@turri-dev/cli 0.4.2-next.a6867e8 → 0.4.2

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.
@@ -247,6 +247,85 @@ const RUN_DOWNLOAD = /\b(ba|z|da|k)?sh\s+(-\w+\s+)*["']?\$\(\s*(curl|wget)\b|<\(
247
247
  /** Killing by name, or by what holds a port. */
248
248
  const KILL_BY_LOOKUP = /\bkill\b[^;&|\n]*(\$\(|`)\s*(lsof|fuser|pgrep|pidof|ss|netstat)\b/;
249
249
  const LOOKUP_TO_KILL = /\b(lsof|pgrep|pidof|fuser|ss|netstat)\b[^;&\n]*\|\s*xargs\s+(-\S+\s+)*kill\b/;
250
+ /** A here-document's start: `<<'EOF'`, `<<-"END"`, `<<EOF` - not a here-string's `<<<`. */
251
+ const HEREDOC = /(?<!<)<<(-?)\s*(?:'([^'\n]+)'|"([^"\n]+)"|\\?([A-Za-z_][A-Za-z0-9_]*))/g;
252
+ /** The programs whose here-document is a file's text: they write it out, and run nothing in it. */
253
+ const DATA_SINKS = new Set(["cat", "tee"]);
254
+ /**
255
+ * The command as the shell reads its operators, the same length: what quotes hold has its `<`, `>`, `|`, `&`, `;` and
256
+ * newlines put out of the way - a `>` in `grep "</content>"` redirects nothing, a `;` in a string ends no command - and
257
+ * the body of a here-document fed to cat or tee with a quoted delimiter, so not expanded, is blanked: it is the text of
258
+ * a file being written, and a `../lib/logger` or a `>` in it is code, not a path or a redirection. A `$(...)` in double
259
+ * quotes, an unquoted delimiter's body and a here-document fed to anything else - a shell, an interpreter - run, and are
260
+ * read as they are.
261
+ */
262
+ export function shellCode(command) {
263
+ const lines = command.split("\n");
264
+ const out = [];
265
+ for (let index = 0; index < lines.length; index += 1) {
266
+ const line = lines[index];
267
+ out.push(line);
268
+ // The here-documents this line opens, in order: each body runs to its delimiter alone on a line.
269
+ const opened = [];
270
+ for (const match of maskQuotes(line).matchAll(HEREDOC)) {
271
+ const quoted = match[2] ?? match[3];
272
+ const before = line.slice(0, match.index).split(/&&|\|\||[;|]/).pop() ?? "";
273
+ const program = programOf(before)?.program;
274
+ opened.push({ delimiter: quoted ?? match[4], strip: match[1] === "-", data: quoted !== undefined && program !== undefined && DATA_SINKS.has(program) });
275
+ }
276
+ for (const heredoc of opened) {
277
+ while (index + 1 < lines.length) {
278
+ index += 1;
279
+ const body = lines[index];
280
+ if ((heredoc.strip ? body.replace(/^\t+/, "") : body) === heredoc.delimiter) {
281
+ out.push(body);
282
+ break;
283
+ }
284
+ out.push(heredoc.data ? " ".repeat(body.length) : body);
285
+ }
286
+ }
287
+ }
288
+ return maskQuotes(out.join("\n"));
289
+ }
290
+ /** `text` with what its quotes hold out of the shell's way: operators and newlines in a string are a space each. */
291
+ function maskQuotes(text) {
292
+ let out = "";
293
+ let quote;
294
+ /** Inside double quotes, a command substitution runs: read as it is to the end of the string. */
295
+ let substituting = false;
296
+ for (let at = 0; at < text.length; at += 1) {
297
+ const char = text[at];
298
+ if (quote === undefined) {
299
+ if (char === "\\" && at + 1 < text.length) {
300
+ out += char + text[at + 1];
301
+ at += 1;
302
+ continue;
303
+ }
304
+ if (char === "'" || char === '"')
305
+ quote = char;
306
+ out += char;
307
+ continue;
308
+ }
309
+ if (quote === '"' && char === "\\" && at + 1 < text.length) {
310
+ out += char + (substituting ? text[at + 1] : maskedChar(text[at + 1]));
311
+ at += 1;
312
+ continue;
313
+ }
314
+ if (char === quote) {
315
+ quote = undefined;
316
+ substituting = false;
317
+ out += char;
318
+ continue;
319
+ }
320
+ if (quote === '"' && (char === "`" || (char === "$" && text[at + 1] === "(")))
321
+ substituting = true;
322
+ out += substituting ? char : maskedChar(char);
323
+ }
324
+ return out;
325
+ }
326
+ function maskedChar(char) {
327
+ return /[<>|&;\n]/.test(char) ? " " : char;
328
+ }
250
329
  /** One check, the paths of one platform. */
251
330
  class Paths {
252
331
  path;
@@ -342,7 +421,8 @@ function writeTargets(segment) {
342
421
  if (found === undefined)
343
422
  continue;
344
423
  const { program, args } = found;
345
- const operands = args.filter((arg) => !arg.startsWith("-"));
424
+ // A redirection among its words - `2>/dev/null`, `>out.txt` - is the shell's, read above: never an operand.
425
+ const operands = args.filter((arg) => !arg.startsWith("-") && !/^(\d|&)?[<>]/.test(arg));
346
426
  if (program === "tee")
347
427
  targets.push(...operands);
348
428
  else if ((program === "cp" || program === "mv" || program === "install" || program === "ln") && operands.length >= 2)
@@ -388,9 +468,9 @@ export function checkCommand(command, fence) {
388
468
  return refusal("kill", killReason());
389
469
  }
390
470
  }
391
- // Paths, a simple command at a time from where the cds before it left it.
471
+ // Paths, a simple command at a time from where the cds before it left it - read as the shell reads its operators.
392
472
  let cwd = fence.cwd;
393
- for (const segment of command.split(/&&|\|\||[;\n]/)) {
473
+ for (const segment of shellCode(command).split(/&&|\|\||[;\n]/)) {
394
474
  for (const word of pathWords(segment, paths, fence)) {
395
475
  const target = resolveWord(word, cwd, fence, paths);
396
476
  if (target !== undefined && !paths.inside(target, readable)) {
@@ -1,7 +1,6 @@
1
1
  import { type ChunkAgents } from "./chunk-plan.ts";
2
2
  import { type SpecGap } from "./notes.ts";
3
3
  import { type Job, type JobRegistry, type PulseCases } from "./jobs.ts";
4
- import type { Steering } from "./steer.ts";
5
4
  import { type ChainEntry } from "./requires.ts";
6
5
  import { type SpecSnapshot } from "./regenerate.ts";
7
6
  import { type JobSteering } from "./steering.ts";
@@ -81,8 +80,8 @@ export interface ModuleStatus {
81
80
  specs?: string[];
82
81
  }>;
83
82
  /**
84
- * What the plan of its code did not do as asked: the person's wishes its planner did not follow and why, an answer
85
- * that did not hold, a group split for its size.
83
+ * Where the plan of its code fell back: a planner's answer that was not given or did not hold, a group split for its
84
+ * size.
86
85
  */
87
86
  planNotes?: string[];
88
87
  /** Why nothing runs there, when nothing does. */
@@ -149,23 +148,20 @@ export interface WorkLoop {
149
148
  */
150
149
  bringUp(plainFile: string, options?: {
151
150
  model?: string;
152
- guidance?: string;
153
151
  }): Promise<ModuleStatus[]>;
154
152
  /**
155
- * Plan a spec's module as `bringUp` would - the same codebases, its config pinned, the steering and `guidance` given
156
- * to the planner - and start nothing: the plans are kept, and its pulses held until regenerate, conform or /regenerate
157
- * asks for the module. Then the first pulse of the kept plan starts as it is, planned again only when the ***plain,
158
- * what it is built from or the steering changed since. A module the person halted stays halted, and a codebase whose
153
+ * Plan a spec's module as `bringUp` would - the same codebases, its config pinned - and start nothing: the plans are kept, and its pulses held until regenerate, conform or /regenerate
154
+ * asks for the module. Then the first pulse of the kept plan starts as it is, planned again only when the ***plain or
155
+ * what it is built from changed since. A module the person halted stays halted, and a codebase whose
159
156
  * chain has a pulse running goes on as it was, planning what follows it. Says what is planned.
160
157
  */
161
158
  lookAhead(plainFile: string, options?: {
162
159
  model?: string;
163
- guidance?: string;
164
160
  }): Promise<ModuleStatus[]>;
165
161
  /**
166
162
  * A planned row (`planned-<module>-N`, as `planned` names it) as the loop keeps it: its cases and, for the next pulse
167
163
  * of a codebase with nothing running, the whole prompt its coding agent will get - built from the kept plan, never
168
- * planned again. Otherwise, or when the ***plain or the steering changed since the plan was made, `why` says why no
164
+ * planned again. Otherwise, or when the ***plain changed since the plan was made, `why` says why no
169
165
  * prompt is shown. Undefined when no row has that id.
170
166
  */
171
167
  plannedPulse(rowId: string): Promise<PlannedPulse | undefined>;
@@ -177,7 +173,6 @@ export interface WorkLoop {
177
173
  */
178
174
  regenerateAgain(plainFile: string, funcIds: string | string[], options?: {
179
175
  model?: string;
180
- guidance?: string;
181
176
  }): Promise<ModuleStatus[]>;
182
177
  /**
183
178
  * What is left to regenerate, for a spec's module, in each codebase where its code lives: the code's work from its
@@ -222,7 +217,6 @@ export interface WorkLoop {
222
217
  */
223
218
  fromScratch(plainFile: string, options?: {
224
219
  model?: string;
225
- guidance?: string;
226
220
  chain?: boolean;
227
221
  }): Promise<ModuleStatus[]>;
228
222
  /**
@@ -367,8 +361,6 @@ export declare function createWorkLoop(options: {
367
361
  planner?: ChunkAgents | false;
368
362
  /** The planner's model, read afresh each plan - the chat's, in a conversation. */
369
363
  plannerModel?: string | (() => string | undefined);
370
- /** How the person wants the work cut and ordered, for every plan of a spec's module. */
371
- steering?: (plainFile: string) => Steering[];
372
364
  /** Renders a job. Default: a spec diff render that lands on its unit tests. */
373
365
  run?: JobRunner;
374
366
  /** Writes and runs a conformance job's tests. Default: a spec diff's conformance run, the whole suite with it. */
@@ -15,7 +15,7 @@ import { adoptDigests, chainTree, codeTree, conformanceTarget, CONFORM_AGAIN, ma
15
15
  import { describeSpecDiffConformance, renderSpecDiffConformance } from "./conform.js";
16
16
  import { conformanceDirFor } from "./conformance.js";
17
17
  import { modulesRoot, projectRootOf } from "./paths.js";
18
- import { configForSpec, configModuleFor, moduleConfigFile, testDirOf, withConfigModule } from "../config.js";
18
+ import { configForSpec, configModuleFor, moduleConfigFile, moduleConfigsOf, testDirOf, withConfigModule } from "../config.js";
19
19
  import { describeSpecChange } from "./prompt.js";
20
20
  import { resolveTemplateDirs } from "./paths.js";
21
21
  import { builtTips, copyRequiredCode, copyRequiredTests, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
@@ -33,7 +33,7 @@ import { baseFolderDrift, baseOfCodebase, seedFromBaseFolder } from "./base-fold
33
33
  import { BASE_RECORD_FILE } from "./paths.js";
34
34
  import { onScriptRunEnded, scriptBeingWritten } from "./scripts-being-written.js";
35
35
  import { conformanceTestsOn } from "../conformance-switch.js";
36
- import { projectRootFor } from "./test-scripts.js";
36
+ import { findTestScripts, projectRootFor } from "./test-scripts.js";
37
37
  /** What is left to regenerate, as the conversation and the command line read it. */
38
38
  export function describeDrift(reports) {
39
39
  if (reports.length === 0)
@@ -304,6 +304,20 @@ export function createWorkLoop(options) {
304
304
  // Lacking the script, or with one being written over: a pulse started now would run without it, or against the old one.
305
305
  return scriptBeingWritten(root, kind, configModuleFor(tip.plainFile));
306
306
  };
307
+ /**
308
+ * Why a codebase waits for a unit testing script of its own, or undefined: the project's modules name their scripts in
309
+ * config files of their own - each its own stack's - and none applies to it, nor names a script it could run. Its
310
+ * script is still to come: a pulse started now would stop for want of one. Looked at again when a script run ends, or
311
+ * the module is asked for again.
312
+ */
313
+ const lacksOwnScript = (state) => {
314
+ const tip = tipEntry(state);
315
+ const root = projectRootFor(tip.plainFile, tip.buildDir);
316
+ if (configModuleFor(tip.plainFile) !== undefined || moduleConfigsOf(root).length === 0)
317
+ return undefined;
318
+ const found = withModuleConfig(state, () => findTestScripts(root, tip.plainFile, tip.buildDir));
319
+ return found.unit !== undefined ? undefined : `${NO_OWN_SCRIPT}${found.notes?.unit !== undefined ? ` ${found.notes.unit}` : ""}`;
320
+ };
307
321
  /**
308
322
  * The base folder a codebase started from, as its status says it. Counting the files still there looks at each, and the
309
323
  * status is read often: so it is read again only when the base record or the code record moved - a pulse landed.
@@ -514,12 +528,6 @@ export function createWorkLoop(options) {
514
528
  reportActivity(` ⇢ steered pulse ${running.jobId} (${steering.steers} of ${MAX_STEERS}): ${why}`);
515
529
  return true;
516
530
  };
517
- /** How the person wants a codebase's work planned: the conversation's and AGENTS.md's steering, then the requests'. */
518
- const steeringOf = (state) => [
519
- ...(options.steering?.(state.askedFile) ?? []),
520
- ...state.guidance.map((text) => ({ source: "the request that asked for the work", text })),
521
- ];
522
- const steeringKeyOf = (state) => JSON.stringify(steeringOf(state));
523
531
  const plan = async (state, spec, from, track = "code") => {
524
532
  const tip = tipEntry(state);
525
533
  const current = track === "code" ? codeTree(spec.tree) : conformanceOf(state, spec, from);
@@ -531,7 +539,6 @@ export function createWorkLoop(options) {
531
539
  catch {
532
540
  /* the layout is only for how the diffs read */
533
541
  }
534
- const steering = steeringOf(state);
535
542
  const separately = track === "conformance" && state.conformanceSeparately === true;
536
543
  // How big a pulse may be: the module's config, else the defaults.
537
544
  const config = configForSpec(tip.plainFile);
@@ -540,7 +547,7 @@ export function createWorkLoop(options) {
540
547
  // A pure rename is turri's to make before the next pulse, not a delete and an add: the work is planned from the code as renamed.
541
548
  const renamed = track === "code" ? pureRenames(from, readRecord(testsDirOf(state)), spec.tree, tip.moduleName) : undefined;
542
549
  const base = renamed !== undefined && renamed.renames.length > 0 && renamed.code !== null ? codeTree(renamed.code) : from;
543
- const input = { base, current, specFile, specText, steering, track, moduleName: tip.moduleName, limits, ...(separately ? { separately } : {}), ...(testPlainPath !== undefined ? { testPlainPath } : {}) };
550
+ const input = { base, current, specFile, specText, track, moduleName: tip.moduleName, limits, ...(separately ? { separately } : {}), ...(testPlainPath !== undefined ? { testPlainPath } : {}) };
544
551
  const model = typeof options.plannerModel === "function" ? options.plannerModel() : options.plannerModel;
545
552
  const agents = options.planner === false ? undefined : (options.planner ?? llmChunkAgents({ cwd: options.cwd, model: model ?? state.model, label: `${basename(tip.plainFile)} planner` }));
546
553
  reportStage(`${tip.moduleName}: planning the ${track === "code" ? "work" : "conformance tests"} into pulses`);
@@ -876,7 +883,7 @@ export function createWorkLoop(options) {
876
883
  }
877
884
  for (const chain of chains)
878
885
  for (const entry of toBuild(chain))
879
- states.add(track(chain.slice(0, chain.indexOf(entry) + 1), file, request));
886
+ states.add(track(chain.slice(0, chain.indexOf(entry) + 1), request));
880
887
  }
881
888
  return states;
882
889
  };
@@ -972,18 +979,16 @@ export function createWorkLoop(options) {
972
979
  return;
973
980
  }
974
981
  }
975
- // Still wanted: what comes after it is planned now, from what it will land - not once it has. The steering
976
- // changed, the code's is planned again too: what is not running yet follows it.
982
+ // Still wanted: what comes after it is planned now, from what it will land - not once it has.
977
983
  const planOf = track === "code" ? state.plan : state.conformancePlan;
978
- const steeringKey = steeringKeyOf(state);
979
- if (planOf === undefined || planOf.specKey !== specKey || (track === "code" && state.plan?.steeringKey !== steeringKey)) {
984
+ if (planOf === undefined || planOf.specKey !== specKey) {
980
985
  const running = state.running;
981
986
  // Shown as being planned on the regeneration; the status goes on showing the running job.
982
987
  const rest = workOf(track, running.after, state, spec).length === 0 ? { jobs: [], notes: [] } : await planIdle(state, spec, running.after, track);
983
988
  const next = { specKey, from: serializeTree(running.from), jobs: [running.planned, ...rest.jobs] };
984
989
  if (state.running === running) {
985
990
  if (track === "code")
986
- state.plan = { ...next, steeringKey, notes: rest.notes };
991
+ state.plan = { ...next, notes: rest.notes };
987
992
  else
988
993
  state.conformancePlan = { ...next, codeKey: codeKeyOf(state) };
989
994
  }
@@ -1089,15 +1094,14 @@ export function createWorkLoop(options) {
1089
1094
  return;
1090
1095
  }
1091
1096
  const fromKey = serializeTree(from);
1092
- const steeringKey = steeringKeyOf(state);
1093
- if (state.plan === undefined || state.plan.specKey !== specKey || state.plan.from !== fromKey || state.plan.steeringKey !== steeringKey || state.plan.jobs.length === 0) {
1097
+ if (state.plan === undefined || state.plan.specKey !== specKey || state.plan.from !== fromKey || state.plan.jobs.length === 0) {
1094
1098
  if (!mayPlan) {
1095
1099
  state.plan = undefined;
1096
1100
  state.why = LOOK_AGAIN;
1097
1101
  return;
1098
1102
  }
1099
1103
  const { jobs, notes } = await planIdle(state, spec, from, "code");
1100
- state.plan = { specKey, from: fromKey, steeringKey, jobs, notes };
1104
+ state.plan = { specKey, from: fromKey, jobs, notes };
1101
1105
  if (jobs.length === 0) {
1102
1106
  state.why = NO_PLAN;
1103
1107
  return;
@@ -1107,6 +1111,11 @@ export function createWorkLoop(options) {
1107
1111
  state.why = SCRIPT_BEING_WRITTEN("unit testing script");
1108
1112
  return;
1109
1113
  }
1114
+ const lacking = lacksOwnScript(state);
1115
+ if (lacking !== undefined) {
1116
+ state.why = lacking;
1117
+ return;
1118
+ }
1110
1119
  state.why = undefined;
1111
1120
  startJob(state, spec, from, state.plan.jobs[0]);
1112
1121
  };
@@ -1213,11 +1222,11 @@ export function createWorkLoop(options) {
1213
1222
  * Look after a codebase - its chain up to it - from now on; says its state. Its config is worked out again - its tip's
1214
1223
  * (`configModuleFor`): `asked`, one that cannot be told refuses the ask; otherwise it keeps the one it had.
1215
1224
  */
1216
- const track = (chain, askedFile, request, asked = false) => {
1225
+ const track = (chain, request, asked = false) => {
1217
1226
  const tip = tipOf(chain);
1218
1227
  let state = modules.get(tip.buildDir);
1219
1228
  if (state === undefined) {
1220
- state = { chain, askedFile, guidance: [] };
1229
+ state = { chain };
1221
1230
  modules.set(tip.buildDir, state);
1222
1231
  // Bottom of the chain first: a codebase is looked at after those it is built on.
1223
1232
  const at = order.findIndex((key) => modules.get(key).chain.some((entry) => entry.buildDir === tip.buildDir));
@@ -1227,7 +1236,6 @@ export function createWorkLoop(options) {
1227
1236
  order.splice(at, 0, tip.buildDir);
1228
1237
  }
1229
1238
  state.chain = chain;
1230
- state.askedFile = askedFile;
1231
1239
  try {
1232
1240
  state.configModule = { name: configModuleFor(tip.plainFile) };
1233
1241
  }
@@ -1239,8 +1247,6 @@ export function createWorkLoop(options) {
1239
1247
  const model = request.model ?? withModuleConfig(state, () => options.modelFor?.(tip.plainFile));
1240
1248
  if (model !== undefined)
1241
1249
  state.model = model;
1242
- if (request.guidance !== undefined && !state.guidance.includes(request.guidance))
1243
- state.guidance.push(request.guidance);
1244
1250
  return state;
1245
1251
  };
1246
1252
  const loop = {
@@ -1253,7 +1259,7 @@ export function createWorkLoop(options) {
1253
1259
  ahead.delete(file);
1254
1260
  }
1255
1261
  // Asked for, its config is worked out - its own file, or one of a module it requires - and pinned to its pulses.
1256
- const states = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), file, given, true)))));
1262
+ const states = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), given, true)))));
1257
1263
  // Asked again, a halted codebase is tried again - one the person halted too. Looked ahead at, its kept plan starts.
1258
1264
  for (const state of states) {
1259
1265
  state.halted = undefined;
@@ -1274,7 +1280,7 @@ export function createWorkLoop(options) {
1274
1280
  if (!asked.has(file))
1275
1281
  ahead.set(file, { ...ahead.get(file), ...given });
1276
1282
  // Its config pinned as an ask pins it: the plan is made, and its pulses run, with the config regenerate would use.
1277
- const tracked = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), file, given, true)))));
1283
+ const tracked = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), given, true)))));
1278
1284
  // A chain with a pulse running is being built as asked, and goes on; every other codebase is held - one asked for
