geneseed 5.3.1 → 5.5.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 +102 -0
- package/README.md +51 -18
- package/SHIPPED.md +7 -7
- package/adapters/bob/README.md +12 -1
- package/adapters/opencode/README.md +5 -3
- package/adapters/opencode/plugins/geneseed-context.js +77 -10
- package/adapters/opencode/plugins/geneseed-guard.js +106 -22
- package/adapters/opencode/plugins/geneseed-learn.js +641 -6
- package/bin/geneseed-cli.mjs +10 -0
- package/bin/geneseed-hook.mjs +5 -4
- package/docs/PRD.md +1 -1
- package/docs/README.md +1 -0
- package/docs/concepts/agents.md +14 -2
- 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 +23 -4
- package/docs/concepts/hook-gates.md +4 -4
- package/docs/concepts/hooks.md +25 -7
- package/docs/concepts/host-matrix.md +4 -4
- package/docs/concepts/hosts.md +1 -1
- 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/shared-tier.md +1 -1
- package/docs/concepts/skills.md +21 -1
- package/docs/concepts/themes.md +1 -1
- package/docs/extending.md +73 -29
- 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 +19 -1
- package/docs/guides/install-scripted.md +8 -2
- package/docs/guides/install.md +20 -2
- 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 +2 -2
- package/docs/guides/worktree.md +1 -1
- package/docs/reference/env-context.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 +5 -1
- package/docs/reference/plugin-workflow.md +1 -1
- package/docs/reference/profiles.md +142 -0
- 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 +11 -6
- package/docs/understand/design-choices-engineering.md +1 -1
- 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 +8 -6
- package/harness.config.json +1 -1
- package/js/README.md +11 -3
- package/js/build/args.mjs +16 -4
- package/js/build/catalog.mjs +11 -1
- package/js/build/driver.mjs +74 -16
- package/js/build/emit-claude.mjs +32 -5
- package/js/build/emit-opencode.mjs +16 -9
- package/js/build/export.mjs +1 -1
- package/js/build/generate.mjs +12 -157
- package/js/build/notes-migrate.mjs +99 -0
- package/js/build/profile.mjs +326 -0
- package/js/build/render.mjs +110 -8
- package/js/build/retired-skills.mjs +60 -13
- package/js/build/source.mjs +100 -3
- package/js/build/stubs.mjs +4 -1
- package/js/cli-table.json +212 -7
- package/js/hosts/agent-runs.mjs +205 -0
- package/js/hosts/done-checks.mjs +3 -1
- package/js/hosts/hooks-done.mjs +428 -63
- package/js/hosts/hooks-learn.mjs +89 -3
- package/js/hosts/hooks-prims.mjs +44 -4
- package/js/hosts/hooks.mjs +159 -9
- package/js/hosts/hosts.mjs +10 -0
- package/js/hosts/installs.mjs +44 -2
- package/js/hosts/link.mjs +45 -10
- package/js/hosts/native.mjs +61 -7
- package/js/hosts/opencode.mjs +1 -1
- package/js/hosts/settings.mjs +101 -3
- package/js/hosts/spec-feedback.mjs +538 -0
- package/js/hosts/usage.mjs +67 -8
- package/js/inspect/agent-scores.mjs +118 -0
- package/js/inspect/checks-authoring.mjs +2 -1
- package/js/inspect/checks-build.mjs +20 -4
- package/js/inspect/checks-constitution.mjs +32 -0
- package/js/inspect/checks-repo.mjs +27 -2
- package/js/inspect/cost.mjs +6 -5
- package/js/inspect/diff.mjs +46 -8
- package/js/inspect/doctor.mjs +4 -0
- package/js/inspect/inventory.mjs +1 -1
- package/js/inspect/status.mjs +3 -1
- package/js/inspect/validate.mjs +1 -0
- package/js/lib/machine-dir.mjs +8 -0
- package/js/lib/paths.mjs +4 -1
- package/js/maintain/profile-scope.mjs +145 -0
- package/js/maintain/profiles.mjs +486 -0
- package/js/maintain/setup.mjs +413 -15
- package/js/maintain/uninstall.mjs +4 -1
- package/js/maintain/update.mjs +4 -2
- package/js/web/actions.mjs +44 -41
- package/js/web/api.mjs +13 -3
- package/js/web/handler.mjs +8 -0
- package/js/web/jobs.mjs +5 -4
- package/js/web/profiles-api.mjs +201 -0
- package/js/web/routes.mjs +5 -0
- package/package.json +2 -1
- package/profiles/guillaume-claude-global.json +16 -0
- package/profiles/starter.json +14 -0
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +16 -18
- package/src/agents/_self-improvement.md +15 -7
- package/src/agents/_template.md +4 -2
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +10 -3
- package/src/agents/devops-engineer.md +1 -1
- package/src/agents/docker-expert.md +1 -1
- package/src/agents/docs.md +1 -1
- package/src/agents/empiricist.md +1 -1
- package/src/agents/explorer.md +4 -2
- package/src/agents/framer.md +1 -1
- package/src/agents/historian.md +1 -1
- package/src/agents/kubernetes-specialist.md +1 -1
- package/src/agents/memory-curator.md +1 -1
- package/src/agents/operator.md +1 -1
- package/src/agents/performance.md +1 -1
- package/src/agents/pragmatist.md +1 -1
- package/src/agents/react-engineer.md +1 -1
- package/src/agents/react-reviewer.md +1 -1
- package/src/agents/researcher.md +1 -1
- package/src/agents/reviewer.md +10 -3
- package/src/agents/security.md +1 -1
- package/src/agents/skeptic.md +1 -1
- package/src/agents/spring-boot-engineer.md +1 -1
- package/src/agents/spring-reviewer.md +1 -1
- package/src/agents/spring-security.md +1 -1
- package/src/agents/steward.md +1 -1
- package/src/agents/tester.md +4 -2
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- 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/memory/README.md +12 -2
- package/src/modes/foreman.md +25 -9
- package/src/skill-descriptions.json +63 -0
- package/src/skills/_self-improvement.md +42 -24
- package/src/skills/_template.md +3 -1
- package/src/skills/brainstorm.md +35 -22
- package/src/skills/commit.md +17 -17
- package/src/skills/daydream/VENDOR.md +6 -0
- package/src/skills/debug/ci.md +1 -1
- package/src/skills/dependencies.md +3 -3
- package/src/skills/diagram-design/VENDOR.md +4 -0
- package/src/skills/document-project.md +3 -2
- package/src/skills/explain-changes/VENDOR.md +5 -1
- 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/parallel-agents.md +11 -0
- package/src/skills/pipeline.md +3 -3
- package/src/skills/plan.md +5 -4
- package/src/skills/react-view-transitions/VENDOR.md +7 -1
- package/src/skills/release.md +11 -9
- package/src/skills/review-response.md +4 -2
- package/src/skills/rule/approve.md +2 -1
- package/src/skills/rule.md +27 -1
- package/src/skills/ship.md +54 -7
- package/src/skills/skill-forge.md +5 -3
- package/src/skills/token-report/VENDOR.md +5 -1
- package/src/skills/worktree.md +2 -2
- package/src/upstreams.json +9 -2
- package/themes/README.md +3 -1
- 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/{ActiveLoops-BJJN3P-V.js → ActiveLoops-DOJCPPPc.js} +1 -1
- package/web/dist/assets/Activity-LKsDzsnK.js +1 -0
- package/web/dist/assets/ActivityDetail-DhwTfPm6.js +1 -0
- package/web/dist/assets/{Bonsai-BBl4XXqs.js → Bonsai-CePMLrpr.js} +1 -1
- package/web/dist/assets/{CopyButton-Beven8yn.js → CopyButton-CuoaJ6k7.js} +1 -1
- package/web/dist/assets/Dashboard-D1VKuvLe.js +2 -0
- package/web/dist/assets/Docs-CUrHJKaU.js +5 -0
- package/web/dist/assets/Factories-Ci1XfmSy.js +1 -0
- package/web/dist/assets/{GreenhouseView-Bce212qd.js → GreenhouseView-CNfH2lPK.js} +1 -1
- package/web/dist/assets/Installs-ZHQZM1iS.js +3 -0
- package/web/dist/assets/{JournalView-CV4omyww.js → JournalView-CMsWahkS.js} +1 -1
- package/web/dist/assets/Kits-CkliyK0n.js +1 -0
- package/web/dist/assets/Laws-hh4O3HZ4.js +4 -0
- package/web/dist/assets/{LibRows-Dag1s0ZX.js → LibRows-Brv0Hmkr.js} +1 -1
- package/web/dist/assets/Library-BYmiLjJr.js +3 -0
- package/web/dist/assets/Loops-ytm-xJ68.js +2 -0
- package/web/dist/assets/{OperatorHudView-JmYY1pBR.js → OperatorHudView-KaqCx_HP.js} +1 -1
- package/web/dist/assets/Personal-CmcnRKYE.js +2 -0
- package/web/dist/assets/Settings-tUrpdOfq.js +1 -0
- package/web/dist/assets/{Tabs-8zsyEPSK.js → Tabs-CD7etcGD.js} +1 -1
- package/web/dist/assets/api-CZ-x0iWG.js +1 -0
- package/web/dist/assets/{controls-D4wmg_pl.js → controls-CK7qHA8H.js} +1 -1
- package/web/dist/assets/{index-CRWqKxfY.css → index-Ba_Kg3Af.css} +1 -1
- package/web/dist/assets/index-COKbhFNo.js +6 -0
- package/web/dist/index.html +3 -3
- 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/api-DLDVY3K-.js +0 -1
- package/web/dist/assets/index-Ce6qF2nG.js +0 -6
package/js/hosts/native.mjs
CHANGED
|
@@ -32,7 +32,7 @@ import path from 'node:path';
|
|
|
32
32
|
import { writeText, copyFile, readText } from '../lib/fs.mjs';
|
|
33
33
|
import { jsonDumps, parseJson, formatValue, formatRepr, isTruthy, isDict } from '../lib/json.mjs';
|
|
34
34
|
import { relPosix } from '../lib/text.mjs';
|
|
35
|
-
import { aliasesOf } from '../build/source.mjs';
|
|
35
|
+
import { aliasesOf, skillDescriptions } from '../build/source.mjs';
|
|
36
36
|
import { resolvePath } from './hosts.mjs';
|
|
37
37
|
import { claimLeaf, ownedState } from './owned.mjs';
|
|
38
38
|
// `lstripNewlines` on spec bodies is a no-op on every input the generator produces today
|
|
@@ -147,7 +147,8 @@ function triggerOf(text) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* Purpose + the trigger's FIRST sentence
|
|
150
|
+
* Purpose + the trigger's FIRST sentence: the emitted `description:` of a skill that has no
|
|
151
|
+
* catalogue line (see below), and the form every skill had until 2026-11-15. Every
|
|
151
152
|
* description is always-on context on a host that catalogues natively: at the earlier
|
|
152
153
|
* 900-char cap the catalogue weighed 22k chars (~5.6k tokens) across 51 skills, three times
|
|
153
154
|
* the figure the footprint page quoted. The first sentence says WHEN; the later sentences
|
|
@@ -157,8 +158,44 @@ function triggerOf(text) {
|
|
|
157
158
|
* failure, so the cure is a shorter first trigger sentence in the source, never a wider cap.
|
|
158
159
|
*/
|
|
159
160
|
const DESCRIPTION_CAP = 320;
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
/**
|
|
162
|
+
* A skill with a line in `src/skill-descriptions.json` (`skillDescriptions`) gets that line,
|
|
163
|
+
* and every shipped skill has one (`catalogueLineProblems` refuses a gap); the purpose +
|
|
164
|
+
* trigger composition above is the fallback for a fixture tree or a skill not catalogued yet.
|
|
165
|
+
*/
|
|
166
|
+
export function skillDescription(text, stem = null, src = undefined) {
|
|
167
|
+
const line = stem === null ? undefined : skillDescriptions(src)[stem];
|
|
168
|
+
return typeof line === 'string' ? line : withWhen(firstBlockquote(text), triggerOf(text));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A vendored skill's own SKILL.md with its frontmatter `description:` swapped for the
|
|
173
|
+
* catalogue line, the upstream description kept as the first body line, as a blockquote. The
|
|
174
|
+
* upstream lines ran to 600 characters and were the longest in the listing. Text with no
|
|
175
|
+
* catalogue line, no frontmatter or no `description:` key passes unchanged, and so does a
|
|
176
|
+
* value this cannot read whole: a block scalar (`>`, `|`), a plain scalar continued on an
|
|
177
|
+
* indented next line, or a quoted value that does not close on its line.
|
|
178
|
+
*/
|
|
179
|
+
export function vendoredWithCatalogueLine(text, stem, src = undefined) {
|
|
180
|
+
const line = skillDescriptions(src)[stem];
|
|
181
|
+
const m = /^---\r?\n([\s\S]*?\r?\n)?---\r?\n/.exec(text);
|
|
182
|
+
if (typeof line !== 'string' || !m) return text;
|
|
183
|
+
const eol = text.includes('\r\n') ? '\r\n' : '\n';
|
|
184
|
+
const lines = m[0].split(/\r?\n/);
|
|
185
|
+
const at = lines.findIndex((ln) => /^description:/.test(ln));
|
|
186
|
+
const raw = at < 0 ? '' : lines[at].replace(/^description:\s*/, '');
|
|
187
|
+
if (!raw || /^[>|]/.test(raw) || /^[ \t]/.test(lines[at + 1] ?? '')) return text;
|
|
188
|
+
let upstream = raw;
|
|
189
|
+
if (raw.startsWith('"')) {
|
|
190
|
+
try { upstream = parseJson(raw); } catch { return text; }
|
|
191
|
+
} else if (raw.startsWith("'")) {
|
|
192
|
+
// YAML single quotes: `''` is an escaped quote, and the value must close on its line.
|
|
193
|
+
if (!/^'(?:[^']|'')*'$/.test(raw)) return text;
|
|
194
|
+
upstream = raw.slice(1, -1).replaceAll("''", "'");
|
|
195
|
+
}
|
|
196
|
+
lines[at] = `description: ${jsonDumps(line)}`;
|
|
197
|
+
const body = text.slice(m[0].length).replace(/^(\r?\n)+/, '');
|
|
198
|
+
return `${lines.join(eol)}${eol}> ${upstream}${eol}${eol}${body}`;
|
|
162
199
|
}
|
|
163
200
|
|
|
164
201
|
/**
|
|
@@ -194,12 +231,16 @@ export function agentDescription(text) {
|
|
|
194
231
|
return withWhen(firstBlockquote(text), dispatchOf(text));
|
|
195
232
|
}
|
|
196
233
|
|
|
197
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Purpose + ` Use when: ` + the first sentence of `trig`, capped — see `skillDescription`.
|
|
236
|
+
* A `;` ends the cut clause as a `.` does, but the clause is the END of the description, so it
|
|
237
|
+
* is written as a `.`: a trailing `;` reads as text that was cut short.
|
|
238
|
+
*/
|
|
198
239
|
function withWhen(desc, trig) {
|
|
199
240
|
if (!trig) return desc;
|
|
200
241
|
const first = trig.match(/^.*?[.;](?=\s|$)/);
|
|
201
242
|
const full = `${desc} Use when: ${first ? first[0] : trig}`;
|
|
202
|
-
if (full.length <= DESCRIPTION_CAP) return full;
|
|
243
|
+
if (full.length <= DESCRIPTION_CAP) return full.replace(/;$/, '.');
|
|
203
244
|
const cut = full.slice(0, DESCRIPTION_CAP);
|
|
204
245
|
const end = Math.max(cut.lastIndexOf('. '), cut.lastIndexOf('; '));
|
|
205
246
|
return end > desc.length ? cut.slice(0, end + 1) : cut.replace(/\s+\S*$/, '') + '…';
|
|
@@ -586,6 +627,19 @@ export function claimer(oldOwned, cfg, manifestExisted = true, oldHashes = {}, f
|
|
|
586
627
|
};
|
|
587
628
|
claim.editRefused = editRefused;
|
|
588
629
|
claim.kept = kept;
|
|
630
|
+
// The manifest's next `kept_hashes` (spec 2026-11-13 §1), read once every writer has claimed.
|
|
631
|
+
// A rel refused for an edit NOW records the hash its last write left (`oldHashes`). From the
|
|
632
|
+
// next emit on it is no longer in `owned`, so the claim refuses it as pre-existing and it lands
|
|
633
|
+
// in `kept`, not `editRefused`: the entry the previous manifest held is carried forward. A rel
|
|
634
|
+
// claimed again (restored, deleted, `--force`) or no longer shipped is in neither set, and drops.
|
|
635
|
+
claim.keptHashes = (oldKeptHashes = {}) => {
|
|
636
|
+
const out = {};
|
|
637
|
+
for (const rel of editRefused) if (Object.hasOwn(oldHashes, rel)) out[rel] = oldHashes[rel];
|
|
638
|
+
for (const rel of kept) {
|
|
639
|
+
if (!Object.hasOwn(out, rel) && Object.hasOwn(oldKeptHashes, rel)) out[rel] = oldKeptHashes[rel];
|
|
640
|
+
}
|
|
641
|
+
return out;
|
|
642
|
+
};
|
|
589
643
|
// Did the previous emit write `dest`? Read by `writeNativeLayer` for a skill's side files.
|
|
590
644
|
claim.owned = (dest) => oldSet !== null && cfg != null && oldSet.has(relPosix(cfg, dest));
|
|
591
645
|
return claim;
|
|
@@ -735,7 +789,7 @@ export function writeNativeLayer(items, agentsDir, skillsDir, overrides = null,
|
|
|
735
789
|
// ALIASES are the one case every non-Claude dialect shares: no alias skill via
|
|
736
790
|
// frontmatter exists for them either, so an alias skill there would land in the
|
|
737
791
|
// model's catalogue as a duplicate; it gets a command instead (`writeAliasCommands`).
|
|
738
|
-
fm = [`name: ${stem}`, `description: ${jsonDumps(skillDescription(text))}`];
|
|
792
|
+
fm = [`name: ${stem}`, `description: ${jsonDumps(skillDescription(text, stem, src))}`];
|
|
739
793
|
userOnly = isUserInvokedOnly(text);
|
|
740
794
|
if (userOnly && !bobDialect) fm.push('disable-model-invocation: true');
|
|
741
795
|
body = stripSkillBodyLinks(pointSideFiles(body, stem, skillDirOf ? skillDirOf(stem)
|
package/js/hosts/opencode.mjs
CHANGED
|
@@ -388,7 +388,7 @@ export function writeAliasCommands(cfg, items, commandDir, claim = (_dest) => tr
|
|
|
388
388
|
for (const name of names) {
|
|
389
389
|
const dest = path.join(commandDir, `${name}.md`);
|
|
390
390
|
if (!claim(dest)) continue;
|
|
391
|
-
writeCommandFile(dest, name === stem ? skillDescription(text) : `Alias of ${stem}.`, body);
|
|
391
|
+
writeCommandFile(dest, name === stem ? skillDescription(text, stem, cfg.src) : `Alias of ${stem}.`, body);
|
|
392
392
|
written.push(dest);
|
|
393
393
|
}
|
|
394
394
|
}
|
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;
|
|
@@ -1417,6 +1443,78 @@ export function unwireClaudeEnv(p, recorded) {
|
|
|
1417
1443
|
}
|
|
1418
1444
|
}
|
|
1419
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* The skill-listing keys of `--context-window` (`CONTEXT_WINDOWS`, js/build/source.mjs), merged
|
|
1448
|
+
* into top-level settings keys one by one. Returns the `{key: value}` pairs Geneseed owns after
|
|
1449
|
+
* the merge, which the manifest records (`managed.settings_listing`).
|
|
1450
|
+
*
|
|
1451
|
+
* UNLIKE `wireClaudeEnv`, A VALUE GENESEED OWNS CAN CHANGE: `200k` -> `1m` turns 80 into 120 and
|
|
1452
|
+
* takes the fraction away. So ownership is the record, checked against the file:
|
|
1453
|
+
* - a key absent from the file is written and recorded;
|
|
1454
|
+
* - a key on file with exactly the recorded value is Geneseed's: updated to `want`, or removed
|
|
1455
|
+
* when `want` no longer names it;
|
|
1456
|
+
* - any other key on file is the user's, even one equal to `want` with no record, and it stays
|
|
1457
|
+
* untouched and unrecorded, so uninstall never takes it.
|
|
1458
|
+
* A commented file is never rewritten: the wanted changes are printed for a hand merge and the
|
|
1459
|
+
* keys already owned stay recorded as they are on file.
|
|
1460
|
+
*/
|
|
1461
|
+
export function wireClaudeListing(p, wanted = {}, recorded = {}) {
|
|
1462
|
+
// Parsed, so every number is the `JsonNumber` the renderers require (`jsonDumpsCompact` below).
|
|
1463
|
+
const want = parseJson(JSON.stringify(wanted));
|
|
1464
|
+
const prior = isDict(recorded) ? recorded : {};
|
|
1465
|
+
const loaded = readSettingsForMerge(p, 'Its skill-listing keys were not wired.');
|
|
1466
|
+
// A file that cannot be read changes nothing, so what this install owns stays on record.
|
|
1467
|
+
if (!loaded) return { ...prior };
|
|
1468
|
+
const [config, hadComments] = loaded;
|
|
1469
|
+
// `deepEquals`, never `===`: a parsed number is a `JsonNumber` wrapper (js/lib/json.mjs).
|
|
1470
|
+
const owned = (k) => has(prior, k) && has(config, k) && deepEquals(config[k], prior[k]);
|
|
1471
|
+
const next = { ...config };
|
|
1472
|
+
const record = {};
|
|
1473
|
+
for (const k of new Set([...Object.keys(prior), ...Object.keys(want)])) {
|
|
1474
|
+
if (has(want, k) && (!has(config, k) || owned(k))) {
|
|
1475
|
+
if (!has(config, k) || !deepEquals(config[k], want[k])) next[k] = want[k];
|
|
1476
|
+
record[k] = want[k];
|
|
1477
|
+
} else if (!has(want, k) && owned(k)) {
|
|
1478
|
+
delete next[k];
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
const changed = Object.keys({ ...config, ...next })
|
|
1482
|
+
.some((k) => has(config, k) !== has(next, k) || !deepEquals(config[k], next[k]));
|
|
1483
|
+
if (!changed) return record;
|
|
1484
|
+
if (hadComments) {
|
|
1485
|
+
const add = Object.fromEntries(Object.entries(record).filter(([k, v]) => !deepEquals(config[k], v)));
|
|
1486
|
+
const drop = Object.keys(config).filter((k) => !has(next, k));
|
|
1487
|
+
process.stderr.write(`[geneseed] ${path.basename(p)} has comments — not rewriting it `
|
|
1488
|
+
+ '(your edits are kept). Merge its skill-listing keys by hand: set '
|
|
1489
|
+
+ `${jsonDumpsCompact(add)}${drop.length ? `, remove ${drop.join(', ')}` : ''}\n`);
|
|
1490
|
+
return Object.fromEntries(Object.keys(prior).filter(owned).map((k) => [k, config[k]]));
|
|
1491
|
+
}
|
|
1492
|
+
try {
|
|
1493
|
+
atomicWriteJson(p, next);
|
|
1494
|
+
} catch (e) {
|
|
1495
|
+
if (!isOsError(e)) throw e;
|
|
1496
|
+
process.stderr.write(`[geneseed] WARN: could not write ${p} (${e.message}) — its `
|
|
1497
|
+
+ `skill-listing keys were not wired. Set them by hand: ${jsonDumpsCompact(want)}\n`);
|
|
1498
|
+
return Object.fromEntries(Object.keys(prior).filter(owned).map((k) => [k, config[k]]));
|
|
1499
|
+
}
|
|
1500
|
+
return record;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/** Remove each recorded skill-listing key while it still holds the recorded value. */
|
|
1504
|
+
export function unwireClaudeListing(p, recorded) {
|
|
1505
|
+
if (!isDict(recorded) || !Object.keys(recorded).length) return;
|
|
1506
|
+
const { state, data: loaded, hadComments } = loadJsonObject(p);
|
|
1507
|
+
if (state !== 'ok' || hadComments) return;
|
|
1508
|
+
const gone = Object.keys(recorded).filter((k) => has(loaded, k) && deepEquals(loaded[k], recorded[k]));
|
|
1509
|
+
if (!gone.length) return;
|
|
1510
|
+
for (const k of gone) delete loaded[k];
|
|
1511
|
+
try {
|
|
1512
|
+
atomicWriteJson(p, loaded);
|
|
1513
|
+
} catch (e) {
|
|
1514
|
+
if (!isOsError(e)) throw e;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1420
1518
|
/** `_build_settings._unwire_claude_excludes`. */
|
|
1421
1519
|
export function unwireClaudeExcludes(p, excludes) {
|
|
1422
1520
|
if (!excludes || !excludes.length) return;
|