@turri-dev/cli 0.1.3-next.f74e98a → 0.1.4-next.172be6f
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 +22 -1
- package/dist/ask.js +34 -15
- package/dist/cli-options.js +12 -6
- package/dist/config-edit.js +1 -0
- package/dist/config.js +5 -2
- package/dist/extension.js +86 -25
- package/dist/genome.js +1 -1
- package/dist/init-config.js +5 -0
- package/dist/loop-cli.js +13 -1
- package/dist/loop-tools.js +31 -12
- package/dist/pi-launch.js +5 -0
- package/dist/pi.js +48 -19
- package/dist/question-dialog.js +9 -3
- package/dist/questioning.js +1 -1
- package/dist/regenerate/activity.js +14 -0
- package/dist/regenerate/conform.js +5 -5
- package/dist/regenerate/conformance-agents.js +28 -8
- package/dist/regenerate/conformance.js +24 -10
- package/dist/regenerate/list-arguments.js +121 -0
- package/dist/regenerate/loop.js +137 -18
- package/dist/regenerate/notes.js +66 -17
- package/dist/regenerate/prompt.js +3 -1
- package/dist/regenerate/regenerate.js +16 -10
- package/dist/regenerate/regression.js +2 -1
- package/dist/regenerate/requires.js +55 -2
- package/dist/regenerate/self-check.js +13 -6
- package/dist/regenerate/test-scripts.js +54 -10
- package/dist/regenerate/unit-review.js +12 -1
- package/dist/regenerate-cli.js +11 -5
- package/dist/release-tools.js +1 -1
- package/dist/resume-line.js +4 -0
- package/dist/review/live.js +2 -1
- package/dist/run-report.js +34 -1
- package/dist/spec-tools.js +10 -45
- package/docs/authoring-plain.md +9 -6
- package/docs/config.md +3 -2
- package/docs/headless.md +30 -3
- package/docs/installation.md +3 -0
- package/docs/regenerating.md +69 -20
- package/docs/skills-and-gates.md +5 -3
- package/docs/using.md +20 -9
- package/genome/skills/bud/SKILL.md +67 -36
- package/genome/skills/bud/references/intent.md +4 -0
- package/genome/skills/refactor-module/SKILL.md +24 -2
- package/package.json +3 -3
- package/genome/skills/bud/references/checklist.md +0 -44
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ npm install -g @turri-dev/cli # puts `turri` on your PATH
|
|
|
27
27
|
turri doctor # checks the machine
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
To work on turri itself, run it from a clone
|
|
30
|
+
To follow `main` as it moves, or work on turri itself, run it [from a clone](#from-a-clone) instead.
|
|
31
31
|
|
|
32
32
|
`doctor` checks for Node 22.19+, bash, the OS sandbox and a model provider for pi; in a project, the toolchains its
|
|
33
33
|
modules need, what its testing scripts run against this machine, and that each model `config.turri.yaml` names
|
|
@@ -73,6 +73,27 @@ Rather not install Node and the rest? **turri** also runs in Docker, from one im
|
|
|
73
73
|
|
|
74
74
|
Choosing models: [models](#models); what to do next: [use](#use).
|
|
75
75
|
|
|
76
|
+
### From a clone
|
|
77
|
+
|
|
78
|
+
In place of the npm package - for the latest of `main`, or to change turri itself:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone git@github.com:turri-oss/turri.git && cd turri
|
|
82
|
+
npm install
|
|
83
|
+
npm link # puts `turri` on your PATH, pointing at this clone
|
|
84
|
+
turri doctor
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The clone runs its TypeScript sources directly, so there is nothing to build. When new commits land:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git pull
|
|
91
|
+
npm install # picks up any dependency that changed
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
A **turri** already running keeps the code it started with - start it again to run what you pulled. More in
|
|
95
|
+
[installation](docs/installation.md#from-a-clone).
|
|
96
|
+
|
|
76
97
|
## Why
|
|
77
98
|
|
|
78
99
|
In the age of coding agents, writing code is getting easy. The hard and important part is
|
package/dist/ask.js
CHANGED
|
@@ -9,6 +9,9 @@ import { PANEL_KEY } from "./regenerate/job-panel.js";
|
|
|
9
9
|
export const OTHER_OPTION = "Something else…";
|
|
10
10
|
export const CHAT_OPTION = "Chat about this";
|
|
11
11
|
export const DONE_OPTION = "Done — that's all of them";
|
|
12
|
+
/** An option's box in a question of several, ticked and not. */
|
|
13
|
+
export const TICKED = "☑";
|
|
14
|
+
export const UNTICKED = "☐";
|
|
12
15
|
export const DISMISSED = "The user dismissed the question without answering.";
|
|
13
16
|
/** How an answer that is no answer starts: the person chose to talk about the question first. */
|
|
14
17
|
export const CHAT_PREFIX = "The user has not answered this question yet: they chose to talk about it first.";
|
|
@@ -107,32 +110,48 @@ export async function runAsk(asked, io) {
|
|
|
107
110
|
return choice;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
|
-
// Pick several:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
// Pick several: every option a box, ticked and unticked as it is chosen, until they say they are done. What they type
|
|
114
|
+
// is one more box, ticked - and can be unticked too. Something else, Chat about this and Done are no boxes.
|
|
115
|
+
const listed = [...options];
|
|
116
|
+
const ticked = new Set();
|
|
117
|
+
const picked = () => listed.filter((option) => ticked.has(option));
|
|
118
|
+
let at = 0;
|
|
119
|
+
for (;;) {
|
|
120
|
+
const rows = listed.map((option) => `${ticked.has(option) ? TICKED : UNTICKED} ${option}`);
|
|
121
|
+
const choice = await io.select(request.question, [...rows, ...extras, DONE_OPTION], context, at);
|
|
122
|
+
if (choice === undefined || choice === DONE_OPTION)
|
|
119
123
|
break;
|
|
120
124
|
if (choice === OTHER_OPTION) {
|
|
125
|
+
at = listed.length;
|
|
121
126
|
const typed = await typeInstead();
|
|
122
|
-
if (
|
|
123
|
-
|
|
127
|
+
if (typedNothing(typed))
|
|
128
|
+
continue;
|
|
129
|
+
const option = typed.trim();
|
|
130
|
+
if (!listed.includes(option))
|
|
131
|
+
listed.push(option);
|
|
132
|
+
ticked.add(option);
|
|
133
|
+
at = listed.indexOf(option);
|
|
124
134
|
continue;
|
|
125
135
|
}
|
|
126
136
|
if (choice === CHAT_OPTION) {
|
|
137
|
+
at = listed.length + extras.indexOf(CHAT_OPTION);
|
|
127
138
|
const said = await chatAbout();
|
|
128
139
|
if (typedNothing(said))
|
|
129
140
|
continue;
|
|
130
|
-
return chatAnswer(said,
|
|
141
|
+
return chatAnswer(said, picked());
|
|
131
142
|
}
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
// A row, or - where the answer is typed, on the command line - an option by its text, or one more of their own.
|
|
144
|
+
const row = rows.indexOf(choice);
|
|
145
|
+
const option = row !== -1 ? listed[row] : choice.trim();
|
|
146
|
+
if (!listed.includes(option))
|
|
147
|
+
listed.push(option);
|
|
148
|
+
if (ticked.has(option))
|
|
149
|
+
ticked.delete(option);
|
|
150
|
+
else
|
|
151
|
+
ticked.add(option);
|
|
152
|
+
at = listed.indexOf(option);
|
|
134
153
|
}
|
|
135
|
-
return
|
|
154
|
+
return ticked.size > 0 ? picked().join(", ") : DISMISSED;
|
|
136
155
|
}
|
|
137
156
|
/**
|
|
138
157
|
* While a question is open, what catches ctrl+h on the terminal's input: pi gives an extension's shortcut only the keys
|
package/dist/cli-options.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { conformanceOption, overrideConfig,
|
|
1
|
+
import { booleanOption, conformanceOption, overrideConfig, splitModelSpec } from "./config.js";
|
|
2
2
|
/**
|
|
3
3
|
* The command line of turri's commands: their words, and the options that stand for the config's own keys - kept apart
|
|
4
4
|
* from the commands that use them, so a light one (doctor) reads them as a regenerate does without loading it.
|
|
@@ -51,19 +51,24 @@ export function optionValue(options, name) {
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* The options that stand for the config's own keys - `--harness-model`, `--coding-model` (`--model`), `--judge-model`
|
|
54
|
-
* and, as asked, `--review` and `--conformance-tests` - read as if config.turri.yaml had them, in their place in the
|
|
54
|
+
* and, as asked, `--review`, `--mutation-testing` and `--conformance-tests` - read as if config.turri.yaml had them, in their place in the
|
|
55
55
|
* order the config resolves them in (overrideConfig): a run, or doctor, with them is the same as one with them in the
|
|
56
56
|
* file. Exits on a value it cannot read.
|
|
57
57
|
*/
|
|
58
58
|
export function configKeyOptions(options, take = {}) {
|
|
59
|
+
const flag = (name) => {
|
|
60
|
+
const given = take.review === true ? optionValue(options, name) : undefined;
|
|
61
|
+
const value = given !== undefined ? booleanOption(given) : undefined;
|
|
62
|
+
if (given !== undefined && value === undefined)
|
|
63
|
+
failOption(`--${name} takes true or false, not ${given}`);
|
|
64
|
+
return value;
|
|
65
|
+
};
|
|
59
66
|
const tests = take.conformance === true ? optionValue(options, "conformance-tests") : undefined;
|
|
60
67
|
const setting = tests !== undefined ? conformanceOption(tests) : undefined;
|
|
61
68
|
if (tests !== undefined && setting === undefined)
|
|
62
69
|
failOption(`--conformance-tests takes all, chosen, module or false, not ${tests}`);
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
if (reviewed !== undefined && review === undefined)
|
|
66
|
-
failOption(`--review takes true or false, not ${reviewed}`);
|
|
70
|
+
const review = flag("review");
|
|
71
|
+
const mutationTesting = flag("mutation-testing");
|
|
67
72
|
const model = (name, key) => {
|
|
68
73
|
const spec = optionValue(options, name);
|
|
69
74
|
return spec !== undefined ? { [key]: splitModelSpec(spec) } : {};
|
|
@@ -74,6 +79,7 @@ export function configKeyOptions(options, take = {}) {
|
|
|
74
79
|
...model("judge-model", "judgeModel"),
|
|
75
80
|
...(setting !== undefined ? { conformanceTests: setting } : {}),
|
|
76
81
|
...(review !== undefined ? { review } : {}),
|
|
82
|
+
...(mutationTesting !== undefined ? { mutationTesting } : {}),
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
function failOption(message) {
|
package/dist/config-edit.js
CHANGED
|
@@ -59,6 +59,7 @@ export function settings(rules = []) {
|
|
|
59
59
|
{ key: "conformance-tests", about: "which functional specs get conformance tests", kind: "choice", options: ["all", "chosen", "module", "false"], unset: "all, where a module has test reqs", effect: "next-plan" },
|
|
60
60
|
{ key: "conformance-budget", about: "under conformance-tests: chosen or module, how many may be chosen - a count or a share", kind: "budget", options: ["10%", "30%", "50%", "5", "10"], unset: "no limit", effect: "next-plan" },
|
|
61
61
|
{ key: "review", about: "whether the code and its tests are reviewed once they pass", kind: "boolean", unset: "true", effect: "next-pulse" },
|
|
62
|
+
{ key: "mutation-testing", about: "whether the coding agent and the reviewer can put a bug in the code for one test run (can_it_fail)", kind: "boolean", unset: "true", effect: "next-pulse" },
|
|
62
63
|
{ key: "allow-to-stop-jobs", about: "whether turri stops a running pulse the spec has moved on from", kind: "boolean", unset: "true", effect: "now" },
|
|
63
64
|
{ key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
|
|
64
65
|
{ key: "unittests-script", about: "the unit testing script, by path from the project root", kind: "path", unset: "the one run_unittests*.sh found", effect: "next-test-run" },
|
package/dist/config.js
CHANGED
|
@@ -21,6 +21,7 @@ import { projectDirOf } from "./regenerate/paths.js";
|
|
|
21
21
|
* conformance-tests: chosen # all, chosen (those with acceptance tests, and those the chooser picks after each pulse), module (the chooser picks, and plans, once the module is regenerated) or false (default: false)
|
|
22
22
|
* conformance-budget: 30% # under chosen or module: how many functional specs a module may have chosen, beside those with acceptance tests - a count or a share (default: no limit)
|
|
23
23
|
* review: false # review the code and its tests once they pass (default: true)
|
|
24
|
+
* mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
|
|
24
25
|
* allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
|
|
25
26
|
* release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
|
|
26
27
|
* rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
|
|
@@ -331,6 +332,7 @@ export const CONFIG_KEYS = {
|
|
|
331
332
|
conformanceTests: "conformance-tests",
|
|
332
333
|
conformanceBudget: "conformance-budget",
|
|
333
334
|
review: "review",
|
|
335
|
+
mutationTesting: "mutation-testing",
|
|
334
336
|
allowToStopJobs: "allow-to-stop-jobs",
|
|
335
337
|
releaseAfterPulse: "release-after-pulse",
|
|
336
338
|
unittestsScript: "unittests-script",
|
|
@@ -416,8 +418,8 @@ export function overrideConfig(overrides) {
|
|
|
416
418
|
export function conformanceOption(value) {
|
|
417
419
|
return conformanceSetting(value);
|
|
418
420
|
}
|
|
419
|
-
/** `--review <value>`: the config's own, true or false. Undefined for anything else. */
|
|
420
|
-
export function
|
|
421
|
+
/** `--review <value>`, `--mutation-testing <value>`: the config's own, true or false. Undefined for anything else. */
|
|
422
|
+
export function booleanOption(value) {
|
|
421
423
|
const word = value.trim().toLowerCase();
|
|
422
424
|
return word === "true" ? true : word === "false" ? false : undefined;
|
|
423
425
|
}
|
|
@@ -487,6 +489,7 @@ function readConfigFile(path) {
|
|
|
487
489
|
conformanceTests: conformanceSetting(conformance),
|
|
488
490
|
conformanceBudget: budgetSetting(raw[CONFIG_KEYS.conformanceBudget]),
|
|
489
491
|
review: typeof raw[CONFIG_KEYS.review] === "boolean" ? raw[CONFIG_KEYS.review] : undefined,
|
|
492
|
+
mutationTesting: typeof raw[CONFIG_KEYS.mutationTesting] === "boolean" ? raw[CONFIG_KEYS.mutationTesting] : undefined,
|
|
490
493
|
allowToStopJobs: typeof raw[CONFIG_KEYS.allowToStopJobs] === "boolean" ? raw[CONFIG_KEYS.allowToStopJobs] : undefined,
|
|
491
494
|
releaseAfterPulse: typeof raw[CONFIG_KEYS.releaseAfterPulse] === "boolean" ? raw[CONFIG_KEYS.releaseAfterPulse] : undefined,
|
|
492
495
|
unittestsScript: text(raw[CONFIG_KEYS.unittestsScript]),
|
package/dist/extension.js
CHANGED
|
@@ -16,7 +16,7 @@ import { readScript, scriptAgainstMachine, stackOnMachine, toolchainsBlock } fro
|
|
|
16
16
|
import { sandboxAvailable, sandboxSummary } from "./regenerate/os-sandbox.js";
|
|
17
17
|
import { findTestScripts } from "./regenerate/test-scripts.js";
|
|
18
18
|
import { createAskUserTool } from "./tools.js";
|
|
19
|
-
import { asksFromScratch, driftTool, fromWorkingDir, haltTool, loopReply, MODEL_PARAM, regenerateTool, stopJob, WAIT_PARAM, WORKING_DIR_PARAM } from "./loop-tools.js";
|
|
19
|
+
import { asksFromScratch, asksWholeChain, driftTool, fromWorkingDir, haltTool, loopReply, MODEL_PARAM, regenerateTool, stopJob, WAIT_PARAM, WORKING_DIR_PARAM } from "./loop-tools.js";
|
|
20
20
|
import { createWebTools } from "./regenerate/web.js";
|
|
21
21
|
import { describeGates, interruptedRun, runSkill } from "./genome.js";
|
|
22
22
|
import { skillStatus } from "./skill.js";
|
|
@@ -41,7 +41,7 @@ import { createJobsTreeState, selectJob } from "./regenerate/jobs-tree.js";
|
|
|
41
41
|
import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
|
|
42
42
|
import { HISTORY_DIR, historyLog, historyShow } from "./regenerate/lineage.js";
|
|
43
43
|
import { defaultBuildDir } from "./regenerate/paths.js";
|
|
44
|
-
import { describeUsage } from "./regenerate/activity.js";
|
|
44
|
+
import { describeTurnIncident, describeUsage, onModelEvent } from "./regenerate/activity.js";
|
|
45
45
|
import { describeSpecConflict } from "./regenerate/stop-report.js";
|
|
46
46
|
import { inheritProviders, inheritThinkingLevel } from "./pi.js";
|
|
47
47
|
import { beginCapture, captureConsole, describeCaptured, dropNoise } from "./quiet.js";
|
|
@@ -90,17 +90,26 @@ aside) {
|
|
|
90
90
|
// The question, with what the asker gives to read for it - a brief to confirm - above it; what it said of its work
|
|
91
91
|
// before asking is kept in its record, never put in the dialog.
|
|
92
92
|
// A dialog of turri's own: a long brief scrolls above the question, and the options always show (question-dialog.ts).
|
|
93
|
-
const dialog = (question, context, options) => ctx.ui.custom((tui, theme, _keybindings, done) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const dialog = (question, context, options, selected) => ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
94
|
+
const shown = new QuestionDialog({
|
|
95
|
+
question,
|
|
96
|
+
...(context !== undefined ? { context } : {}),
|
|
97
|
+
...(options !== undefined ? { options } : {}),
|
|
98
|
+
...(selected !== undefined ? { selected } : {}),
|
|
99
|
+
rows: () => tui.terminal.rows,
|
|
100
|
+
style: { accent: (text) => theme.fg("accent", text), muted: (text) => theme.fg("muted", text), bold: (text) => theme.bold(text) },
|
|
101
|
+
done: (answer) => {
|
|
102
|
+
if (questionShown === shown)
|
|
103
|
+
questionShown = undefined;
|
|
104
|
+
done(answer);
|
|
105
|
+
},
|
|
106
|
+
requestRender: () => tui.requestRender(),
|
|
107
|
+
});
|
|
108
|
+
questionShown = shown;
|
|
109
|
+
return shown;
|
|
110
|
+
});
|
|
102
111
|
const asking = (asked) => runAsk(asked, {
|
|
103
|
-
select: (title, options, context) => dialog(title, context, options),
|
|
112
|
+
select: (title, options, context, at) => dialog(title, context, options, at),
|
|
104
113
|
input: (title, context) => dialog(title, context),
|
|
105
114
|
});
|
|
106
115
|
const bare = { ...request, said: undefined };
|
|
@@ -117,6 +126,12 @@ aside) {
|
|
|
117
126
|
}
|
|
118
127
|
/** The side panel, as a question open in the chat reaches it: set once the extension has its panel. */
|
|
119
128
|
let questionPeek;
|
|
129
|
+
/**
|
|
130
|
+
* The question open in the chat now, if any. The side panel gives the keys back to it: pi would give them to what had the
|
|
131
|
+
* focus when the panel first opened, and a panel kept beside the chat outlives that question - the keys would go to a
|
|
132
|
+
* dialog already answered, and nothing would take them.
|
|
133
|
+
*/
|
|
134
|
+
let questionShown;
|
|
120
135
|
/** A widget with nothing to draw: below the editor, it takes no line. */
|
|
121
136
|
const PEEK_KEY_WIDGET = "turri-peek-key";
|
|
122
137
|
/**
|
|
@@ -313,6 +328,19 @@ export default function (pi) {
|
|
|
313
328
|
};
|
|
314
329
|
pi.on("agent_end", endTurnCapture);
|
|
315
330
|
pi.on("agent_settled", endTurnCapture);
|
|
331
|
+
// A pulse's provider failing and waited out, or a turn turri ended itself: said in the chat as it happens - the job
|
|
332
|
+
// panel's activity holds it too, but scrolls by.
|
|
333
|
+
let stopTurnIncidents;
|
|
334
|
+
pi.on("session_start", (_event, ctx) => {
|
|
335
|
+
stopTurnIncidents?.();
|
|
336
|
+
if (!ctx.hasUI)
|
|
337
|
+
return;
|
|
338
|
+
stopTurnIncidents = onModelEvent((event) => {
|
|
339
|
+
const line = describeTurnIncident(event);
|
|
340
|
+
if (line !== undefined)
|
|
341
|
+
ctx.ui.notify(event.job !== undefined ? `${event.job}: ${line}` : line, "warning");
|
|
342
|
+
});
|
|
343
|
+
});
|
|
316
344
|
// What a turri that was killed left running - its commands' process groups - stopped as this one starts.
|
|
317
345
|
const orphans = sweepOrphanedGroups();
|
|
318
346
|
let orphansSaid = orphans === 0;
|
|
@@ -534,7 +562,7 @@ export default function (pi) {
|
|
|
534
562
|
loopTools: [
|
|
535
563
|
regenerateTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named, work) => jobModel(ctx, work ?? "spec_changes", named, plainFile), wait: () => false }),
|
|
536
564
|
driftTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx) }),
|
|
537
|
-
haltTool({ jobs }),
|
|
565
|
+
haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop }),
|
|
538
566
|
conformTool({ cwd, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, "spec_changes", named, plainFile), wait: () => false }),
|
|
539
567
|
],
|
|
540
568
|
// The escalation becomes a real dialog in the TUI. Without dialog-capable
|
|
@@ -596,7 +624,7 @@ function registerRegenerate(pi, cwd, jobs) {
|
|
|
596
624
|
// by the planner: one functional spec at a time, a few together or the whole module in one, as it judges. What
|
|
597
625
|
// follows the module is guidance for that plan, in the person's words.
|
|
598
626
|
pi.registerCommand("regenerate", {
|
|
599
|
-
description: "Regenerate a module from its spec as it is now, in pulses the planner cuts - named functionalities though they did not change, or all of it from scratch: /regenerate [module | file.plain] [functionality ...] [from scratch] [how to cut the work]",
|
|
627
|
+
description: "Regenerate a module from its spec as it is now, in pulses the planner cuts - named functionalities though they did not change, or all of it from scratch, its whole chain too when asked: /regenerate [module | file.plain] [functionality ...] [from scratch [whole chain]] [how to cut the work]",
|
|
600
628
|
handler: async (args, ctx) => {
|
|
601
629
|
const command = `/regenerate ${args.trim()}`.trim();
|
|
602
630
|
await echoCommand(pi, command);
|
|
@@ -638,13 +666,17 @@ function registerRegenerate(pi, cwd, jobs) {
|
|
|
638
666
|
}
|
|
639
667
|
// From scratch - started over, its code deleted - asked in the person's words: confirmed first, as it deletes.
|
|
640
668
|
const scratch = asksFromScratch(guidance);
|
|
669
|
+
// The whole chain with it - "from scratch, the whole chain" - every module it requires built again from the bottom.
|
|
670
|
+
const chain = scratch && asksWholeChain(guidance);
|
|
641
671
|
const module = basename(plainFile).replace(/\.plain$/, "");
|
|
642
672
|
if (scratch && again.length > 0) {
|
|
643
673
|
say("Name functionalities or ask for it from scratch, not both: from scratch regenerates every one of them.", "warning");
|
|
644
674
|
return;
|
|
645
675
|
}
|
|
646
676
|
if (scratch && ctx.hasUI) {
|
|
647
|
-
const agreed = await ctx.ui.confirm(`Regenerate ${module}
|
|
677
|
+
const agreed = await ctx.ui.confirm(chain ? `Regenerate ${module} and its whole chain from scratch?` : `Regenerate ${module} from scratch?`, chain
|
|
678
|
+
? `The code and conformance tests of ${module} and of every module it requires are deleted - committed first, so /lineage keeps them - and the whole chain is regenerated from its spec, from the bottom.`
|
|
679
|
+
: `Its code and conformance tests are deleted - committed first, so /lineage ${module} keeps them - and the whole module is regenerated from its spec.`);
|
|
648
680
|
if (!agreed)
|
|
649
681
|
return;
|
|
650
682
|
}
|
|
@@ -654,14 +686,14 @@ function registerRegenerate(pi, cwd, jobs) {
|
|
|
654
686
|
// Said at once, and kept in the chat: what follows takes a while - the planner is an agent - and the person sees it
|
|
655
687
|
// began, not a chat that stays empty until the first pulse starts. The plan is said under it once it is made.
|
|
656
688
|
say(scratch
|
|
657
|
-
? `Deleting ${module}'s code, then planning all of it again…`
|
|
689
|
+
? `Deleting ${module}'s code${chain ? " and its whole chain's" : ""}, then planning all of it again…`
|
|
658
690
|
: again.length > 0
|
|
659
691
|
? `Planning ${module}'s functionalit${again.length === 1 ? "y" : "ies"} ${again.join(", ")} again…`
|
|
660
692
|
: `Planning ${module}'s pulses…`, "info");
|
|
661
693
|
await nextFrame();
|
|
662
694
|
try {
|
|
663
695
|
const statuses = scratch
|
|
664
|
-
? await loop.fromScratch(plainFile, request)
|
|
696
|
+
? await loop.fromScratch(plainFile, { ...request, chain })
|
|
665
697
|
: again.length > 0
|
|
666
698
|
? await loop.regenerateAgain(plainFile, again, request)
|
|
667
699
|
: await loop.bringUp(plainFile, request);
|
|
@@ -1405,25 +1437,37 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1405
1437
|
// The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
|
|
1406
1438
|
// list, finished jobs included, put in the transcript where it stays.
|
|
1407
1439
|
pi.registerCommand("halt", {
|
|
1408
|
-
description: "Halt a queued or running pulse, or what activate started: /halt [pulse id | activated <name>]",
|
|
1440
|
+
description: "Halt a queued or running pulse, a module's planned pulses, or what activate started: /halt [pulse id | module | activated <name>]",
|
|
1409
1441
|
handler: async (args, ctx) => {
|
|
1410
1442
|
if (!ctx.hasUI)
|
|
1411
1443
|
return;
|
|
1412
1444
|
const live = jobs.list().filter((job) => job.status === "running" || job.status === "queued");
|
|
1413
1445
|
const deployed = runningDeployed();
|
|
1446
|
+
const loop = workLoops.get(jobs)?.loop;
|
|
1447
|
+
// A module's planned pulses, one line a module: halting one halts the module.
|
|
1448
|
+
const plannedRows = loop?.planned() ?? [];
|
|
1449
|
+
const planned = [...new Set(plannedRows.map((row) => row.module ?? ""))].filter((module) => module !== "");
|
|
1414
1450
|
let id = args.trim();
|
|
1415
1451
|
if (id === "") {
|
|
1416
|
-
if (live.length === 0 && deployed.length === 0)
|
|
1417
|
-
return ctx.ui.notify("Nothing is regenerating or
|
|
1452
|
+
if (live.length === 0 && deployed.length === 0 && planned.length === 0)
|
|
1453
|
+
return ctx.ui.notify("Nothing is regenerating, queued or planned.", "info");
|
|
1418
1454
|
const label = (job) => `${job.id} ${job.status.padEnd(8)} ${pulseName(job)}`;
|
|
1419
|
-
const
|
|
1455
|
+
const plannedLabel = (module) => {
|
|
1456
|
+
const rows = plannedRows.filter((row) => row.module === module);
|
|
1457
|
+
const waiting = rows.find((row) => row.id.endsWith("-waiting"));
|
|
1458
|
+
return `${module} ${waiting !== undefined ? waiting.summary : `${rows.length} planned`} - halts the module`;
|
|
1459
|
+
};
|
|
1460
|
+
const labels = [...live.map(label), ...planned.map(plannedLabel), ...deployed.map((item) => deployedLabel(item.name, item.url ?? item.command))];
|
|
1420
1461
|
const picked = await ctx.ui.select("Halt which?", labels);
|
|
1421
1462
|
const job = live.find((candidate) => picked !== undefined && label(candidate) === picked);
|
|
1463
|
+
const module = planned.find((name) => picked !== undefined && plannedLabel(name) === picked);
|
|
1422
1464
|
const server = deployed.find((item) => picked !== undefined && deployedLabel(item.name, item.url ?? item.command) === picked);
|
|
1423
1465
|
if (server !== undefined)
|
|
1424
1466
|
id = `activated ${server.name}`;
|
|
1425
1467
|
else if (job !== undefined)
|
|
1426
1468
|
id = job.id;
|
|
1469
|
+
else if (module !== undefined)
|
|
1470
|
+
id = module;
|
|
1427
1471
|
else
|
|
1428
1472
|
return;
|
|
1429
1473
|
}
|
|
@@ -1432,7 +1476,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1432
1476
|
const stopped = await stopDeployed({ name });
|
|
1433
1477
|
return shownAfterCommand(pi, ctx, `/halt ${id}`, stopped.length > 0 ? `Halted ${stopped.join(", ")}.` : `Nothing activate started is running as ${name}.`, "info");
|
|
1434
1478
|
}
|
|
1435
|
-
ctx.ui.notify(stopJob(jobs, id), "info");
|
|
1479
|
+
ctx.ui.notify(stopJob(jobs, id, undefined, loop), "info");
|
|
1436
1480
|
},
|
|
1437
1481
|
});
|
|
1438
1482
|
// Debug mode, for the render agents started from now on - see debug-log.ts.
|
|
@@ -1508,6 +1552,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1508
1552
|
}
|
|
1509
1553
|
needsLooking.delete(jobs);
|
|
1510
1554
|
if (panel !== undefined) {
|
|
1555
|
+
panel.keepChatFocus();
|
|
1511
1556
|
panel.handle?.setHidden(false);
|
|
1512
1557
|
panel.keys = true;
|
|
1513
1558
|
panel.handle?.focus();
|
|
@@ -1515,7 +1560,21 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1515
1560
|
}
|
|
1516
1561
|
// Not awaited: the panel lives on while the jobs it shows run.
|
|
1517
1562
|
void ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
1518
|
-
|
|
1563
|
+
// What the chat shows when the panel takes the keys - its editor, or a pi dialog - for when it gives them back.
|
|
1564
|
+
const focusedNow = () => tui.getFocusedComponent?.() ?? null;
|
|
1565
|
+
let chatFocus = focusedNow();
|
|
1566
|
+
const keepChatFocus = () => {
|
|
1567
|
+
const focused = focusedNow();
|
|
1568
|
+
if (focused !== null && focused !== component && !(focused instanceof QuestionDialog))
|
|
1569
|
+
chatFocus = focused;
|
|
1570
|
+
};
|
|
1571
|
+
// The keys back to the chat: to the question open there now, else to what it showed - never to a question answered
|
|
1572
|
+
// while the panel was open.
|
|
1573
|
+
const giveBack = () => entry.handle?.unfocus({ target: questionShown ?? chatFocus });
|
|
1574
|
+
const close = () => {
|
|
1575
|
+
giveBack();
|
|
1576
|
+
done(undefined);
|
|
1577
|
+
};
|
|
1519
1578
|
panelTerminal = tui.terminal;
|
|
1520
1579
|
let component;
|
|
1521
1580
|
// Beside the chat: the chat drawn narrower, on the left, and a click on either side giving it the keys - undone
|
|
@@ -1548,10 +1607,11 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1548
1607
|
// Beside the chat, back to it: the chat has the keys, the panel stays.
|
|
1549
1608
|
const toChat = () => {
|
|
1550
1609
|
entry.keys = false;
|
|
1551
|
-
|
|
1610
|
+
giveBack();
|
|
1552
1611
|
tui.requestRender();
|
|
1553
1612
|
};
|
|
1554
1613
|
const toPanel = () => {
|
|
1614
|
+
keepChatFocus();
|
|
1555
1615
|
entry.keys = true;
|
|
1556
1616
|
entry.handle?.focus();
|
|
1557
1617
|
tui.requestRender();
|
|
@@ -1604,7 +1664,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1604
1664
|
return focused !== null && focused !== component;
|
|
1605
1665
|
},
|
|
1606
1666
|
});
|
|
1607
|
-
const entry = { view, close, keys: true };
|
|
1667
|
+
const entry = { view, close, keepChatFocus, keys: true };
|
|
1608
1668
|
panel = entry;
|
|
1609
1669
|
layOut();
|
|
1610
1670
|
// Every key goes to the panel while it shows, whatever has the focus: a question the chat model asks in the
|
|
@@ -2007,6 +2067,7 @@ function registerDeploy(pi, cwd, jobs, state) {
|
|
|
2007
2067
|
cwd,
|
|
2008
2068
|
state,
|
|
2009
2069
|
jobs,
|
|
2070
|
+
workLoop: () => workLoops.get(jobs)?.loop,
|
|
2010
2071
|
defaultPlainFile: () => readProjectConfig(cwd).module,
|
|
2011
2072
|
});
|
|
2012
2073
|
for (const tool of tools)
|
package/dist/genome.js
CHANGED
|
@@ -185,7 +185,7 @@ export async function runSkill(opts) {
|
|
|
185
185
|
// Built renders were lost with the process; queue what the specs hold that is not built.
|
|
186
186
|
if (resumed !== undefined && opts.renderQueue !== undefined) {
|
|
187
187
|
for (const file of plainFilesIn(opts.cwd))
|
|
188
|
-
void opts.renderQueue.bringUp(file).catch(() => undefined);
|
|
188
|
+
void opts.renderQueue.bringUp(file, { specChange: true }).catch(() => undefined);
|
|
189
189
|
}
|
|
190
190
|
if (liveStep !== undefined && liveProxy !== undefined) {
|
|
191
191
|
const continuous = liveStep.gate.continuous;
|
package/dist/init-config.js
CHANGED
|
@@ -110,6 +110,7 @@ export function withModels(text, lines) {
|
|
|
110
110
|
export const DEFAULTS = {
|
|
111
111
|
conformanceTests: false,
|
|
112
112
|
review: false,
|
|
113
|
+
mutationTesting: true,
|
|
113
114
|
allowToStopJobs: true,
|
|
114
115
|
releaseAfterPulse: false,
|
|
115
116
|
testingScriptsRunOn: "in-place",
|
|
@@ -143,6 +144,10 @@ export function quickStartConfig(vendor = "other", bedrock) {
|
|
|
143
144
|
"# Whether the code and its tests are reviewed once they pass - two reviews at most, the second weighed by the arbiter.",
|
|
144
145
|
`review: ${DEFAULTS.review}`,
|
|
145
146
|
"",
|
|
147
|
+
"# Whether the coding agent and the reviewer can put a bug in the code for one run of the unit tests (can_it_fail),",
|
|
148
|
+
"# to see that a test catches it - on a copy of the code, or in place and put back after.",
|
|
149
|
+
`mutation-testing: ${DEFAULTS.mutationTesting}`,
|
|
150
|
+
"",
|
|
146
151
|
"# Whether turri stops a running pulse the spec has moved on from. false: it lands, the change regenerated on top.",
|
|
147
152
|
`allow-to-stop-jobs: ${DEFAULTS.allowToStopJobs}`,
|
|
148
153
|
"",
|
package/dist/loop-cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import { resolve, sep } from "node:path";
|
|
|
4
4
|
import { configForSpec, inheritModel, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, ROLE_THINKING, splitModelSpec, } from "./config.js";
|
|
5
5
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
6
6
|
import { c } from "./module-report.js";
|
|
7
|
+
import { describeTurnIncident, onModelEvent } from "./regenerate/activity.js";
|
|
7
8
|
import { tryItCommand } from "./regenerate/delivery.js";
|
|
8
9
|
import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
|
|
9
10
|
import { createJobRegistry, pulseName } from "./regenerate/jobs.js";
|
|
@@ -51,6 +52,7 @@ export async function runLoop(options) {
|
|
|
51
52
|
...(buildDir !== undefined ? { buildDir } : {}),
|
|
52
53
|
conformanceTests: conformanceLabel(project.conformanceTests),
|
|
53
54
|
review: project.review === true,
|
|
55
|
+
mutationTesting: project.mutationTesting !== false,
|
|
54
56
|
models: reportModels(project, model),
|
|
55
57
|
})
|
|
56
58
|
: undefined;
|
|
@@ -85,9 +87,19 @@ async function runLoopReporting(options) {
|
|
|
85
87
|
console.log(`${mark} ${job.id} ${pulseName(job)} - ${job.status}`);
|
|
86
88
|
if (job.status !== "succeeded")
|
|
87
89
|
console.log(c.dim((job.announce ?? job.report ?? job.error ?? "").trim()));
|
|
90
|
+
// Its report is not printed when it succeeds, and nobody is asked here: the spec gaps its agents met are said.
|
|
91
|
+
else
|
|
92
|
+
for (const gap of job.details?.specGaps ?? [])
|
|
93
|
+
console.log(c.yellow(` spec gap: ${gap.question}`), c.dim(`Meanwhile: ${gap.assumption}`));
|
|
88
94
|
report?.write();
|
|
89
95
|
},
|
|
90
96
|
});
|
|
97
|
+
// A provider failing and waited out, a turn turri ended itself: said as they happen, not left in the job logs alone.
|
|
98
|
+
onModelEvent((event) => {
|
|
99
|
+
const line = describeTurnIncident(event);
|
|
100
|
+
if (line !== undefined)
|
|
101
|
+
console.log(c.yellow(` ${event.job !== undefined ? `${event.job}: ` : ""}${line}`));
|
|
102
|
+
});
|
|
91
103
|
const planner = modelSpec(projectModels(project).harness);
|
|
92
104
|
const loop = createWorkLoop({
|
|
93
105
|
registry,
|
|
@@ -236,7 +248,7 @@ function reportModels(project, model) {
|
|
|
236
248
|
}
|
|
237
249
|
/**
|
|
238
250
|
* The options every command that regenerates takes for a headless run: `--report` and `--build-dir`, and the config's
|
|
239
|
-
* own keys (configKeyOptions) - `--harness-model`, `--coding-model` (`--model`), `--judge-model`, `--review` and, where
|
|
251
|
+
* own keys (configKeyOptions) - `--harness-model`, `--coding-model` (`--model`), `--judge-model`, `--review`, `--mutation-testing` and, where
|
|
240
252
|
* `conformance` is true, `--conformance-tests` - read as if config.turri.yaml had them. Exits on a value it cannot read.
|
|
241
253
|
*/
|
|
242
254
|
export function headlessOptions(options, conformance) {
|