1279
1285
  // earlier too, which would otherwise start the work the look ahead plans.
1280
1286
  const building = (state) => state.chain.some((entry) => modules.get(entry.buildDir)?.running !== undefined);
@@ -1317,7 +1323,7 @@ export function createWorkLoop(options) {
1317
1323
  return why(`It follows ${index - 1} planned pulse${index === 2 ? "" : "s"} here: its prompt depends on what ${index === 2 ? "that one lands" : "they land"}, and is built when it starts.`);
1318
1324
  if (job.track === "conformance")
1319
1325
  return why("A conformance pulse's prompt is built from what the code it tests holds once it is built: it is not shown before.");
1320
- // The plan as kept, and only while it fits the ***plain and the steering as they are now - else regenerate would plan again.
1326
+ // The plan as kept, and only while it fits the ***plain as it is now - else regenerate would plan again.
1321
1327
  let spec;
1322
1328
  try {
1323
1329
  spec = chainSpec(state.chain);
@@ -1325,8 +1331,8 @@ export function createWorkLoop(options) {
1325
1331
  catch (error) {
1326
1332
  return why(`Its ***plain does not parse now: ${error instanceof Error ? error.message : String(error)}`);
1327
1333
  }
1328
- if (state.plan === undefined || !state.plan.jobs.includes(job) || state.plan.specKey !== keyOf(spec) || state.plan.steeringKey !== steeringKeyOf(state)) {
1329
- return why("The ***plain or the steering changed since it was planned: regenerate would plan it again. Look ahead again to see the new plan.");
1334
+ if (state.plan === undefined || !state.plan.jobs.includes(job) || state.plan.specKey !== keyOf(spec)) {
1335
+ return why("The ***plain changed since it was planned: regenerate would plan it again. Look ahead again to see the new plan.");
1330
1336
  }
1331
1337
  const task = await withModuleConfig(state, () => promptOf({ plainFile: tip.plainFile, spec: { ...spec, tree: job.step.tree }, planned: job }));
1332
1338
  return task !== undefined ? { ...pulse, task } : why("It has no prompt to show.");
@@ -1386,7 +1392,7 @@ export function createWorkLoop(options) {
1386
1392
  const codebase = chain.slice(0, chain.indexOf(entry) + 1);
1387
1393
  const tip = tipOf(codebase);
1388
1394
  // The codebase as the loop knows it, or - never asked for - as its records have it.
1389
- const state = modules.get(tip.buildDir) ?? { chain: codebase, askedFile: file, guidance: [] };
1395
+ const state = modules.get(tip.buildDir) ?? { chain: codebase };
1390
1396
  return withModuleConfig(state, () => {
1391
1397
  const report = { module: tip.moduleName, plainFile: tip.plainFile, code: undefined, conformance: undefined, ...(conformanceTestsOn(tip.plainFile) ? {} : { conformanceOff: true }) };
1392
1398
  let spec;
@@ -1494,7 +1500,7 @@ export function createWorkLoop(options) {
1494
1500
  }
1495
1501
  }
1496
1502
  }
1497
- const tracked = withParseCache(() => (wentBack ? [own] : chainsFor(file)).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), file, request, true))));
1503
+ const tracked = withParseCache(() => (wentBack ? [own] : chainsFor(file)).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), request, true))));
1498
1504
  // The module asked for, in its own codebase - and those below it: never the codebases built on it.
