@turri-dev/cli 0.2.4-next.8422d0f → 0.2.4-next.efe96fe
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 +5 -6
- 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/chats.d.ts +2 -12
- package/dist/chats.js +3 -26
- package/dist/cli.js +11 -30
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +29 -23
- package/dist/config.d.ts +62 -71
- package/dist/config.js +170 -125
- 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 +8 -10
- package/dist/extension.js +257 -429
- package/dist/genome.js +9 -48
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +5 -16
- package/dist/host-session.js +4 -6
- package/dist/host.d.ts +2 -4
- package/dist/host.js +4 -7
- package/dist/identity.js +0 -1
- package/dist/init-config.d.ts +0 -1
- package/dist/init-config.js +3 -10
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +1 -1
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +13 -11
- package/dist/loop-tools.d.ts +37 -18
- package/dist/loop-tools.js +118 -58
- package/dist/new-project.js +2 -2
- 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.js +4 -4
- 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/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/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +2 -15
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/loop.d.ts +48 -62
- package/dist/regenerate/loop.js +296 -131
- 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 +1 -1
- package/dist/regenerate/paths.js +2 -2
- 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 +33 -7
- package/dist/sentinel.js +8 -5
- 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 +2 -4
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +4 -7
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +55 -45
- package/docs/deploy.md +1 -1
- package/docs/development.md +3 -4
- package/docs/headless.md +6 -5
- package/docs/hosting.md +11 -11
- package/docs/parser.md +3 -3
- package/docs/regenerating.md +27 -19
- package/docs/sentinel.md +6 -6
- package/docs/skills-and-gates.md +4 -9
- package/docs/using.md +20 -37
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +6 -9
- 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.d.ts +0 -1
- 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/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- 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/test-advisor.md +0 -110
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
2
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { conformanceTestsOn } from "../conformance-switch.js";
|
|
4
|
-
import {
|
|
4
|
+
import { configModuleFor, configModulePinned, testDirOf, withConfigModule } from "../config.js";
|
|
5
5
|
import { IMPORT_DIRECTIVE, readPlainSourceMetadata } from "../plain/parser.js";
|
|
6
6
|
import { FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS, TEST_REQUIREMENTS } from "../plain/spec.js";
|
|
7
7
|
import { isStdlibModule, STDLIB_ROOT } from "../plain/stdlib.js";
|
|
@@ -50,16 +50,16 @@ export function conformanceTemplateOf(plainFile) {
|
|
|
50
50
|
return conformance !== undefined && existsSync(join(STDLIB_ROOT, `${conformance}.plain`)) ? conformance : undefined;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* The conformance testing script a module's tests would run with, looked for
|
|
54
|
-
*
|
|
53
|
+
* The conformance testing script a module's tests would run with, looked for with its config - the one pinned, else the
|
|
54
|
+
* one `configModuleFor` gives it - or nothing, with why when there is a why.
|
|
55
55
|
*/
|
|
56
56
|
export function conformanceScriptOf(plainFile, buildDir) {
|
|
57
|
-
const
|
|
57
|
+
const configModule = configModulePinned() ? undefined : configModuleFor(plainFile);
|
|
58
58
|
const scripts = () => {
|
|
59
59
|
const root = buildDir !== undefined ? projectRootFor(plainFile, buildDir) : projectDirOf(plainFile);
|
|
60
60
|
return findTestScripts(root, plainFile, buildDir);
|
|
61
61
|
};
|
|
62
|
-
const found =
|
|
62
|
+
const found = configModulePinned() ? scripts() : withConfigModule(configModule, scripts);
|
|
63
63
|
return { ...(found.conformance !== undefined ? { script: found.conformance } : {}), ...(found.notes?.conformance !== undefined ? { note: found.notes.conformance } : {}) };
|
|
64
64
|
}
|
|
65
65
|
/** The functional specs of a codebase's tree - its own, or ones it inherits - that have scenarios, as `module:func-id`, a module below's first. */
|
|
@@ -73,9 +73,9 @@ function named(specs) {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* The step of adding tests a module skipped, when its functional specs have scenarios: no test reqs - its own or
|
|
76
|
-
* imported - or no conformance testing script
|
|
76
|
+
* imported - or no conformance testing script. `tree` is what its conformance tests would be written from:
|
|
77
77
|
* the codebase's spec, the module's own sections with its imports in, and the functional specs it inherits. The script
|
|
78
|
-
* is looked for
|
|
78
|
+
* is looked for with the module's config - the one pinned, else the one `configModuleFor` gives it.
|
|
79
79
|
*/
|
|
80
80
|
export function testingGap(input) {
|
|
81
81
|
const { moduleName, plainFile } = input;
|
|
@@ -93,7 +93,7 @@ export function testingGap(input) {
|
|
|
93
93
|
return {
|
|
94
94
|
step: "test reqs",
|
|
95
95
|
text: `${moduleName} has scenarios to test - ${named(tested)} - but no ***test reqs***, so its conformance tests cannot be written - the test reqs are ` +
|
|
96
|
-
`the first step of adding tests. Next step: ${reqs}
|
|
96
|
+
`the first step of adding tests. Next step: ${reqs}${found.script === undefined ? `; then ${scriptStep}` : ""}.`,
|
|
97
97
|
short: "scenarios not tested: no test reqs",
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -108,3 +108,22 @@ export function testingGap(input) {
|
|
|
108
108
|
}
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The steps of adding tests a module still has to take before it has anything to test - in their order: its test reqs,
|
|
113
|
+
* its conformance testing script, the scenarios - from the first one missing. What is said when conform
|
|
114
|
+
* finds no scenarios: the whole way there, not the last step alone.
|
|
115
|
+
*/
|
|
116
|
+
export function stepsToScenarios(input) {
|
|
117
|
+
const { moduleName, plainFile } = input;
|
|
118
|
+
const steps = [];
|
|
119
|
+
if ((input.tree[TEST_REQUIREMENTS] ?? []).length === 0) {
|
|
120
|
+
const conformance = conformanceTemplateOf(plainFile);
|
|
121
|
+
steps.push(conformance !== undefined ? `import the stack's conformance template, ${conformance}` : "write the module's own ***test reqs***");
|
|
122
|
+
}
|
|
123
|
+
if (conformanceScriptOf(plainFile, input.buildDir).script === undefined)
|
|
124
|
+
steps.push("write the conformance testing script with the implement-conformance-testing-script skill");
|
|
125
|
+
const testDir = relative(projectDirOf(resolve(plainFile)), testDirOf(plainFile)) || ".";
|
|
126
|
+
steps.push(`write the scenarios, each functional spec's in ${testDir}/${moduleName}/<func-id>.plain, then regenerate`);
|
|
127
|
+
const order = steps.length > 1 ? "Adding tests is three steps, in this order: the test reqs, the conformance testing script, the scenarios. " : "";
|
|
128
|
+
return `${order}Next step: ${steps.join("; then ")}.`;
|
|
129
|
+
}
|
package/dist/regenerate-cli.js
CHANGED
|
@@ -16,7 +16,8 @@ build when none is given), coding-model (the agents that build) and harness-mode
|
|
|
16
16
|
0 only when every module is complete: regenerated from the spec as it is, and its conformance tests written
|
|
17
17
|
for every functional spec's scenarios.
|
|
18
18
|
|
|
19
|
-
--dry-run plan the work and print the prompt of
|
|
19
|
+
--dry-run look ahead: plan the work as regenerate would and print the prompt of each codebase's
|
|
20
|
+
next pulse, starting nothing and changing no code or tests
|
|
20
21
|
--start-over start over, without asking, a codebase regenerated without a module it now requires -
|
|
21
22
|
with no terminal to ask and without it, the run stops there
|
|
22
23
|
--from-scratch delete the module's code and conformance tests (its lineage keeps them) and regenerate all of it
|
|
@@ -45,23 +46,31 @@ if (!named) {
|
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
47
48
|
const scratch = options["from-scratch-chain"] !== undefined ? "chain" : options["from-scratch"] !== undefined ? "module" : undefined;
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const dryRun = options["dry-run"] !== undefined;
|
|
50
|
+
// A dry run writes nothing: from scratch deletes the code before it plans, and functional specs named are marked in the records first.
|
|
51
|
+
if (scratch !== undefined && dryRun) {
|
|
50
52
|
console.error(`--from-scratch${scratch === "chain" ? "-chain" : ""} deletes the code before anything is planned: it cannot be a dry run.`);
|
|
51
53
|
process.exit(1);
|
|
52
54
|
}
|
|
55
|
+
if (again.length > 0 && dryRun) {
|
|
56
|
+
console.error(`${again.join(", ")} would be marked to regenerate again in the code records before anything is planned: that cannot be a dry run.`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
53
59
|
runLoop({
|
|
54
60
|
plainFile: named,
|
|
55
61
|
...(buildDir !== undefined ? { buildDir } : {}),
|
|
56
62
|
...(report !== undefined ? { report } : {}),
|
|
57
63
|
command: ["regenerate", ...process.argv.slice(2)],
|
|
58
|
-
dryRun
|
|
64
|
+
dryRun,
|
|
59
65
|
startOver: options["start-over"] !== undefined,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
// A dry run is a look ahead: planned as regenerate plans it, nothing started.
|
|
67
|
+
ask: (loop) => dryRun
|
|
68
|
+
? loop.lookAhead(named)
|
|
69
|
+
: again.length > 0
|
|
70
|
+
? loop.regenerateAgain(named, again)
|
|
71
|
+
: scratch !== undefined
|
|
72
|
+
? loop.fromScratch(named, { chain: scratch === "chain" })
|
|
73
|
+
: loop.bringUp(named),
|
|
65
74
|
}).catch((error) => {
|
|
66
75
|
console.error(error instanceof Error ? error.message : error);
|
|
67
76
|
process.exit(1);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* the same build directories. It is never the right call unless the person asked for the
|
|
9
9
|
* command line, so the harness refuses it and names the tool to use instead.
|
|
10
10
|
*/
|
|
11
|
+
import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
11
12
|
/**
|
|
12
13
|
* What a shell command would run of turri or pi itself, if anything: the subcommand,
|
|
13
14
|
* or "pi" for another pi. `turri parse`, `drift` and `lineage` are not in it - they start no
|
|
@@ -23,3 +24,13 @@ export declare function askedForCommandLine(message: string): boolean;
|
|
|
23
24
|
export declare function refusal(what: string, surface?: string): string;
|
|
24
25
|
/** The instruction that goes into the conversation's system prompt. */
|
|
25
26
|
export declare const TOOLS_NOT_CLI: string;
|
|
27
|
+
type AnyTool = ToolDefinition<any, any, any>;
|
|
28
|
+
/** What a skill's agent is told when its shell would run turri or another pi. */
|
|
29
|
+
export declare function skillRefusal(what: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* A skill's shell: pi's bash in the project, refusing what its agent never runs there - turri or another pi again
|
|
32
|
+
* (selfInvocation), and a change to the machine's toolchains or settings (machineChange). The conversation's own bash is
|
|
33
|
+
* held to the same by its tool_call guard; a skill runs in a session of its own, which that guard does not see.
|
|
34
|
+
*/
|
|
35
|
+
export declare function skillShell(cwd: string): AnyTool;
|
|
36
|
+
export {};
|
package/dist/self-invocation.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* the same build directories. It is never the right call unless the person asked for the
|
|
9
9
|
* command line, so the harness refuses it and names the tool to use instead.
|
|
10
10
|
*/
|
|
11
|
+
import { createBashToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
12
|
+
import { machineChange, machineChangeReason } from "./regenerate/command-check.js";
|
|
11
13
|
/** The tool that does what a turri subcommand does, from inside the conversation. */
|
|
12
14
|
const TOOL_FOR = {
|
|
13
15
|
regenerate: "regenerate",
|
|
14
|
-
glimpse: "glimpse",
|
|
15
16
|
conform: "conform",
|
|
16
17
|
cultivate: "cultivate",
|
|
17
18
|
release: "release",
|
|
18
|
-
"change-plain": "regenerate",
|
|
19
19
|
chat: "nothing - you are the conversation already",
|
|
20
20
|
ask: "nothing - you are the conversation already",
|
|
21
21
|
};
|
|
@@ -31,7 +31,6 @@ const NPM_SCRIPT = {
|
|
|
31
31
|
const ENTRY = {
|
|
32
32
|
"regenerate-cli": "regenerate",
|
|
33
33
|
"conform-cli": "conform",
|
|
34
|
-
"change-plain-cli": "change-plain",
|
|
35
34
|
"cultivate-cli": "cultivate",
|
|
36
35
|
"release-cli": "release",
|
|
37
36
|
};
|
|
@@ -43,10 +42,10 @@ const AT_COMMAND = String.raw `(?:^|[\s;&|()\x60$])`;
|
|
|
43
42
|
* agent - and neither are setup and doctor.
|
|
44
43
|
*/
|
|
45
44
|
export function selfInvocation(command) {
|
|
46
|
-
const cli = new RegExp(`${AT_COMMAND}(?:npx\\s+)?turri\\s+(regenerate|
|
|
45
|
+
const cli = new RegExp(`${AT_COMMAND}(?:npx\\s+)?turri\\s+(regenerate|conform|cultivate|release)\\b`).exec(command);
|
|
47
46
|
if (cli)
|
|
48
47
|
return cli[1];
|
|
49
|
-
const launcher = new RegExp(`(?:bin/turri\\.mjs|src/cli\\.ts)\\s+(regenerate|
|
|
48
|
+
const launcher = new RegExp(`(?:bin/turri\\.mjs|src/cli\\.ts)\\s+(regenerate|conform|cultivate|release)\\b`).exec(command);
|
|
50
49
|
if (launcher)
|
|
51
50
|
return launcher[1];
|
|
52
51
|
// turri alone, or with options, is the conversation - where a command starts, not a word an argument names (`which turri`).
|
|
@@ -83,7 +82,7 @@ const PI_CONFIGURES = new Set([
|
|
|
83
82
|
export function askedForCommandLine(message) {
|
|
84
83
|
const text = message.toLowerCase();
|
|
85
84
|
return (/\b(headless|command[ -]line|cli|terminal|shell|in bash|via bash|through bash|npm run|nohup)\b/.test(text) ||
|
|
86
|
-
/\bturri\s+(regenerate|
|
|
85
|
+
/\bturri\s+(regenerate|conform|cultivate|release)\b/.test(text) ||
|
|
87
86
|
/(^|\s)turri\s+-p\b/.test(text) ||
|
|
88
87
|
/(^|\s)pi\s+-p\b/.test(text));
|
|
89
88
|
}
|
|
@@ -102,10 +101,37 @@ export const TOOLS_NOT_CLI = [
|
|
|
102
101
|
"<turri-tools>",
|
|
103
102
|
"In this conversation, you do your work with your tools - regenerate, conform, cultivate and the rest - which run as",
|
|
104
103
|
"background jobs the user can watch and halt. To try what is regenerated, release it - never by hand in plain_modules. Never",
|
|
105
|
-
"run your own command line (turri regenerate,
|
|
104
|
+
"run your own command line (turri regenerate, conform, cultivate, release, turri itself; npm run",
|
|
106
105
|
"regenerate and the like) or start another pi through bash:",
|
|
107
106
|
"that is a separate headless run the user cannot see or stop. Only when the user explicitly asks for the",
|
|
108
107
|
"command line, run it. Configuring pi itself - turri install, update, remove, list; pi install, update, list, config, auth; or its settings files -",
|
|
109
108
|
"is fine; it starts no agent.",
|
|
110
109
|
"</turri-tools>",
|
|
111
110
|
].join("\n");
|
|
111
|
+
/** What a skill's agent is told when its shell would run turri or another pi. */
|
|
112
|
+
export function skillRefusal(what) {
|
|
113
|
+
return (`Not run: that starts ${what === "pi" ? "another agent" : `turri ${what}`} from the shell - a separate, headless run outside the person's session, ` +
|
|
114
|
+
"its pulses and /halt, writing the same codebases as the work loop. A skill starts no pulse: finish your own work, and say in what you " +
|
|
115
|
+
"hand back what should run next - the conversation runs it.");
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A skill's shell: pi's bash in the project, refusing what its agent never runs there - turri or another pi again
|
|
119
|
+
* (selfInvocation), and a change to the machine's toolchains or settings (machineChange). The conversation's own bash is
|
|
120
|
+
* held to the same by its tool_call guard; a skill runs in a session of its own, which that guard does not see.
|
|
121
|
+
*/
|
|
122
|
+
export function skillShell(cwd) {
|
|
123
|
+
const bash = createBashToolDefinition(cwd);
|
|
124
|
+
return {
|
|
125
|
+
...bash,
|
|
126
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
127
|
+
const command = String(params.command ?? "");
|
|
128
|
+
const what = selfInvocation(command);
|
|
129
|
+
if (what !== undefined)
|
|
130
|
+
throw new Error(skillRefusal(what));
|
|
131
|
+
const changes = machineChange(command);
|
|
132
|
+
if (changes !== undefined)
|
|
133
|
+
throw new Error(machineChangeReason(changes));
|
|
134
|
+
return bash.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
package/dist/sentinel.js
CHANGED
|
@@ -178,11 +178,14 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
178
178
|
]),
|
|
179
179
|
"",
|
|
180
180
|
"For the pulse:",
|
|
181
|
-
"1. Check how it went, from what turri tells you - and, when that is not enough,
|
|
182
|
-
"
|
|
181
|
+
"1. Check how it went, from what turri tells you - and, when that is not enough, the pulse in full (pulses with its id),",
|
|
182
|
+
" its log, and the code and the ***plain, which you read.",
|
|
183
183
|
"2. When it was released (the message says so - release-after-pulse is on), test what was released: it is running",
|
|
184
184
|
" where the message says. How far you test is yours to judge, from what the pulse changed and what the ***plain says",
|
|
185
|
-
" it should do: that it came up, answers, and does what its ***plain diff says it now does.",
|
|
185
|
+
" it should do: that it came up, answers, and does what its ***plain diff says it now does. Where the ***plain picks",
|
|
186
|
+
" one way among several - which of a tie comes first, how a default is chosen - try an input on which the ways give",
|
|
187
|
+
" different answers, so a pass shows the ***plain's way and no other: a tie whose first word is also first",
|
|
188
|
+
" alphabetically tells \"first in the file\" from nothing.",
|
|
186
189
|
"3. When something is wrong - the pulse failed or stopped, it did not pass, the release did not come up, the software",
|
|
187
190
|
" does not do what its ***plain says - find out why. Then:",
|
|
188
191
|
" - When it is the project's tooling - a testing script, or where config.turri.yaml says the scripts are and which",
|
|
@@ -209,7 +212,7 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
209
212
|
"",
|
|
210
213
|
"You fix the project's tooling and nothing else. Your file tools read the whole project; write and edit reach only the",
|
|
211
214
|
"testing scripts and config.turri.yaml - and in it only where the scripts are, and toolchains:. Your shell runs with",
|
|
212
|
-
"the project read only. You never change ***plain - it is the person's intent, never yours to fix - and never steer,",
|
|
215
|
+
"the project read only; the files you try a release with go in $TMPDIR - /tmp is outside what it may write. You never change ***plain - it is the person's intent, never yours to fix - and never steer,",
|
|
213
216
|
"release, or regenerate but by resume after a fix of yours. You install nothing on this machine and change none of",
|
|
214
217
|
"its settings, nor the person's shell - under no circumstances: that is always the person's, said in a notice. You",
|
|
215
218
|
"never ask the person questions - a notice is how you reach them.",
|
|
@@ -316,7 +319,7 @@ export function sentinelCheckBrief(check, context) {
|
|
|
316
319
|
* The tools the sentinel's agent may call: what reads, write and edit for the project's tooling alone, resume, its
|
|
317
320
|
* notices and its guidance - and what a host gives it.
|
|
318
321
|
*/
|
|
319
|
-
export const SENTINEL_TOOLS = ["read", "ls", "grep", "find", "write", "edit", "bash", "read_output", "
|
|
322
|
+
export const SENTINEL_TOOLS = ["read", "ls", "grep", "find", "write", "edit", "bash", "read_output", "pulses", "parse", "doctor", "web_search", "web_fetch", "resume", "notify_person", "conclude", "keep_guidance"];
|
|
320
323
|
/** A testing script by its name - `run_unittests_python.sh`, `prepare_environment_node.sh` - and a config file of turri's. */
|
|
321
324
|
const SCRIPT_FILE = /^(run_|prepare_environment).*\.(sh|ps1|bat|cmd)$/;
|
|
322
325
|
const CONFIG_FILE_NAME = /^config\.turri(\..+)?\.yaml$/;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { type Setting } from "./config-edit.ts";
|
|
3
3
|
/**
|
|
4
|
-
* `/
|
|
5
|
-
* `/
|
|
4
|
+
* `/settings`: every setting of the project's config.turri.yaml from the chat - `/settings` alone lists them,
|
|
5
|
+
* `/settings review` asks for review's value, `/settings review false` sets it. Each is written into the file
|
|
6
6
|
* and takes effect as it says - now, at your next message, at the next pulse - never only once turri starts again:
|
|
7
|
-
* what turri fixes at its start is changed live here (live).
|
|
7
|
+
* what turri fixes at its start is changed live here (live). It takes pi's own /settings over (pi-settings.ts), whose
|
|
8
|
+
* menu is its last entry.
|
|
9
|
+
*
|
|
10
|
+
* The chat's `settings` tool reads them and changes them as the person asks - into config.turri.yaml, or a module's
|
|
11
|
+
* own config.turri.<module>.yaml - a model checked as it is written, by the name the person said. What is the person's
|
|
12
|
+
* alone (`personOnly`) it refuses, and points to /settings.
|
|
8
13
|
*/
|
|
9
14
|
/** What a change does to turri as it runs, beside the file: each says what it did, or nothing. */
|
|
10
15
|
export interface LiveHooks {
|
|
11
16
|
/** The chat's model is now this - provider/id:thinking - or, undefined, no longer set in the file. */
|
|
12
17
|
chatModel(spec: string | undefined, ctx: ExtensionContext): Promise<string | undefined>;
|
|
13
|
-
/** The coding model changed in the file: one
|
|
18
|
+
/** The coding model changed in the file: one given for this session - --coding-model - gives way to it. */
|
|
14
19
|
codingModel(): string | undefined;
|
|
15
20
|
/** How many pulses run at once: the number, or the machine's default. */
|
|
16
21
|
parallelJobs(count: number | undefined): string | undefined;
|
|
17
22
|
}
|
|
18
|
-
export interface
|
|
23
|
+
export interface SettingsOptions {
|
|
19
24
|
/** The folder whose config.turri.yaml the chat reads. */
|
|
20
25
|
cwd: string;
|
|
21
26
|
/** The ***plain rules there are, by name - what rules-off takes. */
|
|
@@ -27,7 +32,7 @@ export interface TurriConfigOptions {
|
|
|
27
32
|
/** The models pi can reach here, signed in: provider/id - from a chat's context, the model registry the chats use. */
|
|
28
33
|
export declare function reachable(ctx: ExtensionContext | undefined): string[];
|
|
29
34
|
/**
|
|
30
|
-
* Every value /
|
|
35
|
+
* Every value /settings offers for a setting after what is typed, in its order - "unset" left out, and uncapped: what
|
|
31
36
|
* its completions show, the first of them, and what a host's settings list shows (host-session.ts `settingChoices`).
|
|
32
37
|
* A model setting's are every model pi can reach, signed in - `models` - and after a colon, that model's thinking levels.
|
|
33
38
|
*/
|
|
@@ -37,4 +42,4 @@ export declare function settingCandidates(setting: Setting, typed: string, where
|
|
|
37
42
|
}): string[];
|
|
38
43
|
/** The ***plain rules there are, by name - what rules-off takes, and its values. */
|
|
39
44
|
export declare function ruleNames(): string[];
|
|
40
|
-
export declare function
|
|
45
|
+
export declare function registerSettings(pi: ExtensionAPI, options: SettingsOptions): void;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
4
|
import { applyBedrockRegion } from "./bedrock-region.js";
|
|
3
|
-
import { CONFIG_FILE, LEGACY_CONFIG_FILE, THINKING_LEVELS, usesLegacyConfig } from "./config.js";
|
|
4
|
-
import { currentValue, dotenvFiles, EFFECT_TEXT, overriddenBy, parseValue, pathOptions, readConfigText, settingOf, settings, shownValue, writeSetting, } from "./config-edit.js";
|
|
5
|
+
import { CONFIG_FILE, LEGACY_CONFIG_FILE, moduleConfigFile, moduleConfigsOf, THINKING_LEVELS, usesLegacyConfig } from "./config.js";
|
|
6
|
+
import { currentValue, dotenvFiles, EFFECT_TEXT, overriddenBy, parseValue, pathOptions, readConfigText, readModuleConfigText, settingOf, settings, shownValue, writeSetting, } from "./config-edit.js";
|
|
5
7
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
8
|
+
import { describeResolution, resolveModel } from "./regenerate/model-names.js";
|
|
9
|
+
import { openPiSettings } from "./pi-settings.js";
|
|
6
10
|
import { loadRules } from "./rules.js";
|
|
7
11
|
/** The option that unsets a setting, for a setting. */
|
|
8
12
|
const unsetOption = (setting) => `unset - ${setting.unset}`;
|
|
9
13
|
const TYPE_ANOTHER = "type another…";
|
|
10
14
|
const DONE = "done";
|
|
11
15
|
const ROLES_ENTRY = "models.<role> - each agent role's own model, thinking and turn limit…";
|
|
16
|
+
const PI_ENTRY = "pi's own settings - the theme, the editor, how the chat is shown…";
|
|
12
17
|
/** The models pi can reach here, signed in: provider/id - from a chat's context, the model registry the chats use. */
|
|
13
18
|
export function reachable(ctx) {
|
|
14
19
|
try {
|
|
@@ -21,7 +26,7 @@ export function reachable(ctx) {
|
|
|
21
26
|
/** How many values the terminal's autocomplete shows for a setting: a host reads them whole (`settingCandidates`). */
|
|
22
27
|
const COMPLETIONS_SHOWN = 40;
|
|
23
28
|
/**
|
|
24
|
-
* Every value /
|
|
29
|
+
* Every value /settings offers for a setting after what is typed, in its order - "unset" left out, and uncapped: what
|
|
25
30
|
* its completions show, the first of them, and what a host's settings list shows (host-session.ts `settingChoices`).
|
|
26
31
|
* A model setting's are every model pi can reach, signed in - `models` - and after a colon, that model's thinking levels.
|
|
27
32
|
*/
|
|
@@ -48,25 +53,22 @@ function listLine(setting, text) {
|
|
|
48
53
|
const value = currentValue(text, setting.key);
|
|
49
54
|
return `${setting.key}: ${value === undefined ? `(unset - ${setting.unset})` : shownValue(value)}`;
|
|
50
55
|
}
|
|
51
|
-
export function
|
|
56
|
+
export function registerSettings(pi, options) {
|
|
52
57
|
const { cwd } = options;
|
|
53
58
|
// The models for completions, which are given no context: the last one seen.
|
|
54
59
|
let seen;
|
|
55
60
|
pi.on("session_start", (_event, ctx) => {
|
|
56
61
|
seen = ctx;
|
|
57
62
|
});
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ctx.ui.notify(parsed.error, "error");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const value = "unset" in parsed ? undefined : parsed.value;
|
|
63
|
+
/**
|
|
64
|
+
* Write a setting - or unset it - into config.turri.yaml, or `module`'s own file, and change live what turri fixed at
|
|
65
|
+
* its start; says what it did and when it takes effect.
|
|
66
|
+
*/
|
|
67
|
+
const change = async (setting, value, ctx, module) => {
|
|
67
68
|
// The first setting written where the project is still read from config.yaml: copied to config.turri.yaml first.
|
|
68
69
|
const adopting = usesLegacyConfig(cwd);
|
|
69
|
-
const text = writeSetting(cwd, setting.key, value);
|
|
70
|
+
const text = writeSetting(cwd, setting.key, value, module);
|
|
71
|
+
const file = module !== undefined ? moduleConfigFile(module) : CONFIG_FILE;
|
|
70
72
|
const notes = [];
|
|
71
73
|
// A model changed: the AWS region its Bedrock models need is worked out again - set, moved or taken back by turri.
|
|
72
74
|
if (setting.key.endsWith("-model") || setting.key.startsWith("models."))
|
|
@@ -89,9 +91,21 @@ export function registerTurriConfig(pi, options) {
|
|
|
89
91
|
}
|
|
90
92
|
if (adopting)
|
|
91
93
|
notes.push(`${LEGACY_CONFIG_FILE} was copied to ${CONFIG_FILE} first - turri reads its own file from now on, and leaves ${LEGACY_CONFIG_FILE} as it is.`);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
if (module !== undefined)
|
|
95
|
+
notes.push(`It holds for ${module}.plain and every module built on it that has no file of its own, over ${CONFIG_FILE}.`);
|
|
96
|
+
notes.push(...overriddenBy(cwd, text, setting, module));
|
|
97
|
+
const what = value === undefined ? `${setting.key} unset - ${module !== undefined ? `${CONFIG_FILE}'s holds` : setting.unset}` : `${setting.key}: ${shownValue(value)}`;
|
|
98
|
+
return [`${what} - written to ${file}, ${EFFECT_TEXT[setting.effect]}.`, ...notes].join("\n");
|
|
99
|
+
};
|
|
100
|
+
/** Set a setting to what was typed - or unset it - and say what it did and when it takes effect. */
|
|
101
|
+
const apply = async (setting, typed, ctx) => {
|
|
102
|
+
const models = reachable(ctx);
|
|
103
|
+
const parsed = parseValue(setting, typed, models.length > 0 ? (model) => models.includes(model) : undefined);
|
|
104
|
+
if ("error" in parsed) {
|
|
105
|
+
ctx.ui.notify(parsed.error, "error");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
ctx.ui.notify(await change(setting, "unset" in parsed ? undefined : parsed.value, ctx), "info");
|
|
95
109
|
};
|
|
96
110
|
/** Ask for a setting's value, as its kind takes it: what is typed comes back, or nothing when the dialog is left. */
|
|
97
111
|
const askValue = async (setting, ctx) => {
|
|
@@ -154,15 +168,20 @@ export function registerTurriConfig(pi, options) {
|
|
|
154
168
|
}
|
|
155
169
|
}
|
|
156
170
|
};
|
|
157
|
-
/** Pick a setting from the list - the models of each role behind one entry. */
|
|
171
|
+
/** Pick a setting from the list - the models of each role behind one entry, and pi's own settings last. */
|
|
158
172
|
const askSetting = async (ctx) => {
|
|
159
173
|
const text = readConfigText(cwd);
|
|
160
174
|
const all = settings(options.rules());
|
|
161
175
|
const top = all.filter((setting) => !setting.key.startsWith("models."));
|
|
162
|
-
const lines = [...top.map((setting) => listLine(setting, text)), ROLES_ENTRY];
|
|
163
|
-
const chosen = await ctx.ui.select(`/
|
|
176
|
+
const lines = [...top.map((setting) => listLine(setting, text)), ROLES_ENTRY, PI_ENTRY];
|
|
177
|
+
const chosen = await ctx.ui.select(`/settings - the project's ${CONFIG_FILE}. Pick a setting to change:`, lines);
|
|
164
178
|
if (chosen === undefined)
|
|
165
179
|
return undefined;
|
|
180
|
+
if (chosen === PI_ENTRY) {
|
|
181
|
+
if (!openPiSettings())
|
|
182
|
+
ctx.ui.notify("pi's own settings open only in the terminal's chat.", "info");
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
166
185
|
if (chosen === ROLES_ENTRY) {
|
|
167
186
|
const roles = all.filter((setting) => setting.key.startsWith("models."));
|
|
168
187
|
const role = await ctx.ui.select("Which role's model or turn limit?", roles.map((setting) => listLine(setting, text)));
|
|
@@ -200,8 +219,8 @@ export function registerTurriConfig(pi, options) {
|
|
|
200
219
|
await apply(setting, value, ctx);
|
|
201
220
|
},
|
|
202
221
|
});
|
|
203
|
-
pi.registerCommand("
|
|
204
|
-
description: `Change a setting of the project's ${CONFIG_FILE}`,
|
|
222
|
+
pi.registerCommand("settings", {
|
|
223
|
+
description: `Change a setting of the project's ${CONFIG_FILE} - or pi's own, last in the list`,
|
|
205
224
|
getArgumentCompletions: (prefix) => {
|
|
206
225
|
const all = settings(options.rules());
|
|
207
226
|
const space = prefix.indexOf(" ");
|
|
@@ -234,7 +253,7 @@ export function registerTurriConfig(pi, options) {
|
|
|
234
253
|
setting = settingOf(key, options.rules());
|
|
235
254
|
if (setting === undefined) {
|
|
236
255
|
const near = settings(options.rules()).filter((entry) => entry.key.includes(key.toLowerCase())).map((entry) => entry.key);
|
|
237
|
-
ctx.ui.notify(`No setting ${key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " /
|
|
256
|
+
ctx.ui.notify(`No setting ${key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " /settings alone lists them."}`, "error");
|
|
238
257
|
return;
|
|
239
258
|
}
|
|
240
259
|
}
|
|
@@ -244,4 +263,116 @@ export function registerTurriConfig(pi, options) {
|
|
|
244
263
|
await apply(setting, given, ctx);
|
|
245
264
|
},
|
|
246
265
|
});
|
|
266
|
+
pi.registerTool(defineTool({
|
|
267
|
+
name: "settings",
|
|
268
|
+
label: "Settings",
|
|
269
|
+
description: `Read or change the project's settings: ${CONFIG_FILE}, and a module's own config.turri.<module>.yaml laid over it for ` +
|
|
270
|
+
"that module and every module built on it that has no file of its own. With no key: every setting, what it is " +
|
|
271
|
+
"and where it is set. With a key and no value: that setting, what it takes and what it is unset. With a value: " +
|
|
272
|
+
"written, taking effect as it says - the coding model at the next pulse. A model may be given by its name as the " +
|
|
273
|
+
"user said it; one that fits several, or none with credentials, comes back as a list - ask the user which. " +
|
|
274
|
+
"Some settings are the user's alone and are refused: they change them with /settings. For one pulse on another " +
|
|
275
|
+
"model, pass model to regenerate or conform instead.",
|
|
276
|
+
promptSnippet: "read the project's settings, or change one when the user asks - the coding model among them",
|
|
277
|
+
promptGuidelines: [
|
|
278
|
+
"Change a setting only when the user asks for it - \"regenerate with gpt 5.5 from now on\" is coding-model - and say what it is now and when it takes effect.",
|
|
279
|
+
"If settings returns several candidate models, ask the user which one, then call it again with the exact provider/model-id.",
|
|
280
|
+
"A setting settings refuses is the user's to change: tell them why it matters and that /settings changes it - never edit the config files to get round it.",
|
|
281
|
+
],
|
|
282
|
+
parameters: Type.Object({
|
|
283
|
+
key: Type.Optional(Type.String({ description: "The setting as the config file writes it - coding-model, models.coding, review, unittests-script. Omitted: every setting" })),
|
|
284
|
+
value: Type.Optional(Type.String({
|
|
285
|
+
description: "What to set it to: true or false, a number, one of its words, a path from the project root, a model as " +
|
|
286
|
+
"provider/model-id - :thinking after it - or its name as the user said it, a list separated by commas; " +
|
|
287
|
+
"unset to take it out. Omitted: what it is now",
|
|
288
|
+
})),
|
|
289
|
+
module: Type.Optional(Type.String({
|
|
290
|
+
description: `The module - its .plain file, e.g. backend.plain - whose own config.turri.<module>.yaml to write. Omitted: ${CONFIG_FILE}, the whole project's`,
|
|
291
|
+
})),
|
|
292
|
+
}),
|
|
293
|
+
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
294
|
+
const reply = (text) => ({ content: [{ type: "text", text }], details: {} });
|
|
295
|
+
const module = params.module !== undefined && params.module.trim() !== "" ? basename(params.module.trim(), ".plain") : undefined;
|
|
296
|
+
if (params.key === undefined || params.key.trim() === "")
|
|
297
|
+
return reply(describeSettings(cwd, options.rules));
|
|
298
|
+
const setting = settingOf(params.key, options.rules());
|
|
299
|
+
if (setting === undefined) {
|
|
300
|
+
const key = params.key.trim().toLowerCase();
|
|
301
|
+
const near = settings(options.rules()).filter((entry) => entry.key.includes(key)).map((entry) => entry.key);
|
|
302
|
+
throw new Error(`No setting ${params.key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " Call settings with no key for every one."}`);
|
|
303
|
+
}
|
|
304
|
+
if (params.value === undefined)
|
|
305
|
+
return reply(describeSetting(cwd, setting));
|
|
306
|
+
if (setting.personOnly === true) {
|
|
307
|
+
throw new Error(`${setting.key} is the user's to change, not yours: ${setting.about}. Nothing was written. Tell them what it would change, ` +
|
|
308
|
+
`and that /settings ${setting.key} changes it.`);
|
|
309
|
+
}
|
|
310
|
+
if (module !== undefined && setting.projectOnly === true)
|
|
311
|
+
throw new Error(`${setting.key} is the whole project's: it is set in ${CONFIG_FILE} alone, never in a module's file. Nothing was written.`);
|
|
312
|
+
const value = writtenValue(setting, params.value, cwd, ctx);
|
|
313
|
+
return reply(await change(setting, value, ctx, module));
|
|
314
|
+
},
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
/** What a setting is set to, read from what the chat gave: a model's name resolved, a path kept inside the project - or why not. */
|
|
318
|
+
function writtenValue(setting, given, cwd, ctx) {
|
|
319
|
+
let typed = given.trim();
|
|
320
|
+
if (setting.kind === "model" && !/^(unset|default|none|-)$/i.test(typed)) {
|
|
321
|
+
const colon = typed.lastIndexOf(":");
|
|
322
|
+
const level = colon !== -1 && THINKING_LEVELS.includes(typed.slice(colon + 1)) ? typed.slice(colon + 1) : undefined;
|
|
323
|
+
const name = level !== undefined ? typed.slice(0, colon) : typed;
|
|
324
|
+
const resolved = resolveModel(name, ctx.modelRegistry);
|
|
325
|
+
if (!resolved.ok)
|
|
326
|
+
throw new Error(`Nothing was written.\n${describeResolution(resolved)}`);
|
|
327
|
+
typed = `${resolved.model}${level !== undefined ? `:${level}` : ""}`;
|
|
328
|
+
}
|
|
329
|
+
if (setting.kind === "path" && !/^(unset|default|none|-)$/i.test(typed)) {
|
|
330
|
+
const inside = relative(cwd, resolve(cwd, typed));
|
|
331
|
+
if (inside.startsWith("..") || isAbsolute(inside))
|
|
332
|
+
throw new Error(`${setting.key} takes a path inside the project, from its root - ${typed} is outside it. Nothing was written.`);
|
|
333
|
+
}
|
|
334
|
+
const parsed = parseValue(setting, typed);
|
|
335
|
+
if ("error" in parsed)
|
|
336
|
+
throw new Error(`${parsed.error} Nothing was written.`);
|
|
337
|
+
return "unset" in parsed ? undefined : parsed.value;
|
|
338
|
+
}
|
|
339
|
+
/** Every setting, as the chat is told them: what each is in config.turri.yaml, what each module's file sets over it. */
|
|
340
|
+
function describeSettings(cwd, rules) {
|
|
341
|
+
const text = readConfigText(cwd);
|
|
342
|
+
const all = settings(rules());
|
|
343
|
+
const lines = all
|
|
344
|
+
.filter((setting) => !setting.key.startsWith("models.") || currentValue(text, setting.key) !== undefined)
|
|
345
|
+
.map((setting) => `- ${listLine(setting, text)}${setting.personOnly === true ? " - the user's to change" : ""}`);
|
|
346
|
+
const modules = moduleConfigsOf(cwd).map((module) => {
|
|
347
|
+
const own = readModuleConfigText(cwd, module);
|
|
348
|
+
const set = all.filter((setting) => currentValue(own, setting.key) !== undefined).map((setting) => `${setting.key}: ${shownValue(currentValue(own, setting.key))}`);
|
|
349
|
+
return `${moduleConfigFile(module)}, over it for ${module}.plain and the modules built on it: ${set.length > 0 ? set.join(", ") : "nothing"}`;
|
|
350
|
+
});
|
|
351
|
+
return [`${CONFIG_FILE}:`, ...lines, ...(modules.length > 0 ? ["", ...modules] : []), "", "models.<role> not listed are unset: each role takes default's, then coding-model's."].join("\n");
|
|
352
|
+
}
|
|
353
|
+
/** One setting, as the chat is told it: what it does, what it takes, what it is in each file. */
|
|
354
|
+
function describeSetting(cwd, setting) {
|
|
355
|
+
const now = currentValue(readConfigText(cwd), setting.key);
|
|
356
|
+
const takes = setting.kind === "boolean"
|
|
357
|
+
? "true or false"
|
|
358
|
+
: setting.kind === "model"
|
|
359
|
+
? "a model, provider/model-id[:thinking]"
|
|
360
|
+
: setting.kind === "path"
|
|
361
|
+
? "a path from the project root"
|
|
362
|
+
: setting.kind === "list"
|
|
363
|
+
? `a list${setting.options !== undefined ? ` of ${setting.options.join(", ")}` : ""}`
|
|
364
|
+
: setting.options !== undefined
|
|
365
|
+
? `${setting.kind === "number" ? "a number - e.g. " : "one of "}${setting.options.join(", ")}`
|
|
366
|
+
: `a ${setting.kind}`;
|
|
367
|
+
const modules = setting.projectOnly === true ? [] : moduleConfigsOf(cwd).flatMap((module) => {
|
|
368
|
+
const own = currentValue(readModuleConfigText(cwd, module), setting.key);
|
|
369
|
+
return own !== undefined ? [`${moduleConfigFile(module)}: ${shownValue(own)}`] : [];
|
|
370
|
+
});
|
|
371
|
+
return [
|
|
372
|
+
`${setting.key} - ${setting.about}.`,
|
|
373
|
+
`Takes ${takes}; unset: ${setting.unset}.`,
|
|
374
|
+
`${CONFIG_FILE}: ${now === undefined ? "unset" : shownValue(now)}${modules.length > 0 ? `; ${modules.join("; ")}` : ""}.`,
|
|
375
|
+
...(setting.personOnly === true ? ["The user's to change, with /settings - not yours."] : []),
|
|
376
|
+
...(setting.projectOnly === true ? [`The whole project's: set in ${CONFIG_FILE} alone.`] : []),
|
|
377
|
+
].join("\n");
|
|
247
378
|
}
|
package/dist/setup.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function checkProject(project: string, machine?: {
|
|
|
38
38
|
jdk?: () => boolean | Promise<boolean>;
|
|
39
39
|
}): Promise<Check[]>;
|
|
40
40
|
/**
|
|
41
|
-
* In a project: each model its config names -
|
|
41
|
+
* In a project: each model its config.turri.yaml names - or the module config pinned, its file's over it - tried with one short
|
|
42
42
|
* request. A model that answers is ready; one that does not says what the provider said, and what to do about it.
|
|
43
43
|
*/
|
|
44
44
|
export declare function checkProjectModels(project: string, access?: ModelAccess): Promise<Check[]>;
|
|
@@ -77,7 +77,7 @@ export interface ClaudeCodeProbe {
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function checkClaudeSubscription(project: string, env?: NodeJS.ProcessEnv, probe?: ClaudeCodeProbe): Promise<Check[]>;
|
|
79
79
|
/**
|
|
80
|
-
* The base folders the project's config names - its own, and each
|
|
80
|
+
* The base folders the project's config names - its own, and each module's own file's - each there with its files, or not: a codebase
|
|
81
81
|
* that requires nothing starts from one, and its first pulse stops when it is not there. Nothing when none is named.
|
|
82
82
|
*/
|
|
83
83
|
export declare function checkBaseFolders(project: string): Promise<Check[]>;
|