@turri-dev/cli 0.2.4-next.240620d → 0.2.4-next.359b847
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 +6 -7
- package/dist/bedrock-region.js +3 -3
- 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 -10
- package/dist/chats.js +125 -41
- package/dist/cli.js +10 -26
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +32 -24
- package/dist/config.d.ts +101 -58
- package/dist/config.js +265 -118
- package/dist/conform-cli.js +14 -3
- package/dist/conformance-switch.d.ts +7 -6
- package/dist/conformance-switch.js +19 -16
- package/dist/extension.d.ts +29 -3
- package/dist/extension.js +375 -351
- package/dist/genome.js +5 -1
- package/dist/host-session.d.ts +8 -7
- package/dist/host-session.js +4 -4
- package/dist/host.d.ts +3 -1
- package/dist/host.js +3 -3
- package/dist/identity.js +2 -2
- package/dist/init-config.d.ts +1 -1
- package/dist/init-config.js +8 -8
- package/dist/launch-agent.d.ts +51 -0
- package/dist/launch-agent.js +267 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +68 -0
- package/dist/launch-session.js +217 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +125 -0
- package/dist/launch-track.js +320 -0
- package/dist/loop-cli.js +4 -4
- package/dist/loop-tools.d.ts +45 -21
- package/dist/loop-tools.js +152 -82
- package/dist/notice.d.ts +7 -6
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +3 -0
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +6 -3
- package/dist/plain/check.d.ts +1 -1
- package/dist/plain/check.js +3 -1
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +7 -7
- 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 +7 -1
- package/dist/regenerate/command-check.js +43 -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/job-panel.js +3 -1
- package/dist/regenerate/jobs.d.ts +2 -2
- package/dist/regenerate/jobs.js +10 -10
- package/dist/regenerate/launch.d.ts +154 -0
- package/dist/regenerate/{release.js → launch.js} +195 -51
- package/dist/regenerate/ledger.d.ts +33 -2
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +30 -10
- package/dist/regenerate/loop.js +166 -59
- 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.js +4 -1
- 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/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 +6 -6
- package/dist/regenerate/testing-steps.js +8 -8
- package/dist/regenerate-cli.js +1 -1
- package/dist/self-invocation.d.ts +11 -0
- package/dist/self-invocation.js +36 -7
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +18 -12
- package/dist/sentinel.js +72 -43
- 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/turri-versions.js +2 -1
- package/docs/README.md +4 -4
- package/docs/chats.md +5 -6
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +58 -46
- package/docs/development.md +2 -2
- package/docs/headless.md +4 -4
- package/docs/hosting.md +20 -19
- package/docs/launch.md +67 -0
- package/docs/parser.md +2 -2
- package/docs/regenerating.md +21 -15
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +26 -14
- package/docs/skills-and-gates.md +4 -4
- package/docs/using.md +19 -28
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/turri-regeneration.md +5 -3
- 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/regenerate/engine.d.ts +0 -52
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
- package/docs/deploy.md +0 -48
- /package/dist/{release-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
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";
|
|
@@ -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 {
|
|
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,13 +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
|
-
* Whether a
|
|
298
|
-
* 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.
|
|
299
300
|
*/
|
|
300
301
|
const awaitsScript = (state, kind) => {
|
|
301
302
|
const tip = tipEntry(state);
|
|
302
303
|
const root = projectRootFor(tip.plainFile, tip.buildDir);
|
|
303
|
-
|
|
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));
|
|
304
306
|
};
|
|
305
307
|
/**
|
|
306
308
|
* The base folder a codebase started from, as its status says it. Counting the files still there looks at each, and the
|
|
@@ -353,15 +355,96 @@ export function createWorkLoop(options) {
|
|
|
353
355
|
}
|
|
354
356
|
return narrowed;
|
|
355
357
|
};
|
|
356
|
-
/**
|
|
357
|
-
|
|
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) => {
|
|
358
363
|
const tree = chainSpec(state.chain).tree;
|
|
359
364
|
const read = new Map();
|
|
360
365
|
for (const section of [FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS]) {
|
|
361
366
|
for (const item of tree[section] ?? [])
|
|
362
367
|
read.set(identityOf(item), JSON.stringify(item));
|
|
363
368
|
}
|
|
364
|
-
|
|
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);
|
|
365
448
|
};
|
|
366
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. */
|
|
367
450
|
const workOf = (track, from, state, spec, narrowed = true) => track === "code" ? codeWork(from, spec.tree) : changesBetween(serializeTree(from), serializeTree(conformanceOf(state, spec, from, narrowed)));
|
|
@@ -547,7 +630,7 @@ export function createWorkLoop(options) {
|
|
|
547
630
|
}
|
|
548
631
|
// Nothing here yet, and nothing below: the codebase starts from its base folder, when the config names one.
|
|
549
632
|
if (tip.requires === null && !started(tip))
|
|
550
|
-
|
|
633
|
+
withModuleConfig(state, () => seedFromBaseFolder(tip.buildDir, tip.plainFile, tip.moduleName));
|
|
551
634
|
// A conformance job is shown the spec whole - its test reqs and scenarios are its to write from.
|
|
552
635
|
const result = await (conformance ? runConformance : run)({
|
|
553
636
|
plainFile: tip.plainFile,
|
|
@@ -559,26 +642,11 @@ export function createWorkLoop(options) {
|
|
|
559
642
|
cwd: options.cwd,
|
|
560
643
|
...(steering !== undefined ? { steering } : {}),
|
|
561
644
|
}, onDelta);
|
|
562
|
-
const report = result.report;
|
|
563
|
-
// Released as its last stage, when the config says so: the module's next pulse starts on what is released.
|
|
564
|
-
let released;
|
|
565
|
-
if (result.landed && options.release !== undefined && configForSpec(tip.plainFile).releaseAfterPulse === true) {
|
|
566
|
-
reportStage(`module ${tip.moduleName}: releasing what this pulse landed (release-after-pulse)`);
|
|
567
|
-
try {
|
|
568
|
-
released = `Released after the pulse: ${(await options.release({ plainFile: tip.plainFile, moduleName: tip.moduleName, title: planned.title, onDelta })).trim()}`;
|
|
569
|
-
}
|
|
570
|
-
catch (error) {
|
|
571
|
-
// What landed stays landed: a release that fails is said, and the next pulse goes on.
|
|
572
|
-
released = `The release after the pulse failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
573
|
-
}
|
|
574
|
-
reportActivity(` ${released.split("\n")[0]}`);
|
|
575
|
-
}
|
|
576
645
|
return {
|
|
577
|
-
report:
|
|
646
|
+
report: result.report,
|
|
578
647
|
details: {
|
|
579
648
|
passed: result.landed,
|
|
580
649
|
landed: result.landed,
|
|
581
|
-
...(released !== undefined ? { released: true } : {}),
|
|
582
650
|
...(result.story !== undefined ? { story: result.story } : {}),
|
|
583
651
|
// The spec gaps its agents met, for a headless run to say - in the chat the report puts them to the person.
|
|
584
652
|
...(result.specGaps !== undefined && result.specGaps.length > 0 ? { specGaps: result.specGaps } : {}),
|
|
@@ -686,6 +754,20 @@ export function createWorkLoop(options) {
|
|
|
686
754
|
// What it did, in the notes every agent after reads - once anything it did not land is rolled back, so the line stays.
|
|
687
755
|
if (running !== undefined)
|
|
688
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
|
+
}
|
|
689
771
|
void tick();
|
|
690
772
|
};
|
|
691
773
|
/**
|
|
@@ -829,7 +911,7 @@ export function createWorkLoop(options) {
|
|
|
829
911
|
// A codebase left behind - built on since - is not looked at, unless a job of it is still running; what it had
|
|
830
912
|
// planned, or waited for, is no longer shown.
|
|
831
913
|
if (now.has(state) || state.running !== undefined)
|
|
832
|
-
await
|
|
914
|
+
await withModuleConfig(state, () => look(state));
|
|
833
915
|
else {
|
|
834
916
|
state.why = "left behind: the code is built on further up the chain, where changes to it are made";
|
|
835
917
|
state.waitsFor = undefined;
|
|
@@ -1053,7 +1135,7 @@ export function createWorkLoop(options) {
|
|
|
1053
1135
|
}));
|
|
1054
1136
|
};
|
|
1055
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. */
|
|
1056
|
-
const describe = (state) =>
|
|
1138
|
+
const describe = (state) => withModuleConfig(state, () => describeIn(state));
|
|
1057
1139
|
const describeIn = (state) => {
|
|
1058
1140
|
// What runs next: the code's jobs, then the conformance tests' - the module's, once its code is built - the running job first.
|
|
1059
1141
|
const running = state.running?.planned;
|
|
@@ -1109,7 +1191,7 @@ export function createWorkLoop(options) {
|
|
|
1109
1191
|
plainFile: tip.plainFile,
|
|
1110
1192
|
...(base !== undefined ? { base } : {}),
|
|
1111
1193
|
...(renames.length > 0 ? { renames: renames.map(renameText) } : {}),
|
|
1112
|
-
...(state.
|
|
1194
|
+
...(state.configModule?.name !== undefined ? { configModule: state.configModule.name } : {}),
|
|
1113
1195
|
...(state.running !== undefined
|
|
1114
1196
|
? {
|
|
1115
1197
|
running: {
|
|
@@ -1128,10 +1210,10 @@ export function createWorkLoop(options) {
|
|
|
1128
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)) };
|
|
1129
1211
|
};
|
|
1130
1212
|
/**
|
|
1131
|
-
* Look after a codebase - its chain up to it - from now on; says its state.
|
|
1132
|
-
*
|
|
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.
|
|
1133
1215
|
*/
|
|
1134
|
-
const track = (chain, askedFile, request,
|
|
1216
|
+
const track = (chain, askedFile, request, asked = false) => {
|
|
1135
1217
|
const tip = tipOf(chain);
|
|
1136
1218
|
let state = modules.get(tip.buildDir);
|
|
1137
1219
|
if (state === undefined) {
|
|
@@ -1146,10 +1228,15 @@ export function createWorkLoop(options) {
|
|
|
1146
1228
|
}
|
|
1147
1229
|
state.chain = chain;
|
|
1148
1230
|
state.askedFile = askedFile;
|
|
1149
|
-
|
|
1150
|
-
state.
|
|
1151
|
-
|
|
1152
|
-
|
|
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));
|
|
1153
1240
|
if (model !== undefined)
|
|
1154
1241
|
state.model = model;
|
|
1155
1242
|
if (request.guidance !== undefined && !state.guidance.includes(request.guidance))
|
|
@@ -1165,8 +1252,7 @@ export function createWorkLoop(options) {
|
|
|
1165
1252
|
asked.set(file, { ...ahead.get(file), ...asked.get(file), ...given });
|
|
1166
1253
|
ahead.delete(file);
|
|
1167
1254
|
}
|
|
1168
|
-
// Asked for,
|
|
1169
|
-
// is chosen later.
|
|
1255
|
+
// Asked for, its config is worked out - its own file, or one of a module it requires - and pinned to its pulses.
|
|
1170
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)))));
|
|
1171
1257
|
// Asked again, a halted codebase is tried again - one the person halted too. Looked ahead at, its kept plan starts.
|
|
1172
1258
|
for (const state of states) {
|
|
@@ -1187,7 +1273,7 @@ export function createWorkLoop(options) {
|
|
|
1187
1273
|
for (const file of files)
|
|
1188
1274
|
if (!asked.has(file))
|
|
1189
1275
|
ahead.set(file, { ...ahead.get(file), ...given });
|
|
1190
|
-
// Its
|
|
1276
|
+
// Its config pinned as an ask pins it: the plan is made, and its pulses run, with the config regenerate would use.
|
|
1191
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)))));
|
|
1192
1278
|
// A chain with a pulse running is being built as asked, and goes on; every other codebase is held - one asked for
|
|
1193
1279
|
// earlier too, which would otherwise start the work the look ahead plans.
|
|
@@ -1242,7 +1328,7 @@ export function createWorkLoop(options) {
|
|
|
1242
1328
|
if (state.plan === undefined || !state.plan.jobs.includes(job) || state.plan.specKey !== keyOf(spec) || state.plan.steeringKey !== steeringKeyOf(state)) {
|
|
1243
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.");
|
|
1244
1330
|
}
|
|
1245
|
-
const task = await
|
|
1331
|
+
const task = await withModuleConfig(state, () => promptOf({ plainFile: tip.plainFile, spec: { ...spec, tree: job.step.tree }, planned: job }));
|
|
1246
1332
|
return task !== undefined ? { ...pulse, task } : why("It has no prompt to show.");
|
|
1247
1333
|
},
|
|
1248
1334
|
async regenerateAgain(plainFile, given, request = {}) {
|
|
@@ -1301,7 +1387,7 @@ export function createWorkLoop(options) {
|
|
|
1301
1387
|
const tip = tipOf(codebase);
|
|
1302
1388
|
// The codebase as the loop knows it, or - never asked for - as its records have it.
|
|
1303
1389
|
const state = modules.get(tip.buildDir) ?? { chain: codebase, askedFile: file, guidance: [] };
|
|
1304
|
-
return
|
|
1390
|
+
return withModuleConfig(state, () => {
|
|
1305
1391
|
const report = { module: tip.moduleName, plainFile: tip.plainFile, code: undefined, conformance: undefined, ...(conformanceTestsOn(tip.plainFile) ? {} : { conformanceOff: true }) };
|
|
1306
1392
|
let spec;
|
|
1307
1393
|
try {
|
|
@@ -1371,10 +1457,20 @@ export function createWorkLoop(options) {
|
|
|
1371
1457
|
}
|
|
1372
1458
|
// Refused before anything is touched: a functional spec not there, nothing to test, or a step of adding tests skipped.
|
|
1373
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.");
|
|
1463
|
+
}
|
|
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");
|
|
1374
1469
|
const tested = new Set((readRecord(conformanceDirFor(self.moduleName, modulesRoot(projectDirOf(self.plainFile))))?.[FUNCTIONAL_REQUIREMENTS] ?? []).map((item) => item.id));
|
|
1375
1470
|
const toWrite = (named !== undefined && named.length > 0 ? named : withScenarios).some((funcId) => !tested.has(funcId));
|
|
1376
1471
|
let wentBack = false;
|
|
1377
|
-
|
|
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) {
|
|
1378
1474
|
const why = `${self.moduleName}'s conformance tests were asked for, and they come before anything is built on it`;
|
|
1379
1475
|
for (const chain of builtTips(file)) {
|
|
1380
1476
|
const above = chain.slice(chain.findIndex((entry) => entry.buildDir === self.buildDir) + 1);
|
|
@@ -1408,7 +1504,7 @@ export function createWorkLoop(options) {
|
|
|
1408
1504
|
state.lookedAhead = undefined;
|
|
1409
1505
|
const asks = named !== undefined && named.length > 0 ? named : undefined;
|
|
1410
1506
|
// Its tests are written already, and a codebase built on it holds its code: nothing to write, nothing touched.
|
|
1411
|
-
if (asking === undefined && asks !== undefined && tip !== undefined) {
|
|
1507
|
+
if (asking === undefined && asks !== undefined && tip !== undefined && again.length === 0) {
|
|
1412
1508
|
throw new Error(`${self.moduleName}'s conformance tests for ${namesOf(self.moduleName, asks)} are written already. Nothing was started.`);
|
|
1413
1509
|
}
|
|
1414
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.
|
|
@@ -1418,7 +1514,7 @@ export function createWorkLoop(options) {
|
|
|
1418
1514
|
state.conformancePlan = undefined;
|
|
1419
1515
|
state.conformanceSeparately = separately;
|
|
1420
1516
|
// Named: their tests alone - the others left as they are until the module is asked for again, or conform names none.
|
|
1421
|
-
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks) : undefined;
|
|
1517
|
+
state.conformanceOnly = asks !== undefined ? namedOnly(state, asks, self.moduleName) : undefined;
|
|
1422
1518
|
state.conformancePlan = undefined;
|
|
1423
1519
|
state.conformanceHalted = undefined;
|
|
1424
1520
|
state.halted = undefined;
|
|
@@ -1717,6 +1813,7 @@ function conformanceLines(module, cases) {
|
|
|
1717
1813
|
...(spec.added.length > 0 ? [`${spec.added.length} added`] : []),
|
|
1718
1814
|
...(spec.changed.length > 0 ? [`${spec.changed.length} changed`] : []),
|
|
1719
1815
|
...(spec.removed.length > 0 ? [`${spec.removed.length} removed`] : []),
|
|
1816
|
+
...(spec.rewritten.length > 0 ? [`written again from scratch - ${spec.rewritten.length} to write anew`] : []),
|
|
1720
1817
|
...(spec.codeChanged !== undefined ? [`${why[spec.codeChanged]} - ${spec.unchanged.length} to run on it`] : []),
|
|
1721
1818
|
];
|
|
1722
1819
|
return parts.length > 0 ? parts.join(", ") : "its text changed";
|
|
@@ -1757,6 +1854,12 @@ export function funcIdsNamed(module, names) {
|
|
|
1757
1854
|
return funcId;
|
|
1758
1855
|
});
|
|
1759
1856
|
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Why conform starts nothing when a step of adding tests is still to take - the test reqs, the conformance testing
|
|
1859
|
+
* script, the scenarios: not a failure but what conform needs first, each step one the chat takes itself.
|
|
1860
|
+
*/
|
|
1861
|
+
export class TestingStepsMissing extends Error {
|
|
1862
|
+
}
|
|
1760
1863
|
/**
|
|
1761
1864
|
* What conform is asked for in a module, checked from its ***plain alone - quick, before anything is said or touched: the
|
|
1762
1865
|
* functional specs named, as func-ids, and the module's spec and those of its functional specs with scenarios. Throws,
|
|
@@ -1772,7 +1875,7 @@ function conformanceAskedIn(own, funcIds) {
|
|
|
1772
1875
|
// No scenarios: the steps still to take, from the first one missing - the test reqs and the script come before them.
|
|
1773
1876
|
const toScenarios = () => stepsToScenarios({ moduleName: self.moduleName, plainFile: self.plainFile, tree: spec, buildDir: self.buildDir });
|
|
1774
1877
|
if (withScenarios.length === 0) {
|
|
1775
|
-
throw new
|
|
1878
|
+
throw new TestingStepsMissing(`No functional spec of ${self.moduleName} has scenarios - none has a test plain file - so there is nothing to test. ${toScenarios()} ` +
|
|
1776
1879
|
"Their tests are written once the code is built. Nothing was started.");
|
|
1777
1880
|
}
|
|
1778
1881
|
if (named !== undefined && named.length > 0) {
|
|
@@ -1782,19 +1885,20 @@ function conformanceAskedIn(own, funcIds) {
|
|
|
1782
1885
|
throw new Error(`${self.moduleName} has no functional spec ${namesOf(self.moduleName, unknown)}. Nothing was started.`);
|
|
1783
1886
|
const untested = named.filter((funcId) => !hasScenarios(items.find((item) => item.id === funcId)));
|
|
1784
1887
|
if (untested.length > 0) {
|
|
1785
|
-
throw new
|
|
1888
|
+
throw new TestingStepsMissing(`${namesOf(self.moduleName, untested)} ${untested.length === 1 ? "has" : "have"} no scenarios - no test plain file - so there is nothing to test. ${toScenarios()} ` +
|
|
1786
1889
|
"Their tests are written once the code is built. Nothing was started.");
|
|
1787
1890
|
}
|
|
1788
1891
|
}
|
|
1789
|
-
// A step of adding tests skipped - its test reqs, or the conformance testing script
|
|
1892
|
+
// A step of adding tests skipped - its test reqs, or the conformance testing script: refused, naming it.
|
|
1790
1893
|
const gap = testingGap({ moduleName: self.moduleName, plainFile: self.plainFile, tree: spec, buildDir: self.buildDir });
|
|
1791
1894
|
if (gap !== undefined)
|
|
1792
|
-
throw new
|
|
1895
|
+
throw new TestingStepsMissing(`${gap.text} Nothing was started.`);
|
|
1793
1896
|
return { named, spec, withScenarios };
|
|
1794
1897
|
}
|
|
1795
1898
|
/**
|
|
1796
1899
|
* Why conform would start nothing for a module, from its ***plain alone (`conformanceAskedIn`): undefined when it would
|
|
1797
|
-
* go on. What /conform checks before it says anything.
|
|
1900
|
+
* go on. What /conform checks before it says anything. `stepsMissing`: what is missing is a step of adding tests - the
|
|
1901
|
+
* test reqs, the conformance testing script, the scenarios - guidance for the chat, not an error for the person.
|
|
1798
1902
|
*/
|
|
1799
1903
|
export function conformanceRefusal(plainFile, funcIds) {
|
|
1800
1904
|
try {
|
|
@@ -1802,7 +1906,7 @@ export function conformanceRefusal(plainFile, funcIds) {
|
|
|
1802
1906
|
return undefined;
|
|
1803
1907
|
}
|
|
1804
1908
|
catch (error) {
|
|
1805
|
-
return error instanceof Error ? error.message : String(error);
|
|
1909
|
+
return { text: error instanceof Error ? error.message : String(error), stepsMissing: error instanceof TestingStepsMissing };
|
|
1806
1910
|
}
|
|
1807
1911
|
}
|
|
1808
1912
|
/** What a job does, in a few words: its cases, each functional spec by its func-id - with its module, a module below's. */
|
|
@@ -1870,7 +1974,7 @@ export function describeModules(statuses, options = {}) {
|
|
|
1870
1974
|
// Nothing to do there: said in a sentence, not as a status.
|
|
1871
1975
|
if (isUpToDate(status))
|
|
1872
1976
|
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.`;
|
|
1873
|
-
const lines = [`${status.module} (${basename(status.plainFile)}${status.
|
|
1977
|
+
const lines = [`${status.module} (${basename(status.plainFile)}${status.configModule !== undefined ? `, built with ${moduleConfigFile(status.configModule)}` : ""}):`];
|
|
1874
1978
|
if (status.running !== undefined) {
|
|
1875
1979
|
lines.push(` running: pulse ${status.running.jobId} - ${status.running.title}`);
|
|
1876
1980
|
// Steered, not stopped or planned again: what changed went to its agent.
|
|
@@ -1886,8 +1990,11 @@ export function describeModules(statuses, options = {}) {
|
|
|
1886
1990
|
: ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - ${casesText(job.cases)}`));
|
|
1887
1991
|
if (status.planNotes !== undefined)
|
|
1888
1992
|
lines.push(" what the plan did not do as asked:", ...status.planNotes.map((note) => ` - ${note}`));
|
|
1993
|
+
// A look ahead from the command line keeps its plan only while the process lives: the run that starts it plans again.
|
|
1889
1994
|
if (status.why !== undefined)
|
|
1890
|
-
lines.push(
|
|
1995
|
+
lines.push(options.for === "command line" && status.why === LOOKED_AHEAD
|
|
1996
|
+
? ` looked ahead - planned, nothing started: turri regenerate ${basename(status.plainFile)} runs it, planning it again as it starts`
|
|
1997
|
+
: ` ${status.why}`);
|
|
1891
1998
|
if (status.conformanceNote !== undefined)
|
|
1892
1999
|
lines.push(` ${status.conformanceNote}`);
|
|
1893
2000
|
lines.push(...startOver(status));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model named as the person said it - "gpt 5.5", "gemini flash" - resolved to the one it means: for a pulse a call
|
|
3
|
+
* names a model for, and for a model written into the config with the settings tool.
|
|
4
|
+
*
|
|
5
|
+
* A name is resolved strictly. pi's own pattern matching picks its best guess and says nothing
|
|
6
|
+
* - "gpt-5" becomes a Bedrock model with no credentials, "flash" a GLM one - and a job on a
|
|
7
|
+
* guessed model is worse than a question. So an exact id is taken as it is, a looser name is
|
|
8
|
+
* taken only when it fits exactly one model that has credentials, and anything else comes back
|
|
9
|
+
* as a short list to ask the person about.
|
|
10
|
+
*/
|
|
11
|
+
/** The part of pi's model registry this needs. */
|
|
12
|
+
export interface ModelCatalog {
|
|
13
|
+
getAll(): ReadonlyArray<CatalogModel>;
|
|
14
|
+
hasConfiguredAuth(model: CatalogModel): boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CatalogModel {
|
|
17
|
+
provider: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
}
|
|
21
|
+
export type ModelResolution = {
|
|
22
|
+
ok: true;
|
|
23
|
+
model: string;
|
|
24
|
+
name: string;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
message: string;
|
|
28
|
+
candidates: string[];
|
|
29
|
+
};
|
|
30
|
+
/** Resolve what the person called a model to one this machine can run, or say why not. */
|
|
31
|
+
export declare function resolveModel(query: string, catalog: ModelCatalog): ModelResolution;
|
|
32
|
+
/** The resolution as text for the agent: the model, or why not and what to ask. */
|
|
33
|
+
export declare function describeResolution(resolution: ModelResolution): string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* By default, whatever the conversation is using. The person can say otherwise - "render spec
|
|
5
|
-
* changes with Gemini Flash" - for one kind of work or for all of it, and that holds for the
|
|
6
|
-
* rest of the session, for jobs started from a tool call and for jobs a skill queues alike. A
|
|
7
|
-
* single tool call can also name a model for itself alone.
|
|
2
|
+
* A model named as the person said it - "gpt 5.5", "gemini flash" - resolved to the one it means: for a pulse a call
|
|
3
|
+
* names a model for, and for a model written into the config with the settings tool.
|
|
8
4
|
*
|
|
9
5
|
* A name is resolved strictly. pi's own pattern matching picks its best guess and says nothing
|
|
10
6
|
* - "gpt-5" becomes a Bedrock model with no credentials, "flash" a GLM one - and a job on a
|
|
@@ -94,25 +90,3 @@ export function describeResolution(resolution) {
|
|
|
94
90
|
return `${resolution.model} (${resolution.name})`;
|
|
95
91
|
return [resolution.message, ...resolution.candidates.map((candidate) => `- ${candidate}`)].join("\n");
|
|
96
92
|
}
|
|
97
|
-
export const WORK_LABEL = {
|
|
98
|
-
spec_changes: "spec changes",
|
|
99
|
-
functionalities: "functionalities",
|
|
100
|
-
all: "everything",
|
|
101
|
-
};
|
|
102
|
-
/** The model a job of this kind runs on: chosen for it, chosen for everything, or the chat's. */
|
|
103
|
-
export function modelFor(choices, work, chat) {
|
|
104
|
-
return choices[work] ?? choices.all ?? chat;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Where each kind of work runs now, in a line each: chosen in this session, or the default coding
|
|
108
|
-
* model - from `--coding-model` or config.turri.yaml, said which - or the conversation's.
|
|
109
|
-
*/
|
|
110
|
-
export function describeChoices(choices, chat, project) {
|
|
111
|
-
const fallback = project !== undefined ? `${project.model} (${project.from})` : `${chat ?? "pi's default model"} (the chat's model)`;
|
|
112
|
-
return ["spec_changes", "functionalities"]
|
|
113
|
-
.map((work) => {
|
|
114
|
-
const chosen = choices[work] ?? choices.all;
|
|
115
|
-
return `- ${WORK_LABEL[work]}: ${chosen ?? fallback}`;
|
|
116
|
-
})
|
|
117
|
-
.join("\n");
|
|
118
|
-
}
|
|
@@ -30,7 +30,7 @@ export declare function defaultBuildDir(moduleName: string, cwd?: string): strin
|
|
|
30
30
|
*/
|
|
31
31
|
/**
|
|
32
32
|
* The project a spec belongs to: the nearest folder, from the spec's own up, that holds a
|
|
33
|
-
* `config.turri.yaml`, a
|
|
33
|
+
* `config.turri.yaml`, a module's `config.turri.<module>.yaml`, the `config.yaml` turri read before it had a file of
|
|
34
34
|
* its own, or a `plain_modules` - where its code is built, its config read, its testing scripts found. Without any, the
|
|
35
35
|
* spec's own folder. So `plain/hubspot.plain`, beside `plain/config.turri.yaml` and `plain/plain_modules`, is built there,
|
|
36
36
|
* wherever turri was started;
|
|
@@ -56,11 +56,11 @@ export declare function modulesRootOf(dir: string): string;
|
|
|
56
56
|
export declare function modulesScratchDir(dir: string): string;
|
|
57
57
|
/** Make `path` inside the modules' scratch, which ignores itself. Returns `path`. */
|
|
58
58
|
export declare function ensureInModulesScratch(dir: string, path: string): string;
|
|
59
|
-
/** Where the project keeps what
|
|
59
|
+
/** Where the project keeps what a launch puts out: `dist/`, beside `plain_modules`. */
|
|
60
60
|
export declare const DIST_DIR = "dist";
|
|
61
61
|
/**
|
|
62
62
|
* Where a person tries a module: `<project>/dist/<module>`, the module's code as its last commit has
|
|
63
|
-
* it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every
|
|
63
|
+
* it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every launch.
|
|
64
64
|
*/
|
|
65
65
|
export declare function distDirFor(projectDir: string, moduleName: string): string;
|
|
66
66
|
/**
|
package/dist/regenerate/paths.js
CHANGED
|
@@ -37,7 +37,7 @@ export function defaultBuildDir(moduleName, cwd = process.cwd()) {
|
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
39
39
|
* The project a spec belongs to: the nearest folder, from the spec's own up, that holds a
|
|
40
|
-
* `config.turri.yaml`, a
|
|
40
|
+
* `config.turri.yaml`, a module's `config.turri.<module>.yaml`, the `config.yaml` turri read before it had a file of
|
|
41
41
|
* its own, or a `plain_modules` - where its code is built, its config read, its testing scripts found. Without any, the
|
|
42
42
|
* spec's own folder. So `plain/hubspot.plain`, beside `plain/config.turri.yaml` and `plain/plain_modules`, is built there,
|
|
43
43
|
* wherever turri was started;
|
|
@@ -56,7 +56,7 @@ export function projectDirOf(plainFile) {
|
|
|
56
56
|
export function isProjectDir(dir) {
|
|
57
57
|
return existsSync(join(dir, "config.yaml")) || existsSync(join(dir, MODULES_DIR)) || hasModuleConfig(dir);
|
|
58
58
|
}
|
|
59
|
-
/** Whether a folder holds a config file - config.turri.yaml, a
|
|
59
|
+
/** Whether a folder holds a config file - config.turri.yaml, a module's config.turri.<module>.yaml, or one in the old naming - which makes it a project too. */
|
|
60
60
|
function hasModuleConfig(dir) {
|
|
61
61
|
try {
|
|
62
62
|
return readdirSync(dir).some((name) => /^config\..+\.yaml$/.test(name));
|
|
@@ -96,11 +96,11 @@ export function modulesScratchDir(dir) {
|
|
|
96
96
|
export function ensureInModulesScratch(dir, path) {
|
|
97
97
|
return ensureInScratch(modulesScratchDir(dir), path);
|
|
98
98
|
}
|
|
99
|
-
/** Where the project keeps what
|
|
99
|
+
/** Where the project keeps what a launch puts out: `dist/`, beside `plain_modules`. */
|
|
100
100
|
export const DIST_DIR = "dist";
|
|
101
101
|
/**
|
|
102
102
|
* Where a person tries a module: `<project>/dist/<module>`, the module's code as its last commit has
|
|
103
|
-
* it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every
|
|
103
|
+
* it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every launch.
|
|
104
104
|
*/
|
|
105
105
|
export function distDirFor(projectDir, moduleName) {
|
|
106
106
|
return join(projectDir, DIST_DIR, moduleName);
|
|
@@ -24,6 +24,17 @@ export { RECORD_FILE } from "./paths.ts";
|
|
|
24
24
|
export declare const REGENERATE_AGAIN = "regenerate_again";
|
|
25
25
|
/** Whether a record's item is marked to regenerate again. */
|
|
26
26
|
export declare function marksRegenerateAgain(item: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A functional spec in the tests record marked to have its conformance tests written again: they are written, and are
|
|
29
|
+
* to be written anew all the same - `conform` with functional specs named, or a module's from scratch. Its code is
|
|
30
|
+
* untouched. The mark makes the tests record differ from what the tests are to be written for at that item, so the
|
|
31
|
+
* work loop plans a conformance pulse for it, and the pulse that writes them writes the item back without it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CONFORM_AGAIN = "conform_again";
|
|
34
|
+
/** Whether a tests record's item is marked to have its conformance tests written again. */
|
|
35
|
+
export declare function marksConformAgain(item: unknown): boolean;
|
|
36
|
+
/** Whether a tests record's item is not written for the code as it is now: marked with its code to regenerate again, or to be written again. */
|
|
37
|
+
export declare function marksTestsAgain(item: unknown): boolean;
|
|
27
38
|
/**
|
|
28
39
|
* Whether a functional spec has scenarios - conformance or acceptance - and so is tested: one with an empty test plain
|
|
29
40
|
* file is not.
|