1499
1505
  const asking = tracked.find((state) => tipEntry(state).buildDir === self.buildDir);
1500
1506
  const states = asking !== undefined ? tracked.filter((state) => own.some((entry) => entry.buildDir === tipEntry(state).buildDir)) : tracked;
@@ -1766,11 +1772,13 @@ export const UP_TO_DATE = "built from the ***plain as it is";
1766
1772
  const LOOKED_AHEAD = "looked ahead - planned, and nothing starts until regenerate, conform or /regenerate asks for it";
1767
1773
  /** What a planned row of a codebase a look ahead planned says first. */
1768
1774
  const LOOKED_AHEAD_NOTE = "Planned by a look ahead: it waits for regenerate, conform or /regenerate to start it.";
1769
- /** Why a codebase held for a look ahead has no plan: its ***plain or steering moved since, and only a look ahead plans it. */
1770
- const LOOK_AGAIN = "looked ahead, and the ***plain or the steering changed since - look ahead again to plan it, or regenerate it";
1775
+ /** Why a codebase held for a look ahead has no plan: its ***plain moved since, and only a look ahead plans it. */
1776
+ const LOOK_AGAIN = "looked ahead, and the ***plain changed since - look ahead again to plan it, or regenerate it";
1771
1777
  /** Why a codebase with work left has no plan: the planner found none. */
