@testsprite/testsprite-cli 0.15.0 → 0.17.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 (207) hide show
  1. package/README.md +53 -141
  2. package/dist/commands/agent.d.ts +12 -4
  3. package/dist/commands/agent.js +55 -65
  4. package/dist/commands/auth.d.ts +6 -10
  5. package/dist/commands/auth.js +44 -56
  6. package/dist/commands/ci.d.ts +23 -100
  7. package/dist/commands/ci.js +297 -489
  8. package/dist/commands/completion.js +2 -1
  9. package/dist/commands/conversation.d.ts +27 -0
  10. package/dist/commands/conversation.js +702 -0
  11. package/dist/commands/doctor.d.ts +5 -1
  12. package/dist/commands/doctor.js +130 -34
  13. package/dist/commands/init.d.ts +4 -45
  14. package/dist/commands/init.js +116 -68
  15. package/dist/commands/project-env.d.ts +62 -2
  16. package/dist/commands/project-env.js +426 -53
  17. package/dist/commands/project-sign-in.d.ts +0 -48
  18. package/dist/commands/project-sign-in.js +1 -224
  19. package/dist/commands/project.d.ts +15 -186
  20. package/dist/commands/project.js +93 -921
  21. package/dist/commands/result.d.ts +10 -0
  22. package/dist/commands/result.js +215 -0
  23. package/dist/commands/schedule.d.ts +0 -29
  24. package/dist/commands/schedule.js +47 -97
  25. package/dist/commands/test.d.ts +315 -1824
  26. package/dist/commands/test.js +1962 -13733
  27. package/dist/commands/testlist.d.ts +128 -5
  28. package/dist/commands/testlist.js +269 -329
  29. package/dist/commands/tunnel.d.ts +2 -2
  30. package/dist/commands/tunnel.js +43 -41
  31. package/dist/commands/usage.d.ts +12 -45
  32. package/dist/commands/usage.js +51 -131
  33. package/dist/index.js +189 -108
  34. package/dist/lib/agent-detect.js +9 -5
  35. package/dist/lib/agent-targets.d.ts +21 -2
  36. package/dist/lib/agent-targets.js +88 -11
  37. package/dist/lib/args.d.ts +13 -0
  38. package/dist/lib/args.js +49 -0
  39. package/dist/lib/basic-auth.d.ts +3 -0
  40. package/dist/lib/basic-auth.js +15 -0
  41. package/dist/lib/billing-refusal.js +4 -3
  42. package/dist/lib/ci-linkage.d.ts +4 -82
  43. package/dist/lib/ci-linkage.js +4 -157
  44. package/dist/lib/ci-run.js +1 -1
  45. package/dist/lib/client-factory.d.ts +10 -2
  46. package/dist/lib/client-factory.js +38 -26
  47. package/dist/lib/commit-signal.d.ts +65 -0
  48. package/dist/lib/commit-signal.js +305 -0
  49. package/dist/lib/concurrency-limiter.d.ts +6 -0
  50. package/dist/lib/concurrency-limiter.js +29 -0
  51. package/dist/lib/config.js +10 -5
  52. package/dist/lib/conflict-reason.d.ts +31 -4
  53. package/dist/lib/conflict-reason.js +38 -4
  54. package/dist/lib/conversation/answers.d.ts +9 -0
  55. package/dist/lib/conversation/answers.js +49 -0
  56. package/dist/lib/conversation/api.d.ts +71 -0
  57. package/dist/lib/conversation/api.js +150 -0
  58. package/dist/lib/conversation/change.d.ts +31 -0
  59. package/dist/lib/conversation/change.js +124 -0
  60. package/dist/lib/conversation/context.d.ts +19 -0
  61. package/dist/lib/conversation/context.js +70 -0
  62. package/dist/lib/conversation/environment.d.ts +15 -0
  63. package/dist/lib/conversation/environment.js +33 -0
  64. package/dist/lib/conversation/follow.d.ts +24 -0
  65. package/dist/lib/conversation/follow.js +42 -0
  66. package/dist/lib/conversation/render.d.ts +33 -0
  67. package/dist/lib/conversation/render.js +315 -0
  68. package/dist/lib/conversation/title.d.ts +2 -0
  69. package/dist/lib/conversation/title.js +18 -0
  70. package/dist/lib/conversation/types.d.ts +156 -0
  71. package/dist/lib/conversation/types.js +6 -0
  72. package/dist/lib/credentials.js +67 -11
  73. package/dist/lib/cron.d.ts +1 -1
  74. package/dist/lib/cron.js +2 -2
  75. package/dist/lib/dispatch-stop.d.ts +20 -0
  76. package/dist/lib/dispatch-stop.js +30 -0
  77. package/dist/lib/download.d.ts +71 -0
  78. package/dist/lib/download.js +274 -0
  79. package/dist/lib/dry-run/fetch.d.ts +10 -0
  80. package/dist/lib/dry-run/fetch.js +20 -0
  81. package/dist/lib/dry-run/samples.d.ts +6 -34
  82. package/dist/lib/dry-run/samples.js +389 -751
  83. package/dist/lib/environment-tunnel.d.ts +16 -26
  84. package/dist/lib/environment-tunnel.js +161 -157
  85. package/dist/lib/errors.d.ts +20 -4
  86. package/dist/lib/errors.js +36 -16
  87. package/dist/lib/facade.d.ts +7 -29
  88. package/dist/lib/facade.js +7 -36
  89. package/dist/lib/failing-fe-resolver.d.ts +13 -58
  90. package/dist/lib/failing-fe-resolver.js +47 -132
  91. package/dist/lib/first-suite-hint.d.ts +16 -22
  92. package/dist/lib/first-suite-hint.js +38 -47
  93. package/dist/lib/gh-output.d.ts +76 -21
  94. package/dist/lib/gh-output.js +171 -90
  95. package/dist/lib/git-utils.d.ts +56 -0
  96. package/dist/lib/git-utils.js +212 -0
  97. package/dist/lib/github-context.d.ts +2 -0
  98. package/dist/lib/github-context.js +40 -8
  99. package/dist/lib/history-retention.d.ts +6 -2
  100. package/dist/lib/history-retention.js +10 -7
  101. package/dist/lib/http.d.ts +58 -134
  102. package/dist/lib/http.js +352 -271
  103. package/dist/lib/interrupt.d.ts +14 -8
  104. package/dist/lib/interrupt.js +28 -10
  105. package/dist/lib/junit-report.d.ts +60 -4
  106. package/dist/lib/junit-report.js +209 -32
  107. package/dist/lib/local-target.d.ts +3 -3
  108. package/dist/lib/local-target.js +3 -3
  109. package/dist/lib/output.d.ts +0 -29
  110. package/dist/lib/output.js +10 -33
  111. package/dist/lib/pagination.d.ts +2 -5
  112. package/dist/lib/pagination.js +2 -5
  113. package/dist/lib/presigned-url.d.ts +22 -0
  114. package/dist/lib/presigned-url.js +90 -0
  115. package/dist/lib/prompt.js +36 -2
  116. package/dist/lib/proxy.js +2 -1
  117. package/dist/lib/redact.d.ts +2 -2
  118. package/dist/lib/redact.js +3 -4
  119. package/dist/lib/removed-commands.d.ts +18 -0
  120. package/dist/lib/removed-commands.js +154 -0
  121. package/dist/lib/render-error.d.ts +31 -6
  122. package/dist/lib/render-error.js +88 -25
  123. package/dist/lib/response-schemas.d.ts +38 -30
  124. package/dist/lib/response-schemas.js +210 -207
  125. package/dist/lib/result/api.d.ts +24 -0
  126. package/dist/lib/result/api.js +28 -0
  127. package/dist/lib/result/evidence.d.ts +71 -0
  128. package/dist/lib/result/evidence.js +420 -0
  129. package/dist/lib/result/render.d.ts +20 -0
  130. package/dist/lib/result/render.js +194 -0
  131. package/dist/lib/result/types.d.ts +122 -0
  132. package/dist/lib/result/types.js +19 -0
  133. package/dist/lib/run-output.d.ts +275 -0
  134. package/dist/lib/run-output.js +227 -0
  135. package/dist/lib/run-render.d.ts +101 -0
  136. package/dist/lib/run-render.js +183 -0
  137. package/dist/lib/run-wait.d.ts +192 -0
  138. package/dist/lib/run-wait.js +452 -0
  139. package/dist/lib/runs.types.d.ts +134 -367
  140. package/dist/lib/runs.types.js +0 -14
  141. package/dist/lib/secret-file.d.ts +1 -1
  142. package/dist/lib/secret-file.js +11 -2
  143. package/dist/lib/skill-nudge.d.ts +7 -27
  144. package/dist/lib/skill-nudge.js +9 -37
  145. package/dist/lib/target-path.d.ts +15 -0
  146. package/dist/lib/target-path.js +35 -0
  147. package/dist/lib/target-url-advisory.d.ts +19 -0
  148. package/dist/lib/target-url-advisory.js +31 -0
  149. package/dist/lib/target-url-preflight.d.ts +9 -0
  150. package/dist/lib/target-url-preflight.js +214 -106
  151. package/dist/lib/target-url.d.ts +1 -1
  152. package/dist/lib/target-url.js +6 -16
  153. package/dist/lib/telemetry.d.ts +32 -12
  154. package/dist/lib/telemetry.js +39 -8
  155. package/dist/lib/terminal-text.d.ts +41 -0
  156. package/dist/lib/terminal-text.js +127 -0
  157. package/dist/lib/testlist.types.d.ts +16 -8
  158. package/dist/lib/testlist.types.js +1 -1
  159. package/dist/lib/text-equality.d.ts +2 -0
  160. package/dist/lib/text-equality.js +5 -0
  161. package/dist/lib/text-file.d.ts +16 -0
  162. package/dist/lib/text-file.js +41 -0
  163. package/dist/lib/text-table.d.ts +46 -0
  164. package/dist/lib/text-table.js +72 -4
  165. package/dist/lib/ticker.d.ts +9 -2
  166. package/dist/lib/ticker.js +16 -3
  167. package/dist/lib/transport-failure.d.ts +22 -0
  168. package/dist/lib/transport-failure.js +126 -0
  169. package/dist/lib/tunnel-session.d.ts +7 -1
  170. package/dist/lib/tunnel-session.js +22 -9
  171. package/dist/lib/update-check.js +3 -2
  172. package/dist/lib/url-template.d.ts +43 -0
  173. package/dist/lib/url-template.js +151 -0
  174. package/dist/lib/validate.d.ts +0 -64
  175. package/dist/lib/validate.js +2 -131
  176. package/dist/lib/version-notice.js +4 -3
  177. package/dist/lib/wait-exit.d.ts +37 -2
  178. package/dist/lib/wait-exit.js +88 -30
  179. package/dist/lib/workspace-status.js +10 -2
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +3 -4
  183. package/skills/testsprite-ci.skill.md +48 -18
  184. package/skills/testsprite-onboard.skill.md +66 -151
  185. package/skills/testsprite-verify.codex.md +54 -56
  186. package/skills/testsprite-verify.skill.md +194 -358
  187. package/dist/lib/browser.d.ts +0 -6
  188. package/dist/lib/browser.js +0 -54
  189. package/dist/lib/bundle.d.ts +0 -234
  190. package/dist/lib/bundle.js +0 -781
  191. package/dist/lib/deprecate.d.ts +0 -10
  192. package/dist/lib/deprecate.js +0 -13
  193. package/dist/lib/flaky.d.ts +0 -91
  194. package/dist/lib/flaky.js +0 -71
  195. package/dist/lib/plan-poll.d.ts +0 -171
  196. package/dist/lib/plan-poll.js +0 -441
  197. package/dist/lib/plans.types.d.ts +0 -130
  198. package/dist/lib/plans.types.js +0 -31
  199. package/dist/lib/poll.d.ts +0 -100
  200. package/dist/lib/poll.js +0 -290
  201. package/dist/lib/rate-throttle.d.ts +0 -49
  202. package/dist/lib/rate-throttle.js +0 -75
  203. package/dist/lib/run-progress.d.ts +0 -41
  204. package/dist/lib/run-progress.js +0 -56
  205. package/dist/lib/v3-advisory.d.ts +0 -55
  206. package/dist/lib/v3-advisory.js +0 -74
  207. package/schemas/plan.schema.json +0 -61
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * `testsprite tunnel start | list | status | stop`.
3
3
  *
