@testsprite/testsprite-cli 0.1.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 (63) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +190 -0
  3. package/dist/assets/agent-skill/testsprite-verify.codex.md +119 -0
  4. package/dist/assets/agent-skill/testsprite-verify.skill.md +423 -0
  5. package/dist/commands/agent.d.ts +51 -0
  6. package/dist/commands/agent.js +552 -0
  7. package/dist/commands/auth.d.ts +38 -0
  8. package/dist/commands/auth.js +247 -0
  9. package/dist/commands/init.d.ts +63 -0
  10. package/dist/commands/init.js +350 -0
  11. package/dist/commands/project.d.ts +72 -0
  12. package/dist/commands/project.js +400 -0
  13. package/dist/commands/test.d.ts +1245 -0
  14. package/dist/commands/test.js +6214 -0
  15. package/dist/commands/usage.d.ts +63 -0
  16. package/dist/commands/usage.js +156 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +146 -0
  19. package/dist/lib/agent-targets.d.ts +50 -0
  20. package/dist/lib/agent-targets.js +99 -0
  21. package/dist/lib/bundle.d.ts +178 -0
  22. package/dist/lib/bundle.js +600 -0
  23. package/dist/lib/client-factory.d.ts +72 -0
  24. package/dist/lib/client-factory.js +120 -0
  25. package/dist/lib/config.d.ts +24 -0
  26. package/dist/lib/config.js +30 -0
  27. package/dist/lib/credentials.d.ts +17 -0
  28. package/dist/lib/credentials.js +122 -0
  29. package/dist/lib/dry-run/fetch.d.ts +18 -0
  30. package/dist/lib/dry-run/fetch.js +52 -0
  31. package/dist/lib/dry-run/samples.d.ts +50 -0
  32. package/dist/lib/dry-run/samples.js +676 -0
  33. package/dist/lib/errors.d.ts +118 -0
  34. package/dist/lib/errors.js +388 -0
  35. package/dist/lib/facade.d.ts +48 -0
  36. package/dist/lib/facade.js +104 -0
  37. package/dist/lib/failing-fe-resolver.d.ts +60 -0
  38. package/dist/lib/failing-fe-resolver.js +103 -0
  39. package/dist/lib/http.d.ts +255 -0
  40. package/dist/lib/http.js +608 -0
  41. package/dist/lib/output.d.ts +55 -0
  42. package/dist/lib/output.js +70 -0
  43. package/dist/lib/pagination.d.ts +56 -0
  44. package/dist/lib/pagination.js +81 -0
  45. package/dist/lib/poll.d.ts +88 -0
  46. package/dist/lib/poll.js +221 -0
  47. package/dist/lib/prompt.d.ts +8 -0
  48. package/dist/lib/prompt.js +97 -0
  49. package/dist/lib/rate-throttle.d.ts +49 -0
  50. package/dist/lib/rate-throttle.js +75 -0
  51. package/dist/lib/render-error.d.ts +15 -0
  52. package/dist/lib/render-error.js +44 -0
  53. package/dist/lib/runs.types.d.ts +344 -0
  54. package/dist/lib/runs.types.js +25 -0
  55. package/dist/lib/target-url.d.ts +25 -0
  56. package/dist/lib/target-url.js +127 -0
  57. package/dist/lib/ticker.d.ts +37 -0
  58. package/dist/lib/ticker.js +63 -0
  59. package/dist/lib/validate.d.ts +82 -0
  60. package/dist/lib/validate.js +165 -0
  61. package/dist/version.d.ts +1 -0
  62. package/dist/version.js +2 -0
  63. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 TestSprite, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,190 @@
