geneseed 4.32.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -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 +85 -18
- package/adapters/opencode/plugins/geneseed-guard.js +437 -76
- 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 +5 -5
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +2 -2
- package/docs/concepts/hooks.md +22 -8
- package/docs/concepts/host-matrix.md +2 -2
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +3 -1
- package/docs/concepts/ownership.md +1 -1
- 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 +8 -4
- package/docs/guides/project-context.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +2 -1
- package/docs/guides/upgrade-to-5.md +118 -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/opencode-plugins.md +3 -3
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +1 -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 +1 -1
- package/docs/understand/machine-bob.md +2 -0
- 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 +135 -70
- package/harness.config.json +1 -1
- package/js/README.md +12 -7
- 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/rule-decide.mjs +273 -0
- 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 +389 -99
- package/js/hosts/hooks-learn.mjs +38 -7
- package/js/hosts/hooks-prims.mjs +4 -2
- package/js/hosts/hooks.mjs +114 -39
- package/js/hosts/hosts.mjs +150 -51
- package/js/hosts/installs.mjs +59 -171
- 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 +191 -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 +110 -32
- 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 +35 -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/maintain/memory.mjs +17 -17
- package/js/maintain/migrate.mjs +120 -92
- 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 +34 -34
- package/js/web/api.mjs +142 -79
- 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 +16 -5
- package/js/web/routes.mjs +24 -22
- package/js/web/state.mjs +78 -19
- package/js/web/update-check.mjs +27 -12
- package/js/web/user-files.mjs +76 -104
- 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 +1 -1
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +1 -1
- 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 +1 -1
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- 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/profile.md +2 -2
- package/src/skills/rule/approve.md +75 -0
- package/src/skills/rule/consolidate.md +3 -3
- package/src/skills/rule.md +14 -5
- 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-Ci4PZco3.js +1 -0
- package/web/dist/assets/ActivityDetail-C8hroCND.js +1 -0
- package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
- package/web/dist/assets/Bonsai-C1iBAt4v.js +1 -0
- package/web/dist/assets/{CopyButton-C5Li6awl.js → CopyButton-DJ3a4N88.js} +1 -1
- package/web/dist/assets/Dashboard-C_On4KXw.js +2 -0
- package/web/dist/assets/Docs-Kffdg5uV.js +5 -0
- package/web/dist/assets/GreenhouseView-k56_cBSF.js +1 -0
- package/web/dist/assets/Installs-DtEKLC9h.js +3 -0
- package/web/dist/assets/JournalView-RQnk5l7I.js +1 -0
- package/web/dist/assets/Kits-CXkEBpnf.js +1 -0
- package/web/dist/assets/Laws-DhhIVqmh.js +3 -0
- package/web/dist/assets/Library-CAUiEoJo.js +3 -0
- package/web/dist/assets/{Loops-CzitjxGV.js → Loops-LKD8mF4E.js} +2 -2
- package/web/dist/assets/{Markdown-C4S4tTA7.js → Markdown-0ORz7tAc.js} +21 -21
- package/web/dist/assets/OperatorHudView-CM5jNPwL.js +1 -0
- package/web/dist/assets/Personal-B6Uoly3C.js +2 -0
- package/web/dist/assets/{RailCats-D5weYPCS.js → RailCats-DQxxYBEP.js} +1 -1
- package/web/dist/assets/Settings-BTe6-wda.js +1 -0
- package/web/dist/assets/Tabs-CbdDWTp_.js +1 -0
- package/web/dist/assets/api-D_r0Jtla.js +1 -0
- package/web/dist/assets/controls-D4wmg_pl.js +1 -0
- package/web/dist/assets/index-HfGmYXab.js +3 -0
- package/web/dist/assets/index-ao3M-Fhm.css +1 -0
- package/web/dist/assets/motion-RlUl1osO.js +1 -0
- package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
- package/web/dist/index.html +5 -5
- package/src/skills/quiz.md +0 -44
- package/web/dist/assets/Activity-Bjy64wHC.js +0 -1
- package/web/dist/assets/ActivityDetail-B0AaipP8.js +0 -1
- package/web/dist/assets/Bonsai-CJniRqaH.js +0 -1
- package/web/dist/assets/Dashboard-B-6DTmae.js +0 -2
- package/web/dist/assets/Docs-LRc30XL9.js +0 -5
- package/web/dist/assets/GreenhouseView-CcoYlaWo.js +0 -1
- package/web/dist/assets/Installs-dp1epTcE.js +0 -3
- package/web/dist/assets/JournalView-nFP4poCf.js +0 -1
- package/web/dist/assets/KitApply-DwyZUj57.js +0 -1
- package/web/dist/assets/Kits-C0IEdZXe.js +0 -1
- package/web/dist/assets/Laws-CkykmQWu.js +0 -3
- package/web/dist/assets/Library-Guh9HBZU.js +0 -2
- package/web/dist/assets/OperatorHudView-DLGNulIY.js +0 -1
- package/web/dist/assets/Personal-BMtberL8.js +0 -2
- package/web/dist/assets/Tabs-uYJqfuQt.js +0 -1
- package/web/dist/assets/api-BxjLd7Qd.js +0 -1
- package/web/dist/assets/index-DA7BiaE5.js +0 -3
- package/web/dist/assets/index-dbbDGFDq.css +0 -1
- package/web/dist/assets/motion-Bccx3zE8.js +0 -1
package/js/inspect/diff.mjs
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `harness diff
|
|
2
|
+
* `harness diff`. What a DEPLOYED install has that a fresh
|
|
3
3
|
* render of `src/` does not, so in-place edits can be reviewed and back-ported.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* marker or a manifest. The verb's entire user-visible payload is `difflib.unified_diff`,
|
|
8
|
-
* which the walk counts as zero because `difflib` is not in `rituals/`. P5e learned that a
|
|
9
|
-
* walk cannot see through a `subprocess`; this is the same blind spot pointed the other way —
|
|
10
|
-
* it cannot see through the STANDARD LIBRARY either, and a stdlib call with no JS equivalent
|
|
11
|
-
* is a port, not a call. `js/lib/udiff.mjs` is where that went, and it is 273 lines against
|
|
12
|
-
* this file's 312 — the module the walk described as the whole verb is not half of it.
|
|
5
|
+
* The verb's entire user-visible payload is the unified diff, and `js/lib/udiff.mjs` is
|
|
6
|
+
* where that lives: a port of `difflib.unified_diff`, which has no JS equivalent.
|
|
13
7
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* in the table, and behind it is the generator. That call is why this file imports
|
|
17
|
-
* `bin/build-driver.mjs` — the same in-process route `js/build/generate.mjs` established for `build`,
|
|
8
|
+
* `diffCollect` runs a whole GLOBAL EMIT into a temp dir. That call is why this file imports
|
|
9
|
+
* `bin/build-driver.mjs` — the same in-process route `js/build/generate.mjs` uses for `build`,
|
|
18
10
|
* under the same transitive `child_process` ban.
|
|
19
11
|
*
|
|
20
12
|
* WHAT NO CELL CAN VARY, stated rather than left implicit:
|
|
@@ -22,12 +14,11 @@
|
|
|
22
14
|
* * **The diff algorithm.** A cell can produce ONE edited file and see one hunk. It cannot
|
|
23
15
|
* produce the shapes where `difflib`'s choices differ from any other diff's — ties, the
|
|
24
16
|
* recursion's alignment, and above all `autojunk`, which only engages at 200 lines and
|
|
25
|
-
* changes the hunks on every real harness file.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* and stamps the report with `datetime.now()`, so the two implementations cannot write the
|
|
17
|
+
* changes the hunks on every real harness file. No Node test drives `unifiedDiff`
|
|
18
|
+
* directly, so beyond the one hunk the `diff/--full-…` cell sees, nothing pins these
|
|
19
|
+
* shapes today.
|
|
20
|
+
* * **The timestamp.** `writeImprovements` names the file `improvements-%Y%m%d-%H%M%S.md`
|
|
21
|
+
* and stamps the report with the current time, so two runs cannot write the
|
|
31
22
|
* same bytes across a second boundary — and a cell runs them in sequence, so the boundary
|
|
32
23
|
* is a coin flip. The cell harness normalises both spellings out of the snapshot, which
|
|
33
24
|
* costs the FORMAT assertion and pays it back in `tests/unit/hook_cli.test.mjs`'s
|
|
@@ -45,37 +36,37 @@ import { rglobFiles } from '../build/emit-common.mjs';
|
|
|
45
36
|
import { CONFIG, makeCfg } from '../build/source.mjs';
|
|
46
37
|
import { sourceFingerprint } from '../build/version.mjs';
|
|
47
38
|
import {
|
|
48
|
-
GLOBAL_MANIFEST, VERSION_MARKER, expanduser, opencodeConfigDir, resolvePath,
|
|
39
|
+
GLOBAL_MANIFEST, VERSION_MARKER, expanduser, isGlobalInstall, opencodeConfigDir, resolvePath,
|
|
49
40
|
} from '../hosts/hosts.mjs';
|
|
50
41
|
import {
|
|
51
42
|
EMIT_HOST_SCOPE, defaultTheme, doctrinesForBuild, excludedRulesOfDir,
|
|
52
|
-
excludedSkillsOfDir, gatesOfDir, kitsOfDir,
|
|
43
|
+
excludedSkillsOfDir, gatesOfDir, kitsOfDir, sharedTierOfDir,
|
|
53
44
|
footprintOfDir, modeOfDir, postureOfDir,
|
|
54
45
|
trustOfDir,
|
|
55
|
-
readJsonMaybe, readMaybe, themeOfDir,
|
|
46
|
+
readJsonMaybe, readMaybe, renderedTier, themeOfDir,
|
|
56
47
|
} from '../hosts/installs.mjs';
|
|
57
48
|
import { hashesOf, ownedState, safeLeaf } from '../hosts/owned.mjs';
|
|
58
49
|
import { unifiedDiff, splitLines } from '../lib/udiff.mjs';
|
|
59
50
|
import { printOut, printErr, readText, writeText, isFile } from '../lib/fs.mjs';
|
|
51
|
+
import { NOTES_DIRS, sharedPaths } from '../lib/machine-dir.mjs';
|
|
60
52
|
import { toPlatformPath } from '../lib/paths.mjs';
|
|
61
53
|
import { relPosix } from '../lib/text.mjs';
|
|
62
54
|
|
|
63
55
|
/**
|
|
64
|
-
*
|
|
56
|
+
* This process's start, in epoch seconds.
|
|
65
57
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* before it.
|
|
58
|
+
* `flushExportNotes` is its only reader. Module load is the sampling moment: the entry
|
|
59
|
+
* imports this module before it parses an argument, so nothing an invocation does can have
|
|
60
|
+
* happened before it.
|
|
70
61
|
*/
|
|
71
62
|
const T0 = Date.now() / 1000;
|
|
72
63
|
|
|
73
64
|
/**
|
|
74
|
-
*
|
|
65
|
+
* How an owned file is keyed for drift.
|
|
75
66
|
*
|
|
76
67
|
* `.geneseed-version` carries a build-DATE stamp that is not a local edit, so it is keyed on
|
|
77
|
-
* the fingerprint token alone.
|
|
78
|
-
*
|
|
68
|
+
* the fingerprint token alone. Splitting on `/\s+/` collapses runs AND strips leading
|
|
69
|
+
* whitespace, which `String.split(' ')` does neither of.
|
|
79
70
|
*/
|
|
80
71
|
export function cmpKey(rel, text) {
|
|
81
72
|
if (rel === VERSION_MARKER) {
|
|
@@ -85,7 +76,7 @@ export function cmpKey(rel, text) {
|
|
|
85
76
|
return text;
|
|
86
77
|
}
|
|
87
78
|
|
|
88
|
-
/**
|
|
79
|
+
/** The files a global install claims, per its manifest. */
|
|
89
80
|
function ownedSet(d, data = readJsonMaybe(path.join(d, GLOBAL_MANIFEST))) {
|
|
90
81
|
if (data === null || typeof data !== 'object') return new Set();
|
|
91
82
|
const owned = data.owned;
|
|
@@ -93,11 +84,11 @@ function ownedSet(d, data = readJsonMaybe(path.join(d, GLOBAL_MANIFEST))) {
|
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
/**
|
|
96
|
-
*
|
|
87
|
+
* "project" or "global", defaulting to "global".
|
|
97
88
|
*
|
|
98
89
|
* Every manifest predating this key is a GLOBAL install, so a missing key, an unreadable file
|
|
99
|
-
* and a malformed one all read as "global".
|
|
100
|
-
*
|
|
90
|
+
* and a malformed one all read as "global". An EMPTY string falls back too, which
|
|
91
|
+
* `?? 'global'` alone would not do.
|
|
101
92
|
*/
|
|
102
93
|
export function manifestScope(d) {
|
|
103
94
|
const data = readJsonMaybe(path.join(d, GLOBAL_MANIFEST));
|
|
@@ -106,10 +97,10 @@ export function manifestScope(d) {
|
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
/**
|
|
109
|
-
*
|
|
100
|
+
* Swallows the emit's stdout and nothing else.
|
|
110
101
|
*
|
|
111
|
-
* The emit prints its own summary line, which is not part of `diff`'s output;
|
|
112
|
-
*
|
|
102
|
+
* The emit prints its own summary line, which is not part of `diff`'s output; it is
|
|
103
|
+
* swallowed and stderr goes through, so a WARN from the emit still reaches the user. Both
|
|
113
104
|
* halves matter and only the first needs code here — `printOut` and every driver funnel go
|
|
114
105
|
* through `process.stdout.write`, so replacing that one method is the whole redirect.
|
|
115
106
|
*
|
|
@@ -132,77 +123,86 @@ const posixRel = (rel) => rel.split('\\').join('/');
|
|
|
132
123
|
/**
|
|
133
124
|
* Render the `expected` tree for `host` at `axes` into a temp dir and SNAPSHOT it — every file,
|
|
134
125
|
* not only the owned ones, because a rel the DEPLOYED manifest claims is looked up here too and
|
|
135
|
-
* its presence decides "edited" against "added". The temp dir is gone before this returns
|
|
136
|
-
*
|
|
137
|
-
* The one place a render depends on WHERE it is installed: a global Bob emit writes each
|
|
138
|
-
* folder skill's absolute directory into its SKILL.md (see `writeNativeLayer`), so the
|
|
139
|
-
* reference render names the temp tree. Mapped back to the deployed dir here, or every such
|
|
140
|
-
* skill reads as edited. A deployment that has since MOVED still differs, and that is real
|
|
141
|
-
* drift — its skills point at a directory that is no longer theirs. A side-file pointer (and a
|
|
142
|
-
* global OpenCode command's) spells the same directory `/`-separated, so that spelling is
|
|
143
|
-
* mapped too.
|
|
126
|
+
* its presence decides "edited" against "added". The temp dir is gone before this returns; `dir`
|
|
127
|
+
* is its name, which the texts still spell (`locatedAt`).
|
|
144
128
|
*/
|
|
145
|
-
function renderExpected(host, axes
|
|
129
|
+
function renderExpected(host, axes) {
|
|
146
130
|
const tmp = mkdtempSync(path.join(os.tmpdir(), 'geneseed-diff-'));
|
|
147
131
|
try {
|
|
148
132
|
const expected = path.join(tmp, 'expected');
|
|
149
133
|
withStdoutSwallowed(() => emitGlobalInto(host, {
|
|
150
134
|
...axes, out: path.join(tmp, 'bundle'), cfgDir: expected,
|
|
151
135
|
}));
|
|
152
|
-
const posix = (p) => p.split(path.sep).join('/');
|
|
153
136
|
const texts = new Map();
|
|
154
|
-
for (const p of rglobFiles(expected))
|
|
155
|
-
|
|
156
|
-
.split(posix(expected)).join(posix(deployedDir)));
|
|
157
|
-
}
|
|
158
|
-
return { owned: ownedSet(expected), texts };
|
|
137
|
+
for (const p of rglobFiles(expected)) texts.set(relPosix(expected, p), readText(p));
|
|
138
|
+
return { dir: expected, owned: ownedSet(expected), texts };
|
|
159
139
|
} finally {
|
|
160
140
|
// `tempfile.TemporaryDirectory()`'s cleanup, which runs on the exception path too.
|
|
161
141
|
rmSync(tmp, { recursive: true, force: true });
|
|
162
142
|
}
|
|
163
143
|
}
|
|
164
144
|
|
|
145
|
+
/**
|
|
146
|
+
* A render, as it reads at `deployedDir`. The one place a render depends on WHERE it is installed:
|
|
147
|
+
* a global Bob emit writes each folder skill's absolute directory into its SKILL.md (see
|
|
148
|
+
* `writeNativeLayer`), so the expected render names the temp tree. Mapped back to the deployed
|
|
149
|
+
* dir here, or every such skill reads as edited. A deployment that has since MOVED still differs,
|
|
150
|
+
* and that is real drift — its skills point at a directory that is no longer theirs. A side-file
|
|
151
|
+
* pointer (and a global OpenCode command's) spells the same directory `/`-separated, so that
|
|
152
|
+
* spelling is mapped too. Apart from the render, so one render serves every install it fits.
|
|
153
|
+
*/
|
|
154
|
+
function locatedAt({ dir, owned, texts }, deployedDir) {
|
|
155
|
+
const posix = (p) => p.split(path.sep).join('/');
|
|
156
|
+
const located = new Map();
|
|
157
|
+
for (const [rel, text] of texts) {
|
|
158
|
+
located.set(rel, text.split(dir).join(deployedDir).split(posix(dir)).join(posix(deployedDir)));
|
|
159
|
+
}
|
|
160
|
+
return { owned, texts: located };
|
|
161
|
+
}
|
|
162
|
+
|
|
165
163
|
/**
|
|
166
164
|
* A memo for `diffCollect`'s `expected` render — opt-in, so `geneseed diff` and every other
|
|
167
|
-
* caller still renders afresh. The web console passes one: `/api/overview
|
|
168
|
-
*
|
|
165
|
+
* caller still renders afresh. The web console passes one: `/api/overview`, `/api/fleet` and
|
|
166
|
+
* `/api/diff` all diff an install, and the render is ~0.6 s of each. One memo serves the daemon's
|
|
167
|
+
* state and every per-install view.
|
|
169
168
|
*
|
|
170
169
|
* ONLY THE RENDER IS MEMOISED, NEVER THE RESULT: the compare against the deployed tree runs on
|
|
171
170
|
* every call, because catching a hand edit there is the whole point of the drift figure.
|
|
172
|
-
* One entry per
|
|
173
|
-
*
|
|
171
|
+
* One entry per key, so installs alike in host and every axis share a render; at most `cap` of
|
|
172
|
+
* them (least recently used goes first), above one global install per host with room for a
|
|
173
|
+
* `--config-dir` or two; `renders` counts real renders, for the tests.
|
|
174
174
|
*/
|
|
175
|
-
export function renderMemo(cap =
|
|
175
|
+
export function renderMemo(cap = 8) {
|
|
176
176
|
return { cap, renders: 0, entries: new Map() };
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* The memoised `renderExpected`. The key is everything the render reads: the source
|
|
181
181
|
* fingerprint, the two render inputs it does not hash (`harness.config.json` and the
|
|
182
|
-
* orchestrator agent), the host and every axis
|
|
183
|
-
*
|
|
182
|
+
* orchestrator agent), the host and every axis, and never the deployed dir: `renderExpected` is
|
|
183
|
+
* not told it. A fingerprint change drops every entry from the old source.
|
|
184
184
|
*/
|
|
185
|
-
function memoExpected(memo, host, axes,
|
|
185
|
+
function memoExpected(memo, host, axes, sourceFp) {
|
|
186
186
|
const fp = sourceFp ?? sourceFingerprint(makeCfg());
|
|
187
187
|
const extra = createHash('sha256');
|
|
188
188
|
for (const p of [CONFIG, PRIMARY_AGENT_SRC]) extra.update(`${readMaybe(p) ?? ''}\0`);
|
|
189
189
|
const key = JSON.stringify([fp, extra.digest('hex'), host, axes]);
|
|
190
|
-
const hit = memo.entries.get(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
memo.entries.set(
|
|
190
|
+
const hit = memo.entries.get(key);
|
|
191
|
+
if (hit) {
|
|
192
|
+
memo.entries.delete(key);
|
|
193
|
+
memo.entries.set(key, hit);
|
|
194
194
|
return hit.exp;
|
|
195
195
|
}
|
|
196
|
-
for (const [
|
|
197
|
-
const exp = renderExpected(host, axes
|
|
196
|
+
for (const [k, e] of memo.entries) if (e.fp !== fp) memo.entries.delete(k);
|
|
197
|
+
const exp = renderExpected(host, axes);
|
|
198
198
|
memo.renders += 1;
|
|
199
|
-
memo.entries.set(
|
|
199
|
+
memo.entries.set(key, { fp, exp });
|
|
200
200
|
while (memo.entries.size > memo.cap) memo.entries.delete(memo.entries.keys().next().value);
|
|
201
201
|
return exp;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
205
|
+
* Returns `{target, theme, files}`, with `files === null` for
|
|
206
206
|
* "nothing to compare here".
|
|
207
207
|
*
|
|
208
208
|
* FIVE VALUES ARE READ OFF THE DEPLOYMENT rather than defaulted, and each has a scar behind
|
|
@@ -212,9 +212,8 @@ function memoExpected(memo, host, axes, deployedDir, sourceFp) {
|
|
|
212
212
|
* AGENT.md and laws/universal.md as edited on every lean install, so a freshly rebuilt
|
|
213
213
|
* harness looked drifted the moment it finished building and no rebuild could clear it.
|
|
214
214
|
*
|
|
215
|
-
* The POSTURE and the MODE joined them late
|
|
216
|
-
*
|
|
217
|
-
* so every verb that rendered rendered at the defaults. An install that chose any other
|
|
215
|
+
* The POSTURE and the MODE joined them late: the build defaults are `peer`/`direct`
|
|
216
|
+
* and a verb that did not read them rendered at the defaults. An install that chose any other
|
|
218
217
|
* register reported its own `## Posture` and `## Mode` sections as a local edit for as long
|
|
219
218
|
* as it lived — and `apiRestore` would have written the default register back over the user's
|
|
220
219
|
* choice, which is the same defect with teeth. `rebuild-all` never had it: it reads
|
|
@@ -223,21 +222,14 @@ function memoExpected(memo, host, axes, deployedDir, sourceFp) {
|
|
|
223
222
|
export function diffCollect({
|
|
224
223
|
target = null, theme = null, emit = null, footprint = null, memo = null, sourceFp = null,
|
|
225
224
|
} = {}) {
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
// the reference's output.
|
|
225
|
+
// Expanded and NOT resolved, which is the opposite of `cmdVersion`'s `resolvePath` two
|
|
226
|
+
// files over. It is observable: `target` is printed on the summary line, so `--target .`
|
|
227
|
+
// reports `.` here and an absolute path there. Kept rather than made consistent, because
|
|
228
|
+
// consistency would be a change to the verb's output.
|
|
231
229
|
const dir = target ? expanduser(target) : opencodeConfigDir();
|
|
232
230
|
if (!existsSync(path.join(dir, GLOBAL_MANIFEST))) return { target: dir, theme, files: null };
|
|
233
231
|
if (manifestScope(dir) === 'project') return { target: dir, theme, files: null };
|
|
234
232
|
|
|
235
|
-
let themeName = theme;
|
|
236
|
-
if (!themeName) themeName = themeOfDir(dir);
|
|
237
|
-
// The Python INLINES this read rather than calling `_default_theme`, and the two bodies
|
|
238
|
-
// are identical — so this calls the one owner instead of copying the body a third time.
|
|
239
|
-
if (!themeName) themeName = defaultTheme();
|
|
240
|
-
|
|
241
233
|
let emitName = emit;
|
|
242
234
|
if (!emitName) {
|
|
243
235
|
const marker = readMaybe(path.join(dir, '.geneseed-emit'));
|
|
@@ -245,6 +237,11 @@ export function diffCollect({
|
|
|
245
237
|
}
|
|
246
238
|
const host = (EMIT_HOST_SCOPE.get(emitName) ?? ['opencode', 'global'])[0];
|
|
247
239
|
|
|
240
|
+
let themeName = theme;
|
|
241
|
+
if (!themeName) themeName = themeOfDir(dir, host);
|
|
242
|
+
// One owner for the default, rather than a copy of its body here.
|
|
243
|
+
if (!themeName) themeName = defaultTheme();
|
|
244
|
+
|
|
248
245
|
const fp = footprint || footprintOfDir(dir);
|
|
249
246
|
|
|
250
247
|
// Every input the render reads off the deployment, in ONE object: it is what the render is
|
|
@@ -256,23 +253,27 @@ export function diffCollect({
|
|
|
256
253
|
// four reports its entire doctrines section — and its `Active packs:` line — as drift.
|
|
257
254
|
// `null` (no marker) means unknown and renders at all four, which `doctrinesForBuild`
|
|
258
255
|
// makes explicit rather than leaving to `makeCfg`'s parameter default two layers down.
|
|
259
|
-
posture: postureOfDir(dir), mode: modeOfDir(dir), doctrines: doctrinesForBuild(dir),
|
|
256
|
+
posture: postureOfDir(dir, host), mode: modeOfDir(dir, host), doctrines: doctrinesForBuild(dir, host),
|
|
260
257
|
// The loop skill's preset, or its `Default trust preset:` line reads as edited.
|
|
261
258
|
trust: trustOfDir(dir, host),
|
|
262
259
|
// The excluded rules, or an install built `--exclude-rules "process 5"` reads its
|
|
263
260
|
// carrier as drift: `expected` would re-state the rule the deployment took away.
|
|
264
|
-
excludeRules: excludedRulesOfDir(dir),
|
|
261
|
+
excludeRules: excludedRulesOfDir(dir, host),
|
|
265
262
|
// The excluded skills, or every skill the install left out reads as deleted.
|
|
266
|
-
excludeSkills: excludedSkillsOfDir(dir),
|
|
263
|
+
excludeSkills: excludedSkillsOfDir(dir, host),
|
|
267
264
|
// The kits on, or every kit file reads as added and the Kits block as drift.
|
|
268
|
-
kits: kitsOfDir(dir),
|
|
265
|
+
kits: kitsOfDir(dir, host),
|
|
266
|
+
// The shared-tier marker, or an install built `--shared-tier on` reads its `Shared tier: on` line as drift.
|
|
267
|
+
sharedTier: sharedTierOfDir(dir, host),
|
|
269
268
|
// The gate switches, or a disarmed install reads its `<gate>: off` line as drift.
|
|
270
|
-
...gatesOfDir(dir),
|
|
269
|
+
...gatesOfDir(dir, host),
|
|
270
|
+
// The tier root it rendered, or an install left relative reads every file as behind source.
|
|
271
|
+
// A root that differs from the run-time one is `renderedPathNotes`'s to report.
|
|
272
|
+
sharedRoot: renderedTier(dir, host).root,
|
|
271
273
|
};
|
|
272
274
|
const deployedDir = resolvePath(dir);
|
|
273
|
-
const exp = memo
|
|
274
|
-
|
|
275
|
-
: renderExpected(host, axes, deployedDir);
|
|
275
|
+
const exp = locatedAt(memo ? memoExpected(memo, host, axes, sourceFp) : renderExpected(host, axes),
|
|
276
|
+
deployedDir);
|
|
276
277
|
|
|
277
278
|
// The deployed manifest, read once: its `owned` and its `hashes` both classify below.
|
|
278
279
|
const manifest = readJsonMaybe(path.join(dir, GLOBAL_MANIFEST));
|
|
@@ -326,9 +327,9 @@ export function diffCollect({
|
|
|
326
327
|
}
|
|
327
328
|
files.push(rec);
|
|
328
329
|
}
|
|
329
|
-
// Already sorted by `rel` above;
|
|
330
|
-
//
|
|
331
|
-
//
|
|
330
|
+
// Already sorted by `rel` above; sorted again here because the two sorts are over
|
|
331
|
+
// different things — this one is over the RECORDS, and dropping it would agree only while
|
|
332
|
+
// the set-union sort happens to be stable.
|
|
332
333
|
files.sort((x, y) => (x.rel < y.rel ? -1 : x.rel > y.rel ? 1 : 0));
|
|
333
334
|
return { target: dir, theme: themeName, files };
|
|
334
335
|
}
|
|
@@ -345,10 +346,14 @@ export const drifted = (files) => files.filter((f) => f.status !== 'linked');
|
|
|
345
346
|
* back-port (a rebuild updates it), so the improvements report and the export `setup` and
|
|
346
347
|
* `update` fire read this set, not `drifted`.
|
|
347
348
|
*/
|
|
348
|
-
|
|
349
|
+
const localChanges = (files) => drifted(files).filter((f) => f.status !== 'stale');
|
|
349
350
|
|
|
350
|
-
/**
|
|
351
|
-
|
|
351
|
+
/** An install's notebook; a global install's loops write to the tier's `notes/` too (D6). */
|
|
352
|
+
function notesRoots(dir) {
|
|
353
|
+
const roots = [[path.join(dir, 'notebook'), 'notebook']];
|
|
354
|
+
try { if (isGlobalInstall(null, dir)) roots.push([sharedPaths().notes, 'notes']); } catch { /* no home: no tier */ }
|
|
355
|
+
return roots;
|
|
356
|
+
}
|
|
352
357
|
|
|
353
358
|
/**
|
|
354
359
|
* The self-improvement notes an install has accumulated, as `{rel, body}` sorted by `rel`.
|
|
@@ -363,21 +368,23 @@ export const NOTES_DIRS = ['skill-notes', 'agent-notes'];
|
|
|
363
368
|
*/
|
|
364
369
|
export function collectNotes(dir) {
|
|
365
370
|
const notes = [];
|
|
366
|
-
for (const
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
for (const [root, label] of notesRoots(dir)) {
|
|
372
|
+
for (const sub of NOTES_DIRS) {
|
|
373
|
+
const d = path.join(root, sub);
|
|
374
|
+
let names;
|
|
375
|
+
try { names = readdirSync(d); } catch { continue; }
|
|
376
|
+
for (const n of names.filter((x) => x.endsWith('.md')).sort()) {
|
|
377
|
+
const a = path.join(d, n);
|
|
378
|
+
if (!isFile(a)) continue;
|
|
379
|
+
const body = readText(a);
|
|
380
|
+
if (body.trim()) notes.push({ rel: `${label}/${sub}/${n}`, body });
|
|
381
|
+
}
|
|
375
382
|
}
|
|
376
383
|
}
|
|
377
384
|
return notes;
|
|
378
385
|
}
|
|
379
386
|
|
|
380
|
-
/**
|
|
387
|
+
/** Pure; `when` is the caller's timestamp. */
|
|
381
388
|
export function improvementsMd(target, theme, allFiles, when, notes = []) {
|
|
382
389
|
// A linked path is never a back-port item: the file is the user's, not a local edit of ours.
|
|
383
390
|
// Nor is a stale one: the source already has what it lacks.
|
|
@@ -442,14 +449,12 @@ function stamp(d) {
|
|
|
442
449
|
}
|
|
443
450
|
|
|
444
451
|
/**
|
|
445
|
-
* `_harness_diff._write_improvements`.
|
|
446
|
-
*
|
|
447
452
|
* The default destination is `<deployed>/improvements/<timestamp>.md` — inside the install it
|
|
448
453
|
* describes, and never in its manifest: rebuilds compare only owned files so the report is
|
|
449
454
|
* not itself reported as drift, re-emits do not clobber it, and uninstall leaves it (the same
|
|
450
455
|
* contract as the memory store).
|
|
451
456
|
*
|
|
452
|
-
* ONE `now` FOR BOTH USES
|
|
457
|
+
* ONE `now` FOR BOTH USES: the filename and the `captured:` line come from
|
|
453
458
|
* the same instant, so a run that crosses a second boundary cannot name a file one second
|
|
454
459
|
* away from what it says inside.
|
|
455
460
|
*/
|
|
@@ -468,7 +473,7 @@ export function writeImprovements(
|
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
/**
|
|
471
|
-
*
|
|
476
|
+
* The drift report as a LIBRARY call, for the callers
|
|
472
477
|
* that want the artifact without the verb's printing.
|
|
473
478
|
*
|
|
474
479
|
* Returns `[path, files]`: `path` is null when nothing was written, and the two reasons are
|
|
@@ -476,13 +481,11 @@ export function writeImprovements(
|
|
|
476
481
|
* "an install, and no drift". `setup` is the caller and reads exactly that: it prints the
|
|
477
482
|
* path when there is one and says nothing when there is not.
|
|
478
483
|
*
|
|
479
|
-
* `flushExportNotes` below is its neighbour
|
|
480
|
-
* keep-vs-delete criterion this port uses: a function with no caller in this binary. P8b is
|
|
481
|
-
* the due date that docblock named — `cmdBootstrap` is the caller.
|
|
484
|
+
* `flushExportNotes` below is its neighbour; `cmdBootstrap` is the caller.
|
|
482
485
|
*/
|
|
483
486
|
export function exportImprovements(target = null, theme = null, outPath = null) {
|
|
484
487
|
const collected = diffCollect({ target, theme });
|
|
485
|
-
//
|
|
488
|
+
// null AND the empty list both return, which is why the caller
|
|
486
489
|
// gets `files` back rather than a bare path and can tell the two apart itself.
|
|
487
490
|
// A linked path alone is not drift, or every update would export an empty report.
|
|
488
491
|
// Nor are stale files alone, or every update over an older install would export one.
|
|
@@ -494,24 +497,22 @@ export function exportImprovements(target = null, theme = null, outPath = null)
|
|
|
494
497
|
}
|
|
495
498
|
|
|
496
499
|
/**
|
|
497
|
-
*
|
|
500
|
+
* Re-print, on the RESTORED terminal, every improvements
|
|
498
501
|
* file exported since this process started.
|
|
499
502
|
*
|
|
500
503
|
* WHY IT SCANS RATHER THAN TRACKS. The export that matters most is the one an update STEP made
|
|
501
|
-
* —
|
|
504
|
+
* — that can be a child process, so a call counter in this one would never see it.
|
|
502
505
|
* It reads the GLOBAL install's `improvements/` and takes anything newer than `T0 - 1`, and the
|
|
503
|
-
* one-second slack is
|
|
506
|
+
* one-second slack is deliberate: a file written in the same second the process started
|
|
504
507
|
* can carry an mtime a hair below it.
|
|
505
508
|
*
|
|
506
|
-
* Its
|
|
507
|
-
* `cmd_bootstrap`; here it is `cmdBootstrap` alone, because the first two are P7's.
|
|
509
|
+
* Its caller is `cmdBootstrap`.
|
|
508
510
|
*/
|
|
509
511
|
export function flushExportNotes() {
|
|
510
512
|
let fresh = [];
|
|
511
513
|
try {
|
|
512
514
|
const d = path.join(String(opencodeConfigDir()), 'improvements');
|
|
513
|
-
// `
|
|
514
|
-
// is why the reference needs no existence check and this needs the readdir in the try.
|
|
515
|
+
// `readdirSync` raises on a directory that is not there, hence the readdir in the try.
|
|
515
516
|
fresh = readdirSync(d)
|
|
516
517
|
.filter((n) => n.startsWith('improvements-') && n.endsWith('.md'))
|
|
517
518
|
.map((n) => path.join(d, n))
|
|
@@ -524,7 +525,6 @@ export function flushExportNotes() {
|
|
|
524
525
|
+ 'your agent to back-port them into src/.\n');
|
|
525
526
|
}
|
|
526
527
|
|
|
527
|
-
/** `_harness_diff.cmd_diff`. */
|
|
528
528
|
export function cmdDiff(args) {
|
|
529
529
|
const { target, theme, files } = diffCollect({ target: args.target, theme: args.theme });
|
|
530
530
|
if (files === null) {
|
package/js/inspect/doctor.mjs
CHANGED
|
@@ -42,13 +42,13 @@ import { printOut } from '../lib/fs.mjs';
|
|
|
42
42
|
import { authoringProblems, loopProblems } from './checks-authoring.mjs';
|
|
43
43
|
import { gateProbe, guardProbe } from './checks-probe.mjs';
|
|
44
44
|
import {
|
|
45
|
-
checkBuild, colorThemeProblems, renderedProblems, themeParityProblems,
|
|
45
|
+
checkBuild, colorThemeProblems, renderedPathNotes, renderedProblems, themeParityProblems,
|
|
46
46
|
} from './checks-build.mjs';
|
|
47
47
|
import { hostMatrixProblems, moduleMapProblems, scorecardProblems, shimProblems } from './checks-repo.mjs';
|
|
48
48
|
import { NOTE, isDoctorNote, sortedProblems, sortedUnique, stemOf, withTempDir } from './scan.mjs';
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Which themes doctor validates.
|
|
52
52
|
*
|
|
53
53
|
* An explicit `--theme` wins. Otherwise, unless `--all` forces the maintainer sweep, scope to
|
|
54
54
|
* the theme THIS host installed so a one-theme user is not buried under the same problem
|
|
@@ -86,10 +86,10 @@ function withSwallowed(streams, fn) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Swallow an emit's log, and ONLY stdout.
|
|
90
90
|
*
|
|
91
|
-
*
|
|
92
|
-
* the user.
|
|
91
|
+
* Stderr is left alone, so a WARN from the emit still reaches
|
|
92
|
+
* the user. That is the point: swallowing both would hide
|
|
93
93
|
* `warnBobGlobalOverProject` and swallowing neither would put ~200 lines of emit summary into
|
|
94
94
|
* doctor's output. `withPlatformNewlines` inside `emitGlobalInto` wraps whatever `write` is
|
|
95
95
|
* installed at call time, so it translates into this buffer and the bytes never leave.
|
|
@@ -126,7 +126,7 @@ function emitProblemsOver(items, makeCell) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
129
|
+
* Validate the opencode-global emit, in BOTH
|
|
130
130
|
* footprints.
|
|
131
131
|
*
|
|
132
132
|
* The RECOMMENDED install, and otherwise a doctor blind spot: the files build and ./Harness
|
|
@@ -150,7 +150,7 @@ export function globalEmitProblems(themeName) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
153
|
+
* Validate the claude/bob/openclaude PER-REPO
|
|
154
154
|
* emits, which were never checked before.
|
|
155
155
|
*
|
|
156
156
|
* That is exactly why the CLAUDE.md/AGENTS.md skill-table dead links shipped unnoticed: the
|
|
@@ -174,18 +174,16 @@ export function claudeBobEmitProblems(themeName) {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
177
|
+
* Run every check; return `[themes, problems]`.
|
|
178
178
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* supply one. `groups` DID land, with the caller that needed it: it is the structured
|
|
179
|
+
* There is no `on_progress` parameter: nothing in this tree can supply one.
|
|
180
|
+
* `groups` is the structured
|
|
182
181
|
* `{check, label, problems}` view the Doctor page renders, and `js/web/api.mjs`'s `apiDoctor`
|
|
183
182
|
* passes an array. `cmdDoctor` passes nothing and gets the flat list, so the return contract
|
|
184
183
|
* is the same either way.
|
|
185
184
|
*
|
|
186
|
-
* THE PER-THEME BUILD IS THE DRIVER, IN-PROCESS
|
|
187
|
-
*
|
|
188
|
-
* `child_process` allow-list leaves. `cwd=ROOT` does not travel in-process and does not have
|
|
185
|
+
* THE PER-THEME BUILD IS THE DRIVER, IN-PROCESS: `driverMain`, the only route the
|
|
186
|
+
* `child_process` allow-list leaves. A working directory does not travel in-process and does not have
|
|
189
187
|
* to: `--out` is an absolute path, which is the one input `resolveOut` would have read the
|
|
190
188
|
* working directory for.
|
|
191
189
|
*/
|
|
@@ -196,10 +194,10 @@ export function doctorCollect({
|
|
|
196
194
|
const available = themeFiles().map(stemOf);
|
|
197
195
|
if (!available.length) return [[], ['[doctor] no themes found']];
|
|
198
196
|
|
|
199
|
-
//
|
|
197
|
+
// The label is the one place each check is NAMED, and a caller can
|
|
200
198
|
// pass an array to collect them. `/api/doctor` renders one card per entry, which is the
|
|
201
|
-
// only reason the structured view exists; `
|
|
202
|
-
// list, so the return contract is unchanged either way.
|
|
199
|
+
// only reason the structured view exists; `cmdDoctor` passes nothing and gets the flat
|
|
200
|
+
// list, so the return contract is unchanged either way.
|
|
203
201
|
const ran = (check, label, probs) => {
|
|
204
202
|
if (groups !== null) groups.push({ check, label, problems: sortedProblems(probs) });
|
|
205
203
|
return probs;
|
|
@@ -260,19 +258,16 @@ export function doctorCollect({
|
|
|
260
258
|
// configuration its owner chose, and doctor must not fail a legal configuration.
|
|
261
259
|
problems = problems.concat(ran('openclaude_dual', 'OpenClaude dual harness',
|
|
262
260
|
openclaudeDualHarnessNotes()));
|
|
261
|
+
problems = problems.concat(ran('shared_paths', 'Rendered shared paths', renderedPathNotes()));
|
|
263
262
|
problems = problems.concat(ran('map', 'Module map', moduleMapProblems()));
|
|
264
263
|
problems = problems.concat(ran('host_matrix', 'Host tables', hostMatrixProblems()));
|
|
265
264
|
problems = problems.concat(ran('scorecard', 'Scorecard floor', scorecardProblems()));
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
// parser edited without regenerating the table. P2 made the table the OWNED document
|
|
269
|
-
// (`js/cli-table.json`), so there is no generator to fall behind and no second file to hash
|
|
270
|
-
// — the digest was a claim about a file this migration deletes. What replaces it is
|
|
265
|
+
// There is no `cli` check: the table is the OWNED document (`js/cli-table.json`), so
|
|
266
|
+
// there is no generator to fall behind and no second file to hash. What gates it is
|
|
271
267
|
// `tests/unit/cli_table.test.mjs`, which holds the owned table against the two entry points
|
|
272
|
-
// that dispatch from it
|
|
268
|
+
// that dispatch from it.
|
|
273
269
|
if (!noBundle) {
|
|
274
|
-
// `
|
|
275
|
-
// deliberately NOT resolved, because the Python's `ROOT / "Harness"` is not either and
|
|
270
|
+
// `resolvePath` expands and resolves — the default is deliberately NOT resolved, because
|
|
276
271
|
// the resolved spelling is what the messages print.
|
|
277
272
|
const b = bundle ? resolvePath(bundle) : path.join(ROOT, 'Harness');
|
|
278
273
|
problems = problems.concat(ran('bundle', 'Committed bundle drift', renderedProblems(b)));
|
|
@@ -286,7 +281,7 @@ function captureBoth(fn) {
|
|
|
286
281
|
}
|
|
287
282
|
|
|
288
283
|
/**
|
|
289
|
-
*
|
|
284
|
+
* The CLI face.
|
|
290
285
|
*
|
|
291
286
|
* With `--theme`, one theme. With none it scopes to the INSTALLED theme, so a one-theme
|
|
292
287
|
* install is not buried under the same issue repeated across every theme; `--all` is the full
|
|
@@ -341,7 +336,7 @@ function doctorReport(args, guard) {
|
|
|
341
336
|
if (problems.some((p) => p.startsWith('[themes]') && p.includes('missing key'))) {
|
|
342
337
|
// ⚠ THE TIP USED TO NAME `./geneseed build --sync-themes`, AND THAT COMMAND ERRORS.
|
|
343
338
|
// It was argued here on the premise that "`build` forwards its extra arguments to the
|
|
344
|
-
// generator" — which
|
|
339
|
+
// generator" — which is not true of `cmdBuild`
|
|
345
340
|
// (`js/build/generate.mjs`), which forwards `--theme` and nothing else. So the front door
|
|
346
341
|
// answered `unrecognized arguments: --sync-themes` to anyone who followed doctor's own
|
|
347
342
|
// advice, for as long as the premise went unchecked. The flag belongs to the GENERATOR,
|