geneseed 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +21 -18
- package/SHIPPED.md +7 -7
- package/adapters/opencode/README.md +3 -2
- package/adapters/opencode/plugins/geneseed-context.js +6 -0
- package/adapters/opencode/plugins/geneseed-guard.js +5 -3
- package/bin/geneseed-cli.mjs +7 -0
- package/bin/geneseed-hook.mjs +3 -3
- package/docs/PRD.md +1 -1
- package/docs/README.md +1 -0
- package/docs/concepts/agents.md +1 -1
- package/docs/concepts/collaboration.md +2 -2
- package/docs/concepts/enforcement-table.md +5 -2
- package/docs/concepts/exclusions.md +16 -2
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +1 -1
- package/docs/concepts/hook-gates.md +3 -3
- package/docs/concepts/hooks.md +4 -3
- package/docs/concepts/host-matrix.md +2 -2
- package/docs/concepts/kits.md +12 -2
- package/docs/concepts/loop-bricks.md +3 -3
- package/docs/concepts/loops.md +6 -4
- package/docs/concepts/ownership.md +1 -1
- package/docs/concepts/rules.md +2 -2
- package/docs/concepts/skills.md +1 -1
- package/docs/extending.md +63 -28
- package/docs/guides/auto-merge.md +100 -0
- package/docs/guides/choose-your-setup.md +1 -1
- package/docs/guides/headless.md +1 -1
- package/docs/guides/install-clone.md +1 -1
- package/docs/guides/install.md +1 -1
- package/docs/guides/loop-finish.md +3 -3
- package/docs/guides/loop-running.md +4 -4
- package/docs/guides/project-context.md +1 -1
- package/docs/guides/run-a-factory.md +2 -2
- package/docs/guides/setup-doctrines.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +3 -3
- package/docs/guides/upgrade.md +1 -1
- package/docs/guides/worktree.md +1 -1
- package/docs/reference/environment.md +4 -2
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/reference/plugin-learn.md +1 -1
- package/docs/reference/plugin-workflow.md +1 -1
- package/docs/reference/troubleshoot-doctor.md +1 -1
- package/docs/reference/troubleshoot-hooks.md +2 -2
- package/docs/reference/troubleshoot-install.md +3 -3
- package/docs/reference/troubleshoot-tools.md +1 -1
- package/docs/token-footprint.md +2 -2
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-claude.md +2 -2
- package/docs/understand/on-your-machine.md +1 -1
- package/docs/web-ui.md +5 -5
- package/harness.config.json +1 -1
- package/js/README.md +2 -1
- package/js/build/args.mjs +12 -1
- package/js/build/driver.mjs +33 -6
- package/js/build/emit-claude.mjs +8 -4
- package/js/build/emit-opencode.mjs +13 -9
- package/js/build/generate.mjs +10 -156
- package/js/build/profile.mjs +318 -0
- package/js/build/render.mjs +81 -3
- package/js/build/retired-skills.mjs +60 -13
- package/js/build/source.mjs +15 -1
- package/js/build/stubs.mjs +4 -1
- package/js/cli-table.json +48 -3
- package/js/hosts/hooks-done.mjs +345 -55
- package/js/hosts/hooks-learn.mjs +4 -3
- package/js/hosts/hooks-prims.mjs +5 -3
- package/js/hosts/hooks.mjs +153 -6
- package/js/hosts/installs.mjs +19 -1
- package/js/hosts/native.mjs +19 -2
- package/js/hosts/settings.mjs +29 -3
- package/js/inspect/checks-constitution.mjs +32 -0
- package/js/inspect/diff.mjs +21 -3
- package/js/inspect/inventory.mjs +1 -1
- package/js/maintain/setup.mjs +5 -1
- package/js/maintain/update.mjs +4 -2
- package/js/web/actions.mjs +16 -3
- package/js/web/api.mjs +7 -2
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +15 -17
- package/src/bricks/pr-open.md +3 -2
- package/src/doctrines/ops.md +2 -2
- package/src/doctrines/process.md +40 -36
- package/src/factories/analysis-to-build.json +1 -1
- package/src/factories/bug-report-to-fix.json +1 -1
- package/src/factories/issue-to-pr.json +1 -1
- package/src/kits/terminal-tools/rules.md +10 -0
- package/src/kits/terminal-tools.json +13 -0
- package/src/licenses/herdr.txt +201 -0
- package/src/modes/foreman.md +6 -3
- package/src/skills/_self-improvement.md +9 -7
- package/src/skills/commit.md +17 -17
- package/src/skills/debug/ci.md +1 -1
- package/src/skills/dependencies.md +3 -3
- package/src/skills/document-project.md +3 -2
- package/src/skills/factory.md +13 -4
- package/src/skills/geneseed.md +4 -2
- package/src/skills/git-history.md +5 -7
- package/src/skills/herdr.md +135 -0
- package/src/skills/loop.md +3 -2
- package/src/skills/opencode-cli.md +84 -0
- package/src/skills/pipeline.md +1 -1
- package/src/skills/release.md +5 -8
- package/src/skills/review-response.md +4 -2
- package/src/skills/rule.md +27 -1
- package/src/skills/ship.md +54 -7
- package/src/skills/worktree.md +2 -2
- package/src/upstreams.json +7 -0
- package/themes/_TEMPLATE.json +2 -0
- package/themes/biker.json +2 -0
- package/themes/commentator.json +2 -0
- package/themes/cyberpunk.json +2 -0
- package/themes/gamer.json +2 -0
- package/themes/imperial.json +2 -0
- package/themes/joker.json +2 -0
- package/themes/marvin.json +2 -0
- package/themes/mean.json +2 -0
- package/themes/military.json +2 -0
- package/themes/neutral.json +2 -0
- package/themes/pirate.json +2 -0
- package/themes/sports.json +2 -0
- package/themes/verstappen.json +2 -0
- package/themes/wizard.json +2 -0
- package/web/dist/assets/Activity-D2kOc3yi.js +1 -0
- package/web/dist/assets/ActivityDetail-By3xOr21.js +1 -0
- package/web/dist/assets/{Bonsai-BBl4XXqs.js → Bonsai-CBWDTBA4.js} +1 -1
- package/web/dist/assets/{CopyButton-Beven8yn.js → CopyButton-BVbpriMB.js} +1 -1
- package/web/dist/assets/Dashboard-CIJLPHM9.js +2 -0
- package/web/dist/assets/Docs-CiRRIELs.js +5 -0
- package/web/dist/assets/Factories-DhyK0O8d.js +1 -0
- package/web/dist/assets/{GreenhouseView-Bce212qd.js → GreenhouseView-DW3PgTPy.js} +1 -1
- package/web/dist/assets/Installs-B6nlo-Ly.js +3 -0
- package/web/dist/assets/{JournalView-CV4omyww.js → JournalView-O65qEWfp.js} +1 -1
- package/web/dist/assets/Kits-C5U-yT6Z.js +1 -0
- package/web/dist/assets/Laws-CuTw_XNf.js +4 -0
- package/web/dist/assets/{LibRows-Dag1s0ZX.js → LibRows-D6-CVa3K.js} +1 -1
- package/web/dist/assets/Library-CzPlerd6.js +3 -0
- package/web/dist/assets/Loops-CqNF_-nS.js +2 -0
- package/web/dist/assets/{OperatorHudView-JmYY1pBR.js → OperatorHudView-BNr8K5qj.js} +1 -1
- package/web/dist/assets/Personal-DeDb9e8O.js +2 -0
- package/web/dist/assets/Settings-B8MPN_AD.js +1 -0
- package/web/dist/assets/{Tabs-8zsyEPSK.js → Tabs-DJzAez4h.js} +1 -1
- package/web/dist/assets/index-BL3P-9Rg.js +6 -0
- package/web/dist/index.html +1 -1
- package/web/dist/assets/Activity-WQ3ykgxU.js +0 -1
- package/web/dist/assets/ActivityDetail-7rt04SkS.js +0 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +0 -2
- package/web/dist/assets/Docs-B5aHp86J.js +0 -5
- package/web/dist/assets/Factories-BjqzXAw8.js +0 -1
- package/web/dist/assets/Installs-B1OsrHXF.js +0 -3
- package/web/dist/assets/Kits-CW1e7xNa.js +0 -1
- package/web/dist/assets/Laws-1Ckf1lbs.js +0 -4
- package/web/dist/assets/Library-B3FuFLel.js +0 -3
- package/web/dist/assets/Loops-CwqgnLNw.js +0 -2
- package/web/dist/assets/Personal-DKLgLa7Z.js +0 -2
- package/web/dist/assets/Settings-BwErnh-R.js +0 -1
- package/web/dist/assets/index-Ce6qF2nG.js +0 -6
package/js/hosts/hooks-prims.mjs
CHANGED
|
@@ -410,9 +410,11 @@ const GATE_ASKS = {
|
|
|
410
410
|
impact: 'the scan can run for hours', tail: 'search one named directory',
|
|
411
411
|
can: 'You can name the directory to search.' }),
|
|
412
412
|
// Routine and frequent, so one line: three more would train the user to stop reading all of them.
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
// `strict`: the install asks for every commit and push (`--strict-consent`), not only main's.
|
|
414
|
+
commit: (f) => ({ rule: 'Consent Before Push', quote: true, short: true,
|
|
415
|
+
line: f.strict ? 'This command commits or pushes with git, which needs your approval each time.'
|
|
416
|
+
: 'This command commits or pushes onto the main branch, forces a push, or takes a form the gate cannot read, so it needs your approval.',
|
|
417
|
+
why: f.strict ? 'every commit and push is your decision' : 'the main branch changes only through a pull request', can: GATE_RUN_IT }),
|
|
416
418
|
// The next four are the OpenCode guard's alone: no hook reads a key path, a stream, a wiki manifest
|
|
417
419
|
// or an unknown tool's arguments, and the guard only refuses them. `wiki` has no rule to name.
|
|
418
420
|
'secret-file': (f) => ({ rule: 'Sealed Secrets', line: `This edit writes to ${gateName(gatePath(f.name))}, a file that holds a secret or key.`,
|
package/js/hosts/hooks.mjs
CHANGED
|
@@ -254,6 +254,148 @@ export function worktreeExempt(command, cwd, agentId) {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
// A plain push of one named branch: `[-u|--set-upstream] <remote> <ref>`, nothing else. The
|
|
258
|
+
// remote's first character is alphanumeric so a flag (`-f`, `--all`, `--delete`) is never read
|
|
259
|
+
// as one, and `<ref>` is checked against the current branch by `ownBranchExempt`; a forced push
|
|
260
|
+
// (`-f`, `--force*`, a `+ref`) or a deletion (`:ref`) matches nothing and asks.
|
|
261
|
+
const SEG_PUSH_RE = new RegExp(`^git\\s+push(?:\\s+(?:-u|--set-upstream))?\\s+([A-Za-z0-9][A-Za-z0-9._-]*)\\s+(${ARG_RE})$`);
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Whether the repository's own config can send a push of `<branch>` (no `:<dst>`) somewhere
|
|
265
|
+
* else: a `push =` refspec on a remote, a `[branch "<b>"]` whose `merge` names another branch, or
|
|
266
|
+
* an `[include]`/`[includeIf]` this read does not follow. Each one asks. An explicit
|
|
267
|
+
* `HEAD:<branch>` refspec needs none of this: git ignores the config once a destination is given.
|
|
268
|
+
* The user's global and system config are not read; a remote push refspec there is the one
|
|
269
|
+
* redirect this check cannot see.
|
|
270
|
+
*/
|
|
271
|
+
function pushRedirected(common, branch) {
|
|
272
|
+
let text = '';
|
|
273
|
+
try { text = readFileSync(path.join(common, 'config'), 'utf8'); } catch (e) { if (e.code !== 'ENOENT') return true; }
|
|
274
|
+
if (/^\s*\[include/im.test(text) || /^\s*push\s*=/im.test(text)) return true;
|
|
275
|
+
let section = '';
|
|
276
|
+
for (const line of text.split(/\r?\n/)) {
|
|
277
|
+
const head = /^\s*\[\s*([^\]]*?)\s*\]/.exec(line);
|
|
278
|
+
if (head) { section = head[1]; continue; }
|
|
279
|
+
const merge = /^\s*merge\s*=\s*(\S+)/i.exec(line);
|
|
280
|
+
if (merge && section === `branch "${branch}"` && merge[1] !== `refs/heads/${branch}`) return true;
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Whether every remote names its default branch: at least one `[remote "<r>"]`, each with a
|
|
287
|
+
* readable `refs/remotes/<r>/HEAD` symref (`git clone` writes it; `git remote add` does not, and
|
|
288
|
+
* `git remote set-head <r> --auto` repairs it). Without it, the default branch may be any name
|
|
289
|
+
* (`trunk`), and the own-branch pass cannot tell it from the session's own branch, so it asks
|
|
290
|
+
* (review F1: "when unsure, treat it as main"). An `[include]` may add a remote: asks too.
|
|
291
|
+
*/
|
|
292
|
+
function defaultBranchKnown(common) {
|
|
293
|
+
let text = '';
|
|
294
|
+
try { text = readFileSync(path.join(common, 'config'), 'utf8'); } catch { return false; }
|
|
295
|
+
if (/^\s*\[include/im.test(text)) return false;
|
|
296
|
+
const remotes = [...text.matchAll(/^\s*\[\s*remote\s+"([^"]+)"\s*\]/gim)].map((m) => m[1]);
|
|
297
|
+
if (!remotes.length) return false;
|
|
298
|
+
return remotes.every((r) => {
|
|
299
|
+
try {
|
|
300
|
+
return /^ref:\s*refs\/remotes\//.test(readFileSync(path.join(common, 'refs', 'remotes', ...r.split('/'), 'HEAD'), 'utf8'));
|
|
301
|
+
} catch {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// One commit message, quoted, after `-m`/`-am`/`--message`, masked before the character checks so
|
|
308
|
+
// a Conventional Commits subject (`fix(hooks): x`) or an `@` does not ask (review F3). Single quotes
|
|
309
|
+
// are literal in bash and PowerShell alike. Inside double quotes both shells still expand `$` (and
|
|
310
|
+
// `$(`), a backtick, and bash a `\`: the class refuses those, so such a message keeps the ask.
|
|
311
|
+
const QUOTED_MSG_RE = /(\s(?:-[a-zA-Z]*m|--message)\s+)(?:'[^'\n]*'|"[^"$`\\\n]*")/g;
|
|
312
|
+
// A bash heredoc message: `git commit -F - <<'EOF'` … `EOF`, last in the command. Only a QUOTED
|
|
313
|
+
// delimiter, which leaves the body literal; and no body line may equal the delimiter, or the shell
|
|
314
|
+
// would end the heredoc there and run the rest as commands.
|
|
315
|
+
const HEREDOC_RE = /\s<<-?[ \t]*(['"])([A-Za-z_][A-Za-z0-9_]*)\1[ \t]*\n([\s\S]*)\n\t*\2[ \t]*\n?$/;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The command with what cannot run anything masked out — quoted messages always, a quoted-
|
|
319
|
+
* delimiter heredoc feeding `git commit -F -` under bash only — or null when a heredoc is there
|
|
320
|
+
* but not that safe shape. The masked text is what the character checks and the segment
|
|
321
|
+
* whitelist then read.
|
|
322
|
+
*/
|
|
323
|
+
function maskMessages(command, shell) {
|
|
324
|
+
let text = command;
|
|
325
|
+
const doc = HEREDOC_RE.exec(text);
|
|
326
|
+
if (doc) {
|
|
327
|
+
const head = text.slice(0, doc.index);
|
|
328
|
+
if (shell !== 'bash' || head.includes('<<') || !/\bgit\s+commit\b[^\n]*\s-F\s+-$/.test(head)) return null;
|
|
329
|
+
if (doc[3].split('\n').some((l) => l.replace(/^\t+/, '').trimEnd() === doc[2])) return null;
|
|
330
|
+
text = head;
|
|
331
|
+
}
|
|
332
|
+
return text.replace(QUOTED_MSG_RE, "$1'M'");
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Consent Before Push's own-branch pass (user decision 2026-11-13): the main branch changes only
|
|
337
|
+
* through a pull request, so every other branch is the session's own, and its commits, local
|
|
338
|
+
* merges and plain pushes go through without a prompt. Every clause must hold, or the ask stands:
|
|
339
|
+
* - No `agentId`: a sub-agent never pushes, and its local commits are `worktreeExempt`'s to judge.
|
|
340
|
+
* - The command, with its messages masked (`maskMessages`): none of `UNSAFE_CHARS_RE` or
|
|
341
|
+
* `SUBSHELL_CHARS_RE`; every segment an add, a
|
|
342
|
+
* read-only look, a plain commit or merge (`SEG_LOCAL_RE`, or the loop's `-F` commit), or a
|
|
343
|
+
* plain push (`SEG_PUSH_RE`) of THIS branch, spelled `<branch>`, `HEAD:<branch>` or
|
|
344
|
+
* `HEAD:refs/heads/<branch>`; after at most one leading `cd <path>`. Bare `git push` asks:
|
|
345
|
+
* `push.default` and the global config decide where it goes, and this read cannot see them.
|
|
346
|
+
* - The repository: every remote names its default branch (`defaultBranchKnown`); no remote, or
|
|
347
|
+
* one with no HEAD symref, asks for everything.
|
|
348
|
+
* - The branch: known, not a symref, and, compared case-insensitively, none of `main`, `master`,
|
|
349
|
+
* a remote's default (`protectedBranches`), or the branch the main worktree holds when `cwd` is
|
|
350
|
+
* a linked worktree. In the main checkout itself the checked-out branch is judged by name, as
|
|
351
|
+
* the doctrine says ("in a linked worktree, the branch the main checkout holds"). A bare
|
|
352
|
+
* `<branch>` refspec also needs `pushRedirected` to be false.
|
|
353
|
+
*/
|
|
354
|
+
export function ownBranchExempt(command, cwd, agentId, shell = null) {
|
|
355
|
+
if (typeof agentId === 'string' && agentId) return false;
|
|
356
|
+
if (typeof command !== 'string') return false;
|
|
357
|
+
const masked = maskMessages(command, shell);
|
|
358
|
+
if (masked === null || UNSAFE_CHARS_RE.test(masked) || SUBSHELL_CHARS_RE.test(masked)) return false;
|
|
359
|
+
const segments = masked.split(/&&|\|\||[;|]/).map((x) => x.trim()).filter(Boolean);
|
|
360
|
+
try {
|
|
361
|
+
let dir = realpathSync(cwd);
|
|
362
|
+
const cd = segments.length ? SEG_CD_RE.exec(segments[0]) : null;
|
|
363
|
+
if (cd) {
|
|
364
|
+
if (cd[1] === '-' || cd[1].startsWith('~')) return false;
|
|
365
|
+
dir = realpathSync(path.resolve(dir, cd[1]));
|
|
366
|
+
segments.shift();
|
|
367
|
+
}
|
|
368
|
+
if (!segments.length) return false;
|
|
369
|
+
const root = gitRootOf(dir);
|
|
370
|
+
const branch = root && currentBranch(dir);
|
|
371
|
+
if (!branch || branch.includes('..')) return false;
|
|
372
|
+
const common = gitCommonDirOf(root);
|
|
373
|
+
if (!defaultBranchKnown(common)) return false;
|
|
374
|
+
// The branch may itself be a symref (`git symbolic-ref refs/heads/sym refs/heads/main`), and a
|
|
375
|
+
// commit then moves its target: as in `worktreeExempt`, a loose ref starting `ref:` asks.
|
|
376
|
+
let loose = '';
|
|
377
|
+
try {
|
|
378
|
+
loose = readFileSync(path.join(common, 'refs', 'heads', ...branch.split('/')), 'utf8');
|
|
379
|
+
} catch (e) {
|
|
380
|
+
if (e.code !== 'ENOENT') return false;
|
|
381
|
+
}
|
|
382
|
+
if (/^\s*ref:/.test(loose)) return false;
|
|
383
|
+
const main = mainWorktreeOf(dir);
|
|
384
|
+
const taken = [...protectedBranches(root), main && currentBranch(main)].filter(Boolean);
|
|
385
|
+
if (taken.some((b) => b.toLowerCase() === branch.toLowerCase())) return false;
|
|
386
|
+
return segments.every((seg) => {
|
|
387
|
+
if (SEG_ADD_RE.test(seg) || SEG_READONLY_RE.test(seg) || SEG_LOCAL_RE.test(seg) || SEG_COMMIT_RE.test(seg)) return true;
|
|
388
|
+
const push = SEG_PUSH_RE.exec(seg);
|
|
389
|
+
if (!push) return false;
|
|
390
|
+
const ref = push[2];
|
|
391
|
+
if (ref === `HEAD:${branch}` || ref === `HEAD:refs/heads/${branch}`) return true;
|
|
392
|
+
return ref === branch && !pushRedirected(common, branch);
|
|
393
|
+
});
|
|
394
|
+
} catch {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
257
399
|
// `askDecision` lives in `./hooks-prims.mjs`, so the entry can ask when THIS module fails to load.
|
|
258
400
|
export { askDecision };
|
|
259
401
|
|
|
@@ -908,7 +1050,8 @@ export function gitDecide(args, payload) {
|
|
|
908
1050
|
return ask(args, 'git-gate', 'law-4', 'unverified', {});
|
|
909
1051
|
}
|
|
910
1052
|
const tool = payload && payload.tool_name;
|
|
911
|
-
const
|
|
1053
|
+
const shell = tool === 'Bash' ? 'bash' : tool === 'PowerShell' ? 'powershell' : null;
|
|
1054
|
+
const command = shellReading(ti.command, shell);
|
|
912
1055
|
// The agent's own words, for the asks where they are no conflict of interest (`gateText`'s `quote`).
|
|
913
1056
|
const says = typeof ti.description === 'string' ? ti.description : '';
|
|
914
1057
|
// Law IV's catastrophic class (a root, a drive, the home dir, a disk): no state makes it safe,
|
|
@@ -946,12 +1089,16 @@ export function gitDecide(args, payload) {
|
|
|
946
1089
|
// no rule behind it — but Law IV above is universal and has already run. Checked before
|
|
947
1090
|
// `loopExempt` so a non-git command, or one with consent off, never pays for the whitelist.
|
|
948
1091
|
if (args.noConsent || !GIT_GATE_RE.test(command) || consentBenign(command)) return 0;
|
|
949
|
-
|
|
950
|
-
//
|
|
951
|
-
|
|
1092
|
+
const cwd = (payload && payload.cwd) || process.cwd();
|
|
1093
|
+
// Consent Before Push: off the main branch, commits, local merges and plain pushes are the
|
|
1094
|
+
// session's own. `--strict-consent` turns this pass off, and every commit and push asks again.
|
|
1095
|
+
if (!args.strictConsent && ownBranchExempt(command, cwd, payload && payload.agent_id, shell)) return 0;
|
|
1096
|
+
// Strict consent keeps the narrower passes: a loop launched on its own `loop/*` branch is a
|
|
1097
|
+
// named batch for a fixed set of commit/push forms on that branch only.
|
|
1098
|
+
if (loopExempt(command, cwd)) return 0;
|
|
952
1099
|
// A worker's own worktree branch is a named batch for local commits and merges, never a push.
|
|
953
|
-
if (worktreeExempt(command,
|
|
954
|
-
return ask(args, 'git-gate', 'process-5', 'commit', { says });
|
|
1100
|
+
if (worktreeExempt(command, cwd, payload && payload.agent_id)) return 0;
|
|
1101
|
+
return ask(args, 'git-gate', 'process-5', 'commit', { says, strict: args.strictConsent === true });
|
|
955
1102
|
}
|
|
956
1103
|
export const cmdGitGate = guardGate(gitGate, 'git-gate');
|
|
957
1104
|
|
package/js/hosts/installs.mjs
CHANGED
|
@@ -45,7 +45,8 @@ import { registryRoots } from '../inspect/registry.mjs';
|
|
|
45
45
|
import { printErr, readText, isFile, isDir } from '../lib/fs.mjs';
|
|
46
46
|
import { formatRepr, isDict } from '../lib/json.mjs';
|
|
47
47
|
import { comparePaths } from '../lib/paths.mjs';
|
|
48
|
-
import { bundleLeftovers, ownedWithin } from './owned.mjs';
|
|
48
|
+
import { bundleLeftovers, ownedWithin, recordedGates } from './owned.mjs';
|
|
49
|
+
import { prunableGates } from './settings.mjs';
|
|
49
50
|
import { claudeHookShell, hookShimPath } from './shim.mjs';
|
|
50
51
|
|
|
51
52
|
export { carriersFor };
|
|
@@ -621,6 +622,23 @@ export function leftoversOf(root, host = 'opencode', scope = 'global') {
|
|
|
621
622
|
return { kept: kept.sort(), stale };
|
|
622
623
|
}
|
|
623
624
|
|
|
625
|
+
/**
|
|
626
|
+
* The `permission.bash` gates a `--prune-gates` rebuild of this OpenCode install would remove:
|
|
627
|
+
* owned keys whose rule this install has off, still at Geneseed's verdict, and absent from its
|
|
628
|
+
* `bash_gates` record (an `opencode.json` written before 5.2.0). The console shows them beside
|
|
629
|
+
* the leftovers and offers that rebuild. Read with the install's OWN choices — packs, excluded
|
|
630
|
+
* rules, the deletion gate — so it names what the console's prune would take, not a guess.
|
|
631
|
+
* Every other host has no such block: `{ keys: [] }`.
|
|
632
|
+
*/
|
|
633
|
+
export function strandedGatesOf(root, host = 'opencode', scope = 'global') {
|
|
634
|
+
if (host !== 'opencode') return { keys: [], commented: false };
|
|
635
|
+
const manifest = scope === 'project' ? path.join(root, '.opencode', GLOBAL_MANIFEST)
|
|
636
|
+
: path.join(root, GLOBAL_MANIFEST);
|
|
637
|
+
return prunableGates(path.join(root, 'opencode.json'), doctrinesForBuild(root, host),
|
|
638
|
+
excludedRulesOfDir(root, host), gatesOfDir(root, host).deletionGate,
|
|
639
|
+
recordedGates(readJsonMaybe(manifest)));
|
|
640
|
+
}
|
|
641
|
+
|
|
624
642
|
/** 'active' | 'disabled' | 'absent'. */
|
|
625
643
|
export function installState(root, host = 'opencode', scope = 'global') {
|
|
626
644
|
if (CLAUDE_STYLE.includes(host)) return claudeState(root, scope, host);
|
package/js/hosts/native.mjs
CHANGED
|
@@ -194,12 +194,16 @@ export function agentDescription(text) {
|
|
|
194
194
|
return withWhen(firstBlockquote(text), dispatchOf(text));
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Purpose + ` Use when: ` + the first sentence of `trig`, capped — see `skillDescription`.
|
|
199
|
+
* A `;` ends the cut clause as a `.` does, but the clause is the END of the description, so it
|
|
200
|
+
* is written as a `.`: a trailing `;` reads as text that was cut short.
|
|
201
|
+
*/
|
|
198
202
|
function withWhen(desc, trig) {
|
|
199
203
|
if (!trig) return desc;
|
|
200
204
|
const first = trig.match(/^.*?[.;](?=\s|$)/);
|
|
201
205
|
const full = `${desc} Use when: ${first ? first[0] : trig}`;
|
|
202
|
-
if (full.length <= DESCRIPTION_CAP) return full;
|
|
206
|
+
if (full.length <= DESCRIPTION_CAP) return full.replace(/;$/, '.');
|
|
203
207
|
const cut = full.slice(0, DESCRIPTION_CAP);
|
|
204
208
|
const end = Math.max(cut.lastIndexOf('. '), cut.lastIndexOf('; '));
|
|
205
209
|
return end > desc.length ? cut.slice(0, end + 1) : cut.replace(/\s+\S*$/, '') + '…';
|
|
@@ -586,6 +590,19 @@ export function claimer(oldOwned, cfg, manifestExisted = true, oldHashes = {}, f
|
|
|
586
590
|
};
|
|
587
591
|
claim.editRefused = editRefused;
|
|
588
592
|
claim.kept = kept;
|
|
593
|
+
// The manifest's next `kept_hashes` (spec 2026-11-13 §1), read once every writer has claimed.
|
|
594
|
+
// A rel refused for an edit NOW records the hash its last write left (`oldHashes`). From the
|
|
595
|
+
// next emit on it is no longer in `owned`, so the claim refuses it as pre-existing and it lands
|
|
596
|
+
// in `kept`, not `editRefused`: the entry the previous manifest held is carried forward. A rel
|
|
597
|
+
// claimed again (restored, deleted, `--force`) or no longer shipped is in neither set, and drops.
|
|
598
|
+
claim.keptHashes = (oldKeptHashes = {}) => {
|
|
599
|
+
const out = {};
|
|
600
|
+
for (const rel of editRefused) if (Object.hasOwn(oldHashes, rel)) out[rel] = oldHashes[rel];
|
|
601
|
+
for (const rel of kept) {
|
|
602
|
+
if (!Object.hasOwn(out, rel) && Object.hasOwn(oldKeptHashes, rel)) out[rel] = oldKeptHashes[rel];
|
|
603
|
+
}
|
|
604
|
+
return out;
|
|
605
|
+
};
|
|
589
606
|
// Did the previous emit write `dest`? Read by `writeNativeLayer` for a skill's side files.
|
|
590
607
|
claim.owned = (dest) => oldSet !== null && cfg != null && oldSet.has(relPosix(cfg, dest));
|
|
591
608
|
return claim;
|
package/js/hosts/settings.mjs
CHANGED
|
@@ -378,6 +378,30 @@ function reconcileOpencodePermission(perm, want, record = new Set(), pruneAll =
|
|
|
378
378
|
return [changed, stranded, null];
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* The gates a `--prune-gates` build of this selection would take out of `jsonPath`, read without
|
|
383
|
+
* writing — the console's notice and its "Remove stranded gates" button (Installs page).
|
|
384
|
+
*
|
|
385
|
+
* It runs `reconcileOpencodePermission` itself on a copy, so it cannot disagree with the build
|
|
386
|
+
* about what is stranded: the keys it declines to remove, minus the ones a user re-scoped (a
|
|
387
|
+
* value that is no longer `OWNED_VERDICT`), which `--prune-gates` keeps too. A recorded gate
|
|
388
|
+
* never shows here: a plain rebuild already takes it back. `commented` says the file has
|
|
389
|
+
* comments, where a build names the keys but cannot write — the console says "by hand" then.
|
|
390
|
+
* Nothing to read, no `permission`, or a shape the build cannot wire into: no keys.
|
|
391
|
+
* @returns {{ keys: string[], commented: boolean }}
|
|
392
|
+
*/
|
|
393
|
+
export function prunableGates(jsonPath, doctrines = null, excluded = [], deletionGate = true,
|
|
394
|
+
record = []) {
|
|
395
|
+
const { state, data, hadComments } = loadJsonObject(opencodeTarget(jsonPath));
|
|
396
|
+
if (state !== 'ok' || !has(data, 'permission')) return { keys: [], commented: false };
|
|
397
|
+
const perm = structuredClone(get(data, 'permission'));
|
|
398
|
+
const [, stranded] = reconcileOpencodePermission(perm,
|
|
399
|
+
defaultPermission(doctrines, excluded, deletionGate), new Set(record));
|
|
400
|
+
const bash = isDict(perm) && isDict(get(perm, 'bash')) ? get(perm, 'bash') : {};
|
|
401
|
+
const keys = stranded.filter((k) => bash[k] === OWNED_VERDICT.get(k));
|
|
402
|
+
return { keys, commented: keys.length > 0 && !!hadComments };
|
|
403
|
+
}
|
|
404
|
+
|
|
381
405
|
/**
|
|
382
406
|
* `permission.skill` rows for OpenCode's O-1 fix (opencode-verdict.md): a skill marked
|
|
383
407
|
* `<!-- invocation: user -->` is still model-invocable there (Claude Code's
|
|
@@ -876,7 +900,7 @@ export function claudeHookGroups(cfg, hookOpts, doctrines = null, excluded = [],
|
|
|
876
900
|
gates = {}) {
|
|
877
901
|
// One object keyed as `GATE_SWITCHES` keys it; only an explicit `false` disarms a gate.
|
|
878
902
|
const { secretsGate = true, doneGate = true, deletionGate = true, ownershipGate = true,
|
|
879
|
-
externalGate = true, testNote = true } = gates ?? {};
|
|
903
|
+
externalGate = true, testNote = true, ownBranchPass = true } = gates ?? {};
|
|
880
904
|
const run = hookPrefix(hookOpts);
|
|
881
905
|
const mem = `--memory "${path.join(cfg, 'memory')}"`;
|
|
882
906
|
// --root carries the install's own dir so a GLOBAL hook can stand down when a live, wired
|
|
@@ -920,7 +944,8 @@ export function claudeHookGroups(cfg, hookOpts, doctrines = null, excluded = [],
|
|
|
920
944
|
// External Gate's hook and the weakened-test note, the same contract.
|
|
921
945
|
const eg = externalGate === false ? ' --no-external-gate' : '';
|
|
922
946
|
const tn = testNote === false ? ' --no-test-note' : '';
|
|
923
|
-
|
|
947
|
+
// Strict consent (`ownBranchPass` off) rides only while the rule is on: off, nothing asks.
|
|
948
|
+
const nc = consentRuleOn(doctrines, excluded) ? (ownBranchPass === false ? ' --strict-consent' : '') : ' --no-consent';
|
|
924
949
|
return {
|
|
925
950
|
SessionStart: [{ hooks: [{ type: 'command', command: `${run} context --root "${cfg}"${b} || exit 0` }] }],
|
|
926
951
|
// One group, both gates. `tool-gate` EXITS 2 for Laws I and IV (unless built
|
|
@@ -964,7 +989,8 @@ export function claudeHookGroups(cfg, hookOpts, doctrines = null, excluded = [],
|
|
|
964
989
|
// the `Skill|Agent|Task` counter (a counter that cannot start must not ask), never on Bob
|
|
965
990
|
// (see its PreToolUse above).
|
|
966
991
|
const down = host === 'openclaude' ? ` || printf '%s' '${GATE_DOWN}'` : '';
|
|
967
|
-
const
|
|
992
|
+
const consent = consentRuleOn(doctrines, excluded) ? (ownBranchPass === false ? ' --strict-consent' : '') : ' --no-consent';
|
|
993
|
+
const gate = `${run} git-gate --root "${cfg}"${h}${consent}`
|
|
968
994
|
+ (deletionGate === false ? ' --no-deletion-gate' : '')
|
|
969
995
|
+ (externalGate === false ? ' --no-external-gate' : '') + ruleFlags('git-gate', doctrines, excluded)
|
|
970
996
|
+ down;
|
|
@@ -98,6 +98,37 @@ const BARE_CITE_RE = /\{\{LAW\}\}\s+[IVXLCDM]+\b|\{\{DOCTRINE\}\}\s+[a-z]+\s+\d+
|
|
|
98
98
|
// legal everywhere, including in an invariant that points at the tier as a whole.
|
|
99
99
|
const DOCTRINE_TOKEN_RE = /\{\{DOCTRINE(?:\}\}|:)/;
|
|
100
100
|
|
|
101
|
+
// The sources the carrier inlines, where an excluded rule's citations are removed at render. A
|
|
102
|
+
// kit's rules file is inlined too (`kitsBody`); the rest of a kit folder ships beside it.
|
|
103
|
+
const CARRIER_SOURCE_RE = /^(?:AGENT\.md\.tmpl$|modes\/|postures\/|doctrines\/|kits\/[^/]+\/rules\.md$)/;
|
|
104
|
+
const PAREN_RE = /\(([^()]*)\)/g;
|
|
105
|
+
const CITE_TOKEN_RE = /\{\{(?:LAW|DOCTRINE):[^}]*\}\}/g;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A parenthetical in a carrier source that cites a doctrine rule holds citations only.
|
|
109
|
+
*
|
|
110
|
+
* ⚠ THIS IS WHAT MAKES D3 SAFE TO RENDER. An excluded rule is off, so `dropExcludedCitations`
|
|
111
|
+
* (`js/build/render.mjs`) removes its citations from the carrier — but only a group made of
|
|
112
|
+
* citations alone, because only then does the sentence still read with the group gone.
|
|
113
|
+
* `(*Consent Before Push* stays with you)` would survive the render and keep invoking a rule the
|
|
114
|
+
* install switched off. A prose mention outside parentheses is fine: it describes, it binds
|
|
115
|
+
* nothing. Doctrine citations only, because a law cannot be excluded.
|
|
116
|
+
* @param {string} rel path under src/, posix
|
|
117
|
+
* @param {string} text the raw source
|
|
118
|
+
*/
|
|
119
|
+
export function citationGroupProblems(rel, text) {
|
|
120
|
+
if (!CARRIER_SOURCE_RE.test(rel)) return [];
|
|
121
|
+
const problems = [];
|
|
122
|
+
for (const [whole, inner] of text.matchAll(PAREN_RE)) {
|
|
123
|
+
if (!inner.includes('{{DOCTRINE:')) continue;
|
|
124
|
+
if (!inner.replace(CITE_TOKEN_RE, '').replace(/[,\s]/g, '')) continue;
|
|
125
|
+
problems.push(`[authoring] ${rel} mixes a doctrine citation with other words in '${whole.replace(/\s+/g, ' ')}'`
|
|
126
|
+
+ ' — an excluded rule\'s citation is removed from the carrier only when its parentheses hold'
|
|
127
|
+
+ ' citations alone; move the words outside: "…, so X ({{DOCTRINE:<id>}})"');
|
|
128
|
+
}
|
|
129
|
+
return problems;
|
|
130
|
+
}
|
|
131
|
+
|
|
101
132
|
/**
|
|
102
133
|
* The rules the hooks enforce at the tool boundary, and the address each is bound to there. The
|
|
103
134
|
* hook path cannot afford to read the canon on every tool call, so its gate-ledger keys
|
|
@@ -284,6 +315,7 @@ export function constitutionProblems() {
|
|
|
284
315
|
+ 'reference a toggleable one, or a pack-off build ships a rule pointing at text '
|
|
285
316
|
+ 'that is not there. State the point directly instead');
|
|
286
317
|
}
|
|
318
|
+
problems.push(...citationGroupProblems(rel, text));
|
|
287
319
|
for (const [bare] of text.matchAll(BARE_CITE_RE)) {
|
|
288
320
|
problems.push(`[authoring] ${rel} cites '${bare.replace(/\s+/g, ' ')}' by number — numbers are `
|
|
289
321
|
+ 'positional and move when the canon does; cite {{LAW:<id>}} / {{DOCTRINE:<id>}}');
|
package/js/inspect/diff.mjs
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
trustOfDir,
|
|
46
46
|
readJsonMaybe, readMaybe, renderedTier, themeOfDir,
|
|
47
47
|
} from '../hosts/installs.mjs';
|
|
48
|
-
import { hashesOf, ownedState, safeLeaf } from '../hosts/owned.mjs';
|
|
48
|
+
import { hashesOf, ownedState, safeLeaf, textHash } from '../hosts/owned.mjs';
|
|
49
49
|
import { hostGlobalInstalls as globalInstalls } from './excludes.mjs';
|
|
50
50
|
import { unifiedDiff, splitLines } from '../lib/udiff.mjs';
|
|
51
51
|
import { printOut, printErr, readText, writeText, isFile } from '../lib/fs.mjs';
|
|
@@ -280,6 +280,8 @@ export function diffCollect({
|
|
|
280
280
|
const manifest = readJsonMaybe(path.join(dir, GLOBAL_MANIFEST));
|
|
281
281
|
const deployedOwned = ownedSet(dir, manifest);
|
|
282
282
|
const hashes = hashesOf(manifest);
|
|
283
|
+
// The bases of the files an emit left to the user, read with `hashes`' own defensive reader.
|
|
284
|
+
const keptHashes = hashesOf({ hashes: manifest?.kept_hashes });
|
|
283
285
|
// STALE IS NOT AN EDIT. A file whose bytes still match the hash its emit recorded was never
|
|
284
286
|
// touched: it differs only because the source moved on, and the next rebuild overwrites it.
|
|
285
287
|
// Reporting it as "edited" told every install behind its source that it was hand-edited.
|
|
@@ -303,7 +305,18 @@ export function diffCollect({
|
|
|
303
305
|
// being behind, never an edit, with or without hashes.
|
|
304
306
|
const stale = rel === VERSION_MARKER
|
|
305
307
|
|| (hashed && ownedState(dir, rel, hashes) === 'unmodified');
|
|
306
|
-
|
|
308
|
+
// KEPT OR DIVERGED (spec 2026-11-13, D1/D6). The base is what the last emit wrote here:
|
|
309
|
+
// `hashes[rel]` while the rel is still owned, else the `kept_hashes[rel]` the emit that
|
|
310
|
+
// refused it carried forward. The edit loses nothing while the fresh render still hashes
|
|
311
|
+
// to that base. `tb` is the LOCATED render read through `readText` (CRLF folded), so
|
|
312
|
+
// `textHash` of it is the manifest's `fileHash` of the same bytes. No base: diverged.
|
|
313
|
+
let diverged;
|
|
314
|
+
if (!stale) {
|
|
315
|
+
const base = Object.hasOwn(hashes, rel) ? hashes[rel]
|
|
316
|
+
: Object.hasOwn(keptHashes, rel) ? keptHashes[rel] : null;
|
|
317
|
+
diverged = base === null || textHash(tb) !== base;
|
|
318
|
+
}
|
|
319
|
+
rec = { rel, status: stale ? 'stale' : 'edited', diff, ...(diverged !== undefined && { diverged }) };
|
|
307
320
|
}
|
|
308
321
|
} else if (isFile(a)) {
|
|
309
322
|
const body = splitLines(readText(a));
|
|
@@ -570,7 +583,12 @@ export function cmdDiff(args) {
|
|
|
570
583
|
if (stale.length) printOut(`[diff] ${stale.length} file(s) behind source — rebuild to update them\n`);
|
|
571
584
|
const notes = collectNotes(target);
|
|
572
585
|
if (notes.length) printOut(`[diff] ${notes.length} self-improvement note(s) to back-port\n`);
|
|
573
|
-
|
|
586
|
+
// The two states of an edit (spec 2026-11-13 §4): kept loses nothing, diverged misses an update.
|
|
587
|
+
for (const f of edited) {
|
|
588
|
+
printOut(` ~ ${f.rel} (edited in deployed — ${'diverged' in f && f.diverged === false
|
|
589
|
+
? 'source unchanged, nothing missed'
|
|
590
|
+
: 'the source has moved; review to back-port, or restore'})\n`);
|
|
591
|
+
}
|
|
574
592
|
for (const f of added) printOut(` + ${f.rel} (only in deployed — your addition)\n`);
|
|
575
593
|
for (const f of missing) printOut(` - ${f.rel} (in source, not deployed — re-emit to add)\n`);
|
|
576
594
|
for (const f of linked) printOut(` = ${f.rel} (a link — yours, left alone)\n`);
|
package/js/inspect/inventory.mjs
CHANGED
|
@@ -105,7 +105,7 @@ export const SKILL_CLASS = {
|
|
|
105
105
|
// knowledge base, terminal) rather than about the user's code. They sat under
|
|
106
106
|
// `understand` before, which made that class a grab-bag.
|
|
107
107
|
wiki: 'harness', geneseed: 'harness', rule: 'harness', profile: 'harness',
|
|
108
|
-
'skill-forge': 'harness', adhd: 'harness',
|
|
108
|
+
'skill-forge': 'harness', adhd: 'harness', herdr: 'harness', 'opencode-cli': 'harness',
|
|
109
109
|
teach: 'learn', 'learn-mode': 'learn',
|
|
110
110
|
};
|
|
111
111
|
|
package/js/maintain/setup.mjs
CHANGED
|
@@ -336,7 +336,7 @@ export function collectSetupLines(kitMap = null) {
|
|
|
336
336
|
const gated = Object.values(gates).some((on) => on === false);
|
|
337
337
|
printOut(`\nAbout to run: geneseed build ${
|
|
338
338
|
setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
|
|
339
|
-
excludeRules, undefined, excludeSkills, gates, kits, sharedTier).join(' ')}\n`);
|
|
339
|
+
excludeRules, undefined, excludeSkills, gates, kits, sharedTier).join(' ')} --reset\n`);
|
|
340
340
|
if (!confirm('Proceed?', true)) return null;
|
|
341
341
|
// The key only when there is something to carry, so a selection that excludes no skill and
|
|
342
342
|
// switches off no gate is the same object it was before either existed.
|
|
@@ -542,6 +542,10 @@ export function setupLines() {
|
|
|
542
542
|
// one command and run another.
|
|
543
543
|
const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
|
|
544
544
|
doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier);
|
|
545
|
+
// `--reset`: the wizard's answers are a WHOLE selection, and `setupBuildArgs` elides an axis at
|
|
546
|
+
// its default, so answering one back to it (mode direct, posture peer) over an install would
|
|
547
|
+
// otherwise trip the preserve guard (js/build/profile.mjs). The plan line above says the same.
|
|
548
|
+
argv.push('--reset');
|
|
545
549
|
printOut(`Running: geneseed build ${argv.join(' ')}\n`);
|
|
546
550
|
const rc = driverMain(argv);
|
|
547
551
|
if (rc !== 0) {
|
package/js/maintain/update.mjs
CHANGED
|
@@ -749,7 +749,9 @@ async function drainStdout() {
|
|
|
749
749
|
|
|
750
750
|
/**
|
|
751
751
|
* The flags that re-emit the install at `dir` on its OWN axes — footprint, posture, mode,
|
|
752
|
-
* trust, doctrine packs, excluded rules — or `[]`
|
|
752
|
+
* trust, doctrine packs, excluded rules, excluded skills, gates, kits, shared tier — or `[]`
|
|
753
|
+
* when no build ever wrote a marker there. Every axis the preserve guard compares
|
|
754
|
+
* (js/build/profile.mjs) has to be here, or `upgrade` is refused on the one it left out.
|
|
753
755
|
*
|
|
754
756
|
* WITHOUT THEM THE REBUILD RESETS THE INSTALL. The generator's defaults are not the install's:
|
|
755
757
|
* a missing `--footprint` is `lean`, and posture, mode, packs and excluded rules come from
|
|
@@ -770,7 +772,7 @@ export async function installAxes(dir, { installProfile, setupBuildArgs }, notif
|
|
|
770
772
|
if (!existsSync(path.join(String(dir), '.geneseed-emit'))) return [];
|
|
771
773
|
const p = installProfile('opencode', 'global', String(dir), notify);
|
|
772
774
|
return setupBuildArgs('', 'files', null, null, p.footprint, p.posture, p.mode, p.doctrines,
|
|
773
|
-
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits).slice(4);
|
|
775
|
+
undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier).slice(4);
|
|
774
776
|
}
|
|
775
777
|
|
|
776
778
|
/**
|
package/js/web/actions.mjs
CHANGED
|
@@ -157,7 +157,7 @@ function bodySharedTier(body, root, host) {
|
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* The gate switches across the trust boundary (`deletionGate`, `secretsGate`, `doneGate`,
|
|
160
|
-
* `ownershipGate`, `externalGate`, `testNote`), each on its own: only a real JSON boolean counts. Anything else — a string
|
|
160
|
+
* `ownershipGate`, `externalGate`, `testNote`, `ownBranchPass`), each on its own: only a real JSON boolean counts. Anything else — a string
|
|
161
161
|
* `"false"`, a number, absence — falls back to the install's own answer for THAT gate, so a
|
|
162
162
|
* malformed or partial body can never disarm (or re-arm) a gate it did not name.
|
|
163
163
|
*/
|
|
@@ -563,12 +563,16 @@ export function buildActionCmds(state, body) {
|
|
|
563
563
|
return { error: `${emit} installs into a folder you choose — use Deploy with a folder, `
|
|
564
564
|
+ 'not Build' };
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
const [step] = actionCommands('build', {
|
|
567
567
|
theme, emit, footprint: deployed(state) ? state.footprint : 'lean',
|
|
568
568
|
posture: state.posture, mode: state.mode,
|
|
569
569
|
trust: state.trust,
|
|
570
570
|
doctrines: doctrinesForBuild(state.target),
|
|
571
571
|
});
|
|
572
|
+
// `--reset`, as in `apiInstallCmd`: a fresh target's argv is a whole selection that elides
|
|
573
|
+
// axes at their defaults, so an install already there must not be refused by the preserve
|
|
574
|
+
// guard (js/build/profile.mjs) for every axis it did not spell.
|
|
575
|
+
return [[...step, '--reset']];
|
|
572
576
|
}
|
|
573
577
|
|
|
574
578
|
/**
|
|
@@ -737,7 +741,7 @@ export function apiInstallCmd(state, body) {
|
|
|
737
741
|
const emit = EMIT_FOR.get(`${host} ${scope}`);
|
|
738
742
|
if (emit === undefined) return { error: `no install mode for ${host}:${scope}` };
|
|
739
743
|
// Every read-back below is narrowed to `host`'s OWN carrier (host-compat B1) — see the
|
|
740
|
-
// comment at `installProfile` in `js/build/
|
|
744
|
+
// comment at `installProfile` in `js/build/profile.mjs`.
|
|
741
745
|
// The theme default is THIS install's own, not the viewed one's: the Kits page acts on any row.
|
|
742
746
|
// An ABSENT row has no footprint of its own (`footprintOfDir` answers its no-marker `full`),
|
|
743
747
|
// so a new install takes the CLI's default, lean — see `apiDeployCmd` below.
|
|
@@ -780,9 +784,16 @@ export function apiInstallCmd(state, body) {
|
|
|
780
784
|
const argv = setupBuildArgs(theme || 'neutral', emit, out, out, fp, pos, mode, doctrines,
|
|
781
785
|
PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates,
|
|
782
786
|
kits ?? kitsOfDir(root, host), sharedTier);
|
|
787
|
+
// `--reset`: this argv is a WHOLE selection — every axis is the body's or the install's own —
|
|
788
|
+
// and `setupBuildArgs` elides an axis at its default, so returning one to it (a mode back to
|
|
789
|
+
// direct, a gate re-armed) would otherwise trip the preserve guard (js/build/profile.mjs).
|
|
790
|
+
argv.push('--reset');
|
|
783
791
|
// `--force` only on a literal `true`: the panel's "Replace with Geneseed's copies", which
|
|
784
792
|
// names the files first. It is this one build's instruction and is never recorded.
|
|
785
793
|
if (bget(body, 'force') === true) argv.push('--force');
|
|
794
|
+
// `--prune-gates` the same way, and only where it means something: OpenCode's opencode.json
|
|
795
|
+
// is the one file with `permission.bash` gates. One build's instruction, never recorded.
|
|
796
|
+
if (bget(body, 'pruneGates') === true && host === 'opencode') argv.push('--prune-gates');
|
|
786
797
|
return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };
|
|
787
798
|
}
|
|
788
799
|
|
|
@@ -916,5 +927,7 @@ export function apiDeployCmd(state, body) {
|
|
|
916
927
|
const argv = setupBuildArgs(theme || 'neutral', host, root, root, fp, pos, mode, doctrines,
|
|
917
928
|
PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, kitsOfDir(root, host),
|
|
918
929
|
bodySharedTier(body, root, host));
|
|
930
|
+
// `--reset`, as in `apiInstallCmd`: the form's answers plus the folder's own are a whole selection.
|
|
931
|
+
argv.push('--reset');
|
|
919
932
|
return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };
|
|
920
933
|
}
|
package/js/web/api.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { factCount } from '../hosts/memory-files.mjs';
|
|
|
24
24
|
import { autostartState } from '../hosts/shim.mjs';
|
|
25
25
|
import {
|
|
26
26
|
footprintOfDir, gatesOfDir, installState, installTargets, leftoversOf, modeOfDir,
|
|
27
|
-
trustOfDir, sharedTierOfDir,
|
|
27
|
+
trustOfDir, sharedTierOfDir, strandedGatesOf,
|
|
28
28
|
postureOfDir, readJsonMaybe, readMaybe, themeOfDir,
|
|
29
29
|
} from '../hosts/installs.mjs';
|
|
30
30
|
import { PRESETS } from '../loop/score.mjs';
|
|
@@ -174,6 +174,8 @@ const driftCounts = (files) => ({
|
|
|
174
174
|
missing: files.filter((f) => f.status === 'missing').length,
|
|
175
175
|
linked: files.filter((f) => f.status === 'linked').length,
|
|
176
176
|
stale: files.filter((f) => f.status === 'stale').length,
|
|
177
|
+
// D11: .md files keep alert tone even when kept, so don't count them in kept
|
|
178
|
+
kept: files.filter((f) => f.status === 'edited' && f.diverged === false && !f.rel.endsWith('.md')).length,
|
|
177
179
|
});
|
|
178
180
|
|
|
179
181
|
/**
|
|
@@ -243,6 +245,8 @@ export function apiInstalls(state) {
|
|
|
243
245
|
// Files here that are the user's where Geneseed ships one, and retired leftovers: what a
|
|
244
246
|
// forced rebuild would replace or remove (`leftoversOf`). Read off the emit's own record.
|
|
245
247
|
leftovers: leftoversOf(root, host, scope),
|
|
248
|
+
// OpenCode only: the bash gates a `--prune-gates` rebuild would take out (`strandedGatesOf`).
|
|
249
|
+
strandedGates: strandedGatesOf(root, host, scope),
|
|
246
250
|
// The install a request naming none reads (`defaultView`): the console's pickers start on it.
|
|
247
251
|
default: !!def && samePath(viewCfg(host, scope, root), def[0]),
|
|
248
252
|
});
|
|
@@ -477,7 +481,8 @@ export function apiOverview(state, counts = machineCounts(state, [{ install: nul
|
|
|
477
481
|
if (samePath(viewCfg(host, scope, root), state.target)) {
|
|
478
482
|
// `deletionGate`/`secretsGate`/`doneGate`/`testNote`/`ownershipGate`/`externalGate`: the gate
|
|
479
483
|
// switches, for the Constitution page's toggles on rows IV, I, III, VIII, inside the Credo's
|
|
480
|
-
// Ownership row and inside doctrine rigor 5's row.
|
|
484
|
+
// Ownership row and inside doctrine rigor 5's row. `ownBranchPass` too: false is strict
|
|
485
|
+
// consent, the switch inside doctrine process 5's row.
|
|
481
486
|
install = { host, scope, path: root, footprint: footprintOfDir(root),
|
|
482
487
|
...gatesOfDir(root, host) };
|
|
483
488
|
break;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "Every field here is argued and gated in tests/unit/package_manifest.test.mjs. `files`, `bin`, `exports` and `engines` each have a test that fails when reality drifts from this file; `version` mirrors harness.config.json and is gated too. Read that docblock before editing this one.",
|
|
3
3
|
"name": "geneseed",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.4.0",
|
|
5
5
|
"description": "A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ai",
|
package/registry.json
CHANGED
|
@@ -596,6 +596,20 @@
|
|
|
596
596
|
"added": "2026-11-08",
|
|
597
597
|
"last_verified": ""
|
|
598
598
|
},
|
|
599
|
+
"skills/herdr": {
|
|
600
|
+
"status": "experimental",
|
|
601
|
+
"version": "1.0.0",
|
|
602
|
+
"owner": "Guillaume Lemer",
|
|
603
|
+
"added": "2026-11-13",
|
|
604
|
+
"last_verified": ""
|
|
605
|
+
},
|
|
606
|
+
"skills/opencode-cli": {
|
|
607
|
+
"status": "experimental",
|
|
608
|
+
"version": "1.0.0",
|
|
609
|
+
"owner": "Guillaume Lemer",
|
|
610
|
+
"added": "2026-11-13",
|
|
611
|
+
"last_verified": ""
|
|
612
|
+
},
|
|
599
613
|
"skills/gitlab-ci": {
|
|
600
614
|
"status": "experimental",
|
|
601
615
|
"version": "1.0.0",
|