@testsprite/testsprite-cli 0.7.0 → 0.9.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 (74) hide show
  1. package/README.md +62 -45
  2. package/dist/commands/agent.d.ts +3 -0
  3. package/dist/commands/agent.js +79 -10
  4. package/dist/commands/ci.d.ts +88 -0
  5. package/dist/commands/ci.js +432 -0
  6. package/dist/commands/doctor.js +100 -1
  7. package/dist/commands/init.d.ts +45 -2
  8. package/dist/commands/init.js +198 -29
  9. package/dist/commands/project.d.ts +78 -0
  10. package/dist/commands/project.js +439 -5
  11. package/dist/commands/test.d.ts +193 -4
  12. package/dist/commands/test.js +1948 -398
  13. package/dist/commands/testlist.js +15 -9
  14. package/dist/commands/tunnel.d.ts +72 -0
  15. package/dist/commands/tunnel.js +367 -0
  16. package/dist/index.js +107 -38
  17. package/dist/lib/agent-detect.d.ts +53 -0
  18. package/dist/lib/agent-detect.js +198 -0
  19. package/dist/lib/dry-run/samples.d.ts +9 -0
  20. package/dist/lib/dry-run/samples.js +116 -0
  21. package/dist/lib/gh-output.d.ts +7 -0
  22. package/dist/lib/gh-output.js +50 -7
  23. package/dist/lib/http.d.ts +104 -0
  24. package/dist/lib/http.js +126 -7
  25. package/dist/lib/interrupt.d.ts +38 -13
  26. package/dist/lib/interrupt.js +130 -15
  27. package/dist/lib/local-target.d.ts +95 -0
  28. package/dist/lib/local-target.js +184 -0
  29. package/dist/lib/plan-poll.d.ts +171 -0
  30. package/dist/lib/plan-poll.js +442 -0
  31. package/dist/lib/plans.types.d.ts +130 -0
  32. package/dist/lib/plans.types.js +31 -0
  33. package/dist/lib/poll-support.d.ts +26 -0
  34. package/dist/lib/poll-support.js +65 -0
  35. package/dist/lib/poll.d.ts +1 -0
  36. package/dist/lib/poll.js +2 -40
  37. package/dist/lib/response-schemas.d.ts +13 -0
  38. package/dist/lib/response-schemas.js +46 -0
  39. package/dist/lib/run-progress.d.ts +41 -0
  40. package/dist/lib/run-progress.js +56 -0
  41. package/dist/lib/runs.types.d.ts +50 -0
  42. package/dist/lib/skill-nudge.d.ts +13 -5
  43. package/dist/lib/skill-nudge.js +40 -14
  44. package/dist/lib/target-url-preflight.js +3 -3
  45. package/dist/lib/target-url.d.ts +54 -8
  46. package/dist/lib/target-url.js +274 -68
  47. package/dist/lib/telemetry.d.ts +11 -0
  48. package/dist/lib/telemetry.js +1 -0
  49. package/dist/lib/ticker.d.ts +8 -0
  50. package/dist/lib/ticker.js +3 -0
  51. package/dist/lib/tunnel-session.d.ts +138 -0
  52. package/dist/lib/tunnel-session.js +249 -0
  53. package/dist/lib/tunnel.types.d.ts +54 -0
  54. package/dist/lib/tunnel.types.js +8 -0
  55. package/dist/vendor/tunnel-client/client.d.ts +82 -0
  56. package/dist/vendor/tunnel-client/client.js +924 -0
  57. package/dist/vendor/tunnel-client/config.d.ts +49 -0
  58. package/dist/vendor/tunnel-client/config.js +50 -0
  59. package/dist/vendor/tunnel-client/index.d.ts +9 -0
  60. package/dist/vendor/tunnel-client/index.js +9 -0
  61. package/dist/vendor/tunnel-client/lodash-lite.d.ts +14 -0
  62. package/dist/vendor/tunnel-client/lodash-lite.js +24 -0
  63. package/dist/vendor/tunnel-client/protocol.d.ts +60 -0
  64. package/dist/vendor/tunnel-client/protocol.js +143 -0
  65. package/dist/vendor/tunnel-client/types.d.ts +101 -0
  66. package/dist/vendor/tunnel-client/types.js +10 -0
  67. package/dist/vendor/tunnel-client/ws-compat.d.ts +206 -0
  68. package/dist/vendor/tunnel-client/ws-compat.js +316 -0
  69. package/dist/version.d.ts +1 -1
  70. package/dist/version.js +1 -1
  71. package/package.json +2 -1
  72. package/skills/testsprite-onboard.skill.md +60 -4
  73. package/skills/testsprite-verify.codex.md +22 -16
  74. package/skills/testsprite-verify.skill.md +27 -18
