@kurvball/rehearse 1.2.1 → 1.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 (46) hide show
  1. package/README.md +9 -3
  2. package/dist/commands/clean.js +2 -2
  3. package/dist/commands/command.d.ts +3 -1
  4. package/dist/commands/command.js +18 -1
  5. package/dist/commands/compare.js +9 -3
  6. package/dist/commands/run.js +5 -3
  7. package/dist/commands/stage.js +9 -4
  8. package/dist/compare/announce.d.ts +1 -0
  9. package/dist/compare/changesets.d.ts +8 -0
  10. package/dist/compare/changesets.js +91 -0
  11. package/dist/compare/compare.d.ts +2 -0
  12. package/dist/compare/compare.js +44 -12
  13. package/dist/compare/index.d.ts +2 -0
  14. package/dist/compare/index.js +2 -0
  15. package/dist/drive/daemon.js +2 -1
  16. package/dist/git/checkout.js +8 -2
  17. package/dist/git/seed.d.ts +3 -0
  18. package/dist/git/seed.js +115 -0
  19. package/dist/kinds/flow/kind.js +27 -15
  20. package/dist/kinds/index.d.ts +1 -1
  21. package/dist/kinds/kind.d.ts +6 -0
  22. package/dist/kinds/piece/conventions.d.ts +1 -1
  23. package/dist/kinds/piece/conventions.js +1 -2
  24. package/dist/kinds/piece/kind.js +2 -0
  25. package/dist/kinds/piece/server.d.ts +1 -0
  26. package/dist/kinds/piece/server.js +1 -1
  27. package/dist/manifest/load.js +1 -0
  28. package/dist/manifest/types.d.ts +2 -0
  29. package/dist/run/index.d.ts +2 -1
  30. package/dist/run/index.js +2 -1
  31. package/dist/run/parallel.d.ts +28 -0
  32. package/dist/run/parallel.js +140 -0
  33. package/dist/run/session.d.ts +3 -0
  34. package/dist/run/session.js +312 -171
  35. package/dist/services/index.d.ts +1 -1
  36. package/dist/services/index.js +1 -1
  37. package/dist/services/service.d.ts +2 -1
  38. package/dist/services/service.js +41 -12
  39. package/dist/stage/api.d.ts +3 -0
  40. package/dist/stage/api.js +3 -2
  41. package/dist/stage/server.d.ts +3 -0
  42. package/dist/stage/server.js +5 -1
  43. package/llms.txt +3 -3
  44. package/package.json +1 -1
  45. package/schema/v1/manifest.schema.json +4 -0
  46. package/skill/rehearse/SKILL.md +4 -0
@@ -1,6 +1,7 @@
1
1
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { createServer } from 'node:http';
3
3
  import path from 'node:path';
4
+ import { readAnnouncement } from '../compare/index.js';
4
5
  import { RehearseError, errorText } from '../errors.js';
5
6
  import { checkoutFor } from '../git/index.js';
6
7
  import { parseHurl, Refusal, sendFile, startPieceServer, } from '../kinds/index.js';
