ripplo 0.5.11 → 0.6.1

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 (3) hide show
  1. package/README.md +46 -53
  2. package/dist/index.js +170 -169
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,82 +1,75 @@
1
1
  # ripplo
2
2
 
3
- CLI for [Ripplo](https://ripplo.ai) typed end-to-end tests with real backend state.
3
+ CLI for [Ripplo](https://ripplo.ai). Typed end-to-end tests with real backend state.
4
4
 
5
- ## Install
5
+ Run via `npx ripplo <command>` so you always pick up the latest version. No global install needed.
6
6
 
7
- ```sh
8
- npm install -g ripplo
9
- # or: npx ripplo <subcommand>
10
- ```
7
+ ## Recommended setup: Claude Code plugin
11
8
 
12
- ## Setup
9
+ If you use Claude Code, this is the shortest path. The plugin handles auth, scaffolding, and adapter wiring, and adds hooks that keep tests in sync with code changes.
13
10
 
14
- ```sh
15
- ripplo auth login # device-code flow; opens a browser
16
- ripplo init # scaffolds .ripplo/ and writes RIPPLO_* env vars
11
+ ```
12
+ /plugin marketplace add ripplo/claude-plugin
13
+ /plugin install ripplo
14
+ /ripplo:setup
17
15
  ```
18
16
 
19
- `init` is interactive (or pass `--project`, `--env`, `--app-url`, `--engine-url`). It scaffolds `.ripplo/{index.ts, project.json, preconditions/, observers/, tests/}`, appends `RIPPLO_APP_URL` / `RIPPLO_ENGINE_URL` / `RIPPLO_WEBHOOK_SECRET` to your env file, and installs `@ripplo/testing`.
17
+ That's it. Skip the rest of this README unless you want to know what `/ripplo:setup` is doing under the hood, or you're not on Claude Code.
20
18
 
21
- Run `ripplo watch` as a background process in your project directory — it's the local executor that subscribes to run requests and runs tests against your dev server:
19
+ ## Manual setup
20
+
21
+ Three steps: authenticate, scaffold, mount the adapter in your app server.
22
22
 
23
23
  ```sh
24
- npx ripplo watch
24
+ npx ripplo auth login # device-code flow, opens a browser
25
+ npx ripplo init # scaffolds .ripplo/ and writes RIPPLO_* env vars
25
26
  ```
26
27
 
27
- Run it alongside (but separate from) your app's dev server. Then mount the engine adapter into your app server (Express, Fastify, Next.js, Hono, Koa, NestJS, Elysia) — see [`@ripplo/testing`](https://www.npmjs.com/package/@ripplo/testing) for the adapter snippets.
28
+ `ripplo init` is interactive. It creates `.ripplo/{index.ts, project.json, preconditions/, observers/, tests/}`, appends `RIPPLO_APP_URL`, `RIPPLO_ENGINE_URL`, and `RIPPLO_WEBHOOK_SECRET` to your env file, and installs `@ripplo/testing`.
28
29
 
29
- For a guided setup, install the [Claude Code plugin](https://www.npmjs.com/package/@ripplo/claude-plugin) and run `/ripplo:setup`.
30
+ Then mount the adapter in your app server. Next.js App Router:
30
31
 
31
- ## Worktrees
32
+ ```ts
33
+ // app/ripplo/[action]/route.ts
34
+ import { createNextHandler } from "@ripplo/testing/nextjs";
35
+ import { engine } from "@/server/test/engine";
36
+
37
+ export const PUT = createNextHandler({
38
+ enabled: process.env.ENABLE_RIPPLO_TESTING === "true",
39
+ engine,
40
+ });
41
+ ```
32
42
 
33
- Each git worktree is its own self-contained Ripplo project: own DevSession, scope, debug artifacts, and lockfile checkout. Auth token, Playwright browser, projectId, and webhook secret are shared globally — no re-auth or re-init needed when you create a new worktree.
43
+ For Express, Fastify, Hono, Koa, NestJS, or Elysia, see [`@ripplo/testing`](https://www.npmjs.com/package/@ripplo/testing).
34
44
 
35
- Two things won't carry over automatically:
45
+ `engine` is what you write in `src/test/engine.ts` to provide the implementations for the preconditions and observers you defined in `.ripplo/`. The DSL reference covers it.
36
46
 
37
- - **Env files are usually gitignored.** A fresh worktree won't have your `.env.local` (or whichever file `ripplo init` wrote `RIPPLO_*` vars to). Copy it from the main checkout, or point all worktrees at a shared file outside the working tree (e.g. `envFiles: ["../.shared.env"]` in `.ripplo/project.json`). `ripplo doctor` flags missing env files explicitly.
38
- - **Dev server port + URL vars.** Two sibling worktrees can't both run `pnpm dev` on the same port. Pick a distinct port for this worktree, **and update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL`** in this worktree's env file to match — e.g. main on `:3000` → this worktree on `:3001` → set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo`. If the URL vars stay pointing at main's port, `ripplo watch` talks to the wrong dev server.
47
+ ## Running tests
39
48
 
40
- ## Commands
49
+ In one terminal, start the local executor:
41
50
 
42
- | Command | Description |
43
- | -------------------------- | ---------------------------------------------------------------------------------------------- |
44
- | `ripplo auth login` | Authenticate via device code flow |
45
- | `ripplo auth status` | Show current authentication |
46
- | `ripplo auth logout` | Remove the saved token |
47
- | `ripplo init` | Scaffold `.ripplo/` and write `RIPPLO_*` env vars |
48
- | `ripplo watch` | Subscribe to run requests; execute tests against your dev server |
49
- | `ripplo run [ids..]` | Run tests in parallel (defaults to scope + dirty tests; `--all` for full suite) |
50
- | `ripplo lint [ids..]` | Compile and lint; writes `.ripplo/ripplo.lock` |
51
- | `ripplo compile [--check]` | Rebuild the lockfile (`--check` = exit non-zero if stale; for CI/hooks) |
52
- | `ripplo sync` | Push the compiled `.ripplo/` resources to the server (no run; useful for debugging sync state) |
53
- | `ripplo doctor` | Check lockfile freshness, auth, env |
54
- | `ripplo status` | Report unimplemented tests and preconditions |
55
- | `ripplo cover` | Audit coverage statements across the whole tree |
56
- | `ripplo scope <sub>` | Manage testing scope (`add`, `link`, `remove`, `status`) |
57
- | `ripplo flake-detect <id>` | Run a test N times in parallel to detect flakiness |
51
+ ```sh
52
+ npx ripplo watch
53
+ ```
58
54
 
59
- `init` flags: `--project <id> --env <path> --app-url <url> --engine-url <url>`. `--env` is **relative to `.ripplo/`** (e.g. `../.env.local` for a repo-root file, `../apps/server/.env` for a monorepo). `--engine-url` defaults to `<app-url>/ripplo`; override it when the adapter mounts at a different prefix or your backend runs on a different port than your frontend.
55
+ Leave it running alongside your dev server. It subscribes to run requests and drives Playwright against your local app.
60
56
 
61
- ## Project layout
57
+ In another, run tests:
62
58
 
63
- ```
64
- .ripplo/
65
- ├── index.ts # createRipplo({ preconditions, observers, tests })
66
- ├── project.json # projectId + envFile pointers
67
- ├── ripplo.lock # generated + committed; read by the Ripplo server on push
68
- ├── preconditions/index.ts # handles + `preconditions` registry
69
- ├── observers/index.ts # handles + `observers` registry
70
- └── tests/
71
- └── <test-id>.ts # one TestDefinition per file
59
+ ```sh
60
+ npx ripplo run # scope + dirty tests
61
+ npx ripplo run --all # everything
62
+ npx ripplo run my-test # by id
72
63
  ```
73
64
 
74
- Test definitions live in `.ripplo/`. **Implementations** (precondition setup/teardown, observer functions) live in your app server via `createEngine(ripplo, { preconditions, observers })`. Both halves are exhaustiveness-checked at compile time.
65
+ Commit `.ripplo/ripplo.lock`. The Ripplo server reads it on every push webhook; `ripplo compile --check` in a pre-commit hook keeps it fresh.
66
+
67
+ ## Worktrees
75
68
 
76
- See [`@ripplo/testing`](https://www.npmjs.com/package/@ripplo/testing) for the DSL reference and adapter wiring.
69
+ Ripplo is built for parallel feature work via `git worktree`. Each worktree gets its own dev session, scope, debug artifacts, and lockfile checkout — your auth token, projectId, and webhook secret are shared globally, so a fresh worktree needs no re-auth or re-init. Spin up as many as you want and run them concurrently.
77
70
 
78
- ## Lockfile
71
+ Two things to know: env files are usually gitignored, so copy your `.env.local` into the new worktree (or point `envFiles` in `.ripplo/project.json` at a shared file outside the tree), and pick a distinct dev-server port — update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match. `ripplo doctor` flags both.
79
72
 
80
- `ripplo compile` writes `.ripplo/ripplo.lock`. **Commit it.** The Ripplo server reads it on every GitHub push webhook; stale or missing returns 422.
73
+ ## Other commands
81
74
 
82
- In a pre-commit hook, run `ripplo compile --check` on staged `.ripplo/**/*.ts`.
75
+ `npx ripplo --help` lists everything. The ones you'll use beyond setup: `lint` (compile + typecheck), `doctor` (auth/env/lockfile health), `scope` (manage what the current session is testing), `flake-detect` (run a test in parallel N times).