@@ -10,11 +10,11 @@ docs/config and is about to be reported complete.
10
10
  Run after a feature or fix lands. Skip only for: docs-only edits, pure
11
11
  build/config changes, or when the repo has no TestSprite project linked.
12
12
 
13
- The CLI only tests a reachable deployed URL (it rejects localhost). If the
14
- change is only running locally, hand off to the TestSprite MCP when it's
15
- available — it tunnels your local server; otherwise report the change as
16
- unverified-because-undeployed and stop. If the user explicitly named a tool
17
- (the CLI or the MCP), honor that over this reachability heuristic.
13
+ The CLI tests a deployed URL via `--target-url`, or a frontend test on this
14
+ machine via `--local <port>` (tunnels `localhost`/`127.0.0.1`/`::1` only; needs
15
+ a key with the `run:tunnel` scope — 403 there means mint a new key; a backend
16
+ test's target is baked into its code, so it can't use `--local`). If the user
17
+ named a tool (the CLI or the MCP), honor that even when both could apply.
18
18
 
19
19
  ## Core loop
20
20
 
@@ -67,23 +67,25 @@ testsprite test run --all --project <id> [--filter <substr>] \
67
67
  **Key behaviors:**
68
68
 
69
69
  - `--target-url` must be publicly reachable (no localhost / RFC1918) and must
70
- already have the change deployed (e.g. a CI preview deploy) — the CLI tests a
71
- deployed URL, it doesn't host your environment. Running earlier verifies the
72
- previous build.
70
+ already have the change deployed (e.g. a CI preview deploy) — running earlier
71
+ verifies the previous build, not your change. For a local-only change use
72
+ `--local <port>` instead (frontend tests only).
73
73
  - Backend `--code-file`: the runner executes the file top-to-bottom (not `pytest`), so **call your `test_*` function(s) at the end of the file** — a defined-but-uncalled test silently passes.
74
74
  - Backend sandbox has only stdlib + `requests` + `pytest` + `numpy` + `scipy`. Test the API over HTTP with `requests`; do **not** `import` the project's own source modules or other packages (e.g. `torch`) — they aren't installed and the test won't run.
75
- - `--wait` long-polls until terminal. Do not wrap it in a retry loop.
75
+ - `--wait` long-polls until terminal; don't wrap it in a retry loop. A
76
+ `--local` timeout has nothing to resume — re-run with `--local`.
76
77
  - Exit `0` = passed; `1` = failed/blocked; `7` = timeout (resume with `test wait <run-id>`).
77
- - BE dependency flags (`--produces`/`--needs`/`--category`) are backend-only and
78
- **create-only** — they can't be read back or edited later (delete + recreate to
79
- change the graph). Don't hand-sequence `test run` calls to fake ordering; use
80
- `test run --all` so the engine passes captured variables between waves.
78
+ - BE dependency flags (`--produces`/`--needs`/`--category`) are backend-only,
79
+ repeatable, and **editable** — `test update` amends them, so never delete and
80
+ recreate a test to change the graph. Don't hand-sequence `test run` calls to
81
+ fake ordering; use `test run --all` so the engine passes captured variables
82
+ between waves.
81
83
  - A BE `test rerun` dispatches the whole producer/teardown closure, side effects
82
84
  included; `--skip-dependencies` reruns only the named test. If a producer failed
83
85
  in the same closure, the consumer's failure is starvation (missing token/fixture)
84
86
  — triage the producer first; it does not implicate your change.
85
- - `create` and `--wait` output include a `dashboardUrl` — if the user wants to
86
- inspect a test or run themselves, point them there.
87
+ - `create` and `--wait` output a `dashboardUrl` — point the user there to
88
+ inspect a test or run.
87
89
 
88
90
  ### 4. On failure — download the artifact
89
91
 
@@ -94,7 +96,7 @@ testsprite test artifact get <run-id> --out ./.testsprite/runs/<run-id>/
94
96
  Inspect the bundle (failing step, screenshots, root-cause hypothesis) before
95
97
  deciding whether your change caused the failure.
96
98
 
97
- ### 5. One more tool — dry-run for learning
99
+ ### 5. Dry-run for learning
98
100
 
99
101
  Every command works without credentials under `--dry-run`:
100
102
 
