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
|
@@ -127,7 +127,7 @@ export function loopProblems() {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* Author-time gates on the source specs and plugins.
|
|
131
131
|
*
|
|
132
132
|
* Every agent/skill spec must carry a one-line `>` purpose blockquote as the FIRST content
|
|
133
133
|
* block after its title, or its `description:` on every host either renders empty or silently
|
|
@@ -174,8 +174,8 @@ export function authoringProblems() {
|
|
|
174
174
|
// THE ONE SPAWN. `node --check` and nothing else — see the module header, and
|
|
175
175
|
// the `inspect/checks-authoring.mjs` row of the spawn allow-list in
|
|
176
176
|
// `tests/unit/hook_cli.test.mjs`, which names this argv literally.
|
|
177
|
-
// `NO_WINDOW` because
|
|
178
|
-
//
|
|
177
|
+
// `NO_WINDOW` because every CAPTURING spawn folds `CREATE_NO_WINDOW` in and this is
|
|
178
|
+
// one — and because this loop is the burst a user sees:
|
|
179
179
|
// one console window per plugin, every time the web daemon runs the doctor.
|
|
180
180
|
const r = spawnSync(node, ['--check', js], { encoding: 'utf-8', ...NO_WINDOW });
|
|
181
181
|
if (r.status !== 0) {
|
|
@@ -10,14 +10,16 @@ import path from 'node:path';
|
|
|
10
10
|
import { stripCapabilityLinks } from '../build/emit-common.mjs';
|
|
11
11
|
import { STRUCTURE, renderAll } from '../build/render.mjs';
|
|
12
12
|
import { CONFIG, CREDIT_RE, makeCfg } from '../build/source.mjs';
|
|
13
|
-
import { CLAUDE_STYLE, hostCatalogsNatively, resolvePath } from '../hosts/hosts.mjs';
|
|
14
|
-
import { EMIT_HOST_SCOPE, footprintOfDir, themeFiles } from '../hosts/installs.mjs';
|
|
13
|
+
import { CLAUDE_STYLE, HOSTS, hostCatalogsNatively, resolvePath } from '../hosts/hosts.mjs';
|
|
14
|
+
import { EMIT_HOST_SCOPE, footprintOfDir, readMaybe, renderedTier, themeFiles } from '../hosts/installs.mjs';
|
|
15
15
|
import { isVendoredPath } from '../hosts/native.mjs';
|
|
16
16
|
import { PALETTE_ROLES, colorThemeFiles } from '../hosts/opencode.mjs';
|
|
17
17
|
import { readText, withDiscardableStderr } from '../lib/fs.mjs';
|
|
18
18
|
import { parseJson, formatRepr } from '../lib/json.mjs';
|
|
19
|
+
import { renderedSharedRoot, sharedPaths } from '../lib/machine-dir.mjs';
|
|
20
|
+
import { normcase } from '../lib/paths.mjs';
|
|
19
21
|
import {
|
|
20
|
-
ABS_LINK_RE, LINK_RE, TOKEN_RE, has, isDir, isFile, rglob, sortedUnique, stemOf, stripCode, within,
|
|
22
|
+
ABS_LINK_RE, LINK_RE, NOTE, TOKEN_RE, has, isDir, isFile, rglob, sortedUnique, stemOf, stripCode, within,
|
|
21
23
|
} from './scan.mjs';
|
|
22
24
|
import { existsSync, readFileSync } from 'node:fs';
|
|
23
25
|
|
|
@@ -26,7 +28,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
26
28
|
// --------------------------------------------------------------------------------------
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Dead links AND non-hermetic ones.
|
|
30
32
|
*
|
|
31
33
|
* Hermeticity is what lets a bundle be copied or subtree-split into any repo; a link that
|
|
32
34
|
* escapes `out` breaks it silently. The two are separate messages because they have separate
|
|
@@ -43,9 +45,8 @@ export function linkProblems(md, text, out, rel) {
|
|
|
43
45
|
problems.push(`non-hermetic absolute link '${link}' in ${rel}`);
|
|
44
46
|
continue;
|
|
45
47
|
}
|
|
46
|
-
// `
|
|
47
|
-
//
|
|
48
|
-
// `out` that went through the same call.
|
|
48
|
+
// `resolvePath`, not `path.resolve`, because it canonicalises the symlinks in the part
|
|
49
|
+
// that exists and this comparison is against an `out` that went through the same call.
|
|
49
50
|
const target = resolvePath(path.join(path.dirname(md), raw));
|
|
50
51
|
if (!existsSync(target)) problems.push(`dead link '${link}' in ${rel}`);
|
|
51
52
|
else if (!within(target, out)) {
|
|
@@ -56,7 +57,7 @@ export function linkProblems(md, text, out, rel) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
+
* Scan one rendered tree for unresolved tokens and bad links.
|
|
60
61
|
*
|
|
61
62
|
* `isVendored` decides which relative shape counts as a vendored folder, and the two callers
|
|
62
63
|
* pass different ones ON PURPOSE: a `files`/opencode-global bundle nests skills at
|
|
@@ -64,7 +65,7 @@ export function linkProblems(md, text, out, rel) {
|
|
|
64
65
|
* Vendored folders are verbatim upstream docs carrying their own license, and their internal
|
|
65
66
|
* cross-links point at the upstream project's own files, so they are exempt.
|
|
66
67
|
*
|
|
67
|
-
* `rel`
|
|
68
|
+
* `rel` keeps the platform's separator, because that is what the messages print
|
|
68
69
|
* — every emit-scan cell in the acceptance matrix names a backslash on Windows.
|
|
69
70
|
*/
|
|
70
71
|
export function checkBuild(themeName, out, isVendored = isVendoredPath) {
|
|
@@ -120,7 +121,7 @@ export function descriptionProblems(text, rel) {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
|
-
*
|
|
124
|
+
* Every theme defines the same VOICE keys.
|
|
124
125
|
*
|
|
125
126
|
* A token present in one theme map and missing from another renders as a raw `{{TOKEN}}`
|
|
126
127
|
* only in the files that use it and only under that theme, so a plain build can miss it
|
|
@@ -148,11 +149,11 @@ export function themeParityProblems() {
|
|
|
148
149
|
return problems;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
/**
|
|
152
|
+
/** Anchored at BOTH ends, so `#12345` and `#1122334` both fail. */
|
|
152
153
|
const HEX_RE = /^#[0-9a-fA-F]{6}$/;
|
|
153
154
|
|
|
154
155
|
/**
|
|
155
|
-
*
|
|
156
|
+
* Every curated colour theme carries the full
|
|
156
157
|
* palette, in 6-digit hex. Voice-theme parity, for colours.
|
|
157
158
|
*
|
|
158
159
|
* TWO OF ITS THREE ARMS ARE UNREACHABLE FROM ANY CELL, and it is doctor's own ordering that
|
|
@@ -188,7 +189,32 @@ export function colorThemeProblems() {
|
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
/**
|
|
191
|
-
*
|
|
192
|
+
* Each global install whose carrier names another tier than the one this process resolves: the
|
|
193
|
+
* agent writes where the text says, the hooks read where the environment says. `$XDG_CONFIG_HOME`
|
|
194
|
+
* moved, or the install rendered relative and the tier has since appeared. A NOTE, because a
|
|
195
|
+
* rebuild clears it and `update` rolls a pull back on a doctor problem, and that rebuild comes
|
|
196
|
+
* after its gate. A relative carrier with no tier is a pre-tier install and is consistent.
|
|
197
|
+
*/
|
|
198
|
+
export function renderedPathNotes() {
|
|
199
|
+
const root = renderedSharedRoot();
|
|
200
|
+
if (root === null) return [];
|
|
201
|
+
const notes = [];
|
|
202
|
+
for (const { host, configDir } of HOSTS) {
|
|
203
|
+
let dir;
|
|
204
|
+
try { dir = configDir(); } catch { continue; }
|
|
205
|
+
if (readMaybe(path.join(dir, '.geneseed-emit'))?.trim() !== `${host}-global`) continue;
|
|
206
|
+
const { text, root: rendered } = renderedTier(dir, host);
|
|
207
|
+
if (!text.includes('user-rules.md')) continue;
|
|
208
|
+
if (rendered === null ? isDir(sharedPaths().memory) : normcase(rendered) !== normcase(root)) {
|
|
209
|
+
notes.push(`${NOTE}[shared-tier] ${host}: the carrier renders ${rendered ?? 'relative paths'}, `
|
|
210
|
+
+ `the run-time tier is ${root} — run geneseed rebuild-all`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return notes;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* A committed bundle must match a fresh render of
|
|
192
218
|
* `src/` for its OWN recorded theme, emit and footprint.
|
|
193
219
|
*
|
|
194
220
|
* Doctor's temp builds never touch the committed bundle, so drift there is invisible to
|
|
@@ -226,15 +252,16 @@ export function renderedProblems(bundle) {
|
|
|
226
252
|
if (scope === 'project' && CLAUDE_STYLE.includes(host)) return [];
|
|
227
253
|
let items;
|
|
228
254
|
try {
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
//
|
|
232
|
-
// all; this port's convention is to write at the raise site (`loadTheme`, and its
|
|
233
|
-
// docblock says why), which is identical for every caller that lets the throw propagate
|
|
255
|
+
// THIS CALLER CATCHES A REFUSAL, and that is why the stderr is buffered. The
|
|
256
|
+
// convention is to write at the raise site (`loadTheme`, and its docblock says why),
|
|
257
|
+
// which is right for every caller that lets the throw propagate
|
|
234
258
|
// and wrong for exactly this one. Buffered and replayed on success, so a WARN the render
|
|
235
259
|
// legitimately emits still reaches the user, and discarded with the refusal it belongs to.
|
|
236
260
|
({ items } = withDiscardableStderr(() => renderAll(cfg, themeName, {
|
|
237
261
|
footprint: footprintOfDir(bundle), nativeCatalog: hostCatalogsNatively(host),
|
|
262
|
+
// The bundle's own root, like its theme and footprint: `renderedPathNotes` judges that value,
|
|
263
|
+
// and a second verdict here would call every file stale for one moved directory.
|
|
264
|
+
sharedRoot: scope === 'global' ? renderedTier(bundle, host).root : null,
|
|
238
265
|
})));
|
|
239
266
|
} catch (e) {
|
|
240
267
|
// `except SystemExit` — `effectiveTheme` refuses an unknown theme, and the driver's
|
|
@@ -19,7 +19,7 @@ import { globSorted, has, isDir, isFile, srcStems } from './scan.mjs';
|
|
|
19
19
|
import { existsSync, readdirSync } from 'node:fs';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The human-readable count mirrors, the ones the
|
|
23
23
|
* badge regex never sees.
|
|
24
24
|
*
|
|
25
25
|
* The README "What you get" table and the web onboarding copy each restate the law / agent /
|
|
@@ -39,7 +39,7 @@ export function proseMirrorProblems(readme, web, counts, skillStems, shipped = '
|
|
|
39
39
|
// The README plugin count. It had drifted — the overview sentence said six while seven
|
|
40
40
|
// shipped — because the project's other plugin count ({N_PLUGINS} in the web docs) reads
|
|
41
41
|
// a DEPLOYED plugins dir that a markdown file in this repository never has. `plugins` is
|
|
42
|
-
// optional in `counts` (
|
|
42
|
+
// optional in `counts` (undefined when absent) because the corpus predates it.
|
|
43
43
|
if (plugins !== undefined) {
|
|
44
44
|
for (const m of readme.matchAll(/(\d+) \*{0,2}plugins/g)) {
|
|
45
45
|
if (Number(m[1]) !== plugins) {
|
|
@@ -109,7 +109,7 @@ export function proseMirrorProblems(readme, web, counts, skillStems, shipped = '
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
// N is a curated-subset size, not the total, so it is gated against the wikilinks it
|
|
112
|
-
// introduces rather than against the skill count. `[\s\S]` is
|
|
112
|
+
// introduces rather than against the skill count. `[\s\S]` is a dot that crosses newlines.
|
|
113
113
|
const m = /(\d+) repeatable workflows the agent can invoke by name([\s\S]*?)playbook under/
|
|
114
114
|
.exec(web);
|
|
115
115
|
if (m) {
|
|
@@ -140,7 +140,7 @@ export function proseMirrorProblems(readme, web, counts, skillStems, shipped = '
|
|
|
140
140
|
const TMPL_SPEC_RE = /\{\{DIR_(AGENTS|SKILLS)\}\}\/([A-Za-z0-9_-]+)\.md/g;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* The hand-authored AGENT.md tables and the README
|
|
144
144
|
* badges, against `src/`.
|
|
145
145
|
*
|
|
146
146
|
* The tables must list EXACTLY the spec files (no dead row, no orphaned spec) and each
|
|
@@ -27,7 +27,7 @@ import { isDir, isFile, rglob, srcStems, within } from './scan.mjs';
|
|
|
27
27
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Every entity the registry must describe.
|
|
31
31
|
*
|
|
32
32
|
* The flat agent and skill specs plus the vendored skill FOLDERS, which have no flat spec and
|
|
33
33
|
* are still shipped capabilities. Keyed `<folder>/<stem>`, the shape doctor already prints.
|
|
@@ -47,7 +47,7 @@ const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
|
47
47
|
// it too, and a copy would stop being the value under test the first time one side changed.
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* `
|
|
50
|
+
* `registry.json` describes exactly what `src/`
|
|
51
51
|
* provides, with well-formed fields.
|
|
52
52
|
*
|
|
53
53
|
* Two-way, like every anti-drift gate here: a new spec with no row and a row whose spec is
|
|
@@ -106,10 +106,10 @@ export function registryProblems() {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
109
|
+
* Credential shapes, by the prefix each issuer stamps,
|
|
110
110
|
* plus the generic assignment. Deliberately narrow: a gate that cries wolf gets disabled.
|
|
111
111
|
*
|
|
112
|
-
* `(?i)` becomes the `i` flag on the last one only
|
|
112
|
+
* `(?i)` becomes the `i` flag on the last one only.
|
|
113
113
|
*/
|
|
114
114
|
/** @type {Array<[string, RegExp]>} */
|
|
115
115
|
const SECRET_PATTERNS = [
|
|
@@ -124,7 +124,7 @@ const SECRET_PATTERNS = [
|
|
|
124
124
|
];
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* No credential may ship.
|
|
128
128
|
*
|
|
129
129
|
* Sweeps the four trees `sourceFingerprint()` hashes, which is exactly the material that ends
|
|
130
130
|
* up inside a user's bundle. Reports file:line and the KIND only — echoing the matched text
|
|
@@ -136,17 +136,16 @@ export function secretProblems() {
|
|
|
136
136
|
if (!isDir(root)) continue;
|
|
137
137
|
for (const p of rglob(root)) {
|
|
138
138
|
if (!isFile(p) || p.split(path.sep).includes('__pycache__')) continue;
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
// be applied by hand afterwards for the LINE NUMBERS to agree.
|
|
139
|
+
// Binary or unreadable: nothing to scan. `readText` would substitute U+FFFD rather than
|
|
140
|
+
// raise, so the strict decode is the check rather than a catch, and the newline
|
|
141
|
+
// folding has to be applied by hand afterwards for the LINE NUMBERS to agree.
|
|
143
142
|
let raw;
|
|
144
143
|
try { raw = readFileSync(p); } catch { continue; }
|
|
145
144
|
let s;
|
|
146
145
|
try { s = new TextDecoder('utf-8', { fatal: true }).decode(raw); } catch { continue; }
|
|
147
146
|
s = s.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
|
|
148
|
-
// `path.relative` returns a `..`-prefixed path
|
|
149
|
-
//
|
|
147
|
+
// `path.relative` returns a `..`-prefixed path for a tree outside the repo (a test
|
|
148
|
+
// tmpdir); the fallback is the path as given.
|
|
150
149
|
const r = path.relative(ROOT, p);
|
|
151
150
|
const rel = (r.startsWith('..') || path.isAbsolute(r) ? p : r)
|
|
152
151
|
.split(path.sep).join('/');
|
|
@@ -166,7 +165,7 @@ export function secretProblems() {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
/**
|
|
169
|
-
*
|
|
168
|
+
* The hook shim exists and points at something real.
|
|
170
169
|
*
|
|
171
170
|
* This gate exists because the shim DISARMED an accidental safety net. When the emitted hook
|
|
172
171
|
* command still carried the checkout path, moving the checkout made that command
|
|
@@ -225,7 +224,7 @@ const HEX40_RE = /^[0-9a-f]{40}$/;
|
|
|
225
224
|
const MOVING_REFS = new Set(['main', 'master', 'develop', 'dev', 'head', 'latest', 'trunk']);
|
|
226
225
|
|
|
227
226
|
/**
|
|
228
|
-
*
|
|
227
|
+
* Every vendored skill folder records where it came
|
|
229
228
|
* from: `**Upstream key:** <key>`, naming its `src/upstreams.json` entry, which holds the repo,
|
|
230
229
|
* the pinned commit and the licence (`creditProblems` checks those facts).
|
|
231
230
|
*
|
|
@@ -621,7 +620,7 @@ export function hostMatrixProblems(root = ROOT) {
|
|
|
621
620
|
*
|
|
622
621
|
* Taken from `geneseed scorecard` on main after #209-#213 (security policy, PR template, ARCHITECTURE
|
|
623
622
|
* and ADRs, the audit and commitlint jobs, Dependabot, coverage, property tests, fuzzing): 26 of 31,
|
|
624
|
-
* 81.2/100, matching upstream's
|
|
623
|
+
* 81.2/100, matching upstream's scorecard tool check for check. Then the weekly Stryker run and the
|
|
625
624
|
* offline link check added mutation_testing and stale_doc_detection: 28 of 31, 88.7 (A); the checkJs
|
|
626
625
|
* pass added type_safety (partial: `strict` is off): 29 of 31, 90.4; calling the web job's prettier and vitest
|
|
627
626
|
* directly (the scorecard reads only the root package.json's scripts) added formatter_enforcement
|
package/js/inspect/cost.mjs
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
|
|
24
|
-
import { sessionFiles } from '../hosts/hooks-context.mjs';
|
|
24
|
+
import { emittedHost, sessionFiles, tierSessionChars } from '../hosts/hooks-context.mjs';
|
|
25
25
|
import { carriersFor } from '../hosts/installs.mjs';
|
|
26
26
|
import { frontmatter } from '../hosts/memory-files.mjs';
|
|
27
27
|
import { listDir } from '../hosts/hooks-prims.mjs';
|
|
@@ -37,6 +37,28 @@ import { isFile, readText } from '../lib/fs.mjs';
|
|
|
37
37
|
*/
|
|
38
38
|
export const CARRIER_CEILING = { full: 66_432, lean: 41_612 };
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* THE TRADE OF `--shared-tier on`, stated once. `--help` (js/cli-table.json), the console's toggle
|
|
42
|
+
* and docs/concepts/rules.md quote these sentences; tests/unit/shared_tier_option.test.mjs
|
|
43
|
+
* holds the copies equal. The cost line carries the example figure (1 500 tokens, the estimate
|
|
44
|
+
* for a tier of 6 010 bytes before the memory map); the `setup` prompt swaps in this machine's.
|
|
45
|
+
*/
|
|
46
|
+
export const SHARED_TIER_BENEFIT = 'This project sees your machine-wide rules, profile and memory map, so what you taught '
|
|
47
|
+
+ 'one tool or repo applies here too.';
|
|
48
|
+
export const sharedTierCost = (figure = '1 500') => `About ${figure} tokens at every session start, growing with your rules. `
|
|
49
|
+
+ 'The hook budget is fixed at 9 000 characters, and the tier loads before this project\'s docs, '
|
|
50
|
+
+ 'so a large tier can push them down to a lazy listing.';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* This machine's tier cost as the prompt shows it: characters over four (the estimate this module
|
|
54
|
+
* always makes), rounded to 100 so the figure does not pretend to a precision it lacks, with a thin
|
|
55
|
+
* grouping space as the spec writes it. An empty tier says so instead of "about 0".
|
|
56
|
+
*/
|
|
57
|
+
export function sharedTierFigure() {
|
|
58
|
+
const tokens = Math.round(tierSessionChars() / 4 / 100) * 100;
|
|
59
|
+
return tokens > 0 ? String(tokens).replace(/\B(?=(\d{3})+$)/g, ' ') : null;
|
|
60
|
+
}
|
|
61
|
+
|
|
40
62
|
/**
|
|
41
63
|
* A frontmatter value as the host shows it. The emit writes descriptions JSON-escaped
|
|
42
64
|
* (`—` for one em dash), and `frontmatter()` has already stripped the quotes, so the
|
|
@@ -108,7 +130,7 @@ export function alwaysOnCost({ host, root, dir, footprint }) {
|
|
|
108
130
|
}
|
|
109
131
|
}
|
|
110
132
|
let context = 0;
|
|
111
|
-
try { for (const s of sessionFiles(dir)) context += s.text.length; } catch { /* none */ }
|
|
133
|
+
try { for (const s of sessionFiles(dir, emittedHost(host))) context += s.text.length; } catch { /* none */ }
|
|
112
134
|
|
|
113
135
|
return { carrier, skills, agents, context, ceiling: CARRIER_CEILING[footprint] ?? null };
|
|
114
136
|
}
|