@testsprite/testsprite-cli 0.10.0 → 0.12.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 (61) hide show
  1. package/README.md +65 -41
  2. package/dist/commands/auth.d.ts +5 -1
  3. package/dist/commands/auth.js +17 -5
  4. package/dist/commands/ci.js +34 -4
  5. package/dist/commands/init.d.ts +6 -1
  6. package/dist/commands/init.js +13 -5
  7. package/dist/commands/project-env.d.ts +90 -0
  8. package/dist/commands/project-env.js +486 -0
  9. package/dist/commands/project.d.ts +19 -0
  10. package/dist/commands/project.js +92 -25
  11. package/dist/commands/test.d.ts +42 -4
  12. package/dist/commands/test.js +344 -49
  13. package/dist/commands/testlist.js +29 -3
  14. package/dist/commands/tunnel.d.ts +2 -2
  15. package/dist/commands/tunnel.js +139 -31
  16. package/dist/index.js +42 -14
  17. package/dist/lib/client-factory.d.ts +4 -1
  18. package/dist/lib/client-factory.js +14 -4
  19. package/dist/lib/client-tag.d.ts +13 -0
  20. package/dist/lib/client-tag.js +44 -0
  21. package/dist/lib/conflict-reason.d.ts +43 -2
  22. package/dist/lib/conflict-reason.js +100 -14
  23. package/dist/lib/credentials.d.ts +4 -0
  24. package/dist/lib/credentials.js +43 -4
  25. package/dist/lib/cron.js +8 -1
  26. package/dist/lib/errors.d.ts +44 -1
  27. package/dist/lib/errors.js +69 -12
  28. package/dist/lib/gh-output.d.ts +25 -11
  29. package/dist/lib/gh-output.js +36 -13
  30. package/dist/lib/http.d.ts +21 -2
  31. package/dist/lib/http.js +45 -8
  32. package/dist/lib/local-target.d.ts +32 -0
  33. package/dist/lib/local-target.js +77 -0
  34. package/dist/lib/output.d.ts +27 -1
  35. package/dist/lib/output.js +22 -3
  36. package/dist/lib/response-schemas.d.ts +5 -2
  37. package/dist/lib/response-schemas.js +39 -1
  38. package/dist/lib/runs.types.d.ts +50 -2
  39. package/dist/lib/target-url.d.ts +1 -1
  40. package/dist/lib/target-url.js +35 -12
  41. package/dist/lib/telemetry.d.ts +174 -4
  42. package/dist/lib/telemetry.js +286 -13
  43. package/dist/lib/tunnel-session.d.ts +13 -2
  44. package/dist/lib/tunnel-session.js +92 -23
  45. package/dist/lib/tunnel.types.d.ts +3 -1
  46. package/dist/lib/version-notice.d.ts +20 -1
  47. package/dist/lib/version-notice.js +59 -12
  48. package/dist/vendor/tunnel-client/client.d.ts +11 -0
  49. package/dist/vendor/tunnel-client/client.js +383 -56
  50. package/dist/vendor/tunnel-client/config.d.ts +11 -3
  51. package/dist/vendor/tunnel-client/config.js +11 -3
  52. package/dist/vendor/tunnel-client/types.d.ts +26 -1
  53. package/dist/vendor/tunnel-client/types.js +1 -0
  54. package/dist/vendor/tunnel-client/ws-compat.d.ts +3 -2
  55. package/dist/vendor/tunnel-client/ws-compat.js +3 -2
  56. package/dist/version.d.ts +1 -1
  57. package/dist/version.js +1 -1
  58. package/package.json +2 -1
  59. package/skills/testsprite-onboard.skill.md +74 -59
  60. package/skills/testsprite-verify.codex.md +82 -97
  61. package/skills/testsprite-verify.skill.md +64 -15
@@ -6,12 +6,14 @@ import { Command } from 'commander';
6
6
  import { emitDryRunBanner, makeHttpClient, parseRequestTimeoutFlag, resolveRequestTimeoutMs, } from '../lib/client-factory.js';
7
7
  import { ApiError, InterruptError, RequestTimeoutError } from '../lib/errors.js';
8
8
  import { globalShutdown } from '../lib/interrupt.js';
9
+ import { assertStoredLocalTargetListening, buildLocalTargetUrl, DEFAULT_LOCAL_HOST, parseStoredLocalTarget, } from '../lib/local-target.js';
9
10
  import { GLOBAL_OPTS_HINT, Output, resolveOutputMode } from '../lib/output.js';
