@testsprite/testsprite-cli 0.15.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.
- package/README.md +24 -16
- package/dist/commands/agent.js +7 -2
- package/dist/commands/auth.js +7 -3
- package/dist/commands/ci.js +20 -18
- package/dist/commands/completion.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/init.js +8 -2
- package/dist/commands/project-env.js +39 -17
- package/dist/commands/project-sign-in.js +9 -4
- package/dist/commands/project.js +28 -21
- package/dist/commands/schedule.js +24 -15
- package/dist/commands/test.d.ts +32 -26
- package/dist/commands/test.js +949 -769
- package/dist/commands/testlist.js +13 -3
- package/dist/commands/tunnel.js +23 -25
- package/dist/commands/usage.js +1 -0
- package/dist/index.js +9 -6
- package/dist/lib/conflict-reason.d.ts +24 -3
- package/dist/lib/conflict-reason.js +33 -2
- package/dist/lib/deprecate.d.ts +22 -0
- package/dist/lib/deprecate.js +26 -0
- package/dist/lib/dry-run/samples.js +14 -4
- package/dist/lib/environment-tunnel.d.ts +2 -1
- package/dist/lib/environment-tunnel.js +1 -4
- package/dist/lib/http.js +20 -2
- package/dist/lib/junit-report.d.ts +3 -0
- package/dist/lib/junit-report.js +8 -1
- package/dist/lib/output.d.ts +11 -1
- package/dist/lib/output.js +17 -2
- package/dist/lib/response-schemas.js +3 -0
- package/dist/lib/runs.types.d.ts +16 -0
- package/dist/lib/telemetry.d.ts +1 -1
- package/dist/lib/telemetry.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/testsprite-verify.codex.md +7 -7
- 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://
|
|
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
|
|
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
|
|
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>`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
See [the
|
|
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>`
|
|
193
|
-
| | `test rerun` |
|
|
194
|
-
| | `test flaky` |
|
|
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` |
|
|
@@ -206,16 +208,22 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
|
|
|
206
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 |
|
|
207
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 |
|
|
208
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 |
|
|
209
215
|
|
|
210
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).
|
|
211
217
|
|
|
212
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).
|
|
213
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
|
+
|
|
214
222
|
## Why a CLI for coding agents?
|
|
215
223
|
|
|
216
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.
|
|
217
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.
|
|
218
|
-
- ♻️ **A loop, not a one-shot.** `create → run → failure get → fix →
|
|
226
|
+
- ♻️ **A loop, not a one-shot.** `create → run → failure get → fix → run` — every pass is banked, not thrown away.
|
|
219
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.
|
|
220
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)
|
|
221
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.
|
|
@@ -225,8 +233,8 @@ See [the full local-testing reference](./DOCUMENTATION.md#local-frontend-testing
|
|
|
225
233
|
Every time your agent changes code, it asks one question: **is this behavior already covered by the suite?**
|
|
226
234
|
|
|
227
235
|
- **Not yet covered** → `testsprite test create` — describe the new behavior, run it.
|
|
228
|
-
- **Already covered** → `testsprite test
|
|
229
|
-
- **Something fails** → `testsprite test failure get` — one self-consistent bundle; the agent fixes the code and
|
|
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.
|
|
230
238
|
|
|
231
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.
|
|
232
240
|
|
|
@@ -235,7 +243,7 @@ flowchart TD
|
|
|
235
243
|
A["🤖 Your coding agent<br/>Claude Code · Codex · Antigravity · Kimi · Cursor · Trae …"]
|
|
236
244
|
D{"behavior already<br/>covered by the suite?"}
|
|
237
245
|
B["<b>testsprite test create</b><br/>new behavior → new test"]
|
|
238
|
-
R["<b>testsprite test
|
|
246
|
+
R["<b>testsprite test run --all</b><br/>run the existing tests"]
|
|
239
247
|
C{{"☁️ TestSprite testing agent<br/>runs the test like a real user against<br/>real browsers & real APIs on Cloud"}}
|
|
240
248
|
F["<b>testsprite test failure get</b><br/>ONE self-consistent bundle:<br/>failing step · screenshots · DOM ·<br/>root-cause · recommended fix"]
|
|
241
249
|
S[("📚 Durable integration suite<br/>grows with every pass")]
|
|
@@ -262,7 +270,7 @@ That's the point of all of this: you no longer need the biggest, most expensive
|
|
|
262
270
|
## Getting help
|
|
263
271
|
|
|
264
272
|
- 📚 **CLI reference** — [DOCUMENTATION.md](./DOCUMENTATION.md)
|
|
265
|
-
- 🌐 **Platform docs** — [testsprite.com
|
|
273
|
+
- 🌐 **Platform docs** — [docs.testsprite.com](https://docs.testsprite.com)
|
|
266
274
|
- 🐛 **Issues & feature requests** — [GitHub issues](https://github.com/TestSprite/testsprite-cli/issues)
|
|
267
275
|
- 💬 **Quick questions** — [Discord](https://discord.gg/GXWFjCe4an), or `testsprite --help` / `testsprite test run --help` right in your terminal
|
|
268
276
|
- 📝 **Changelog** — [CHANGELOG.md](./CHANGELOG.md)
|
package/dist/commands/agent.js
CHANGED
|
@@ -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')
|
|
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
|
-
'
|
|
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)
|
package/dist/commands/auth.js
CHANGED
|
@@ -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')
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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);
|
package/dist/commands/ci.js
CHANGED
|
@@ -1160,7 +1160,10 @@ export function createCiCommand(deps = {}) {
|
|
|
1160
1160
|
}, deps);
|
|
1161
1161
|
});
|
|
1162
1162
|
ci.command('init <platform>')
|
|
1163
|
-
.
|
|
1163
|
+
.summary('Write a CI workflow that runs your test cases on pull requests (github)')
|
|
1164
|
+
.description("Write a CI workflow (platform: github) that runs the project's TestSprite test cases against each\n" +
|
|
1165
|
+
'pull request\'s preview deployment; each run spends credits. Replace the "REPLACE ME" step in the\n' +
|
|
1166
|
+
`generated file with your preview URL. Needs the ${API_KEY_SECRET_NAME} repo secret (see --set-secret).`)
|
|
1164
1167
|
.option('--project <id>', 'project id to run (auto-detected if you have exactly one)')
|
|
1165
1168
|
.option('--env <name>', "environment whose sign-in each PR run uses (default: the project's default environment, written out by name)")
|
|
1166
1169
|
.option('--timeout <s>', "max seconds ci run waits for a terminal verdict (1-3600; omitted: ci run's default)")
|
|
@@ -1189,18 +1192,18 @@ export function createCiCommand(deps = {}) {
|
|
|
1189
1192
|
// which reads the same deployment history and runs the platform's own CLI.
|
|
1190
1193
|
// Behaviour and exit codes are unchanged until the commands are removed.
|
|
1191
1194
|
ci.command('doctor', { hidden: true })
|
|
1192
|
-
.description('Check that deployment events reach this repo — the precondition a deployment-gated workflow
|
|
1195
|
+
.description('Check that deployment events reach this repo — the precondition for a deployment-gated workflow.\n' +
|
|
1196
|
+
'Needs the GitHub CLI (`gh`), installed and authenticated.')
|
|
1193
1197
|
.option('--repo <owner/name>', 'repo to check (inferred from the `origin` remote if omitted)')
|
|
1194
1198
|
.option('--wait', 'keep checking until a NEW deployment record arrives (use right after connecting + pushing)', false)
|
|
1195
1199
|
.option('--timeout <s>', 'with --wait, how long to keep checking (1-3600, default 600)')
|
|
1196
|
-
.addHelpText('after', '\
|
|
1197
|
-
'
|
|
1198
|
-
|
|
1199
|
-
' nothing is ever written and the gate stays silent — with no error anywhere.\n' +
|
|
1200
|
-
'\n--wait succeeds when any new deployment record arrives, whatever its\n' +
|
|
1201
|
-
'environment — a new record is the hard fact that events reach this repo.\n' +
|
|
1200
|
+
.addHelpText('after', '\nA deployment-triggered workflow only fires if the repo receives GitHub Deployment events;\n' +
|
|
1201
|
+
'if the deploy platform is not linked, the gate stays silent with no error.\n' +
|
|
1202
|
+
'--wait succeeds when any new deployment record arrives, whatever its environment.\n' +
|
|
1202
1203
|
'\nExit codes:\n' +
|
|
1203
|
-
' 0 events reach this repo (a gate will fire), or --wait saw a new record\n' +
|
|
1204
|
+
' 0 events reach this repo (a gate will fire), or --wait saw a new record. With --wait and\n' +
|
|
1205
|
+
' no new record before --timeout it is still 0 if earlier events exist: check the output\n' +
|
|
1206
|
+
' (JSON: newDeployment)\n' +
|
|
1204
1207
|
' 1 no usable events yet — see the printed next steps\n' +
|
|
1205
1208
|
' 5 validation error (bad --repo, or no GitHub remote here)\n' +
|
|
1206
1209
|
' 10 could not read the history (gh missing / unauthenticated) — not a verdict')
|
|
@@ -1219,15 +1222,14 @@ export function createCiCommand(deps = {}) {
|
|
|
1219
1222
|
ci.command('connect', { hidden: true })
|
|
1220
1223
|
.description('Link your deploy platform (Vercel) to this repo so deployment events are emitted')
|
|
1221
1224
|
.option('--project <name>', 'Vercel project to link when this directory is not linked yet (must already exist)')
|
|
1222
|
-
.addHelpText('after',
|
|
1223
|
-
'
|
|
1224
|
-
'to link) it refuses
|
|
1225
|
-
'
|
|
1226
|
-
'
|
|
1227
|
-
'
|
|
1228
|
-
'
|
|
1229
|
-
'\nLinking only affects FUTURE pushes: push a commit
|
|
1230
|
-
'`testsprite ci doctor --wait`.')
|
|
1225
|
+
.addHelpText('after', `\nRuns \`npx ${VERCEL_CLI_SPEC}\` (downloads the Vercel CLI) non-interactively to link this directory\n` +
|
|
1226
|
+
'and connect the repo (`vercel link` / `vercel git connect`); if a decision is needed (which\n' +
|
|
1227
|
+
'project to link) it refuses rather than create anything you did not pick. Your Vercel\n' +
|
|
1228
|
+
'credentials stay with the Vercel CLI; this command never asks for or stores a platform token.\n' +
|
|
1229
|
+
'`vercel link` itself writes `.vercel/`, may add VERCEL_OIDC_TOKEN to `.env.local` and may\n' +
|
|
1230
|
+
'update `.gitignore`. --dry-run is not honored: the link is made.\n' +
|
|
1231
|
+
'\nExit codes: 0 connected, 1 could not connect\n' +
|
|
1232
|
+
'\nLinking only affects FUTURE pushes: push a commit, then confirm with `testsprite ci doctor --wait`.')
|
|
1231
1233
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
1232
1234
|
.action(async (cmdOpts, command) => {
|
|
1233
1235
|
emitCiDeprecationNotice('connect', deps);
|
|
@@ -91,7 +91,8 @@ export function createCompletionCommand(getSpec, deps = {}) {
|
|
|
91
91
|
return new Command('completion')
|
|
92
92
|
.description('Print a shell completion script (bash|zsh|fish)')
|
|
93
93
|
.argument('[shell]', 'Shell to generate for (bash|zsh|fish); auto-detected from $SHELL when omitted')
|
|
94
|
-
.addHelpText('after', '\
|
|
94
|
+
.addHelpText('after', '\nCompletes commands and their subcommands one level deep; option names are not completed.\n' +
|
|
95
|
+
'\nExamples:\n' +
|
|
95
96
|
' eval "$(testsprite completion bash)" # bash, current session\n' +
|
|
96
97
|
' testsprite completion zsh > ~/.zsh/_testsprite\n' +
|
|
97
98
|
' testsprite completion fish | source # fish, current session')
|
package/dist/commands/doctor.js
CHANGED
|
@@ -362,7 +362,8 @@ function renderDoctor(report) {
|
|
|
362
362
|
}
|
|
363
363
|
export function createDoctorCommand(deps = {}) {
|
|
364
364
|
const cmd = new Command('doctor')
|
|
365
|
-
.
|
|
365
|
+
.summary('Diagnose CLI setup: credentials, connectivity, skill')
|
|
366
|
+
.description('Diagnose CLI setup: version, Node, profile, endpoint, credentials, API connectivity, workspace routing, tunnel permission (run:tunnel) and the verify skill in this directory. Exit 1 if any check fails; warnings do not.')
|
|
366
367
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
367
368
|
.addHelpText('after', '\nExamples:\n' +
|
|
368
369
|
' testsprite doctor # run all checks (exit 1 if any fails)\n' +
|
package/dist/commands/init.js
CHANGED
|
@@ -564,7 +564,7 @@ export function addSetupOptions(cmd, validTargets, defaultAgent) {
|
|
|
564
564
|
.option('--no-agent', 'Skip the agent skill install (configure credentials only)')
|
|
565
565
|
.option('--force', 'Overwrite an existing skill file (a .bak backup is kept)')
|
|
566
566
|
.option('--dir <path>', 'Project root for the skill install (default: current directory)')
|
|
567
|
-
.option('-y, --yes', 'Non-interactive: accept
|
|
567
|
+
.option('-y, --yes', 'Non-interactive: accept defaults, never prompt (needs --from-env or --api-key)')
|
|
568
568
|
.option('--skip-if-configured', 'Skip the API key prompt when credentials already exist for this profile (CI-safe idempotent re-run)');
|
|
569
569
|
}
|
|
570
570
|
/** Build {@link InitOptions} from raw Commander opts + globals. */
|
|
@@ -617,8 +617,14 @@ export function createSetupCommand(deps = {}) {
|
|
|
617
617
|
const validTargets = Object.keys(TARGETS);
|
|
618
618
|
const defaultAgent = 'claude';
|
|
619
619
|
return addSetupOptions(new Command('setup'), validTargets, defaultAgent)
|
|
620
|
+
.summary('Configure your API key and install the agent skills')
|
|
620
621
|
.description(SETUP_DESCRIPTION)
|
|
621
|
-
.addHelpText('after',
|
|
622
|
+
.addHelpText('after', '\nValidates the key (GET /me), saves it to your profile and writes the skills into the project\n' +
|
|
623
|
+
'directory. With --yes or no terminal (CI) the key must come from --from-env or --api-key\n' +
|
|
624
|
+
'(or --skip-if-configured with a saved key); otherwise setup exits 5.\n' +
|
|
625
|
+
'\nExample:\n' +
|
|
626
|
+
' TESTSPRITE_API_KEY=sk-... testsprite setup --from-env --yes --agent claude\n' +
|
|
627
|
+
GLOBAL_OPTS_HINT)
|
|
622
628
|
.action(async (cmdOpts, command) => {
|
|
623
629
|
await runSetupAction(cmdOpts, command, deps);
|
|
624
630
|
});
|
|
@@ -673,12 +673,27 @@ export async function runEnvSetDefault(opts, deps = {}) {
|
|
|
673
673
|
return res;
|
|
674
674
|
}
|
|
675
675
|
const IDEMPOTENCY_HELP = 'opaque idempotency token. Defaults to a UUIDv4 minted per invocation.';
|
|
676
|
-
const
|
|
676
|
+
const LIST_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
677
677
|
' 0 success\n' +
|
|
678
678
|
' 3 auth error\n' +
|
|
679
|
-
' 4 project
|
|
680
|
-
' 5 validation error
|
|
681
|
-
|
|
679
|
+
' 4 project not found\n' +
|
|
680
|
+
' 5 validation error';
|
|
681
|
+
const GET_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
682
|
+
' 0 success\n' +
|
|
683
|
+
' 3 auth error\n' +
|
|
684
|
+
' 4 project or environment not found\n' +
|
|
685
|
+
' 5 validation error';
|
|
686
|
+
const DELETE_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
687
|
+
' 0 success\n' +
|
|
688
|
+
' 3 auth error\n' +
|
|
689
|
+
' 4 project or environment not found\n' +
|
|
690
|
+
' 5 validation error (e.g., missing --confirm)\n' +
|
|
691
|
+
' 6 conflict (the default environment cannot be deleted)';
|
|
692
|
+
const SET_DEFAULT_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
693
|
+
' 0 success\n' +
|
|
694
|
+
' 3 auth error\n' +
|
|
695
|
+
' 4 project or environment not found\n' +
|
|
696
|
+
' 5 validation error';
|
|
682
697
|
const UPDATE_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
683
698
|
' 0 success\n' +
|
|
684
699
|
' 3 auth error\n' +
|
|
@@ -698,25 +713,29 @@ const CREATE_EXIT_CODE_NOTE = '\nExit codes:\n' +
|
|
|
698
713
|
'\n 14 client too old';
|
|
699
714
|
export function createProjectEnvCommand(deps = {}) {
|
|
700
715
|
const env = new Command('env')
|
|
716
|
+
.summary("Manage a project's environments")
|
|
701
717
|
.description("Manage a project's environments — named URL + test-account bundles that `test run --env <name>` selects")
|
|
702
718
|
.addHelpText('after', '\nFor an app that only runs on this machine, create or update the environment with\n' +
|
|
703
719
|
'`--url http://localhost:<port>` or `--local <port>`; `test run <id> --env <name>` opens a tunnel automatically.');
|
|
704
720
|
env
|
|
705
721
|
.command('list <project-id>')
|
|
706
|
-
.
|
|
722
|
+
.summary("List a project's environments")
|
|
723
|
+
.description("List a project's environments (name, default, URL, auth)." + LIST_EXIT_CODE_NOTE)
|
|
707
724
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
708
725
|
.action(async (projectId, _cmdOpts, command) => {
|
|
709
726
|
await runEnvList({ ...resolveCommonOptions(command, deps.env), projectId }, deps);
|
|
710
727
|
});
|
|
711
728
|
env
|
|
712
729
|
.command('get <project-id> <name>')
|
|
713
|
-
.
|
|
730
|
+
.summary('Get one environment by name')
|
|
731
|
+
.description('Get one environment by name, including its login settings.' + GET_EXIT_CODE_NOTE)
|
|
714
732
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
715
733
|
.action(async (projectId, name, _cmdOpts, command) => {
|
|
716
734
|
await runEnvGet({ ...resolveCommonOptions(command, deps.env), projectId, name }, deps);
|
|
717
735
|
});
|
|
718
736
|
env
|
|
719
737
|
.command('create <project-id>')
|
|
738
|
+
.summary('Create an environment')
|
|
720
739
|
.description('Create an environment (--name and one of --url / --local are required).' +
|
|
721
740
|
CREATE_EXIT_CODE_NOTE)
|
|
722
741
|
.option('--name <name>', 'environment name, unique within the project (required)')
|
|
@@ -725,11 +744,11 @@ export function createProjectEnvCommand(deps = {}) {
|
|
|
725
744
|
.addOption(new Option('--local-host <host>', 'deprecated loopback host override; requires --local').hideHelp())
|
|
726
745
|
.option('--skip-preflight', 'skip the local TCP listener check before creating')
|
|
727
746
|
.option('--username <user>', 'test-account username the browser logs in with')
|
|
728
|
-
.option('--password <pw>', 'test-account password (prefer --password-file)')
|
|
747
|
+
.option('--password <pw>', 'test-account password (prefer --password-file, exclusive)')
|
|
729
748
|
.option('--password-file <path>', 'read the password from a file instead of the command line')
|
|
730
|
-
.option('--var <KEY=VALUE>', 'set a custom variable (repeatable); shown in plain text by `env get
|
|
731
|
-
.option('--sign-in <mode>', 'public, account, otp, or manual (aliases: none, credentials, sso)')
|
|
732
|
-
.option('--otp-channel <email,sms>', 'OTP channels: email and/or sms; repeat or comma-separate', (value, previous = []) => [...previous, value])
|
|
749
|
+
.option('--var <KEY=VALUE>', 'set a custom variable (repeatable; max 50, 4096 bytes each, key [A-Za-z_][A-Za-z0-9_]*, reserved names like url/username/password rejected); shown in plain text by `env get`, not for secrets', collectVar, [])
|
|
750
|
+
.option('--sign-in <mode>', 'public, account, otp, or manual (aliases: none, credentials, sso). manual: log in once in the Portal, runs reuse that session (not signed in until then). otp and manual: not for local environments')
|
|
751
|
+
.option('--otp-channel <email,sms>', 'OTP channels: email and/or sms; repeat or comma-separate (default: email)', (value, previous = []) => [...previous, value])
|
|
733
752
|
.option('--session-ttl <seconds|never>', 'SSO session reuse lifetime: 1–2592000 seconds or never (manual only)')
|
|
734
753
|
.option('--set-default', "make this the project's default environment", false)
|
|
735
754
|
.option('--idempotency-key <token>', IDEMPOTENCY_HELP)
|
|
@@ -756,16 +775,18 @@ export function createProjectEnvCommand(deps = {}) {
|
|
|
756
775
|
});
|
|
757
776
|
env
|
|
758
777
|
.command('update <project-id> <name>')
|
|
759
|
-
.
|
|
778
|
+
.summary('Change an environment')
|
|
779
|
+
.description("Change an environment's URL, credentials, custom variables or name (sign-in mode: `project sign-in set`)." +
|
|
780
|
+
UPDATE_EXIT_CODE_NOTE)
|
|
760
781
|
.option('--url <url>', 'new address runs open (public http/https, or a loopback http origin with an explicit port)')
|
|
761
782
|
.option('--local <port>', 'shorthand for --url http://localhost:<port> (1-65535; excludes --url)')
|
|
762
783
|
.addOption(new Option('--local-host <host>', 'deprecated loopback host override; requires --local').hideHelp())
|
|
763
784
|
.option('--skip-preflight', 'skip the local TCP listener check before the update')
|
|
764
785
|
.option('--username <user>', 'new test-account username')
|
|
765
|
-
.option('--password <pw>', 'new test-account password (prefer --password-file)')
|
|
786
|
+
.option('--password <pw>', 'new test-account password (prefer --password-file, exclusive)')
|
|
766
787
|
.option('--password-file <path>', 'read the new password from a file')
|
|
767
788
|
.option('--clear-credentials', 'remove stored username and password; disable account login')
|
|
768
|
-
.option('--var <KEY=VALUE>', 'merge a custom variable (repeatable); shown in plain text by `env get
|
|
789
|
+
.option('--var <KEY=VALUE>', 'merge a custom variable (repeatable; max 50, 4096 bytes each, key [A-Za-z_][A-Za-z0-9_]*, reserved names like url/username/password rejected); shown in plain text by `env get`, not for secrets', collectVar, [])
|
|
769
790
|
.option('--rename <new-name>', 'rename the environment (runs keep referring to it by the new name)')
|
|
770
791
|
.option('--idempotency-key <token>', IDEMPOTENCY_HELP)
|
|
771
792
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
@@ -789,9 +810,10 @@ export function createProjectEnvCommand(deps = {}) {
|
|
|
789
810
|
});
|
|
790
811
|
env
|
|
791
812
|
.command('delete <project-id> <name>')
|
|
813
|
+
.summary('Delete an environment (requires --confirm)')
|
|
792
814
|
.description('Delete an environment and its stored credentials. Requires --confirm; the default\n' +
|
|
793
815
|
'environment cannot be deleted (set another default first).' +
|
|
794
|
-
|
|
816
|
+
DELETE_EXIT_CODE_NOTE)
|
|
795
817
|
.option('--confirm', 'required: explicit confirmation for the destructive operation', false)
|
|
796
818
|
.option('--idempotency-key <token>', IDEMPOTENCY_HELP)
|
|
797
819
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
@@ -806,9 +828,9 @@ export function createProjectEnvCommand(deps = {}) {
|
|
|
806
828
|
});
|
|
807
829
|
env
|
|
808
830
|
.command('set-default <project-id> <name>')
|
|
809
|
-
.
|
|
810
|
-
'
|
|
811
|
-
|
|
831
|
+
.summary('Make an environment the project default')
|
|
832
|
+
.description('Make an environment the project default — what every run without --env uses.' +
|
|
833
|
+
SET_DEFAULT_EXIT_CODE_NOTE)
|
|
812
834
|
.option('--idempotency-key <token>', IDEMPOTENCY_HELP)
|
|
813
835
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
814
836
|
.action(async (projectId, name, cmdOpts, command) => {
|
|
@@ -261,9 +261,12 @@ export async function runSignInSet(opts, deps = {}) {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
export function createProjectSignInCommand(deps = {}) {
|
|
264
|
-
const group = new Command('sign-in')
|
|
264
|
+
const group = new Command('sign-in')
|
|
265
|
+
.summary('Inspect or change how an environment signs in')
|
|
266
|
+
.description('Inspect or change how an environment signs in to the app under test.');
|
|
265
267
|
group
|
|
266
268
|
.command('get <project-id>')
|
|
269
|
+
.summary('Show the environment sign-in mode and status')
|
|
267
270
|
.description('Show the environment sign-in mode, credentials status, OTP channels, or SSO session.')
|
|
268
271
|
.option('--env <name>', 'environment name (defaults to the project default)')
|
|
269
272
|
.addHelpText('after', GLOBAL_OPTS_HINT)
|
|
@@ -272,11 +275,13 @@ export function createProjectSignInCommand(deps = {}) {
|
|
|
272
275
|
});
|
|
273
276
|
group
|
|
274
277
|
.command('set <project-id>')
|
|
275
|
-
.
|
|
276
|
-
.
|
|
278
|
+
.summary('Set the environment sign-in mode')
|
|
279
|
+
.description('Set the sign-in mode. OTP can only be chosen at `project env create --sign-in otp`, never switched to or from.\n' +
|
|
280
|
+
'manual (log in once in the Portal; runs are not signed in until then) and otp are not available on local environments.')
|
|
281
|
+
.option('--mode <mode>', 'required: public, account or manual (aliases: none, credentials, sso)')
|
|
277
282
|
.option('--env <name>', 'environment name (defaults to the project default)')
|
|
278
283
|
.option('--username <user>', 'test-account username (account only)')
|
|
279
|
-
.option('--password <pw>', 'test-account password (prefer --password-file; account only)')
|
|
284
|
+
.option('--password <pw>', 'test-account password (prefer --password-file, exclusive; account only)')
|
|
280
285
|
.option('--password-file <path>', 'read the test-account password from a file (account only)')
|
|
281
286
|
.option('--session-ttl <seconds|never>', 'SSO session reuse lifetime: 1–2592000 seconds or never (manual only)')
|
|
282
287
|
.option('--idempotency-key <token>', 'opaque idempotency token. Defaults to a UUIDv4 minted per invocation.')
|