Skip to content

Commit 2872d7d

Browse files
chanceaclarkclaude
andcommitted
feat(cli): LTRAC-612 show global options in subcommand help
Apply `.configureHelp({ showGlobalOptions: true })` to every Command and subcommand so `catalyst <command> --help` surfaces the root-level `--env-path` option (and other globals) under a "Global Options" section. Previously these were only visible on `catalyst --help`. Refs LTRAC-612 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 591d7b8 commit 2872d7d

10 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bigcommerce/catalyst": patch
3+
---
4+
5+
Show the global `--env-path` option in every subcommand's `--help` output.

packages/catalyst/src/cli/commands/auth.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async function fetchStoreProfile(storeHash: string, accessToken: string, apiHost
3939
}
4040

4141
const whoami = new Command('whoami')
42+
.configureHelp({ showGlobalOptions: true })
4243
.description('Verify stored credentials and display store/project info.')
4344
.addHelpText(
4445
'after',
@@ -119,6 +120,7 @@ Example:
119120
});
120121

121122
const login = new Command('login')
123+
.configureHelp({ showGlobalOptions: true })
122124
.description(
123125
'Authenticate via browser using the OAuth device code flow. If already logged in, displays current credentials and suggests running `catalyst auth logout` to re-authenticate.',
124126
)
@@ -204,6 +206,7 @@ Examples:
204206
});
205207

206208
const logout = new Command('logout')
209+
.configureHelp({ showGlobalOptions: true })
207210
.description('Remove stored credentials for the current project.')
208211
.addHelpText(
209212
'after',
@@ -239,6 +242,7 @@ Example:
239242
});
240243

241244
export const auth = new Command('auth')
245+
.configureHelp({ showGlobalOptions: true })
242246
.description('Manage authentication for the BigCommerce CLI.')
243247
.addCommand(whoami)
244248
.addCommand(login)

packages/catalyst/src/cli/commands/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export async function buildCatalystProject(projectUuid: string): Promise<void> {
7676
}
7777

7878
export const build = new Command('build')
79+
.configureHelp({ showGlobalOptions: true })
7980
.description(
8081
'Build your Catalyst project using the OpenNext/Cloudflare build pipeline. Also runs a Wrangler dry-run to generate deployment artifacts.',
8182
)

packages/catalyst/src/cli/commands/deploy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ export const fetchProject = async (
369369
};
370370

371371
export const deploy = new Command('deploy')
372+
.configureHelp({ showGlobalOptions: true })
372373
.description('Deploy your application to Cloudflare.')
373374
.addHelpText(
374375
'after',

packages/catalyst/src/cli/commands/logs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export const tailLogs = async (
232232
};
233233

234234
const tail = new Command('tail')
235+
.configureHelp({ showGlobalOptions: true })
235236
.description('Tail live logs from your deployed application.')
236237
.addHelpText(
237238
'after',
@@ -274,6 +275,7 @@ Examples:
274275
});
275276

276277
const query = new Command('query')
278+
.configureHelp({ showGlobalOptions: true })
277279
.description('Query historical logs from your deployed application.')
278280
.addHelpText(
279281
'after',
@@ -292,6 +294,7 @@ Example:
292294
});
293295

294296
export const logs = new Command('logs')
297+
.configureHelp({ showGlobalOptions: true })
295298
.description('View logs from your deployed application.')
296299
.addCommand(tail, { isDefault: true })
297300
.addCommand(query);

packages/catalyst/src/cli/commands/project.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { resolveCredentials } from '../lib/resolve-credentials';
77
import { getTelemetry } from '../lib/telemetry';
88

99
const list = new Command('list')
10+
.configureHelp({ showGlobalOptions: true })
1011
.description('List BigCommerce infrastructure projects for your store.')
1112
.addHelpText(
1213
'after',
@@ -59,6 +60,7 @@ Example:
5960
});
6061

6162
const create = new Command('create')
63+
.configureHelp({ showGlobalOptions: true })
6264
.description(
6365
'Create a new BigCommerce infrastructure project and link it to your local Catalyst project.',
6466
)
@@ -110,6 +112,7 @@ Example:
110112
});
111113

112114
export const link = new Command('link')
115+
.configureHelp({ showGlobalOptions: true })
113116
.description(
114117
'Link your local Catalyst project to a BigCommerce infrastructure project. You can provide a project UUID directly, or fetch and select from available projects using your store credentials.',
115118
)
@@ -221,6 +224,7 @@ Examples:
221224
});
222225

223226
export const project = new Command('project')
227+
.configureHelp({ showGlobalOptions: true })
224228
.description('Manage your BigCommerce infrastructure project.')
225229
.addCommand(create)
226230
.addCommand(list)

packages/catalyst/src/cli/commands/start.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { join, relative } from 'node:path';
66
import { consola } from '../lib/logger';
77

88
export const start = new Command('start')
9+
.configureHelp({ showGlobalOptions: true })
910
.description(
1011
'Start a local preview of your Catalyst storefront using the OpenNext Cloudflare adapter.',
1112
)

packages/catalyst/src/cli/commands/telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const telemetryService = getTelemetry();
88
let isEnabled = telemetryService.isEnabled();
99

1010
export const telemetry = new Command('telemetry')
11+
.configureHelp({ showGlobalOptions: true })
1112
.description(
1213
'View or change CLI telemetry collection status. Enabling telemetry helps BigCommerce support diagnose and troubleshoot errors you encounter when using the CLI.',
1314
)

packages/catalyst/src/cli/commands/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PACKAGE_INFO from '../../../package.json';
44
import { consola } from '../lib/logger';
55

66
export const version = new Command('version')
7+
.configureHelp({ showGlobalOptions: true })
78
.description('Display detailed version information.')
89
.addHelpText(
910
'after',

packages/catalyst/src/cli/program.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ program
2828
.description(
2929
'CLI tool for Catalyst development.\n\nConfiguration priority: flags > env file (--env-path) > process.env > .bigcommerce/project.json.\nRun `catalyst <command> --help` for details on a specific command.',
3030
)
31+
.configureHelp({ showGlobalOptions: true })
3132
.addOption(
3233
new Option(
3334
'--env-path <path>',

0 commit comments

Comments
 (0)