geneseed 5.3.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 +27 -0
- package/README.md +2 -2
- 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 +169 -62
- package/adapters/opencode/plugins/geneseed-guard.js +414 -202
- package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
- package/adapters/opencode/workflows/_runtime.js +3 -2
- package/bin/geneseed-hook.mjs +57 -9
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +2 -2
- package/docs/concepts/footprint.md +10 -0
- package/docs/concepts/hook-gates.md +3 -3
- package/docs/concepts/host-matrix.md +22 -4
- package/docs/design-history.md +8 -0
- package/docs/extending.md +49 -7
- package/docs/guides/install-bob.md +2 -2
- package/docs/guides/install-openclaude.md +1 -1
- package/docs/guides/verify.md +12 -0
- package/docs/reference/environment.md +1 -0
- package/docs/reference/troubleshoot-doctor.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 +5 -0
- package/harness.config.json +1 -1
- package/js/README.md +3 -2
- package/js/build/args.mjs +1 -1
- package/js/build/driver.mjs +1 -1
- package/js/build/emit-claude.mjs +1 -1
- package/js/build/generate.mjs +5 -14
- 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 +4 -2
- package/js/hosts/hooks-learn.mjs +47 -16
- package/js/hosts/hooks.mjs +19 -13
- package/js/hosts/hosts.mjs +80 -12
- package/js/hosts/installs.mjs +7 -0
- 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/doctor.mjs +6 -1
- package/js/lib/machine-dir.mjs +1 -1
- package/js/lib/node-floor.mjs +46 -6
- package/js/maintain/uninstall.mjs +42 -16
- package/js/web/actions.mjs +1 -9
- package/package.json +1 -1
- package/web/dist/assets/Activity-WQ3ykgxU.js +1 -0
- package/web/dist/assets/{ActivityDetail-BSzevynX.js → ActivityDetail-7rt04SkS.js} +1 -1
- package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-BBl4XXqs.js} +1 -1
- package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-Beven8yn.js} +1 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +2 -0
- package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-B5aHp86J.js} +3 -3
- package/web/dist/assets/Factories-BjqzXAw8.js +1 -0
- package/web/dist/assets/GreenhouseView-Bce212qd.js +1 -0
- package/web/dist/assets/{Installs-BlGmVrFK.js → Installs-B1OsrHXF.js} +3 -3
- package/web/dist/assets/JournalView-CV4omyww.js +1 -0
- package/web/dist/assets/{Kits-DRwpxC-J.js → Kits-CW1e7xNa.js} +1 -1
- package/web/dist/assets/{Laws-CZkiNOWQ.js → Laws-1Ckf1lbs.js} +2 -2
- package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-Dag1s0ZX.js} +1 -1
- 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-Bp9nV4GR.js → Personal-DKLgLa7Z.js} +2 -2
- package/web/dist/assets/Settings-BwErnh-R.js +1 -0
- package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-8zsyEPSK.js} +1 -1
- package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
- package/web/dist/assets/index-Ce6qF2nG.js +6 -0
- package/web/dist/index.html +2 -2
- package/adapters/claude-code/settings.json +0 -52
- package/web/dist/assets/Activity-CqJiquEq.js +0 -1
- package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
- package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
- package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
- package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
- package/web/dist/assets/Library-B4K-1iNF.js +0 -3
- package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
- package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
- package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
- package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
- package/web/dist/assets/index-How7SzDZ.js +0 -6
|
@@ -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/doctor.mjs
CHANGED
|
@@ -44,7 +44,10 @@ 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
|
/**
|
|
@@ -264,6 +267,8 @@ export function doctorCollect({
|
|
|
264
267
|
problems = problems.concat(ran('shared_paths', 'Rendered shared paths', renderedPathNotes()));
|
|
265
268
|
problems = problems.concat(ran('map', 'Module map', moduleMapProblems()));
|
|
266
269
|
problems = problems.concat(ran('host_matrix', 'Host tables', hostMatrixProblems()));
|
|
270
|
+
problems = problems.concat(ran('host_claims', 'Host claims',
|
|
271
|
+
[...bobBlockProblems(), ...strayClaimProblems(), ...localNoteProblems()]));
|
|
267
272
|
problems = problems.concat(ran('scorecard', 'Scorecard floor', scorecardProblems()));
|
|
268
273
|
// There is no `cli` check: the table is the OWNED document (`js/cli-table.json`), so
|
|
269
274
|
// there is no generator to fall behind and no second file to hash. What gates it is
|
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';
|
|
@@ -246,12 +248,24 @@ const REVERSAL_MARKERS = [GLOBAL_MANIFEST, '.geneseed-theme', '.geneseed-emit',
|
|
|
246
248
|
* deactivate, which removed the entry but kept the denies (PR #241 review) — so either half
|
|
247
249
|
* alone is a change, and only "neither" declines.
|
|
248
250
|
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
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
|
|
251
265
|
* would drop the comments. That branch returns False, so the caller's `unmerged` reports
|
|
252
266
|
* REALITY rather than intent.
|
|
253
267
|
*/
|
|
254
|
-
export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null) {
|
|
268
|
+
export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null, gates = []) {
|
|
255
269
|
const target = opencodeTarget(p);
|
|
256
270
|
// Absent, unreadable (the Python's `except OSError: return False`) or not an object: decline.
|
|
257
271
|
const { state, data: cfg, hadComments } = loadJsonObject(target);
|
|
@@ -267,20 +281,28 @@ export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null) {
|
|
|
267
281
|
// back only when nothing but its `"*"` is left — a key the user added since keeps the object.
|
|
268
282
|
const editObj = edit && isDict(cfg.permission) && isDict(cfg.permission.edit) ? cfg.permission.edit : null;
|
|
269
283
|
const asks = editObj ? edit.asks.filter((k) => editObj[k] === 'ask') : [];
|
|
270
|
-
|
|
271
|
-
|
|
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) {
|
|
272
290
|
printOut(`[uninstall] ${path.basename(target)} has comments — not rewriting it.`
|
|
273
291
|
+ (hasEntry ? ` Remove this from its "instructions" by hand: ${jsonDumps(entry)}` : '')
|
|
274
292
|
+ (denies.length ? ` Remove these from its "permission.skill" by hand: `
|
|
275
293
|
+ `${denies.map((n) => jsonDumps(n)).join(', ')}` : '')
|
|
276
294
|
+ (asks.length ? ` Remove these from its "permission.edit" by hand: `
|
|
277
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(', ')}` : '')
|
|
278
298
|
+ '\n');
|
|
279
299
|
return false;
|
|
280
300
|
}
|
|
281
301
|
if (hasEntry) cfg.instructions = instr.filter((i) => i !== entry);
|
|
282
302
|
for (const name of denies) delete skill[name];
|
|
283
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;
|
|
284
306
|
for (const k of asks) delete editObj[k];
|
|
285
307
|
if (asks.length) {
|
|
286
308
|
const left = Object.keys(editObj);
|
|
@@ -324,7 +346,7 @@ export function claudeUninstall(cfg, archiveMemory, force = false) {
|
|
|
324
346
|
if (kept.length) warnKept(kept);
|
|
325
347
|
const hooks = managed.settings_hooks || [];
|
|
326
348
|
const sf = settingsFile(cfg, managed);
|
|
327
|
-
const unwired = unwireClaudeSettings(sf, hooks);
|
|
349
|
+
const unwired = unwireClaudeSettings(sf, hooks, cfg);
|
|
328
350
|
unwireClaudeExcludes(sf, managed.settings_excludes || []);
|
|
329
351
|
unwireClaudeEnv(sf, managed.settings_env);
|
|
330
352
|
// The unwire is VERIFIED, not assumed: a commented settings file is never rewritten, so a
|
|
@@ -361,7 +383,8 @@ export function uninstallGlobal(target, archiveMemory, host = 'opencode', force
|
|
|
361
383
|
if (isDir(p) && isEmptyDir(p)) rmdirQuiet(p);
|
|
362
384
|
}
|
|
363
385
|
const unmerged = unmergeOpencodeJson(path.join(target, 'opencode.json'),
|
|
364
|
-
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));
|
|
365
388
|
managedBlockRemove(path.join(target, OPENCODE_SENTINEL));
|
|
366
389
|
if (failed.length) warnMarkersKept();
|
|
367
390
|
else for (const m of REVERSAL_MARKERS) unlinkQuiet(path.join(target, m));
|
|
@@ -488,7 +511,8 @@ function opencodeProjectUninstall(root, force = false) {
|
|
|
488
511
|
}
|
|
489
512
|
}
|
|
490
513
|
const unmerged = unmergeOpencodeJson(path.join(root, 'opencode.json'), entry,
|
|
491
|
-
man ? recordedDenies(man) : [], man ? recordedEdit(man) : null
|
|
514
|
+
man ? recordedDenies(man) : [], man ? recordedEdit(man) : null,
|
|
515
|
+
man ? recordedGates(man) : []);
|
|
492
516
|
const result = { removed, unmerged, archived: null, userOnly };
|
|
493
517
|
if (failed.length) result.failed = failed;
|
|
494
518
|
if (kept.length) result.kept = kept;
|
|
@@ -1010,7 +1034,7 @@ function installMoveList(root, kind) {
|
|
|
1010
1034
|
*
|
|
1011
1035
|
* Deliberately a minimal inline re-add rather than the emit's own merge, whose side effects
|
|
1012
1036
|
* (adding `permission` and `lsp: true` when absent) would clobber values the user may have
|
|
1013
|
-
* set since the install was disabled. A commented
|
|
1037
|
+
* set since the install was disabled. A commented file is not rewritten — the same
|
|
1014
1038
|
* refusal `unmergeOpencodeJson` makes — but here the files have ALREADY been restored, so it
|
|
1015
1039
|
* tells the operator what to add rather than failing the whole reactivate. That asymmetry is
|
|
1016
1040
|
* the reference's and is gated per side.
|
|
@@ -1024,7 +1048,7 @@ function installReaddEntry(target, entry) {
|
|
|
1024
1048
|
if (state !== 'ok') return false; // unreadable (except OSError), or not an object
|
|
1025
1049
|
const instr = Array.isArray(cfg.instructions) ? cfg.instructions : [];
|
|
1026
1050
|
if (indexOfDeepEqual(instr, entry) >= 0) return false;
|
|
1027
|
-
if (
|
|
1051
|
+
if (hadComments) {
|
|
1028
1052
|
printOut(`[activate] ${path.basename(target)} has comments — not rewriting it. Add this `
|
|
1029
1053
|
+ `to its "instructions" by hand: ${jsonDumps(entry)}\n`);
|
|
1030
1054
|
return false;
|
|
@@ -1138,12 +1162,14 @@ export function installDeactivate(root, host = 'opencode', scope = 'global') {
|
|
|
1138
1162
|
}
|
|
1139
1163
|
const kind = installKind(root);
|
|
1140
1164
|
const target = opencodeTarget(path.join(root, 'opencode.json'));
|
|
1141
|
-
// Caught UP FRONT, before any file moves: a commented
|
|
1142
|
-
// dropping the user's comments, so refuse and move NOTHING.
|
|
1143
|
-
|
|
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) {
|
|
1144
1170
|
return { ok: false,
|
|
1145
1171
|
error: `${path.basename(target)} has comments — refusing to rewrite it. `
|
|
1146
|
-
+ 'Disable by hand or
|
|
1172
|
+
+ 'Disable by hand or remove the comments first.' };
|
|
1147
1173
|
}
|
|
1148
1174
|
const stash = path.join(root, DISABLED_STASH);
|
|
1149
1175
|
const { done, failed } = moveAll(root, stash, installMoveList(root, kind));
|
|
@@ -1275,7 +1301,7 @@ function claudeDeactivate(root, scope = 'global', host = 'claude') {
|
|
|
1275
1301
|
cleanHostStash(cfg, host);
|
|
1276
1302
|
return { ok: false, failed, rolled_back: done.length };
|
|
1277
1303
|
}
|
|
1278
|
-
unwireClaudeSettings(settingsFile(cfg, managed), managed.settings_hooks || []);
|
|
1304
|
+
unwireClaudeSettings(settingsFile(cfg, managed), managed.settings_hooks || [], cfg);
|
|
1279
1305
|
unwireClaudeExcludes(settingsFile(cfg, managed), managed.settings_excludes || []);
|
|
1280
1306
|
unwireClaudeEnv(settingsFile(cfg, managed), managed.settings_env);
|
|
1281
1307
|
// The same integrity check the uninstall path runs: a deactivate that silently failed to
|
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,
|
|
@@ -716,14 +716,6 @@ export function apiRestore(state, files) {
|
|
|
716
716
|
return { restored, deleted, errors, archive };
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
/** (host, scope) -> the emit name that installs it. */
|
|
720
|
-
const EMIT_FOR = new Map([
|
|
721
|
-
['opencode global', 'opencode-global'], ['opencode project', 'opencode'],
|
|
722
|
-
['claude global', 'claude-global'], ['claude project', 'claude'],
|
|
723
|
-
['bob global', 'bob-global'], ['bob project', 'bob'],
|
|
724
|
-
['openclaude global', 'openclaude-global'], ['openclaude project', 'openclaude'],
|
|
725
|
-
]);
|
|
726
|
-
|
|
727
719
|
/**
|
|
728
720
|
* The build command that installs Geneseed into a DETECTED location, or re-themes an
|
|
729
721
|
* already-active one (an in-place re-emit, the same command either way).
|