@testsprite/testsprite-cli 0.12.0 → 0.13.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 (91) hide show
  1. package/README.md +11 -4
  2. package/dist/commands/agent.js +16 -13
  3. package/dist/commands/auth.d.ts +19 -0
  4. package/dist/commands/auth.js +60 -24
  5. package/dist/commands/ci.d.ts +86 -1
  6. package/dist/commands/ci.js +436 -5
  7. package/dist/commands/doctor.d.ts +2 -0
  8. package/dist/commands/doctor.js +22 -9
  9. package/dist/commands/init.js +14 -11
  10. package/dist/commands/project-env.js +9 -9
  11. package/dist/commands/project.d.ts +5 -5
  12. package/dist/commands/project.js +42 -42
  13. package/dist/commands/schedule.d.ts +2 -0
  14. package/dist/commands/schedule.js +18 -10
  15. package/dist/commands/test.d.ts +73 -27
  16. package/dist/commands/test.js +1756 -413
  17. package/dist/commands/testlist.js +49 -19
  18. package/dist/commands/tunnel.d.ts +26 -3
  19. package/dist/commands/tunnel.js +211 -14
  20. package/dist/commands/usage.d.ts +3 -0
  21. package/dist/commands/usage.js +12 -5
  22. package/dist/index.js +34 -20
  23. package/dist/lib/agent-targets.d.ts +3 -3
  24. package/dist/lib/agent-targets.js +2 -2
  25. package/dist/lib/billing-refusal.d.ts +43 -0
  26. package/dist/lib/billing-refusal.js +171 -0
  27. package/dist/lib/bundle.d.ts +5 -0
  28. package/dist/lib/bundle.js +43 -13
  29. package/dist/lib/ci-linkage.d.ts +90 -0
  30. package/dist/lib/ci-linkage.js +181 -0
  31. package/dist/lib/client-factory.d.ts +4 -1
  32. package/dist/lib/client-factory.js +23 -2
  33. package/dist/lib/config.d.ts +17 -0
  34. package/dist/lib/config.js +20 -1
  35. package/dist/lib/conflict-reason.d.ts +27 -3
  36. package/dist/lib/conflict-reason.js +53 -4
  37. package/dist/lib/credentials.js +56 -14
  38. package/dist/lib/dry-run/samples.d.ts +13 -1
  39. package/dist/lib/dry-run/samples.js +51 -7
  40. package/dist/lib/errors.d.ts +18 -11
  41. package/dist/lib/errors.js +111 -13
  42. package/dist/lib/failing-fe-resolver.d.ts +1 -1
  43. package/dist/lib/failing-fe-resolver.js +3 -3
  44. package/dist/lib/gh-output.d.ts +1 -0
  45. package/dist/lib/gh-output.js +13 -4
  46. package/dist/lib/history-retention.d.ts +8 -0
  47. package/dist/lib/history-retention.js +24 -0
  48. package/dist/lib/http.d.ts +37 -19
  49. package/dist/lib/http.js +46 -24
  50. package/dist/lib/interrupt.d.ts +21 -13
  51. package/dist/lib/interrupt.js +32 -21
  52. package/dist/lib/junit-report.d.ts +11 -1
  53. package/dist/lib/junit-report.js +15 -3
  54. package/dist/lib/local-target.d.ts +1 -1
  55. package/dist/lib/local-target.js +1 -1
  56. package/dist/lib/plan-poll.d.ts +11 -11
  57. package/dist/lib/plan-poll.js +12 -12
  58. package/dist/lib/plans.types.d.ts +9 -9
  59. package/dist/lib/plans.types.js +3 -3
  60. package/dist/lib/poll.d.ts +2 -2
  61. package/dist/lib/poll.js +9 -3
  62. package/dist/lib/render-error.d.ts +2 -0
  63. package/dist/lib/render-error.js +13 -0
  64. package/dist/lib/response-schemas.d.ts +54 -12
  65. package/dist/lib/response-schemas.js +88 -7
  66. package/dist/lib/runs.types.d.ts +59 -10
  67. package/dist/lib/secret-file.js +72 -14
  68. package/dist/lib/skill-nudge.d.ts +6 -1
  69. package/dist/lib/skill-nudge.js +32 -5
  70. package/dist/lib/target-url-preflight.d.ts +6 -4
  71. package/dist/lib/target-url-preflight.js +64 -51
  72. package/dist/lib/target-url.js +6 -6
  73. package/dist/lib/telemetry.d.ts +4 -1
  74. package/dist/lib/telemetry.js +13 -13
  75. package/dist/lib/ticker.js +93 -4
  76. package/dist/lib/tunnel-session.d.ts +13 -0
  77. package/dist/lib/tunnel-session.js +4 -1
  78. package/dist/lib/tunnel.types.d.ts +12 -2
  79. package/dist/lib/tunnel.types.js +2 -2
  80. package/dist/lib/wait-exit.d.ts +8 -0
  81. package/dist/lib/wait-exit.js +76 -4
  82. package/dist/lib/workspace-status.d.ts +23 -0
  83. package/dist/lib/workspace-status.js +15 -0
  84. package/dist/version-guard.d.ts +7 -1
  85. package/dist/version-guard.js +19 -1
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +4 -4
  89. package/skills/testsprite-onboard.skill.md +4 -4
  90. package/skills/testsprite-verify.codex.md +59 -57
  91. package/skills/testsprite-verify.skill.md +53 -38
@@ -25,6 +25,95 @@ export function isNoColor(env = process.env) {
25
25
  const value = env.NO_COLOR;
26
26
  return typeof value === 'string' && value.length > 0;
27
27
  }
28
+ const DEFAULT_TERMINAL_COLUMNS = 80;
29
+ const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
30
+ const markPattern = /^\p{Mark}$/u;
31
+ const emojiPattern = /\p{Extended_Pictographic}|\p{Regional_Indicator}|\u20e3/u;
32
+ /**
33
+ * Return whether a Unicode code point normally occupies two terminal columns.
34
+ *
35
+ * @param codePoint - Unicode scalar value to classify.
36
+ * @returns Whether the code point is full-width in a terminal.
37
+ */
38
+ function isFullwidthCodePoint(codePoint) {
39
+ return (codePoint >= 0x1100 &&
40
+ (codePoint <= 0x115f ||
41
+ codePoint === 0x2329 ||
42
+ codePoint === 0x232a ||
43
+ (codePoint >= 0x2e80 && codePoint <= 0xa4cf && codePoint !== 0x303f) ||
44
+ (codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
45
+ (codePoint >= 0xf900 && codePoint <= 0xfaff) ||
46
+ (codePoint >= 0xfe10 && codePoint <= 0xfe19) ||
47
+ (codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
48
+ (codePoint >= 0xff00 && codePoint <= 0xff60) ||
49
+ (codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
50
+ (codePoint >= 0x1b000 && codePoint <= 0x1b001) ||
51
+ (codePoint >= 0x1f200 && codePoint <= 0x1f251) ||
52
+ (codePoint >= 0x20000 && codePoint <= 0x3fffd)));
53
+ }
54
+ /**
55
+ * Measure one grapheme cluster in terminal display columns.
56
+ *
57
+ * @param grapheme - User-perceived character produced by the segmenter.
58
+ * @returns The number of terminal columns occupied by the grapheme.
59
+ */
60
+ function graphemeWidth(grapheme) {
61
+ if (emojiPattern.test(grapheme))
62
+ return 2;
63
+ let width = 0;
64
+ for (const character of grapheme) {
65
+ const codePoint = character.codePointAt(0);
66
+ if (codePoint === 0x200d ||
67
+ (codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
68
+ (codePoint >= 0xe0100 && codePoint <= 0xe01ef) ||
69
+ codePoint <= 0x1f ||
70
+ (codePoint >= 0x7f && codePoint <= 0x9f) ||
71
+ markPattern.test(character)) {
72
+ continue;
73
+ }
74
+ width += isFullwidthCodePoint(codePoint) ? 2 : 1;
75
+ }
76
+ return width;
77
+ }
78
+ /**
79
+ * Measure a complete string in terminal display columns.
80
+ *
81
+ * @param text - Text to measure.
82
+ * @returns The number of terminal columns occupied by the text.
83
+ */
84
+ function terminalWidth(text) {
85
+ let width = 0;
86
+ for (const { segment } of graphemeSegmenter.segment(text)) {
87
+ width += graphemeWidth(segment);
88
+ }
89
+ return width;
90
+ }
91
+ /**
92
+ * Keep a ticker frame inside the terminal's last safe column. Terminal width is
93
+ * read for every frame so an in-progress ticker follows live resizes.
94
+ */
95
+ function fitToTerminal(line) {
96
+ const reportedColumns = typeof process !== 'undefined' ? process.stderr.columns : undefined;
97
+ const columns = typeof reportedColumns === 'number' && Number.isFinite(reportedColumns) && reportedColumns > 0
98
+ ? Math.floor(reportedColumns)
99
+ : DEFAULT_TERMINAL_COLUMNS;
100
+ const maxWidth = Math.max(0, columns - 1);
101
+ if (terminalWidth(line) <= maxWidth)
102
+ return line;
103
+ if (maxWidth === 0)
104
+ return '';
105
+ const contentWidth = maxWidth - 1;
106
+ let fitted = '';
107
+ let fittedWidth = 0;
108
+ for (const { segment } of graphemeSegmenter.segment(line)) {
109
+ const width = graphemeWidth(segment);
110
+ if (fittedWidth + width > contentWidth)
111
+ break;
112
+ fitted += segment;
113
+ fittedWidth += width;
114
+ }
115
+ return `${fitted}…`;
116
+ }
28
117
  /**
29
118
  * Create a ticker bound to the given stderr writer. Respects
30
119
  * `isTTY` to silently no-op in CI environments.
@@ -59,13 +148,13 @@ export function createTicker(stderrWrite, isTTY, stderrRaw, noColor) {
59
148
  return {
60
149
  redrawsInPlace: false,
61
150
  update(line) {
62
- const stamped = `${new Date().toISOString()} ${line}`;
151
+ const stamped = fitToTerminal(`${new Date().toISOString()} ${line}`);
63
152
  stderrWrite(stamped);
64
153
  lastLength = stamped.length;
65
154
  },
66
155
  finalize(line) {
67
156
  if (line !== undefined) {
68
- const stamped = `${new Date().toISOString()} ${line}`;
157
+ const stamped = fitToTerminal(`${new Date().toISOString()} ${line}`);
69
158
  stderrWrite(stamped);
70
159
  lastLength = stamped.length;
71
160
  }
@@ -77,13 +166,13 @@ export function createTicker(stderrWrite, isTTY, stderrRaw, noColor) {
77
166
  redrawsInPlace: true,
78
167
  update(line) {
79
168
  // ANSI ESC[2K clears the entire line; \r moves to column 0.
80
- const stamped = `${new Date().toISOString()} ${line}`;
169
+ const stamped = fitToTerminal(`${new Date().toISOString()} ${line}`);
81
170
  rawWrite(`\x1b[2K\r${stamped}`);
82
171
  lastLength = stamped.length;
83
172
  },
84
173
  finalize(line) {
85
174
  if (line !== undefined) {
86
- const stamped = `${new Date().toISOString()} ${line}`;
175
+ const stamped = fitToTerminal(`${new Date().toISOString()} ${line}`);
87
176
  rawWrite(`\x1b[2K\r${stamped}`);
88
177
  lastLength = stamped.length;
89
178
  }
@@ -101,6 +101,19 @@ export interface OpenTunnelSessionOptions {
101
101
  connectTimeoutMs?: number;
102
102
  /** Called once, the first time the tunnel becomes unusable for this run. */
103
103
  onFatal?: (reason: TunnelFatalReason, message?: string) => void;
104
+ /**
105
+ * Called once, right after the mint succeeds and BEFORE the connect attempt,
106
+ * with the binding's non-secret handle. A process killed while connecting
107
+ * never reaches the line a caller prints after connect, and the binding it
108
+ * leaves behind holds a slot of the per-account cap until it expires; this
109
+ * is what lets the caller name that binding while it still can. Not called
110
+ * for an adopted client. A throw is treated like a failed connect: the
111
+ * binding is deleted and the error propagates.
112
+ */
113
+ onMinted?: (minted: {
114
+ clientId: string;
115
+ expiresAt: string;
116
+ }) => void;
104
117
  /**
105
118
  * Attach to a client someone else minted (`testsprite tunnel start` in
106
119
  * another terminal) instead of minting one. No secret is available, so
@@ -38,7 +38,7 @@
38
38
  * does instead is honest failure: record the loss, let the caller stop the run
39
39
  * and say why. See `openTunnelSession`'s `onFatal`.
40
40
  */
41
- import { ApiError } from './errors.js';
41
+ import { ApiError, InterruptError } from './errors.js';
42
42
  import { ErrCode, TunnelClient } from '../vendor/tunnel-client/index.js';
43
43
  import { DEFAULT_DATA_PLANE_RETRY_DEADLINE_MS } from '../vendor/tunnel-client/config.js';
44
44
  /**
@@ -218,6 +218,7 @@ export async function openTunnelSession(options, deps) {
218
218
  }
219
219
  };
220
220
  try {
221
+ options.onMinted?.({ clientId: minted.clientId, expiresAt: minted.expiresAt });
221
222
  client = createClient({
222
223
  clientId: minted.clientId,
223
224
  secret: minted.secret,
@@ -280,6 +281,8 @@ export async function openTunnelSession(options, deps) {
280
281
  }
281
282
  catch (err) {
282
283
  await stopAndDestroy();
284
+ if (err instanceof InterruptError)
285
+ throw err;
283
286
  if (err instanceof ApiError)
284
287
  throw err;
285
288
  throw ApiError.fromEnvelope({
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Wire types for the `/api/cli/v1/tunnel` facade (DEV-747 piece 1).
2
+ * Wire types for the `/api/cli/v1/tunnel` facade.
3
3
  *
4
- * Three routes and deliberately no fourth — there is no resume/adopt route to
4
+ * The list and status reads are secret-free. There is no resume/adopt route to
5
5
  * hand a `{clientId, secret}` back to, so the CLI mints fresh per invocation.
6
6
  */
7
7
  /** Body of `POST /api/cli/v1/tunnel`. */
@@ -54,3 +54,13 @@ export interface TunnelStatusResponse {
54
54
  status: 'online' | 'offline' | (string & {});
55
55
  expiresAt: string;
56
56
  }
57
+ /** One secret-free binding returned by `GET /api/cli/v1/tunnel`. */
58
+ export interface TunnelListItem {
59
+ clientId: string;
60
+ status: 'online' | 'offline' | 'unknown' | (string & {});
61
+ expiresAt: string;
62
+ createdAt?: string | null;
63
+ }
64
+ export interface TunnelListResponse {
65
+ tunnels: TunnelListItem[];
66
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Wire types for the `/api/cli/v1/tunnel` facade (DEV-747 piece 1).
2
+ * Wire types for the `/api/cli/v1/tunnel` facade.
3
3
  *
4
- * Three routes and deliberately no fourth — there is no resume/adopt route to
4
+ * The list and status reads are secret-free. There is no resume/adopt route to
5
5
  * hand a `{clientId, secret}` back to, so the CLI mints fresh per invocation.
6
6
  */
7
7
  export {};
@@ -14,8 +14,16 @@ export interface WaitMemberResult {
14
14
  code: string;
15
15
  message: string;
16
16
  exitCode?: number;
17
+ nextAction?: string;
18
+ serverNextAction?: string;
19
+ requestId?: string;
20
+ details?: Record<string, unknown>;
21
+ apiUrl?: string;
17
22
  };
18
23
  }
24
+ export declare function waitMemberError(err: ApiError): NonNullable<WaitMemberResult['error']> & {
25
+ exitCode: number;
26
+ };
19
27
  /**
20
28
  * Resolve the process-level failure for a completed `--wait` fan-out, or `null`
21
29
  * when every member passed. Shared by `test run --all` / `test rerun` and
@@ -1,4 +1,47 @@
1
- import { ApiError, CLIError, isAuthCode } from './errors.js';
1
+ import { ApiError, CLIError, isAuthCode, isErrorCode } from './errors.js';
2
+ import { classifyBillingRefusal, isPausedReason } from './billing-refusal.js';
3
+ /**
4
+ * Envelope metadata for a billing/feature-gate member error, keyed by the
5
+ * IDENTITY of the object `waitMemberError` returns. The enumerable shape of
6
+ * that object must stay exactly `{ code, message, exitCode }` — it lands
7
+ * verbatim in `--output json` stdout (`accepted[]` / `results[]`), and a
8
+ * `nextAction` / `details` / `apiUrl` riding along there would both leak
9
+ * internal fields to every consumer AND (since the guard below fires for
10
+ * every FEATURE_GATED, including `rollout`) attach billing-looking data to a
11
+ * refusal that isn't one. The extra fields `resolveWaitFailure` needs to
12
+ * reconstruct a faithful ApiError travel here instead, out of band.
13
+ */
14
+ const memberEnvelopeMeta = new WeakMap();
15
+ export function waitMemberError(err) {
16
+ const memberError = { code: err.code, message: err.message, exitCode: err.exitCode };
17
+ if (err.code === 'FEATURE_GATED' || classifyBillingRefusal(err)) {
18
+ memberEnvelopeMeta.set(memberError, {
19
+ nextAction: err.nextAction,
20
+ serverNextAction: err.serverNextAction,
21
+ requestId: err.requestId,
22
+ details: err.details,
23
+ apiUrl: err.apiUrl,
24
+ });
25
+ }
26
+ return memberError;
27
+ }
28
+ /**
29
+ * Read a member error's out-of-band envelope metadata, falling back to
30
+ * whatever the object carries as OWN enumerable properties. The fallback
31
+ * exists for callers that build a `WaitMemberResult['error']` by hand (a
32
+ * legacy/shared JUnit result shape, or a test fixture) rather than through
33
+ * `waitMemberError` — those never got a `memberEnvelopeMeta` entry, so their
34
+ * fields must still be read the old way.
35
+ */
36
+ function memberMeta(error) {
37
+ return (memberEnvelopeMeta.get(error) ?? {
38
+ nextAction: error.nextAction,
39
+ serverNextAction: error.serverNextAction,
40
+ requestId: error.requestId,
41
+ details: error.details,
42
+ apiUrl: error.apiUrl,
43
+ });
44
+ }
2
45
  /**
3
46
  * Exit-code precedence for a `--wait` fan-out, highest first. Ordered
4
47
  * batch-wide-non-retriable → per-run → transient → timeout → generic:
@@ -61,10 +104,39 @@ export function resolveWaitFailure(results, opts) {
61
104
  // non-1 exit like 0/99). Routed through the ENVELOPE so `--output json`
62
105
  // carries `error.code` — the machine-readable field this fix exists for;
63
106
  // `ApiError.fromEnvelope` derives the exit via `exitCodeFor(code)`.
64
- const operational = errored
65
- .filter(r => isOperationalCode(r.error.exitCode ?? 1))
66
- .sort((a, b) => priorityOf(a.error.exitCode) - priorityOf(b.error.exitCode))[0];
107
+ const operationalCandidates = errored.filter(r => isOperationalCode(r.error.exitCode ?? 1));
108
+ // Narrow exception to the table above (mirrors the identical rule in
109
+ // conflict-reason.ts's `isPausedRefusal`): when EVERY operational
110
+ // member is a billing refusal and at least one is a paused workspace, paused
111
+ // wins over a plain credits shortfall — topping up credits cannot resume a
112
+ // paused workspace. This does not reorder WAIT_EXIT_PRIORITY for any other
113
+ // code combination.
114
+ const isPausedMember = (r) => r.error.code === 'FEATURE_GATED' && isPausedReason(memberMeta(r.error).details?.reason);
115
+ const isBillingRefusalMember = (r) => r.error.code === 'INSUFFICIENT_CREDITS' || isPausedMember(r);
116
+ const operational = operationalCandidates.length > 0 &&
117
+ operationalCandidates.every(isBillingRefusalMember) &&
118
+ operationalCandidates.some(isPausedMember)
119
+ ? operationalCandidates.find(isPausedMember)
120
+ : operationalCandidates.sort((a, b) => priorityOf(a.error.exitCode) - priorityOf(b.error.exitCode))[0];
67
121
  if (operational) {
122
+ const meta = memberMeta(operational.error);
123
+ if (meta.details && isErrorCode(operational.error.code)) {
124
+ // Merge the server's own details with the local runId/testId (never the
125
+ // reverse) so automation reading `error.details.runId`/`testId` keeps
126
+ // working for a billing refusal exactly as it does for any other typed
127
+ // error, while `reason` (billing_hold / rollout / …) survives untouched.
128
+ return new ApiError({
129
+ code: operational.error.code,
130
+ message: operational.error.message,
131
+ nextAction: meta.nextAction ?? '',
132
+ requestId: meta.requestId ?? 'local',
133
+ details: {
134
+ ...meta.details,
135
+ runId: operational.runId ?? null,
136
+ testId: operational.testId ?? null,
137
+ },
138
+ }, undefined, undefined, meta.apiUrl, meta.serverNextAction);
139
+ }
68
140
  return ApiError.fromEnvelope({
69
141
  error: {
70
142
  code: operational.error.code,
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The workspace's billing standing, as `GET /me` reports it under
3
+ * `activeOrg.workspace` (backend `WorkspaceGateService.status`). `state` is
4
+ * what the FE banners key on; `notice` is the refusal every write will get
5
+ * while the workspace is paused, already worded — it is null while the
6
+ * workspace can be written to.
7
+ */
8
+ export interface WorkspaceStatus {
9
+ state: 'ok' | 'pending' | 'paused';
10
+ tier: string;
11
+ notice: {
12
+ title: string;
13
+ message: string;
14
+ cta: string;
15
+ billingUrl: string;
16
+ } | null;
17
+ }
18
+ /**
19
+ * One line for the text renderers (`auth status`, `usage`) — undefined when
20
+ * the workspace is simply on its plan, so the callers print nothing then.
21
+ * `--output json` carries the whole object; this is the human reading of it.
22
+ */
23
+ export declare function formatWorkspaceStatus(ws: WorkspaceStatus | undefined): string | undefined;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * One line for the text renderers (`auth status`, `usage`) — undefined when
3
+ * the workspace is simply on its plan, so the callers print nothing then.
4
+ * `--output json` carries the whole object; this is the human reading of it.
5
+ */
6
+ export function formatWorkspaceStatus(ws) {
7
+ if (!ws || ws.state === 'ok')
8
+ return undefined;
9
+ if (ws.notice)
10
+ return `${ws.state} — ${ws.notice.message} ${ws.notice.cta}: ${ws.notice.billingUrl}`;
11
+ if (ws.state === 'pending')
12
+ return 'pending — a scheduled plan change or a payment retry is in progress; the workspace keeps working meanwhile';
13
+ return ws.state;
14
+ }
15
+ //# sourceMappingURL=workspace-status.js.map
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The CLI targets modern Node (see `engines.node` in package.json). Running on
5
5
  * an older runtime tends to fail later with a cryptic ESM/syntax error, so the
6
- * entrypoint (`src/index.ts`) uses {@link shouldRejectNodeVersion} to exit early
6
+ * entrypoint (`src/index.ts`) uses {@link rejectUnsupportedNodeVersion} to exit early
7
7
  * with a clear, actionable message instead.
8
8
  *
9
9
  * The logic lives here (rather than inline) so it can be unit-tested against the
@@ -34,3 +34,9 @@ export declare function parseMajorVersion(nodeVersion: string): number;
34
34
  * @returns `true` when the runtime is unsupported and should be rejected.
35
35
  */
36
36
  export declare function shouldRejectNodeVersion(nodeVersion: string): boolean;
37
+ export interface RejectUnsupportedNodeDeps {
38
+ writeStderr?: (message: string) => void;
39
+ exit?: (code: number) => void;
40
+ }
41
+ /** Write synchronously so an immediate exit cannot truncate piped stderr. */
42
+ export declare function rejectUnsupportedNodeVersion(nodeVersion: string, deps?: RejectUnsupportedNodeDeps): void;
@@ -3,12 +3,13 @@
3
3
  *
4
4
  * The CLI targets modern Node (see `engines.node` in package.json). Running on
5
5
  * an older runtime tends to fail later with a cryptic ESM/syntax error, so the
6
- * entrypoint (`src/index.ts`) uses {@link shouldRejectNodeVersion} to exit early
6
+ * entrypoint (`src/index.ts`) uses {@link rejectUnsupportedNodeVersion} to exit early
7
7
  * with a clear, actionable message instead.
8
8
  *
9
9
  * The logic lives here (rather than inline) so it can be unit-tested against the
10
10
  * real implementation the entrypoint uses — not a copy.
11
11
  */
12
+ import { writeSync } from 'node:fs';
12
13
  /** Canonical supported range, pinned to package.json by the unit test. */
13
14
  export const SUPPORTED_NODE_ENGINE = '^20.19.0 || ^22.13.0 || >=24';
14
15
  /** Human-readable form of the supported range for startup errors. */
@@ -64,4 +65,21 @@ export function shouldRejectNodeVersion(nodeVersion) {
64
65
  return true;
65
66
  return false;
66
67
  }
68
+ /** Write synchronously so an immediate exit cannot truncate piped stderr. */
69
+ export function rejectUnsupportedNodeVersion(nodeVersion, deps = {}) {
70
+ if (!shouldRejectNodeVersion(nodeVersion))
71
+ return;
72
+ const writeStderr = deps.writeStderr ??
73
+ ((message) => {
74
+ try {
75
+ writeSync(process.stderr.fd, message);
76
+ }
77
+ catch {
78
+ // Best-effort: the runtime still exits when stderr is unavailable.
79
+ }
80
+ });
81
+ const exit = deps.exit ?? ((code) => process.exit(code));
82
+ writeStderr(`Error: testsprite requires Node.js ${SUPPORTED_NODE_RANGE} (found ${nodeVersion}).\nInstall a supported Node.js release from https://nodejs.org\n`);
83
+ exit(1);
84
+ }
67
85
  //# sourceMappingURL=version-guard.js.map
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.12.0";
1
+ export declare const VERSION = "0.13.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by scripts/generate-version.mjs — do not edit by hand.
2
2
  // Run `npm run build` (or `npm run generate:version`) to regenerate.
3
- export const VERSION = '0.12.0';
3
+ export const VERSION = '0.13.0';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testsprite/testsprite-cli",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Official TestSprite command-line interface",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "prebuild": "node scripts/generate-version.mjs",
19
19
  "build": "tsc -p tsconfig.build.json && node scripts/postbuild.mjs",
20
20
  "clean": "rm -rf dist coverage",
21
- "lint": "eslint .",
21
+ "lint": "eslint . && node .github/scripts/check-ticket-refs.mjs",
22
22
  "lint:fix": "eslint . --fix",
23
23
  "format": "prettier --write .",
24
24
  "format:check": "prettier --check .",
@@ -67,7 +67,7 @@
67
67
  "devDependencies": {
68
68
  "@eslint/js": "^10.0.1",
69
69
  "@types/node": "^22.9.0",
70
- "@vitest/coverage-v8": "^2.1.4",
70
+ "@vitest/coverage-v8": "^4.1.11",
71
71
  "ajv": "^8.20.0",
72
72
  "eslint": "^10.7.0",
73
73
  "eslint-config-prettier": "^9.1.0",
@@ -78,6 +78,6 @@
78
78
  "selfsigned": "^5.5.0",
79
79
  "typescript": "^5.6.3",
80
80
  "typescript-eslint": "^8.13.0",
81
- "vitest": "^2.1.4"
81
+ "vitest": "^4.1.11"
82
82
  }
83
83
  }
@@ -216,9 +216,9 @@ testsprite test run <testId> --local <port> --local-host <host> # local fronten
216
216
 
217
217
  Do **not** run the whole suite automatically. V3 frontend runs, including local runs,
218
218
  cost 0.5 credit each; check `testsprite usage` before sizing the suite.
219
- Local runs imply waiting (1200 seconds by default); one test per invocation, parallel
220
- invocations allowed, 5 live tunnel bindings per user. Keep the early stderr `Run <runId>`
221
- receipt. An owned local timeout cancels by default: start a new run with
219
+ Local runs wait (1200 s per run). Put several in ONE `test run <id> <id> --local <port>`
220
+ (one tunnel, 5 at a time); each process holds 1 of 5 tunnel slots. Keep the stderr
221
+ `Run <runId>` receipt. An owned local timeout cancels by default: start a new run with
222
222
  `--local <port> --local-host <host> --timeout 1800` (same host), not `test wait`. A run cancelled before it finished is refunded.
223
223
 
224
224
  ### 6. Report
@@ -229,7 +229,7 @@ Tell the user, plainly:
229
229
  - "I smoke-ran **M** — here's the result: <pass/fail + the dashboard link from the run output>."
230
230
  - "To run the rest (≈X credits — state the cost so they choose knowingly):
231
231
  - frontend — use `test run <testId> --wait` for deployed targets or
232
- `test run <testId> --local <port> --local-host <host>` for local targets (`--all --local` is refused);
232
+ `test run --all --project <id> --local <port> --local-host <host>` for local targets;
233
233
  - backend — `testsprite test run --all --project <id>` (wave-ordered, runs every BE test)."
234
234
 
235
235
  ## Quality checklist (self-check before reporting done)