@testsprite/testsprite-cli 0.1.2 → 0.3.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 (58) hide show
  1. package/README.md +34 -26
  2. package/dist/commands/agent.d.ts +52 -0
  3. package/dist/commands/agent.js +341 -93
  4. package/dist/commands/auth.js +29 -27
  5. package/dist/commands/doctor.d.ts +49 -0
  6. package/dist/commands/doctor.js +211 -0
  7. package/dist/commands/init.d.ts +7 -1
  8. package/dist/commands/init.js +66 -26
  9. package/dist/commands/project.d.ts +50 -1
  10. package/dist/commands/project.js +257 -43
  11. package/dist/commands/test.d.ts +214 -12
  12. package/dist/commands/test.js +1310 -174
  13. package/dist/commands/usage.js +13 -12
  14. package/dist/index.js +71 -18
  15. package/dist/lib/agent-targets.d.ts +169 -22
  16. package/dist/lib/agent-targets.js +335 -34
  17. package/dist/lib/bundle.d.ts +51 -1
  18. package/dist/lib/bundle.js +146 -55
  19. package/dist/lib/client-factory.d.ts +43 -0
  20. package/dist/lib/client-factory.js +89 -2
  21. package/dist/lib/config.d.ts +2 -0
  22. package/dist/lib/config.js +11 -2
  23. package/dist/lib/credentials.d.ts +7 -0
  24. package/dist/lib/credentials.js +40 -1
  25. package/dist/lib/dry-run/samples.d.ts +5 -0
  26. package/dist/lib/dry-run/samples.js +54 -9
  27. package/dist/lib/flaky.d.ts +80 -0
  28. package/dist/lib/flaky.js +76 -0
  29. package/dist/lib/http.d.ts +20 -0
  30. package/dist/lib/http.js +216 -132
  31. package/dist/lib/interrupt.d.ts +61 -0
  32. package/dist/lib/interrupt.js +97 -0
  33. package/dist/lib/junit-report.d.ts +58 -0
  34. package/dist/lib/junit-report.js +210 -0
  35. package/dist/lib/output.d.ts +16 -1
  36. package/dist/lib/output.js +24 -2
  37. package/dist/lib/pagination.d.ts +4 -3
  38. package/dist/lib/pagination.js +34 -6
  39. package/dist/lib/prompt.js +52 -8
  40. package/dist/lib/proxy.d.ts +29 -0
  41. package/dist/lib/proxy.js +30 -0
  42. package/dist/lib/render-error.d.ts +13 -0
  43. package/dist/lib/render-error.js +30 -7
  44. package/dist/lib/skill-nudge.d.ts +2 -2
  45. package/dist/lib/skill-nudge.js +13 -4
  46. package/dist/lib/target-url.js +8 -1
  47. package/dist/lib/ticker.d.ts +11 -1
  48. package/dist/lib/ticker.js +33 -1
  49. package/dist/lib/update-check.d.ts +67 -0
  50. package/dist/lib/update-check.js +246 -0
  51. package/dist/version-guard.d.ts +33 -0
  52. package/dist/version-guard.js +39 -0
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/package.json +3 -2
  56. package/skills/testsprite-onboard.skill.md +183 -0
  57. package/skills/testsprite-verify.codex.md +2 -0
  58. package/skills/testsprite-verify.skill.md +52 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ AI ships code in minutes — verifying it hasn't. `testsprite` opens your live a
17
17
  <p>
18
18
  <a href="https://www.npmjs.com/package/@testsprite/testsprite-cli"><img src="https://img.shields.io/npm/v/@testsprite/testsprite-cli?color=19C379&label=npm" alt="npm version"></a>
19
19
  <a href="https://www.npmjs.com/package/@testsprite/testsprite-cli"><img src="https://img.shields.io/npm/dm/@testsprite/testsprite-cli?color=19C379&label=downloads" alt="npm downloads"></a>
