Skip to content

Commit 85f75a0

Browse files
committed
[CLI]: Fact check and complete the command help (#2901)
Synced from monorepo@d4d8591dd48b3dee1e3960d08b80199e73d3bb58
1 parent 18f5a32 commit 85f75a0

22 files changed

Lines changed: 204 additions & 203 deletions

File tree

.sync-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
211363ac9fc3e3ecd8ce98c6a2037923b28e7cf1
1+
d4d8591dd48b3dee1e3960d08b80199e73d3bb58

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
"yaml": "2.9.0",
3737
"zod": "4.4.3",
3838
"zod-config": "1.4.0",
39-
"@xata.io/lang": "0.0.4",
40-
"@xata.io/pgroll": "0.9.1",
41-
"@xata.io/config": "0.0.9",
42-
"@xata.io/sql": "0.2.4",
4339
"@xata.io/ai": "0.1.1",
4440
"@xata.io/api": "0.1.8",
45-
"@xata.io/tsconfig": "0.0.2",
41+
"@xata.io/config": "0.0.9",
42+
"@xata.io/lang": "0.0.4",
43+
"@xata.io/pgroll": "0.9.1",
4644
"@xata.io/pgstream": "0.2.3",
47-
"@xata.io/utils": "0.1.3"
45+
"@xata.io/sql": "0.2.4",
46+
"@xata.io/utils": "0.1.3",
47+
"@xata.io/tsconfig": "0.0.2"
4848
},
4949
"scripts": {
5050
"dev": "bun src/bin/cli.ts",

pnpm-lock.yaml

Lines changed: 168 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/auth/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const AuthLoginCommand = buildCommand({
113113
docs: {
114114
brief: `Log in to a ${PRODUCT_NAME} account`,
115115
fullDescription:
116-
'Opens the device flow in a browser, or stores an API key with --api-key for non-interactive use. The issuer, API URL and client flags point the CLI at a deployment other than production, which is what Enterprise customers running their own cloud need.',
116+
'Prints a URL and a code to authorize this machine, or stores an API key with `--api-key` for non-interactive use. The issuer, API URL and client flags log in against a deployment other than production, which is how Enterprise customers connect the CLI to a custom deployment in their own cloud. Omit them and the CLI uses the default production values.',
117117
customUsage: [
118118
{ input: '--api-key xau_...', brief: 'Log in from a script or CI' },
119119
{ input: '--profile staging', brief: 'Log in as another profile' },

src/commands/branch/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ export const BranchCreateCommand = buildCommand({
403403
docs: {
404404
brief: 'Create a new branch',
405405
fullDescription:
406-
'A branch is a running Postgres database that starts as a copy of its parent. It takes a moment to come up, so `xata branch wait-ready` is what to run before connecting to it. Creating a branch in a folder linked to a project also checks it out.',
406+
'A branch is a running Postgres database that starts as a copy of its parent. It takes a moment to come up, so `xata branch wait-ready` is what to run before connecting to it. It is checked out afterwards when this folder already has an organization, project and branch to work from.',
407407
customUsage: [
408408
{ input: '--name my-branch', brief: 'Branch the current branch' },
409409
{ input: '--name my-branch --parent-branch <branch-id>', brief: 'Branch another branch' },

src/commands/branch/delete.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ export async function implementation(this: LocalContext, flags: Flags, branchNam
6060
export const BranchDeleteCommand = buildCommand({
6161
docs: {
6262
brief: 'Delete a branch',
63-
fullDescription:
64-
'Deleting a branch destroys its database and cannot be undone. The branch checked out in this folder cannot be deleted, and outside an interactive terminal the confirmation has to come from `--yes`.',
63+
fullDescription: [
64+
'The branch checked out in this folder cannot be deleted, and outside an interactive terminal the confirmation has to come from `--yes`.',
65+
'Warning: deleting a branch destroys its database and cannot be undone.'
66+
].join('\n'),
6567
customUsage: [
6668
{ input: 'my-branch', brief: 'Delete a branch, asking for confirmation' },
6769
{ input: 'my-branch --yes', brief: 'Delete a branch from a script' }

src/commands/branch/logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export const BranchLogsCommand = buildCommand({
338338
docs: {
339339
brief: 'Retrieve the PostgreSQL logs of a branch',
340340
fullDescription:
341-
'Reads the logs of every instance of the branch, the primary and any replicas, which is where slow queries, connection issues and replication problems show up. Requires the `logs:read` scope on the API key. Of the output formats, `raw` prints `<timestamp> [<level> <instanceID> <process>] <message>` per line, `json` a single array, `ndjson` one object per line for streaming into another process, and `csv` the columns `timestamp,level,instanceID,process,message`. Follow mode polls every 2 seconds with a 5 second overlap and de-duplicates entries. Logs can contain connection strings and other credentials.',
341+
'Reads the logs of every instance of the branch, the primary and any replicas, which is where slow queries, connection issues and replication problems show up. Requires the `logs:read` scope on the API key. Of the output formats, `raw` prints `<timestamp> [<level> <instanceID> <process>] <message>` per line, `json` a single array, `ndjson` one object per line for streaming into another process, and `csv` the columns `timestamp,level,instanceID,process,message`. Follow mode polls every 2 seconds with a 5 second overlap and de-duplicates entries. Logs can contain connection strings and other credentials, see https://xata.io/docs/platform/logs for what is redacted.',
342342
customUsage: [
343343
{ input: 'my-branch --level error --start 15m', brief: 'Errors from the last 15 minutes' },
344344
{

src/commands/branch/query-insights/enable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const QueryInsightsEnableCommand = buildCommand({
108108
docs: {
109109
brief: 'Enable pg_stat_statements for query insights on a branch',
110110
fullDescription:
111-
'Creates the `pg_stat_statements` extension and adds it to the preloaded libraries, which needs a branch restart: wait for it with `xata branch wait-ready <branch> --wake`. Operations that rebuild a branch, such as a migration into it, can drop the extension, so run this again if query insights stop returning rows.'
111+
'Adds `pg_stat_statements` to the preloaded libraries, which restarts the branch, and creates the extension. Run it, wait for the branch with `xata branch wait-ready <branch> --wake`, then run it again to create the extension. Operations that rebuild a branch, such as a migration into it, can drop the extension, so run this again if query insights stop returning rows. The same can be done from the console, by adding it to the preloaded libraries in the branch settings, see https://xata.io/docs/platform/extensions.'
112112
},
113113
parameters: {
114114
flags: {

src/commands/branch/query-insights/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const BranchQueryInsightsRoute = buildRouteMap({
99
docs: {
1010
brief: 'Inspect query statistics and active queries for a branch',
1111
fullDescription:
12-
'Which statements are slow, which are expensive, and what is running right now. Historical statistics come from `pg_stat_statements`, and the queries running at this moment from `pg_stat_activity`. Running `xata branch qi` without a subcommand is the same as `xata branch qi list`. Except for `active`, which reads `pg_stat_activity`, these commands need `pg_stat_statements` loaded: run `xata branch query-insights enable <branch>` and then wait for the restart with `xata branch wait-ready <branch> --wake`.'
12+
'Which statements are slow, which are expensive, and what is running right now. Historical statistics come from `pg_stat_statements`, and the queries running at this moment from `pg_stat_activity`. Running `xata branch qi` without a subcommand is the same as `xata branch qi list`. Except for `active`, which reads `pg_stat_activity`, these commands need `pg_stat_statements` loaded: run `xata branch query-insights enable <branch>` and then wait for the restart with `xata branch wait-ready <branch> --wake`. Unlike `logs` and `metrics`, which go through the API, these commands open a direct PostgreSQL connection: they cannot run against a branch that is hibernated or still provisioning, and an API key needs the `credentials:read` scope. The console reads the same `pg_stat_statements` data, see https://xata.io/docs/platform/query-insights.'
1313
},
1414
routes: {
1515
list: QueryInsightsListCommand,

src/commands/branch/query-insights/list.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,14 @@ export async function implementation(this: LocalContext, flags: Flags, branchNam
9999

100100
export const QueryInsightsListCommand = buildCommand({
101101
docs: {
102-
brief: 'List historical query statistics for a branch, slowest first',
102+
brief: 'List historical query statistics for a branch, by total execution time',
103103
fullDescription:
104-
'In table output a leading `!` marks a row with a high mean execution time or a low cache hit rate, and the command prints the `show` command for each flagged query. Both `json` and `ndjson` emit `{ "total", "limit", "offset", "queries" }`, with the statements under `queries`.',
104+
'In table output a leading `!` marks a row worth a look, a slow mean, spikes far above it, a low cache hit rate, heavy temporary file use or a very large row count, and the command prints the `show` command for each flagged query. Below the table it prints how many queries are being shown and, when more remain, the `list` command that fetches the next page. Both `json` and `ndjson` emit `{ "total", "limit", "offset", "queries" }`, with the statements under `queries`.',
105105
customUsage: [
106106
{
107107
input: 'my-branch --performance slow --sort mean-time',
108108
brief: 'The slowest statements by average execution time'
109109
},
110-
{
111-
input: 'xata branch qi my-branch --sort mean-time',
112-
brief: 'Same thing, through the alias and default subcommand'
113-
},
114110
{
115111
input: `my-branch --limit 100 --output ndjson | jq -r '.queries[].query'`,
116112
brief: 'Feed the top 100 statements to another process'

0 commit comments

Comments
 (0)