@turri-dev/cli 0.4.2 → 0.4.3-next.8482fed
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 +1 -0
- package/dist/background-skills.d.ts +4 -1
- package/dist/background-skills.js +9 -1
- package/dist/capture/agents.d.ts +361 -0
- package/dist/capture/agents.js +332 -0
- package/dist/capture/area.d.ts +58 -0
- package/dist/capture/area.js +197 -0
- package/dist/capture/assemble.d.ts +122 -0
- package/dist/capture/assemble.js +452 -0
- package/dist/capture/capture.d.ts +116 -0
- package/dist/capture/capture.js +1228 -0
- package/dist/capture/chat.d.ts +29 -0
- package/dist/capture/chat.js +94 -0
- package/dist/capture/checks.d.ts +142 -0
- package/dist/capture/checks.js +643 -0
- package/dist/capture/config.d.ts +13 -0
- package/dist/capture/config.js +60 -0
- package/dist/capture/interface.d.ts +71 -0
- package/dist/capture/interface.js +199 -0
- package/dist/capture/map.d.ts +56 -0
- package/dist/capture/map.js +530 -0
- package/dist/capture/progress.d.ts +108 -0
- package/dist/capture/progress.js +234 -0
- package/dist/capture/report.d.ts +75 -0
- package/dist/capture/report.js +267 -0
- package/dist/capture/scripts.d.ts +26 -0
- package/dist/capture/scripts.js +33 -0
- package/dist/capture/state.d.ts +296 -0
- package/dist/capture/state.js +43 -0
- package/dist/capture/trial.d.ts +34 -0
- package/dist/capture/trial.js +89 -0
- package/dist/capture-cli.d.ts +1 -0
- package/dist/capture-cli.js +77 -0
- package/dist/chat-commands.d.ts +2 -10
- package/dist/chat-commands.js +3 -57
- package/dist/chat-tab-header.d.ts +15 -0
- package/dist/chat-tab-header.js +78 -0
- package/dist/chat-tabs.d.ts +20 -0
- package/dist/chat-tabs.js +96 -0
- package/dist/chat-terminal.js +54 -8
- package/dist/chat-waiting.d.ts +4 -1
- package/dist/chat-waiting.js +7 -4
- package/dist/chats.d.ts +2 -0
- package/dist/cli.js +32 -14
- package/dist/config-edit.js +1 -0
- package/dist/config.d.ts +15 -2
- package/dist/config.js +57 -3
- package/dist/extension.js +140 -7
- package/dist/identity.js +2 -1
- package/dist/init-config.js +1 -0
- package/dist/loop-cli.js +5 -1
- package/dist/loop-tools.js +5 -1
- package/dist/new-project.d.ts +5 -0
- package/dist/new-project.js +11 -0
- package/dist/pi.js +2 -2
- package/dist/plain-code-blocks.d.ts +14 -0
- package/dist/plain-code-blocks.js +56 -0
- package/dist/pointer-hover.d.ts +12 -0
- package/dist/pointer-hover.js +44 -0
- package/dist/regenerate/command-check.js +80 -11
- package/dist/regenerate/jobs-tree.d.ts +1 -0
- package/dist/regenerate/jobs-tree.js +5 -1
- package/dist/regenerate/loop.js +9 -1
- package/dist/regenerate/side-panel.d.ts +4 -1
- package/dist/regenerate/side-panel.js +131 -22
- package/dist/regenerate/spec-map-view.d.ts +9 -1
- package/dist/regenerate/spec-map-view.js +22 -2
- package/dist/regenerate/test-scripts.d.ts +5 -0
- package/dist/regenerate/test-scripts.js +4 -0
- package/dist/reopen.d.ts +29 -0
- package/dist/reopen.js +47 -0
- package/dist/resume-line.d.ts +4 -1
- package/dist/resume-line.js +5 -2
- package/dist/setup.js +9 -1
- package/docs/README.md +2 -0
- package/docs/capture.md +191 -0
- package/docs/chats.md +6 -5
- package/docs/config.md +14 -2
- package/docs/development.md +4 -1
- package/docs/regenerating.md +1 -1
- package/docs/sandbox.md +2 -2
- package/docs/theming.md +2 -2
- package/docs/using.md +9 -1
- package/genome/capture/capture.md +26 -0
- package/genome/capture/check-conventions.md +5 -0
- package/genome/capture/check-reference.md +11 -0
- package/genome/capture/concepts.md +3 -0
- package/genome/capture/divide.md +9 -0
- package/genome/capture/feature.md +45 -0
- package/genome/capture/interface.md +9 -0
- package/genome/capture/modules.md +23 -0
- package/genome/capture/outline.md +11 -0
- package/genome/capture/readability.md +12 -0
- package/genome/capture/reference.md +10 -0
- package/genome/capture/split.md +9 -0
- package/genome/capture/survey.md +37 -0
- package/genome/capture/trial.md +18 -0
- package/genome/capture/verify.md +7 -0
- package/package.json +3 -3
|
@@ -170,6 +170,7 @@ export function jobsTreeLines(jobs, state, width, style) {
|
|
|
170
170
|
state.cursor = Math.max(0, Math.min(state.cursor, rows.length - 1));
|
|
171
171
|
const lines = [];
|
|
172
172
|
const rowStarts = [];
|
|
173
|
+
const labelHeights = [];
|
|
173
174
|
rows.forEach((row, index) => {
|
|
174
175
|
rowStarts.push(lines.length);
|
|
175
176
|
const here = index === state.cursor;
|
|
@@ -182,12 +183,14 @@ export function jobsTreeLines(jobs, state, width, style) {
|
|
|
182
183
|
}
|
|
183
184
|
const header = `${pointer} ${state.open[row.section] ? "▾" : "▸"} ${SECTION_NAMES[row.section]} (${row.count})`;
|
|
184
185
|
lines.push(here ? style.heading(header) : style.muted(header));
|
|
186
|
+
labelHeights.push(1);
|
|
185
187
|
return;
|
|
186
188
|
}
|
|
187
189
|
if (row.kind === "file") {
|
|
188
190
|
const open = isFileOpen(state, row);
|
|
189
191
|
const paint = style.diff ?? { ...PLAIN_PAINT, added: style.added, removed: style.removed, muted: style.muted };
|
|
190
192
|
const shown = diffFiles(row.job.diff, Math.max(10, width - FILE_INDENT.length), paint, row.job.diffWhere).find((file) => file.file === row.file);
|
|
193
|
+
labelHeights.push(shown === undefined ? 0 : 1);
|
|
191
194
|
if (shown === undefined)
|
|
192
195
|
return;
|
|
193
196
|
const header = `${pointer}${FILE_INDENT.slice(1)}${fileHeader(shown, paint, open)}`;
|
|
@@ -204,6 +207,7 @@ export function jobsTreeLines(jobs, state, width, style) {
|
|
|
204
207
|
const head = `${pointer} ${open ? "▾" : "▸"} ${markOf(job, style)} ${pulseName(job)}${time}${pulseCost(job)}`;
|
|
205
208
|
const [first = "", ...rest] = wrapTextWithAnsi(head, Math.max(10, width));
|
|
206
209
|
lines.push(here ? style.heading(first) : first, ...rest.map((line) => ` ${line}`));
|
|
210
|
+
labelHeights.push(1 + rest.length);
|
|
207
211
|
if (open)
|
|
208
212
|
lines.push(...detailLines(job, jobs, width, style));
|
|
209
213
|
});
|
|
@@ -211,7 +215,7 @@ export function jobsTreeLines(jobs, state, width, style) {
|
|
|
211
215
|
if (state.open.earlier && (state.earlierMore ?? 0) > 0) {
|
|
212
216
|
lines.push(style.muted(` ${state.earlierMore} earlier run${state.earlierMore === 1 ? "" : "s"} in the ledger - pulses with runs lists them`));
|
|
213
217
|
}
|
|
214
|
-
return { lines, rowStarts, rows };
|
|
218
|
+
return { lines, rowStarts, labelHeights, rows };
|
|
215
219
|
}
|
|
216
220
|
/** How far a job's files, and their lines, are indented under it. */
|
|
217
221
|
const FILE_INDENT = " ";
|
package/dist/regenerate/loop.js
CHANGED
|
@@ -1151,7 +1151,8 @@ export function createWorkLoop(options) {
|
|
|
1151
1151
|
const own = (jobs) => (jobs ?? []).filter((job) => job !== running);
|
|
1152
1152
|
// A track being planned again shows as that, not as its plan before - and a module asked for, from that moment, as
|
|
1153
1153
|
// its code being planned: its code deleted, what is left worked out, before the planner runs.
|
|
1154
|
-
|
|
1154
|
+
// One waiting for a module below it is shown waiting, asked for or not: nothing plans it until that one is built.
|
|
1155
|
+
const planningTrack = state.running === undefined ? (state.planning ?? (preparing.has(tipEntry(state).moduleName) && state.waitsFor === undefined ? "code" : undefined)) : undefined;
|
|
1155
1156
|
const replanning = planningTrack;
|
|
1156
1157
|
const jobs = [
|
|
1157
1158
|
...(running !== undefined ? [running] : []),
|
|
@@ -1267,6 +1268,13 @@ export function createWorkLoop(options) {
|
|
|
1267
1268
|
state.lookedAhead = undefined;
|
|
1268
1269
|
// Asked for again: its conformance tests are written for every functional spec with scenarios, not only those conform named.
|
|
1269
1270
|
state.conformanceOnly = undefined;
|
|
1271
|
+
// A module below it not built at all: it waits for that one, said at once - the looks go bottom first, each the
|
|
1272
|
+
// planner's time, and until its own it would show as being planned. Its look says it again, or moves it on.
|
|
1273
|
+
const below = state.running === undefined ? state.chain.slice(0, -1).find((entry) => modules.has(entry.buildDir) && !started(entry)) : undefined;
|
|
1274
|
+
if (below !== undefined && state.waitsFor === undefined) {
|
|
1275
|
+
state.waitsFor = below.moduleName;
|
|
1276
|
+
state.why = `waiting for ${below.moduleName}: the code it is built on is not built yet`;
|
|
1277
|
+
}
|
|
1270
1278
|
}
|
|
1271
1279
|
await tick();
|
|
1272
1280
|
return [...new Set(states)].map(statusOf);
|
|
@@ -4,6 +4,7 @@ import { type JobsTreeState } from "./jobs-tree.ts";
|
|
|
4
4
|
import type { MarkedPage } from "./spec-map.ts";
|
|
5
5
|
import { type SpecMapState } from "./spec-map-view.ts";
|
|
6
6
|
import type { TranscriptStyle } from "./transcript-view.ts";
|
|
7
|
+
import type { ButtonPaint, PointerHover } from "../pointer-hover.ts";
|
|
7
8
|
/**
|
|
8
9
|
* The side panel: the spec and how far the code has been regenerated, beside the conversation rather than instead of
|
|
9
10
|
* it.
|
|
@@ -21,6 +22,8 @@ export interface SidePanelOptions {
|
|
|
21
22
|
earlier?: () => Job[];
|
|
22
23
|
/** The regeneration's pages. Not given: the pulse list alone. */
|
|
23
24
|
map?: () => MarkedPage[];
|
|
25
|
+
pointer?: PointerHover;
|
|
26
|
+
tabLabel?: ButtonPaint;
|
|
24
27
|
/** Rows the panel may use. */
|
|
25
28
|
rows: () => number;
|
|
26
29
|
style: TranscriptStyle;
|
|
@@ -53,7 +56,7 @@ export interface SidePanelOptions {
|
|
|
53
56
|
export declare function createSidePanel(options: SidePanelOptions): {
|
|
54
57
|
render(width: number): string[];
|
|
55
58
|
handleInput(data: string): void;
|
|
56
|
-
/**
|
|
59
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
57
60
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
58
61
|
invalidate(): void;
|
|
59
62
|
};
|
|
@@ -12,6 +12,48 @@ export function createSidePanel(options) {
|
|
|
12
12
|
let drawnTree = { rows: [], rowStarts: [], lineCount: 0 };
|
|
13
13
|
let drawnMap = { rows: [], rowStarts: [], lineCount: 0 };
|
|
14
14
|
let pages = [];
|
|
15
|
+
let pressed;
|
|
16
|
+
// Hit regions for the last frame, in panel-local cells (the dock border is outside them).
|
|
17
|
+
const hits = new Map();
|
|
18
|
+
const hit = (y, target) => {
|
|
19
|
+
const row = hits.get(y);
|
|
20
|
+
if (row)
|
|
21
|
+
row.push(target);
|
|
22
|
+
else
|
|
23
|
+
hits.set(y, [target]);
|
|
24
|
+
};
|
|
25
|
+
let headerHeight = 0;
|
|
26
|
+
function hitLabels(drawn, first, y, height, width, target) {
|
|
27
|
+
drawn.rows.forEach((row, index) => {
|
|
28
|
+
const start = drawn.rowStarts[index] - first;
|
|
29
|
+
const end = Math.min(height, start + drawn.labelHeights[index]);
|
|
30
|
+
if (Math.max(0, start) >= end)
|
|
31
|
+
return;
|
|
32
|
+
const label = { ...target(row, index), x: 0, end: width };
|
|
33
|
+
for (let line = Math.max(0, start); line < end; line++)
|
|
34
|
+
hit(headerHeight + y + line, label);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const controls = (width) => {
|
|
38
|
+
if (width <= 0 || (!options.map && !options.dock))
|
|
39
|
+
return [];
|
|
40
|
+
const close = width >= 30 ? " × close " : width >= 3 ? " × " : "×";
|
|
41
|
+
const right = width - visibleWidth(close);
|
|
42
|
+
const buttons = [];
|
|
43
|
+
let x = 0;
|
|
44
|
+
if (options.map) {
|
|
45
|
+
for (const [action, label] of [["map", "***plain"], ["pulses", "pulses"]]) {
|
|
46
|
+
const marker = width >= 30 ? (map.view === action ? "▸ " : " ") : "";
|
|
47
|
+
const text = truncateToWidth(` ${marker}${label} `, Math.max(0, right - x - 1), "");
|
|
48
|
+
if (!text)
|
|
49
|
+
break;
|
|
50
|
+
buttons.push({ action, text, x });
|
|
51
|
+
x += visibleWidth(text) + 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [...buttons, { action: "close", text: close, x: right }];
|
|
55
|
+
};
|
|
56
|
+
const tabLabel = options.tabLabel ?? ((text, active) => active ? style.heading(text) : style.muted(text));
|
|
15
57
|
/** The keys back to the chat - and `s`, from over the screen to beside the chat and back. */
|
|
16
58
|
const backKeys = () => {
|
|
17
59
|
if (options.dock === undefined)
|
|
@@ -65,7 +107,7 @@ export function createSidePanel(options) {
|
|
|
65
107
|
/** The rule under the top. */
|
|
66
108
|
const rule = (width) => style.muted("─".repeat(Math.max(1, width)));
|
|
67
109
|
const renderPulses = (width, rows) => {
|
|
68
|
-
const keys = ["↑↓ move", "enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
110
|
+
const keys = ["↑↓ move", "click/enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
69
111
|
const top = topBlock([`${style.heading("pulses")}${waitingNote()}`], keys, width);
|
|
70
112
|
// Under the top: the rule, and a line of space - as the map has.
|
|
71
113
|
const bodyHeight = Math.max(3, rows - top.length - 2);
|
|
@@ -75,6 +117,10 @@ export function createSidePanel(options) {
|
|
|
75
117
|
const tree_ = jobsTreeLines([...options.jobs(), ...(options.earlier?.() ?? [])], tree, width, style);
|
|
76
118
|
drawnTree = { rows: tree_.rows, rowStarts: tree_.rowStarts, lineCount: tree_.lines.length };
|
|
77
119
|
keepCursorInView(tree, tree_.rowStarts, tree_.lines.length, bodyHeight);
|
|
120
|
+
hitLabels(tree_, tree.top, top.length + 2, bodyHeight, width, (row, index) => ({
|
|
121
|
+
key: `tree:${row.section}:${row.kind}:${row.kind !== "section" ? row.job.id : ""}:${row.kind === "file" ? row.file : ""}`,
|
|
122
|
+
pick: () => { tree.cursor = index; treeKey(tree, drawnTree.rows, "toggle"); },
|
|
123
|
+
}));
|
|
78
124
|
const visible = tree_.lines.slice(tree.top, tree.top + bodyHeight);
|
|
79
125
|
while (visible.length < bodyHeight)
|
|
80
126
|
visible.push("");
|
|
@@ -94,12 +140,19 @@ export function createSidePanel(options) {
|
|
|
94
140
|
const tabbed = pages.length > 1;
|
|
95
141
|
const page = shownPage(pages, map);
|
|
96
142
|
const discuss = page.stuck && options.discuss !== undefined ? [`${DISCUSS_KEY} talk it through in the chat`] : [];
|
|
97
|
-
const keys = [...discuss, "↑↓ move", "enter open/close", ...(tabbed ? ["←→ module"] : []), "o/c all", "pgup pgdn", "p pulses", ...backKeys()];
|
|
143
|
+
const keys = [...discuss, "↑↓ move", "click/enter open/close", ...(tabbed ? ["←→ module"] : []), "o/c all", "pgup pgdn", "p pulses", ...backKeys()];
|
|
98
144
|
// The legend's box in the upper right corner, over what is under it; too narrow a panel has none.
|
|
99
145
|
const box = width >= 60 ? legendBox(legendLines(page, style)) : [];
|
|
100
146
|
const room = box.length > 0 ? width - visibleWidth(box[0]) - 1 : width;
|
|
101
147
|
// The top line whole - it wraps beside the box; the tabs fit themselves, counting what does not fit.
|
|
102
|
-
const title = [specMapHeader(page, Number.MAX_SAFE_INTEGER, style, waitingNote())
|
|
148
|
+
const title = [specMapHeader(page, Number.MAX_SAFE_INTEGER, style, waitingNote())];
|
|
149
|
+
if (tabbed) {
|
|
150
|
+
const tabs = tabBar(pages, page, room, style, now);
|
|
151
|
+
const y = headerHeight + wrapTextWithAnsi(title[0], room).length;
|
|
152
|
+
for (const tab of tabs.targets)
|
|
153
|
+
hit(y, { key: `module:${tab.page.plainFile}`, x: tab.x, end: tab.end, pick: () => switchTab(pages, map, pages.indexOf(tab.page) - pages.indexOf(page)) });
|
|
154
|
+
title.push(tabs.line);
|
|
155
|
+
}
|
|
103
156
|
const top = topBlock(title, keys, room);
|
|
104
157
|
// Under the top: the rule, a line of space, and the columns' headings - two lines.
|
|
105
158
|
const bodyHeight = Math.max(3, rows - top.length - 4);
|
|
@@ -110,6 +163,19 @@ export function createSidePanel(options) {
|
|
|
110
163
|
const drawn = long ? specMapLines(pages, map, width - 2, style, options.jobs(), now) : first;
|
|
111
164
|
drawnMap = { rows: drawn.rows, rowStarts: drawn.rowStarts, lineCount: drawn.lines.length };
|
|
112
165
|
keepCursorInView(map, drawn.rowStarts, drawn.lines.length, bodyHeight);
|
|
166
|
+
const headings = columnHeadings(page, width, style);
|
|
167
|
+
const bodyY = top.length + 2 + headings.length;
|
|
168
|
+
hitLabels(drawn, map.top, bodyY, bodyHeight, long ? width - 2 : width, (row, index) => ({
|
|
169
|
+
key: `map:${row.key}`,
|
|
170
|
+
pick: () => { map.cursor = index; map.cursorKey = row.key; toggleMapRow(row); },
|
|
171
|
+
}));
|
|
172
|
+
// On a short header the legend can cover part of a body row as well.
|
|
173
|
+
for (let i = bodyY; i < box.length; i++) {
|
|
174
|
+
const y = headerHeight + i;
|
|
175
|
+
const row = hits.get(y);
|
|
176
|
+
if (row)
|
|
177
|
+
hits.set(y, row.map((target) => ({ ...target, end: Math.min(target.end, room) })));
|
|
178
|
+
}
|
|
113
179
|
const visible = drawn.lines.slice(map.top, map.top + bodyHeight).map((line) => truncateToWidth(line, long ? width - 2 : width));
|
|
114
180
|
while (visible.length < bodyHeight)
|
|
115
181
|
visible.push("");
|
|
@@ -120,7 +186,7 @@ export function createSidePanel(options) {
|
|
|
120
186
|
})()
|
|
121
187
|
: visible;
|
|
122
188
|
// The rule beside the box stops short of it.
|
|
123
|
-
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...
|
|
189
|
+
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...headings, ...body], box, width);
|
|
124
190
|
};
|
|
125
191
|
/** From the map to the pulse list: onto the pulse that regenerates the item under the cursor, when one does. */
|
|
126
192
|
const toPulses = () => {
|
|
@@ -155,6 +221,17 @@ export function createSidePanel(options) {
|
|
|
155
221
|
return;
|
|
156
222
|
}
|
|
157
223
|
};
|
|
224
|
+
const toggleMapRow = (target, open) => {
|
|
225
|
+
if (target === undefined || target.kind === "group")
|
|
226
|
+
return;
|
|
227
|
+
const to = open ?? !(target.kind === "import" ? target.open : map.open.has(target.key));
|
|
228
|
+
if (target.kind === "import")
|
|
229
|
+
map.imports.set(target.key.replace(/^import\n/, ""), to);
|
|
230
|
+
else if (to)
|
|
231
|
+
map.open.add(target.key);
|
|
232
|
+
else
|
|
233
|
+
map.open.delete(target.key);
|
|
234
|
+
};
|
|
158
235
|
/** A key in the map. */
|
|
159
236
|
const mapKey = (data) => {
|
|
160
237
|
const page = Math.max(1, lastBodyHeight - 1);
|
|
@@ -164,25 +241,12 @@ export function createSidePanel(options) {
|
|
|
164
241
|
map.cursor = Math.max(0, Math.min(rows.length - 1, to));
|
|
165
242
|
map.cursorKey = rows[map.cursor]?.key;
|
|
166
243
|
};
|
|
167
|
-
const isOpen = (target) => (target.kind === "item" ? map.open.has(target.key) : target.kind === "group" ? false : target.open);
|
|
168
|
-
const toggle = (target, open) => {
|
|
169
|
-
// A group's heading only says what is under it.
|
|
170
|
-
if (target === undefined || target.kind === "group")
|
|
171
|
-
return;
|
|
172
|
-
const to = open ?? !isOpen(target);
|
|
173
|
-
if (target.kind === "import")
|
|
174
|
-
map.imports.set(target.key.replace(/^import\n/, ""), to);
|
|
175
|
-
else if (to)
|
|
176
|
-
map.open.add(target.key);
|
|
177
|
-
else
|
|
178
|
-
map.open.delete(target.key);
|
|
179
|
-
};
|
|
180
244
|
if (matchesKey(data, Key.up))
|
|
181
245
|
move(map.cursor - 1);
|
|
182
246
|
else if (matchesKey(data, Key.down))
|
|
183
247
|
move(map.cursor + 1);
|
|
184
248
|
else if (matchesKey(data, Key.enter) || data === " ")
|
|
185
|
-
|
|
249
|
+
toggleMapRow(row);
|
|
186
250
|
// ←→ go from one module's tab to the next.
|
|
187
251
|
else if (matchesKey(data, Key.right))
|
|
188
252
|
switchTab(pages, map, 1);
|
|
@@ -190,7 +254,7 @@ export function createSidePanel(options) {
|
|
|
190
254
|
switchTab(pages, map, -1);
|
|
191
255
|
else if (data === "o" || data === "c")
|
|
192
256
|
for (const entry of rows)
|
|
193
|
-
|
|
257
|
+
toggleMapRow(entry, data === "o");
|
|
194
258
|
else if (data === DISCUSS_KEY && options.discuss !== undefined) {
|
|
195
259
|
const shown = shownPage(pages, map);
|
|
196
260
|
if (shown?.stuck === true)
|
|
@@ -211,15 +275,26 @@ export function createSidePanel(options) {
|
|
|
211
275
|
};
|
|
212
276
|
return {
|
|
213
277
|
render(width) {
|
|
214
|
-
|
|
278
|
+
hits.clear();
|
|
279
|
+
let bar = "";
|
|
280
|
+
let end = 0;
|
|
281
|
+
for (const { action, text, x } of controls(width)) {
|
|
282
|
+
bar += " ".repeat(x - end) + tabLabel(text, map.view === action, options.pointer?.target === `panel:${action}`, action === "close" ? "close" : "tab");
|
|
283
|
+
end = x + visibleWidth(text);
|
|
284
|
+
}
|
|
285
|
+
const header = bar ? [bar] : [];
|
|
286
|
+
headerHeight = header.length;
|
|
287
|
+
const rows = Math.max(8, options.rows()) - header.length;
|
|
215
288
|
try {
|
|
216
|
-
return map.view === "map" && options.map !== undefined ? renderMap(width, rows) : renderPulses(width, rows);
|
|
289
|
+
return [...header, ...(map.view === "map" && options.map !== undefined ? renderMap(width, rows) : renderPulses(width, rows))];
|
|
217
290
|
}
|
|
218
291
|
catch (error) {
|
|
292
|
+
hits.clear();
|
|
219
293
|
// A frame that throws is never drawn - nor is anything after it: the screen would freeze. What failed is shown instead.
|
|
220
294
|
const top = topBlock([`${style.heading(map.view === "map" ? "regen" : "pulses")}${waitingNote()}`], [...(options.map !== undefined ? ["p the other view"] : []), ...backKeys()], width);
|
|
221
295
|
const lines = (error instanceof Error ? (error.stack ?? error.message) : String(error)).split("\n").slice(0, Math.max(1, rows - top.length - 1));
|
|
222
296
|
return [
|
|
297
|
+
...header,
|
|
223
298
|
...top,
|
|
224
299
|
rule(width),
|
|
225
300
|
...lines.map((line, index) => truncateToWidth(index === 0 ? style.error(`could not be drawn: ${line}`) : style.muted(line), width)),
|
|
@@ -274,8 +349,42 @@ export function createSidePanel(options) {
|
|
|
274
349
|
else if (matchesKey(data, Key.end) || data === "G")
|
|
275
350
|
tree.cursor = Math.max(0, drawnTree.rows.length - 1);
|
|
276
351
|
},
|
|
277
|
-
/**
|
|
352
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
278
353
|
handleMouse(event) {
|
|
354
|
+
const down = pressed;
|
|
355
|
+
if (event.type === "press" || event.type === "click")
|
|
356
|
+
pressed = undefined;
|
|
357
|
+
if (event.y === 0 && (event.type === "move" || (event.button === "left" && (event.type === "press" || event.type === "click")))) {
|
|
358
|
+
for (const { action, text, x } of controls(event.width)) {
|
|
359
|
+
if (event.x >= x && event.x < x + visibleWidth(text)) {
|
|
360
|
+
if (options.pointer)
|
|
361
|
+
options.pointer.target = `panel:${action}`;
|
|
362
|
+
if (event.type === "move")
|
|
363
|
+
return { handled: true, render: false };
|
|
364
|
+
if (event.type === "press")
|
|
365
|
+
pressed = action;
|
|
366
|
+
else if (action === down && action !== map.view) {
|
|
367
|
+
if (action === "close")
|
|
368
|
+
options.close();
|
|
369
|
+
else if (action === "map")
|
|
370
|
+
toMap();
|
|
371
|
+
else
|
|
372
|
+
toPulses();
|
|
373
|
+
}
|
|
374
|
+
return { handled: true };
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (event.button === "left" && (event.type === "press" || event.type === "click")) {
|
|
379
|
+
const target = hits.get(event.y)?.find(({ x, end }) => event.x >= x && event.x < end);
|
|
380
|
+
if (target) {
|
|
381
|
+
if (event.type === "press")
|
|
382
|
+
pressed = target.key;
|
|
383
|
+
else if (down === target.key)
|
|
384
|
+
target.pick();
|
|
385
|
+
return { handled: true };
|
|
386
|
+
}
|
|
387
|
+
}
|
|
279
388
|
if (event.type !== "wheel" || event.wheelDelta === undefined)
|
|
280
389
|
return undefined;
|
|
281
390
|
if (map.view === "map" && options.map !== undefined)
|
|
@@ -70,7 +70,14 @@ export declare function switchTab(pages: MarkedPage[], state: SpecMapState, by:
|
|
|
70
70
|
* The tabs, a module each in the chain's order, the one shown marked - those regenerating spin, those stuck say so - fitted to
|
|
71
71
|
* `width` around the one shown, what does not fit counted at either end.
|
|
72
72
|
*/
|
|
73
|
-
export declare function tabBar(pages: MarkedPage[], shown: MarkedPage | undefined, width: number, style: TranscriptStyle, now: number):
|
|
73
|
+
export declare function tabBar(pages: MarkedPage[], shown: MarkedPage | undefined, width: number, style: TranscriptStyle, now: number): {
|
|
74
|
+
line: string;
|
|
75
|
+
targets: {
|
|
76
|
+
x: number;
|
|
77
|
+
end: number;
|
|
78
|
+
page: MarkedPage;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
74
81
|
/**
|
|
75
82
|
* Where an item stands, as one mark on a ladder every item climbs: planned, working, regenerated, validating, conform - and needs
|
|
76
83
|
* you, off it - named in the legend in the panel's corner. The same mark means the same thing whatever the config says
|
|
@@ -123,6 +130,7 @@ export declare function specMapRows(pages: MarkedPage[], state: SpecMapState): M
|
|
|
123
130
|
export declare function specMapLines(pages: MarkedPage[], state: SpecMapState, width: number, style: TranscriptStyle, _jobs?: Job[], now?: number): {
|
|
124
131
|
lines: string[];
|
|
125
132
|
rowStarts: number[];
|
|
133
|
+
labelHeights: number[];
|
|
126
134
|
rows: MapRow[];
|
|
127
135
|
marks: LineMark[];
|
|
128
136
|
};
|
|
@@ -67,7 +67,23 @@ export function tabBar(pages, shown, width, style, now) {
|
|
|
67
67
|
if (from > 0 && visibleWidth(lineOf(from - 1, to)) <= width)
|
|
68
68
|
(from -= 1), (widened = true);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
const full = lineOf(from, to);
|
|
71
|
+
const end = visibleWidth(full) > width ? Math.max(0, width - 1) : width;
|
|
72
|
+
const targets = [];
|
|
73
|
+
let x = 0;
|
|
74
|
+
const target = (text, index) => {
|
|
75
|
+
const next = x + visibleWidth(text);
|
|
76
|
+
if (x < end && pages[index])
|
|
77
|
+
targets.push({ x, end: Math.min(next, end), page: pages[index] });
|
|
78
|
+
x = next + 2;
|
|
79
|
+
};
|
|
80
|
+
if (from > 0)
|
|
81
|
+
target(`‹ ${from}`, from - 1);
|
|
82
|
+
for (let i = from; i < to; i++)
|
|
83
|
+
target(tabs[i] ?? "", i);
|
|
84
|
+
if (to < tabs.length)
|
|
85
|
+
target(`${tabs.length - to} ›`, to);
|
|
86
|
+
return { line: truncateToWidth(full, width, "…"), targets };
|
|
71
87
|
}
|
|
72
88
|
/** What needs the person - a stuck page, its `!` - in the warning colour: it waits on them, nothing is broken. */
|
|
73
89
|
const needs = (style) => style.warning ?? style.error;
|
|
@@ -427,6 +443,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
427
443
|
const lines = [];
|
|
428
444
|
const marks = [];
|
|
429
445
|
const rowStarts = [];
|
|
446
|
+
const labelHeights = [];
|
|
430
447
|
const add = (line, mark) => {
|
|
431
448
|
lines.push(line);
|
|
432
449
|
marks.push(mark);
|
|
@@ -455,6 +472,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
455
472
|
rowStarts.push(lines.length);
|
|
456
473
|
const text = `${INDENT.repeat(row.depth + 1)}${row.label}`;
|
|
457
474
|
add(`${pointer}${here ? style.heading(text) : style.muted(text)}`);
|
|
475
|
+
labelHeights.push(0); // A heading, with nothing to open.
|
|
458
476
|
underImport = true;
|
|
459
477
|
return;
|
|
460
478
|
}
|
|
@@ -468,6 +486,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
468
486
|
const items = page.items.filter((item) => item.file === row.file);
|
|
469
487
|
const text = `${row.open ? "▾" : "▸"} from ${row.file} · ${importSummary(items)}`;
|
|
470
488
|
add(`${pointer}${INDENT.repeat(row.depth + 1)}${here ? style.heading(text) : style.muted(text)}`);
|
|
489
|
+
labelHeights.push(1);
|
|
471
490
|
underImport = true;
|
|
472
491
|
return;
|
|
473
492
|
}
|
|
@@ -516,6 +535,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
516
535
|
if (heading !== undefined)
|
|
517
536
|
for (const line of hanging(body, first, room))
|
|
518
537
|
add(`${CONTINUED}${line}`, mark);
|
|
538
|
+
labelHeights.push(lines.length - rowStarts[index]);
|
|
519
539
|
// The first item that needs the person says what for, and how to go about it - opened or closed.
|
|
520
540
|
if (page.stuck && !toldWhy && rungOf(item) === "needsYou") {
|
|
521
541
|
toldWhy = true;
|
|
@@ -540,7 +560,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
540
560
|
add(`${CONTINUED}${style.muted(`… ${changed.length - 4} more - enter opens it`)}`, mark);
|
|
541
561
|
}
|
|
542
562
|
});
|
|
543
|
-
return { lines, rowStarts, rows, marks };
|
|
563
|
+
return { lines, rowStarts, labelHeights, rows, marks };
|
|
544
564
|
}
|
|
545
565
|
/** How the strip and the minimap colour a mark. */
|
|
546
566
|
function paintOf(mark, style) {
|
|
@@ -88,6 +88,11 @@ export declare function staticChecksOnly(run: {
|
|
|
88
88
|
exitCode: number;
|
|
89
89
|
timedOut?: boolean;
|
|
90
90
|
}): boolean;
|
|
91
|
+
/** The skill that writes a testing script of a kind, and what the script is called in words. */
|
|
92
|
+
export declare function testingScriptSkill(kind: ScriptKind): {
|
|
93
|
+
skill: string;
|
|
94
|
+
what: string;
|
|
95
|
+
};
|
|
91
96
|
/** The kind of testing script a skill writes, by its name - one that writes none, undefined. */
|
|
92
97
|
export declare function scriptKindOfSkill(skill: string): ScriptKind | undefined;
|
|
93
98
|
/** Raised before a build starts when the script that would decide it is done is missing. */
|
|
@@ -193,6 +193,10 @@ const SKILL = {
|
|
|
193
193
|
unit: { skill: "implement-unit-testing-script", file: "run_unittests", what: "unit testing script" },
|
|
194
194
|
conformance: { skill: "implement-conformance-testing-script", file: "run_conformance_tests", what: "conformance testing script" },
|
|
195
195
|
};
|
|
196
|
+
/** The skill that writes a testing script of a kind, and what the script is called in words. */
|
|
197
|
+
export function testingScriptSkill(kind) {
|
|
198
|
+
return { skill: SKILL[kind].skill, what: SKILL[kind].what };
|
|
199
|
+
}
|
|
196
200
|
/** The kind of testing script a skill writes, by its name - one that writes none, undefined. */
|
|
197
201
|
export function scriptKindOfSkill(skill) {
|
|
198
202
|
return Object.keys(SKILL).find((kind) => SKILL[kind].skill === skill);
|
package/dist/reopen.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turri opened again in another folder, in the same terminal, once its chat has quit: a chat works on the project of
|
|
3
|
+
* the folder it was opened in, and after a capture the work is in another - `plain/`, a project of its own. `turri`
|
|
4
|
+
* (cli.ts) starts the chat as a process of its own, with turri's theme, its screen and the folder's models, and names
|
|
5
|
+
* it a file to write in: a chat that is to open again elsewhere writes where, with what, and quits; `turri` reads it and
|
|
6
|
+
* starts the chat there as it started the first - the theme, the screen and that folder's models worked out the same.
|
|
7
|
+
* A chat `turri` did not start - a host's, a desktop app's - has no file, and is never offered it.
|
|
8
|
+
*/
|
|
9
|
+
/** The file the chat `turri` started writes where it is to open again. */
|
|
10
|
+
export declare const REOPEN_FILE_ENV = "TURRI_REOPEN_FILE";
|
|
11
|
+
/** Said to the chat opened again, at its start: the capture whose report it tells - what the capture said of itself. */
|
|
12
|
+
export declare const REOPENED_AFTER_CAPTURE = "TURRI_REOPENED_AFTER_CAPTURE";
|
|
13
|
+
export interface Reopening {
|
|
14
|
+
/** The folder the chat opens in. */
|
|
15
|
+
dir: string;
|
|
16
|
+
/** Its arguments, as `turri` takes them. */
|
|
17
|
+
args: string[];
|
|
18
|
+
/** What it is told at its start, in its environment. */
|
|
19
|
+
env: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** Whether this chat can open again in another folder: `turri` started it. */
|
|
22
|
+
export declare function canReopen(): boolean;
|
|
23
|
+
/** Ask `turri` to open the chat again in `dir` once it has quit - the caller quits it. False when it cannot (`canReopen`). */
|
|
24
|
+
export declare function reopenIn(dir: string, options?: {
|
|
25
|
+
args?: string[];
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
}): boolean;
|
|
28
|
+
/** What the chat that quit asked for, taken - its file removed - or undefined when it asked for nothing. */
|
|
29
|
+
export declare function takeReopening(file: string): Reopening | undefined;
|
package/dist/reopen.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* turri opened again in another folder, in the same terminal, once its chat has quit: a chat works on the project of
|
|
4
|
+
* the folder it was opened in, and after a capture the work is in another - `plain/`, a project of its own. `turri`
|
|
5
|
+
* (cli.ts) starts the chat as a process of its own, with turri's theme, its screen and the folder's models, and names
|
|
6
|
+
* it a file to write in: a chat that is to open again elsewhere writes where, with what, and quits; `turri` reads it and
|
|
7
|
+
* starts the chat there as it started the first - the theme, the screen and that folder's models worked out the same.
|
|
8
|
+
* A chat `turri` did not start - a host's, a desktop app's - has no file, and is never offered it.
|
|
9
|
+
*/
|
|
10
|
+
/** The file the chat `turri` started writes where it is to open again. */
|
|
11
|
+
export const REOPEN_FILE_ENV = "TURRI_REOPEN_FILE";
|
|
12
|
+
/** Said to the chat opened again, at its start: the capture whose report it tells - what the capture said of itself. */
|
|
13
|
+
export const REOPENED_AFTER_CAPTURE = "TURRI_REOPENED_AFTER_CAPTURE";
|
|
14
|
+
/** Whether this chat can open again in another folder: `turri` started it. */
|
|
15
|
+
export function canReopen() {
|
|
16
|
+
return (process.env[REOPEN_FILE_ENV] ?? "") !== "";
|
|
17
|
+
}
|
|
18
|
+
/** Ask `turri` to open the chat again in `dir` once it has quit - the caller quits it. False when it cannot (`canReopen`). */
|
|
19
|
+
export function reopenIn(dir, options = {}) {
|
|
20
|
+
const file = process.env[REOPEN_FILE_ENV];
|
|
21
|
+
if (file === undefined || file === "")
|
|
22
|
+
return false;
|
|
23
|
+
const reopening = { dir, args: options.args ?? [], env: options.env ?? {} };
|
|
24
|
+
writeFileSync(file, JSON.stringify(reopening));
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/** What the chat that quit asked for, taken - its file removed - or undefined when it asked for nothing. */
|
|
28
|
+
export function takeReopening(file) {
|
|
29
|
+
let text;
|
|
30
|
+
try {
|
|
31
|
+
text = readFileSync(file, "utf8");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
rmSync(file, { force: true });
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(text);
|
|
39
|
+
if (typeof parsed.dir !== "string" || !Array.isArray(parsed.args) || parsed.args.some((arg) => typeof arg !== "string"))
|
|
40
|
+
return undefined;
|
|
41
|
+
const env = Object.fromEntries(Object.entries(parsed.env ?? {}).filter((entry) => typeof entry[1] === "string"));
|
|
42
|
+
return { dir: parsed.dir, args: parsed.args, env };
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/resume-line.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* pi's lines on the way out that say how to resume the session - its label, then the command on a line of its own -
|
|
3
|
+
* left out: turri leaves nothing behind but the command run.
|
|
4
|
+
*/
|
|
2
5
|
export declare function withoutResumeLine(text: string): string;
|
package/dist/resume-line.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* pi's lines on the way out that say how to resume the session - its label, then the command on a line of its own -
|
|
3
|
+
* left out: turri leaves nothing behind but the command run.
|
|
4
|
+
*/
|
|
2
5
|
export function withoutResumeLine(text) {
|
|
3
|
-
return text.replace(/^(?:\x1b\[[0-9;]*m)*To resume this session
|
|
6
|
+
return text.replace(/^(?:\x1b\[[0-9;]*m)*To resume this session:(?:\x1b\[[0-9;]*m)*\n[^\n]*\n?/m, "");
|
|
4
7
|
}
|
package/dist/setup.js
CHANGED
|
@@ -10,7 +10,7 @@ import { fetchLatest, newerThan, turrisOnPath, versionFindings } from "./turri-v
|
|
|
10
10
|
import { sandboxAvailable, sandboxWithAsync } from "./regenerate/os-sandbox.js";
|
|
11
11
|
import { findTestScripts, onThisMachine } from "./regenerate/test-scripts.js";
|
|
12
12
|
import { configKeyOptions, parseArgs } from "./cli-options.js";
|
|
13
|
-
import { CONFIG_FILE, hasProjectConfig, readProjectConfig, moduleConfigFile, configModuleOf, moduleConfigsOf } from "./config.js";
|
|
13
|
+
import { CONFIG_FILE, hasProjectConfig, readProjectConfig, moduleConfigFile, configModuleOf, moduleConfigsOf, configProblems } from "./config.js";
|
|
14
14
|
import { checkModels, modelsInUse, piModelAccess } from "./model-check.js";
|
|
15
15
|
import { bedrockRegionFor, describeBedrockRegion, regionInGeography } from "./bedrock-region.js";
|
|
16
16
|
import { baseFilesAsync } from "./regenerate/base-folder.js";
|
|
@@ -230,6 +230,14 @@ async function allChecks(options) {
|
|
|
230
230
|
const project = options.dir;
|
|
231
231
|
if (project === undefined)
|
|
232
232
|
return checks;
|
|
233
|
+
// A config that does not parse is read as empty - every setting at its default, the models pi's own: said first.
|
|
234
|
+
checks.push(...configProblems(project).map((problem) => ({
|
|
235
|
+
level: "missing",
|
|
236
|
+
name: "Config",
|
|
237
|
+
detail: problem.text,
|
|
238
|
+
more: [`turri reads a config that does not parse as empty: none of ${problem.file} applies - not its models, not conformance tests, no other setting.`],
|
|
239
|
+
fix: `Set each key once in ${problem.file}, then run turri doctor again`,
|
|
240
|
+
})));
|
|
233
241
|
if (hasProjectConfig(project) || existsSync(join(project, "plain_modules")))
|
|
234
242
|
checks.push(...(await checkProject(project, { has: (command) => onThisMachine(command, env) !== undefined })));
|
|
235
243
|
if (hasProjectConfig(project))
|
package/docs/README.md
CHANGED
|
@@ -16,6 +16,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
16
16
|
| what my machine needs, and why a check failed | [installation](installation.md) |
|
|
17
17
|
| what turri needs of this machine, and what `turri doctor` checks | [installation](installation.md#what-turri-doctor-checks) |
|
|
18
18
|
| how to start a project, or add a feature, in a conversation | [using](using.md#in-a-conversation) |
|
|
19
|
+
| how to bring an existing codebase under \*\*\*plain | [capture](capture.md) |
|
|
19
20
|
| how to have several chats open at once, and reopen them | [chats](chats.md) |
|
|
20
21
|
| what checks each pulse as it finishes, and tells me what needs me | [the sentinel](sentinel.md) |
|
|
21
22
|
| which model codes, and how to change it | [using](using.md#choosing-a-model), [the project config](config.md#models) |
|
|
@@ -48,6 +49,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
48
49
|
| [A Claude subscription](claude-subscription.md) | running every agent on a Claude Pro, Max or Team subscription through Claude Code: setting it up, its models, checking it yourself, in turri-desktop, its limits, when it does not work |
|
|
49
50
|
| [The project config](config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: where they are read from, every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
50
51
|
| [Launch](launch.md) | trying what is built: the launch track, a commit in dist/<module>, starting it on your machine, after every pulse, `turri launch` |
|
|
52
|
+
| [Capture](capture.md) | an existing codebase captured into \*\*\*plain, offline: what it aims for, how it scales, what it writes, the report, resuming |
|
|
51
53
|
| [Running unattended](headless.md) | regenerating overnight or in CI: before you leave it, the command, the results, resuming, rebuilding one functionality |
|
|
52
54
|
| [Authoring \*\*\*plain](authoring-plain.md) | a \*\*\*plain project, what \*\*\*plain is made of, the rules, writing \*\*\*plain with the agent, the skills, checking \*\*\*plain |
|
|
53
55
|
| [Regenerating](regenerating.md) | where things go, one job, a whole module and how its work is cut into jobs, each job's cases, \*\*\*plain changes, conformance tests, the two records of what is built |
|