geneseed 5.2.0 → 5.3.1
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/CHANGELOG.md +54 -0
- package/README.md +4 -4
- package/SHIPPED.md +1 -1
- package/adapters/bob/README.md +31 -18
- package/adapters/claude-code/README.md +27 -22
- package/adapters/openclaude/README.md +18 -8
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
- package/adapters/opencode/plugins/geneseed-activity.js +20 -21
- package/adapters/opencode/plugins/geneseed-context.js +224 -71
- package/adapters/opencode/plugins/geneseed-guard.js +420 -203
- package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
- package/adapters/opencode/workflows/_runtime.js +3 -2
- package/bin/geneseed-cli.mjs +61 -16
- package/bin/geneseed-hook.mjs +94 -12
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +2 -2
- package/docs/concepts/factories.md +40 -6
- package/docs/concepts/footprint.md +11 -1
- package/docs/concepts/foreman-mode.md +2 -2
- package/docs/concepts/hook-gates.md +3 -3
- package/docs/concepts/host-matrix.md +22 -4
- package/docs/concepts/loop-gates.md +1 -1
- package/docs/concepts/loops.md +2 -2
- package/docs/concepts/shared-tier.md +1 -1
- package/docs/design-history.md +148 -0
- package/docs/extending.md +97 -163
- package/docs/guides/install-bob.md +2 -2
- package/docs/guides/install-openclaude.md +1 -1
- package/docs/guides/run-a-factory.md +15 -2
- package/docs/guides/upgrade.md +2 -2
- package/docs/guides/verify.md +12 -0
- package/docs/reference/environment.md +1 -0
- package/docs/reference/factory-actions.md +6 -5
- package/docs/reference/troubleshoot-doctor.md +1 -1
- package/docs/reference/troubleshoot-update.md +1 -1
- package/docs/token-footprint.md +66 -2
- package/docs/understand/design-choices-hosts.md +1 -1
- package/docs/understand/design-choices-shape.md +1 -0
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-bob.md +1 -1
- package/docs/web-ui.md +21 -3
- package/harness.config.json +1 -1
- package/js/README.md +7 -5
- package/js/build/args.mjs +4 -4
- package/js/build/driver.mjs +1 -1
- package/js/build/emit-claude.mjs +1 -1
- package/js/build/generate.mjs +5 -14
- package/js/build/render.mjs +44 -24
- package/js/cli-table.json +135 -59
- package/js/factory/cli.mjs +24 -5
- package/js/factory/graph.mjs +13 -9
- package/js/factory/metrics.mjs +93 -0
- package/js/factory/registry.mjs +37 -12
- package/js/factory/state.mjs +25 -6
- package/js/hosts/done-checks.mjs +6 -0
- package/js/hosts/geneseed-dir.mjs +3 -2
- package/js/hosts/gitref.mjs +5 -3
- package/js/hosts/hook-tap.mjs +104 -0
- package/js/hosts/hooks-context.mjs +30 -3
- package/js/hosts/hooks-learn.mjs +47 -16
- package/js/hosts/hooks-prims.mjs +52 -3
- package/js/hosts/hooks.mjs +69 -42
- package/js/hosts/hosts.mjs +80 -12
- package/js/hosts/installs.mjs +7 -0
- package/js/hosts/loss.mjs +6 -1
- package/js/hosts/native.mjs +14 -5
- package/js/hosts/owned.mjs +7 -6
- package/js/hosts/ownership-gate.mjs +14 -1
- package/js/hosts/settings.mjs +245 -103
- package/js/hosts/shim.mjs +4 -4
- package/js/hosts/usage.mjs +9 -3
- package/js/inspect/checks-probe.mjs +66 -5
- package/js/inspect/checks-repo.mjs +196 -2
- package/js/inspect/cost.mjs +34 -2
- package/js/inspect/diff.mjs +16 -1
- package/js/inspect/doctor.mjs +13 -4
- package/js/inspect/excludes.mjs +18 -6
- package/js/inspect/status.mjs +35 -7
- package/js/inspect/validate.mjs +44 -21
- package/js/lib/machine-dir.mjs +1 -1
- package/js/lib/node-floor.mjs +46 -6
- package/js/maintain/uninstall.mjs +70 -17
- package/js/maintain/update.mjs +31 -7
- package/js/ui/cli.mjs +34 -4
- package/js/ui/menu.mjs +1 -1
- package/js/ui/tui.mjs +11 -14
- package/js/web/actions.mjs +3 -9
- package/js/web/api.mjs +28 -10
- package/js/web/daemon.mjs +0 -1
- package/js/web/server.mjs +1 -0
- package/js/web/state.mjs +37 -16
- package/package.json +1 -1
- package/src/AGENT.md.tmpl +23 -17
- package/src/agents/_template.md +1 -1
- package/src/agents/advocate.md +1 -1
- package/src/agents/developer.md +12 -3
- package/src/agents/empiricist.md +1 -1
- package/src/agents/framer.md +1 -1
- package/src/agents/historian.md +1 -1
- package/src/agents/operator.md +1 -1
- package/src/agents/pragmatist.md +1 -1
- package/src/agents/researcher.md +1 -1
- package/src/agents/skeptic.md +1 -1
- package/src/agents/steward.md +1 -1
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- package/src/bricks/intake.md +10 -3
- package/src/bricks/retro.md +13 -3
- package/src/doctrines/comms.md +1 -1
- package/src/doctrines/ops.md +1 -1
- package/src/doctrines/process.md +7 -5
- package/src/factories/analysis-to-build.json +1 -0
- package/src/factories/bug-report-to-fix.json +1 -0
- package/src/factories/issue-to-pr.json +1 -0
- package/src/laws/universal.md +2 -2
- package/src/modes/foreman.md +8 -14
- package/src/skills/commit.md +7 -2
- package/src/skills/debug.md +1 -1
- package/src/skills/diagram-design/SKILL.md +1 -1
- package/src/skills/diagram-design/VENDOR.md +3 -1
- package/src/skills/factory-forge.md +5 -3
- package/src/skills/factory.md +22 -1
- package/src/skills/geneseed.md +1 -1
- package/src/skills/handoff.md +1 -1
- package/src/skills/parallel-agents.md +1 -1
- package/src/skills/pipeline.md +6 -6
- package/src/skills/plan.md +7 -3
- package/src/skills/spring-testing.md +1 -1
- package/themes/biker.json +78 -78
- package/themes/commentator.json +81 -81
- package/themes/cyberpunk.json +79 -79
- package/themes/gamer.json +77 -77
- package/themes/imperial.json +82 -82
- package/themes/joker.json +79 -79
- package/themes/marvin.json +82 -82
- package/themes/mean.json +82 -82
- package/themes/military.json +78 -78
- package/themes/neutral.json +78 -78
- package/themes/pirate.json +79 -79
- package/themes/sports.json +79 -79
- package/themes/verstappen.json +78 -78
- package/themes/wizard.json +79 -79
- package/web/dist/assets/ActiveLoops-BJJN3P-V.js +1 -0
- package/web/dist/assets/Activity-WQ3ykgxU.js +1 -0
- package/web/dist/assets/ActivityDetail-7rt04SkS.js +1 -0
- package/web/dist/assets/{Bonsai-DSwUbavu.js → Bonsai-BBl4XXqs.js} +1 -1
- package/web/dist/assets/{CopyButton-BzRQz7k2.js → CopyButton-Beven8yn.js} +1 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +2 -0
- package/web/dist/assets/Docs-B5aHp86J.js +5 -0
- package/web/dist/assets/Factories-BjqzXAw8.js +1 -0
- package/web/dist/assets/GreenhouseView-Bce212qd.js +1 -0
- package/web/dist/assets/Installs-B1OsrHXF.js +3 -0
- package/web/dist/assets/JournalView-CV4omyww.js +1 -0
- package/web/dist/assets/Kits-CW1e7xNa.js +1 -0
- package/web/dist/assets/Laws-1Ckf1lbs.js +4 -0
- package/web/dist/assets/LibRows-Dag1s0ZX.js +1 -0
- package/web/dist/assets/Library-B3FuFLel.js +3 -0
- package/web/dist/assets/Loops-CwqgnLNw.js +2 -0
- package/web/dist/assets/Markdown-CxkA7940.js +71 -0
- package/web/dist/assets/OperatorHudView-JmYY1pBR.js +1 -0
- package/web/dist/assets/Personal-DKLgLa7Z.js +2 -0
- package/web/dist/assets/Settings-BwErnh-R.js +1 -0
- package/web/dist/assets/Tabs-8zsyEPSK.js +1 -0
- package/web/dist/assets/index-CRWqKxfY.css +1 -0
- package/web/dist/assets/index-Ce6qF2nG.js +6 -0
- package/web/dist/assets/usePoll-D5c_qIFZ.js +1 -0
- package/web/dist/index.html +2 -2
- package/adapters/claude-code/settings.json +0 -52
- package/web/dist/assets/ActiveLoops-BTHIaRhn.js +0 -1
- package/web/dist/assets/Activity-DlQ30znB.js +0 -1
- package/web/dist/assets/ActivityDetail-CG0mn5fW.js +0 -1
- package/web/dist/assets/Dashboard-Ce3UOsxJ.js +0 -2
- package/web/dist/assets/Docs-CisVnYqv.js +0 -5
- package/web/dist/assets/Factories-Dq5oW4CU.js +0 -1
- package/web/dist/assets/GreenhouseView-y9WAfcc_.js +0 -1
- package/web/dist/assets/Installs-m4GElwFW.js +0 -3
- package/web/dist/assets/JournalView-DeBLRNGc.js +0 -1
- package/web/dist/assets/Kits-DJYVAnyE.js +0 -1
- package/web/dist/assets/Laws-CNpc_8ZV.js +0 -4
- package/web/dist/assets/LibRows-RO5bvXth.js +0 -1
- package/web/dist/assets/Library-Dg0ScciC.js +0 -3
- package/web/dist/assets/Loops-CjEdo-NG.js +0 -2
- package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
- package/web/dist/assets/OperatorHudView-2ujVMjq1.js +0 -1
- package/web/dist/assets/Personal-D0yS7ahT.js +0 -2
- package/web/dist/assets/Settings-DEN0U8QI.js +0 -1
- package/web/dist/assets/Tabs-But5R6_r.js +0 -1
- package/web/dist/assets/index-Ck42AbRX.js +0 -6
- package/web/dist/assets/index-PG_ukkh6.css +0 -1
- package/web/dist/assets/usePoll-o8ul-Sog.js +0 -1
package/js/inspect/validate.mjs
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* reached — see its row in `tests/ported.json`.
|
|
8
8
|
*/
|
|
9
9
|
import path from 'node:path';
|
|
10
|
+
import { FLAGS, VALUED } from '../build/args.mjs';
|
|
10
11
|
import { buildInto, emitGlobalInto, emitProjectInto } from '../build/driver.mjs';
|
|
11
12
|
import { GATE_SWITCHES } from '../build/source.mjs';
|
|
12
13
|
import { resolvePath } from '../hosts/hosts.mjs';
|
|
@@ -17,6 +18,7 @@ import { validateIsVendored } from '../hosts/native.mjs';
|
|
|
17
18
|
import { printOut, printErr } from '../lib/fs.mjs';
|
|
18
19
|
import { comparePaths } from '../lib/paths.mjs';
|
|
19
20
|
import { stripWhitespace } from '../lib/text.mjs';
|
|
21
|
+
import { cliCommand, formatHelp, helpWidth } from '../ui/cli.mjs';
|
|
20
22
|
import { checkBuild } from './checks-build.mjs';
|
|
21
23
|
import { cmdDoctor } from './doctor.mjs';
|
|
22
24
|
import { isDir, isFile, rglob, withTempDir, within } from './scan.mjs';
|
|
@@ -25,23 +27,45 @@ import { isDir, isFile, rglob, withTempDir, within } from './scan.mjs';
|
|
|
25
27
|
// validate — the generator's `--validate-only`, on this binary because it runs the doctor
|
|
26
28
|
// --------------------------------------------------------------------------------------
|
|
27
29
|
|
|
30
|
+
/** The generator flags `validate` refuses (`cmdValidate`) or has no use for. */
|
|
31
|
+
const NOT_VALIDATE = ['--sync-themes', '--config-dir', '--validate-only'];
|
|
32
|
+
|
|
28
33
|
/**
|
|
29
|
-
* `validate --help`.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
34
|
+
* `validate --help`. Not the borrowed parser's own `-h`, which prints `usage: geneseed-build …`
|
|
35
|
+
* under a program name the user did not type.
|
|
36
|
+
*
|
|
37
|
+
* DERIVED FROM THE GENERATOR'S FLAG TABLES (`VALUED`, `FLAGS`), never typed out: the hand-kept
|
|
38
|
+
* copy it replaces had already lost `--no-ownership-gate`, `--prune-gates` and `--force`. Each
|
|
39
|
+
* flag's help and choices are `geneseed build`'s (`cliCommand`), so the two verbs say one thing.
|
|
32
40
|
*/
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
export function validateUsage(width = helpWidth()) {
|
|
42
|
+
const build = new Map(cliCommand('build').options.map((o) => [o.names[0], o]));
|
|
43
|
+
const byDest = new Map();
|
|
44
|
+
for (const [table, isFlag] of [[VALUED, false], [FLAGS, true]]) {
|
|
45
|
+
for (const [flag, dest] of Object.entries(table)) {
|
|
46
|
+
if (NOT_VALIDATE.includes(flag)) continue;
|
|
47
|
+
if (byDest.has(dest)) { byDest.get(dest).names.push(flag); continue; }
|
|
48
|
+
const row = build.get(flag);
|
|
49
|
+
const choices = row?.choices ?? null;
|
|
50
|
+
// argparse's metavar is the dest upper-cased; the driver's dests are camelCase, so the
|
|
51
|
+
// flag spells it (`EXCLUDE_RULES`, as `build --help` shows), unless choices stand in.
|
|
52
|
+
const metavar = row?.metavar ?? (isFlag || choices ? null
|
|
53
|
+
: flag.slice(2).toUpperCase().replace(/-/g, '_'));
|
|
54
|
+
byDest.set(dest, {
|
|
55
|
+
names: [flag], dest, metavar, help: row?.help ?? '',
|
|
56
|
+
choices, required: false, nargs: isFlag ? '0' : null, is_flag: isFlag,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// `-v`/`--verbose` is the one flag `build` does not forward, so the table has no help for it.
|
|
61
|
+
const verbose = byDest.get('verbose');
|
|
62
|
+
if (verbose && !verbose.help) verbose.help = 'list every file the dry run would write';
|
|
63
|
+
return formatHelp({
|
|
64
|
+
options: [...byDest.values()],
|
|
65
|
+
description: "Render and emit into a throwaway sandbox, run the doctor's checks, and write "
|
|
66
|
+
+ `nothing real. Takes the generator's render flags except ${NOT_VALIDATE.slice(0, 2).join(' and ')}.`,
|
|
67
|
+
}, 'geneseed validate', width);
|
|
68
|
+
}
|
|
45
69
|
|
|
46
70
|
/**
|
|
47
71
|
* Capture the streams of an IN-PROCESS call.
|
|
@@ -149,13 +173,12 @@ export function cmdValidate(args) {
|
|
|
149
173
|
} catch (e) {
|
|
150
174
|
// A DELIBERATE refusal from the render (an unknown theme, an incomplete source).
|
|
151
175
|
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
176
|
+
// The refusal already explained itself on stderr (`loadTheme`'s sentence) on the way out;
|
|
177
|
+
// what crosses the seam is only its exit code. So this line names what failed and adds
|
|
178
|
+
// nothing after it: it used to end in that bare code (`: 1`), which read as a message
|
|
179
|
+
// cut short. The code is the process's exit status, where it belongs.
|
|
156
180
|
if (e && e.exitCode !== undefined) {
|
|
157
|
-
printOut(`[validate-only] render/emit FAILED for theme '${args.theme}' `
|
|
158
|
-
+ `emit '${emit}': ${e.exitCode}\n`);
|
|
181
|
+
printOut(`[validate-only] render/emit FAILED for theme '${args.theme}' emit '${emit}'\n`);
|
|
159
182
|
return null;
|
|
160
183
|
}
|
|
161
184
|
throw e;
|
package/js/lib/machine-dir.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import path from 'node:path';
|
|
|
17
17
|
/**
|
|
18
18
|
* The wiki manifest's names, newest first. The last two are earlier seeds', read with no end date:
|
|
19
19
|
* nothing yet tells a user an install missed the rename, so dropping one would lose a wiki in
|
|
20
|
-
* silence. The OpenCode plugins carry
|
|
20
|
+
* silence. The OpenCode plugins carry this line (`node tests/twins.mjs --write` after changing it).
|
|
21
21
|
*/
|
|
22
22
|
export const WIKI_NAMES = ['geneseed-wiki.jsonc', 'wiki.jsonc', 'wiki.json'];
|
|
23
23
|
|
package/js/lib/node-floor.mjs
CHANGED
|
@@ -6,7 +6,15 @@
|
|
|
6
6
|
* hook shim all run the binaries directly. ESM links the whole graph before any body runs, so
|
|
7
7
|
* this only helps while every file still PARSES on the old Node; it runs before any of them
|
|
8
8
|
* executes. The hook exits 0: a hook must never block a tool call, and the message on stderr
|
|
9
|
-
* is what the host surfaces.
|
|
9
|
+
* is what the host surfaces.
|
|
10
|
+
*
|
|
11
|
+
* Stdout is the hook's decision channel, and exactly one thing may go there: a gate verb's ask.
|
|
12
|
+
* A gate that exits 0 with stdout empty reads to Claude Code as "the gate deferred", so on an old
|
|
13
|
+
* Node every gated call used to run unjudged with nobody told. The gate now asks, with the
|
|
14
|
+
* gate-error wording a gate that failed to load uses (`verbFailed`, bin/geneseed-hook.mjs). Not on
|
|
15
|
+
* Bob: it ignores stdout and has no ask tier, and exit 2 there would refuse every tool, reads
|
|
16
|
+
* included, so Bob keeps the stderr sentence and exit 0. Every other verb and binary prints
|
|
17
|
+
* nothing on stdout.
|
|
10
18
|
*/
|
|
11
19
|
import path from 'node:path';
|
|
12
20
|
|
|
@@ -22,10 +30,42 @@ export function belowFloor(version, floor = NODE_FLOOR) {
|
|
|
22
30
|
return false;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
const GATE_VERBS = ['git-gate', 'rule-gate', 'tool-gate'];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* What a gate verb says on stdout below the floor: the document `askDecision(gateSafe('gate-error',
|
|
37
|
+
* 'ask', …))` builds (js/hosts/hooks-prims.mjs), written out. A literal because this file runs
|
|
38
|
+
* where that module may not parse; tests/unit/node_floor.test.mjs holds the two equal, and fails
|
|
39
|
+
* when NODE_FLOOR moves without it.
|
|
40
|
+
*/
|
|
41
|
+
export const FLOOR_ASK = '{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "ask", '
|
|
42
|
+
+ '"permissionDecisionReason": "Geneseed gate error: the check failed with \\"a Node older than 22.7\\", '
|
|
43
|
+
+ 'so nothing judged this call.\\nSafe choice: Deny, then run geneseed doctor.\\n'
|
|
44
|
+
+ 'It asks because a gate that crashed cannot say this call is safe.\\n'
|
|
45
|
+
+ 'If you allow it, this call runs with no check at all."}}\n';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* What a binary started as `argv` (`process.argv`) prints and exits with on Node `version`, or
|
|
49
|
+
* null at or above the floor. Pure, so the table in tests/unit/node_floor.test.mjs can state every
|
|
50
|
+
* case without an old Node to run. Only syntax every ESM-capable Node parses.
|
|
51
|
+
*/
|
|
52
|
+
export function floorVerdict(version, argv) {
|
|
53
|
+
if (!belowFloor(version)) return null;
|
|
54
|
+
const stderr = 'geneseed needs Node ' + NODE_FLOOR.replace(/\.0$/, '') + ' or newer; '
|
|
55
|
+
+ 'this is Node ' + version + '. '
|
|
28
56
|
+ 'Install a current Node from https://nodejs.org (or your package manager), then run the '
|
|
29
|
-
+ 'command again.\n'
|
|
30
|
-
|
|
57
|
+
+ 'command again.\n';
|
|
58
|
+
if (!path.basename(argv[1] || '').startsWith('geneseed-hook')) return { stderr: stderr, stdout: '', code: 1 };
|
|
59
|
+
const rest = argv.slice(3);
|
|
60
|
+
const bob = rest.some(function (tok, i) { return tok === '--host=bob' || (tok === 'bob' && rest[i - 1] === '--host'); });
|
|
61
|
+
const asks = GATE_VERBS.indexOf(argv[2]) !== -1 && !bob;
|
|
62
|
+
return { stderr: stderr, stdout: asks ? FLOOR_ASK : '', code: 0 };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const verdict = floorVerdict(process.versions.node, process.argv);
|
|
66
|
+
if (verdict) {
|
|
67
|
+
process.stderr.write(verdict.stderr);
|
|
68
|
+
// The platform's line end, as `printOut` (./fs.mjs) writes every other verdict.
|
|
69
|
+
if (verdict.stdout) process.stdout.write(process.platform === 'win32' ? verdict.stdout.replace(/\n/g, '\r\n') : verdict.stdout);
|
|
70
|
+
process.exit(verdict.code);
|
|
31
71
|
}
|
|
@@ -58,13 +58,15 @@ import {
|
|
|
58
58
|
CLAUDE_STYLE, DISABLED_STASH, GLOBAL_MANIFEST, HOSTS, VERSION_MARKER, expanduser, isHostGlobalDir, opencodeConfigDir,
|
|
59
59
|
resolvePath, settingsFile,
|
|
60
60
|
} from '../hosts/hosts.mjs';
|
|
61
|
-
import {
|
|
61
|
+
import { mcpLoad } from '../hosts/mcp.mjs';
|
|
62
62
|
import {
|
|
63
63
|
SRC_DIRS_MARKER, bundleFiles, hashesOf, ownedState, ownedWithin, recordedDenies, recordedEdit,
|
|
64
|
+
recordedGates,
|
|
64
65
|
} from '../hosts/owned.mjs';
|
|
65
66
|
import {
|
|
66
67
|
atomicWriteJson, managedBlockRead, managedBlockRemove, managedBlockWrite,
|
|
67
68
|
loadJsonObject, mergeClaudeSettings, opencodeTarget, OPENCODE_SENTINEL, opencodeSentinelWrite,
|
|
69
|
+
OWNED_VERDICT,
|
|
68
70
|
settingsIntegrityCheck, wireClaudeExcludes, unwireClaudeExcludes,
|
|
69
71
|
unwireClaudeSettings, wireClaudeEnv, unwireClaudeEnv,
|
|
70
72
|
} from '../hosts/settings.mjs';
|
|
@@ -72,6 +74,7 @@ import { printOut, printErr, readText, writeText, isFile, isDir, isOsError } fro
|
|
|
72
74
|
import { indexOfDeepEqual, isDict, jsonDumps, deepEquals } from '../lib/json.mjs';
|
|
73
75
|
import { sharedPaths } from '../lib/machine-dir.mjs';
|
|
74
76
|
import { archiveStore } from '../hosts/memory-files.mjs';
|
|
77
|
+
import { hostGlobalInstalls } from '../inspect/excludes.mjs';
|
|
75
78
|
import { comparePaths, isAbsolutePath } from '../lib/paths.mjs';
|
|
76
79
|
|
|
77
80
|
const hostSpec = (host) => HOSTS.find((h) => h.host === host);
|
|
@@ -245,12 +248,24 @@ const REVERSAL_MARKERS = [GLOBAL_MANIFEST, '.geneseed-theme', '.geneseed-emit',
|
|
|
245
248
|
* deactivate, which removed the entry but kept the denies (PR #241 review) — so either half
|
|
246
249
|
* alone is a change, and only "neither" declines.
|
|
247
250
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
251
|
+
* `gates` is the manifest's `bash_gates` — the `permission.bash` keys an emit itself ADDED,
|
|
252
|
+
* because they were absent when it ran. Uninstall once left all of them (some 45 keys:
|
|
253
|
+
* `"git commit*": "ask"` and the push chain) in a file whose harness was gone, although the
|
|
254
|
+
* record of having written them was right there. A recorded key goes only while it still reads
|
|
255
|
+
* the verdict Geneseed writes for it (`OWNED_VERDICT`): the same two conditions under which a
|
|
256
|
+
* pack-off rebuild takes one back (`reconcileOpencodePermission`), so a key the user re-scoped,
|
|
257
|
+
* and any key that is not in the record — theirs from the start, or from an install older than
|
|
258
|
+
* 5.2.0 — stays. An emptied `bash` object is dropped, as an emptied `skill` is; `permission`
|
|
259
|
+
* itself is left, empty or not, as those two sweeps leave it. `[]` (deactivate) sweeps nothing:
|
|
260
|
+
* a paused install keeps its gates, which is the fail-closed direction.
|
|
261
|
+
*
|
|
262
|
+
* A COMMENTED file — `opencode.json` or `.jsonc`, the extension does not matter — is not
|
|
263
|
+
* rewritten and the user is told to do it by hand — the entry, the recorded denies still set
|
|
264
|
+
* to `"deny"` AND the recorded gates still at Geneseed's verdict, each named: rewriting it
|
|
250
265
|
* would drop the comments. That branch returns False, so the caller's `unmerged` reports
|
|
251
266
|
* REALITY rather than intent.
|
|
252
267
|
*/
|
|
253
|
-
export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null) {
|
|
268
|
+
export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null, gates = []) {
|
|
254
269
|
const target = opencodeTarget(p);
|
|
255
270
|
// Absent, unreadable (the Python's `except OSError: return False`) or not an object: decline.
|
|
256
271
|
const { state, data: cfg, hadComments } = loadJsonObject(target);
|
|
@@ -266,20 +281,28 @@ export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null) {
|
|
|
266
281
|
// back only when nothing but its `"*"` is left — a key the user added since keeps the object.
|
|
267
282
|
const editObj = edit && isDict(cfg.permission) && isDict(cfg.permission.edit) ? cfg.permission.edit : null;
|
|
268
283
|
const asks = editObj ? edit.asks.filter((k) => editObj[k] === 'ask') : [];
|
|
269
|
-
|
|
270
|
-
|
|
284
|
+
const bash = isDict(cfg.permission) && isDict(cfg.permission.bash) ? cfg.permission.bash : null;
|
|
285
|
+
const ours = bash
|
|
286
|
+
? gates.filter((k) => OWNED_VERDICT.has(k) && bash[k] === OWNED_VERDICT.get(k))
|
|
287
|
+
: [];
|
|
288
|
+
if (!hasEntry && !denies.length && !asks.length && !ours.length) return false;
|
|
289
|
+
if (hadComments) {
|
|
271
290
|
printOut(`[uninstall] ${path.basename(target)} has comments — not rewriting it.`
|
|
272
291
|
+ (hasEntry ? ` Remove this from its "instructions" by hand: ${jsonDumps(entry)}` : '')
|
|
273
292
|
+ (denies.length ? ` Remove these from its "permission.skill" by hand: `
|
|
274
293
|
+ `${denies.map((n) => jsonDumps(n)).join(', ')}` : '')
|
|
275
294
|
+ (asks.length ? ` Remove these from its "permission.edit" by hand: `
|
|
276
295
|
+ `${asks.map((k) => jsonDumps(k)).join(', ')}` : '')
|
|
296
|
+
+ (ours.length ? ` Remove these from its "permission.bash" by hand: `
|
|
297
|
+
+ `${ours.map((k) => jsonDumps(k)).join(', ')}` : '')
|
|
277
298
|
+ '\n');
|
|
278
299
|
return false;
|
|
279
300
|
}
|
|
280
301
|
if (hasEntry) cfg.instructions = instr.filter((i) => i !== entry);
|
|
281
302
|
for (const name of denies) delete skill[name];
|
|
282
303
|
if (skill && denies.length && !Object.keys(skill).length) delete cfg.permission.skill;
|
|
304
|
+
for (const k of ours) delete bash[k];
|
|
305
|
+
if (ours.length && !Object.keys(bash).length) delete cfg.permission.bash;
|
|
283
306
|
for (const k of asks) delete editObj[k];
|
|
284
307
|
if (asks.length) {
|
|
285
308
|
const left = Object.keys(editObj);
|
|
@@ -323,7 +346,7 @@ export function claudeUninstall(cfg, archiveMemory, force = false) {
|
|
|
323
346
|
if (kept.length) warnKept(kept);
|
|
324
347
|
const hooks = managed.settings_hooks || [];
|
|
325
348
|
const sf = settingsFile(cfg, managed);
|
|
326
|
-
const unwired = unwireClaudeSettings(sf, hooks);
|
|
349
|
+
const unwired = unwireClaudeSettings(sf, hooks, cfg);
|
|
327
350
|
unwireClaudeExcludes(sf, managed.settings_excludes || []);
|
|
328
351
|
unwireClaudeEnv(sf, managed.settings_env);
|
|
329
352
|
// The unwire is VERIFIED, not assumed: a commented settings file is never rewritten, so a
|
|
@@ -360,7 +383,8 @@ export function uninstallGlobal(target, archiveMemory, host = 'opencode', force
|
|
|
360
383
|
if (isDir(p) && isEmptyDir(p)) rmdirQuiet(p);
|
|
361
384
|
}
|
|
362
385
|
const unmerged = unmergeOpencodeJson(path.join(target, 'opencode.json'),
|
|
363
|
-
path.join(target, 'AGENT.md').split(path.sep).join('/'), recordedDenies(man), recordedEdit(man)
|
|
386
|
+
path.join(target, 'AGENT.md').split(path.sep).join('/'), recordedDenies(man), recordedEdit(man),
|
|
387
|
+
recordedGates(man));
|
|
364
388
|
managedBlockRemove(path.join(target, OPENCODE_SENTINEL));
|
|
365
389
|
if (failed.length) warnMarkersKept();
|
|
366
390
|
else for (const m of REVERSAL_MARKERS) unlinkQuiet(path.join(target, m));
|
|
@@ -487,7 +511,8 @@ function opencodeProjectUninstall(root, force = false) {
|
|
|
487
511
|
}
|
|
488
512
|
}
|
|
489
513
|
const unmerged = unmergeOpencodeJson(path.join(root, 'opencode.json'), entry,
|
|
490
|
-
man ? recordedDenies(man) : [], man ? recordedEdit(man) : null
|
|
514
|
+
man ? recordedDenies(man) : [], man ? recordedEdit(man) : null,
|
|
515
|
+
man ? recordedGates(man) : []);
|
|
491
516
|
const result = { removed, unmerged, archived: null, userOnly };
|
|
492
517
|
if (failed.length) result.failed = failed;
|
|
493
518
|
if (kept.length) result.kept = kept;
|
|
@@ -720,7 +745,8 @@ export function projectQualifies(root, host) {
|
|
|
720
745
|
* 2. `--target` IS a project marker dir itself (…/.claude) — root is its parent.
|
|
721
746
|
* 3. `--target` (as a root) carries a Geneseed project install.
|
|
722
747
|
* 4. `--target` given and unrecognised — null, and the caller reports it.
|
|
723
|
-
* 5. No `--target`: the cwd, then the
|
|
748
|
+
* 5. No `--target`: the cwd, then the one global install on the machine, else the OpenCode
|
|
749
|
+
* global config dir (`cmdUninstall` refuses when there are several).
|
|
724
750
|
*/
|
|
725
751
|
export function uninstallResolve(targetArg) {
|
|
726
752
|
const globalHit = (p) => {
|
|
@@ -754,9 +780,23 @@ export function uninstallResolve(targetArg) {
|
|
|
754
780
|
// would otherwise return a root that LOOKS different from the identical directory.
|
|
755
781
|
const hit = projectHit(resolvePath(process.cwd()));
|
|
756
782
|
if (hit) return hit;
|
|
783
|
+
// The one global install on this machine, whatever its host: a Claude-only machine used to
|
|
784
|
+
// resolve to the empty OpenCode dir. With none, or several, the OpenCode dir stays the
|
|
785
|
+
// answer; `cmdUninstall` refuses the several case before it acts on it.
|
|
786
|
+
const globals = globalInstalls();
|
|
787
|
+
if (globals.length === 1) return [globals[0][0], 'global', globals[0][1]];
|
|
757
788
|
return ['opencode', 'global', opencodeConfigDir()];
|
|
758
789
|
}
|
|
759
790
|
|
|
791
|
+
/**
|
|
792
|
+
* `[host, configDir]` for each host's global dir that holds an install (`installState` not
|
|
793
|
+
* absent) — the candidates a bare `uninstall` chooses from. The walk is `hostGlobalInstalls`
|
|
794
|
+
* (`inspect/excludes.mjs`), its one owner; `version` and `diff` call it with their own marker.
|
|
795
|
+
*/
|
|
796
|
+
export function globalInstalls() {
|
|
797
|
+
return hostGlobalInstalls((host, dir) => installState(dir, host, 'global') !== 'absent');
|
|
798
|
+
}
|
|
799
|
+
|
|
760
800
|
/**
|
|
761
801
|
* The PROJECT installs still on record.
|
|
762
802
|
*
|
|
@@ -831,6 +871,17 @@ export function cmdUninstall(args) {
|
|
|
831
871
|
return 1;
|
|
832
872
|
}
|
|
833
873
|
const [host, scope, root] = hit;
|
|
874
|
+
// No `--target` and more than one global install: which one is meant is a guess, and this
|
|
875
|
+
// verb deletes. Refused before anything is printed as a target, `--yes` or not.
|
|
876
|
+
if (!args.target && scope === 'global') {
|
|
877
|
+
const globals = globalInstalls();
|
|
878
|
+
if (globals.length > 1) {
|
|
879
|
+
printErr(`[uninstall] ${globals.length} global installs found, and no --target names one. `
|
|
880
|
+
+ 'Run one of:\n'
|
|
881
|
+
+ globals.map(([h, d]) => ` geneseed uninstall --target "${d}" (${h}:global)\n`).join(''));
|
|
882
|
+
return 2;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
834
885
|
if (installState(root, host, scope) === 'absent') {
|
|
835
886
|
const where = scope === 'project' && host !== 'opencode'
|
|
836
887
|
? ` under ${hostSpec(host).projectMarker}/` : '';
|
|
@@ -983,7 +1034,7 @@ function installMoveList(root, kind) {
|
|
|
983
1034
|
*
|
|
984
1035
|
* Deliberately a minimal inline re-add rather than the emit's own merge, whose side effects
|
|
985
1036
|
* (adding `permission` and `lsp: true` when absent) would clobber values the user may have
|
|
986
|
-
* set since the install was disabled. A commented
|
|
1037
|
+
* set since the install was disabled. A commented file is not rewritten — the same
|
|
987
1038
|
* refusal `unmergeOpencodeJson` makes — but here the files have ALREADY been restored, so it
|
|
988
1039
|
* tells the operator what to add rather than failing the whole reactivate. That asymmetry is
|
|
989
1040
|
* the reference's and is gated per side.
|
|
@@ -997,7 +1048,7 @@ function installReaddEntry(target, entry) {
|
|
|
997
1048
|
if (state !== 'ok') return false; // unreadable (except OSError), or not an object
|
|
998
1049
|
const instr = Array.isArray(cfg.instructions) ? cfg.instructions : [];
|
|
999
1050
|
if (indexOfDeepEqual(instr, entry) >= 0) return false;
|
|
1000
|
-
if (
|
|
1051
|
+
if (hadComments) {
|
|
1001
1052
|
printOut(`[activate] ${path.basename(target)} has comments — not rewriting it. Add this `
|
|
1002
1053
|
+ `to its "instructions" by hand: ${jsonDumps(entry)}\n`);
|
|
1003
1054
|
return false;
|
|
@@ -1111,12 +1162,14 @@ export function installDeactivate(root, host = 'opencode', scope = 'global') {
|
|
|
1111
1162
|
}
|
|
1112
1163
|
const kind = installKind(root);
|
|
1113
1164
|
const target = opencodeTarget(path.join(root, 'opencode.json'));
|
|
1114
|
-
// Caught UP FRONT, before any file moves: a commented
|
|
1115
|
-
// dropping the user's comments, so refuse and move NOTHING.
|
|
1116
|
-
|
|
1165
|
+
// Caught UP FRONT, before any file moves: a commented file cannot be rewritten without
|
|
1166
|
+
// dropping the user's comments, so refuse and move NOTHING. By comments, not by extension:
|
|
1167
|
+
// the unmerge below refuses a commented `opencode.json` too, and a guard that let one
|
|
1168
|
+
// through would move every file and leave the `instructions` entry pointing at nothing.
|
|
1169
|
+
if (loadJsonObject(target).hadComments) {
|
|
1117
1170
|
return { ok: false,
|
|
1118
1171
|
error: `${path.basename(target)} has comments — refusing to rewrite it. `
|
|
1119
|
-
+ 'Disable by hand or
|
|
1172
|
+
+ 'Disable by hand or remove the comments first.' };
|
|
1120
1173
|
}
|
|
1121
1174
|
const stash = path.join(root, DISABLED_STASH);
|
|
1122
1175
|
const { done, failed } = moveAll(root, stash, installMoveList(root, kind));
|
|
@@ -1248,7 +1301,7 @@ function claudeDeactivate(root, scope = 'global', host = 'claude') {
|
|
|
1248
1301
|
cleanHostStash(cfg, host);
|
|
1249
1302
|
return { ok: false, failed, rolled_back: done.length };
|
|
1250
1303
|
}
|
|
1251
|
-
unwireClaudeSettings(settingsFile(cfg, managed), managed.settings_hooks || []);
|
|
1304
|
+
unwireClaudeSettings(settingsFile(cfg, managed), managed.settings_hooks || [], cfg);
|
|
1252
1305
|
unwireClaudeExcludes(settingsFile(cfg, managed), managed.settings_excludes || []);
|
|
1253
1306
|
unwireClaudeEnv(settingsFile(cfg, managed), managed.settings_env);
|
|
1254
1307
|
// The same integrity check the uninstall path runs: a deactivate that silently failed to
|
package/js/maintain/update.mjs
CHANGED
|
@@ -936,7 +936,17 @@ export async function upgrade(themeArg = null) {
|
|
|
936
936
|
* captured against the PRE-refresh source. Anything it throws is a warning on stderr and the
|
|
937
937
|
* upgrade continues — a failed export is a lost note, a blocked upgrade is a broken install.
|
|
938
938
|
*/
|
|
939
|
-
export async function cmdUpgrade(args) {
|
|
939
|
+
export async function cmdUpgrade(args, { handoff = reexec } = {}) {
|
|
940
|
+
// `--theme NAME` is the positional `[theme]` spelled as every other verb spells it; both kept.
|
|
941
|
+
// Two different answers on one line is a typo, not a choice, so it is refused before anything runs.
|
|
942
|
+
if (args.theme && args.themeOpt && args.theme !== args.themeOpt) {
|
|
943
|
+
printErr(`geneseed: error: argument --theme: '${args.themeOpt}' contradicts the theme `
|
|
944
|
+
+ `argument '${args.theme}' — give one.\n`);
|
|
945
|
+
return 2;
|
|
946
|
+
}
|
|
947
|
+
const theme = args.themeOpt || args.theme || null;
|
|
948
|
+
// `--setup`: the update with its step banner, then a FRESH `setup` — what `bootstrap` was.
|
|
949
|
+
if (args.setup) return updateThenSetup(theme, { handoff });
|
|
940
950
|
try {
|
|
941
951
|
const [ipath] = exportImprovements();
|
|
942
952
|
if (ipath) {
|
|
@@ -947,7 +957,7 @@ export async function cmdUpgrade(args) {
|
|
|
947
957
|
printErr(`[upgrade] ⚠️ could not export local edits (${e && e.message ? e.message : e}) — `
|
|
948
958
|
+ 'run `geneseed diff --out FILE` before upgrading to keep them.\n');
|
|
949
959
|
}
|
|
950
|
-
return upgrade(
|
|
960
|
+
return upgrade(theme);
|
|
951
961
|
}
|
|
952
962
|
|
|
953
963
|
// ---------------------------------------------------------------------------------------
|
|
@@ -1037,7 +1047,7 @@ export function diagnoseFailedStep(n, total, title, cmd, rc, output) {
|
|
|
1037
1047
|
*
|
|
1038
1048
|
* Returns true when a step FAILED, so scripted callers get a real exit code.
|
|
1039
1049
|
*/
|
|
1040
|
-
async function bootstrapPlain() {
|
|
1050
|
+
async function bootstrapPlain(theme = null) {
|
|
1041
1051
|
// One `git pull` refreshes launchers + factory together, then rebuilds — a single step.
|
|
1042
1052
|
//
|
|
1043
1053
|
// `cmdUpgrade`, NOT `upgrade`. The step the reference runs is the SUBCOMMAND — its argv is
|
|
@@ -1048,7 +1058,7 @@ async function bootstrapPlain() {
|
|
|
1048
1058
|
// which was written for `_flush_export_notes` and found this instead.
|
|
1049
1059
|
/** @type {Array<[string, string[], () => Promise<number>]>} */
|
|
1050
1060
|
const steps = [['Update & rebuild', updateStepCmd('upgrade'),
|
|
1051
|
-
() => cmdUpgrade({ theme
|
|
1061
|
+
() => cmdUpgrade({ theme })]];
|
|
1052
1062
|
let failed = false;
|
|
1053
1063
|
for (let i = 0; i < steps.length; i += 1) {
|
|
1054
1064
|
const [title, cmd, step] = steps[i];
|
|
@@ -1095,16 +1105,19 @@ function reexec(argv) {
|
|
|
1095
1105
|
*
|
|
1096
1106
|
* AN UNCHECKED SOURCE IS THE EXCEPTION: `setup` renders, and no doctor has judged this tree.
|
|
1097
1107
|
* An npm install has no record to hold, so it is not asked.
|
|
1108
|
+
*
|
|
1109
|
+
* `upgrade --setup` since `bootstrap` was folded into it; `setup: false` is what
|
|
1110
|
+
* `bootstrap --no-setup` still reaches for the one release it stays.
|
|
1098
1111
|
*/
|
|
1099
|
-
|
|
1100
|
-
const failed = await bootstrapPlain();
|
|
1112
|
+
async function updateThenSetup(theme, { handoff = reexec, setup = true } = {}) {
|
|
1113
|
+
const failed = await bootstrapPlain(theme);
|
|
1101
1114
|
flushExportNotes();
|
|
1102
1115
|
if (isGitCheckout() && pendingGate()) {
|
|
1103
1116
|
printOut('[geneseed] setup not started: the source has no doctor verdict yet. '
|
|
1104
1117
|
+ 'Run `geneseed update`, then `geneseed setup`.\n');
|
|
1105
1118
|
return 1;
|
|
1106
1119
|
}
|
|
1107
|
-
if (
|
|
1120
|
+
if (setup) {
|
|
1108
1121
|
const rc = handoff([process.execPath,
|
|
1109
1122
|
path.join(String(ROOT), 'bin', 'geneseed-cli.mjs'), 'setup']);
|
|
1110
1123
|
return failed ? 1 : rc;
|
|
@@ -1112,3 +1125,14 @@ export async function cmdBootstrap(args, { handoff = reexec } = {}) {
|
|
|
1112
1125
|
// Scripted `bootstrap --no-setup` must not exit 0 over a failed update.
|
|
1113
1126
|
return failed ? 1 : 0;
|
|
1114
1127
|
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* `bootstrap`, DEPRECATED: folded into `upgrade --setup`. Kept one release as an alias that
|
|
1131
|
+
* says so on stderr and then does exactly what it did; its `--no-setup` is a plain `upgrade`
|
|
1132
|
+
* with the step banner.
|
|
1133
|
+
*/
|
|
1134
|
+
export async function cmdBootstrap(args, { handoff = reexec } = {}) {
|
|
1135
|
+
printErr('[geneseed] bootstrap is deprecated: run `geneseed upgrade --setup` '
|
|
1136
|
+
+ '(or `geneseed upgrade` for --no-setup).\n');
|
|
1137
|
+
return updateThenSetup(null, { handoff, setup: !args.noSetup });
|
|
1138
|
+
}
|
package/js/ui/cli.mjs
CHANGED
|
@@ -35,15 +35,19 @@
|
|
|
35
35
|
import { readFileSync } from 'node:fs';
|
|
36
36
|
import path from 'node:path';
|
|
37
37
|
|
|
38
|
+
import { choicesFor } from '../build/args.mjs';
|
|
38
39
|
import { ROOT } from '../build/source.mjs';
|
|
39
40
|
import { printOut } from '../lib/fs.mjs';
|
|
40
41
|
import { parseIntStrict, stripWhitespace } from '../lib/text.mjs';
|
|
41
42
|
|
|
42
43
|
const CLI_JSON = path.join(ROOT, 'js', 'cli-table.json');
|
|
43
44
|
|
|
44
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The keys the docs page carries, per argument — `type` and `hidden` are ours. `description` is
|
|
47
|
+
* an argument's own paragraph, when the table gives one; `null` when it does not.
|
|
48
|
+
*/
|
|
45
49
|
const PAGE_ARG_KEYS = ['names', 'dest', 'metavar', 'help', 'choices', 'default',
|
|
46
|
-
'required', 'nargs', 'is_flag'];
|
|
50
|
+
'required', 'nargs', 'is_flag', 'description'];
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
53
|
* `js/cli-table.json`, parsed. An unreadable file is the empty reference; the entry points
|
|
@@ -61,6 +65,26 @@ function load() {
|
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
68
|
+
/**
|
|
69
|
+
* `build` forwards the generator's flags, and the generator owns their choice lists — two of
|
|
70
|
+
* them (`--posture`, `--mode`) are discovered from the checkout. So the table carries no copy:
|
|
71
|
+
* the readers that SHOW the rows (help, the docs page) lay `choicesFor` over them here. Not in
|
|
72
|
+
* `load`: `cliSpec` never reads an option's choices, and every verb's parse would pay the scan.
|
|
73
|
+
*/
|
|
74
|
+
function withDriverChoices(cmd) {
|
|
75
|
+
if (cmd?.name !== 'build') return cmd;
|
|
76
|
+
const choices = choicesFor();
|
|
77
|
+
for (const o of cmd.options ?? []) {
|
|
78
|
+
const list = choices[o.names?.[0]];
|
|
79
|
+
if (!list) continue;
|
|
80
|
+
o.choices = list;
|
|
81
|
+
// A row with its own metavar (`--emit`: nine names do not fit a usage line) names the
|
|
82
|
+
// list in its help instead of in `{…}`.
|
|
83
|
+
if (o.metavar) o.help = `${o.help} (one of: ${list.join(', ')})`;
|
|
84
|
+
}
|
|
85
|
+
return cmd;
|
|
86
|
+
}
|
|
87
|
+
|
|
64
88
|
const pageArgs = (args) => (args ?? [])
|
|
65
89
|
.filter((a) => !a.hidden)
|
|
66
90
|
.map((a) => Object.fromEntries(PAGE_ARG_KEYS.map((k) => [k, a[k] ?? null])));
|
|
@@ -77,7 +101,7 @@ export function cliReference() {
|
|
|
77
101
|
const data = load();
|
|
78
102
|
return {
|
|
79
103
|
prog: data.prog ?? 'geneseed',
|
|
80
|
-
commands: (data.commands ?? []).map((c) => ({
|
|
104
|
+
commands: (data.commands ?? []).map(withDriverChoices).map((c) => ({
|
|
81
105
|
name: c.name ?? '',
|
|
82
106
|
help: c.help ?? '',
|
|
83
107
|
description: c.description ?? '',
|
|
@@ -364,6 +388,12 @@ export function formatHelp(cmd, prog, width) {
|
|
|
364
388
|
maxHelpPosition);
|
|
365
389
|
|
|
366
390
|
const blocks = [`${formatUsage(prog, optParts, posParts, width)}\n`];
|
|
391
|
+
// argparse's `description`, wrapped to the full width after the usage line. It is where a
|
|
392
|
+
// verb's paragraph lives, so the top-level listing can keep each verb to one short line.
|
|
393
|
+
if (cmd.description && cmd.description.trim()) {
|
|
394
|
+
const collapsed = cmd.description.replace(/[ \t\n\v\f\r]+/g, ' ').trim();
|
|
395
|
+
blocks.push(`${wrapText(collapsed, Math.max(width, 11)).join('\n')}\n`);
|
|
396
|
+
}
|
|
367
397
|
if (positionals.length) {
|
|
368
398
|
blocks.push(`positional arguments:\n${positionals
|
|
369
399
|
.map((a) => formatAction(a, true, helpPosition, width)).join('')}`);
|
|
@@ -401,7 +431,7 @@ export function helpWidth() {
|
|
|
401
431
|
|
|
402
432
|
/** One command's raw row — everything the table knows, unlike the page's filtered view. */
|
|
403
433
|
export function cliCommand(verb) {
|
|
404
|
-
return (load().commands ?? []).find((c) => c.name === verb) ?? null;
|
|
434
|
+
return withDriverChoices((load().commands ?? []).find((c) => c.name === verb) ?? null);
|
|
405
435
|
}
|
|
406
436
|
|
|
407
437
|
/**
|
package/js/ui/menu.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import { startDaemon } from '../web/daemon.mjs';
|
|
|
25
25
|
/** The off-TTY arm, and the fallback both TTY arms end in. */
|
|
26
26
|
function menuHelp() {
|
|
27
27
|
printOut('Geneseed — no interactive menu here. Get started with: geneseed setup\n');
|
|
28
|
-
printOut('Other commands:
|
|
28
|
+
printOut('Other commands: update · build · doctor · diff · web\n');
|
|
29
29
|
printOut('`geneseed --help` lists every command.\n');
|
|
30
30
|
return 0;
|
|
31
31
|
}
|
package/js/ui/tui.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `tui` — and the TUI's pure half: the layout helpers that have no screen in them.
|
|
3
3
|
*
|
|
4
|
-
* `cmdTui` is an
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `isTTY` true in a child and asserts
|
|
8
|
-
* the
|
|
4
|
+
* `cmdTui` is RETIRED: an alias kept one release that prints one line pointing at `geneseed
|
|
5
|
+
* menu` and returns 0, on a TTY or off one — `menu`'s own off-terminal exit. There is no
|
|
6
|
+
* full-screen panel behind it, the same decision `js/ui/menu.mjs` makes.
|
|
7
|
+
* `tests/unit/no_panel.test.mjs` fakes `isTTY` true in a child and asserts the exit code, that
|
|
8
|
+
* the line names only declared verbs, and that nothing is drawn.
|
|
9
9
|
*
|
|
10
10
|
* What lives here is the alignment contract — the functions below that decide what a row
|
|
11
11
|
* looks like: display width, fitting, glyph tiers, the catalogue's entries and detail lines.
|
|
@@ -310,15 +310,12 @@ export function detailLines(kind, label, data) {
|
|
|
310
310
|
// ---- the verb ------------------------------------------------------------------------
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
|
-
* The `tui` verb
|
|
314
|
-
*
|
|
313
|
+
* The `tui` verb, RETIRED: it refused on every terminal, since there is no panel (see this
|
|
314
|
+
* module's header). Kept one release as an alias that says where to go and exits as `menu`
|
|
315
|
+
* does off a terminal (0), so a script that called it learns the new name without breaking.
|
|
316
|
+
* The same one line on a TTY and off one. The layout helpers above stay: `catalog` uses them.
|
|
315
317
|
*/
|
|
316
318
|
export function cmdTui() {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return 1;
|
|
320
|
-
}
|
|
321
|
-
printOut('[tui] full-screen panel unavailable (this entry carries the TUI\'s layout '
|
|
322
|
-
+ 'half, not its screens). Use `geneseed setup`, `geneseed doctor`, or `geneseed build`.\n');
|
|
323
|
-
return 1;
|
|
319
|
+
printOut('[tui] tui is retired; use `geneseed menu`.\n');
|
|
320
|
+
return 0;
|
|
324
321
|
}
|
package/js/web/actions.mjs
CHANGED
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
opencodeConfigDir, resolvePath,
|
|
49
49
|
} from '../hosts/hosts.mjs';
|
|
50
50
|
import {
|
|
51
|
-
EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, kitsOfDir, sharedTierOfDir, renderedTier,
|
|
51
|
+
EMIT_FOR, EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, kitsOfDir, sharedTierOfDir, renderedTier,
|
|
52
52
|
footprintOfDir, gatesOfDir,
|
|
53
53
|
installState, installTargets, modeOfDir, postureOfDir, themeOfDir,
|
|
54
54
|
trustOfDir,
|
|
@@ -234,6 +234,8 @@ export function targetView(base, [host, scope, root]) {
|
|
|
234
234
|
v = webState(null, target);
|
|
235
235
|
v.selectView(target, root, emitOf(host, scope));
|
|
236
236
|
v.pinned = true;
|
|
237
|
+
// A serving daemon runs no doctor on the event loop, for a named install either (`warmDoctor`).
|
|
238
|
+
Object.defineProperty(v, 'warm', { get: () => base.warm });
|
|
237
239
|
// The daemon's one memo: a render is keyed on what it read, not on who asked for it.
|
|
238
240
|
v.renderMemo = (base.renderMemo ??= renderMemo());
|
|
239
241
|
v.refresh = base.refresh;
|
|
@@ -714,14 +716,6 @@ export function apiRestore(state, files) {
|
|
|
714
716
|
return { restored, deleted, errors, archive };
|
|
715
717
|
}
|
|
716
718
|
|
|
717
|
-
/** (host, scope) -> the emit name that installs it. */
|
|
718
|
-
const EMIT_FOR = new Map([
|
|
719
|
-
['opencode global', 'opencode-global'], ['opencode project', 'opencode'],
|
|
720
|
-
['claude global', 'claude-global'], ['claude project', 'claude'],
|
|
721
|
-
['bob global', 'bob-global'], ['bob project', 'bob'],
|
|
722
|
-
['openclaude global', 'openclaude-global'], ['openclaude project', 'openclaude'],
|
|
723
|
-
]);
|
|
724
|
-
|
|
725
719
|
/**
|
|
726
720
|
* The build command that installs Geneseed into a DETECTED location, or re-themes an
|
|
727
721
|
* already-active one (an in-place re-emit, the same command either way).
|