@turri-dev/cli 0.4.3-next.3fc888b → 0.4.3-next.7ada234

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.
Files changed (58) hide show
  1. package/dist/capture/agents.d.ts +21 -6
  2. package/dist/capture/agents.js +49 -8
  3. package/dist/capture/assemble.d.ts +4 -14
  4. package/dist/capture/assemble.js +19 -18
  5. package/dist/capture/capture.d.ts +3 -3
  6. package/dist/capture/capture.js +67 -33
  7. package/dist/capture/checks.js +7 -1
  8. package/dist/capture/config.d.ts +1 -1
  9. package/dist/capture/config.js +16 -10
  10. package/dist/capture/interface.js +1 -1
  11. package/dist/capture/map.d.ts +0 -2
  12. package/dist/capture/map.js +1 -1
  13. package/dist/capture/models.d.ts +4 -0
  14. package/dist/capture/models.js +16 -0
  15. package/dist/capture/plan.d.ts +2 -3
  16. package/dist/capture/plan.js +9 -9
  17. package/dist/capture/progress.d.ts +3 -1
  18. package/dist/capture/progress.js +28 -2
  19. package/dist/capture/python-interface.d.ts +3 -0
  20. package/dist/capture/python-interface.js +17 -0
  21. package/dist/capture/report.js +2 -2
  22. package/dist/capture/runners.d.ts +6 -0
  23. package/dist/capture/runners.js +59 -0
  24. package/dist/capture/scripts.d.ts +1 -1
  25. package/dist/capture/scripts.js +5 -0
  26. package/dist/capture/state.d.ts +11 -0
  27. package/dist/capture-cli.js +4 -4
  28. package/dist/chat-tab-header.d.ts +3 -2
  29. package/dist/chat-tab-header.js +22 -9
  30. package/dist/chat-terminal.js +22 -4
  31. package/dist/chats.d.ts +3 -0
  32. package/dist/chats.js +14 -2
  33. package/dist/config-edit.js +4 -3
  34. package/dist/config.d.ts +1 -1
  35. package/dist/config.js +8 -7
  36. package/dist/extension.d.ts +1 -1
  37. package/dist/extension.js +40 -16
  38. package/dist/init-config.d.ts +4 -1
  39. package/dist/init-config.js +31 -6
  40. package/dist/pi.d.ts +2 -2
  41. package/dist/pi.js +2 -2
  42. package/dist/question-dialog.d.ts +2 -2
  43. package/dist/question-dialog.js +10 -6
  44. package/dist/regenerate/agent-env.js +5 -1
  45. package/dist/terminal-notifications.d.ts +8 -2
  46. package/dist/terminal-notifications.js +45 -15
  47. package/docs/capture.md +31 -11
  48. package/docs/chats.md +3 -1
  49. package/docs/config.md +4 -3
  50. package/docs/sandbox.md +2 -0
  51. package/docs/sentinel.md +1 -1
  52. package/genome/capture/check-reference.md +1 -0
  53. package/genome/capture/modules.md +2 -0
  54. package/genome/capture/python-interface.py +111 -0
  55. package/genome/capture/runners/python-requirements.sh +67 -0
  56. package/genome/capture/survey.md +2 -0
  57. package/genome/capture/trial.md +1 -1
  58. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { Container, SelectList, Text } from "@earendil-works/pi-tui";
