Skip to content

Commit 7928b5c

Browse files
authored
fix(help): include request-timeout in global flag guidance (#41)
1 parent 9a8a5cd commit 7928b5c

4 files changed

Lines changed: 32 additions & 18 deletions

File tree

src/lib/output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export type OutputMode = 'json' | 'text';
33
/**
44
* Help-text footer pointing at the global options surface so users
55
* looking at any subcommand `--help` don't miss `--dry-run`, `--output`,
6-
* `--profile`, `--endpoint-url`, `--debug`.
6+
* `--profile`, `--endpoint-url`, `--request-timeout`, `--debug`.
77
*/
88
export const GLOBAL_OPTS_HINT =
9-
'\nGlobal options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):' +
9+
'\nGlobal options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):' +
1010
'\n testsprite --help';
1111

1212
export function isOutputMode(value: unknown): value is OutputMode {

src/lib/render-error.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ describe('rephraseUnknownOption', () => {
3737
expect(result).toContain('--endpoint-url');
3838
});
3939

40+
it('rephrases --request-timeout placed after subcommand', () => {
41+
const result = rephraseUnknownOption("error: unknown option '--request-timeout'");
42+
expect(result).not.toBeNull();
43+
expect(result).toContain('--request-timeout');
44+
});
45+
4046
it('rephrases --debug placed after subcommand', () => {
4147
const result = rephraseUnknownOption("error: unknown option '--debug'");
4248
expect(result).not.toBeNull();
@@ -87,6 +93,12 @@ describe('rephraseUnknownOption', () => {
8793
expect(result).not.toBeNull();
8894
expect(result).toContain('testsprite --endpoint-url <value> <subcommand>');
8995
});
96+
97+
it('value flag (--request-timeout) example DOES include a <value> placeholder', () => {
98+
const result = rephraseUnknownOption("error: unknown option '--request-timeout'");
99+
expect(result).not.toBeNull();
100+
expect(result).toContain('testsprite --request-timeout <value> <subcommand>');
101+
});
90102
});
91103

92104
describe('renderCommanderError', () => {

src/lib/render-error.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import type { OutputMode } from './output.js';
1111
*
1212
* `boolean` flags (--dry-run, --debug, --verbose) take no value; emit
1313
* example without a placeholder. `value` flags (--output, --profile,
14-
* --endpoint-url) take a single argument; emit example with `<value>`.
14+
* --endpoint-url, --request-timeout) take a single argument; emit example
15+
* with `<value>`.
1516
*/
1617
const GLOBAL_FLAG_ARITY: Record<string, 'boolean' | 'value'> = {
1718
'dry-run': 'boolean',
1819
output: 'value',
1920
profile: 'value',
2021
'endpoint-url': 'value',
22+
'request-timeout': 'value',
2123
debug: 'boolean',
2224
verbose: 'boolean',
2325
};

test/__snapshots__/help.snapshot.test.ts.snap

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Options:
3636
destroyed.
3737
-h, --help display help for command
3838
39-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
39+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
4040
testsprite --help
4141
"
4242
`;
@@ -49,7 +49,7 @@ List supported agent targets and skills, their status, and landing paths
4949
Options:
5050
-h, --help display help for command
5151
52-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
52+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
5353
testsprite --help
5454
"
5555
`;
@@ -86,7 +86,7 @@ exports[`--help snapshots > auth logout 1`] = `
8686
Options:
8787
-h, --help display help for command
8888
89-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
89+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
9090
testsprite --help
9191
"
9292
`;
@@ -97,7 +97,7 @@ exports[`--help snapshots > auth whoami 1`] = `
9797
Options:
9898
-h, --help display help for command
9999
100-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
100+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
101101
testsprite --help
102102
"
103103
`;
@@ -153,7 +153,7 @@ Get a project by id
153153
Options:
154154
-h, --help display help for command
155155
156-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
156+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
157157
testsprite --help
158158
"
159159
`;
@@ -175,7 +175,7 @@ Options:
175175
--max-items <n> stop after this many items across auto-paged pages
176176
-h, --help display help for command
177177
178-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
178+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
179179
testsprite --help
180180
"
181181
`;
@@ -280,7 +280,7 @@ Options:
280280
source body; json mode: wire envelope)
281281
-h, --help display help for command
282282
283-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
283+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
284284
testsprite --help
285285
"
286286
`;
@@ -315,7 +315,7 @@ Options:
315315
per invocation; pin one yourself for safe retries.
316316
-h, --help display help for command
317317
318-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
318+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
319319
testsprite --help
320320
"
321321
`;
@@ -331,7 +331,7 @@ Options:
331331
--failed-only Keep only the failed step plus its immediate neighbors (±1)
332332
-h, --help display help for command
333333
334-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
334+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
335335
testsprite --help
336336
"
337337
`;
@@ -344,7 +344,7 @@ Get a test by id
344344
Options:
345345
-h, --help display help for command
346346
347-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
347+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
348348
testsprite --help
349349
"
350350
`;
@@ -369,7 +369,7 @@ Options:
369369
--max-items <n> stop after this many items across auto-paged pages
370370
-h, --help display help for command
371371
372-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
372+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
373373
testsprite --help
374374
"
375375
`;
@@ -433,7 +433,7 @@ Dry-run shape notes:
433433
omit \`closure\` (or return it as null) since there is no dependency expansion.
434434
• \`autoHeal\` defaults true for FE reruns; BE reruns ignore the field entirely.
435435
436-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
436+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
437437
testsprite --help
438438
"
439439
`;
@@ -465,7 +465,7 @@ Options:
465465
--cursor <token> with --history: opaque cursor from a prior page
466466
-h, --help display help for command
467467
468-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
468+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
469469
testsprite --help
470470
"
471471
`;
@@ -516,7 +516,7 @@ Dependency-aware fresh run (M4):
516516
BE tests can declare --produces/--needs at create time to drive wave ordering
517517
(see \`testsprite test create --help\` for details).
518518
519-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
519+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
520520
testsprite --help
521521
"
522522
`;
@@ -539,7 +539,7 @@ Options:
539539
excluded when this flag is set.
540540
-h, --help display help for command
541541
542-
Global options (--dry-run, --output, --profile, --endpoint-url, --verbose, --debug):
542+
Global options (--dry-run, --output, --profile, --endpoint-url, --request-timeout, --verbose, --debug):
543543
testsprite --help
544544
"
545545
`;

0 commit comments

Comments
 (0)