@testsprite/testsprite-cli 0.15.0 → 0.17.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 (207) hide show
  1. package/README.md +53 -141
  2. package/dist/commands/agent.d.ts +12 -4
  3. package/dist/commands/agent.js +55 -65
  4. package/dist/commands/auth.d.ts +6 -10
  5. package/dist/commands/auth.js +44 -56
  6. package/dist/commands/ci.d.ts +23 -100
  7. package/dist/commands/ci.js +297 -489
  8. package/dist/commands/completion.js +2 -1
  9. package/dist/commands/conversation.d.ts +27 -0
  10. package/dist/commands/conversation.js +702 -0
  11. package/dist/commands/doctor.d.ts +5 -1
  12. package/dist/commands/doctor.js +130 -34
  13. package/dist/commands/init.d.ts +4 -45
  14. package/dist/commands/init.js +116 -68
  15. package/dist/commands/project-env.d.ts +62 -2
  16. package/dist/commands/project-env.js +426 -53
  17. package/dist/commands/project-sign-in.d.ts +0 -48
  18. package/dist/commands/project-sign-in.js +1 -224
  19. package/dist/commands/project.d.ts +15 -186
  20. package/dist/commands/project.js +93 -921
  21. package/dist/commands/result.d.ts +10 -0
  22. package/dist/commands/result.js +215 -0
  23. package/dist/commands/schedule.d.ts +0 -29
  24. package/dist/commands/schedule.js +47 -97
  25. package/dist/commands/test.d.ts +315 -1824
  26. package/dist/commands/test.js +1962 -13733
  27. package/dist/commands/testlist.d.ts +128 -5
  28. package/dist/commands/testlist.js +269 -329
  29. package/dist/commands/tunnel.d.ts +2 -2
  30. package/dist/commands/tunnel.js +43 -41
  31. package/dist/commands/usage.d.ts +12 -45
  32. package/dist/commands/usage.js +51 -131
  33. package/dist/index.js +189 -108
  34. package/dist/lib/agent-detect.js +9 -5
  35. package/dist/lib/agent-targets.d.ts +21 -2
  36. package/dist/lib/agent-targets.js +88 -11
  37. package/dist/lib/args.d.ts +13 -0
  38. package/dist/lib/args.js +49 -0
  39. package/dist/lib/basic-auth.d.ts +3 -0
  40. package/dist/lib/basic-auth.js +15 -0
  41. package/dist/lib/billing-refusal.js +4 -3
  42. package/dist/lib/ci-linkage.d.ts +4 -82
  43. package/dist/lib/ci-linkage.js +4 -157
  44. package/dist/lib/ci-run.js +1 -1
  45. package/dist/lib/client-factory.d.ts +10 -2
  46. package/dist/lib/client-factory.js +38 -26
  47. package/dist/lib/commit-signal.d.ts +65 -0
  48. package/dist/lib/commit-signal.js +305 -0
  49. package/dist/lib/concurrency-limiter.d.ts +6 -0
  50. package/dist/lib/concurrency-limiter.js +29 -0
  51. package/dist/lib/config.js +10 -5
  52. package/dist/lib/conflict-reason.d.ts +31 -4
  53. package/dist/lib/conflict-reason.js +38 -4
  54. package/dist/lib/conversation/answers.d.ts +9 -0
  55. package/dist/lib/conversation/answers.js +49 -0
  56. package/dist/lib/conversation/api.d.ts +71 -0
  57. package/dist/lib/conversation/api.js +150 -0
  58. package/dist/lib/conversation/change.d.ts +31 -0
  59. package/dist/lib/conversation/change.js +124 -0
  60. package/dist/lib/conversation/context.d.ts +19 -0
  61. package/dist/lib/conversation/context.js +70 -0
  62. package/dist/lib/conversation/environment.d.ts +15 -0
  63. package/dist/lib/conversation/environment.js +33 -0
  64. package/dist/lib/conversation/follow.d.ts +24 -0
  65. package/dist/lib/conversation/follow.js +42 -0
  66. package/dist/lib/conversation/render.d.ts +33 -0
  67. package/dist/lib/conversation/render.js +315 -0
  68. package/dist/lib/conversation/title.d.ts +2 -0
  69. package/dist/lib/conversation/title.js +18 -0
  70. package/dist/lib/conversation/types.d.ts +156 -0
  71. package/dist/lib/conversation/types.js +6 -0
  72. package/dist/lib/credentials.js +67 -11
  73. package/dist/lib/cron.d.ts +1 -1
  74. package/dist/lib/cron.js +2 -2
  75. package/dist/lib/dispatch-stop.d.ts +20 -0
  76. package/dist/lib/dispatch-stop.js +30 -0
  77. package/dist/lib/download.d.ts +71 -0
  78. package/dist/lib/download.js +274 -0
  79. package/dist/lib/dry-run/fetch.d.ts +10 -0
  80. package/dist/lib/dry-run/fetch.js +20 -0
  81. package/dist/lib/dry-run/samples.d.ts +6 -34
  82. package/dist/lib/dry-run/samples.js +389 -751
  83. package/dist/lib/environment-tunnel.d.ts +16 -26
  84. package/dist/lib/environment-tunnel.js +161 -157
  85. package/dist/lib/errors.d.ts +20 -4
  86. package/dist/lib/errors.js +36 -16
  87. package/dist/lib/facade.d.ts +7 -29
  88. package/dist/lib/facade.js +7 -36
  89. package/dist/lib/failing-fe-resolver.d.ts +13 -58
  90. package/dist/lib/failing-fe-resolver.js +47 -132
  91. package/dist/lib/first-suite-hint.d.ts +16 -22
  92. package/dist/lib/first-suite-hint.js +38 -47
  93. package/dist/lib/gh-output.d.ts +76 -21
  94. package/dist/lib/gh-output.js +171 -90
  95. package/dist/lib/git-utils.d.ts +56 -0
  96. package/dist/lib/git-utils.js +212 -0
  97. package/dist/lib/github-context.d.ts +2 -0
  98. package/dist/lib/github-context.js +40 -8
  99. package/dist/lib/history-retention.d.ts +6 -2
  100. package/dist/lib/history-retention.js +10 -7
  101. package/dist/lib/http.d.ts +58 -134
  102. package/dist/lib/http.js +352 -271
  103. package/dist/lib/interrupt.d.ts +14 -8
  104. package/dist/lib/interrupt.js +28 -10
  105. package/dist/lib/junit-report.d.ts +60 -4
  106. package/dist/lib/junit-report.js +209 -32
  107. package/dist/lib/local-target.d.ts +3 -3
  108. package/dist/lib/local-target.js +3 -3
  109. package/dist/lib/output.d.ts +0 -29
  110. package/dist/lib/output.js +10 -33
  111. package/dist/lib/pagination.d.ts +2 -5
  112. package/dist/lib/pagination.js +2 -5
  113. package/dist/lib/presigned-url.d.ts +22 -0
  114. package/dist/lib/presigned-url.js +90 -0
  115. package/dist/lib/prompt.js +36 -2
  116. package/dist/lib/proxy.js +2 -1
  117. package/dist/lib/redact.d.ts +2 -2
  118. package/dist/lib/redact.js +3 -4
  119. package/dist/lib/removed-commands.d.ts +18 -0
  120. package/dist/lib/removed-commands.js +154 -0
  121. package/dist/lib/render-error.d.ts +31 -6
  122. package/dist/lib/render-error.js +88 -25
  123. package/dist/lib/response-schemas.d.ts +38 -30
  124. package/dist/lib/response-schemas.js +210 -207
  125. package/dist/lib/result/api.d.ts +24 -0
  126. package/dist/lib/result/api.js +28 -0
  127. package/dist/lib/result/evidence.d.ts +71 -0
  128. package/dist/lib/result/evidence.js +420 -0
  129. package/dist/lib/result/render.d.ts +20 -0
  130. package/dist/lib/result/render.js +194 -0
  131. package/dist/lib/result/types.d.ts +122 -0
  132. package/dist/lib/result/types.js +19 -0
  133. package/dist/lib/run-output.d.ts +275 -0
  134. package/dist/lib/run-output.js +227 -0
  135. package/dist/lib/run-render.d.ts +101 -0
  136. package/dist/lib/run-render.js +183 -0
  137. package/dist/lib/run-wait.d.ts +192 -0
  138. package/dist/lib/run-wait.js +452 -0
  139. package/dist/lib/runs.types.d.ts +134 -367
  140. package/dist/lib/runs.types.js +0 -14
  141. package/dist/lib/secret-file.d.ts +1 -1
  142. package/dist/lib/secret-file.js +11 -2
  143. package/dist/lib/skill-nudge.d.ts +7 -27
  144. package/dist/lib/skill-nudge.js +9 -37
  145. package/dist/lib/target-path.d.ts +15 -0
  146. package/dist/lib/target-path.js +35 -0
  147. package/dist/lib/target-url-advisory.d.ts +19 -0
  148. package/dist/lib/target-url-advisory.js +31 -0
  149. package/dist/lib/target-url-preflight.d.ts +9 -0
  150. package/dist/lib/target-url-preflight.js +214 -106
  151. package/dist/lib/target-url.d.ts +1 -1
  152. package/dist/lib/target-url.js +6 -16
  153. package/dist/lib/telemetry.d.ts +32 -12
  154. package/dist/lib/telemetry.js +39 -8
  155. package/dist/lib/terminal-text.d.ts +41 -0
  156. package/dist/lib/terminal-text.js +127 -0
  157. package/dist/lib/testlist.types.d.ts +16 -8
  158. package/dist/lib/testlist.types.js +1 -1
  159. package/dist/lib/text-equality.d.ts +2 -0
  160. package/dist/lib/text-equality.js +5 -0
  161. package/dist/lib/text-file.d.ts +16 -0
  162. package/dist/lib/text-file.js +41 -0
  163. package/dist/lib/text-table.d.ts +46 -0
  164. package/dist/lib/text-table.js +72 -4
  165. package/dist/lib/ticker.d.ts +9 -2
  166. package/dist/lib/ticker.js +16 -3
  167. package/dist/lib/transport-failure.d.ts +22 -0
  168. package/dist/lib/transport-failure.js +126 -0
  169. package/dist/lib/tunnel-session.d.ts +7 -1
  170. package/dist/lib/tunnel-session.js +22 -9
  171. package/dist/lib/update-check.js +3 -2
  172. package/dist/lib/url-template.d.ts +43 -0
  173. package/dist/lib/url-template.js +151 -0
  174. package/dist/lib/validate.d.ts +0 -64
  175. package/dist/lib/validate.js +2 -131
  176. package/dist/lib/version-notice.js +4 -3
  177. package/dist/lib/wait-exit.d.ts +37 -2
  178. package/dist/lib/wait-exit.js +88 -30
  179. package/dist/lib/workspace-status.js +10 -2
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +3 -4
  183. package/skills/testsprite-ci.skill.md +48 -18
  184. package/skills/testsprite-onboard.skill.md +66 -151
  185. package/skills/testsprite-verify.codex.md +54 -56
  186. package/skills/testsprite-verify.skill.md +194 -358
  187. package/dist/lib/browser.d.ts +0 -6
  188. package/dist/lib/browser.js +0 -54
  189. package/dist/lib/bundle.d.ts +0 -234
  190. package/dist/lib/bundle.js +0 -781
  191. package/dist/lib/deprecate.d.ts +0 -10
  192. package/dist/lib/deprecate.js +0 -13
  193. package/dist/lib/flaky.d.ts +0 -91
  194. package/dist/lib/flaky.js +0 -71
  195. package/dist/lib/plan-poll.d.ts +0 -171
  196. package/dist/lib/plan-poll.js +0 -441
  197. package/dist/lib/plans.types.d.ts +0 -130
  198. package/dist/lib/plans.types.js +0 -31
  199. package/dist/lib/poll.d.ts +0 -100
  200. package/dist/lib/poll.js +0 -290
  201. package/dist/lib/rate-throttle.d.ts +0 -49
  202. package/dist/lib/rate-throttle.js +0 -75
  203. package/dist/lib/run-progress.d.ts +0 -41
  204. package/dist/lib/run-progress.js +0 -56
  205. package/dist/lib/v3-advisory.d.ts +0 -55
  206. package/dist/lib/v3-advisory.js +0 -74
  207. package/schemas/plan.schema.json +0 -61
