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
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* (`git reflog expire --expire=now --all`, Law IV in Bob's `BLOCK_RULES`) and one that must pass (`git status`).
|
|
10
10
|
* A gate wired `--no-deletion-gate` passes the Law IV call by design, so `badCommandFor` swaps in a
|
|
11
11
|
* root-wide scan (ops 2) it must still refuse — a disarmed install is not a gate that stopped working.
|
|
12
|
+
* Bob is asked in Bob's own shapes as well (`probesFor`): the legacy payload, and a `write_file`
|
|
13
|
+
* carrying a credential.
|
|
12
14
|
* Both directions are judged, because "allows everything" and "refuses everything" (the
|
|
13
15
|
* PowerShell-fallback case `hookShellProblems` can only infer) are both broken gates.
|
|
14
16
|
*
|
|
@@ -44,7 +46,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
44
46
|
* runs everything through `tool-gate --host bob`. OpenCode's guard is an in-process plugin with
|
|
45
47
|
* no command: `guardProbe` below imports it instead.
|
|
46
48
|
*/
|
|
47
|
-
const PROBED_VERB = { claude: 'git-gate', openclaude: 'git-gate', bob: 'tool-gate' };
|
|
49
|
+
export const PROBED_VERB = { claude: 'git-gate', openclaude: 'git-gate', bob: 'tool-gate' };
|
|
48
50
|
|
|
49
51
|
// A Law IV act that loses data in EVERY state: since the gate asks only on real loss
|
|
50
52
|
// (2026-10-17), a state-dependent act such as `reset --hard` would pass on a clean tree.
|
|
@@ -68,6 +70,61 @@ function probePayload(command, cwd) {
|
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
/** The older Bob shape, `{event, tool, input}`, which `tool-gate` normalises at its entry. */
|
|
74
|
+
function legacyBobPayload(command) {
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
event: 'PreToolUse', session_id: 'geneseed-probe', tool: 'execute_command', input: { command },
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A credential-shaped string, put together at run time: the literal would trip this repo's own
|
|
82
|
+
* secret scans, and Law I's hook on whoever edits this file. It is the documented AWS example
|
|
83
|
+
* key id, which opens no account.
|
|
84
|
+
*/
|
|
85
|
+
const probeCredential = () => ['AK', 'IA', 'IOSFODNN7', 'EXAMPLE'].join('');
|
|
86
|
+
|
|
87
|
+
/** Bob's `write_file`, in the keys Bob 2.2.3 sends, carrying `probeCredential()`. */
|
|
88
|
+
function bobSecretWritePayload(cwd) {
|
|
89
|
+
return JSON.stringify({
|
|
90
|
+
session_id: 'geneseed-probe', hook_event_name: 'PreToolUse', tool_name: 'write_file',
|
|
91
|
+
tool_input: { path: 'geneseed-probe.txt', content: `aws_access_key_id = ${probeCredential()}\n` },
|
|
92
|
+
cwd,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** What the Bob credential probe is called in a problem line. Never the credential itself. */
|
|
97
|
+
export const SECRET_PROBE_NAME = 'write_file with a credential';
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The probes for one gate command: `{ shape, name, bad, good }`, each a payload pair. `shape`
|
|
101
|
+
* is '' for the first, so a Claude or OpenClaude problem line reads as it always did; `good` is
|
|
102
|
+
* null where only the refusal is asked.
|
|
103
|
+
*
|
|
104
|
+
* Claude and OpenClaude get the one Claude-shaped pair. BOB GETS THREE, because a Claude-shaped
|
|
105
|
+
* Bash call is not what Bob sends: `tool-gate` reads a `command` field wherever it sits, so
|
|
106
|
+
* that pair alone could pass while the gate was blind to Bob's own payloads. The second pair is
|
|
107
|
+
* the legacy `{event, tool, input}` shape, which `normaliseBobPayload` must still lift; the
|
|
108
|
+
* third is a `write_file`, Bob's own edit tool, carrying a credential, which reaches Law I
|
|
109
|
+
* through the rule half of the gate. A gate wired `--no-secrets-gate` passes that write by
|
|
110
|
+
* design, so the third probe is left out, the way `badCommandFor` swaps the Law IV command.
|
|
111
|
+
*/
|
|
112
|
+
export function probesFor(host, command, cwd) {
|
|
113
|
+
const badCommand = badCommandFor(command);
|
|
114
|
+
const probes = [{
|
|
115
|
+
shape: '', name: badCommand, bad: probePayload(badCommand, cwd), good: probePayload(GOOD_COMMAND, cwd),
|
|
116
|
+
}];
|
|
117
|
+
if (host !== 'bob') return probes;
|
|
118
|
+
probes.push({
|
|
119
|
+
shape: "Bob's legacy payload", name: badCommand,
|
|
120
|
+
bad: legacyBobPayload(badCommand), good: legacyBobPayload(GOOD_COMMAND),
|
|
121
|
+
});
|
|
122
|
+
if (!/ --no-secrets-gate(?:\s|$)/.test(command)) {
|
|
123
|
+
probes.push({ shape: "Bob's write_file", name: SECRET_PROBE_NAME, bad: bobSecretWritePayload(cwd), good: null });
|
|
124
|
+
}
|
|
125
|
+
return probes;
|
|
126
|
+
}
|
|
127
|
+
|
|
71
128
|
/**
|
|
72
129
|
* The shell a host runs this handler under, as `{ exe, argv, label, verbatim }` — or null when
|
|
73
130
|
* that shell is not on this machine. Mirrors the emit's own rule: an explicit
|
|
@@ -170,10 +227,14 @@ export function gateProbe(targets = installTargets(), { platform = process.platf
|
|
|
170
227
|
}
|
|
171
228
|
const verdict = withTempDir((tmp) => {
|
|
172
229
|
const runEnv = { ...env, GENESEED_GATE_PROBE: '1', CLAUDE_PROJECT_DIR: tmp };
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
230
|
+
// The first probe that fails is the verdict: one line per gate, naming the shape.
|
|
231
|
+
for (const p of probesFor(host, handler.command, tmp)) {
|
|
232
|
+
const bad = runOnce(shell, p.bad, tmp, runEnv);
|
|
233
|
+
const good = p.good ? runOnce(shell, p.good, tmp, runEnv) : { status: 0, stdout: '', stderr: '' };
|
|
234
|
+
const v = probeVerdict(host, bad, good, p.name);
|
|
235
|
+
if (v) return p.shape ? `${v} (${p.shape})` : v;
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
177
238
|
}, 'geneseed-probe-');
|
|
178
239
|
if (verdict) problems.push(`${label} under ${shell.label} ${verdict}`);
|
|
179
240
|
else probed.push(`${path.normalize(cfg)} (${verb}, ${shell.label})`);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The checks over the REPO's own records — the registry, committed secrets, the hook shim,
|
|
3
3
|
* the vendored skill folders (their pins and their SKILL.md frontmatter), skill aliases and
|
|
4
|
-
* side files, the `js/README.md` module map, the host tables,
|
|
4
|
+
* side files, the `js/README.md` module map, the host tables (their columns, Bob's block set,
|
|
5
|
+
* the one place a verified claim may sit, citations nobody can open), and the scorecard ratchet.
|
|
5
6
|
*
|
|
6
7
|
* Same contract as `checks-build.mjs`: an array of problem strings, empty when clean, one
|
|
7
8
|
* planted fault per check in the gate. This is the group that reads what the repo SAYS about
|
|
@@ -20,6 +21,7 @@ import { hookShimPath, shimDeadPaths } from '../hosts/shim.mjs';
|
|
|
20
21
|
import { readText } from '../lib/fs.mjs';
|
|
21
22
|
import { formatRepr, formatValue } from '../lib/json.mjs';
|
|
22
23
|
import { splitLines } from '../lib/udiff.mjs';
|
|
24
|
+
import { HOOK_PINNED } from './checks-constitution.mjs';
|
|
23
25
|
import { ENTITY_STATUSES } from './inventory.mjs';
|
|
24
26
|
import { assessRepo } from './scorecard.mjs';
|
|
25
27
|
import { badgeUrl, renderSvg } from './scorecard-svg.mjs';
|
|
@@ -547,7 +549,7 @@ export function moduleMapProblems() {
|
|
|
547
549
|
* machine-facing table (config dirs, project markers, catalog flags), and a doc-table LABEL is
|
|
548
550
|
* a fact about two Markdown files, not about an install.
|
|
549
551
|
*/
|
|
550
|
-
const HOST_LABELS = { opencode: 'OpenCode', claude: 'Claude Code', bob: 'Bob', openclaude: 'OpenClaude' };
|
|
552
|
+
export const HOST_LABELS = { opencode: 'OpenCode', claude: 'Claude Code', bob: 'Bob', openclaude: 'OpenClaude' };
|
|
551
553
|
|
|
552
554
|
/**
|
|
553
555
|
* The two hand-written, one-column-per-host tables, and the non-host columns each one carries
|
|
@@ -615,6 +617,198 @@ export function hostMatrixProblems(root = ROOT) {
|
|
|
615
617
|
return problems;
|
|
616
618
|
}
|
|
617
619
|
|
|
620
|
+
/** `I`..`X` as the hook ledger numbers a law: the canon's label to the `law-N` key. */
|
|
621
|
+
const ROMAN = { I: 1, II: 2, III: 3, IV: 4, V: 5, VI: 6, VII: 7, VIII: 8, IX: 9, X: 10 };
|
|
622
|
+
|
|
623
|
+
/** `HOOK_PINNED`'s label (`IV`, `process 1`) as the hook's ledger key (`law-4`, `process-1`). */
|
|
624
|
+
const ledgerKey = (label) => (ROMAN[label] ? `law-${ROMAN[label]}` : label.replace(' ', '-'));
|
|
625
|
+
|
|
626
|
+
/** The ids inside `BLOCK_RULES = new Set([...])`, read off the source text; null when not found. */
|
|
627
|
+
function blockRulesOf(text) {
|
|
628
|
+
const m = /const BLOCK_RULES = new Set\(\[([^\]]*)\]\)/.exec(text);
|
|
629
|
+
return m ? new Set([...m[1].matchAll(/'([^']+)'/g)].map((x) => x[1])) : null;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** Every `| … |` row of `text` as trimmed cells, the edge cells dropped. */
|
|
633
|
+
function tableRows(text) {
|
|
634
|
+
return text.split('\n').map((l) => l.trim()).filter((l) => l.startsWith('|'))
|
|
635
|
+
.map((l) => l.split('|').slice(1, -1).map((c) => c.trim()));
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* The Bob column of `docs/concepts/enforcement-table.md` says "block" exactly for the rules in
|
|
640
|
+
* `BLOCK_RULES` (`js/hosts/hooks.mjs`).
|
|
641
|
+
*
|
|
642
|
+
* WHY. Eight pages restated that set in prose, and when `process-1` joined it (2026-11) one
|
|
643
|
+
* was updated. The pages now point at the table, so the table is the one copy left to hold to
|
|
644
|
+
* the code. A rule's Bob cell that STARTS with `block` is a block; anything else (`log only`,
|
|
645
|
+
* `not judged`) is not. The rows are the `HOOK_PINNED` ids, whose labels give the ledger key.
|
|
646
|
+
*
|
|
647
|
+
* `BLOCK_RULES` is read by a regex over the source, never imported: `hooks.mjs` reaches
|
|
648
|
+
* `loss.mjs`, which starts a process, and the doctor runs inside the CLI, which may not
|
|
649
|
+
* (`tests/unit/hook_cli.test.mjs`). A source line the regex no longer finds is its own problem,
|
|
650
|
+
* so a refactor cannot turn this arm into one that checks nothing.
|
|
651
|
+
*/
|
|
652
|
+
export function bobBlockProblems(root = ROOT) {
|
|
653
|
+
const rel = 'docs/concepts/enforcement-table.md';
|
|
654
|
+
let table; let hooks;
|
|
655
|
+
try {
|
|
656
|
+
table = readText(path.join(root, ...rel.split('/')));
|
|
657
|
+
hooks = readText(path.join(root, 'js', 'hosts', 'hooks.mjs'));
|
|
658
|
+
} catch (e) {
|
|
659
|
+
return [`[authoring] the Bob block check cannot read its inputs: ${e.message}`];
|
|
660
|
+
}
|
|
661
|
+
const blocked = blockRulesOf(hooks);
|
|
662
|
+
if (!blocked) {
|
|
663
|
+
return ['[authoring] js/hosts/hooks.mjs no longer declares `const BLOCK_RULES = new Set([…])` '
|
|
664
|
+
+ 'on one line — the Bob block check (js/inspect/checks-repo.mjs) reads that line'];
|
|
665
|
+
}
|
|
666
|
+
const rows = tableRows(table);
|
|
667
|
+
const header = rows.find((r) => r[0] === 'id');
|
|
668
|
+
const bob = header ? header.indexOf('Bob') : -1;
|
|
669
|
+
if (bob < 0) return [`[authoring] ${rel} has no \`id\` table with a Bob column`];
|
|
670
|
+
const problems = [];
|
|
671
|
+
for (const [id, label] of Object.entries(HOOK_PINNED)) {
|
|
672
|
+
const row = rows.find((r) => r[0] === `\`${id}\``);
|
|
673
|
+
if (!row) { problems.push(`[authoring] ${rel} has no row for \`${id}\`, a rule the hooks gate`); continue; }
|
|
674
|
+
const says = /^block\b/.test(row[bob] || '');
|
|
675
|
+
const does = blocked.has(ledgerKey(label));
|
|
676
|
+
if (says !== does) {
|
|
677
|
+
problems.push(`[authoring] ${rel}: the Bob cell of \`${id}\` ${says ? 'says' : 'does not say'} `
|
|
678
|
+
+ `"block", but BLOCK_RULES (js/hosts/hooks.mjs) ${does ? 'has' : 'does not have'} `
|
|
679
|
+
+ `${ledgerKey(label)} — the table is the one statement of what Bob refuses`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
return problems;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Directories a walk of the checkout must not enter: the VCS directory, installed packages,
|
|
687
|
+
* build output, and the local working trees `.gitignore` names. The doctor cannot ask which
|
|
688
|
+
* files are tracked (no spawn in the CLI), so this list stands in for it; `docs/reviews` is
|
|
689
|
+
* here because a maintainer's machine has one.
|
|
690
|
+
*/
|
|
691
|
+
const WALK_SKIP = new Set([
|
|
692
|
+
'.git', 'node_modules', 'web/node_modules', 'web/dist', 'Harness', 'archived-Harness',
|
|
693
|
+
'improvements', 'coverage', 'reports', '.stryker-tmp', '.superpowers', '.geneseed',
|
|
694
|
+
'.claude/worktrees', 'docs/specs', 'docs/reviews', 'docs/superpowers',
|
|
695
|
+
'agents', 'doctrines', 'laws', 'memory', 'modes', 'ontology', 'postures', 'skills', 'notebook',
|
|
696
|
+
]);
|
|
697
|
+
|
|
698
|
+
/** The text files a claim or a citation can sit in. */
|
|
699
|
+
const TEXT_EXT = new Set(['.md', '.mjs', '.js', '.cjs', '.ts', '.tsx', '.json', '.yml', '.yaml', '.txt', '.tmpl']);
|
|
700
|
+
|
|
701
|
+
/** Every text file under `root` outside `WALK_SKIP`, as sorted `/`-separated relative paths. */
|
|
702
|
+
function checkoutTextFiles(root) {
|
|
703
|
+
const out = [];
|
|
704
|
+
const walk = (dir, rel) => {
|
|
705
|
+
let entries;
|
|
706
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
707
|
+
for (const e of entries) {
|
|
708
|
+
const r = rel ? `${rel}/${e.name}` : e.name;
|
|
709
|
+
if (WALK_SKIP.has(r)) continue;
|
|
710
|
+
if (e.isDirectory()) walk(path.join(dir, e.name), r);
|
|
711
|
+
else if (e.isFile() && TEXT_EXT.has(path.extname(e.name))) out.push(r);
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
walk(root, '');
|
|
715
|
+
return out.sort();
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/** The heading that opens the one block allowed to say what is verified, and its file. */
|
|
719
|
+
const VERIFIED_FILE = 'docs/concepts/host-matrix.md';
|
|
720
|
+
const VERIFIED_HEADING = '## What is verified';
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* A verified/unverified claim about a host, in the words this repo used for one. Two shapes:
|
|
724
|
+
* "verified live" / "unverified live", and "not (yet) (been) run|verified|tested against".
|
|
725
|
+
*/
|
|
726
|
+
const STRAY_CLAIM_RE = /(un)?verified live|not (yet )?(been )?(run|verified|tested) against/i;
|
|
727
|
+
|
|
728
|
+
/** `text` with the What-is-verified block (heading to the next `## `) blanked, lines kept. */
|
|
729
|
+
function withoutVerifiedBlock(text) {
|
|
730
|
+
const lines = text.split('\n');
|
|
731
|
+
const start = lines.findIndex((l) => l.trim() === VERIFIED_HEADING);
|
|
732
|
+
if (start < 0) return text;
|
|
733
|
+
let end = lines.findIndex((l, i) => i > start && /^## /.test(l));
|
|
734
|
+
if (end < 0) end = lines.length;
|
|
735
|
+
return lines.map((l, i) => (i >= start && i < end ? '' : l)).join('\n');
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* What is verified about a host is said in ONE place, `## What is verified` in
|
|
740
|
+
* `docs/concepts/host-matrix.md`; a Markdown file that says it anywhere else fails.
|
|
741
|
+
*
|
|
742
|
+
* WHY. Nine pages each carried their own sentence, written at different times, and they
|
|
743
|
+
* disagreed: two said OpenClaude had never been run while the canary ran it weekly, and three
|
|
744
|
+
* said nothing about Bob had been seen live after two live sessions. A claim with a date can
|
|
745
|
+
* only stay true where someone will look for it. `CHANGELOG.md` and `docs/adr/` are dated
|
|
746
|
+
* records of what was true then, so they are exempt; the block itself is where the words belong.
|
|
747
|
+
*/
|
|
748
|
+
export function strayClaimProblems(root = ROOT) {
|
|
749
|
+
const problems = [];
|
|
750
|
+
const block = path.join(root, ...VERIFIED_FILE.split('/'));
|
|
751
|
+
if (!(isFile(block) && readText(block).split('\n').some((l) => l.trim() === VERIFIED_HEADING))) {
|
|
752
|
+
problems.push(`[authoring] ${VERIFIED_FILE} has no \`${VERIFIED_HEADING}\` section — the one `
|
|
753
|
+
+ 'place that says what was checked against each host');
|
|
754
|
+
}
|
|
755
|
+
for (const rel of checkoutTextFiles(root)) {
|
|
756
|
+
if (!rel.endsWith('.md') || rel === 'CHANGELOG.md' || rel.startsWith('docs/adr/')) continue;
|
|
757
|
+
let text;
|
|
758
|
+
try { text = readText(path.join(root, ...rel.split('/'))); } catch { continue; }
|
|
759
|
+
if (rel === VERIFIED_FILE) text = withoutVerifiedBlock(text);
|
|
760
|
+
text.split('\n').forEach((line, i) => {
|
|
761
|
+
const m = STRAY_CLAIM_RE.exec(line);
|
|
762
|
+
if (m) {
|
|
763
|
+
problems.push(`[authoring] ${rel}:${i + 1} says "${m[0]}" — what is verified about a host `
|
|
764
|
+
+ `is said only under \`${VERIFIED_HEADING}\` in ${VERIFIED_FILE}; link there instead`);
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
return problems;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/** A citation of the local review notes: the directory, or one of the three files by name. */
|
|
772
|
+
const LOCAL_NOTE_RE = /docs\/reviews\/|bob-(verdict|docs|code)\.md/;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Files that may name `docs/reviews/`: this arm and its test (the pattern and its fixtures),
|
|
776
|
+
* the changelog (a dated record) and the packaging test (it records that the directory must
|
|
777
|
+
* never ship). `.gitignore`, which is what makes the directory local, has no text extension
|
|
778
|
+
* and is never read.
|
|
779
|
+
*/
|
|
780
|
+
const LOCAL_NOTE_EXEMPT = new Set([
|
|
781
|
+
'js/inspect/checks-repo.mjs', 'tests/unit/doctor_host_claims.test.mjs', 'CHANGELOG.md',
|
|
782
|
+
'tests/unit/package_manifest.test.mjs',
|
|
783
|
+
]);
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* No tracked file cites `docs/reviews/`, which `.gitignore` keeps off every machine but the
|
|
787
|
+
* author's.
|
|
788
|
+
*
|
|
789
|
+
* WHY. Docblocks and the Bob adapter page justified decisions with "see bob-verdict.md I1":
|
|
790
|
+
* a reference nobody else can open, so the reason was lost exactly where it was needed. A
|
|
791
|
+
* citation names something in the repo (the What-is-verified block), a dated observation
|
|
792
|
+
* ("Bob 2.2.3 bundle, read 2026-10"), or the host's public docs.
|
|
793
|
+
*/
|
|
794
|
+
export function localNoteProblems(root = ROOT) {
|
|
795
|
+
const problems = [];
|
|
796
|
+
for (const rel of checkoutTextFiles(root)) {
|
|
797
|
+
if (LOCAL_NOTE_EXEMPT.has(rel)) continue;
|
|
798
|
+
let text;
|
|
799
|
+
try { text = readText(path.join(root, ...rel.split('/'))); } catch { continue; }
|
|
800
|
+
text.split('\n').forEach((line, i) => {
|
|
801
|
+
const m = LOCAL_NOTE_RE.exec(line);
|
|
802
|
+
if (m) {
|
|
803
|
+
problems.push(`[authoring] ${rel}:${i + 1} cites ${m[0]} — docs/reviews/ is gitignored, so `
|
|
804
|
+
+ 'nobody else can open it; cite the What-is-verified block, a dated observation or '
|
|
805
|
+
+ "the host's own docs");
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
return problems;
|
|
810
|
+
}
|
|
811
|
+
|
|
618
812
|
/**
|
|
619
813
|
* The AI Harness Scorecard checks this repo passes, written out — the ratchet's floor.
|
|
620
814
|
*
|
package/js/inspect/cost.mjs
CHANGED
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
* `disable-model-invocation` on Claude Code and OpenClaude; on OpenCode, which
|
|
16
16
|
* ignores that key, the `permission.skill` deny in `opencode.json`; on Bob no
|
|
17
17
|
* SKILL.md exists for one, so there is nothing to skip.
|
|
18
|
-
* - `agents` the same for native agents
|
|
18
|
+
* - `agents` the same for native agents. Bob counts 0: it has native `agents/<name>.md`
|
|
19
|
+
* files, but whether Bob lists them to the model is unverified, so its agents
|
|
20
|
+
* table stays in the carrier (`catalog.agents`, js/hosts/hosts.mjs) and is
|
|
21
|
+
* counted there.
|
|
19
22
|
* - `context` the session files the context hook injects (untouched seeds already skipped).
|
|
20
23
|
* The per-repo project context is NOT counted: it changes with the working dir.
|
|
21
24
|
*/
|
|
@@ -38,6 +41,31 @@ import { isFile, readText } from '../lib/fs.mjs';
|
|
|
38
41
|
*/
|
|
39
42
|
export const CARRIER_CEILING = { full: 66_432, lean: 40_312 };
|
|
40
43
|
|
|
44
|
+
/**
|
|
45
|
+
* THE CEILING ON THE SKILL LISTING: the most the names and descriptions of the skills the model
|
|
46
|
+
* lists may weigh on a Claude Code install with every skill on. It is `alwaysOnCost(...).skills`
|
|
47
|
+
* for a `claude` emit: user-only skills and aliases are on disk but out of the listing, so they
|
|
48
|
+
* count 0. The footprint does not change it: a description is the same text in both.
|
|
49
|
+
*
|
|
50
|
+
* WHY A CEILING. The listing is always-on context, and unlike the carrier nothing bounded its
|
|
51
|
+
* total. Each description has its own cap (`DESCRIPTION_CAP`, js/hosts/native.mjs), which
|
|
52
|
+
* bounds one skill and says nothing about fifty: the catalogue once reached 22k characters
|
|
53
|
+
* before anyone measured it (that docblock has the history). And the host has a listing budget
|
|
54
|
+
* of its own, past which it trims descriptions without a word, so growth here ends as routing
|
|
55
|
+
* text the model never sees. A new skill, or a longer trigger sentence, now has to fit, or the
|
|
56
|
+
* number is raised in the open.
|
|
57
|
+
*
|
|
58
|
+
* MEASURED 2026-11-12: 8 706 characters over 48 listed skills, the same for
|
|
59
|
+
* `claude` and `claude-global`, full and lean. The ceiling is that figure plus 2 %, rounded up
|
|
60
|
+
* (the headroom the lean carrier ceiling was given). `tests/unit/emit_smoke.test.mjs` gates it.
|
|
61
|
+
* Raise it by the measured overrun and say why here, after trying a shorter description first.
|
|
62
|
+
*
|
|
63
|
+
* `alwaysOnCost` returns it as `skillCeiling` for a `claude` install only, the one host it was
|
|
64
|
+
* measured on and is gated for, and the console draws it under that install's cost breakdown.
|
|
65
|
+
* Every other host answers `null`: no bar, not a bar against a number nobody measured there.
|
|
66
|
+
*/
|
|
67
|
+
export const SKILL_LISTING_CEILING = 8_881;
|
|
68
|
+
|
|
41
69
|
/**
|
|
42
70
|
* THE TRADE OF `--shared-tier on`, stated once. `--help` (js/cli-table.json), the console's toggle
|
|
43
71
|
* and docs/concepts/rules.md quote these sentences; tests/unit/shared_tier_option.test.mjs
|
|
@@ -118,7 +146,11 @@ export function alwaysOnCost({ host, root, dir, footprint }) {
|
|
|
118
146
|
const { skills, agents } = catalogueChars(host, root, dir);
|
|
119
147
|
let context = 0;
|
|
120
148
|
for (const s of sessionLayers(dir, host)) context += s.text.length;
|
|
121
|
-
return {
|
|
149
|
+
return {
|
|
150
|
+
carrier, skills, agents, context,
|
|
151
|
+
ceiling: CARRIER_CEILING[footprint] ?? null,
|
|
152
|
+
skillCeiling: host === 'claude' ? SKILL_LISTING_CEILING : null,
|
|
153
|
+
};
|
|
122
154
|
}
|
|
123
155
|
|
|
124
156
|
/** The install's root instruction file, or undefined: the first of the host's carriers on disk. */
|
package/js/inspect/diff.mjs
CHANGED
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
readJsonMaybe, readMaybe, renderedTier, themeOfDir,
|
|
47
47
|
} from '../hosts/installs.mjs';
|
|
48
48
|
import { hashesOf, ownedState, safeLeaf } from '../hosts/owned.mjs';
|
|
49
|
+
import { hostGlobalInstalls as globalInstalls } from './excludes.mjs';
|
|
49
50
|
import { unifiedDiff, splitLines } from '../lib/udiff.mjs';
|
|
50
51
|
import { printOut, printErr, readText, writeText, isFile } from '../lib/fs.mjs';
|
|
51
52
|
import { NOTES_DIRS, sharedPaths } from '../lib/machine-dir.mjs';
|
|
@@ -527,7 +528,21 @@ export function flushExportNotes() {
|
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
export function cmdDiff(args) {
|
|
530
|
-
|
|
531
|
+
// No `--target`: the global install there is, whatever its host — the OpenCode dir used to be
|
|
532
|
+
// the answer on a Claude-only machine too. Several: the first, named on stderr. None: the
|
|
533
|
+
// OpenCode dir, whose refusal below says what to do. Here and not in `diffCollect`, whose
|
|
534
|
+
// other caller (`upgrade`'s export) keeps its own default.
|
|
535
|
+
let chosen = args.target;
|
|
536
|
+
if (!chosen) {
|
|
537
|
+
const globals = globalInstalls((_h, d) => existsSync(path.join(d, GLOBAL_MANIFEST))
|
|
538
|
+
&& manifestScope(d) !== 'project');
|
|
539
|
+
if (globals.length) chosen = globals[0][1];
|
|
540
|
+
if (globals.length > 1) {
|
|
541
|
+
printErr(`[diff] ${globals.length} global installs found; diffing ${globals[0][1]} `
|
|
542
|
+
+ `(${globals[0][0]}:global). Pass --target for another.\n`);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const { target, theme, files } = diffCollect({ target: chosen, theme: args.theme });
|
|
531
546
|
if (files === null) {
|
|
532
547
|
if (existsSync(path.join(target, GLOBAL_MANIFEST)) && manifestScope(target) === 'project') {
|
|
533
548
|
printErr(`[diff] ${target} is a PROJECT install — diff only compares GLOBAL `
|
package/js/inspect/doctor.mjs
CHANGED
|
@@ -38,13 +38,16 @@ import {
|
|
|
38
38
|
hookShellProblems, installedDefaults, openclaudeDualHarnessRoots, themeFiles,
|
|
39
39
|
} from '../hosts/installs.mjs';
|
|
40
40
|
import { validateIsVendored } from '../hosts/native.mjs';
|
|
41
|
-
import { printOut } from '../lib/fs.mjs';
|
|
41
|
+
import { printErr, printOut } from '../lib/fs.mjs';
|
|
42
42
|
import { authoringProblems, factoryProblems, loopProblems } from './checks-authoring.mjs';
|
|
43
43
|
import { gateProbe, guardProbe } from './checks-probe.mjs';
|
|
44
44
|
import {
|
|
45
45
|
checkBuild, colorThemeProblems, renderedPathNotes, renderedProblems, themeParityProblems,
|
|
46
46
|
} from './checks-build.mjs';
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
bobBlockProblems, hostMatrixProblems, localNoteProblems, moduleMapProblems, scorecardProblems,
|
|
49
|
+
shimProblems, strayClaimProblems,
|
|
50
|
+
} from './checks-repo.mjs';
|
|
48
51
|
import { NOTE, isDoctorNote, sortedProblems, sortedUnique, stemOf, withTempDir } from './scan.mjs';
|
|
49
52
|
|
|
50
53
|
/**
|
|
@@ -189,7 +192,7 @@ export function claudeBobEmitProblems(themeName) {
|
|
|
189
192
|
*/
|
|
190
193
|
export function doctorCollect({
|
|
191
194
|
theme = null, allThemes = false, bundle = null, noBundle = false, groups = null,
|
|
192
|
-
probe = false, probed = null, extraProbeProblems = [],
|
|
195
|
+
probe = false, probed = null, extraProbeProblems = [], onTheme = null,
|
|
193
196
|
} = {}) {
|
|
194
197
|
const available = themeFiles().map(stemOf);
|
|
195
198
|
if (!available.length) return [[], ['[doctor] no themes found']];
|
|
@@ -217,7 +220,9 @@ export function doctorCollect({
|
|
|
217
220
|
if (probeRun && probed) probed.push(...probeRun.probed);
|
|
218
221
|
let problems = [];
|
|
219
222
|
withTempDir((tmp) => {
|
|
220
|
-
for (const themeName of themes) {
|
|
223
|
+
for (const [i, themeName] of themes.entries()) {
|
|
224
|
+
// A sweep of several themes runs for minutes; the caller may say where it is.
|
|
225
|
+
if (onTheme && themes.length > 1) onTheme(i + 1, themes.length, themeName);
|
|
221
226
|
const out = path.join(tmp, themeName);
|
|
222
227
|
// capture_output=True: BOTH streams, unlike the emits below, which redirect stdout
|
|
223
228
|
// only. A failing build's stderr is not doctor's output either — the return code is.
|
|
@@ -262,6 +267,8 @@ export function doctorCollect({
|
|
|
262
267
|
problems = problems.concat(ran('shared_paths', 'Rendered shared paths', renderedPathNotes()));
|
|
263
268
|
problems = problems.concat(ran('map', 'Module map', moduleMapProblems()));
|
|
264
269
|
problems = problems.concat(ran('host_matrix', 'Host tables', hostMatrixProblems()));
|
|
270
|
+
problems = problems.concat(ran('host_claims', 'Host claims',
|
|
271
|
+
[...bobBlockProblems(), ...strayClaimProblems(), ...localNoteProblems()]));
|
|
265
272
|
problems = problems.concat(ran('scorecard', 'Scorecard floor', scorecardProblems()));
|
|
266
273
|
// There is no `cli` check: the table is the OWNED document (`js/cli-table.json`), so
|
|
267
274
|
// there is no generator to fall behind and no second file to hash. What gates it is
|
|
@@ -302,6 +309,8 @@ function doctorReport(args, guard) {
|
|
|
302
309
|
theme: args.theme, allThemes: Boolean(args.all), bundle: args.bundle,
|
|
303
310
|
noBundle: Boolean(args.noBundle), probe: Boolean(args.probe), probed,
|
|
304
311
|
extraProbeProblems: guard ? guard.problems : [],
|
|
312
|
+
// stderr, so the verdict on stdout is the bytes it was; `--all` took ~2 min 40 s in silence.
|
|
313
|
+
onTheme: (n, total, name) => printErr(`[doctor] theme ${n}/${total}: ${name}\n`),
|
|
305
314
|
});
|
|
306
315
|
if (!themes.length) {
|
|
307
316
|
printOut(`${collected.length ? collected[0] : '[doctor] no themes found'}\n`);
|
package/js/inspect/excludes.mjs
CHANGED
|
@@ -55,21 +55,33 @@ function worktreeNote(host, cfg, repo) {
|
|
|
55
55
|
+ `to the repo's ${marker}/settings.json: "claudeMdExcludes": ["${claudeMdEntry(cfg)}"]`;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
|
|
58
|
+
/**
|
|
59
|
+
* `[host, configDir]` for each host whose GLOBAL config dir `has` accepts, in `HOSTS` order —
|
|
60
|
+
* THE one walk over the hosts' global dirs. `exclude` tests for the manifest; `uninstall`,
|
|
61
|
+
* `version` and `diff` pass their own test to pick a no-`--target` default.
|
|
62
|
+
*
|
|
63
|
+
* HERE, not in `maintain/uninstall.mjs`: every global emit runs the fold, the fold reaches this
|
|
64
|
+
* module, and `tests/unit/hook_cli.test.mjs` keeps js/maintain out of the fold's import graph.
|
|
65
|
+
*/
|
|
66
|
+
export function hostGlobalInstalls(has) {
|
|
60
67
|
const out = [];
|
|
61
68
|
for (const { host, configDir } of HOSTS) {
|
|
62
|
-
let cfg;
|
|
63
69
|
try {
|
|
64
|
-
|
|
70
|
+
const dir = configDir();
|
|
71
|
+
if (has(host, dir)) out.push([host, dir]);
|
|
65
72
|
} catch {
|
|
66
|
-
continue; // a broken resolver must not kill the CLI
|
|
73
|
+
continue; // a broken resolver, or an unreadable dir, must not kill the CLI
|
|
67
74
|
}
|
|
68
|
-
if (isFile(path.join(cfg, GLOBAL_MANIFEST))) out.push({ host, cfg });
|
|
69
75
|
}
|
|
70
76
|
return out;
|
|
71
77
|
}
|
|
72
78
|
|
|
79
|
+
/** `_global_installs` — every host whose GLOBAL config dir carries a Geneseed manifest. */
|
|
80
|
+
function globalInstalls() {
|
|
81
|
+
return hostGlobalInstalls((_host, cfg) => isFile(path.join(cfg, GLOBAL_MANIFEST)))
|
|
82
|
+
.map(([host, cfg]) => ({ host, cfg }));
|
|
83
|
+
}
|
|
84
|
+
|
|
73
85
|
/** `_read_excludes` — the file, or the seeded stub's shape when it is absent or unusable. */
|
|
74
86
|
function readExcludes(cfg) {
|
|
75
87
|
try {
|
package/js/inspect/status.mjs
CHANGED
|
@@ -57,7 +57,8 @@ import { pendingDrafts } from '../hosts/hooks-context.mjs';
|
|
|
57
57
|
import { factCount } from '../hosts/memory-files.mjs';
|
|
58
58
|
import { lastStoreReport } from '../hosts/store-watch.mjs';
|
|
59
59
|
import { hookShimPath, shimDead } from '../hosts/shim.mjs';
|
|
60
|
-
import { printOut } from '../lib/fs.mjs';
|
|
60
|
+
import { printErr, printOut } from '../lib/fs.mjs';
|
|
61
|
+
import { hostGlobalInstalls as globalInstalls } from './excludes.mjs';
|
|
61
62
|
import { readDefaultInstall, sharedPaths } from '../lib/machine-dir.mjs';
|
|
62
63
|
import { normcase } from '../lib/paths.mjs';
|
|
63
64
|
import { renamedFilesIn } from '../build/stubs.mjs';
|
|
@@ -79,7 +80,14 @@ export function cmdVersion(args) {
|
|
|
79
80
|
const current = sourceFingerprint(cfg);
|
|
80
81
|
// `Path(args.target).expanduser().resolve()` — `resolvePath` already expands, so the tilde
|
|
81
82
|
// is handled once rather than twice.
|
|
82
|
-
let target = args.target ? resolvePath(args.target) :
|
|
83
|
+
let target = args.target ? resolvePath(args.target) : null;
|
|
84
|
+
// No `--target`: the global install the user picked as the default leads, as it leads
|
|
85
|
+
// `status`'s version row (`statusData`), so the two verbs name the same install.
|
|
86
|
+
if (!target) {
|
|
87
|
+
const picked = pickedInstall();
|
|
88
|
+
if (picked && picked[1] === 'global' && readVersion(picked[2]) !== null) target = picked[2];
|
|
89
|
+
}
|
|
90
|
+
target ??= opencodeConfigDir();
|
|
83
91
|
let installed = readVersion(target);
|
|
84
92
|
if (installed === null) {
|
|
85
93
|
// A claude/bob/openclaude-only machine must not report "no install detected". The bundle
|
|
@@ -90,6 +98,15 @@ export function cmdVersion(args) {
|
|
|
90
98
|
if (v) { installed = v; target = base; break; }
|
|
91
99
|
}
|
|
92
100
|
}
|
|
101
|
+
// The walk above already finds a Claude-only machine's install; with several, it shows the
|
|
102
|
+
// first, and says so rather than letting the reader take it for the only one.
|
|
103
|
+
if (!args.target) {
|
|
104
|
+
const globals = globalInstalls((_h, d) => readVersion(d) !== null);
|
|
105
|
+
if (globals.length > 1) {
|
|
106
|
+
printErr(`[version] ${globals.length} global installs found; showing ${target}. `
|
|
107
|
+
+ 'Pass --target for another.\n');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
93
110
|
printOut(`[version] source: ${current} (${ROOT})\n`);
|
|
94
111
|
printOut(`[version] installed: ${installed || '(none found)'}`
|
|
95
112
|
+ (installed ? ` (${target})` : '') + '\n');
|
|
@@ -306,8 +323,10 @@ export function statusData() {
|
|
|
306
323
|
try { otherCfg.push(fn()); } catch { /* a missing host dir must not sink status */ }
|
|
307
324
|
}
|
|
308
325
|
const hostDirs = [...(cfgDir ? [cfgDir] : []), ...otherCfg, path.join(process.cwd(), 'Harness')];
|
|
309
|
-
// Same walk as `cmdVersion`'s fallback, and cwd-relative for the same reason
|
|
310
|
-
|
|
326
|
+
// Same walk as `cmdVersion`'s fallback, and cwd-relative for the same reason — led by the
|
|
327
|
+
// global install the `install` row names, so the `version` row describes that install.
|
|
328
|
+
const lead = picked && picked[1] === 'global' ? [picked[2]] : [];
|
|
329
|
+
for (const base of [...lead, ...hostDirs, process.cwd()]) {
|
|
311
330
|
const v = readVersion(base);
|
|
312
331
|
if (v) { installedFp = v; verTarget = base; break; }
|
|
313
332
|
}
|
|
@@ -391,8 +410,12 @@ function colorEnabled() {
|
|
|
391
410
|
* `_TUI_ASCII` is read from the environment at CALL time, not import time. Same value for a
|
|
392
411
|
* process that runs one verb and exits; spelled this way because a module-level constant in
|
|
393
412
|
* a file the tests import would freeze at whatever the test runner's environment was.
|
|
413
|
+
*
|
|
414
|
+
* `boxed` false is the face off a terminal: the title, the rows and the verdict, with no frame
|
|
415
|
+
* and no padding to the widest row. A long `installs` row made every boxed line ~210 columns,
|
|
416
|
+
* which a pipe, a log or an agent reads as 4–5 kB of spaces.
|
|
394
417
|
*/
|
|
395
|
-
export function statusLines(d, color = false) {
|
|
418
|
+
export function statusLines(d, color = false, boxed = true) {
|
|
396
419
|
const asc = Boolean(process.env.GENESEED_TUI_ASCII);
|
|
397
420
|
const [H, V] = asc ? ['-', '|'] : ['─', '│'];
|
|
398
421
|
const [TL, TR, BL, BR, LT, RT] = asc
|
|
@@ -429,7 +452,10 @@ export function statusLines(d, color = false) {
|
|
|
429
452
|
+ `doctrine rules in ${d.packs}/${d.packs_total} packs`]);
|
|
430
453
|
}
|
|
431
454
|
if (d.agent_md) {
|
|
432
|
-
|
|
455
|
+
// The row is the OpenCode global's health, shown whichever install the `install` row names;
|
|
456
|
+
// under another host's install it says whose AGENT.md it is, so the two rows cannot be read
|
|
457
|
+
// as one install.
|
|
458
|
+
rows.push([d.emit === 'opencode-global' ? 'AGENT.md' : 'opencode AGENT.md',
|
|
433
459
|
`${d.agent_md} (${d.agent_md_present ? 'present' : 'MISSING'})`]);
|
|
434
460
|
}
|
|
435
461
|
// Conditional for the same recording reason as `constitution` above: the 30 recorded
|
|
@@ -496,6 +522,7 @@ export function statusLines(d, color = false) {
|
|
|
496
522
|
const body = rows.map(([k, v]) => ` ${padEndToWidth(k, labelW)} ${v}`);
|
|
497
523
|
const verdict = ` ${mark} ${d.version_verdict}`;
|
|
498
524
|
const title = ` ${badge} Geneseed ${emdash} status `;
|
|
525
|
+
if (!boxed) return [title.trim(), ...body, verdict];
|
|
499
526
|
const width = Math.max(...body.map(codePointLength), codePointLength(verdict), codePointLength(title) + 2);
|
|
500
527
|
|
|
501
528
|
const ac = ANSI_CODES[d.accent] ?? '36';
|
|
@@ -524,6 +551,7 @@ export function cmdStatus(args) {
|
|
|
524
551
|
printOut(`${JSON.stringify(d, null, 2)}\n`);
|
|
525
552
|
return 0;
|
|
526
553
|
}
|
|
527
|
-
|
|
554
|
+
// The box only on a terminal; NO_COLOR on a terminal still gets it, so this is not `color`.
|
|
555
|
+
for (const line of statusLines(d, colorEnabled(), Boolean(process.stdout.isTTY))) printOut(`${line}\n`);
|
|
528
556
|
return 0;
|
|
529
557
|
}
|