@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
@@ -341,14 +341,14 @@ export interface TestDeps {
341
341
  */
342
342
  sleep?: (ms: number) => Promise<void>;
343
343
  /**
344
- * Graceful-detach coordinator for the `--wait` paths (DEV-331 piece 1).
344
+ * Graceful-detach coordinator for the `--wait` paths.
345
345
  * Defaults to the process-wide `globalShutdown`; tests inject their own
346
346
  * controller and abort it to simulate Ctrl-C deterministically (same
347
347
  * pattern as `sleep` / `fetchImpl`).
348
348
  */
349
349
  shutdown?: ShutdownHandle;
350
350
  /**
351
- * Tunnel-client factory for `test run --local` (DEV-747 piece 3). Defaults
351
+ * Tunnel-client factory for `test run --local`. Defaults
352
352
  * to the vendored `TunnelClient`; tests inject a fake so the command's
353
353
  * contract can be exercised without a real control plane — same pattern as
354
354
  * `sleep` / `fetchImpl` / `shutdown`.
@@ -425,7 +425,7 @@ export interface CliCreateTestResponse {
425
425
  */
426
426
  warnings?: string[];
427
427
  /**
428
- * Server-built Portal deep link for the created test (DEV-737). Same
428
+ * Server-built Portal deep link for the created test. Same
429
429
  * presence/absence contract as `RunResponse.dashboardUrl`
430
430
  * (`withRunDashboardUrl` below): PRESENT (string or falsy) on a backend
431
431
  * that resolved the question at all — a falsy value means "there is no
@@ -440,6 +440,7 @@ export interface CliCreateTestResponse {
440
440
  export declare const CLI_CREATE_PRIORITIES: readonly ["p0", "p1", "p2", "p3"];
441
441
  export type CliCreatePriority = (typeof CLI_CREATE_PRIORITIES)[number];
442
442
  interface CreateOptions extends CommonOptions {
443
+ environment?: string;
443
444
  projectId?: string;
444
445
  type: 'frontend' | 'backend';
445
446
  name: string;
@@ -756,7 +757,7 @@ export interface CliCreateFromPlanResponse extends CliCreateTestResponse {
756
757
  * Caveat: the pinned tag only resolves once that version is actually
757
758
  * released — a locally-built/pre-release checkout may see a 404 until then.
758
759
  */
759
- export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.12.0/schemas/plan.schema.json";
760
+ export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.13.0/schemas/plan.schema.json";
760
761
  /**
761
762
  * The SINGLE canonical example plan. This
762
763
  * exact value (via `PLAN_TEMPLATE_TEXT` below) is:
@@ -804,7 +805,7 @@ export interface CliBatchSpecResult {
804
805
  field?: string;
805
806
  };
806
807
  /**
807
- * Server-built Portal deep link for this created item (DEV-737). Same
808
+ * Server-built Portal deep link for this created item. Same
808
809
  * presence/absence contract as `CliCreateTestResponse.dashboardUrl` —
809
810
  * see that field's doc.
810
811
  */
@@ -875,6 +876,22 @@ export interface CliCreateBatchRunResponse {
875
876
  export declare const DEFAULT_BATCH_RUN_CONCURRENCY = 50;
876
877
  /** Hard upper bound for --max-concurrency. Values above this are rejected with exit 5 (VALIDATION_ERROR). */
877
878
  export declare const MAX_BATCH_CONCURRENCY = 100;
879
+ /**
880
+ * The server's DEFAULT in-flight run cap. Runs from every source count
881
+ * toward it (CLI, portal, schedules, CI), but only CLI run triggers are
882
+ * refused on it; a portal or schedule run over the cap is not. Exceeding it
883
+ * answers RATE_LIMITED with `details.reason: "inflight_cap"`, whose details
884
+ * carry the account's real `cap` and `current`.
885
+ *
886
+ * Quoted in help text only — the server owns the real number and rejects on
887
+ * its own value, so this is documentation, never a client-side gate.
888
+ *
889
+ * Distinct from `--max-concurrency`, whose meaning differs per command: on
890
+ * `create --run` it bounds in-flight triggers, and with `--wait` a slot is
891
+ * held until that run finishes, so lowering it there does bound how many runs
892
+ * are in flight. On `run --all` it bounds the `--wait` poll fan-out only.
893
+ */
894
+ export declare const SERVER_INFLIGHT_RUN_CAP = 50;
878
895
  /** 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
896
  export declare const BATCH_RUN_RATE_LIMIT = 50;
880
897
  /** Rolling window duration (ms) for the client-side trigger rate throttle. */
@@ -905,14 +922,12 @@ export declare const WAIT_POLL_RATE_MAX_OUTER_RETRIES = 3;
905
922
  */
906
923
  /**
907
924
  * 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.
925
+ * `InterruptError`, so the caller's existing catch owns the detach UX.
909
926
  *
910
927
  * 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.
928
+ * window where a first Ctrl-C waits for a timer before the command exits.
914
929
  */
915
- export declare function sleepUntilOrInterrupt(ms: number, signal: AbortSignal | undefined, sleep: (ms: number) => Promise<void>): Promise<void>;
930
+ export declare function sleepUntilOrInterrupt(ms: number, signal: AbortSignal | undefined, sleep: (ms: number, signal?: AbortSignal) => Promise<void>): Promise<void>;
916
931
  export declare function resolveRateLimitRetryMs(err: ApiError): number;
917
932
  /**
918
933
  * D3: max automatic retry attempts for deferred tests under `--wait`.
@@ -957,6 +972,7 @@ export declare const DEFERRED_RETRY_DEFAULT_SLEEP_MS = 61000;
957
972
  */
958
973
  export declare function isTransientRateLimit(err: ApiError): boolean;
959
974
  interface CreateFromPlanOptions extends CommonOptions {
975
+ environment?: string;
960
976
  /** Path to the JSON file containing one `CliPlanInput`. */
961
977
  planFrom: string;
962
978
  /** Caller-supplied idempotency token; UUIDv4 minted client-side if absent. */
@@ -1011,6 +1027,7 @@ interface CreateFromPlanOptions extends CommonOptions {
1011
1027
  */
1012
1028
  export declare function runCreateFromPlan(opts: CreateFromPlanOptions, deps?: TestDeps): Promise<CliCreateFromPlanResponse>;
1013
1029
  interface CreateBatchOptions extends CommonOptions {
1030
+ environment?: string;
1014
1031
  /** Path to the JSONL file containing one `CliPlanInput` per line. */
1015
1032
  plans: string;
1016
1033
  /**
@@ -1468,6 +1485,13 @@ export declare function runFailureGet(opts: FailureGetOptions, deps?: TestDeps):
1468
1485
  interface RunTestRunOptions extends CommonOptions {
1469
1486
  testId: string;
1470
1487
  targetUrl?: string;
1488
+ /**
1489
+ * `false` only when the caller passed `--no-auto-heal`. Anything
1490
+ * else leaves the field off the wire, which is how the server's protected
1491
+ * default ("heal, but replay a user-authored body") is requested; see
1492
+ * `TriggerRunBody.autoHeal` for why an explicit `true` is never sent.
1493
+ */
1494
+ autoHeal?: false;
1471
1495
  /**
1472
1496
  * Skip the pre-charge --target-url reachability preflight (zero
1473
1497
  * network calls). Also set by a delegating caller (`runCreate`/
@@ -1673,14 +1697,6 @@ export declare function makeBackendWaitFallback(args: {
1673
1697
  resolveNotBefore: (run: RunResponse) => string | undefined;
1674
1698
  onResolved?: (testId: string, status: CliPublicStatus) => void;
1675
1699
  }): (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
1700
  export declare function runTestRun(opts: RunTestRunOptions, deps?: TestDeps): Promise<TriggerRunResponse | RunResponse>;
1685
1701
  /** One row of the `test wait <run-id...>` multi-run payload. */
1686
1702
  export interface CliMultiWaitResult {
@@ -1722,7 +1738,7 @@ export interface CliCancelResultRow {
1722
1738
  conflictStatus?: string;
1723
1739
  error?: string;
1724
1740
  }
1725
- /** JSON payload for a multi-id `test cancel` — per piece-3 CXL-11. */
1741
+ /** JSON payload for a multi-id `test cancel`. */
1726
1742
  export interface CliCancelSummary {
1727
1743
  cancelled: string[];
1728
1744
  alreadyCancelled: string[];
@@ -1734,7 +1750,7 @@ export interface CliCancelSummary {
1734
1750
  /**
1735
1751
  * Runs that errored for a reason other than 404/409 (e.g. auth, transport).
1736
1752
  * Always present — an empty array on full success — so machine consumers
1737
- * can rely on a stable shape (DEV-331 codex finding 2).
1753
+ * can rely on a stable shape.
1738
1754
  */
1739
1755
  errors: Array<{
1740
1756
  runId: string;
@@ -1742,13 +1758,13 @@ export interface CliCancelSummary {
1742
1758
  }>;
1743
1759
  }
1744
1760
  /**
1745
- * `test cancel <run-id...>` — DEV-331 piece 3.
1761
+ * `test cancel <run-id...>`.
1746
1762
  *
1747
1763
  * User-initiated cancel of one or more queued/running runs via
1748
- * `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent (D10): a
1764
+ * `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent: a
1749
1765
  * 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").
1766
+ * error. Dispatches serially (per-id volume is tiny — no batch endpoint;
1767
+ * a batch-level cancel endpoint would be YAGNI).
1752
1768
  *
1753
1769
  * Single id: renders the returned run card (`status cancelled`); an
1754
1770
  * `alreadyCancelled` response adds an `[advisory]` line. Exit code mirrors
@@ -1798,8 +1814,14 @@ interface RunTestRunAllOptions extends CommonOptions {
1798
1814
  * default and still emits the summary / annotation / JUnit report.
1799
1815
  */
1800
1816
  allowEmpty?: boolean;
1817
+ /** See `RunTestRunOptions.autoHeal`. */
1818
+ autoHeal?: false;
1801
1819
  /** `--env <name>`: see `RunTestRunOptions.environment` — applied to every test in the batch. */
1802
1820
  environment?: string;
1821
+ /** Per-run URL override for every frontend test in the batch. */
1822
+ targetUrl?: string;
1823
+ /** Skip the pre-charge target URL reachability probe. */
1824
+ skipPreflight?: boolean;
1803
1825
  }
1804
1826
  export declare function writeBatchJUnitReportIfRequested(opts: {
1805
1827
  report?: JUnitReportFormat;
@@ -1819,6 +1841,30 @@ export declare function writeBatchJUnitReportIfRequested(opts: {
1819
1841
  * With `--wait`, polls each accepted runId.
1820
1842
  */
1821
1843
  export declare function runTestRunAll(opts: RunTestRunAllOptions, deps?: TestDeps): Promise<BatchRunFreshResponse | undefined>;
1844
+ interface RunTestRunLocalBatchOptions extends CommonOptions {
1845
+ testIds: string[];
1846
+ all: boolean;
1847
+ projectId?: string;
1848
+ nameFilter?: string;
1849
+ localPort: number;
1850
+ localHost: LoopbackHost;
1851
+ skipPreflight: boolean;
1852
+ tunnelClientId?: string;
1853
+ cancelOnInterrupt: boolean;
1854
+ timeoutSeconds: number;
1855
+ maxConcurrency: number;
1856
+ idempotencyKey?: string;
1857
+ report?: JUnitReportFormat;
1858
+ reportFile?: string;
1859
+ reportSuiteName?: string;
1860
+ ghOutput?: boolean;
1861
+ summaryFile?: string;
1862
+ allowEmpty: boolean;
1863
+ autoHeal?: false;
1864
+ environment?: string;
1865
+ }
1866
+ /** One bounded trigger-and-wait pool shares one local tunnel for its full lifetime. */
1867
+ export declare function runTestRunLocalBatch(opts: RunTestRunLocalBatchOptions, deps?: TestDeps): Promise<void>;
1822
1868
  /**
1823
1869
  * `test rerun` — M3.4 piece-3.
1824
1870
  *
@@ -1934,7 +1980,7 @@ interface PlanAcceptOptions extends CommonOptions {
1934
1980
  * polls until staged/failed/timeout), so it is pinned directly. */
1935
1981
  export declare function renderPlanGenerateResultText(plans: CliGetPlansResponse, projectId: string, creditsUsed: number | null, skippedCategories?: number | null): string;
1936
1982
  /**
1937
- * `test plan generate --project <id>` — DEV-384 V3-B.
1983
+ * `test plan generate --project <id>`.
1938
1984
  *
1939
1985
  * Drives the server's generation ladder (exploration → strategy →
1940
1986
  * proposals) through `runGenerationLadder` and renders the staged
@@ -1948,7 +1994,7 @@ export declare function runPlanGenerate(opts: PlanGenerateOptions, deps?: TestDe
1948
1994
  /** Derived, additive result the CLI prints for `accept` — the server truth
1949
1995
  * (`acceptedCount`, `caseKeys`) plus the client-side discard count. A
1950
1996
  * 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
1997
+ * fields; it was dropped — the backend fills every
1952
1998
  * proposal's `type` from the PROJECT, so the split was always (all, 0) or
1953
1999
  * (0, all) and would be actively wrong for mixed projects. */
1954
2000
  interface PlanAcceptResult {
@@ -1958,7 +2004,7 @@ interface PlanAcceptResult {
1958
2004
  discardedCount: number;
1959
2005
  }
1960
2006
  /**
1961
- * `test plan accept --project <id> [--only <ids...>]` — DEV-384 V3-B.
2007
+ * `test plan accept --project <id> [--only <ids...>]`.
1962
2008
  *
1963
2009
  * Reads the staged batch, selects all of it (or the `--only` subset),
1964
2010
  * and POSTs an EXPLICIT id list. Free — the generation charge already