@kurvball/rehearse 0.0.0-stage → 1.3.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/LICENSE +21 -0
- package/README.md +107 -2
- package/dist/affected/affected.d.ts +22 -0
- package/dist/affected/affected.js +162 -0
- package/dist/affected/index.d.ts +1 -0
- package/dist/affected/index.js +1 -0
- package/dist/args.d.ts +12 -0
- package/dist/args.js +42 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +100 -0
- package/dist/commands/check.d.ts +2 -0
- package/dist/commands/check.js +42 -0
- package/dist/commands/clean.d.ts +2 -0
- package/dist/commands/clean.js +37 -0
- package/dist/commands/command.d.ts +30 -0
- package/dist/commands/command.js +38 -0
- package/dist/commands/compare.d.ts +4 -0
- package/dist/commands/compare.js +89 -0
- package/dist/commands/drive.d.ts +2 -0
- package/dist/commands/drive.js +244 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.js +32 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +19 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/list.js +69 -0
- package/dist/commands/open.d.ts +2 -0
- package/dist/commands/open.js +60 -0
- package/dist/commands/people.d.ts +2 -0
- package/dist/commands/people.js +49 -0
- package/dist/commands/run.d.ts +4 -0
- package/dist/commands/run.js +84 -0
- package/dist/commands/services.d.ts +28 -0
- package/dist/commands/services.js +51 -0
- package/dist/commands/stage.d.ts +7 -0
- package/dist/commands/stage.js +53 -0
- package/dist/commands/up.d.ts +3 -0
- package/dist/commands/up.js +77 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.js +35 -0
- package/dist/commands/worlds.d.ts +2 -0
- package/dist/commands/worlds.js +15 -0
- package/dist/compare/announce.d.ts +6 -0
- package/dist/compare/announce.js +27 -0
- package/dist/compare/compare.d.ts +83 -0
- package/dist/compare/compare.js +335 -0
- package/dist/compare/diff.d.ts +15 -0
- package/dist/compare/diff.js +105 -0
- package/dist/compare/index.d.ts +5 -0
- package/dist/compare/index.js +5 -0
- package/dist/compare/setaside.d.ts +29 -0
- package/dist/compare/setaside.js +121 -0
- package/dist/compare/verdict.d.ts +21 -0
- package/dist/compare/verdict.js +30 -0
- package/dist/drive/aria.d.ts +8 -0
- package/dist/drive/aria.js +12 -0
- package/dist/drive/browser.d.ts +34 -0
- package/dist/drive/browser.js +216 -0
- package/dist/drive/daemon.d.ts +1 -0
- package/dist/drive/daemon.js +171 -0
- package/dist/drive/grammar.d.ts +93 -0
- package/dist/drive/grammar.js +303 -0
- package/dist/drive/index.d.ts +4 -0
- package/dist/drive/index.js +4 -0
- package/dist/drive/names.d.ts +24 -0
- package/dist/drive/names.js +97 -0
- package/dist/drive/state.d.ts +13 -0
- package/dist/drive/state.js +28 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.js +32 -0
- package/dist/exec.d.ts +16 -0
- package/dist/exec.js +43 -0
- package/dist/git/checkout.d.ts +11 -0
- package/dist/git/checkout.js +90 -0
- package/dist/git/git.d.ts +7 -0
- package/dist/git/git.js +27 -0
- package/dist/git/index.d.ts +2 -0
- package/dist/git/index.js +2 -0
- package/dist/git/seed.d.ts +3 -0
- package/dist/git/seed.js +115 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +15 -0
- package/dist/kinds/all.d.ts +4 -0
- package/dist/kinds/all.js +4 -0
- package/dist/kinds/call/check.d.ts +29 -0
- package/dist/kinds/call/check.js +187 -0
- package/dist/kinds/call/definition.d.ts +16 -0
- package/dist/kinds/call/definition.js +33 -0
- package/dist/kinds/call/hurl.d.ts +65 -0
- package/dist/kinds/call/hurl.js +333 -0
- package/dist/kinds/call/kind.d.ts +8 -0
- package/dist/kinds/call/kind.js +122 -0
- package/dist/kinds/call/send.d.ts +32 -0
- package/dist/kinds/call/send.js +152 -0
- package/dist/kinds/call/words.d.ts +22 -0
- package/dist/kinds/call/words.js +24 -0
- package/dist/kinds/file/kind.d.ts +44 -0
- package/dist/kinds/file/kind.js +331 -0
- package/dist/kinds/file/layouts.d.ts +14 -0
- package/dist/kinds/file/layouts.js +103 -0
- package/dist/kinds/flow/kind.d.ts +21 -0
- package/dist/kinds/flow/kind.js +412 -0
- package/dist/kinds/flow/literal.d.ts +8 -0
- package/dist/kinds/flow/literal.js +148 -0
- package/dist/kinds/index.d.ts +10 -0
- package/dist/kinds/index.js +8 -0
- package/dist/kinds/kind.d.ts +63 -0
- package/dist/kinds/kind.js +21 -0
- package/dist/kinds/piece/canvas.d.ts +18 -0
- package/dist/kinds/piece/canvas.js +165 -0
- package/dist/kinds/piece/conventions.d.ts +12 -0
- package/dist/kinds/piece/conventions.js +101 -0
- package/dist/kinds/piece/csf.d.ts +10 -0
- package/dist/kinds/piece/csf.js +304 -0
- package/dist/kinds/piece/kind.d.ts +12 -0
- package/dist/kinds/piece/kind.js +297 -0
- package/dist/kinds/piece/server.d.ts +23 -0
- package/dist/kinds/piece/server.js +236 -0
- package/dist/manifest/fill.d.ts +4 -0
- package/dist/manifest/fill.js +7 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.js +5 -0
- package/dist/manifest/init.d.ts +1 -0
- package/dist/manifest/init.js +47 -0
- package/dist/manifest/load.d.ts +7 -0
- package/dist/manifest/load.js +245 -0
- package/dist/manifest/types.d.ts +255 -0
- package/dist/manifest/types.js +7 -0
- package/dist/manifest/yaml.d.ts +5 -0
- package/dist/manifest/yaml.js +47 -0
- package/dist/people/index.d.ts +1 -0
- package/dist/people/index.js +1 -0
- package/dist/people/people.d.ts +39 -0
- package/dist/people/people.js +139 -0
- package/dist/run/cache.d.ts +20 -0
- package/dist/run/cache.js +98 -0
- package/dist/run/index.d.ts +5 -0
- package/dist/run/index.js +4 -0
- package/dist/run/observation.d.ts +27 -0
- package/dist/run/observation.js +1 -0
- package/dist/run/parallel.d.ts +28 -0
- package/dist/run/parallel.js +140 -0
- package/dist/run/session.d.ts +35 -0
- package/dist/run/session.js +399 -0
- package/dist/run/vars.d.ts +3 -0
- package/dist/run/vars.js +13 -0
- package/dist/scenarios/area.d.ts +6 -0
- package/dist/scenarios/area.js +37 -0
- package/dist/scenarios/files.d.ts +9 -0
- package/dist/scenarios/files.js +26 -0
- package/dist/scenarios/glob.d.ts +6 -0
- package/dist/scenarios/glob.js +106 -0
- package/dist/scenarios/index.d.ts +4 -0
- package/dist/scenarios/index.js +4 -0
- package/dist/scenarios/read.d.ts +18 -0
- package/dist/scenarios/read.js +54 -0
- package/dist/scenarios/scenario.d.ts +34 -0
- package/dist/scenarios/scenario.js +10 -0
- package/dist/schema.d.ts +14 -0
- package/dist/schema.js +122 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/registry.d.ts +23 -0
- package/dist/services/registry.js +49 -0
- package/dist/services/service.d.ts +23 -0
- package/dist/services/service.js +313 -0
- package/dist/stage/api.d.ts +30 -0
- package/dist/stage/api.js +206 -0
- package/dist/stage/client/client/api.js +11 -0
- package/dist/stage/client/client/index.js +1 -0
- package/dist/stage/client/features/canvas/call.js +65 -0
- package/dist/stage/client/features/canvas/context.js +1 -0
- package/dist/stage/client/features/canvas/file.js +36 -0
- package/dist/stage/client/features/canvas/flow.js +59 -0
- package/dist/stage/client/features/canvas/index.js +1 -0
- package/dist/stage/client/features/canvas/observed.js +8 -0
- package/dist/stage/client/features/canvas/parts.js +24 -0
- package/dist/stage/client/features/canvas/piece.js +31 -0
- package/dist/stage/client/features/canvas/reach.js +6 -0
- package/dist/stage/client/features/canvas/views.js +16 -0
- package/dist/stage/client/features/list/index.js +1 -0
- package/dist/stage/client/features/list/list.js +53 -0
- package/dist/stage/client/features/list/reach.js +10 -0
- package/dist/stage/client/features/scenario/heading.js +14 -0
- package/dist/stage/client/features/scenario/index.js +1 -0
- package/dist/stage/client/features/scenario/reach.js +9 -0
- package/dist/stage/client/features/scenario/scenario.js +145 -0
- package/dist/stage/client/features/try/index.js +1 -0
- package/dist/stage/client/features/try/reach.js +12 -0
- package/dist/stage/client/features/try/try.js +65 -0
- package/dist/stage/client/index.html +16 -0
- package/dist/stage/client/main.js +24 -0
- package/dist/stage/client/primitives/busy.js +6 -0
- package/dist/stage/client/primitives/focus.js +21 -0
- package/dist/stage/client/primitives/h.js +25 -0
- package/dist/stage/client/primitives/index.js +6 -0
- package/dist/stage/client/primitives/keyed.js +16 -0
- package/dist/stage/client/primitives/say.js +6 -0
- package/dist/stage/client/primitives/state.js +21 -0
- package/dist/stage/client/primitives/types.js +1 -0
- package/dist/stage/client/primitives/verdicts.js +8 -0
- package/dist/stage/client/stage.css +652 -0
- package/dist/stage/compared.d.ts +20 -0
- package/dist/stage/compared.js +58 -0
- package/dist/stage/files.d.ts +4 -0
- package/dist/stage/files.js +59 -0
- package/dist/stage/guard.d.ts +3 -0
- package/dist/stage/guard.js +20 -0
- package/dist/stage/http.d.ts +12 -0
- package/dist/stage/http.js +34 -0
- package/dist/stage/index.d.ts +1 -0
- package/dist/stage/index.js +1 -0
- package/dist/stage/sending.d.ts +18 -0
- package/dist/stage/sending.js +66 -0
- package/dist/stage/server.d.ts +33 -0
- package/dist/stage/server.js +253 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +5 -0
- package/dist/worlds/define.d.ts +16 -0
- package/dist/worlds/define.js +45 -0
- package/dist/worlds/index.d.ts +2 -0
- package/dist/worlds/index.js +2 -0
- package/dist/worlds/worlds.d.ts +15 -0
- package/dist/worlds/worlds.js +46 -0
- package/llms.txt +46 -0
- package/package.json +84 -3
- package/schema/v1/announce.schema.json +28 -0
- package/schema/v1/check.schema.json +67 -0
- package/schema/v1/clean.schema.json +19 -0
- package/schema/v1/common.schema.json +210 -0
- package/schema/v1/comparison.schema.json +298 -0
- package/schema/v1/dependents.schema.json +30 -0
- package/schema/v1/drive.schema.json +112 -0
- package/schema/v1/error.schema.json +26 -0
- package/schema/v1/file-scenario.schema.json +175 -0
- package/schema/v1/flow.schema.json +216 -0
- package/schema/v1/init.schema.json +20 -0
- package/schema/v1/list.schema.json +70 -0
- package/schema/v1/manifest.schema.json +434 -0
- package/schema/v1/observation.schema.json +388 -0
- package/schema/v1/open.schema.json +14 -0
- package/schema/v1/people.schema.json +88 -0
- package/schema/v1/samples/announce.yaml +5 -0
- package/schema/v1/samples/check.json +13 -0
- package/schema/v1/samples/clean.json +1 -0
- package/schema/v1/samples/comparison.json +83 -0
- package/schema/v1/samples/dependents.json +7 -0
- package/schema/v1/samples/drive.json +10 -0
- package/schema/v1/samples/error.json +10 -0
- package/schema/v1/samples/file-scenario.yaml +13 -0
- package/schema/v1/samples/flow.yaml +13 -0
- package/schema/v1/samples/init.json +1 -0
- package/schema/v1/samples/list.json +24 -0
- package/schema/v1/samples/manifest.yaml +55 -0
- package/schema/v1/samples/observation.json +49 -0
- package/schema/v1/samples/open.json +6 -0
- package/schema/v1/samples/people.json +11 -0
- package/schema/v1/samples/services.json +27 -0
- package/schema/v1/samples/stage.json +6 -0
- package/schema/v1/samples/try.json +13 -0
- package/schema/v1/samples/up.json +16 -0
- package/schema/v1/samples/validate.json +7 -0
- package/schema/v1/samples/worlds.json +21 -0
- package/schema/v1/services.schema.json +72 -0
- package/schema/v1/stage.schema.json +14 -0
- package/schema/v1/try.schema.json +56 -0
- package/schema/v1/up.schema.json +55 -0
- package/schema/v1/validate.schema.json +40 -0
- package/schema/v1/worlds.schema.json +33 -0
- package/skill/rehearse/SKILL.md +148 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { mkdirSync, realpathSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { infoOf, overlay, topOf } from '../git/index.js';
|
|
4
|
+
import { toPosix, refOf } from '../scenarios/index.js';
|
|
5
|
+
import { RehearseError, errorText } from '../errors.js';
|
|
6
|
+
import { broken, runnerOf, } from '../kinds/index.js';
|
|
7
|
+
import { fill } from '../manifest/index.js';
|
|
8
|
+
import { signIn } from '../people/index.js';
|
|
9
|
+
import { stateDir, bringDown, bringUp, inUse, liveServices, makeRoom, release, standinsFor, } from '../services/index.js';
|
|
10
|
+
import { VERSION } from '../version.js';
|
|
11
|
+
import { applyWorld, chainOf } from '../worlds/index.js';
|
|
12
|
+
export { applyWorld };
|
|
13
|
+
import { cacheKeyOf, groupsOf } from './cache.js';
|
|
14
|
+
import { inTurn, slotsFor, unitsOf } from './parallel.js';
|
|
15
|
+
import { baseVars } from './vars.js';
|
|
16
|
+
const worldOf = (s, o) => o.world ?? s.world;
|
|
17
|
+
const personOf = (s, o) => o.as ?? s.person;
|
|
18
|
+
export function standinUses(m, services, real) {
|
|
19
|
+
const seen = new Map();
|
|
20
|
+
for (const svc of services)
|
|
21
|
+
for (const { standin, real: isReal } of standinsFor(m, svc, real))
|
|
22
|
+
seen.set(standin.name, {
|
|
23
|
+
name: standin.name,
|
|
24
|
+
replaces: standin.replaces,
|
|
25
|
+
by: standin.by,
|
|
26
|
+
fidelity: standin.fidelity,
|
|
27
|
+
real: isReal,
|
|
28
|
+
});
|
|
29
|
+
return [...seen.values()];
|
|
30
|
+
}
|
|
31
|
+
function everyServiceWhenTheWorldAdds(m, world) {
|
|
32
|
+
if (!world)
|
|
33
|
+
return [];
|
|
34
|
+
return chainOf(m, world).some((w) => w.add) ? Object.keys(m.services) : [];
|
|
35
|
+
}
|
|
36
|
+
const asItReallyIs = (dir) => {
|
|
37
|
+
try {
|
|
38
|
+
return realpathSync(dir);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return dir;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const wholeFolder = (dir) => new RegExp(`${dir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?!\\w|[.-]\\w)`, 'g');
|
|
45
|
+
export function placedIn(value, folders) {
|
|
46
|
+
const asGivenAndAsTheyReallyAre = folders.flatMap(([dir, name]) => [
|
|
47
|
+
[dir, name],
|
|
48
|
+
[asItReallyIs(dir), name],
|
|
49
|
+
]);
|
|
50
|
+
const longestFirst = [...new Map(asGivenAndAsTheyReallyAre)]
|
|
51
|
+
.filter(([dir]) => dir.length > 1)
|
|
52
|
+
.sort(([a], [b]) => b.length - a.length)
|
|
53
|
+
.map(([dir, name]) => [wholeFolder(dir), name]);
|
|
54
|
+
const walk = (v) => typeof v === 'string'
|
|
55
|
+
? longestFirst.reduce((text, [dir, name]) => text.replace(dir, name), v)
|
|
56
|
+
: Array.isArray(v)
|
|
57
|
+
? v.map(walk)
|
|
58
|
+
: v && typeof v === 'object'
|
|
59
|
+
? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, walk(x)]))
|
|
60
|
+
: v;
|
|
61
|
+
return walk(value);
|
|
62
|
+
}
|
|
63
|
+
function manifestFolderAsOnBothSides(m) {
|
|
64
|
+
const home = path.resolve(m.checkout ?? topOf(m.dir) ?? m.dir);
|
|
65
|
+
const inside = path.relative(home, path.resolve(m.dir));
|
|
66
|
+
if (inside.startsWith('..') || path.isAbsolute(inside))
|
|
67
|
+
return '{{manifest}}';
|
|
68
|
+
return inside ? `{{checkout}}/${toPosix(inside)}` : '{{checkout}}';
|
|
69
|
+
}
|
|
70
|
+
async function planOf(m, world, group) {
|
|
71
|
+
const runners = new Map();
|
|
72
|
+
for (const s of group)
|
|
73
|
+
if (!runners.has(s.kind))
|
|
74
|
+
runners.set(s.kind, await runnerOf(s.kind));
|
|
75
|
+
const forEveryScenario = [
|
|
76
|
+
...everyServiceWhenTheWorldAdds(m, world),
|
|
77
|
+
...(m.signIn?.service ? [m.signIn.service] : []),
|
|
78
|
+
];
|
|
79
|
+
const needed = new Set([
|
|
80
|
+
...group.flatMap((s) => runners.get(s.kind).services(s, m)),
|
|
81
|
+
...everyServiceWhenTheWorldAdds(m, world),
|
|
82
|
+
]);
|
|
83
|
+
if (m.signIn?.service)
|
|
84
|
+
needed.add(m.signIn.service);
|
|
85
|
+
return {
|
|
86
|
+
world,
|
|
87
|
+
group,
|
|
88
|
+
runners,
|
|
89
|
+
needed,
|
|
90
|
+
servicesOf: (s) => [...new Set([...runners.get(s.kind).services(s, m), ...forEveryScenario])],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function undeclaredIn(m, needed) {
|
|
94
|
+
const undeclared = [...needed].filter((name) => !m.services[name]);
|
|
95
|
+
return undeclared.length
|
|
96
|
+
? {
|
|
97
|
+
step: 'up',
|
|
98
|
+
says: `It needs the service ${undeclared.join(', ')}, which the manifest doesn't declare.`,
|
|
99
|
+
}
|
|
100
|
+
: null;
|
|
101
|
+
}
|
|
102
|
+
function upInAnotherWorld(checkout, world, leftUp) {
|
|
103
|
+
const other = leftUp.find((r) => (r.world ?? null) !== world);
|
|
104
|
+
return other
|
|
105
|
+
? {
|
|
106
|
+
step: 'world',
|
|
107
|
+
says: `${other.name} is already up in ${checkout} with ${other.world ? `the world ${other.world}` : 'no world Rehearse built'}, not ${world ?? 'no world'}: run with --world ${other.world ?? '…'}, or stop it with \`rehearse down\`.`,
|
|
108
|
+
}
|
|
109
|
+
: null;
|
|
110
|
+
}
|
|
111
|
+
const everyOneOf = (group, why) => group.map((s) => ({ scenario: s, ...why, byItsRunner: false }));
|
|
112
|
+
async function runGroup(side, world, group, runners, needed, upAlready, rehearseCanVouchForTheirState) {
|
|
113
|
+
const { m, checkout, o } = side;
|
|
114
|
+
const out = { observations: new Map(), notRun: [], broke: null };
|
|
115
|
+
const started = [];
|
|
116
|
+
let running = upAlready;
|
|
117
|
+
const vars = () => baseVars(m, checkout, running);
|
|
118
|
+
let bringingUp = null;
|
|
119
|
+
try {
|
|
120
|
+
const fresh = [...needed].filter((name) => !running.some((r) => r.name === name));
|
|
121
|
+
if (fresh.length)
|
|
122
|
+
await makeRoom(m, checkout, o.progress);
|
|
123
|
+
if (world && fresh.length)
|
|
124
|
+
await applyWorld(m, world, 'before', checkout, vars());
|
|
125
|
+
for (const name of Object.keys(m.services).filter((n) => fresh.includes(n))) {
|
|
126
|
+
bringingUp = name;
|
|
127
|
+
const r = await bringUp(m, m.services[name], checkout, {
|
|
128
|
+
world,
|
|
129
|
+
real: o.real,
|
|
130
|
+
vars: vars(),
|
|
131
|
+
progress: o.progress,
|
|
132
|
+
});
|
|
133
|
+
started.push(r);
|
|
134
|
+
running = [...running, r];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
for (const r of started)
|
|
139
|
+
await bringDown(m, r, o.progress);
|
|
140
|
+
out.broke = {
|
|
141
|
+
step: error instanceof RehearseError && error.code === 'world' ? 'world' : 'up',
|
|
142
|
+
says: errorText(error),
|
|
143
|
+
bringingUp,
|
|
144
|
+
};
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
if (world && started.length)
|
|
149
|
+
await applyWorld(m, world, 'add', checkout, vars());
|
|
150
|
+
const someoneSignsIn = Boolean(m.signIn) || Object.values(m.people).some((p) => p.token);
|
|
151
|
+
const signedIn = async () => {
|
|
152
|
+
if (!someoneSignsIn)
|
|
153
|
+
return { tokens: {}, variables: {} };
|
|
154
|
+
const v = vars();
|
|
155
|
+
const signed = await signIn(m, {
|
|
156
|
+
cwd: checkout,
|
|
157
|
+
env: {},
|
|
158
|
+
fill: (t) => fill(t, { ...v, ...(world && { world }) }),
|
|
159
|
+
});
|
|
160
|
+
return { tokens: signed.tokens, variables: signed.variables };
|
|
161
|
+
};
|
|
162
|
+
let people = await signedIn();
|
|
163
|
+
const variables = () => ({ ...vars(), ...people.variables, ...(world && { world }) });
|
|
164
|
+
const signInAgain = async () => {
|
|
165
|
+
people = await signedIn();
|
|
166
|
+
return { tokens: people.tokens, variables: variables() };
|
|
167
|
+
};
|
|
168
|
+
const broughtUpAndUnused = new Set(started.map((r) => r.name));
|
|
169
|
+
for (const [kind, runner] of runners) {
|
|
170
|
+
const these = group.filter((s) => s.kind === kind);
|
|
171
|
+
const begun = Date.now();
|
|
172
|
+
let ran;
|
|
173
|
+
try {
|
|
174
|
+
ran = await runner.run(these, {
|
|
175
|
+
manifest: m,
|
|
176
|
+
checkout,
|
|
177
|
+
world,
|
|
178
|
+
as: o.as,
|
|
179
|
+
tokens: people.tokens,
|
|
180
|
+
variables: variables(),
|
|
181
|
+
running,
|
|
182
|
+
broughtUpAndUnused: new Set(broughtUpAndUnused),
|
|
183
|
+
signInAgain,
|
|
184
|
+
keep: side.keepDir,
|
|
185
|
+
progress: o.progress,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
ran = new Map(these.map((s) => [s.id, broken('runner', errorText(error))]));
|
|
190
|
+
}
|
|
191
|
+
for (const s of these)
|
|
192
|
+
for (const name of runner.services(s, m))
|
|
193
|
+
broughtUpAndUnused.delete(name);
|
|
194
|
+
const ms = Math.round((Date.now() - begun) / Math.max(1, these.length));
|
|
195
|
+
for (const s of these) {
|
|
196
|
+
const r = ran.get(s.id);
|
|
197
|
+
if (!r)
|
|
198
|
+
continue;
|
|
199
|
+
if (r.broke &&
|
|
200
|
+
['world', 'signIn', 'runner', 'driver', 'up'].includes(r.broke.step) &&
|
|
201
|
+
r.observed === null) {
|
|
202
|
+
out.notRun.push({ scenario: s, step: r.broke.step, says: r.broke.says, byItsRunner: true });
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const services = runner.services(s, m);
|
|
206
|
+
const person = personOf(s, o);
|
|
207
|
+
out.observations.set(s.id, {
|
|
208
|
+
v: 1,
|
|
209
|
+
ok: r.ok,
|
|
210
|
+
scenario: refOf(s),
|
|
211
|
+
checkout: side.info,
|
|
212
|
+
world,
|
|
213
|
+
person,
|
|
214
|
+
standins: standinUses(m, services, o.real),
|
|
215
|
+
failures: side.placed(r.failures),
|
|
216
|
+
broke: side.placed(r.broke),
|
|
217
|
+
observed: side.placed(r.observed),
|
|
218
|
+
artifacts: r.artifacts,
|
|
219
|
+
ms,
|
|
220
|
+
at: new Date().toISOString(),
|
|
221
|
+
rehearse: VERSION,
|
|
222
|
+
runner: runner.version,
|
|
223
|
+
cacheKey: side.info.commit && !side.info.dirty && rehearseCanVouchForTheirState
|
|
224
|
+
? cacheKeyOf({
|
|
225
|
+
group: side.groups.get(s.id) ?? null,
|
|
226
|
+
commit: side.info.commit,
|
|
227
|
+
scenario: s,
|
|
228
|
+
world,
|
|
229
|
+
person,
|
|
230
|
+
real: [...o.real],
|
|
231
|
+
runner,
|
|
232
|
+
manifest: m,
|
|
233
|
+
})
|
|
234
|
+
: null,
|
|
235
|
+
cached: false,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
out.notRun.push(...everyOneOf(group, {
|
|
242
|
+
step: error instanceof RehearseError && error.code === 'sign_in'
|
|
243
|
+
? 'signIn'
|
|
244
|
+
: error instanceof RehearseError && error.code === 'world'
|
|
245
|
+
? 'world'
|
|
246
|
+
: 'runner',
|
|
247
|
+
says: errorText(error),
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
250
|
+
finally {
|
|
251
|
+
if (o.keepUp)
|
|
252
|
+
for (const r of started)
|
|
253
|
+
release(r);
|
|
254
|
+
else
|
|
255
|
+
for (const r of started.toReversed())
|
|
256
|
+
await bringDown(m, r, o.progress);
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
const asNotRun = ({ byItsRunner: _byItsRunner, ...n }) => n;
|
|
261
|
+
function takeIn(side, ran) {
|
|
262
|
+
for (const [id, ob] of ran.observations)
|
|
263
|
+
side.observations.set(id, ob);
|
|
264
|
+
side.notRun.push(...ran.notRun.map(asNotRun));
|
|
265
|
+
}
|
|
266
|
+
async function oneWorldAfterAnother(scope, worlds, side) {
|
|
267
|
+
const { m, checkout } = scope;
|
|
268
|
+
for (const [world, group] of worlds) {
|
|
269
|
+
const plan = await planOf(m, world, group);
|
|
270
|
+
const undeclared = undeclaredIn(m, plan.needed);
|
|
271
|
+
if (undeclared) {
|
|
272
|
+
side.notRun.push(...everyOneOf(group, undeclared).map(asNotRun));
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const running = await liveServices(m, checkout);
|
|
276
|
+
const leftUp = running.filter((r) => plan.needed.has(r.name));
|
|
277
|
+
const elsewhere = upInAnotherWorld(checkout, world, leftUp);
|
|
278
|
+
if (elsewhere) {
|
|
279
|
+
side.notRun.push(...everyOneOf(group, elsewhere).map(asNotRun));
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
const ran = await runGroup(scope, world, group, plan.runners, plan.needed, running, leftUp.length === 0);
|
|
283
|
+
if (ran.broke) {
|
|
284
|
+
side.broke = { step: ran.broke.step, says: ran.broke.says };
|
|
285
|
+
return side;
|
|
286
|
+
}
|
|
287
|
+
takeIn(side, ran);
|
|
288
|
+
}
|
|
289
|
+
return side;
|
|
290
|
+
}
|
|
291
|
+
function inTheOrderOneAfterAnotherWouldGive(plan, ran) {
|
|
292
|
+
const kinds = [...plan.runners.keys()];
|
|
293
|
+
const at = new Map(plan.group.map((s, i) => [s.id, i]));
|
|
294
|
+
const rank = (s, byItsRunner) => byItsRunner ? [0, kinds.indexOf(s.kind), at.get(s.id) ?? 0] : [1, 0, at.get(s.id) ?? 0];
|
|
295
|
+
const byRank = (a, b) => {
|
|
296
|
+
for (let i = 0; i < a.length; i += 1)
|
|
297
|
+
if (a[i] !== b[i])
|
|
298
|
+
return a[i] - b[i];
|
|
299
|
+
return 0;
|
|
300
|
+
};
|
|
301
|
+
const observations = ran
|
|
302
|
+
.flatMap((r) => [...r.observations])
|
|
303
|
+
.sort(([a], [b]) => byRank(rank(plan.group[at.get(a)], true), rank(plan.group[at.get(b)], true)));
|
|
304
|
+
const notRun = ran
|
|
305
|
+
.flatMap((r) => r.notRun)
|
|
306
|
+
.sort((a, b) => byRank(rank(a.scenario, a.byItsRunner), rank(b.scenario, b.byItsRunner)));
|
|
307
|
+
return { observations: new Map(observations), notRun, broke: null };
|
|
308
|
+
}
|
|
309
|
+
function brokeFirstOneAfterAnother(m, ran) {
|
|
310
|
+
const order = Object.keys(m.services);
|
|
311
|
+
const broke = ran.flatMap((r) => (r.broke ? [r.broke] : []));
|
|
312
|
+
const at = (b) => b.bringingUp === null ? -1 : order.indexOf(b.bringingUp);
|
|
313
|
+
return broke.sort((a, b) => at(a) - at(b))[0] ?? null;
|
|
314
|
+
}
|
|
315
|
+
async function inTurns(scope, worlds, side, slots) {
|
|
316
|
+
const { m, checkout } = scope;
|
|
317
|
+
const upAtFirst = await liveServices(m, checkout);
|
|
318
|
+
const upAtFirstNames = new Set(upAtFirst.map((r) => r.name));
|
|
319
|
+
const planned = [];
|
|
320
|
+
const units = [];
|
|
321
|
+
for (const [world, group] of worlds) {
|
|
322
|
+
const plan = await planOf(m, world, group);
|
|
323
|
+
const leftUp = upAtFirst.filter((r) => plan.needed.has(r.name));
|
|
324
|
+
const refused = undeclaredIn(m, plan.needed) ?? upInAnotherWorld(checkout, world, leftUp);
|
|
325
|
+
if (refused) {
|
|
326
|
+
planned.push({ refused: everyOneOf(group, refused) });
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
const these = unitsOf(m, { ...plan, at: planned.length, vouched: leftUp.length === 0 });
|
|
330
|
+
planned.push({ plan, units: these });
|
|
331
|
+
units.push(...these);
|
|
332
|
+
}
|
|
333
|
+
let firstWorldThatBroke = Infinity;
|
|
334
|
+
const results = await inTurn(units, slots, async (u) => {
|
|
335
|
+
const running = (await liveServices(m, checkout)).filter((r) => u.needed.has(r.name) || upAtFirstNames.has(r.name));
|
|
336
|
+
const ran = await runGroup(scope, u.world, u.members, u.runners, u.needed, running, u.vouched);
|
|
337
|
+
if (ran.broke)
|
|
338
|
+
firstWorldThatBroke = Math.min(firstWorldThatBroke, u.at);
|
|
339
|
+
return ran;
|
|
340
|
+
}, (u) => u.at >= firstWorldThatBroke);
|
|
341
|
+
for (const p of planned) {
|
|
342
|
+
if ('refused' in p) {
|
|
343
|
+
side.notRun.push(...p.refused.map(asNotRun));
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
const ran = p.units.flatMap((u) => results[units.indexOf(u)] ?? []);
|
|
347
|
+
const broke = brokeFirstOneAfterAnother(m, ran);
|
|
348
|
+
if (broke) {
|
|
349
|
+
side.broke = { step: broke.step, says: broke.says };
|
|
350
|
+
return side;
|
|
351
|
+
}
|
|
352
|
+
takeIn(side, inTheOrderOneAfterAnotherWouldGive(p.plan, ran));
|
|
353
|
+
}
|
|
354
|
+
return side;
|
|
355
|
+
}
|
|
356
|
+
export function runSide(m, checkout, scenarios, o) {
|
|
357
|
+
return runSideSharing(m, checkout, scenarios, o, slotsFor(o.parallel ?? 1));
|
|
358
|
+
}
|
|
359
|
+
export function runSideSharing(m, checkout, scenarios, o, slots) {
|
|
360
|
+
return inUse(checkout, async () => {
|
|
361
|
+
const side = {
|
|
362
|
+
checkout: infoOf(m, checkout, o.ref),
|
|
363
|
+
observations: new Map(),
|
|
364
|
+
broke: null,
|
|
365
|
+
notRun: [],
|
|
366
|
+
};
|
|
367
|
+
if (scenarios.length === 0)
|
|
368
|
+
return side;
|
|
369
|
+
try {
|
|
370
|
+
overlay(m, checkout);
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
side.broke = { step: 'overlay', says: errorText(error) };
|
|
374
|
+
return side;
|
|
375
|
+
}
|
|
376
|
+
side.checkout = infoOf(m, checkout, o.ref);
|
|
377
|
+
const manifestAs = manifestFolderAsOnBothSides(m);
|
|
378
|
+
const keepDir = path.join(stateDir(m.dir), 'runs', `${Date.now().toString(36)}-${path.basename(checkout)}`);
|
|
379
|
+
mkdirSync(keepDir, { recursive: true });
|
|
380
|
+
const scope = {
|
|
381
|
+
m,
|
|
382
|
+
checkout,
|
|
383
|
+
o,
|
|
384
|
+
info: side.checkout,
|
|
385
|
+
groups: o.groups ?? (await groupsOf(m, scenarios, o.world)),
|
|
386
|
+
keepDir,
|
|
387
|
+
placed: (v) => placedIn(v, [
|
|
388
|
+
[path.resolve(checkout), '{{checkout}}'],
|
|
389
|
+
[path.resolve(m.dir), manifestAs],
|
|
390
|
+
]),
|
|
391
|
+
};
|
|
392
|
+
const worlds = new Map();
|
|
393
|
+
for (const s of scenarios)
|
|
394
|
+
worlds.set(worldOf(s, o), [...(worlds.get(worldOf(s, o)) ?? []), s]);
|
|
395
|
+
return (o.parallel ?? 1) > 1 && !o.keepUp
|
|
396
|
+
? inTurns(scope, worlds, side, slots)
|
|
397
|
+
: oneWorldAfterAnother(scope, worlds, side);
|
|
398
|
+
});
|
|
399
|
+
}
|
package/dist/run/vars.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function baseVars(m, checkout, running) {
|
|
2
|
+
const vars = { checkout, manifest: m.dir };
|
|
3
|
+
for (const r of running) {
|
|
4
|
+
if (r.url)
|
|
5
|
+
vars[`${r.name}_url`] = r.url;
|
|
6
|
+
if (r.port !== null)
|
|
7
|
+
vars[`${r.name}_port`] = String(r.port);
|
|
8
|
+
}
|
|
9
|
+
const main = m.defaults.service ? running.find((r) => r.name === m.defaults.service) : undefined;
|
|
10
|
+
if (main?.url)
|
|
11
|
+
vars.url = main.url;
|
|
12
|
+
return vars;
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Manifest } from '../manifest/index.ts';
|
|
2
|
+
import type { ScenarioFile } from './files.ts';
|
|
3
|
+
export declare const PACKAGE_FILES: readonly ['package.json', 'pyproject.toml', 'Cargo.toml', 'go.mod'];
|
|
4
|
+
export declare function packageDirOf(root: string, file: string): string | null;
|
|
5
|
+
export declare function packageNameOf(dir: string): string | null;
|
|
6
|
+
export declare function areaOf(m: Manifest, checkout: string, f: ScenarioFile): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { toPosix } from './glob.js';
|
|
4
|
+
export const PACKAGE_FILES = ['package.json', 'pyproject.toml', 'Cargo.toml', 'go.mod'];
|
|
5
|
+
export function packageDirOf(root, file) {
|
|
6
|
+
for (let at = path.dirname(path.resolve(root, file));; at = path.dirname(at)) {
|
|
7
|
+
if (PACKAGE_FILES.some((p) => existsSync(path.join(at, p))))
|
|
8
|
+
return at;
|
|
9
|
+
if (path.resolve(at) === path.resolve(root) || path.dirname(at) === at)
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function packageNameOf(dir) {
|
|
14
|
+
try {
|
|
15
|
+
const name = JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8'))
|
|
16
|
+
.name;
|
|
17
|
+
if (typeof name === 'string' && name)
|
|
18
|
+
return name;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
export function areaOf(m, checkout, f) {
|
|
26
|
+
if (f.from === 'manifest')
|
|
27
|
+
return toPosix(path.dirname(f.file)).replace(/^\.\/?/, '') || 'scenarios';
|
|
28
|
+
const dir = packageDirOf(checkout, f.file);
|
|
29
|
+
if (dir && path.resolve(dir) !== path.resolve(checkout))
|
|
30
|
+
return packageNameOf(dir) ?? toPosix(path.relative(checkout, dir));
|
|
31
|
+
const parts = f.file.split('/');
|
|
32
|
+
return parts.length > 2
|
|
33
|
+
? parts.slice(0, 2).join('/')
|
|
34
|
+
: parts.length === 2
|
|
35
|
+
? parts[0]
|
|
36
|
+
: path.basename(m.dir);
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Kind, type Manifest, type PathEntry } from '../manifest/index.ts';
|
|
2
|
+
export interface ScenarioFile {
|
|
3
|
+
kind: Kind;
|
|
4
|
+
file: string;
|
|
5
|
+
abs: string;
|
|
6
|
+
from: PathEntry['from'];
|
|
7
|
+
covers: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function filesOf(m: Manifest, kind: Kind, checkout: string): ScenarioFile[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { KIND_BLOCK } from '../manifest/index.js';
|
|
3
|
+
import { findFiles, toPosix } from './glob.js';
|
|
4
|
+
export function filesOf(m, kind, checkout) {
|
|
5
|
+
const out = new Map();
|
|
6
|
+
for (const entry of m.scenarios[KIND_BLOCK[kind]].paths) {
|
|
7
|
+
const root = entry.from === 'manifest' ? m.dir : checkout;
|
|
8
|
+
for (const file of findFiles(root, [entry.glob])) {
|
|
9
|
+
const abs = path.resolve(root, file);
|
|
10
|
+
const rel = toPosix(entry.from === 'manifest' ? path.relative(m.dir, abs) : file);
|
|
11
|
+
const id = `${entry.from}:${rel}`;
|
|
12
|
+
const known = out.get(id);
|
|
13
|
+
if (known)
|
|
14
|
+
known.covers.push(...entry.covers);
|
|
15
|
+
else
|
|
16
|
+
out.set(id, {
|
|
17
|
+
kind,
|
|
18
|
+
file: rel.startsWith('.') ? rel : entry.from === 'manifest' ? `./${rel}` : rel,
|
|
19
|
+
abs,
|
|
20
|
+
from: entry.from,
|
|
21
|
+
covers: [...entry.covers],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return [...out.values()].sort((a, b) => a.file.localeCompare(b.file));
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const NEVER_WALKED: Set<string>;
|
|
2
|
+
export declare function globToRegExp(glob: string): RegExp;
|
|
3
|
+
export declare function globRoot(glob: string): string;
|
|
4
|
+
export declare const toPosix: (p: string) => string;
|
|
5
|
+
export declare function findFiles(root: string, globs: readonly string[], limit?: number): string[];
|
|
6
|
+
export declare const matches: (file: string, globs: readonly string[]) => boolean;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export const NEVER_WALKED = new Set([
|
|
4
|
+
'node_modules',
|
|
5
|
+
'.git',
|
|
6
|
+
'dist',
|
|
7
|
+
'out',
|
|
8
|
+
'build',
|
|
9
|
+
'target',
|
|
10
|
+
'.rehearse',
|
|
11
|
+
'coverage',
|
|
12
|
+
'.turbo',
|
|
13
|
+
'.next',
|
|
14
|
+
'.astro',
|
|
15
|
+
'__pycache__',
|
|
16
|
+
'.venv',
|
|
17
|
+
]);
|
|
18
|
+
const escape = (c) => c.replace(/[.+^$()|\\]/g, '\\$&');
|
|
19
|
+
export function globToRegExp(glob) {
|
|
20
|
+
let out = '';
|
|
21
|
+
let i = 0;
|
|
22
|
+
let braces = 0;
|
|
23
|
+
while (i < glob.length) {
|
|
24
|
+
const c = glob[i];
|
|
25
|
+
if (c === '*') {
|
|
26
|
+
if (glob[i + 1] === '*') {
|
|
27
|
+
const slashAfter = glob[i + 2] === '/';
|
|
28
|
+
out += slashAfter ? '(?:.*/)?' : '.*';
|
|
29
|
+
i += slashAfter ? 3 : 2;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
out += '[^/]*';
|
|
33
|
+
}
|
|
34
|
+
else if (c === '?')
|
|
35
|
+
out += '[^/]';
|
|
36
|
+
else if (c === '{') {
|
|
37
|
+
braces += 1;
|
|
38
|
+
out += '(?:';
|
|
39
|
+
}
|
|
40
|
+
else if (c === '}' && braces > 0) {
|
|
41
|
+
braces -= 1;
|
|
42
|
+
out += ')';
|
|
43
|
+
}
|
|
44
|
+
else if (c === ',' && braces > 0)
|
|
45
|
+
out += '|';
|
|
46
|
+
else if (c === '[') {
|
|
47
|
+
const end = glob.indexOf(']', i + 1);
|
|
48
|
+
if (end < 0)
|
|
49
|
+
out += '\\[';
|
|
50
|
+
else {
|
|
51
|
+
out += `[${glob
|
|
52
|
+
.slice(i + 1, end)
|
|
53
|
+
.replace(/^!/, '^')
|
|
54
|
+
.replace(/\\/g, '\\\\')}]`;
|
|
55
|
+
i = end;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
out += escape(c);
|
|
60
|
+
i += 1;
|
|
61
|
+
}
|
|
62
|
+
return new RegExp(`^${out}$`);
|
|
63
|
+
}
|
|
64
|
+
export function globRoot(glob) {
|
|
65
|
+
const parts = glob.split('/');
|
|
66
|
+
const fixed = [];
|
|
67
|
+
for (const part of parts.slice(0, -1)) {
|
|
68
|
+
if (/[*?{[]/.test(part))
|
|
69
|
+
break;
|
|
70
|
+
fixed.push(part);
|
|
71
|
+
}
|
|
72
|
+
return fixed.join('/');
|
|
73
|
+
}
|
|
74
|
+
export const toPosix = (p) => p.split(path.sep).join('/');
|
|
75
|
+
export function findFiles(root, globs, limit = 20_000) {
|
|
76
|
+
const found = new Set();
|
|
77
|
+
for (const glob of globs) {
|
|
78
|
+
const clean = glob.replace(/^\.\//, '');
|
|
79
|
+
const re = globToRegExp(clean);
|
|
80
|
+
const start = globRoot(clean);
|
|
81
|
+
const walk = (relative) => {
|
|
82
|
+
if (found.size >= limit)
|
|
83
|
+
return;
|
|
84
|
+
let entries;
|
|
85
|
+
try {
|
|
86
|
+
entries = readdirSync(path.join(root, relative), { withFileTypes: true });
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
92
|
+
const child = relative ? `${relative}/${entry.name}` : entry.name;
|
|
93
|
+
if (entry.isDirectory()) {
|
|
94
|
+
if (NEVER_WALKED.has(entry.name))
|
|
95
|
+
continue;
|
|
96
|
+
walk(child);
|
|
97
|
+
}
|
|
98
|
+
else if (entry.isFile() && re.test(child))
|
|
99
|
+
found.add(child);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
walk(start);
|
|
103
|
+
}
|
|
104
|
+
return [...found].sort();
|
|
105
|
+
}
|
|
106
|
+
export const matches = (file, globs) => globs.some((g) => globToRegExp(g.replace(/^\.\//, '')).test(file));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { packageDirOf, packageNameOf } from './area.ts';
|
|
2
|
+
export { findFiles, globRoot, globToRegExp, matches, toPosix } from './glob.ts';
|
|
3
|
+
export { readScenarios, registerReader } from './read.ts';
|
|
4
|
+
export { refOf, type Refused, type Scenario, type ScenarioRef } from './scenario.ts';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Kind, type Manifest } from '../manifest/index.ts';
|
|
2
|
+
import { type ScenarioFile } from './files.ts';
|
|
3
|
+
import type { Refused, Scenario } from './scenario.ts';
|
|
4
|
+
export interface KindReader {
|
|
5
|
+
kind: Kind;
|
|
6
|
+
read(file: ScenarioFile, text: string, ctx: ReadContext): Scenario[];
|
|
7
|
+
}
|
|
8
|
+
export interface ReadContext {
|
|
9
|
+
manifest: Manifest;
|
|
10
|
+
checkout: string;
|
|
11
|
+
area: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function registerReader(reader: KindReader): void;
|
|
14
|
+
export interface Read {
|
|
15
|
+
scenarios: Scenario[];
|
|
16
|
+
refused: Refused[];
|
|
17
|
+
}
|
|
18
|
+
export declare function readScenarios(m: Manifest, checkout: string, kinds?: readonly Kind[]): Promise<Read>;
|