@testsprite/testsprite-cli 0.12.0 → 0.14.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 (113) hide show
  1. package/README.md +59 -49
  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 +34 -20
  9. package/dist/commands/init.js +14 -11
  10. package/dist/commands/project-env.d.ts +11 -1
  11. package/dist/commands/project-env.js +408 -70
  12. package/dist/commands/project-sign-in.d.ts +60 -0
  13. package/dist/commands/project-sign-in.js +289 -0
  14. package/dist/commands/project.d.ts +14 -5
  15. package/dist/commands/project.js +110 -70
  16. package/dist/commands/schedule.d.ts +14 -0
  17. package/dist/commands/schedule.js +193 -15
  18. package/dist/commands/test.d.ts +123 -44
  19. package/dist/commands/test.js +2993 -636
  20. package/dist/commands/testlist.d.ts +10 -5
  21. package/dist/commands/testlist.js +217 -47
  22. package/dist/commands/tunnel.d.ts +26 -3
  23. package/dist/commands/tunnel.js +221 -18
  24. package/dist/commands/usage.d.ts +3 -0
  25. package/dist/commands/usage.js +12 -5
  26. package/dist/index.js +39 -50
  27. package/dist/lib/agent-targets.d.ts +3 -3
  28. package/dist/lib/agent-targets.js +2 -2
  29. package/dist/lib/billing-refusal.d.ts +43 -0
  30. package/dist/lib/billing-refusal.js +171 -0
  31. package/dist/lib/bundle.d.ts +5 -0
  32. package/dist/lib/bundle.js +43 -13
  33. package/dist/lib/ci-linkage.d.ts +90 -0
  34. package/dist/lib/ci-linkage.js +181 -0
  35. package/dist/lib/client-factory.d.ts +16 -2
  36. package/dist/lib/client-factory.js +37 -6
  37. package/dist/lib/config.d.ts +17 -0
  38. package/dist/lib/config.js +20 -1
  39. package/dist/lib/conflict-reason.d.ts +27 -3
  40. package/dist/lib/conflict-reason.js +53 -4
  41. package/dist/lib/credentials.js +56 -14
  42. package/dist/lib/dry-run/samples.d.ts +13 -1
  43. package/dist/lib/dry-run/samples.js +104 -7
  44. package/dist/lib/environment-tunnel.d.ts +109 -0
  45. package/dist/lib/environment-tunnel.js +465 -0
  46. package/dist/lib/errors.d.ts +18 -11
  47. package/dist/lib/errors.js +123 -14
  48. package/dist/lib/failing-fe-resolver.d.ts +1 -1
  49. package/dist/lib/failing-fe-resolver.js +3 -3
  50. package/dist/lib/gh-output.d.ts +1 -0
  51. package/dist/lib/gh-output.js +16 -4
  52. package/dist/lib/history-retention.d.ts +8 -0
  53. package/dist/lib/history-retention.js +24 -0
  54. package/dist/lib/http.d.ts +39 -19
  55. package/dist/lib/http.js +46 -24
  56. package/dist/lib/interrupt.d.ts +21 -13
  57. package/dist/lib/interrupt.js +32 -21
  58. package/dist/lib/junit-report.d.ts +18 -4
  59. package/dist/lib/junit-report.js +23 -5
  60. package/dist/lib/local-target.d.ts +14 -4
  61. package/dist/lib/local-target.js +48 -13
  62. package/dist/lib/output.js +15 -1
  63. package/dist/lib/plan-poll.d.ts +11 -11
  64. package/dist/lib/plan-poll.js +15 -16
  65. package/dist/lib/plans.types.d.ts +9 -9
  66. package/dist/lib/plans.types.js +3 -3
  67. package/dist/lib/poll.d.ts +2 -2
  68. package/dist/lib/poll.js +9 -3
  69. package/dist/lib/redact.d.ts +38 -0
  70. package/dist/lib/redact.js +140 -0
  71. package/dist/lib/render-error.d.ts +21 -5
  72. package/dist/lib/render-error.js +44 -0
  73. package/dist/lib/response-schemas.d.ts +54 -12
  74. package/dist/lib/response-schemas.js +88 -7
  75. package/dist/lib/runs.types.d.ts +68 -11
  76. package/dist/lib/secret-file.js +72 -14
  77. package/dist/lib/skill-nudge.d.ts +6 -1
  78. package/dist/lib/skill-nudge.js +32 -5
  79. package/dist/lib/target-url-preflight.d.ts +6 -4
  80. package/dist/lib/target-url-preflight.js +64 -51
  81. package/dist/lib/target-url.js +11 -11
  82. package/dist/lib/telemetry.d.ts +10 -8
  83. package/dist/lib/telemetry.js +24 -17
  84. package/dist/lib/testlist.types.d.ts +1 -0
  85. package/dist/lib/ticker.d.ts +9 -0
  86. package/dist/lib/ticker.js +111 -4
  87. package/dist/lib/tunnel-session.d.ts +16 -4
  88. package/dist/lib/tunnel-session.js +7 -5
  89. package/dist/lib/tunnel.types.d.ts +12 -2
  90. package/dist/lib/tunnel.types.js +2 -2
  91. package/dist/lib/v3-advisory.js +0 -1
  92. package/dist/lib/wait-exit.d.ts +8 -0
  93. package/dist/lib/wait-exit.js +76 -4
  94. package/dist/lib/workspace-status.d.ts +23 -0
  95. package/dist/lib/workspace-status.js +15 -0
  96. package/dist/vendor/tunnel-client/client.d.ts +15 -8
  97. package/dist/vendor/tunnel-client/client.js +477 -407
  98. package/dist/vendor/tunnel-client/config.d.ts +5 -5
  99. package/dist/vendor/tunnel-client/config.js +5 -5
  100. package/dist/vendor/tunnel-client/index.d.ts +4 -4
  101. package/dist/vendor/tunnel-client/index.js +4 -4
  102. package/dist/vendor/tunnel-client/types.d.ts +19 -34
  103. package/dist/vendor/tunnel-client/types.js +1 -0
  104. package/dist/vendor/tunnel-client/ws-compat.d.ts +13 -3
  105. package/dist/vendor/tunnel-client/ws-compat.js +70 -12
  106. package/dist/version-guard.d.ts +7 -1
  107. package/dist/version-guard.js +19 -1
  108. package/dist/version.d.ts +1 -1
  109. package/dist/version.js +1 -1
  110. package/package.json +4 -4
  111. package/skills/testsprite-onboard.skill.md +8 -8
  112. package/skills/testsprite-verify.codex.md +59 -57
  113. package/skills/testsprite-verify.skill.md +53 -38
