@testsprite/testsprite-cli 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +34 -26
  2. package/dist/commands/agent.d.ts +52 -0
  3. package/dist/commands/agent.js +341 -93
  4. package/dist/commands/auth.js +29 -27
  5. package/dist/commands/doctor.d.ts +49 -0
  6. package/dist/commands/doctor.js +211 -0
  7. package/dist/commands/init.d.ts +7 -1
  8. package/dist/commands/init.js +66 -26
  9. package/dist/commands/project.d.ts +50 -1
  10. package/dist/commands/project.js +257 -43
  11. package/dist/commands/test.d.ts +214 -12
  12. package/dist/commands/test.js +1310 -174
  13. package/dist/commands/usage.js +13 -12
  14. package/dist/index.js +71 -18
  15. package/dist/lib/agent-targets.d.ts +169 -22
  16. package/dist/lib/agent-targets.js +335 -34
  17. package/dist/lib/bundle.d.ts +51 -1
  18. package/dist/lib/bundle.js +146 -55
  19. package/dist/lib/client-factory.d.ts +43 -0
  20. package/dist/lib/client-factory.js +89 -2
  21. package/dist/lib/config.d.ts +2 -0
  22. package/dist/lib/config.js +11 -2
  23. package/dist/lib/credentials.d.ts +7 -0
  24. package/dist/lib/credentials.js +40 -1
  25. package/dist/lib/dry-run/samples.d.ts +5 -0
  26. package/dist/lib/dry-run/samples.js +54 -9
  27. package/dist/lib/flaky.d.ts +80 -0
  28. package/dist/lib/flaky.js +76 -0
  29. package/dist/lib/http.d.ts +20 -0
  30. package/dist/lib/http.js +216 -132
  31. package/dist/lib/interrupt.d.ts +61 -0
  32. package/dist/lib/interrupt.js +97 -0
  33. package/dist/lib/junit-report.d.ts +58 -0
  34. package/dist/lib/junit-report.js +210 -0
  35. package/dist/lib/output.d.ts +16 -1
  36. package/dist/lib/output.js +24 -2
  37. package/dist/lib/pagination.d.ts +4 -3
  38. package/dist/lib/pagination.js +34 -6
  39. package/dist/lib/prompt.js +52 -8
  40. package/dist/lib/proxy.d.ts +29 -0
  41. package/dist/lib/proxy.js +30 -0
  42. package/dist/lib/render-error.d.ts +13 -0
  43. package/dist/lib/render-error.js +30 -7
  44. package/dist/lib/skill-nudge.d.ts +2 -2
  45. package/dist/lib/skill-nudge.js +13 -4
  46. package/dist/lib/target-url.js +8 -1
  47. package/dist/lib/ticker.d.ts +11 -1
  48. package/dist/lib/ticker.js +33 -1
  49. package/dist/lib/update-check.d.ts +67 -0
  50. package/dist/lib/update-check.js +246 -0
  51. package/dist/version-guard.d.ts +33 -0
  52. package/dist/version-guard.js +39 -0
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/package.json +3 -2
  56. package/skills/testsprite-onboard.skill.md +183 -0
  57. package/skills/testsprite-verify.codex.md +2 -0
  58. package/skills/testsprite-verify.skill.md +52 -1
@@ -1,20 +1,20 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import { Command } from 'commander';
4
- import { makeHttpClient, } from '../lib/client-factory.js';
4
+ import { emitDryRunBanner, makeHttpClient, parseRequestTimeoutFlag, } from '../lib/client-factory.js';
5
5
  import { ApiError } from '../lib/errors.js';
6
- import { GLOBAL_OPTS_HINT, Output } from '../lib/output.js';
6
+ import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
7
7
  import { assertNotLocal } from '../lib/target-url.js';
8
8
  import { assertIdempotencyKey } from '../lib/validate.js';
9
9
  import { fetchSinglePage, paginate, validatePaginationFlags, } from '../lib/pagination.js';
