@testsprite/testsprite-cli 0.14.0 → 0.16.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 +27 -17
  2. package/dist/commands/agent.js +7 -2
  3. package/dist/commands/auth.js +7 -3
  4. package/dist/commands/ci.d.ts +66 -17
  5. package/dist/commands/ci.js +486 -122
  6. package/dist/commands/completion.js +2 -1
  7. package/dist/commands/doctor.d.ts +3 -0
  8. package/dist/commands/doctor.js +52 -10
  9. package/dist/commands/init.js +25 -5
  10. package/dist/commands/project-env.js +39 -17
  11. package/dist/commands/project-sign-in.js +9 -4
  12. package/dist/commands/project.js +43 -22
  13. package/dist/commands/schedule.js +24 -15
  14. package/dist/commands/test.d.ts +105 -36
  15. package/dist/commands/test.js +1494 -847
  16. package/dist/commands/testlist.js +13 -3
  17. package/dist/commands/tunnel.js +23 -25
  18. package/dist/commands/usage.js +1 -0
  19. package/dist/index.js +14 -7
  20. package/dist/lib/agent-targets.d.ts +8 -3
  21. package/dist/lib/agent-targets.js +15 -4
  22. package/dist/lib/ci-run.d.ts +11 -0
  23. package/dist/lib/ci-run.js +34 -0
  24. package/dist/lib/client-factory.d.ts +23 -0
  25. package/dist/lib/client-factory.js +7 -6
  26. package/dist/lib/config.d.ts +1 -0
  27. package/dist/lib/config.js +1 -1
  28. package/dist/lib/conflict-reason.d.ts +24 -3
  29. package/dist/lib/conflict-reason.js +33 -2
  30. package/dist/lib/credentials.d.ts +0 -1
  31. package/dist/lib/credentials.js +51 -14
  32. package/dist/lib/deprecate.d.ts +22 -0
  33. package/dist/lib/deprecate.js +26 -0
  34. package/dist/lib/dry-run/samples.js +56 -5
  35. package/dist/lib/environment-tunnel.d.ts +2 -1
  36. package/dist/lib/environment-tunnel.js +1 -4
  37. package/dist/lib/first-suite-hint.d.ts +55 -0
  38. package/dist/lib/first-suite-hint.js +101 -0
  39. package/dist/lib/gh-output.d.ts +62 -4
  40. package/dist/lib/gh-output.js +149 -7
  41. package/dist/lib/github-context.d.ts +21 -0
  42. package/dist/lib/github-context.js +153 -0
  43. package/dist/lib/http.d.ts +10 -1
  44. package/dist/lib/http.js +29 -3
  45. package/dist/lib/junit-report.d.ts +3 -0
  46. package/dist/lib/junit-report.js +8 -1
  47. package/dist/lib/output.d.ts +11 -1
  48. package/dist/lib/output.js +17 -2
  49. package/dist/lib/plans.types.d.ts +1 -1
  50. package/dist/lib/response-schemas.d.ts +5 -1
  51. package/dist/lib/response-schemas.js +57 -0
  52. package/dist/lib/runs.types.d.ts +122 -0
  53. package/dist/lib/telemetry.d.ts +26 -2
  54. package/dist/lib/telemetry.js +47 -4
  55. package/dist/version.d.ts +1 -1
  56. package/dist/version.js +1 -1
  57. package/package.json +3 -3
  58. package/schemas/plan.schema.json +2 -2
  59. package/skills/testsprite-ci.skill.md +154 -0
  60. package/skills/testsprite-verify.codex.md +7 -7
  61. package/skills/testsprite-verify.skill.md +24 -21
package/README.md CHANGED
@@ -24,7 +24,7 @@ AI ships code in minutes — verifying it hasn't. `testsprite` opens your live a
24
24
 
25
25
  <p>
26
26
  <a href="https://www.testsprite.com"><img src="https://img.shields.io/badge/testsprite.com-19C379?style=for-the-badge&logoColor=white" alt="Website"></a>
27
- <a href="https://www.testsprite.com/docs"><img src="https://img.shields.io/badge/Docs-0A0A0A?style=for-the-badge" alt="Docs"></a>
27
+ <a href="https://docs.testsprite.com/cli/getting-started/overview"><img src="https://img.shields.io/badge/Docs-0A0A0A?style=for-the-badge" alt="Docs"></a>
28
28
  <a href="https://x.com/Test_Sprite"><img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X"></a>