4
- * The out-of-band primitive under `test run --local`, which is sugar over it.
4
+ * The out-of-band primitive under `run --local`, which is sugar over it.
5
5
  * Two things it buys that the sugar cannot:
6
6
  *
7
7
  * - **One tunnel, many runs.** `tunnel start` in one terminal, then
8
- * `test run <id> --local <port> --tunnel-client <id>` as many times as you
8
+ * `run <id> --local <port> --tunnel-client <id>` as many times as you
9
9
  * like in another. Each run would otherwise mint and tear down its own
10
10
  * credential, and the per-principal live-binding cap is small.
11
11
  * - **A place to look when a run says the tunnel is down.** `tunnel status`
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * `testsprite tunnel start | list | status | stop`.
3
3
  *
4
- * The out-of-band primitive under `test run --local`, which is sugar over it.
4
+ * The out-of-band primitive under `run --local`, which is sugar over it.
5
5
  * Two things it buys that the sugar cannot:
6
6
  *
7
7
  * - **One tunnel, many runs.** `tunnel start` in one terminal, then
8
- * `test run <id> --local <port> --tunnel-client <id>` as many times as you
8
+ * `run <id> --local <port> --tunnel-client <id>` as many times as you
9
9
  * like in another. Each run would otherwise mint and tear down its own