@@ -1,3 +1,4 @@
1
+ import { resolveEnvironmentRunTarget, type EnvironmentTunnelContext, type ResolvedRunTarget, type RunTargetTest } from '../lib/environment-tunnel.js';
1
2
  import { Command } from 'commander';
2
3
  import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factory.js';
3
4
  import { type WriteBundleResult } from '../lib/bundle.js';
@@ -7,7 +8,7 @@ import { type ShutdownHandle } from '../lib/interrupt.js';
7
8
  import type { FetchImpl } from '../lib/http.js';
8
9
  import { type Page } from '../lib/pagination.js';
9
10
  import { type WaitTimeoutTelemetry } from '../lib/telemetry.js';
10
- import type { CliGetPlansResponse } from '../lib/plans.types.js';
11
+ import type { CliGetPlansResponse, CliGenerationStage } from '../lib/plans.types.js';
11
12
  import type { RunResponse, RunStatus, TriggerRunResponse, RerunResponse, BatchRerunResponse, ListRunsResponse, RunSource, BatchRunFreshResponse, CancelRunResponse, RunEnvironmentRef } from '../lib/runs.types.js';
12
13
  import { type LoopbackHost } from '../lib/local-target.js';
13
14
  import { type TunnelClientHandle } from '../lib/tunnel-session.js';