@@ -62,6 +63,8 @@ export async function startStage(o) {
62
63
  const other = await runningStage(m);
63
64
  if (other && other.pid !== process.pid)
64
65
  throw new RehearseError('stage', `A stage already runs for this repository at ${other.url} (pid ${other.pid}). Open it, or stop it with kill ${other.pid}.`);
66
+ if (o.announce)
67
+ readAnnouncement(o.announce);
65
68
  const head = o.head
66
69
  ? await checkoutFor(m, o.repo, o.head, o.progress, [], o.cwd)
67
70
  : { path: o.repo, ref: null };
@@ -75,7 +78,7 @@ export async function startStage(o) {
75
78
  const api = {
76
79
  ...apiOf({
77
80
  m,
78
- asked: o,
81
+ asked: { ...o, announce: o.announce ?? null, announceFrom: o.announceFrom ?? null, said: o.said ?? [] },
79
82
  head,
80
83
  baseRef,
81
84
  checkoutOf,
@@ -153,6 +156,7 @@ export async function startStage(o) {
153
156
  if (!server) {
154
157
  server = await startPieceServer({
155
158
  dir: spec.packageDir,
159
+ state: stateDir(m.dir),
156
160
  config: m.scenarios.pieces.config ?? null,
157
161
  styles: m.scenarios.pieces.styles ?? null,
158
162
  preview: m.scenarios.pieces.preview ?? null,
package/llms.txt CHANGED
@@ -9,10 +9,10 @@
9
9
  - `rehearse services | people | worlds [--json]`: what can come up; who you can sign in as (people: the sign-in shape {name: {token, …}}, everyone described in about; tokens only with --json); the named starting states.
10
10
  - `rehearse list [--affected <file>… | --since <ref>] [--json]`: the scenarios, or those a change reaches, each with reachedBy (schema list).
11
11
  - `rehearse up [<service>…] [--world] [--real <stand-in>]` and `rehearse down [--all]`: services left running with a world built on them (schema up).
12
- - `rehearse run <scenario> [--on <checkout|ref>] [--world] [--as <person>] [--real <stand-in>] [--keep] --json`: one observation (schema observation).
13
- - `rehearse compare [<id or glob>…] [--affected] [--base <ref|./folder>] [--head <ref|./folder>] [--announce <file>] [--said <id>]… [--world] [--as] [--real] [--fresh] --json`: a verdict per scenario (schema comparison). Exit 0 when both sides came up and nothing fails on the head or changed without saying so.
12
+ - `rehearse run <scenario> [--on <checkout|ref>] [--world] [--as <person>] [--real <stand-in>] [--keep] [--parallel <n>] --json`: one observation (schema observation).
13
+ - `rehearse compare [<id or glob>…] [--affected] [--base <ref|./folder>] [--head <ref|./folder>] [--announce <file>] [--announce-from changesets] [--said <id>]… [--world] [--as] [--real] [--fresh] [--parallel <n>] --json`: a verdict per scenario (schema comparison). --announce-from changesets also reads the `announce` blocks of the changesets the change adds. Exit 0 when both sides came up and nothing fails on the head or changed without saying so. --parallel runs groups that share no service at once, and the base beside the head when budget.services allows two; the result is the same as one at a time.
14
14
  - `rehearse drive start [--service <name> | --piece <id>] [--world] [--as <person>] [--scheme light|dark]` (or DRIVE_SCHEME), then `rehearse drive click --name <name> [--role <role>] | fill --name <name> --with <text> | type <text> | key <key> | snapshot [--name <name> [--role <role>]] | screenshot <file.png> | stop`, each with --json: the drive result shape {ok, command, ms, file, tree} plus v and driver (schema drive). Exit 0 done, 1 failed, 2 usage.
15
- - `rehearse stage [--base] [--head] [--port]`: the stage on 127.0.0.1 (default port 4400): every scenario in Base, Head and Diff, with Works, Doesn't and a note (kept in .rehearse/tries.jsonl, schema try).
15
+ - `rehearse stage [--base] [--head] [--port] [--announce <file>] [--announce-from changesets] [--said <id>]…`: the stage on 127.0.0.1 (default port 4400): every scenario in Base, Head and Diff, with Works, Doesn't and a note (kept in .rehearse/tries.jsonl, schema try).
16
16
  - `rehearse open <scenario> [--json]`: the stage's address for a scenario (schema open), starting the stage if none runs.
17
17
  - `rehearse clean [--all]`: removes old base checkouts, runs and comparisons (schema clean).
18
18
  - `rehearse validate <schema> [file]`: checks a JSON or YAML file, or stdin, against a v1 schema (schema validate).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurvball/rehearse",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Rehearse a change before it ships: bring the product up, sign in as named people, start from named worlds, and compare any scenario on the base and on the head.",
5
5
  "homepage": "https://rehearse.kurvball.ca/",
6
6
  "repository": {
@@ -20,6 +20,10 @@
20
20
  "description": "Run once in a fresh checkout of a base commit, before anything else: installing dependencies, building.",
21
21
  "$ref": "#/$defs/command"
22
22
  },
23
+ "seed": {
24
+ "description": "Whether a new base checkout starts from the node_modules of the newest one prepared with the same lockfile, before prepare runs. Default true. Turn it off when an install script generates code from your source and prepare doesn't run it again.",
25
+ "type": "boolean"
26
+ },
23
27
  "overlay": {
24
28
  "description": "Files copied into each checkout after prepare, for a manifest kept outside the product. In a repository that adopts Rehearse, commit them instead.",
25
29
  "type": "array",
@@ -120,6 +120,10 @@ changes:
120
120
 
121
121
  Editing a scenario's own definition also counts as saying so. Announce only what you changed on purpose.
122
122
 
123
+ In a repository with changesets (`.changeset/`), announce in the changeset you add instead: below its summary, an
124
+ `announce` block with one `rehearse: <id or glob>` per line, then `rehearse compare --announce-from changesets --json`.
125
+ The summary is each line's why, unless the line ends with ` — <why>`. Leave other tools' lines (`cast:` …) as they are.
126
+
123
127
  ## 6. Drive the product step by step
124
128
 
125
129
  ```bash