1
+ import { Container, SelectList, Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
2
2
  import { QuestionDialog } from "./question-dialog.js";
3
3
  export class TerminalNotifications {
4
4
  items = [];
@@ -9,8 +9,8 @@ export class TerminalNotifications {
9
9
  needsAnswer(item) {
10
10
  return item.notice?.state === "open" && item.notice.kind !== "fixed";
11
11
  }
12
- add(title, detail, notice) {
13
- this.items.unshift({ title, detail, seen: false, notice });
12
+ add(title, detail, options = {}) {
13
+ this.items.unshift({ title, detail, seen: false, ...options });
14
14
  }
15
15
  /** Only the sentinel's review shares a row. The pulse result and the question whether to start it are independent. */
16
16
  review(about, title) {
@@ -30,8 +30,10 @@ export class TerminalNotifications {
30
30
  const title = [heading, about, notice.summary].filter(Boolean).join(" · ");
31
31
  const detail = notice.evidence.join("\n\n");
32
32
  if (notice.kind === "sentinel-start")
33
- return this.add(title, detail, notice);
33
+ return this.add(title, detail, { notice });
34
34
  const item = this.review(work ?? notice, title);
35
+ if (!item.conclusion)
36
+ item.warning = notice.severity !== "info";
35
37
  Object.assign(item, { title, detail, notice, seen: false });
36
38
  }
37
39
  concluded(result) {
@@ -39,13 +41,41 @@ export class TerminalNotifications {
39
41
  const verdict = result.verdict === "holds" ? "it holds" : result.verdict === "wrong" ? "found something wrong" : "not checked";
40
42
  const item = this.review(result, ["Sentinel", result.module, what, verdict].filter(Boolean).join(" · "));
41
43
  item.conclusion = `${verdict}: ${result.summary}`;
44
+ item.warning = result.verdict !== "holds";
42
45
  }
43
46
  }
44
- /** The notifications tab. Opening or leaving a detail never answers its notice. Only an explicit choice does. */
45
47
  export function notificationView(session, style, leave) {
46
48
  const inbox = session.notifications;
47
49
  const { accent, muted } = style;
48
50
  const listBox = new Container();
51
+ const markRead = () => {
52
+ for (const item of inbox.items)
53
+ item.seen = true;
54
+ session.changed();
55
+ };
56
+ const readLabel = " mark all as read ";
57
+ let pressedRead = false;
58
+ const listHeader = {
59
+ render(width) {
60
+ const button = truncateToWidth(readLabel, width);
61
+ const room = width - visibleWidth(button);
62
+ const title = truncateToWidth("notifications", Math.max(0, room - 1), "");
63
+ return [style.bold(accent(title)) + " ".repeat(room - visibleWidth(title)) + style.button(button, false)];
64
+ },
65
+ handleMouse(event) {
66
+ if (event.button !== "left" || (event.type !== "press" && event.type !== "click"))
67
+ return;
68
+ const inside = event.x >= Math.max(0, event.width - visibleWidth(readLabel)) && event.x < event.width && event.y === 0;
69
+ const down = pressedRead;
70
+ pressedRead = event.type === "press" && inside;
71
+ if (!inside)
72
+ return;
73
+ if (event.type === "click" && down)
74
+ markRead();
75
+ return { handled: true };
76
+ },
77
+ invalidate() { },
78
+ };
49
79
  let list;
50
80
  let rows = [];
51
81
  let labels = [];
@@ -67,9 +97,9 @@ export function notificationView(session, style, leave) {
67
97
  const options = [...actions, ...(open && notice.ignorable ? [ignore] : []), ...(open && notice.kind === undefined ? [steer] : []), ...(open ? ["Dismiss"] : []), "Back"];
68
98
  const target = notice && session.chats().find((chat) => chat.id === notice.chat);
69
99
  detail = new QuestionDialog({
70
- question: steering ? "What should be done about it?" : "Notifications",
71
- context: [item.title, item.detail, item.conclusion, ...(open && notice.kind === undefined && target ? [`Accepted work goes to ${target.title}.`] : [])].filter(Boolean).join("\n\n"),
72
- ...(steering ? {} : { options, clickable: true }), rows: () => height,
100
+ question: steering ? "What should be done about it?" : "notifications",
101
+ context: [item.warning ? style.warning(item.title) : item.title, item.detail, item.conclusion, ...(open && notice.kind === undefined && target ? [`Accepted work goes to ${target.title}.`] : [])].filter(Boolean).join("\n\n"),
102
+ ...(steering ? {} : { options, choiceButton: style.button }), rows: () => height,
73
103
  style, requestRender: () => { },
74
104
  done(answer) {
75
105
  if (!answer || !notice || notice.state !== "open" || (!steering && answer === "Back"))
@@ -99,7 +129,10 @@ export function notificationView(session, style, leave) {
99
129
  if (detail)
100
130
  return detail.render(width);
101
131
  const next = inbox.items;
102
- const lines = next.map((item) => `${inbox.needsAnswer(item) ? "? " : item.seen ? " " : "• "}${item.notice && item.notice.state !== "open" ? `[${item.notice.state}] ` : ""}${item.title.replace(/\s+/g, " ")}`);
132
+ const lines = next.map((item) => {
133
+ const label = `${inbox.needsAnswer(item) ? "? " : item.seen ? " " : "• "}${item.notice && item.notice.state !== "open" ? `[${item.notice.state}] ` : ""}${item.title.replace(/\s+/g, " ")}`;
134
+ return item.warning ? style.warning(label) : label;
135
+ });
103
136
  const room = Math.max(1, available - 4);
104
137
  if (!list || room !== visible || next.length !== rows.length || next.some((item, i) => item !== rows[i] || lines[i] !== labels[i])) {
105
138
  // Keep the same item selected when a pulse finishes while the person is reading the list.
@@ -112,7 +145,7 @@ export function notificationView(session, style, leave) {
112
145
  list.onSelect = ({ value }) => show(rows[Number(value)]);
113
146
  list.onCancel = leave;
114
147
  listBox.clear();
115
- listBox.addChild(new Text(style.bold(accent("Notifications")), 0, 0));
148
+ listBox.addChild(listHeader);
116
149
  listBox.addChild(rows.length ? list : new Text("No notifications this session.", 0, 0));
117
150
  listBox.addChild(new Text(muted(rows.length ? "↑↓ select · enter open · r mark all read · esc back" : "esc back"), 0, 0));
118
151
  }
@@ -121,11 +154,8 @@ export function notificationView(session, style, leave) {
121
154
  handleInput(data) {
122
155
  if (detail)
123
156
  detail.handleInput(data);
124
- else if (data === "r") {
125
- for (const item of inbox.items)
126
- item.seen = true;
127
- session.changed();
128
- }
157
+ else if (data === "r")
158
+ markRead();
129
159
  else
130
160
  list?.handleInput(data);
131
161
  },
package/docs/capture.md CHANGED
@@ -10,7 +10,17 @@ turri capture ../other-app --harness-model anthropic/claude-opus-4-5 --coding-mo
10
10
 
11
11
  In the chat, `/capture [path]` does the same in the background. Only you start it: the chat can tell you about it, but cannot run it, since a capture turns conformance tests on in the project it writes (`src/capture/`).
12
12
 
13
- While it runs, the lines above the input show how far it is and what is left (`src/capture/progress.ts`):
13
+ The chat that started `/capture` keeps a trace you can scroll back through. Each milestone shows elapsed time and, once reported, the model cost so far. For example:
14
+
15
+ ```text
16
+ capture · 0s · compact capture: 10/64 source, test and contract files, 305/4000 lines, 0/24 mapped interface entries - within all three limits
17
+ capture · 1s · survey · plan: I’ll trace the calculator’s commands and check how its tests exercise them.
18
+ capture · 14s · $0.08 · survey: Both arithmetic commands reject invalid arguments before computing a result.
19
+ capture · 14s · $0.08 · surveyed: calc-cli
20
+ capture · 1m 12s · $0.42 · captured calc-cli in one pass: 3 functional specs
21
+ ```
22
+
23
+ Each agent, including a testing-script writer, opens with a **plan**: one sentence about what it will inspect, write or test. If it goes straight to a tool, the trace shows its assigned task instead. Each capture agent reports a concrete finding in its existing submission: what it discovered, corrected or could not verify. Once the harness accepts that submission, the finding appears by the agent's name alongside the progress lines. Testing-script writers describe what their scripts check. Neither the plan nor the finding needs a separate model call. These transcript entries do not start a chat turn or enter the chat model's context. While capture runs, the widget above the input shows finer detail, including what each agent is doing right now (`src/capture/progress.ts`):
14
24
 
15
25
  ```
16
26
  capture shorty ✓ survey ━ ✓ outline ━ ⠋ features ─ ○ concepts ─ ○ readability ─ ○ interface ─ ○ trial ─ ○ scripts phase 3 of 8
@@ -48,12 +58,16 @@ When it ends, turri asks whether to open the captured project. A chat works on t
48
58
 
49
59
  ## How capture scales
50
60
 
61
+ For Python libraries the interface reference also records statically declared package exports, import paths used in the original tests, callable signatures and fields of their result types. When Python 3 is available, a helper reads syntax trees without importing the project. Dynamic exports still need the agents' source check. These literal details belong in the linked reference, leaving the functional specs to describe behaviour. A survey that already found distinct concerns too large for a single module can hand that decision directly to the staged writers.
62
+
51
63
  Capture chooses a pipeline automatically, before the first model call. The CLI says which it chose and why; the report records the choice. It uses the map rather than asking an agent to estimate the work.
52
64
 
53
- - **Compact:** at most 12 source, test and contract files, **800 lines and 64 KiB combined**, and at most **12 mapped interface entries** outside tests. A lower `TURRI_CAPTURE_LEAF_LINES` also bounds the line count. Assets, docs and dependency lock files do not count. After the survey and interface reference, **one writer** reads the program and its tests and writes one module directly. There is no separate feature outline, writer per feature, module planner, concept reconciliation or readability pass. The conventions and reference still get checked, a fresh agent verifies the module against the code, and the scenarios are still tried on the original. Testing scripts and the parser check are the same on both paths.
54
- - **Staged:** larger or interface-heavy inputs are outlined by area, written by feature and checked by module. Areas split only when too large for one outliner; division runs only across multiple leaves, reconciliation only for conflicting definitions. Reference and trial work is batched and independent writers run up to `--parallel` at a time.
65
+ Size selects **staged** if **any one** of three counts exceeds its limit: **more than 64** source, test and contract files, **more than 4,000** lines across those files, or **more than 24** interface entries outside tests. Otherwise capture starts **compact**. A count exactly at its limit does not exceed it. Bytes, assets, docs and dependency lock files do not enter the decision.
55
66
 
56
- A short program need not be simple. A compact capture switches to staged if the survey finds multiple parts, the extracted interface exceeds the budget, or the writer cannot fit the behaviour and scenarios into one module of up to eight functional specs. A writer can ask to expand rather than omit behaviour; an invalid draft that still fails the normal checks after retries also expands. Capture reuses the survey, conventions and reference. The choice is saved with its checkpoints; captures started before compact mode resume on the staged path.
67
+ - **Compact:** after the survey and interface reference, **one writer** reads the program and its tests and writes one module directly. There is no separate feature outline, writer per feature, module planner, concept reconciliation or readability pass. The conventions and reference still get checked, a fresh agent verifies the module against the code, and the scenarios are still tried on the original. Testing scripts and the parser check are the same on both paths.
68
+ - **Staged:** the code is outlined by area, written by feature and checked by module. `TURRI_CAPTURE_LEAF_LINES` controls splitting within this pipeline. Division runs only across multiple leaves, reconciliation only for conflicting definitions. Reference and trial work is batched and independent writers run up to `--parallel` at a time.
69
+
70
+ A short program need not be simple. A compact capture checks the same three limits again using the discovered interface. Independently of size, it switches to staged if the survey finds multiple parts, or the writer cannot fit the behaviour and scenarios into one module of up to eight functional specs. A writer can ask to expand rather than omit behaviour; an invalid draft that still fails the normal checks after retries also expands. Capture reuses the survey, conventions and reference. The choice is saved with its checkpoints; captures started before compact mode resume on the staged path.
57
71
 
58
72
  ## How it works
59
73
 
@@ -87,7 +101,7 @@ Both pipelines share the map, survey, interface reference and final checks. The
87
101
  5. **The split.** An area of more than 6000 lines (`TURRI_CAPTURE_LEAF_LINES`) goes to an agent that splits it into smaller areas by what they do. Each smaller area that is still too large is split again, so depth grows only slowly with size. The harness puts the areas in the order of their code: an area whose files import another's comes after it. The modules are gathered by concern and put in the order their behaviour is built in once the features are written (step 10).
88
102
  6. **The outline.** An area that fits is outlined by one agent into features, in build order. Each feature is something a user can do, with the files where it is built. The agent sees the stack's templates too: infrastructure they settle - settings, logging, error bodies, middleware - is no feature, and is left out as settled by the stack, unless a user would notice the original does it differently.
89
103
  7. **The features divided.** Once every area of a part is outlined, one agent sees all its features, area by area, with what each is about and where it is built, and gives each behaviour to one feature. The outlines are made area by area from each area's own files, so the same behaviour can be outlined twice - an option parsed in one area and acted on in another, a message printed in a third - and written twice it reads twice, in different words, and contradicts itself. Each feature that stays gets a line of what it alone owns; a feature that is a slice of another's behaviour is merged into it, its files the other's, and not written. A part outlined as one area is not divided: one agent saw all of it. A division that never holds leaves each feature owning what it was outlined for.
90
- 8. **The features, side by side.** One agent per feature, up to `--parallel` (4) at once. Each is given the full text of the `stdlib/` templates its part is built on - the stack, its kind's `common`, its language's - as the default it never restates, the part's conventions, every feature of the part with what it owns, and the reference's entries in its feature's files, with what the map found there that the reference does not list: it captures what each piece its feature owns does, by its exact name, using the part's interface concept - what one takes, its choices, its default and its help left to the reference, said only where a behaviour turns on them and never otherwise - and never another feature's behaviour, even where its code or tests touch it. Each follows the feature's surfaces through the code, reads the original's tests of it, then writes:
104
+ 8. **The features, side by side.** One agent per feature, up to `--parallel` (8 by default) at once. Each is given the full text of the `stdlib/` templates its part is built on - the stack, its kind's `common`, its language's - as the default it never restates, the part's conventions, every feature of the part with what it owns, and the reference's entries in its feature's files, with what the map found there that the reference does not list: it captures what each piece its feature owns does, by its exact name, using the part's interface concept - what one takes, its choices, its default and its help left to the reference, said only where a behaviour turns on them and never otherwise - and never another feature's behaviour, even where its code or tests touch it. Each follows the feature's surfaces through the code, reads the original's tests of it, then writes:
91
105
  - at most 8 functional specs
92
106
  - the concepts they need beyond the part's
93
107
  - its scenarios, mimicking the original's black-box tests - a test that runs the software through its interface, in its own process or the test's - and spent where those are densest: a functional spec the original tests twenty ways gets several, error cases no larger share than the original gives them. Where the original has no test of a spec, it gets scenarios only when it can fail silently, can be read two ways, or is costly when wrong. A feature may have 8 scenarios, and one more for every 50 lines of the original's tests in its files, up to 30; its agent is shown those test files, their lines and their tests' names. Each scenario expects what the original does under the test reqs: output that is not a terminal unless they give one, a local server rather than the internet - never a unit test that mocks a library, recast.
@@ -98,7 +112,7 @@ Both pipelines share the map, survey, interface reference and final checks. The
98
112
  13. **The interface checked against the code.** For each module, an agent is given its \*\*\*plain - functional specs with their scenarios - the reference's entries in its features' files, and the options the \*\*\*plain names that the reference does not have, found mechanically, and checks every interface fact against the reference and the code that decides it: each option's names, value, choices and default; each route's method, path, fields and status codes; each message, format and exit code. It corrects what is wrong or left out, a functional spec's text or a scenario's, citing the code - over the readability pass, which never sees the code. A correction that never holds is not made.
99
113
  14. **The scenarios tried on the original** (`src/capture/trial.ts`, `genome/capture/trial.md`). Every agent before this one read the original and never ran it, so a scenario can expect a terminal its test will not give, a site on the internet, output wrapped at a width nobody set, or a message the original never prints. For each module, a copy of the original - the files the map has, so none of its installed dependencies, nor turri's own config files, and the lock files beside its manifests, so it installs what the original pins - is made under `.turri/capture/trial/<module>/`, and agents with a shell on it, 20 scenarios each, one after another, install the original there and run each scenario as its conformance test will: from outside, through its interface, under the part's test reqs and its stack's conformance template. Their shell is a coding agent's - the command check, a home, temporary folder and package caches of its own, the OS sandbox and the audit - fenced to the copy. Each scenario comes back `held`, with what was run and what the original answered; `corrected` to what the original does, keeping what it checks - a local server for a site on the internet, the option that forces colour where the test's output is no terminal; `removed`, when nothing outside can check it; or `untried`, with why, when the original would not run here - kept as written. A functional spec the original contradicts is corrected with its scenario, and what every test must set up for the original to act as the scenarios say - `COLUMNS`, a configuration folder of its own, an update check off - joins the part's test reqs. What only some scenarios need - a file one sends, a server answering one exact body, a pseudo-terminal for one prompt - is never a test req, which every conformance test of every module is written under: those scenarios are corrected to say it themselves, and a test req that names a scenario or a functional spec is sent back. The harness checks that every scenario has one result and that each held or corrected one says what was run. The copy is removed once the module's agents are done. An agent that never holds leaves its scenarios as written, and the report says so.
100
114
  15. **The files.** The modules, their scenarios, the interface references and the config are written, once.
101
- 16. **The testing scripts.** turri's own skills write each part's unit and conformance testing scripts for the \*\*\*plain just written - `implement-unit-testing-script` and `implement-conformance-testing-script` (`src/capture/scripts.ts`), side by side, on the coding model with its configured thinking. They run as the chat runs them in the background: nobody is asked, and a review gate that cannot be satisfied stands. So the captured project can be regenerated at once. A script that is not written does not stop the capture: the report says why, and which skill to ask for.
115
+ 16. **The testing scripts.** Capture first checks whether a reusable runner fits the surveyed setup. A single Python part with `requirements.txt` and ordinary pytest discovery can use the stock unit runner. Its external suite can use pytest or Bats, including a helper's build-folder and interpreter variables. For a standard installable `pyproject.toml` package, the pytest runner installs the staged package in its own venv so imports and console entry points work. It recognises the manifest's Black/isort/flake8/mypy toolset and `dev` extra. A custom invocation, installation or service setup still needs a writer. Reused scripts are copied into the project and named in its config without a model call. For each unmatched kind, `implement-unit-testing-script` or `implement-conformance-testing-script` writes the runner on the writing tier. The report says which runner was used, or why one could not be written.
102
116
  17. **The check and the report.** The parser checks every module.
103
117
 
104
118
  The harness checks every answer before keeping it, and sends it back with what is wrong, twice at most (`src/capture/checks.ts`). It checks:
@@ -128,6 +142,8 @@ Only a survey that never holds stops the capture, before anything is written.
128
142
 
129
143
  ## What it writes
130
144
 
145
+ When a captured program itself uses Liquid templates, literal tags and expressions in its examples are emitted as literal text. Markdown backticks alone do not prevent Liquid from evaluating them before the module is parsed. This applies to shared requirements, functional specs and their scenarios.
146
+
131
147
  ```
132
148
  my-app/
133
149
  ... the original - read only, never written
@@ -149,7 +165,8 @@ my-app/
149
165
  - **Concepts.** A concept stays in the module that defines it when only that module uses it. A concept used across modules goes to the part's import module, along with every concept its definition uses.
150
166
  - **The codebase is never written to.** Capture's agents only read it - read, grep, find, ls, and no shell - but for those that try the scenarios, which run the original in a copy of it, removed once they are done.
151
167
  - **Assets.** The assets are copied rather than linked, so the original can be deleted without breaking anything. `base-folder: assets` puts them in the first module's code before its first pulse, at the paths they had.
152
- - **The config.** The captured project's `config.turri.yaml` starts as the config in use where the capture was started - the chat's folder's, or the folder `turri capture` runs in (the nearest upwards that is a project's) - so the person's models, thinking, reviews, limits and every other setting they chose carry over (`src/capture/config.ts`). It is written as the capture starts and its agents use [these models](#models). What belonged to the original project alone is left out - `module`, the testing scripts, `base-folder`, `test-dir` - since the capture writes its own; then `conformance-tests: true`, and the models given for it where they differ: in the chat, its model and thinking of the moment, and the coding model turri was started with; on the command line, `--harness-model` and `--coding-model`. With no config in use, it holds those alone. A config in use that does not parse refuses the capture, and nothing is written ([a config that does not parse](config.md#a-config-that-does-not-parse)).
168
+ - **The config.** Capture inherits `config.turri.yaml` from the project in which the chat or `turri capture` was started. That keeps the person's models, thinking, reviews and limits. With no config to inherit, capture writes the full `turri init-config` template. A named harness model selects its vendor's pair: for example, a global Bedrock Claude harness gets Haiku low for coding. `--coding-model` overrides that choice. A custom provider with no preset keeps its named model. The capture agents use their [own three tiers](#models).
169
+ - **Capture-specific settings.** Capture turns on `conformance-tests` and wires up the captured project's own unit and conformance runners. The original project's script paths, `module`, `base-folder` and `test-dir` do not carry over. In the chat, the current chat model and thinking and any coding model given at startup take precedence; on the command line, `--harness-model` and `--coding-model` do. A config that does not parse stops capture before anything is written ([details](config.md#a-config-that-does-not-parse)).
153
170
 
154
171
  ## The report
155
172
 
@@ -185,17 +202,20 @@ Its first lines are the summary the command line and the chat show. In the chat,
185
202
 
186
203
  | Role | Work | Default |
187
204
  | --- | --- | --- |
188
- | `capture-analysis` | Extract and check the interface reference; split areas, outline features and divide ownership on the staged path. | The coding model (`--coding-model` on the CLI), thinking **low**, even if coding itself uses high thinking. Without a separate coding model, the harness model thinks low. |
189
- | `capture` | Write or correct \*\*\*plain. This includes the survey, conventions, compact or feature writers, module gathering, verification and scenario trials, which can correct a spec or scenario. | The chat's model, or `--harness-model` / the project's harness model on the CLI; pi's choice when none is set. Thinking is **medium** unless a level is named. |
205
+ | `capture-exploration` | Gather facts from source for the public interface reference. | **Haiku, low** |
206
+ | `capture-analysis` | Check conventions, reference entries and the module's interface against the code, split and outline areas, divide features, and try draft scenarios against the original. | **Sonnet, low** |
207
+ | `capture` | Reason about the stack and requirements, write the specs, organise modules, reconcile concepts, revise the text and write custom testing scripts. | **Opus, medium** |
190
208
 
191
- For example, to use Sonnet for analysis without changing chat, coding or testing-script models, set this in `config.turri.yaml`:
209
+ `init-config` writes all three entries as active configuration. For example, with Anthropic:
192
210
 
193
211
  ```yaml
194
212
  models:
213
+ capture-exploration: anthropic/claude-haiku-5-5:low
195
214
  capture-analysis: anthropic/claude-sonnet-5-5:low
215
+ capture: anthropic/claude-opus-5-5:medium
196
216
  ```
197
217
 
198
- An explicit `models.capture` setting still applies to both roles. Each model, thinking or turn-limit field set under `models.capture-analysis` overrides that field for analysis only. Capture turns have ten minutes unless a role, `models.default` or `turn-limit` sets a limit; scenario trials get at least thirty minutes unless the limit is off.
218
+ The three entries are independent, each overriding its tier's default. Headless capture resolves the same defaults without needing `init-config`; a Bedrock Claude harness uses its inference geography. A non-Claude harness keeps its configured provider models: coding for exploration and analysis, harness for writing. Capture prints the resolved models at startup, and each agent's elapsed time and cost at completion. Capture turns have ten minutes unless a role, `models.default` or `turn-limit` sets a limit; scenario trials get at least thirty minutes unless the limit is off.
199
219
 
200
220
  `--harness-model` and `--coding-model` are also written into the new project's config, for the chat and the regeneration that follow.
201
221
 
package/docs/chats.md CHANGED
@@ -35,7 +35,9 @@ Each finished pulse appears in the session's notifications. When the [sentinel](
35
35
  | `/resume` | a saved chat, opened as a chat of its own beside the others - or shown, when it is open |
36
36
  | `ctrl+c` | what the chat shown is doing, stopped - its turn, a skill or a tool in it, a `!` command, a compaction; in a chat doing nothing, a draft in the editor cleared, else turri left, every chat with it |
37
37
 
38
- The chat tabs sit just below the banner's horizontal rule. When the banner scrolls away, the tabs stay at the top of the fullscreen terminal. A fresh session starts with one tab and a `+` button. Click `+` to open a chat, a tab's title to switch to it, or its `×` to close it. The active tab has the accent fill and a `▸` marker when there is room. Moving the pointer over a control highlights and underlines that target, including the close button independently of its tab. Each tab shows its number and title - "new chat" until the first message, unless `/name` gives it a name - and a spinner while it works, `?` while a question waits, or `•` when it said something since you last looked. In `--tui-mode regular` the tabs scroll with the terminal; use the commands or keys to switch.
38
+ The welcome banner appears only in the first tab. Typing or pasting a draft leaves it visible. Submitting a non-empty message or slash command, including `/regenerate`, hides it for the rest of the session. After that, and in new chats, only the tab row remains above the conversation.
39
+
40
+ When the tabs scroll away, they stay at the top of the fullscreen terminal. A fresh session starts with one tab and a `+` button. Click `+` to open a chat, a tab's title to switch to it, or its `×` to close it. The active tab has the accent fill and a `▸` marker when there is room. Moving the pointer over a control highlights and underlines that target, including the close button independently of its tab. Each tab shows its number and title - "new chat" until the first message, unless `/name` gives it a name - and a spinner while it works, `?` while a question waits, or `•` when it said something since you last looked. In `--tui-mode regular` the tabs scroll with the terminal; use the commands or keys to switch.
39
41
 
40
42
  A message you send while a chat's agent works is shown under the chat at once, shaded and marked `not read yet`, and stays under what the agent writes and the tools it calls until the agent reads it - at the end of its current step - when it goes into the chat as a normal message, where it was read. `alt+up` takes the messages waiting back into the editor (`src/chat-waiting.ts`). While a skill runs in the chat its own agent is the one at work, and the chat's waits for the whole run: what you type then goes to the skill's agent, shown waiting until it reads it, at the end of its current step - and is in the chat from then, where it was read. The chat's agent is told what you said to the skill when the run ends. A message the skill's agent has not read when the run ends goes to the chat's agent instead.
41
43
 
package/docs/config.md CHANGED
@@ -18,7 +18,7 @@ Amazon Bedrock asks three more things, from [pi](https://pi.dev)'s catalogue: wh
18
18
 
19
19
  `--harness-model` and `--coding-model` name the two models instead, for any vendor: provider/model-id without a thinking level - `turri init-config --harness-model amazon-bedrock/global.xai.grok-4.7 --coding-model amazon-bedrock/global.xai.grok-4.6`. They are written wherever the vendor's own would be - the two models with their thinking, the commented-out `judge-model` and `models:` examples - and the vendor, maker and geography are read from them. `--judge-model` names the strong one the judging examples use, the harness model unless given. Each is checked against [pi](https://pi.dev)'s catalogue first: one it does not have, or that is not a chat model, is named, with the closest it has, and nothing is written.
20
20
 
21
- Each is written with how hard it thinks - `harness-model: openai/gpt-6-astra:medium`, `coding-model: openai/gpt-6-luna:low` - so the file shows it. The reviews and judges run on the coding model but think medium (see [models per role](#models-per-role)).
21
+ Each is written with how hard it thinks - `harness-model: openai/gpt-6-astra:medium`, `coding-model: openai/gpt-6-luna:low` - so the file shows it. `init-config` also writes and prints the three active capture tiers. On an existing config it fills in missing capture entries and preserves explicit overrides. The reviews and judges of a regeneration run on the coding model but think medium (see [models per role](#models-per-role)).
22
22
 
23
23
  They are an example, not a requirement - any model [pi](https://pi.dev) supports works, signed in any way [pi](https://pi.dev) supports; `other` is the starting point for another provider. What we recommend is that split, a capable model to talk to and a smaller, cheaper one for the coding. Once written, it says what to do next: the key to set in your shell - or `/login` in turri, which [pi](https://pi.dev) keeps in `~/.pi/agent/auth.json` - and that the file belongs to that folder: turri reads the nearest `config.turri.yaml` upwards from where it starts, so one written anywhere else is not seen.
24
24
 
@@ -139,8 +139,9 @@ Keys are written with dashes; underscores are read the same (`mutation_testing`)
139
139
  | `chat` | `turri`'s model - the same as `harness-model`, which it wins over |
140
140
  | `sentinel` | [the sentinel](sentinel.md): checks every finished pulse, and tests what was launched. Unnamed, the chat's model |
141
141
  | `planner` | the conversation's side: the planner's agents. Unnamed, the chat's model |
142
- | `capture` | the agents of [a capture](capture.md): they write \*\*\*plain from an existing codebase. Unnamed, the chat's model - `--harness-model` under `turri capture`. A turn may take ten minutes unless its entry, `default`'s or `turn-limit:` says otherwise - one trying the scenarios on the original at least thirty, unless the limit is off |
143
- | `capture-analysis` | extracts and checks a capture's interface reference, splits areas, outlines features and divides ownership. Takes any fields explicitly set in `models.capture` unless overridden here; otherwise uses the coding model with low thinking and the same turn limit as capture |
142
+ | `capture-exploration` | gathers the interface reference from the original code. Claude default: Haiku low |
143
+ | `capture-analysis` | checks evidence and conventions, outlines areas and features, and trials scenarios on the original. Claude default: Sonnet low |
144
+ | `capture` | reasons about requirements, writes and revises \*\*\*plain and writes custom runners. Claude default: Opus medium. `init-config` writes all three active [capture tiers](capture.md#models); setting one does not change the others |
144
145
  | `diagnosis` | the diagnosis of a job that failed for good: why it did not land, and what to do. Unnamed, the coding model the job ran on, thinking medium |
145
146
  | `launch` | the launch agent - the chat's `launch`, `turri launch` and launch-after-pulse's: it follows steps - a script, a start command - so it runs on the coding model, thinking low |
146
147
  | `coding` | the coding agent, the code fixer of a conformance run and the repair agent - the same as `coding-model`, which it wins over. `--model` on the command line, or a model a call to `regenerate` or `conform` names, wins over both |
package/docs/sandbox.md CHANGED
@@ -4,6 +4,8 @@ A regenerating agent is building one module. It has no business reading \*\*\*pl
4
4
 
5
5
  ## What an agent can reach
6
6
 
7
+ The agent's `PATH` omits the launching shell's Python virtual environments. A venv's `bin` (or Windows `Scripts`) alone is not a usable interpreter without its neighbouring `pyvenv.cfg` and packages. Commands use the next installed Python and can create a venv inside their own workspace. No additional host directory needs to be opened to trial a Python project.
8
+
7
9
  Each agent's file tools reach its own module and only the parts its role needs:
8
10
 
9
11
  | Role | Reads | Writes |
package/docs/sentinel.md CHANGED
@@ -19,7 +19,7 @@ Finished pulses appear in notifications immediately. Their reviews wait until yo
19
19
 
20
20
  ## What you see
21
21
 
22
- - **Notifications** is shared by all chats in the terminal session. Each finished pulse has a completion entry, even with the sentinel off. Each sentinel review has one entry: its conclusion is added to the finding or fix, alongside the evidence and actions. A conclusion does not reopen a dismissed notice or mark it unread again. The count beside `***plain` and on the notifications tab includes unread items and notices waiting for an answer. Open an item for its details; `r` in the list marks everything read without answering anything.
22
+ - The **notifications** tab is shared by all chats in the terminal session. Each finished pulse has a completion entry, even with the sentinel off. Each sentinel review has one entry: its conclusion is added to the finding or fix, alongside the evidence and actions. A conclusion does not reopen a dismissed notice or mark it unread again. Failed pulses, builds that did not pass, and reviews that found a problem or could not be checked use the warning colour (orange in the turri themes). Open an entry to see the details; **Back** returns to the list. The **mark all as read** button (`r`) clears unread marks without answering or dismissing notices. The count beside `***plain` and on the notifications tab still includes notices waiting for an answer.
23
23
  - **The sentinel** opens with the first pulse that finishes - once you said to start it, under `sentinel: ask` - in the background: it never takes the screen, and you stay in your chat. It is a tab in the strip like any other chat - `sentinel` - marked while it works and when it has something new. Switch to it to read what it checked: it shows the pulse it is on, or the last one it checked - each pulse has a conversation of its own (below).
24
24
  - **A notice**, when something needs you: open its `?` entry in notifications to read what is wrong, the evidence and the choices:
25
25
  - `enter` on an action accepts it: the chat's agent is started on it - a change to the \*\*\*plain, a pulse regenerated again, a credential to provide, a setting to change;
@@ -7,5 +7,6 @@ Below is part of the software's interface reference as an agent took it from the
7
7
  - **Its default, what it takes, whether it repeats, is required or is hidden** - as the code has them; a default worked out when it runs, in its details, saying how.
8
8
  - **Before you say what a set, a list or a mapping holds,** grep every line that builds it or adds to it - a set defined in one place is often added to in another, a mapping filtered further down - and read each. Correct an entry only where the code shows it wrong, and say the file and the line that show it.
9
9
  - **What was missed:** grep the part for interface no entry holds - environment variables read through a constant or a helper, subcommands, arguments, routes a router adds - and add each.
10
+ - **Which command owns an option:** shared arguments belong to each actual command. Do not invent a command named `a, b`. Keep usage failures, configuration failures and domain failures distinct, even when the CLI catches them in the same file.
10
11
 
11
12
  Call `submit_capture_reference_checked` once, with every entry as the code has it - each that holds, word for word; each corrected; each missed - and every exclusion; and in `changes` what you changed, a line each, with why: the file and the line, and what its code does there. Never change one that holds.
@@ -21,3 +21,5 @@ The areas are in the order of the code's imports, which is not that order: the c
21
21
  - `rewrites`: a scenario that needs a module after its own whatever the order - two modules whose scenarios each need the other - is rewritten so it checks what it checks with only the modules before it: a scenario of output formatting that follows a redirect checks the formatting of a plain response instead. Its feature's key, its functional spec's func-id, its scenario's id, its whole new text, and `why`: the later module it needed. None when none: most orders need no rewrite. Never merge two modules to spare a rewrite.
22
22
 
23
23
  You see the ***plain, not the code: decide from what each feature does and what its scenarios run.
24
+
25
+ Prefer the order that preserves the original observations. In particular, a test of the effect of an option must not become a test that the option is merely accepted. A test of one named failure must not become a test of a different failure that happens to share its exit code. Put the consumer after the features needed to demonstrate the original outcome. When choosing between a neat ordering and an exact observable contract, keep the contract.
@@ -0,0 +1,111 @@
1
+ """Static Python package interface. Read only the mapped files on stdin; never import the project."""
2
+ import ast
3
+ import json
4
+ import pathlib
5
+ import sys
6
+
7
+
8
+ def public_reference(root, paths):
9
+ modules, files, exports, decls, aliases = {}, {}, {}, {}, {}
10
+ for path in paths:
11
+ p = pathlib.PurePosixPath(path)
12
+ if p.suffix != '.py' or any(x.startswith('.') or x == '__pycache__' for x in p.parts):
13
+ continue
14
+ try:
15
+ raw = (root / p).read_bytes()
16
+ if len(raw) > 512 * 1024:
17
+ continue
18
+ tree = ast.parse(raw)
19
+ except (OSError, SyntaxError, ValueError, RecursionError):
20
+ continue
21
+ files[path] = tree
22
+ for path, tree in files.items():
23
+ p = pathlib.PurePosixPath(path)
24
+ parts = [] if p.stem == '__init__' else [p.stem]
25
+ folder = p.parent
26
+ while str(folder / '__init__.py') in files:
27
+ parts.insert(0, folder.name)
28
+ folder = folder.parent
29
+ if not parts or (len(parts) == 1 and p.stem != '__init__'):
30
+ continue
31
+ mod = '.'.join(parts)
32
+ modules[mod] = path
33
+ for node in tree.body:
34
+ if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == '__all__' for t in node.targets) and isinstance(node.value, (ast.List, ast.Tuple)):
35
+ exports[mod] = [x.value for x in node.value.elts if isinstance(x, ast.Constant) and isinstance(x.value, str)]
36
+ if isinstance(node, ast.ImportFrom):
37
+ package = mod if p.stem == '__init__' else mod.rpartition('.')[0]
38
+ prefix = (package.split('.')[:len(package.split('.')) - node.level + 1] if node.level else []) + ([node.module] if node.module else [])
39
+ for a in node.names:
40
+ aliases[mod + '.' + (a.asname or a.name)] = '.'.join([*prefix, a.name])
41
+ if isinstance(node, (ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)):
42
+ decls[mod + '.' + node.name] = node
43
+ package_api = {mod + '.' + name for mod, names in exports.items() for name in names}
44
+ # Public uses in the original's own tests are evidence too. test_*.py may itself be an installed API module.
45
+ for path, tree in files.items():
46
+ dirs = pathlib.PurePosixPath(path).parts[:-1]
47
+ if not (any(x in {'tests', 'ext_tests', 'test'} for x in dirs) or (path not in modules.values() and pathlib.PurePosixPath(path).name.startswith('test_'))):
48
+ continue
49
+ imports = {}
50
+ for n in ast.walk(tree):
51
+ if isinstance(n, ast.ImportFrom) and n.module in modules:
52
+ for a in n.names:
53
+ qualified = n.module + '.' + a.name
54
+ if a.name != '*' and not a.name.startswith('_'):
55
+ imports[a.asname or a.name] = qualified
56
+ package_api.add(qualified)
57
+ if isinstance(n, ast.Import):
58
+ for a in n.names:
59
+ if a.name in modules:
60
+ imports[a.asname or a.name.split('.')[0]] = a.name if a.asname else a.name.split('.')[0]
61
+ for n in ast.walk(tree):
62
+ if isinstance(n, ast.Attribute) and isinstance(n.value, ast.Name) and n.value.id in imports and not n.attr.startswith('_'):
63
+ name = imports[n.value.id] + '.' + n.attr
64
+ if name in decls or name in modules or name in aliases:
65
+ package_api.add(name)
66
+ # Exception types in an explicitly exported module are public, including ones looked up dynamically.
67
+ for name, node in decls.items():
68
+ if isinstance(node, ast.ClassDef) and name.rpartition('.')[0] in package_api and any(ast.unparse(b).endswith(('Exception', 'Error')) for b in node.bases):
69
+ package_api.add(name)
70
+ # Record shapes reached via the public signatures matter to callers just as much as their function names.
71
+ pending = list(package_api)
72
+ while pending:
73
+ name = pending.pop()
74
+ target = aliases.get(name, name)
75
+ node = decls.get(target)
76
+ annotations = ([node.returns] if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) else [n.annotation for n in node.body if isinstance(n, ast.AnnAssign)] if isinstance(node, ast.ClassDef) else [])
77
+ for a in annotations:
78
+ for token in ast.walk(a) if a else []:
79
+ if not isinstance(token, (ast.Name, ast.Attribute)):
80
+ continue
81
+ first, _, rest = ast.unparse(token).partition('.')
82
+ local = target.rpartition('.')[0] + '.' + first
83
+ typ = aliases.get(local, local) + ('.' + rest if rest else '')
84
+ if typ not in package_api and isinstance(decls.get(typ), ast.ClassDef):
85
+ package_api.add(typ); pending.append(typ)
86
+ rows = []
87
+ for name in sorted(package_api):
88
+ target, seen = name, set()
89
+ while target in aliases and target not in seen:
90
+ seen.add(target); target = aliases[target]
91
+ node = decls.get(target)
92
+ if isinstance(node, ast.ClassDef):
93
+ bases = ', '.join(ast.unparse(b) for b in node.bases)
94
+ declaration = 'class ' + name + ('(' + bases + ')' if bases else '')
95
+ fields = [n.target.id + ': ' + ast.unparse(n.annotation) for n in node.body if isinstance(n, ast.AnnAssign) and isinstance(n.target, ast.Name) and not n.target.id.startswith('_')]
96
+ if fields:
97
+ declaration += ' - fields: ' + ', '.join(fields)
98
+ rows.append(declaration)
99
+ for method in node.body:
100
+ if isinstance(method, (ast.FunctionDef, ast.AsyncFunctionDef)) and not method.name.startswith('_'):
101
+ prop = any(isinstance(d, ast.Name) and d.id == 'property' for d in method.decorator_list)
102
+ rows.append(f'{name}.{method.name}' + (' (property)' if prop else '(' + ast.unparse(method.args) + ')') + (' -> ' + ast.unparse(method.returns) if method.returns else ''))
103
+ elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
104
+ rows.append(f'{name}({ast.unparse(node.args)})' + (' -> ' + ast.unparse(node.returns) if node.returns else ''))
105
+ else:
106
+ rows.append(name)
107
+ return '\n'.join('- `' + row + '`' for row in rows)
108
+
109
+
110
+ if __name__ == '__main__':
111
+ sys.stdout.write(public_reference(pathlib.Path.cwd(), json.load(sys.stdin)))
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ # Self-contained runner for a Python project run from its root. Inputs are read-only.
3
+ set -eu -o pipefail
4
+ mode='@MODE@'; build_var='@BUILD_VAR@'; python_var='@PYTHON_VAR@'
5
+ if [[ $mode == unit ]]; then [[ $# == 1 ]] || exit 1; else [[ $# == 2 ]] || exit 69; fi
6
+ src=$(cd "$1" && pwd) || exit 2
7
+ if [[ $mode != unit ]]; then
8
+ tests=$(cd "$2" && pwd) || exit 2
9
+ misplaced=$(grep -rlE --exclude='.turri*' --exclude-dir=.venv --exclude-dir=.git '(conformance tests|(conformance|acceptance) scenario [a-z0-9-]+) of [^[:space:]:]+:[a-z0-9-]+' "$src" || true
10
+ find "$src" -type f \( -ipath '*conformance*' -o -ipath '*acceptance*' \) -iname '*test*' ! -name '.turri*')
11
+ if [[ -n $misplaced ]]; then echo "Conformance tests belong in $tests, not the build: $misplaced"; exit 1; fi
12
+ fi
13
+ work=$(mktemp -d "${TMPDIR:-/tmp}/turri-tests.XXXXXXXX") || exit 2
14
+ trap 'rm -rf "$work"' EXIT
15
+ mkdir -p "$work/build" "$work/tmp"
16
+ tar -C "$src" --exclude=.git --exclude=.venv --exclude=__pycache__ -cf - . | tar -C "$work/build" -xf - || exit 2
17
+ cd "$work/build"
18
+ export TMPDIR="$work/tmp" PYTHONDONTWRITEBYTECODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1
19
+ unset PYTHONPATH PYTHONHOME
20
+ for py in python3 python; do "$py" -c 'import sys; assert sys.version_info.major == 3' 2>/dev/null && break; done
21
+ "$py" -m venv "$work/venv" || { echo 'Python 3 with venv is required'; exit 69; }
22
+ bin="$work/venv/bin"; [[ -d "$bin" ]] || bin="$work/venv/Scripts"
23
+ export PATH="$bin:$PATH"
24
+ if [[ '@INSTALL@' == package ]]; then
25
+ "$bin/python" -m pip install --cache-dir "$work/pip" '@EXTRA@' || exit $?
26
+ else
27
+ "$bin/python" -m pip install --cache-dir "$work/pip" -r requirements.txt || exit $?
28
+ fi
29
+ [[ -z $build_var ]] || export "$build_var=$PWD"
30
+ [[ -z $python_var ]] || export "$python_var=$bin/python"
31
+ checks=0
32
+ if [[ $mode == bats ]]; then
33
+ if ! command -v bats >/dev/null; then
34
+ git clone -q --depth 1 --branch v1.12.0 https://github.com/bats-core/bats-core.git "$work/bats" || exit 69
35
+ export PATH="$work/bats/bin:$PATH"
36
+ fi
37
+ # Bats preprocessing checks the suite's shell syntax. Count first: zero tests must never pass.
38
+ count=$(bats --recursive --count "$tests") || exit 1
39
+ [[ $count =~ ^[1-9][0-9]*$ ]] || { echo 'No Bats tests discovered'; exit 1; }
40
+ bats --recursive --formatter tap "$tests"
41
+ else
42
+ if [[ '@CHECKS@' == black ]]; then
43
+ "$bin/python" -m pip install --cache-dir "$work/pip" pytest black isort flake8 mypy || exit $?
44
+ target=.; [[ $mode == unit ]] || target=$tests
45
+ "$bin/python" -m black --check --config pyproject.toml "$target" || checks=80
46
+ "$bin/python" -m isort --check-only --settings-path pyproject.toml "$target" || checks=80
47
+ "$bin/python" -m flake8 --isolated "$target" || checks=80
48
+ else
49
+ "$bin/python" -m pip install --cache-dir "$work/pip" pytest ruff mypy || exit $?
50
+ fi
51
+ if [[ $mode == unit ]]; then
52
+ if [[ '@CHECKS@' != black ]]; then
53
+ "$bin/python" -m ruff format --check . || checks=80
54
+ "$bin/python" -m ruff check . || checks=80
55
+ fi
56
+ "$bin/python" -m mypy . || checks=80
57
+ "$bin/python" -m pytest
58
+ else
59
+ if [[ '@CHECKS@' != black ]]; then
60
+ "$bin/python" -m ruff format --check --isolated --no-cache "$tests" || checks=80
61
+ "$bin/python" -m ruff check --isolated --no-cache "$tests" || checks=80
62
+ fi
63
+ "$bin/python" -m mypy --config-file= --disallow-untyped-defs --follow-imports=silent "$tests" || checks=80
64
+ "$bin/python" -m pytest -c /dev/null -p no:cacheprovider --basetemp="$work/pytest" "$tests"
65
+ fi
66
+ fi
67
+ exit "$checks"
@@ -12,6 +12,8 @@ A part is software on one stack: a backend, a frontend, a command-line tool, a l
12
12
 
13
13
  ## The stack
14
14
 
15
+ Select stock testing `runners` only where they match the part. Ordinary pytest can use a requirements.txt build or a standard pip-installable pyproject.toml package, including src layouts and installed console scripts. The runner installs the build in a fresh venv and runs pytest with the staged project as cwd (for conformance, only the supplied external tests). For conformance on a requirements.txt build, Bats is also available. Read any test helper for the exact environment variable names for the build folder and Python interpreter. Choose custom for any different checkers, services, flags or setup. Do not change the original's stack to make a stock runner fit.
16
+
15
17
  The parts are captured on the stack they are on now - the same language, framework, storage and main libraries, with their versions from the manifests.
16
18
 
17
19
  - `stdlib_stack`: turri's standard library has templates that settle a stack (the catalogue is below). Read the one that matches. Name it only when the original agrees with it - its framework, its layout, its libraries - since everything in it becomes a requirement. When it contradicts the original anywhere that matters, name none, and write the stack in `implementation_reqs` instead.
@@ -15,4 +15,4 @@ What every conformance test of the part must set up for the original to act as t
15
15
 
16
16
  The test reqs are read by whoever writes any conformance test of the part, for every scenario of every module. So what only some scenarios need - a file one sends, a session file one starts from, a server that answers one exact body, a pseudo-terminal for the one password prompt, a variable unset for one case - is never a test req: it goes in those scenarios' own text. Return each `corrected`, its text saying the setup it needs as part of what it does, and `why`: the setup it did not say. A test req names no scenario and no functional spec.
17
17
 
18
- You have a budget of tool calls: install once, then a command or two a scenario. Run several scenarios in one command where you can.
18
+ Run the smallest batch of actual commands that demonstrates all the scenarios, capturing stdout, stderr and exit status separately. A standard-library CLI you can run from its source tree needs no install: invoke it directly. A test framework is not needed to observe what its black-box tests observe. Do not spend a turn installing a framework just to launch the same command.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turri-dev/cli",
3
- "version": "0.4.3-next.3fc888b",
3
+ "version": "0.4.3-next.7ada234",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {