@turri-dev/cli 0.1.4-next.318a98a → 0.1.4-next.4342332

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.
Files changed (100) hide show
  1. package/.pi/themes/turri-dark.json +67 -66
  2. package/.pi/themes/turri-light.json +71 -73
  3. package/README.md +39 -127
  4. package/assets/jellyfish/dark-00.png +0 -0
  5. package/assets/jellyfish/dark-01.png +0 -0
  6. package/assets/jellyfish/dark-02.png +0 -0
  7. package/assets/jellyfish/dark-03.png +0 -0
  8. package/assets/jellyfish/dark-04.png +0 -0
  9. package/assets/jellyfish/dark-05.png +0 -0
  10. package/assets/jellyfish/dark-06.png +0 -0
  11. package/assets/jellyfish/dark-07.png +0 -0
  12. package/assets/jellyfish/dark-08.png +0 -0
  13. package/assets/jellyfish/dark-09.png +0 -0
  14. package/assets/jellyfish/dark-10.png +0 -0
  15. package/assets/jellyfish/dark-11.png +0 -0
  16. package/assets/jellyfish/dark-12.png +0 -0
  17. package/assets/jellyfish/dark-13.png +0 -0
  18. package/assets/jellyfish/dark-14.png +0 -0
  19. package/assets/jellyfish/light-00.png +0 -0
  20. package/assets/jellyfish/light-01.png +0 -0
  21. package/assets/jellyfish/light-02.png +0 -0
  22. package/assets/jellyfish/light-03.png +0 -0
  23. package/assets/jellyfish/light-04.png +0 -0
  24. package/assets/jellyfish/light-05.png +0 -0
  25. package/assets/jellyfish/light-06.png +0 -0
  26. package/assets/jellyfish/light-07.png +0 -0
  27. package/assets/jellyfish/light-08.png +0 -0
  28. package/assets/jellyfish/light-09.png +0 -0
  29. package/assets/jellyfish/light-10.png +0 -0
  30. package/assets/jellyfish/light-11.png +0 -0
  31. package/assets/jellyfish/light-12.png +0 -0
  32. package/assets/jellyfish/light-13.png +0 -0
  33. package/assets/jellyfish/light-14.png +0 -0
  34. package/dist/ask.js +34 -15
  35. package/dist/brand.js +7 -7
  36. package/dist/cli-options.js +12 -6
  37. package/dist/config-edit.js +1 -0
  38. package/dist/config.js +5 -2
  39. package/dist/cultivate-cli.js +16 -23
  40. package/dist/extension.js +41 -29
  41. package/dist/init-config.js +5 -0
  42. package/dist/loop-cli.js +19 -7
  43. package/dist/loop-tools.js +11 -5
  44. package/dist/module-report.js +5 -4
  45. package/dist/pi.js +76 -19
  46. package/dist/question-dialog.js +1 -0
  47. package/dist/regenerate/activity.js +21 -0
  48. package/dist/regenerate/list-arguments.js +121 -0
  49. package/dist/regenerate/loop.js +21 -8
  50. package/dist/regenerate/plain-palette.js +51 -36
  51. package/dist/regenerate/regenerate.js +4 -2
  52. package/dist/regenerate/self-check.js +13 -6
  53. package/dist/regenerate/side-panel.js +1 -1
  54. package/dist/regenerate/spec-map-view.js +9 -5
  55. package/dist/regenerate/test-scripts.js +54 -10
  56. package/dist/regenerate/unit-review.js +1 -1
  57. package/dist/regenerate-cli.js +11 -5
  58. package/dist/release-cli.js +3 -8
  59. package/dist/review/live.js +2 -1
  60. package/dist/run-report.js +39 -1
  61. package/dist/validate-cli.js +3 -8
  62. package/docs/README.md +5 -12
  63. package/docs/authoring-plain.md +37 -119
  64. package/docs/config.md +53 -178
  65. package/docs/deploy.md +21 -80
  66. package/docs/development.md +13 -41
  67. package/docs/headless.md +45 -121
  68. package/docs/images/how-turri-works.svg +29 -31
  69. package/docs/installation.md +13 -40
  70. package/docs/parser.md +15 -43
  71. package/docs/regenerating.md +229 -938
  72. package/docs/sandbox.md +38 -152
  73. package/docs/skills-and-gates.md +50 -171
  74. package/docs/theming.md +45 -46
  75. package/docs/using.md +69 -345
  76. package/genome/rules/bullet-continuation.md +5 -13
  77. package/genome/rules/concise-specs-examples.md +2 -4
  78. package/genome/rules/concise-specs-integration-examples.md +2 -6
  79. package/genome/rules/concise-specs.md +1 -2
  80. package/genome/rules/func-specs.md +1 -0
  81. package/genome/rules/integration-embedded-testing.md +1 -4
  82. package/genome/rules/integrations.md +1 -2
  83. package/genome/rules/project-model.md +14 -35
  84. package/genome/rules/stdlib.md +14 -49
  85. package/genome/rules/turri-regeneration.md +48 -0
  86. package/genome/skills/add-implementation-requirement/SKILL.md +1 -2
  87. package/genome/skills/analyze-if-func-spec-too-complex/SKILL.md +3 -8
  88. package/genome/skills/brood/SKILL.md +37 -127
  89. package/genome/skills/brood/references/intent.md +4 -12
  90. package/genome/skills/brood/references/product.md +24 -76
  91. package/genome/skills/brood/references/stack.md +7 -29
  92. package/genome/skills/brood/references/testing.md +11 -42
  93. package/genome/skills/bud/SKILL.md +32 -109
  94. package/genome/skills/bud/references/intent.md +4 -11
  95. package/genome/skills/implement-conformance-testing-script/SKILL.md +3 -6
  96. package/genome/skills/implement-unit-testing-script/SKILL.md +1 -2
  97. package/genome/skills/mature/SKILL.md +21 -69
  98. package/genome/skills/refactor-module/SKILL.md +24 -2
  99. package/genome/skills/spawn/SKILL.md +28 -113
  100. package/package.json +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
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: keep offering what is left until they say they are done.
111
- const chosen = [];
112
- let remaining = [...options];
113
- while (remaining.length > 0) {
114
- const title = chosen.length === 0 ? request.question : `${request.question} [so far: ${chosen.join(", ")}]`;
115
- const choice = await io.select(title, [...remaining, ...extras, DONE_OPTION], context);
116
- if (choice === undefined)
117
- break;
118
- if (choice === DONE_OPTION)
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 (!typedNothing(typed))
123
- chosen.push(typed.trim());
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, chosen);
141
+ return chatAnswer(said, picked());
131
142
  }