10
11
  import { readSecretFileGuarded } from '../lib/secret-file.js';
11
12
  import { assertNotLocal } from '../lib/target-url.js';
12
13
  import { renderTextTable, resolveTextColumns } from '../lib/text-table.js';
13
14
  import { assertIdempotencyKey } from '../lib/validate.js';
14
15
  import { fetchSinglePage, paginate, validatePaginationFlags, } from '../lib/pagination.js';
16
+ import { createProjectEnvCommand } from './project-env.js';
15
17
  /** Attribute names are interpolated into CSS selectors by the engine — keep them plain. */
16
18
  const TEST_ID_ATTRIBUTE_NAME = /^[A-Za-z_][\w.:-]*$/;
17
19
  const TEST_ID_ATTRIBUTES_MAX = 10;
@@ -109,16 +111,27 @@ export async function runCreate(opts, deps = {}) {
109
111
  if (opts.description !== undefined) {
110
112
  throw localValidationError('--description is not supported for projects; omit it (test-level descriptions are set on `test create`)');
111
113
  }
114
+ if (opts.local !== undefined && opts.type !== 'frontend') {
115
+ throw localValidationError('--local projects are frontend-only');
116
+ }
117
+ const localTarget = parseStoredLocalTarget({
118
+ local: opts.local,
119
+ localHost: opts.localHost,
120
+ url: opts.targetUrl,
121
+ });
122
+ const targetUrl = localTarget
123
+ ? buildLocalTargetUrl(localTarget.host, localTarget.port)
124
+ : opts.targetUrl;
112
125
  // P2-7: guard --url against localhost/RFC1918/non-http(s) (same rules as
113
126
  // `test create --target-url`). Applies to both FE (required) and BE (optional).
114
127
  if (opts.targetUrl !== undefined) {
115
128
  assertNotLocal(opts.targetUrl, {
116
129
  field: 'url',
117
130
  helpCommand: 'testsprite project create',
118
- hintContext: 'bootstrap',
131
+ hintContext: 'local-project-create',
119
132
  });
120
133
  }
121
- if (opts.type === 'frontend' && !opts.targetUrl) {
134
+ if (opts.type === 'frontend' && !targetUrl) {
122
135
  throw localValidationError('--url is required for --type frontend');
123
136
  }
124
137
  if (opts.dryRun) {
@@ -141,7 +154,8 @@ export async function runCreate(opts, deps = {}) {
141
154
  id: 'p_dryrun_2026',
142
155
  type: opts.type,
143
156
  name: opts.name,
144
- targetUrl: opts.targetUrl ?? '',
157
+ targetUrl: targetUrl ?? '',
158
+ ...(localTarget ? { originMode: 'local' } : {}),
145
159
  createdFrom: 'cli',
146
160
  createdAt: '2026-05-16T00:00:00.000Z',
147
161
  updatedAt: '2026-05-16T00:00:00.000Z',
@@ -149,6 +163,9 @@ export async function runCreate(opts, deps = {}) {
149
163
  out.print(sample, data => renderCreateProjectText(data));
150
164
  return sample;
151
165
  }
166
+ if (localTarget) {
167
+ await assertStoredLocalTargetListening(localTarget, opts, deps.localPortProbeDeps);
168
+ }
152
169
  // Resolve password: flag > file > none
153
170
  let password = opts.password;
154
171
  if (password === undefined && opts.passwordFile !== undefined) {
@@ -161,7 +178,8 @@ export async function runCreate(opts, deps = {}) {
161
178
  const body = {
162
179
  type: opts.type,
163
180
  name: opts.name,
164
- ...(opts.targetUrl !== undefined ? { targetUrl: opts.targetUrl } : {}),
181
+ ...(targetUrl !== undefined ? { targetUrl } : {}),
182
+ ...(localTarget ? { originMode: 'local' } : {}),
165
183
  ...(opts.username !== undefined ? { username: opts.username } : {}),
166
184
  ...(password !== undefined ? { password } : {}),
167
185
  ...(opts.instruction !== undefined ? { instruction: opts.instruction } : {}),
@@ -186,7 +204,7 @@ export async function runCreate(opts, deps = {}) {
186
204
  ...rawCreated,
187
205
  ...(resolvedId !== undefined ? { projectId: resolvedId, id: resolvedId } : {}),
188
206
  };
189
- out.print(created, data => renderCreateProjectText(data));
207
+ out.print(created, data => renderCreateProjectText(data, localTarget));
190
208
  // A backend project created without --url has no default environment URL.
191
209
  // On the V3 execution path, the shared admission guard (`runProjectGuarded`
192
210
  // -> `assertProjectEnvNotLocal`, called by every V3 run/rerun/batch entry
@@ -249,12 +267,24 @@ export async function runUpdate(opts, deps = {}) {
249
267
  if (opts.name !== undefined && opts.name.length > 200) {
250
268
  throw localValidationError('--name must be at most 200 characters');
251
269
  }
252
- // P2-7: guard --url against localhost/RFC1918/non-http(s).
270
+ // `--local <port>` is the one way to point a project at an app on this
271
+ // machine, on update exactly as on create. A loopback `--url` has no
272
+ // accepted form here and is redirected to `--local`. The project's type is
273
+ // not known client-side on update; the server refuses `--local` on a
274
+ // backend project.
275
+ const localTarget = parseStoredLocalTarget({
276
+ local: opts.local,
277
+ localHost: opts.localHost,
278
+ url: opts.targetUrl,
279
+ });
280
+ const targetUrl = localTarget
281
+ ? buildLocalTargetUrl(localTarget.host, localTarget.port)
282
+ : opts.targetUrl;
253
283
  if (opts.targetUrl !== undefined) {
254
284
  assertNotLocal(opts.targetUrl, {
255
285
  field: 'url',
256
286
  helpCommand: 'testsprite project update',
257
- hintContext: 'bootstrap',
287
+ hintContext: 'local-project-create',
258
288
  });
259
289
  }
260
290
  if (opts.testIdAttributes !== undefined && opts.clearTestIdAttributes) {
@@ -263,7 +293,7 @@ export async function runUpdate(opts, deps = {}) {
263
293
  const passwordSupplied = opts.password !== undefined || opts.passwordFile !== undefined;
264
294
  const mutableFields = {
265
295
  name: opts.name !== undefined,
266
- targetUrl: opts.targetUrl !== undefined,
296
+ targetUrl: targetUrl !== undefined,
267
297
  username: opts.username !== undefined,
268
298
  password: passwordSupplied,
269
299
  instruction: opts.instruction !== undefined,
@@ -293,9 +323,12 @@ export async function runUpdate(opts, deps = {}) {
293
323
  updatedFields: presentFieldNames,
294
324
  updatedAt: '2026-05-16T00:00:00.000Z',
295
325
  };
296
- out.print(sample, data => renderUpdateText(data));
326
+ out.print(sample, data => renderUpdateText(data, localTarget));
297
327
  return sample;
298
328
  }
329
+ if (localTarget) {
330
+ await assertStoredLocalTargetListening(localTarget, opts, deps.localPortProbeDeps);
331
+ }
299
332
  // Resolve password only on the real path. Dry-run must not touch the
300
333
  // filesystem, even when --password-file is present.
301
334
  let password = opts.password;
@@ -308,7 +341,8 @@ export async function runUpdate(opts, deps = {}) {
308
341
  }
309
342
  const bodyFields = {
310
343
  name: opts.name,
311
- targetUrl: opts.targetUrl,
344
+ targetUrl,
345
+ originMode: localTarget ? 'local' : undefined,
312
346
  username: opts.username,
313
347
  password,
314
348
  instruction: opts.instruction,
@@ -337,7 +371,7 @@ export async function runUpdate(opts, deps = {}) {
337
371
  ? { projectId: resolvedUpdatedId, id: resolvedUpdatedId }
338
372
  : {}),
339
373
  };
340
- out.print(updated, data => renderUpdateText(data));
374
+ out.print(updated, data => renderUpdateText(data, localTarget));
341
375
  return updated;
342
376
  }
343
377
  /**
@@ -937,8 +971,11 @@ export function createProjectCommand(deps = {}) {
937
971
  .description('Create a new project')
938
972
  .option('--type <frontend|backend>', 'project type (required)')
939
973
  .option('--name <name>', 'project name (required)')
940
- .option('--url <url>', 'target URL (required for frontend; also required for backend on the V3 execution ' +
974
+ .option('--url <url>', 'target URL (required for frontend unless --local is used; also required for backend on the V3 execution ' +
941
975
  'path — see `auth status` for your routing)')
976
+ .option('--local <port>', 'create a frontend project for an app on this machine (1-65535; excludes --url)')
977
+ .option('--local-host <host>', 'loopback host: localhost, 127.0.0.1 (default), or ::1; requires --local')
978
+ .option('--skip-preflight', 'skip the local TCP listener check before project creation')
942
979
  .option('--description <text>', 'not supported — projects have no description (test-level descriptions are set on `test create`)')
943
980
  .option('--username <user>', 'optional auth username')
944
981
  .option('--password <pw>', 'optional auth password (use --password-file for non-interactive)')
@@ -957,14 +994,14 @@ export function createProjectCommand(deps = {}) {
957
994
  if (type !== 'frontend' && type !== 'backend') {
958
995
  throw localValidationError('--type must be frontend or backend');
959
996
  }
960
- if (type === 'frontend' && !cmdOpts.url) {
961
- throw localValidationError('--url is required for --type frontend');
962
- }
963
997
  await runCreate({
964
998
  ...resolveCommonOptions(command),
965
999
  type,
966
1000
  name: cmdOpts.name,
967
1001
  targetUrl: cmdOpts.url,
1002
+ local: cmdOpts.local,
1003
+ localHost: cmdOpts.localHost,
1004
+ skipPreflight: cmdOpts.skipPreflight,
968
1005
  description: cmdOpts.description,
969
1006
  username: cmdOpts.username,
970
1007
  password: cmdOpts.password,
@@ -980,7 +1017,10 @@ export function createProjectCommand(deps = {}) {
980
1017
  .command('update <project-id>')
981
1018
  .description('Update project metadata')
982
1019
  .option('--name <name>', 'new project name')
983
- .option('--url <url>', 'new target URL')
1020
+ .option('--url <url>', 'new target URL (public; for an app on this machine use --local)')
1021
+ .option('--local <port>', 'point the project at an app on this machine (1-65535; excludes --url; frontend only)')
1022
+ .option('--local-host <host>', 'loopback host: localhost, 127.0.0.1 (default), or ::1; requires --local')
1023
+ .option('--skip-preflight', 'skip the local TCP listener check before the update')
984
1024
  .option('--username <user>', 'new auth username')
985
1025
  .option('--password <pw>', 'new auth password')
986
1026
  .option('--password-file <path>', 'read new password from file')
@@ -996,6 +1036,9 @@ export function createProjectCommand(deps = {}) {
996
1036
  projectId,
997
1037
  name: cmdOpts.name,
998
1038
  targetUrl: cmdOpts.url,
1039
+ local: cmdOpts.local,
1040
+ localHost: cmdOpts.localHost,
1041
+ skipPreflight: cmdOpts.skipPreflight,
999
1042
  username: cmdOpts.username,
1000
1043
  password: cmdOpts.password,
1001
1044
  passwordFile: cmdOpts.passwordFile,
@@ -1132,6 +1175,9 @@ export function createProjectCommand(deps = {}) {
1132
1175
  }, deps);
1133
1176
  });
1134
1177
  project.addCommand(docs);
1178
+ // DEV-1305: `project env <verb>` — the per-project environment surface
1179
+ // (credentials, URL, default). Own module; `deps` threaded so tests inject.
1180
+ project.addCommand(createProjectEnvCommand(deps));
1135
1181
  return project;
1136
1182
  }
1137
1183
  function parseFlag(raw, flagName) {
@@ -1201,19 +1247,26 @@ const PROJECT_LIST_COLUMNS = [
1201
1247
  width: rows => Math.max(3, ...rows.map(project => (project.orgName ?? project.orgId ?? '').length)),
1202
1248
  render: project => project.orgName ?? project.orgId ?? '',
1203
1249
  },
1250
+ {
1251
+ header: 'URL',
1252
+ width: rows => Math.max(3, ...rows.map(project => renderProjectUrl(project).length)),
1253
+ render: renderProjectUrl,
1254
+ },
1204
1255
  { header: 'CREATED', width: 0, render: project => project.createdAt },
1205
1256
  ];
1206
- const PROJECT_LIST_ORG_COLUMN = PROJECT_LIST_COLUMNS.find(c => c.header === 'ORG');
1257
+ function renderProjectUrl(project) {
1258
+ const url = project.targetUrl ?? '';
1259
+ return project.originMode === 'local' ? `${url ? `${url} ` : ''}(Local)` : url;
1260
+ }
1207
1261
  /**
1208
1262
  * Default (no explicit `--columns`) column set. ORG is included only when
1209
- * at least one row in this page carries `orgId` — avoids widening the table
1210
- * for callers whose projects have no org attribution at all.
1263
+ * at least one row carries `orgId`; URL is included when a row is local.
1264
+ * Older responses retain the existing default table columns.
1211
1265
  */
1212
1266
  function defaultProjectListColumns(rows) {
1213
1267
  const hasOrgInfo = rows.some(project => project.orgId !== undefined);
1214
- return hasOrgInfo
1215
- ? PROJECT_LIST_COLUMNS
1216
- : PROJECT_LIST_COLUMNS.filter(c => c !== PROJECT_LIST_ORG_COLUMN);
1268
+ const hasLocalProject = rows.some(project => project.originMode === 'local');
1269
+ return PROJECT_LIST_COLUMNS.filter(column => (column.header !== 'ORG' || hasOrgInfo) && (column.header !== 'URL' || hasLocalProject));
1217
1270
  }
1218
1271
  function renderProjectListText(page, options = {}) {
1219
1272
  if (page.items.length === 0) {
@@ -1252,9 +1305,12 @@ function renderProjectText(p) {
1252
1305
  // hint) from "this endpoint doesn't report it" (say nothing).
1253
1306
  if ('targetUrl' in p) {
1254
1307
  lines.push(p.targetUrl
1255
- ? `targetUrl: ${p.targetUrl}`
1308
+ ? `targetUrl: ${renderProjectUrl(p)}`
1256
1309
  : `targetUrl: (not set — set one with: testsprite project update ${p.id} --url <url>)`);
1257
1310
  }
1311
+ if (p.originMode === 'local' && !p.targetUrl) {
1312
+ lines.push('originMode: local (Local)');
1313
+ }
1258
1314
  // Presence-keyed like targetUrl: older backends don't report the field at all.
1259
1315
  if ('testIdAttributes' in p) {
1260
1316
  lines.push(p.testIdAttributes && p.testIdAttributes.length > 0
@@ -1269,7 +1325,7 @@ function renderProjectText(p) {
1269
1325
  * field is proven reliable) because the create response's id field name and
1270
1326
  * `updatedAt` presence are not guaranteed — see `CliCreateProjectResponse`.
1271
1327
  */
1272
- function renderCreateProjectText(p) {
1328
+ function renderCreateProjectText(p, localTarget) {
1273
1329
  const lines = [
1274
1330
  `id: ${resolveCreatedProjectId(p) ?? '(unknown)'}`,
1275
1331
  `name: ${p.name}`,
@@ -1279,15 +1335,26 @@ function renderCreateProjectText(p) {
1279
1335
  ];
1280
1336
  if (p.updatedAt !== undefined)
1281
1337
  lines.push(`updatedAt: ${p.updatedAt}`);
1338
+ if (localTarget) {
1339
+ const projectId = resolveCreatedProjectId(p) ?? '<project-id>';
1340
+ const url = buildLocalTargetUrl(localTarget.host, localTarget.port);
1341
+ const hostFlag = localTarget.host === DEFAULT_LOCAL_HOST ? '' : ` --local-host ${localTarget.host}`;
1342
+ lines.push(`Local project: TestSprite will reach ${url} only through a tunnel from this machine.`, 'Next: write a plan and run it locally:', ` In plan.json, set projectId to ${projectId}.`, ` testsprite test create --project ${projectId} --plan-from plan.json`, ` testsprite test run <test-id> --local ${localTarget.port}${hostFlag}`, `Portal runs of this project stay blocked (free) until you set a public URL with: testsprite project update ${projectId} --url https://...`);
1343
+ }
1282
1344
  return lines.join('\n');
1283
1345
  }
1284
- function renderUpdateText(r) {
1346
+ function renderUpdateText(r, localTarget) {
1285
1347
  const lines = [
1286
1348
  `id: ${resolveUpdatedProjectId(r) ?? '(unknown)'}`,
1287
1349
  `updatedFields: ${r.updatedFields?.join(', ') ?? '(none)'}`,
1288
1350
  ];
1289
1351
  if (r.updatedAt !== undefined)
1290
1352
  lines.push(`updatedAt: ${r.updatedAt}`);
1353
+ if (localTarget) {
1354
+ const url = buildLocalTargetUrl(localTarget.host, localTarget.port);
1355
+ const hostFlag = localTarget.host === DEFAULT_LOCAL_HOST ? '' : ` --local-host ${localTarget.host}`;
1356
+ lines.push(`Local project: TestSprite will reach ${url} only through a tunnel from this machine.`, `Run its tests with: testsprite test run <test-id> --local ${localTarget.port}${hostFlag}`);
1357
+ }
1291
1358
  return lines.join('\n');
1292
1359
  }
1293
1360
  function renderDeleteText(r) {
@@ -6,8 +6,9 @@ import { ApiError, InterruptError } from '../lib/errors.js';
6
6
  import { type ShutdownHandle } from '../lib/interrupt.js';
7
7
  import type { FetchImpl } from '../lib/http.js';
8
8
  import { type Page } from '../lib/pagination.js';
9
+ import { type WaitTimeoutTelemetry } from '../lib/telemetry.js';
9
10
  import type { CliGetPlansResponse } from '../lib/plans.types.js';
10
- import type { RunResponse, RunStatus, TriggerRunResponse, RerunResponse, BatchRerunResponse, ListRunsResponse, RunSource, BatchRunFreshResponse, CancelRunResponse } from '../lib/runs.types.js';
11
+ import type { RunResponse, RunStatus, TriggerRunResponse, RerunResponse, BatchRerunResponse, ListRunsResponse, RunSource, BatchRunFreshResponse, CancelRunResponse, RunEnvironmentRef } from '../lib/runs.types.js';
11
12
  import { type LoopbackHost } from '../lib/local-target.js';
12
13
  import { type TunnelClientHandle } from '../lib/tunnel-session.js';
13
14
  import { type TunnelClientOptions } from '../vendor/tunnel-client/index.js';
@@ -183,6 +184,11 @@ export interface CliLatestResult {
183
184
  * (semantically equivalent to `'unresolved'`).
184
185
  */
185
186
  targetUrlSource?: 'run' | 'project-default' | 'unresolved' | null;
187
+ /**
188
+ * The environment the latest run resolved to. Absent on an older backend;
189
+ * `null` when the row names no environment.
190
+ */
191
+ environment?: RunEnvironmentRef | null;
186
192
  failedStepIndex: number | null;
187
193
  failureKind: CliFailureKind;
188
194
  /**
@@ -315,6 +321,8 @@ export interface CliFailureContext {
315
321
  failure: CliFailureBlock;
316
322
  }
317
323
  export interface TestDeps {
324
+ /** Report an exhausted poll deadline without changing the public output/error shape. */
325
+ onWaitTimeout?: (context: WaitTimeoutTelemetry) => void;
318
326
  env?: NodeJS.ProcessEnv;
319
327
  credentialsPath?: string;
320
328
  fetchImpl?: FetchImpl;
@@ -359,7 +367,10 @@ export interface TunnelDetach {
359
367
  runId: string;
360
368
  testId: string;
361
369
  localPort: number;
370
+ localHost: LoopbackHost;
362
371
  reason: TunnelDetachReason;
372
+ /** The borrowed tunnel owner disappeared while this run was non-terminal. */
373
+ ownerGone?: boolean;
363
374
  cancel: TunnelCancelOutcome;
364
375
  terminalStatus?: RunStatus;
365
376
  }
@@ -745,7 +756,7 @@ export interface CliCreateFromPlanResponse extends CliCreateTestResponse {
745
756
  * Caveat: the pinned tag only resolves once that version is actually
746
757
  * released — a locally-built/pre-release checkout may see a 404 until then.
747
758
  */
748
- export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.10.0/schemas/plan.schema.json";
759
+ export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.12.0/schemas/plan.schema.json";
749
760
  /**
750
761
  * The SINGLE canonical example plan. This
751
762
  * exact value (via `PLAN_TEMPLATE_TEXT` below) is:
@@ -934,8 +945,14 @@ export declare const DEFERRED_RETRY_DEFAULT_SLEEP_MS = 61000;
934
945
  * a secondary guard. If both fields are absent we treat the error as permanent
935
946
  * to avoid silently burning the entire retry budget on a non-recoverable state.
936
947
  *
948
+ * A 429 whose `details.reason` names a standing condition (see
949
+ * `STANDING_RATE_LIMIT_REASONS` in `lib/http.ts` — e.g. the live
950
+ * tunnel-binding cap) is also permanent, even though it now carries a real
951
+ * `Retry-After`: that header says when a retry COULD first succeed if the
952
+ * caller frees the resource, not that the condition clears on its own.
953
+ *
937
954
  * Limitation: a hypothetical future backend that emits `RATE_LIMITED` for a
938
- * third reason without a `Retry-After` header AND without the per-minute
955
+ * new reason without a `Retry-After` header AND without the per-minute
939
956
  * wording would be classified as permanent here. Document this if it occurs.
940
957
  */
941
958
  export declare function isTransientRateLimit(err: ApiError): boolean;
@@ -1371,6 +1388,8 @@ interface ResultHistoryOptions extends CommonOptions {
1371
1388
  * fresh runs, `undefined` → no filter. Applied to each page after the fetch.
1372
1389
  */
1373
1390
  rerun?: boolean;
1391
+ /** `--env <name>`: only runs whose credentials came from this environment (server-side filter). */
1392
+ environment?: string;
1374
1393
  columns?: string;
1375
1394
  noHeader?: boolean;
1376
1395
  }
@@ -1520,6 +1539,14 @@ interface RunTestRunOptions extends CommonOptions {
1520
1539
  * ordinary runs, where detaching leaves a run that can still pass.
1521
1540
  */
1522
1541
  cancelOnInterrupt?: boolean;
1542
+ /**
1543
+ * `--env <name>` — the project environment whose credentials, auto-auth and
1544
+ * OTP settings this run uses. Composes with `--local` / `--target-url` (those
1545
+ * choose WHERE the browser goes; this chooses WHOSE login it uses). Absent →
1546
+ * the project's default environment, byte-identical to today. Feature-gated
1547
+ * per workspace: checked client-side before anything is minted or billed.
1548
+ */
1549
+ environment?: string;
1523
1550
  }
1524
1551
  interface RunTestWaitOptions extends CommonOptions {
1525
1552
  runId: string;
@@ -1555,6 +1582,8 @@ interface RunTestRerunOptions extends CommonOptions {
1555
1582
  autoHealExplicit: boolean;
1556
1583
  /** --skip-dependencies: BE only. Don't expand the producer/teardown closure. */
1557
1584
  skipDependencies: boolean;
1585
+ /** `--env <name>`: see `RunTestRunOptions.environment` — the environment to replay against. */
1586
+ environment?: string;
1558
1587
  /** --max-concurrency: bounds the --wait poll fan-out (batch / BE closure). */
1559
1588
  maxConcurrency: number;
1560
1589
  /** --idempotency-key: caller-supplied; auto-minted UUID when absent. */
@@ -1590,6 +1619,13 @@ interface RunTestRerunOptions extends CommonOptions {
1590
1619
  ghOutput?: boolean;
1591
1620
  /** --summary-file: also write the reduced machine summary JSON to this path. */
1592
1621
  summaryFile?: string;
1622
+ /**
1623
+ * --allow-empty: with --all, exit 0 (instead of failing with exit 5) when the
1624
+ * resolved test set is EMPTY — no tests match --filter/--status/--skip-terminal,
1625
+ * or the project has none. Mirrors `test run --all --allow-empty`;
1626
+ * it does NOT cover ids the server rejected (notFound still gates, exit 4).
1627
+ */
1628
+ allowEmpty?: boolean;
1593
1629
  }
1594
1630
  /** Minimal client surface the backend-test wait fallback needs. */
1595
1631
  interface ResultReadClient {
@@ -1759,9 +1795,11 @@ interface RunTestRunAllOptions extends CommonOptions {
1759
1795
  * --allow-empty: exit 0 (instead of failing) when the batch dispatches ZERO
1760
1796
  * tests (all skipped / empty project / --filter matched nothing). Default off:
1761
1797
  * a zero-dispatch `--all` is a CI false-green, so it fails with exit 5 by
1762
- * default and still emits the summary / annotation / JUnit report (DEV-1046).
1798
+ * default and still emits the summary / annotation / JUnit report.
1763
1799
  */
1764
1800
  allowEmpty?: boolean;
1801
+ /** `--env <name>`: see `RunTestRunOptions.environment` — applied to every test in the batch. */
1802
+ environment?: string;
1765
1803
  }
1766
1804
  export declare function writeBatchJUnitReportIfRequested(opts: {
1767
1805
  report?: JUnitReportFormat;