@@ -11,8 +11,8 @@ Seed a repo with no tests into a coherent suite and 2–3 passing smoke tests.
11
11
 
12
12
  This skill only uses shipped CLI commands. Do **not** call backend APIs directly.
13
13
 
14
- For deployed targets, try generation first (V3 required), then author by hand.
15
- Local projects use authored plans directly; exploration is unavailable.
14
+ The tests are written by the project's agent (`testsprite plan` → `testsprite apply`);
15
+ you give it what it needs, review what it proposes, and smoke-run the result.
16
16
 
17
17
  ## When to use
18
18
 
@@ -45,41 +45,41 @@ Read the source to identify:
45
45
 
46
46
  Use code-derived routes/handlers; do not guess.
47
47
 
48
- ### 2. Create the project
49
-
50
- Deployed frontend:
48
+ ### 2. Create the project and its environment
51
49
 
52
50
  ```bash
53
- testsprite project create --type frontend --name "<repo name>" --url <app-url> \
54
- [--username <user> --password-file <path-to-secret>]
51
+ testsprite project create --type frontend --name "<repo name>" # or --type backend
55
52
  ```
56
53
 
57
- Local frontend (start the app first; V3 required):
54
+ Capture the returned `projectId`, then say where the app runs.
55
+
56
+ Deployed:
58
57
 