132
- chosen.push(choice);
133
- remaining = remaining.filter((option) => option !== choice);
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 chosen.length > 0 ? chosen.join(", ") : DISMISSED;
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/brand.js CHANGED
@@ -2,8 +2,8 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  /**
5
- * turri's colours for what its command line prints - the ones its themes use (.pi/themes): on a dark terminal its lime
6
- * accent and green, on a light one its blue. Nothing is coloured when the output is not a terminal, or NO_COLOR is set;
5
+ * turri's colours for what its command line prints - the design system's, as its themes use them (.pi/themes): on a
6
+ * dark terminal neon and pink, on a light one blue whale and eggplant. Nothing is coloured when the output is not a terminal, or NO_COLOR is set;
7
7
  * a terminal without 24-bit colour gets the nearest of its sixteen.
8
8
  */
9
9
  /** Whether the terminal is light: COLORFGBG says so (a light background, 7 or 15), or pi's theme is a light one. */
@@ -35,15 +35,15 @@ function paint(stream = process.stdout) {
35
35
  };
36
36
  return {
37
37
  /** turri's accent: what to look at - a heading, a choice's number, the command to run. */
38
- accent: light ? ink("#0a1fd4", 34) : ink("#e0ff6e", 93),
38
+ accent: light ? ink("#1e3442", 34) : ink("#5ce1e6", 96),
39
39
  /** Done, and what was written. */
40
- success: light ? ink("#223936", 32) : ink("#79fc96", 92),
40
+ success: light ? ink("#732553", 35) : ink("#ff5c8d", 95),
41
41
  /** What is wrong: what stops turri. */
42
- error: light ? ink("#d00505", 31) : ink("#dd5353", 91),
42
+ error: ink("#ff7a3d", 33),
43
43
  /** What works, with limits. */
44
- warning: ink("#dc6803", 33),
44
+ warning: ink("#ff7a3d", 33),
45
45
  /** What goes with it, and can be skimmed. */
46
- muted: ink("#808080", 90),
46
+ muted: light ? ink("#3e5a6b", 90) : ink("#85a3b2", 37),
47
47
  bold: (text) => (on ? `\x1b[1m${text}\x1b[22m` : text),
48
48
  };
