@turri-dev/cli 0.2.3-next.fea0bd9 → 0.2.4-next.009bd0c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -62
- package/dist/bedrock-region.js +3 -3
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- package/dist/chat-models.d.ts +1 -1
- package/dist/chat-models.js +1 -1
- package/dist/chat-scope.d.ts +1 -3
- package/dist/chat-skills.d.ts +1 -1
- package/dist/chat-skills.js +1 -1
- package/dist/chats.d.ts +44 -20
- package/dist/chats.js +125 -64
- package/dist/cli.js +42 -31
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +32 -26
- package/dist/config.d.ts +106 -78
- package/dist/config.js +267 -133
- package/dist/conform-cli.js +14 -3
- package/dist/conformance-switch.d.ts +13 -22
- package/dist/conformance-switch.js +37 -59
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +31 -12
- package/dist/extension.js +555 -556
- package/dist/genome.js +10 -49
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +11 -21
- package/dist/host-session.js +6 -8
- package/dist/host.d.ts +4 -4
- package/dist/host.js +4 -7
- package/dist/identity.js +2 -3
- package/dist/init-config.d.ts +1 -2
- package/dist/init-config.js +10 -17
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +2 -2
- package/dist/launch-agent.d.ts +41 -0
- package/dist/launch-agent.js +219 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +58 -0
- package/dist/launch-session.js +195 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +120 -0
- package/dist/launch-track.js +298 -0
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +17 -15
- package/dist/loop-tools.d.ts +45 -21
- package/dist/loop-tools.js +155 -90
- package/dist/new-project.js +2 -2
- package/dist/notice.d.ts +7 -6
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +4 -1
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +12 -9
- package/dist/plain/check.d.ts +2 -9
- package/dist/plain/check.js +6 -39
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +7 -7
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +5 -3
- package/dist/regenerate/audit.js +9 -0
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- package/dist/regenerate/cases.js +7 -0
- package/dist/regenerate/chunk-plan.d.ts +5 -0
- package/dist/regenerate/chunk-plan.js +16 -1
- package/dist/regenerate/command-check.d.ts +1 -1
- package/dist/regenerate/command-check.js +1 -1
- package/dist/regenerate/delivery.d.ts +1 -1
- package/dist/regenerate/delivery.js +3 -3
- package/dist/regenerate/drift.d.ts +4 -0
- package/dist/regenerate/drift.js +26 -6
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/job-panel.js +3 -1
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +4 -2
- package/dist/regenerate/jobs.js +14 -10
- package/dist/regenerate/launch.d.ts +126 -0
- package/dist/regenerate/{release.js → launch.js} +60 -48
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +26 -16
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +57 -65
- package/dist/regenerate/loop.js +354 -171
- package/dist/regenerate/model-names.d.ts +33 -0
- package/dist/regenerate/{engine.js → model-names.js} +2 -28
- package/dist/regenerate/paths.d.ts +3 -3
- package/dist/regenerate/paths.js +4 -4
- package/dist/regenerate/records.d.ts +11 -0
- package/dist/regenerate/records.js +15 -0
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +4 -15
- package/dist/regenerate/renames.js +4 -4
- package/dist/regenerate/requires.d.ts +7 -0
- package/dist/regenerate/requires.js +24 -18
- package/dist/regenerate/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -3
- package/dist/regenerate/spec-map.js +3 -3
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/submit-work.d.ts +2 -0
- package/dist/regenerate/submit-work.js +8 -3
- package/dist/regenerate/test-scripts.d.ts +2 -1
- package/dist/regenerate/test-scripts.js +33 -23
- package/dist/regenerate/testing-steps.d.ts +16 -5
- package/dist/regenerate/testing-steps.js +28 -9
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.d.ts +11 -0
- package/dist/self-invocation.js +37 -11
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +17 -12
- package/dist/sentinel.js +75 -46
- package/dist/{config-command.d.ts → settings.d.ts} +13 -8
- package/dist/{config-command.js → settings.js} +155 -24
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +7 -7
- package/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/tools.js +2 -3
- package/dist/turri-versions.js +2 -1
- package/docs/README.md +4 -6
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +6 -9
- package/docs/claude-subscription.md +8 -8
- package/docs/config.md +62 -52
- package/docs/development.md +4 -5
- package/docs/headless.md +7 -6
- package/docs/hosting.md +25 -24
- package/docs/installation.md +4 -0
- package/docs/launch.md +63 -0
- package/docs/parser.md +3 -3
- package/docs/regenerating.md +30 -22
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +27 -16
- package/docs/skills-and-gates.md +6 -11
- package/docs/using.md +26 -42
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +7 -10
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
- package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
- package/package.json +1 -1
- package/dist/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/engine.d.ts +0 -52
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-cli.d.ts +0 -1
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
- package/docs/deploy.md +0 -48
- package/docs/test-advisor.md +0 -110
- /package/dist/{change-plain-cli.d.ts → launch-cli.d.ts} +0 -0
package/dist/regenerate/loop.js
CHANGED
|
@@ -6,19 +6,19 @@ import { ACCEPTANCE_TESTS, CONFORMANCE_TESTS, FUNCTIONAL_REQUIREMENTS, REQUIRED_
|
|
|
6
6
|
import { testPlainFilesOf } from "../test-plain-files.js";
|
|
7
7
|
import { reportActivity, reportStage } from "./activity.js";
|
|
8
8
|
import { llmChunkAgents, MAX_LINES_PER_JOB, MAX_SPECS_PER_JOB, planChunks, stepsOf } from "./chunk-plan.js";
|
|
9
|
-
import { commitNotes, landWork, recordHistory, resetToLastCommit } from "./lineage.js";
|
|
9
|
+
import { commitNotes, landWork, lastCommit, recordHistory, resetToLastCommit } from "./lineage.js";
|
|
10
10
|
import { firstLine, record } from "./ledger.js";
|
|
11
11
|
import { NOTES_FILE, recordPulse } from "./notes.js";
|
|
12
|
-
import {
|
|
12
|
+
import { formatDuration } from "./jobs.js";
|
|
13
13
|
import { moduleLanes } from "./lanes.js";
|
|
14
|
-
import { adoptDigests, chainTree, codeTree, conformanceTarget,
|
|
14
|
+
import { adoptDigests, chainTree, codeTree, conformanceTarget, CONFORM_AGAIN, marksTestsAgain, REGENERATE_AGAIN, inheritedRecord, isOldRecord, notBuilt, readRecord, RECORD_FILE, withResourceDigests, writeCodeRecord, writeTestsRecord, hasScenarios, identityOf, testedFuncIds, } from "./records.js";
|
|
15
15
|
import { describeSpecDiffConformance, renderSpecDiffConformance } from "./conform.js";
|
|
16
16
|
import { conformanceDirFor } from "./conformance.js";
|
|
17
17
|
import { modulesRoot, projectRootOf } from "./paths.js";
|
|
18
|
-
import { configForSpec,
|
|
18
|
+
import { configForSpec, configModuleFor, moduleConfigFile, testDirOf, withConfigModule } from "../config.js";
|
|
19
19
|
import { describeSpecChange } from "./prompt.js";
|
|
20
20
|
import { resolveTemplateDirs } from "./paths.js";
|
|
21
|
-
import { builtTips, copyRequiredCode, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
|
|
21
|
+
import { builtTips, copyRequiredCode, copyRequiredTests, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
|
|
22
22
|
import { describeSpecDiff, renderSpecDiff, specFilesOf } from "./regenerate.js";
|
|
23
23
|
import { locateDiffLines } from "./diff-view.js";
|
|
24
24
|
import { agentChanges, changeDiffInFiles } from "./change-view.js";
|
|
@@ -28,12 +28,12 @@ import { changesBetween, parseTree, serializeTree } from "./spec-steps.js";
|
|
|
28
28
|
import { hasFiles } from "./testing.js";
|
|
29
29
|
import { makeRenames, pureRenames, renameText } from "./renames.js";
|
|
30
30
|
import { casesOf, codeWork, stillWanted, whyNotWanted } from "./drift.js";
|
|
31
|
-
import { testingGap } from "./testing-steps.js";
|
|
31
|
+
import { stepsToScenarios, testingGap } from "./testing-steps.js";
|
|
32
32
|
import { baseFolderDrift, baseOfCodebase, seedFromBaseFolder } from "./base-folder.js";
|
|
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 {
|
|
36
|
+
import { 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)
|
|
@@ -208,8 +208,9 @@ export function codebaseCompletion(chain) {
|
|
|
208
208
|
codebase.forEach((entry, index) => {
|
|
209
209
|
const count = counts[index];
|
|
210
210
|
const completed = entry.funcIds.filter((funcId) => !touched.has(`${entry.moduleName}:${funcId}`));
|
|
211
|
-
// Tests marked to regenerate again were written against code since replaced
|
|
212
|
-
|
|
211
|
+
// Tests marked to regenerate again were written against code since replaced, and those marked to be written again
|
|
212
|
+
// are to be written anew: not conformance tested until rewritten.
|
|
213
|
+
const tested = ownItems(testsRecord ?? undefined, entry.moduleName, entry.moduleName === tip.moduleName).filter((item) => item.id !== undefined && !marksTestsAgain(item) && reads(item) === specText(entry.moduleName, item.id));
|
|
213
214
|
count.completed = completed.length;
|
|
214
215
|
count.tested = completed.filter((funcId) => tested.some((item) => item.id === funcId));
|
|
215
216
|
count.conformanceTested = count.tested.length;
|
|
@@ -240,8 +241,8 @@ export function createWorkLoop(options) {
|
|
|
240
241
|
const tip = tipEntry(state);
|
|
241
242
|
return { project: projectRootOf(tip.buildDir), module: tip.moduleName, job };
|
|
242
243
|
};
|
|
243
|
-
/** `work` with the codebase's
|
|
244
|
-
const
|
|
244
|
+
/** `work` with the codebase's config pinned - its module's own file, or one it requires - once it is worked out. */
|
|
245
|
+
const withModuleConfig = (state, work) => (state.configModule !== undefined ? withConfigModule(state.configModule.name, work) : work());
|
|
245
246
|
const keyOf = (spec) => serializeTree(codeTree(spec.tree));
|
|
246
247
|
/** What a codebase is built from: its record, or - nothing built - what it starts from, the code of the module it requires. */
|
|
247
248
|
const builtOf = (state) => {
|
|
@@ -286,7 +287,7 @@ export function createWorkLoop(options) {
|
|
|
286
287
|
(spec.tree[TEST_REQUIREMENTS] ?? []).length > 0 && readRecord(tipEntry(state).buildDir) !== null && gapOf(state, spec) === undefined;
|
|
287
288
|
/**
|
|
288
289
|
* The step of adding tests a codebase skipped - its functional specs have scenarios, and it has no test reqs or no
|
|
289
|
-
* conformance testing script
|
|
290
|
+
* conformance testing script: no conformance pulse of it starts, in the loop or from conform, and it
|
|
290
291
|
* waits on that step until the spec or the scripts change.
|
|
291
292
|
*/
|
|
292
293
|
const gapOf = (state, spec) => {
|
|
@@ -294,28 +295,14 @@ export function createWorkLoop(options) {
|
|
|
294
295
|
return testingGap({ moduleName: tip.moduleName, plainFile: tip.plainFile, tree: spec.tree, buildDir: tip.buildDir });
|
|
295
296
|
};
|
|
296
297
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
const askedSpecs = (moduleName, spec, funcIds) => {
|
|
301
|
-
const items = spec[FUNCTIONAL_REQUIREMENTS] ?? [];
|
|
302
|
-
const unknown = funcIds.filter((funcId) => !items.some((item) => item.id === funcId));
|
|
303
|
-
if (unknown.length > 0)
|
|
304
|
-
throw new Error(`${moduleName} has no functional spec ${namesOf(moduleName, unknown)}. Nothing was started.`);
|
|
305
|
-
const untested = funcIds.filter((funcId) => !hasScenarios(items.find((item) => item.id === funcId)));
|
|
306
|
-
if (untested.length > 0) {
|
|
307
|
-
throw new Error(`${namesOf(moduleName, untested)} ${untested.length === 1 ? "has" : "have"} no scenarios - no test plain file - so there is nothing to test: ` +
|
|
308
|
-
"write the conformance or acceptance scenarios first, with change_plain, and their tests are written once the code is built. Nothing was started.");
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* Whether a codebase lacks a testing script of this kind that is being written in the background now: it waits for it,
|
|
313
|
-
* rather than fail for want of it, and is looked at again once the run ends.
|
|
298
|
+
* Whether a testing script of this kind is being written for a codebase now - one it lacks, or one written over: it waits
|
|
299
|
+
* for it, rather than fail for want of it or run against the old one, and is looked at again once the run ends.
|
|
314
300
|
*/
|
|
315
301
|
const awaitsScript = (state, kind) => {
|
|
316
302
|
const tip = tipEntry(state);
|
|
317
303
|
const root = projectRootFor(tip.plainFile, tip.buildDir);
|
|
318
|
-
|
|
304
|
+
// Lacking the script, or with one being written over: a pulse started now would run without it, or against the old one.
|
|
305
|
+
return scriptBeingWritten(root, kind, configModuleFor(tip.plainFile));
|
|
319
306
|
};
|
|
320
307
|
/**
|
|
321
308
|
* The base folder a codebase started from, as its status says it. Counting the files still there looks at each, and the
|
|
@@ -368,15 +355,96 @@ export function createWorkLoop(options) {
|
|
|
368
355
|
}
|
|
369
356
|
return narrowed;
|
|
370
357
|
};
|
|
371
|
-
/**
|
|
372
|
-
|
|
358
|
+
/**
|
|
359
|
+
* The functional specs conform named - func-ids of `module` - and every functional spec as it reads now, to tell a
|
|
360
|
+
* change to one after. In a codebase built on `module`, they are among the functional specs it requires.
|
|
361
|
+
*/
|
|
362
|
+
const namedOnly = (state, funcIds, module) => {
|
|
373
363
|
const tree = chainSpec(state.chain).tree;
|
|
374
364
|
const read = new Map();
|
|
375
365
|
for (const section of [FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS]) {
|
|
376
366
|
for (const item of tree[section] ?? [])
|
|
377
367
|
read.set(identityOf(item), JSON.stringify(item));
|
|
378
368
|
}
|
|
379
|
-
|
|
369
|
+
const own = tipEntry(state).moduleName === module;
|
|
370
|
+
return { specs: new Set(funcIds.map((id) => identityOf(own ? { id } : { id, module }))), read };
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Conformance tests written already, to be written again as conform names them - their code untouched: the functional
|
|
374
|
+
* specs named, func-ids of `self`, marked in the tests record of every codebase where its code lives - the tips of its
|
|
375
|
+
* chains, whose suite holds the chain's tests, among the functional specs required there for a module below - each
|
|
376
|
+
* committed. Refused while a pulse runs in one it marks. Says which functional specs were marked.
|
|
377
|
+
*/
|
|
378
|
+
const conformAgain = (file, self, funcIds) => {
|
|
379
|
+
const codebases = [...new Map(chainsFor(file).map(tipOf).map((entry) => [entry.buildDir, entry])).values()];
|
|
380
|
+
// What is marked, worked out before anything is: a codebase that has none of them is not touched, nor refused.
|
|
381
|
+
const touching = codebases.flatMap((entry) => {
|
|
382
|
+
const testsDir = conformanceDirFor(entry.moduleName, modulesRoot(projectDirOf(entry.plainFile)));
|
|
383
|
+
const tests = readRecord(testsDir);
|
|
384
|
+
if (tests === null)
|
|
385
|
+
return [];
|
|
386
|
+
const section = entry.moduleName === self.moduleName ? FUNCTIONAL_REQUIREMENTS : REQUIRED_FUNCTIONAL_SPECS;
|
|
387
|
+
const items = tests[section] ?? [];
|
|
388
|
+
const funcIdOf = (item) => (section === FUNCTIONAL_REQUIREMENTS || item.module === self.moduleName ? (item.id ?? "") : "");
|
|
389
|
+
const taken = items.flatMap((item) => (funcIds.includes(funcIdOf(item)) ? [funcIdOf(item)] : []));
|
|
390
|
+
if (taken.length === 0)
|
|
391
|
+
return [];
|
|
392
|
+
const marked = items.map((item) => (funcIds.includes(funcIdOf(item)) ? { ...item, [CONFORM_AGAIN]: true } : item));
|
|
393
|
+
return [{ entry, testsDir, taken, record: { ...tests, [section]: marked } }];
|
|
394
|
+
});
|
|
395
|
+
for (const { entry } of touching) {
|
|
396
|
+
if (modules.get(entry.buildDir)?.running !== undefined)
|
|
397
|
+
throw new Error(`${entry.moduleName} has a pulse running: halt it, or ask again once it is done. Nothing was started.`);
|
|
398
|
+
}
|
|
399
|
+
const found = new Set();
|
|
400
|
+
for (const { entry, testsDir, taken, record } of touching) {
|
|
401
|
+
writeTestsRecord(testsDir, record);
|
|
402
|
+
recordHistory(entry.buildDir, `the conformance tests of ${namesOf(self.moduleName, taken)} to write again`);
|
|
403
|
+
for (const funcId of taken)
|
|
404
|
+
found.add(funcId);
|
|
405
|
+
const state = modules.get(entry.buildDir);
|
|
406
|
+
if (state === undefined)
|
|
407
|
+
continue;
|
|
408
|
+
state.conformancePlan = undefined;
|
|
409
|
+
state.conformanceHalted = undefined;
|
|
410
|
+
}
|
|
411
|
+
return [...found];
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* A module's conformance tests from scratch, where its code lives - the tip of each chain it is built in, as
|
|
415
|
+
* `fromScratch` regenerates its code there, never a codebase in the middle - the code untouched: each tip's tests folder
|
|
416
|
+
* taken out whole, committed so its history keeps it; then, `fromBelow`, the tests of the module the tip requires copied
|
|
417
|
+
* in, as the codebase started from them - its own tests written anew on them, those it inherits brought up to date.
|
|
418
|
+
* Without, nothing: every functional spec of the chain is written anew there. Nothing below a tip is touched. Refused
|
|
419
|
+
* while a pulse runs in one. Says which codebases' tests were taken out.
|
|
420
|
+
*/
|
|
421
|
+
const testsFromScratch = (file, fromBelow) => {
|
|
422
|
+
const chains = chainsFor(file);
|
|
423
|
+
const tips = [...new Map(chains.map((chain) => [tipOf(chain).buildDir, chain])).values()].flatMap((chain) => {
|
|
424
|
+
const tip = tipOf(chain);
|
|
425
|
+
const testsDir = conformanceDirFor(tip.moduleName, modulesRoot(projectDirOf(tip.plainFile)));
|
|
426
|
+
// Nothing built and no tests: there is nothing to start again - they are written once the code is.
|
|
427
|
+
return started(tip) || existsSync(testsDir) ? [{ chain, tip, testsDir }] : [];
|
|
428
|
+
});
|
|
429
|
+
for (const { tip } of tips) {
|
|
430
|
+
if (modules.get(tip.buildDir)?.running !== undefined)
|
|
431
|
+
throw new Error(`${tip.moduleName} has a pulse running: halt it, or ask again once it is done. Nothing was started.`);
|
|
432
|
+
}
|
|
433
|
+
for (const { chain, tip, testsDir } of tips) {
|
|
434
|
+
rmSync(testsDir, { recursive: true, force: true });
|
|
435
|
+
const below = fromBelow ? chain.find((entry) => entry.moduleName === tip.requires) : undefined;
|
|
436
|
+
if (below !== undefined)
|
|
437
|
+
copyRequiredTests(below.buildDir, tip.buildDir, below.moduleName);
|
|
438
|
+
const why = below !== undefined ? `asked to be written again from scratch, starting from ${below.moduleName}'s` : "asked to be written again from scratch, with its whole chain's";
|
|
439
|
+
recordHistory(tip.buildDir, `conformance tests from scratch: ${why}`);
|
|
440
|
+
reportActivity(` ${tip.moduleName}: its conformance tests are taken out${below !== undefined ? `, and ${below.moduleName}'s copied in` : ""} - ${why}`);
|
|
441
|
+
const state = modules.get(tip.buildDir);
|
|
442
|
+
if (state === undefined)
|
|
443
|
+
continue;
|
|
444
|
+
state.conformancePlan = undefined;
|
|
445
|
+
state.conformanceHalted = undefined;
|
|
446
|
+
}
|
|
447
|
+
return tips.map(({ tip }) => tip.moduleName);
|
|
380
448
|
};
|
|
381
449
|
/** The work of a track, from where it is built from to what it is to be - for the conformance tests, as conform narrowed them unless `narrowed` is false. */
|
|
382
450
|
const workOf = (track, from, state, spec, narrowed = true) => track === "code" ? codeWork(from, spec.tree) : changesBetween(serializeTree(from), serializeTree(conformanceOf(state, spec, from, narrowed)));
|
|
@@ -501,20 +569,18 @@ export function createWorkLoop(options) {
|
|
|
501
569
|
options.registry.notify?.();
|
|
502
570
|
}
|
|
503
571
|
};
|
|
504
|
-
/** A dry run's first jobs, by codebase: what each would start. */
|
|
505
|
-
const firsts = new Map();
|
|
506
572
|
const startJob = (state, spec, from, planned) => {
|
|
507
573
|
// Halted while it was being planned: the plan is made, nothing starts.
|
|
508
574
|
if (state.held !== undefined) {
|
|
509
575
|
state.why = state.held.why;
|
|
510
576
|
return;
|
|
511
577
|
}
|
|
512
|
-
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
state.why = `would start: ${planned.title}`;
|
|
578
|
+
// Looked ahead: the plan is kept, and its first pulse waits for the module to be asked for.
|
|
579
|
+
if (state.lookedAhead === true) {
|
|
580
|
+
state.why = LOOKED_AHEAD;
|
|
516
581
|
return;
|
|
517
582
|
}
|
|
583
|
+
const tip = tipEntry(state);
|
|
518
584
|
const conformance = planned.track === "conformance";
|
|
519
585
|
// A code job can be steered while it regenerates: its target moves with the spec, inside what it regenerates.
|
|
520
586
|
const steering = conformance ? undefined : createSteering(planned.step.tree, tip.moduleName);
|
|
@@ -564,7 +630,7 @@ export function createWorkLoop(options) {
|
|
|
564
630
|
}
|
|
565
631
|
// Nothing here yet, and nothing below: the codebase starts from its base folder, when the config names one.
|
|
566
632
|
if (tip.requires === null && !started(tip))
|
|
567
|
-
|
|
633
|
+
withModuleConfig(state, () => seedFromBaseFolder(tip.buildDir, tip.plainFile, tip.moduleName));
|
|
568
634
|
// A conformance job is shown the spec whole - its test reqs and scenarios are its to write from.
|
|
569
635
|
const result = await (conformance ? runConformance : run)({
|
|
570
636
|
plainFile: tip.plainFile,
|
|
@@ -576,26 +642,11 @@ export function createWorkLoop(options) {
|
|
|
576
642
|
cwd: options.cwd,
|
|
577
643
|
...(steering !== undefined ? { steering } : {}),
|
|
578
644
|
}, onDelta);
|
|
579
|
-
const report = result.report;
|
|
580
|
-
// Released as its last stage, when the config says so: the module's next pulse starts on what is released.
|
|
581
|
-
let released;
|
|
582
|
-
if (result.landed && options.release !== undefined && configForSpec(tip.plainFile).releaseAfterPulse === true) {
|
|
583
|
-
reportStage(`module ${tip.moduleName}: releasing what this pulse landed (release-after-pulse)`);
|
|
584
|
-
try {
|
|
585
|
-
released = `Released after the pulse: ${(await options.release({ plainFile: tip.plainFile, moduleName: tip.moduleName, title: planned.title, onDelta })).trim()}`;
|
|
586
|
-
}
|
|
587
|
-
catch (error) {
|
|
588
|
-
// What landed stays landed: a release that fails is said, and the next pulse goes on.
|
|
589
|
-
released = `The release after the pulse failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
590
|
-
}
|
|
591
|
-
reportActivity(` ${released.split("\n")[0]}`);
|
|
592
|
-
}
|
|
593
645
|
return {
|
|
594
|
-
report:
|
|
646
|
+
report: result.report,
|
|
595
647
|
details: {
|
|
596
648
|
passed: result.landed,
|
|
597
649
|
landed: result.landed,
|
|
598
|
-
...(released !== undefined ? { released: true } : {}),
|
|
599
650
|
...(result.story !== undefined ? { story: result.story } : {}),
|
|
600
651
|
// The spec gaps its agents met, for a headless run to say - in the chat the report puts them to the person.
|
|
601
652
|
...(result.specGaps !== undefined && result.specGaps.length > 0 ? { specGaps: result.specGaps } : {}),
|
|
@@ -703,6 +754,20 @@ export function createWorkLoop(options) {
|
|
|
703
754
|
// What it did, in the notes every agent after reads - once anything it did not land is rolled back, so the line stays.
|
|
704
755
|
if (running !== undefined)
|
|
705
756
|
notePulse(state, running, settled, landed);
|
|
757
|
+
// Landed: the commit it ends on, its line in the notes amended in - told before the codebase's next pulse starts.
|
|
758
|
+
if (running !== undefined && settled !== undefined && landed) {
|
|
759
|
+
const tip = tipEntry(state);
|
|
760
|
+
const commit = lastCommit(tip.buildDir);
|
|
761
|
+
if (commit !== undefined) {
|
|
762
|
+
settled.details = { ...settled.details, commit };
|
|
763
|
+
try {
|
|
764
|
+
options.landed?.({ job: settled, plainFile: tip.plainFile, moduleName: tip.moduleName, commit, title: running.planned.title });
|
|
765
|
+
}
|
|
766
|
+
catch {
|
|
767
|
+
/* what is done with a landing is not the loop's to fail on */
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
706
771
|
void tick();
|
|
707
772
|
};
|
|
708
773
|
/**
|
|
@@ -733,8 +798,8 @@ export function createWorkLoop(options) {
|
|
|
733
798
|
* nothing running there - so the code is taken to be built from them, rather than everything linking one built again.
|
|
734
799
|
*/
|
|
735
800
|
const hashResources = (state, spec) => {
|
|
736
|
-
// A
|
|
737
|
-
if (
|
|
801
|
+
// A look ahead only reads.
|
|
802
|
+
if (state.lookedAhead === true)
|
|
738
803
|
return;
|
|
739
804
|
const code = tipEntry(state).buildDir;
|
|
740
805
|
for (const dir of [code, testsDirOf(state)]) {
|
|
@@ -764,11 +829,15 @@ export function createWorkLoop(options) {
|
|
|
764
829
|
};
|
|
765
830
|
// A testing script written in the background, or not: what waited for it is looked at again - started, or failed for want of it.
|
|
766
831
|
onScriptRunEnded(() => {
|
|
767
|
-
if (asked.size > 0
|
|
832
|
+
if (asked.size > 0 || ahead.size > 0)
|
|
768
833
|
void tick();
|
|
769
834
|
});
|
|
770
835
|
/** The files asked for, each with how: what the loop brings up, worked out again each look. */
|
|
771
836
|
const asked = new Map();
|
|
837
|
+
/** The files looked ahead at and not asked for since: their codebases are looked at, their pulses held. */
|
|
838
|
+
const ahead = new Map();
|
|
839
|
+
/** The codebases a look ahead is planning now: the only looks that plan a codebase held for one. */
|
|
840
|
+
const planningAhead = new Set();
|
|
772
841
|
/**
|
|
773
842
|
* The modules asked for whose plan is not made yet - their code being deleted, what is left being worked out, the
|
|
774
843
|
* planner not started - by name, with since when: each shows as being planned from the moment it is asked for, not
|
|
@@ -791,10 +860,13 @@ export function createWorkLoop(options) {
|
|
|
791
860
|
options.registry.notify?.();
|
|
792
861
|
}
|
|
793
862
|
};
|
|
794
|
-
/**
|
|
795
|
-
|
|
863
|
+
/**
|
|
864
|
+
* The codebases the requests bring up now - where each module's code lives, and what is to be built on it - those
|
|
865
|
+
* asked for and, unless `requests` names others, those looked ahead at.
|
|
866
|
+
*/
|
|
867
|
+
const active = (requests = [...asked, ...ahead]) => {
|
|
796
868
|
const states = new Set();
|
|
797
|
-
for (const [file, request] of
|
|
869
|
+
for (const [file, request] of requests) {
|
|
798
870
|
let chains;
|
|
799
871
|
try {
|
|
800
872
|
chains = chainsFor(file);
|
|
@@ -820,6 +892,9 @@ export function createWorkLoop(options) {
|
|
|
820
892
|
for (const file of [...asked.keys()])
|
|
821
893
|
if (!existsSync(file))
|
|
822
894
|
asked.delete(file);
|
|
895
|
+
for (const file of [...ahead.keys()])
|
|
896
|
+
if (!existsSync(file))
|
|
897
|
+
ahead.delete(file);
|
|
823
898
|
for (const key of [...order]) {
|
|
824
899
|
const state = modules.get(key);
|
|
825
900
|
if (state.running === undefined && !existsSync(tipEntry(state).plainFile))
|
|
@@ -836,7 +911,7 @@ export function createWorkLoop(options) {
|
|
|
836
911
|
// A codebase left behind - built on since - is not looked at, unless a job of it is still running; what it had
|
|
837
912
|
// planned, or waited for, is no longer shown.
|
|
838
913
|
if (now.has(state) || state.running !== undefined)
|
|
839
|
-
await
|
|
914
|
+
await withModuleConfig(state, () => look(state));
|
|
840
915
|
else {
|
|
841
916
|
state.why = "left behind: the code is built on further up the chain, where changes to it are made";
|
|
842
917
|
state.waitsFor = undefined;
|
|
@@ -868,14 +943,6 @@ export function createWorkLoop(options) {
|
|
|
868
943
|
}
|
|
869
944
|
const specKey = keyOf(spec);
|
|
870
945
|
state.seen = spec;
|
|
871
|
-
if (options.onSpec !== undefined) {
|
|
872
|
-
try {
|
|
873
|
-
options.onSpec({ chain: state.chain, tree: spec.tree, built: builtOf(state) });
|
|
874
|
-
}
|
|
875
|
-
catch {
|
|
876
|
-
/* what watches the spec never stops the loop */
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
946
|
if (state.running !== undefined) {
|
|
880
947
|
if (state.running.stopping === true)
|
|
881
948
|
return;
|
|
@@ -962,8 +1029,10 @@ export function createWorkLoop(options) {
|
|
|
962
1029
|
// A func-id or a scenario-id renamed, and nothing else with it: turri renames it in the records and relabels the tests
|
|
963
1030
|
// itself, as one unit of work - no pulse, the code untouched. Failing, it is rolled back whole, and the codebase halts
|
|
964
1031
|
// rather than build the functional spec anew.
|
|
965
|
-
|
|
966
|
-
|
|
1032
|
+
// Looked ahead, they are not made - a look ahead writes nothing - and the code is planned from as they would leave it.
|
|
1033
|
+
const renamed = readRecord(tip.buildDir) === null ? undefined : pureRenames(readRecord(tip.buildDir), readRecord(testsDirOf(state)), spec.tree, tip.moduleName);
|
|
1034
|
+
const pending = state.lookedAhead === true && renamed !== undefined && renamed.renames.length > 0 && renamed.code !== null ? renamed.code : undefined;
|
|
1035
|
+
if (renamed !== undefined && renamed.renames.length > 0 && state.lookedAhead !== true) {
|
|
967
1036
|
const made = makeRenames({ buildDir: tip.buildDir, testsDir: testsDirOf(state), moduleName: tip.moduleName, renamed, place: { project: projectRootOf(tip.buildDir), module: tip.moduleName } });
|
|
968
1037
|
if (!made) {
|
|
969
1038
|
state.halted = { why: `renaming ${renamed.renames.map(renameText).join(", ")} failed, and was rolled back - it is tried again once the spec changes, or the module is asked for again`, specKey };
|
|
@@ -974,8 +1043,10 @@ export function createWorkLoop(options) {
|
|
|
974
1043
|
}
|
|
975
1044
|
// The module's code first, every job of it; then its conformance tests - once, for the module as built, with one
|
|
976
1045
|
// explorer and one run of the whole suite - and only then is anything built on it (waitingOn).
|
|
977
|
-
const from = builtOf(state);
|
|
1046
|
+
const from = pending !== undefined ? codeTree(pending) : builtOf(state);
|
|
978
1047
|
const codeLeft = codeWork(from, spec.tree).length > 0;
|
|
1048
|
+
// Held for a look ahead, a codebase is planned by a look ahead alone: a plan that no longer fits is dropped, not made again.
|
|
1049
|
+
const mayPlan = state.lookedAhead !== true || planningAhead.has(state);
|
|
979
1050
|
if (state.conformanceHalted !== undefined && state.conformanceHalted.key !== conformanceKey(state))
|
|
980
1051
|
state.conformanceHalted = undefined;
|
|
981
1052
|
if (!codeLeft && conformanceWanted(state, spec) && state.conformanceHalted === undefined) {
|
|
@@ -986,6 +1057,11 @@ export function createWorkLoop(options) {
|
|
|
986
1057
|
// Made again when the spec, the tests or the code it was planned against moved: what the tests are written for
|
|
987
1058
|
// follows the code, and a plan made before a code pulse landed would test it as it was.
|
|
988
1059
|
if (existing === undefined || existing.specKey !== specKey || existing.from !== testedKey || existing.codeKey !== codeKeyOf(state) || existing.jobs.length === 0) {
|
|
1060
|
+
if (!mayPlan) {
|
|
1061
|
+
state.conformancePlan = undefined;
|
|
1062
|
+
state.why = LOOK_AGAIN;
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
989
1065
|
state.conformancePlan = { specKey, from: testedKey, codeKey: codeKeyOf(state), jobs: (await planIdle(state, spec, tested, "conformance")).jobs };
|
|
990
1066
|
}
|
|
991
1067
|
const next = state.conformancePlan.jobs[0];
|
|
@@ -1015,6 +1091,11 @@ export function createWorkLoop(options) {
|
|
|
1015
1091
|
const fromKey = serializeTree(from);
|
|
1016
1092
|
const steeringKey = steeringKeyOf(state);
|
|
1017
1093
|
if (state.plan === undefined || state.plan.specKey !== specKey || state.plan.from !== fromKey || state.plan.steeringKey !== steeringKey || state.plan.jobs.length === 0) {
|
|
1094
|
+
if (!mayPlan) {
|
|
1095
|
+
state.plan = undefined;
|
|
1096
|
+
state.why = LOOK_AGAIN;
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1018
1099
|
const { jobs, notes } = await planIdle(state, spec, from, "code");
|
|
1019
1100
|
state.plan = { specKey, from: fromKey, steeringKey, jobs, notes };
|
|
1020
1101
|
if (jobs.length === 0) {
|
|
@@ -1030,6 +1111,17 @@ export function createWorkLoop(options) {
|
|
|
1030
1111
|
startJob(state, spec, from, state.plan.jobs[0]);
|
|
1031
1112
|
};
|
|
1032
1113
|
const statusOf = (state) => describe(state).status;
|
|
1114
|
+
/** A planned row's codebase and its place there, from its id - `planned-<module>-N`, the longest module name it starts with, as a name may hold a hyphen. */
|
|
1115
|
+
const rowOf = (rowId) => {
|
|
1116
|
+
const state = order
|
|
1117
|
+
.map((key) => modules.get(key))
|
|
1118
|
+
.filter((candidate) => rowId.startsWith(`planned-${tipEntry(candidate).moduleName}-`))
|
|
1119
|
+
.sort((a, b) => tipEntry(b).moduleName.length - tipEntry(a).moduleName.length)[0];
|
|
1120
|
+
if (state === undefined)
|
|
1121
|
+
return undefined;
|
|
1122
|
+
const rest = rowId.slice(`planned-${tipEntry(state).moduleName}-`.length);
|
|
1123
|
+
return /^[1-9]\d*$/.test(rest) ? { state, index: Number(rest) } : undefined;
|
|
1124
|
+
};
|
|
1033
1125
|
/** The modules asked for that the loop holds nothing of yet - turri just opened, say: their code being planned all the same. */
|
|
1034
1126
|
const preparingAlone = () => {
|
|
1035
1127
|
const held = new Set(order.map((key) => tipEntry(modules.get(key)).moduleName));
|
|
@@ -1043,7 +1135,7 @@ export function createWorkLoop(options) {
|
|
|
1043
1135
|
}));
|
|
1044
1136
|
};
|
|
1045
1137
|
/** A codebase's status, and beside each job it lists as planned, the planned job it is - none for one being planned or scheduled. */
|
|
1046
|
-
const describe = (state) =>
|
|
1138
|
+
const describe = (state) => withModuleConfig(state, () => describeIn(state));
|
|
1047
1139
|
const describeIn = (state) => {
|
|
1048
1140
|
// What runs next: the code's jobs, then the conformance tests' - the module's, once its code is built - the running job first.
|
|
1049
1141
|
const running = state.running?.planned;
|
|
@@ -1099,7 +1191,7 @@ export function createWorkLoop(options) {
|
|
|
1099
1191
|
plainFile: tip.plainFile,
|
|
1100
1192
|
...(base !== undefined ? { base } : {}),
|
|
1101
1193
|
...(renames.length > 0 ? { renames: renames.map(renameText) } : {}),
|
|
1102
|
-
...(state.
|
|
1194
|
+
...(state.configModule?.name !== undefined ? { configModule: state.configModule.name } : {}),
|
|
1103
1195
|
...(state.running !== undefined
|
|
1104
1196
|
? {
|
|
1105
1197
|
running: {
|
|
@@ -1118,10 +1210,10 @@ export function createWorkLoop(options) {
|
|
|
1118
1210
|
return { status, jobs: shown.map((item) => item.job), ahead: shown.map((item) => (item.entry.afterCode === true ? { title: item.entry.title, specs: item.entry.specs ?? [] } : undefined)) };
|
|
1119
1211
|
};
|
|
1120
1212
|
/**
|
|
1121
|
-
* Look after a codebase - its chain up to it - from now on; says its state.
|
|
1122
|
-
*
|
|
1213
|
+
* 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
|
+
* (`configModuleFor`): `asked`, one that cannot be told refuses the ask; otherwise it keeps the one it had.
|
|
1123
1215
|
*/
|
|
1124
|
-
const track = (chain, askedFile, request,
|
|
1216
|
+
const track = (chain, askedFile, request, asked = false) => {
|
|
1125
1217
|
const tip = tipOf(chain);
|
|
1126
1218
|
let state = modules.get(tip.buildDir);
|
|
1127
1219
|
if (state === undefined) {
|
|
@@ -1136,12 +1228,15 @@ export function createWorkLoop(options) {
|
|
|
1136
1228
|
}
|
|
1137
1229
|
state.chain = chain;
|
|
1138
1230
|
state.askedFile = askedFile;
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1231
|
+
try {
|
|
1232
|
+
state.configModule = { name: configModuleFor(tip.plainFile) };
|
|
1233
|
+
}
|
|
1234
|
+
catch (error) {
|
|
1235
|
+
if (asked)
|
|
1236
|
+
throw error;
|
|
1237
|
+
}
|
|
1238
|
+
// Its model as its config has it: a module's own file can name a coding model of its own.
|
|
1239
|
+
const model = request.model ?? withModuleConfig(state, () => options.modelFor?.(tip.plainFile));
|
|
1145
1240
|
if (model !== undefined)
|
|
1146
1241
|
state.model = model;
|
|
1147
1242
|
if (request.guidance !== undefined && !state.guidance.includes(request.guidance))
|
|
@@ -1150,29 +1245,91 @@ export function createWorkLoop(options) {
|
|
|
1150
1245
|
};
|
|
1151
1246
|
const loop = {
|
|
1152
1247
|
async bringUp(plainFile, given = {}) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1248
|
+
// Asked for, it shows as being planned at once.
|
|
1249
|
+
return preparingFor(plainFile, async () => {
|
|
1155
1250
|
const files = codebasesOf(resolve(options.cwd, plainFile));
|
|
1156
|
-
for (const file of files)
|
|
1157
|
-
asked.set(file, { ...asked.get(file), ...
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
const states = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), file,
|
|
1162
|
-
// Asked again, a halted codebase is tried again - one the person halted too
|
|
1251
|
+
for (const file of files) {
|
|
1252
|
+
asked.set(file, { ...ahead.get(file), ...asked.get(file), ...given });
|
|
1253
|
+
ahead.delete(file);
|
|
1254
|
+
}
|
|
1255
|
+
// 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)))));
|
|
1257
|
+
// Asked again, a halted codebase is tried again - one the person halted too. Looked ahead at, its kept plan starts.
|
|
1163
1258
|
for (const state of states) {
|
|
1164
1259
|
state.halted = undefined;
|
|
1165
|
-
|
|
1166
|
-
|
|
1260
|
+
state.held = undefined;
|
|
1261
|
+
state.lookedAhead = undefined;
|
|
1167
1262
|
// Asked for again: its conformance tests are written for every functional spec with scenarios, not only those conform named.
|
|
1168
|
-
|
|
1169
|
-
state.conformanceOnly = undefined;
|
|
1263
|
+
state.conformanceOnly = undefined;
|
|
1170
1264
|
}
|
|
1171
1265
|
await tick();
|
|
1172
1266
|
return [...new Set(states)].map(statusOf);
|
|
1173
|
-
};
|
|
1174
|
-
|
|
1175
|
-
|
|
1267
|
+
});
|
|
1268
|
+
},
|
|
1269
|
+
async lookAhead(plainFile, given = {}) {
|
|
1270
|
+
// Being planned, it shows so at once; what is planned is said once it is - not as being planned.
|
|
1271
|
+
const states = await preparingFor(plainFile, async () => {
|
|
1272
|
+
const files = codebasesOf(resolve(options.cwd, plainFile));
|
|
1273
|
+
for (const file of files)
|
|
1274
|
+
if (!asked.has(file))
|
|
1275
|
+
ahead.set(file, { ...ahead.get(file), ...given });
|
|
1276
|
+
// 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)))));
|
|
1278
|
+
// A chain with a pulse running is being built as asked, and goes on; every other codebase is held - one asked for
|
|
1279
|
+
// earlier too, which would otherwise start the work the look ahead plans.
|
|
1280
|
+
const building = (state) => state.chain.some((entry) => modules.get(entry.buildDir)?.running !== undefined);
|
|
1281
|
+
for (const state of tracked) {
|
|
1282
|
+
if (!building(state))
|
|
1283
|
+
state.lookedAhead = true;
|
|
1284
|
+
planningAhead.add(state);
|
|
1285
|
+
}
|
|
1286
|
+
try {
|
|
1287
|
+
await tick();
|
|
1288
|
+
}
|
|
1289
|
+
finally {
|
|
1290
|
+
for (const state of tracked)
|
|
1291
|
+
planningAhead.delete(state);
|
|
1292
|
+
}
|
|
1293
|
+
return tracked;
|
|
1294
|
+
});
|
|
1295
|
+
return [...new Set(states)].map(statusOf);
|
|
1296
|
+
},
|
|
1297
|
+
async plannedPulse(rowId) {
|
|
1298
|
+
const found = rowOf(rowId);
|
|
1299
|
+
if (found === undefined)
|
|
1300
|
+
return undefined;
|
|
1301
|
+
const { state, index } = found;
|
|
1302
|
+
const { status, jobs } = describe(state);
|
|
1303
|
+
const entry = status.planned[index - 1];
|
|
1304
|
+
if (entry === undefined)
|
|
1305
|
+
return undefined;
|
|
1306
|
+
const tip = tipEntry(state);
|
|
1307
|
+
const pulse = { id: rowId, module: tip.moduleName, plainFile: tip.plainFile, title: entry.title, track: entry.track, cases: entry.cases, index, lookedAhead: state.lookedAhead === true };
|
|
1308
|
+
const job = jobs[index - 1];
|
|
1309
|
+
const why = (text) => ({ ...pulse, why: text });
|
|
1310
|
+
if (entry.planning === true)
|
|
1311
|
+
return why("It is being planned now: its prompt is built once the plan is made.");
|
|
1312
|
+
if (entry.afterCode === true || job === undefined)
|
|
1313
|
+
return why("It is not planned yet: the conformance tests are planned into pulses once the module's code is built, and their prompt is built from that code.");
|
|
1314
|
+
if (state.running !== undefined)
|
|
1315
|
+
return why(`Pulse ${state.running.jobId} is running in this codebase: what this pulse is given depends on what that one lands.`);
|
|
1316
|
+
if (index > 1)
|
|
1317
|
+
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
|
+
if (job.track === "conformance")
|
|
1319
|
+
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.
|
|
1321
|
+
let spec;
|
|
1322
|
+
try {
|
|
1323
|
+
spec = chainSpec(state.chain);
|
|
1324
|
+
}
|
|
1325
|
+
catch (error) {
|
|
1326
|
+
return why(`Its ***plain does not parse now: ${error instanceof Error ? error.message : String(error)}`);
|
|
1327
|
+
}
|
|
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.");
|
|
1330
|
+
}
|
|
1331
|
+
const task = await withModuleConfig(state, () => promptOf({ plainFile: tip.plainFile, spec: { ...spec, tree: job.step.tree }, planned: job }));
|
|
1332
|
+
return task !== undefined ? { ...pulse, task } : why("It has no prompt to show.");
|
|
1176
1333
|
},
|
|
1177
1334
|
async regenerateAgain(plainFile, given, request = {}) {
|
|
1178
1335
|
return preparingFor(plainFile, async () => {
|
|
@@ -1230,7 +1387,7 @@ export function createWorkLoop(options) {
|
|
|
1230
1387
|
const tip = tipOf(codebase);
|
|
1231
1388
|
// The codebase as the loop knows it, or - never asked for - as its records have it.
|
|
1232
1389
|
const state = modules.get(tip.buildDir) ?? { chain: codebase, askedFile: file, guidance: [] };
|
|
1233
|
-
return
|
|
1390
|
+
return withModuleConfig(state, () => {
|
|
1234
1391
|
const report = { module: tip.moduleName, plainFile: tip.plainFile, code: undefined, conformance: undefined, ...(conformanceTestsOn(tip.plainFile) ? {} : { conformanceOff: true }) };
|
|
1235
1392
|
let spec;
|
|
1236
1393
|
try {
|
|
@@ -1286,7 +1443,8 @@ export function createWorkLoop(options) {
|
|
|
1286
1443
|
},
|
|
1287
1444
|
async conformance(plainFile, request = {}) {
|
|
1288
1445
|
const file = resolve(options.cwd, plainFile);
|
|
1289
|
-
asked.set(file, { ...asked.get(file), ...(request.model !== undefined ? { model: request.model } : {}) });
|
|
1446
|
+
asked.set(file, { ...ahead.get(file), ...asked.get(file), ...(request.model !== undefined ? { model: request.model } : {}) });
|
|
1447
|
+
ahead.delete(file);
|
|
1290
1448
|
const own = resolveRequiresChain(file, [], undefined, { allowNoFunctionalities: true });
|
|
1291
1449
|
const self = tipOf(own);
|
|
1292
1450
|
// What the person asks for comes first. Its tests are written in its own codebase, before anything is built on it:
|
|
@@ -1295,26 +1453,24 @@ export function createWorkLoop(options) {
|
|
|
1295
1453
|
// it has, nothing is touched.
|
|
1296
1454
|
if (!conformanceTestsOn(self.plainFile)) {
|
|
1297
1455
|
throw new Error(`Conformance tests are off for ${self.moduleName} (conformance-tests: false, or unset): nothing is conformance tested. ` +
|
|
1298
|
-
"
|
|
1456
|
+
"/conform in the chat turns them on, or conformance-tests: true in config.turri.yaml. Nothing was started.");
|
|
1299
1457
|
}
|
|
1300
|
-
|
|
1301
|
-
const ownSpec =
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
throw new Error(`No functional spec of ${self.moduleName} has scenarios - none has a test plain file - so there is nothing to test: ` +
|
|
1306
|
-
"write the conformance or acceptance scenarios first, with change_plain, and their tests are written once the code is built. Nothing was started.");
|
|
1458
|
+
// Refused before anything is touched: a functional spec not there, nothing to test, or a step of adding tests skipped.
|
|
1459
|
+
const { named, spec: ownSpec, withScenarios } = conformanceAskedIn(own, request.funcIds);
|
|
1460
|
+
const scratch = request.fromScratch;
|
|
1461
|
+
if (scratch !== undefined && named !== undefined && named.length > 0) {
|
|
1462
|
+
throw new Error("Name functional specs or ask for the conformance tests from scratch, not both: from scratch writes every one of them again. Nothing was started.");
|
|
1307
1463
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
throw new Error(`${gap.text} Nothing was started.`);
|
|
1464
|
+
// Written already, and asked for again: the named ones written anew where they are tested; from scratch, the module's
|
|
1465
|
+
// tests folder taken out - and started again from the module it requires, unless the whole chain's are asked for.
|
|
1466
|
+
const again = named !== undefined && named.length > 0 ? conformAgain(file, self, named) : [];
|
|
1467
|
+
if (scratch !== undefined)
|
|
1468
|
+
testsFromScratch(file, scratch === "module");
|
|
1314
1469
|
const tested = new Set((readRecord(conformanceDirFor(self.moduleName, modulesRoot(projectDirOf(self.plainFile))))?.[FUNCTIONAL_REQUIREMENTS] ?? []).map((item) => item.id));
|
|
1315
1470
|
const toWrite = (named !== undefined && named.length > 0 ? named : withScenarios).some((funcId) => !tested.has(funcId));
|
|
1316
1471
|
let wentBack = false;
|
|
1317
|
-
|
|
1472
|
+
// From scratch, the tests are written again at the tips, where they were: nothing built on the module is touched.
|
|
1473
|
+
if (scratch === undefined && readRecord(self.buildDir) !== null && toWrite) {
|
|
1318
1474
|
const why = `${self.moduleName}'s conformance tests were asked for, and they come before anything is built on it`;
|
|
1319
1475
|
for (const chain of builtTips(file)) {
|
|
1320
1476
|
const above = chain.slice(chain.findIndex((entry) => entry.buildDir === self.buildDir) + 1);
|
|
@@ -1338,14 +1494,17 @@ export function createWorkLoop(options) {
|
|
|
1338
1494
|
}
|
|
1339
1495
|
}
|
|
1340
1496
|
}
|
|
1341
|
-
const tracked = withParseCache(() => (wentBack ? [own] : chainsFor(file)).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), file, request,
|
|
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))));
|
|
1342
1498
|
// The module asked for, in its own codebase - and those below it: never the codebases built on it.
|
|
1343
1499
|
const asking = tracked.find((state) => tipEntry(state).buildDir === self.buildDir);
|
|
1344
1500
|
const states = asking !== undefined ? tracked.filter((state) => own.some((entry) => entry.buildDir === tipEntry(state).buildDir)) : tracked;
|
|
1345
1501
|
const tip = asking ?? states.at(-1);
|
|
1502
|
+
// Asked for: what a look ahead held here goes on - the modules below with it, or the module waits for them for ever.
|
|
1503
|
+
for (const state of tracked)
|
|
1504
|
+
state.lookedAhead = undefined;
|
|
1346
1505
|
const asks = named !== undefined && named.length > 0 ? named : undefined;
|
|
1347
1506
|
// Its tests are written already, and a codebase built on it holds its code: nothing to write, nothing touched.
|
|
1348
|
-
if (asking === undefined && asks !== undefined && tip !== undefined) {
|
|
1507
|
+
if (asking === undefined && asks !== undefined && tip !== undefined && again.length === 0) {
|
|
1349
1508
|
throw new Error(`${self.moduleName}'s conformance tests for ${namesOf(self.moduleName, asks)} are written already. Nothing was started.`);
|
|
1350
1509
|
}
|
|
1351
1510
|
// Only the module asked for: one job for all of its tests, or one a functional spec, as this request asks; a halt cleared.
|
|
@@ -1355,7 +1514,7 @@ export function createWorkLoop(options) {
|
|
|
1355
1514
|
state.conformancePlan = undefined;
|
|
1356
1515
|
state.conformanceSeparately = separately;
|
|
1357
1516
|
// Named: their tests alone - the others left as they are until the module is asked for again, or conform names none.
|
|
1358
|
-
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks) : undefined;
|
|
1517
|
+
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks, self.moduleName) : undefined;
|
|
1359
1518
|
state.conformancePlan = undefined;
|
|
1360
1519
|
state.conformanceHalted = undefined;
|
|
1361
1520
|
state.halted = undefined;
|
|
@@ -1495,12 +1654,15 @@ export function createWorkLoop(options) {
|
|
|
1495
1654
|
let before = status.running?.jobId;
|
|
1496
1655
|
if (before !== undefined)
|
|
1497
1656
|
lastOf.set(tip.moduleName, before);
|
|
1657
|
+
// Looked ahead at: every row of it says it waits for the module to be asked for.
|
|
1658
|
+
const held = state.lookedAhead === true && state.running === undefined;
|
|
1498
1659
|
const row = (id, summary, note, waitingOn, conformance = false) => ({
|
|
1499
1660
|
id,
|
|
1500
1661
|
kind: conformance ? "conformance" : "regenerate",
|
|
1501
1662
|
summary,
|
|
1502
1663
|
module: tip.moduleName,
|
|
1503
|
-
note,
|
|
1664
|
+
note: held ? `${LOOKED_AHEAD_NOTE} ${note}` : note,
|
|
1665
|
+
...(held ? { lookedAhead: true } : {}),
|
|
1504
1666
|
...(state.model !== undefined ? { model: state.model } : {}),
|
|
1505
1667
|
status: "queued",
|
|
1506
1668
|
sequence: sequence--,
|
|
@@ -1536,16 +1698,9 @@ export function createWorkLoop(options) {
|
|
|
1536
1698
|
});
|
|
1537
1699
|
})];
|
|
1538
1700
|
},
|
|
1539
|
-
firsts() {
|
|
1540
|
-
return order.flatMap((key) => {
|
|
1541
|
-
const first = firsts.get(key);
|
|
1542
|
-
const tip = tipEntry(modules.get(key));
|
|
1543
|
-
return first === undefined ? [] : [{ module: tip.moduleName, plainFile: tip.plainFile, buildDir: tip.buildDir, ...first }];
|
|
1544
|
-
});
|
|
1545
|
-
},
|
|
1546
1701
|
mapPlan() {
|
|
1547
1702
|
return {
|
|
1548
|
-
files: [...asked.keys()],
|
|
1703
|
+
files: [...asked.keys(), ...[...ahead.keys()].filter((file) => !asked.has(file))],
|
|
1549
1704
|
codebases: order.map((key) => {
|
|
1550
1705
|
const state = modules.get(key);
|
|
1551
1706
|
const tip = tipEntry(state);
|
|
@@ -1607,6 +1762,12 @@ function oldCodebases(chain) {
|
|
|
1607
1762
|
const OLD_RECORDS_WHY = (codebases) => `${codebases.join(", ")} ${codebases.length === 1 ? "was" : "were"} built when functional specs were numbered, before they had func-ids: nothing more is built on ${codebases.length === 1 ? "it" : "them"} - the whole chain is regenerated from scratch once you agree`;
|
|
1608
1763
|
/** Why nothing runs in a codebase whose code - and conformance tests, where they are wanted - is built from its spec as it is. */
|
|
1609
1764
|
export const UP_TO_DATE = "built from the ***plain as it is";
|
|
1765
|
+
/** Why nothing starts in a codebase a look ahead planned: its pulses wait for the module to be asked for. */
|
|
1766
|
+
const LOOKED_AHEAD = "looked ahead - planned, and nothing starts until regenerate, conform or /regenerate asks for it";
|
|
1767
|
+
/** What a planned row of a codebase a look ahead planned says first. */
|
|
1768
|
+
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";
|
|
1610
1771
|
/** Why a codebase with work left has no plan: the planner found none. */
|
|
1611
1772
|
/** Why a codebase waits for a testing script being written in the background. */
|
|
1612
1773
|
const SCRIPT_BEING_WRITTEN = (what) => `waiting for its ${what}, which is being written`;
|
|
@@ -1652,6 +1813,7 @@ function conformanceLines(module, cases) {
|
|
|
1652
1813
|
...(spec.added.length > 0 ? [`${spec.added.length} added`] : []),
|
|
1653
1814
|
...(spec.changed.length > 0 ? [`${spec.changed.length} changed`] : []),
|
|
1654
1815
|
...(spec.removed.length > 0 ? [`${spec.removed.length} removed`] : []),
|
|
1816
|
+
...(spec.rewritten.length > 0 ? [`written again from scratch - ${spec.rewritten.length} to write anew`] : []),
|
|
1655
1817
|
...(spec.codeChanged !== undefined ? [`${why[spec.codeChanged]} - ${spec.unchanged.length} to run on it`] : []),
|
|
1656
1818
|
];
|
|
1657
1819
|
return parts.length > 0 ? parts.join(", ") : "its text changed";
|
|
@@ -1692,6 +1854,54 @@ export function funcIdsNamed(module, names) {
|
|
|
1692
1854
|
return funcId;
|
|
1693
1855
|
});
|
|
1694
1856
|
}
|
|
1857
|
+
/**
|
|
1858
|
+
* What conform is asked for in a module, checked from its ***plain alone - quick, before anything is said or touched: the
|
|
1859
|
+
* functional specs named, as func-ids, and the module's spec and those of its functional specs with scenarios. Throws,
|
|
1860
|
+
* saying why nothing was started, when a functional spec named is not there or has no scenarios, when none has any, or
|
|
1861
|
+
* when a step of adding tests is skipped - no test reqs, no conformance testing script. Conformance tests off are not
|
|
1862
|
+
* checked: the conform tool is refused for that, and /conform turns them on.
|
|
1863
|
+
*/
|
|
1864
|
+
function conformanceAskedIn(own, funcIds) {
|
|
1865
|
+
const self = tipOf(own);
|
|
1866
|
+
const named = funcIds === undefined ? undefined : funcIdsNamed(self.moduleName, [...new Set(funcIds)]);
|
|
1867
|
+
const spec = chainSpec(own).tree;
|
|
1868
|
+
const withScenarios = testedFuncIds(spec);
|
|
1869
|
+
// No scenarios: the steps still to take, from the first one missing - the test reqs and the script come before them.
|
|
1870
|
+
const toScenarios = () => stepsToScenarios({ moduleName: self.moduleName, plainFile: self.plainFile, tree: spec, buildDir: self.buildDir });
|
|
1871
|
+
if (withScenarios.length === 0) {
|
|
1872
|
+
throw new Error(`No functional spec of ${self.moduleName} has scenarios - none has a test plain file - so there is nothing to test. ${toScenarios()} ` +
|
|
1873
|
+
"Their tests are written once the code is built. Nothing was started.");
|
|
1874
|
+
}
|
|
1875
|
+
if (named !== undefined && named.length > 0) {
|
|
1876
|
+
const items = spec[FUNCTIONAL_REQUIREMENTS] ?? [];
|
|
1877
|
+
const unknown = named.filter((funcId) => !items.some((item) => item.id === funcId));
|
|
1878
|
+
if (unknown.length > 0)
|
|
1879
|
+
throw new Error(`${self.moduleName} has no functional spec ${namesOf(self.moduleName, unknown)}. Nothing was started.`);
|
|
1880
|
+
const untested = named.filter((funcId) => !hasScenarios(items.find((item) => item.id === funcId)));
|
|
1881
|
+
if (untested.length > 0) {
|
|
1882
|
+
throw new Error(`${namesOf(self.moduleName, untested)} ${untested.length === 1 ? "has" : "have"} no scenarios - no test plain file - so there is nothing to test. ${toScenarios()} ` +
|
|
1883
|
+
"Their tests are written once the code is built. Nothing was started.");
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
// A step of adding tests skipped - its test reqs, or the conformance testing script: refused, naming it.
|
|
1887
|
+
const gap = testingGap({ moduleName: self.moduleName, plainFile: self.plainFile, tree: spec, buildDir: self.buildDir });
|
|
1888
|
+
if (gap !== undefined)
|
|
1889
|
+
throw new Error(`${gap.text} Nothing was started.`);
|
|
1890
|
+
return { named, spec, withScenarios };
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Why conform would start nothing for a module, from its ***plain alone (`conformanceAskedIn`): undefined when it would
|
|
1894
|
+
* go on. What /conform checks before it says anything.
|
|
1895
|
+
*/
|
|
1896
|
+
export function conformanceRefusal(plainFile, funcIds) {
|
|
1897
|
+
try {
|
|
1898
|
+
conformanceAskedIn(resolveRequiresChain(resolve(plainFile), [], undefined, { allowNoFunctionalities: true }), funcIds);
|
|
1899
|
+
return undefined;
|
|
1900
|
+
}
|
|
1901
|
+
catch (error) {
|
|
1902
|
+
return error instanceof Error ? error.message : String(error);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1695
1905
|
/** What a job does, in a few words: its cases, each functional spec by its func-id - with its module, a module below's. */
|
|
1696
1906
|
function casesText(cases) {
|
|
1697
1907
|
const named = (specs) => specs.map((spec) => (spec.module !== undefined ? `${spec.module}:${spec.funcId}` : spec.funcId)).join(", ");
|
|
@@ -1704,54 +1914,24 @@ function casesText(cases) {
|
|
|
1704
1914
|
];
|
|
1705
1915
|
return parts.length > 0 ? parts.join(", ") : "no functional spec - reqs or definitions only";
|
|
1706
1916
|
}
|
|
1707
|
-
/** The codebases the loop looks after, as the person reads them: what runs, what is planned after it, and why nothing does. */
|
|
1708
1917
|
/**
|
|
1709
|
-
* The coding agent's task for a
|
|
1710
|
-
* a conformance
|
|
1918
|
+
* The coding agent's task for a planned code pulse, built as the pulse builds it - with `spec` the ***plain the pulse
|
|
1919
|
+
* would be given - and all it did rolled back. Not for a conformance pulse: its prompt is built from what the code holds
|
|
1920
|
+
* once it is built.
|
|
1711
1921
|
*/
|
|
1712
|
-
|
|
1713
|
-
if (
|
|
1922
|
+
async function promptOf(next) {
|
|
1923
|
+
if (next.planned.track !== "code")
|
|
1714
1924
|
return undefined;
|
|
1715
1925
|
const result = await renderSpecDiff({
|
|
1716
|
-
plainFile:
|
|
1717
|
-
diff:
|
|
1926
|
+
plainFile: next.plainFile,
|
|
1927
|
+
diff: next.planned.step.textDiff,
|
|
1718
1928
|
applied: "already applied",
|
|
1719
|
-
spec:
|
|
1720
|
-
cases:
|
|
1929
|
+
spec: next.spec,
|
|
1930
|
+
cases: next.planned.cases,
|
|
1721
1931
|
dryRun: true,
|
|
1722
1932
|
});
|
|
1723
1933
|
return result.task;
|
|
1724
1934
|
}
|
|
1725
|
-
/**
|
|
1726
|
-
* What bringing a spec's module up would start, in each codebase, and the prompt of each - planned on a loop of its own
|
|
1727
|
-
* that starts nothing. A codebase `busy` says is running a job is left out: a dry run starts from its last commit, and
|
|
1728
|
-
* what the next job there is given depends on what the running one lands.
|
|
1729
|
-
*/
|
|
1730
|
-
export async function previewJobs(options) {
|
|
1731
|
-
const loop = createWorkLoop({
|
|
1732
|
-
registry: createJobRegistry(),
|
|
1733
|
-
cwd: options.cwd,
|
|
1734
|
-
dryRun: true,
|
|
1735
|
-
...(options.model !== undefined ? { modelFor: () => options.model } : {}),
|
|
1736
|
-
...(options.plannerModel !== undefined ? { plannerModel: options.plannerModel } : {}),
|
|
1737
|
-
...(options.steering !== undefined ? { steering: options.steering } : {}),
|
|
1738
|
-
});
|
|
1739
|
-
const statuses = await loop.bringUp(options.plainFile, options.model !== undefined ? { model: options.model } : {});
|
|
1740
|
-
const previews = [];
|
|
1741
|
-
const busy = [];
|
|
1742
|
-
for (const first of loop.firsts()) {
|
|
1743
|
-
if (options.busy?.(first.module) === true) {
|
|
1744
|
-
busy.push(first.module);
|
|
1745
|
-
continue;
|
|
1746
|
-
}
|
|
1747
|
-
const preview = { module: first.module, title: first.planned.title, track: first.planned.track, cases: first.planned.cases };
|
|
1748
|
-
const task = await promptOf(first);
|
|
1749
|
-
if (task !== undefined)
|
|
1750
|
-
preview.task = task;
|
|
1751
|
-
previews.push(preview);
|
|
1752
|
-
}
|
|
1753
|
-
return { statuses, previews, busy };
|
|
1754
|
-
}
|
|
1755
1935
|
/** Nothing runs, is planned or is waiting there, as its code is built from its spec as it is. */
|
|
1756
1936
|
export function isUpToDate(status) {
|
|
1757
1937
|
return status.why === UP_TO_DATE && status.running === undefined && status.planned.length === 0 && status.startOver === undefined;
|
|
@@ -1787,7 +1967,7 @@ export function describeModules(statuses, options = {}) {
|
|
|
1787
1967
|
// Nothing to do there: said in a sentence, not as a status.
|
|
1788
1968
|
if (isUpToDate(status))
|
|
1789
1969
|
return `${status.module} is up to date: its code is built from the ***plain as it is now in ${basename(status.plainFile)}, so there is nothing to regenerate.`;
|
|
1790
|
-
const lines = [`${status.module} (${basename(status.plainFile)}${status.
|
|
1970
|
+
const lines = [`${status.module} (${basename(status.plainFile)}${status.configModule !== undefined ? `, built with ${moduleConfigFile(status.configModule)}` : ""}):`];
|
|
1791
1971
|
if (status.running !== undefined) {
|
|
1792
1972
|
lines.push(` running: pulse ${status.running.jobId} - ${status.running.title}`);
|
|
1793
1973
|
// Steered, not stopped or planned again: what changed went to its agent.
|
|
@@ -1803,8 +1983,11 @@ export function describeModules(statuses, options = {}) {
|
|
|
1803
1983
|
: ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - ${casesText(job.cases)}`));
|
|
1804
1984
|
if (status.planNotes !== undefined)
|
|
1805
1985
|
lines.push(" what the plan did not do as asked:", ...status.planNotes.map((note) => ` - ${note}`));
|
|
1986
|
+
// A look ahead from the command line keeps its plan only while the process lives: the run that starts it plans again.
|
|
1806
1987
|
if (status.why !== undefined)
|
|
1807
|
-
lines.push(
|
|
1988
|
+
lines.push(options.for === "command line" && status.why === LOOKED_AHEAD
|
|
1989
|
+
? ` looked ahead - planned, nothing started: turri regenerate ${basename(status.plainFile)} runs it, planning it again as it starts`
|
|
1990
|
+
: ` ${status.why}`);
|
|
1808
1991
|
if (status.conformanceNote !== undefined)
|
|
1809
1992
|
lines.push(` ${status.conformanceNote}`);
|
|
1810
1993
|
lines.push(...startOver(status));
|