@kurvball/rehearse 1.12.2 → 1.13.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 +1 -0
- package/dist/commands/drive.js +16 -7
- package/dist/commands/index.js +2 -0
- package/dist/commands/record.d.ts +2 -0
- package/dist/commands/record.js +146 -0
- package/dist/drive/browser.d.ts +12 -1
- package/dist/drive/browser.js +64 -5
- package/dist/drive/daemon.js +91 -90
- package/dist/drive/grammar.d.ts +1 -0
- package/dist/drive/grammar.js +3 -1
- package/dist/drive/index.d.ts +9 -5
- package/dist/drive/index.js +9 -5
- package/dist/drive/log.d.ts +19 -0
- package/dist/drive/log.js +75 -0
- package/dist/drive/names.d.ts +2 -0
- package/dist/drive/names.js +4 -0
- package/dist/drive/open.d.ts +25 -0
- package/dist/drive/open.js +95 -0
- package/dist/drive/secrets.d.ts +3 -0
- package/dist/drive/secrets.js +31 -21
- package/dist/drive/state.d.ts +2 -0
- package/dist/drive/state.js +11 -0
- package/dist/drive/walk.d.ts +39 -0
- package/dist/drive/walk.js +112 -0
- package/dist/drive/watcher.d.ts +28 -0
- package/dist/drive/watcher.js +255 -0
- package/dist/kinds/flow/kind.js +2 -2
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/types.d.ts +1 -0
- package/dist/record/flow.d.ts +38 -0
- package/dist/record/flow.js +88 -0
- package/dist/record/index.d.ts +6 -0
- package/dist/record/index.js +5 -0
- package/dist/record/keys.d.ts +24 -0
- package/dist/record/keys.js +92 -0
- package/dist/record/page.d.ts +47 -0
- package/dist/record/page.js +188 -0
- package/dist/record/person.d.ts +22 -0
- package/dist/record/person.js +286 -0
- package/dist/record/taking.d.ts +39 -0
- package/dist/record/taking.js +214 -0
- package/dist/record/walked.d.ts +10 -0
- package/dist/record/walked.js +59 -0
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -0
- package/llms.txt +3 -2
- package/package.json +1 -1
- package/schema/v1/flow.schema.json +4 -0
- package/schema/v1/record.schema.json +64 -0
- package/schema/v1/samples/record.json +20 -0
- package/skill/rehearse/SKILL.md +14 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { isRole } from '../drive/index.js';
|
|
2
|
+
import { NOT_PLAIN_NOTE, PASSWORD, PASSWORD_NOTE, UNSEEN, UNSEEN_NOTE } from './flow.js';
|
|
3
|
+
import { keyOf } from './keys.js';
|
|
4
|
+
const either = (now, before) => now === 'many' || before === 'many' ? 'many' : now === 'one' || before === 'one' ? 'one' : 'none';
|
|
5
|
+
const after = (n) => (n === 0 ? 'Before the first step' : `After step ${n}`);
|
|
6
|
+
export const sameNameWords = (role, name) => `More than one ${role} is named “${name}”, so the flow can’t tell them apart and stops here: give each its own name, then run it.`;
|
|
7
|
+
export const namelessWords = (n) => `${after(n)}, a click on something with no role and name was left out: give it one, such as a button with words in it, and record again.`;
|
|
8
|
+
export const unknownKeyWords = (n, key) => `${after(n)}, the key ${key} was left out: a flow presses keys as Playwright names them, and this isn't one.`;
|
|
9
|
+
export const namelessFieldWords = (n, chars) => `${after(n)}, ${chars === null ? 'text was' : `${chars} character${chars === 1 ? ' was' : 's were'}`} typed into a field with no name, and left out: give the field a label, and record again.`;
|
|
10
|
+
export const frameWords = (n, name) => `${after(n)}, you used ${name ? `the frame “${name}”` : 'a frame'}: Rehearse can’t see inside a frame, so what you did there was left out.`;
|
|
11
|
+
export const LONG_NOTE = `The text was longer than 100,000 characters, so Rehearse didn’t record it: write what the flow types in place of ${UNSEEN}.`;
|
|
12
|
+
export const repeatedWords = (field, label) => `More than one option of “${field}” is labelled ${label === null ? 'as the chosen one is' : `“${label}”`}, so the flow chooses the first: give each its own label.`;
|
|
13
|
+
export const severalWords = (field, label) => `“${field}” had more than one option chosen, and a fill chooses one: the flow keeps ${label === null ? 'the first' : `“${label}”`}.`;
|
|
14
|
+
const joined = (...notes) => [...new Set(notes.filter((n) => Boolean(n)))].join(' ') || null;
|
|
15
|
+
const textFor = (f, value) => f.secret ? PASSWORD : !f.plain || f.long || value === null ? UNSEEN : value;
|
|
16
|
+
const notesFor = (f) => joined(f.same, f.secret && PASSWORD_NOTE, !f.secret && !f.plain && NOT_PLAIN_NOTE, !f.secret && f.long && LONG_NOTE);
|
|
17
|
+
export class Taking {
|
|
18
|
+
taken = [];
|
|
19
|
+
notes = [];
|
|
20
|
+
folding = null;
|
|
21
|
+
fields = new Map();
|
|
22
|
+
texts = [];
|
|
23
|
+
nameless = [];
|
|
24
|
+
secretIdentities = new Set();
|
|
25
|
+
secretFields = new Set();
|
|
26
|
+
choices = [];
|
|
27
|
+
pick;
|
|
28
|
+
told;
|
|
29
|
+
constructor(pick, told = () => undefined) {
|
|
30
|
+
this.pick = pick;
|
|
31
|
+
this.told = told;
|
|
32
|
+
}
|
|
33
|
+
push(taken, folding) {
|
|
34
|
+
this.taken.push(taken);
|
|
35
|
+
this.folding = folding && { ...folding, taken };
|
|
36
|
+
this.told(taken.step);
|
|
37
|
+
}
|
|
38
|
+
known(field, identities) {
|
|
39
|
+
return this.secretFields.has(field) || identities.some((i) => this.secretIdentities.has(i));
|
|
40
|
+
}
|
|
41
|
+
async named(role, name, before) {
|
|
42
|
+
const known = isRole(role) ? role : null;
|
|
43
|
+
const alone = either(await this.pick(name, null), before(name, null));
|
|
44
|
+
if (alone === 'one' || !known)
|
|
45
|
+
return { note: alone === 'many' ? sameNameWords(known ?? 'element', name) : null };
|
|
46
|
+
const narrowed = alone === 'many' ? either(await this.pick(name, known), before(name, known)) : 'none';
|
|
47
|
+
return { role: known, note: narrowed === 'many' ? sameNameWords(known, name) : null };
|
|
48
|
+
}
|
|
49
|
+
sharesItsName(role, name, field) {
|
|
50
|
+
const key = `${role}\0${name}`;
|
|
51
|
+
const all = this.fields.get(key) ?? new Set();
|
|
52
|
+
all.add(field);
|
|
53
|
+
this.fields.set(key, all);
|
|
54
|
+
return all.size > 1 ? sameNameWords(isRole(role) ? role : 'element', name) : null;
|
|
55
|
+
}
|
|
56
|
+
fieldKeys() {
|
|
57
|
+
return [
|
|
58
|
+
...this.texts.map((t) => t.about.field),
|
|
59
|
+
...this.choices.map((c) => c.field),
|
|
60
|
+
...this.nameless.map((n) => n.field),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
becameSecret(field, identities) {
|
|
64
|
+
if (field)
|
|
65
|
+
this.secretFields.add(field);
|
|
66
|
+
for (const i of identities)
|
|
67
|
+
this.secretIdentities.add(i);
|
|
68
|
+
for (const t of this.texts)
|
|
69
|
+
if (!t.about.secret && this.known(t.about.field, t.about.identities)) {
|
|
70
|
+
t.about.secret = true;
|
|
71
|
+
t.taken.step.with = PASSWORD;
|
|
72
|
+
t.taken.note = notesFor(t.about);
|
|
73
|
+
}
|
|
74
|
+
for (const c of this.choices)
|
|
75
|
+
if (!c.secret && this.known(c.field, c.identities)) {
|
|
76
|
+
c.secret = true;
|
|
77
|
+
c.value = '';
|
|
78
|
+
this.chosen(c);
|
|
79
|
+
}
|
|
80
|
+
for (const n of this.nameless)
|
|
81
|
+
if (n.chars !== null && this.known(n.field, n.identities)) {
|
|
82
|
+
n.chars = null;
|
|
83
|
+
this.notes[n.note] = namelessFieldWords(n.after, null);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
text(seen, before) {
|
|
87
|
+
const key = `field ${seen.field}`;
|
|
88
|
+
const now = this.folding?.field === key ? this.folding : null;
|
|
89
|
+
const secret = seen.secret || this.known(seen.field, seen.identities);
|
|
90
|
+
if (secret)
|
|
91
|
+
this.becameSecret(seen.field, seen.identities);
|
|
92
|
+
const about = { secret, plain: seen.plain, long: seen.long === true };
|
|
93
|
+
const chars = secret || !seen.plain || seen.value === null ? null : seen.value.length;
|
|
94
|
+
if (!seen.name) {
|
|
95
|
+
if (now?.nameless !== null && now?.nameless !== undefined) {
|
|
96
|
+
const n = this.nameless[now.nameless];
|
|
97
|
+
n.chars = chars;
|
|
98
|
+
this.notes[n.note] = namelessFieldWords(n.after, chars);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.notes.push(namelessFieldWords(this.taken.length, chars));
|
|
102
|
+
this.nameless.push({
|
|
103
|
+
note: this.notes.length - 1,
|
|
104
|
+
after: this.taken.length,
|
|
105
|
+
chars,
|
|
106
|
+
field: seen.field,
|
|
107
|
+
identities: seen.identities,
|
|
108
|
+
});
|
|
109
|
+
this.folding = { field: key, taken: null, nameless: this.nameless.length - 1 };
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const folded = now?.taken ? this.texts.find((t) => t.taken === now.taken) : undefined;
|
|
113
|
+
if (folded) {
|
|
114
|
+
Object.assign(folded.about, about, { secret: folded.about.secret || secret });
|
|
115
|
+
folded.taken.step.with = textFor(folded.about, seen.value);
|
|
116
|
+
folded.taken.note = notesFor(folded.about);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return this.newText(seen, before, about);
|
|
120
|
+
}
|
|
121
|
+
async newText(seen, before, about) {
|
|
122
|
+
const { role, note } = await this.named(seen.role, seen.name, before);
|
|
123
|
+
const field = {
|
|
124
|
+
field: seen.field,
|
|
125
|
+
identities: seen.identities,
|
|
126
|
+
same: joined(note, this.sharesItsName(seen.role, seen.name, seen.field), seen.nameNote ?? null),
|
|
127
|
+
...about,
|
|
128
|
+
};
|
|
129
|
+
const taken = {
|
|
130
|
+
step: { fill: seen.name, ...(role && { role }), with: textFor(field, seen.value) },
|
|
131
|
+
note: notesFor(field),
|
|
132
|
+
};
|
|
133
|
+
this.texts.push({ taken, about: field });
|
|
134
|
+
this.push(taken, { field: `field ${seen.field}`, nameless: null });
|
|
135
|
+
}
|
|
136
|
+
chosen(c) {
|
|
137
|
+
const label = c.secret ? null : c.value;
|
|
138
|
+
c.taken.step.with = c.secret ? PASSWORD : c.value;
|
|
139
|
+
c.taken.note = joined(c.same, c.secret && PASSWORD_NOTE, c.repeated && repeatedWords(c.name, label), c.several && severalWords(c.name, label));
|
|
140
|
+
}
|
|
141
|
+
async choice(seen, before) {
|
|
142
|
+
const key = `field ${seen.field}`;
|
|
143
|
+
const secret = seen.secret || this.known(seen.field, seen.identities);
|
|
144
|
+
if (secret)
|
|
145
|
+
this.becameSecret(seen.field, seen.identities);
|
|
146
|
+
const now = { secret, value: secret ? '' : seen.value, repeated: seen.repeated, several: seen.several };
|
|
147
|
+
const folded = this.folding?.field === key ? this.choices.find((c) => c.taken === this.folding?.taken) : null;
|
|
148
|
+
if (folded) {
|
|
149
|
+
Object.assign(folded, now, { secret: folded.secret || secret });
|
|
150
|
+
this.chosen(folded);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const { role, note } = await this.named(seen.role, seen.name, before);
|
|
154
|
+
const c = {
|
|
155
|
+
taken: { step: { fill: seen.name, ...(role && { role }) }, note: null },
|
|
156
|
+
field: seen.field,
|
|
157
|
+
identities: seen.identities,
|
|
158
|
+
name: seen.name,
|
|
159
|
+
same: joined(note, seen.nameNote ?? null),
|
|
160
|
+
...now,
|
|
161
|
+
};
|
|
162
|
+
this.chosen(c);
|
|
163
|
+
this.choices.push(c);
|
|
164
|
+
this.push(c.taken, { field: key, nameless: null });
|
|
165
|
+
}
|
|
166
|
+
unseen() {
|
|
167
|
+
if (this.folding?.field !== 'unseen')
|
|
168
|
+
this.push({ step: { type: UNSEEN }, note: UNSEEN_NOTE }, { field: 'unseen', nameless: null });
|
|
169
|
+
}
|
|
170
|
+
async take(seen, before = () => null) {
|
|
171
|
+
switch (seen.kind) {
|
|
172
|
+
case 'click': {
|
|
173
|
+
if (!seen.name) {
|
|
174
|
+
this.folding = null;
|
|
175
|
+
this.notes.push(namelessWords(this.taken.length));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const { role, note } = await this.named(seen.role, seen.name, before);
|
|
179
|
+
this.push({ step: { click: seen.name, ...(role && { role }) }, note: joined(note, seen.nameNote ?? null) }, null);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
case 'text':
|
|
183
|
+
return this.text(seen, before);
|
|
184
|
+
case 'choice':
|
|
185
|
+
return this.choice(seen, before);
|
|
186
|
+
case 'secret':
|
|
187
|
+
this.becameSecret(seen.key, seen.identities);
|
|
188
|
+
return;
|
|
189
|
+
case 'unseen':
|
|
190
|
+
this.unseen();
|
|
191
|
+
return;
|
|
192
|
+
case 'frame':
|
|
193
|
+
this.folding = null;
|
|
194
|
+
this.notes.push(frameWords(this.taken.length, seen.name));
|
|
195
|
+
return;
|
|
196
|
+
case 'key': {
|
|
197
|
+
const key = keyOf(seen);
|
|
198
|
+
if (key.as === 'nothing')
|
|
199
|
+
return;
|
|
200
|
+
if (key.as === 'unknown') {
|
|
201
|
+
this.folding = null;
|
|
202
|
+
this.notes.push(unknownKeyWords(this.taken.length, key.key));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (key.as === 'text') {
|
|
206
|
+
this.unseen();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.push({ step: { key: key.key }, note: null }, null);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Walk } from '../drive/index.ts';
|
|
2
|
+
import { type FlowHead, type Taken } from './flow.ts';
|
|
3
|
+
export interface FromTheWalk {
|
|
4
|
+
head: Omit<FlowHead, 'name'>;
|
|
5
|
+
taken: Taken[];
|
|
6
|
+
notes: string[];
|
|
7
|
+
failed: number;
|
|
8
|
+
looks: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function fromTheWalk(walk: Walk): FromTheWalk;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DRIVER_NOTE, PASSWORD, PASSWORD_NOTE, PENDING_NOTE, TOKEN_NOTE, TRIMMED_NOTE, UNSEEN, UNSEEN_NOTE, } from './flow.js';
|
|
2
|
+
const role = (r) => (r ? { role: r } : {});
|
|
3
|
+
function textOf(w, typed, driver) {
|
|
4
|
+
const hidden = {
|
|
5
|
+
password: { text: PASSWORD, note: PASSWORD_NOTE },
|
|
6
|
+
unseen: { text: UNSEEN, note: driver === 'service' ? DRIVER_NOTE : UNSEEN_NOTE },
|
|
7
|
+
token: { text: UNSEEN, note: TOKEN_NOTE },
|
|
8
|
+
pending: { text: UNSEEN, note: PENDING_NOTE },
|
|
9
|
+
};
|
|
10
|
+
return w.hid ? hidden[w.hid] : { text: typed, note: null };
|
|
11
|
+
}
|
|
12
|
+
function takenOf(w, driver) {
|
|
13
|
+
const c = w.command;
|
|
14
|
+
switch (c.command) {
|
|
15
|
+
case 'click':
|
|
16
|
+
return { step: { click: c.name, ...role(c.role) }, note: null };
|
|
17
|
+
case 'fill': {
|
|
18
|
+
const { text, note } = textOf(w, c.text, driver);
|
|
19
|
+
return { step: { fill: c.name, ...role(c.role), with: text }, note, fillsIn: w.fillsIn === true };
|
|
20
|
+
}
|
|
21
|
+
case 'type': {
|
|
22
|
+
const { text, note } = textOf(w, c.text, driver);
|
|
23
|
+
return { step: { type: text }, note };
|
|
24
|
+
}
|
|
25
|
+
case 'key':
|
|
26
|
+
return { step: { key: c.key }, note: null };
|
|
27
|
+
case 'snapshot':
|
|
28
|
+
return c.name ? { step: { snapshot: c.name, ...role(c.role) }, note: null } : null;
|
|
29
|
+
default:
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function fromTheWalk(walk) {
|
|
34
|
+
const out = {
|
|
35
|
+
head: {
|
|
36
|
+
service: walk.began.service,
|
|
37
|
+
piece: walk.began.piece,
|
|
38
|
+
start: walk.began.start,
|
|
39
|
+
world: walk.began.world,
|
|
40
|
+
person: walk.began.person,
|
|
41
|
+
},
|
|
42
|
+
taken: [],
|
|
43
|
+
notes: walk.began.trimmed ? [TRIMMED_NOTE] : [],
|
|
44
|
+
failed: 0,
|
|
45
|
+
looks: 0,
|
|
46
|
+
};
|
|
47
|
+
for (const w of walk.steps) {
|
|
48
|
+
if (!w.ok) {
|
|
49
|
+
out.failed += 1;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const taken = takenOf(w, walk.began.driver);
|
|
53
|
+
if (taken)
|
|
54
|
+
out.taken.push(taken);
|
|
55
|
+
else
|
|
56
|
+
out.looks += 1;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ErrorObject, type ValidateFunction } from 'ajv/dist/2020.js';
|
|
2
2
|
export declare const SCHEMA_DIR: string;
|
|
3
|
-
export declare const SCHEMAS: readonly ['manifest', 'flow', 'file-scenario', 'announce', 'services', 'people', 'worlds', 'list', 'observation', 'comparison', 'drive', 'open', 'stage', 'static', 'try', 'error', 'dependents', 'check', 'init', 'validate', 'up', 'clean'];
|
|
3
|
+
export declare const SCHEMAS: readonly ['manifest', 'flow', 'file-scenario', 'announce', 'services', 'people', 'worlds', 'list', 'observation', 'comparison', 'drive', 'open', 'stage', 'static', 'try', 'error', 'dependents', 'check', 'init', 'validate', 'up', 'clean', 'record'];
|
|
4
4
|
export type SchemaName = (typeof SCHEMAS)[number];
|
|
5
5
|
export declare const schemaId: (name: SchemaName | 'common') => string;
|
|
6
6
|
export declare function validatorOf(name: SchemaName): ValidateFunction;
|
package/dist/schema.js
CHANGED
package/llms.txt
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
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>] [--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.
|
|
14
14
|
- `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.
|
|
15
15
|
- `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.
|
|
16
|
+
- `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.
|
|
16
17
|
- `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).
|
|
17
18
|
- `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.
|
|
18
19
|
- `rehearse open <scenario> [--json]`: the stage's address for a scenario (schema open), starting the stage if none runs.
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
## Kinds
|
|
24
25
|
|
|
25
26
|
- piece: Storybook CSF beside the component. Id `<file>#<Export>`. Rendered in the package's own Vite and React with the preview; Storybook hooks and storybook/test are shimmed; play is not run. Observed: accessibility tree, errors, axe violations (screenshot kept as an artifact).
|
|
26
|
-
- flow: `*.flow.yaml` (name, service or piece, start, world, person, steps) or a reach module `export default {name, steps}` read as data. Steps: `{click: name, role?}`, `{fill: name, with: text}
|
|
27
|
+
- flow: `*.flow.yaml` (name, service or piece, start, world, person, steps) or a reach module `export default {name, steps}` read as data. Steps: `{click: name, role?}`, `{fill: name, with: text, literal?}` (in a select, the option's label; literal: true types with as written, not filling {{token}}), `{type: text}`, `{key: Enter}`, `{snapshot: name, role?}`. Observed: the tree after each step. A service with `drive:` is driven through its own driver.
|
|
27
28
|
- call: Hurl's plain part. Each call is a scenario named by the comment above it: `<file>#<name>`. `Authorization: Bearer {{person}}` sends as that person; none is nobody. `{{api}}` is the calls service's URL.
|
|
28
29
|
- file: `*.rehearse.yaml` with input (file, or a command writing {{input}}), run (writing into {{output}}), output (file, layout csv|tsv|json|lines|fixed|zip; zip entries by glob: csv|tsv|json|lines|zip|skip).
|
|
29
30
|
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
## Schemas (schema/v1/)
|
|
38
39
|
|
|
39
40
|
- manifest.schema.json: rehearse.yaml. flow.schema.json: *.flow.yaml. file-scenario.schema.json: *.rehearse.yaml. announce.schema.json: announcements, and what `rehearse announce --json` prints.
|
|
40
|
-
- check, init, services, people, worlds, list, up, observation, comparison, drive, open, static, try, clean, validate, error: one per command's --json output, each with a sample in schema/v1/samples/.
|
|
41
|
+
- check, init, services, people, worlds, list, up, observation, comparison, drive, record, open, static, try, clean, validate, error: one per command's --json output, each with a sample in schema/v1/samples/.
|
|
41
42
|
- dependents.schema.json: what Rehearse reads from an import graph (`ashlar dependents <files> --json`, or the manifest's affected.graph).
|
|
42
43
|
- Within v1 an output only gains optional fields, and open string fields may gain values: readers ignore what they don't know.
|
|
43
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurvball/rehearse",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.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": {
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
},
|
|
105
105
|
"with": {
|
|
106
106
|
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"literal": {
|
|
109
|
+
"description": "Fills with as it is written: {{token}} in it is typed as those characters, not filled in. rehearse record writes it for recorded text that holds {{…}}.",
|
|
110
|
+
"type": "boolean"
|
|
107
111
|
}
|
|
108
112
|
},
|
|
109
113
|
"additionalProperties": false
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://rehearse.kurvball.ca/schema/v1/record.schema.json",
|
|
4
|
+
"title": "Rehearse v1: rehearse record --json",
|
|
5
|
+
"description": "The flow rehearse record wrote: its file, its steps, and what to check in it before you rely on it.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["v", "file", "from", "replaced", "steps", "warnings"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"v": {
|
|
10
|
+
"$ref": "common.schema.json#/$defs/v"
|
|
11
|
+
},
|
|
12
|
+
"file": {
|
|
13
|
+
"description": "The flow file written, as an absolute path.",
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"from": {
|
|
17
|
+
"description": "Where the steps came from: drive, the steps a drive took (--from-drive); person, what a person did in Rehearse's browser.",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"examples": ["drive", "person"]
|
|
20
|
+
},
|
|
21
|
+
"replaced": {
|
|
22
|
+
"description": "Whether it replaced a file that was there (--force).",
|
|
23
|
+
"type": "boolean"
|
|
24
|
+
},
|
|
25
|
+
"steps": {
|
|
26
|
+
"description": "The flow's steps as written, each one step of flow.schema.json: click, fill, type, key or snapshot, with its role and with.",
|
|
27
|
+
"type": "array",
|
|
28
|
+
"minItems": 1,
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "object"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"warnings": {
|
|
34
|
+
"description": "What to check in the flow: a password left out, a name more than one element has, a step left out.",
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"$ref": "#/$defs/warning"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"$defs": {
|
|
42
|
+
"warning": {
|
|
43
|
+
"description": "One thing to check in the flow, pointing to its line.",
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["line", "step", "says"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"line": {
|
|
48
|
+
"description": "The line of the file it is about, or null when it is about no one step.",
|
|
49
|
+
"type": ["integer", "null"],
|
|
50
|
+
"minimum": 1
|
|
51
|
+
},
|
|
52
|
+
"step": {
|
|
53
|
+
"description": "The step it is about, counted from 1, or null.",
|
|
54
|
+
"type": ["integer", "null"],
|
|
55
|
+
"minimum": 1
|
|
56
|
+
},
|
|
57
|
+
"says": {
|
|
58
|
+
"description": "What to check, and what to do, in plain words.",
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"v": 1,
|
|
3
|
+
"file": "/work/web/flows/save-account.flow.yaml",
|
|
4
|
+
"from": "drive",
|
|
5
|
+
"replaced": false,
|
|
6
|
+
"steps": [
|
|
7
|
+
{ "fill": "Email", "with": "ada@example.test" },
|
|
8
|
+
{ "fill": "Password", "with": "<password>" },
|
|
9
|
+
{ "fill": "Plan", "with": "Team" },
|
|
10
|
+
{ "click": "Save" },
|
|
11
|
+
{ "snapshot": "Account", "role": "status" }
|
|
12
|
+
],
|
|
13
|
+
"warnings": [
|
|
14
|
+
{
|
|
15
|
+
"line": 9,
|
|
16
|
+
"step": 2,
|
|
17
|
+
"says": "Rehearse never records what is typed in a password field, or in one that may hold a secret: write what this flow types there in place of <password>."
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/skill/rehearse/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rehearse
|
|
3
|
-
description: Use in a repository with a rehearse.yaml, or when asked to try, compare, prove or check a change before it ships, write piece/flow/call/file scenarios, or drive a running product step by step. Teaches Rehearse's commands and MCP tools, its scenario formats, how to read a comparison's verdicts, and how to announce what a change meant before pushing it.
|
|
3
|
+
description: Use in a repository with a rehearse.yaml, or when asked to try, compare, prove or check a change before it ships, write piece/flow/call/file scenarios, or drive a running product step by step and save the walk as a flow. Teaches Rehearse's commands and MCP tools, its scenario formats, how to read a comparison's verdicts, and how to announce what a change meant before pushing it.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Rehearse
|
|
@@ -194,6 +194,19 @@ rehearse drive stop --json
|
|
|
194
194
|
A result is `{ok, command, ms, file, tree}` or `{ok: false, failure, says}`. On `not_found`, `says` lists the names
|
|
195
195
|
close to the one you asked for. Exit 0 done, 1 failed, 2 usage.
|
|
196
196
|
|
|
197
|
+
When the walk shows something worth keeping, save it as a flow, then run it:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
rehearse record flows/two-pens.flow.yaml --from-drive --json # the steps the current or latest drive took
|
|
201
|
+
rehearse run flows/two-pens.flow.yaml --json
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
It keeps each click, fill, type and key that worked, and each `snapshot --name` as a check that the element is there;
|
|
205
|
+
it leaves out failed steps and looks. Read `warnings`: each points to a `line` of the file. Rehearse keeps typed text
|
|
206
|
+
only for plain fields it can see: a secret field is written as `<password>`, anything else as `<not recorded>`. Put
|
|
207
|
+
the real text there. Two elements with one name stop the flow: give each its own name. It refuses
|
|
208
|
+
with code `exists` when the file is there (`--force` replaces it), and `no_steps` when there is nothing to keep.
|
|
209
|
+
|
|
197
210
|
## 7. Show a person
|
|
198
211
|
|
|
199
212
|
```bash
|