59
58
  ```bash
60
- testsprite project create --type frontend --name "<repo name>" --local <port> --local-host <host>
59
+ testsprite project env create <projectId> --name default --url <app-url> \
60
+ [--username <user> --password-file <path-to-secret>]
61
61
  ```
62
62
 
63
- `--local` stores `http://<host>:<port>`; `--local-host` sets both probe and URL host:
64
- `localhost`, `127.0.0.1` (default), or `::1` (`http://[::1]:<port>`).
65
- Reuse the host on runs; omit for default IPv4.
66
- `project get/list`: JSON `originMode: 'local'`, text `(Local)`.
67
- No `--url`. Dead port: exit 5 (`--skip-preflight` bypasses).
68
- V2-only: exit 7 (`local-origin-requires-v3`). Local runs work on Free and need
69
- `run:tunnel` (mint a new key if missing).
70
-
71
- Backend:
63
+ Local frontend (start the app first):
72
64
 
73
65
  ```bash
74
- testsprite project create --type backend --name "<repo name>"
66
+ testsprite project env create <projectId> --name local --local <port>
75
67
  ```
76
68
 
77
- Capture the returned `projectId`.
69
+ `--local` stores `http://localhost:<port>`; `--url http://127.0.0.1:<port>` or
70
+ `http://[::1]:<port>` keeps another loopback host. Reuse that host on runs with
71
+ `--local-host`; omit it for `localhost`. Dead port: exit 5 (`--skip-preflight` bypasses).
72
+ Local runs work on Free and need `run:tunnel` (mint a new key if missing).
78
73
 