20
- <a href="#quickstart"><img src="https://img.shields.io/badge/node-%3E%3D20-19C379" alt="Node >= 20"></a>
20
+ <a href="#quickstart"><img src="https://img.shields.io/badge/node-20.19%2B%20%7C%2022.13%2B%20%7C%2024%2B-19C379" alt="Node 20.19+, 22.13+, or 24+"></a>
21
21
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-0A0A0A" alt="License Apache 2.0"></a>
22
22
  <a href="https://github.com/TestSprite/testsprite-cli/actions/workflows/ci.yml"><img src="https://github.com/TestSprite/testsprite-cli/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
23
23
  </p>
@@ -54,14 +54,14 @@ If you find `testsprite` useful, a GitHub Star ⭐️ would be greatly appreciat
54
54
 
55
55
  ## Quickstart
56
56
 
57
- Requires **Node.js ≥ 20**. (No global install? `npx @testsprite/testsprite-cli` works too.)
57
+ Requires **Node.js 20.19+**, **22.13+**, or **24+**. (No global install? `npx @testsprite/testsprite-cli` works too.)
58
58
 
59
59
  ```bash
60
60
  npm install -g @testsprite/testsprite-cli
61
61
  testsprite setup
62
62
  ```
63
63
 
64
- `testsprite setup` prompts for your [API key](https://www.testsprite.com), verifies it, and installs the verification-loop skill for your coding agent (`claude`, `cursor`, `cline`, `antigravity`, `codex`, etc.) — one command, so your agent is wired to verify its own work. Non-interactive (CI / onboarding scripts):
64
+ `testsprite setup` prompts for your [API key](https://www.testsprite.com), verifies it, and installs the verification-loop skill for your coding agent (`claude`, `cursor`, `cline`, `windsurf`, `antigravity`, `codex`, etc.) — one command, so your agent is wired to verify its own work. Non-interactive (CI / onboarding scripts):
65
65
 
66
66
  ```bash
67
67
  TESTSPRITE_API_KEY=sk-... testsprite setup --from-env --yes --agent claude
@@ -69,6 +69,8 @@ TESTSPRITE_API_KEY=sk-... testsprite setup --from-env --yes --agent claude
69
69
 
70
70
  > **Pointing a coding agent (Claude Code, Cursor, Codex, Cline, …) at TestSprite?** Have it run `testsprite setup` first — that installs the verification skill, so the agent knows how to create, run, and triage tests on its own (instead of guessing from this README). New here? Start with the **[getting-started overview](https://docs.testsprite.com/cli/getting-started/overview)**.
71
71
 
72
+ > **Privacy note:** interactive runs check the npm registry at most once per 24 h to offer a "new version available" notice — package name only, never your key or data; `TESTSPRITE_NO_UPDATE_NOTIFIER=1` disables it. Details in [DOCUMENTATION.md → Update notice](./DOCUMENTATION.md#update-notice).
73
+
72
74
  From there, the loop runs on its own — an example session, typed by the coding agent:
73
75
 
74
76
  ```bash
@@ -89,28 +91,34 @@ Prefer to configure each step by hand (or learn the surface offline with `--dry-
89
91
 
90
92
  ## Commands
91
93
 
92
- | Group | Command | What it does |
93
- | --------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
94
- | **Setup** | `setup` | **Start here** — one command: configure your API key, verify it, and install the agent verification skill |
95
- | **Auth** | `auth status` | Resolve the active profile to its user, key, env, and scopes |
96
- | | `auth remove` | Remove the active profile from the credentials file |
97
- | **Read** | `project list` / `project get` | List projects / fetch one by id |
98
- | | `test list` / `test get` | List tests under a project / fetch one by id |
99
- | | `test code get` | Print (or write) the generated test source |
100
- | | `test steps` | List the latest run's steps with screenshot / DOM pointers |
101
- | | `test result` | Latest result; `--history` lists a test's prior runs |
102
- | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
103
- | | `test failure summary` | One-screen triage card (no media download) |
104
- | **Write** | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--produces` / `--needs` / `--category` wire BE dependency metadata |
105
- | | `test update` / `test delete` / `test delete-batch` | Edit metadata / soft-delete |
106
- | | `test code put` | Replace generated code (etag-guarded) |
107
- | | `test plan put` | Replace a frontend test's plan-steps |
108
- | | `project create` / `project update` | Manage projects |
109
- | **Run** | `test run` | Trigger a fresh run; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order |
110
- | | `test rerun` | Cheap replay of one/many tests (FE verbatim; BE with deps); `--all --project <id>` reruns all tests |
111
- | | `test wait` | Block on a `runId` until terminal |
112
- | | `test artifact get` | Download the failure bundle for a specific `runId` |
113
- | **Agent** | `agent install` / `agent list` | Add or list coding-agent targets (pure-local): `claude`, `codex`, `cursor`, `cline`, `antigravity` |
94
+ | Group | Command | What it does |
95
+ | --------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
96
+ | **Setup** | `setup` | **Start here** — one command: configure your API key, verify it, and install the agent verification skill |
97
+ | | `doctor` | Environment diagnostic — CLI/Node versions, profile, endpoint, credentials, connectivity, agent skill; exits non-zero on failure |
98
+ | **Auth** | `auth status` | Resolve the active profile to its user, key, env, and scopes |
99
+ | | `auth remove` | Remove the active profile from the credentials file |
100
+ | | `usage` (alias `credits`) | Account pre-flight: identity, plus credit balance / plan info when the backend supplies them |
101
+ | **Read** | `project list` / `project get` | List projects / fetch one by id |
102
+ | | `test list` / `test get` | List tests under a project / fetch one by id |
103
+ | | `test code get` | Print (or write) the generated test source |
104
+ | | `test steps` | List the latest run's steps with screenshot / DOM pointers |
105
+ | | `test result` | Latest result; `--history` lists a test's prior runs |
106
+ | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
107
+ | | `test failure summary` | One-screen triage card (no media download) |
108
+ | | `test diff` | Compare two runs — verdict, failure kind, per-step status flips, code-version drift |
109
+ | **Write** | `test scaffold` / `test lint` | Author plans locally: emit a schema-correct starter, validate plan files offline — no network, no credentials |
110
+ | | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--produces` / `--needs` / `--category` wire BE dependency metadata |
111
+ | | `test update` / `test delete` / `test delete-batch` | Edit metadata / permanently delete (no restore window; `--confirm` required) |
112
+ | | `test code put` | Replace generated code (etag-guarded) |
113
+ | | `test plan put` | Replace a frontend test's plan-steps |
114
+ | | `project create` / `project update` | Manage projects |
115
+ | | `project credential` / `project auto-auth` | Configure backend-test auth: a static injected credential, or auto-refresh login (Pro) |
116
+ | **Run** | `test run` | Trigger a fresh run; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order |
117
+ | | `test rerun` | Cheap replay of one/many tests (FE verbatim; BE with deps); `--all --project <id>` reruns all tests |
118
+ | | `test flaky` | Replay a test several times (auto-heal off) and report a stability score |
119
+ | | `test wait` | Block on one or more `runId`s until terminal |
120
+ | | `test artifact get` | Download the failure bundle for a specific `runId` |
121
+ | **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` |
114
122
 
115
123
  > 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).
116
124
 
@@ -173,7 +181,7 @@ That's the point of all of this: you no longer need the biggest, most expensive
173
181
 
174
182
  ## Contributing
175
183
 
176
- Contributions are welcome — the CLI is plain TypeScript/Node (≥ 20), tested with Vitest, built with `tsc`. Getting a dev loop running takes a minute:
184
+ Contributions are welcome — the CLI is plain TypeScript/Node (20.19+, 22.13+, or 24+), tested with Vitest, built with `tsc`. Getting a dev loop running takes a minute:
177
185
 
178
186
  ```bash
179
187
  git clone https://github.com/TestSprite/testsprite-cli.git
@@ -32,20 +32,72 @@ export interface InstallResult {
32
32
  target: AgentTarget;
33
33
  path: string;
34
34
  action: InstallAction;
35
+ /**
36
+ * Skill(s) this result covers. Own-file targets produce one result per skill
37
+ * (`[skill]`); the codex managed-section target produces ONE result whose
38
+ * section aggregates every installed skill (`[...skills]`).
39
+ */
40
+ skills: string[];
35
41
  }
36
42
  type CommonOptions = FactoryCommonOptions;
37
43
  interface InstallOptions extends CommonOptions {
38
44
  target: string[];
45
+ /** Skill subset to install; empty/absent → {@link DEFAULT_SKILLS}. */
46
+ skills?: string[];
39
47
  dir?: string;
40
48
  force: boolean;
41
49
  }
42
50
  export declare function runInstall(opts: InstallOptions, deps?: AgentDeps): Promise<void>;
43
51
  export interface ListResult {
44
52
  target: AgentTarget;
53
+ skill: string;
45
54
  status: string;
46
55
  mode: string;
47
56
  path: string;
48
57
  }
49
58
  export declare function runList(opts: CommonOptions, deps?: AgentDeps): Promise<void>;
59
+ /**
60
+ * Health of one installed skill artifact, as reported by `agent status`.
61
+ *
62
+ * Decision order (first match wins):
63
+ * - 'absent' : nothing at the landing path (codex: no managed section,
64
+ * including an AGENTS.md that exists without our sentinels).
65
+ * - 'corrupt' : codex only. Dangling or duplicated sentinels, the same
66
+ * classification `agent install` refuses on; status REPORTS it
67
+ * instead of refusing.
68
+ * - 'unmarked' : artifact present but carries no testsprite-skill marker
69
+ * (installed before markers existed), or the landing path is
70
+ * occupied by a non-regular file (never followed).
71
+ * - 'stale' : marker present, but its hash differs from the current
72
+ * canonical body: a re-install would change the content. Edits
73
+ * on top of an OLD install also read stale (older renders
74
+ * cannot be reproduced); the remedy is the same re-install.
75
+ * - 'modified' : marker hash matches the current body, but the artifact bytes
76
+ * differ from the canonical render carrying that same marker
77
+ * line: the user edited the artifact after install.
78
+ * - 'ok' : marker hash matches and the bytes equal the canonical render
79
+ * with the file's own marker line (a version-string-only lag
80
+ * with an unchanged body still reads ok).
81
+ *
82
+ * For the codex managed section, ONE marker names every aggregated skill
83
+ * ('+'-joined); skills not named by the marker report 'absent'.
84
+ */
85
+ export type SkillArtifactState = 'ok' | 'stale' | 'modified' | 'unmarked' | 'absent' | 'corrupt';
86
+ export interface StatusResult {
87
+ target: AgentTarget;
88
+ skill: string;
89
+ path: string;
90
+ state: SkillArtifactState;
91
+ }
92
+ interface StatusOptions extends CommonOptions {
93
+ dir?: string;
94
+ }
95
+ /**
96
+ * `agent status`: one row per (target × default skill), each classified per
97
+ * the {@link SkillArtifactState} contract. Exit contract: returns normally
98
+ * (exit 0) when every row is 'ok' or 'absent'; throws CLIError exit 1 when any
99
+ * row is stale/modified/unmarked/corrupt, so the command can gate CI.
100
+ */
101
+ export declare function runStatus(opts: StatusOptions, deps?: AgentDeps): Promise<void>;
50
102
  export declare function createAgentCommand(deps?: AgentDeps): Command;
51
103
  export {};