@turri-dev/cli 0.2.4-next.bc1fc47 → 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 +3 -4
- package/dist/bedrock-region.js +3 -3
- package/dist/chat-models.d.ts +1 -1
- package/dist/chat-models.js +1 -1
- package/dist/chat-scope.d.ts +1 -3
- package/dist/chats.d.ts +2 -2
- package/dist/chats.js +3 -3
- package/dist/cli.js +6 -23
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +29 -21
- package/dist/config.d.ts +43 -50
- package/dist/config.js +122 -104
- package/dist/conform-cli.js +1 -1
- package/dist/conformance-switch.d.ts +7 -6
- package/dist/conformance-switch.js +16 -16
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +82 -200
- package/dist/host-session.d.ts +2 -2
- package/dist/host-session.js +2 -2
- package/dist/host.d.ts +1 -1
- package/dist/host.js +3 -3
- package/dist/init-config.js +1 -1
- package/dist/loop-tools.d.ts +9 -13
- package/dist/loop-tools.js +32 -37
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +3 -0
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +3 -3
- package/dist/plain/check.d.ts +1 -1
- package/dist/plain/check.js +3 -1
- package/dist/plain-files.js +4 -4
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +2 -2
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- package/dist/regenerate/jobs.d.ts +2 -2
- package/dist/regenerate/jobs.js +10 -10
- package/dist/regenerate/ledger.d.ts +1 -1
- package/dist/regenerate/loop.d.ts +3 -3
- package/dist/regenerate/loop.js +27 -23
- 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/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -3
- package/dist/regenerate/test-scripts.d.ts +2 -1
- package/dist/regenerate/test-scripts.js +33 -23
- package/dist/regenerate/testing-steps.d.ts +6 -6
- package/dist/regenerate/testing-steps.js +8 -8
- package/dist/{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/docs/README.md +2 -2
- package/docs/chats.md +3 -4
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +50 -38
- package/docs/development.md +1 -1
- package/docs/headless.md +1 -2
- package/docs/hosting.md +6 -6
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +9 -9
- package/docs/sentinel.md +2 -2
- package/docs/skills-and-gates.md +1 -2
- package/docs/using.md +8 -17
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/turri-regeneration.md +2 -1
- package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
- package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
- package/package.json +1 -1
- package/dist/regenerate/engine.d.ts +0 -52
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
package/docs/using.md
CHANGED
|
@@ -25,8 +25,8 @@ While a skill runs, a line above the input shows its phases, every one by name -
|
|
|
25
25
|
| `drift` | what is left to regenerate: how far the code and its conformance tests have drifted from \*\*\*plain, starting nothing |
|
|
26
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
27
|
| `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
|
-
| `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
|
|
29
|
-
| `
|
|
28
|
+
| `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
|
+
| `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
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 - the steering with it - and kept, nothing started, its pulses waiting for `regenerate`, `conform` or `/regenerate`, which runs that plan as it is unless the \*\*\*plain or the steering 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
31
|
| `halt` | halt a pulse, a module's planned pulses, or what `activate` started |
|
|
32
32
|
| `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 |
|
|
@@ -76,10 +76,9 @@ A regeneration takes minutes, so in the TUI every tool that regenerates starts t
|
|
|
76
76
|
|
|
77
77
|
`ctrl+h` again, or `esc`, closes it and goes back to the chat. Beside the chat, one side has the keys and the other is drawn faint: `ctrl+h` switches sides - from the chat to the panel, from the panel to the chat, the panel staying and following the pulses - `esc` gives the chat the keys too, and a click gives them to the side clicked. `ctrl+c` closes the panel; so do `s`, over the whole screen, then `esc`. ([pi](https://pi.dev)'s regular screen, `--tui-mode regular`, reads no mouse: there it is the keys alone.) While the panel has the keys, every key is the panel's, whatever else happens: a question the chat model asks in the background (`ask_user`) waits in the chat, unanswered - an `enter` in the panel never answers it - and the panel's top line says "the chat is waiting for your answer". Back in the chat, the question is there, with the keys.
|
|
78
78
|
- `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
|
-
- **`/
|
|
79
|
+
- **`/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
80
|
- **`/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
|
-
- **`/
|
|
82
|
-
- **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [how to cut the work]`** 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. Words after the module are guidance for that plan (`/regenerate app models first`). 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 model chosen for functionalities: 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.
|
|
81
|
+
- **`/regenerate [module | file.plain] [module:func-id ...] [from scratch [whole chain]] [how to cut the work]`** 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. Words after the module are guidance for that plan (`/regenerate app models first`). 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.
|
|
83
82
|
- **`/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 - no scenarios, a functional spec named that is not there or has none, a step of adding tests skipped (no test reqs, no conformance testing script) - and turri answers it at once in the chat. What is missing that turri can write - the test reqs, the conformance testing script, the scenarios of the functional specs named, or of each one that needs them - it writes at once, without asking again: your `/conform` was the yes. Then it regenerates the module, and says what it wrote and why. What is yours to settle - a functional spec named that is not there - it tells you, 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.
|
|
84
83
|
- **`/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 activated <name>`** halts a server `activate` started; it lists all three when no id is given.
|
|
85
84
|
- **What these commands show you, the chat knows.** What `/regenerate`, `/conform` and `/halt activated` 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 - writing what it can of what is missing, 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.
|
|
@@ -96,7 +95,7 @@ In `print`, `json` and `rpc` modes the process ends when the answer is written,
|
|
|
96
95
|
|
|
97
96
|
The chat reads the project's `config.turri.yaml` afresh every turn and follows it: its agent is told what it sets, and the tools that regenerate default to it - `module` when you ask to build without naming one, `coding-model` for what regenerations run on, and the testing scripts. `harness-model` is what `turri` starts on. What you ask for in the conversation wins. Every key, what happens without it, and how the models inherit: [the project config](config.md).
|
|
98
97
|
|
|
99
|
-
A project whose parts are on different stacks gives
|
|
98
|
+
A project whose parts are on different stacks gives a module its own `config.turri.<module>.yaml` beside `config.turri.yaml` - `config.turri.backend.yaml`, `config.turri.frontend.yaml` - with its testing scripts, models and conformance over the project's, for that module and every module built on it that has no file of its own. Nobody chooses it: a backend and a frontend are each built with their own, side by side. The chat is told each module's file. See [a module's own config](config.md#a-modules-own-config).
|
|
100
99
|
|
|
101
100
|
A project with only a `config.yaml` - turri's file before it had its own name, or another tool's - is read from it until turri first writes a setting, which copies it to `config.turri.yaml`; see [the old config.yaml](config.md#the-old-configyaml).
|
|
102
101
|
|
|
@@ -117,19 +116,11 @@ judge-model:
|
|
|
117
116
|
|
|
118
117
|
Each may leave out either part, and a bare string (`coding-model: provider/id`, or `provider/id:high`) is a model alone. What one leaves out it takes from the one it inherits from: the judge model from the coding model, the coding model from the harness model - so with only a harness model, everything runs on it.
|
|
119
118
|
|
|
120
|
-
On the command line, `turri --harness-model <m> --coding-model <m>` wins over them ([pi](https://pi.dev)'s own `--model` works for the harness model too), and in the conversation [pi](https://pi.dev)'s `/model` changes the harness model and `
|
|
119
|
+
On the command line, `turri --harness-model <m> --coding-model <m>` wins over them ([pi](https://pi.dev)'s own `--model` works for the harness model too), and in the conversation [pi](https://pi.dev)'s `/model` changes the harness model and the `settings` tool, below, the coding model. `model:`, from before there were two, is read as `coding-model`. With neither, regenerations run on the conversation's model.
|
|
121
120
|
|
|
122
|
-
Every regeneration runs on the coding model unless you say otherwise. Say it in words - "regenerate
|
|
121
|
+
Every regeneration runs on the coding model unless you say otherwise. Say it in words - "regenerate with gpt 5.5 from now on", "use Claude for the code" - and the agent's `settings` tool writes `coding-model` into `config.turri.yaml`, from the next pulse on, in every [chat](chats.md) and the sessions after; a module's own model goes in its own file. Pulses already queued keep the model they were queued with. For one regeneration alone - "regenerate this on Gemini 3.6 Flash" - the agent passes the model to `regenerate` or `conform` instead, and the config stays as it was.
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
| --- | --- |
|
|
126
|
-
| \*\*\*plain changes | \*\*\*plain diff pulses |
|
|
127
|
-
| functionalities | a functionality or a whole module regenerated, functionalities regenerated again, conformance |
|
|
128
|
-
| everything | both |
|
|
129
|
-
|
|
130
|
-
It works mid-interview as well: the skill's agent has the same tool. Pulses already queued keep the model they were queued with; `"chat"` drops the session's choice, back to the default coding model - `--coding-model`, `config.turri.yaml`, or the conversation's. `/engine` shows what each kind of work runs on. A tool that regenerates can also be given a model for one call.
|
|
131
|
-
|
|
132
|
-
Names are resolved strictly, because [pi](https://pi.dev)'s own matching guesses and says nothing ("gpt-5" can land on a Bedrock model you have no key for). An exact `provider/model-id` is taken as it is. A looser name is taken when it fits exactly one model you have credentials for, or is exactly one model's id in other words ("gpt 5.5" is `openai/gpt-5.5`, not `gpt-5.5-pro`). Anything else comes back as a short list and the agent asks you which one; a model whose provider has no credentials is never picked.
|
|
123
|
+
Names are resolved strictly, because [pi](https://pi.dev)'s own matching guesses and says nothing ("gpt-5" can land on a Bedrock model you have no key for). An exact `provider/model-id` is taken as it is. A looser name is taken when it fits exactly one model you have credentials for, or is exactly one model's id in other words ("gpt 5.5" is `openai/gpt-5.5`, not `gpt-5.5-pro`). Anything else comes back as a short list and the agent asks you which one - nothing is written meanwhile; a model whose provider has no credentials is never picked.
|
|
133
124
|
|
|
134
125
|
To change [pi](https://pi.dev)'s own default, in `~/.pi/agent/settings.json`:
|
|
135
126
|
|
|
@@ -33,7 +33,8 @@ Follow `module-structure.md`, `import-modules.md` and `linked-resources.md` for
|
|
|
33
33
|
|
|
34
34
|
- Settle a decision, write it into the config in the same step - never leave it to be inferred from what is on disk. A testing script you write or keep is named by its key, by path from the root (`unittests-script: test_scripts/run_unittests_python.sh`)
|
|
35
35
|
- Change only the keys you settled. Where the file has a key's example commented out, uncomment that line and set it; keep every other line and comment as it is
|
|
36
|
-
- A project whose parts are on different stacks
|
|
36
|
+
- A project whose parts are on different stacks gives a module its own `config.turri.<module>.yaml` beside it, with that module's scripts - it builds the module and every module built on it that has no file of its own; what they share stays in `config.turri.yaml`. Name the file after the module at the bottom of the chain it builds - two files among the modules one requires is an error
|
|
37
|
+
- In the conversation, a setting is changed with the `settings` tool, which checks what it writes; an agent without it writes the key in the file itself
|
|
37
38
|
- A project with only a `config.yaml` has it copied to `config.turri.yaml` first, and each `config.<name>.yaml` to `config.turri.<name>.yaml`; `config.yaml` may be another tool's, and is never written
|
|
38
39
|
- Say in your summary which lines you wrote
|
|
39
40
|
|
|
@@ -31,7 +31,8 @@ The other rules say what a spec means. This one says what turri does with a chan
|
|
|
31
31
|
- Test reqs and scenarios - a functional spec's conformance and acceptance scenarios, in its test plain file - reach the conformance tests only, never the code. A scenario changed alone regenerates no code
|
|
32
32
|
- A functional spec regenerated again by name has its code taken out and built anew - never left as it was, even where it already does what the spec says; a pulse that changes nothing does not land. Its conformance tests, when it has them, are run on its new code once it lands: those that pass are kept as they are; one that fails is judged against the spec - what it checks that the spec leaves open, a path, a field, a message the old code chose, goes by the new code
|
|
33
33
|
- What is conformance tested is the scenarios: each conformance and acceptance scenario of a functional spec gets at least one test, and nothing else is tested - a functional spec with no test plain file, or an empty one, has no conformance tests. Its tests are written or changed once its code lands, whenever a scenario is added, changed or taken out, its text changes, it is regenerated again or taken out; one whose scenarios are all taken out loses its tests. It goes scenario by scenario, by scenario-id: a scenario added gets its tests, one changed has them rewritten, one taken out loses them, and an unchanged one keeps them - run on the new code when the functional spec's code changed. A scenario-id renamed with its text as it was has its tests relabelled, nothing rewritten; renamed with any other change, or moved between conformance and acceptance, it is one taken out and one added. To have something checked end to end, write it as a scenario
|
|
34
|
-
- Scenarios are tested only once the module has test reqs - its own, or the stack's conformance template imported - and the project has a conformance testing script for
|
|
34
|
+
- Scenarios are tested only once the module has test reqs - its own, or the stack's conformance template imported - and the project has a conformance testing script for it. For a module another requires, that is the tip of the chain: its conformance tests are written there, from the tip's test reqs, so the template goes into the tip. Without either, turri starts no conformance pulse there, by itself or from `conform`: it refuses, naming the step missing, the module waits on it until the `.plain` files or the scripts change, and `turri parse` warns. Take the steps in order - test reqs, the script, then the scenarios - and a module with no scenarios needs neither
|
|
35
|
+
- A module is built with `config.turri.yaml` and, laid over it, its own `config.turri.<module>.yaml` - else the one of a module it requires, all the way down: a module is built on their code, with their testing scripts. Nobody chooses it. Two modules it requires with a file of their own, and none of its own, is an error `turri parse` reports and `regenerate` refuses: give the module its own file, or keep one of theirs. Only `requires` counts, not `import`
|
|
35
36
|
- Definitions moved to a common module and reqs reordered are recorded, not regenerated
|
|
36
37
|
- A functional spec written on its happy path and hardened later - its validation, edge cases and errors added to it - is patched in place each time: growing a spec a step at a time costs no more than writing it whole up front
|
|
37
38
|
- A module's first pulse, when it builds one functional spec - the project set up and the smallest thing that runs - lands on its unit tests with no review
|
|
@@ -212,7 +212,7 @@ The harness never runs `.ps1` scripts. These notes apply only to an optional cop
|
|
|
212
212
|
4. Pick the right row from the [Dependency isolation](#dependency-isolation) table — use the same flag/env var in steps 7, 7b and 8 — and the checks from [Static checks of the tests](#static-checks-of-the-tests).
|
|
213
213
|
5. Add the language-appropriate "no tests discovered" guard from [No tests discovered detection](#no-tests-discovered-detection), and the guard against conformance tests in the build folder from [Tests in the build folder](#tests-in-the-build-folder).
|
|
214
214
|
6. Save the new script as `test_scripts/run_conformance_tests_<lang>.sh` and `chmod +x` it. Write a `.ps1` copy only if the user wants to run it by hand on Windows.
|
|
215
|
-
7. **Make sure turri finds the script.** Do not link it from the ***plain - turri finds the conformance testing script in the project root (the folder that holds `plain_modules/`) and puts it, whole, into the prompts of the agents that write and review the conformance tests itself, whenever conformance tests are written for a build; a link to it from the ***plain is ignored. It looks, in order, at `config.turri.yaml` in the root (`conformance-tests-script: <path relative to the root>`) - with the
|
|
215
|
+
7. **Make sure turri finds the script.** Do not link it from the ***plain - turri finds the conformance testing script in the project root (the folder that holds `plain_modules/`) and puts it, whole, into the prompts of the agents that write and review the conformance tests itself, whenever conformance tests are written for a build; a link to it from the ***plain is ignored. It looks, in order, at `config.turri.yaml` in the root (`conformance-tests-script: <path relative to the root>`) - with the module's own `config.turri.<module>.yaml` over it - or the one of a module it requires - then for the one `run_conformance_tests*.sh` in the root, then for the one in `test_scripts/`. Saving the script in `test_scripts/` (or the root) is enough when it is the only one there. If the project keeps it elsewhere, name it in `config.turri.yaml` as `conformance-tests-script:` - and when the project has only a `config.yaml`, copy it to `config.turri.yaml` first (and each `config.<name>.yaml` to `config.turri.<name>.yaml`) and edit the copy; `config.yaml` may be another tool's, and is never written. If the project has modules on different stacks - e.g. a Python backend and a React frontend side by side, sharing only an imported module - each part names its own script in a file of its own beside `config.turri.yaml`: `conformance-tests-script:` in `config.turri.backend.yaml` for `backend.plain`, in `config.turri.frontend.yaml` for `frontend.plain`. A module's file builds it and every module built on it that has no file of its own, so name it after the module at the bottom of the chain - `config.turri.backend.yaml` builds `backend_auth.plain`, which requires `backend.plain`, too - and turri works it out with nothing to choose; two files among the modules one requires is an error. turri never guesses between two. The script is required: without one, no conformance or acceptance test is written or run. The `***test reqs***` still describe the conformance framework and command in words; do not paraphrase the script into them.
|
|
216
216
|
|
|
217
217
|
## Anti-Patterns
|
|
218
218
|
|
|
@@ -235,5 +235,5 @@ The harness never runs `.ps1` scripts. These notes apply only to an optional cop
|
|
|
235
235
|
- **Don't ship only a `.ps1`.** The harness runs `.sh` scripts only; a project with just a PowerShell runner has no conformance testing script as far as turri is concerned.
|
|
236
236
|
- **Don't install dependencies into the user's global location** (`~/.m2`, system-wide `pip`, `~/.cargo`, etc.). Always isolate inside `$WORKING_FOLDER` so concurrent runs and other projects can't interfere.
|
|
237
237
|
- **Don't run the test command without first verifying the install succeeded.** A failed install followed by a "test" run produces misleading errors that look like test failures.
|
|
238
|
-
- **Don't link the script from the ***plain, and don't leave turri guessing.** turri finds the script in `config.turri.yaml`, the project root, or `test_scripts/`, shows it to the agents that write the conformance tests itself, and writes or runs no conformance test without it; a link to it from the ***plain is ignored. Put it where it is found, and when there are two conformance testing scripts in one folder, name the one to use as `conformance-tests-script:` - in each
|
|
238
|
+
- **Don't link the script from the ***plain, and don't leave turri guessing.** turri finds the script in `config.turri.yaml`, the project root, or `test_scripts/`, shows it to the agents that write the conformance tests itself, and writes or runs no conformance test without it; a link to it from the ***plain is ignored. Put it where it is found, and when there are two conformance testing scripts in one folder, name the one to use as `conformance-tests-script:` - in each module's own `config.turri.<module>.yaml` when they are for parts on different stacks (see Workflow step 7).
|
|
239
239
|
- **Don't write a terse script.** Silent steps, `>/dev/null` redirects on the install output, missing `--version` prints, absent step banners, an un-logged resolved `$2`, and a missing final summary all make the script harder to debug than the tests it is running. Follow the *Logging — be as verbose as possible* rule under [Conventions](#conventions) literally: every step announces itself, every command is echoed, the resolved `$CONFORMANCE_TESTS_FOLDER` is printed, every failure prints what was about to run and where, and the final summary names the test command, exit code, and working folder.
|
|
@@ -138,12 +138,12 @@ Notes:
|
|
|
138
138
|
|
|
139
139
|
## Workflow
|
|
140
140
|
|
|
141
|
-
1. Take the target **language**, **test framework** and **dependency manifest** (`pom.xml`, `requirements.txt` / `pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, ...) from the module the script is for: its stack - the `stdlib/...` template it imports - its implementation reqs, and the project. You run in the background, with nobody to ask: decide what they leave open, the choice most consistent with them, and say what you decided in your result. The script is Bash; a PowerShell copy only when the context asks for one. When `config.turri.yaml` - or the
|
|
141
|
+
1. Take the target **language**, **test framework** and **dependency manifest** (`pom.xml`, `requirements.txt` / `pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, ...) from the module the script is for: its stack - the `stdlib/...` template it imports - its implementation reqs, and the project. You run in the background, with nobody to ask: decide what they leave open, the choice most consistent with them, and say what you decided in your result. The script is Bash; a PowerShell copy only when the context asks for one. When `config.turri.yaml` - or the module's own `config.turri.<module>.yaml` - names a `base-folder:`, the module's code starts as a copy of that folder: an existing codebase to build on, or only files to use. Read it. When it holds code with its own test setup - a `pytest.ini` or `pyproject.toml` test section, `package.json` test scripts, a `pom.xml`, a `go.mod` - the script runs that setup's tests as they run there, beside the tests the coding agents write, so they keep passing; its existing dependency manifest is the one to install from. A folder of assets alone changes nothing.
|
|
142
142
|
2. Read [assets/run_unittests_java.sh](assets/run_unittests_java.sh) to refresh the exact structure.
|
|
143
143
|
3. Translate each of the eight steps above into the equivalent commands for the target language **and** shell. The toolchain check, dependency install, static checks and test invocation are the language-specific parts; the rest is mechanical translation between Bash and PowerShell syntax.
|
|
144
144
|
4. Pick the dependency-isolation mechanism from the [Dependency isolation](#dependency-isolation) table and use it consistently in steps 6, 7 and 8, and the checks from the [Static checks](#static-checks) table.
|
|
145
145
|
5. Save the new script as `test_scripts/run_unittests_<lang>.sh` (a `.ps1` copy next to it only if the user wants to run it by hand on Windows). For Bash, `chmod +x` it.
|
|
146
|
-
6. **Make sure turri finds the script.** Do not link it from the ***plain - turri finds the unit testing script in the project root (the folder that holds `plain_modules/`) and puts it, whole, into the prompt of the coding agent itself; a link to it from the ***plain is ignored. It looks, in order, at `config.turri.yaml` in the root (`unittests-script: <path relative to the root>`) - with the
|
|
146
|
+
6. **Make sure turri finds the script.** Do not link it from the ***plain - turri finds the unit testing script in the project root (the folder that holds `plain_modules/`) and puts it, whole, into the prompt of the coding agent itself; a link to it from the ***plain is ignored. It looks, in order, at `config.turri.yaml` in the root (`unittests-script: <path relative to the root>`) - with the module's own `config.turri.<module>.yaml` over it - or the one of a module it requires - then for the one `run_unittests*.sh` in the root, then for the one in `test_scripts/`. Saving the script in `test_scripts/` (or the root) is enough when it is the only one there. If the project keeps it elsewhere, name it in `config.turri.yaml` as `unittests-script:` - and when the project has only a `config.yaml`, copy it to `config.turri.yaml` first (and each `config.<name>.yaml` to `config.turri.<name>.yaml`) and edit the copy; `config.yaml` may be another tool's, and is never written. If the project has modules on different stacks - e.g. a Python backend and a React frontend side by side, sharing only an imported module - each part names its own script in a file of its own beside `config.turri.yaml`: `unittests-script:` in `config.turri.backend.yaml` for `backend.plain`, in `config.turri.frontend.yaml` for `frontend.plain`. A module's file builds it and every module built on it that has no file of its own, so name it after the module at the bottom of the chain - `config.turri.backend.yaml` builds `backend_auth.plain`, which requires `backend.plain`, too - and turri works it out with nothing to choose; two files among the modules one requires is an error. turri never guesses between two. The script is required: a build without one stops before it starts.
|
|
147
147
|
|
|
148
148
|
## Anti-Patterns
|
|
149
149
|
|
|
@@ -159,5 +159,5 @@ Notes:
|
|
|
159
159
|
- Don't write a cross-shell hybrid (e.g. a `.sh` that detects PowerShell, or vice versa). Ship one script per shell, named with the appropriate extension.
|
|
160
160
|
- Don't install dependencies into the user's global location (`~/.m2`, system-wide `pip`, `~/.cargo`, etc.). Always isolate inside `$WORKING_FOLDER` so concurrent runs and other projects can't interfere.
|
|
161
161
|
- Don't run the test command without first verifying the install step succeeded. A failed install followed by a "test" run produces misleading errors that look like test failures.
|
|
162
|
-
- **Don't link the script from the ***plain, and don't leave turri guessing.** turri finds the script in `config.turri.yaml`, the project root, or `test_scripts/`, and shows it to the coding agent itself; a link to it from the ***plain is ignored. Put it where it is found, and when there are two unit testing scripts in one folder, name the one to use as `unittests-script:` - in each
|
|
162
|
+
- **Don't link the script from the ***plain, and don't leave turri guessing.** turri finds the script in `config.turri.yaml`, the project root, or `test_scripts/`, and shows it to the coding agent itself; a link to it from the ***plain is ignored. Put it where it is found, and when there are two unit testing scripts in one folder, name the one to use as `unittests-script:` - in each module's own `config.turri.<module>.yaml` when they are for parts on different stacks (see Workflow step 6).
|
|
163
163
|
- **Don't write a terse script.** Silent steps, `>/dev/null` redirects on the install output, missing `--version` prints, and absent failure banners all make the script harder to debug than the code it is testing. Follow the *Logging — be as verbose as possible* rule under [Conventions](#conventions) literally: every step announces itself, every command is echoed, every failure prints what was about to run and where.
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which model the agents of a job run on.
|
|
3
|
-
*
|
|
4
|
-
* By default, whatever the conversation is using. The person can say otherwise - "render spec
|
|
5
|
-
* changes with Gemini Flash" - for one kind of work or for all of it, and that holds for the
|
|
6
|
-
* rest of the session, for jobs started from a tool call and for jobs a skill queues alike. A
|
|
7
|
-
* single tool call can also name a model for itself alone.
|
|
8
|
-
*
|
|
9
|
-
* A name is resolved strictly. pi's own pattern matching picks its best guess and says nothing
|
|
10
|
-
* - "gpt-5" becomes a Bedrock model with no credentials, "flash" a GLM one - and a job on a
|
|
11
|
-
* guessed model is worse than a question. So an exact id is taken as it is, a looser name is
|
|
12
|
-
* taken only when it fits exactly one model that has credentials, and anything else comes back
|
|
13
|
-
* as a short list to ask the person about.
|
|
14
|
-
*/
|
|
15
|
-
/** The part of pi's model registry this needs. */
|
|
16
|
-
export interface ModelCatalog {
|
|
17
|
-
getAll(): ReadonlyArray<CatalogModel>;
|
|
18
|
-
hasConfiguredAuth(model: CatalogModel): boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface CatalogModel {
|
|
21
|
-
provider: string;
|
|
22
|
-
id: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
}
|
|
25
|
-
export type ModelResolution = {
|
|
26
|
-
ok: true;
|
|
27
|
-
model: string;
|
|
28
|
-
name: string;
|
|
29
|
-
} | {
|
|
30
|
-
ok: false;
|
|
31
|
-
message: string;
|
|
32
|
-
candidates: string[];
|
|
33
|
-
};
|
|
34
|
-
/** Resolve what the person called a model to one this machine can run, or say why not. */
|
|
35
|
-
export declare function resolveModel(query: string, catalog: ModelCatalog): ModelResolution;
|
|
36
|
-
/** The resolution as text for the agent: the model, or why not and what to ask. */
|
|
37
|
-
export declare function describeResolution(resolution: ModelResolution): string;
|
|
38
|
-
/** Kinds of work a model can be chosen for. */
|
|
39
|
-
export type RenderWork = "spec_changes" | "functionalities";
|
|
40
|
-
export declare const WORK_LABEL: Record<RenderWork | "all", string>;
|
|
41
|
-
/** The models chosen in this session, by kind of work. Unset: the project's, or the conversation's model. */
|
|
42
|
-
export type ModelChoices = Partial<Record<RenderWork | "all", string>>;
|
|
43
|
-
/** The model a job of this kind runs on: chosen for it, chosen for everything, or the chat's. */
|
|
44
|
-
export declare function modelFor(choices: ModelChoices, work: RenderWork, chat: string | undefined): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Where each kind of work runs now, in a line each: chosen in this session, or the default coding
|
|
47
|
-
* model - from `--coding-model` or config.turri.yaml, said which - or the conversation's.
|
|
48
|
-
*/
|
|
49
|
-
export declare function describeChoices(choices: ModelChoices, chat: string | undefined, project?: {
|
|
50
|
-
model: string;
|
|
51
|
-
from: string;
|
|
52
|
-
}): string;
|
package/dist/stacks.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Choosing a stack: `config.turri.<stack>.yaml` laid over `config.turri.yaml` for everything built from then on - a
|
|
3
|
-
* backend's testing scripts, then a frontend's. `/stack` and the `stack` tool in the chat, `--stack <name>` on the
|
|
4
|
-
* command line (cli.ts). The choice itself is kept in config.ts (`chooseStack`): in the chat it is made in, for that chat
|
|
5
|
-
* alone (chat-scope.ts), each new chat starting from `--stack`.
|
|
6
|
-
*/
|
|
7
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
-
/** The stacks of the projects here: the folder's own, and those of the projects one folder down (specs kept in plain/). */
|
|
9
|
-
export declare function knownStacks(root: string): string[];
|
|
10
|
-
/** Choose `name` - or none - among the stacks here, and say what is chosen now; a stack the project has no file for is refused. */
|
|
11
|
-
export declare function switchStack(root: string, name: string | undefined): string;
|
|
12
|
-
/** /stack and the chat's stack tool. */
|
|
13
|
-
export declare function registerStacks(pi: ExtensionAPI, cwd: string): void;
|
package/dist/stacks.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Choosing a stack: `config.turri.<stack>.yaml` laid over `config.turri.yaml` for everything built from then on - a
|
|
3
|
-
* backend's testing scripts, then a frontend's. `/stack` and the `stack` tool in the chat, `--stack <name>` on the
|
|
4
|
-
* command line (cli.ts). The choice itself is kept in config.ts (`chooseStack`): in the chat it is made in, for that chat
|
|
5
|
-
* alone (chat-scope.ts), each new chat starting from `--stack`.
|
|
6
|
-
*/
|
|
7
|
-
import { readdirSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
10
|
-
import { Type } from "typebox";
|
|
11
|
-
import { chooseStack, chosenStack, hasProjectConfig, NO_STACK, stackConfigFile, stacksOf } from "./config.js";
|
|
12
|
-
/** The stacks of the projects here: the folder's own, and those of the projects one folder down (specs kept in plain/). */
|
|
13
|
-
export function knownStacks(root) {
|
|
14
|
-
const below = (() => {
|
|
15
|
-
try {
|
|
16
|
-
return readdirSync(root, { withFileTypes: true })
|
|
17
|
-
.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== "plain_modules")
|
|
18
|
-
.map((entry) => join(root, entry.name))
|
|
19
|
-
.filter(hasProjectConfig);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
25
|
-
return [...new Set([root, ...below].flatMap(stacksOf))].sort();
|
|
26
|
-
}
|
|
27
|
-
/** Choose `name` - or none - among the stacks here, and say what is chosen now; a stack the project has no file for is refused. */
|
|
28
|
-
export function switchStack(root, name) {
|
|
29
|
-
const stacks = knownStacks(root);
|
|
30
|
-
const wanted = name?.trim() ?? "";
|
|
31
|
-
if (wanted === "" || NO_STACK.includes(wanted.toLowerCase())) {
|
|
32
|
-
chooseStack(undefined);
|
|
33
|
-
return "No stack chosen: everything is built with the project's config.turri.yaml alone, from now on.";
|
|
34
|
-
}
|
|
35
|
-
if (!stacks.includes(wanted)) {
|
|
36
|
-
throw new Error(stacks.length > 0
|
|
37
|
-
? `There is no stack ${wanted} here. The stacks: ${stacks.join(", ")} - or none.`
|
|
38
|
-
: `This project has no stacks: a stack is a ${stackConfigFile("<stack>")} beside config.turri.yaml.`);
|
|
39
|
-
}
|
|
40
|
-
chooseStack(wanted);
|
|
41
|
-
return `Stack ${wanted} chosen: everything is built with ${stackConfigFile(wanted)} over config.turri.yaml from now on - a pulse already running keeps the stack it started with.`;
|
|
42
|
-
}
|
|
43
|
-
/** /stack and the chat's stack tool. */
|
|
44
|
-
export function registerStacks(pi, cwd) {
|
|
45
|
-
pi.registerCommand("stack", {
|
|
46
|
-
description: "Choose the stack everything is built with - its config.turri.<stack>.yaml over config.turri.yaml: /stack [name | none]",
|
|
47
|
-
getArgumentCompletions: (prefix) => {
|
|
48
|
-
const items = [...knownStacks(cwd), "none"].filter((stack) => stack.startsWith(prefix)).map((stack) => ({ value: stack, label: stack }));
|
|
49
|
-
return items.length > 0 ? items : null;
|
|
50
|
-
},
|
|
51
|
-
handler: async (args, ctx) => {
|
|
52
|
-
let name = args.trim();
|
|
53
|
-
if (name === "") {
|
|
54
|
-
const stacks = knownStacks(cwd);
|
|
55
|
-
if (stacks.length === 0)
|
|
56
|
-
return ctx.ui.notify(`This project has no stacks: a stack is a ${stackConfigFile("<stack>")} beside config.turri.yaml.`, "info");
|
|
57
|
-
const now = chosenStack();
|
|
58
|
-
const label = (stack) => `${stack}${stack === now ? " (chosen now)" : ""}`;
|
|
59
|
-
const none = `none - config.turri.yaml alone${now === undefined ? " (chosen now)" : ""}`;
|
|
60
|
-
const picked = await ctx.ui.select("Build with which stack?", [...stacks.map(label), none]);
|
|
61
|
-
if (picked === undefined)
|
|
62
|
-
return;
|
|
63
|
-
name = picked === none ? "none" : (stacks.find((stack) => label(stack) === picked) ?? "");
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
ctx.ui.notify(switchStack(cwd, name), "info");
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
pi.registerTool(defineTool({
|
|
74
|
-
name: "stack",
|
|
75
|
-
label: "Stack",
|
|
76
|
-
description: "Choose the stack everything is built with from now on - the project's config.turri.yaml with the stack's " +
|
|
77
|
-
"config.turri.<stack>.yaml over it: its testing scripts, toolchains, models - or none, the project's file alone. " +
|
|
78
|
-
"For this chat alone - each chat chooses its own; a pulse already running keeps the stack it started with. Without a name, says the stacks and the one chosen.",
|
|
79
|
-
promptSnippet: "choose the stack - its testing scripts and settings - that everything is built with",
|
|
80
|
-
promptGuidelines: [
|
|
81
|
-
"Switch the stack only when the user asks for it, and say which you chose. A module is built with the stack named after it by itself; to build one whose stack has another name, pass that stack as stack to regenerate, conform or pulses instead: it is pinned to that module's pulses, and this chat's choice stays as it is.",
|
|
82
|
-
],
|
|
83
|
-
parameters: Type.Object({
|
|
84
|
-
name: Type.Optional(Type.String({ description: "The stack to choose, or none. Omitted: the stacks there are, and the one chosen" })),
|
|
85
|
-
}),
|
|
86
|
-
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
87
|
-
if (params.name === undefined) {
|
|
88
|
-
const stacks = knownStacks(cwd);
|
|
89
|
-
const text = stacks.length > 0 ? `The stacks: ${stacks.join(", ")}. Chosen now: ${chosenStack() ?? "none"}.` : "This project has no stacks.";
|
|
90
|
-
return { content: [{ type: "text", text }], details: {} };
|
|
91
|
-
}
|
|
92
|
-
const text = switchStack(cwd, params.name);
|
|
93
|
-
return { content: [{ type: "text", text }], details: {} };
|
|
94
|
-
},
|
|
95
|
-
}));
|
|
96
|
-
}
|