geneseed 4.31.0 → 5.0.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 +107 -0
- package/DESIGN.md +2 -2
- package/README.md +6 -5
- package/SHIPPED.md +4 -3
- package/adapters/bob/README.md +6 -5
- package/adapters/claude-code/README.md +4 -3
- package/adapters/claude-code/skills/geneseed/SKILL.md +1 -1
- package/adapters/openclaude/README.md +4 -3
- package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +3 -1
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -1
- package/adapters/opencode/README.md +18 -18
- package/adapters/opencode/plugins/geneseed-activity.js +57 -1
- package/adapters/opencode/plugins/geneseed-context.js +220 -18
- package/adapters/opencode/plugins/geneseed-guard.js +578 -74
- package/adapters/opencode/plugins/geneseed-learn.js +97 -23
- package/bin/geneseed-cli.mjs +17 -25
- package/bin/geneseed-hook.mjs +23 -8
- package/docs/DESIGN.md +175 -0
- package/docs/PRD.md +111 -0
- package/docs/README.md +3 -2
- package/docs/architecture.md +145 -0
- package/docs/concepts/agents.md +1 -1
- package/docs/concepts/collaboration.md +1 -1
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +6 -6
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +2 -2
- package/docs/concepts/hook-gates.md +1 -1
- package/docs/concepts/hooks.md +27 -11
- package/docs/concepts/host-matrix.md +3 -3
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +3 -1
- package/docs/concepts/loop-bricks.md +1 -1
- package/docs/concepts/loop-notes.md +4 -2
- package/docs/concepts/loop-templates.md +7 -4
- package/docs/concepts/loops.md +3 -0
- package/docs/concepts/ownership.md +2 -2
- package/docs/concepts/rules.md +15 -2
- package/docs/concepts/shared-tier.md +73 -0
- package/docs/concepts/skills.md +2 -2
- package/docs/concepts/themes.md +1 -1
- package/docs/extending.md +13 -12
- package/docs/guides/install-claude-code.md +1 -1
- package/docs/guides/install-opencode.md +1 -1
- package/docs/guides/migrate.md +4 -2
- package/docs/guides/project-context.md +2 -2
- package/docs/guides/run-a-loop.md +1 -1
- package/docs/guides/set-up-ownership.md +1 -1
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +2 -1
- package/docs/guides/upgrade-to-5.md +116 -0
- package/docs/guides/upgrade.md +21 -9
- package/docs/guides/wiki.md +3 -3
- package/docs/reference/env-context.md +5 -3
- package/docs/reference/environment.md +1 -1
- package/docs/reference/glossary.md +2 -0
- package/docs/reference/loop-actions.md +1 -1
- package/docs/reference/opencode-plugins.md +3 -3
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +5 -0
- package/docs/reference/plugin-guard.md +14 -6
- package/docs/reference/plugin-learn.md +13 -6
- package/docs/reference/troubleshoot-hooks.md +3 -3
- package/docs/reference/troubleshoot-update.md +14 -0
- package/docs/token-footprint.md +4 -3
- package/docs/understand/a-day.md +2 -2
- package/docs/understand/design-choices-install.md +2 -1
- package/docs/understand/enforced-vs-asked.md +4 -3
- package/docs/understand/machine-bob.md +3 -1
- package/docs/understand/machine-claude.md +7 -5
- package/docs/understand/machine-opencode.md +7 -5
- package/docs/understand/on-your-machine.md +4 -0
- package/docs/understand/take-it-out.md +1 -1
- package/docs/web-ui.md +141 -73
- package/harness.config.json +1 -1
- package/js/README.md +10 -6
- package/js/build/args.mjs +10 -8
- package/js/build/bundle.mjs +11 -13
- package/js/build/driver.mjs +66 -65
- package/js/build/emit-claude.mjs +22 -16
- package/js/build/emit-common.mjs +4 -5
- package/js/build/emit-opencode.mjs +22 -22
- package/js/build/fold.mjs +515 -0
- package/js/build/generate.mjs +41 -52
- package/js/build/render.mjs +115 -29
- package/js/build/source.mjs +4 -1
- package/js/build/stubs.mjs +70 -9
- package/js/build/version.mjs +10 -10
- package/js/cli-table.json +23 -83
- package/js/hosts/activity.mjs +2 -2
- package/js/hosts/geneseed-dir.mjs +1 -1
- package/js/hosts/hooks-context.mjs +410 -99
- package/js/hosts/hooks-done.mjs +97 -31
- package/js/hosts/hooks-learn.mjs +38 -7
- package/js/hosts/hooks-prims.mjs +69 -2
- package/js/hosts/hooks.mjs +300 -64
- package/js/hosts/hosts.mjs +150 -51
- package/js/hosts/installs.mjs +55 -167
- package/js/hosts/link.mjs +3 -5
- package/js/hosts/mcp.mjs +1 -1
- package/js/hosts/memory-files.mjs +219 -17
- package/js/hosts/ownership-gate.mjs +1 -1
- package/js/hosts/settings.mjs +18 -13
- package/js/hosts/shim.mjs +4 -33
- package/js/hosts/store-watch.mjs +189 -0
- package/js/inspect/checks-authoring.mjs +3 -3
- package/js/inspect/checks-build.mjs +45 -18
- package/js/inspect/checks-counts.mjs +4 -4
- package/js/inspect/checks-repo.mjs +13 -14
- package/js/inspect/cost.mjs +24 -2
- package/js/inspect/diff.mjs +123 -123
- package/js/inspect/doctor.mjs +22 -27
- package/js/inspect/excludes.mjs +181 -62
- package/js/inspect/inventory.mjs +22 -27
- package/js/inspect/registry.mjs +106 -30
- package/js/inspect/scan.mjs +5 -5
- package/js/inspect/status.mjs +141 -119
- package/js/inspect/validate.mjs +22 -24
- package/js/lib/fs.mjs +47 -50
- package/js/lib/json.mjs +10 -17
- package/js/lib/machine-dir.mjs +73 -0
- package/js/lib/paths.mjs +22 -33
- package/js/lib/proc.mjs +1 -1
- package/js/lib/prompt.mjs +19 -27
- package/js/lib/text.mjs +8 -12
- package/js/lib/udiff.mjs +11 -15
- package/js/loop/catalog.mjs +2 -3
- package/js/loop/state.mjs +15 -5
- package/js/maintain/memory.mjs +17 -17
- package/js/maintain/migrate.mjs +79 -89
- package/js/maintain/setup.mjs +43 -32
- package/js/maintain/uninstall.mjs +43 -61
- package/js/maintain/update.mjs +200 -93
- package/js/ui/anim.mjs +21 -35
- package/js/ui/cli.mjs +36 -58
- package/js/ui/menu.mjs +22 -45
- package/js/ui/tui.mjs +27 -67
- package/js/web/actions.mjs +38 -38
- package/js/web/api.mjs +132 -76
- package/js/web/catalog.mjs +175 -46
- package/js/web/docs.mjs +33 -12
- package/js/web/doctor-worker.mjs +14 -0
- package/js/web/handler.mjs +14 -5
- package/js/web/routes.mjs +17 -19
- package/js/web/state.mjs +78 -19
- package/js/web/update-check.mjs +25 -10
- package/js/web/user-files.mjs +50 -105
- package/package.json +7 -4
- package/registry.json +48 -55
- package/src/AGENT.md.tmpl +13 -14
- package/src/agents/_self-improvement.md +1 -1
- package/src/agents/_template.md +4 -1
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +6 -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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +5 -2
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- package/src/bricks/apply.md +3 -0
- package/src/bricks/test.md +6 -4
- package/src/loops/bugfix.json +11 -5
- package/src/loops/feature.json +7 -4
- package/src/memory/README.md +1 -1
- package/src/skills/_self-improvement.md +2 -2
- package/src/skills/daydream/SKILL.md +2 -2
- package/src/skills/daydream/instructions.md +1 -1
- package/src/skills/geneseed.md +1 -1
- package/src/skills/learn-mode.md +1 -2
- package/src/skills/loop.md +1 -0
- package/src/skills/profile.md +2 -2
- package/src/skills/rule/approve.md +69 -0
- package/src/skills/rule/consolidate.md +3 -3
- package/src/skills/rule.md +13 -5
- package/src/skills/ship.md +9 -1
- package/src/skills/skill-forge.md +1 -1
- package/src/skills/teach.md +29 -12
- package/src/skills/wiki.md +1 -1
- package/themes/_TEMPLATE.json +1 -2
- package/themes/biker.json +1 -2
- package/themes/commentator.json +1 -2
- package/themes/cyberpunk.json +1 -2
- package/themes/gamer.json +1 -2
- package/themes/imperial.json +1 -2
- package/themes/joker.json +1 -2
- package/themes/marvin.json +1 -2
- package/themes/mean.json +1 -2
- package/themes/military.json +1 -2
- package/themes/neutral.json +1 -2
- package/themes/pirate.json +1 -2
- package/themes/sports.json +1 -2
- package/themes/verstappen.json +1 -2
- package/themes/wizard.json +1 -2
- package/web/dist/assets/Activity-D8G4eClY.js +1 -0
- package/web/dist/assets/ActivityDetail-BtOBYk3M.js +1 -0
- package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
- package/web/dist/assets/Bonsai-B_y20b3i.js +1 -0
- package/web/dist/assets/{CopyButton-IXnXzH4Y.js → CopyButton-CHQte7Ap.js} +1 -1
- package/web/dist/assets/Dashboard-B8uXeJZ_.js +2 -0
- package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
- package/web/dist/assets/Docs-Dgv_MWfT.js +5 -0
- package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
- package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
- package/web/dist/assets/GreenhouseView-CSzTMSl_.js +1 -0
- package/web/dist/assets/Installs-BDk9lqBI.js +3 -0
- package/web/dist/assets/JournalView-CvRk1-m5.js +1 -0
- package/web/dist/assets/Kits-CoITzxWM.js +1 -0
- package/web/dist/assets/Laws-Ctf5r9rE.js +3 -0
- package/web/dist/assets/Library-DNwHYVXt.js +3 -0
- package/web/dist/assets/{Loops-C5u7fQOR.js → Loops-S85PMQ8m.js} +2 -2
- package/web/dist/assets/Markdown-0ORz7tAc.js +69 -0
- package/web/dist/assets/OperatorHudView-DuGz_sTk.js +1 -0
- package/web/dist/assets/Personal-afJNwvRS.js +2 -0
- package/web/dist/assets/RailCats-AW92uhsX.js +1 -0
- package/web/dist/assets/Settings-CGDFz-6j.js +1 -0
- package/web/dist/assets/Tabs-1qLrnqmn.js +1 -0
- package/web/dist/assets/api-C46vAuqp.js +1 -0
- package/web/dist/assets/controls-D4wmg_pl.js +1 -0
- package/web/dist/assets/index-COTd4TRZ.js +3 -0
- package/web/dist/assets/index-CtorA7uK.css +1 -0
- package/web/dist/assets/motion-RlUl1osO.js +1 -0
- package/web/dist/assets/react-C1iE8mnY.js +9 -0
- package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
- package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
- package/web/dist/index.html +7 -7
- package/src/skills/quiz.md +0 -44
- package/web/dist/assets/Activity-B7cFtS00.js +0 -1
- package/web/dist/assets/ActivityDetail-C-GbMmuW.js +0 -1
- package/web/dist/assets/Bonsai-_YyexVC5.js +0 -1
- package/web/dist/assets/Dashboard-sCfEjowQ.js +0 -2
- package/web/dist/assets/Docs-w3Y7M5Ts.js +0 -5
- package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
- package/web/dist/assets/GreenhouseView-BWWbMKmg.js +0 -1
- package/web/dist/assets/Installs-CnkdJ-VA.js +0 -3
- package/web/dist/assets/JournalView-C7bPD3fZ.js +0 -1
- package/web/dist/assets/KitApply-CQQbnThf.js +0 -1
- package/web/dist/assets/Kits-aj07N7mT.js +0 -1
- package/web/dist/assets/Laws-DZ38nl_H.js +0 -3
- package/web/dist/assets/Library-QCGXPV5h.js +0 -2
- package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
- package/web/dist/assets/OperatorHudView-Blu1lqiZ.js +0 -1
- package/web/dist/assets/Personal-ox_MktWO.js +0 -2
- package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
- package/web/dist/assets/Tabs-CIPyMAX-.js +0 -1
- package/web/dist/assets/api-BxjLd7Qd.js +0 -1
- package/web/dist/assets/index-0GCxkY7m.css +0 -1
- package/web/dist/assets/index-CzDi9JpF.js +0 -3
- package/web/dist/assets/motion-CXaUMNkg.js +0 -1
- package/web/dist/assets/react-DlYQp10C.js +0 -9
- package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
package/js/build/bundle.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function missingReferencedSpecs(cfg) {
|
|
|
59
59
|
/**
|
|
60
60
|
* `_build_render.assert_source_complete`.
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* The message goes to the
|
|
63
63
|
* captured stderr buffer and the throw carries the exit code, which the driver turns
|
|
64
64
|
* into a process status by `bin/build-driver.mjs`'s `main` — so the caller sees the same stream
|
|
65
65
|
* bytes and the same exit status whichever runtime rendered.
|
|
@@ -107,8 +107,8 @@ function writeSrcDirsMarker(out, resolved) {
|
|
|
107
107
|
*
|
|
108
108
|
* `.geneseed-srcdirs.json` is a plain file a user (or another tool) can edit, and the
|
|
109
109
|
* name in it is joined onto `out` and handed to a recursive delete. `".."` would take out
|
|
110
|
-
* the bundle's PARENT, an absolute path replaces `out` entirely
|
|
111
|
-
* `
|
|
110
|
+
* the bundle's PARENT, an absolute path replaces `out` entirely when joined, and
|
|
111
|
+
* `"a/b"` reaches into nested content. Only a plain
|
|
112
112
|
* single-segment name resolving directly under `out` is ever deleted.
|
|
113
113
|
*/
|
|
114
114
|
function safePriorDirName(out, priorName) {
|
|
@@ -161,9 +161,9 @@ export function phaseLog(phase) {
|
|
|
161
161
|
/**
|
|
162
162
|
* `_build_render.build` — render the bundle into `out`.
|
|
163
163
|
*
|
|
164
|
-
* `out` arrives as
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* `out` arrives as an already-resolved STRING and is echoed into the progress lines
|
|
165
|
+
* verbatim: it is backslash-separated on Windows, and re-deriving it here would differ by
|
|
166
|
+
* separator in every message.
|
|
167
167
|
*/
|
|
168
168
|
export function build(cfg, themeName, out, { footprint = 'full', nativeCatalog = false } = {}) {
|
|
169
169
|
phaseLog('RENDER');
|
|
@@ -177,17 +177,15 @@ export function build(cfg, themeName, out, { footprint = 'full', nativeCatalog =
|
|
|
177
177
|
const priorSrcDirs = isBundle ? readPriorSrcDirs(out) : {};
|
|
178
178
|
const resolvedSrcDirs = {};
|
|
179
179
|
for (const srcDir of OWNED_SRC_DIRS) {
|
|
180
|
-
//
|
|
181
|
-
// where Python would go on to join `None` onto a path and raise. No theme has one.
|
|
180
|
+
// `??` falls back on an explicit JSON null too. No theme has one.
|
|
182
181
|
const dirname = theme[SRC_DIR_TOKENS[srcDir]] ?? srcDir;
|
|
183
182
|
resolvedSrcDirs[srcDir] = dirname;
|
|
184
183
|
const managed = path.join(out, dirname);
|
|
185
184
|
|
|
186
|
-
// `isTruthy`, not `priorName &&`: the marker is user-editable JSON, and
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
// would look for it.
|
|
185
|
+
// `isTruthy`, not `priorName &&`: the marker is user-editable JSON, and an
|
|
186
|
+
// empty `[]`, `{}` or `0` must count as absent although JS's `&&` treats the first two
|
|
187
|
+
// as set. Getting that wrong warns about a value that is silently skipped — reachable
|
|
188
|
+
// only from a hand-edited file, which is the one place nobody would look for it.
|
|
191
189
|
const priorName = priorSrcDirs[srcDir];
|
|
192
190
|
if (isBundle && isTruthy(priorName) && priorName !== dirname) {
|
|
193
191
|
if (safePriorDirName(out, priorName)) {
|
package/js/build/driver.mjs
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* script's own location, not from an inherited `cfg`.
|
|
16
16
|
*
|
|
17
17
|
* A KEY IS DELIBERATELY ABSENT FROM `cfg`, and its absence is load-bearing.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The former Python driver always sent `structure` and `capabilityLinkRe`, because
|
|
19
|
+
* those were module-level names that TESTS MUTATE. This driver has no such module to
|
|
20
|
+
* mutate, so it sends neither;
|
|
21
21
|
* `js/build/render.mjs:215`'s `cfg.structure ?? STRUCTURE` takes its right-hand branch for
|
|
22
22
|
* that reason — a fallback that was dead code until P4, always overridden by the driver
|
|
23
23
|
* that always supplies it. `capabilityLinkRe`'s equivalent fallback in
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* supplied one, so there was no longer a `cfg` left to be absent from.
|
|
27
27
|
*
|
|
28
28
|
* THE FOOTPRINT DEFAULT IS THE FLAG'S, NOT THE FUNCTION'S. `--footprint` defaults to
|
|
29
|
-
* `lean
|
|
29
|
+
* `lean`; every `emit_*`/`build` SIGNATURE defaults to `full`. A driver
|
|
30
30
|
* that reproduced the signature default would emit a different harness in every cell while
|
|
31
31
|
* every gate that calls the functions directly stayed green.
|
|
32
32
|
*/
|
|
@@ -45,7 +45,7 @@ import { parseJson, jsonDumpsIndent } from '../lib/json.mjs';
|
|
|
45
45
|
import { relPosix } from '../lib/text.mjs';
|
|
46
46
|
// P5c moved these out of this file: `bin/geneseed-cli.mjs` needs the same four resolvers to
|
|
47
47
|
// find a global install, and a resolver that decides WHERE a driver writes is the last thing
|
|
48
|
-
// that should exist twice.
|
|
48
|
+
// that should exist twice.
|
|
49
49
|
import {
|
|
50
50
|
GLOBAL_MANIFEST, HOSTS, resolvePath, opencodeConfigDir, claudeConfigDir, bobConfigDir,
|
|
51
51
|
openclaudeConfigDir, hostCatalogsNatively,
|
|
@@ -57,7 +57,7 @@ import { seedProtectedChecks } from '../hosts/geneseed-dir.mjs';
|
|
|
57
57
|
|
|
58
58
|
// P5d moved these out of this file for the reason P5c moved the host resolvers: `harness
|
|
59
59
|
// status` renders to count, so `bin/geneseed-cli.mjs` needs the same checkout paths and the
|
|
60
|
-
// same cfg.
|
|
60
|
+
// same cfg.
|
|
61
61
|
import {
|
|
62
62
|
GATE_SWITCHES, ROOT, makeCfg,
|
|
63
63
|
} from './source.mjs';
|
|
@@ -99,7 +99,7 @@ export const PRIMARY_AGENT_SRC = path.join(ROOT, 'adapters', 'opencode', 'agents
|
|
|
99
99
|
* It is invisible on a machine whose paths are already canonical, which is every machine
|
|
100
100
|
* this ran on until GitHub's Windows runner handed it a `C:\\Users\\RUNNER~1\\...` and the
|
|
101
101
|
* two CLIs printed the same directory under two different names — a 70-byte difference in a
|
|
102
|
-
* line
|
|
102
|
+
* line that was once compared BYTE for byte; `tests/unit/resolve_out.test.mjs` pins
|
|
103
103
|
* it now. The
|
|
104
104
|
* argument to `resolvePath` is made absolute first so its `expanduser` cannot fire: the
|
|
105
105
|
* reference does not expand `~` here, and a bare `~` is a legal directory name. */
|
|
@@ -116,10 +116,9 @@ export function resolveOut(raw) {
|
|
|
116
116
|
* key" no longer describes what resolves the directory; the carrier-name rule still holds.
|
|
117
117
|
*
|
|
118
118
|
* Computed HERE and not in the render child, and that is the inverted boundary rule doing
|
|
119
|
-
* real work rather than being restated.
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* silence. The child must therefore never derive it — but this file is the PARENT, so
|
|
119
|
+
* real work rather than being restated. A redirect that stops at a subprocess half-works
|
|
120
|
+
* in silence, and the suite redirects the config dir at a sandbox. The child must
|
|
121
|
+
* therefore never derive it — but this file is the PARENT, so
|
|
123
122
|
* deriving it is exactly this file's job, and `the host emit` receives the answer.
|
|
124
123
|
*
|
|
125
124
|
* POSIX spelling, per the original: `claudeMdExcludes` entries are glob patterns, where a
|
|
@@ -128,7 +127,10 @@ export function resolveOut(raw) {
|
|
|
128
127
|
function preambleExclude(claudeMd, host) {
|
|
129
128
|
if (path.basename(claudeMd) !== 'CLAUDE.md') return null;
|
|
130
129
|
// OpenClaude inherited `claudeMdExcludes` from Claude Code; its global preamble is its own.
|
|
131
|
-
|
|
130
|
+
let globalDir;
|
|
131
|
+
try {
|
|
132
|
+
globalDir = host === 'openclaude' ? openclaudeConfigDir() : claudeConfigDir();
|
|
133
|
+
} catch { return null; } // no home: no global preamble to exclude, and a prior claim is kept
|
|
132
134
|
return resolvePath(path.join(globalDir, 'CLAUDE.md')).split(path.sep).join('/');
|
|
133
135
|
}
|
|
134
136
|
|
|
@@ -170,8 +172,7 @@ function relUnder(out, root) {
|
|
|
170
172
|
* `_build_global._write_manifest_atomic` — temp + rename, so a torn manifest can never make
|
|
171
173
|
* the next emit treat every owned file as the user's own.
|
|
172
174
|
*
|
|
173
|
-
* `writeText`, not `writeFileSync`:
|
|
174
|
-
* whole document is CRLF on Windows.
|
|
175
|
+
* `writeText`, not `writeFileSync`: the whole document is CRLF on Windows, as it always was.
|
|
175
176
|
*
|
|
176
177
|
* `jsonDumpsIndent`, not `JSON.stringify`: `json.dumps` defaults to `ensure_ascii=True` and
|
|
177
178
|
* escapes every non-ASCII character, where `JSON.stringify` emits it raw. This was
|
|
@@ -297,12 +298,12 @@ function projectSurvivors(emitName) {
|
|
|
297
298
|
}
|
|
298
299
|
|
|
299
300
|
/**
|
|
300
|
-
* `_build_emit.emit_opencode` — the driver body
|
|
301
|
+
* `_build_emit.emit_opencode` — the driver body.
|
|
301
302
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
303
|
+
* The stage either side of RENDER and WIRE: reading the previous manifest (PRE),
|
|
304
|
+
* pruning what this layer no longer owns, writing the manifest atomically, and the
|
|
305
|
+
* summary line. All five stages run in one process, in the order
|
|
306
|
+
* `tests/unit/emit_phase_order.test.mjs` pins:
|
|
306
307
|
* RENDER -> WIRE -> PRUNE -> MANIFEST -> VERIFY (opencode has no VERIFY; it writes no
|
|
307
308
|
* settings file of its own).
|
|
308
309
|
*/
|
|
@@ -390,7 +391,7 @@ function emitOpencodeGlobal(cfg, args, out) {
|
|
|
390
391
|
const rendered = emitOpencodeGlobalRender(
|
|
391
392
|
{ ...cfg, primaryAgentSrc: PRIMARY_AGENT_SRC },
|
|
392
393
|
{
|
|
393
|
-
theme: args.theme, cfgDir, out,
|
|
394
|
+
theme: args.theme, cfgDir, out, sharedRoot: args.sharedRoot,
|
|
394
395
|
footprint: args.footprint, nativeCatalog: hostCatalogsNatively('opencode'),
|
|
395
396
|
oldOwned, agentPath, oldDenies, oldEdit, oldHashes,
|
|
396
397
|
});
|
|
@@ -415,8 +416,7 @@ function emitOpencodeGlobal(cfg, args, out) {
|
|
|
415
416
|
+ `${stats.nSkills} skills, ${stats.nPlugins} plugin(s), `
|
|
416
417
|
+ `${stats.nWorkflows} workflow file(s), AGENT.md, ${memStatus}, ${nbStatus}, `
|
|
417
418
|
+ `${cfgName} (no context.json)${extra}. `
|
|
418
|
-
+ '
|
|
419
|
-
+ 'override.\n');
|
|
419
|
+
+ 'Facts live in the shared tier, and the learn plugin finds it by itself.\n');
|
|
420
420
|
return cfgDir;
|
|
421
421
|
}
|
|
422
422
|
|
|
@@ -444,7 +444,7 @@ function emitClaudeCore(cfg, args, { cfgDir, claudeMd, scope, host, out, hookOpt
|
|
|
444
444
|
// `preambleExclude`'s own docblock). Spelling it as a call rather than a literal is what
|
|
445
445
|
// makes that a measured `null` instead of an assumed one.
|
|
446
446
|
const rendered = emitClaudeRender(cfg, {
|
|
447
|
-
theme: args.theme, cfgDir, claudeMd, scope, host,
|
|
447
|
+
theme: args.theme, cfgDir, claudeMd, scope, host, sharedRoot: args.sharedRoot,
|
|
448
448
|
out,
|
|
449
449
|
footprint: args.footprint, nativeCatalog: hostCatalogsNatively(host),
|
|
450
450
|
oldOwned, oldManaged, preambleExclude: preambleExclude(claudeMd, host),
|
|
@@ -475,11 +475,9 @@ function emitClaudeCore(cfg, args, { cfgDir, claudeMd, scope, host, out, hookOpt
|
|
|
475
475
|
// external edit, a bug in the merge) is loud now instead of surfacing as hooks that
|
|
476
476
|
// quietly never fire.
|
|
477
477
|
//
|
|
478
|
-
//
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
// because it is a real reduction in what a Claude emit proves about itself, and the thing
|
|
482
|
-
// that replaces it is the acceptance matrix rather than anything at runtime.
|
|
478
|
+
// Both halves are Node, so this proves only the emit against itself — worth stating,
|
|
479
|
+
// because it is a limit on what a Claude emit proves about itself; the acceptance matrix
|
|
480
|
+
// covers the rest, not anything at runtime.
|
|
483
481
|
//
|
|
484
482
|
// SILENT ON SUCCESS, which is its own coverage hazard: a clean emit prints nothing, so
|
|
485
483
|
// deleting this call is byte-identical in all 259 cells. `test_verify_reports_an_orphaned
|
|
@@ -520,8 +518,8 @@ const CLAUDE_SHAPED = {
|
|
|
520
518
|
summary: (at, r) => `[geneseed] claude-global -> ${at}: ${r.nAgents} subagents, `
|
|
521
519
|
+ `${r.nSkills} skills, CLAUDE.md, ${r.nHooks} hook group(s), settings.json, `
|
|
522
520
|
+ `${r.memStatus}, ${r.nbStatus}. No plugins/workflows/themes (no Claude analogue); `
|
|
523
|
-
+ '~/.claude/plugins is never touched. Hooks call the harness by absolute path
|
|
524
|
-
+ '
|
|
521
|
+
+ '~/.claude/plugins is never touched. Hooks call the harness by absolute path. '
|
|
522
|
+
+ 'Facts live in the shared tier.\n',
|
|
525
523
|
},
|
|
526
524
|
// Per-repo: CLAUDE.md at the root + a `.claude/` layer.
|
|
527
525
|
claude: {
|
|
@@ -585,23 +583,22 @@ const claudeShaped = (name) => (cfg, args, out) => {
|
|
|
585
583
|
};
|
|
586
584
|
|
|
587
585
|
/**
|
|
588
|
-
*
|
|
586
|
+
* The POST stage, which writes markers and records the install and
|
|
589
587
|
* wires NOTHING. `tests/unit/emit_phase_order.test.mjs`'s 'the post-emit marker stage wires
|
|
590
588
|
* nothing' classifies it, and that is why it stays after the dispatch.
|
|
591
589
|
*
|
|
592
|
-
* `writeText`, never `writeFileSync`:
|
|
593
|
-
*
|
|
594
|
-
* with a bare LF differs from Python's in every cell on this platform.
|
|
590
|
+
* `writeText`, never `writeFileSync`: it translates the trailing newline to CRLF on Windows,
|
|
591
|
+
* and a marker written with a bare LF differs from every other emitted file there.
|
|
595
592
|
*/
|
|
596
593
|
function writeMarkers(markerDir, emit, footprint) {
|
|
597
594
|
try {
|
|
598
595
|
mkdirSync(markerDir, { recursive: true });
|
|
599
596
|
writeText(path.join(markerDir, '.geneseed-emit'), `${emit}\n`);
|
|
600
|
-
// Written for EVERY emit (
|
|
597
|
+
// Written for EVERY emit (unconditional), unlike the theme marker:
|
|
601
598
|
// the claude/bob/openclaude PROJECT installs never call build(), so this is their only
|
|
602
599
|
// footprint record. Read by harness._footprint_of_dir, which defaults to 'full'.
|
|
603
600
|
writeText(path.join(markerDir, '.geneseed-footprint'), `${footprint}\n`);
|
|
604
|
-
} catch { /* best-effort
|
|
601
|
+
} catch { /* best-effort: a marker hiccup never fails a build */ }
|
|
605
602
|
}
|
|
606
603
|
|
|
607
604
|
/**
|
|
@@ -609,9 +606,8 @@ function writeMarkers(markerDir, emit, footprint) {
|
|
|
609
606
|
* needs, and the reason it is a named export rather than a fifth branch in `main`.
|
|
610
607
|
*
|
|
611
608
|
* `harness diff` renders an 'expected' copy of a deployed install into a temp dir and
|
|
612
|
-
* compares it file by file.
|
|
613
|
-
*
|
|
614
|
-
* otherwise resolve. This is that call, and the override is threaded as `args.cfgDir` through
|
|
609
|
+
* compares it file by file. `cfg` overrides the target the emit would otherwise resolve;
|
|
610
|
+
* the override is threaded as `args.cfgDir` through
|
|
615
611
|
* the `emit*Global` bodies. The same key is also `--config-dir` on the command line: a global
|
|
616
612
|
* emit never writes to `--out` (there `out` is the legacy bundle a memory store migrates FROM,
|
|
617
613
|
* and `update` passes it for exactly that), so without the flag there was no way to preview a
|
|
@@ -642,12 +638,12 @@ const GLOBAL_EMITS = {
|
|
|
642
638
|
*
|
|
643
639
|
* IT CALLS THE EMIT, NOT `main`, AND THAT IS THE WHOLE POINT OF THE EXPORT. Routing this
|
|
644
640
|
* through `driverMain(['--emit', 'claude', …])` would look like less code and would run two
|
|
645
|
-
* stages
|
|
641
|
+
* stages a direct call never reaches: `writeMarkers` drops `.geneseed-emit` and
|
|
646
642
|
* `.geneseed-footprint` into the sandbox, and `registryRecord` writes a row into the USER'S
|
|
647
643
|
* install registry for a temp directory that is deleted a millisecond later. A validation
|
|
648
644
|
* pass must not register an install.
|
|
649
645
|
*
|
|
650
|
-
* `footprint: 'full'` is the
|
|
646
|
+
* `footprint: 'full'` is the signature default that `_claude_bob_emit_problems`'s
|
|
651
647
|
* three-positional call leaves in place, inherited here rather than re-decided.
|
|
652
648
|
*/
|
|
653
649
|
const PROJECT_EMITS = {
|
|
@@ -670,12 +666,12 @@ const PROJECT_EMITS = {
|
|
|
670
666
|
* carry straight past the parameter default.
|
|
671
667
|
*/
|
|
672
668
|
function axesCfg({
|
|
673
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, ...gates
|
|
669
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates
|
|
674
670
|
}) {
|
|
675
671
|
return makeCfg({
|
|
676
672
|
...(posture ? { posture } : {}), ...(mode ? { mode } : {}), ...(trust ? { trust } : {}),
|
|
677
673
|
...(doctrines ? { doctrines } : {}), ...(excludeRules ? { excludeRules } : {}),
|
|
678
|
-
...(excludeSkills ? { excludeSkills } : {}), ...(kits ? { kits } : {}),
|
|
674
|
+
...(excludeSkills ? { excludeSkills } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
|
|
679
675
|
// The gate switches (`GATE_SWITCHES` keys): only an explicit `false` disarms; `null` (no
|
|
680
676
|
// opinion) keeps the gate.
|
|
681
677
|
...Object.fromEntries(GATE_SWITCHES.filter((g) => gates[g.key] === false).map((g) => [g.arg, true])),
|
|
@@ -684,7 +680,7 @@ function axesCfg({
|
|
|
684
680
|
|
|
685
681
|
export function emitProjectInto(host, {
|
|
686
682
|
theme, out, root, footprint = 'full', posture = null, mode = null, trust = null,
|
|
687
|
-
doctrines = null, excludeRules = null, excludeSkills = null, kits = null, seed = true, ...gates
|
|
683
|
+
doctrines = null, excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, seed = true, ...gates
|
|
688
684
|
}) {
|
|
689
685
|
const emit = PROJECT_EMITS[host];
|
|
690
686
|
// The axes ride the same rail into every `*Into`, and for the same reason: a drift reader
|
|
@@ -695,7 +691,7 @@ export function emitProjectInto(host, {
|
|
|
695
691
|
// the git root, which for a temp dir inside a repo is that repo, outside the sandbox.
|
|
696
692
|
return withPlatformNewlines(() => emit(
|
|
697
693
|
axesCfg({
|
|
698
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, ...gates }),
|
|
694
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
699
695
|
{ theme, footprint, root, seed }, out,
|
|
700
696
|
));
|
|
701
697
|
}
|
|
@@ -710,24 +706,24 @@ export function emitProjectInto(host, {
|
|
|
710
706
|
*/
|
|
711
707
|
export function buildInto({
|
|
712
708
|
theme, out, footprint = 'lean', posture = null, mode = null, trust = null, doctrines = null,
|
|
713
|
-
excludeRules = null, excludeSkills = null, kits = null, ...gates
|
|
709
|
+
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, ...gates
|
|
714
710
|
}) {
|
|
715
711
|
return withPlatformNewlines(() => build(axesCfg({
|
|
716
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, ...gates }),
|
|
712
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
717
713
|
theme, out, { footprint, nativeCatalog: false }));
|
|
718
714
|
}
|
|
719
715
|
|
|
720
716
|
export function emitGlobalInto(host, {
|
|
721
717
|
theme, out, cfgDir, footprint, posture = null, mode = null, doctrines = null, trust = null,
|
|
722
|
-
excludeRules = null, excludeSkills = null, kits = null, ...gates
|
|
718
|
+
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, sharedRoot = undefined, ...gates
|
|
723
719
|
}) {
|
|
724
720
|
// `build.HOSTS.get(host, build.HOSTS["opencode"])` — an unknown host falls back rather than
|
|
725
721
|
// raising, because the host comes from a marker file a user can edit.
|
|
726
722
|
const emit = GLOBAL_EMITS[host] ?? GLOBAL_EMITS.opencode;
|
|
727
723
|
// The same funnel `main` installs, for the same reason and not because `diff` asked: this
|
|
728
724
|
// runs the whole render tree, whose ~25 print sites write raw `\n`. `diff` swallows the
|
|
729
|
-
// emit's STDOUT and lets its stderr through
|
|
730
|
-
//
|
|
725
|
+
// emit's STDOUT and lets its stderr through, so an untranslated WARN from
|
|
726
|
+
// `warnBobGlobalOverProject` would reach the user's
|
|
731
727
|
// terminal with the wrong bytes on the one stream the caller deliberately does not hide.
|
|
732
728
|
// ALL FIVE AXES TRAVEL WITH THE RENDER (see `axesCfg`). Callers that pass nothing keep the
|
|
733
729
|
// reference's behaviour of rendering at `peer`/`direct`; the drift readers pass what the
|
|
@@ -736,23 +732,23 @@ export function emitGlobalInto(host, {
|
|
|
736
732
|
// the same scar the footprint left in `diffCollect`, one axis over each time.
|
|
737
733
|
return withPlatformNewlines(() => emit(
|
|
738
734
|
axesCfg({
|
|
739
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, ...gates }),
|
|
740
|
-
{ theme, footprint, root: null, cfgDir }, out,
|
|
735
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
736
|
+
{ theme, footprint, root: null, cfgDir, sharedRoot }, out,
|
|
741
737
|
));
|
|
742
738
|
}
|
|
743
739
|
|
|
744
740
|
/**
|
|
745
741
|
* EXPORTED because `harness build` is a passthrough to this program.
|
|
746
742
|
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
* the same one, and `bin/geneseed-cli.mjs` is under a transitive `child_process` ban, so
|
|
743
|
+
* The generator is a module in the same process, and `bin/geneseed-cli.mjs` is under a
|
|
744
|
+
* transitive `child_process` ban, so
|
|
750
745
|
* `js/build/generate.mjs` calls this directly. The export is what makes the auto-run below need a
|
|
751
746
|
* guard: without one, importing this file to reach `main` would RUN the generator with the
|
|
752
747
|
* CLI's argv.
|
|
753
748
|
*/
|
|
754
749
|
export function main(argv) {
|
|
755
|
-
// `withPlatformNewlines`
|
|
750
|
+
// `withPlatformNewlines` makes this driver's bytes match the platform's text mode on
|
|
751
|
+
// Windows, for every
|
|
756
752
|
// print site in the whole render tree at once — see its docblock for why a funnel and not
|
|
757
753
|
// 25 calls to `printOut`. It wraps the `catch` as well as `run`, because `die` writes its
|
|
758
754
|
// line on the way out.
|
|
@@ -763,7 +759,7 @@ export function main(argv) {
|
|
|
763
759
|
// Every DELIBERATE refusal becomes this process's exit code — `die`'s, and equally
|
|
764
760
|
// `assertSourceComplete`'s and `effectiveTheme`'s, which have already explained
|
|
765
761
|
// themselves on stderr. An unmarked throw is a crash and keeps its stack, because
|
|
766
|
-
//
|
|
762
|
+
// dressing it as a tidy refusal would hide a bug.
|
|
767
763
|
if (e && e.exitCode !== undefined) return e.exitCode;
|
|
768
764
|
throw e;
|
|
769
765
|
}
|
|
@@ -798,7 +794,7 @@ function run(argv) {
|
|
|
798
794
|
// `--sync-themes` is HERE, because it needs nothing this driver may not have: it reads
|
|
799
795
|
// `themes/`, rewrites the files textually, and prints. `js/build/themes.mjs` carries it.
|
|
800
796
|
// Non-zero when files were CHANGED (0 == already in sync), so CI can run it as a drift
|
|
801
|
-
// check —
|
|
797
|
+
// check — and a refusal (exit 2) if the template is unreadable.
|
|
802
798
|
if (args.syncThemes) return syncThemes() ? 1 : 0;
|
|
803
799
|
// `--validate-only` is NOT, and cannot be: its source-tree half is the doctor, and
|
|
804
800
|
// `js/inspect/checks-authoring.mjs` starts a process (`node --check` over the OpenCode plugins). This driver
|
|
@@ -822,12 +818,18 @@ function run(argv) {
|
|
|
822
818
|
}
|
|
823
819
|
args.cfgDir = resolveOut(args.cfgDir);
|
|
824
820
|
}
|
|
821
|
+
// D11: the option belongs to a project install. A global install owns the tier, and a plain
|
|
822
|
+
// bundle has no host to read it with, so either would write a marker nothing honours.
|
|
823
|
+
if (args.sharedTier === 'on' && (args.emit === 'files' || args.emit.endsWith('-global'))) {
|
|
824
|
+
die(2, `argument --shared-tier: only applies to a per-repo host emit (got --emit ${args.emit}); `
|
|
825
|
+
+ 'a global install already owns the shared tier');
|
|
826
|
+
}
|
|
825
827
|
const cfg = makeCfg(args);
|
|
826
828
|
warnDroppedKits(args, out);
|
|
827
829
|
|
|
828
830
|
// The marker directory is the emit's TARGET, which for a global emit is the config dir it
|
|
829
831
|
// just rendered into and not `--out` at all — so the emit returns it rather than the
|
|
830
|
-
// caller guessing (
|
|
832
|
+
// caller guessing (returning it keeps one resolution).
|
|
831
833
|
//
|
|
832
834
|
// NINE ARMS, TWO TABLES ALREADY ON FILE: `GLOBAL_EMITS` and `PROJECT_EMITS` above are
|
|
833
835
|
// exactly this dispatch's `-global` and per-repo halves, keyed by host rather than by
|
|
@@ -837,13 +839,12 @@ function run(argv) {
|
|
|
837
839
|
markerDir = GLOBAL_EMITS[args.emit.slice(0, -'-global'.length)](cfg, args, out);
|
|
838
840
|
} else if (args.emit !== 'files') {
|
|
839
841
|
// The PROJECT emits keep their markers in `out`, not in the host config dir the emit
|
|
840
|
-
// wrote to
|
|
842
|
+
// wrote to — `.claude/` is the layer, `out` is the install.
|
|
841
843
|
PROJECT_EMITS[args.emit](cfg, args, out);
|
|
842
844
|
} else {
|
|
843
|
-
// The ninth choice, a plain bundle: `nativeCatalog: false`
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
// this driver DOES inherit, and it is inherited because the Python CLI inherits it too.
|
|
845
|
+
// The ninth choice, a plain bundle: `nativeCatalog: false` leaves
|
|
846
|
+
// `native_catalog` at its signature default, as `build(args.theme, out, args.footprint)`
|
|
847
|
+
// does. It is the one signature default this driver DOES inherit.
|
|
847
848
|
build(cfg, args.theme, out, { footprint: args.footprint, nativeCatalog: false });
|
|
848
849
|
}
|
|
849
850
|
|
|
@@ -858,7 +859,7 @@ function run(argv) {
|
|
|
858
859
|
if (args.emit.endsWith('-global')) {
|
|
859
860
|
try {
|
|
860
861
|
writeText(path.join(markerDir, '.geneseed-theme'), `${args.theme}\n`);
|
|
861
|
-
} catch { /* best-effort
|
|
862
|
+
} catch { /* best-effort */ }
|
|
862
863
|
}
|
|
863
864
|
// An ALLOW-LIST, not "everything that is not global": a plain `--emit files` dev build —
|
|
864
865
|
// the default — must never pollute the registry, and only the four per-repo host emits
|
package/js/build/emit-claude.mjs
CHANGED
|
@@ -16,14 +16,15 @@ import {
|
|
|
16
16
|
import { get, isDict, isTruthy } from '../lib/json.mjs';
|
|
17
17
|
import { relPosix } from '../lib/text.mjs';
|
|
18
18
|
import { assertSourceComplete, phaseLog, ensureMemoryStore } from './bundle.mjs';
|
|
19
|
+
import { foldOnEmit } from './fold.mjs';
|
|
19
20
|
import {
|
|
20
21
|
claimAndWrite, globalMemory, globalNotebook, shipLeanLaws, stripCapabilityLinks,
|
|
21
22
|
} from './emit-common.mjs';
|
|
22
|
-
import { kitsBody, renderAll, renderFile } from './render.mjs';
|
|
23
|
+
import { kitsBody, pathTokens, renderAll, renderFile } from './render.mjs';
|
|
23
24
|
import {
|
|
24
25
|
BOB_RULES_STUB, bobFirstReply, ensureContextStub, ensureExcludesStub, ensureNotebookIndex,
|
|
25
26
|
ensureProfileStub,
|
|
26
|
-
ensureRulesStub, ensureWikiStub, WIKI_FILE,
|
|
27
|
+
ensureRulesStub, ensureWikiStub, sharedRootFor, WIKI_FILE,
|
|
27
28
|
} from './stubs.mjs';
|
|
28
29
|
import { writeVersion } from './version.mjs';
|
|
29
30
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
@@ -53,11 +54,13 @@ export function emitClaudeRender(cfg, job) {
|
|
|
53
54
|
oldOwned, oldHashes = {},
|
|
54
55
|
} = job;
|
|
55
56
|
|
|
56
|
-
//
|
|
57
|
-
//
|
|
57
|
+
// Relative to the CLAUDE.md directory, so the argument order is cfg-from-claude_md; an
|
|
58
|
+
// identical pair is '.' where `path.relative` answers ''.
|
|
58
59
|
const relCfg = relPosix(path.dirname(claudeMd), cfgDir) || '.';
|
|
59
60
|
const lawsPrefix = relCfg === '.' ? '' : `${relCfg}/`;
|
|
60
|
-
|
|
61
|
+
// A re-render of a deployed install sends that install's root, null included.
|
|
62
|
+
const { sharedRoot = scope === 'global' ? sharedRootFor(cfgDir, host) : null } = job;
|
|
63
|
+
const { theme, items } = renderAll(cfg, themeName, { footprint, lawsPrefix, nativeCatalog, sharedRoot });
|
|
61
64
|
assertSourceComplete(cfg, `claude-${scope}`);
|
|
62
65
|
mkdirSync(cfgDir, { recursive: true });
|
|
63
66
|
|
|
@@ -68,7 +71,7 @@ export function emitClaudeRender(cfg, job) {
|
|
|
68
71
|
// Deliberately NOT the same lookup as `agentText` below: that one skips an
|
|
69
72
|
// AGENT.md whose text is null, this one does not. Unreachable today (`.md` is a
|
|
70
73
|
// text suffix, so the render is never null) and reproduced anyway, because the two
|
|
71
|
-
// spellings sit four lines apart
|
|
74
|
+
// spellings sit four lines apart and only one of them filters.
|
|
72
75
|
//
|
|
73
76
|
// The fast path itself is byte-inert, measured: removing it re-renders with a theme
|
|
74
77
|
// whose DIR_* tokens gained an EMPTY prefix and with the same lawsPrefix, so it
|
|
@@ -82,6 +85,9 @@ export function emitClaudeRender(cfg, job) {
|
|
|
82
85
|
ptheme[tok] = prefix + (ptheme[tok] ?? tok.split('_').slice(1).join('_').toLowerCase());
|
|
83
86
|
}
|
|
84
87
|
ptheme.AT_HARNESS = prefix;
|
|
88
|
+
// The PATH_* tokens are not in the loop: absolute ones take no prefix, and relative ones
|
|
89
|
+
// follow the tokens just prefixed.
|
|
90
|
+
Object.assign(ptheme, pathTokens(ptheme, sharedRoot));
|
|
85
91
|
// The Kits block was substituted with the unprefixed DIR_* tokens; rebuild it, or its links dangle.
|
|
86
92
|
ptheme.KITS_BODY = kitsBody(cfg, ptheme, '');
|
|
87
93
|
// Same catalogue decision as the renderAll above — a re-render that forgot it would
|
|
@@ -113,8 +119,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
113
119
|
: scope === 'project' ? (name) => relPosix(path.dirname(cfgDir), path.join(cfgDir, 'skills', name))
|
|
114
120
|
: (name) => path.join(cfgDir, 'skills', name).split(path.sep).join('/');
|
|
115
121
|
// Bob's and OpenClaude's agents/skills use the Claude dialect verbatim.
|
|
116
|
-
// `manifestExisted` is deliberately not passed
|
|
117
|
-
// the pre-manifest header line is unreachable from this emit
|
|
122
|
+
// `manifestExisted` is deliberately not passed, so
|
|
123
|
+
// the pre-manifest header line is unreachable from this emit.
|
|
118
124
|
// One shared `claim` (see `claimer`): the skills/agents writer and the Bob command writer
|
|
119
125
|
// below both push into the same `owned` list, so a pre-manifest-install warning still
|
|
120
126
|
// prints once across the whole emit rather than once per writer.
|
|
@@ -148,6 +154,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
148
154
|
ensureRulesStub(cfgDir);
|
|
149
155
|
ensureProfileStub(cfgDir);
|
|
150
156
|
ensureExcludesStub(cfgDir);
|
|
157
|
+
// After the seeds, so what the fold sets aside is all it re-seeds. A project emit has no root.
|
|
158
|
+
if (sharedRoot !== null) foldOnEmit(host, cfgDir);
|
|
151
159
|
|
|
152
160
|
// Project hygiene, claim-on-create: an existing (possibly user-authored) .gitignore is
|
|
153
161
|
// never rewritten, but one we created stays owned across re-emits. The hook file is
|
|
@@ -216,8 +224,7 @@ export function emitClaudeRender(cfg, job) {
|
|
|
216
224
|
*
|
|
217
225
|
* `GENESEED_STACK_GLOBAL` is read from the environment on BOTH sides — the child inherits
|
|
218
226
|
* `process.env`, so the opt-out reaches here without travelling in the job. `isTruthy` is
|
|
219
|
-
* not needed for it:
|
|
220
|
-
* always a string, so `''` is the only falsy value either language sees.
|
|
227
|
+
* not needed for it: an env var is always a string, so `''` is the only falsy value.
|
|
221
228
|
*/
|
|
222
229
|
function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRules = [],
|
|
223
230
|
gates = {}) {
|
|
@@ -240,8 +247,8 @@ function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRu
|
|
|
240
247
|
// when nothing else remains — a whole-file delete would eat prose the user added AFTER
|
|
241
248
|
// Geneseed created the file.
|
|
242
249
|
//
|
|
243
|
-
//
|
|
244
|
-
// `path.relative` answers ''
|
|
250
|
+
// Relative path with '/' separators. An identical pair is '.' where
|
|
251
|
+
// `path.relative` answers '', the same guard `lawsPrefix` needs
|
|
245
252
|
// above — unreachable here (CLAUDE.md is a file, cfgDir a directory, so the pair is
|
|
246
253
|
// never identical) and spelled anyway, because the two call sites are 400 lines apart
|
|
247
254
|
// and only one of them is obviously safe.
|
|
@@ -249,8 +256,7 @@ function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRu
|
|
|
249
256
|
managed.claude_md = { rel };
|
|
250
257
|
} else if (isBob && scope === 'global' && isTruthy(get(old, 'claude_md'))) {
|
|
251
258
|
const oldCm = isDict(get(old, 'claude_md')) ? get(old, 'claude_md') : {};
|
|
252
|
-
//
|
|
253
|
-
// applied to a path already built from an absolute cfgDir.
|
|
259
|
+
// `path.resolve` is applied to a path already built from an absolute cfgDir.
|
|
254
260
|
const victim = path.resolve(cfgDir, get(oldCm, 'rel') || path.basename(claudeMd));
|
|
255
261
|
managedBlockRemove(victim);
|
|
256
262
|
}
|
|
@@ -306,8 +312,8 @@ function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRu
|
|
|
306
312
|
const addedExcl = wireClaudeExcludes(settingsPath, wantExcl);
|
|
307
313
|
// Claim only what Geneseed itself wired (prior + newly added) — folding `wantExcl`
|
|
308
314
|
// in unconditionally would claim a user's own pre-existing exclude, and uninstall
|
|
309
|
-
// would then strip it.
|
|
310
|
-
//
|
|
315
|
+
// would then strip it. The default `Array.sort` orders strings by code
|
|
316
|
+
// unit, which is the order wanted, so no comparator is passed.
|
|
311
317
|
managed.settings_excludes = [...new Set([...priorExcl, ...addedExcl])].sort();
|
|
312
318
|
}
|
|
313
319
|
} else if (priorExcl.length && isBob) {
|
package/js/build/emit-common.mjs
CHANGED
|
@@ -45,9 +45,8 @@ const LEAN_FULL_TEXT_DIRS = ['laws', 'ontology', 'doctrines'];
|
|
|
45
45
|
/**
|
|
46
46
|
* `_build_core.CAPABILITY_LINK_RE`.
|
|
47
47
|
*
|
|
48
|
-
* NOT OVERRIDABLE.
|
|
49
|
-
*
|
|
50
|
-
* sends one (see its docblock), so the override branch that used to sit in
|
|
48
|
+
* NOT OVERRIDABLE. A `cfg.capabilityLinkRe` seam once let tests swap the pattern;
|
|
49
|
+
* `bin/build-driver.mjs` deliberately never sends one (see its docblock), so the override branch that used to sit in
|
|
51
50
|
* `stripCapabilityLinks` never took its left-hand side and was deleted as dead code in the
|
|
52
51
|
* over-engineering cleanup. `tests/unit/harness.test.mjs`'s planted-fault test drives this
|
|
53
52
|
* exact constant by rewriting the module's source text instead, which is what "no injection
|
|
@@ -60,7 +59,7 @@ const CAPABILITY_LINK_RE =
|
|
|
60
59
|
export const TMPL_SPEC_RE = /\{\{DIR_(AGENTS|SKILLS)\}\}\/([A-Za-z0-9_-]+)\.md/g;
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
|
-
*
|
|
62
|
+
* Every file under a directory, recursively, skipping `__pycache__`.
|
|
64
63
|
*
|
|
65
64
|
* `recursive: true, withFileTypes: true` (Node >= 20.1, `parentPath` >= 21.4 — this repo
|
|
66
65
|
* requires >= 22.7) replaces a hand-rolled walk; the order it yields is NOT the walk's
|
|
@@ -94,7 +93,7 @@ export function stripCapabilityLinks(text) {
|
|
|
94
93
|
* ever touching a store that already holds something.
|
|
95
94
|
*
|
|
96
95
|
* The three outcomes are the returned status string, which the emit prints, so they are
|
|
97
|
-
* compared through stdout as well as through the tree.
|
|
96
|
+
* compared through stdout as well as through the tree. A `theme` parameter is
|
|
98
97
|
* dropped for both: the store dir is ALWAYS the classic English name, never themed (the
|
|
99
98
|
* OpenCode config dir uses fixed names), so the argument was never read.
|
|
100
99
|
*
|