10
10
  * credential, and the per-principal live-binding cap is small.
11
11
  * - **A place to look when a run says the tunnel is down.** `tunnel status`
@@ -28,6 +28,7 @@ import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
28
28
  import { renderTextTable } from '../lib/text-table.js';
29
29
  import { formatDataPlaneUnreachableMessage, formatDataPlaneUnreachableNextAction, openTunnelSession, } from '../lib/tunnel-session.js';
30
30
  import { TunnelClient } from '../vendor/tunnel-client/index.js';
31
+ import { terminalSafeLine, terminalSafeWriter } from '../lib/terminal-text.js';
31
32
  const TUNNEL_CLIENT_ID_SCHEMA = v.pipe(v.string(), v.uuid());
32
33
  function assertTunnelClientId(clientId) {
33
34
  if (v.is(TUNNEL_CLIENT_ID_SCHEMA, clientId))
@@ -35,8 +36,8 @@ function assertTunnelClientId(clientId) {
35
36
  throw ApiError.fromEnvelope({
36
37
  error: {
37
38
  code: 'VALIDATION_ERROR',
38
- message: "Tunnel client id must be a UUID (see 'testsprite tunnel status'/'tunnel start' output).",
39
- nextAction: "Run 'testsprite tunnel start' to get a tunnel client id.",
39
+ message: "Tunnel client id must be a UUID (see 'testsprite tunnel list').",
40
+ nextAction: "Run 'testsprite tunnel list' to see your tunnel client ids, or 'testsprite tunnel start' to open one.",
40
41
  requestId: 'local',
41
42
  details: { field: 'clientId', reason: 'must be a UUID' },
42
43
  },
@@ -46,7 +47,7 @@ function stdoutOf(deps) {
46
47
  return deps.stdout ?? ((line) => process.stdout.write(`${line}\n`));
47
48
  }
48
49
  function stderrOf(deps) {
49
- return deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
50
+ return terminalSafeWriter(deps.stderr);
50
51
  }
51
52
  function makeClient(opts, deps, shutdownSignal = (deps.shutdown ?? globalShutdown).signal) {
52
53
  return makeHttpClient(opts, {
@@ -127,6 +128,8 @@ async function withTeardownDeadline(createClient, shutdown, operation) {
127
128
  async function deleteTunnelForCleanup(createClient, shutdown, clientId) {
128
129
  await withTeardownDeadline(createClient, shutdown, client => client.delete(`/tunnel/${encodeURIComponent(clientId)}`, {
129
130
  allowNoContent: true,
131
+ retryOnConflict: false,
132
+ replaySafe: true,
130
133
  }));
131
134
  }
132
135
  const TEARDOWN_OPERATION_TIMEOUT_MS = 10_000;
@@ -230,7 +233,7 @@ export async function runTunnelStart(opts, deps = {}) {
230
233
  log: stderr,
231
234
  logLevel: opts.debug ? 'debug' : opts.verbose ? 'info' : 'error',
232
235
  ...(opts.ttlSeconds !== undefined ? { ttlSeconds: opts.ttlSeconds } : {}),
233
- onMinted: minted => stderr(`Minted tunnel client ${minted.clientId} (expires ${minted.expiresAt}); connecting…`),
236
+ onMinted: minted => stderr(`Minted tunnel client ${terminalSafeLine(minted.clientId)} (expires ${terminalSafeLine(minted.expiresAt)}); connecting…`),
234
237
  onFatal: (reason, message) => {
235
238
  fatal = true;
236
239
  fatalReason = reason;
@@ -259,13 +262,14 @@ export async function runTunnelStart(opts, deps = {}) {
259
262
  transport: session.transport,
260
263
  }, data => {
261
264
  const d = data;
265
+ const clientId = terminalSafeLine(d.clientId);
262
266
  return [
263
- `clientId ${d.clientId}`,
264
- `expiresAt ${d.expiresAt}`,
267
+ `clientId ${clientId}`,
268
+ `expiresAt ${terminalSafeLine(d.expiresAt)}`,
265
269
  `status online`,
266
270
  `transport ${d.transport}`,
267
- `hint Attach a run: testsprite test run <test-id> --env <name> --tunnel-client ${d.clientId}`,
268
- `hint Stop it: press Ctrl-C here, or run 'testsprite tunnel stop ${d.clientId}' from another terminal`,
271
+ `hint Attach a run: testsprite run <test-id> --env <name> --tunnel-client ${clientId}`,
272
+ `hint Stop it: press Ctrl-C here, or run 'testsprite tunnel stop ${clientId}' from another terminal`,
269
273
  ].join('\n');
270
274
  });
271
275
  void stdout;
@@ -301,7 +305,7 @@ export async function runTunnelStart(opts, deps = {}) {
301
305
  if ((fatal || revoked) && !shutdown.signal.aborted) {
302
306
  const dataPlaneUnreachable = fatalReason === 'data-plane-unreachable';
303
307
  if (revoked) {
304
- stderr(`Tunnel credential ${session.clientId} was revoked, expired, or taken over by another process.`);
308
+ stderr(`Tunnel credential ${terminalSafeLine(session.clientId)} was revoked, expired, or taken over by another process.`);
305
309
  }
306
310
  throw ApiError.fromEnvelope({
307
311
  error: {
@@ -327,7 +331,7 @@ export async function runTunnelStart(opts, deps = {}) {
327
331
  },
328
332
  });
329
333
  }
330
- stderr(`Tunnel ${session.clientId} closed.`);
334
+ stderr(`Tunnel ${terminalSafeLine(session.clientId)} closed.`);
331
335
  }
332
336
  /**
333
337
  * Is a client of mine connected?
@@ -357,9 +361,9 @@ export async function runTunnelStatus(opts, deps = {}) {
357
361
  }
358
362
  function renderStatus(status) {
359
363
  const lines = [
360
- `clientId ${status.clientId}`,
361
- `status ${status.status}`,
362
- `expiresAt ${status.expiresAt}`,
364
+ `clientId ${terminalSafeLine(status.clientId)}`,
365
+ `status ${terminalSafeLine(status.status)}`,
366
+ `expiresAt ${terminalSafeLine(status.expiresAt)}`,
363
367
  ];
364
368
  if (status.status !== 'online') {
365
369
  lines.push('hint Nothing is connected with this id. Start one with: testsprite tunnel start');
@@ -490,7 +494,7 @@ export async function runTunnelStop(opts, deps = {}) {
490
494
  method: 'DELETE',
491
495
  path: `/api/cli/v1/tunnel/${item.clientId}`,
492
496
  }));
493
- out.print({ requests }, () => requests.map(item => `${item.method} ${item.path}`).join('\n'));
497
+ out.print({ requests }, () => requests.map(item => `${item.method} ${terminalSafeLine(item.path)}`).join('\n'));
494
498
  return;
495
499
  }
496
500
  if (response.tunnels.length === 0) {
@@ -528,8 +532,8 @@ export async function runTunnelStop(opts, deps = {}) {
528
532
  };
529
533
  out.print(bulk, () => [
530
534
  ...results.map(result => result.stopped
531
- ? `stopped ${result.clientId}`
532
- : `failed ${result.clientId} ${result.error?.message}`),
535
+ ? `stopped ${terminalSafeLine(result.clientId)}`
536
+ : `failed ${terminalSafeLine(result.clientId)} ${terminalSafeLine(String(result.error?.message))}`),
533
537
  `Stopped ${stopped} of ${results.length} tunnels.`,
534
538
  'hint A running `tunnel start` notices a revoked credential within ~15 s and exits.',
535
539
  ].join('\n'));
@@ -551,18 +555,14 @@ export async function runTunnelStop(opts, deps = {}) {
551
555
  export function createTunnelCommand(deps = {}) {
552
556
  const tunnel = new Command('tunnel')
553
557
  .description('Open a tunnel so TestSprite can reach an app on this machine')
554
- .addHelpText('after', '\nFrontend runs automatically open and close a tunnel when the selected environment URL\n' +
555
- 'is on this machine. Use these commands when you want one tunnel to serve several runs, or to check on\n' +
556
- 'one that a run reported as down.\n' +
557
- '\nA tunnel lives only as long as `tunnel start` is running — there is no background\n' +
558
- 'daemon, because the credential that authorises an inbound network path into this machine\n' +
559
- 'is never written to disk.\n' +
558
+ .addHelpText('after', '\nFrontend runs open and close a tunnel automatically when the environment URL is on this\n' +
559
+ 'machine. Use these commands to share one tunnel across several runs or to check one a run\n' +
560
+ 'reported as down. A tunnel lives only as long as `tunnel start` runs: there is no background\n' +
561
+ 'daemon, because its credential is never written to disk.\n' +
560
562
  '\nExamples:\n' +
561
- ' testsprite tunnel start # hold a tunnel open (Ctrl-C to stop)\n' +
562
- ' testsprite test run <id> --env <name> --tunnel-client <id>\n' +
563
- ' testsprite tunnel list\n' +
564
- ' testsprite tunnel status <id>\n' +
565
- ' testsprite tunnel stop <id>\n' +
563
+ ' testsprite tunnel start # hold a tunnel open (Ctrl-C to stop)\n' +
564
+ ' testsprite run <test-id> --env <name> --tunnel-client <client-id>\n' +
565
+ ' testsprite run <test-id> --local 3000 --tunnel-client <client-id>\n' +
566
566
  ' testsprite tunnel stop --all --confirm\n');
567
567
  tunnel
568
568
  .command('start')
@@ -570,14 +570,13 @@ export function createTunnelCommand(deps = {}) {
570
570
  // where an embedded newline breaks out of the indented column. The detail
571
571
  // belongs in this command's own help, below.
572
572
  .description('Open a tunnel and hold it until you stop the command (Ctrl-C)')
573
- .option('--ttl <seconds>', 'requested lifetime of the tunnel credential (60–28800). The server clamps this, and the ' +
574
- 'credential is deleted when the command exits regardless — the lifetime only matters if ' +
575
- 'this process is killed without cleaning up.')
576
- .addHelpText('after', '\nPrints the client id to stderr as soon as it is minted, before connecting; pass it\n' +
577
- 'to `test run <id> --env <name> --tunnel-client <id>` for an environment on this machine.\n' +
578
- 'Frontend runs normally open their own tunnel automatically for a loopback environment URL.\n' +
579
- '\nDev servers can take a minute per page through the tunnel. For a heavy dev server,\n' +
580
- "test a built server: `npm run build`, then your framework's preview/start command.\n" +
573
+ .summary('Open a tunnel and hold it until Ctrl-C')
574
+ .option('--ttl <seconds>', 'requested credential lifetime (60–28800), clamped by the server; the credential is deleted ' +
575
+ 'on exit regardless, so this only matters if the process is killed')
576
+ .addHelpText('after', '\nPrints the client id to stderr as soon as it is minted; pass it to\n' +
577
+ '`run <test-id> --env <name> --tunnel-client <client-id>` for an environment on this machine.\n' +
578
+ '\nDev servers can take a minute per page through the tunnel; for a heavy one, test a built\n' +
579
+ "server (`npm run build`, then your framework's preview/start command).\n" +
581
580
  '\nExit codes:\n' +
582
581
  ' 0 you stopped it (Ctrl-C is the normal way to end this command)\n' +
583
582
  ' 3 auth error — the key needs the `run:tunnel` scope; mint a new key\n' +
@@ -594,8 +593,7 @@ export function createTunnelCommand(deps = {}) {
594
593
  tunnel
595
594
  .command('list')
596
595
  .description('List live tunnel bindings for this account')
597
- .addHelpText('after', '\nShows each tunnel client id, connection status, creation time and expiry.\n' +
598
- 'Includes tunnels automatically opened for environments on this machine.\n' +
596
+ .addHelpText('after', '\nShows each tunnel client id, status, creation time and expiry, including tunnels opened automatically.\n' +
599
597
  '\nExit codes:\n' +
600
598
  ' 0 listed (possibly empty)\n' +
601
599
  ' 3 auth error — the key needs the `run:tunnel` scope\n' +
@@ -607,6 +605,7 @@ export function createTunnelCommand(deps = {}) {
607
605
  });
608
606
  tunnel
609
607
  .command('status <client-id>')
608
+ .summary('Report whether a tunnel client is connected')
610
609
  .description('Report whether a tunnel client of yours is connected')
611
610
  .addHelpText('after', '\n`offline` means the API answered and said nothing is connected with that id. A failure\n' +
612
611
  'to reach TestSprite is reported as its own error, never as `offline`.\n' +
@@ -614,6 +613,7 @@ export function createTunnelCommand(deps = {}) {
614
613
  '\nExit codes:\n' +
615
614
  ' 0 answered (the answer may be `offline`)\n' +
616
615
  ' 4 no such tunnel for this account\n' +
616
+ ' 5 client id is not a UUID\n' +
617
617
  ' 10 could not reach TestSprite to ask\n')
618
618
  .addHelpText('after', GLOBAL_OPTS_HINT)
619
619
  .action(async (clientId, _cmdOpts, command) => {
@@ -621,19 +621,21 @@ export function createTunnelCommand(deps = {}) {
621
621
  });
622
622
  tunnel
623
623
  .command('stop [client-id]')
624
+ .summary('Stop one tunnel, or all with --all')
624
625
  .description('Destroy one tunnel credential or stop every live tunnel')
625
626
  .option('--all', 'stop every live tunnel on this account', false)
626
627
  .option('--confirm', 'required with --all for this destructive operation', false)
627
628
  .addHelpText('after', '\nStopping one that is already gone succeeds. Revoking the credential\n' +
628
629
  'also makes a running `tunnel start` exit within ~15 s.\n' +
629
630
  'A run that automatically opened this tunnel loses access to its environment when you stop it.\n' +
630
- 'Stopping all requires --confirm; --dry-run previews sample ids without it.\n' +
631
+ 'Stopping all requires --confirm and also revokes tunnels used by other terminals and CI jobs;\n' +
632
+ '--dry-run previews sample ids without it.\n' +
631
633
  '\nExit codes:\n' +
632
634
  ' 0 stopped (or already absent), including an empty --all result\n' +
633
635
  ' 1 at least one tunnel could not be stopped\n' +
634
636
  ' 3 auth error — the key needs the `run:tunnel` scope\n' +
635
637
  ' 4 server too old to list tunnels (with --all)\n' +
636
- ' 5 invalid arguments or --all without --confirm\n' +
638
+ ' 5 invalid arguments (e.g. a client id that is not a UUID) or --all without --confirm\n' +
637
639
  ' 10 could not reach TestSprite\n')
638
640
  .addHelpText('after', GLOBAL_OPTS_HINT)
639
641
  .action(async (clientId, cmdOpts, command) => {
@@ -1,14 +1,10 @@
1
1
  /**
2
- * `testsprite usage` — show the account's credit balance and plan/entitlement
3
- * info as a proactive pre-flight before a large `test run` fan-out.
2
+ * `testsprite usage` — show the caller's organization wallet (balance, plan,
3
+ * seats) as a proactive pre-flight before a large `run` fan-out.
4
4
  *
5
- * Backend note: `GET /me` now includes the `credits` / `subPlan` projection
6
- * (this shipped; the CLI's old "requires a backend update"
7
- * wording is stale and was removed). This command calls `/me` and surfaces
8
- * the `credits` / `subPlan` / `creditsPerRun` fields when and only when the
9
- * backend response includes them — kept absent-safe/forward-compat since not
10
- * every account shape is guaranteed to populate all three (e.g. `creditsPerRun`
11
- * has no server-side source at all today).
5
+ * Reads `GET /me`. The wallet is the `activeOrg` block, which the backend
6
+ * enriches best-effort and omits on a lookup failure; every field beyond the
7
+ * identity core stays absent-safe.
12
8
  */
13
9
  import { Command } from 'commander';
14
10
  import { type WorkspaceStatus } from '../lib/workspace-status.js';
@@ -16,46 +12,19 @@ import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factor
16
12
  import type { FetchImpl } from '../lib/http.js';
17
13
  import type { CliOrgBinding, CliOrgSummary } from '../lib/org-render.js';
18
14
  /**
19
- * Usage/balance response from `/me` (when the backend supplies it) or a future
20
- * `/usage` endpoint.
21
- *
22
- * `credits` / `subPlan` now ship on `/me` (live). Still
23
- * kept optional/absent-safe: `userId`/`keyId`/`env` are the only fields every
24
- * backend and account shape is guaranteed to populate.
15
+ * The `/me` projection the `usage` command reads. `userId`/`keyId`/`env` are
16
+ * the only fields every account shape is guaranteed to populate.
25
17
  */
26
18
  export interface UsageResponse {
27
19
  userId: string;
28
20
  keyId: string;
29
21
  env: 'development' | 'staging' | 'production';
30
22
  /**
31
- * Remaining credit balance. Present when the backend /me (or /usage)
32
- * includes the User.credits projection (live).
33
- */
34
- credits?: number;
35
- /**
36
- * Subscription plan name (e.g. "Free", "Standard", "Pro"). Present when
37
- * the backend /me (or /usage) includes the User.subPlan projection (live).
38
- */
39
- subPlan?: string;
40
- /**
41
- * Credit cost per test run trigger (informational). Present only when the
42
- * backend supplies it.
43
- */
44
- creditsPerRun?: number;
45
- /**
46
- * The caller's organization wallet — the billing subject on org-based
47
- * accounts. Rendered only together with `v3Enabled: true` (see
48
- * `renderUsage`): the org wallet supersedes the legacy `credits`/`subPlan`
49
- * pair only for callers whose commands actually bill it. Absent-safe like
50
- * every other optional field.
23
+ * The caller's organization wallet — the billing subject. The backend
24
+ * resolves it from the key's org binding, else the personal org, and omits
25
+ * it when that lookup fails.
51
26
  */
52
27
  activeOrg?: ActiveOrg;
53
- /**
54
- * Authoritative per-caller routing bit: true when this caller's commands
55
- * run (and bill) on the V3 platform. Always present on current backends;
56
- * absent on older ones.
57
- */
58
- v3Enabled?: boolean;
59
28
  /**
60
29
  * Every organization the underlying user belongs to (account-wide
61
30
  * membership list, personal org included). Absent-safe: omitted on a
@@ -95,10 +64,8 @@ type CommonOptions = FactoryCommonOptions;
95
64
  /** Dry-run canned response — matches what the real /me + User lookup would return. */
96
65
  export declare const DRY_RUN_USAGE_SAMPLE: UsageResponse;
97
66
  /**
98
- * Run the `usage` command. Calls `GET /me`, surfaces identity + any
99
- * credits/plan fields the backend supplies. Absent fields are silently
100
- * omitted (forward-compat in case a given account/backend version doesn't
101
- * populate them).
67
+ * Run the `usage` command. Calls `GET /me` and surfaces identity plus the org
68
+ * wallet when the backend supplies it. Absent fields are silently omitted.
102
69
  */
103
70
  export declare function runUsage(opts: CommonOptions, deps?: UsageDeps): Promise<UsageResponse>;
104
71
  export declare function createUsageCommand(deps?: UsageDeps): Command;
@@ -1,14 +1,10 @@
1
1
  /**
2
- * `testsprite usage` — show the account's credit balance and plan/entitlement
3
- * info as a proactive pre-flight before a large `test run` fan-out.
2
+ * `testsprite usage` — show the caller's organization wallet (balance, plan,
3
+ * seats) as a proactive pre-flight before a large `run` fan-out.
4
4
  *
5
- * Backend note: `GET /me` now includes the `credits` / `subPlan` projection
6
- * (this shipped; the CLI's old "requires a backend update"
7
- * wording is stale and was removed). This command calls `/me` and surfaces
8
- * the `credits` / `subPlan` / `creditsPerRun` fields when and only when the
9
- * backend response includes them — kept absent-safe/forward-compat since not
10
- * every account shape is guaranteed to populate all three (e.g. `creditsPerRun`
11
- * has no server-side source at all today).
5
+ * Reads `GET /me`. The wallet is the `activeOrg` block, which the backend
6
+ * enriches best-effort and omits on a lookup failure; every field beyond the
7
+ * identity core stays absent-safe.
12
8
  */
13
9
  import { Command } from 'commander';
14
10
  import { formatWorkspaceStatus } from '../lib/workspace-status.js';
@@ -18,15 +14,12 @@ import { resolvePortalBase } from '../lib/facade.js';
18
14
  import { formatOrgBinding, formatOrgsSummary } from '../lib/org-render.js';
19
15
  import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
20
16
  import { USAGE_RESPONSE_SCHEMA } from '../lib/response-schemas.js';
17
+ import { terminalSafeLine, terminalSafeWriter } from '../lib/terminal-text.js';
21
18
  /** Dry-run canned response — matches what the real /me + User lookup would return. */
22
19
  export const DRY_RUN_USAGE_SAMPLE = {
23
20
  userId: '11111111-1111-4111-8111-111111111111',
24
21
  keyId: 'key_dryrun_2026',
25
22
  env: 'development',
26
- credits: 42,
27
- subPlan: 'Standard',
28
- creditsPerRun: 2,
29
- v3Enabled: true,
30
23
  activeOrg: {
31
24
  id: '22222222-2222-4222-8222-222222222222',
32
25
  name: 'Dry Run Workspace',
@@ -38,13 +31,11 @@ export const DRY_RUN_USAGE_SAMPLE = {
38
31
  },
39
32
  };
40
33
  /**
41
- * Run the `usage` command. Calls `GET /me`, surfaces identity + any
42
- * credits/plan fields the backend supplies. Absent fields are silently
43
- * omitted (forward-compat in case a given account/backend version doesn't
44
- * populate them).
34
+ * Run the `usage` command. Calls `GET /me` and surfaces identity plus the org
35
+ * wallet when the backend supplies it. Absent fields are silently omitted.
45
36
  */
46
37
  export async function runUsage(opts, deps = {}) {
47
- const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
38
+ const stderr = terminalSafeWriter(deps.stderr);
48
39
  const out = makeOutput(opts.output, deps);
49
40
  if (opts.dryRun) {
50
41
  emitDryRunBanner(stderr);
@@ -69,18 +60,11 @@ export async function runUsage(opts, deps = {}) {
69
60
  credentialsPath: deps.credentialsPath,
70
61
  }).apiUrl);
71
62
  const billingUrl = portalBase !== undefined
72
- ? `${portalBase}/dashboard/settings/billing`
73
- : 'the portal Billing page (/dashboard/settings/billing)';
74
- // /me is the only available source of credits/plan today. If the backend
75
- // adds a dedicated /usage endpoint later, this single get call is where
76
- // it would be swapped in — no other code change needed in the CLI.
63
+ ? `${portalBase}${BILLING_PAGE_PATH}`
64
+ : `the portal Billing page (${BILLING_PAGE_PATH})`;
77
65
  const me = await client.get('/me', { schema: USAGE_RESPONSE_SCHEMA });
78
66
  out.print(me, data => renderUsage(data, portalBase));
79
- // In text mode, emit a note when NO balance was shown at all — neither the
80
- // legacy per-user `credits` nor an org wallet. A V3-routed org account can
81
- // legitimately have no DDB `credits` field (org-native members never get a
82
- // legacy user row), and its balance already rendered in the organization
83
- // block — the note would contradict the output right above it.
67
+ // In text mode, emit a note when no balance was shown at all.
84
68
  //
85
69
  // "Is this key org-bound" and "do I have a balance number to show" are two
86
70
  // different questions and must not be conflated. `me.org` is the key's own
@@ -88,14 +72,10 @@ export async function runUsage(opts, deps = {}) {
88
72
  // authenticated with a membership key (`sk-member-…`). `activeOrg` is the
89
73
  // *enriched* org balance: the backend does a best-effort Postgres read for
90
74
  // it and swallows the exception on failure, so `org` can be present while
91
- // `activeOrg` (and, for a V3-native user with no legacy DynamoDB row,
92
- // `credits` too) is absent. Deciding org-boundedness from `activeOrg`
93
- // (i.e. `orgWalletShown`) alone means that degraded state falls through to
94
- // this personal-billing note — pointing an org-key operator at the wrong
95
- // wallet in exactly the situation this whole surface exists to prevent.
75
+ // `activeOrg` is absent. An org-bound key in that state must be told its
76
+ // org balance is unavailable, never pointed at a generic billing page.
96
77
  const isOrgBound = me.org !== undefined;
97
- const orgWalletShown = me.v3Enabled === true && me.activeOrg !== undefined;
98
- if (opts.output === 'text' && me.credits === undefined && !orgWalletShown) {
78
+ if (opts.output === 'text' && me.activeOrg === undefined) {
99
79
  stderr(isOrgBound
100
80
  ? "[note] this key is organization-bound, but the org balance could not be loaded right now. Retry `testsprite usage`, or check the Portal's organization billing settings (ask an org admin if you don't have access)."
101
81
  : `[note] credit balance not returned for this account. Check ${billingUrl} for your current balance.`);
@@ -108,128 +88,68 @@ export async function runUsage(opts, deps = {}) {
108
88
  * AI-assisted operation may fail; cheaper actions can still succeed.
109
89
  */
110
90
  const LOW_ORG_BALANCE_CREDITS = 2;
91
+ /**
92
+ * Org-less Portal billing route: the Portal re-anchors it under the viewer's
93
+ * active workspace.
94
+ */
95
+ const BILLING_PAGE_PATH = '/dashboard-v3/settings/billing';
111
96
  function renderUsage(u, portalBase) {
112
97
  const lines = [];
113
98
  // Identity block (always present)
114
- lines.push(`userId: ${u.userId}`);
115
- lines.push(`keyId: ${u.keyId}`);
116
- lines.push(`env: ${u.env}`);
99
+ lines.push(`userId: ${terminalSafeLine(u.userId)}`);
100
+ lines.push(`keyId: ${terminalSafeLine(u.keyId)}`);
101
+ lines.push(`env: ${terminalSafeLine(u.env)}`);
117
102
  // Org attribution — rendered only when the backend supplies it.
118
103
  const orgsSummary = formatOrgsSummary(u.organizations);
119
104
  if (orgsSummary)
120
- lines.push(`orgs: ${orgsSummary}`);
105
+ lines.push(`orgs: ${terminalSafeLine(orgsSummary)}`);
121
106
  const orgBinding = formatOrgBinding(u.org);
122
107
  if (orgBinding)
123
- lines.push(`org binding: ${orgBinding}`);
108
+ lines.push(`org binding: ${terminalSafeLine(orgBinding)}`);
124
109
  // Whether the CALLING KEY is org-bound — read from `u.org` (the key's own
125
- // membership binding: always present, no I/O, populated whenever the
126
- // request authenticated with a `sk-member-…` key), NOT from `activeOrg`.
127
- // `activeOrg` is the *enriched* org balance: the backend does a best-effort
128
- // Postgres read for it and swallows the exception on failure, so a caller
129
- // can be genuinely org-bound (`org` present) while `activeOrg` — and, for a
130
- // V3-native user with no legacy DynamoDB row, `credits` too — is absent.
131
- // "Is this key org-bound" and "do I have a balance number to show" are two
132
- // different questions; conflating them (deciding org-boundedness from
133
- // `orgWallet`/`activeOrg` alone) sends a degraded-enrichment org caller
134
- // down the personal-wallet branches below.
110
+ // membership binding), NOT from `activeOrg`, which is a best-effort
111
+ // enrichment the backend omits on a lookup failure (see `runUsage`).
135
112
  const isOrgBound = u.org !== undefined;
136
- // Org wallet block — the billing subject on org-based accounts. Rendered
137
- // only when the caller is actually V3-routed: `v3Enabled` is the
138
- // authoritative routing bit, so wallet selection never rests on field
139
- // presence alone. A V2-routed caller keeps the legacy block below (their
140
- // billable commands still charge the legacy wallet); older backends send
141
- // neither field and degrade the same way.
142
- // `?? undefined` also normalizes a hypothetical explicit `null` from the
143
- // wire so the block below can't dereference it.
144
- const orgWallet = u.v3Enabled === true ? (u.activeOrg ?? undefined) : undefined;
113
+ // Org wallet block — the billing subject. `?? undefined` also normalizes a
114
+ // hypothetical explicit `null` from the wire so the block below can't
115
+ // dereference it.
116
+ const orgWallet = u.activeOrg ?? undefined;
145
117
  if (orgWallet !== undefined) {
146
118
  const org = orgWallet;
147
119
  lines.push('');
148
120
  lines.push('--- organization ---');
149
- lines.push(`org: ${org.name} (${org.role})`);
150
- lines.push(`plan: ${org.plan}`);
121
+ lines.push(`org: ${terminalSafeLine(org.name)} (${terminalSafeLine(org.role)})`);
122
+ lines.push(`plan: ${terminalSafeLine(org.plan)}`);
151
123
  // A paused workspace cannot spend this balance at all; a payment-pending
152
124
  // one keeps spending but gets no refill. Both are worth a line here.
153
125
  const standing = formatWorkspaceStatus(org.workspace);
154
126
  if (standing)
155
127
  lines.push(`state: ${standing}`);
156
- // Labeled `balance:` (not `credits:`) — `--output json` exposes the
157
- // legacy per-user number under `.credits`, and giving the org wallet the
158
- // same label in text mode would make one word mean two different values.
159
128
  lines.push(`balance: ${org.remaining} remaining (${org.includedCredits}/mo per seat)`);
160
129
  lines.push(`seats: ${org.seats}`);
161
- // No "~N runs" estimate here: org billing prices actions individually and
162
- // the API does not expose a per-run rate for the org wallet — an estimate
163
- // computed from the legacy frontend rate would be wrong.
130
+ // No "~N runs" estimate here: org billing prices actions individually,
131
+ // so a single per-run rate would be wrong for most fan-outs.
164
132
  }
165
133
  else if (isOrgBound) {
166
134
  // Org-bound key, but the enrichment that would have populated `activeOrg`
167
- // degraded (best-effort Postgres read failed server-side, or `v3Enabled`
168
- // itself couldn't be resolved). Say so honestly — never fall through to
169
- // the legacy per-user blocks below (this key's commands bill the org
170
- // wallet, not the personal one, regardless of whether we could load its
171
- // number just now), and never fabricate an org-scoped URL.
135
+ // degraded (best-effort Postgres read failed server-side). Say so
136
+ // honestly, and never fabricate an org-scoped URL.
172
137
  lines.push('');
173
138
  lines.push('--- organization ---');
174
139
  lines.push("balance: could not be loaded right now. Retry `testsprite usage`, or check the Portal's organization billing settings (ask an org admin if you don't have access).");
175
140
  }
176
- // Legacy balance block — shown only when the backend supplies it, no org
177
- // wallet superseded it (older backends / V2-routed accounts), AND the key
178
- // isn't org-bound (an org-bound key's commands never charge these numbers,
179
- // even if a legacy row happens to still carry them).
180
- const hasBalanceData = u.credits !== undefined || u.subPlan !== undefined;
181
- if (orgWallet === undefined && !isOrgBound && hasBalanceData) {
182
- lines.push('');
183
- lines.push('--- credits & plan ---');
184
- if (u.subPlan !== undefined) {
185
- lines.push(`plan: ${u.subPlan}`);
186
- }
187
- if (u.credits !== undefined) {
188
- lines.push(`credits: ${u.credits}`);
189
- }
190
- if (u.creditsPerRun !== undefined) {
191
- lines.push(`cost per frontend run: ${u.creditsPerRun} credit(s)`);
192
- // Backend runs DO consume credits (confirmed by design 2026-06-30).
193
- // The API exposes no backend-specific per-run cost field, and it differs from
194
- // the frontend rate, so state that it bills without asserting a possibly-wrong
195
- // number — check your balance before/after, or see the billing page.
196
- lines.push(`cost per backend run: also consumes credits (exact amount not reported by the API)`);
197
- }
198
- // Pre-flight hint: how many runs the current balance can fund
199
- if (u.credits !== undefined && u.creditsPerRun !== undefined && u.creditsPerRun > 0) {
200
- const maxRuns = Math.floor(u.credits / u.creditsPerRun);
201
- lines.push(`can trigger: ~${maxRuns} run(s) at current balance`);
202
- }
203
- }
204
- // Actionable upgrade line for Free or low-balance keys. Prefer the org
205
- // wallet's plan/balance when present. `!isOrgBound` guards the personal
206
- // branch of each: an org-bound key with degraded enrichment has no
207
- // `orgWallet` to compute from, but must not fall back to reading `u.credits`
208
- // / `u.subPlan` either (a legacy row that happens to coexist with an org
209
- // binding is not what this key's commands actually bill).
210
- const isLowBalance = orgWallet !== undefined
211
- ? orgWallet.remaining < LOW_ORG_BALANCE_CREDITS
212
- : !isOrgBound &&
213
- u.credits !== undefined &&
214
- u.creditsPerRun !== undefined &&
215
- u.credits < u.creditsPerRun;
216
- const isFree = orgWallet !== undefined
217
- ? orgWallet.plan.toLowerCase() === 'free'
218
- : !isOrgBound && u.subPlan?.toLowerCase() === 'free';
141
+ // Upgrade line for Free or low-balance wallets.
142
+ const isLowBalance = orgWallet !== undefined && orgWallet.remaining < LOW_ORG_BALANCE_CREDITS;
143
+ const isFree = orgWallet !== undefined && orgWallet.plan.toLowerCase() === 'free';
219
144
  if (isLowBalance) {
220
145
  lines.push('');
221
- // The org wallet is billed under the ORGANIZATION's own settings, not the
222
- // personal `/dashboard/settings/billing` page (that page manages the
223
- // legacy per-user DDB balance, a different column entirely) — so the
224
- // org branch deliberately does not point at that URL. No org-scoped
225
- // settings URL is fabricated here either: the CLI has no confirmed route
226
- // for one, so "ask an org admin" is the honest next step.
227
- lines.push(orgWallet !== undefined
228
- ? // Org billing prices actions individually, and cheaper actions (e.g.
229
- // a 1-credit backend run) may still succeed below the threshold —
230
- // so this is "low", not "cannot run".
231
- `warning: organization balance is low (under the ${LOW_ORG_BALANCE_CREDITS}-credit cost of a generation action). Top up in the Portal's organization billing settings (ask an org admin if you don't have access).`
232
- : `warning: credit balance is below the per-run cost. Top up at: ${portalBase !== undefined ? `${portalBase}/dashboard/settings/billing` : 'the portal Billing page (/dashboard/settings/billing)'}`);
146
+ // No URL here: the Portal's org-less billing route re-anchors under the
147
+ // viewer's ACTIVE workspace in the browser, which need not be the org
148
+ // this key bills, so "the organization billing settings" is the honest
149
+ // pointer. Org billing prices actions individually, and cheaper actions
150
+ // (e.g. a 1-credit backend run) may still succeed below the threshold —
151
+ // so this is "low", not "cannot run".
152
+ lines.push(`warning: organization balance is low (under the ${LOW_ORG_BALANCE_CREDITS}-credit cost of a generation action). Top up in the Portal's organization billing settings (ask an org admin if you don't have access).`);
233
153
  }
234
154
  else if (isFree) {
235
155
  lines.push('');
@@ -241,7 +161,8 @@ function renderUsage(u, portalBase) {
241
161
  export function createUsageCommand(deps = {}) {
242
162
  const cmd = new Command('usage')
243
163
  .alias('credits')
244
- .description('Show credit balance and plan/entitlement info (proactive pre-flight before a large test run)')
164
+ .summary('Show credit balance and plan info')
165
+ .description('Show credit balance and plan/entitlement info (proactive pre-flight before a large run)')
245
166
  .addHelpText('after', GLOBAL_OPTS_HINT)
246
167
  .addHelpText('after', '\nExamples:\n' +
247
168
  ' testsprite usage # show balance + plan\n' +
@@ -252,9 +173,8 @@ export function createUsageCommand(deps = {}) {
252
173
  ' 0 success (or --dry-run)\n' +
253
174
  ' 3 auth error — run `testsprite setup` to configure credentials\n' +
254
175
  ' 10 transport/network failure (UNAVAILABLE) — retry the command\n' +
255
- "\nNote: if credit balance isn't shown for your account, check your portal's\n" +
256
- ' Billing page (/dashboard/settings/billing) for a personal key, or your\n' +
257
- ' organization billing settings (ask an org admin) if this key is\n' +
176
+ "\nNote: if the balance isn't shown, check the portal's Billing page\n" +
177
+ ' (/dashboard-v3/settings/billing), or ask an org admin if this key is\n' +
258
178
  ' organization-bound.')
259
179
  .action(async (_cmdOpts, command) => {
260
180
  await runUsage(resolveCommonOptions(command, deps.env), deps);