@kurvball/rehearse 1.3.0 → 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.
package/README.md CHANGED
@@ -85,7 +85,8 @@ Rehearse runs on [Kurvball](https://www.kurvball.ca) from a scratch clone, with
85
85
 
86
86
  Rehearse 1.0 is built on [the decisions in its design](docs/plans/v1.md). [CHANGELOG.md](CHANGELOG.md) says what each version
87
87
  changed, and [RELEASING.md](RELEASING.md) how a change gets its changeset and how a release and a hotfix go. Each
88
- release is a tag and a [GitHub Release](https://github.com/kurvball/rehearse/releases) with the package's tarball.
88
+ release is a tag, a version on [npm](https://www.npmjs.com/package/@kurvball/rehearse) published with provenance, and a
89
+ [GitHub Release](https://github.com/kurvball/rehearse/releases) with the package's tarball.
89
90
 
90
91
  It runs on its own. Other tools read it only through its JSON commands, and [Ashlar](https://github.com/kurvball/ashlar), when present, lends it an import
91
92
  graph. Neither is required.
@@ -93,7 +94,7 @@ graph. Neither is required.
93
94
  ## Name
94
95
 
95
96
  The package is `@kurvball/rehearse`; its command is `rehearse`. The bare name `rehearse` is taken on npm and on PyPI by
96
- unrelated projects. It isn't on npm yet: each release is a tarball on its GitHub Release.
97
+ unrelated projects. Install it with `pnpm add -D @kurvball/rehearse`.
97
98
 
98
99
  ## Licence
99
100
 
@@ -6,7 +6,7 @@ import { stateDir } from '../services/index.js';
6
6
  const DAY = 24 * 60 * 60 * 1000;
7
7
  export const clean = {
8
8
  name: 'clean',
9
- summary: 'Removes base checkouts beyond the budget, and runs and comparisons older than a week. Keeps the cache.',
9
+ summary: "Removes base checkouts beyond the budget, and runs, comparisons and pieces' Vite caches older than a week. Keeps the cache.",
10
10
  usage: 'rehearse clean [--all] [--json]\n\n--all also removes every base checkout and the baseline cache.',
11
11
  spec: { valued: [], bare: ['all'] },
12
12
  async run(args, ctx) {
@@ -16,7 +16,7 @@ export const clean = {
16
16
  const removed = all
17
17
  ? evict({ ...m, budget: { ...m.budget, checkouts: 0 } }, repo)
18
18
  : evict(m, repo);
19
- for (const folder of ['runs', 'compare', ...(all ? ['cache'] : [])]) {
19
+ for (const folder of ['runs', 'compare', 'pieces', ...(all ? ['cache'] : [])]) {
20
20
  const dir = path.join(stateDir(m.dir), folder);
21
21
  if (!existsSync(dir))
22
22
  continue;
@@ -28,3 +28,4 @@ export declare function manifestOf(ctx: Context): Manifest;
28
28
  export declare function checkoutOf(m: Manifest, given: string | null, cwd: string): string;
29
29
  export declare function columns(rows: readonly (readonly [string, string])[], indent?: string): string;
30
30
  export declare function parallelOf(args: Args): number;
31
+ export declare function announceFromOf(args: Args): 'changesets' | null;
@@ -36,3 +36,11 @@ export function parallelOf(args) {
36
36
  throw usage(`--parallel takes a whole number, 1 or more, not “${given}”.`);
37
37
  return Number(given);
38
38
  }
39
+ export function announceFromOf(args) {
40
+ const given = one(args, 'announce-from');
41
+ if (given === null)
42
+ return null;
43
+ if (given !== 'changesets')
44
+ throw usage(`--announce-from takes changesets, not “${given}”.`);
45
+ return given;
46
+ }
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { checkoutOf, manifestOf, parallelOf, said } from './command.js';
2
+ import { announceFromOf, checkoutOf, manifestOf, parallelOf, said } from './command.js';
3
3
  import { many, one } from '../args.js';
4
4
  import { compare as compareSides } from '../compare/index.js';
5
5
  const VERDICT_WORDS = {
@@ -58,9 +58,9 @@ export function comparisonText(c) {
58
58
  export const compare = {
59
59
  name: 'compare',
60
60
  summary: 'Runs scenarios on the base and on the head, compares them, and sorts each into a verdict.',
61
- usage: "rehearse compare [<scenario>…] [--affected] [--base <ref|checkout>] [--head <ref|checkout>] [--announce <file>] [--said <scenario>]… [--world <name>] [--as <person>] [--real <stand-in>]… [--fresh] [--parallel <n>] [--json]\n\nThe base defaults to the manifest's base branch; the head to this checkout as it is now.\nScenario ids may be globs: 'apps/api/**'. It exits 0 when nothing fails on the head or changed without saying so.",
61
+ usage: "rehearse compare [<scenario>…] [--affected] [--base <ref|checkout>] [--head <ref|checkout>] [--announce <file>] [--announce-from changesets] [--said <scenario>]… [--world <name>] [--as <person>] [--real <stand-in>]… [--fresh] [--parallel <n>] [--json]\n\nThe base defaults to the manifest's base branch; the head to this checkout as it is now.\nScenario ids may be globs: 'apps/api/**'. It exits 0 when nothing fails on the head or changed without saying so.",
62
62
  spec: {
63
- valued: ['base', 'head', 'announce', 'said', 'world', 'as', 'real', 'parallel'],
63
+ valued: ['base', 'head', 'announce', 'announce-from', 'said', 'world', 'as', 'real', 'parallel'],
64
64
  bare: ['affected', 'fresh'],
65
65
  },
66
66
  async run(args, ctx) {
@@ -76,6 +76,7 @@ export const compare = {
76
76
  ids: args.positional,
77
77
  affected: args.flags.has('affected'),
78
78
  announce: announce ? path.resolve(ctx.cwd, announce) : null,
79
+ announceFrom: announceFromOf(args),
79
80
  said: many(args, 'said'),
80
81
  fresh: args.flags.has('fresh'),
81
82
  world: one(args, 'world'),
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { checkoutOf, manifestOf, said } from './command.js';
2
+ import { announceFromOf, checkoutOf, manifestOf, said } from './command.js';
3
3
  import { many, one } from '../args.js';
4
4
  import { errorText, usage } from '../errors.js';
5
5
  import { startStage } from '../stage/index.js';
@@ -15,8 +15,8 @@ export function portOf(given) {
15
15
  export const stage = {
16
16
  name: 'stage',
17
17
  summary: "Serves the stage: every scenario on one page, in Base, Head and Diff, with Works, Doesn't and a note.",
18
- usage: 'rehearse stage [--base <ref|checkout>] [--head <ref|checkout>] [--port <port>] [--announce <file>] [--said <scenario>]…\n\nIt runs until you stop it (Ctrl-C), and stops the services it brought up.\nCompare on the stage reads the announcement as rehearse compare does.',
19
- spec: { valued: ['base', 'head', 'port', 'announce', 'said'], bare: [] },
18
+ usage: 'rehearse stage [--base <ref|checkout>] [--head <ref|checkout>] [--port <port>] [--announce <file>] [--announce-from changesets] [--said <scenario>]…\n\nIt runs until you stop it (Ctrl-C), and stops the services it brought up.\nCompare on the stage reads the announcement as rehearse compare does.',
19
+ spec: { valued: ['base', 'head', 'port', 'announce', 'announce-from', 'said'], bare: [] },
20
20
  async run(args, ctx) {
21
21
  const m = manifestOf(ctx);
22
22
  const { port, anyPort } = portOf(one(args, 'port'));
@@ -30,6 +30,7 @@ export const stage = {
30
30
  port,
31
31
  anyPort,
32
32
  announce: announce ? path.resolve(ctx.cwd, announce) : null,
33
+ announceFrom: announceFromOf(args),
33
34
  said: many(args, 'said'),
34
35
  progress: ctx.progress,
35
36
  });
@@ -1,6 +1,7 @@
1
1
  export interface Announced {
2
2
  scenario: string;
3
3
  why: string;
4
+ from?: string;
4
5
  }
5
6
  export declare function readAnnouncement(file: string): Announced[];
6
7
  export declare function announcementFor(id: string, announced: readonly Announced[]): Announced | null;
@@ -0,0 +1,8 @@
1
+ import type { Announced } from './announce.ts';
2
+ export interface ChangesetAnnounced extends Announced {
3
+ file: string;
4
+ line: number;
5
+ }
6
+ export declare function addedChangesets(base: string, head: string): string[];
7
+ export declare function announcedIn(text: string, file: string): ChangesetAnnounced[];
8
+ export declare function announcedByChangesets(base: string, head: string): ChangesetAnnounced[];
@@ -0,0 +1,91 @@
1
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { RehearseError } from '../errors.js';
4
+ const CHANGESETS = '.changeset';
5
+ const NOT_A_CHANGESET = new Set(['README.md']);
6
+ const FENCE = /^(`{3,}|~{3,})\s*([^\s`~]*)/;
7
+ const TARGET = /^([a-z][a-z0-9-]*):\s*(.*)$/;
8
+ const OWN_WHY = /^(.*?)\s+—(?:\s+(.*))?$/;
9
+ function changesetsIn(checkout) {
10
+ const folder = path.join(checkout, CHANGESETS);
11
+ if (!existsSync(folder))
12
+ return new Set();
13
+ return new Set(readdirSync(folder).filter((name) => name.endsWith('.md') && !NOT_A_CHANGESET.has(name)));
14
+ }
15
+ export function addedChangesets(base, head) {
16
+ const onBase = changesetsIn(base);
17
+ return [...changesetsIn(head)]
18
+ .filter((name) => !onBase.has(name))
19
+ .sort()
20
+ .map((name) => `${CHANGESETS}/${name}`);
21
+ }
22
+ function bodyStart(lines) {
23
+ if (lines[0]?.trim() !== '---')
24
+ return 0;
25
+ const end = lines.findIndex((line, i) => i > 0 && line.trim() === '---');
26
+ return end === -1 ? lines.length : end + 1;
27
+ }
28
+ function closes(line, fence) {
29
+ return line.startsWith(fence) && new RegExp(`^\\${fence[0]}+$`).test(line);
30
+ }
31
+ function proseAndBlocks(lines, from) {
32
+ const prose = [];
33
+ const blocks = [];
34
+ let open = null;
35
+ for (let i = from; i < lines.length; i += 1) {
36
+ const text = lines[i].trim();
37
+ if (open) {
38
+ if (closes(text, open.fence))
39
+ open = null;
40
+ else
41
+ open.block.lines.push({ text, line: i + 1 });
42
+ continue;
43
+ }
44
+ const fence = FENCE.exec(text);
45
+ if (fence) {
46
+ open = { fence: fence[1], block: { announce: fence[2] === 'announce', lines: [] } };
47
+ blocks.push(open.block);
48
+ continue;
49
+ }
50
+ prose.push(text);
51
+ }
52
+ return { prose, blocks };
53
+ }
54
+ function summaryOf(prose) {
55
+ const first = prose.findIndex((line) => line !== '');
56
+ if (first === -1)
57
+ return '';
58
+ const end = prose.findIndex((line, i) => i > first && line === '');
59
+ return prose
60
+ .slice(first, end === -1 ? undefined : end)
61
+ .join(' ')
62
+ .trim();
63
+ }
64
+ export function announcedIn(text, file) {
65
+ const lines = text.split(/\r?\n/);
66
+ const { prose, blocks } = proseAndBlocks(lines, bodyStart(lines));
67
+ const summary = summaryOf(prose);
68
+ const refuse = (line, says) => new RehearseError('announce', `${file}:${line}: ${says}`, { file, line });
69
+ const announced = [];
70
+ for (const { text: entry, line } of blocks.filter((b) => b.announce).flatMap((b) => b.lines)) {
71
+ if (entry === '' || entry.startsWith('#'))
72
+ continue;
73
+ const target = TARGET.exec(entry);
74
+ if (!target)
75
+ throw refuse(line, `Rehearse can't read “${entry}”: write each line as <tool>: <target>, such as rehearse: <scenario>.`);
76
+ if (target[1] !== 'rehearse')
77
+ continue;
78
+ const own = OWN_WHY.exec(target[2]);
79
+ const scenario = (own ? own[1] : target[2]).trim();
80
+ const why = own?.[2]?.trim() || summary;
81
+ if (!scenario)
82
+ throw refuse(line, 'The line names no scenario after rehearse:.');
83
+ if (!why)
84
+ throw refuse(line, `The line announces ${scenario} with no why: give the changeset a summary, or end the line with — and why.`);
85
+ announced.push({ scenario, why, file, line });
86
+ }
87
+ return announced;
88
+ }
89
+ export function announcedByChangesets(base, head) {
90
+ return addedChangesets(base, head).flatMap((file) => announcedIn(readFileSync(path.join(head, file), 'utf8'), file));
91
+ }
@@ -13,6 +13,7 @@ export interface CompareOptions {
13
13
  ids: string[];
14
14
  affected: boolean;
15
15
  announce: string | null;
16
+ announceFrom?: 'changesets' | null;
16
17
  said: string[];
17
18
  fresh: boolean;
18
19
  world: string | null;
@@ -3,12 +3,13 @@ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { affected } from '../affected/index.js';
5
5
  import { RehearseError, errorText } from '../errors.js';
6
- import { checkoutFor, infoOf, commitOf, gitOr } from '../git/index.js';
6
+ import { checkoutFor, infoOf, commitOf, gitOr, topOf } from '../git/index.js';
7
7
  import { runnerOf } from '../kinds/index.js';
8
8
  import { cached, cacheKeyOf, groupsOf, keep, runSideSharing, slotsFor, } from '../run/index.js';
9
9
  import { readScenarios, refOf, globToRegExp, } from '../scenarios/index.js';
10
10
  import { runningServices, stateDir } from '../services/index.js';
11
11
  import { announcementFor, readAnnouncement } from './announce.js';
12
+ import { announcedByChangesets } from './changesets.js';
12
13
  import { nonZeroCounts, noCounts, rulesOf } from './setaside.js';
13
14
  import { lineOf, verdictOf } from './verdict.js';
14
15
  const emptyCounts = () => ({
@@ -118,9 +119,15 @@ export async function compare(m, o) {
118
119
  ? path.join(stateDir(m.dir), 'announce.yaml')
119
120
  : null);
120
121
  if (announceFile)
121
- announced.push(...readAnnouncement(path.resolve(o.repo, announceFile)));
122
+ announced.push(...readAnnouncement(path.resolve(o.repo, announceFile)).map((a) => ({ ...a, from: announceFile })));
123
+ if (o.announceFrom === 'changesets')
124
+ announced.push(...announcedByChangesets(topOf(base.path) ?? base.path, topOf(head.path) ?? head.path).map((a) => ({
125
+ scenario: a.scenario,
126
+ why: a.why,
127
+ from: a.file,
128
+ })));
122
129
  for (const id of o.said)
123
- announced.push({ scenario: id, why: 'Said on the command line.' });
130
+ announced.push({ scenario: id, why: 'Said on the command line.', from: '--said' });
124
131
  const headRead = await readScenarios(m, head.path);
125
132
  const baseRead = await readScenarios(m, base.path);
126
133
  let headScenarios = select(headRead.scenarios, o.ids);
@@ -285,7 +292,7 @@ export async function compare(m, o) {
285
292
  if (mayBeATypo)
286
293
  out.refused.push({
287
294
  side: 'head',
288
- file: announceFile ?? '--said',
295
+ file: a.from ?? '--said',
289
296
  says: `The announcement names ${a.scenario}, which matches no scenario compared.`,
290
297
  });
291
298
  if (named.length > 0 && named.every((c) => !c.changed))
@@ -1,4 +1,5 @@
1
1
  export { readAnnouncement } from './announce.ts';
2
+ export { addedChangesets, announcedByChangesets, announcedIn, type ChangesetAnnounced, } from './changesets.ts';
2
3
  export { changedFiles, compare, type CompareOptions, type Compared, type Comparison } from './compare.ts';
3
4
  export { clip, jsonDifferences, lineHunks, textDifferences, type Difference } from './diff.ts';
4
5
  export { noCounts, noRules, setAsideJson, setAsideText, type Counts as AsideCounts, type Rules, } from './setaside.ts';
@@ -1,4 +1,5 @@
1
1
  export { readAnnouncement } from './announce.js';
2
+ export { addedChangesets, announcedByChangesets, announcedIn, } from './changesets.js';
2
3
  export { changedFiles, compare } from './compare.js';
3
4
  export { clip, jsonDifferences, lineHunks, textDifferences } from './diff.js';
4
5
  export { noCounts, noRules, setAsideJson, setAsideText, } from './setaside.js';
@@ -7,7 +7,7 @@ import { fill, loadManifest } from '../manifest/index.js';
7
7
  import { scrub, scrubDeep, signIn } from '../people/index.js';
8
8
  import { startPieceServer } from '../kinds/index.js';
9
9
  import { applyWorld, baseVars } from '../run/index.js';
10
- import { runningServices, bringDown, bringUp, freePort } from '../services/index.js';
10
+ import { runningServices, bringDown, bringUp, freePort, stateDir } from '../services/index.js';
11
11
  import { act, calm, contextFor, errorsOf, failed, FIXED_TIME, launch, signInBySteps, signInOf, } from './browser.js';
12
12
  import { driveArgv, parseDrive } from './grammar.js';
13
13
  import { forgetDriving, writeDriving } from './state.js';
@@ -45,6 +45,7 @@ async function open() {
45
45
  throw new Error(`There is no piece ${values.piece} in ${checkout}.`);
46
46
  pieces = await startPieceServer({
47
47
  dir: spec.packageDir,
48
+ state: stateDir(m.dir),
48
49
  preview: m.scenarios.pieces.preview ?? null,
49
50
  styles: m.scenarios.pieces.styles ?? null,
50
51
  config: m.scenarios.pieces.config ?? null,
@@ -10,7 +10,7 @@ import { readScenarios, registerReader } from '../../scenarios/index.js';
10
10
  import { validate } from '../../schema.js';
11
11
  import { broken, registerRunner } from '../kind.js';
12
12
  import { startPieceServer } from '../piece/server.js';
13
- import { restart, restartable } from '../../services/index.js';
13
+ import { restart, restartable, stateDir } from '../../services/index.js';
14
14
  import { applyWorld } from '../../worlds/index.js';
15
15
  import { defaultExportOf, LiteralError } from './literal.js';
16
16
  const refuse = (says, line) => {
@@ -355,6 +355,7 @@ registerRunner({
355
355
  try {
356
356
  server = await startPieceServer({
357
357
  dir: pspec.packageDir,
358
+ state: stateDir(ctx.manifest.dir),
358
359
  config: ctx.manifest.scenarios.pieces.config ?? null,
359
360
  styles: ctx.manifest.scenarios.pieces.styles ?? null,
360
361
  preview: ctx.manifest.scenarios.pieces.preview ?? null,
@@ -5,7 +5,7 @@ export interface Found {
5
5
  }
6
6
  export declare const CONFIG_CONVENTIONS: readonly string[];
7
7
  export declare const STYLES_CONVENTIONS: readonly string[];
8
- export declare const cacheDirOf: (dir: string, under?: string) => string;
8
+ export declare const cacheDirOf: (dir: string, state: string) => string;
9
9
  export declare const SKIPPED_FOLDERS: ReadonlySet<string>;
10
10
  export declare function findConfig(dir: string, given?: string | null): Found | null;
11
11
  export declare function findStyles(dir: string, given?: string | null): Found | null;
@@ -1,12 +1,11 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
3
- import { tmpdir } from 'node:os';
4
3
  import path from 'node:path';
5
4
  import { PIECE_FILE } from './csf.js';
6
5
  const EXTENSIONS = ['ts', 'mts', 'js', 'mjs', 'cts', 'cjs'];
7
6
  export const CONFIG_CONVENTIONS = ['vite', 'vitest'].flatMap((name) => EXTENSIONS.map((ext) => `${name}.config.${ext}`));
8
7
  export const STYLES_CONVENTIONS = ['src/styles.css', 'src/index.css'];
9
- export const cacheDirOf = (dir, under = tmpdir()) => path.join(under, 'rehearse-pieces', createHash('sha256').update(path.resolve(dir)).digest('hex').slice(0, 16));
8
+ export const cacheDirOf = (dir, state) => path.join(state, 'pieces', createHash('sha256').update(path.resolve(dir)).digest('hex').slice(0, 16));
10
9
  export const SKIPPED_FOLDERS = new Set(['node_modules', 'dist', 'out']);
11
10
  const isFile = (file) => {
12
11
  try {
@@ -7,6 +7,7 @@ import { calm, contextFor, errorsOf, FIXED_TIME, launch } from '../../drive/inde
7
7
  import { errorText } from '../../errors.js';
8
8
  import { hashOf } from '../../manifest/index.js';
9
9
  import { registerReader, toPosix } from '../../scenarios/index.js';
10
+ import { stateDir } from '../../services/index.js';
10
11
  import { broken, registerRunner } from '../kind.js';
11
12
  import { ROOT_ID, THREW } from './canvas.js';
12
13
  import { metaTitle, propertyString, statementAt, storyExportsOf, storyNameFromExport, titleFromPath, toId, } from './csf.js';
@@ -177,6 +178,7 @@ export async function runPieces(scenarios, ctx, browser) {
177
178
  try {
178
179
  server = await startPieceServer({
179
180
  dir,
181
+ state: stateDir(m.dir),
180
182
  config: settings.config ?? null,
181
183
  styles: settings.styles ?? null,
182
184
  preview: settings.preview ?? null,
@@ -3,6 +3,7 @@ export declare const HOST = "127.0.0.1";
3
3
  export declare const resolvable: (dir: string, request: string) => boolean;
4
4
  export interface PieceServerOptions {
5
5
  dir: string;
6
+ state: string;
6
7
  config?: string | null;
7
8
  styles?: string | null;
8
9
  preview?: string | null;
@@ -164,7 +164,7 @@ export async function startPieceServer(o) {
164
164
  const inline = {
165
165
  configFile: config?.file ?? false,
166
166
  root: dir,
167
- cacheDir: cacheDirOf(dir),
167
+ cacheDir: cacheDirOf(dir, o.state),
168
168
  base: '/',
169
169
  mode: 'development',
170
170
  clearScreen: false,
@@ -12,6 +12,7 @@ export interface StageScope {
12
12
  head: string | null;
13
13
  base: string | null;
14
14
  announce: string | null;
15
+ announceFrom: 'changesets' | null;
15
16
  said: readonly string[];
16
17
  progress: (line: string) => void;
17
18
  };
package/dist/stage/api.js CHANGED
@@ -156,6 +156,7 @@ export function apiOf(s) {
156
156
  ids: [id],
157
157
  affected: false,
158
158
  announce: s.asked.announce,
159
+ announceFrom: s.asked.announceFrom,
159
160
  said: [...s.asked.said],
160
161
  fresh: false,
161
162
  world,
@@ -14,6 +14,7 @@ export interface StageOptions {
14
14
  port: number;
15
15
  anyPort?: boolean;
16
16
  announce?: string | null;
17
+ announceFrom?: 'changesets' | null;
17
18
  said?: readonly string[];
18
19
  progress: (line: string) => void;
19
20
  }
@@ -78,7 +78,7 @@ export async function startStage(o) {
78
78
  const api = {
79
79
  ...apiOf({
80
80
  m,
81
- asked: { ...o, announce: o.announce ?? null, said: o.said ?? [] },
81
+ asked: { ...o, announce: o.announce ?? null, announceFrom: o.announceFrom ?? null, said: o.said ?? [] },
82
82
  head,
83
83
  baseRef,
84
84
  checkoutOf,
@@ -156,6 +156,7 @@ export async function startStage(o) {
156
156
  if (!server) {
157
157
  server = await startPieceServer({
158
158
  dir: spec.packageDir,
159
+ state: stateDir(m.dir),
159
160
  config: m.scenarios.pieces.config ?? null,
160
161
  styles: m.scenarios.pieces.styles ?? null,
161
162
  preview: m.scenarios.pieces.preview ?? null,
package/llms.txt CHANGED
@@ -10,9 +10,9 @@
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
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>] [--said <id>]… [--world] [--as] [--real] [--fresh] [--parallel <n>] --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. --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.
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] [--announce <file>] [--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).
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.3.0",
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": {
@@ -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