@@ -125,3 +127,7 @@ testsprite setup # configure + verify + install agent skill in one shot
125
127
  ```
126
128
 
127
129
  Verify your setup anytime: `testsprite auth status`.
130
+
131
+ Project with **no tests at all**? Seed a suite first — that's setup, not verification.
132
+ `testsprite test plan generate --project <id>` proposes cases and `test plan accept`
133
+ promotes them; or author plans by hand.
@@ -16,21 +16,22 @@ project's TestSprite suite; before writing a new one, check `testsprite test lis
16
16
  for an existing test that already covers the behavior and extend it instead of
17
17
  duplicating.
18
18
 
19
- The CLI tests a **deployed** URL — it doesn't build or host your environment.
20
- Run the loop only once the change is live somewhere reachable (e.g. open the PR,
21
- let CI deploy the preview/staging environment) and pass that URL as
22
- `--target-url`. Running earlier verifies the previous build, not your change.
23
-
24
- This CLI only tests a reachable deployed URL (it rejects localhost). If the
25
- change is only running locally and isn't deployed anywhere reachable yet:
26
-
27
- - if the TestSprite MCP is available in this environment, hand off to it — it
28
- tunnels your local server and tests the running app;
29
- - otherwise report the change as unverified-because-undeployed and stop — don't
30
- run against a stale deployment to manufacture a verdict.
31
-
32
- If the user explicitly named a tool (the CLI or the MCP), honor that over this
33
- reachability heuristic.
19
+ The CLI tests either a **deployed** URL or a frontend test running on this
20
+ machine — it doesn't build or host your environment either way. For a deployed
21
+ change, wait until it's live somewhere reachable (e.g. open the PR, let CI
22
+ deploy the preview/staging environment) and pass that URL as `--target-url`.
23
+ Running earlier verifies the previous build, not your change.
24
+
25
+ For a change that is only running locally, don't wait for a deployment: run
26
+ `testsprite test run <test-id> --local <port>` instead. It tunnels this
27
+ machine's own loopback address (`localhost` / `127.0.0.1` / `::1` — not a LAN
28
+ or RFC1918 address, and not a general local-network escape hatch) to the test
29
+ runner. Two constraints: frontend tests only (a backend test's target is baked
30
+ into its generated code, so run it normally), and it needs an API key with the
31
+ `run:tunnel` scope — a 403 there means mint a new key.
32
+
33
+ If the user explicitly named a tool (the CLI or the MCP), honor that choice
34
+ regardless of which one the change's reachability would otherwise suggest.
34
35
 
35
36
  ## When to skip
36
37
 
@@ -59,6 +60,11 @@ counts:
59
60
  What does **not** count: unit tests / typecheck / lint; drafting a plan without
60
61
  `--run`; asking the user to run it for you.
61
62
 
63
+ If the project has **no tests at all**, that's the `testsprite-onboard` skill's
64
+ job, not this one — seed a suite first (it can generate the proposals for you
65
+ with `testsprite test plan generate` / `test plan accept`, or author them by
66
+ hand). Seeding is a deliberate setup pass, not part of the verify loop.
67
+
62
68
  If you can't satisfy this — no creds, no valid target URL, repo not linked —
63
69
  **say so explicitly**: "Feature shipped but I could not run any TestSprite test
64
70
  because <X>. Treat this as unverified until that's resolved." Don't claim done.
@@ -380,13 +386,16 @@ testsprite test run <test-id> --target-url <env-url> --wait --timeout 600
380
386
  Key behaviors:
381
387
 
382
388
  - `--target-url` must be an allowed project/environment URL. The CLI rejects
383
- `localhost` / RFC1918 / link-local — local-only changes can't be run here. If
384
- the feature is deployed only locally, say so and skip the run.
389
+ `localhost` / RFC1918 / link-local there. If the feature is only running
390
+ locally, use `--local <port>` instead of `--target-url` (frontend tests
391
+ only, see "When to run" above) — don't skip the run over this.
385
392
  - `--wait` long-polls until terminal and handles its own backoff — don't wrap it
386
393
  in a retry loop.
387
394
  - Exit codes: `0` = passed; `1` = failed / blocked / cancelled; `7` = timeout.
388
395
  Treat `7` as inconclusive (resume with `testsprite test wait <run-id>`), not a
389
- regression.
396
+ regression — except a `--local` run: its exit 7 already cancelled the run
397
+ (the tunnel closes with the process, so there is nothing to resume), so
398
+ don't suggest `test wait` there; re-run with `--local` again instead.
390
399
  - Batch: `create-batch --run --wait` creates the tests (FE-only) and fans
391
400
  out triggers in one call (bounded by `--max-concurrency`), emitting
392
401
  `{ results: [...] }` that mirrors the single-test `test run --wait`