49
49
  }
@@ -1,4 +1,4 @@
1
- import { conformanceOption, overrideConfig, reviewOption, splitModelSpec } from "./config.js";
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 reviewed = take.review === true ? optionValue(options, "review") : undefined;
64
- const review = reviewed !== undefined ? reviewOption(reviewed) : undefined;
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) {
@@ -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 reviewOption(value) {
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]),
@@ -7,40 +7,33 @@ import { skillRunDir } from "./regenerate/paths.js";
7
7
  import { loadSkill } from "./skill.js";
8
8
  import { discoverSkills } from "./skills.js";
9
9
  import { PACKAGE_ROOT } from "./environment.js";
10
- const c = {
11
- dim: (s) => `\x1b[2m${s}\x1b[0m`,
12
- bold: (s) => `\x1b[1m${s}\x1b[0m`,
13
- green: (s) => `\x1b[32m${s}\x1b[0m`,
14
- red: (s) => `\x1b[31m${s}\x1b[0m`,
15
- yellow: (s) => `\x1b[33m${s}\x1b[0m`,
16
- cyan: (s) => `\x1b[36m${s}\x1b[0m`,
17
- };
10
+ import { c } from "./module-report.js";
18
11
  const reporter = {
19
- step: (name, attempt) => console.log(`\n${c.bold(c.cyan(`> step ${name}`))} ${c.dim(`attempt ${attempt}`)}`),
12
+ step: (name, attempt) => console.log(`\n${c.bold(c.accent(`> step ${name}`))} ${c.dim(`attempt ${attempt}`)}`),
20
13
  artifact: (path, body) => {
21
14
  console.log(c.dim(` ${path}:`));
22
15
  for (const line of body.split("\n"))
23
16
  console.log(c.dim(` | ${line}`));
24
17
  },
25
18
  gate: (name, judges) => console.log(judges === 0
26
- ? `${c.bold(c.yellow(`> gate ${name}`))} ${c.dim("no artifact - failing without spending judges")}`
27
- : `${c.bold(c.yellow(`> gate ${name}`))} ${c.dim(`${judges} independent judges`)}`),
19
+ ? `${c.bold(c.warning(`> gate ${name}`))} ${c.dim("no artifact - failing without spending judges")}`
20
+ : `${c.bold(c.warning(`> gate ${name}`))} ${c.dim(`${judges} independent judges`)}`),
28
21
  livePass: (step, scope, findings) => console.log(findings === 0
29
22
  ? c.dim(` review ${step}: ${scope} - clean`)
30
- : ` ${c.yellow(`review ${step}`)}: ${scope} ${c.dim(`- ${findings} to fix`)}`),
23
+ : ` ${c.warning(`review ${step}`)}: ${scope} ${c.dim(`- ${findings} to fix`)}`),
31
24
  liveReview: (name, passes, findings) => console.log(findings === 0
32
- ? `${c.bold(c.yellow(`> gate ${name}`))} ${c.dim(`reviewer read along in ${passes} passes, nothing outstanding`)}`
33
- : `${c.bold(c.yellow(`> gate ${name}`))} ${c.dim(`${findings} unresolved from the reviewer - failing without spending judges`)}`),
25
+ ? `${c.bold(c.warning(`> gate ${name}`))} ${c.dim(`reviewer read along in ${passes} passes, nothing outstanding`)}`
26
+ : `${c.bold(c.warning(`> gate ${name}`))} ${c.dim(`${findings} unresolved from the reviewer - failing without spending judges`)}`),
34
27
  judge: (index, model, verdict, violations) => {
35
- const mark = verdict === "pass" ? c.green("pass") : c.red(verdict);
28
+ const mark = verdict === "pass" ? c.success("pass") : c.error(verdict);
36
29
  console.log(` judge ${index + 1} ${c.dim(`(${model})`)}: ${mark}${violations ? c.dim(` (${violations})`) : ""}`);
37
30
  },
