@turri-dev/cli 0.2.4-next.636a651 → 0.2.4-next.bc1fc47
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 -1
- package/dist/conform-cli.js +13 -2
- package/dist/extension.js +32 -26
- package/dist/loop-tools.d.ts +2 -2
- package/dist/loop-tools.js +2 -2
- package/dist/regenerate/cases.js +7 -0
- package/dist/regenerate/drift.d.ts +4 -0
- package/dist/regenerate/drift.js +26 -6
- package/dist/regenerate/loop.d.ts +9 -0
- package/dist/regenerate/loop.js +103 -10
- package/dist/regenerate/records.d.ts +11 -0
- package/dist/regenerate/records.js +15 -0
- package/dist/regenerate/renames.js +4 -4
- package/dist/regenerate/requires.d.ts +7 -0
- package/dist/regenerate/requires.js +24 -18
- package/dist/regenerate/spec-map.js +3 -3
- package/docs/headless.md +1 -0
- package/docs/regenerating.md +7 -1
- package/docs/using.md +4 -4
- package/genome/rules/turri-regeneration.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ That is what regenerative software asks of software, and what **turri** does:
|
|
|
121
121
|
| Every cell can become another, and it is still the same jellyfish. | Every line of code can be replaced, and it is still the same software - because what it is never lived in the code. |
|
|
122
122
|
| It can do it again and again, for as long as it lives. | The code can be regenerated whenever \*\*\*plain changes or a model gets better, for as long as \*\*\*plain is kept. |
|
|
123
123
|
|
|
124
|
-
So the tools speak its language: **`regenerate`** regenerates the code from \*\*\*plain as it is now - or the functionalities you name, though nothing changed, or all of it from scratch - **`drift`** says how far the code has moved from it, and
|
|
124
|
+
So the tools speak its language: **`regenerate`** regenerates the code from \*\*\*plain as it is now - or the functionalities you name, though nothing changed, or all of it from scratch - **`drift`** says how far the code has moved from it, and **`/lineage`** shows every generation of a module and what each was regenerated from.
|
|
125
125
|
|
|
126
126
|
## Models
|
|
127
127
|
|
package/dist/conform-cli.js
CHANGED
|
@@ -8,22 +8,32 @@ exactly their conformance and acceptance scenarios, following the spec's test re
|
|
|
8
8
|
the module inherits, a failure fixed in the test or the code, whichever is wrong. A functional spec with
|
|
9
9
|
no scenarios is refused: write them first. So is a module with no test reqs, or no conformance testing
|
|
10
10
|
script for its stack: the refusal names the next step. Every functional spec tested goes in one pulse,
|
|
11
|
-
as far as the size guardrail lets.
|
|
11
|
+
as far as the size guardrail lets. A functional spec named whose tests are written has them written
|
|
12
|
+
again: deleted and written anew from its scenarios, its code untouched.
|
|
12
13
|
|
|
13
14
|
--one-by-one a pulse a functional spec instead
|
|
15
|
+
--from-scratch take out the tests folder where the module's code lives - the tip of its chain - (its
|
|
16
|
+
lineage keeps it) and write the tests again, starting from a copy of the tests of the
|
|
17
|
+
module the tip requires; the code untouched
|
|
18
|
+
--from-scratch-chain the same, starting from nothing: every functional spec of the chain's tests written again
|
|
14
19
|
--harness-model <p/id> config.turri.yaml's harness-model for this run: the planner, a diagnosis
|
|
15
20
|
--coding-model <p/id> its coding-model, --model too: the agents that build
|
|
16
21
|
--judge-model <p/id> its judge-model: the judge and the test review
|
|
17
22
|
--review <true|false> its review: whether the code and its tests are reviewed once they pass
|
|
18
23
|
--build-dir <dir> as the run ends, export the code there (see turri regenerate --help)
|
|
19
24
|
--report <file.json> write a report of the run there (see turri regenerate --help)`;
|
|
20
|
-
const { positional, options } = parseArgs(process.argv.slice(2), ["--one-by-one"], USAGE, ["--build-dir", "--report", "--harness-model", "--judge-model", "--review"]);
|
|
25
|
+
const { positional, options } = parseArgs(process.argv.slice(2), ["--one-by-one", "--from-scratch", "--from-scratch-chain"], USAGE, ["--build-dir", "--report", "--harness-model", "--judge-model", "--review"]);
|
|
21
26
|
const { report, buildDir } = headlessOptions(options);
|
|
22
27
|
const [plainFile, ...funcIds] = positional;
|
|
23
28
|
if (plainFile === undefined) {
|
|
24
29
|
console.error(USAGE);
|
|
25
30
|
process.exit(1);
|
|
26
31
|
}
|
|
32
|
+
const scratch = options["from-scratch-chain"] !== undefined ? "chain" : options["from-scratch"] !== undefined ? "module" : undefined;
|
|
33
|
+
if (scratch !== undefined && funcIds.length > 0) {
|
|
34
|
+
console.error(`Name functional specs or --from-scratch${scratch === "chain" ? "-chain" : ""}, not both: from scratch writes every one of them again.`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
27
37
|
runLoop({
|
|
28
38
|
plainFile,
|
|
29
39
|
...(buildDir !== undefined ? { buildDir } : {}),
|
|
@@ -32,6 +42,7 @@ runLoop({
|
|
|
32
42
|
ask: (loop) => loop.conformance(plainFile, {
|
|
33
43
|
...(funcIds.length > 0 ? { funcIds } : {}),
|
|
34
44
|
...(options["one-by-one"] !== undefined ? { separately: true } : {}),
|
|
45
|
+
...(scratch !== undefined ? { fromScratch: scratch } : {}),
|
|
35
46
|
}),
|
|
36
47
|
}).catch((error) => {
|
|
37
48
|
console.error(error instanceof Error ? error.message : error);
|
package/dist/extension.js
CHANGED
|
@@ -52,7 +52,7 @@ import { createSpecMapSource, defaultMapFiles } from "./regenerate/spec-map.js";
|
|
|
52
52
|
import { createSpecMapState } from "./regenerate/spec-map-view.js";
|
|
53
53
|
import { createJobsTreeState, selectJob } from "./regenerate/jobs-tree.js";
|
|
54
54
|
import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
|
|
55
|
-
import { HISTORY_DIR, historyLog
|
|
55
|
+
import { HISTORY_DIR, historyLog } from "./regenerate/lineage.js";
|
|
56
56
|
import { defaultBuildDir } from "./regenerate/paths.js";
|
|
57
57
|
import { describeTurnIncident, describeUsage, JobStoppedError, onModelEvent } from "./regenerate/activity.js";
|
|
58
58
|
import { ledgerWanted, startLedger } from "./regenerate/ledger.js";
|
|
@@ -1346,7 +1346,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1346
1346
|
// them is asking for them on: off, they are turned on first. What would start nothing is found before anything is
|
|
1347
1347
|
// said, and the chat's agent answers it at once.
|
|
1348
1348
|
pi.registerCommand("conform", {
|
|
1349
|
-
description: "Write and run a module's conformance tests now - the functional specs named, or every one with scenarios - in one pulse, or one a functional spec when asked; turned on first when they are off: /conform [module | file.plain] [module:func-id ...] [one by one]",
|
|
1349
|
+
description: "Write and run a module's conformance tests now - the functional specs named, or every one with scenarios - in one pulse, or one a functional spec when asked; those written already written again, named, or from scratch - the tests folder at the tip of its chain taken out, started again from the module it requires, or from nothing with whole chain; turned on first when they are off: /conform [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [one by one]",
|
|
1350
1350
|
handler: async (args, ctx) => {
|
|
1351
1351
|
const command = `/conform ${args.trim()}`.trim();
|
|
1352
1352
|
await echoCommand(pi, command);
|
|
@@ -1362,9 +1362,15 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1362
1362
|
const { funcIds, rest } = funcIdsNamedFirst(picked.rest);
|
|
1363
1363
|
const words = rest.join(" ").trim();
|
|
1364
1364
|
const separately = asksOneByOne(words);
|
|
1365
|
-
//
|
|
1366
|
-
|
|
1367
|
-
|
|
1365
|
+
// From scratch - the tests written again, the code untouched - asked in the person's words; the whole chain's with it.
|
|
1366
|
+
const scratch = asksFromScratch(words) ? (asksWholeChain(words) ? "chain" : "module") : undefined;
|
|
1367
|
+
// Nothing but the functional specs, from scratch and one by one: no planner reads guidance here, so other words are not dropped unsaid.
|
|
1368
|
+
if (words !== "" && !separately && scratch === undefined) {
|
|
1369
|
+
refuse(`/conform takes functional specs, each as module:func-id, "from scratch" with "whole chain" and "one by one" - not "${words}". Nothing was started.`);
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
if (scratch !== undefined && funcIds.length > 0) {
|
|
1373
|
+
refuse("Name functional specs or ask for the conformance tests from scratch, not both: from scratch writes every one of them again. Nothing was started.");
|
|
1368
1374
|
return;
|
|
1369
1375
|
}
|
|
1370
1376
|
// Off: turned on - written where the module's value comes from, every chat's tools switched - and said with what follows.
|
|
@@ -1393,7 +1399,10 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1393
1399
|
}
|
|
1394
1400
|
const module = basename(plainFile).replace(/\.plain$/, "");
|
|
1395
1401
|
const model = jobModel(ctx, "spec_changes", undefined, plainFile);
|
|
1396
|
-
|
|
1402
|
+
const starting = scratch !== undefined
|
|
1403
|
+
? `Writing ${module}'s conformance tests${scratch === "chain" ? " and its whole chain's" : ""} again from scratch…`
|
|
1404
|
+
: `Starting ${funcIds.length > 0 ? `the conformance tests of ${funcIds.join(", ")}` : `${module}'s conformance tests`}…`;
|
|
1405
|
+
shownAfterCommand(pi, ctx, command, withTurnedOn(starting), "info", true);
|
|
1397
1406
|
await nextFrame();
|
|
1398
1407
|
// In the background, as /regenerate: a codebase built on the module may be stopped and deleted first.
|
|
1399
1408
|
void (async () => {
|
|
@@ -1402,6 +1411,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1402
1411
|
...(funcIds.length > 0 ? { funcIds } : {}),
|
|
1403
1412
|
...(model !== undefined ? { model } : {}),
|
|
1404
1413
|
...(separately ? { separately: true } : {}),
|
|
1414
|
+
...(scratch !== undefined ? { fromScratch: scratch } : {}),
|
|
1405
1415
|
}));
|
|
1406
1416
|
// Nothing to write: said in the loop's words - "up to date" alone speaks of the code, not its tests.
|
|
1407
1417
|
const upToDate = statuses.length > 0 && statuses.every(isUpToDate);
|
|
@@ -1433,7 +1443,10 @@ function conformTool(options) {
|
|
|
1433
1443
|
"conformance and acceptance scenarios, at least one test each, by the spec's test reqs, runs them with the whole suite " +
|
|
1434
1444
|
"the module inherits, and, where one fails, fixes the test or the code, whichever is wrong. What they are written for is " +
|
|
1435
1445
|
"recorded apart from the code. The work loop starts these pulses by itself for every functional spec with scenarios whose " +
|
|
1436
|
-
"tests are behind, once the module's code is built; conform starts them now, or for the functional specs named - those alone: the module's others stay behind until conform names none, or the module is regenerated.
|
|
1446
|
+
"tests are behind, once the module's code is built; conform starts them now, or for the functional specs named - those alone: the module's others stay behind until conform names none, or the module is regenerated. " +
|
|
1447
|
+
"A functional spec named whose tests are written already has them written again - deleted and written anew from its " +
|
|
1448
|
+
"scenarios, its code untouched; with from_scratch, the module's whole tests folder is taken out and written again, at " +
|
|
1449
|
+
"the tip of each chain it is built in, as regenerate from scratch does its code. A " +
|
|
1437
1450
|
"functional spec with no scenarios - no test plain file - is refused: there is nothing to test until scenarios " +
|
|
1438
1451
|
"are written. So is one the spec does not have, and a module with scenarios that skipped a step of adding tests - " +
|
|
1439
1452
|
"no test reqs, or no conformance testing script for its stack: the refusal names the next step. While conformance tests " +
|
|
@@ -1445,11 +1458,19 @@ function conformTool(options) {
|
|
|
1445
1458
|
"Call conform when the user asks for the conformance tests to be written or run now, for a module or some of its functional specs with scenarios.",
|
|
1446
1459
|
"What the user asks for comes first: for a module already regenerated, while a module built on it is being regenerated, conform stops that pulse, deletes the codebase built on it, writes the tests, and the module above is regenerated from it after - say so. For a module not regenerated yet, its tests are written once its code is built, before anything is built on it.",
|
|
1447
1460
|
"Conformance tests go in one pulse for all the functional specs tested. Set one_by_one only when the user asks for a pulse a functional spec - one at a time, separately, or the like.",
|
|
1461
|
+
"Name a functional spec whose tests are written only when the user asks for its tests to be written again: they are deleted and written anew. Set from_scratch only when the user asks for a module's conformance tests - or its whole chain's - to be written again from scratch, never to fix tests that did not pass. Name funcIds or set from_scratch, not both.",
|
|
1462
|
+
'from_scratch works where the module\'s code lives - the tip of each chain it is built in, never a module in the middle - and takes that codebase\'s whole tests folder out, committed first so its lineage keeps it. "module" starts it again from a copy of the tests of the module the tip requires, and writes the tip\'s own tests anew on them; "chain" starts it from nothing, every functional spec of the chain written anew. Neither touches the code, nor any other codebase.',
|
|
1448
1463
|
],
|
|
1449
1464
|
parameters: Type.Object({
|
|
1450
1465
|
plain_file: Type.String({ description: "A .plain file of the module" }),
|
|
1451
1466
|
working_dir: WORKING_DIR_PARAM,
|
|
1452
|
-
funcIds: Type.Optional(Type.Array(Type.String(), {
|
|
1467
|
+
funcIds: Type.Optional(Type.Array(Type.String(), {
|
|
1468
|
+
description: "The functional specs to test, each as module:func-id (todo:add-task) - each with scenarios; one whose tests are written has them written again. Omitted: every one with scenarios",
|
|
1469
|
+
})),
|
|
1470
|
+
from_scratch: Type.Optional(Type.Union([Type.Literal("module"), Type.Literal("chain")], {
|
|
1471
|
+
description: "Only when the user asks for it: the tests folder where the module's code lives - the tip of its chain - taken out, committed first so its lineage keeps it, and written again from a copy of the tests of the module the tip requires; the code untouched. " +
|
|
1472
|
+
'"chain": written again from nothing - every functional spec of the chain\'s tests',
|
|
1473
|
+
})),
|
|
1453
1474
|
one_by_one: Type.Optional(Type.Boolean({ description: "Only when the user asks for it: a pulse a functional spec. Omitted: every functional spec tested in one pulse, as far as the size guardrail lets" })),
|
|
1454
1475
|
stack: STACK_PARAM,
|
|
1455
1476
|
model: MODEL_PARAM,
|
|
@@ -1473,6 +1494,7 @@ function conformTool(options) {
|
|
|
1473
1494
|
...(params.funcIds !== undefined ? { funcIds: params.funcIds } : {}),
|
|
1474
1495
|
...(model !== undefined ? { model } : {}),
|
|
1475
1496
|
...(params.one_by_one === true ? { separately: true } : {}),
|
|
1497
|
+
...(params.from_scratch !== undefined ? { fromScratch: params.from_scratch } : {}),
|
|
1476
1498
|
});
|
|
1477
1499
|
}
|
|
1478
1500
|
catch (error) {
|
|
@@ -1999,7 +2021,8 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1999
2021
|
"of its codebase - the whole prompt its coding agent will get, from the plan regenerate runs. With plain_file, a look " +
|
|
2000
2022
|
"ahead: that module's work planned as regenerate plans it, steering and all, and kept - nothing started, its pulses waiting " +
|
|
2001
2023
|
"for regenerate, which then runs this plan unless the ***plain or the steering changed - and what is planned listed. " +
|
|
2002
|
-
"What is left to regenerate, without a plan, is drift's."
|
|
2024
|
+
"What is left to regenerate, without a plan, is drift's. Every generation of a module's code and tests is a commit in its " +
|
|
2025
|
+
"history, read with git: git --git-dir=plain_modules/<module>/.plaingit log, and show <commit>.",
|
|
2003
2026
|
promptSnippet: "pulses: every pulse or one - earlier, running or planned - why one did not land, and with plain_file what will run next and its prompt",
|
|
2004
2027
|
promptGuidelines: [
|
|
2005
2028
|
"When a pulse failed or did not land, call pulses with its id before you explain it or change the spec: go by what happened, not by the report alone.",
|
|
@@ -2128,23 +2151,6 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2128
2151
|
pi.appendEntry(HISTORY_ENTRY, { module: name, text: historyLog(defaultBuildDir(name, cwd)) });
|
|
2129
2152
|
},
|
|
2130
2153
|
});
|
|
2131
|
-
pi.registerTool({
|
|
2132
|
-
name: "lineage",
|
|
2133
|
-
label: "Lineage",
|
|
2134
|
-
description: "Read a module's lineage: every generation of its code and tests - each regeneration, conformance run and spec change, " +
|
|
2135
|
-
"with what it was regenerated from - as git commits. Without a commit, the log; with one, that commit in full - its message and " +
|
|
2136
|
-
"the change it made.",
|
|
2137
|
-
promptSnippet: "a module's lineage: what was regenerated into it, and when",
|
|
2138
|
-
parameters: Type.Object({
|
|
2139
|
-
module: Type.String({ description: "The module's name" }),
|
|
2140
|
-
commit: Type.Optional(Type.String({ description: "A commit from the log, to see in full" })),
|
|
2141
|
-
}),
|
|
2142
|
-
async execute(_id, params) {
|
|
2143
|
-
const buildDir = defaultBuildDir(params.module, cwd);
|
|
2144
|
-
const text = params.commit ? historyShow(buildDir, params.commit) : historyLog(buildDir);
|
|
2145
|
-
return { content: [{ type: "text", text }], details: {} };
|
|
2146
|
-
},
|
|
2147
|
-
});
|
|
2148
2154
|
// The side panel: the regeneration - and the pulses behind p - over the whole screen, or beside the chat (s, from one to
|
|
2149
2155
|
// the other). Its key (PANEL_KEY) opens it; the key again closes it and goes back to the chat, as esc does over the
|
|
2150
2156
|
// screen - beside the chat, the key switches sides, giving the keys to the chat or the panel, as esc gives them to the
|
package/dist/loop-tools.d.ts
CHANGED
|
@@ -84,9 +84,9 @@ export interface LoopToolsOptions {
|
|
|
84
84
|
/** Whether a call waits for its work to finish, given what it asked. Default: only when it asked to. */
|
|
85
85
|
wait?: (ctx: ExtensionContext, asked?: boolean) => boolean;
|
|
86
86
|
}
|
|
87
|
-
/** Whether a /regenerate's words ask for the module from scratch
|
|
87
|
+
/** Whether a /regenerate's words ask for the module from scratch - its code deleted, and all of it regenerated again - or a /conform's, for its conformance tests written again. */
|
|
88
88
|
export declare function asksFromScratch(words: string): boolean;
|
|
89
|
-
/** Whether a /regenerate asking for its module from scratch asks for its whole requires chain with it. */
|
|
89
|
+
/** Whether a /regenerate or /conform asking for its module from scratch asks for its whole requires chain with it. */
|
|
90
90
|
export declare function asksWholeChain(words: string): boolean;
|
|
91
91
|
/** regenerate: regenerate a module's code up to its spec as it is now. */
|
|
92
92
|
export declare function regenerateTool(options: LoopToolsOptions & {
|
package/dist/loop-tools.js
CHANGED
|
@@ -208,11 +208,11 @@ function plainFileOf(cwd, given, what) {
|
|
|
208
208
|
refuseTestPlainFile(plainFile);
|
|
209
209
|
return plainFile;
|
|
210
210
|
}
|
|
211
|
-
/** Whether a /regenerate's words ask for the module from scratch
|
|
211
|
+
/** Whether a /regenerate's words ask for the module from scratch - its code deleted, and all of it regenerated again - or a /conform's, for its conformance tests written again. */
|
|
212
212
|
export function asksFromScratch(words) {
|
|
213
213
|
return FROM_SCRATCH.test(words);
|
|
214
214
|
}
|
|
215
|
-
/** Whether a /regenerate asking for its module from scratch asks for its whole requires chain with it. */
|
|
215
|
+
/** Whether a /regenerate or /conform asking for its module from scratch asks for its whole requires chain with it. */
|
|
216
216
|
export function asksWholeChain(words) {
|
|
217
217
|
return /\bchain\b|\bevery module\b|\ball (the )?modules\b/i.test(words);
|
|
218
218
|
}
|
package/dist/regenerate/cases.js
CHANGED
|
@@ -80,6 +80,8 @@ function scenarioCasesLines(specs, module) {
|
|
|
80
80
|
lines.push(` - added - write a test for each: ${labelled(spec, spec.added, module)}.`);
|
|
81
81
|
if (spec.changed.length > 0)
|
|
82
82
|
lines.push(` - changed - rewrite its tests to the scenario as it reads now: ${labelled(spec, spec.changed, module)}.`);
|
|
83
|
+
if (spec.rewritten.length > 0)
|
|
84
|
+
lines.push(` - written anew - delete every test labelled with it, then write its tests again from the scenario: ${labelled(spec, spec.rewritten, module)}.`);
|
|
83
85
|
if (spec.removed.length > 0)
|
|
84
86
|
lines.push(` - removed - delete every test labelled with it, and its label, and nothing else: ${labelled(spec, spec.removed, module)}.`);
|
|
85
87
|
if (spec.unchanged.length > 0) {
|
|
@@ -91,6 +93,9 @@ function scenarioCasesLines(specs, module) {
|
|
|
91
93
|
if (specs.some((spec) => spec.codeChanged !== undefined)) {
|
|
92
94
|
lines.push("- Where the code changed under unchanged scenarios: their tests were written against the code it replaced. Run them", " against the new code. Those that pass are tests of the new code too - conformance tests are black box - and are", " not rewritten. Fix what fails against its scenario, read with the functional spec's text: what a failing test checks", " that the scenario says stays checked, the test changed only as the new code needs it reached; what it checks that", " the scenario and the specification leave open - a path, a field, a message, a format the old code chose - is the", " new code's choice now: rewrite that check to what the new code does, or take it out. No test may hold the new code", " to what only the old code did.");
|
|
93
95
|
}
|
|
96
|
+
if (specs.some((spec) => spec.rewritten.length > 0)) {
|
|
97
|
+
lines.push("- Written anew: the person asked for these tests to be written again from scratch - their code did not change.", " Delete every test labelled with the scenario first, and what only those tests used, then write the scenario's", " tests from the scenario and the functional spec's text - never from the old tests, and never copying them back.", " A test that comes out as it was has not been written anew. Helpers the other tests use stay as they are.");
|
|
98
|
+
}
|
|
94
99
|
lines.push("- The tests of every other functional spec stay as they are.");
|
|
95
100
|
return lines;
|
|
96
101
|
}
|
|
@@ -126,8 +131,10 @@ export function conformanceReviewCasesBlock(cases, module = "") {
|
|
|
126
131
|
const kept = all((spec) => (spec.codeChanged === undefined ? spec.unchanged : []));
|
|
127
132
|
const rerun = all((spec) => (spec.codeChanged !== undefined ? spec.unchanged : []));
|
|
128
133
|
const removed = all((spec) => spec.removed);
|
|
134
|
+
const rewritten = all((spec) => spec.rewritten);
|
|
129
135
|
return [
|
|
130
136
|
"What this job does to the tests, scenario by scenario - hold it to that:",
|
|
137
|
+
...(rewritten !== "" ? [`- Written anew, as the person asked - their old tests deleted and written again from the scenario, none left as it was: ${rewritten}.`] : []),
|
|
131
138
|
...(kept !== "" ? [`- Unchanged - their tests come out exactly as they were, not rewritten or reworded: ${kept}.`] : []),
|
|
132
139
|
...(rerun !== "" ? [`- Unchanged, the code changed under them - a test changed only where it failed on the new code, and only to what its scenario says: ${rerun}.`] : []),
|
|
133
140
|
...(removed !== "" ? [`- Removed - no test labelled with them is left: ${removed}.`] : []),
|
|
@@ -74,12 +74,16 @@ export interface ScenarioRef {
|
|
|
74
74
|
* - `codeChanged`: the functional spec's code moved under its unchanged scenarios - its text or a file it links changed
|
|
75
75
|
* (`text`), it was regenerated again (`again`), or a concept it uses changed (`concept`): their tests are run on the
|
|
76
76
|
* new code, and those that fail are fixed against the scenario.
|
|
77
|
+
* - rewritten: its tests are to be written anew - `conform` named it, or asked for its module from scratch: every one
|
|
78
|
+
* labelled with the scenario deleted and written again from it. A functional spec marked so has every scenario it has
|
|
79
|
+
* now rewritten, and those it no longer has removed.
|
|
77
80
|
*/
|
|
78
81
|
export interface ScenarioCases extends TouchedSpec {
|
|
79
82
|
added: ScenarioRef[];
|
|
80
83
|
changed: ScenarioRef[];
|
|
81
84
|
removed: ScenarioRef[];
|
|
82
85
|
unchanged: ScenarioRef[];
|
|
86
|
+
rewritten: ScenarioRef[];
|
|
83
87
|
codeChanged?: "text" | "again" | "concept";
|
|
84
88
|
}
|
|
85
89
|
/**
|
package/dist/regenerate/drift.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_CONCEPTS, extractConceptsFromDefinition, extractConceptsFromSpecText } from "../plain/concepts.js";
|
|
2
2
|
import { ACCEPTANCE_TESTS, CONFORMANCE_TESTS, DEFINITIONS, FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS } from "../plain/spec.js";
|
|
3
|
-
import { codeTree, conformanceTarget, marksRegenerateAgain } from "./records.js";
|
|
3
|
+
import { codeTree, conformanceTarget, marksConformAgain, marksRegenerateAgain } from "./records.js";
|
|
4
4
|
import { applyChanges, changesBetween, isMove, parseTree, resourcesChanged, serializeTree } from "./spec-steps.js";
|
|
5
5
|
/**
|
|
6
6
|
* The work, derived from the records - see docs/regenerating.md. Nothing here is stored: what is left
|
|
@@ -38,15 +38,26 @@ function scenariosIn(item) {
|
|
|
38
38
|
function codeOf(item) {
|
|
39
39
|
if (item === undefined)
|
|
40
40
|
return "";
|
|
41
|
-
const { [CONFORMANCE_TESTS]: _conformance, [ACCEPTANCE_TESTS]: _acceptance, regenerate_again: _again, ...rest } = item;
|
|
41
|
+
const { [CONFORMANCE_TESTS]: _conformance, [ACCEPTANCE_TESTS]: _acceptance, regenerate_again: _again, conform_again: _conform, ...rest } = item;
|
|
42
42
|
return JSON.stringify({ ...rest, markdown: rest.markdown.trim() });
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* A functional spec's scenarios by case, from the item its tests were written for to the one they are to be. `anew`: its
|
|
46
|
+
* tests are written again, every scenario it has now rewritten.
|
|
47
|
+
*/
|
|
48
|
+
function scenarioCasesOf(spec, was, is, code, anew = false) {
|
|
46
49
|
const before = scenariosIn(was);
|
|
47
50
|
const after = scenariosIn(is);
|
|
48
51
|
const plain = ({ kind, id, text }) => ({ kind, id, text });
|
|
49
|
-
const cases = { ...spec, added: [], changed: [], removed: [], unchanged: [] };
|
|
52
|
+
const cases = { ...spec, added: [], changed: [], removed: [], unchanged: [], rewritten: [] };
|
|
53
|
+
if (anew) {
|
|
54
|
+
for (const scenario of after.values())
|
|
55
|
+
cases.rewritten.push(plain(scenario));
|
|
56
|
+
for (const [key, scenario] of before)
|
|
57
|
+
if (!after.has(key))
|
|
58
|
+
cases.removed.push(plain(scenario));
|
|
59
|
+
return cases;
|
|
60
|
+
}
|
|
50
61
|
for (const [key, scenario] of after) {
|
|
51
62
|
const old = before.get(key);
|
|
52
63
|
if (old === undefined)
|
|
@@ -125,6 +136,8 @@ export function casesOf(before, changes, options = {}) {
|
|
|
125
136
|
const patch = [];
|
|
126
137
|
const again = [];
|
|
127
138
|
const removed = [];
|
|
139
|
+
/** Of those regenerated again, the ones whose conformance tests are written anew: conform asked for them again. */
|
|
140
|
+
const anew = new Set();
|
|
128
141
|
/** Each functional spec touched, as the tests record has it and as it is to be: its scenarios' cases are worked out from them. */
|
|
129
142
|
const items = new Map();
|
|
130
143
|
const keyOf = (spec) => `${spec.module ?? ""}:${spec.funcId}`;
|
|
@@ -139,6 +152,13 @@ export function casesOf(before, changes, options = {}) {
|
|
|
139
152
|
const required = change.section === REQUIRED_FUNCTIONAL_SPECS;
|
|
140
153
|
const was = itemOfLine(change.before);
|
|
141
154
|
const is = itemOfLine(change.after);
|
|
155
|
+
// Its conformance tests marked to be written again: written anew, whatever else changed - its code untouched.
|
|
156
|
+
if (change.kind === "change" && is !== undefined && marksConformAgain(was)) {
|
|
157
|
+
const touched = seen(touchedOf(is, required), was, is);
|
|
158
|
+
again.push(touched);
|
|
159
|
+
anew.add(keyOf(touched));
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
142
162
|
// Marked to regenerate again: regenerated again, whatever else changed in its text - its own or, required, another module's.
|
|
143
163
|
if (change.kind === "change" && is !== undefined && marksRegenerateAgain(was)) {
|
|
144
164
|
again.push(seen(touchedOf(is, required), was, is));
|
|
@@ -199,7 +219,7 @@ export function casesOf(before, changes, options = {}) {
|
|
|
199
219
|
const { was, is } = items.get(keyOf(spec)) ?? {};
|
|
200
220
|
return scenarioCasesOf(spec, was, is, was === is ? "concept" : undefined);
|
|
201
221
|
}),
|
|
202
|
-
...again.map((spec) => scenarioCasesOf(spec, items.get(keyOf(spec))?.was, items.get(keyOf(spec))?.is, "again")),
|
|
222
|
+
...again.map((spec) => scenarioCasesOf(spec, items.get(keyOf(spec))?.was, items.get(keyOf(spec))?.is, "again", anew.has(keyOf(spec)))),
|
|
203
223
|
...removed.map((spec) => scenarioCasesOf(spec, items.get(keyOf(spec))?.was, undefined)),
|
|
204
224
|
]
|
|
205
225
|
: undefined;
|
|
@@ -188,11 +188,20 @@ export interface WorkLoop {
|
|
|
188
188
|
* Write and run the conformance tests of a spec's module - of the functional specs named, or of every one - on the
|
|
189
189
|
* code as it is built, in the codebases where its code lives: for this session, whatever the config says. Asked
|
|
190
190
|
* again, it clears a halt. Says what it planned.
|
|
191
|
+
*
|
|
192
|
+
* A functional spec named whose tests are written already has them written again: marked in the tests record of
|
|
193
|
+
* every codebase it is tested in - committed - and written anew there, its code untouched. `fromScratch` works where
|
|
194
|
+
* its code lives, as regenerating it from scratch does - the tip of each chain it is built in, never a codebase in the
|
|
195
|
+
* middle: the tip's tests folder taken out - committed first, so its history keeps it - and the tests written again
|
|
196
|
+
* there: `"module"` starting from a copy of the tests of the module the tip requires, `"chain"` from nothing, every
|
|
197
|
+
* functional spec of the chain written anew. The code is untouched, and nothing else is. Destructive: asked for only
|
|
198
|
+
* when the person asked for it. Not both: from scratch writes every one of them again.
|
|
191
199
|
*/
|
|
192
200
|
conformance(plainFile: string, options?: {
|
|
193
201
|
funcIds?: string[];
|
|
194
202
|
model?: string;
|
|
195
203
|
separately?: boolean;
|
|
204
|
+
fromScratch?: "module" | "chain";
|
|
196
205
|
}): Promise<ModuleStatus[]>;
|
|
197
206
|
/**
|
|
198
207
|
* Start over the codebases of a spec's module that now require a module their code was not built on (see
|
package/dist/regenerate/loop.js
CHANGED
|
@@ -11,14 +11,14 @@ import { firstLine, record } from "./ledger.js";
|
|
|
11
11
|
import { NOTES_FILE, recordPulse } from "./notes.js";
|
|
12
12
|
import { formatDuration } from "./jobs.js";
|
|
13
13
|
import { moduleLanes } from "./lanes.js";
|
|
14
|
-
import { adoptDigests, chainTree, codeTree, conformanceTarget,
|
|
14
|
+
import { adoptDigests, chainTree, codeTree, conformanceTarget, CONFORM_AGAIN, marksTestsAgain, REGENERATE_AGAIN, inheritedRecord, isOldRecord, notBuilt, readRecord, RECORD_FILE, withResourceDigests, writeCodeRecord, writeTestsRecord, hasScenarios, identityOf, testedFuncIds, } from "./records.js";
|
|
15
15
|
import { describeSpecDiffConformance, renderSpecDiffConformance } from "./conform.js";
|
|
16
16
|
import { conformanceDirFor } from "./conformance.js";
|
|
17
17
|
import { modulesRoot, projectRootOf } from "./paths.js";
|
|
18
18
|
import { configForSpec, stackForModule, testDirOf, withStack } from "../config.js";
|
|
19
19
|
import { describeSpecChange } from "./prompt.js";
|
|
20
20
|
import { resolveTemplateDirs } from "./paths.js";
|
|
21
|
-
import { builtTips, copyRequiredCode, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
|
|
21
|
+
import { builtTips, copyRequiredCode, copyRequiredTests, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
|
|
22
22
|
import { describeSpecDiff, renderSpecDiff, specFilesOf } from "./regenerate.js";
|
|
23
23
|
import { locateDiffLines } from "./diff-view.js";
|
|
24
24
|
import { agentChanges, changeDiffInFiles } from "./change-view.js";
|
|
@@ -208,8 +208,9 @@ export function codebaseCompletion(chain) {
|
|
|
208
208
|
codebase.forEach((entry, index) => {
|
|
209
209
|
const count = counts[index];
|
|
210
210
|
const completed = entry.funcIds.filter((funcId) => !touched.has(`${entry.moduleName}:${funcId}`));
|
|
211
|
-
// Tests marked to regenerate again were written against code since replaced
|
|
212
|
-
|
|
211
|
+
// Tests marked to regenerate again were written against code since replaced, and those marked to be written again
|
|
212
|
+
// are to be written anew: not conformance tested until rewritten.
|
|
213
|
+
const tested = ownItems(testsRecord ?? undefined, entry.moduleName, entry.moduleName === tip.moduleName).filter((item) => item.id !== undefined && !marksTestsAgain(item) && reads(item) === specText(entry.moduleName, item.id));
|
|
213
214
|
count.completed = completed.length;
|
|
214
215
|
count.tested = completed.filter((funcId) => tested.some((item) => item.id === funcId));
|
|
215
216
|
count.conformanceTested = count.tested.length;
|
|
@@ -354,15 +355,96 @@ export function createWorkLoop(options) {
|
|
|
354
355
|
}
|
|
355
356
|
return narrowed;
|
|
356
357
|
};
|
|
357
|
-
/**
|
|
358
|
-
|
|
358
|
+
/**
|
|
359
|
+
* The functional specs conform named - func-ids of `module` - and every functional spec as it reads now, to tell a
|
|
360
|
+
* change to one after. In a codebase built on `module`, they are among the functional specs it requires.
|
|
361
|
+
*/
|
|
362
|
+
const namedOnly = (state, funcIds, module) => {
|
|
359
363
|
const tree = chainSpec(state.chain).tree;
|
|
360
364
|
const read = new Map();
|
|
361
365
|
for (const section of [FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS]) {
|
|
362
366
|
for (const item of tree[section] ?? [])
|
|
363
367
|
read.set(identityOf(item), JSON.stringify(item));
|
|
364
368
|
}
|
|
365
|
-
|
|
369
|
+
const own = tipEntry(state).moduleName === module;
|
|
370
|
+
return { specs: new Set(funcIds.map((id) => identityOf(own ? { id } : { id, module }))), read };
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Conformance tests written already, to be written again as conform names them - their code untouched: the functional
|
|
374
|
+
* specs named, func-ids of `self`, marked in the tests record of every codebase where its code lives - the tips of its
|
|
375
|
+
* chains, whose suite holds the chain's tests, among the functional specs required there for a module below - each
|
|
376
|
+
* committed. Refused while a pulse runs in one it marks. Says which functional specs were marked.
|
|
377
|
+
*/
|
|
378
|
+
const conformAgain = (file, self, funcIds) => {
|
|
379
|
+
const codebases = [...new Map(chainsFor(file).map(tipOf).map((entry) => [entry.buildDir, entry])).values()];
|
|
380
|
+
// What is marked, worked out before anything is: a codebase that has none of them is not touched, nor refused.
|
|
381
|
+
const touching = codebases.flatMap((entry) => {
|
|
382
|
+
const testsDir = conformanceDirFor(entry.moduleName, modulesRoot(projectDirOf(entry.plainFile)));
|
|
383
|
+
const tests = readRecord(testsDir);
|
|
384
|
+
if (tests === null)
|
|
385
|
+
return [];
|
|
386
|
+
const section = entry.moduleName === self.moduleName ? FUNCTIONAL_REQUIREMENTS : REQUIRED_FUNCTIONAL_SPECS;
|
|
387
|
+
const items = tests[section] ?? [];
|
|
388
|
+
const funcIdOf = (item) => (section === FUNCTIONAL_REQUIREMENTS || item.module === self.moduleName ? (item.id ?? "") : "");
|
|
389
|
+
const taken = items.flatMap((item) => (funcIds.includes(funcIdOf(item)) ? [funcIdOf(item)] : []));
|
|
390
|
+
if (taken.length === 0)
|
|
391
|
+
return [];
|
|
392
|
+
const marked = items.map((item) => (funcIds.includes(funcIdOf(item)) ? { ...item, [CONFORM_AGAIN]: true } : item));
|
|
393
|
+
return [{ entry, testsDir, taken, record: { ...tests, [section]: marked } }];
|
|
394
|
+
});
|
|
395
|
+
for (const { entry } of touching) {
|
|
396
|
+
if (modules.get(entry.buildDir)?.running !== undefined)
|
|
397
|
+
throw new Error(`${entry.moduleName} has a pulse running: halt it, or ask again once it is done. Nothing was started.`);
|
|
398
|
+
}
|
|
399
|
+
const found = new Set();
|
|
400
|
+
for (const { entry, testsDir, taken, record } of touching) {
|
|
401
|
+
writeTestsRecord(testsDir, record);
|
|
402
|
+
recordHistory(entry.buildDir, `the conformance tests of ${namesOf(self.moduleName, taken)} to write again`);
|
|
403
|
+
for (const funcId of taken)
|
|
404
|
+
found.add(funcId);
|
|
405
|
+
const state = modules.get(entry.buildDir);
|
|
406
|
+
if (state === undefined)
|
|
407
|
+
continue;
|
|
408
|
+
state.conformancePlan = undefined;
|
|
409
|
+
state.conformanceHalted = undefined;
|
|
410
|
+
}
|
|
411
|
+
return [...found];
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* A module's conformance tests from scratch, where its code lives - the tip of each chain it is built in, as
|
|
415
|
+
* `fromScratch` regenerates its code there, never a codebase in the middle - the code untouched: each tip's tests folder
|
|
416
|
+
* taken out whole, committed so its history keeps it; then, `fromBelow`, the tests of the module the tip requires copied
|
|
417
|
+
* in, as the codebase started from them - its own tests written anew on them, those it inherits brought up to date.
|
|
418
|
+
* Without, nothing: every functional spec of the chain is written anew there. Nothing below a tip is touched. Refused
|
|
419
|
+
* while a pulse runs in one. Says which codebases' tests were taken out.
|
|
420
|
+
*/
|
|
421
|
+
const testsFromScratch = (file, fromBelow) => {
|
|
422
|
+
const chains = chainsFor(file);
|
|
423
|
+
const tips = [...new Map(chains.map((chain) => [tipOf(chain).buildDir, chain])).values()].flatMap((chain) => {
|
|
424
|
+
const tip = tipOf(chain);
|
|
425
|
+
const testsDir = conformanceDirFor(tip.moduleName, modulesRoot(projectDirOf(tip.plainFile)));
|
|
426
|
+
// Nothing built and no tests: there is nothing to start again - they are written once the code is.
|
|
427
|
+
return started(tip) || existsSync(testsDir) ? [{ chain, tip, testsDir }] : [];
|
|
428
|
+
});
|
|
429
|
+
for (const { tip } of tips) {
|
|
430
|
+
if (modules.get(tip.buildDir)?.running !== undefined)
|
|
431
|
+
throw new Error(`${tip.moduleName} has a pulse running: halt it, or ask again once it is done. Nothing was started.`);
|
|
432
|
+
}
|
|
433
|
+
for (const { chain, tip, testsDir } of tips) {
|
|
434
|
+
rmSync(testsDir, { recursive: true, force: true });
|
|
435
|
+
const below = fromBelow ? chain.find((entry) => entry.moduleName === tip.requires) : undefined;
|
|
436
|
+
if (below !== undefined)
|
|
437
|
+
copyRequiredTests(below.buildDir, tip.buildDir, below.moduleName);
|
|
438
|
+
const why = below !== undefined ? `asked to be written again from scratch, starting from ${below.moduleName}'s` : "asked to be written again from scratch, with its whole chain's";
|
|
439
|
+
recordHistory(tip.buildDir, `conformance tests from scratch: ${why}`);
|
|
440
|
+
reportActivity(` ${tip.moduleName}: its conformance tests are taken out${below !== undefined ? `, and ${below.moduleName}'s copied in` : ""} - ${why}`);
|
|
441
|
+
const state = modules.get(tip.buildDir);
|
|
442
|
+
if (state === undefined)
|
|
443
|
+
continue;
|
|
444
|
+
state.conformancePlan = undefined;
|
|
445
|
+
state.conformanceHalted = undefined;
|
|
446
|
+
}
|
|
447
|
+
return tips.map(({ tip }) => tip.moduleName);
|
|
366
448
|
};
|
|
367
449
|
/** The work of a track, from where it is built from to what it is to be - for the conformance tests, as conform narrowed them unless `narrowed` is false. */
|
|
368
450
|
const workOf = (track, from, state, spec, narrowed = true) => track === "code" ? codeWork(from, spec.tree) : changesBetween(serializeTree(from), serializeTree(conformanceOf(state, spec, from, narrowed)));
|
|
@@ -1372,10 +1454,20 @@ export function createWorkLoop(options) {
|
|
|
1372
1454
|
}
|
|
1373
1455
|
// Refused before anything is touched: a functional spec not there, nothing to test, or a step of adding tests skipped.
|
|
1374
1456
|
const { named, spec: ownSpec, withScenarios } = conformanceAskedIn(own, request.funcIds);
|
|
1457
|
+
const scratch = request.fromScratch;
|
|
1458
|
+
if (scratch !== undefined && named !== undefined && named.length > 0) {
|
|
1459
|
+
throw new Error("Name functional specs or ask for the conformance tests from scratch, not both: from scratch writes every one of them again. Nothing was started.");
|
|
1460
|
+
}
|
|
1461
|
+
// Written already, and asked for again: the named ones written anew where they are tested; from scratch, the module's
|
|
1462
|
+
// tests folder taken out - and started again from the module it requires, unless the whole chain's are asked for.
|
|
1463
|
+
const again = named !== undefined && named.length > 0 ? conformAgain(file, self, named) : [];
|
|
1464
|
+
if (scratch !== undefined)
|
|
1465
|
+
testsFromScratch(file, scratch === "module");
|
|
1375
1466
|
const tested = new Set((readRecord(conformanceDirFor(self.moduleName, modulesRoot(projectDirOf(self.plainFile))))?.[FUNCTIONAL_REQUIREMENTS] ?? []).map((item) => item.id));
|
|
1376
1467
|
const toWrite = (named !== undefined && named.length > 0 ? named : withScenarios).some((funcId) => !tested.has(funcId));
|
|
1377
1468
|
let wentBack = false;
|
|
1378
|
-
|
|
1469
|
+
// From scratch, the tests are written again at the tips, where they were: nothing built on the module is touched.
|
|
1470
|
+
if (scratch === undefined && readRecord(self.buildDir) !== null && toWrite) {
|
|
1379
1471
|
const why = `${self.moduleName}'s conformance tests were asked for, and they come before anything is built on it`;
|
|
1380
1472
|
for (const chain of builtTips(file)) {
|
|
1381
1473
|
const above = chain.slice(chain.findIndex((entry) => entry.buildDir === self.buildDir) + 1);
|
|
@@ -1409,7 +1501,7 @@ export function createWorkLoop(options) {
|
|
|
1409
1501
|
state.lookedAhead = undefined;
|
|
1410
1502
|
const asks = named !== undefined && named.length > 0 ? named : undefined;
|
|
1411
1503
|
// Its tests are written already, and a codebase built on it holds its code: nothing to write, nothing touched.
|
|
1412
|
-
if (asking === undefined && asks !== undefined && tip !== undefined) {
|
|
1504
|
+
if (asking === undefined && asks !== undefined && tip !== undefined && again.length === 0) {
|
|
1413
1505
|
throw new Error(`${self.moduleName}'s conformance tests for ${namesOf(self.moduleName, asks)} are written already. Nothing was started.`);
|
|
1414
1506
|
}
|
|
1415
1507
|
// Only the module asked for: one job for all of its tests, or one a functional spec, as this request asks; a halt cleared.
|
|
@@ -1419,7 +1511,7 @@ export function createWorkLoop(options) {
|
|
|
1419
1511
|
state.conformancePlan = undefined;
|
|
1420
1512
|
state.conformanceSeparately = separately;
|
|
1421
1513
|
// Named: their tests alone - the others left as they are until the module is asked for again, or conform names none.
|
|
1422
|
-
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks) : undefined;
|
|
1514
|
+
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks, self.moduleName) : undefined;
|
|
1423
1515
|
state.conformancePlan = undefined;
|
|
1424
1516
|
state.conformanceHalted = undefined;
|
|
1425
1517
|
state.halted = undefined;
|
|
@@ -1718,6 +1810,7 @@ function conformanceLines(module, cases) {
|
|
|
1718
1810
|
...(spec.added.length > 0 ? [`${spec.added.length} added`] : []),
|
|
1719
1811
|
...(spec.changed.length > 0 ? [`${spec.changed.length} changed`] : []),
|
|
1720
1812
|
...(spec.removed.length > 0 ? [`${spec.removed.length} removed`] : []),
|
|
1813
|
+
...(spec.rewritten.length > 0 ? [`written again from scratch - ${spec.rewritten.length} to write anew`] : []),
|
|
1721
1814
|
...(spec.codeChanged !== undefined ? [`${why[spec.codeChanged]} - ${spec.unchanged.length} to run on it`] : []),
|
|
1722
1815
|
];
|
|
1723
1816
|
return parts.length > 0 ? parts.join(", ") : "its text changed";
|
|
@@ -24,6 +24,17 @@ export { RECORD_FILE } from "./paths.ts";
|
|
|
24
24
|
export declare const REGENERATE_AGAIN = "regenerate_again";
|
|
25
25
|
/** Whether a record's item is marked to regenerate again. */
|
|
26
26
|
export declare function marksRegenerateAgain(item: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A functional spec in the tests record marked to have its conformance tests written again: they are written, and are
|
|
29
|
+
* to be written anew all the same - `conform` with functional specs named, or a module's from scratch. Its code is
|
|
30
|
+
* untouched. The mark makes the tests record differ from what the tests are to be written for at that item, so the
|
|
31
|
+
* work loop plans a conformance pulse for it, and the pulse that writes them writes the item back without it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CONFORM_AGAIN = "conform_again";
|
|
34
|
+
/** Whether a tests record's item is marked to have its conformance tests written again. */
|
|
35
|
+
export declare function marksConformAgain(item: unknown): boolean;
|
|
36
|
+
/** Whether a tests record's item is not written for the code as it is now: marked with its code to regenerate again, or to be written again. */
|
|
37
|
+
export declare function marksTestsAgain(item: unknown): boolean;
|
|
27
38
|
/**
|
|
28
39
|
* Whether a functional spec has scenarios - conformance or acceptance - and so is tested: one with an empty test plain
|
|
29
40
|
* file is not.
|
|
@@ -32,6 +32,21 @@ export const REGENERATE_AGAIN = "regenerate_again";
|
|
|
32
32
|
export function marksRegenerateAgain(item) {
|
|
33
33
|
return typeof item === "object" && item !== null && item[REGENERATE_AGAIN] === true;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A functional spec in the tests record marked to have its conformance tests written again: they are written, and are
|
|
37
|
+
* to be written anew all the same - `conform` with functional specs named, or a module's from scratch. Its code is
|
|
38
|
+
* untouched. The mark makes the tests record differ from what the tests are to be written for at that item, so the
|
|
39
|
+
* work loop plans a conformance pulse for it, and the pulse that writes them writes the item back without it.
|
|
40
|
+
*/
|
|
41
|
+
export const CONFORM_AGAIN = "conform_again";
|
|
42
|
+
/** Whether a tests record's item is marked to have its conformance tests written again. */
|
|
43
|
+
export function marksConformAgain(item) {
|
|
44
|
+
return typeof item === "object" && item !== null && item[CONFORM_AGAIN] === true;
|
|
45
|
+
}
|
|
46
|
+
/** Whether a tests record's item is not written for the code as it is now: marked with its code to regenerate again, or to be written again. */
|
|
47
|
+
export function marksTestsAgain(item) {
|
|
48
|
+
return marksRegenerateAgain(item) || marksConformAgain(item);
|
|
49
|
+
}
|
|
35
50
|
const itemsOf = (tree, heading) => (tree?.[heading] ?? []).slice();
|
|
36
51
|
/** A tree without the sections it has nothing in, as the parser leaves them out. */
|
|
37
52
|
function withoutEmpty(tree) {
|
|
@@ -4,7 +4,7 @@ import { ACCEPTANCE_TESTS, CONFORMANCE_TESTS, FUNCTIONAL_REQUIREMENTS, REQUIRED_
|
|
|
4
4
|
import { reportActivity } from "./activity.js";
|
|
5
5
|
import { record } from "./ledger.js";
|
|
6
6
|
import { abandonWork, landWork, moduleDirOf, startWork } from "./lineage.js";
|
|
7
|
-
import { hasScenarios, marksRegenerateAgain, writeCodeRecord, writeTestsRecord } from "./records.js";
|
|
7
|
+
import { hasScenarios, marksRegenerateAgain, marksTestsAgain, writeCodeRecord, writeTestsRecord } from "./records.js";
|
|
8
8
|
import { listFiles } from "./testing.js";
|
|
9
9
|
const SECTIONS = [REQUIRED_FUNCTIONAL_SPECS, FUNCTIONAL_REQUIREMENTS];
|
|
10
10
|
const KINDS = [
|
|
@@ -24,7 +24,7 @@ function stable(value) {
|
|
|
24
24
|
}
|
|
25
25
|
/** What of a functional spec the code is built from, but its func-id: its text, its links. */
|
|
26
26
|
function codeOf(item) {
|
|
27
|
-
const { id: _id, [CONFORMANCE_TESTS]: _conformance, [ACCEPTANCE_TESTS]: _acceptance, regenerate_again: _again, ...rest } = item;
|
|
27
|
+
const { id: _id, [CONFORMANCE_TESTS]: _conformance, [ACCEPTANCE_TESTS]: _acceptance, regenerate_again: _again, conform_again: _conform, ...rest } = item;
|
|
28
28
|
return stable({ ...rest, markdown: String(rest.markdown ?? "").trim() });
|
|
29
29
|
}
|
|
30
30
|
const scenariosOf = (item, key) => item?.[key] ?? [];
|
|
@@ -58,7 +58,7 @@ export function pureRenames(code, tests, spec, module) {
|
|
|
58
58
|
for (const gone of built.filter((item) => !inSpec.has(key(item)) && !marksRegenerateAgain(item))) {
|
|
59
59
|
const testedItem = tested.find((item) => key(item) === key(gone));
|
|
60
60
|
// Its tests, when it has them, written for it as it is built: the same text, not marked to be written again.
|
|
61
|
-
if (testedItem !== undefined && (
|
|
61
|
+
if (testedItem !== undefined && (marksTestsAgain(testedItem) || codeOf(testedItem) !== codeOf(gone)))
|
|
62
62
|
continue;
|
|
63
63
|
const match = fresh.find((item) => !taken.has(item) &&
|
|
64
64
|
moduleOf(item) === moduleOf(gone) &&
|
|
@@ -83,7 +83,7 @@ export function pureRenames(code, tests, spec, module) {
|
|
|
83
83
|
const testedNow = sectionOf(testsNow, heading).map((item) => {
|
|
84
84
|
const current = nowByKey.get(key(item));
|
|
85
85
|
const have = builtNow.get(key(item));
|
|
86
|
-
if (current === undefined || have === undefined ||
|
|
86
|
+
if (current === undefined || have === undefined || marksTestsAgain(item) || marksRegenerateAgain(have))
|
|
87
87
|
return item;
|
|
88
88
|
if (codeOf(item) !== codeOf(current) || codeOf(have) !== codeOf(current))
|
|
89
89
|
return item;
|
|
@@ -90,6 +90,13 @@ export declare function builtTips(plainFile: string, options?: {
|
|
|
90
90
|
export declare function copyRequiredCode(from: string, to: string, toModule: string,
|
|
91
91
|
/** The module the code comes from: its functional specs are what the new one inherits. */
|
|
92
92
|
fromModule: string): string[];
|
|
93
|
+
/**
|
|
94
|
+
* Copy a required module's conformance tests beside a codebase's code - into its `tests` directory, beside the code -
|
|
95
|
+
* as a codebase built on that module starts from them: their files and notes, and what they are written for as what
|
|
96
|
+
* the module inherits - its conformance suite is the chain's, kept up to date there from then on. `from` and `to` are
|
|
97
|
+
* the two codebases' code folders. Nothing, when the required module has no tests.
|
|
98
|
+
*/
|
|
99
|
+
export declare function copyRequiredTests(from: string, to: string, fromModule: string): void;
|
|
93
100
|
/**
|
|
94
101
|
* A module the chain requires now that a module built in it was not built on: one required for
|
|
95
102
|
* the first time - a new module the specs were split into, say - and the built modules above it,
|
|
@@ -303,27 +303,33 @@ fromModule) {
|
|
|
303
303
|
const at = head(from);
|
|
304
304
|
const recordStart = () => recordHistory(to, `start from ${source}${at ? ` at ${at}` : ""}`);
|
|
305
305
|
// So do the conformance tests: they check the code that was just copied, and the new
|
|
306
|
-
// module's regression suite has to keep them passing.
|
|
307
|
-
|
|
306
|
+
// module's regression suite has to keep them passing.
|
|
307
|
+
copyRequiredTests(from, to, fromModule);
|
|
308
|
+
recordStart();
|
|
309
|
+
return copied;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Copy a required module's conformance tests beside a codebase's code - into its `tests` directory, beside the code -
|
|
313
|
+
* as a codebase built on that module starts from them: their files and notes, and what they are written for as what
|
|
314
|
+
* the module inherits - its conformance suite is the chain's, kept up to date there from then on. `from` and `to` are
|
|
315
|
+
* the two codebases' code folders. Nothing, when the required module has no tests.
|
|
316
|
+
*/
|
|
317
|
+
export function copyRequiredTests(from, to, fromModule) {
|
|
308
318
|
const testsFrom = join(dirname(from), "tests");
|
|
309
319
|
const testsTo = join(dirname(to), "tests");
|
|
310
|
-
if (existsSync(testsFrom))
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
// And their notes, which listFiles leaves out as it does the code's.
|
|
317
|
-
if (existsSync(notesPath(testsFrom)) && !existsSync(notesPath(testsTo)))
|
|
318
|
-
copyFileSync(notesPath(testsFrom), notesPath(testsTo));
|
|
319
|
-
// What they are written for comes with them, as what the new module inherits: its conformance suite is the chain's,
|
|
320
|
-
// kept up to date here from now on.
|
|
321
|
-
const tested = readRecord(testsFrom);
|
|
322
|
-
if (tested !== null)
|
|
323
|
-
writeTestsRecord(testsTo, inheritedTestsRecord(tested, fromModule));
|
|
320
|
+
if (!existsSync(testsFrom))
|
|
321
|
+
return;
|
|
322
|
+
for (const file of listFiles(testsFrom)) {
|
|
323
|
+
const target = join(testsTo, file);
|
|
324
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
325
|
+
copyFileSync(join(testsFrom, file), target);
|
|
324
326
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
// And their notes, which listFiles leaves out as it does the code's.
|
|
328
|
+
if (existsSync(notesPath(testsFrom)) && !existsSync(notesPath(testsTo)))
|
|
329
|
+
copyFileSync(notesPath(testsFrom), notesPath(testsTo));
|
|
330
|
+
const tested = readRecord(testsFrom);
|
|
331
|
+
if (tested !== null)
|
|
332
|
+
writeTestsRecord(testsTo, inheritedTestsRecord(tested, fromModule));
|
|
327
333
|
}
|
|
328
334
|
/**
|
|
329
335
|
* A module the chain requires now that a module built in it was not built on: one required for
|
|
@@ -9,7 +9,7 @@ import { conformanceDirFor } from "./conformance.js";
|
|
|
9
9
|
import { chainSpec } from "./loop.js";
|
|
10
10
|
import { modulesRoot, projectDirOf } from "./paths.js";
|
|
11
11
|
import { HISTORY_DIR } from "./lineage.js";
|
|
12
|
-
import { codeTree, hasScenarios,
|
|
12
|
+
import { codeTree, hasScenarios, marksTestsAgain, readRecord, RECORD_FILE } from "./records.js";
|
|
13
13
|
import { pureRenames } from "./renames.js";
|
|
14
14
|
import { specFilesOf } from "./regenerate.js";
|
|
15
15
|
import { builtTips, resolveRequiresChain } from "./requires.js";
|
|
@@ -136,7 +136,7 @@ export function pageItems(input) {
|
|
|
136
136
|
}
|
|
137
137
|
// Conformance tests: of the functional specs, by func-id, those the tests record has as they read now - their text and
|
|
138
138
|
// their scenarios - as they read before, or taken out. Tests marked to regenerate again were written against code since
|
|
139
|
-
// replaced: written for an earlier build, not now.
|
|
139
|
+
// replaced, and those marked to be written again are to be written anew: written for an earlier build, not now.
|
|
140
140
|
const testedItems = new Map(itemsOf(input.tested ?? null, FUNCTIONAL_REQUIREMENTS).map((item) => [item.id ?? "", item]));
|
|
141
141
|
const asNow = new Map(itemsOf(now, FUNCTIONAL_REQUIREMENTS).map((item) => [item.id ?? "", item]));
|
|
142
142
|
const reads = (item) => JSON.stringify({ markdown: item.markdown.trim(), scenarios: scenarioViews(item) });
|
|
@@ -150,7 +150,7 @@ export function pageItems(input) {
|
|
|
150
150
|
if (item.state === "removed")
|
|
151
151
|
item.tests = "removed";
|
|
152
152
|
else
|
|
153
|
-
item.tests = !
|
|
153
|
+
item.tests = !marksTestsAgain(tested) && current !== undefined && reads(tested) === reads(current) ? "now" : "older";
|
|
154
154
|
}
|
|
155
155
|
return keyed(items);
|
|
156
156
|
}
|
package/docs/headless.md
CHANGED
|
@@ -65,6 +65,7 @@ Useful options - `turri regenerate --help` lists all of them:
|
|
|
65
65
|
| `--stack <name>` | build with the stack's `config.turri.<name>.yaml` over `config.turri.yaml`; default, `TURRI_STACK`, else none |
|
|
66
66
|
| `--from-scratch` | delete the module's code and conformance tests (its lineage keeps them) and regenerate all of it |
|
|
67
67
|
| `--from-scratch-chain` | the same for every module of its requires chain, the base's included, built again from the bottom |
|
|
68
|
+
| `turri conform --from-scratch` | take out the tests folder at the tip of the module's chain (its lineage keeps it) and write the tests again from a copy of the tests of the module the tip requires, the code untouched; `--from-scratch-chain`, from nothing |
|
|
68
69
|
| `--start-over` | start over, unasked, a codebase built without a module it now requires - without a terminal, a run that needs it and lacks it stops |
|
|
69
70
|
| `--build-dir <dir>` | as the run ends, export the code there - see below |
|
|
70
71
|
| `--report <file.json>` | write [the run report](#the-run-report) there |
|
package/docs/regenerating.md
CHANGED
|
@@ -324,7 +324,9 @@ The unit tests are written by the agent that wrote the code. Conformance tests a
|
|
|
324
324
|
|
|
325
325
|
```bash
|
|
326
326
|
turri conform <file.plain> # every functional spec with scenarios
|
|
327
|
-
turri conform <file.plain> app:add-task # one, named module:func-id
|
|
327
|
+
turri conform <file.plain> app:add-task # one, named module:func-id - written again when its tests are written
|
|
328
|
+
turri conform <file.plain> --from-scratch # the tests folder at the tip taken out, written again from the module it requires
|
|
329
|
+
turri conform <file.plain> --from-scratch-chain # the same, from nothing: every functional spec of the chain written again
|
|
328
330
|
```
|
|
329
331
|
|
|
330
332
|
They follow the code: a functional spec's scenarios get their tests once its code is built, for modules with `***test reqs***` and a conformance testing script. Once a codebase has conformance tests, they are always run and kept passing, and they are carried up to the modules built on top of it.
|
|
@@ -345,6 +347,8 @@ A conformance job is a \*\*\*plain diff's conformance run: the tests of its chan
|
|
|
345
347
|
|
|
346
348
|
**`conform`.** The loop starts conformance pulses by itself; `conform` starts them now - every functional spec of the module with scenarios, or those named as `module:func-id`. Named, it writes their tests alone: the module's other functional specs whose tests are behind are left as they are - `drift` lists them, saying conform asked for the named ones alone - until `conform` names none or the module is asked for again (`regenerate`); one of them whose text or scenarios change meanwhile joins those named. A module none of whose functional specs has scenarios, a functional spec \*\*\*plain does not have, one with no scenarios ("write them first") or a module that skipped a step of adding tests ([above](#the-steps-of-adding-tests)) is refused, and nothing is started. `conform` changes the module named alone, never the modules below it. For a module not regenerated yet, its tests are written once its code is built, before anything is built on it. For a module already regenerated whose tests are not written, while a module above it was started from it - its first pulse running, or code of its own built - the codebase above is disposable: a pulse running there is stopped, whatever `allow-to-stop-jobs` says, as the person asked; the codebase is deleted whole, its history with it; the tests are written in the module's own codebase; and the module above is regenerated from it once they pass. With every test written for what is built, it says so, and nothing is touched.
|
|
347
349
|
|
|
350
|
+
**Written again.** `conform` asks for tests written already to be written again - as `regenerate` does code - and touches no code. A functional spec it names whose tests are written has them written anew: marked `conform_again` in the tests record of every codebase where its code lives - the tips of its chains, whose suite holds the chain's tests, among the functional specs required there for a module below - committed, so the mark differs from what the tests are to be written for and the work loop plans a conformance pulse for it; one named whose tests are not written is written, as before. The pulse deletes every test labelled with each of its scenarios, and what only those tests used, and writes them again from the scenario and the functional spec's text, never from the old tests; it lands the tests record without the mark. **From scratch** (`from_scratch`, `/conform … from scratch`, `turri conform --from-scratch`) works where the module's code lives, as `regenerate` from scratch does - the tip of each chain it is built in, never a codebase in the middle: the tip's whole tests folder - its tests, their notes and their record - is taken out, committed first so its lineage keeps it, and the tests of the module the tip requires are copied in, as the codebase started from them; the tip's own tests are written anew on them, and those it inherits are brought up to date. `"chain"` (`from scratch, whole chain`, `--from-scratch-chain`) copies nothing in: every functional spec of the chain with scenarios has its tests written anew at the tip. Neither touches the code, a codebase below the tip or one built on the module. Functional specs named and from scratch are not asked for together, and a pulse running in a codebase it would touch refuses it, as `regenerate` from scratch does.
|
|
351
|
+
|
|
348
352
|
**`turri drift`** lists the conformance work one functional spec a line, its scenarios counted by case, and why else its tests are behind:
|
|
349
353
|
|
|
350
354
|
```
|
|
@@ -353,6 +357,7 @@ A conformance job is a \*\*\*plain diff's conformance run: the tests of its chan
|
|
|
353
357
|
todo:edit-task 1 added, 1 changed, 1 removed
|
|
354
358
|
todo:list-tasks its code was regenerated again - 3 to run on it
|
|
355
359
|
todo:delete-task taken out - its tests go (2 removed)
|
|
360
|
+
todo:log-in written again from scratch - 2 to write anew
|
|
356
361
|
```
|
|
357
362
|
|
|
358
363
|
A functional spec with no scenarios is not listed: `parse` shows it as "no scenarios - not tested".
|
|
@@ -372,6 +377,7 @@ A conformance job goes down to the scenarios. For each functional spec it touche
|
|
|
372
377
|
| removed | deleted, every test labelled with it - and nothing else |
|
|
373
378
|
| unchanged | left exactly as they are |
|
|
374
379
|
| unchanged, its functional spec's code changed - its text or a file it links patched, it was regenerated again, or a concept it uses changed | run on the new code: those that pass stay as they are, and one that fails is fixed against its scenario, read with the functional spec's text - no test holds the new code to what only the old code did |
|
|
380
|
+
| written anew - its functional spec's tests asked for again (`conform`, [above](#conformance-tests-in-the-work-loop)) | deleted, every test labelled with it, and written again from the scenario - none left as it was; a scenario it no longer has is removed |
|
|
375
381
|
|
|
376
382
|
A scenario given another scenario-id, and nothing else with it, is relabelled by turri itself, its tests not rewritten (see [a pure rename](#what-a-job-is-given-and-what-it-records)); renamed with any other change of its functional spec's, it is one removed and one added, and so is one moved between `***conformance tests***` and `***acceptance tests***`, as its label changes; one moved between two test plain files of the same functional spec is nothing. A functional spec whose text and scenarios both changed gets both cases. The tests record stores nothing new for it: each scenario's `{id, text}`, as written. The reviewer holds the agent to the cases: the tests of an unchanged scenario come out unchanged - unless the code changed under it and a test failed on it - and none labelled with a removed scenario is left.
|
|
377
383
|
|
package/docs/using.md
CHANGED
|
@@ -30,7 +30,6 @@ While a skill runs, a line above the input shows its phases, every one by name -
|
|
|
30
30
|
| `pulses` | pulses in every tense: this session's - finished, running and planned - and the last runs of earlier sessions (`runs` for more), or one of them - a finished one with what the [ledger](#the-ledger) recorded of it: its rounds, test runs, verdicts, healers and commits; one that did not land says why besides, from its transcript: its diagnosis, the stages that went wrong, the last failing test run, the last review, the tool calls that failed. With a module's `plain_file`, a look ahead: its work planned as `regenerate` plans it - the steering with it - and kept, nothing started, its pulses waiting for `regenerate`, `conform` or `/regenerate`, which runs that plan as it is unless the \*\*\*plain or the steering changed since. A planned row's id (`planned-<module>-1`) then gives its cases and - the next pulse of its codebase - the whole prompt its coding agent will get |
|
|
31
31
|
| `halt` | halt a pulse, a module's planned pulses, or what `activate` started |
|
|
32
32
|
| `doctor` | turri's self check, as `turri doctor` runs it: Node, bash, git, the OS sandbox, a model provider, and the project's toolchains and testing scripts - against the PATH turri's pulses run with, not the agent's shell's. The project's models are asked for a word only when you ask (a request a model); it changes nothing |
|
|
33
|
-
| `lineage` | a module's lineage: what each regeneration and conformance run changed in it, and what it was regenerated from |
|
|
34
33
|
| `cultivate` | run a gated skill, its steps and review gates enforced |
|
|
35
34
|
| `release`, `activate` | try what is regenerated: release it to `dist/<module>` and activate it on this machine, installing what it needs - see [deploy](deploy.md) |
|
|
36
35
|
| `ask_user` | put a question to you as a dialog to pick from - several at once, each a box you tick and untick, "Something else…" to type, or "Chat about this" to talk it over first; Esc in either goes back to the options |
|
|
@@ -81,7 +80,7 @@ A regeneration takes minutes, so in the TUI every tool that regenerates starts t
|
|
|
81
80
|
- **`/sentinel`** says whether the [sentinel](sentinel.md) checks every pulse that finishes: `ask` - you are asked before it first opens in a session - `on`, or `off`; written to `config.turri.yaml`.
|
|
82
81
|
- **`/stack`** chooses the stack everything is built with from then on, in a project whose parts are on different stacks: a list of the project's stacks, or `/stack backend`, `/stack none`. The stack's `config.turri.<stack>.yaml` is laid over `config.turri.yaml` - its testing scripts, toolchains, models - for the session; a module already asked for keeps the stack it was asked for with. The chat model switches it too when you ask - and, to build one part, passes that part's stack to `regenerate` instead, leaving the session's as it is. See [stacks](config.md#stacks).
|
|
83
82
|
- **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [how to cut the work]`** regenerates a module from its \*\*\*plain as it is now, as the `regenerate` tool does: what is left to regenerate is planned into pulses - one functional spec at a time, a few together or the whole module in one, as the planner judges - and the first starts. Words after the module are guidance for that plan (`/regenerate app models first`). A module's name typed with spaces for its underscores is that module - `/regenerate d365_function executor` is `d365_function_executor`. With no module named: the one `module:` in `config.turri.yaml` names, else the folder's top modules, to pick from. Asked for from scratch - `from scratch`, `start over`, `delete the module` - it starts at once, with nothing to confirm: it deletes the module's code and conformance tests in every codebase where they live, committed so `/lineage` keeps them, and regenerates the whole module from its \*\*\*plain, built though nothing in it changed: `/regenerate shorty from scratch`. The modules below it keep their code, and the module starts again from a copy of the code below it. Asked for its chain too - `/regenerate shorty from scratch, the whole chain` - the code of every module of its requires chain is deleted, the base's included, and the whole chain is regenerated from the bottom: what to do after modules were split, merged or moved, when the code below was laid out for modules that are no more. The chat's `regenerate` does the same with `from_scratch: "module"` or `"chain"`, when you ask for it; `turri regenerate --from-scratch` or `--from-scratch-chain` on the command line, not with `--dry-run`. Functional specs named after the module, each as `<module>:<func-id>` - `/regenerate shorty shorty:shorten shorty:expand` - are regenerated though their \*\*\*plain did not change, on the model chosen for functionalities: as `turri regenerate shorty.plain shorty:shorten shorty:expand` does, and the chat's `regenerate` with `funcIds`. A bare func-id is refused: the module is always named. Code built before functional specs had func-ids - its record numbers them - is never built on: the module's whole chain has to be regenerated from scratch, and the chat asks you first, as for a start over.
|
|
84
|
-
- **`/conform [module | file.plain] [module:func-id ...] [one by one]`** writes and runs a module's conformance tests now, as the `conform` tool does: those of the functional specs named, each as `<module>:<func-id>` - `/conform shorty shorty:shorten shorty:expand` - or, with none named, of every functional spec with scenarios. They go in one pulse, as far as a size guardrail lets; `one by one` (or `separately`, `one at a time`) has a pulse a functional spec. No other words are taken: there is no plan to guide. The module is found as `/regenerate` finds it. Asking for them is asking for them on: with conformance tests off, `/conform` turns them on first - `conformance-tests: true`, written where the module's value comes from - and says so: the one way the chat's work has them turned on, as the `conform` tool is refused while they are off. What would start nothing is found from the \*\*\*plain before anything is said - no scenarios, a functional spec named that is not there or has none, a step of adding tests skipped (no test reqs, no conformance testing script) - and turri answers it at once in the chat. What is missing that turri can write - the test reqs, the conformance testing script, the scenarios of the functional specs named, or of each one that needs them - it writes at once, without asking again: your `/conform` was the yes. Then it regenerates the module, and says what it wrote and why. What is yours to settle - a functional spec named that is not there - it tells you, starting nothing. Its tests come before anything is built on it: a codebase built on the module is stopped and deleted, and regenerated from it once they pass. Tests written already for the scenarios as built are said to be, and nothing starts.
|
|
83
|
+
- **`/conform [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [one by one]`** writes and runs a module's conformance tests now, as the `conform` tool does: those of the functional specs named, each as `<module>:<func-id>` - `/conform shorty shorty:shorten shorty:expand` - or, with none named, of every functional spec with scenarios. A functional spec named whose tests are written has them written again, deleted and written anew from its scenarios; `from scratch` takes out the tests folder where the module's code lives - the tip of its chain, never a module in the middle - its lineage keeping it, and writes the tests again from a copy of the tests of the module the tip requires; `from scratch, whole chain`, from nothing. None of it touches the code ([written again](regenerating.md#conformance-tests-in-the-work-loop)). They go in one pulse, as far as a size guardrail lets; `one by one` (or `separately`, `one at a time`) has a pulse a functional spec. No other words are taken: there is no plan to guide. The module is found as `/regenerate` finds it. Asking for them is asking for them on: with conformance tests off, `/conform` turns them on first - `conformance-tests: true`, written where the module's value comes from - and says so: the one way the chat's work has them turned on, as the `conform` tool is refused while they are off. What would start nothing is found from the \*\*\*plain before anything is said - no scenarios, a functional spec named that is not there or has none, a step of adding tests skipped (no test reqs, no conformance testing script) - and turri answers it at once in the chat. What is missing that turri can write - the test reqs, the conformance testing script, the scenarios of the functional specs named, or of each one that needs them - it writes at once, without asking again: your `/conform` was the yes. Then it regenerates the module, and says what it wrote and why. What is yours to settle - a functional spec named that is not there - it tells you, starting nothing. Its tests come before anything is built on it: a codebase built on the module is stopped and deleted, and regenerated from it once they pass. Tests written already for the scenarios as built are said to be, and nothing starts.
|
|
85
84
|
- **`/halt <id>`** halts a pulse - a queued one never starts - **`/halt <module>`** (or a planned row's id) halts a module's planned pulses until you ask for it again, a \*\*\*plain change not starting it, and **`/halt activated <name>`** halts a server `activate` started; it lists all three when no id is given.
|
|
86
85
|
- **What these commands show you, the chat knows.** What `/regenerate`, `/conform` and `/halt activated` tell you - \*\*\*plain that does not parse, the pulses planned, a server halted - stays in the chat under the command, and since a slash command runs outside the conversation, it is put in the conversation as well: say "fix it" next and turri knows what you are looking at. When `/conform` starts nothing, turri answers it at once - writing what it can of what is missing, and saying why for the rest. Once `/regenerate` or `/conform` has started pulses, turri says so in the chat too - what runs and what is planned, and that you need not wait for it - without starting anything more for it; a module already up to date gets the plan's answer alone. A halted pulse reaches it as every pulse's end does.
|
|
87
86
|
- **Nothing is queued.** What is left to build is worked out from what each codebase is built from and \*\*\*plain as it is now - again whenever a pulse ends or \*\*\*plain changes - and the first pulse of it runs; see [a whole module](regenerating.md#a-whole-module). Changes that overlap never pile up: the next pulse builds \*\*\*plain as it is. The pulses planned after the one running are listed behind it, as queued, and so is each module waiting for the one it is built on - "waits for base" - until it can be planned. A change inside what the running pulse regenerates - a functional spec it regenerates reworded or given a sub-bullet, a definition or req it is given, a file they link - steers it: its agent is told, and it lands \*\*\*plain as it is now there, twice a pulse at most. Otherwise a pulse building something \*\*\*plain no longer wants is stopped and rolled back - unless `allow-to-stop-jobs: false` in `config.turri.yaml`, which has it land first and the change regenerated on top. To drop something, take it out of \*\*\*plain - one \*\*\*plain diff. Stopping a pulse leaves its change in \*\*\*plain: the codebase waits until its \*\*\*plain changes or it is asked for again.
|
|
@@ -146,7 +145,7 @@ A provider a [pi](https://pi.dev) extension registers - a Claude subscription th
|
|
|
146
145
|
|
|
147
146
|
## Module history
|
|
148
147
|
|
|
149
|
-
Each `plain_modules/<module>` is a git repository whose git directory is `.plaingit` rather than `.git`, so it stays plain files to your own repository. A commit is made after every step that changes the module - a regeneration, a functionality regenerated, a conformance run, a regression repair, a \*\*\*plain change. `/lineage [module]` and `lineage` show it.
|
|
148
|
+
Each `plain_modules/<module>` is a git repository whose git directory is `.plaingit` rather than `.git`, so it stays plain files to your own repository. A commit is made after every step that changes the module - a regeneration, a functionality regenerated, a conformance run, a regression repair, a \*\*\*plain change. `/lineage [module]` and `turri lineage <module> [commit]` show it; the chat reads it with git.
|
|
150
149
|
|
|
151
150
|
The last commit is also the last known good state. Every regeneration, functionality regenerated, \*\*\*plain change and conformance run starts by putting the codebase it works in back to it, so if turri was stopped or restarted mid-pulse, whatever that pulse left half-written is undone first - and one that does not pass is undone the same way when it ends, commits and all. Only work that passed is committed. Installed dependencies and caches are not in the history and stay.
|
|
152
151
|
|
|
@@ -206,7 +205,8 @@ turri regenerate <file.plain> # regenerate what the code is not bui
|
|
|
206
205
|
turri regenerate <file.plain> app:add-task # regenerate a functional spec again, changed or not
|
|
207
206
|
turri regenerate <file.plain> --from-scratch # delete the module's code and tests (its lineage keeps them), regenerate all of it
|
|
208
207
|
turri regenerate <file.plain> --from-scratch-chain # the same for every module of its requires chain, from the bottom
|
|
209
|
-
turri conform <file.plain> app:add-task # black-box tests for one functional spec
|
|
208
|
+
turri conform <file.plain> app:add-task # black-box tests for one functional spec - written again when written already
|
|
209
|
+
turri conform <file.plain> --from-scratch # its tests folder taken out and written again; --from-scratch-chain, from nothing
|
|
210
210
|
turri lineage <module> # what each regeneration changed in a module, and when
|
|
211
211
|
turri cultivate debug-specs # run a skill directly - by name, the project's too, or by its folder
|
|
212
212
|
turri release <file.plain> # release what is regenerated to dist/<module>, and activate it here
|
|
@@ -52,6 +52,7 @@ The other rules say what a spec means. This one says what turri does with a chan
|
|
|
52
52
|
|
|
53
53
|
- Never edit the code under `plain_modules/`: the next regeneration does not keep it, and the code record no longer says what the code is
|
|
54
54
|
- In order of cost: change the spec where it is wrong or silent; regenerate the functional specs whose code went bad again, by name; regenerate the module from scratch, or its whole chain - only when the person asks for it or agrees to it
|
|
55
|
+
- Bad conformance tests are fixed the same way, their code untouched: `conform` naming a functional spec whose tests are written writes them again, anew from its scenarios; `conform` from scratch takes out the tests folder at the tip of the module's chain and writes them again - from the tests of the module the tip requires, or, its whole chain, from nothing - only when the person asks for it
|
|
55
56
|
- Pulses regenerate in the background: the spec can be changed while they run, and need not wait for them. A change inside what a running pulse regenerates steers it; the rest is planned again around it
|
|
56
57
|
- A pulse that does not land is rolled back whole - code, tests and record together - and its module waits until the spec changes or the module is asked for again. Running it again unchanged usually ends the same way: look at why it did not land first
|
|
57
58
|
- A finished pulse goes to the sentinel, a chat of turri's own - unless `sentinel: false`; under `sentinel: ask`, the default, only once the person said to start it, asked by turri before it first opens in a session (declined, a pulse goes to the chat that asked for it, as with `false`): it checks the pulse, tests what was released, fixes a testing script - or where the config says the scripts are - itself and regenerates the module again, and puts anything else that is wrong to the person as a notice with what can be done. It never changes ***plain. turri installs nothing on the machine and changes none of its settings - not the sentinel, the chat, a release or any agent: a toolchain the machine lacks is the person's to install, told the exact command. A pulse that landed is told to the chat the person is in too, only to say it landed and what the sentinel does with it, and when the sentinel is done with a pulse, what it found - the chat does nothing else about either; a pulse that went wrong is not told to it - the chat's agent is given a notice's task once the person accepts it, and does that
|