@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
package/README.md
CHANGED
|
@@ -121,11 +121,11 @@ That is what regenerative software asks of software, and what **turri** does:
|
|
|
121
121
|
| Every cell can become another, and it is still the same jellyfish. | Every line of code can be replaced, and it is still the same software - because what it is never lived in the code. |
|
|
122
122
|
| It can do it again and again, for as long as it lives. | The code can be regenerated whenever \*\*\*plain changes or a model gets better, for as long as \*\*\*plain is kept. |
|
|
123
123
|
|
|
124
|
-
So the tools speak its language: **`regenerate`** regenerates the code from \*\*\*plain as it is now - or the functionalities you name, though nothing changed, or all of it from scratch - **`drift`** says how far the code has moved from it, and
|
|
124
|
+
So the tools speak its language: **`regenerate`** regenerates the code from \*\*\*plain as it is now - or the functionalities you name, though nothing changed, or all of it from scratch - **`drift`** says how far the code has moved from it, and **`/lineage`** shows every generation of a module and what each was regenerated from.
|
|
125
125
|
|
|
126
126
|
## Models
|
|
127
127
|
|
|
128
|
-
`init-config`'s models are only a starting point. **turri** is built on [pi](https://pi.dev), so any model [pi](https://pi.dev) supports works - Anthropic, OpenAI, Google, Amazon Bedrock, OpenRouter, a local one. A model is reached as [pi](https://pi.dev) reaches it - `/login`, in `turri` as in `pi`, the provider's API key in the environment (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...), or a cloud account - and named as [pi](https://pi.dev) names it, `provider/model-id`, with `:high`, `:low` and so on for how hard it thinks. It uses three: the **harness** model you talk to, which writes \*\*\*plain and plans the work - worth a capable one - and the **coding** and **judge** models its agents build and judge with, which can be smaller and cheaper, such as GPT-6 Luna or Gemini 3.1 Flash Lite. `turri --harness-model` and `--coding-model` choose them for a session, and [pi](https://pi.dev)'s `/model` switches the one you talk to as you go; to keep them for the project, set them with `/
|
|
128
|
+
`init-config`'s models are only a starting point. **turri** is built on [pi](https://pi.dev), so any model [pi](https://pi.dev) supports works - Anthropic, OpenAI, Google, Amazon Bedrock, OpenRouter, a local one. A model is reached as [pi](https://pi.dev) reaches it - `/login`, in `turri` as in `pi`, the provider's API key in the environment (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...), or a cloud account - and named as [pi](https://pi.dev) names it, `provider/model-id`, with `:high`, `:low` and so on for how hard it thinks. It uses three: the **harness** model you talk to, which writes \*\*\*plain and plans the work - worth a capable one - and the **coding** and **judge** models its agents build and judge with, which can be smaller and cheaper, such as GPT-6 Luna or Gemini 3.1 Flash Lite. `turri --harness-model` and `--coding-model` choose them for a session, and [pi](https://pi.dev)'s `/model` switches the one you talk to as you go; to keep them for the project, set them with `/settings harness-model`, `/settings coding-model` and so on - each role's too, as `models.<role>` - or write them in its `config.turri.yaml`:
|
|
129
129
|
|
|
130
130
|
```yaml
|
|
131
131
|
harness-model: anthropic/claude-opus-5-5 # the model you talk to: a capable one
|
|
@@ -148,16 +148,15 @@ Then say what you want:
|
|
|
148
148
|
|
|
149
149
|
> A small API where people can register and sign in, in Python.
|
|
150
150
|
|
|
151
|
-
In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or
|
|
151
|
+
In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or - conformance tests on - it judges a functional spec needs them), regenerates the smallest thing that runs at once, then the main thing you described, and says what it chose and what it would write next. Every change after is yours to ask for: **turri** writes it as \*\*\*plain and regenerates it. While it works:
|
|
152
152
|
|
|
153
153
|
- the **panel** above the input shows every build - its stage, what its agents are doing, its model and cost - and the queue behind it;
|
|
154
154
|
- ask to try it at any time - "let me try it" - and **`release`** puts what is built so far in `dist/<module>` and **`activate`** starts it, installing what it needs - nothing to approve;
|
|
155
155
|
- the **side panel** (`ctrl+h`) takes the screen and opens on **regen** - \*\*\*plain, every item marked planned, working, regenerated, validating, conform or needs you - and `p` turns it to the **pulses** (`/pulses`) - every pulse, running, queued and finished, and what each regenerates; what its agents did is in each pulse's log in `.turri/jobs/`, kept with `--debug` (`debug: true`);
|
|
156
156
|
- **`/halt`** halts a pulse, **`/lineage`** shows every generation of a module, and the **`drift`** tool says what is left to regenerate;
|
|
157
157
|
- **`/btw <question>`** asks turri something on the side - answered at once, even while a question waits for you (typed as the answer, under "Something else…"), and left out of the conversation;
|
|
158
|
-
- **`/
|
|
158
|
+
- **`/settings`** changes any setting of the project's `config.turri.yaml` - the models, review, how many pulses at once - and says when it takes effect: now, at your next message, or at the next pulse. No restart: `/settings review false`, or `/settings` alone to pick from the list - [pi](https://pi.dev)'s own settings the last entry. Or just ask: "regenerate with gpt 5.5 from now on";
|
|
159
159
|
- **`/sentinel`** says whether the sentinel checks every pulse that finishes: `ask` (you are asked before it first opens), `on` or `off`;
|
|
160
|
-
- **`/stack`** chooses the stack to build with, in a project whose backend and frontend each have their own testing scripts in `config.turri.<stack>.yaml` - `/stack backend`, `/stack none` - for the session (`--stack <name>` on the command line). The chat's model builds each part with its own stack by itself, pinned to that module's pulses.
|
|
161
160
|
|
|
162
161
|
Other things to ask for:
|
|
163
162
|
|
|
@@ -189,7 +188,7 @@ Start at the [documentation index](docs/README.md), or go straight to a page:
|
|
|
189
188
|
| [Installation](docs/installation.md) | doctor, what turri needs of this machine, **turri** and `pi`, environment variables |
|
|
190
189
|
| [Examples](examples/README.md) | projects to build with turri step by step: guestbook - a backend and a frontend in minutes - a CLI, and a backend service tested where it matters |
|
|
191
190
|
| [Using **turri**](docs/using.md) | the conversation, skills, tools, pulses and regen, choosing models, the command line |
|
|
192
|
-
| [The project config](docs/config.md) | `config.turri.yaml` and
|
|
191
|
+
| [The project config](docs/config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
193
192
|
| [Deploy](docs/deploy.md) | trying what is built: the last commit in `dist/<module>`, started on your machine, nothing installed without asking |
|
|
194
193
|
| [Running unattended](docs/headless.md) | regenerating \*\*\*plain overnight or in CI: the command, keeping it running, the results, resuming, rebuilding one functionality |
|
|
195
194
|
| [Authoring \*\*\*plain](docs/authoring-plain.md) | what \*\*\*plain is made of, the authoring rules, the skills that write and fix it, checking it |
|
package/dist/bedrock-region.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { readProjectConfig,
|
|
4
|
+
import { readProjectConfig, moduleConfigsOf } from "./config.js";
|
|
5
5
|
import { bedrockAwsRegion, bedrockNeedsAwsRegion, bedrockPlaceOf } from "./init-config.js";
|
|
6
6
|
import { modelsInUse } from "./model-check.js";
|
|
7
7
|
/** The variable turri marks its own AWS_REGION with, so the pi it starts - and a reload - tells it from the person's. */
|
|
@@ -52,9 +52,9 @@ export function profileRegion(profile, env = process.env) {
|
|
|
52
52
|
}
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
|
-
/** The Bedrock models a project uses: every model its config names - each
|
|
55
|
+
/** The Bedrock models a project uses: every model its config names - each module's own file's too - and those given. */
|
|
56
56
|
function bedrockModels(projectDir, also) {
|
|
57
|
-
const configs = [readProjectConfig(projectDir), ...
|
|
57
|
+
const configs = [readProjectConfig(projectDir), ...moduleConfigsOf(projectDir).map((module) => readProjectConfig(projectDir, module))];
|
|
58
58
|
const specs = [...configs.flatMap((config) => modelsInUse(config).map((used) => used.spec)), ...also];
|
|
59
59
|
return [...new Set(specs.filter((spec) => spec.startsWith("amazon-bedrock/")))];
|
|
60
60
|
}
|
package/dist/chat-idle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { ChatLink } from "./chats.ts";
|
|
3
3
|
/**
|
|
4
|
-
* Whether a chat is busy, for what turri tells it of its own accord - a
|
|
5
|
-
*
|
|
4
|
+
* Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
|
|
5
|
+
* agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
|
|
6
6
|
*/
|
|
7
7
|
export declare function chatBusy(link: ChatLink, context: () => ExtensionContext | undefined): boolean;
|
package/dist/chat-idle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Whether a chat is busy, for what turri tells it of its own accord - a
|
|
3
|
-
*
|
|
2
|
+
* Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
|
|
3
|
+
* agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
|
|
4
4
|
*/
|
|
5
5
|
export function chatBusy(link, context) {
|
|
6
6
|
const session = link.session();
|
package/dist/chat-models.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type ProjectConfig } from "./config.ts";
|
|
|
6
6
|
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
7
7
|
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
8
8
|
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
9
|
-
* changed in the conversation: pi's /model,
|
|
9
|
+
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
10
10
|
*/
|
|
11
11
|
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
12
12
|
export declare const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-models.js
CHANGED
|
@@ -6,7 +6,7 @@ import { modelSpec, projectModels } from "./config.js";
|
|
|
6
6
|
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
7
7
|
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
8
8
|
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
9
|
-
* changed in the conversation: pi's /model,
|
|
9
|
+
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
10
10
|
*/
|
|
11
11
|
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
12
12
|
export const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-scope.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The chat a piece of work runs for: its tools, its commands, its event handlers - and what they start, a pulse
|
|
3
3
|
* queued from them among it. A turri session holds several chats (chats.ts); what each keeps for itself rides along
|
|
4
|
-
* with its work here: its id, which pulses and the ledger's events carry
|
|
4
|
+
* with its work here: its id, which pulses and the ledger's events carry.
|
|
5
5
|
*/
|
|
6
6
|
export interface ChatScope {
|
|
7
7
|
id: string;
|
|
8
|
-
/** The stack this chat chose with /stack or the stack tool - none: the project's config alone. */
|
|
9
|
-
stack: string | undefined;
|
|
10
8
|
/** The questions it asks now, each with what declines it: a host declines them with `Turri.decline`. */
|
|
11
9
|
readonly asking: Set<() => void>;
|
|
12
10
|
}
|
package/dist/chats.d.ts
CHANGED
|
@@ -6,13 +6,12 @@ import { type SentinelSetting } from "./config.ts";
|
|
|
6
6
|
import type { AskUserIO } from "./ask.ts";
|
|
7
7
|
import type { Job, JobRegistry } from "./regenerate/jobs.ts";
|
|
8
8
|
import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
9
|
-
import type { AdvisorVerdict } from "./regenerate/advisor-runs.ts";
|
|
10
9
|
import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type NoticeInput, type SentinelCheck } from "./notice.ts";
|
|
11
10
|
/**
|
|
12
11
|
* The chats of a turri session.
|
|
13
12
|
*
|
|
14
13
|
* One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
|
|
15
|
-
* history, model, thinking level
|
|
14
|
+
* history, model, thinking level and questions, each working while another is shown. What they share is the
|
|
16
15
|
* session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
|
|
17
16
|
* chat's side panel - the coding model, steering, releases and the ledger.
|
|
18
17
|
*
|
|
@@ -126,19 +125,12 @@ export interface ChatInstance {
|
|
|
126
125
|
concluded(conclusion: Conclusion): void;
|
|
127
126
|
/** The person answered a notice with something to do: the chat's agent started on it. */
|
|
128
127
|
act(task: string): void;
|
|
129
|
-
/**
|
|
130
|
-
* The test advisor's verdict: once the chat is idle - its agent done, nothing typed - a yes starts a turn that writes its
|
|
131
|
-
* scenarios, and a no is a line. Those that arrive meanwhile are delivered together.
|
|
132
|
-
*/
|
|
133
|
-
advised(verdict: AdvisorVerdict): void;
|
|
134
128
|
/** The jobs changed: what it draws of them is drawn again. */
|
|
135
129
|
jobsChanged(): void;
|
|
136
130
|
/** How hard the chat's model thinks now: sub-agents started from it think as hard. */
|
|
137
131
|
thinkingLevel(): string | undefined;
|
|
138
132
|
/** The chat's context, as its tools get it - for its model and its providers. */
|
|
139
133
|
context(): ExtensionContext | undefined;
|
|
140
|
-
/** Conformance tests turned on or off: the chat's tools switched to match - conform and evaluate_tests, or the tool that turns them on. */
|
|
141
|
-
conformanceSwitched?(): void;
|
|
142
134
|
}
|
|
143
135
|
/** A chat's extension, linked to its chat. */
|
|
144
136
|
export interface ChatLink {
|
|
@@ -248,8 +240,6 @@ export interface TurriCore {
|
|
|
248
240
|
} | {
|
|
249
241
|
refused: string;
|
|
250
242
|
};
|
|
251
|
-
/** The test advisor's verdict, for the chat the person looks at - held until there is one. Undefined: no chat to hand it to yet. */
|
|
252
|
-
advised(verdict: AdvisorVerdict): string | undefined;
|
|
253
243
|
/** The notices put to the person and not yet answered. */
|
|
254
244
|
notices(): Notice[];
|
|
255
245
|
/**
|
|
@@ -305,7 +295,7 @@ export declare function interruptChat<R>(session: Stoppable, asked: {
|
|
|
305
295
|
export declare function createChats(options: CoreOptions): TurriCore;
|
|
306
296
|
/**
|
|
307
297
|
* pi's extension API for a chat: every tool, command, shortcut and handler the extension registers runs inside the
|
|
308
|
-
* chat's scope - its
|
|
298
|
+
* chat's scope - its id on what it starts.
|
|
309
299
|
*/
|
|
310
300
|
export declare function scopedToChat(pi: ExtensionAPI, scope: ChatScope): ExtensionAPI;
|
|
311
301
|
/** A chat's stand-in for the screen, for the terminal's driver. */
|
package/dist/chats.js
CHANGED
|
@@ -10,7 +10,7 @@ import { newNotice, noticeTask, SENTINEL, sentinelStartChoice, wentWrong } from
|
|
|
10
10
|
* The chats of a turri session.
|
|
11
11
|
*
|
|
12
12
|
* One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
|
|
13
|
-
* history, model, thinking level
|
|
13
|
+
* history, model, thinking level and questions, each working while another is shown. What they share is the
|
|
14
14
|
* session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
|
|
15
15
|
* chat's side panel - the coding model, steering, releases and the ledger.
|
|
16
16
|
*
|
|
@@ -106,8 +106,6 @@ export function createChats(options) {
|
|
|
106
106
|
let consent = "unasked";
|
|
107
107
|
let asking;
|
|
108
108
|
const held = [];
|
|
109
|
-
/** The test advisor's verdicts that came with no chat of the person's to hand them to: handed on as one comes up. */
|
|
110
|
-
const unplaced = [];
|
|
111
109
|
const run = { run: randomUUID().slice(0, 8), pid: process.pid, started: new Date().toISOString(), chats: [] };
|
|
112
110
|
const changed = () => {
|
|
113
111
|
for (const listener of listeners) {
|
|
@@ -160,7 +158,7 @@ export function createChats(options) {
|
|
|
160
158
|
const id = randomUUID().slice(0, 8);
|
|
161
159
|
const chat = {
|
|
162
160
|
id,
|
|
163
|
-
scope: { id,
|
|
161
|
+
scope: { id, asking: new Set() },
|
|
164
162
|
...(title !== undefined ? { recordedTitle: title } : {}),
|
|
165
163
|
...(role !== undefined ? { role } : {}),
|
|
166
164
|
working: false,
|
|
@@ -364,10 +362,6 @@ export function createChats(options) {
|
|
|
364
362
|
session: () => chat.session,
|
|
365
363
|
live: (instance) => {
|
|
366
364
|
chat.instance = instance;
|
|
367
|
-
// The advisor's verdicts that waited for a chat of the person's.
|
|
368
|
-
if (unplaced.length > 0 && personFacing() !== undefined)
|
|
369
|
-
for (const verdict of unplaced.splice(0))
|
|
370
|
-
core.advised(verdict);
|
|
371
365
|
},
|
|
372
366
|
};
|
|
373
367
|
},
|
|
@@ -496,23 +490,6 @@ export function createChats(options) {
|
|
|
496
490
|
changed();
|
|
497
491
|
return target.id;
|
|
498
492
|
},
|
|
499
|
-
advised(verdict) {
|
|
500
|
-
const target = personFacing();
|
|
501
|
-
if (target?.instance === undefined) {
|
|
502
|
-
unplaced.push(verdict);
|
|
503
|
-
return undefined;
|
|
504
|
-
}
|
|
505
|
-
if (target.id !== shownId)
|
|
506
|
-
target.unread = true;
|
|
507
|
-
try {
|
|
508
|
-
target.instance.advised(verdict);
|
|
509
|
-
}
|
|
510
|
-
catch {
|
|
511
|
-
/* a chat let go as it was told: a yes stays undelivered in the advisor's file, for the next start */
|
|
512
|
-
}
|
|
513
|
-
changed();
|
|
514
|
-
return target.id;
|
|
515
|
-
},
|
|
516
493
|
answer(id, answer) {
|
|
517
494
|
const notice = open.find((candidate) => candidate.id === id);
|
|
518
495
|
if (notice === undefined)
|
|
@@ -903,7 +880,7 @@ export function createChats(options) {
|
|
|
903
880
|
}
|
|
904
881
|
/**
|
|
905
882
|
* pi's extension API for a chat: every tool, command, shortcut and handler the extension registers runs inside the
|
|
906
|
-
* chat's scope - its
|
|
883
|
+
* chat's scope - its id on what it starts.
|
|
907
884
|
*/
|
|
908
885
|
export function scopedToChat(pi, scope) {
|
|
909
886
|
const within = (work) => work === undefined ? undefined : (...args) => inChat(scope, () => work(...args));
|
package/dist/cli.js
CHANGED
|
@@ -73,13 +73,10 @@ function chat(args) {
|
|
|
73
73
|
}
|
|
74
74
|
const COMMANDS = {
|
|
75
75
|
regenerate: { module: "./regenerate-cli.ts", blurb: "regenerate a module and its chain from the spec as it is (with module:func-ids: regenerate those again)" },
|
|
76
|
-
glimpse: { module: "./regenerate-cli.ts", blurb: "plan the work and print the first job's prompt, starting nothing", args: ["--dry-run"] },
|
|
77
76
|
drift: { module: "./drift-cli.ts", blurb: "what is left to regenerate: how far the code has drifted from its spec" },
|
|
78
77
|
conform: { module: "./conform-cli.ts", blurb: "write and run a module's conformance tests" },
|
|
79
|
-
"change-plain": { module: "./change-plain-cli.ts", blurb: "apply a change to ***plain, given as a git diff, and regenerate it" },
|
|
80
78
|
parse: { module: "./parse-cli.ts", blurb: "parse ***plain - its syntax and structure, never its code or tests - regenerating nothing" },
|
|
81
79
|
lineage: { module: "./lineage-cli.ts", blurb: "a module's lineage: what was regenerated into it, and when" },
|
|
82
|
-
ledger: { module: "./ledger-cli.ts", blurb: "what turri did here: the last runs and their pulses, or one pulse, from the ledger" },
|
|
83
80
|
release: { module: "./release-cli.ts", blurb: "release what is regenerated to dist/<module> and activate it on this machine" },
|
|
84
81
|
cultivate: { module: "./cultivate-cli.ts", blurb: "run a gated skill" },
|
|
85
82
|
};
|
|
@@ -112,8 +109,7 @@ const USAGE = [
|
|
|
112
109
|
" turri <command> [args]",
|
|
113
110
|
" turri --version turri's version, and pi's",
|
|
114
111
|
"",
|
|
115
|
-
` ${"options".padEnd(12)} --harness-model <m> the model you chat with --coding-model <m> the model
|
|
116
|
-
` ${"".padEnd(12)} --stack <name> build with config.turri.<name>.yaml over config.turri.yaml - here and in every command`,
|
|
112
|
+
` ${"options".padEnd(12)} --harness-model <m> the model you chat with --coding-model <m> the model that writes the code`,
|
|
117
113
|
` ${"".padEnd(12)} --debug keep what turri writes for debugging it - agents' logs and sessions - as debug: true does`,
|
|
118
114
|
` ${"".padEnd(12)} --use-theme <t> another theme than turri-dark - and every option of pi's own`,
|
|
119
115
|
"",
|
|
@@ -128,37 +124,22 @@ const USAGE = [
|
|
|
128
124
|
"specification, so that linked resources inside it resolve the way the parser expects.",
|
|
129
125
|
].join("\n");
|
|
130
126
|
dropNoise();
|
|
131
|
-
// --
|
|
132
|
-
//
|
|
133
|
-
const argv =
|
|
127
|
+
// --debug, for any command and for the conversation: TURRI_DEBUG for this run, and the pi it starts - taken out before
|
|
128
|
+
// the rest is read, so a command never sees it.
|
|
129
|
+
const argv = withoutDebug(process.argv.slice(2));
|
|
134
130
|
const [command, ...rest] = argv;
|
|
135
|
-
|
|
131
|
+
function withoutDebug(args) {
|
|
136
132
|
const kept = [];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const arg = args[at];
|
|
140
|
-
if (arg === "--stack")
|
|
141
|
-
stack = args[++at] ?? "";
|
|
142
|
-
else if (arg.startsWith("--stack="))
|
|
143
|
-
stack = arg.slice("--stack=".length);
|
|
144
|
-
else if (arg === "--debug")
|
|
133
|
+
for (const arg of args) {
|
|
134
|
+
if (arg === "--debug")
|
|
145
135
|
process.env.TURRI_DEBUG = "1";
|
|
146
136
|
else
|
|
147
137
|
kept.push(arg);
|
|
148
138
|
}
|
|
149
|
-
if (stack === undefined)
|
|
150
|
-
return kept;
|
|
151
|
-
const { switchStack } = await import("./stacks.js");
|
|
152
|
-
try {
|
|
153
|
-
switchStack(process.cwd(), stack);
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
157
|
-
process.exit(1);
|
|
158
|
-
}
|
|
159
139
|
return kept;
|
|
160
140
|
}
|
|
161
|
-
|
|
141
|
+
// `turri help` too: the word people type first, which would otherwise be an unknown command.
|
|
142
|
+
if (command === "-h" || command === "--help" || command === "help") {
|
|
162
143
|
console.log(USAGE);
|
|
163
144
|
process.exit(0);
|
|
164
145
|
}
|
|
@@ -172,7 +153,7 @@ if (command === "-v" || command === "--version") {
|
|
|
172
153
|
// The AWS region the project's Bedrock models need, set before any model is called - here, and in the pi the chat starts,
|
|
173
154
|
// which inherits it - unless the person set one (bedrock-region.ts). The models named on the command line count too. A
|
|
174
155
|
// command that calls no model is left alone.
|
|
175
|
-
if (!["parse", "drift", "lineage", "
|
|
156
|
+
if (!["parse", "drift", "lineage", "init-config", ...Object.keys(PACKAGE_COMMANDS)].includes(command ?? "")) {
|
|
176
157
|
const { applyBedrockRegion } = await import("./bedrock-region.js");
|
|
177
158
|
const named = argv.flatMap((arg, at) => ["--harness-model", "--coding-model", "--model"].includes(arg) ? [argv[at + 1] ?? ""] : arg.startsWith("--harness-model=") || arg.startsWith("--coding-model=") || arg.startsWith("--model=") ? [arg.slice(arg.indexOf("=") + 1)] : []);
|
|
178
159
|
applyBedrockRegion(process.cwd(), { also: named.filter((model) => model !== "") });
|
|
@@ -215,7 +196,7 @@ process.argv = [
|
|
|
215
196
|
// A headless run is stopped by a signal - SIGTERM, SIGHUP, Ctrl-C - whatever else listens for it: it exits, and what
|
|
216
197
|
// its agents left running goes with it (shell.ts kills every process group on exit). Left to the libraries' own
|
|
217
198
|
// handlers, one ran on for minutes after it was told to stop, building in the same codebase as the run after it.
|
|
218
|
-
if (!["parse", "drift", "lineage"
|
|
199
|
+
if (!["parse", "drift", "lineage"].includes(command)) {
|
|
219
200
|
for (const [signal, code] of [["SIGTERM", 143], ["SIGHUP", 129], ["SIGINT", 130]]) {
|
|
220
201
|
process.on(signal, () => {
|
|
221
202
|
console.error(`\nstopped (${signal})`);
|
package/dist/config-edit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/
|
|
2
|
+
* `/settings`' and the chat's settings tool's side of config.turri.yaml: every setting turri reads, what it takes - a yes or no, one of a few words, a
|
|
3
3
|
* number, a model, a list - and when a change to it takes effect, so the person knows whether to wait for the next
|
|
4
4
|
* pulse or not at all. A change is written into the file line by line, its comments and the commented-out examples
|
|
5
5
|
* kept; `models:` and `agent-env:`, which nest, are written again whole, their own comments lost.
|
|
@@ -20,14 +20,20 @@ export interface Setting {
|
|
|
20
20
|
options?: string[];
|
|
21
21
|
/** The least a number may be. */
|
|
22
22
|
min?: number;
|
|
23
|
-
/** Set in the project's config.turri.yaml only: a
|
|
23
|
+
/** Set in the project's config.turri.yaml only: a module's config.turri.<module>.yaml does not change it. */
|
|
24
24
|
projectOnly?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Changed by the person alone, with /settings: the chat's settings tool refuses it. What it decides is theirs - turning
|
|
27
|
+
* conformance tests on doubles each change - or it widens what the agents reach (credentials, folders past the
|
|
28
|
+
* sandbox), or it is a check on the chat's own work (the sentinel, the ***plain rules, the ledger).
|
|
29
|
+
*/
|
|
30
|
+
personOnly?: boolean;
|
|
25
31
|
}
|
|
26
32
|
/** What each effect is, said to the person. */
|
|
27
33
|
export declare const EFFECT_TEXT: Record<Effect, string>;
|
|
28
34
|
/** Every setting, in the order the list shows them. */
|
|
29
35
|
export declare function settings(rules?: string[]): Setting[];
|
|
30
|
-
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /
|
|
36
|
+
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /settings offers them. */
|
|
31
37
|
export declare function configSettings(): Setting[];
|
|
32
38
|
/** A setting by its key - `review`, `models.coding` - or nothing. */
|
|
33
39
|
export declare function settingOf(key: string, rules?: string[]): Setting | undefined;
|
|
@@ -58,13 +64,19 @@ export declare function currentValue(text: string, key: string): unknown;
|
|
|
58
64
|
export declare function shownValue(value: unknown): string;
|
|
59
65
|
/** The project's config.turri.yaml - or the config.yaml it is read from until it has one - its text, empty when there is neither. */
|
|
60
66
|
export declare function readConfigText(dir: string): string;
|
|
61
|
-
/** What a change does beside setting the value: the files and settings that win over it, said to the person. */
|
|
62
|
-
export declare function overriddenBy(dir: string, text: string, setting: Setting): string[];
|
|
63
67
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
68
|
+
* What a change does beside setting the value: the files and settings that win over it, said to the person. `module`:
|
|
69
|
+
* written into that module's own file - the project's file is the one it wins over, and nothing over it is said.
|
|
66
70
|
*/
|
|
67
|
-
export declare function
|
|
71
|
+
export declare function overriddenBy(dir: string, text: string, setting: Setting, module?: string): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Write a setting into the project's config.turri.yaml - or, with `module`, that module's config.turri.<module>.yaml -
|
|
74
|
+
* made when it is not there, from config.yaml and each module's file in the old naming when they are what the project
|
|
75
|
+
* is read from - and give back the file as written.
|
|
76
|
+
*/
|
|
77
|
+
export declare function writeSetting(dir: string, key: string, value: unknown, module?: string): string;
|
|
78
|
+
/** A module's own config.turri.<module>.yaml - or the config.<module>.yaml it is read from until the project has turri's files - its text, empty when there is none. */
|
|
79
|
+
export declare function readModuleConfigText(dir: string, module: string): string;
|
|
68
80
|
/** The files a path setting is offered: the testing scripts in the root and test_scripts/, the .plain files of the folder, or - the test folder - its folders. */
|
|
69
81
|
export declare function pathOptions(dir: string, key: string): string[];
|
|
70
82
|
/** The dotenv files of the project root, for agent-env.files. */
|
package/dist/config-edit.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { dump as dumpYaml, load as loadYaml } from "js-yaml";
|
|
4
4
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
5
5
|
import { loadRules } from "./rules.js";
|
|
6
|
-
import { adoptLegacyConfig, AGENT_ROLES, CONFIG_FILE,
|
|
6
|
+
import { adoptLegacyConfig, AGENT_ROLES, CONFIG_FILE, moduleConfigFile, moduleConfigFileIn, moduleConfigsOf, projectConfigFile, splitModelSpec, THINKING_LEVELS } from "./config.js";
|
|
7
7
|
/** What each effect is, said to the person. */
|
|
8
8
|
export const EFFECT_TEXT = {
|
|
9
9
|
now: "in effect now",
|
|
@@ -32,7 +32,6 @@ const ROLE_ABOUT = {
|
|
|
32
32
|
judge: "judges a failing conformance run - as judge-model, which it wins over",
|
|
33
33
|
arbiter: "weighs a second review",
|
|
34
34
|
debugger: "a fresh look at unit tests that keep failing the same way",
|
|
35
|
-
advisor: "the test advisor: whether a new or changed functional spec needs scenarios",
|
|
36
35
|
};
|
|
37
36
|
/** Every setting, in the order the list shows them. */
|
|
38
37
|
export function settings(rules = []) {
|
|
@@ -64,9 +63,8 @@ export function settings(rules = []) {
|
|
|
64
63
|
{ key: "mutation-testing", about: "whether the coding agent and the reviewer can put a bug in the code for one test run (can_it_fail)", kind: "boolean", unset: "true", effect: "next-pulse" },
|
|
65
64
|
{ key: "allow-to-stop-jobs", about: "whether turri stops a running pulse the ***plain has moved on from", kind: "boolean", unset: "true", effect: "now" },
|
|
66
65
|
{ key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
|
|
67
|
-
{ key: "sentinel", about: "whether a chat of its own checks every finished pulse, tests the release, and tells you what is wrong - ask: you are asked before it first opens", kind: "choice", options: ["ask", "true", "false"], unset: "ask", effect: "next-landing" },
|
|
68
|
-
{ key: "
|
|
69
|
-
{ key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, the test advisor and conform off", kind: "boolean", unset: "false", effect: "now" },
|
|
66
|
+
{ key: "sentinel", about: "whether a chat of its own checks every finished pulse, tests the release, and tells you what is wrong - ask: you are asked before it first opens", kind: "choice", options: ["ask", "true", "false"], unset: "ask", effect: "next-landing", personOnly: true },
|
|
67
|
+
{ key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, and the chat's conform refused", kind: "boolean", unset: "false", effect: "now", personOnly: true },
|
|
70
68
|
{ key: "test-dir", about: "the folder of the test plain files, a folder per module in it, by path from the project root", kind: "path", unset: "tests", effect: "now" },
|
|
71
69
|
{ key: "base-folder", about: "a folder a codebase that requires no other module starts from, by path from the project root - code to build on, files to use, copied in once", kind: "path", unset: "none: it starts empty", effect: "next-pulse" },
|
|
72
70
|
{ key: "unittests-script", about: "the unit testing script, by path from the project root", kind: "path", unset: "the one run_unittests*.sh found", effect: "next-test-run" },
|
|
@@ -78,17 +76,17 @@ export function settings(rules = []) {
|
|
|
78
76
|
{ key: "max-lines-per-pulse", about: "the most lines of ***plain in one pulse before a group is split", kind: "number", options: ["60", "120", "200", "300"], min: 1, unset: "120", effect: "next-plan" },
|
|
79
77
|
{ key: "turn-limit", about: "seconds each agent turn has, for every role without its own - 0 for none", kind: "number", options: SECONDS, min: 0, unset: "120", effect: "next-pulse" },
|
|
80
78
|
{ key: "compact-at", about: "tokens of work an agent holds before it is compacted between turns", kind: "number", options: ["50000", "100000", "150000", "200000"], min: 1000, unset: "100000", effect: "next-pulse", projectOnly: true },
|
|
81
|
-
{ key: "rules-off", about: "***plain rules left out of the prompts of the agents that write ***plain", kind: "list", options: rules, unset: "none", effect: "next-message", projectOnly: true },
|
|
82
|
-
{ key: "agent-env.files", about: "dotenv files whose variables the agents' commands get", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
83
|
-
{ key: "agent-env.vars", about: "variables from turri's environment the agents' commands get, by name", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
84
|
-
{ key: "toolchains", about: "folders of this machine an agent's commands may read beside the usual ones", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
79
|
+
{ key: "rules-off", about: "***plain rules left out of the prompts of the agents that write ***plain", kind: "list", options: rules, unset: "none", effect: "next-message", projectOnly: true, personOnly: true },
|
|
80
|
+
{ key: "agent-env.files", about: "dotenv files whose variables the agents' commands get", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
81
|
+
{ key: "agent-env.vars", about: "variables from turri's environment the agents' commands get, by name", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
82
|
+
{ key: "toolchains", about: "folders of this machine an agent's commands may read beside the usual ones", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
85
83
|
{ key: "debug", about: "whether turri keeps what it writes for debugging it - agents' logs and sessions, pulse logs, outputs", kind: "boolean", unset: "false", effect: "next-pulse", projectOnly: true },
|
|
86
84
|
{ key: "cache-keep", about: "megabytes of package caches the project keeps; 0 keeps none", kind: "number", options: ["0", "1024", "4096", "16384"], min: 0, unset: "4096", effect: "next-start", projectOnly: true },
|
|
87
|
-
{ key: "ledger-keep", about: "megabytes of the ledger - what turri did, as facts - the project keeps; 0 keeps none", kind: "number", options: ["0", "50", "100", "500"], min: 0, unset: "100", effect: "next-start", projectOnly: true },
|
|
85
|
+
{ key: "ledger-keep", about: "megabytes of the ledger - what turri did, as facts - the project keeps; 0 keeps none", kind: "number", options: ["0", "50", "100", "500"], min: 0, unset: "100", effect: "next-start", projectOnly: true, personOnly: true },
|
|
88
86
|
...roles,
|
|
89
87
|
];
|
|
90
88
|
}
|
|
91
|
-
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /
|
|
89
|
+
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /settings offers them. */
|
|
92
90
|
export function configSettings() {
|
|
93
91
|
return settings(loadRules(join(PACKAGE_ROOT, "genome", "rules")).map((rule) => rule.name));
|
|
94
92
|
}
|
|
@@ -309,21 +307,24 @@ export function readConfigText(dir) {
|
|
|
309
307
|
const path = join(dir, projectConfigFile(dir));
|
|
310
308
|
return existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
311
309
|
}
|
|
312
|
-
/**
|
|
313
|
-
|
|
310
|
+
/**
|
|
311
|
+
* What a change does beside setting the value: the files and settings that win over it, said to the person. `module`:
|
|
312
|
+
* written into that module's own file - the project's file is the one it wins over, and nothing over it is said.
|
|
313
|
+
*/
|
|
314
|
+
export function overriddenBy(dir, text, setting, module) {
|
|
314
315
|
const notes = [];
|
|
315
316
|
const wins = { "harness-model": "models.chat", "coding-model": "models.coding", "judge-model": "models.judge" };
|
|
316
317
|
const over = wins[setting.key];
|
|
317
318
|
if (over !== undefined && currentValue(text, over) !== undefined)
|
|
318
|
-
notes.push(`${over} is set too, and wins over ${setting.key} - change it with /
|
|
319
|
-
if (setting.projectOnly === true)
|
|
319
|
+
notes.push(`${over} is set too, and wins over ${setting.key} - change it with /settings ${over}.`);
|
|
320
|
+
if (setting.projectOnly === true || module !== undefined)
|
|
320
321
|
return notes;
|
|
321
322
|
const top = setting.key.split(".")[0];
|
|
322
|
-
for (const
|
|
323
|
-
const file =
|
|
323
|
+
for (const each of moduleConfigsOf(dir)) {
|
|
324
|
+
const file = moduleConfigFileIn(dir, each);
|
|
324
325
|
const own = loadMapping(safeRead(join(dir, file)))[top];
|
|
325
326
|
if (own !== undefined)
|
|
326
|
-
notes.push(`${file} sets ${top} too, and wins
|
|
327
|
+
notes.push(`${file} sets ${top} too, and wins for ${each}.plain and the modules built on it.`);
|
|
327
328
|
}
|
|
328
329
|
return notes;
|
|
329
330
|
}
|
|
@@ -336,15 +337,20 @@ function safeRead(path) {
|
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
/**
|
|
339
|
-
* Write a setting into the project's config.turri.yaml -
|
|
340
|
-
* file in the old naming when they are what the project
|
|
340
|
+
* Write a setting into the project's config.turri.yaml - or, with `module`, that module's config.turri.<module>.yaml -
|
|
341
|
+
* made when it is not there, from config.yaml and each module's file in the old naming when they are what the project
|
|
342
|
+
* is read from - and give back the file as written.
|
|
341
343
|
*/
|
|
342
|
-
export function writeSetting(dir, key, value) {
|
|
344
|
+
export function writeSetting(dir, key, value, module) {
|
|
343
345
|
adoptLegacyConfig(dir);
|
|
344
|
-
const text = withSetting(readConfigText(dir), key, value);
|
|
345
|
-
writeFileSync(join(dir, CONFIG_FILE), text);
|
|
346
|
+
const text = withSetting(module !== undefined ? safeRead(join(dir, moduleConfigFile(module))) : readConfigText(dir), key, value);
|
|
347
|
+
writeFileSync(join(dir, module !== undefined ? moduleConfigFile(module) : CONFIG_FILE), text);
|
|
346
348
|
return text;
|
|
347
349
|
}
|
|
350
|
+
/** A module's own config.turri.<module>.yaml - or the config.<module>.yaml it is read from until the project has turri's files - its text, empty when there is none. */
|
|
351
|
+
export function readModuleConfigText(dir, module) {
|
|
352
|
+
return safeRead(join(dir, moduleConfigFileIn(dir, module)));
|
|
353
|
+
}
|
|
348
354
|
/** The files a path setting is offered: the testing scripts in the root and test_scripts/, the .plain files of the folder, or - the test folder - its folders. */
|
|
349
355
|
export function pathOptions(dir, key) {
|
|
350
356
|
const list = (folder, test) => {
|