@@ -50,6 +51,15 @@ export interface CliTest {
50
51
  type: 'frontend' | 'backend';
51
52
  createdFrom: 'portal' | 'mcp' | 'cli';
52
53
  status: CliPublicStatus;
54
+ statusByEnvironment?: Array<{
55
+ environmentId: string | null;
56
+ environmentName: string | null;
57
+ status: CliPublicStatus;
58
+ }>;
59
+ headlineEnvironment?: {
60
+ id: string | null;
61
+ name: string | null;
62
+ } | null;
53
63
  createdAt: string;
54
64
  updatedAt: string;
55
65
  /**
@@ -321,6 +331,10 @@ export interface CliFailureContext {
321
331
  failure: CliFailureBlock;
322
332
  }
323
333
  export interface TestDeps {
334
+ environmentCache?: Parameters<typeof resolveEnvironmentRunTarget>[0]['cache'];
335
+ creationTargets?: ReadonlyMap<string, ResolvedRunTarget>;
336
+ createdTests?: ReadonlyMap<string, RunTargetTest>;
337
+ environmentTunnel?: EnvironmentTunnelContext;
324
338
  /** Report an exhausted poll deadline without changing the public output/error shape. */
325
339
  onWaitTimeout?: (context: WaitTimeoutTelemetry) => void;
326
340
  env?: NodeJS.ProcessEnv;
@@ -341,14 +355,14 @@ export interface TestDeps {
341
355
  */
342
356
  sleep?: (ms: number) => Promise<void>;
343
357
  /**
344
- * Graceful-detach coordinator for the `--wait` paths (DEV-331 piece 1).
358
+ * Graceful-detach coordinator for the `--wait` paths.
345
359
  * Defaults to the process-wide `globalShutdown`; tests inject their own
346
360
  * controller and abort it to simulate Ctrl-C deterministically (same
347
361
  * pattern as `sleep` / `fetchImpl`).
348
362
  */
349
363
  shutdown?: ShutdownHandle;
350
364
  /**
351
- * Tunnel-client factory for `test run --local` (DEV-747 piece 3). Defaults
365
+ * Tunnel-client factory for `test run --local`. Defaults
352
366
  * to the vendored `TunnelClient`; tests inject a fake so the command's
353
367
  * contract can be exercised without a real control plane — same pattern as
354
368
  * `sleep` / `fetchImpl` / `shutdown`.
@@ -368,6 +382,8 @@ export interface TunnelDetach {
368
382
  testId: string;
369
383
  localPort: number;
370
384
  localHost: LoopbackHost;
385
+ automatic?: boolean;
386
+ environment?: string;
371
387
  reason: TunnelDetachReason;
372
388
  /** The borrowed tunnel owner disappeared while this run was non-terminal. */
373
389
  ownerGone?: boolean;
@@ -392,6 +408,7 @@ export declare function tunnelInterruptNextAction(detach: TunnelDetach, err: Int
392
408
  type CommonOptions = FactoryCommonOptions;
393
409
  interface ListOptions extends CommonOptions {
394
410
  projectId?: string;
411
+ environment?: string;
395
412
  type?: 'frontend' | 'backend';
396
413
  createdFrom?: 'portal' | 'mcp' | 'cli';
397
414
  /**
@@ -425,7 +442,7 @@ export interface CliCreateTestResponse {
425
442
  */
426
443
  warnings?: string[];
427
444
  /**
428
- * Server-built Portal deep link for the created test (DEV-737). Same
445
+ * Server-built Portal deep link for the created test. Same
429
446
  * presence/absence contract as `RunResponse.dashboardUrl`
430
447
  * (`withRunDashboardUrl` below): PRESENT (string or falsy) on a backend
431
448
  * that resolved the question at all — a falsy value means "there is no
@@ -440,6 +457,8 @@ export interface CliCreateTestResponse {
440
457
  export declare const CLI_CREATE_PRIORITIES: readonly ["p0", "p1", "p2", "p3"];
441
458
  export type CliCreatePriority = (typeof CLI_CREATE_PRIORITIES)[number];
442
459
  interface CreateOptions extends CommonOptions {
460
+ noWait?: boolean;
461
+ environment?: string;
443
462
  projectId?: string;
444
463
  type: 'frontend' | 'backend';
445
464
  name: string;
@@ -756,7 +775,7 @@ export interface CliCreateFromPlanResponse extends CliCreateTestResponse {
756
775
  * Caveat: the pinned tag only resolves once that version is actually
757
776
  * released — a locally-built/pre-release checkout may see a 404 until then.
758
777
  */
759
- export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.12.0/schemas/plan.schema.json";
778
+ export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.14.0/schemas/plan.schema.json";
760
779
  /**
761
780
  * The SINGLE canonical example plan. This
762
781
  * exact value (via `PLAN_TEMPLATE_TEXT` below) is:
@@ -804,7 +823,7 @@ export interface CliBatchSpecResult {
804
823
  field?: string;
805
824
  };
806
825
  /**
807
- * Server-built Portal deep link for this created item (DEV-737). Same
826
+ * Server-built Portal deep link for this created item. Same
808
827
  * presence/absence contract as `CliCreateTestResponse.dashboardUrl` —
809
828
  * see that field's doc.
810
829
  */
@@ -841,6 +860,7 @@ export interface CliBatchRunResult {
841
860
  code: string;
842
861
  message: string;
843
862
  exitCode: number;
863
+ details?: Record<string, unknown>;
844
864
  };
845
865
  /**
846
866
  * Portal deep link (R3b), threaded through from the SAME per-item
@@ -875,6 +895,22 @@ export interface CliCreateBatchRunResponse {
875
895
  export declare const DEFAULT_BATCH_RUN_CONCURRENCY = 50;
876
896
  /** Hard upper bound for --max-concurrency. Values above this are rejected with exit 5 (VALIDATION_ERROR). */
877
897
  export declare const MAX_BATCH_CONCURRENCY = 100;
898
+ /**
899
+ * The server's DEFAULT in-flight run cap. Runs from every source count
900
+ * toward it (CLI, portal, schedules, CI), but only CLI run triggers are
901
+ * refused on it; a portal or schedule run over the cap is not. Exceeding it
902
+ * answers RATE_LIMITED with `details.reason: "inflight_cap"`, whose details
903
+ * carry the account's real `cap` and `current`.
904
+ *
905
+ * Quoted in help text only — the server owns the real number and rejects on
906
+ * its own value, so this is documentation, never a client-side gate.
907
+ *
908
+ * Distinct from `--max-concurrency`, whose meaning differs per command: on
909
+ * `create --run` it bounds in-flight triggers, and with `--wait` a slot is
910
+ * held until that run finishes, so lowering it there does bound how many runs
911
+ * are in flight. On `run --all` it bounds the `--wait` poll fan-out only.
912
+ */
913
+ export declare const SERVER_INFLIGHT_RUN_CAP = 50;
878
914
  /** Client-side run-trigger throttle: 50 triggers per 60-second rolling window per key (sits just under the server's 60/min/key cap). */
879
915
  export declare const BATCH_RUN_RATE_LIMIT = 50;
880
916
  /** Rolling window duration (ms) for the client-side trigger rate throttle. */
@@ -905,14 +941,12 @@ export declare const WAIT_POLL_RATE_MAX_OUTER_RETRIES = 3;
905
941
  */
906
942
  /**
907
943
  * Sleep that a termination signal cuts short by rejecting with the signal's
908
- * `InterruptError`, so the caller's existing DEV-331 catch owns the detach UX.
944
+ * `InterruptError`, so the caller's existing catch owns the detach UX.
909
945
  *
910
946
  * Mirrors `HttpClient.sleepBeforeRetry` — an in-flight backoff must not be a
911
- * window where a first Ctrl-C hard-exits with empty stdout. The caller is
912
- * responsible for having ARMED the shutdown scope; a disarmed controller never
913
- * aborts its signal, so this would otherwise sleep straight through the signal.
947
+ * window where a first Ctrl-C waits for a timer before the command exits.
914
948
  */
915
- export declare function sleepUntilOrInterrupt(ms: number, signal: AbortSignal | undefined, sleep: (ms: number) => Promise<void>): Promise<void>;
949
+ export declare function sleepUntilOrInterrupt(ms: number, signal: AbortSignal | undefined, sleep: (ms: number, signal?: AbortSignal) => Promise<void>): Promise<void>;
916
950
  export declare function resolveRateLimitRetryMs(err: ApiError): number;
917
951
  /**
918
952
  * D3: max automatic retry attempts for deferred tests under `--wait`.
@@ -957,6 +991,8 @@ export declare const DEFERRED_RETRY_DEFAULT_SLEEP_MS = 61000;
957
991
  */
958
992
  export declare function isTransientRateLimit(err: ApiError): boolean;
959
993
  interface CreateFromPlanOptions extends CommonOptions {
994
+ noWait?: boolean;
995
+ environment?: string;
960
996
  /** Path to the JSON file containing one `CliPlanInput`. */
961
997
  planFrom: string;
962
998
  /** Caller-supplied idempotency token; UUIDv4 minted client-side if absent. */
@@ -1011,6 +1047,8 @@ interface CreateFromPlanOptions extends CommonOptions {
1011
1047
  */
1012
1048
  export declare function runCreateFromPlan(opts: CreateFromPlanOptions, deps?: TestDeps): Promise<CliCreateFromPlanResponse>;
1013
1049
  interface CreateBatchOptions extends CommonOptions {
1050
+ noWait?: boolean;
1051
+ environment?: string;
1014
1052
  /** Path to the JSONL file containing one `CliPlanInput` per line. */
1015
1053
  plans: string;
1016
1054
  /**
@@ -1466,8 +1504,17 @@ export interface FailureGetResult {
1466
1504
  */
1467
1505
  export declare function runFailureGet(opts: FailureGetOptions, deps?: TestDeps): Promise<FailureGetResult>;
1468
1506
  interface RunTestRunOptions extends CommonOptions {
1507
+ knownTest?: RunTargetTest;
1508
+ noWait?: boolean;
1469
1509
  testId: string;
1470
1510
  targetUrl?: string;
1511
+ /**
1512
+ * `false` only when the caller passed `--no-auto-heal`. Anything
1513
+ * else leaves the field off the wire, which is how the server's protected
1514
+ * default ("heal, but replay a user-authored body") is requested; see
1515
+ * `TriggerRunBody.autoHeal` for why an explicit `true` is never sent.
1516
+ */
1517
+ autoHeal?: false;
1471
1518
  /**
1472
1519
  * Skip the pre-charge --target-url reachability preflight (zero
1473
1520
  * network calls). Also set by a delegating caller (`runCreate`/
@@ -1553,6 +1600,11 @@ interface RunTestWaitOptions extends CommonOptions {
1553
1600
  timeoutSeconds: number;
1554
1601
  }
1555
1602
  interface RunTestRerunOptions extends CommonOptions {
1603
+ knownTests?: ReadonlyMap<string, Pick<CliTest, 'type' | 'projectId'>>;
1604
+ noWait?: boolean;
1605
+ skipPreflight?: boolean;
1606
+ concurrencyIsDefault?: boolean;
1607
+ batchResolved?: boolean;
1556
1608
  /** One or more testIds to rerun. Empty + all=false → validation error (exit 5). */
1557
1609
  testIds: string[];
1558
1610
  /** --all: resolve all tests in the project and batch-rerun them. */
@@ -1673,14 +1725,6 @@ export declare function makeBackendWaitFallback(args: {
1673
1725
  resolveNotBefore: (run: RunResponse) => string | undefined;
1674
1726
  onResolved?: (testId: string, status: CliPublicStatus) => void;
1675
1727
  }): (run: RunResponse, elapsedMs: number, signal: AbortSignal) => Promise<RunResponse | null>;
1676
- /**
1677
- * `test run <test-id>` — M3.3 piece-3.
1678
- *
1679
- * Triggers a run via `POST /api/cli/v1/tests/{testId}/runs`. With
1680
- * `--wait`, polls until terminal status (via `pollRunUntilTerminal`).
1681
- * Exit code is 0 on `passed`, 1 on `failed`/`blocked`/`cancelled`,
1682
- * 7 on timeout.
1683
- */
1684
1728
  export declare function runTestRun(opts: RunTestRunOptions, deps?: TestDeps): Promise<TriggerRunResponse | RunResponse>;
1685
1729
  /** One row of the `test wait <run-id...>` multi-run payload. */
1686
1730
  export interface CliMultiWaitResult {
@@ -1722,7 +1766,7 @@ export interface CliCancelResultRow {
1722
1766
  conflictStatus?: string;
1723
1767
  error?: string;
1724
1768
  }
1725
- /** JSON payload for a multi-id `test cancel` — per piece-3 CXL-11. */
1769
+ /** JSON payload for a multi-id `test cancel`. */
1726
1770
  export interface CliCancelSummary {
1727
1771
  cancelled: string[];
1728
1772
  alreadyCancelled: string[];
@@ -1734,7 +1778,7 @@ export interface CliCancelSummary {
1734
1778
  /**
1735
1779
  * Runs that errored for a reason other than 404/409 (e.g. auth, transport).
1736
1780
  * Always present — an empty array on full success — so machine consumers
1737
- * can rely on a stable shape (DEV-331 codex finding 2).
1781
+ * can rely on a stable shape.
1738
1782
  */
1739
1783
  errors: Array<{
1740
1784
  runId: string;
@@ -1742,13 +1786,13 @@ export interface CliCancelSummary {
1742
1786
  }>;
1743
1787
  }
1744
1788
  /**
1745
- * `test cancel <run-id...>` — DEV-331 piece 3.
1789
+ * `test cancel <run-id...>`.
1746
1790
  *
1747
1791
  * User-initiated cancel of one or more queued/running runs via
1748
- * `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent (D10): a
1792
+ * `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent: a
1749
1793
  * repeat cancel of the same run is a 200 `alreadyCancelled` success, not an
1750
- * error. Dispatches serially (per-id volume is tiny — no batch endpoint,
1751
- * D8 "Batch-level cancel endpoint... YAGNI").
1794
+ * error. Dispatches serially (per-id volume is tiny — no batch endpoint;
1795
+ * a batch-level cancel endpoint would be YAGNI).
1752
1796
  *
1753
1797
  * Single id: renders the returned run card (`status cancelled`); an
1754
1798
  * `alreadyCancelled` response adds an `[advisory]` line. Exit code mirrors
@@ -1769,6 +1813,11 @@ export declare function createTestCancelCommand(deps: TestDeps): Command;
1769
1813
  */
1770
1814
  export declare function runTestWait(opts: RunTestWaitOptions, deps?: TestDeps): Promise<RunResponse>;
1771
1815
  interface RunTestRunAllOptions extends CommonOptions {
1816
+ environmentResolutionComplete?: boolean;
1817
+ cancelOnInterrupt?: boolean;
1818
+ timeoutIsDefault?: boolean;
1819
+ noWait?: boolean;
1820
+ concurrencyIsDefault?: boolean;
1772
1821
  /** projectId to run all tests in; may be resolved from --project or TESTSPRITE_PROJECT_ID. */
1773
1822
  projectId?: string;
1774
1823
  /** --filter <substr>: only run tests whose name contains this substring (case-insensitive). */
@@ -1798,8 +1847,14 @@ interface RunTestRunAllOptions extends CommonOptions {
1798
1847
  * default and still emits the summary / annotation / JUnit report.
1799
1848
  */
1800
1849
  allowEmpty?: boolean;
1850
+ /** See `RunTestRunOptions.autoHeal`. */
1851
+ autoHeal?: false;
1801
1852
  /** `--env <name>`: see `RunTestRunOptions.environment` — applied to every test in the batch. */
1802
1853
  environment?: string;
1854
+ /** Per-run URL override for every frontend test in the batch. */
1855
+ targetUrl?: string;
1856
+ /** Skip the pre-charge target URL reachability probe. */
1857
+ skipPreflight?: boolean;
1803
1858
  }
1804
1859
  export declare function writeBatchJUnitReportIfRequested(opts: {
1805
1860
  report?: JUnitReportFormat;
@@ -1807,6 +1862,7 @@ export declare function writeBatchJUnitReportIfRequested(opts: {
1807
1862
  reportSuiteName?: string;
1808
1863
  projectId?: string;
1809
1864
  }, results: readonly (JUnitTestResult & {
1865
+ createdAt?: string | null;
1810
1866
  startedAt?: string | null;
1811
1867
  finishedAt?: string | null;
1812
1868
  testTitle?: string | null;
@@ -1819,20 +1875,35 @@ export declare function writeBatchJUnitReportIfRequested(opts: {
1819
1875
  * With `--wait`, polls each accepted runId.
1820
1876
  */
1821
1877
  export declare function runTestRunAll(opts: RunTestRunAllOptions, deps?: TestDeps): Promise<BatchRunFreshResponse | undefined>;
1822
- /**
1823
- * `test rerun` — M3.4 piece-3.
1824
- *
1825
- * FE: `POST /tests/{id}/runs/rerun` → verbatim replay, billed at 0.5 credits
1826
- * (same as a fresh run; legacy V2 accounts: free). With `--wait`, polls
1827
- * `GET /runs/{runId}` until terminal.
1828
- *
1829
- * BE: same route → closure + per-member runIds. With `--wait`, polls every
1830
- * closure-member runId; exits on the named test's verdict; failed closure
1831
- * members surface as warnings + `closureFailures[]` in JSON.
1832
- *
1833
- * Batch / `--all`: `POST /tests/batch/rerun` → per-test runIds. With
1834
- * `--wait`, fan-out poll under `--max-concurrency`. `deferred[]` → exit 7.
1835
- */
1878
+ interface RunTestRunLocalBatchOptions extends CommonOptions {
1879
+ wait?: boolean;
1880
+ targetUrl?: string;
1881
+ noWait?: boolean;
1882
+ concurrencyIsDefault?: boolean;
1883
+ resolvedTarget?: ResolvedRunTarget;
1884
+ testIds: string[];
1885
+ all: boolean;
1886
+ projectId?: string;
1887
+ nameFilter?: string;
1888
+ localPort?: number;
1889
+ localHost?: LoopbackHost;
1890
+ skipPreflight: boolean;
1891
+ tunnelClientId?: string;
1892
+ cancelOnInterrupt: boolean;
1893
+ timeoutSeconds: number;
1894
+ maxConcurrency: number;
1895
+ idempotencyKey?: string;
1896
+ report?: JUnitReportFormat;
1897
+ reportFile?: string;
1898
+ reportSuiteName?: string;
1899
+ ghOutput?: boolean;
1900
+ summaryFile?: string;
1901
+ allowEmpty: boolean;
1902
+ autoHeal?: false;
1903
+ environment?: string;
1904
+ }
1905
+ /** One bounded trigger-and-wait pool shares one local tunnel for its full lifetime. */
1906
+ export declare function runTestRunLocalBatch(opts: RunTestRunLocalBatchOptions, deps?: TestDeps): Promise<void>;
1836
1907
  export declare function runTestRerun(opts: RunTestRerunOptions, deps?: TestDeps): Promise<RerunResponse | BatchRerunResponse | undefined>;
1837
1908
  export interface ArtifactGetOptions extends CommonOptions {
1838
1909
  runId: string;
@@ -1933,22 +2004,30 @@ interface PlanAcceptOptions extends CommonOptions {
1933
2004
  * reachable through `runGenerationLadder` today (after the proposals rung it
1934
2005
  * polls until staged/failed/timeout), so it is pinned directly. */
1935
2006
  export declare function renderPlanGenerateResultText(plans: CliGetPlansResponse, projectId: string, creditsUsed: number | null, skippedCategories?: number | null): string;
2007
+ /** Plan-generate interrupt outcome consumed by the top-level JSON renderer
2008
+ * (`buildInterruptEnvelope`), the way `TunnelInterruptDetach` is for tunnels. */
2009
+ export interface PlanInterruptDetach {
2010
+ projectId: string;
2011
+ stagesRemaining: CliGenerationStage[] | null;
2012
+ nextAction: string;
2013
+ }
1936
2014
  /**
1937
- * `test plan generate --project <id>` — DEV-384 V3-B.
2015
+ * `test plan generate --project <id>`.
1938
2016
  *
1939
2017
  * Drives the server's generation ladder (exploration → strategy →
1940
2018
  * proposals) through `runGenerationLadder` and renders the staged
1941
2019
  * proposals. Exit 0 on staged proposals, 1 on a server-side stage failure,
1942
2020
  * 7 on timeout (typed `UNSUPPORTED` envelope — the raw ladder timeout is
1943
- * not a CLI error), 130/143 on Ctrl-C detach (honest: work and charges
1944
- * continue server-side), plus the usual catalog exits for trigger errors
2021
+ * not a CLI error), 130/143 on Ctrl-C (the running stage finishes server-side;
2022
+ * nothing after it starts until a re-run, see PlanStageTracker), plus the
2023
+ * usual catalog exits for trigger errors
1945
2024
  * (412 → 6 with the exact fix command, 402 → 12, 404 → 4, 429 → 11).
1946
2025
  */
1947
2026
  export declare function runPlanGenerate(opts: PlanGenerateOptions, deps?: TestDeps): Promise<unknown>;
1948
2027
  /** Derived, additive result the CLI prints for `accept` — the server truth
1949
2028
  * (`acceptedCount`, `caseKeys`) plus the client-side discard count. A
1950
2029
  * frontend/API split used to be derived from the selected proposals' `type`
1951
- * fields; it was dropped (DEV-384 review F10) — the backend fills every
2030
+ * fields; it was dropped — the backend fills every
1952
2031
  * proposal's `type` from the PROJECT, so the split was always (all, 0) or
1953
2032
  * (0, all) and would be actively wrong for mixed projects. */
1954
2033
  interface PlanAcceptResult {
@@ -1958,7 +2037,7 @@ interface PlanAcceptResult {
1958
2037
  discardedCount: number;
1959
2038
  }
1960
2039
  /**
1961
- * `test plan accept --project <id> [--only <ids...>]` — DEV-384 V3-B.
2040
+ * `test plan accept --project <id> [--only <ids...>]`.
1962
2041
  *
1963
2042
  * Reads the staged batch, selects all of it (or the `--only` subset),
1964
2043
  * and POSTs an EXPLICIT id list. Free — the generation charge already