@testsprite/testsprite-cli 0.2.0 → 0.4.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 (68) hide show
  1. package/README.md +35 -26
  2. package/dist/commands/agent.d.ts +43 -0
  3. package/dist/commands/agent.js +200 -18
  4. package/dist/commands/auth.d.ts +5 -0
  5. package/dist/commands/auth.js +38 -27
  6. package/dist/commands/doctor.d.ts +49 -0
  7. package/dist/commands/doctor.js +233 -0
  8. package/dist/commands/init.d.ts +1 -1
  9. package/dist/commands/init.js +24 -14
  10. package/dist/commands/project.d.ts +75 -2
  11. package/dist/commands/project.js +326 -47
  12. package/dist/commands/test.d.ts +281 -2
  13. package/dist/commands/test.js +1658 -177
  14. package/dist/commands/usage.js +13 -12
  15. package/dist/index.js +71 -3
  16. package/dist/lib/agent-targets.d.ts +72 -6
  17. package/dist/lib/agent-targets.js +188 -6
  18. package/dist/lib/bundle.d.ts +34 -0
  19. package/dist/lib/bundle.js +63 -11
  20. package/dist/lib/client-factory.d.ts +31 -0
  21. package/dist/lib/client-factory.js +63 -0
  22. package/dist/lib/config.d.ts +2 -0
  23. package/dist/lib/config.js +11 -2
  24. package/dist/lib/credentials.js +10 -1
  25. package/dist/lib/dry-run/samples.d.ts +5 -0
  26. package/dist/lib/dry-run/samples.js +64 -0
  27. package/dist/lib/errors.d.ts +28 -1
  28. package/dist/lib/errors.js +40 -0
  29. package/dist/lib/failing-fe-resolver.d.ts +15 -0
  30. package/dist/lib/failing-fe-resolver.js +49 -1
  31. package/dist/lib/flaky.d.ts +80 -0
  32. package/dist/lib/flaky.js +76 -0
  33. package/dist/lib/http.d.ts +73 -1
  34. package/dist/lib/http.js +327 -135
  35. package/dist/lib/interrupt.d.ts +116 -0
  36. package/dist/lib/interrupt.js +182 -0
  37. package/dist/lib/junit-report.d.ts +58 -0
  38. package/dist/lib/junit-report.js +210 -0
  39. package/dist/lib/output.d.ts +16 -1
  40. package/dist/lib/output.js +24 -2
  41. package/dist/lib/pagination.d.ts +4 -3
  42. package/dist/lib/pagination.js +34 -6
  43. package/dist/lib/poll.d.ts +11 -0
  44. package/dist/lib/poll.js +70 -5
  45. package/dist/lib/prompt.js +52 -8
  46. package/dist/lib/proxy.d.ts +29 -0
  47. package/dist/lib/proxy.js +30 -0
  48. package/dist/lib/render-error.js +3 -1
  49. package/dist/lib/runs.types.d.ts +9 -0
  50. package/dist/lib/skill-nudge.d.ts +2 -2
  51. package/dist/lib/skill-nudge.js +13 -4
  52. package/dist/lib/target-url.js +8 -1
  53. package/dist/lib/ticker.d.ts +11 -1
  54. package/dist/lib/ticker.js +33 -1
  55. package/dist/lib/update-check.d.ts +67 -0
  56. package/dist/lib/update-check.js +246 -0
  57. package/dist/lib/v3-advisory.d.ts +13 -0
  58. package/dist/lib/v3-advisory.js +24 -0
  59. package/dist/lib/version-notice.d.ts +37 -0
  60. package/dist/lib/version-notice.js +87 -0
  61. package/dist/version-guard.d.ts +33 -0
  62. package/dist/version-guard.js +39 -0
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/package.json +3 -2
  66. package/skills/testsprite-onboard.skill.md +21 -0
  67. package/skills/testsprite-verify.codex.md +6 -0
  68. package/skills/testsprite-verify.skill.md +48 -4