38
31
  outcome: (name, decision, critique) => {
39
32
  const colour = {
40
- advance: c.green,
41
- retry: c.yellow,
42
- escalate: c.yellow,
43
- abort: c.red,
33
+ advance: c.success,
34
+ retry: c.warning,
35
+ escalate: c.warning,
36
+ abort: c.error,
44
37
  };
45
38
  console.log(` ${c.bold(colour[decision](decision))} ${c.dim(`<- gate ${name}`)}`);
46
39
  if (critique)
@@ -78,7 +71,7 @@ async function main() {
78
71
  select: async (title, options, context) => {
79
72
  const rl = createInterface({ input: process.stdin, output: process.stdout });
80
73
  const list = options.map((option, i) => ` ${c.bold(String(i + 1))}. ${option}`).join("\n");
81
- const reply = (await rl.question(`\n${context !== undefined ? `${context}\n\n` : ""}${c.bold(c.cyan("? "))}${title}\n${list}\n> `)).trim();
74
+ const reply = (await rl.question(`\n${context !== undefined ? `${context}\n\n` : ""}${c.bold(c.accent("? "))}${title}\n${list}\n> `)).trim();
82
75
  rl.close();
83
76
  const index = Number.parseInt(reply, 10);
84
77
  if (Number.isInteger(index) && index >= 1 && index <= options.length)
@@ -87,13 +80,13 @@ async function main() {
87
80
  },
88
81
  input: async (title, context) => {
89
82
  const rl = createInterface({ input: process.stdin, output: process.stdout });
90
- const reply = (await rl.question(`\n${context !== undefined ? `${context}\n\n` : ""}${c.bold(c.cyan("? "))}${title}\n> `)).trim();
83
+ const reply = (await rl.question(`\n${context !== undefined ? `${context}\n\n` : ""}${c.bold(c.accent("? "))}${title}\n> `)).trim();
91
84
  rl.close();
92
85
  return reply === "" ? undefined : reply;
93
86
  },
94
87
  }),
95
88
  escalate: async ({ question, critique }) => {
96
- console.log(`\n${c.bold(c.yellow("! human review required"))}`);
89
+ console.log(`\n${c.bold(c.warning("! human review required"))}`);
97
90
  console.log(c.dim(critique));
98
91
  const rl = createInterface({ input: process.stdin, output: process.stdout });
99
92
  const answer = (await rl.question(`${question} [y/N] `)).trim().toLowerCase();
@@ -101,7 +94,7 @@ async function main() {
101
94
  return answer === "y";
102
95
  },
103
96
  });
104
- console.log(`\n${result.ok ? c.green(c.bold("run complete")) : c.red(c.bold("run aborted at a gate"))} ${c.dim(`artifacts in ${relative(cwd, skillRunDir(cwd, skill.name))}`)}`);
97
+ console.log(`\n${result.ok ? c.success(c.bold("run complete")) : c.error(c.bold("run aborted at a gate"))} ${c.dim(`artifacts in ${relative(cwd, skillRunDir(cwd, skill.name))}`)}`);
105
98
  process.exit(result.ok ? 0 : 1);
106
99
  }
107
100
  main().catch((err) => {
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";
@@ -29,7 +29,7 @@ import { describeChoices, describeResolution, modelFor, resolveModel } from "./r
29
29
  import { checkPlainFile, checkPlainTargets, formatCheckResults } from "./plain/check.js";
30
30
  import { whyFailed } from "./regenerate/diagnose-job.js";
31
31
  import { createWorkLoop, describeModules, isUpToDate, previewJobs } from "./regenerate/loop.js";
32
- import { brandBlue, plainPaint } from "./regenerate/plain-palette.js";
32
+ import { brandNeon, brandPink, plainPaint } from "./regenerate/plain-palette.js";
33
33
  import { createJobPanel, didNotPass, keyPressed, PANEL_KEY, spinner } from "./regenerate/job-panel.js";
34
34
  import { clickToFocus, dockedWidth, narrowChat, shade, shadeChat } from "./regenerate/panel-dock.js";
35
35
  import { overPictureRow, PICTURE_AT } from "./picture-row.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,11 +90,12 @@ 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) => {
93
+ const dialog = (question, context, options, selected) => ctx.ui.custom((tui, theme, _keybindings, done) => {
94
94
  const shown = new QuestionDialog({
95
95
  question,
96
96
  ...(context !== undefined ? { context } : {}),
97
97
  ...(options !== undefined ? { options } : {}),
98
+ ...(selected !== undefined ? { selected } : {}),
98
99
  rows: () => tui.terminal.rows,
99
100
  style: { accent: (text) => theme.fg("accent", text), muted: (text) => theme.fg("muted", text), bold: (text) => theme.bold(text) },
100
101
  done: (answer) => {
@@ -108,7 +109,7 @@ aside) {
108
109
  return shown;
109
110
  });
110
111
  const asking = (asked) => runAsk(asked, {
111
- select: (title, options, context) => dialog(title, context, options),
112
+ select: (title, options, context, at) => dialog(title, context, options, at),
112
113
  input: (title, context) => dialog(title, context),
113
114
  });
114
115
  const bare = { ...request, said: undefined };
@@ -327,6 +328,19 @@ export default function (pi) {
327
328
  };
328
329
  pi.on("agent_end", endTurnCapture);
329
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
+ });
330
344
  // What a turri that was killed left running - its commands' process groups - stopped as this one starts.
331
345
  const orphans = sweepOrphanedGroups();
332
346
  let orphansSaid = orphans === 0;
@@ -610,7 +624,7 @@ function registerRegenerate(pi, cwd, jobs) {
610
624
  // by the planner: one functional spec at a time, a few together or the whole module in one, as it judges. What
611
625
  // follows the module is guidance for that plan, in the person's words.
612
626
  pi.registerCommand("regenerate", {
613
- 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]",
614
628
  handler: async (args, ctx) => {
615
629
  const command = `/regenerate ${args.trim()}`.trim();
616
630
  await echoCommand(pi, command);
@@ -652,13 +666,17 @@ function registerRegenerate(pi, cwd, jobs) {
652
666
  }
653
667
  // From scratch - started over, its code deleted - asked in the person's words: confirmed first, as it deletes.
654
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);
655
671
  const module = basename(plainFile).replace(/\.plain$/, "");
656
672
  if (scratch && again.length > 0) {
657
673
  say("Name functionalities or ask for it from scratch, not both: from scratch regenerates every one of them.", "warning");
658
674
  return;
659
675
  }
660
676
  if (scratch && ctx.hasUI) {
661
- const agreed = await ctx.ui.confirm(`Regenerate ${module} from scratch?`, `Its code and conformance tests are deleted - committed first, so /lineage ${module} keeps them - and the whole module is regenerated from its spec.`);
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.`);
662
680
  if (!agreed)
663
681
  return;
664
682
  }
@@ -668,14 +686,14 @@ function registerRegenerate(pi, cwd, jobs) {
668
686
  // Said at once, and kept in the chat: what follows takes a while - the planner is an agent - and the person sees it
669
687
  // began, not a chat that stays empty until the first pulse starts. The plan is said under it once it is made.
670
688
  say(scratch
671
- ? `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…`
672
690
  : again.length > 0
673
691
  ? `Planning ${module}'s functionalit${again.length === 1 ? "y" : "ies"} ${again.join(", ")} again…`
674
692
  : `Planning ${module}'s pulses…`, "info");
675
693
  await nextFrame();
676
694
  try {
677
695
  const statuses = scratch
678
- ? await loop.fromScratch(plainFile, request)
696
+ ? await loop.fromScratch(plainFile, { ...request, chain })
679
697
  : again.length > 0
680
698
  ? await loop.regenerateAgain(plainFile, again, request)
681
699
  : await loop.bringUp(plainFile, request);
@@ -1499,7 +1517,8 @@ function registerJobTools(pi, jobs, cwd) {
1499
1517
  });
1500
1518
  // The side panel: the regeneration - and the pulses behind p - over the whole screen, or beside the chat (s, from one to
1501
1519
  // the other). Its key (PANEL_KEY) opens it; the key again closes it and goes back to the chat, as esc does over the
1502
- // screen - beside the chat, esc gives the chat its keys back and the panel stays, and the key gives them to the panel.
1520
+ // screen - beside the chat, the key switches sides, giving the keys to the chat or the panel, as esc gives them to the
1521
+ // chat, the panel staying; ctrl+c closes it.
1503
1522
  // While the panel has the keys, every key is its own.
1504
1523
  let panel;
1505
1524
  // Beside the chat or over it: as the person last left it, for the conversation.
@@ -1627,8 +1646,8 @@ function registerJobTools(pi, jobs, cwd) {
1627
1646
  removed: (text) => theme.fg("toolDiffRemoved", text),
1628
1647
  // A spec diff's ***plain highlighted as plyn highlights it, and its added and removed lines filled.
1629
1648
  diff: plainPaint(theme),
1630
- // What conformance tests show does what its spec says: brand blue.
1631
- conforms: brandBlue(theme),
1649
+ // What conformance tests show does what its spec says: neon.
1650
+ conforms: brandNeon(theme),
1632
1651
  },
1633
1652
  back,
1634
1653
  close,
@@ -1670,17 +1689,6 @@ function registerJobTools(pi, jobs, cwd) {
1670
1689
  }
1671
1690
  if (!state)
1672
1691
  return undefined;
1673
- // Beside the chat, ⌥⌘← and ⌥⌘→ go to the side they point at, whichever has the keys - on a terminal that tells
1674
- // turri of ⌘ (the Kitty keyboard protocol). Its release goes nowhere.
1675
- if (panelBeside() > 0 && (matchesKey(data, SIDE_KEYS.chat) || matchesKey(data, SIDE_KEYS.panel))) {
1676
- if (!isKeyRelease(data)) {
1677
- if (matchesKey(data, SIDE_KEYS.chat))
1678
- toChat();
1679
- else
1680
- toPanel();
1681
- }
1682
- return { consume: true };
1683
- }
1684
1692
  // Beside the chat, with the chat's keys: they are the chat's - PANEL_KEY among them, for the shortcut that gives
1685
1693
  // them to the panel. A click on the panel gives it the focus, and the keys with it.
1686
1694
  if (!entry.keys && entry.handle?.isFocused() !== true)
@@ -1691,9 +1699,13 @@ function registerJobTools(pi, jobs, cwd) {
1691
1699
  // presses count - and ctrl+h held down, repeating, does not open and close it over and over.
1692
1700
  if (isKeyRelease(data) || (isKeyRepeat(data) && matchesKey(data, PANEL_KEY)))
1693
1701
  return { consume: true };
1694
- // ctrl+c closes it too: whatever else goes wrong, a key always leads back to the chat.
1695
- if (matchesKey(data, PANEL_KEY) || matchesKey(data, "ctrl+c"))
1702
+ // PANEL_KEY goes back: beside the chat, to the chat, the panel staying - the switch between the sides, as it is
1703
+ // from the chat to the panel - and over the screen, closing it. ctrl+c closes it either way: whatever else goes
1704
+ // wrong, a key always leads back to the chat.
1705
+ if (matchesKey(data, "ctrl+c"))
1696
1706
  close();
1707
+ else if (matchesKey(data, PANEL_KEY))
1708
+ back();
1697
1709
  else {
1698
1710
  try {
1699
1711
  view.handleInput(data);
@@ -1723,8 +1735,10 @@ function registerJobTools(pi, jobs, cwd) {
1723
1735
  handleInput: (data) => {
1724
1736
  if (isKeyRepeat(data) && matchesKey(data, PANEL_KEY))
1725
1737
  return;
1726
- if (matchesKey(data, PANEL_KEY))
1738
+ if (matchesKey(data, "ctrl+c"))
1727
1739
  close();
1740
+ else if (matchesKey(data, PANEL_KEY))
1741
+ back();
1728
1742
  else
1729
1743
  view.handleInput(data);
1730
1744
  tui.requestRender();
@@ -1859,8 +1873,6 @@ export const JOB_FINISHED_REACTION = [
1859
1873
  " to do, and that \"resume\" picks it up once it is in.",
1860
1874
  "- a credential `agent-env:` names that is not there: never make one up - tell the person where it is read from.",
1861
1875
  ].join("\n");
1862
- /** The keys that go to the chat and to the panel, side by side: ⌥⌘← and ⌥⌘→. */
1863
- const SIDE_KEYS = { chat: "alt+super+left", panel: "alt+super+right" };
1864
1876
  /** Opens the side panel, and goes back to it from the conversation. */
1865
1877
  /** The modules in this project that have a history, by name. */
1866
1878
  function modulesWithHistory(cwd) {
@@ -2296,7 +2308,7 @@ function registerBranding(pi, ruleCount, skills) {
2296
2308
  if (data === undefined)
2297
2309
  return undefined;
2298
2310
  const lines = [
2299
- `${theme.fg("accent", "turri")} ${theme.fg("muted", `v${data.version}`)}` +
2311
+ `${brandPink(theme)("turri")} ${theme.fg("muted", `v${data.version}`)}` +
2300
2312
  (data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
2301
2313
  theme.fg("text", "regenerative software - the code is regenerated from the spec"),
2302
2314
  theme.fg("muted", `${data.rules} rules · ${data.skills} skill${data.skills === 1 ? "" : "s"}` +
@@ -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;
@@ -78,16 +80,26 @@ async function runLoopReporting(options) {
78
80
  return;
79
81
  seen.set(job.id, line);
80
82
  if (job.status === "running")
81
- console.log(`${c.cyan(`▶ ${job.id}`)} ${pulseName(job)}${job.stage !== undefined ? c.dim(` - ${job.stage}`) : ""}`);
83
+ console.log(`${c.accent(`▶ ${job.id}`)} ${pulseName(job)}${job.stage !== undefined ? c.dim(` - ${job.stage}`) : ""}`);
82
84
  },
83
85
  onFinish: (job) => {
84
- const mark = job.status === "succeeded" ? c.green("✓") : job.status === "stopped" ? c.dim("■") : c.red("✗");
86
+ const mark = job.status === "succeeded" ? c.success("✓") : job.status === "stopped" ? c.dim("■") : c.error("✗");
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.warning(` 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.warning(` ${event.job !== undefined ? `${event.job}: ` : ""}${line}`));
102
+ });
91
103
  const planner = modelSpec(projectModels(project).harness);
92
104
  const loop = createWorkLoop({
93
105
  registry,
@@ -119,7 +131,7 @@ async function runLoopReporting(options) {
119
131
  // No terminal and no --start-over: no one to ask, so the run stops here rather than build nothing and say it is done.
120
132
  if (options.startOver !== true && process.stdin.isTTY !== true) {
121
133
  const message = `${why}\nThere is no terminal to ask whether to start over: run it again with --start-over to start over without asking.`;
122
- console.error(c.red(message));
134
+ console.error(c.error(message));
123
135
  report?.end("incomplete", message);
124
136
  process.exit(1);
125
137
  }
@@ -150,10 +162,10 @@ async function runLoopReporting(options) {
150
162
  // waiting for a start over, nothing the planner left out.
151
163
  const unfinished = moduleStates(loop.drift(plainFile)).filter((module) => module.state !== "complete");
152
164
  const verdict = failed.length > 0
153
- ? c.red(c.bold(`${failed.length} job${failed.length === 1 ? "" : "s"} failed`))
165
+ ? c.error(c.bold(`${failed.length} job${failed.length === 1 ? "" : "s"} failed`))
154
166
  : unfinished.length > 0
155
- ? c.red(c.bold(`not complete: ${unfinished.map((module) => `${module.module}${module.why !== undefined ? ` - ${module.why}` : ""}`).join("; ")}`))
156
- : c.green(c.bold("all jobs done"));
167
+ ? c.error(c.bold(`not complete: ${unfinished.map((module) => `${module.module}${module.why !== undefined ? ` - ${module.why}` : ""}`).join("; ")}`))
168
+ : c.success(c.bold("all jobs done"));
157
169
  console.log(`\n${verdict}`);
158
170
  for (const job of [...ended].reverse())
159
171
  console.log(` ${job.id} ${pulseName(job)}: ${job.status}`);
@@ -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) {