1772
1778
  /** Why a codebase waits for a testing script being written in the background. */
1773
1779
  const SCRIPT_BEING_WRITTEN = (what) => `waiting for its ${what}, which is being written`;
1780
+ /** Why a codebase waits where modules name their testing scripts in files of their own and it has none: the note says which file names which. */
1781
+ const NO_OWN_SCRIPT = "waiting for a unit testing script of its own - write one for its stack (implement-unit-testing-script), named in its own config file.";
1774
1782
  const NO_PLAN = "the planner found no way to cut the work into pulses that hold together";
1775
1783
  /**
1776
1784
  * Where the functional specs' test plain files of a module's chain are, by func-id and module - the module's own when none
@@ -1990,7 +1998,7 @@ export function describeModules(statuses, options = {}) {
1990
1998
  ? ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - being planned into pulses`
1991
1999
  : ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - ${casesText(job.cases)}`));
1992
2000
  if (status.planNotes !== undefined)
1993
- lines.push(" what the plan did not do as asked:", ...status.planNotes.map((note) => ` - ${note}`));
2001
+ lines.push(" where the plan fell back:", ...status.planNotes.map((note) => ` - ${note}`));
1994
2002
  // A look ahead from the command line keeps its plan only while the process lives: the run that starts it plans again.
1995
2003
  if (status.why !== undefined)
1996
2004
  lines.push(options.for === "command line" && status.why === LOOKED_AHEAD
@@ -71,6 +71,9 @@ export declare function projectRootFor(plainFile: string, buildDir: string): str
71
71
  *
72
72
  * A folder holding two of a kind does not say which is meant: it is skipped, and noted, so the
73
73
  * error that stops the build can say to name one in config.turri.yaml.
74
+ *
75
+ * Where modules have config files of their own and none applies to this one, a script one of those files names is that
76
+ * module's - of its stack - and never found in a folder for this one: a frontend is not tested with the backend's script.
74
77
  */
