@kurvball/rehearse 1.14.0 → 1.15.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/dist/commands/announce.js +2 -2
- package/dist/commands/clean.js +6 -3
- package/dist/commands/compare.js +6 -1
- package/dist/commands/drive.js +8 -2
- package/dist/commands/init.js +1 -1
- package/dist/commands/run.js +8 -4
- package/dist/commands/services.d.ts +2 -0
- package/dist/commands/services.js +9 -1
- package/dist/commands/stage.js +18 -2
- package/dist/commands/up.js +11 -3
- package/dist/compare/compare.d.ts +2 -0
- package/dist/compare/compare.js +19 -10
- package/dist/detect/detect.js +4 -0
- package/dist/detect/index.d.ts +1 -0
- package/dist/detect/index.js +1 -0
- package/dist/detect/keys.d.ts +16 -0
- package/dist/detect/keys.js +141 -0
- package/dist/detect/write.d.ts +2 -0
- package/dist/detect/write.js +20 -1
- package/dist/drive/open.js +2 -0
- package/dist/git/checkout.d.ts +6 -0
- package/dist/git/checkout.js +28 -19
- package/dist/git/index.d.ts +3 -2
- package/dist/git/index.js +3 -2
- package/dist/kinds/flow/kind.js +2 -2
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/load.js +12 -0
- package/dist/manifest/types.d.ts +15 -0
- package/dist/repositories/copies.d.ts +16 -0
- package/dist/repositories/copies.js +132 -0
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +1 -0
- package/dist/run/cache.d.ts +2 -1
- package/dist/run/cache.js +3 -1
- package/dist/run/index.d.ts +1 -1
- package/dist/run/index.js +1 -0
- package/dist/run/observation.d.ts +4 -0
- package/dist/run/observation.js +5 -1
- package/dist/run/session.d.ts +3 -1
- package/dist/run/session.js +22 -12
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/services/registry.d.ts +1 -0
- package/dist/services/service.d.ts +4 -0
- package/dist/services/service.js +24 -8
- package/dist/stage/api.d.ts +2 -0
- package/dist/stage/api.js +4 -0
- package/dist/stage/sending.d.ts +2 -1
- package/dist/stage/sending.js +8 -2
- package/dist/stage/server.d.ts +2 -0
- package/dist/stage/server.js +14 -1
- package/llms.txt +5 -5
- package/package.json +2 -2
- package/schema/v1/common.schema.json +22 -0
- package/schema/v1/init.schema.json +2 -1
- package/schema/v1/manifest.schema.json +30 -0
- package/schema/v1/samples/manifest.yaml +8 -0
- package/schema/v1/services.schema.json +8 -0
- package/skill/rehearse/SKILL.md +4 -0
|
@@ -10,8 +10,12 @@ export interface UpOptions {
|
|
|
10
10
|
world: string | null;
|
|
11
11
|
real: ReadonlySet<string>;
|
|
12
12
|
vars: Record<string, string>;
|
|
13
|
+
roots?: Readonly<Record<string, string>>;
|
|
13
14
|
progress?: (line: string) => void;
|
|
14
15
|
}
|
|
16
|
+
export declare const rootOf: (r: Running) => string;
|
|
17
|
+
export declare const cwdOf: (s: Service | undefined, r: Running) => string;
|
|
18
|
+
export declare function upFromAnotherCopy(m: Manifest, r: Running, roots: Readonly<Record<string, string>>): string | null;
|
|
15
19
|
export declare const logOf: (m: Manifest, name: string, checkout: string) => string;
|
|
16
20
|
export declare function liveServices(m: Manifest, checkout?: string | null): Promise<Running[]>;
|
|
17
21
|
export declare const restartable: (r: Running) => boolean;
|
package/dist/services/service.js
CHANGED
|
@@ -72,6 +72,15 @@ export function standinsFor(m, service, real) {
|
|
|
72
72
|
return { standin, real: isReal };
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
export const rootOf = (r) => r.root ?? r.checkout;
|
|
76
|
+
export const cwdOf = (s, r) => s?.cwd ? path.resolve(rootOf(r), s.cwd) : rootOf(r);
|
|
77
|
+
export function upFromAnotherCopy(m, r, roots) {
|
|
78
|
+
const repository = m.services[r.name]?.repository;
|
|
79
|
+
const wanted = repository ? roots[repository] : undefined;
|
|
80
|
+
if (!wanted || path.resolve(rootOf(r)) === path.resolve(wanted))
|
|
81
|
+
return null;
|
|
82
|
+
return `${r.name} is already up from ${rootOf(r)}, and this needs it from ${wanted}: stop it with \`rehearse down ${r.name}\`.`;
|
|
83
|
+
}
|
|
75
84
|
const logDir = (m) => path.join(stateDir(m.dir), 'logs');
|
|
76
85
|
export const logOf = (m, name, checkout) => path.join(logDir(m), `${name}@${checkoutKey(checkout)}.log`);
|
|
77
86
|
function signalledIfStillThere(pid, signal) {
|
|
@@ -123,7 +132,7 @@ export async function liveServices(m, checkout = null) {
|
|
|
123
132
|
}
|
|
124
133
|
const s = m.services[r.name];
|
|
125
134
|
const answers = s?.ready
|
|
126
|
-
? await readyNow(s.ready, varsOf(m, r), envOf(m, r), s
|
|
135
|
+
? await readyNow(s.ready, varsOf(m, r), envOf(m, r), cwdOf(s, r), '', r.port)
|
|
127
136
|
: r.port !== null
|
|
128
137
|
? await portTaken(r.port)
|
|
129
138
|
: false;
|
|
@@ -151,7 +160,7 @@ export async function handoverSettled(r) {
|
|
|
151
160
|
}
|
|
152
161
|
function varsOf(m, r) {
|
|
153
162
|
return (r.vars ?? {
|
|
154
|
-
checkout: r
|
|
163
|
+
checkout: rootOf(r),
|
|
155
164
|
manifest: m.dir,
|
|
156
165
|
...(r.scratch && { scratch: r.scratch }),
|
|
157
166
|
...(r.world && { world: r.world }),
|
|
@@ -189,7 +198,7 @@ export async function restart(m, r, whileDown = async () => undefined) {
|
|
|
189
198
|
const s = m.services[r.name];
|
|
190
199
|
if (!s || !restartable(r))
|
|
191
200
|
return null;
|
|
192
|
-
const cwd = s
|
|
201
|
+
const cwd = cwdOf(s, r);
|
|
193
202
|
const env = envOf(m, r);
|
|
194
203
|
let keys;
|
|
195
204
|
try {
|
|
@@ -227,16 +236,22 @@ export async function downStartedHere() {
|
|
|
227
236
|
}
|
|
228
237
|
}
|
|
229
238
|
export async function bringUp(m, s, checkout, options) {
|
|
239
|
+
const root = s.repository === null ? checkout : options.roots?.[s.repository];
|
|
240
|
+
if (root === undefined)
|
|
241
|
+
throw new RehearseError('service', `${s.name} runs in the repository ${s.repository}, and Rehearse has no copy of it for ${checkout}.`);
|
|
230
242
|
const upThere = () => runningServices(m.dir).find((r) => r.name === s.name && path.resolve(r.checkout) === path.resolve(checkout));
|
|
231
243
|
const already = upThere();
|
|
232
244
|
if (already) {
|
|
245
|
+
const another = upFromAnotherCopy(m, already, options.roots ?? {});
|
|
246
|
+
if (another)
|
|
247
|
+
throw new RehearseError('service', another);
|
|
233
248
|
await knowKeys(m, s);
|
|
234
249
|
if (alive(already.pid) || !s.ready)
|
|
235
250
|
return already;
|
|
236
251
|
if (await readyNow(s.ready, {
|
|
237
252
|
...(already.url && { url: already.url }),
|
|
238
253
|
...(already.port !== null && { port: String(already.port) }),
|
|
239
|
-
}, envOf(m, already), s
|
|
254
|
+
}, envOf(m, already), cwdOf(s, already), '', already.port))
|
|
240
255
|
return already;
|
|
241
256
|
forget(m.dir, already.name, already.checkout);
|
|
242
257
|
}
|
|
@@ -253,14 +268,14 @@ export async function bringUp(m, s, checkout, options) {
|
|
|
253
268
|
throw new RehearseError('service', `${s.name} listens on port ${port}, and something already answers there. Stop it, or give the service port: auto.`);
|
|
254
269
|
}
|
|
255
270
|
const standins = standinsFor(m, s.name, options.real);
|
|
256
|
-
const cwd = s.cwd ? path.resolve(
|
|
271
|
+
const cwd = s.cwd ? path.resolve(root, s.cwd) : root;
|
|
257
272
|
if (!existsSync(cwd))
|
|
258
273
|
throw new RehearseError('service', `${s.name} runs in ${cwd}, which isn't there.`);
|
|
259
274
|
mkdirSync(path.join(stateDir(m.dir), 'scratch'), { recursive: true });
|
|
260
275
|
const scratch = mkdtempSync(path.join(stateDir(m.dir), 'scratch', `${s.name}-${checkoutKey(checkout)}-`));
|
|
261
276
|
const vars = {
|
|
262
277
|
...options.vars,
|
|
263
|
-
checkout,
|
|
278
|
+
checkout: root,
|
|
264
279
|
manifest: m.dir,
|
|
265
280
|
scratch,
|
|
266
281
|
...(options.world !== null && { world: options.world }),
|
|
@@ -278,7 +293,7 @@ export async function bringUp(m, s, checkout, options) {
|
|
|
278
293
|
const log = logOf(m, s.name, checkout);
|
|
279
294
|
const out = openSync(log, 'w');
|
|
280
295
|
const command = fill(s.up, vars);
|
|
281
|
-
options.progress?.(`Bringing ${s.name} up in ${
|
|
296
|
+
options.progress?.(`Bringing ${s.name} up in ${root}: ${command}`);
|
|
282
297
|
const child = spawn('/bin/sh', ['-c', command], {
|
|
283
298
|
cwd,
|
|
284
299
|
env: { ...process.env, ...env, ...keys },
|
|
@@ -300,6 +315,7 @@ export async function bringUp(m, s, checkout, options) {
|
|
|
300
315
|
const running = {
|
|
301
316
|
name: s.name,
|
|
302
317
|
checkout,
|
|
318
|
+
...(s.repository !== null && { root }),
|
|
303
319
|
pid,
|
|
304
320
|
port,
|
|
305
321
|
url,
|
|
@@ -352,7 +368,7 @@ export async function bringUp(m, s, checkout, options) {
|
|
|
352
368
|
export async function bringDown(m, r, progress) {
|
|
353
369
|
if (r.down) {
|
|
354
370
|
const s = m.services[r.name];
|
|
355
|
-
const cwd = s
|
|
371
|
+
const cwd = cwdOf(s, r);
|
|
356
372
|
await sh(r.down, {
|
|
357
373
|
cwd,
|
|
358
374
|
timeoutMs: 30_000,
|
package/dist/stage/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Manifest } from '../manifest/index.ts';
|
|
2
|
+
import { type Copies } from '../repositories/index.ts';
|
|
2
3
|
import { type Observation } from '../run/index.ts';
|
|
3
4
|
import { type Scenario } from '../scenarios/index.ts';
|
|
4
5
|
import type { LastCompared } from './compared.ts';
|
|
@@ -22,6 +23,7 @@ export interface StageScope {
|
|
|
22
23
|
};
|
|
23
24
|
baseRef: string;
|
|
24
25
|
checkoutOf(side: Side): Promise<string>;
|
|
26
|
+
copiesOn(side: Side): Promise<Copies>;
|
|
25
27
|
scenarioOn(side: Side, id: string): Promise<Scenario | null>;
|
|
26
28
|
runs: Map<string, Observation>;
|
|
27
29
|
compared: LastCompared;
|
package/dist/stage/api.js
CHANGED
|
@@ -3,6 +3,7 @@ import { compare, lineOf } from '../compare/index.js';
|
|
|
3
3
|
import { RehearseError } from '../errors.js';
|
|
4
4
|
import { infoOf } from '../git/index.js';
|
|
5
5
|
import { scrub } from '../people/index.js';
|
|
6
|
+
import { pinnedOf } from '../repositories/index.js';
|
|
6
7
|
import { runSide } from '../run/index.js';
|
|
7
8
|
import { readScenarios, refOf } from '../scenarios/index.js';
|
|
8
9
|
import { validate } from '../schema.js';
|
|
@@ -131,6 +132,7 @@ export function apiOf(s) {
|
|
|
131
132
|
keepUp: false,
|
|
132
133
|
progress: s.asked.progress,
|
|
133
134
|
ref: side === 'base' ? baseRef : head.ref,
|
|
135
|
+
copies: await s.copiesOn(side),
|
|
134
136
|
});
|
|
135
137
|
const ob = run.observations.get(id);
|
|
136
138
|
if (!ob) {
|
|
@@ -153,6 +155,8 @@ export function apiOf(s) {
|
|
|
153
155
|
cwd: s.asked.cwd,
|
|
154
156
|
head: s.asked.head,
|
|
155
157
|
base: s.asked.base,
|
|
158
|
+
headRepositories: pinnedOf(await s.copiesOn('head')),
|
|
159
|
+
baseRepositories: pinnedOf(await s.copiesOn('base')),
|
|
156
160
|
ids: [id],
|
|
157
161
|
affected: false,
|
|
158
162
|
announce: s.asked.announce,
|
package/dist/stage/sending.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Manifest } from '../manifest/index.ts';
|
|
2
|
+
import { type Copies } from '../repositories/index.ts';
|
|
2
3
|
import { type Running } from '../services/index.ts';
|
|
3
4
|
import type { Side } from './http.ts';
|
|
4
5
|
export interface SideSession {
|
|
@@ -15,4 +16,4 @@ export interface ServicesForSending {
|
|
|
15
16
|
takeDown(): Promise<void>;
|
|
16
17
|
tokens(): Record<string, string>;
|
|
17
18
|
}
|
|
18
|
-
export declare function servicesForSending(m: Manifest, checkoutOf: (side: Side) => Promise<string>, progress: (line: string) => void): ServicesForSending;
|
|
19
|
+
export declare function servicesForSending(m: Manifest, checkoutOf: (side: Side) => Promise<string>, copiesOn: (side: Side) => Promise<Copies>, progress: (line: string) => void): ServicesForSending;
|
package/dist/stage/sending.js
CHANGED
|
@@ -2,8 +2,9 @@ import { RehearseError } from '../errors.js';
|
|
|
2
2
|
import { fill } from '../manifest/index.js';
|
|
3
3
|
import { signIn } from '../people/index.js';
|
|
4
4
|
import { applyWorld, baseVars } from '../run/index.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { rootsOf } from '../repositories/index.js';
|
|
6
|
+
import { bringDown, bringUp, liveServices, makeRoom, upFromAnotherCopy, } from '../services/index.js';
|
|
7
|
+
export function servicesForSending(m, checkoutOf, copiesOn, progress) {
|
|
7
8
|
let session = null;
|
|
8
9
|
const takeDown = async () => {
|
|
9
10
|
const s = session;
|
|
@@ -18,7 +19,11 @@ export function servicesForSending(m, checkoutOf, progress) {
|
|
|
18
19
|
return session;
|
|
19
20
|
await takeDown();
|
|
20
21
|
await makeRoom(m, checkout, progress);
|
|
22
|
+
const roots = rootsOf(await copiesOn(side));
|
|
21
23
|
let running = await liveServices(m, checkout);
|
|
24
|
+
const fromAnotherCopy = running.map((r) => upFromAnotherCopy(m, r, roots)).find(Boolean);
|
|
25
|
+
if (fromAnotherCopy)
|
|
26
|
+
throw new RehearseError('service', fromAnotherCopy);
|
|
22
27
|
const already = running.find((r) => (r.world ?? null) !== world);
|
|
23
28
|
if (already)
|
|
24
29
|
throw new RehearseError('service', `${already.name} is already up on the ${side} with ${already.world ? `the world ${already.world}` : 'no world'}: bring it down with rehearse down to send in ${world ? `the world ${world}` : 'no world'}.`);
|
|
@@ -34,6 +39,7 @@ export function servicesForSending(m, checkoutOf, progress) {
|
|
|
34
39
|
world,
|
|
35
40
|
real: new Set(),
|
|
36
41
|
vars: baseVars(m, checkout, running),
|
|
42
|
+
roots,
|
|
37
43
|
progress,
|
|
38
44
|
});
|
|
39
45
|
started.push(r);
|
package/dist/stage/server.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface StageOptions {
|
|
|
17
17
|
announceFrom?: 'changesets' | null;
|
|
18
18
|
said?: readonly string[];
|
|
19
19
|
progress: (line: string) => void;
|
|
20
|
+
baseRepositories?: Readonly<Record<string, string>>;
|
|
21
|
+
headRepositories?: Readonly<Record<string, string>>;
|
|
20
22
|
}
|
|
21
23
|
export interface Stage {
|
|
22
24
|
url: string;
|
package/dist/stage/server.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { readAnnouncement } from '../compare/index.js';
|
|
5
5
|
import { RehearseError, errorText } from '../errors.js';
|
|
6
6
|
import { checkoutFor } from '../git/index.js';
|
|
7
|
+
import { copiesFor } from '../repositories/index.js';
|
|
7
8
|
import { parseHurl, Refusal, sendFile, startPieceServer, } from '../kinds/index.js';
|
|
8
9
|
import { scrubDeep } from '../people/index.js';
|
|
9
10
|
import { readScenarios } from '../scenarios/index.js';
|
|
@@ -72,8 +73,19 @@ export async function startStage(o) {
|
|
|
72
73
|
const baseRef = o.base ?? m.base;
|
|
73
74
|
const baseCheckout = async () => (base ??= await checkoutFor(m, head.path, baseRef, o.progress, [head.path], o.cwd));
|
|
74
75
|
const checkoutOf = async (side) => (side === 'head' ? head.path : (await baseCheckout()).path);
|
|
76
|
+
const copies = new Map();
|
|
77
|
+
const copiesOn = (side) => {
|
|
78
|
+
const known = copies.get(side);
|
|
79
|
+
if (known)
|
|
80
|
+
return known;
|
|
81
|
+
const given = (side === 'head' ? o.headRepositories : o.baseRepositories) ?? {};
|
|
82
|
+
const resolving = checkoutOf(side).then((dir) => copiesFor(m, given, dir, o.progress, o.cwd));
|
|
83
|
+
resolving.catch(() => copies.delete(side));
|
|
84
|
+
copies.set(side, resolving);
|
|
85
|
+
return resolving;
|
|
86
|
+
};
|
|
75
87
|
const scenarioOn = async (side, id) => (await readScenarios(m, await checkoutOf(side))).scenarios.find((s) => s.id === id) ?? null;
|
|
76
|
-
const sending = servicesForSending(m, checkoutOf, o.progress);
|
|
88
|
+
const sending = servicesForSending(m, checkoutOf, copiesOn, o.progress);
|
|
77
89
|
const pieces = new Map();
|
|
78
90
|
const api = {
|
|
79
91
|
...apiOf({
|
|
@@ -82,6 +94,7 @@ export async function startStage(o) {
|
|
|
82
94
|
head,
|
|
83
95
|
baseRef,
|
|
84
96
|
checkoutOf,
|
|
97
|
+
copiesOn,
|
|
85
98
|
scenarioOn,
|
|
86
99
|
runs: new Map(),
|
|
87
100
|
compared: lastCompared(path.join(stateDir(m.dir), 'compare'), head.path, baseAsked(head.path, baseRef, o.cwd)),
|
package/llms.txt
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
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 keys [--check] [--json]` and `rehearse keys add <key>`: the keys services need (manifest `keys`: an op:// reference, or this computer's key store), where each comes from and who gets it as which variable; --check looks each up (found, missing, live, short, unreadable; exit 1 when one isn't there); add keeps one on this computer from stdin. Never prints a key (schema keys).
|
|
11
11
|
- `rehearse list [--affected <file>… | --since <ref>] [--json]`: the scenarios, or those a change reaches, each with reachedBy (schema list).
|
|
12
|
-
- `rehearse up [<service>…] [--world] [--real <stand-in>]` and `rehearse down [--all]`: services left running with a world built on them (schema up).
|
|
13
|
-
- `rehearse run <scenario> [--on <checkout|ref>] [--world] [--as <person>] [--real <stand-in>] [--keep] [--parallel <n>] --json`: one observation (schema observation).
|
|
14
|
-
- `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>] [--gate [--preview <url>]] --json`: a verdict per scenario (schema comparison). --gate prints a gate answer instead ({v, ok, summary, details, annotations, links, tool}; exit 0 ok, 1 not, 2 can't compare). --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.
|
|
12
|
+
- `rehearse up [<service>…] [--on <checkout>] [--repository <name=ref|folder>]… [--world] [--real <stand-in>]` and `rehearse down [--all]`: services left running with a world built on them (schema up).
|
|
13
|
+
- `rehearse run <scenario> [--on <checkout|ref>] [--repository <name=ref|folder>]… [--world] [--as <person>] [--real <stand-in>] [--keep] [--parallel <n>] --json`: one observation (schema observation). A service whose manifest entry names a `repository` (top-level `repositories: {name: {from, base?, prepare?}}`) runs in a fresh, prepared copy of that repository at its base, or at what --repository names; checkout.repositories gives each copy's {path, ref, commit, dirty}.
|
|
14
|
+
- `rehearse compare [<id or glob>…] [--affected] [--base <ref|./folder>] [--head <ref|./folder>] [--base-repository <name=ref|folder>]… [--head-repository <name=ref|folder>]… [--announce <file>] [--announce-from changesets] [--said <id>]… [--world] [--as] [--real] [--fresh] [--parallel <n>] [--gate [--preview <url>]] --json`: a verdict per scenario (schema comparison). --gate prints a gate answer instead ({v, ok, summary, details, annotations, links, tool}; exit 0 ok, 1 not, 2 can't compare). --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.
|
|
15
15
|
- `rehearse announce [<id or glob>…] [--draft] [--base] [--head] [--announce <file>] [--announce-from changesets] [--said <id>]… [--format yaml|changeset] --json`: what a comparison would read as announced (schema announce); with --draft (and compare's own options) it compares and proposes {scenario, why} for each scenario whose verdict is unsaid, its why the first difference, for you to rewrite as the reason. --format changeset prints an `announce` block for a changeset. It writes no file; refuses with code not_compared when the base or head doesn't come up.
|
|
16
16
|
- `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.
|
|
17
17
|
- `rehearse record <file.flow.yaml> --from-drive [--name <words>] [--force] --json`: writes the steps the current or latest drive took as a flow, every step by accessible name, then `rehearse run <file>` runs it (schema record: {file, from, replaced, steps, warnings}, each warning with the line it points to). It keeps each click, fill, type and key that worked, and each `snapshot --name` as a check the element is there; it leaves out failed steps and looks. The drive's steps are kept in .rehearse/drive-steps.jsonl until the next drive start. Without --from-drive, `rehearse record <file> [--service] [--world] [--as] [--start]` opens a Chromium window and records what a person clicks, fills, chooses and presses until the window closes or Ctrl-C. Rehearse keeps typed text only for plain fields it can see (native text, email, search, url, tel and number inputs and textareas, not secret, checked again when the step is written): a secret field (ever a password, a secret autocomplete, -webkit-text-security, or a name, label, placeholder or title saying pass, secret, token, key, pin, otp…) is written as `<password>`, anything else (custom elements, role=textbox, contenteditable, closed shadow roots, a service's own driver) as `<not recorded>`, each with a warning at its line that never quotes the text; text holding `{{` gets `literal: true`, the person's own token is written as `{{token}}`, and any other form of a token is kept out. A role and name more than one element has keeps its step with a warning. Refuses with code exists when the file is there (--force replaces it), and no_steps when there is nothing to write.
|
|
18
|
-
- `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).
|
|
18
|
+
- `rehearse stage [--base] [--head] [--base-repository]… [--head-repository]… [--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).
|
|
19
19
|
- `rehearse stage --static <dir> [--base <ref>] [--json]`: writes the stage of the latest comparison of this checkout with the base (the newer of .rehearse/compare/latest.json and latest-partial.json; --base as compare was given it) into <dir> as plain files with relative addresses, for any static host, such as a pull request's preview, then exits (schema static). It runs nothing; Run, Compare, Send, Works and a piece's live canvas aren't there. For a public preview it turns local paths (the checkouts, the home folder, and any /home/<name>, /Users/<name>, /root or C:\Users\<name>, also JSON-escaped or percent-encoded) into {{checkout}} and ~, copies an input only when git tracks it unchanged, copies from .rehearse only what runs made, and copies anything but a PNG, JPEG, WebP or GIF as scrubbed plain text; a home with a space in its name can slip through, so read a copy made on your own machine before publishing it. --base matches a ref by name and a folder by path; the newer comparison is the one written later. Refuses with code no_comparison when there is no comparison of this checkout with the base it can read, and exists when <dir> holds files an earlier copy didn't write.
|
|
20
20
|
- `rehearse open <scenario> [--json]`: the stage's address for a scenario (schema open), starting the stage if none runs.
|
|
21
21
|
- `rehearse clean [--all]`: removes old base checkouts, runs and comparisons (schema clean).
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
- same: as on the base. said: changed and said so (announced, or its own definition edited, unless it is a file scenario with contract: true; announced wins). unsaid: changed without saying so. new: not on the base. fails: fails on the head (failsOnBase: it fails on the base too, so not this change's doing).
|
|
35
35
|
- Ids, times and opaque tokens are set aside before comparing; arrays keep their order unless a scenario says unordered; a comparison counts what it set aside.
|
|
36
36
|
- A change announces what it expects to change in .rehearse/announce.yaml beside rehearse.yaml (schema announce): changes: [{scenario: <id or glob>, why: <one line>}].
|
|
37
|
-
- The base's observations are cached by commit under .rehearse/cache, so each base commit runs once; scenarios that share services in a world are cached and run as a group; --fresh runs again.
|
|
37
|
+
- The base's observations are cached by commit (and by the commit of each other repository's copy) under .rehearse/cache, so each base commit runs once; scenarios that share services in a world are cached and run as a group; --fresh runs again.
|
|
38
38
|
|
|
39
39
|
## Schemas (schema/v1/)
|
|
40
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurvball/rehearse",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.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": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"docs:dev": "pnpm --filter rehearse-docs dev",
|
|
84
84
|
"rehearse": "node dist/cli.js",
|
|
85
85
|
"changeset": "changeset",
|
|
86
|
-
"release:version": "changeset version && node scripts/changelog.ts && node docs/scripts/since.ts && prettier --write CHANGELOG.md package.json",
|
|
86
|
+
"release:version": "changeset version && node scripts/changelog.ts && node docs/scripts/since.ts && prettier --write CHANGELOG.md package.json docs/reference docs/src/content/docs",
|
|
87
87
|
"release:publish": "node scripts/release.ts"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -61,6 +61,23 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
+
"copy": {
|
|
65
|
+
"description": "A copy of one of the manifest's other repositories.",
|
|
66
|
+
"type": "object",
|
|
67
|
+
"required": ["path"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"path": { "description": "The copy's folder, or the folder given as it is.", "type": "string" },
|
|
70
|
+
"ref": {
|
|
71
|
+
"description": "The ref it was asked for, or null for a folder given.",
|
|
72
|
+
"type": ["string", "null"]
|
|
73
|
+
},
|
|
74
|
+
"commit": { "description": "The commit it holds.", "type": ["string", "null"] },
|
|
75
|
+
"dirty": {
|
|
76
|
+
"description": "Whether it holds uncommitted changes to tracked files. A run with one is never cached.",
|
|
77
|
+
"type": "boolean"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
64
81
|
"checkout": {
|
|
65
82
|
"type": "object",
|
|
66
83
|
"required": ["path"],
|
|
@@ -80,6 +97,11 @@
|
|
|
80
97
|
"dirty": {
|
|
81
98
|
"description": "Whether it holds uncommitted changes. A dirty checkout is never cached.",
|
|
82
99
|
"type": "boolean"
|
|
100
|
+
},
|
|
101
|
+
"repositories": {
|
|
102
|
+
"description": "The copy of each of the manifest's other repositories that its services ran in, by name: its folder, the ref asked for, its commit and whether it holds changes.",
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": { "$ref": "#/$defs/copy" }
|
|
83
105
|
}
|
|
84
106
|
}
|
|
85
107
|
},
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"prepare",
|
|
41
41
|
"build",
|
|
42
42
|
"service",
|
|
43
|
+
"key",
|
|
43
44
|
"pieces",
|
|
44
45
|
"flows",
|
|
45
46
|
"calls",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
]
|
|
51
52
|
},
|
|
52
53
|
"name": {
|
|
53
|
-
"description": "The
|
|
54
|
+
"description": "The name it wrote in the manifest, for a service or a key.",
|
|
54
55
|
"type": "string"
|
|
55
56
|
},
|
|
56
57
|
"from": {
|
|
@@ -138,6 +138,32 @@
|
|
|
138
138
|
"type": "object",
|
|
139
139
|
"propertyNames": { "$ref": "#/$defs/name" },
|
|
140
140
|
"additionalProperties": { "$ref": "#/$defs/key" }
|
|
141
|
+
},
|
|
142
|
+
"repositories": {
|
|
143
|
+
"description": "Other repositories services run from, by name. Rehearse keeps a clone of each and runs a service in a fresh copy of the commit each side needs: its base, unless the change names another.",
|
|
144
|
+
"type": "object",
|
|
145
|
+
"propertyNames": { "$ref": "#/$defs/name" },
|
|
146
|
+
"additionalProperties": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"required": ["from"],
|
|
149
|
+
"properties": {
|
|
150
|
+
"from": {
|
|
151
|
+
"description": "Where to clone it from: a git address (https://, ssh://, git@host:path, file://) or a folder, relative to the manifest's folder.",
|
|
152
|
+
"type": "string",
|
|
153
|
+
"minLength": 1
|
|
154
|
+
},
|
|
155
|
+
"base": {
|
|
156
|
+
"description": "The branch, tag or commit a comparison's base runs, and what runs when nothing names another. Default: the branch the repository's HEAD named when Rehearse cloned it.",
|
|
157
|
+
"type": "string",
|
|
158
|
+
"minLength": 1
|
|
159
|
+
},
|
|
160
|
+
"prepare": {
|
|
161
|
+
"description": "Run once in each fresh copy, before a service comes up in it, as the manifest's prepare is in its own.",
|
|
162
|
+
"$ref": "#/$defs/command"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"additionalProperties": false
|
|
166
|
+
}
|
|
141
167
|
}
|
|
142
168
|
},
|
|
143
169
|
"additionalProperties": false,
|
|
@@ -237,6 +263,10 @@
|
|
|
237
263
|
"type": "object",
|
|
238
264
|
"propertyNames": { "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
|
|
239
265
|
"additionalProperties": { "$ref": "#/$defs/name" }
|
|
266
|
+
},
|
|
267
|
+
"repository": {
|
|
268
|
+
"description": "The repository, in the manifest's repositories, whose copy it runs in: up, cwd and {{checkout}} are that copy's. Default: the manifest's own.",
|
|
269
|
+
"$ref": "#/$defs/name"
|
|
240
270
|
}
|
|
241
271
|
},
|
|
242
272
|
"additionalProperties": false
|
|
@@ -16,6 +16,10 @@ services:
|
|
|
16
16
|
ready: { command: pnpm drive snapshot --json }
|
|
17
17
|
down: pnpm drive stop
|
|
18
18
|
drive: pnpm drive
|
|
19
|
+
billing:
|
|
20
|
+
repository: billing
|
|
21
|
+
up: pnpm serve --port {{port}}
|
|
22
|
+
port: auto
|
|
19
23
|
signIn:
|
|
20
24
|
command: node scripts/people.mjs --api {{api_url}}
|
|
21
25
|
service: api
|
|
@@ -54,6 +58,10 @@ setAside:
|
|
|
54
58
|
keys: ['^requestId$']
|
|
55
59
|
keep: ['$.expiresAt']
|
|
56
60
|
budget: { services: 1, checkouts: 3 }
|
|
61
|
+
repositories:
|
|
62
|
+
billing:
|
|
63
|
+
from: git@github.com:acme/billing-api.git
|
|
64
|
+
prepare: pnpm install --frozen-lockfile --offline
|
|
57
65
|
keys:
|
|
58
66
|
payments: op://Acme/Payments/test secret key
|
|
59
67
|
carrier: { find: "The carrier's developer page, under Sandbox keys" }
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"type": "object",
|
|
51
51
|
"additionalProperties": { "type": "string" }
|
|
52
52
|
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"description": "The repository, in the manifest's repositories, whose copy it runs in, or null for the manifest's own.",
|
|
55
|
+
"type": ["string", "null"]
|
|
56
|
+
},
|
|
53
57
|
"standins": {
|
|
54
58
|
"description": "The stand-ins that apply to it.",
|
|
55
59
|
"type": "array",
|
|
@@ -63,6 +67,10 @@
|
|
|
63
67
|
"required": ["checkout", "pid"],
|
|
64
68
|
"properties": {
|
|
65
69
|
"checkout": { "type": "string" },
|
|
70
|
+
"root": {
|
|
71
|
+
"description": "For a service with a repository, the copy of it it runs in.",
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
66
74
|
"url": { "type": ["string", "null"] },
|
|
67
75
|
"port": { "type": ["integer", "null"] },
|
|
68
76
|
"pid": { "type": "integer" },
|
package/skill/rehearse/SKILL.md
CHANGED
|
@@ -130,6 +130,10 @@ Read `line`, then each entry of `scenarios`:
|
|
|
130
130
|
`byChange` groups unannounced changes by what changed. `notRun` lists scenarios that couldn't run, and `base.ok: false`
|
|
131
131
|
means the base didn't come up. The command exits 0 only when nothing fails on the head and nothing changed unsaid.
|
|
132
132
|
|
|
133
|
+
When the manifest has `repositories`, a service runs from a fresh copy of its own repository, at that repository's
|
|
134
|
+
`base`. If your change is in one of them, name it: `rehearse compare --head-repository api=<your branch or ./folder>`,
|
|
135
|
+
and `rehearse run '<id>' --repository api=<…>`. `checkout.repositories` says which commit of each ran.
|
|
136
|
+
|
|
133
137
|
## 5. Announce what you meant, before you push
|
|
134
138
|
|
|
135
139
|
Announce every change you made on purpose, so a reviewer sees what you meant apart from what slipped. Before you push:
|