@turri-dev/cli 0.4.1 → 0.4.2-next.761e1ea
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/dist/chats.d.ts +1 -1
- package/dist/chats.js +1 -1
- package/dist/extension.js +66 -84
- package/dist/identity.js +1 -1
- package/dist/loop-tools.d.ts +2 -3
- package/dist/loop-tools.js +7 -12
- package/dist/regenerate/chunk-plan.d.ts +2 -11
- package/dist/regenerate/chunk-plan.js +9 -20
- package/dist/regenerate/command-check.d.ts +9 -0
- package/dist/regenerate/command-check.js +83 -3
- package/dist/regenerate/loop.d.ts +6 -14
- package/dist/regenerate/loop.js +42 -34
- package/dist/regenerate/test-scripts.d.ts +3 -0
- package/dist/regenerate/test-scripts.js +16 -5
- package/dist/sentinel.js +1 -1
- package/docs/chats.md +0 -1
- package/docs/config.md +2 -0
- package/docs/regenerating.md +8 -7
- package/docs/sandbox.md +2 -0
- package/docs/skills-and-gates.md +1 -1
- package/docs/using.md +2 -3
- package/genome/rules/turri-regeneration.md +1 -1
- package/package.json +1 -1
- package/dist/regenerate/steer.d.ts +0 -34
- package/dist/regenerate/steer.js +0 -91
package/docs/using.md
CHANGED
|
@@ -23,11 +23,10 @@ While a skill runs, a line above the input shows its phases, every one by name -
|
|
|
23
23
|
| --- | --- |
|
|
24
24
|
| `regenerate` | regenerate a module and its chain from \*\*\*plain as it is now - after any change to it, by any means: what is left to regenerate is planned into pulses of one to three functional specs, each with the definitions and reqs it uses, and a pulse regenerating what \*\*\*plain no longer wants is stopped. With functionalities named, those are regenerated though their \*\*\*plain did not change - their code taken out and built anew, planned into pulses as any change is; with `from_scratch`, the whole module, its code deleted first - `"chain"` for every module of its requires chain too, built again from the bottom - only when you ask, or agree |
|
|
25
25
|
| `drift` | what is left to regenerate: how far the code and its conformance tests have drifted from \*\*\*plain, starting nothing |
|
|
26
|
-
| `steer` | say how the work is planned - which functional specs go together, what first - for the project or one module, for the session; the next plan follows it, beside what AGENTS.md says under a heading naming the queue |
|
|
27
26
|
| `conform` | write and run conformance tests for functional specs - now, or ahead of their code: every one tested in one conformance pulse, as far as a size guardrail lets (or one a functional spec, or a pulse each of groups you name - 1-3 and 4-6 - when you ask for that), started once every one named is regenerated. Refused while conformance tests are off: turning them on is yours, with `/conform`, and the chat tells you why it wants them |
|
|
28
27
|
| `parse` | parse \*\*\*plain - its syntax and structure, never its code or tests - regenerating nothing - a module whose functional specs have scenarios but which has no test reqs, or no conformance testing script, passes with a warning naming the next step (see [the steps of adding tests](regenerating.md#the-steps-of-adding-tests)) |
|
|
29
28
|
| `settings` | read the project's settings, or change one when you ask - "regenerate with gpt 5.5 from now on" sets `coding-model` - see [below](#choosing-a-model) and [changing it from the chat](config.md#changing-it-from-the-chat) |
|
|
30
|
-
| `pulses` | pulses in every tense: this session's - finished, running and planned - and the last runs of earlier sessions (`runs` for more), or one of them - a finished one with what the [ledger](#the-ledger) recorded of it: its rounds, test runs, verdicts, healers and commits; one that did not land says why besides, from its transcript: its diagnosis, the stages that went wrong, the last failing test run, the last review, the tool calls that failed. With a module's `plain_file`, a look ahead: its work planned as `regenerate` plans it
|
|
29
|
+
| `pulses` | pulses in every tense: this session's - finished, running and planned - and the last runs of earlier sessions (`runs` for more), or one of them - a finished one with what the [ledger](#the-ledger) recorded of it: its rounds, test runs, verdicts, healers and commits; one that did not land says why besides, from its transcript: its diagnosis, the stages that went wrong, the last failing test run, the last review, the tool calls that failed. With a module's `plain_file`, a look ahead: its work planned as `regenerate` plans it and kept, nothing started, its pulses waiting for `regenerate`, `conform` or `/regenerate`, which runs that plan as it is unless the \*\*\*plain changed since. A planned row's id (`planned-<module>-1`) then gives its cases and - the next pulse of its codebase - the whole prompt its coding agent will get |
|
|
31
30
|
| `halt` | halt a pulse, a module's planned pulses, a launch, or what a launch started |
|
|
32
31
|
| `doctor` | turri's self check, as `turri doctor` runs it: Node, bash, git, the OS sandbox, a model provider, and the project's toolchains and testing scripts - against the PATH turri's pulses run with, not the agent's shell's. The project's models are asked for a word only when you ask (a request a model); it changes nothing |
|
|
33
32
|
| `cultivate` | run a gated skill, its steps and review gates enforced |
|
|
@@ -78,7 +77,7 @@ A regeneration takes minutes, so in the TUI every tool that regenerates starts t
|
|
|
78
77
|
- `turri` runs [pi](https://pi.dev) in fullscreen mode, so the conversation stays where you scroll it while the pulses redraw (PgUp/PgDn, the wheel); `--tui-mode regular` goes back to the terminal's own scrollback.
|
|
79
78
|
- **`/settings`** changes a setting of the project's `config.turri.yaml` - the models, review, conformance tests, any key - and says when it takes effect: now, at your next message, or at the next pulse; never only after a restart. It takes [pi](https://pi.dev)'s own `/settings` over, pi's menu the last entry of its list. See [changing it from the chat](config.md#changing-it-from-the-chat).
|
|
80
79
|
- **`/sentinel`** says whether the [sentinel](sentinel.md) checks every pulse that finishes: `ask` - you are asked before it first opens in a session - `on`, or `off`; written to `config.turri.yaml`.
|
|
81
|
-
- **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]]
|
|
80
|
+
- **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]]`** regenerates a module from its \*\*\*plain as it is now, as the `regenerate` tool does: what is left to regenerate is planned into pulses - one functional spec at a time, a few together or the whole module in one, as the planner judges - and the first starts. No other words are taken: how the work is cut is the planner's. A module's name typed with spaces for its underscores is that module - `/regenerate d365_function executor` is `d365_function_executor`. With no module named: the one `module:` in `config.turri.yaml` names, else the folder's top modules, to pick from. Asked for from scratch - `from scratch`, `start over`, `delete the module` - it starts at once, with nothing to confirm: it deletes the module's code and conformance tests in every codebase where they live, committed so `/lineage` keeps them, and regenerates the whole module from its \*\*\*plain, built though nothing in it changed: `/regenerate shorty from scratch`. The modules below it keep their code, and the module starts again from a copy of the code below it. Asked for its chain too - `/regenerate shorty from scratch, the whole chain` - the code of every module of its requires chain is deleted, the base's included, and the whole chain is regenerated from the bottom: what to do after modules were split, merged or moved, when the code below was laid out for modules that are no more. The chat's `regenerate` does the same with `from_scratch: "module"` or `"chain"`, when you ask for it; `turri regenerate --from-scratch` or `--from-scratch-chain` on the command line, not with `--dry-run`. Functional specs named after the module, each as `<module>:<func-id>` - `/regenerate shorty shorty:shorten shorty:expand` - are regenerated though their \*\*\*plain did not change, on the coding model: as `turri regenerate shorty.plain shorty:shorten shorty:expand` does, and the chat's `regenerate` with `funcIds`. A bare func-id is refused: the module is always named. Code built before functional specs had func-ids - its record numbers them - is never built on: the module's whole chain has to be regenerated from scratch, and the chat asks you first, as for a start over.
|
|
82
81
|
- **`/conform [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [one by one]`** writes and runs a module's conformance tests now, as the `conform` tool does: those of the functional specs named, each as `<module>:<func-id>` - `/conform shorty shorty:shorten shorty:expand` - or, with none named, of every functional spec with scenarios. A functional spec named whose tests are written has them written again, deleted and written anew from its scenarios; `from scratch` takes out the tests folder where the module's code lives - the tip of its chain, never a module in the middle - its lineage keeping it, and writes the tests again from a copy of the tests of the module the tip requires; `from scratch, whole chain`, from nothing. None of it touches the code ([written again](regenerating.md#conformance-tests-in-the-work-loop)). They go in one pulse, as far as a size guardrail lets; `one by one` (or `separately`, `one at a time`) has a pulse a functional spec. No other words are taken: there is no plan to guide. The module is found as `/regenerate` finds it. Asking for them is asking for them on: with conformance tests off, `/conform` turns them on first - `conformance-tests: true`, written where the module's value comes from - and says so: the one way the chat's work has them turned on, as the `conform` tool is refused while they are off. What would start nothing is found from the \*\*\*plain before anything is said. A step of adding tests still to take - no test reqs, no conformance testing script, no scenarios - is not an error: it is what `/conform` needs first, told to turri alone, not shown to you, and turri takes it at once - the test reqs, the conformance testing script, the scenarios of the functional specs named, or of each one that needs them - without asking again: your `/conform` was the yes. Then it regenerates the module, and says what it is writing and why. What is yours to settle - a functional spec named that is not there - is shown to you, and turri tells you what would let it start, starting nothing. Its tests come before anything is built on it: a codebase built on the module is stopped and deleted, and regenerated from it once they pass. Tests written already for the scenarios as built are said to be, and nothing starts.
|
|
83
82
|
- **`/halt <id>`** halts a pulse - a queued one never starts - **`/halt <module>`** (or a planned row's id) halts a module's planned pulses until you ask for it again, a \*\*\*plain change not starting it, and **`/halt launched <name>`** halts a server a launch started - **`/halt launched <module>`** the module's launch under way, the one waiting, and what it started; it lists them all when no id is given.
|
|
84
83
|
- **What these commands show you, the chat knows.** What `/regenerate`, `/conform` and `/halt launched` tell you - \*\*\*plain that does not parse, the pulses planned, a server halted - stays in the chat under the command, and since a slash command runs outside the conversation, it is put in the conversation as well: say "fix it" next and turri knows what you are looking at. When `/conform` starts nothing, turri answers it at once - taking the steps of adding tests still to take, which you are not shown, and saying why for the rest. Once `/regenerate` or `/conform` has started pulses, turri says so in the chat too - what runs and what is planned, and that you need not wait for it - without starting anything more for it; a module already up to date gets the plan's answer alone. A halted pulse reaches it as every pulse's end does.
|
|
@@ -46,7 +46,7 @@ The other rules say what a spec means. This one says what turri does with a chan
|
|
|
46
46
|
|
|
47
47
|
- A coding agent sees its prompt and its module's code - nothing else. It cannot read `.plain` files, this conversation, AGENTS.md or the person. It never sees a functional spec's scenarios: those are the conformance tests'
|
|
48
48
|
- What the code needs to know has to be in the spec. A fact said only in the conversation, AGENTS.md or notes never reaches the code, and is lost at the next regeneration
|
|
49
|
-
-
|
|
49
|
+
- How the work is cut into pulses, and in what order, is the planner's alone: nothing the person or the conversation says reaches it. What the code does is changed in the spec
|
|
50
50
|
- A codebase that requires no module may start from a base folder (`base-folder:` in config.turri.yaml): an existing codebase, files to use - images, animations - or both, copied in once before its first pulse and up the chain with the code. The agents that change and review its code are told what came from it, and keep it unless a functional spec asks otherwise. Refer to what is in it in the spec - in words, or by a link into the folder, relative to the module's file as every link is - for the code to use it: a file it holds that no functional spec names is kept, never used. A change to the folder later reaches the code only when the module is regenerated from scratch
|
|
51
51
|
|
|
52
52
|
## How bad code is fixed
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How the person wants the queue planned - which functional specs go together, what goes first, how big a job is -
|
|
3
|
-
* given to the planner's agents with every plan, as a strong preference.
|
|
4
|
-
*
|
|
5
|
-
* It comes from three places. The conversation sets it (`steer`), for the whole project or one module, and it
|
|
6
|
-
* holds for the session. The project's AGENTS.md can say it once for good: a section whose heading names the queue
|
|
7
|
-
* ("## Queue guidance") is read with every plan, so an edit to it holds from the next. And whatever queues work can
|
|
8
|
-
* pass guidance for that work (a tool's `guidance`), which the queue keeps with it.
|
|
9
|
-
*/
|
|
10
|
-
/** Everything the conversation's steering applies to: every module of the project. */
|
|
11
|
-
export declare const EVERY_MODULE = "*";
|
|
12
|
-
export interface SteeringStore {
|
|
13
|
-
/** The steering for a scope - a module's name, or EVERY_MODULE - in the order it was given. */
|
|
14
|
-
get(scope: string): string[];
|
|
15
|
-
set(scope: string, texts: string[]): void;
|
|
16
|
-
scopes(): string[];
|
|
17
|
-
}
|
|
18
|
-
export declare function createSteeringStore(): SteeringStore;
|
|
19
|
-
/** A module's name as the steering names it: its spec file's name, without `.plain`. */
|
|
20
|
-
export declare function moduleNameOf(plainFile: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* What an AGENTS.md says of the queue: every section whose heading names it - "Queue", "Queue guidance", "How the
|
|
23
|
-
* render queue is planned" - up to the next heading of its level or above. Empty when there is none.
|
|
24
|
-
*/
|
|
25
|
-
export declare function queueSectionOf(markdown: string): string;
|
|
26
|
-
/** The steering a plan of this spec's codebase follows - AGENTS.md's, then the conversation's for every module and for this one. */
|
|
27
|
-
export declare function steeringFor(plainFile: string, cwd: string, store: SteeringStore): Steering[];
|
|
28
|
-
/** How the person or the harness wants the queue planned: a strong preference, each with where it came from. */
|
|
29
|
-
export interface Steering {
|
|
30
|
-
source: string;
|
|
31
|
-
text: string;
|
|
32
|
-
}
|
|
33
|
-
/** The steering, for an agent's task: each with where it came from, and how binding it is. */
|
|
34
|
-
export declare function steeringBlock(steering: Steering[] | undefined): string[];
|
package/dist/regenerate/steer.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
3
|
-
import { projectDirOf } from "./paths.js";
|
|
4
|
-
/**
|
|
5
|
-
* How the person wants the queue planned - which functional specs go together, what goes first, how big a job is -
|
|
6
|
-
* given to the planner's agents with every plan, as a strong preference.
|
|
7
|
-
*
|
|
8
|
-
* It comes from three places. The conversation sets it (`steer`), for the whole project or one module, and it
|
|
9
|
-
* holds for the session. The project's AGENTS.md can say it once for good: a section whose heading names the queue
|
|
10
|
-
* ("## Queue guidance") is read with every plan, so an edit to it holds from the next. And whatever queues work can
|
|
11
|
-
* pass guidance for that work (a tool's `guidance`), which the queue keeps with it.
|
|
12
|
-
*/
|
|
13
|
-
/** Everything the conversation's steering applies to: every module of the project. */
|
|
14
|
-
export const EVERY_MODULE = "*";
|
|
15
|
-
export function createSteeringStore() {
|
|
16
|
-
const byScope = new Map();
|
|
17
|
-
return {
|
|
18
|
-
get: (scope) => [...(byScope.get(scope) ?? [])],
|
|
19
|
-
set(scope, texts) {
|
|
20
|
-
if (texts.length === 0)
|
|
21
|
-
byScope.delete(scope);
|
|
22
|
-
else
|
|
23
|
-
byScope.set(scope, [...texts]);
|
|
24
|
-
},
|
|
25
|
-
scopes: () => [...byScope.keys()],
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/** A module's name as the steering names it: its spec file's name, without `.plain`. */
|
|
29
|
-
export function moduleNameOf(plainFile) {
|
|
30
|
-
return basename(plainFile, extname(plainFile));
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* What an AGENTS.md says of the queue: every section whose heading names it - "Queue", "Queue guidance", "How the
|
|
34
|
-
* render queue is planned" - up to the next heading of its level or above. Empty when there is none.
|
|
35
|
-
*/
|
|
36
|
-
export function queueSectionOf(markdown) {
|
|
37
|
-
const lines = markdown.split("\n");
|
|
38
|
-
const out = [];
|
|
39
|
-
let level = 0;
|
|
40
|
-
for (const line of lines) {
|
|
41
|
-
const heading = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
42
|
-
if (heading !== null) {
|
|
43
|
-
const depth = heading[1].length;
|
|
44
|
-
if (level > 0 && depth <= level)
|
|
45
|
-
level = 0;
|
|
46
|
-
if (level === 0 && /\bqueue/i.test(heading[2])) {
|
|
47
|
-
level = depth;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (level > 0)
|
|
52
|
-
out.push(line);
|
|
53
|
-
}
|
|
54
|
-
return out.join("\n").trim();
|
|
55
|
-
}
|
|
56
|
-
/** The AGENTS.md files a spec's steering is read from: where turri runs, and the spec's project - once each. */
|
|
57
|
-
function agentsFiles(plainFile, cwd) {
|
|
58
|
-
const dirs = [resolve(cwd), projectDirOf(resolve(cwd, plainFile))];
|
|
59
|
-
return [...new Set(dirs.map((dir) => join(dir, "AGENTS.md")))].filter((file) => existsSync(file));
|
|
60
|
-
}
|
|
61
|
-
/** The steering a plan of this spec's codebase follows - AGENTS.md's, then the conversation's for every module and for this one. */
|
|
62
|
-
export function steeringFor(plainFile, cwd, store) {
|
|
63
|
-
const fromFiles = agentsFiles(plainFile, cwd).flatMap((file) => {
|
|
64
|
-
try {
|
|
65
|
-
const text = queueSectionOf(readFileSync(file, "utf8"));
|
|
66
|
-
return text === "" ? [] : [{ source: `AGENTS.md (${basename(dirname(file))})`, text }];
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const module = moduleNameOf(plainFile);
|
|
73
|
-
return [
|
|
74
|
-
...fromFiles,
|
|
75
|
-
...store.get(EVERY_MODULE).map((text) => ({ source: "the conversation", text })),
|
|
76
|
-
...store.get(module).map((text) => ({ source: `the conversation, for ${module}`, text })),
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
/** The steering, for an agent's task: each with where it came from, and how binding it is. */
|
|
80
|
-
export function steeringBlock(steering) {
|
|
81
|
-
if (steering === undefined || steering.length === 0)
|
|
82
|
-
return [];
|
|
83
|
-
return [
|
|
84
|
-
"<how the queue is to be planned - the person's or the harness's wishes>",
|
|
85
|
-
...steering.map((entry) => `<from source="${entry.source}">\n${entry.text.trim()}\n</from>`),
|
|
86
|
-
"</how the queue is to be planned>",
|
|
87
|
-
"Follow these as a strong preference: they say how the person wants the work cut and ordered. They never override the",
|
|
88
|
-
"limits and checks the plan is held to; where one would, keep to the limit, and say which and why in your answer's notes.",
|
|
89
|
-
"",
|
|
90
|
-
];
|
|
91
|
-
}
|