79
- For frontend, configure login with
80
- `--username/--password-file` if needed; the cloud agent logs in through the tunnel
81
- using the project environment's username/password. OTP environments are refused
82
- before charge (exit 6).
74
+ With a frontend test account, the cloud agent logs in through the tunnel using the
75
+ environment's username/password. OTP environments are refused before charge (exit 6).
76
+
77
+ Backend: configure the API credential once on its environment (ask the user for the value —
78
+ never invent it or reuse a key you happened to see). The agent's tests read it from the
79
+ injected `__AUTH_HEADERS__`; they never hardcode it. A static credential:
80
+ `testsprite project env update <projectId> <env> --auth bearer|basic|apikey --credential-file <f>`
81
+ (extra headers: `--header "Name: value"`, secret ones in `--header-file <f>`); a sign-in that
82
+ refreshes the credential: `--auto-auth-file <f>`.
83
83
 
84
84
  #### 2b. FE: register the app's test-hook attribute
85
85
 
@@ -87,157 +87,75 @@ If the source tags elements with something other than `data-testid` (e.g. `data-
87
87
  run `testsprite project update <projectId> --test-id-attributes data-element,data-testid`
88
88
  once; exported locators then use the tag (check: `project get` → `testIdAttrs:`).
89
89
 
90
- ### 3. Get the tests
90
+ ### 3. Ask the project's agent for the tests
91
91
 
92
- **Local project: go directly to 3b.** Creation does no exploration/generation;
93
- `test plan generate` is refused before charge (exit 6). Author a plan, then use:
92
+ Name the flows from step 1 in the request, so the suite covers them rather than one page.
93
+ Attach what the agent can't see: an API spec (backend projects need one), a PRD, your
94
+ change.
94
95
 
95
96
  ```bash
96
- testsprite test create --plan-from plan.json --project <projectId>
97
- testsprite test run <testId> --local <port> --local-host <host>
97
+ testsprite plan "Seed a first suite: <the 4–8 flows from step 1>" --project <projectId> \
98
+ [--file ./openapi.yaml] [--file ./prd.md] [--diff] --output json
98
99
  ```
99
100
 
100
- Portal runs are blocked for free until `project update <id> --url https://…` sets
101
- a public URL. For deployed projects, try 3a first.
102
-
103
- #### 3a. Preferred: generate → review → accept
104
-
105
- Proposals stage on the server for review; no files are written locally.
106
-
107
- API projects require an API spec (`no_processed_inputs` without one). An optional
108
- PRD supplements it (`--role prd`, 0.5 credits); a PRD alone can charge strategy and
109
- then fail for missing endpoints. Deployed frontend exploration supplies its inputs.
110
-
111
- ```bash
112
- testsprite project docs upload ./openapi.yaml --project <projectId> --role api-doc
113
- testsprite project docs upload ./prd.md --project <projectId> --role prd # optional, with the spec
114
- ```
115
-
116
- ```bash
117
- testsprite test plan generate --project <projectId>
118
- ```
119
-
120
- Only missing stages run. Frontend exploration can take minutes. If cut off, the
121
- running stage finishes; re-run to continue. If inputs are processing, wait and re-run.
122
-
123
- Review titles and steps against the source. Drop nonexistent flows, duplicates,
124
- and vague assertions before accepting.
101
+ - Frontend: the agent explores the deployed app in a real browser. A local project's app
102
+ can't be opened from the cloud: attach your change (`--diff`) and the agent works from it.
103
+ - `"state": "replied"` → read `reply`; answer from the code what you can with
104
+ `testsprite reply "..."`, ask the user only what only they know.
105
+ - Exit 7: still working; `testsprite status --wait` follows it.
106
+ - Exit 13: the agent isn't enabled for this account. Tell the user and stop — the CLI
107
+ has no other way to write tests.
125
108
 
126
- ```bash
127
- testsprite test plan accept --project <projectId> # all of them
128
- testsprite test plan accept --project <projectId> --only prop_2 prop_5 # or a subset
129
- ```
130
-
131
- A subset accept **discards the rest**, so name every proposal you want in that one call.
132
- Then `testsprite test list --project <projectId>` for the ids, and go to step 5
133
- (**skip step 4** — that's the hand-authoring path).
134
-
135
- If generation is unavailable (older CLI, non-V3 account/exit 6, or missing inputs),
136
- report the reason and author tests using 3b. Local-project creation itself still
137
- requires V3.
138
-
139
- #### 3b. Author the tests by hand
140
-
141
- **Frontend** — one JSON plan file per flow, in a directory (e.g. `./testsprite-plans/`).
142
- Each file is a COMPLETE plan and must include `projectId` (from step 2), `type: "frontend"`,
143
- `name`, and `planSteps` — `create-batch` reads the project from each file, not from a flag:
144
-
145
- ```json
146
- {
147
- "projectId": "<projectId from step 2>",
148
- "type": "frontend",
149
- "name": "Checkout — guest can complete a purchase",
150
- "planSteps": [
151
- { "type": "action", "description": "Navigate to /products and open the first product" },
152
- { "type": "action", "description": "Click 'Add to cart', then go to /cart" },
153
- {
154
- "type": "assertion",
155
- "description": "The cart shows exactly 1 line item with the product's name and price"
156
- },
157
- { "type": "action", "description": "Proceed to checkout as guest and submit the test payment" },
158
- { "type": "assertion", "description": "A confirmation page appears showing an order number" }
159
- ]
160
- }
161
- ```
162
-
163
- **Backend** — one `.py` file per endpoint, using `requests` with concrete assertions on
164
- status code and response body.
165
-
166
- **Backend auth:** read injected `__AUTH_HEADERS__`; never hardcode Bearer/JWT tokens,
167
- API keys, basic-auth blobs, or cookies. TestSprite injects `__AUTH_CREDENTIAL__`,
168
- `__AUTH_TYPE__`, and `__AUTH_HEADERS__` from project Authentication settings.
169
- The headers already match the configured type (Authorization for Bearer/basic,
170
- X-API-Key for API keys). Spread them into each request:
171
-
172
- ```python
173
- r = requests.get(f"{TARGET_URL}/orders", headers={**__AUTH_HEADERS__})
174
- ```
175
-
176
- Configure the credential once on the project (ask the user for the value — never invent it or
177
- reuse a key you happened to see): a static credential with
178
- `testsprite project credential <projectId> --type "Bearer token"|"API key"|"basic token" --credential <value>`,
179
- or an auto-refreshing login with `testsprite project auto-auth <projectId> …` so scheduled/repeat
180
- runs keep working after the token expires. A hardcoded token expires within hours and a hardcoded
181
- key can't be rotated centrally — `test create` emits a `[warn]` on an inlined credential; treat it
182
- as a must-fix.
183
-
184
- Each assertion must name an observable element, text, URL, count, or status;
185
- vague ones like "verify it works" create false passes.
186
-
187
- Aim for ~8–15 tests covering the core flows. Don't pad.
188
-
189
- ### 4. Batch-create (hand-authored path only — skip if you accepted generated proposals)
190
-
191
- Frontend (one call, up to 50 plans from the directory — `create-batch` is FE-only and has
192
- **no `--project` flag**; the project comes from each plan file's `projectId`):
193
-
194
- ```bash
195
- testsprite test create-batch --plan-from-dir ./testsprite-plans
196
- ```
109
+ `"state": "proposed"` → review the plan against the source before applying it:
197
110
 
198
- Backend (one call per file — `create-batch` is FE-only; `--name` is required):
111
+ - Drop flows that don't exist and duplicates.
112
+ - Every assertion names an observable element, text, URL, count, or status; vague
113
+ ones like "verify it works" create false passes.
114
+ - Aim for ~8–15 tests covering the core flows. Don't pad.
199
115
 
200
116
  ```bash
201
- testsprite test create --type backend --name "<behavior being tested>" \
202
- --code-file ./tests/<endpoint>.py --project <projectId>
117
+ testsprite apply # all of it
118
+ testsprite apply --exclude <ref>,<ref> # without some tests
119
+ testsprite apply --answer 1=b --answer 2=a,c # a card that asks questions: answer by letter
120
+ testsprite reject "<what to change>" # the agent revises and proposes again
203
121
  ```
204
122
 
205
- Capture the created `testId`s from the output.
123
+ `apply` prints the saved test ids (`applied.tests` in JSON).
206
124
 
207
- ### 5. Smoke-run a few — NOT all (protect credits)
125
+ ### 4. Smoke-run a few — NOT all (protect credits)
208
126
 
209
127
  Pick the **2–3 highest-value happy-path** tests (prefer ones you're most confident are green)
210
128
  and run only those:
211
129
 
212
130
  ```bash
213
- testsprite test run <testId> --wait # deployed target
214
- testsprite test run <testId> --local <port> --local-host <host> # local frontend
131
+ testsprite run <test-id> --wait # deployed target
132
+ testsprite run <test-id> --local <port> --local-host <host> # local frontend
215
133
  ```
216
134
 
217
- Do **not** run the whole suite automatically. V3 frontend runs, including local runs,
135
+ Do **not** run the whole suite automatically. Frontend runs, including local runs,
218
136
  cost 0.5 credit each; check `testsprite usage` before sizing the suite.
219
- Local runs wait (1200 s per run). Put several in ONE `test run <id> <id> --local <port>`
220
- (one tunnel, 5 at a time); each process holds 1 of 5 tunnel slots. Keep the stderr
221
- `Run <runId>` receipt. An owned local timeout cancels by default: start a new run with
222
- `--local <port> --local-host <host> --timeout 1800` (same host), not `test wait`. A run cancelled before it finished is refunded.
137
+ Local runs wait (1200 s each). Put several in ONE `run <id> <id> --local <port>`
138
+ (one tunnel, 5 at a time; each process holds 1 of 5 tunnel slots). Keep the stderr
139
+ `Run <run-id>` receipt. An owned local timeout cancels by default: start a new run with
140
+ `--local <port> --local-host <host> --timeout 1800` (same host), not `run wait`. For a frontend test cancelled before a terminal verdict the server attempts a refund; read the reported `refund`.
223
141
 
224
- ### 6. Report
142
+ ### 5. Report
225
143
 
226
144
  Tell the user, plainly:
227
145
 
228
146
  - "Your project now has **N** tests covering: <list the flows>."
229
147
  - "I smoke-ran **M** — here's the result: <pass/fail + the dashboard link from the run output>."
230
- - "To run the rest (≈X credits — state the cost so they choose knowingly):
231
- - frontend — use `test run <testId> --wait` for deployed targets or
232
- `test run --all --project <id> --local <port> --local-host <host>` for local targets;
233
- - backend — `testsprite test run --all --project <id>` (wave-ordered, runs every BE test)."
148
+ - "To run the rest (≈X credits, so they choose knowingly):
149
+ - frontend — use `run <test-id> --wait` for deployed targets or
150
+ `run --project <id> --local <port> --local-host <host>` for local targets;
151
+ - backend — `testsprite run --project <id>` (wave-ordered, runs every BE test)."
234
152
 
235
153
  ## Quality checklist (self-check before reporting done)
236
154
 
237
155
  - [ ] FE project has a public `--url` or uses `--local`; login configured if needed.
238
- - [ ] API project: an API spec uploaded before generating (a PRD is optional, alongside it) — or you used path 3b.
239
- - [ ] If you generated: you **read the proposals** and dropped the ones that don't fit,
240
- rather than accepting the batch unseen.
156
+ - [ ] API project: the API spec attached to the request (a PRD is optional, alongside it).
157
+ - [ ] You **read the plan** and rejected or excluded the tests that don't fit,
158
+ rather than applying it unseen.
241
159
  - [ ] Every FE assertion names a concrete, observable outcome (no "verify it works").
242
160
  - [ ] Tests cover the core flows you found in the code, not just one page.
243
161
  - [ ] Smoke-ran 2–3 happy-path tests, not the whole suite.
@@ -246,14 +164,11 @@ Tell the user, plainly:
246
164
  ## Don'ts
247
165
 
248
166
  - Don't auto-run the full suite (credit wall / surprise 402).
249
- - Don't write narrative assertions an AI judge can't fail.
167
+ - Don't apply narrative assertions an AI judge can't fail.
250
168
  - Don't call backend endpoints directly — only the `testsprite` CLI.
251
169
  - Don't create a FE project without public `--url` or `--local <port>`.
252
- - Don't re-seed a project that already has tests — that's not this skill's job.
253
- - Don't accept a generated batch unread — reviewing it is the point of the staging step.
254
- - Don't stall when generation isn't available — say so and hand-author instead.
255
- - Don't re-run `test plan generate` hoping for a different batch: with proposals already
256
- staged it starts nothing, and regenerating is a Portal action today.
170
+ - Don't apply a plan unread — reviewing it is the point of the proposal.
171
+ - Don't write or edit tests yourself — ask the agent (`reply`, `reject`, or a new `plan`).
257
172
 
258
173
  ## Hand off to verify
259
174
 
@@ -17,17 +17,16 @@ If missing, advise CLI install or `testsprite setup`. Find the project via
17
17
  For a local app without a project:
18
18
 
19
19
  ```bash
20
- testsprite project create --type frontend --name "<repo name>" --local <port> --local-host <host>
21
- testsprite test create --plan-from plan.json --project <projectId>
22
- testsprite test run <id> <id> --local <port> --local-host <host> --output json
20
+ testsprite project create --type frontend --name "<repo name>"
21
+ testsprite project env create <projectId> --name local --local <port>
22
+ testsprite plan "<what you built>" --diff --project <projectId>
23
+ testsprite apply
24
+ testsprite run --project <projectId> --wait --local <port> --local-host <host> --output json
23
25
  ```
24
26
 
25
- Local projects need V3 (V2-only: exit 7, `local-origin-requires-v3`). Exploration
26
- and `test plan generate` exit 6 before charge. Create plans with `test create
27
- --plan-from` without `--run`; then run several ids with `--local`. Portal runs
28
- are blocked free until `project update <id> --url https://…` sets a public URL.
29
- For deployed projects use `project create --url`; empty suites can use `test plan
30
- generate --project <id>` then `test plan accept`.
27
+ Portal runs of a local environment are blocked free until a public environment is
28
+ the default: `project env create <id> --name staging --url https://… --set-default`.
29
+ For a deployed app, `project env create … --url` is the only environment needed.
31
30
 
32
31
  ## 2. Run against the change
33
32
 
@@ -35,74 +34,74 @@ The CLI does not host apps. Create a deployed environment once; select it with
35
34
  `--env <name>` or omit for Default. Unknown names list valid names. Use `--local
36
35
  <port>` for local FE runs.
37
36
 
37
+ You don't write or edit tests. New tests (frontend or backend): ask the
38
+ project's agent, show the user its plan, apply it, run the saved ids. A test
39
+ that is itself wrong: `testsprite plan "the <name> test should …"`, then apply.
40
+ Exit 13: the agent isn't enabled; say so and stop.
41
+
38
42
  ```bash
39
- # Deployed frontend: create + run, or run an existing test
43
+ testsprite plan "<what you built + the user's rules>" --diff --project <id>
44
+ testsprite apply # or --exclude <ref>; or reject "<what to change>"
40
45
  testsprite project env create <id> --name staging --url https://staging.example.com
41
- testsprite test create --plan-from plan.json --run --wait \
42
- --env staging --timeout 600 --output json
43
- testsprite test run <test-id> --env staging \
44
- --wait --timeout 600 --output json
45
- # Backend Python assertion
46
- testsprite test create --type backend --name "Login rejects empty password" \
47
- --project <id> --code-file /tmp/test.py --run --wait --timeout 600
48
- # Deployed replay (V3 FE: 0.5 credit)
49
- testsprite test rerun <test-id> --env staging --wait --output json
50
- # Dependency batch; optional --filter <substring>
51
- testsprite test run --all --project <id> --env staging --wait --output json
46
+ # Project suite
47
+ testsprite run --project <id> --env staging --wait --output json
48
+ # One test
49
+ testsprite run <test-id> --env staging --wait --timeout 600 --output json
50
+ # Several tests, one batch (FE: 0.5 credit each)
51
+ testsprite run <test-id> <test-id> --env staging --wait --output json
52
+ # Saved list or positional subset
53
+ testsprite run --testlist <listId> --wait
54
+ testsprite run <test-id> --testlist <listId> --wait
52
55
  ```
53
56
 
54
57
  - Supported backends grant existing keys `run:tunnel`; a narrowed key without it
55
- exits 3. Free-plan local runs work; V3 FE costs 0.5 credit. BE cannot use `--local`.
56
- - `--local` implies `--wait` (1200 s per run; ordinary: 600). `--local-host`:
57
- `localhost`, `127.0.0.1` (default), `::1`. A dead port exits 5 before charge;
58
- `--skip-preflight` skips the probe. Environment `--url` rejects private hosts.
59
- `--local` selects/creates `local-<port>`; a named `--env` must be local.
58
+ exits 3. Free-plan local runs work. BE cannot use `--local`.
59
+ - `--local` implies `--wait` (shared 1200 s deadline; public: 600). `--local-host`:
60
+ `localhost`, `127.0.0.1`, `::1`. A dead port exits 5 before charge;
61
+ `--skip-preflight` skips the probe. Environment `--url` rejects private (non-loopback) hosts.
62
+ `--local` selects/creates `local-<port>`; `--env` keeps its sign-in settings.
60
63
  `--target-url` cannot combine with `--local`.
61
- - Run local ids together (`test run <id> <id> … --local <port>`); `--all --project
62
- <id> --local <port>` skips BE tests. One tunnel, 5 concurrent runs by default
63
- (`--max-concurrency` 1–10). Five live bindings per user; `tunnel_binding_limit`
64
+ - Run local ids together in one `run`; `run --project <id> --local <port>` skips BE tests. One run per project, one tunnel, 5 tests at once per execution by default
65
+ (`--max-concurrency` 1–15, a server dispatch cap only). Each distinct run is waited on independently. Five live bindings per user; `tunnel_binding_limit`
64
66
  exits 11 without retry. Use `tunnel list` then `tunnel stop <id>` or `--all --confirm`.
65
- - Keep early **stderr** `Run <runId>` receipts and any `Dashboard: <url>`.
66
- Stdout is the JSON channel.
67
+ - Keep each run's `Run <id>` line and its stdout `Dashboard:` link (a no-wait `--testlist` launch has none until `run wait`). All waits return `runs[].runId`,
68
+ `results[].resultId` and counts in `summary`. Only an incomplete timeout or
69
+ interruption adds `partial: true`.
67
70
  - An **owned** local timeout, Ctrl-C, or poll failure requests cancellation and
68
- closes the tunnel. Before a terminal V3 FE verdict, the backend attempts a refund;
71
+ closes the tunnel. Before a terminal FE verdict, the backend attempts a refund;
69
72
  check `refund.status`: cancellation does not guarantee a refund.
70
73
  `--no-cancel-on-interrupt` detaches, but the owned tunnel still closes.
71
- - After an owned timeout, start a **new** `test run <test-id> --local <port>
72
- --timeout 1800` (retain `--local-host`). `test wait` cannot reopen the tunnel;
73
- ordinary/adopted waits can resume with `test wait <run-id>` if reachable.
74
+ - After an owned timeout, start a **new** `run <test-id> --local <port>
75
+ --timeout 1800` (retain `--local-host`). `run wait` cannot reopen the tunnel;
76
+ ordinary/adopted waits can resume with `run wait <run-id>` if reachable.
74
77
  - Keep `tunnel start` alive; borrow with `--local <port> --tunnel-client <uuid>`.
75
78
  Adopted runs normally detach without cancellation or closing the owner's tunnel.
76
79
  If the owner has disappeared during a run, cancellation is requested by default;
77
80
  `--no-cancel-on-interrupt` skips it. A second connection with the same credential
78
81
  takes over; the first exits **10**.
79
- - Loopback environments need `--local <port>`. Bare CLI runs selecting one by
80
- name or Default exit 6 (`tunnel-required`) before dispatch or charge. The Portal
81
- shows no Run; backend requests are refused free. Schedules and test lists get
82
- free BLOCKED results. A public `--env` or Default works regardless of earlier
83
- tunnel runs. V3 local runs use the agent path, never saved-code replay, and
84
- preserve saved code.
85
- - `--wait` handles polling/backoff; do not wrap it in a retry loop.
86
- - Backend Python runs top-to-bottom, not via pytest: call `test_*` functions.
87
- The sandbox has stdlib, `requests`, `pytest`, `numpy`, `scipy`; use HTTP,
88
- not project imports or uninstalled packages.
89
- - Backend `--produces`/`--needs` are repeatable; `--category teardown` marks cleanup.
90
- Set dependencies with `test create` or edit with `test update`; do not delete
91
- and recreate. Use `test run --all` for producer → consumer → teardown ordering
92
- and variable passing. A BE `test rerun` includes that closure and its side effects;
82
+ - Saved loopback frontend environments open a tunnel automatically, including
83
+ list mappings. Lists use pinned environments; no target/env overrides.
84
+ - Choose project, named IDs, or list; never combine project with IDs/list.
85
+ No IDs/list: project flag then `TESTSPRITE_PROJECT_ID`. Named/list ignore it.
86
+ `--filter` narrows project selection. Resume with `run wait <run-id...>
87
+ --timeout 600`; cancel with `run cancel <run-id...>`. Child flags follow the child.
88
+ - `--wait` handles polling/backoff; don't wrap it in a retry loop.
89
+ - Use `run --project <project-id>` for backend producer → consumer → teardown ordering
90
+ and variable passing. A BE run includes that closure and its side effects;
93
91
  `--skip-dependencies` selects only the named test. Triage failed producers before
94
92
  blaming consumers starved of their token/fixture.
95
93
 
96
94
  ## 3. Inspect and report
97
95
 
98
96
  ```bash
99
- testsprite test artifact get <run-id> --out ./.testsprite/runs/<run-id>/
100
- testsprite test steps <test-id> --run-id <run-id> --output json
97
+ testsprite result list --run <run-id> --status failed,blocked # what did not pass
98
+ testsprite result get <result-id> --output json # error, cause, fix, every step; BE: trace, apiOutput
99
+ testsprite result get <result-id> --out .testsprite/results/<result-id> # evidence
101
100
  ```
102
101
 
103
- Read failing steps, screenshots and root cause. Bare `test steps <test-id>`
104
- shows the latest run; pin the receipt's id. For empty latest steps, choose an
105
- earlier run from `test result <test-id> --history`. Report verdict and dashboard.
102
+ Read the result of the run you verify, not an older one (`result list --test
103
+ <test-id>` lists them). `--out` writes `result.json`, the video and `steps/`, and
104
+ replaces those in an existing dir: one dir per result. Report verdict and links.
106
105
 
107
106
  Exits: 0 passed; 1 failed/blocked/cancelled; 3 auth/scope; 4 not found;
108
107
  5 validation; 6 conflict/precondition; 7 timeout/unsupported; 10 unavailable;
@@ -113,8 +112,7 @@ Exits: 0 passed; 1 failed/blocked/cancelled; 3 auth/scope; 4 not found;
113
112
  `--dry-run` works without credentials:
114
113
 
115
114
  ```bash
116
- testsprite test run <test-id> --dry-run --output json
117
- testsprite test create --plan-from plan.json --dry-run --output json
115
+ testsprite run <test-id> --dry-run --output json
118
116
  ```
119
117
 
120
118
  Setup: `npm install -g @testsprite/testsprite-cli`; `testsprite setup`.