@@ -21,6 +21,17 @@ Run the loop only once the change is live somewhere reachable (e.g. open the PR,
21
21
  let CI deploy the preview/staging environment) and pass that URL as
22
22
  `--target-url`. Running earlier verifies the previous build, not your change.
23
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.
34
+
24
35
  ## When to skip
25
36
 
26
37
  The skip list is narrow:
@@ -165,6 +176,39 @@ only the Python **standard library + `requests` + `pytest` + `numpy` + `scipy`**
165
176
  - Get values from the API's responses (and captured variables), not by importing and
166
177
  calling the app's internals.
167
178
 
179
+ **Authentication — read the injected credential, NEVER hardcode any credential.** This
180
+ applies to **every** secret the API needs — Bearer/JWT tokens **and** API keys, basic-auth
181
+ blobs, session cookies. Do not paste a literal `Bearer …`, `sk-…`, `x-api-key` value, or any
182
+ other credential into the test. Before your script runs, TestSprite prepends a managed
183
+ credential block built from the project's Authentication settings, and `__AUTH_HEADERS__`
184
+ already contains the right header(s) for the configured auth type:
185
+
186
+ ```python
187
+ # Auto-injected credentials — do not modify
188
+ __AUTH_CREDENTIAL__ = "..."
189
+ __AUTH_TYPE__ = "Bearer token" # or "API key" / "basic token" / "public"
190
+ __AUTH_HEADERS__ = {"Authorization": "Bearer ..."} # API key → {"X-API-Key": "..."}; basic → {"Authorization": "Basic ..."}
191
+ ```
192
+
193
+ Spread `__AUTH_HEADERS__` into every authenticated request — it adapts to whatever auth type
194
+ the project is configured for, so the same line works for Bearer, API-key, or basic auth:
195
+
196
+ ```python
197
+ r = requests.get(f"{TARGET_URL}/profile", headers={**__AUTH_HEADERS__})
198
+ ```
199
+
200
+ Configure the credential **once on the project** (ask the user for the value — never invent
201
+ or reuse a key you happened to see), and the block stays correct + refreshable:
202
+
203
+ - **Bearer / API key / basic (static):**
204
+ `testsprite project credential <projectId> --type "Bearer token"|"API key"|"basic token" --credential <value>`
205
+ - **Auto-refreshing login (recurring token):** `testsprite project auto-auth <projectId> …`
206
+
207
+ A hardcoded token expires within hours (and a hardcoded key can't be rotated centrally), so
208
+ the test breaks on later runs; the managed block is rewritten with a fresh value each run.
209
+ `test create` emits a `[warn]` when it detects an inlined credential literal — treat that as
210
+ a must-fix, not a nuisance.
211
+
168
212
  **Backend tests that share state declare dependencies at create time.** For a
169
213
  one-off verification, prefer a single self-contained script (log in inside the
170
214
  same file). But when the coverage set splits naturally into producer → consumer
@@ -192,10 +236,10 @@ testsprite test create --type backend --project <projectId> --name "fixture user
192
236
  ordering: trigger the set with `test run --all` (§4) and producers run before
193
237
  consumers, `teardown` last. Chaining `run A --wait && run B --wait` yourself
194
238
  loses the engine's variable passing and conflicts with concurrent runs.
195
- - **Declarations are currently create-only.** `test update` cannot amend them and
196
- `test get` / `test list` don't echo them back, so note what each test
197
- produces/needs as you create it; changing the graph later means delete +
198
- recreate.
239
+ - **Declarations are editable.** `test update` amends them (`--produces` /
240
+ `--needs` / `--category`, repeatable) and `test get` echoes them back —
241
+ still declare the graph at create time when you can, so wave ordering is
242
+ right on the first run.
199
243
 
200
244
  **Show the user the drafted plan / code before creating it** — creating writes to
201
245
  their project. One short confirmation; let them edit the tempfile first.