1
+ <div align="center">
2
+
3
+ <a href="https://www.testsprite.com">
4
+ <picture>
5
+ <source media="(prefers-color-scheme: dark)" srcset="assets/testsprite-logo-dark.svg">
6
+ <source media="(prefers-color-scheme: light)" srcset="assets/testsprite-logo-light.svg">
7
+ <img src="assets/testsprite-logo-dark.svg" alt="TestSprite" width="420">
8
+ </picture>
9
+ </a>
10
+
11
+ ### The verification layer for the agentic coding era.
12
+
13
+ AI ships code in minutes — verifying it hasn't. `testsprite` opens your live app, uses it like a real user, and shows your coding agent exactly what broke — so it fixes its own work before a bug ever reaches you.
14
+
15
+ <sub><b>Proof, in public: verification beats model size.</b> With this CLI in the loop, the cheapest model in the field shipped the most correct app on an open leaderboard — <b>89%</b>, at half the cost of the priciest one. <a href="https://codercup.ai">See the leaderboard →</a></sub>
16
+
17
+ <p>
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
+ <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>
21
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-0A0A0A" alt="License Apache 2.0"></a>
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
+ </p>
24
+
25
+ <p>
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://www.testsprite.com/docs"><img src="https://img.shields.io/badge/Docs-0A0A0A?style=for-the-badge" alt="Docs"></a>
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
+ <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
+ <a href="https://discord.gg/W4JDrZfdB"><img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord"></a>
31
+ </p>
32
+
33
+ ⭐ _Help us reach more developers and grow the TestSprite community. Star this repo!_
34
+
35
+ </div>
36
+
37
+ https://github.com/user-attachments/assets/ab3105d5-4d5c-4a7b-b639-610f80fddc0e
38
+
39
+ <p align="center"><sub><b>▶ Watch the launch video</b> — the three hard limits every coding agent hits, and the loop that breaks them (4 min).</sub></p>
40
+
41
+ ---
42
+
43
+ ## What is it?
44
+
45
+ [TestSprite](https://www.testsprite.com) is the AI testing platform 100,000+ teams use to test their software, frontend and backend — in the cloud, against the live product, not mocks. This repo is its official CLI.
46
+
47
+ It puts that platform in your coding agent's hands: the agent verifies every behavior it ships, and what broke comes back as **one self-consistent bundle** it can act on — no dashboard scraping. Humans drive the same surface from a terminal or CI.
48
+
49
+ ## ⭐️ Star the Repository
50
+
51
+ <img width="900" height="506" alt="testsprite-repo-star-fast" src="https://github.com/user-attachments/assets/8c3975df-8d47-4d6c-a485-135b80f779a5" />
52
+
53
+ If you find `testsprite` useful, a GitHub Star ⭐️ would be greatly appreciated — it helps other builders (and their agents) find the project, and stars notify you about new releases.
54
+
55
+ ## Quickstart
56
+
57
+ Requires **Node.js ≥ 20**. (No global install? `npx @testsprite/testsprite-cli` works too.)
58
+
59
+ ```bash
60
+ npm install -g @testsprite/testsprite-cli
61
+ testsprite init
62
+ ```
63
+
64
+ `testsprite init` 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.). Non-interactive (CI / onboarding scripts):
65
+
66
+ ```bash
67
+ TESTSPRITE_API_KEY=sk-... testsprite init --from-env --yes --agent claude
68
+ ```
69
+
70
+ From there, the loop runs on its own — an example session, typed by the coding agent:
71
+
72
+ ```bash
73
+ # 1 — describe the behavior you want to guarantee, run it, wait
74
+ testsprite test create --project proj_8f0f6 --type frontend \
75
+ --plan-from ./checkout-flow.plan.json --run --wait --output json
76
+ # → exits 1: the run failed
77
+
78
+ # 2 — pull ONE self-consistent failure bundle
79
+ testsprite test failure get test_3a9f21c7 --out ./.testsprite/failure
80
+
81
+ # 3 — the agent reads the bundle, fixes the code, then replays
82
+ testsprite test rerun test_3a9f21c7 --wait --output json
83
+ # → exits 0: passed. The test now lives in your durable suite.
84
+ ```
85
+
86
+ Prefer to configure each step by hand (or learn the surface offline with `--dry-run` first)? See [Manual setup](./DOCUMENTATION.md#manual-setup) and [Install & verify](./DOCUMENTATION.md#install--verify).
87
+
88
+ ## Commands
89
+
90
+ | Group | Command | What it does |
91
+ | --------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
92
+ | **Init** | `init` | One-shot onboarding: auth configure + whoami + agent install |
93
+ | **Auth** | `auth configure` | Store an API key at `~/.testsprite/credentials` |
94
+ | | `auth whoami` _(alias `status`)_ | Resolve the active profile to its user, key, env, and scopes |
95
+ | | `auth logout` | Remove the active profile from the credentials file |
96
+ | **Read** | `project list` / `project get` | List projects / fetch one by id |
97
+ | | `test list` / `test get` | List tests under a project / fetch one by id |
98
+ | | `test code get` | Print (or write) the generated test source |
99
+ | | `test steps` | List the latest run's steps with screenshot / DOM pointers |
100
+ | | `test result` | Latest result; `--history` lists a test's prior runs |
101
+ | | `test failure get` | The agent entry point: one self-contained latest-failure bundle |
102
+ | | `test failure summary` | One-screen triage card (no media download) |
103
+ | **Write** | `test create` / `test create-batch` | Create a test (or bulk-create from a plan file); `--produces` / `--needs` / `--category` wire BE dependency metadata |
104
+ | | `test update` / `test delete` / `test delete-batch` | Edit metadata / soft-delete |
105
+ | | `test code put` | Replace generated code (etag-guarded) |
106
+ | | `test plan put` | Replace a frontend test's plan-steps |
107
+ | | `project create` / `project update` | Manage projects |
108
+ | **Run** | `test run` | Trigger a fresh run; `--wait` blocks until terminal; `--all --project <id>` runs all tests in a project in wave order |
109
+ | | `test rerun` | Cheap replay of one/many tests (FE verbatim; BE with deps); `--all --project <id>` reruns all tests |
110
+ | | `test wait` | Block on a `runId` until terminal |
111
+ | | `test artifact get` | Download the failure bundle for a specific `runId` |
112
+ | **Agent** | `agent install` / `agent list` | Onboard a coding agent (pure-local); targets: `claude`, `codex`, `cursor`, `cline`, `antigravity` |
113
+
114
+ 📚 **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).
115
+
116
+ ## Why a CLI for coding agents?
117
+
118
+ - 🧪 **Tests like a real user.** Runs against a live browser or API in the cloud — real clicks, real navigation, real assertions. Not a mock.
119
+ - 🤖 **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.
120
+ - ♻️ **A loop, not a one-shot.** `create → run → failure get → fix → rerun` — every pass is banked, not thrown away.
121
+ - 📐 **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.
122
+ - 🔌 **One command to onboard your agent.** `testsprite agent install claude` drops a ready-made skill file into your repo so your coding agent knows how to drive the loop on its own.
123
+
124
+ ## How it works
125
+
126
+ Every time your agent changes code, it asks one question: **is this behavior already covered by the suite?**
127
+
128
+ - **Not yet covered** → `testsprite test create` — describe the new behavior, run it.
129
+ - **Already covered** → `testsprite test rerun` — replay the existing tests, so nothing that used to work breaks silently.
130
+ - **Something fails** → `testsprite test failure get` — one self-consistent bundle; the agent fixes the code and reruns.
131
+
132
+ 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.
133
+
134
+ ```mermaid
135
+ flowchart TD
136
+ A["🤖 Your coding agent<br/>Claude Code · Codex · Antigravity · Kimi · Cursor · Trae …"]
137
+ D{"behavior already<br/>covered by the suite?"}
138
+ B["<b>testsprite test create</b><br/>new behavior → new test"]
139
+ R["<b>testsprite test rerun</b><br/>replay the existing tests"]
140
+ C{{"☁️ TestSprite testing agent<br/>runs the test like a real user against<br/>real browsers & real APIs on Cloud"}}
141
+ F["<b>testsprite test failure get</b><br/>ONE self-consistent bundle:<br/>failing step · screenshots · DOM ·<br/>root-cause · recommended fix"]
142
+ S[("📚 Durable integration suite<br/>grows with every pass")]
143
+
144
+ A -->|"writes / changes code"| D
145
+ D -->|"no — new behavior"| B
146
+ D -->|"yes"| R
147
+ B --> C
148
+ R --> C
149
+ C -->|"pass ✅"| S
150
+ C -->|"fail ❌"| F
151
+ F -->|"agent reads the bundle<br/>& fixes the code"| A
152
+ S -.->|"defines what's covered"| D
153
+ ```
154
+
155
+ The cloud is a black box on purpose: your agent describes intent and reads results. It never has to know _how_ the test was driven — only _what_ a real user experienced.
156
+
157
+ ## Proved in public
158
+
159
+ On [**CoderCup**](https://codercup.ai) — an open leaderboard where frontier coding agents build the _same_ app under the _same_ rules, with TestSprite as the referee — the **cheapest** model in the field shipped the **most correct** app on the board: **89%**, at half the cost of the priciest one.
160
+
161
+ That's the point of all of this: you no longer need the biggest, most expensive model to ship software you can trust — top-tier quality, without paying top-tier prices, within reach of every team.
162
+
163
+ ## Getting help
164
+
165
+ - 📚 **CLI reference** — [DOCUMENTATION.md](./DOCUMENTATION.md)
166
+ - 🌐 **Platform docs** — [testsprite.com/docs](https://www.testsprite.com/docs)
167
+ - 🐛 **Issues & feature requests** — [GitHub issues](https://github.com/TestSprite/testsprite-cli/issues)
168
+ - 💬 **Quick questions** — [Discord](https://discord.gg/W4JDrZfdB), or `testsprite --help` / `testsprite test run --help` right in your terminal
169
+ - 📝 **Changelog** — [CHANGELOG.md](./CHANGELOG.md)
170
+
171
+ ## Contributing
172
+
173
+ Contributions are welcome — the CLI is plain TypeScript/Node (≥ 20), tested with Vitest, built with `tsc`. Getting a dev loop running takes a minute:
174
+
175
+ ```bash
176
+ git clone https://github.com/TestSprite/testsprite-cli.git
177
+ cd testsprite-cli && npm install
178
+ npm run build # tsc → dist/ ; try it: node dist/index.js --help
179
+ npm test # unit suite — no network or credentials needed
180
+ npm run lint:fix # ESLint
181
+ npm run typecheck # tsc --noEmit
182
+ ```
183
+
184
+ Pull requests target the `dev` branch. The full guide — build from source, test tiers, CI gates, branches, project layout — is in [CONTRIBUTING.md](./CONTRIBUTING.md).
185
+
186
+ **Support** — if you need any help, we're responsive on [Discord](https://discord.gg/W4JDrZfdB), and feel free to email us at [contact@testsprite.com](mailto:contact@testsprite.com) too.
187
+
188
+ ## License
189
+
190
+ [Apache-2.0](./LICENSE) © TestSprite
@@ -0,0 +1,119 @@
1
+ # TestSprite Verification Loop
2
+
3
+ After finishing a feature or fix in a TestSprite-tested repo, use the `testsprite`
4
+ CLI to run the relevant TestSprite tests against the change and inspect any failure
5
+ artifacts before reporting the work as done. Use whenever code has changed outside
6
+ docs/config and is about to be reported complete.
7
+
8
+ ## When to run
9
+
10
+ Run after a feature or fix lands. Skip only for: docs-only edits, pure
11
+ build/config changes, or when the repo has no TestSprite project linked.
12
+
13
+ ## Core loop
14
+
15
+ ### 1. Preflight
16
+
17
+ ```bash
18
+ testsprite --version # CLI installed?
19
+ testsprite auth whoami # credentials valid?
20
+ ```
21
+
22
+ If `--version` fails, tell the user to install the CLI and stop.
23
+ If `auth whoami` fails, tell the user to run `testsprite auth configure` and stop.
24
+
25
+ ### 2. Find the project
26
+
27
+ In order: `$TESTSPRITE_PROJECT_ID` → `.testsprite/config.json` → `testsprite project list --output json`.
28
+
29
+ ### 3. Run
30
+
31
+ ```bash
32
+ # New frontend test from plan (most common)
33
+ testsprite test create --plan-from plan.json --run --wait \
34
+ --target-url https://staging.example.com --timeout 600 --output json
35
+
36
+ # Existing test
37
+ testsprite test run <test-id> --target-url https://staging.example.com \
38
+ --wait --timeout 600 --output json
39
+
40
+ # New backend test from Python assertion file
41
+ testsprite test create --type backend --name "Login rejects empty password" \
42
+ --project <id> --code-file /tmp/test.py --run --wait --timeout 600
43
+
44
+ # Replay (cheaper than a fresh run — reuses saved test code)
45
+ testsprite test rerun <test-id> --wait --output json
46
+
47
+ # Backend tests sharing state: declare the dependency graph at create time;
48
+ # the wave engine orders runs (producers → consumers → teardown last)
49
+ testsprite test create --type backend --project <id> --code-file /tmp/login.py \
50
+ --name "login issues an auth token" --produces auth_token
51
+ testsprite test create --type backend --project <id> --code-file /tmp/profile.py \
52
+ --name "profile update accepts the token" --needs auth_token
53
+ testsprite test create --type backend --project <id> --code-file /tmp/cleanup.py \
54
+ --name "fixture user is deleted" --category teardown
55
+
56
+ # Wave-ordered batch fresh run (BE tests, all or filtered)
57
+ testsprite test run --all --project <id> [--filter <substr>] \
58
+ --wait --max-concurrency 4 --output json
59
+ ```
60
+
61
+ **Key behaviors:**
62
+
63
+ - `--target-url` must be publicly reachable (no localhost / RFC1918) and must
64
+ already have the change deployed (e.g. a CI preview deploy) — the CLI tests a
65
+ deployed URL, it doesn't host your environment. Running earlier verifies the
66
+ previous build.
67
+ - `--wait` long-polls until terminal. Do not wrap it in a retry loop.
68
+ - Exit `0` = passed; `1` = failed/blocked; `7` = timeout (resume with `test wait <run-id>`).
69
+ - BE dependency flags (`--produces`/`--needs`/`--category`) are backend-only and
70
+ **create-only** — they can't be read back or edited later (delete + recreate to
71
+ change the graph). Don't hand-sequence `test run` calls to fake ordering; use
72
+ `test run --all` so the engine passes captured variables between waves.
73
+ - A BE `test rerun` dispatches the whole producer/teardown closure, side effects
74
+ included; `--skip-dependencies` reruns only the named test. If a producer failed
75
+ in the same closure, the consumer's failure is starvation (missing token/fixture)
76
+ — triage the producer first; it does not implicate your change.
77
+ - `create` and `--wait` output include a `dashboardUrl` — if the user wants to
78
+ inspect a test or run themselves, point them there.
79
+
80
+ ### 4. On failure — download the artifact
81
+
82
+ ```bash
83
+ testsprite test artifact get <run-id> --out ./.testsprite/runs/<run-id>/
84
+ ```
85
+
86
+ Inspect the bundle (failing step, screenshots, root-cause hypothesis) before
87
+ deciding whether your change caused the failure.
88
+
89
+ ### 5. One more tool — dry-run for learning
90
+
91
+ Every command works without credentials under `--dry-run`:
92
+
93
+ ```bash
94
+ testsprite test run <test-id> --dry-run --output json
95
+ testsprite test create --plan-from plan.json --dry-run --output json
96
+ ```
97
+
98
+ ## Exit-code quick reference
99
+
100
+ | Code | Meaning |
101
+ | ---- | ------------------------------------------------- |
102
+ | 0 | Success (passed) |
103
+ | 1 | Failed / blocked / cancelled |
104
+ | 3 | Auth error |
105
+ | 4 | Not found |
106
+ | 5 | Validation error |
107
+ | 6 | Conflict (already running) |
108
+ | 7 | Timeout — resume: `testsprite test wait <run-id>` |
109
+ | 11 | Rate limited (retriable) |
110
+ | 12 | Insufficient credits |
111
+
112
+ ## Bootstrap (first-time setup)
113
+
114
+ ```bash
115
+ npm install -g @testsprite/testsprite-cli
116
+ testsprite init # configure + verify + install agent skill in one shot
117
+ ```
118
+
119
+ Or step-by-step: `testsprite auth configure` → `testsprite auth whoami`.