@turri-dev/cli 0.4.3-next.fd01774 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/banner.js +12 -1
- package/dist/capture-cli.js +50 -68
- package/dist/chat-terminal.js +0 -1
- package/dist/cli-root.js +44 -4
- package/dist/cli.js +33 -33
- package/dist/init-config-cli.js +10 -1
- package/dist/pi-launch.js +0 -4
- package/dist/terminal-view.js +0 -36
- package/docs/README.md +1 -1
- package/docs/capture.md +79 -180
- package/docs/config.md +2 -5
- package/docs/development.md +3 -3
- package/docs/using.md +3 -3
- package/package.json +2 -2
- package/dist/capture-view.js +0 -99
- package/dist/reopen.js +0 -80
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ turri init-config
|
|
|
39
39
|
|
|
40
40
|
Choose your model provider, then sign in with `/login` once **turri** has started.
|
|
41
41
|
|
|
42
|
+
`turri init-config --global` writes the same into `~/.turri/config.turri.yaml` instead: **turri** reads it under every project's `config.turri.yaml`, and a project's own file overrides any key of it.
|
|
43
|
+
|
|
42
44
|
### Build your first app
|
|
43
45
|
|
|
44
46
|
```bash
|
|
@@ -210,7 +212,7 @@ Start at the [documentation index](docs/README.md), or go straight to a page:
|
|
|
210
212
|
| [Using **turri**](docs/using.md) | the conversation, skills, tools, pulses and regen, choosing models, the command line |
|
|
211
213
|
| [The project config](docs/config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
212
214
|
| [Launch](docs/launch.md) | trying what is built: a commit in `dist/<module>`, started on your machine in the background - after every pulse too - nothing installed without asking |
|
|
213
|
-
| [Capture](docs/capture.md) | an existing codebase captured into \*\*\*plain
|
|
215
|
+
| [Capture](docs/capture.md) | an existing codebase, whole, captured into \*\*\*plain by the chat's agent with sub-agents - to work on from then on instead of the code |
|
|
214
216
|
| [Running unattended](docs/headless.md) | regenerating \*\*\*plain overnight or in CI: the command, keeping it running, the results, resuming, rebuilding one functionality |
|
|
215
217
|
| [Authoring \*\*\*plain](docs/authoring-plain.md) | what \*\*\*plain is made of, the authoring rules, the skills that write and fix it, checking it |
|
|
216
218
|
| [Regenerating](docs/regenerating.md) | what each build does and in which order: functionalities, modules, regeneration, changes to \*\*\*plain, conformance and acceptance tests, working notes, what the code is built from |
|
package/dist/banner.js
CHANGED
|
@@ -2,7 +2,8 @@ import { join } from "node:path";
|
|
|
2
2
|
import { readdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { allocateImageId, Box, getCapabilities, getPngDimensions, renderImage, Text, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
4
4
|
import { BANNER_ENTRY, VERSION_ENTRY } from "@turri-dev/core";
|
|
5
|
-
import {
|
|
5
|
+
import { coreVersion } from "@turri-dev/core/system";
|
|
6
|
+
import { CLI_ROOT, coreLine, corePlace } from "./cli-root.js";
|
|
6
7
|
import { bannerWarnings } from "./turri-versions.js";
|
|
7
8
|
import { brandPink } from "./regenerate/plain-palette.js";
|
|
8
9
|
import { halfBlocks, JELLYFISH_FRAME_MS, JELLYFISH_REST, JELLYFISH_SEQUENCE, JELLYFISH_TEXT_FRAMES } from "./jellyfish.js";
|
|
@@ -16,9 +17,17 @@ import { highlightPlainCodeBlocks } from "./plain-code-blocks.js";
|
|
|
16
17
|
let versions;
|
|
17
18
|
/** Whether what npm said later was told: once, in the chat that heard it first. */
|
|
18
19
|
let toldLater = false;
|
|
20
|
+
/** The core this process runs, as the banner says it - asked once a process, as a clone's asks git. */
|
|
21
|
+
let core;
|
|
19
22
|
export function registerBanner(pi, welcomeVisible) {
|
|
20
23
|
versions ??= bannerWarnings();
|
|
21
24
|
const { lines: newer, later } = versions;
|
|
25
|
+
try {
|
|
26
|
+
core ??= coreLine(coreVersion(), corePlace());
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
/* not said: the core could not tell its version */
|
|
30
|
+
}
|
|
22
31
|
pi.registerEntryRenderer(BANNER_ENTRY, (entry, _options, theme) => {
|
|
23
32
|
const data = entry.data;
|
|
24
33
|
if (data === undefined)
|
|
@@ -26,6 +35,8 @@ export function registerBanner(pi, welcomeVisible) {
|
|
|
26
35
|
const lines = [
|
|
27
36
|
`${brandPink(theme)("turri")} ${theme.fg("muted", `v${data.version}`)}` +
|
|
28
37
|
(data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
|
|
38
|
+
// The core under it: a checkout linked in says where it is, and warns when it runs its dist/ rather than its sources.
|
|
39
|
+
...(core !== undefined ? [theme.fg(core.warn ? "warning" : "dim", core.text)] : []),
|
|
29
40
|
// A newer turri out, or one installed and hidden behind this one: said first, under the version it is about.
|
|
30
41
|
...(data.versions ?? newer).map((line) => theme.fg("warning", line)),
|
|
31
42
|
// A key renamed is information; one that does not parse stops everything that reads it; the rest are the person's to take out.
|
package/dist/capture-cli.js
CHANGED
|
@@ -1,77 +1,59 @@
|
|
|
1
|
-
import { relative, resolve } from "node:path";
|
|
2
|
-
import { CaptureError, DEFAULT_PARALLEL, runCapture } from "@turri-dev/core/project";
|
|
3
|
-
import { c } from "./module-report.js";
|
|
4
1
|
/**
|
|
5
|
-
* `turri capture [path] [--
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* `turri capture [path] [--into <folder>] [--harness-model <m>] [--coding-model <m>]`: the chat's `/capture`, run
|
|
3
|
+
* unattended - pi's print mode with turri built in (`turri -p "/capture ..."`), which asks nobody and waits for the
|
|
4
|
+
* chat's agent, so turri ends as the capture does (the core's docs/capture.md). cli.ts starts it; this reads its words.
|
|
8
5
|
*/
|
|
9
|
-
const
|
|
10
|
-
"usage: turri capture [path] [--
|
|
6
|
+
export const CAPTURE_USAGE = [
|
|
7
|
+
"usage: turri capture [path] [--into <folder>] [--harness-model <m>] [--coding-model <m>]",
|
|
11
8
|
"",
|
|
12
|
-
"Capture the codebase at path (the current folder by default) into ***plain, in <path>/plain
|
|
13
|
-
"
|
|
14
|
-
"with
|
|
9
|
+
"Capture the codebase at path (the current folder by default) into ***plain, in <path>/plain: the chat's /capture,",
|
|
10
|
+
"run unattended - nobody is asked, and turri ends as the capture does. The chat's agent captures it from a map of",
|
|
11
|
+
"the code, with writers for its parts when it is large; its working files and report are in plain/.turri/capture/.",
|
|
12
|
+
"Run it again to go on with a capture that was stopped.",
|
|
15
13
|
"",
|
|
16
|
-
" --harness-model <m> the project's harness model; Claude capture defaults to Haiku low / Sonnet low / Opus medium",
|
|
17
|
-
" --coding-model <m> the project's coding model; set models.capture-exploration, capture-analysis and capture to override capture's tiers",
|
|
18
14
|
" --into <folder> where the ***plain goes, instead of <path>/plain",
|
|
19
|
-
|
|
15
|
+
" --harness-model <m> the model the chat's agent and its writers write on, and the captured project's harness model",
|
|
16
|
+
" --coding-model <m> the captured project's coding model, the one its code is regenerated on",
|
|
20
17
|
].join("\n");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const result = await runCapture({
|
|
56
|
-
root,
|
|
57
|
-
// The captured project starts as the config in use here: the one turri reads where the command is run.
|
|
58
|
-
configFrom: process.cwd(),
|
|
59
|
-
...(into !== undefined ? { plainDir: resolve(into) } : {}),
|
|
60
|
-
...(harnessModel !== undefined ? { model: harnessModel, harnessModel } : {}),
|
|
61
|
-
...(codingModel !== undefined ? { codingModel } : {}),
|
|
62
|
-
...(parallel !== undefined ? { parallel } : {}),
|
|
63
|
-
progress: (line) => console.log(c.dim(` ${line}`)),
|
|
64
|
-
});
|
|
65
|
-
const minutes = Math.round((Date.now() - started) / 60_000);
|
|
66
|
-
console.log(`\n${c.success(c.bold(result.summary))} ${c.dim(`(${minutes} min)`)}`);
|
|
67
|
-
console.log(c.dim(`the report: ${relative(process.cwd(), result.reportFile) || result.reportFile}`));
|
|
68
|
-
return 0;
|
|
18
|
+
/** The options that take a model, passed on to the chat as they are given. */
|
|
19
|
+
const MODEL_OPTIONS = ["--harness-model", "--coding-model"];
|
|
20
|
+
/**
|
|
21
|
+
* `turri capture`'s words as the chat's: `-p "/capture [path] [--into <folder>]"` and the model options - or what is wrong
|
|
22
|
+
* with them. The chat's /capture splits its words on spaces, so a path holding one cannot be given.
|
|
23
|
+
*/
|
|
24
|
+
export function captureArgs(args) {
|
|
25
|
+
let path;
|
|
26
|
+
let into;
|
|
27
|
+
const models = [];
|
|
28
|
+
for (let at = 0; at < args.length; at += 1) {
|
|
29
|
+
const arg = args[at];
|
|
30
|
+
const eq = arg.startsWith("--") ? arg.indexOf("=") : -1;
|
|
31
|
+
const name = eq === -1 ? arg : arg.slice(0, eq);
|
|
32
|
+
if (name === "--into" || MODEL_OPTIONS.includes(name)) {
|
|
33
|
+
const value = eq === -1 ? args[at + 1] : arg.slice(eq + 1);
|
|
34
|
+
if (eq === -1)
|
|
35
|
+
at += 1;
|
|
36
|
+
if (value === undefined || value === "")
|
|
37
|
+
return { problem: `${name} takes a value.` };
|
|
38
|
+
if (name === "--into")
|
|
39
|
+
into = value;
|
|
40
|
+
else
|
|
41
|
+
models.push(name, value);
|
|
42
|
+
}
|
|
43
|
+
else if (arg.startsWith("-")) {
|
|
44
|
+
return { problem: `unknown option: ${arg}` };
|
|
45
|
+
}
|
|
46
|
+
else if (path === undefined) {
|
|
47
|
+
path = arg;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return { problem: `capture takes one path, and was given ${path} and ${arg}.` };
|
|
51
|
+
}
|
|
69
52
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
console.error(c.dim(error.stack));
|
|
74
|
-
return 1;
|
|
53
|
+
for (const [what, value] of [["the path", path], ["--into", into]]) {
|
|
54
|
+
if (value !== undefined && /\s/.test(value))
|
|
55
|
+
return { problem: `${what} ${value} holds a space, which /capture cannot take: name it from a folder whose path has none.` };
|
|
75
56
|
}
|
|
57
|
+
const command = ["/capture", ...(path !== undefined ? [path] : []), ...(into !== undefined ? ["--into", into] : [])].join(" ");
|
|
58
|
+
return { args: ["-p", command, ...models] };
|
|
76
59
|
}
|
|
77
|
-
process.exit(await main());
|
package/dist/chat-terminal.js
CHANGED
|
@@ -146,7 +146,6 @@ export function driveTerminal(terminal, options = {}) {
|
|
|
146
146
|
await rebind.apply(this, args);
|
|
147
147
|
screen = this;
|
|
148
148
|
runtime = this.runtimeHost;
|
|
149
|
-
terminal.leave = () => void this.shutdown();
|
|
150
149
|
bound();
|
|
151
150
|
};
|
|
152
151
|
// Signed in or out - pi says how many providers it has again: every chat put on harness-model, where it can be now.
|
package/dist/cli-root.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
4
|
+
import { dirname, extname, join } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
/**
|
|
7
7
|
* This turri: the package the person runs - its version and clone, its themes and art, a global pi extension file that
|
|
@@ -52,12 +52,52 @@ export function clientInfo(mode, identity = turriIdentity()) {
|
|
|
52
52
|
* and pi's beside it. pi's own `--version` says only pi's, which read as turri's.
|
|
53
53
|
*/
|
|
54
54
|
export function versionLine(core, identity = turriIdentity()) {
|
|
55
|
-
const clone = (commit, changed) => (commit !== null ? `, from a clone, ${commit.slice(0, 7)}${changed === true ? " with changes" : ""}` : "");
|
|
56
55
|
const under = [
|
|
57
|
-
...(core.version !== null ? [`core ${core.version}${
|
|
56
|
+
...(core.version !== null ? [`core ${core.version}${fromClone(core.commit, core.changed)}`] : []),
|
|
58
57
|
...(core.pi !== null ? [`pi ${core.pi}`] : []),
|
|
59
58
|
];
|
|
60
|
-
return `turri ${identity.version ?? "0.0.0"}${
|
|
59
|
+
return `turri ${identity.version ?? "0.0.0"}${fromClone(identity.git_commit, identity.git_dirty)}${under.length > 0 ? ` (${under.join("; ")})` : ""}`;
|
|
60
|
+
}
|
|
61
|
+
/** A clone's commit, as the version line and the banner say it: nothing when it is no clone. */
|
|
62
|
+
const fromClone = (commit, changed) => (commit !== null ? `, from a clone, ${commit.slice(0, 7)}${changed === true ? " with changes" : ""}` : "");
|
|
63
|
+
/**
|
|
64
|
+
* The core this process imports - inside this turri's node_modules as npm installs it, or a checkout `npm run link:core`
|
|
65
|
+
* linked - and whether Node took its sources, as it does only under `--conditions=turri-source`. Nothing when it cannot be
|
|
66
|
+
* resolved.
|
|
67
|
+
*/
|
|
68
|
+
export function corePlace(resolve = () => import.meta.resolve("@turri-dev/core")) {
|
|
69
|
+
let file;
|
|
70
|
+
try {
|
|
71
|
+
file = fileURLToPath(resolve());
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
for (let dir = dirname(file);;) {
|
|
77
|
+
try {
|
|
78
|
+
if (JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).name === "@turri-dev/core")
|
|
79
|
+
return { root: dir, sources: extname(file) === ".ts" };
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
/* not here: up */
|
|
83
|
+
}
|
|
84
|
+
const up = dirname(dir);
|
|
85
|
+
if (up === dir)
|
|
86
|
+
return undefined;
|
|
87
|
+
dir = up;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The banner's line on the core: its version - and, from a clone, its commit, where the clone is and whether its sources
|
|
92
|
+
* run. `warn` when a clone runs from its dist/, which is as old as its last build.
|
|
93
|
+
*/
|
|
94
|
+
export function coreLine(core, place) {
|
|
95
|
+
const text = `core ${core.version ?? "?"}${fromClone(core.commit, core.changed)}`;
|
|
96
|
+
if (place === undefined || (core.commit === null && !place.sources))
|
|
97
|
+
return { text, warn: false };
|
|
98
|
+
if (place.sources)
|
|
99
|
+
return { text: `${text} - ${place.root}, from its sources`, warn: false };
|
|
100
|
+
return { text: `${text} - ${place.root}, from its dist/ build, not its sources (NODE_OPTIONS=--conditions=turri-source runs them)`, warn: true };
|
|
61
101
|
}
|
|
62
102
|
/** The global pi extension file that loads turri into every `pi`, if there is one - an older `turri setup` wrote it. */
|
|
63
103
|
export function globalExtensionFile() {
|
package/dist/cli.js
CHANGED
|
@@ -15,13 +15,11 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
15
15
|
return path;
|
|
16
16
|
};
|
|
17
17
|
import { spawnSync } from "node:child_process";
|
|
18
|
-
import { tmpdir } from "node:os";
|
|
19
18
|
import { dirname, join } from "node:path";
|
|
20
19
|
import { fileURLToPath } from "node:url";
|
|
21
20
|
import { CLI_ROOT, extensionInstalledGlobally, themesInstalledGlobally, versionLine } from "./cli-root.js";
|
|
22
21
|
import { dropNoise } from "./quiet.js";
|
|
23
22
|
import { describeVersion } from "./turri-versions.js";
|
|
24
|
-
import { REOPEN_FILE_ENV, takeReopening } from "./reopen.js";
|
|
25
23
|
/**
|
|
26
24
|
* Start pi with this project's extension and themes already wired in.
|
|
27
25
|
*
|
|
@@ -57,35 +55,23 @@ function chat(args) {
|
|
|
57
55
|
// in as well: pi-launch.ts is told, and leaves it to that. turri doctor offers to remove the file.
|
|
58
56
|
const inPi = extensionInstalledGlobally();
|
|
59
57
|
const themes = themesInstalledGlobally() ? [] : ["--theme", join(CLI_ROOT, ".pi", "themes")];
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
env: {
|
|
78
|
-
...process.env,
|
|
79
|
-
...run.env,
|
|
80
|
-
[REOPEN_FILE_ENV]: reopenFile,
|
|
81
|
-
...(inPi ? { TURRI_EXTENSION_IN_PI: "1" } : {}),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
const next = takeReopening(reopenFile);
|
|
85
|
-
if (next === undefined)
|
|
86
|
-
process.exit(result.status ?? 1);
|
|
87
|
-
run = { cwd: next.dir, args: next.args, env: next.env };
|
|
88
|
-
}
|
|
58
|
+
// turri's own theme, unless this run names another. For this run only: pi's settings
|
|
59
|
+
// are left as they are, so a plain `pi` keeps its theme.
|
|
60
|
+
const useTheme = args.some((arg) => arg === "--use-theme" || arg.startsWith("--use-theme=")) ? [] : ["--use-theme", DEFAULT_THEME];
|
|
61
|
+
// Fullscreen: pi owns the viewport, so the conversation stays where it is scrolled to while the
|
|
62
|
+
// jobs redraw - in the terminal's own scrollback, every redraw pulls it back to the bottom.
|
|
63
|
+
const tuiMode = args.some((arg) => arg === "--tui-mode" || arg.startsWith("--tui-mode=")) ? [] : ["--tui-mode", "fullscreen"];
|
|
64
|
+
// A condition passed directly to node (rather than through NODE_OPTIONS) must reach the chat too.
|
|
65
|
+
const conditions = import.meta.resolve("@turri-dev/core/project").endsWith(".ts") ? ["--conditions=turri-source"] : [];
|
|
66
|
+
// The models named - --harness-model, --coding-model - are the chat's to read (chat-models.ts): pi's arguments with them.
|
|
67
|
+
const result = spawnSync(process.execPath, [...conditions, launcher, ...themes, ...useTheme, ...tuiMode, ...args], {
|
|
68
|
+
stdio: "inherit",
|
|
69
|
+
env: {
|
|
70
|
+
...process.env,
|
|
71
|
+
...(inPi ? { TURRI_EXTENSION_IN_PI: "1" } : {}),
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
process.exit(result.status ?? 1);
|
|
89
75
|
}
|
|
90
76
|
const COMMANDS = {
|
|
91
77
|
regenerate: { module: "./regenerate-cli.ts", blurb: "regenerate a module and its chain from the spec as it is (with module:func-ids: regenerate those again)" },
|
|
@@ -95,11 +81,11 @@ const COMMANDS = {
|
|
|
95
81
|
lineage: { module: "./lineage-cli.ts", blurb: "a module's lineage: what was regenerated into it, and when" },
|
|
96
82
|
launch: { module: "./launch-cli.ts", blurb: "launch what is regenerated from dist/<module> on this machine" },
|
|
97
83
|
cultivate: { module: "./cultivate-cli.ts", blurb: "run a gated skill" },
|
|
98
|
-
capture: { module: "./capture-cli.ts", blurb: "capture an existing codebase into ***plain, in <path>/plain -
|
|
84
|
+
capture: { module: "./capture-cli.ts", blurb: "capture an existing codebase into ***plain, in <path>/plain - the chat's /capture, unattended" },
|
|
99
85
|
};
|
|
100
86
|
/** Getting the machine ready, and checking it is. */
|
|
101
87
|
const SETUP_COMMANDS = {
|
|
102
|
-
"init-config": "write a quick start config.turri.yaml here, from the vendor you use: a strong model to talk to, a smaller one to write the code",
|
|
88
|
+
"init-config": "write a quick start config.turri.yaml here - or, with --global, your ~/.turri one under every project's - from the vendor you use: a strong model to talk to, a smaller one to write the code",
|
|
103
89
|
doctor: "check what turri needs - in a project, what it needs of this machine, and that its models answer",
|
|
104
90
|
};
|
|
105
91
|
/**
|
|
@@ -175,6 +161,20 @@ if (command === "init-config") {
|
|
|
175
161
|
const { main } = await import("./init-config-cli.js");
|
|
176
162
|
process.exit(await main(rest));
|
|
177
163
|
}
|
|
164
|
+
// The chat's /capture, unattended: pi's print mode, turri built in, asks nobody and ends as the capture does.
|
|
165
|
+
if (command === "capture") {
|
|
166
|
+
const { CAPTURE_USAGE, captureArgs } = await import("./capture-cli.js");
|
|
167
|
+
if (rest.includes("-h") || rest.includes("--help")) {
|
|
168
|
+
console.log(CAPTURE_USAGE);
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
const run = captureArgs(rest);
|
|
172
|
+
if ("problem" in run) {
|
|
173
|
+
console.error(`${run.problem}\n\n${CAPTURE_USAGE}`);
|
|
174
|
+
process.exit(1);
|
|
175
|
+
}
|
|
176
|
+
chat(run.args);
|
|
177
|
+
}
|
|
178
178
|
if (command === "doctor") {
|
|
179
179
|
const { main } = await import("./doctor-cli.js");
|
|
180
180
|
process.exit(await main(rest));
|
package/dist/init-config-cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { initConfig } from "@turri-dev/core/project";
|
|
|
5
5
|
import { brand } from "./brand.js";
|
|
6
6
|
const USAGE = [
|
|
7
7
|
"usage: turri init-config [--vendor anthropic|openai|google|amazon-bedrock|other] [--maker <maker>] [--region <geography>]",
|
|
8
|
-
" [--harness-model <spec> --coding-model <spec> [--judge-model <spec>]] [--force] [folder]",
|
|
8
|
+
" [--harness-model <spec> --coding-model <spec> [--judge-model <spec>]] [--force] [--global | folder]",
|
|
9
9
|
"",
|
|
10
10
|
"Write a quick start config.turri.yaml in the folder, the current one by default: the model you talk to and the one that",
|
|
11
11
|
"writes the code, from the vendor you use. Asked when --vendor is not given and this is a terminal; otherwise other -",
|
|
@@ -18,6 +18,9 @@ const USAGE = [
|
|
|
18
18
|
"A config.turri.yaml already there keeps everything but its two models; --force writes the whole of it again. A new",
|
|
19
19
|
"one takes from a config.yaml beside it - another tool's, say - the keys turri reads too, its testing scripts say, and leaves",
|
|
20
20
|
"config.yaml as it is.",
|
|
21
|
+
"",
|
|
22
|
+
"--global writes your global config instead, ~/.turri/config.turri.yaml: turri reads it under every project's",
|
|
23
|
+
"config.turri.yaml, and a project's own file overrides any key of it.",
|
|
21
24
|
].join("\n");
|
|
22
25
|
/** Ask until the answer is one `read` takes. */
|
|
23
26
|
async function askUntil(rl, prompt, read, again) {
|
|
@@ -127,6 +130,11 @@ export async function main(args) {
|
|
|
127
130
|
};
|
|
128
131
|
const taken = new Set(Object.values(flags).flatMap((flag) => flag.at));
|
|
129
132
|
const rest = args.filter((arg, index) => !arg.startsWith("-") && !taken.has(index));
|
|
133
|
+
const global = args.includes("--global");
|
|
134
|
+
if (global && rest[0] !== undefined) {
|
|
135
|
+
console.error(`--global writes ~/.turri/config.turri.yaml: name no folder with it.\n\n${USAGE}`);
|
|
136
|
+
return 1;
|
|
137
|
+
}
|
|
130
138
|
const folder = rest[0] ?? process.cwd();
|
|
131
139
|
if (!existsSync(folder)) {
|
|
132
140
|
console.error(`${folder} does not exist.`);
|
|
@@ -199,6 +207,7 @@ export async function main(args) {
|
|
|
199
207
|
const result = await initConfig(folder, {
|
|
200
208
|
paint: brand,
|
|
201
209
|
force,
|
|
210
|
+
...(global ? { global } : {}),
|
|
202
211
|
...(chosen.vendor !== undefined ? { vendor: chosen.vendor } : {}),
|
|
203
212
|
...(chosen.bedrock !== undefined ? { bedrock: chosen.bedrock } : {}),
|
|
204
213
|
...(chosen.models !== undefined ? { models: chosen.models } : {}),
|
package/dist/pi-launch.js
CHANGED
|
@@ -21,7 +21,6 @@ import { setProcessTurri } from "./extension.js";
|
|
|
21
21
|
import { takeOverSettings } from "./pi-settings.js";
|
|
22
22
|
import { adoptAsBound } from "./print-mode.js";
|
|
23
23
|
import { quietBrandThemeOverrides } from "./pi-themes.js";
|
|
24
|
-
import { takeCaptured } from "./reopen.js";
|
|
25
24
|
import { createTerminal } from "./terminal-view.js";
|
|
26
25
|
/**
|
|
27
26
|
* pi, started the way its own CLI starts it, for `turri`.
|
|
@@ -86,13 +85,10 @@ if (interactive) {
|
|
|
86
85
|
restore = true;
|
|
87
86
|
}
|
|
88
87
|
const terminal = createTerminal();
|
|
89
|
-
const captured = takeCaptured();
|
|
90
88
|
turri = await createTurri({
|
|
91
89
|
frontend: { ...terminal.frontend, sessions: driveTerminal(terminal, { restore }) },
|
|
92
90
|
client: clientInfo("chat"),
|
|
93
91
|
overrides,
|
|
94
|
-
// Opened again in the project a capture wrote (reopen.ts): its report, told in the first chat.
|
|
95
|
-
...(captured !== undefined ? { captured } : {}),
|
|
96
92
|
});
|
|
97
93
|
terminal.attach(turri);
|
|
98
94
|
}
|
package/dist/terminal-view.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { didNotPass } from "@turri-dev/core";
|
|
3
3
|
import { registerBanner } from "./banner.js";
|
|
4
|
-
import { captureProgress } from "./capture-view.js";
|
|
5
4
|
import { registerChats } from "./chat-commands.js";
|
|
6
5
|
import { createChatUi } from "./chat-ui.js";
|
|
7
6
|
import { registerEntries } from "./entry-renderers.js";
|
|
8
7
|
import { makePanel, registerNotifications, registerPanelKey, terminalAsk } from "./panel-view.js";
|
|
9
8
|
import { openPiSettings } from "./pi-settings.js";
|
|
10
|
-
import { canReopen, captureOpenQuestion, capturedEnv, reopenIn } from "./reopen.js";
|
|
11
9
|
import { skillProgress } from "./skill-progress.js";
|
|
12
10
|
import { TerminalNotifications } from "./terminal-notifications.js";
|
|
13
11
|
/**
|
|
@@ -68,7 +66,6 @@ export function createTerminal() {
|
|
|
68
66
|
// The session's work and spec map, as last read - read again once an event says they changed.
|
|
69
67
|
let work;
|
|
70
68
|
let pages;
|
|
71
|
-
const captures = new Map();
|
|
72
69
|
const focused = () => session?.chats.focused();
|
|
73
70
|
const uiOf = (chat) => {
|
|
74
71
|
let ui = uis.get(chat);
|
|
@@ -109,7 +106,6 @@ export function createTerminal() {
|
|
|
109
106
|
continue;
|
|
110
107
|
ui.close();
|
|
111
108
|
uis.delete(id);
|
|
112
|
-
captures.delete(id);
|
|
113
109
|
}
|
|
114
110
|
changed();
|
|
115
111
|
break;
|
|
@@ -131,23 +127,6 @@ export function createTerminal() {
|
|
|
131
127
|
skillProgress(ui, event.progress);
|
|
132
128
|
break;
|
|
133
129
|
}
|
|
134
|
-
case "captureProgress": {
|
|
135
|
-
const key = event.chat ?? "";
|
|
136
|
-
let view = captures.get(key);
|
|
137
|
-
if (view === undefined) {
|
|
138
|
-
const ui = drawOn(event.chat);
|
|
139
|
-
if (ui === undefined)
|
|
140
|
-
break;
|
|
141
|
-
view = captureProgress(ui);
|
|
142
|
-
captures.set(key, view);
|
|
143
|
-
}
|
|
144
|
-
view.update(event.status);
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case "captureEnded":
|
|
148
|
-
captures.get(event.chat ?? "")?.close();
|
|
149
|
-
captures.delete(event.chat ?? "");
|
|
150
|
-
break;
|
|
151
130
|
case "outOfReach":
|
|
152
131
|
showOutOfReach(event.chat, event.outOfReach);
|
|
153
132
|
break;
|
|
@@ -216,7 +195,6 @@ export function createTerminal() {
|
|
|
216
195
|
.catch((error) => terminal.notify(error instanceof Error ? error.message : String(error), "warning"));
|
|
217
196
|
},
|
|
218
197
|
panel: undefined,
|
|
219
|
-
leave: undefined,
|
|
220
198
|
frontend: undefined,
|
|
221
199
|
};
|
|
222
200
|
terminal.panel = makePanel(terminal, () => {
|
|
@@ -252,20 +230,6 @@ export function createTerminal() {
|
|
|
252
230
|
terminal.panel.open(ui, target.kind === "map" ? "map" : "pulses");
|
|
253
231
|
return true;
|
|
254
232
|
},
|
|
255
|
-
// A capture wrote a project of its own: turri closes here and opens again there - `turri` started this chat, and the
|
|
256
|
-
// person agrees - where the capture's report is told.
|
|
257
|
-
async openProject(dir, { summary }) {
|
|
258
|
-
const ui = drawOn(undefined);
|
|
259
|
-
if (!canReopen() || terminal.leave === undefined || ui === undefined)
|
|
260
|
-
return false;
|
|
261
|
-
const question = captureOpenQuestion(process.cwd(), dir, summary);
|
|
262
|
-
if (!(await ui.confirm(question.title, question.message)))
|
|
263
|
-
return false;
|
|
264
|
-
if (!reopenIn(dir, { env: capturedEnv(summary) }))
|
|
265
|
-
return false;
|
|
266
|
-
terminal.leave();
|
|
267
|
-
return true;
|
|
268
|
-
},
|
|
269
233
|
openPiSettings,
|
|
270
234
|
// The terminal shows these itself: a pulse's end in the chat and the inbox, notices in the inbox - answered there -
|
|
271
235
|
// and the spec map in regen.
|
package/docs/README.md
CHANGED
|
@@ -49,7 +49,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
49
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 |
|
|
50
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` |
|
|
51
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
|
|
52
|
+
| [Capture](capture.md) | an existing codebase, whole, captured into \*\*\*plain by the chat's agent with sub-agents: the steps, explore, how it scales, what it writes, going on |
|
|
53
53
|
| [Running unattended](headless.md) | regenerating overnight or in CI: before you leave it, the command, the results, resuming, rebuilding one functionality |
|
|
54
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 |
|
|
55
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 |
|