75
78
  export declare function findTestScripts(root: string, plainFile?: string, buildDir?: string): TestScripts;
76
79
  /**
@@ -54,12 +54,15 @@ export function projectRootFor(plainFile, buildDir) {
54
54
  const index = parts.lastIndexOf("plain_modules");
55
55
  return index > 0 ? parts.slice(0, index).join(sep) : dirname(resolve(plainFile));
56
56
  }
57
- /** The one script of a kind in a folder, by the names the skills give them; two or more say which. */
58
- function onlyScriptIn(dir, kind) {
57
+ /**
58
+ * The one script of a kind in a folder, by the names the skills give them; two or more say which. What `claimed` holds -
59
+ * the scripts other modules' own files name - is never one of them.
60
+ */
61
+ function onlyScriptIn(dir, kind, claimed = new Set()) {
59
62
  if (!existsSync(dir))
60
63
  return {};
61
64
  const candidates = readdirSync(dir)
62
- .filter((name) => (kind === "prepare" ? PREPARE_NAME.test(name) : scriptKind(name) === kind) && isFile(join(dir, name)))
65
+ .filter((name) => (kind === "prepare" ? PREPARE_NAME.test(name) : scriptKind(name) === kind) && isFile(join(dir, name)) && !claimed.has(resolve(dir, name)))
63
66
  .sort();
64
67
  if (candidates.length === 1)
65
68
  return { path: join(dir, candidates[0]) };
@@ -79,6 +82,9 @@ function onlyScriptIn(dir, kind) {
79
82
  *
80
83
  * A folder holding two of a kind does not say which is meant: it is skipped, and noted, so the
81
84
  * error that stops the build can say to name one in config.turri.yaml.
85
+ *
86
+ * Where modules have config files of their own and none applies to this one, a script one of those files names is that
87
+ * module's - of its stack - and never found in a folder for this one: a frontend is not tested with the backend's script.
82
88
  */
83
89
  export function findTestScripts(root, plainFile, buildDir) {
84
90
  const found = {};
@@ -89,6 +95,11 @@ export function findTestScripts(root, plainFile, buildDir) {
89
95
  const file = own !== undefined ? `${moduleConfigFileIn(root, own)} (over ${projectConfigFile(root)})` : projectConfigFile(root);
90
96
  // Modules with files of their own, none of them this one's: its scripts are likely named in theirs.
91
97
  const others = own === undefined ? moduleConfigsOf(root) : [];
98
+ // What their files name is theirs: never this module's, found in a folder.
99
+ const claimed = new Set(others.flatMap((each) => {
100
+ const theirs = readProjectConfig(root, each);
101
+ return [theirs.unittestsScript, theirs.conformanceTestsScript, theirs.prepareEnvironmentScript].flatMap((named) => (named !== undefined ? [resolve(root, named.trim())] : []));
102
+ }));
92
103
  // Where a script is named: the module's own file - or, where modules have their own, the one of the module that builds it.
93
104
  const nameIn = own !== undefined
94
105
  ? moduleConfigFileIn(root, own)
@@ -114,7 +125,7 @@ export function findTestScripts(root, plainFile, buildDir) {
114
125
  }
115
126
  }
116
127
  for (const dir of [root, join(root, SCRIPTS_DIR)]) {
117
- const { path, several } = onlyScriptIn(dir, kind);
128
+ const { path, several } = onlyScriptIn(dir, kind, claimed);
118
129
  if (path !== undefined) {
119
130
  found[kind] = path;
120
131
  break;
@@ -137,7 +148,7 @@ export function findTestScripts(root, plainFile, buildDir) {
137
148
  if (preparePath !== undefined)
138
149
  notes.prepare = `${file} names ${prepareNamed.trim()} as the ${CONFIG_KEYS.prepareEnvironmentScript}, and there is no such file.`;
139
150
  for (const dir of [root, join(root, SCRIPTS_DIR)]) {
140
- const { path, several } = onlyScriptIn(dir, "prepare");
151
+ const { path, several } = onlyScriptIn(dir, "prepare", claimed);
141
152
  if (path !== undefined) {
142
153
  found.prepare = path;
143
154
  break;
package/dist/sentinel.js CHANGED
@@ -219,7 +219,7 @@ export function sentinelPrompt(cwd, options = {}) {
219
219
  "You fix the project's tooling and nothing else. Your file tools read the whole project; write and edit reach only the",
220
220
  "testing scripts and config.turri.yaml - and in it only where the scripts are, and toolchains:. Your shell runs with",
221
221
  "the project read only; the files you try a launch with go in $TMPDIR - /tmp is outside what it may write. It sees no",
222
- "other process: ps and lsof do not run there - who_holds says what holds a port and whose it is. You never change ***plain - it is the person's intent, never yours to fix - and never steer,",
222
+ "other process: ps and lsof do not run there - who_holds says what holds a port and whose it is. You never change ***plain - it is the person's intent, never yours to fix - and never",
223
223
  "launch, or regenerate but by resume after a fix of yours. You install nothing on this machine and change none of",
224
224
  "its settings, nor the person's shell - under no circumstances: that is always the person's, said in a notice. You",
225
225
  "never ask the person questions - a notice is how you reach them.",
package/docs/chats.md CHANGED
@@ -15,7 +15,6 @@ The session's, shared by every chat:
15
15
 
16
16
  - **the pulses and their plan** - one job registry and one work loop on the project: a pulse any chat starts is in every chat's side panel and `pulses`, and two chats asking for the same module get one plan, not two;
17
17
  - **the coding model** given with `--coding-model`, and `parallel-jobs`;
18
- - **steering** - what `steer` was told, every plan follows;
19
18
  - **conformance** chosen with `conform`, module by module;
20
19
  - **what launches started** - it runs until turri ends or `/halt launched <name>`, whatever chats are opened or closed - and the launch track;
21
20
  - **the ledger** - one run, each event with the id of the chat its work was asked for in (`chat`), and `chat.opened` and `chat.closed` as they happen.
package/docs/config.md CHANGED
@@ -202,6 +202,8 @@ A build needs a unit testing script - and, with conformance on, a conformance te
202
202
  2. the one `run_unittests*.sh` / `run_conformance_tests*.sh` in the project root;
203
203
  3. the one of each in `test_scripts/`.
204
204
 
205
+ Where modules have files of their own, a module with none - nor any module it requires - never takes a script one of those files names from 2 or 3: it is another module's, of another stack. It waits for one of its own instead, saying which file names which.
206
+
205
207
  The optional prepare script - `prepare-environment-script:`, else the one `prepare_environment*.sh` - is looked for the same way, and run on the build before the conformance testing script.
206
208
 
207
209
  A folder holding two of a kind is not guessed between: name the one to use. A script named inside `plain_modules/` is refused - agents write there, so it could be changed by the work it judges. The scripts are never linked from \*\*\*plain. What they are and how they run is in [regenerating the code](regenerating.md#the-testing-scripts).
@@ -12,7 +12,6 @@ Every path below is in the project. What the person writes:
12
12
  | --- | --- |
13
13
  | `config.turri.yaml`, `config.turri.<module>.yaml` | the project config, and a module's own, laid over it for that module and the modules built on it - see [the project config](config.md) |
14
14
  | `test_scripts/run_unittests_<lang>.sh`, `test_scripts/run_conformance_tests_<lang>.sh` | the testing scripts, the only judges of pass or fail - their static checks included, the formatter, linter and type checker - where `config.turri.yaml` names them, else in the project folder, else in `test_scripts/` - see [below](#the-testing-scripts) |
15
- | `AGENTS.md` | optional: a section whose heading names the queue steers how the work is cut - see [how the work is cut into jobs](#how-the-work-is-cut-into-jobs) |
16
15
 
17
16
  What a module is - each module's folder, its own git history:
18
17
 
@@ -172,7 +171,7 @@ Code accumulates up a `requires` chain: a module is built on a copy of the code
172
171
 
173
172
  A module already built from \*\*\*plain as it is gets nothing. A job that does not land is rolled back, and halts its codebase: nothing more runs there until \*\*\*plain changes or the module is asked for again. On the command line, `turri regenerate` runs until nothing more can start, one line as each job starts and ends, and exits 1 when any failed.
174
173
 
175
- The person halts a module's planned work too: `halt` (and `/halt`) given a planned row - `planned-<module>-2`, `planned-<module>-waiting` - or the module's name. A module's pulses are planned again from its \*\*\*plain at every look, so one planned pulse cannot be taken out alone: the module is halted - its running pulse stopped and rolled back, none of its planned pulses started, the modules built on it waiting for it - and what landed stays. A halt the person asked for holds through \*\*\*plain changes - the loop sees them without starting the module - until the module is asked for again (`regenerate`, `conform`). To build some of it later, or cut it differently, there is `steer`; to drop work, \*\*\*plain.
174
+ The person halts a module's planned work too: `halt` (and `/halt`) given a planned row - `planned-<module>-2`, `planned-<module>-waiting` - or the module's name. A module's pulses are planned again from its \*\*\*plain at every look, so one planned pulse cannot be taken out alone: the module is halted - its running pulse stopped and rolled back, none of its planned pulses started, the modules built on it waiting for it - and what landed stays. A halt the person asked for holds through \*\*\*plain changes - the loop sees them without starting the module - until the module is asked for again (`regenerate`, `conform`). To drop work, change \*\*\*plain.
176
175
 
177
176
  A module the loop looked after whose `.plain` file is gone is forgotten - no rows, nothing waited for - and a codebase left behind, or whose \*\*\*plain no longer parses, shows nothing planned: its plan, and what it waited for, were \*\*\*plain's before.
178
177
 
@@ -190,11 +189,11 @@ Changes to what is built - an item edited or taken out, a functional spec built
190
189
 
191
190
  Each planned job knows its cases - which functional specs it adds, changes (their text, or a concept they use) and takes out, or none: reqs and definitions only - and the loop says them, with each job's title, where the person looks (`drift`, `pulses`, and what `regenerate` returns).
192
191
 
193
- **Steering.** How you want the work cut and ordered - "build the batch worker's helpers with the worker", "models first" - goes to the grouping and placement agents with every plan, as a strong preference: it never overrides the limits and checks. It comes from three places, each labelled with where it came from: the conversation (`steer`, for the whole project or one module, for the session); the project's `AGENTS.md`, every section whose heading names the queue (`## Queue guidance`), read afresh with every plan; and whatever asks for the work - `regenerate` takes a `guidance` of its own, which the loop keeps with that module.
192
+ How the work is cut is the planner's alone: nobody tells it which functional specs go together or what goes first. To have work built differently, change \*\*\*plain.
194
193
 
195
- A plan is kept until \*\*\*plain, what it starts from or its steering changes. `steer` alone plans nothing: the next look does - a `regenerate`, a job ending, \*\*\*plain changing. Then the work not running yet is planned again to follow it, a running job going on as it is. Where a plan did not do as asked, it says so, and what `regenerate` returns lists it under "what the plan did not do as asked": each wish an agent did not follow, with why (both tools take a `notes` for that), a grouping or placement that did not hold, with what was wrong, and a group split for its size. The conversation tells the person that, rather than guessing.
194
+ A plan is kept until \*\*\*plain or what it starts from changes. Then the work not running yet is planned again, a running job going on as it is - or [steered](#when-plain-changes), when the change is inside what it regenerates. Where a plan fell back, it says so, and what `regenerate` returns lists it under "where the plan fell back": a grouping, placement or titling that was not given or did not hold, with what was wrong, and a group split for its size. The conversation tells the person that, rather than guessing.
196
195
 
197
- **Looking ahead.** What will run can be seen before it does, from the same plan: a look ahead (`WorkLoop.lookAhead` - the chat's `pulses` with a module's `plain_file`, and `turri regenerate --dry-run`) has the session's work loop plan the module as `regenerate` would - the same codebases, its config pinned, the steering and AGENTS.md's queue section given to the planner - and keep the plans, starting nothing. Its codebases are held for it, apart from a halt: none of their pulses starts when another pulse ends and the loop looks again, and the look ahead writes nothing - a pure rename is not made, the work planned from the code as it would leave it. A codebase whose chain has a pulse running goes on as it was, what follows that pulse planned; a module the person halted stays halted. `regenerate`, `conform` or `/regenerate` lifts the hold, and the first pulse of the kept plan starts as it is, no planner asked again - so the plan seen is the plan run. Until then the plan is kept only while it fits: \*\*\*plain, what it starts from or the steering changed, it is dropped, not made again - only a look ahead plans a held codebase - and the next look ahead or `regenerate` plans it anew. The planned rows say they wait for `regenerate`. A planned row's id (`pulses` with `planned-<module>-1`) gives the next pulse of its codebase's whole prompt, built from the kept plan - and never planned again for it; a later pulse's prompt depends on what the ones before it land, a conformance pulse's on the code once it is built, and a codebase with a pulse running shows none. `turri regenerate --dry-run` keeps its plan only while it runs: it prints the next pulse's prompt and exits, and the `turri regenerate` after it plans again.
196
+ **Looking ahead.** What will run can be seen before it does, from the same plan: a look ahead (`WorkLoop.lookAhead` - the chat's `pulses` with a module's `plain_file`, and `turri regenerate --dry-run`) has the session's work loop plan the module as `regenerate` would - the same codebases, its config pinned - and keep the plans, starting nothing. Its codebases are held for it, apart from a halt: none of their pulses starts when another pulse ends and the loop looks again, and the look ahead writes nothing - a pure rename is not made, the work planned from the code as it would leave it. A codebase whose chain has a pulse running goes on as it was, what follows that pulse planned; a module the person halted stays halted. `regenerate`, `conform` or `/regenerate` lifts the hold, and the first pulse of the kept plan starts as it is, no planner asked again - so the plan seen is the plan run. Until then the plan is kept only while it fits: \*\*\*plain or what it starts from changed, it is dropped, not made again - only a look ahead plans a held codebase - and the next look ahead or `regenerate` plans it anew. The planned rows say they wait for `regenerate`. A planned row's id (`pulses` with `planned-<module>-1`) gives the next pulse of its codebase's whole prompt, built from the kept plan - and never planned again for it; a later pulse's prompt depends on what the ones before it land, a conformance pulse's on the code once it is built, and a codebase with a pulse running shows none. `turri regenerate --dry-run` keeps its plan only while it runs: it prints the next pulse's prompt and exits, and the `turri regenerate` after it plans again.
198
197
 
199
198
  ### When \*\*\*plain changes
200
199
 
@@ -222,7 +221,7 @@ Whether something is done is never the agent's call, and never a command it chos
222
221
 
223
222
  Each is run by bash, its folders given as absolute paths - on Windows written with forward slashes (`C:/Users/...`), which Windows and Git Bash both take: GNU tar, and the other tools of Git Bash that read a backslash as an escape, would take the `\a` of `C:\Users\anton` for a bell.
224
223
 
225
- The `implement-unit-testing-script` and `implement-conformance-testing-script` skills write them, in the background on the coding model of the module they are for ([background skills](skills-and-gates.md)). While one is being written - in the background, or to its end in print mode - a module built with the config it is named in waits for it, whether it lacks that script or has one being written over (a pulse started meanwhile would run against the old one) - `waiting for its unit testing script, which is being written`, or its conformance testing script - rather than fail for want of it, and is looked at again once the run ends: built, once the script is there, and stopped for want of it as before, when the run wrote none (`src/regenerate/scripts-being-written.ts`). A script written for one module's config file holds only the modules built with that file. They are looked for at the project root - the folder that holds `plain_modules` - in this order:
224
+ The `implement-unit-testing-script` and `implement-conformance-testing-script` skills write them, in the background on the coding model of the module they are for ([background skills](skills-and-gates.md)). While one is being written - in the background, or to its end in print mode - a module built with the config it is named in waits for it, whether it lacks that script or has one being written over (a pulse started meanwhile would run against the old one) - `waiting for its unit testing script, which is being written`, or its conformance testing script - rather than fail for want of it, and is looked at again once the run ends: built, once the script is there, and stopped for want of it as before, when the run wrote none (`src/regenerate/scripts-being-written.ts`). A script written for one module's config file holds only the modules built with that file. Asked for while the same skill writes another module's, it waits its turn, and its modules wait with it from the moment it is asked for - never started in between with the other module's script. Where the modules have config files of their own, each its own stack's, a module with none - nor any module it requires - is never given a script one of those files names: that is another module's, of another stack. Without a script of its own it waits - `waiting for a unit testing script of its own`, with which file names which - and is looked at again when a script run ends or it is asked for again, rather than start a pulse that would stop for want of one, or run another stack's tests on its code. They are looked for at the project root - the folder that holds `plain_modules` - in this order:
226
225
 
227
226
  1. `config.turri.yaml` - with the module's own `config.turri.<module>.yaml` over it, or the one of a module it requires - naming them by path from the root:
228
227
 
@@ -234,7 +233,9 @@ The `implement-unit-testing-script` and `implement-conformance-testing-script` s
234
233
  2. the root itself: the one `run_unittests*.sh` and `run_conformance_tests*.sh` there;
235
234
  3. `test_scripts/`: the one of each there.
236
235
 
237
- The same `config.turri.yaml` holds the project's other defaults - `module`, `model`, `review` - for [unattended runs](headless.md). A folder holding two of a kind is not guessed between: name the one to use in `config.turri.yaml` - or in the module's own `config.turri.<module>.yaml`. A module with no file of its own, where others have one, says so when it stops: which files there are, and which script each names. The scripts are not linked from \*\*\*plain; a link to one is ignored.
236
+ In 2 and 3 a script another module's own config file names is not a candidate for a module with no file of its own.
237
+
238
+ The same `config.turri.yaml` holds the project's other defaults - `module`, `model`, `review` - for [unattended runs](headless.md). A folder holding two of a kind is not guessed between: name the one to use in `config.turri.yaml` - or in the module's own `config.turri.<module>.yaml`. A module with no file of its own, where others have one, says so while it waits: which files there are, and which script each names. The scripts are not linked from \*\*\*plain; a link to one is ignored.
238
239
 
239
240
  They are required: a build with no unit testing script, or with conformance on and no conformance testing script, stops before it starts and says which skill adds it.
240
241
 
package/docs/sandbox.md CHANGED
@@ -67,6 +67,8 @@ Before an agent's command runs, its text is checked (`src/regenerate/command-che
67
67
  - installs software outside the project: `sudo`, the system's package managers installing (`brew`, `apt`, `dnf`, `apk`, `pacman`, `choco`, `winget`, ...), toolchain managers installing (`nvm`, `sdk`, `rustup`, `pyenv`, `asdf`, ...), global installs (`npm -g`, `yarn global`, `pip --user`, `pipx`, `gem install`), a script downloaded and run (`curl ... | sh`), an installer (`.pkg`, `.msi`, `.dmg`, `.run`). The project's own dependencies - `npm install`, pip into its venv, `mvn`, `cargo`, `go mod` - are building the code, and pass;
68
68
  - kills what its pulse did not start: `pkill`, `killall`, `taskkill`, `fuser -k`, or `kill` aimed at a port or name lookup. `kill $!` and `kill %1` pass.
69
69
 
70
+ It reads the command as the shell reads its operators: a `>`, `<`, `|`, `&` or `;` inside quotes is text (`grep -rl "</content>" .` redirects nothing), and so is the body of a here-document fed to `cat` or `tee` under a quoted delimiter (`cat > src/App.tsx <<'EOF'`) - the text of a file being written, whose `../lib/logger` is an import, not a path. A body that runs - under an unquoted delimiter, where `$(...)` expands, or fed to a shell or an interpreter - and a `$(...)` in double quotes are checked as commands.
71
+
70
72
  On Windows, drive letters, backslashes and any case are read as Windows has them. It knowingly misses a path built at run time (`$(...)`, a variable, a script that reads one from a file): the OS sandbox and the audit are for those.
71
73
 
72
74
  ### The OS sandbox
@@ -39,7 +39,7 @@ A skill declares its steps with a `## Steps` section whose `###` headings are th
39
39
 
40
40
  `command-only: true` under `metadata:` keeps a skill from the model: it is started only by the person, with its slash command. None of turri's own is; turri registers the command for every such skill, the project's own too. Typed, the command puts what was typed in the chat as the person's message, and lets `cultivate` start the skill once - and so does an option starting with the command - a project's `/release-notes - for this release` - picked in the conversation's `ask_user` (`chosenCommand` in `src/skills.ts`). The answer tells the model to call `cultivate` for it at once, with the person's request word for word as its context (`startPicked`), so they never type the command after picking it; the run starting uses that up, so the model cannot start it again later on its own. Without either, `cultivate` refuses it and the model is told how the person starts it; the skill's line in `cultivate`'s list says so too.
41
41
 
42
- `background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it; quitting turri stops it. In pi's print, json and rpc modes, and from `turri cultivate`, it runs as any skill does, to its end. `model: coding` runs a skill on the coding model of the module it is for - `cultivate`'s `plainFile`: that module's own file's `coding-model` over the project's, and `--coding-model` over both - the model a code pulse of that module runs on; without it, a skill runs on the chat's model (`harness-model` from the command line). turri's two that write the testing scripts, `implement-unit-testing-script` and `implement-conformance-testing-script`, are its only ones that set either, and they set both.
42
+ `background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it: asked for again for the same module, nothing new starts; asked for another module - a frontend's testing script while the backend's is written - it waits its turn and starts once the run before it ends, and a testing script it is to write counts as being written from the moment it is asked for, so the modules that need it wait for it. Quitting turri stops it, and drops what waits. In pi's print, json and rpc modes, and from `turri cultivate`, it runs as any skill does, to its end. `model: coding` runs a skill on the coding model of the module it is for - `cultivate`'s `plainFile`: that module's own file's `coding-model` over the project's, and `--coding-model` over both - the model a code pulse of that module runs on; without it, a skill runs on the chat's model (`harness-model` from the command line). turri's two that write the testing scripts, `implement-unit-testing-script` and `implement-conformance-testing-script`, are its only ones that set either, and they set both.
43
43
 
44
44
  `questioning:` under `metadata:` names the steps the questioning level caps (`src/questioning.ts`) - `[stack, product]`, say. When there are any and someone to ask, the harness itself asks the first question of the first step: how many questions those steps may ask - light (3), medium (5), thorough (10) or best judgement - and tells the agent the answer beside each step's instructions, with how broad each question is to be: broad at light, a whole area at once, narrow at thorough, an edge case at a time. Every level covers the same ground, in less or more depth. In a capped step `ask_user` refuses a question past the cap; the step's closing confirmation, asked with `confirms_phase: true`, is never counted. `end_questions` ends the step's questions sooner - best judgement's only end. What the questions leave open, the agent decides itself and says what it chose. The level, and how many questions each step has asked, are kept in the run's `run.json`, so a resumed run keeps them. A step it does not name, or a run with nobody to ask, is not capped.
45
45