10
10
  export async function runList(opts, deps = {}) {
11
11
  const out = makeOutput(opts.output, deps);
12
- const client = makeClient(opts, deps);
13
12
  const paginationFlags = validatePaginationFlags({
14
13
  pageSize: opts.pageSize,
15
14
  startingToken: opts.startingToken,
16
15
  maxItems: opts.maxItems,
17
16
  });
17
+ const client = makeClient(opts, deps);
18
18
  // When the user explicitly passed a page-size flag and did NOT ask
19
19
  // for --max-items, treat that as a "give me one page and the cursor"
20
20
  // request — same shape AWS CLI ships. Otherwise auto-page.
@@ -49,7 +49,15 @@ export async function runCreate(opts, deps = {}) {
49
49
  // (exit 10 UNAVAILABLE) — fail fast with a clear exit 5 instead.
50
50
  assertIdempotencyKey(opts.idempotencyKey);
51
51
  // P1-3: client-side length checks matching server limits.
52
- if (opts.name !== undefined && opts.name.length > 200) {
52
+ // Whitespace-only / empty rejection (parity with `test create`'s requireString;
53
+ // a truthy `--name " "` otherwise creates a blank-named project on the backend).
54
+ if (opts.name === undefined || opts.name.trim().length === 0) {
55
+ throw localValidationError('--name is required and must not be empty or whitespace-only');
56
+ }
57
+ if (opts.password !== undefined && opts.password.trim().length === 0) {
58
+ throw localValidationError('--password must not be empty or whitespace-only');
59
+ }
60
+ if (opts.name.length > 200) {
53
61
  throw localValidationError('--name must be at most 200 characters');
54
62
  }
55
63
  if (opts.description !== undefined && opts.description.length > 2000) {
@@ -64,6 +72,9 @@ export async function runCreate(opts, deps = {}) {
64
72
  throw localValidationError('--url is required for --type frontend');
65
73
  }
66
74
  if (opts.dryRun) {
75
+ // DEV-247: this path returns before makeClient() fires the banner, so emit it
76
+ // here — otherwise the canned sample can be mistaken for a live response.
77
+ emitDryRunBanner(stderr);
67
78
  const idempotencyKey = opts.idempotencyKey ?? `cli-proj-create-${randomUUID()}`;
68
79
  // P2-6: gate idempotency-key output behind --verbose/--debug/json (matches
69
80
  // test create convention). Suppress in plain text interactive mode to reduce
@@ -116,34 +127,38 @@ export async function runUpdate(opts, deps = {}) {
116
127
  // P1-2: validate idempotency key before sending as an HTTP header.
117
128
  assertIdempotencyKey(opts.idempotencyKey);
118
129
  // P1-3: client-side length checks matching server limits.
119
- if (opts.name !== undefined && opts.name.length > 200) {
120
- throw localValidationError('--name must be at most 200 characters');
130
+ // Reject a whitespace-only `--name` on update too (parity with create); name
131
+ // stays optional here, so only validate when the flag is supplied.
132
+ if (opts.name !== undefined && opts.name.trim().length === 0) {
133
+ throw localValidationError('--name must not be empty or whitespace-only');
121
134
  }
122
- if (opts.description !== undefined && opts.description.length > 2000) {
123
- throw localValidationError('--description must be at most 2000 characters');
135
+ if (opts.password !== undefined && opts.password.trim().length === 0) {
136
+ throw localValidationError('--password must not be empty or whitespace-only');
124
137
  }
125
- // Resolve password
126
- let password = opts.password;
127
- if (password === undefined && opts.passwordFile !== undefined) {
128
- password = readFileSync(opts.passwordFile, 'utf8').trim();
138
+ if (opts.name !== undefined && opts.name.length > 200) {
139
+ throw localValidationError('--name must be at most 200 characters');
129
140
  }
130
141
  // P2-7: guard --url against localhost/RFC1918/non-http(s).
131
142
  if (opts.targetUrl !== undefined) {
132
143
  assertNotLocal(opts.targetUrl);
133
144
  }
145
+ const passwordSupplied = opts.password !== undefined || opts.passwordFile !== undefined;
134
146
  const mutableFields = {
135
- name: opts.name,
136
- targetUrl: opts.targetUrl,
137
- username: opts.username,
138
- password,
139
- description: opts.description,
140
- instruction: opts.instruction,
147
+ name: opts.name !== undefined,
148
+ targetUrl: opts.targetUrl !== undefined,
149
+ username: opts.username !== undefined,
150
+ password: passwordSupplied,
151
+ instruction: opts.instruction !== undefined,
141
152
  };
142
- const presentFields = Object.entries(mutableFields).filter(([, v]) => v !== undefined);
143
- if (presentFields.length === 0) {
144
- throw localValidationError('At least one mutable flag is required: --name, --url, --username, --password/--password-file, --description, or --instruction.');
153
+ const presentFieldNames = Object.entries(mutableFields)
154
+ .filter(([, present]) => present)
155
+ .map(([field]) => field);
156
+ if (presentFieldNames.length === 0) {
157
+ throw localValidationError('At least one mutable flag is required: --name, --url, --username, --password/--password-file, or --instruction.');
145
158
  }
146
159
  if (opts.dryRun) {
160
+ // DEV-247: emit the banner here (this path returns before makeClient() does).
161
+ emitDryRunBanner(stderr);
147
162
  const idempotencyKey = opts.idempotencyKey ?? `cli-proj-update-${randomUUID()}`;
148
163
  if (opts.idempotencyKey === undefined &&
149
164
  (opts.output === 'json' || opts.verbose || opts.debug)) {
@@ -151,17 +166,30 @@ export async function runUpdate(opts, deps = {}) {
151
166
  }
152
167
  const sample = {
153
168
  id: opts.projectId,
154
- updatedFields: presentFields.map(([k]) => k),
169
+ updatedFields: presentFieldNames,
155
170
  updatedAt: '2026-05-16T00:00:00.000Z',
156
171
  };
157
172
  out.print(sample, data => renderUpdateText(data));
158
173
  return sample;
159
174
  }
175
+ // Resolve password only on the real path. Dry-run must not touch the
176
+ // filesystem, even when --password-file is present.
177
+ let password = opts.password;
178
+ if (password === undefined && opts.passwordFile !== undefined) {
179
+ password = readFileSync(opts.passwordFile, 'utf8').trim();
180
+ }
160
181
  const idempotencyKey = opts.idempotencyKey ?? `cli-proj-update-${randomUUID()}`;
161
182
  if (opts.idempotencyKey === undefined && (opts.output === 'json' || opts.verbose || opts.debug)) {
162
183
  stderr(`idempotency-key: ${idempotencyKey}`);
163
184
  }
164
- const body = Object.fromEntries(presentFields);
185
+ const bodyFields = {
186
+ name: opts.name,
187
+ targetUrl: opts.targetUrl,
188
+ username: opts.username,
189
+ password,
190
+ instruction: opts.instruction,
191
+ };
192
+ const body = Object.fromEntries(Object.entries(bodyFields).filter(([, v]) => v !== undefined));
165
193
  const client = makeClient(opts, deps);
166
194
  const updated = await client.patch(`/projects/${encodeURIComponent(opts.projectId)}`, {
167
195
  body,
@@ -170,6 +198,136 @@ export async function runUpdate(opts, deps = {}) {
170
198
  out.print(updated, data => renderUpdateText(data));
171
199
  return updated;
172
200
  }
201
+ // ---------------------------------------------------------------------------
202
+ // project credential — set the static backend credential
203
+ // ---------------------------------------------------------------------------
204
+ const CLI_AUTH_TYPES = ['public', 'Bearer token', 'API key', 'basic token'];
205
+ export async function runCredential(opts, deps = {}) {
206
+ const out = makeOutput(opts.output, deps);
207
+ const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
208
+ assertIdempotencyKey(opts.idempotencyKey);
209
+ if (!CLI_AUTH_TYPES.includes(opts.authType)) {
210
+ throw localValidationError(`--type must be one of: ${CLI_AUTH_TYPES.join(', ')}`);
211
+ }
212
+ // Resolve the credential value (flag or file). Required for every type
213
+ // except `public` (which clears it).
214
+ let credential = opts.credential;
215
+ if (credential === undefined && opts.credentialFile !== undefined) {
216
+ credential = readFileSync(opts.credentialFile, 'utf8').trim();
217
+ }
218
+ if (opts.authType !== 'public' && (credential === undefined || credential === '')) {
219
+ throw localValidationError('--credential (or --credential-file) is required unless --type is "public"');
220
+ }
221
+ const body = { authType: opts.authType };
222
+ if (opts.authType !== 'public' && credential !== undefined)
223
+ body.credential = credential;
224
+ const idempotencyKey = opts.idempotencyKey ?? `cli-proj-cred-${randomUUID()}`;
225
+ if (opts.idempotencyKey === undefined && (opts.output === 'json' || opts.verbose || opts.debug)) {
226
+ stderr(`idempotency-key: ${idempotencyKey}`);
227
+ }
228
+ if (opts.dryRun) {
229
+ const sample = {
230
+ projectId: opts.projectId,
231
+ authType: opts.authType,
232
+ rewroteCount: 0,
233
+ };
234
+ out.print(sample, data => renderCredentialText(data));
235
+ return sample;
236
+ }
237
+ const client = makeClient(opts, deps);
238
+ const res = await client.put(`/projects/${encodeURIComponent(opts.projectId)}/credential`, { body, headers: { 'idempotency-key': idempotencyKey } });
239
+ out.print(res, data => renderCredentialText(data));
240
+ return res;
241
+ }
242
+ function renderCredentialText(r) {
243
+ return [
244
+ `projectId ${r.projectId}`,
245
+ `authType ${r.authType}`,
246
+ `rewroteCount ${r.rewroteCount}`,
247
+ ].join('\n');
248
+ }
249
+ // ---------------------------------------------------------------------------
250
+ // project auto-auth — configure the recurring-token (auto-refresh) login
251
+ // ---------------------------------------------------------------------------
252
+ const AUTO_AUTH_METHODS = ['password', 'refresh_token', 'aws_cognito_refresh'];
253
+ const AUTO_AUTH_INJECTS = ['bearer', 'header', 'cookie'];
254
+ export async function runAutoAuth(opts, deps = {}) {
255
+ const out = makeOutput(opts.output, deps);
256
+ const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
257
+ assertIdempotencyKey(opts.idempotencyKey);
258
+ if (!AUTO_AUTH_METHODS.includes(opts.method)) {
259
+ throw localValidationError(`--method must be one of: ${AUTO_AUTH_METHODS.join(', ')}`);
260
+ }
261
+ if (!AUTO_AUTH_INJECTS.includes(opts.inject)) {
262
+ throw localValidationError(`--inject must be one of: ${AUTO_AUTH_INJECTS.join(', ')}`);
263
+ }
264
+ // Resolve secrets from --*-file variants so they stay out of shell history.
265
+ const password = opts.password ??
266
+ (opts.passwordFile !== undefined ? readFileSync(opts.passwordFile, 'utf8').trim() : undefined);
267
+ const clientSecret = opts.clientSecret ??
268
+ (opts.clientSecretFile !== undefined
269
+ ? readFileSync(opts.clientSecretFile, 'utf8').trim()
270
+ : undefined);
271
+ const refreshToken = opts.refreshToken ??
272
+ (opts.refreshTokenFile !== undefined
273
+ ? readFileSync(opts.refreshTokenFile, 'utf8').trim()
274
+ : undefined);
275
+ const enabled = opts.disable !== true;
276
+ const body = { enabled, method: opts.method, inject: opts.inject };
277
+ const maybe = (k, v) => {
278
+ if (v !== undefined)
279
+ body[k] = v;
280
+ };
281
+ maybe('injectKey', opts.injectKey);
282
+ maybe('loginUrl', opts.loginUrl);
283
+ maybe('loginMethod', opts.loginMethod);
284
+ maybe('loginContentType', opts.loginContentType);
285
+ maybe('loginBodyTemplate', opts.loginBodyTemplate);
286
+ maybe('username', opts.username);
287
+ maybe('password', password);
288
+ maybe('tokenPath', opts.tokenPath);
289
+ maybe('tokenEndpoint', opts.tokenEndpoint);
290
+ maybe('clientId', opts.clientId);
291
+ maybe('clientSecret', clientSecret);
292
+ maybe('refreshToken', refreshToken);
293
+ maybe('scope', opts.scope);
294
+ maybe('region', opts.region);
295
+ const idempotencyKey = opts.idempotencyKey ?? `cli-proj-autoauth-${randomUUID()}`;
296
+ if (opts.idempotencyKey === undefined && (opts.output === 'json' || opts.verbose || opts.debug)) {
297
+ stderr(`idempotency-key: ${idempotencyKey}`);
298
+ }
299
+ if (opts.dryRun) {
300
+ const sample = {
301
+ projectId: opts.projectId,
302
+ enabled,
303
+ method: opts.method,
304
+ inject: opts.inject,
305
+ };
306
+ out.print(sample, data => renderAutoAuthText(data));
307
+ return sample;
308
+ }
309
+ const client = makeClient(opts, deps);
310
+ const res = await client.put(`/projects/${encodeURIComponent(opts.projectId)}/auto-auth`, { body, headers: { 'idempotency-key': idempotencyKey } });
311
+ out.print(res, data => renderAutoAuthText(data));
312
+ return res;
313
+ }
314
+ function renderAutoAuthText(r) {
315
+ const lines = [
316
+ `projectId ${r.projectId}`,
317
+ `enabled ${r.enabled}`,
318
+ `method ${r.method}`,
319
+ `inject ${r.inject}`,
320
+ ];
321
+ if (r.lastRefreshError) {
322
+ lines.push(`lastRefreshError ${r.lastRefreshError}`);
323
+ }
324
+ // A disabled result after a write means the trial login failed — call it out
325
+ // so the user doesn't assume auto-auth is live.
326
+ if (!r.enabled) {
327
+ lines.push('note auto-auth was stored but is DISABLED — the trial login failed. Fix the credentials (e.g. a valid refresh token) and re-run.');
328
+ }
329
+ return lines.join('\n');
330
+ }
173
331
  export function createProjectCommand(deps = {}) {
174
332
  const project = new Command('project').description('Manage TestSprite projects');
175
333
  project
@@ -250,7 +408,6 @@ export function createProjectCommand(deps = {}) {
250
408
  .option('--username <user>', 'new auth username')
251
409
  .option('--password <pw>', 'new auth password')
252
410
  .option('--password-file <path>', 'read new password from file')
253
- .option('--description <text>', 'new description')
254
411
  .option('--instruction <text>', 'new FE plan-gen instruction hint')
255
412
  .option('--idempotency-key <token>', 'opaque idempotency token. Defaults to a UUIDv4 minted per invocation.')
256
413
  .addHelpText('after', GLOBAL_OPTS_HINT)
@@ -263,11 +420,85 @@ export function createProjectCommand(deps = {}) {
263
420
  username: cmdOpts.username,
264
421
  password: cmdOpts.password,
265
422
  passwordFile: cmdOpts.passwordFile,
266
- description: cmdOpts.description,
267
423
  instruction: cmdOpts.instruction,
268
424
  idempotencyKey: cmdOpts.idempotencyKey,
269
425
  }, deps);
270
426
  });
427
+ project
428
+ .command('credential <project-id>')
429
+ .description('Set the static backend credential injected into every backend test\n' +
430
+ '(Bearer token / API key / Basic token / public). Free tier.')
431
+ .requiredOption('--type <type>', 'public | "Bearer token" | "API key" | "basic token"')
432
+ .option('--credential <value>', 'credential value (required unless --type public)')
433
+ .option('--credential-file <path>', 'read the credential value from a file')
434
+ .option('--idempotency-key <token>', 'opaque idempotency token. Defaults to a UUIDv4 minted per invocation.')
435
+ .addHelpText('after', GLOBAL_OPTS_HINT)
436
+ .action(async (projectId, cmdOpts, command) => {
437
+ await runCredential({
438
+ ...resolveCommonOptions(command),
439
+ projectId,
440
+ authType: cmdOpts.type,
441
+ credential: cmdOpts.credential,
442
+ credentialFile: cmdOpts.credentialFile,
443
+ idempotencyKey: cmdOpts.idempotencyKey,
444
+ }, deps);
445
+ });
446
+ project
447
+ .command('auto-auth <project-id>')
448
+ .description('Configure the recurring-token (auto-refresh login) for backend tests (Pro).\n' +
449
+ 'A fresh token is fetched on each run and injected into every backend test.')
450
+ .requiredOption('--method <method>', 'password | refresh_token | aws_cognito_refresh')
451
+ .requiredOption('--inject <where>', 'bearer | header | cookie')
452
+ .option('--disable', 'turn auto-auth off (keeps stored config)')
453
+ .option('--inject-key <name>', 'header/cookie name when --inject is header/cookie')
454
+ // password method
455
+ .option('--login-url <url>', 'login endpoint (method=password)')
456
+ .option('--login-method <verb>', 'POST | PUT (method=password)')
457
+ .option('--login-content-type <ct>', 'application/json | application/x-www-form-urlencoded')
458
+ .option('--login-body-template <tpl>', 'login body template with {{username}}/{{password}}')
459
+ .option('--username <user>', 'login username (method=password)')
460
+ .option('--password <pw>', 'login password (method=password)')
461
+ .option('--password-file <path>', 'read login password from a file')
462
+ .option('--token-path <jsonpath>', 'JSONPath to the token in the login response')
463
+ // refresh_token method
464
+ .option('--token-endpoint <url>', 'OAuth token endpoint (method=refresh_token)')
465
+ .option('--client-id <id>', 'OAuth client id')
466
+ .option('--client-secret <secret>', 'OAuth client secret')
467
+ .option('--client-secret-file <path>', 'read OAuth client secret from a file')
468
+ .option('--refresh-token <token>', 'OAuth/Cognito refresh token')
469
+ .option('--refresh-token-file <path>', 'read the refresh token from a file')
470
+ .option('--scope <scope>', 'OAuth scope')
471
+ // aws_cognito_refresh method
472
+ .option('--region <region>', "AWS region (method=aws_cognito_refresh, e.g. 'us-east-1')")
473
+ .option('--idempotency-key <token>', 'opaque idempotency token. Defaults to a UUIDv4 minted per invocation.')
474
+ .addHelpText('after', GLOBAL_OPTS_HINT)
475
+ .action(async (projectId, cmdOpts, command) => {
476
+ await runAutoAuth({
477
+ ...resolveCommonOptions(command),
478
+ projectId,
479
+ disable: cmdOpts.disable,
480
+ method: cmdOpts.method,
481
+ inject: cmdOpts.inject,
482
+ injectKey: cmdOpts.injectKey,
483
+ loginUrl: cmdOpts.loginUrl,
484
+ loginMethod: cmdOpts.loginMethod,
485
+ loginContentType: cmdOpts.loginContentType,
486
+ loginBodyTemplate: cmdOpts.loginBodyTemplate,
487
+ username: cmdOpts.username,
488
+ password: cmdOpts.password,
489
+ passwordFile: cmdOpts.passwordFile,
490
+ tokenPath: cmdOpts.tokenPath,
491
+ tokenEndpoint: cmdOpts.tokenEndpoint,
492
+ clientId: cmdOpts.clientId,
493
+ clientSecret: cmdOpts.clientSecret,
494
+ clientSecretFile: cmdOpts.clientSecretFile,
495
+ refreshToken: cmdOpts.refreshToken,
496
+ refreshTokenFile: cmdOpts.refreshTokenFile,
497
+ scope: cmdOpts.scope,
498
+ region: cmdOpts.region,
499
+ idempotencyKey: cmdOpts.idempotencyKey,
500
+ }, deps);
501
+ });
271
502
  return project;
272
503
  }
273
504
  function parseFlag(raw, flagName) {
@@ -290,13 +521,9 @@ function parseFlag(raw, flagName) {
290
521
  function resolveCommonOptions(command) {
291
522
  const globals = command.optsWithGlobals();
292
523
  // P2-8: validate --output before allowing silent fallback to 'text'.
293
- const rawOutput = globals.output;
294
- if (rawOutput !== undefined && rawOutput !== 'json' && rawOutput !== 'text') {
295
- throw localValidationError('--output must be one of: json, text');
296
- }
297
524
  return {
298
525
  profile: globals.profile ?? 'default',
299
- output: globals.output ?? 'text',
526
+ output: resolveOutputMode(globals.output),
300
527
  endpointUrl: globals.endpointUrl,
301
528
  debug: globals.debug ?? false,
302
529
  verbose: globals.verbose ?? false,
@@ -304,19 +531,6 @@ function resolveCommonOptions(command) {
304
531
  requestTimeoutMs: parseRequestTimeoutFlag(globals.requestTimeout),
305
532
  };
306
533
  }
307
- /**
308
- * Parse the `--request-timeout <seconds>` flag value into milliseconds.
309
- * Returns `undefined` when the flag was not supplied (factory falls back to
310
- * the env var / default). Silently clamps out-of-range values.
311
- */
312
- function parseRequestTimeoutFlag(raw) {
313
- if (raw === undefined)
314
- return undefined;
315
- const n = Number(raw);
316
- if (!Number.isFinite(n) || n <= 0)
317
- return undefined;
318
- return Math.round(n * 1000); // seconds → milliseconds
319
- }
320
534
  function makeClient(opts, deps) {
321
535
  return makeHttpClient(opts, {
322
536
  env: deps.env,