29
29
  <a href="https://www.linkedin.com/company/testsprite"><img src="https://img.shields.io/badge/LinkedIn-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn"></a>
30
30
  <a href="https://discord.gg/GXWFjCe4an"><img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord"></a>
@@ -87,7 +87,7 @@ testsprite test create --project proj_8f0f6 --type frontend \
87
87
  testsprite test failure get test_3a9f21c7 --out ./.testsprite/failure
88
88
 
89
89
  # 3 — the agent reads the bundle, fixes the code, then replays
90
- testsprite test rerun test_3a9f21c7 --wait --output json
90
+ testsprite test run test_3a9f21c7 --wait --output json
91
91
  # → exits 0: passed. The test now lives in your durable suite.
92
92
  ```
93
93
 
@@ -152,13 +152,13 @@ testsprite tunnel stop --all --confirm
152
152
  Run several local frontend tests in one invocation to share one tunnel binding. The batch runs up to 5 tests at once by default; `--max-concurrency` accepts 1–10. `--all --local` skips backend tests. An owned batch cancels unfinished runs on Ctrl-C or tunnel loss; JSON output lists every requested test in input order, including tests that did not start. The minted client id is printed before the tunnel connects.
153
153
  Hit the tunnel limit? Run `testsprite tunnel list`, then `testsprite tunnel stop <client-uuid>` for an unused binding, or `testsprite tunnel stop --all --confirm` to revoke them all. An older server without listing returns exit 4; a key without `run:tunnel` returns exit 3.
154
154
  A second `tunnel start` or process using the same credential takes over, and the first exits **10**.
155
- An environment is one origin (scheme, host and port) plus its sign-in configuration. Frontend runs automatically open a tunnel for a saved `localhost`, `127.0.0.1` or `[::1]` URL: `test run`, `test rerun`, `test create --run`, `test create-batch --run` and `testlist run` use this behavior. `--env <name>` selects the environment; omit it for the project default. `--no-wait` disables automatic tunnels; drop it to run through one. If environment reads are unavailable, the command keeps the previous server behavior. Several fresh-run IDs require a tunnel; public targets retain the exit-5 refusal. A named public environment used against a local origin prints a sign-in advisory on stderr. Reruns and test-list runs share one timeout including capacity waits and require the server to confirm tunnel support; an older server triggers a cancellation attempt and a clear error.
155
+ An environment is one origin (scheme, host and port) plus its sign-in configuration. Frontend runs automatically open a tunnel for a saved `localhost`, `127.0.0.1` or `[::1]` URL: `test run`, `test create --run`, `test create-batch --run` and `testlist run` use this behavior. `--env <name>` selects the environment; omit it for the project default. `--no-wait` disables automatic tunnels; drop it to run through one. If environment reads are unavailable, the command keeps the previous server behavior. Several fresh-run IDs require a tunnel; public targets retain the exit-5 refusal. A named public environment used against a local origin prints a sign-in advisory on stderr. Test-list runs share one timeout including capacity waits and require the server to confirm tunnel support; an older server triggers a cancellation attempt and a clear error.
156
156
 
157
- `--local <port>` remains a shorthand and defaults new project/environment URLs to `http://localhost:<port>`. On a test run it preserves the host of a selected loopback environment, or the one host agreed by saved non-temporary loopback environments on that port; otherwise it uses `localhost`. If environment reads fail, it retains the legacy `127.0.0.1` host. Saved URLs retain their exact spelling, and aliases are not merged. `--local-host` remains accepted but is deprecated and hidden from project/environment help; prefer `--url http://127.0.0.1:<port>` or `--url http://[::1]:<port>` when the host matters. Dev servers can take a minute per page through a tunnel; test a built server with `npm run build` and your framework's preview/start command for heavy apps.
158
- The control plane is WebSocket over TLS (`wss://control.tun.testsprite.com/ws`). The data plane, which carries the tunnel secret and proxied traffic, uses TLS at `data.tun.testsprite.com:443` and verifies the certificate with Node's default trust store: its bundled Mozilla roots, plus certificates supplied through `NODE_EXTRA_CA_CERTS` and the system CAs when Node is started with `--use-system-ca`. Node 20 is supported without losing `NODE_EXTRA_CA_CERTS`. Verification cannot be disabled, and the CLI never falls back from TLS to plaintext. On a network that re-signs TLS, export your organisation's root CA to a PEM file and set `NODE_EXTRA_CA_CERTS=/path/to/ca.pem` before running `testsprite`. Plaintext connects and TLS handshakes each time out after 10 seconds. The first failed attempt starts a **60-second** retry episode; writing `TunnelHello` is not enough to reset it. The episode ends only after the first inbound tunnel stream or after the socket remains open for 5 seconds following the hello. A real deadline timer stays armed across retries and destroys an in-flight socket when it expires. After that, an owned `test run --local` run is cancelled and refunded and the command exits **10**; `tunnel start` exits **10**. If a self-hosted or older TestSprite server does not advertise a TLS endpoint, the CLI prints a one-time warning and uses legacy plaintext port **7400** under the same timeout and retry rules. `tunnel start` prints `transport: tls` or `transport: plaintext`.
159
- An owned tunnel's timeout or Ctrl-C cancels unfinished runs by default. A borrowed run still detaches without cancellation on Ctrl-C/SIGTERM because its owner keeps the tunnel alive; if that owner disappears while a run is active, the borrower cancels its own run and reports `cancelled`, `already finished`, or `skipped`. A run cancelled before it finishes is refunded. `--no-cancel-on-interrupt` also skips this owner-gone cancellation. Keep the early stderr run-id receipts (`Run <runId>` for one test, `[i/N] <testId> → run <runId>` for a batch) and read the reported runs before re-running.
160
- Local projects skip exploration/plan generation; author plans with `test create --plan-from`. Portal runs are blocked for free until you set a public project URL.
161
- See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing-and-tunnels) for flags, login, billing/refunds, timeouts, and retargeting.
157
+ `--local <port>` saves new project and environment URLs as `http://localhost:<port>`. Use `--url http://127.0.0.1:<port>` or `--url http://[::1]:<port>` when the host matters (`--local-host` is deprecated). Dev servers can be slow through a tunnel, so for heavy apps test a production build (`npm run build` plus your framework's preview or start command).
158
+
159
+ The tunnel uses verified TLS. On a network that re-signs TLS, set `NODE_EXTRA_CA_CERTS=/path/to/ca.pem` to your organisation's root CA. If the tunnel keeps failing to connect for 60 seconds, the command exits **10**, and an owned run is cancelled and refunded.
160
+
161
+ On an owned tunnel, Ctrl-C or a timeout cancels unfinished runs by default, and a run cancelled before it finishes is refunded. A run on a borrowed `--tunnel-client` detaches on Ctrl-C instead. Local projects skip plan generation, so write plans with `test create --plan-from`. Portal runs stay blocked, at no charge, until the project has a public URL. See [the local-testing reference](./DOCUMENTATION.md#local-frontend-testing-and-tunnels) for the details.
162
162
 
163
163
  ## Commands
164
164
 
@@ -166,6 +166,7 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
166
166
  | -------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
167
167
  | **Setup** | `setup` | **Start here** — one command: configure your API key, verify it, and install the agent verification skill |
168
168
  | | `doctor` | Environment diagnostic — CLI/Node versions, profile, endpoint, credentials, connectivity, agent skill; exits non-zero on failure |
169
+ | | `completion` | Print a shell completion script (bash, zsh, fish) |
169
170
  | **Auth** | `auth status` | Resolve the active profile to its user, key, env, and scopes |
170
171
  | | `auth remove` | Remove the active profile from the credentials file |
171
172
  | | `usage` (alias `credits`) | Account pre-flight: identity, plus credit balance / plan info when the backend supplies them |
@@ -177,6 +178,7 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
177
178
  | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
178
179
  | | `test failure summary` | One-screen triage card (no media download) |
179
180
  | | `test diff` | Compare two runs — verdict, failure kind, per-step status flips, code-version drift |
181
+ | | `test open` | Open a test in the dashboard (`--no-browser` prints the URL only) |
180
182
  | **Write** | `test scaffold` / `test lint` | Author plans locally: emit a schema-correct starter, validate plan files offline — no network, no credentials |
181
183
  | | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--step-timeout <ms>` sets a per-test timeout; dependency flags wire BE metadata |
182
184
  | | `test update` / `test delete` / `test delete-batch` | Edit metadata, set/clear the step timeout (`--step-timeout` / `--clear-step-timeout`), or permanently delete (`--confirm` required) |
@@ -189,9 +191,9 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
189
191
  | **Generate** | `test plan generate` | Ask TestSprite to propose test cases for a project — proposals are staged server-side for review, never written to disk; only the stages the project is missing actually run |
190
192
  | | `test plan accept` | Turn staged proposals into real tests — all of them, or a subset with `--only` |
191
193
  | | `project docs upload` | Upload an API spec or PRD as a project source, so generation has something to read |
192
- | **Run** | `test run` | Trigger a fresh run; saved loopback environments open a tunnel and wait automatically; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order `--env <name>` runs against a named environment. |
193
- | | `test rerun` | Replay one/many tests (FE verbatim; BE with deps); billed as a run (0.5 credits FE / 0.2 BE); `--all --project <id>` reruns all tests `--env <name>` replays against a named environment; loopback URLs open a tunnel automatically when the server supports it. |
194
- | | `test flaky` | Replay a test several times (auto-heal off) and report a stability score |
194
+ | **Run** | `test run` | Trigger a fresh run; saved loopback environments open a tunnel and wait automatically; `--wait` blocks until terminal; several ids or `--all --project <id>` run a batch in wave order (`--status`/`--filter` narrow `--all`; `--skip-dependencies` for backend); `--env <name>` runs against a named environment. |
195
+ | | `test rerun` | **Deprecated** — use `test run` (same flags; several ids and `--all --status` are supported there). Removed in 0.17.0. |
196
+ | | `test flaky` | **Deprecated** — no replacement; run `test run <id>` again to sample a test. Removed in 0.17.0. |
195
197
  | | `test wait` | Block on one or more `runId`s until terminal |
196
198
  | | `test cancel` | Cancel one or more in-flight runs (Ctrl-C during `--wait` only detaches, `cancel` is the real stop — except a run with an owned tunnel, which Ctrl-C cancels by default) |
197
199
  | | `test artifact get` | Download the failure bundle for a specific `runId` |
@@ -203,19 +205,27 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
203
205
  | | `schedule update` | Retime or rename a schedule, change recipients, pin a project schedule with `--env <name>`, or `--pause` / `--resume` it |
204
206
  | | `schedule delete` | Remove a schedule and its run history, stopping future triggers (`--confirm` required, no restore window) |
205
207
  | | `schedule run list` | A schedule's past runs, with per-run pass / fail / blocked counts |
208
+ | **CI** | `ci init github` | Write a GitHub Actions PR gate that runs `ci run` against each pull request's preview deployment — one placeholder step to fill in: your platform deploys every PR (`on: deployment_status`) or the workflow deploys |
209
+ | | `ci run` | The CI gate in one command: every project test (or `--filter`) against `--target-url`, signed in as `--env`, in a temporary `github-pr-<N>` environment, one execution; waits and exits with the verdict. Job summary = the execution report (the GitHub App comment); `--summary-file`, `--report junit`, step outputs |
206
210
  | **Agent** | `agent install` / `agent list` / `agent status` | Add, list, or health-check coding-agent skills (pure-local): `claude`, `codex`, `cursor`, `cline`, `antigravity`, `kiro`, `windsurf`, `copilot` |
211
+ | **CI** | `ci init github` | Write a GitHub Actions workflow that runs your tests |
212
+ | | `ci doctor` | Check that deployment events reach this repo |
213
+ | | `ci connect` | Link your deploy platform (Vercel) to this repo |
214
+ | **Tunnel** | `tunnel start` / `list` / `status` / `stop` | Hold one tunnel open for several `--local` runs; list, check, or stop tunnels |
207
215
 
208
216
  > The earlier command names — `init`, `auth configure`, `auth whoami`, `auth logout` — still work as hidden, deprecated aliases (each prints a one-line notice pointing at the new name), so existing scripts keep running. `auth configure` now runs the full `setup` (it also installs the skill).
209
217
 
210
218
  📚 **Full reference — every command, flag, and example:** [DOCUMENTATION.md](./DOCUMENTATION.md), including [configuration & profiles](./DOCUMENTATION.md#configuration), [scripting](./DOCUMENTATION.md#output--scripting), and [exit codes](./DOCUMENTATION.md#exit-codes).
211
219
 
220
+ Exit codes: `0` success, `1` failure (including a run that did not pass), `7` timeout, `12` insufficient credits, `13` feature gated, `14` CLI too old; the rest are in [DOCUMENTATION.md](./DOCUMENTATION.md#exit-codes).
221
+
212
222
  ## Why a CLI for coding agents?
213
223
 
214
224
  - 🧪 **Tests like a real user.** Runs against a live browser or API in the cloud — real clicks, real navigation, real assertions. Not a mock.
215
225
  - 🤖 **Agent-shaped output.** `test failure get` returns **one bundle** — the failing step, its neighbors, screenshots, DOM snapshots, the test source, a root-cause hypothesis, and a recommended fix target — all sharing a single `snapshotId`. The CLI _refuses_ to stitch data from two different runs, so an agent never reasons over a frankenstein context.
216
- - ♻️ **A loop, not a one-shot.** `create → run → failure get → fix → rerun` — every pass is banked, not thrown away.
226
+ - ♻️ **A loop, not a one-shot.** `create → run → failure get → fix → run` — every pass is banked, not thrown away.
217
227
  - 📐 **Scriptable & deterministic.** Stable `--output json` contract, predictable [exit codes](./DOCUMENTATION.md#exit-codes), and a `--dry-run` that exercises the full code path offline with canned data.
218
- - 🚦 **CI-native.** On GitHub Actions, `--wait` runs annotate the PR checks tab with one `::error::` per failure and append a results table to the job summary — automatically. Add `--report junit` for a JUnit XML sidecar, `--summary-file` for a machine summary, or `--gh-output` to preview the annotations locally. Runs in any CI, not just GitHub. [Details →](./DOCUMENTATION.md#continuous-integration)
228
+ - 🚦 **CI-native.** `testsprite ci init github` writes a PR gate; `testsprite ci run --env <name> --target-url "$PREVIEW_URL"` tests each pull request's preview deployment as one execution and exits with the verdict. The job summary is the execution report — the same content as the GitHub App's PR comment — plus `::error::` annotations on the checks tab, step outputs, `--summary-file` for a machine summary and `--report junit` for a JUnit sidecar. In any other CI, `testsprite ci run --project <id> --env <name> --target-url <url>` still runs the suite as one execution and makes the exit code the verdict — the pull-request context, draft skip and job summary are GitHub Actions only. [Details →](./DOCUMENTATION.md#continuous-integration)
219
229
  - 🔌 **One command to onboard your agent.** `testsprite setup` drops ready-made skill files into your repo — for the agents it detects you using — so your coding agent knows how to drive the loop on its own.
220
230
 
221
231
  ## How it works
@@ -223,8 +233,8 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
223
233
  Every time your agent changes code, it asks one question: **is this behavior already covered by the suite?**
224
234
 
225
235
  - **Not yet covered** → `testsprite test create` — describe the new behavior, run it.
226
- - **Already covered** → `testsprite test rerun` — replay the existing tests, so nothing that used to work breaks silently.
227
- - **Something fails** → `testsprite test failure get` — one self-consistent bundle; the agent fixes the code and reruns.
236
+ - **Already covered** → `testsprite test run --all` — run the existing tests, so nothing that used to work breaks silently.
237
+ - **Something fails** → `testsprite test failure get` — one self-consistent bundle; the agent fixes the code and runs again.
228
238
 
229
239
  Every pass is banked into a durable suite, so coverage compounds as the project grows — a lasting record of every requirement it has ever gotten right, far bigger than any context window.
230
240
 
@@ -233,7 +243,7 @@ flowchart TD
233
243
  A["🤖 Your coding agent<br/>Claude Code · Codex · Antigravity · Kimi · Cursor · Trae …"]
234
244
  D{"behavior already<br/>covered by the suite?"}
235
245
  B["<b>testsprite test create</b><br/>new behavior → new test"]
236
- R["<b>testsprite test rerun</b><br/>replay the existing tests"]
246
+ R["<b>testsprite test run --all</b><br/>run the existing tests"]
237
247
  C{{"☁️ TestSprite testing agent<br/>runs the test like a real user against<br/>real browsers & real APIs on Cloud"}}
238
248
  F["<b>testsprite test failure get</b><br/>ONE self-consistent bundle:<br/>failing step · screenshots · DOM ·<br/>root-cause · recommended fix"]
239
249
  S[("📚 Durable integration suite<br/>grows with every pass")]
@@ -260,7 +270,7 @@ That's the point of all of this: you no longer need the biggest, most expensive
260
270
  ## Getting help
261
271
 
262
272
  - 📚 **CLI reference** — [DOCUMENTATION.md](./DOCUMENTATION.md)
263
- - 🌐 **Platform docs** — [testsprite.com/docs](https://www.testsprite.com/docs)
273
+ - 🌐 **Platform docs** — [docs.testsprite.com](https://docs.testsprite.com)
264
274
  - 🐛 **Issues & feature requests** — [GitHub issues](https://github.com/TestSprite/testsprite-cli/issues)
265
275
  - 💬 **Quick questions** — [Discord](https://discord.gg/GXWFjCe4an), or `testsprite --help` / `testsprite test run --help` right in your terminal
266
276
  - 📝 **Changelog** — [CHANGELOG.md](./CHANGELOG.md)
@@ -818,11 +818,14 @@ function collect(v, prev) {
818
818
  return prev.concat(v);
819
819
  }
820
820
  export function createAgentCommand(deps = {}) {
821
- const agent = new Command('agent').description('Install TestSprite guidance into coding-agent config (Claude Code, Cursor, Cline, Antigravity, Kiro, Windsurf, Copilot, Codex)');
821
+ const agent = new Command('agent')
822
+ .summary('Install TestSprite guidance into coding-agent config')
823
+ .description('Install TestSprite guidance into coding-agent config (Claude Code, Cursor, Cline, Antigravity, Kiro, Windsurf, Copilot, Codex)');
822
824
  agent
823
825
  .command('install [targets...]')
826
+ .summary('Write the TestSprite agent skills into a project')
824
827
  .description('Write the TestSprite agent skills (verification loop + first-run onboarding) into a project for a coding agent. ' +
825
- 'Target(s) may be given positionally (e.g. `agent install cursor codex`) and/or via --target; the two are merged.')
828
+ 'Targets may be positional (`agent install cursor codex`) and/or via --target; they are merged.')
826
829
  .option('--target <t>', 'Agent target(s): claude, cursor, cline, antigravity, kiro, windsurf, copilot, codex (comma-separated or repeated). Merged with any positional target(s).', collect, [])
827
830
  .option('--skill <name>', `Skill(s) to install: ${Object.keys(SKILLS).join(', ')} (comma-separated or repeated; default: all)`, collect, [])
828
831
  .option('--dir <path>', 'Project root to write into (default: cwd)')
@@ -850,6 +853,7 @@ export function createAgentCommand(deps = {}) {
850
853
  });
851
854
  agent
852
855
  .command('list')
856
+ .summary('List installable agent targets and skills')
853
857
  .description('List the agent targets and skills this CLI can install and where each lands (run `testsprite agent status` to see what is installed here)')
854
858
  .addHelpText('after', GLOBAL_OPTS_HINT)
855
859
  .action(async (_o, command) => {
@@ -857,6 +861,7 @@ export function createAgentCommand(deps = {}) {
857
861
  });
858
862
  agent
859
863
  .command('status')
864
+ .summary('Check installed skill files against this CLI version')
860
865
  .description('Check installed TestSprite skill files against this CLI version: ok, stale, modified, unmarked, absent, or corrupt (exits 1 when anything needs attention, so it can gate CI)')
861
866
  .option('--dir <path>', 'Project root to inspect (default: cwd)')
862
867
  .addHelpText('after', GLOBAL_OPTS_HINT)
@@ -300,13 +300,16 @@ export async function runLogout(opts, deps = {}) {
300
300
  });
301
301
  }
302
302
  export function createAuthCommand(deps = {}) {
303
- const auth = new Command('auth').description('Manage TestSprite credentials');
303
+ const auth = new Command('auth')
304
+ .description('Manage TestSprite credentials')
305
+ .addHelpText('after', '\nTo add credentials, run: testsprite setup');
304
306
  // `status` (primary; formerly `whoami`). Credential WRITES no longer live
305
307
  // here — `auth configure` is a hidden, deprecated alias for `setup` (attached
306
308
  // in index.ts), and `setup` is the only command that writes credentials.
307
309
  auth
308
310
  .command('status')
309
- .description('Show the user, API key, env, and scopes bound to the active profile')
311
+ .summary('Show the active profile and its credentials')
312
+ .description('Show the active profile: user, API key id, endpoint, env, scopes and, when available, org, workspace and routing')
310
313
  .addHelpText('after', GLOBAL_OPTS_HINT)
311
314
  .action(async (_cmdOpts, command) => {
312
315
  await runWhoami(resolveCommonOptions(command, deps.env), deps);
@@ -322,7 +325,8 @@ export function createAuthCommand(deps = {}) {
322
325
  });
323
326
  auth
324
327
  .command('remove')
325
- .description('Remove credentials for the active profile')
328
+ .summary('Remove the stored API key for the active profile')
329
+ .description('Remove the stored API key for the active profile, on this machine only. The key is not revoked (do that in the dashboard); TESTSPRITE_API_KEY is unaffected')
326
330
  .addHelpText('after', GLOBAL_OPTS_HINT)
327
331
  .action(async (_cmdOpts, command) => {
328
332
  await runLogout(resolveCommonOptions(command, deps.env), deps);
@@ -3,6 +3,7 @@ import { Command } from 'commander';
3
3
  import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factory.js';
4
4
  import { type FetchImpl } from '../lib/http.js';
5
5
  import { type DeploymentRecord, type LinkageStatus } from '../lib/ci-linkage.js';
6
+ import { type RunTestRunAllOptions, type TestDeps } from './test.js';
6
7
  /** Platforms `ci init` can scaffold. One today; the positional arg leaves room. */
7
8
  declare const SUPPORTED_PLATFORMS: readonly ["github"];
8
9
  type Platform = (typeof SUPPORTED_PLATFORMS)[number];
@@ -17,16 +18,18 @@ export interface CiFs {
17
18
  }): Promise<void>;
18
19
  mkdir(dir: string): Promise<void>;
19
20
  readFile(target: string): Promise<string>;
21
+ /** Entry names in `dir`; rejects with ENOENT when the directory is absent. */
22
+ readdir(dir: string): Promise<string[]>;
20
23
  }
21
24
  /** Injectable subprocess runner (defaults to a real `spawnSync`), so tests never
22
- * shell out. Runs `git` (default-branch detection), `gh` (optional secret set,
23
- * deployment history) and `npx vercel` (`ci connect`). */
25
+ * shell out. Runs `git` (repo slug), `gh` (optional secret set, deployment
26
+ * history) and `npx vercel` (`ci connect`). */
24
27
  export type SpawnImpl = (cmd: string, args: string[], opts: {
25
28
  input?: string;
26
29
  cwd?: string;
27
30
  shell?: boolean;
28
31
  }) => SpawnSyncReturns<string>;
29
- export interface CiDeps {
32
+ export interface CiDeps extends Pick<TestDeps, 'shutdown' | 'onWaitTimeout'> {
30
33
  env?: NodeJS.ProcessEnv;
31
34
  credentialsPath?: string;
32
35
  fetchImpl?: FetchImpl;
@@ -44,8 +47,10 @@ type CommonOptions = FactoryCommonOptions;
44
47
  export interface CiInitOptions extends CommonOptions {
45
48
  platform: string;
46
49
  project?: string;
47
- filter?: string;
48
- timeoutSeconds: number;
50
+ /** `--env`: the environment whose sign-in each PR run uses (default: the project's default). */
51
+ env?: string;
52
+ /** `--timeout`, written into the `ci run` line only when given. */
53
+ timeoutSeconds?: number;
49
54
  workflowPath: string;
50
55
  force: boolean;
51
56
  setSecret: boolean;
@@ -55,18 +60,22 @@ export interface CiInitOptions extends CommonOptions {
55
60
  export interface CiInitSummary {
56
61
  platform: Platform;
57
62
  path: string;
58
- action: string;
59
63
  projectId: string;
64
+ /** The environment written into `ci run --env`. */
65
+ environment: string;
60
66
  wrote: boolean;
61
67
  /** Distinguishes the two `wrote: false` cases a scripted caller can't otherwise
62
68
  * tell apart: `preview` (a --dry-run) vs `unchanged` (the file was already
63
69
  * byte-identical). `written` is the wrote-true case. */
64
70
  status: 'written' | 'unchanged' | 'preview';
65
- backupPath: string | null;
66
- filter: string | null;
67
71
  endpointUrl: string | null;
68
72
  endpointWarning: string | null;
69
- timeoutSeconds: number;
73
+ /** `--timeout` as written into the workflow; null when `ci run`'s default applies. */
74
+ timeoutSeconds: number | null;
75
+ /** Other workflows in `.github/workflows/` that already mention TestSprite. */
76
+ otherTestspriteWorkflows: string[];
77
+ /** `--force` over an edited file: where the previous file was kept. */
78
+ backupPath?: string;
70
79
  secret: {
71
80
  name: string;
72
81
  attempted: boolean;
@@ -75,19 +84,25 @@ export interface CiInitSummary {
75
84
  };
76
85
  }
77
86
  export declare function parseTimeoutSeconds(raw: unknown): number;
87
+ /** `--execution-report-timeout <s>`: same bounds as `--timeout`, its own default. */
88
+ export declare function parseExecutionReportTimeoutSeconds(raw: unknown): number;
78
89
  /**
79
- * Build the GitHub Actions workflow. It delegates to the published
80
- * `TestSprite/testsprite-action` (design A) rather than inlining the CLI, so the
81
- * partial-run guard (`allow-partial: false` by default), the JUnit upload, the
82
- * annotations, and the CLI-version pin all come from one maintained place.
90
+ * Build the GitHub Actions workflow. It calls the CLI directly (`ci run`), which
91
+ * owns every judgement — waiting, skipped counts, the exit code, the PR
92
+ * context — so the yml only moves data.
93
+ *
94
+ * One template covers both ways a PR gets a preview, because they differ only
95
+ * in where the URL comes from. The trigger, `if:` and concurrency already accept
96
+ * both events; the single placeholder step is the part only the repo owner can
97
+ * write, and it fails loudly until replaced so the gate can never run against a
98
+ * URL nobody chose.
83
99
  */
84
100
  export declare function buildGithubWorkflow(input: {
85
101
  projectId: string;
86
- filter?: string;
87
- timeoutSeconds: number;
102
+ environment: string;
103
+ timeoutSeconds?: number;
88
104
  endpointUrl?: string;
89
- cliVersion: string;
90
- defaultBranch: string;
105
+ workflowPath: string;
91
106
  }): string;
92
107
  export declare function runCiInit(opts: CiInitOptions, deps?: CiDeps): Promise<void>;
93
108
  export interface CiDoctorOptions extends CommonOptions {
@@ -169,5 +184,39 @@ export interface CiConnectSummary {
169
184
  export declare function runCiConnect(opts: CiConnectOptions, deps?: CiDeps): Promise<void>;
170
185
  export declare function renderCiConnectText(s: CiConnectSummary): string;
171
186
  export declare function renderCiInitText(s: CiInitSummary): string;
187
+ export type CiRunOptions = Omit<RunTestRunAllOptions, 'wait' | 'ci' | 'admission' | 'previewName' | 'githubTrigger'> & {
188
+ failOnSkipped?: boolean;
189
+ /** `--execution-report-timeout`: how long to wait for the execution report (default 60). */
190
+ executionReportTimeoutSeconds?: number;
191
+ /** `--no-execution-report`: job summary stays the local table; nothing is read or written for the report. */
192
+ executionReport?: boolean;
193
+ };
194
+ /**
195
+ * `ci run` = `test run --all --wait` with CI's defaults, plus what only a CI
196
+ * job can add:
197
+ *
198
+ * - `admission: 'all'` — one request, one execution, server-side pacing (as
199
+ * for a GitHub App run), so a PR run is one row in the Portal and, in a
200
+ * pull request, one `github-pr-<N>` environment. The backend echoes the
201
+ * field; a backend that cannot honour it is refused (exit 7), never
202
+ * silently cut to the per-key budget and retried.
203
+ * - In a pull request (read off the Actions event, or looked up from the
204
+ * deployment's commit), `--env X --target-url U` runs in a temporary clone
205
+ * of X at U named `github-pr-<N>`, and the run is stamped with the PR so
206
+ * the Portal links back to it — the GitHub App's own mechanism.
207
+ * - Outside a pull request the run keeps `test run`'s semantics: X's sign-in
208
+ * against U, recorded under X.
209
+ */
210
+ export declare function runCiRun(opts: CiRunOptions, deps?: TestDeps): Promise<void>;
172
211
  export declare function createCiCommand(deps?: CiDeps): Command;
212
+ /**
213
+ * One stderr line per run of a deprecated `ci` subcommand, naming the
214
+ * equivalent commands (stdout stays clean for JSON pipelines). The
215
+ * replacements are not `testsprite` commands, so this does not reuse
216
+ * `emitDeprecationNotice`.
217
+ */
218
+ export declare const CI_DEPRECATION_NOTICES: {
219
+ readonly doctor: string;
220
+ readonly connect: string;
221
+ };
173
222
  export {};