geneseed 5.0.0 → 5.0.3
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 +70 -0
- package/README.md +1 -1
- package/SHIPPED.md +1 -1
- package/adapters/claude-code/README.md +6 -4
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +3 -0
- package/adapters/opencode/plugins/geneseed-context.js +13 -2
- package/adapters/opencode/plugins/geneseed-guard.js +595 -74
- package/adapters/opencode/plugins/geneseed-learn.js +1 -1
- package/bin/geneseed-hook.mjs +21 -7
- package/docs/PRD.md +1 -1
- package/docs/concepts/enforcement-table.md +22 -3
- package/docs/concepts/exclusions.md +48 -2
- package/docs/concepts/foreman-mode.md +19 -4
- package/docs/concepts/hook-gates.md +1 -1
- package/docs/concepts/hooks.md +53 -12
- package/docs/concepts/host-matrix.md +4 -3
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +18 -0
- package/docs/concepts/shared-tier.md +5 -5
- package/docs/concepts/skills.md +1 -1
- package/docs/extending.md +3 -1
- package/docs/guides/autostart.md +27 -3
- package/docs/guides/choose-your-setup.md +1 -1
- package/docs/guides/migrate.md +5 -3
- package/docs/guides/uninstall.md +1 -1
- package/docs/guides/upgrade-to-5.md +6 -4
- package/docs/reference/plugin-context.md +1 -1
- package/docs/reference/plugin-guard.md +24 -5
- package/docs/reference/troubleshoot-doctor.md +2 -2
- package/docs/understand/a-day.md +9 -5
- package/docs/web-ui.md +78 -20
- package/harness.config.json +1 -1
- package/js/README.md +3 -2
- package/js/build/emit-claude.mjs +9 -1
- package/js/build/emit-opencode.mjs +2 -1
- package/js/build/fold.mjs +7 -7
- package/js/build/rule-decide.mjs +273 -0
- package/js/build/source.mjs +9 -3
- package/js/cli-table.json +122 -2
- package/js/hosts/geneseed-dir.mjs +1 -1
- package/js/hosts/hooks-context.mjs +9 -7
- package/js/hosts/hooks-done.mjs +3 -1
- package/js/hosts/hooks-learn.mjs +1 -1
- package/js/hosts/hooks-prims.mjs +270 -0
- package/js/hosts/hooks.mjs +409 -151
- package/js/hosts/hosts.mjs +22 -0
- package/js/hosts/installs.mjs +13 -9
- package/js/hosts/memory-files.mjs +2 -2
- package/js/hosts/settings.mjs +123 -23
- package/js/hosts/shim.mjs +155 -7
- package/js/hosts/store-watch.mjs +41 -14
- package/js/inspect/diff.mjs +2 -1
- package/js/inspect/inventory.mjs +1 -0
- package/js/inspect/registry.mjs +4 -2
- package/js/inspect/validate.mjs +1 -1
- package/js/lib/paths.mjs +13 -0
- package/js/maintain/migrate.mjs +60 -22
- package/js/maintain/uninstall.mjs +5 -1
- package/js/web/actions.mjs +17 -1
- package/js/web/api.mjs +22 -16
- package/js/web/handler.mjs +2 -0
- package/js/web/routes.mjs +9 -4
- package/js/web/update-check.mjs +2 -2
- package/js/web/user-files.mjs +38 -11
- package/package.json +1 -1
- package/registry.json +21 -0
- package/src/AGENT.md.tmpl +17 -21
- package/src/agents/_self-improvement.md +7 -6
- package/src/agents/developer.md +3 -2
- package/src/agents/docker-expert.md +1 -0
- package/src/agents/memory-curator.md +3 -2
- package/src/doctrines/process.md +24 -19
- package/src/kits/ci-pipelines/rules.md +10 -0
- package/src/kits/ci-pipelines.json +14 -0
- package/src/kits/docker/rules.md +11 -0
- package/src/kits/docker.json +12 -0
- package/src/memory/README.md +5 -4
- package/src/modes/foreman.md +23 -10
- package/src/notebook/README.md +1 -1
- package/src/skills/_self-improvement.md +12 -9
- package/src/skills/compose-ops.md +58 -0
- package/src/skills/gitlab-ci.md +51 -0
- package/src/skills/jenkins-pipeline.md +56 -0
- package/src/skills/pipeline.md +2 -2
- package/src/skills/rule/approve.md +11 -5
- package/src/skills/rule.md +26 -19
- package/src/skills/skill-forge.md +24 -6
- package/themes/_TEMPLATE.json +5 -2
- package/themes/biker.json +5 -2
- package/themes/commentator.json +5 -2
- package/themes/cyberpunk.json +5 -2
- package/themes/gamer.json +5 -2
- package/themes/imperial.json +5 -2
- package/themes/joker.json +5 -2
- package/themes/marvin.json +5 -2
- package/themes/mean.json +5 -2
- package/themes/military.json +5 -2
- package/themes/neutral.json +5 -2
- package/themes/pirate.json +5 -2
- package/themes/sports.json +5 -2
- package/themes/verstappen.json +5 -2
- package/themes/wizard.json +5 -2
- package/web/dist/assets/Activity-Ck_Xffpo.js +1 -0
- package/web/dist/assets/ActivityDetail-CBxVS4mU.js +1 -0
- package/web/dist/assets/{Bonsai-B_y20b3i.js → Bonsai-BlOwsvW6.js} +1 -1
- package/web/dist/assets/{CopyButton-CHQte7Ap.js → CopyButton-DFMOIGbe.js} +1 -1
- package/web/dist/assets/Dashboard-BUdUTjbB.js +2 -0
- package/web/dist/assets/{Docs-Dgv_MWfT.js → Docs-D_2Jt6gU.js} +3 -3
- package/web/dist/assets/{GreenhouseView-CSzTMSl_.js → GreenhouseView-WalcX5bp.js} +1 -1
- package/web/dist/assets/Installs-UGiPDMDt.js +3 -0
- package/web/dist/assets/{JournalView-CvRk1-m5.js → JournalView-CZtXQz-v.js} +1 -1
- package/web/dist/assets/Kits-XQHsazCN.js +1 -0
- package/web/dist/assets/Laws-B6A55S-2.js +4 -0
- package/web/dist/assets/Library-D7L0Wdbh.js +3 -0
- package/web/dist/assets/Loops-C0loS73u.js +2 -0
- package/web/dist/assets/{OperatorHudView-DuGz_sTk.js → OperatorHudView-CeDw5qMB.js} +1 -1
- package/web/dist/assets/Personal-PVmGA2-M.js +2 -0
- package/web/dist/assets/{RailCats-AW92uhsX.js → RailCats-BGZnJ6fa.js} +1 -1
- package/web/dist/assets/Settings-DWuxwh4i.js +1 -0
- package/web/dist/assets/Tabs-d2RIRAKT.js +1 -0
- package/web/dist/assets/api-BMFDSXoB.js +1 -0
- package/web/dist/assets/index-BEI5ugYQ.css +1 -0
- package/web/dist/assets/index-BNttaGQb.js +6 -0
- package/web/dist/index.html +3 -3
- package/web/dist/assets/Activity-D8G4eClY.js +0 -1
- package/web/dist/assets/ActivityDetail-BtOBYk3M.js +0 -1
- package/web/dist/assets/Dashboard-B8uXeJZ_.js +0 -2
- package/web/dist/assets/Installs-BDk9lqBI.js +0 -3
- package/web/dist/assets/Kits-CoITzxWM.js +0 -1
- package/web/dist/assets/Laws-Ctf5r9rE.js +0 -3
- package/web/dist/assets/Library-DNwHYVXt.js +0 -3
- package/web/dist/assets/Loops-S85PMQ8m.js +0 -2
- package/web/dist/assets/Personal-afJNwvRS.js +0 -2
- package/web/dist/assets/Settings-CGDFz-6j.js +0 -1
- package/web/dist/assets/Tabs-1qLrnqmn.js +0 -1
- package/web/dist/assets/api-C46vAuqp.js +0 -1
- package/web/dist/assets/index-COTd4TRZ.js +0 -3
- package/web/dist/assets/index-CtorA7uK.css +0 -1
package/js/build/fold.mjs
CHANGED
|
@@ -45,11 +45,11 @@ const sha256 = (data) => createHash('sha256').update(data).digest('hex');
|
|
|
45
45
|
const seedHash = (bytes) => sha256(bytes.toString('utf8').replaceAll('\r\n', '\n'));
|
|
46
46
|
const WHOLE_FILE_SEEDS = new Set([sha256(SESSION_SEEDS['PROFILE.md']), sha256(SESSION_SEEDS[WIKI_FILE]),
|
|
47
47
|
LEGACY_WIKI_SEED]);
|
|
48
|
-
const isWholeFileSeed = (bytes) => WHOLE_FILE_SEEDS.has(seedHash(bytes));
|
|
48
|
+
export const isWholeFileSeed = (bytes) => WHOLE_FILE_SEEDS.has(seedHash(bytes));
|
|
49
49
|
|
|
50
50
|
/** A folded store keeps these: the re-seed restores them, and their text never says "not folded". */
|
|
51
51
|
const STORE_KEEPS = ['README.md', '.gitignore', '.own-writes.json'];
|
|
52
|
-
const DRAFT_HEAD = '# User rules — draft\n\nNot active. The rule Rite applies decisions.\n';
|
|
52
|
+
const DRAFT_HEAD = '# User rules — draft\n\nNot active. The rule Rite or the console applies decisions.\n';
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Claim `dest` with the finished bytes, or throw EEXIST: a rename would replace a file another
|
|
@@ -70,7 +70,7 @@ function claimFile(tmp, dest) {
|
|
|
70
70
|
* `bytes` at `dest`, or nothing there: a short write fails on its temp name, never on `dest`.
|
|
71
71
|
* `exclusive` is for a name the caller found free; without it the file is meant to be replaced.
|
|
72
72
|
*/
|
|
73
|
-
function landFile(dest, bytes, { exclusive = false } = {}) {
|
|
73
|
+
export function landFile(dest, bytes, { exclusive = false } = {}) {
|
|
74
74
|
mkdirSync(path.dirname(dest), { recursive: true });
|
|
75
75
|
const tmp = `${dest}.${process.pid}.fold-tmp`;
|
|
76
76
|
try {
|
|
@@ -297,7 +297,7 @@ function foldNotes(cfgDir, ctx) {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
const itemKey = (kind, host, bytes) => createHash('sha256').update(`${kind}\0${host}\0`).update(bytes).digest('hex');
|
|
300
|
+
export const itemKey = (kind, host, bytes) => createHash('sha256').update(`${kind}\0${host}\0`).update(bytes).digest('hex');
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
303
|
* A block in the draft and a C7 record. The key names the host too, so two hosts holding the same
|
|
@@ -351,7 +351,7 @@ function foldWholeFile(kind, hostFiles, sharedFile, reseed, ctx) {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
/** What makes two rules one (fold step 5): metadata and number do not. Line endings are already gone. */
|
|
354
|
-
const ruleText = (r) => `${r.title}\n${r.body}`;
|
|
354
|
+
export const ruleText = (r) => `${r.title}\n${r.body}`;
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
357
|
* A pending rule this host no longer holds waits for nothing: it merged, because another host's
|
|
@@ -392,8 +392,8 @@ function withoutRules(text, merged) {
|
|
|
392
392
|
/**
|
|
393
393
|
* Fold step 5. A rule the shared file holds word for word leaves the host file: it binds from
|
|
394
394
|
* there. Any other goes to the draft and stays, so nothing stops binding before the user decides
|
|
395
|
-
* (C8), and an approval needs no code here: the rule Rite
|
|
396
|
-
* fold finds a duplicate. A rejected rule is the exception to the merge, because "keep it on this
|
|
395
|
+
* (C8), and an approval needs no code here: the rule Rite or the console (`rule-decide.mjs`) puts it
|
|
396
|
+
* in the shared file, and the next fold finds a duplicate. A rejected rule is the exception to the merge, because "keep it on this
|
|
397
397
|
* host" holds even if the shared file later says the same.
|
|
398
398
|
*
|
|
399
399
|
* The old file is copied aside, not moved: the host file must exist at every moment, because the
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE DECISIONS ON THE DRAFT: what the fold left in `user-rules.draft.md`, applied as the rule
|
|
3
|
+
* Rite's approval flow says (src/skills/rule/approve.md). The console calls this; the Rite stays a
|
|
4
|
+
* written procedure, because an agent's write must pass the rule gate and a verb it could run would
|
|
5
|
+
* step around that prompt. So the two are held together by words: a change to one step here or there
|
|
6
|
+
* is a change to both, and `tests/unit/rule_decide.test.mjs` pins the formats they share.
|
|
7
|
+
*
|
|
8
|
+
* THE WRITE ORDER IS THE SAFETY: target file, ledger row, draft. A rule stays in force at every
|
|
9
|
+
* point, because nothing here touches a host's rule file: a stop leaves the rule bound from its
|
|
10
|
+
* host, and `settle` (the flow's step 2) or the next fold finishes the rest. A ledger that does not
|
|
11
|
+
* read fails before the first write.
|
|
12
|
+
*
|
|
13
|
+
* A POINTER IS DATA. An agent can write the draft past one prompt. So a `Rule from` block is
|
|
14
|
+
* decided only when its text hashes to its key, its ledger row is pending and it holds exactly one
|
|
15
|
+
* rule. A `Choose` block may only name a whole file by its own name, in its host's live config
|
|
16
|
+
* directory, compared as a string before any file call, so a forged path never reaches the disk.
|
|
17
|
+
* The shared side is always the tier's, whatever the block says. Nothing is deleted: a file that
|
|
18
|
+
* leaves goes to `archived-<file>/`.
|
|
19
|
+
*
|
|
20
|
+
* THE CHANGE REPORT SEES THESE WRITES (not Reject or Keep both: those touch only the unwatched
|
|
21
|
+
* draft and ledger), on purpose. The console's token is readable by anything on
|
|
22
|
+
* the machine, so a POST here proves no click, and logging it as Geneseed's own would let an agent
|
|
23
|
+
* blind the report. A false alarm on a real click is the safe direction, and the line names it.
|
|
24
|
+
*/
|
|
25
|
+
import { copyFileSync, readFileSync, realpathSync } from 'node:fs';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
|
|
28
|
+
import { HOSTS } from '../hosts/hosts.mjs';
|
|
29
|
+
import { readMaybe } from '../hosts/installs.mjs';
|
|
30
|
+
import { archiveStore, parseDraft, parseRules, readFoldState } from '../hosts/memory-files.mjs';
|
|
31
|
+
import { isFile, writeTextAtomic } from '../lib/fs.mjs';
|
|
32
|
+
import { jsonDumpsIndent } from '../lib/json.mjs';
|
|
33
|
+
import { WIKI_NAMES } from '../lib/machine-dir.mjs';
|
|
34
|
+
import { normcase } from '../lib/paths.mjs';
|
|
35
|
+
import { isWholeFileSeed, itemKey, landFile, ruleText } from './fold.mjs';
|
|
36
|
+
|
|
37
|
+
/** Where a retired rule goes: beside its `user-rules.md`, never loaded. */
|
|
38
|
+
export const RETIRED_RULES_FILE = 'user-rules-retired.md';
|
|
39
|
+
|
|
40
|
+
export const RULE_DECISIONS = ['approve', 'reject'];
|
|
41
|
+
export const CHOICE_DECISIONS = ['host', 'shared', 'both'];
|
|
42
|
+
|
|
43
|
+
const RENUMBERED = '## Renumbered';
|
|
44
|
+
const RULE_POINTER = /^\(source: .* \| old: R(\d+) \| sha256: \w+\)$/;
|
|
45
|
+
const CHOICE_POINTER = /^\(hosts: shared, (.+?) \| paths: (.*) \| sha256: \w+\)$/;
|
|
46
|
+
/** Where a block starts. A rule body holds no `## ` line (`settleRules` in fold.mjs says why). */
|
|
47
|
+
const pieces = (text) => text.split(/^(?=## )/m);
|
|
48
|
+
|
|
49
|
+
/** A host's live config directory, or null. `configDir` throws with no home directory. */
|
|
50
|
+
function configDirOf(host) {
|
|
51
|
+
try { return HOSTS.find((h) => h.host === host)?.configDir() ?? null; } catch { return null; }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Is `dir` that directory? Strings only: `dir` comes from the draft, and may name a share. */
|
|
55
|
+
const isConfigDir = (dir, host) => {
|
|
56
|
+
const cfg = configDirOf(host);
|
|
57
|
+
return cfg !== null && normcase(path.resolve(dir)) === normcase(path.resolve(cfg));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** A `Choose` block's facts, or nothing when its pointer does not name a whole file. */
|
|
61
|
+
function choiceFacts(pointer, title, shared) {
|
|
62
|
+
const m = CHOICE_POINTER.exec(pointer);
|
|
63
|
+
const file = title.slice('Choose: '.length);
|
|
64
|
+
const whole = new Map([['PROFILE.md', ['profile', shared.profile, ['PROFILE.md']]],
|
|
65
|
+
[path.basename(shared.wiki), ['wiki', shared.wiki, WIKI_NAMES]]]).get(file);
|
|
66
|
+
if (!m || !whole) return {};
|
|
67
|
+
const [, chooser, paths] = m;
|
|
68
|
+
const at = paths.indexOf(`${file}, `);
|
|
69
|
+
const spelled = at < 0 ? '' : paths.slice(at + file.length + 2);
|
|
70
|
+
// Resolved, so a `sub/../` spelling cannot pass the compare and then walk a link on POSIX.
|
|
71
|
+
const hostFile = spelled && path.resolve(spelled);
|
|
72
|
+
const [kind, sharedFile, names] = whole;
|
|
73
|
+
const trusted = names.includes(path.basename(hostFile)) && isConfigDir(path.dirname(hostFile), chooser);
|
|
74
|
+
return trusted ? { file, chooser, kind, sharedFile, hostFile } : {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The draft's blocks: `parseDraft`'s fields, the block's own text, and its pointer's facts. */
|
|
78
|
+
function blocksOf(text, shared) {
|
|
79
|
+
return pieces(text).flatMap((piece) => {
|
|
80
|
+
const [b] = parseDraft(piece);
|
|
81
|
+
if (!b) return [];
|
|
82
|
+
const pointer = piece.split('\n')[1]?.trim() ?? '';
|
|
83
|
+
if (!b.host) return [{ ...b, piece, ...choiceFacts(pointer, b.title, shared) }];
|
|
84
|
+
const m = RULE_POINTER.exec(pointer);
|
|
85
|
+
return [{ ...b, piece, ...(m ? { old: m[1] } : {}) }];
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A `Rule from` block as the fold compares rules: its metadata and number do not count. Null unless
|
|
91
|
+
* it reads as exactly one rule: a `##\u00a0R900` line would raise a second one nobody was shown.
|
|
92
|
+
*/
|
|
93
|
+
function blockRule(b) {
|
|
94
|
+
const [rules] = parseRules(`## R0 — ${b.title}\n${b.body}\n`);
|
|
95
|
+
return rules.length === 1 ? ruleText(rules[0]) : null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The ledger row of `key`: a key is draft text, so `constructor` must not read as a row. */
|
|
99
|
+
const rowOf = (items, key) => (Object.hasOwn(items, key) ? items[key] : undefined);
|
|
100
|
+
|
|
101
|
+
/** The shared file's rules, as `ruleText -> number`. */
|
|
102
|
+
const heldRules = (shared) => new Map(parseRules(readMaybe(shared.rules) ?? '')[0].map((r) => [ruleText(r), r.id]));
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Does a `Choose` block no longer ask anything (the flow's step 2)? An absent or seed shared file
|
|
106
|
+
* counts: there is nothing to choose, and *Use the shared file* would keep a seed over the user's
|
|
107
|
+
* text. The next fold moves the host file up.
|
|
108
|
+
*/
|
|
109
|
+
function staleChoice(b) {
|
|
110
|
+
if (!isFile(b.hostFile) || !isFile(b.sharedFile)) return true;
|
|
111
|
+
const bytes = readFileSync(b.hostFile);
|
|
112
|
+
const held = readFileSync(b.sharedFile);
|
|
113
|
+
return isWholeFileSeed(bytes) || isWholeFileSeed(held) || held.equals(bytes)
|
|
114
|
+
|| itemKey(b.kind, b.chooser, bytes) !== b.key;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const renumberedLine = (b, id) => `- ${b.host} R${b.old} -> R${id}: ${b.title}`;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The draft without `drop`, with `lines` under its `## Renumbered` heading. The heading can sit
|
|
121
|
+
* anywhere, because the fold appends after it. One write, so the record and the delete cannot part.
|
|
122
|
+
*/
|
|
123
|
+
function rewritten(text, drop, lines = []) {
|
|
124
|
+
const kept = pieces(text).filter((p) => !drop.some((b) => b.piece === p));
|
|
125
|
+
const fresh = lines.filter((l) => !text.includes(l));
|
|
126
|
+
if (!fresh.length) return kept.join('');
|
|
127
|
+
const at = kept.findIndex((p) => p.startsWith(RENUMBERED));
|
|
128
|
+
if (at < 0) return `${kept.join('').replace(/\n+$/, '')}\n\n${RENUMBERED}\n${fresh.join('\n')}\n`;
|
|
129
|
+
const body = kept[at].replace(/\n+$/, '');
|
|
130
|
+
kept[at] = `${body}\n${fresh.join('\n')}${kept[at].slice(body.length) || '\n'}`;
|
|
131
|
+
return kept.join('');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const saveLedger = (shared, state, io) => io.text(shared.foldState, `${jsonDumpsIndent(state)}\n`);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The flow's step 2: finish what a stop left, and clear what no longer asks. A block the ledger
|
|
138
|
+
* already decided goes, its row stays, and an approved rule gets its `## Renumbered` line if the
|
|
139
|
+
* shared file still holds it. A stale `Choose` block goes with its row: the next fold asks about
|
|
140
|
+
* the current text. Row first, because this walk starts from the blocks: a block left without a row
|
|
141
|
+
* is found again, and a row left without a block would count as pending for ever.
|
|
142
|
+
*/
|
|
143
|
+
function settle(shared, io) {
|
|
144
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
145
|
+
const state = readFoldState(shared);
|
|
146
|
+
const held = heldRules(shared);
|
|
147
|
+
const drop = [];
|
|
148
|
+
const lines = [];
|
|
149
|
+
let rowsGone = false;
|
|
150
|
+
for (const b of blocksOf(text, shared)) {
|
|
151
|
+
const row = rowOf(state.items, b.key);
|
|
152
|
+
if (row && row.state !== 'pending') {
|
|
153
|
+
const id = held.get(b.host ? blockRule(b) : null);
|
|
154
|
+
if (row.state === 'approved' && b.old && id !== undefined) lines.push(renumberedLine(b, id));
|
|
155
|
+
drop.push(b);
|
|
156
|
+
} else if (b.hostFile && staleChoice(b)) {
|
|
157
|
+
delete state.items[b.key];
|
|
158
|
+
rowsGone = true;
|
|
159
|
+
drop.push(b);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!drop.length) return [];
|
|
163
|
+
if (rowsGone) saveLedger(shared, state, io);
|
|
164
|
+
io.text(shared.draft, rewritten(text, drop, lines));
|
|
165
|
+
return drop.map((b) => b.title);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* One above the highest number in the shared file and in each retired file: the tier's and each
|
|
170
|
+
* host's. A host keeps its own retired rules, and a retired number is never reused. A block's
|
|
171
|
+
* `source` is read by nobody: the fold drafts only from these same directories, and a forged one
|
|
172
|
+
* would have this read reach wherever it points.
|
|
173
|
+
*/
|
|
174
|
+
function nextRuleId(shared) {
|
|
175
|
+
const retired = [shared.root, ...HOSTS.map((h) => configDirOf(h.host)).filter(Boolean)]
|
|
176
|
+
.map((dir) => path.join(dir, RETIRED_RULES_FILE));
|
|
177
|
+
const ids = [shared.rules, ...retired].flatMap((f) => parseRules(readMaybe(f) ?? '')[0].map((r) => r.id));
|
|
178
|
+
return Math.max(0, ...ids) + 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** `ok: false` as the rule routes answer it: the client reloads. */
|
|
182
|
+
const conflict = (detail, cleared) => ({ ok: false, error: 'conflict', detail, cleared });
|
|
183
|
+
|
|
184
|
+
/** The target file's write for a `Choose` decision. */
|
|
185
|
+
function applyChoice(b, decision, io) {
|
|
186
|
+
if (decision === 'both') return;
|
|
187
|
+
if (decision === 'shared') {
|
|
188
|
+
archiveStore(b.hostFile);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const bytes = readFileSync(b.hostFile);
|
|
192
|
+
if (itemKey(b.kind, b.chooser, bytes) !== b.key) throw new Error(`${b.hostFile} changed just now`);
|
|
193
|
+
archiveStore(b.sharedFile, copyFileSync);
|
|
194
|
+
io.bytes(b.sharedFile, bytes);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function applyDecision(shared, key, decision, io, cleared) {
|
|
198
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
199
|
+
const b = blocksOf(text, shared).find((x) => x.key === key);
|
|
200
|
+
if (!b) return conflict('That item is no longer in the draft.', cleared);
|
|
201
|
+
const state = readFoldState(shared);
|
|
202
|
+
const allowed = decisionsOf(b, heldRules(shared), state.items);
|
|
203
|
+
if (!allowed.includes(decision)) return conflict(`"${decision}" does not decide this item.`, cleared);
|
|
204
|
+
const lines = [];
|
|
205
|
+
let id;
|
|
206
|
+
if (decision === 'approve') {
|
|
207
|
+
id = nextRuleId(shared);
|
|
208
|
+
const base = (readMaybe(shared.rules) ?? '# User rules\n').replace(/\n+$/, '');
|
|
209
|
+
io.text(shared.rules, `${base}\n\n## R${id} — ${b.title}\n${b.body}\n`);
|
|
210
|
+
lines.push(renumberedLine(b, id));
|
|
211
|
+
} else if (b.hostFile) applyChoice(b, decision, io);
|
|
212
|
+
const kept = decision === 'reject' || decision === 'both';
|
|
213
|
+
state.items[key] = { ...state.items[key], kind: b.kind ?? 'rule', host: b.host ?? b.chooser,
|
|
214
|
+
state: kept ? 'rejected' : 'approved' };
|
|
215
|
+
saveLedger(shared, state, io);
|
|
216
|
+
io.text(shared.draft, rewritten(text, [b], lines));
|
|
217
|
+
return { ok: true, decision, key, id, rebuild: !kept, cleared };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* What may decide a block now. Only what the fold drafted: a pending row, and for a rule its text
|
|
222
|
+
* hashing to its key. None for a rule the shared file already holds, which the next fold clears.
|
|
223
|
+
*/
|
|
224
|
+
function decisionsOf(b, held, items) {
|
|
225
|
+
if (!b.key || rowOf(items, b.key)?.state !== 'pending') return [];
|
|
226
|
+
if (!b.host) return b.hostFile ? CHOICE_DECISIONS : [];
|
|
227
|
+
const rule = blockRule(b);
|
|
228
|
+
return b.old && rule !== null && itemKey('rule', b.host, rule) === b.key && !held.has(rule) ? RULE_DECISIONS : [];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** `f` with its links resolved, so a tier file linked into a dotfiles repo stays a link. */
|
|
232
|
+
function through(f) {
|
|
233
|
+
try { return realpathSync.native(f); } catch { return f; }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Decide one item. Never throws for a failed step: it answers `ok: false`, and the steps already
|
|
238
|
+
* written stand, which is the state the flow's step 2 finishes. `io` is the two writers, so a test
|
|
239
|
+
* can fail each write in turn.
|
|
240
|
+
*/
|
|
241
|
+
export function decideItem(shared, key, decision, io = {
|
|
242
|
+
text: (f, t) => writeTextAtomic(through(f), t),
|
|
243
|
+
bytes: (f, b) => landFile(through(f), b),
|
|
244
|
+
}) {
|
|
245
|
+
try {
|
|
246
|
+
return applyDecision(shared, key, decision, io, settle(shared, io));
|
|
247
|
+
} catch (e) {
|
|
248
|
+
return { ok: false, error: 'failed', detail: `The decision stopped: ${e.message}. The rule stays in force.` };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The draft as the console shows it: each block, with what may decide it and, for a `Choose`, both
|
|
254
|
+
* files' text, since the user picks between them.
|
|
255
|
+
*/
|
|
256
|
+
export function draftItems(shared) {
|
|
257
|
+
const held = heldRules(shared);
|
|
258
|
+
let items = {};
|
|
259
|
+
try { items = readFoldState(shared).items; } catch { /* no ledger to read: nothing is decidable */ }
|
|
260
|
+
return blocksOf(readMaybe(shared.draft) ?? '', shared).map((b) => ({
|
|
261
|
+
title: b.title, host: b.host, body: b.body, key: b.key, decisions: decisionsOf(b, held, items),
|
|
262
|
+
...(b.host && held.has(blockRule(b)) ? { held: true } : {}),
|
|
263
|
+
...(b.hostFile ? { choice: { file: b.file, host: b.chooser, shared_path: b.sharedFile, host_path: b.hostFile,
|
|
264
|
+
shared_text: readMaybe(b.sharedFile), host_text: readMaybe(b.hostFile) } } : {}),
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Every text a decision rests on, for the fingerprint its POST must send back. */
|
|
269
|
+
export function decisionState(shared) {
|
|
270
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
271
|
+
const files = blocksOf(text, shared).filter((b) => b.hostFile).flatMap((b) => [b.sharedFile, b.hostFile]);
|
|
272
|
+
return [text, ...[shared.rules, ...files].map((f) => readMaybe(f) ?? '')].join('\0');
|
|
273
|
+
}
|
package/js/build/source.mjs
CHANGED
|
@@ -525,9 +525,9 @@ export function resolveSkillNames(names, {
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
/**
|
|
528
|
-
* The hook gates an install can switch off (the laws', in law order, then the
|
|
529
|
-
*
|
|
530
|
-
* build flag, the carrier marker (`<marker>: off`, written only when off) and the law. ONE
|
|
528
|
+
* The hook gates an install can switch off (the laws', in law order, then the rows no law owns:
|
|
529
|
+
* `law: null`, appended so an existing install's argv and marker order never move): the
|
|
530
|
+
* cfg/profile key, the build flag, the carrier marker (`<marker>: off`, written only when off) and the law. ONE
|
|
531
531
|
* table, so the flag, the marker, the rebuild argv, the read-back and `status` cannot drift
|
|
532
532
|
* apart. Every gate is ARMED by default and the law's text binds either way. The deletion row
|
|
533
533
|
* is #319's, unchanged: existing installs carry its flag and marker.
|
|
@@ -539,6 +539,12 @@ export const GATE_SWITCHES = [
|
|
|
539
539
|
// Not a law's gate (`law: null`): the ownership first-write gate (js/hosts/ownership-gate.mjs,
|
|
540
540
|
// ruling D25). Its off switch is this flag, never `harness.config.json` (args.mjs says why).
|
|
541
541
|
{ key: 'ownershipGate', flag: '--no-ownership-gate', arg: 'noOwnershipGate', marker: 'Ownership gate', law: null },
|
|
542
|
+
// Rigor 5's hook, so a doctrine's and no law's: protected checks and the gates' own configuration
|
|
543
|
+
// stop asking. Excluding the doctrine is the other axis: it drops the text, never this hook.
|
|
544
|
+
{ key: 'externalGate', flag: '--no-external-gate', arg: 'noExternalGate', marker: 'External gate', law: null },
|
|
545
|
+
// Cure the Cause's weakened-test note, edit time and turn end. Advisory, so no gate the doctor
|
|
546
|
+
// pins (`HOOK_PINNED`; ledger key `cure-the-cause`): `law: null`, though the console shows it on Rule VIII.
|
|
547
|
+
{ key: 'testNote', flag: '--no-test-note', arg: 'noTestNote', marker: 'Test note', law: null },
|
|
542
548
|
];
|
|
543
549
|
|
|
544
550
|
/**
|
package/js/cli-table.json
CHANGED
|
@@ -339,6 +339,36 @@
|
|
|
339
339
|
"is_flag": true,
|
|
340
340
|
"type": null,
|
|
341
341
|
"hidden": false
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"names": [
|
|
345
|
+
"--no-external-gate"
|
|
346
|
+
],
|
|
347
|
+
"dest": "no_external_gate",
|
|
348
|
+
"metavar": null,
|
|
349
|
+
"help": "switch External Gate's hook off for this install: protected checks and the gates' own configuration stop asking, on every host (the doctrine's text still binds unless excluded; OpenCode's own permission.edit keys stay); written to the carrier as 'External gate: off' and replayed by rebuilds",
|
|
350
|
+
"choices": null,
|
|
351
|
+
"default": false,
|
|
352
|
+
"required": false,
|
|
353
|
+
"nargs": "0",
|
|
354
|
+
"is_flag": true,
|
|
355
|
+
"type": null,
|
|
356
|
+
"hidden": false
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"names": [
|
|
360
|
+
"--no-test-note"
|
|
361
|
+
],
|
|
362
|
+
"dest": "no_test_note",
|
|
363
|
+
"metavar": null,
|
|
364
|
+
"help": "switch the weakened-test note off for this install, at edit time and at turn end (Cure the Cause's text still binds; the done checks still run); written to the carrier as 'Test note: off' and replayed by rebuilds",
|
|
365
|
+
"choices": null,
|
|
366
|
+
"default": false,
|
|
367
|
+
"required": false,
|
|
368
|
+
"nargs": "0",
|
|
369
|
+
"is_flag": true,
|
|
370
|
+
"type": null,
|
|
371
|
+
"hidden": false
|
|
342
372
|
}
|
|
343
373
|
],
|
|
344
374
|
"mutex": []
|
|
@@ -698,6 +728,21 @@
|
|
|
698
728
|
"is_flag": true,
|
|
699
729
|
"type": null,
|
|
700
730
|
"hidden": false
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"names": [
|
|
734
|
+
"--no-external-gate"
|
|
735
|
+
],
|
|
736
|
+
"dest": "no_external_gate",
|
|
737
|
+
"metavar": null,
|
|
738
|
+
"help": "skip the External Gate protected-check and gate-configuration asks (set by the emit when the install was built --no-external-gate); the deletion, root-scan, store and consent asks still run",
|
|
739
|
+
"choices": null,
|
|
740
|
+
"default": false,
|
|
741
|
+
"required": false,
|
|
742
|
+
"nargs": "0",
|
|
743
|
+
"is_flag": true,
|
|
744
|
+
"type": null,
|
|
745
|
+
"hidden": false
|
|
701
746
|
}
|
|
702
747
|
],
|
|
703
748
|
"mutex": []
|
|
@@ -774,6 +819,21 @@
|
|
|
774
819
|
"is_flag": true,
|
|
775
820
|
"type": null,
|
|
776
821
|
"hidden": false
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"names": [
|
|
825
|
+
"--no-test-note"
|
|
826
|
+
],
|
|
827
|
+
"dest": "no_test_note",
|
|
828
|
+
"metavar": null,
|
|
829
|
+
"help": "skip the weakened-test note (set by the emit when the install was built --no-test-note); the done checks and learning still run",
|
|
830
|
+
"choices": null,
|
|
831
|
+
"default": false,
|
|
832
|
+
"required": false,
|
|
833
|
+
"nargs": "0",
|
|
834
|
+
"is_flag": true,
|
|
835
|
+
"type": null,
|
|
836
|
+
"hidden": false
|
|
777
837
|
}
|
|
778
838
|
],
|
|
779
839
|
"mutex": []
|
|
@@ -1148,7 +1208,7 @@
|
|
|
1148
1208
|
},
|
|
1149
1209
|
{
|
|
1150
1210
|
"name": "migrate",
|
|
1151
|
-
"help": "move this machine from the git-checkout install shape to the npm one: re-
|
|
1211
|
+
"help": "move this machine from the git-checkout install shape to the npm one: run from the npm package, it re-emits every registered install, which points the hook shim at that package, and reports what must be fixed by hand. A git clone or a bundle is refused with exit 3. Use --dry-run alone, from anywhere, to preview the shared-tier fold",
|
|
1152
1212
|
"description": "",
|
|
1153
1213
|
"positionals": [],
|
|
1154
1214
|
"options": [
|
|
@@ -1219,7 +1279,7 @@
|
|
|
1219
1279
|
},
|
|
1220
1280
|
{
|
|
1221
1281
|
"name": "rule-gate",
|
|
1222
|
-
"help": "PreToolUse hook: force an ASK before any write to user-rules.md or
|
|
1282
|
+
"help": "PreToolUse hook: force an ASK before any write to user-rules.md or the rule draft (Persist Insight backstop; memory is written freely), and stop the first write of a session once in an application repo with no ## Ownership section in its root AGENTS.md (the ownership gate)",
|
|
1223
1283
|
"description": "",
|
|
1224
1284
|
"positionals": [],
|
|
1225
1285
|
"options": [
|
|
@@ -1282,6 +1342,36 @@
|
|
|
1282
1342
|
"is_flag": true,
|
|
1283
1343
|
"type": null,
|
|
1284
1344
|
"hidden": false
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
"names": [
|
|
1348
|
+
"--no-external-gate"
|
|
1349
|
+
],
|
|
1350
|
+
"dest": "no_external_gate",
|
|
1351
|
+
"metavar": null,
|
|
1352
|
+
"help": "skip the External Gate protected-check and gate-configuration asks (set by the emit when the install was built --no-external-gate); every other check still runs",
|
|
1353
|
+
"choices": null,
|
|
1354
|
+
"default": false,
|
|
1355
|
+
"required": false,
|
|
1356
|
+
"nargs": "0",
|
|
1357
|
+
"is_flag": true,
|
|
1358
|
+
"type": null,
|
|
1359
|
+
"hidden": false
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"names": [
|
|
1363
|
+
"--no-test-note"
|
|
1364
|
+
],
|
|
1365
|
+
"dest": "no_test_note",
|
|
1366
|
+
"metavar": null,
|
|
1367
|
+
"help": "skip the weakened-test note (set by the emit when the install was built --no-test-note); every other check still runs",
|
|
1368
|
+
"choices": null,
|
|
1369
|
+
"default": false,
|
|
1370
|
+
"required": false,
|
|
1371
|
+
"nargs": "0",
|
|
1372
|
+
"is_flag": true,
|
|
1373
|
+
"type": null,
|
|
1374
|
+
"hidden": false
|
|
1285
1375
|
}
|
|
1286
1376
|
],
|
|
1287
1377
|
"mutex": []
|
|
@@ -1567,6 +1657,36 @@
|
|
|
1567
1657
|
"is_flag": true,
|
|
1568
1658
|
"type": null,
|
|
1569
1659
|
"hidden": false
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
"names": [
|
|
1663
|
+
"--no-external-gate"
|
|
1664
|
+
],
|
|
1665
|
+
"dest": "no_external_gate",
|
|
1666
|
+
"metavar": null,
|
|
1667
|
+
"help": "skip the External Gate protected-check and gate-configuration asks (set by the emit when the install was built --no-external-gate); every other check still runs",
|
|
1668
|
+
"choices": null,
|
|
1669
|
+
"default": false,
|
|
1670
|
+
"required": false,
|
|
1671
|
+
"nargs": "0",
|
|
1672
|
+
"is_flag": true,
|
|
1673
|
+
"type": null,
|
|
1674
|
+
"hidden": false
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
"names": [
|
|
1678
|
+
"--no-test-note"
|
|
1679
|
+
],
|
|
1680
|
+
"dest": "no_test_note",
|
|
1681
|
+
"metavar": null,
|
|
1682
|
+
"help": "skip the weakened-test note (set by the emit when the install was built --no-test-note); every other check still runs",
|
|
1683
|
+
"choices": null,
|
|
1684
|
+
"default": false,
|
|
1685
|
+
"required": false,
|
|
1686
|
+
"nargs": "0",
|
|
1687
|
+
"is_flag": true,
|
|
1688
|
+
"type": null,
|
|
1689
|
+
"hidden": false
|
|
1570
1690
|
}
|
|
1571
1691
|
],
|
|
1572
1692
|
"mutex": []
|
|
@@ -53,7 +53,7 @@ const SEED_REL = '.geneseed/protected-checks.txt';
|
|
|
53
53
|
* What a project's checks live in. A string ending `/` is a folder, any other string a file; a
|
|
54
54
|
* regex matches file names at the root. Lockfiles are not listed: they move on every install.
|
|
55
55
|
*/
|
|
56
|
-
const CANDIDATES = [
|
|
56
|
+
export const CANDIDATES = [
|
|
57
57
|
'.github/workflows/', '.gitlab-ci.yml', 'Jenkinsfile', 'azure-pipelines.yml', '.circleci/',
|
|
58
58
|
/^eslint\.config\./, /^\.eslintrc/, 'biome.json', 'biome.jsonc', 'tsconfig.json',
|
|
59
59
|
/^jest\.config\./, /^vitest\.config\./, 'pytest.ini', 'ruff.toml', '.golangci.yml', 'checkstyle.xml',
|
|
@@ -12,7 +12,7 @@ import { LEGACY_WIKI_SEED, WIKI_NAMES, sharedPaths } from '../lib/machine-dir.mj
|
|
|
12
12
|
import { normcase, toPlatformPath } from '../lib/paths.mjs';
|
|
13
13
|
import { relPosix } from '../lib/text.mjs';
|
|
14
14
|
import {
|
|
15
|
-
SHARED_TIER_RE, carriersFor, globalHookStandingDown, hookProjectDir, isGlobalInstall, resolvePath, sovereignBypass,
|
|
15
|
+
SHARED_TIER_RE, carriersFor, gateCarrierText, globalHookStandingDown, hookProjectDir, isGlobalInstall, resolvePath, sovereignBypass,
|
|
16
16
|
} from './hosts.mjs';
|
|
17
17
|
import { isFile, isDir, sortPaths, listDir } from './hooks-prims.mjs';
|
|
18
18
|
import { gitRootOf } from './gitref.mjs';
|
|
@@ -281,7 +281,7 @@ export function pendingDrafts() {
|
|
|
281
281
|
/** The session's reminder of them, or null. The OpenCode context plugin's `draftLine` is its twin. */
|
|
282
282
|
function draftLine() {
|
|
283
283
|
const n = pendingDrafts();
|
|
284
|
-
return n ? `[drafts] ${n} drafted item${n === 1 ? '' : 's'} in user-rules.draft.md wait${n === 1 ? 's' : ''} for the user's decision (the rule skill).` : null;
|
|
284
|
+
return n ? `[drafts] ${n} drafted item${n === 1 ? '' : 's'} in user-rules.draft.md wait${n === 1 ? 's' : ''} for the user's decision (the rule skill or the web console).` : null;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
/**
|
|
@@ -658,15 +658,16 @@ function fitLines(lines, room, tailOf) {
|
|
|
658
658
|
* a project install keeps it in the repo, one level above the harness dir. The first candidate
|
|
659
659
|
* that exists answers, as `firstCarrier` does.
|
|
660
660
|
*/
|
|
661
|
-
function
|
|
661
|
+
function installCarrierFile(hookRoot, host) {
|
|
662
662
|
const base = readsTier(hookRoot, host) ? hookRoot : path.dirname(hookRoot);
|
|
663
663
|
// Last, a plain bundle or git-clone harness dir keeps its AGENT.md in the dir itself.
|
|
664
664
|
const found = [...carriersFor(host || 'claude').map((rel) => path.join(base, rel)), path.join(hookRoot, 'AGENT.md')];
|
|
665
665
|
for (const file of found) {
|
|
666
|
-
try { return readFileSync(file, 'utf8'); } catch { /* next candidate */ }
|
|
666
|
+
try { return [file, readFileSync(file, 'utf8')]; } catch { /* next candidate */ }
|
|
667
667
|
}
|
|
668
|
-
return '';
|
|
668
|
+
return ['', ''];
|
|
669
669
|
}
|
|
670
|
+
const installCarrier = (hookRoot, host) => installCarrierFile(hookRoot, host)[1];
|
|
670
671
|
|
|
671
672
|
/**
|
|
672
673
|
* The payload, what it spent against `OUTPUT_BUDGET`, and whether the budget `cut` content from it:
|
|
@@ -792,7 +793,7 @@ export function cmdContext(args) {
|
|
|
792
793
|
// The RAW `args.host`, never defaulted to claude, which would key an older
|
|
793
794
|
// OpenClaude emit's `~/.openclaude` (no `--host`) on `.claude` instead of its folder name.
|
|
794
795
|
if (globalHookStandingDown(hookRoot, root, args.host, 'context')) return 0;
|
|
795
|
-
const carrier = hookRoot ?
|
|
796
|
+
const [carrierFile, carrier] = hookRoot ? installCarrierFile(hookRoot, host) : ['', ''];
|
|
796
797
|
const session = hookRoot ? sessionFiles(hookRoot, host, carrier) : [];
|
|
797
798
|
// A session file discovery would also pick up (a `user-rules.md` at the repo root of an
|
|
798
799
|
// install whose harness dir IS the repo root) is injected once, in the session block.
|
|
@@ -807,7 +808,8 @@ export function cmdContext(args) {
|
|
|
807
808
|
// `--no-done-gate` carries `Done gate: off` in its AGENT.md and gets no line — the OpenCode
|
|
808
809
|
// context plugin's `doneGateOff` reads the same marker with the same pattern.
|
|
809
810
|
const gitRoot = gitRootOf(root);
|
|
810
|
-
const gateOff = (marker) => new RegExp(`^${marker}:[ \\t]*off[ \\t]*\\r?$`, 'm')
|
|
811
|
+
const gateOff = (marker) => new RegExp(`^${marker}:[ \\t]*off[ \\t]*\\r?$`, 'm')
|
|
812
|
+
.test(gateCarrierText(carrierFile, carrier));
|
|
811
813
|
// Bob's Stop carries no transcript, so the gate never judges a turn there (`hooks-done.mjs`).
|
|
812
814
|
const done = gitRoot && !gateOff('Done gate') ? doneLine(gitRoot, host !== 'bob') : null;
|
|
813
815
|
// The ownership decline reminder (`./ownership-gate.mjs`), under the same contract: an install
|
package/js/hosts/hooks-done.mjs
CHANGED
|
@@ -269,7 +269,9 @@ export function doneGate(meta, args, install, read = tailReader()) {
|
|
|
269
269
|
if (checks.length) err('[done-gate] transcript unreadable — turn not judged.\n');
|
|
270
270
|
return null;
|
|
271
271
|
}
|
|
272
|
-
const { missing
|
|
272
|
+
const { missing } = verdict;
|
|
273
|
+
// `--no-test-note`: the line goes, the done checks do not.
|
|
274
|
+
const weakened = args.noTestNote ? [] : verdict.weakened;
|
|
273
275
|
// One JSON document on stdout, whatever the advisories: Stop reads no second one.
|
|
274
276
|
const advise = (...said) => {
|
|
275
277
|
if (weakened.length) {
|
package/js/hosts/hooks-learn.mjs
CHANGED
|
@@ -357,7 +357,7 @@ export function cmdLearn(args) {
|
|
|
357
357
|
if (hookEvent === 'Stop' && !args.file && install) {
|
|
358
358
|
const said = storeReport(install, meta.session_id, {
|
|
359
359
|
transcript: typeof meta.transcript_path === 'string' ? meta.transcript_path : null,
|
|
360
|
-
cwd: meta.cwd, host: args.host || 'claude',
|
|
360
|
+
cwd: meta.cwd, host: args.host || 'claude', ruleStore: !args.noRuleStore,
|
|
361
361
|
});
|
|
362
362
|
if (said && (verdict === 'advisory' || args.host === 'bob')) err(`[geneseed] ${said}\n`);
|
|
363
363
|
else if (said) out(`${JSON.stringify({ systemMessage: said })}\n`);
|