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
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE DECISIONS ON THE DRAFT: what the fold left in `user-rules.draft.md`, applied as the rule
|
|
3
|
+
* Rite's approval flow says (src/skills/rule/approve.md). The console calls this; the Rite stays a
|
|
4
|
+
* written procedure, because an agent's write must pass the rule gate and a verb it could run would
|
|
5
|
+
* step around that prompt. So the two are held together by words: a change to one step here or there
|
|
6
|
+
* is a change to both, and `tests/unit/rule_decide.test.mjs` pins the formats they share.
|
|
7
|
+
*
|
|
8
|
+
* THE WRITE ORDER IS THE SAFETY: target file, ledger row, draft. A rule stays in force at every
|
|
9
|
+
* point, because nothing here touches a host's rule file: a stop leaves the rule bound from its
|
|
10
|
+
* host, and `settle` (the flow's step 2) or the next fold finishes the rest. A ledger that does not
|
|
11
|
+
* read fails before the first write.
|
|
12
|
+
*
|
|
13
|
+
* A POINTER IS DATA. An agent can write the draft past one prompt. So a `Rule from` block is
|
|
14
|
+
* decided only when its text hashes to its key, its ledger row is pending and it holds exactly one
|
|
15
|
+
* rule. A `Choose` block may only name a whole file by its own name, in its host's live config
|
|
16
|
+
* directory, compared as a string before any file call, so a forged path never reaches the disk.
|
|
17
|
+
* The shared side is always the tier's, whatever the block says. Nothing is deleted: a file that
|
|
18
|
+
* leaves goes to `archived-<file>/`.
|
|
19
|
+
*
|
|
20
|
+
* THE CHANGE REPORT SEES THESE WRITES (not Reject or Keep both: those touch only the unwatched
|
|
21
|
+
* draft and ledger), on purpose. The console's token is readable by anything on
|
|
22
|
+
* the machine, so a POST here proves no click, and logging it as Geneseed's own would let an agent
|
|
23
|
+
* blind the report. A false alarm on a real click is the safe direction, and the line names it.
|
|
24
|
+
*/
|
|
25
|
+
import { copyFileSync, readFileSync, realpathSync } from 'node:fs';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
|
|
28
|
+
import { HOSTS } from '../hosts/hosts.mjs';
|
|
29
|
+
import { readMaybe } from '../hosts/installs.mjs';
|
|
30
|
+
import { archiveStore, parseDraft, parseRules, readFoldState } from '../hosts/memory-files.mjs';
|
|
31
|
+
import { isFile, writeTextAtomic } from '../lib/fs.mjs';
|
|
32
|
+
import { jsonDumpsIndent } from '../lib/json.mjs';
|
|
33
|
+
import { WIKI_NAMES } from '../lib/machine-dir.mjs';
|
|
34
|
+
import { normcase } from '../lib/paths.mjs';
|
|
35
|
+
import { isWholeFileSeed, itemKey, landFile, ruleText } from './fold.mjs';
|
|
36
|
+
|
|
37
|
+
/** Where a retired rule goes: beside its `user-rules.md`, never loaded. */
|
|
38
|
+
export const RETIRED_RULES_FILE = 'user-rules-retired.md';
|
|
39
|
+
|
|
40
|
+
export const RULE_DECISIONS = ['approve', 'reject'];
|
|
41
|
+
export const CHOICE_DECISIONS = ['host', 'shared', 'both'];
|
|
42
|
+
|
|
43
|
+
const RENUMBERED = '## Renumbered';
|
|
44
|
+
const RULE_POINTER = /^\(source: .* \| old: R(\d+) \| sha256: \w+\)$/;
|
|
45
|
+
const CHOICE_POINTER = /^\(hosts: shared, (.+?) \| paths: (.*) \| sha256: \w+\)$/;
|
|
46
|
+
/** Where a block starts. A rule body holds no `## ` line (`settleRules` in fold.mjs says why). */
|
|
47
|
+
const pieces = (text) => text.split(/^(?=## )/m);
|
|
48
|
+
|
|
49
|
+
/** A host's live config directory, or null. `configDir` throws with no home directory. */
|
|
50
|
+
function configDirOf(host) {
|
|
51
|
+
try { return HOSTS.find((h) => h.host === host)?.configDir() ?? null; } catch { return null; }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Is `dir` that directory? Strings only: `dir` comes from the draft, and may name a share. */
|
|
55
|
+
const isConfigDir = (dir, host) => {
|
|
56
|
+
const cfg = configDirOf(host);
|
|
57
|
+
return cfg !== null && normcase(path.resolve(dir)) === normcase(path.resolve(cfg));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** A `Choose` block's facts, or nothing when its pointer does not name a whole file. */
|
|
61
|
+
function choiceFacts(pointer, title, shared) {
|
|
62
|
+
const m = CHOICE_POINTER.exec(pointer);
|
|
63
|
+
const file = title.slice('Choose: '.length);
|
|
64
|
+
const whole = new Map([['PROFILE.md', ['profile', shared.profile, ['PROFILE.md']]],
|
|
65
|
+
[path.basename(shared.wiki), ['wiki', shared.wiki, WIKI_NAMES]]]).get(file);
|
|
66
|
+
if (!m || !whole) return {};
|
|
67
|
+
const [, chooser, paths] = m;
|
|
68
|
+
const at = paths.indexOf(`${file}, `);
|
|
69
|
+
const spelled = at < 0 ? '' : paths.slice(at + file.length + 2);
|
|
70
|
+
// Resolved, so a `sub/../` spelling cannot pass the compare and then walk a link on POSIX.
|
|
71
|
+
const hostFile = spelled && path.resolve(spelled);
|
|
72
|
+
const [kind, sharedFile, names] = whole;
|
|
73
|
+
const trusted = names.includes(path.basename(hostFile)) && isConfigDir(path.dirname(hostFile), chooser);
|
|
74
|
+
return trusted ? { file, chooser, kind, sharedFile, hostFile } : {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The draft's blocks: `parseDraft`'s fields, the block's own text, and its pointer's facts. */
|
|
78
|
+
function blocksOf(text, shared) {
|
|
79
|
+
return pieces(text).flatMap((piece) => {
|
|
80
|
+
const [b] = parseDraft(piece);
|
|
81
|
+
if (!b) return [];
|
|
82
|
+
const pointer = piece.split('\n')[1]?.trim() ?? '';
|
|
83
|
+
if (!b.host) return [{ ...b, piece, ...choiceFacts(pointer, b.title, shared) }];
|
|
84
|
+
const m = RULE_POINTER.exec(pointer);
|
|
85
|
+
return [{ ...b, piece, ...(m ? { old: m[1] } : {}) }];
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A `Rule from` block as the fold compares rules: its metadata and number do not count. Null unless
|
|
91
|
+
* it reads as exactly one rule: a `##\u00a0R900` line would raise a second one nobody was shown.
|
|
92
|
+
*/
|
|
93
|
+
function blockRule(b) {
|
|
94
|
+
const [rules] = parseRules(`## R0 — ${b.title}\n${b.body}\n`);
|
|
95
|
+
return rules.length === 1 ? ruleText(rules[0]) : null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The ledger row of `key`: a key is draft text, so `constructor` must not read as a row. */
|
|
99
|
+
const rowOf = (items, key) => (Object.hasOwn(items, key) ? items[key] : undefined);
|
|
100
|
+
|
|
101
|
+
/** The shared file's rules, as `ruleText -> number`. */
|
|
102
|
+
const heldRules = (shared) => new Map(parseRules(readMaybe(shared.rules) ?? '')[0].map((r) => [ruleText(r), r.id]));
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Does a `Choose` block no longer ask anything (the flow's step 2)? An absent or seed shared file
|
|
106
|
+
* counts: there is nothing to choose, and *Use the shared file* would keep a seed over the user's
|
|
107
|
+
* text. The next fold moves the host file up.
|
|
108
|
+
*/
|
|
109
|
+
function staleChoice(b) {
|
|
110
|
+
if (!isFile(b.hostFile) || !isFile(b.sharedFile)) return true;
|
|
111
|
+
const bytes = readFileSync(b.hostFile);
|
|
112
|
+
const held = readFileSync(b.sharedFile);
|
|
113
|
+
return isWholeFileSeed(bytes) || isWholeFileSeed(held) || held.equals(bytes)
|
|
114
|
+
|| itemKey(b.kind, b.chooser, bytes) !== b.key;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const renumberedLine = (b, id) => `- ${b.host} R${b.old} -> R${id}: ${b.title}`;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The draft without `drop`, with `lines` under its `## Renumbered` heading. The heading can sit
|
|
121
|
+
* anywhere, because the fold appends after it. One write, so the record and the delete cannot part.
|
|
122
|
+
*/
|
|
123
|
+
function rewritten(text, drop, lines = []) {
|
|
124
|
+
const kept = pieces(text).filter((p) => !drop.some((b) => b.piece === p));
|
|
125
|
+
const fresh = lines.filter((l) => !text.includes(l));
|
|
126
|
+
if (!fresh.length) return kept.join('');
|
|
127
|
+
const at = kept.findIndex((p) => p.startsWith(RENUMBERED));
|
|
128
|
+
if (at < 0) return `${kept.join('').replace(/\n+$/, '')}\n\n${RENUMBERED}\n${fresh.join('\n')}\n`;
|
|
129
|
+
const body = kept[at].replace(/\n+$/, '');
|
|
130
|
+
kept[at] = `${body}\n${fresh.join('\n')}${kept[at].slice(body.length) || '\n'}`;
|
|
131
|
+
return kept.join('');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const saveLedger = (shared, state, io) => io.text(shared.foldState, `${jsonDumpsIndent(state)}\n`);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The flow's step 2: finish what a stop left, and clear what no longer asks. A block the ledger
|
|
138
|
+
* already decided goes, its row stays, and an approved rule gets its `## Renumbered` line if the
|
|
139
|
+
* shared file still holds it. A stale `Choose` block goes with its row: the next fold asks about
|
|
140
|
+
* the current text. Row first, because this walk starts from the blocks: a block left without a row
|
|
141
|
+
* is found again, and a row left without a block would count as pending for ever.
|
|
142
|
+
*/
|
|
143
|
+
function settle(shared, io) {
|
|
144
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
145
|
+
const state = readFoldState(shared);
|
|
146
|
+
const held = heldRules(shared);
|
|
147
|
+
const drop = [];
|
|
148
|
+
const lines = [];
|
|
149
|
+
let rowsGone = false;
|
|
150
|
+
for (const b of blocksOf(text, shared)) {
|
|
151
|
+
const row = rowOf(state.items, b.key);
|
|
152
|
+
if (row && row.state !== 'pending') {
|
|
153
|
+
const id = held.get(b.host ? blockRule(b) : null);
|
|
154
|
+
if (row.state === 'approved' && b.old && id !== undefined) lines.push(renumberedLine(b, id));
|
|
155
|
+
drop.push(b);
|
|
156
|
+
} else if (b.hostFile && staleChoice(b)) {
|
|
157
|
+
delete state.items[b.key];
|
|
158
|
+
rowsGone = true;
|
|
159
|
+
drop.push(b);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!drop.length) return [];
|
|
163
|
+
if (rowsGone) saveLedger(shared, state, io);
|
|
164
|
+
io.text(shared.draft, rewritten(text, drop, lines));
|
|
165
|
+
return drop.map((b) => b.title);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* One above the highest number in the shared file and in each retired file: the tier's and each
|
|
170
|
+
* host's. A host keeps its own retired rules, and a retired number is never reused. A block's
|
|
171
|
+
* `source` is read by nobody: the fold drafts only from these same directories, and a forged one
|
|
172
|
+
* would have this read reach wherever it points.
|
|
173
|
+
*/
|
|
174
|
+
function nextRuleId(shared) {
|
|
175
|
+
const retired = [shared.root, ...HOSTS.map((h) => configDirOf(h.host)).filter(Boolean)]
|
|
176
|
+
.map((dir) => path.join(dir, RETIRED_RULES_FILE));
|
|
177
|
+
const ids = [shared.rules, ...retired].flatMap((f) => parseRules(readMaybe(f) ?? '')[0].map((r) => r.id));
|
|
178
|
+
return Math.max(0, ...ids) + 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** `ok: false` as the rule routes answer it: the client reloads. */
|
|
182
|
+
const conflict = (detail, cleared) => ({ ok: false, error: 'conflict', detail, cleared });
|
|
183
|
+
|
|
184
|
+
/** The target file's write for a `Choose` decision. */
|
|
185
|
+
function applyChoice(b, decision, io) {
|
|
186
|
+
if (decision === 'both') return;
|
|
187
|
+
if (decision === 'shared') {
|
|
188
|
+
archiveStore(b.hostFile);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const bytes = readFileSync(b.hostFile);
|
|
192
|
+
if (itemKey(b.kind, b.chooser, bytes) !== b.key) throw new Error(`${b.hostFile} changed just now`);
|
|
193
|
+
archiveStore(b.sharedFile, copyFileSync);
|
|
194
|
+
io.bytes(b.sharedFile, bytes);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function applyDecision(shared, key, decision, io, cleared) {
|
|
198
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
199
|
+
const b = blocksOf(text, shared).find((x) => x.key === key);
|
|
200
|
+
if (!b) return conflict('That item is no longer in the draft.', cleared);
|
|
201
|
+
const state = readFoldState(shared);
|
|
202
|
+
const allowed = decisionsOf(b, heldRules(shared), state.items);
|
|
203
|
+
if (!allowed.includes(decision)) return conflict(`"${decision}" does not decide this item.`, cleared);
|
|
204
|
+
const lines = [];
|
|
205
|
+
let id;
|
|
206
|
+
if (decision === 'approve') {
|
|
207
|
+
id = nextRuleId(shared);
|
|
208
|
+
const base = (readMaybe(shared.rules) ?? '# User rules\n').replace(/\n+$/, '');
|
|
209
|
+
io.text(shared.rules, `${base}\n\n## R${id} — ${b.title}\n${b.body}\n`);
|
|
210
|
+
lines.push(renumberedLine(b, id));
|
|
211
|
+
} else if (b.hostFile) applyChoice(b, decision, io);
|
|
212
|
+
const kept = decision === 'reject' || decision === 'both';
|
|
213
|
+
state.items[key] = { ...state.items[key], kind: b.kind ?? 'rule', host: b.host ?? b.chooser,
|
|
214
|
+
state: kept ? 'rejected' : 'approved' };
|
|
215
|
+
saveLedger(shared, state, io);
|
|
216
|
+
io.text(shared.draft, rewritten(text, [b], lines));
|
|
217
|
+
return { ok: true, decision, key, id, rebuild: !kept, cleared };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* What may decide a block now. Only what the fold drafted: a pending row, and for a rule its text
|
|
222
|
+
* hashing to its key. None for a rule the shared file already holds, which the next fold clears.
|
|
223
|
+
*/
|
|
224
|
+
function decisionsOf(b, held, items) {
|
|
225
|
+
if (!b.key || rowOf(items, b.key)?.state !== 'pending') return [];
|
|
226
|
+
if (!b.host) return b.hostFile ? CHOICE_DECISIONS : [];
|
|
227
|
+
const rule = blockRule(b);
|
|
228
|
+
return b.old && rule !== null && itemKey('rule', b.host, rule) === b.key && !held.has(rule) ? RULE_DECISIONS : [];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** `f` with its links resolved, so a tier file linked into a dotfiles repo stays a link. */
|
|
232
|
+
function through(f) {
|
|
233
|
+
try { return realpathSync.native(f); } catch { return f; }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Decide one item. Never throws for a failed step: it answers `ok: false`, and the steps already
|
|
238
|
+
* written stand, which is the state the flow's step 2 finishes. `io` is the two writers, so a test
|
|
239
|
+
* can fail each write in turn.
|
|
240
|
+
*/
|
|
241
|
+
export function decideItem(shared, key, decision, io = {
|
|
242
|
+
text: (f, t) => writeTextAtomic(through(f), t),
|
|
243
|
+
bytes: (f, b) => landFile(through(f), b),
|
|
244
|
+
}) {
|
|
245
|
+
try {
|
|
246
|
+
return applyDecision(shared, key, decision, io, settle(shared, io));
|
|
247
|
+
} catch (e) {
|
|
248
|
+
return { ok: false, error: 'failed', detail: `The decision stopped: ${e.message}. The rule stays in force.` };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The draft as the console shows it: each block, with what may decide it and, for a `Choose`, both
|
|
254
|
+
* files' text, since the user picks between them.
|
|
255
|
+
*/
|
|
256
|
+
export function draftItems(shared) {
|
|
257
|
+
const held = heldRules(shared);
|
|
258
|
+
let items = {};
|
|
259
|
+
try { items = readFoldState(shared).items; } catch { /* no ledger to read: nothing is decidable */ }
|
|
260
|
+
return blocksOf(readMaybe(shared.draft) ?? '', shared).map((b) => ({
|
|
261
|
+
title: b.title, host: b.host, body: b.body, key: b.key, decisions: decisionsOf(b, held, items),
|
|
262
|
+
...(b.host && held.has(blockRule(b)) ? { held: true } : {}),
|
|
263
|
+
...(b.hostFile ? { choice: { file: b.file, host: b.chooser, shared_path: b.sharedFile, host_path: b.hostFile,
|
|
264
|
+
shared_text: readMaybe(b.sharedFile), host_text: readMaybe(b.hostFile) } } : {}),
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Every text a decision rests on, for the fingerprint its POST must send back. */
|
|
269
|
+
export function decisionState(shared) {
|
|
270
|
+
const text = readMaybe(shared.draft) ?? '';
|
|
271
|
+
const files = blocksOf(text, shared).filter((b) => b.hostFile).flatMap((b) => [b.sharedFile, b.hostFile]);
|
|
272
|
+
return [text, ...[shared.rules, ...files].map((f) => readMaybe(f) ?? '')].join('\0');
|
|
273
|
+
}
|
package/js/build/source.mjs
CHANGED
|
@@ -199,6 +199,7 @@ export function ruleSummaries(src = SRC) {
|
|
|
199
199
|
*/
|
|
200
200
|
const AUTHOR_NOTE_RE = /[ \t]*<!--[ \t]*note:[\s\S]*?-->[ \t]*\r?\n?/g;
|
|
201
201
|
export function stripAuthorNotes(text) {
|
|
202
|
+
if (!text.includes('note:')) return text; // most files: skips the blanking and the regex scan
|
|
202
203
|
const masked = blankCodeSpans(text);
|
|
203
204
|
const ranges = [...masked.matchAll(AUTHOR_NOTE_RE)]
|
|
204
205
|
.map((m) => [m.index, m.index + m[0].length]);
|
|
@@ -554,7 +555,7 @@ export const GATE_SWITCHES = [
|
|
|
554
555
|
*/
|
|
555
556
|
export function makeCfg({
|
|
556
557
|
posture = 'peer', mode = 'direct', trust = DEFAULT_PRESET, doctrines = PACK_ORDER,
|
|
557
|
-
excludeRules = [], excludeSkills = [], kits = [], ...switches
|
|
558
|
+
excludeRules = [], excludeSkills = [], kits = [], sharedTier = /** @type {boolean | string} */ (false), ...switches
|
|
558
559
|
} = {}) {
|
|
559
560
|
return {
|
|
560
561
|
root: ROOT,
|
|
@@ -584,6 +585,8 @@ export function makeCfg({
|
|
|
584
585
|
excludeSkills: Array.isArray(excludeSkills) ? [...excludeSkills] : [],
|
|
585
586
|
// Kits switched on for this install — off unless named, so a default build is unchanged.
|
|
586
587
|
kits: Array.isArray(kits) ? [...kits] : [],
|
|
588
|
+
// The shared tier read by a PROJECT install (`--shared-tier on`); `on` from the flag, a boolean from a read-back.
|
|
589
|
+
sharedTier: sharedTier === true || sharedTier === 'on',
|
|
587
590
|
// The gate switches (`GATE_SWITCHES`: `secretsGate`, `doneGate`, `deletionGate`), each armed
|
|
588
591
|
// unless its `no*` arg says so in so many words: only a literal `true` disarms, so every
|
|
589
592
|
// caller that never heard of a switch keeps the gate.
|
package/js/build/stubs.mjs
CHANGED
|
@@ -14,9 +14,10 @@ import path from 'node:path';
|
|
|
14
14
|
import { writeText } from '../lib/fs.mjs';
|
|
15
15
|
import { isDir } from '../lib/fs.mjs';
|
|
16
16
|
import { jsonDumpsIndent } from '../lib/json.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { NOTES_DIRS, WIKI_NAMES, renderedSharedRoot, sharedPaths } from '../lib/machine-dir.mjs';
|
|
18
|
+
import { EXCLUDES_FILE, isCanonical } from '../hosts/hosts.mjs';
|
|
18
19
|
import { MEMORY_SEED } from '../hosts/memory-files.mjs';
|
|
19
|
-
import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
20
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
20
21
|
|
|
21
22
|
// ---------------------------------------------------------------------------
|
|
22
23
|
// Seeded stubs. Written once into the bundle and NEVER overwritten — each holds
|
|
@@ -239,24 +240,50 @@ export function ensureContextStub(out) {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
/** The wiki manifest's name. `geneseed-` says who owns it in a shared `.claude/`/`.opencode/`. */
|
|
242
|
-
export const WIKI_FILE =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
export const WIKI_FILE = WIKI_NAMES[0];
|
|
244
|
+
const LEGACY_WIKI_FILES = WIKI_NAMES.slice(1);
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* `{new: [old…]}` — every file a build renamed, with the names it used to have. The fallback that
|
|
248
|
+
* still reads an old name has no end date, so `status` and `rebuild-all` warn while one is on disk
|
|
249
|
+
* (M3): removal waits for a release after users have been told. One table, so the next rename is
|
|
250
|
+
* one row and not a second warning.
|
|
251
|
+
*/
|
|
252
|
+
export const RENAMED_FILES = { [WIKI_FILE]: LEGACY_WIKI_FILES };
|
|
253
|
+
|
|
254
|
+
/** The old-name files present in `dirs`, as `{file, now}`: the path found and the name it takes. */
|
|
255
|
+
export function renamedFilesIn(dirs) {
|
|
256
|
+
const found = [];
|
|
257
|
+
for (const dir of dirs) {
|
|
258
|
+
for (const [now, olds] of Object.entries(RENAMED_FILES)) {
|
|
259
|
+
for (const old of olds) {
|
|
260
|
+
const file = path.join(dir, old);
|
|
261
|
+
if (existsSync(file)) found.push({ file, now });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return found;
|
|
266
|
+
}
|
|
246
267
|
|
|
247
268
|
/**
|
|
248
269
|
* `_build_render.ensure_wiki_stub`, plus the rename. A legacy manifest is the user's file: it is
|
|
249
270
|
* RENAMED to `WIKI_FILE` (bytes preserved by construction), never copied and never seeded beside.
|
|
250
271
|
* A rename that fails (the file held open on Windows) leaves it where it is and seeds nothing —
|
|
251
|
-
* a seed beside it would fork the user's declarations; the readers' fallback still finds it.
|
|
272
|
+
* a seed beside it would fork the user's declarations; the readers' fallback still finds it. The
|
|
273
|
+
* failure is WARNED (B6): it used to be swallowed, and the old name then stayed in use unseen.
|
|
252
274
|
* The sibling `.gitignore` follows the rename, or the private paths become committable.
|
|
253
275
|
*/
|
|
254
|
-
export function ensureWikiStub(out
|
|
276
|
+
export function ensureWikiStub(out, { rename = renameSync,
|
|
277
|
+
warn = (m) => process.stderr.write(m) } = {}) {
|
|
255
278
|
const dest = path.join(out, WIKI_FILE);
|
|
256
279
|
if (existsSync(dest)) return;
|
|
257
280
|
const legacy = LEGACY_WIKI_FILES.find((n) => existsSync(path.join(out, n)));
|
|
258
281
|
if (!legacy) return seed(dest, WIKI_STUB);
|
|
259
|
-
try {
|
|
282
|
+
try { rename(path.join(out, legacy), dest); } catch (e) {
|
|
283
|
+
warn(`[geneseed] WARN could not rename ${path.join(out, legacy)} to ${WIKI_FILE}: ${e.message}; `
|
|
284
|
+
+ 'it is still read under its old name, and the next build tries again\n');
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
260
287
|
ignoreRenamedWiki(path.join(out, '.gitignore'), legacy);
|
|
261
288
|
}
|
|
262
289
|
|
|
@@ -285,6 +312,40 @@ export const ensureProfileStub = stubWriter(PROFILE_FILE, PROFILE_STUB);
|
|
|
285
312
|
*/
|
|
286
313
|
export const ensureExcludesStub = stubWriter(EXCLUDES_FILE, EXCLUDES_STUB);
|
|
287
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Create the machine tier and seed what is absent; every file is the user's once it exists, as a
|
|
317
|
+
* host's are. Nothing here enters a manifest: uninstall never touches the tier (D8). False when it
|
|
318
|
+
* cannot be created, and that is never fatal: the emit renders relative and the host layer serves.
|
|
319
|
+
*/
|
|
320
|
+
export function ensureSharedTier() {
|
|
321
|
+
try {
|
|
322
|
+
const tier = sharedPaths();
|
|
323
|
+
mkdirSync(tier.memory, { recursive: true });
|
|
324
|
+
for (const sub of NOTES_DIRS) mkdirSync(path.join(tier.notes, sub), { recursive: true });
|
|
325
|
+
ensureMemoryIndex(tier.memory);
|
|
326
|
+
ensureRulesStub(tier.root);
|
|
327
|
+
ensureProfileStub(tier.root);
|
|
328
|
+
ensureWikiStub(tier.root);
|
|
329
|
+
ensureExcludesStub(tier.root);
|
|
330
|
+
return true;
|
|
331
|
+
} catch (e) {
|
|
332
|
+
process.stderr.write(`[geneseed] WARN could not create the shared tier: ${e.message}; `
|
|
333
|
+
+ 'this emit renders relative paths\n');
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The root a global emit renders. Rendering and creating are two decisions: every global emit
|
|
340
|
+
* renders the same path, and only a canonical one creates the tier. null, so relative paths, only
|
|
341
|
+
* when that creation failed or there is no home. `diff` and Restore do not ask: they re-render a
|
|
342
|
+
* deployed install, so they send its own root (`renderedTier`).
|
|
343
|
+
*/
|
|
344
|
+
export function sharedRootFor(cfgDir, host) {
|
|
345
|
+
const root = renderedSharedRoot();
|
|
346
|
+
return root !== null && (!isCanonical(cfgDir, host) || ensureSharedTier()) ? root : null;
|
|
347
|
+
}
|
|
348
|
+
|
|
288
349
|
/** `_build_render.ensure_bundle_gitignore`. */
|
|
289
350
|
export const ensureBundleGitignore = stubWriter('.gitignore', BUNDLE_GITIGNORE);
|
|
290
351
|
|
package/js/build/version.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { parseJson } from '../lib/json.mjs';
|
|
|
14
14
|
import { isDir } from '../lib/fs.mjs';
|
|
15
15
|
import { relPosix } from '../lib/text.mjs';
|
|
16
16
|
import { rglobFiles } from './emit-common.mjs';
|
|
17
|
+
import { sourceGeneration } from './render.mjs';
|
|
17
18
|
import { createHash } from 'node:crypto';
|
|
18
19
|
import { readFileSync } from 'node:fs';
|
|
19
20
|
|
|
@@ -31,17 +32,13 @@ import { readFileSync } from 'node:fs';
|
|
|
31
32
|
* in the output; reproducing the wrong one changes the fingerprint of every install.
|
|
32
33
|
*/
|
|
33
34
|
export function sourceFingerprint(cfg) {
|
|
34
|
-
// Once per
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
FINGERPRINT.set(cfg, fp);
|
|
40
|
-
return fp;
|
|
35
|
+
// Once per source generation — every emit (84 of them in `doctor --all`) hashed the whole tree
|
|
36
|
+
// again, and the web daemon is long-lived, so the key has to see an edit: render.mjs says how.
|
|
37
|
+
const generation = sourceGeneration(cfg);
|
|
38
|
+
generation.fingerprint ??= hashSource(cfg);
|
|
39
|
+
return generation.fingerprint;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
const FINGERPRINT = new WeakMap();
|
|
44
|
-
|
|
45
42
|
function hashSource(cfg) {
|
|
46
43
|
const h = createHash('sha256');
|
|
47
44
|
const files = [];
|
|
@@ -51,8 +48,11 @@ function hashSource(cfg) {
|
|
|
51
48
|
const keyed = files.map((p) => [relPosix(cfg.root, p), p]);
|
|
52
49
|
keyed.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
|
|
53
50
|
for (const [rel, p] of keyed) {
|
|
51
|
+
// A file deleted since the walk listed it is not in the tree any more (as in `sourceStamp`).
|
|
52
|
+
let bytes;
|
|
53
|
+
try { bytes = readFileSync(p); } catch (e) { if (e.code === 'ENOENT') continue; throw e; }
|
|
54
54
|
h.update(Buffer.from(`${rel}\0`, 'utf8'));
|
|
55
|
-
h.update(
|
|
55
|
+
h.update(bytes);
|
|
56
56
|
h.update(Buffer.from([0]));
|
|
57
57
|
}
|
|
58
58
|
return h.digest('hex').slice(0, 12);
|
package/js/cli-table.json
CHANGED
|
@@ -42,36 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "bootstrap",
|
|
45
|
-
"help": "update everything (
|
|
45
|
+
"help": "update everything (upgrade) with a progress UI, then run setup",
|
|
46
46
|
"description": "",
|
|
47
|
-
"positionals": [
|
|
48
|
-
{
|
|
49
|
-
"names": [],
|
|
50
|
-
"dest": "ref",
|
|
51
|
-
"metavar": null,
|
|
52
|
-
"help": "accepted for back-compat; ignored (git follows the current branch)",
|
|
53
|
-
"choices": null,
|
|
54
|
-
"default": null,
|
|
55
|
-
"required": false,
|
|
56
|
-
"nargs": "?",
|
|
57
|
-
"is_flag": false,
|
|
58
|
-
"type": null,
|
|
59
|
-
"hidden": false
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"names": [],
|
|
63
|
-
"dest": "extra",
|
|
64
|
-
"metavar": null,
|
|
65
|
-
"help": "",
|
|
66
|
-
"choices": null,
|
|
67
|
-
"default": null,
|
|
68
|
-
"required": false,
|
|
69
|
-
"nargs": "*",
|
|
70
|
-
"is_flag": false,
|
|
71
|
-
"type": null,
|
|
72
|
-
"hidden": true
|
|
73
|
-
}
|
|
74
|
-
],
|
|
47
|
+
"positionals": [],
|
|
75
48
|
"options": [
|
|
76
49
|
{
|
|
77
50
|
"names": [
|
|
@@ -247,6 +220,21 @@
|
|
|
247
220
|
"type": null,
|
|
248
221
|
"hidden": false
|
|
249
222
|
},
|
|
223
|
+
{
|
|
224
|
+
"names": [
|
|
225
|
+
"--shared-tier"
|
|
226
|
+
],
|
|
227
|
+
"dest": "shared_tier",
|
|
228
|
+
"metavar": null,
|
|
229
|
+
"help": "let a per-repo install also read the machine-wide shared tier: on|off (default: off; refused for a global or bundle emit). Benefit: This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too. Cost: About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.",
|
|
230
|
+
"choices": null,
|
|
231
|
+
"default": null,
|
|
232
|
+
"required": false,
|
|
233
|
+
"nargs": null,
|
|
234
|
+
"is_flag": false,
|
|
235
|
+
"type": null,
|
|
236
|
+
"hidden": false
|
|
237
|
+
},
|
|
250
238
|
{
|
|
251
239
|
"names": [
|
|
252
240
|
"--out"
|
|
@@ -608,7 +596,7 @@
|
|
|
608
596
|
},
|
|
609
597
|
{
|
|
610
598
|
"name": "exclude",
|
|
611
|
-
"help": "manage sovereign-repo exclusions: folders where the GLOBAL installs go dormant (hooks silent, preamble suppressed); stored in
|
|
599
|
+
"help": "manage sovereign-repo exclusions: folders where the GLOBAL installs go dormant (hooks silent, preamble suppressed); stored in the shared tier's excludes.json, with the repo-side wiring per host",
|
|
612
600
|
"description": "",
|
|
613
601
|
"positionals": [
|
|
614
602
|
{
|
|
@@ -748,7 +736,7 @@
|
|
|
748
736
|
],
|
|
749
737
|
"dest": "memory",
|
|
750
738
|
"metavar": null,
|
|
751
|
-
"help": "
|
|
739
|
+
"help": "memory dir to dedup against and index into (default: $GENESEED_MEMORY, else $GENESEED_HARNESS/memory, else a project install in the cwd or ./Harness, else the shared tier, else the OpenCode config store); the only way to a memory/ no install owns",
|
|
752
740
|
"choices": null,
|
|
753
741
|
"default": null,
|
|
754
742
|
"required": false,
|
|
@@ -1068,7 +1056,7 @@
|
|
|
1068
1056
|
},
|
|
1069
1057
|
{
|
|
1070
1058
|
"name": "memory",
|
|
1071
|
-
"help": "manage the memory store: list the facts the agent reads, or remove one by name (archived into memory/archive/; --purge deletes)",
|
|
1059
|
+
"help": "manage the memory store: list the facts the agent reads, or remove one by name (archived into memory/archive/; --purge deletes). A global install's store is the shared tier, ~/.config/geneseed/memory; a project install keeps its own",
|
|
1072
1060
|
"description": "",
|
|
1073
1061
|
"positionals": [
|
|
1074
1062
|
{
|
|
@@ -1160,7 +1148,7 @@
|
|
|
1160
1148
|
},
|
|
1161
1149
|
{
|
|
1162
1150
|
"name": "migrate",
|
|
1163
|
-
"help": "move this machine from the git-checkout install shape to the npm one: re-
|
|
1151
|
+
"help": "move this machine from the git-checkout install shape to the npm one: run from the npm package, it re-emits every registered install, which points the hook shim at that package, and reports what must be fixed by hand. A git clone or a bundle is refused with exit 3. Use --dry-run alone, from anywhere, to preview the shared-tier fold",
|
|
1164
1152
|
"description": "",
|
|
1165
1153
|
"positionals": [],
|
|
1166
1154
|
"options": [
|
|
@@ -1170,7 +1158,7 @@
|
|
|
1170
1158
|
],
|
|
1171
1159
|
"dest": "dry_run",
|
|
1172
1160
|
"metavar": null,
|
|
1173
|
-
"help": "survey and print the plan; write nothing",
|
|
1161
|
+
"help": "survey and print the plan, with the fold each global install would run and any orphan; write nothing",
|
|
1174
1162
|
"choices": null,
|
|
1175
1163
|
"default": false,
|
|
1176
1164
|
"required": false,
|
|
@@ -1381,28 +1369,6 @@
|
|
|
1381
1369
|
],
|
|
1382
1370
|
"mutex": []
|
|
1383
1371
|
},
|
|
1384
|
-
{
|
|
1385
|
-
"name": "sync-self",
|
|
1386
|
-
"help": "refresh the orchestration layer — launchers + update scripts (cross-platform; an alias of upgrade)",
|
|
1387
|
-
"description": "",
|
|
1388
|
-
"positionals": [
|
|
1389
|
-
{
|
|
1390
|
-
"names": [],
|
|
1391
|
-
"dest": "ref",
|
|
1392
|
-
"metavar": null,
|
|
1393
|
-
"help": "",
|
|
1394
|
-
"choices": null,
|
|
1395
|
-
"default": null,
|
|
1396
|
-
"required": false,
|
|
1397
|
-
"nargs": "?",
|
|
1398
|
-
"is_flag": false,
|
|
1399
|
-
"type": null,
|
|
1400
|
-
"hidden": true
|
|
1401
|
-
}
|
|
1402
|
-
],
|
|
1403
|
-
"options": [],
|
|
1404
|
-
"mutex": []
|
|
1405
|
-
},
|
|
1406
1372
|
{
|
|
1407
1373
|
"name": "theme",
|
|
1408
1374
|
"help": "create a user OpenCode colour theme (solid + transparent) in the live themes dir; survives rebuilds",
|
|
@@ -1631,7 +1597,7 @@
|
|
|
1631
1597
|
},
|
|
1632
1598
|
{
|
|
1633
1599
|
"name": "uninstall",
|
|
1634
|
-
"help": "remove a global or project-scoped Geneseed install (manifest-tracked); memory/notebook are never deleted (--archive-memory moves them aside)",
|
|
1600
|
+
"help": "remove a global or project-scoped Geneseed install (manifest-tracked); memory/notebook are never deleted (--archive-memory moves them aside), and the shared tier, ~/.config/geneseed, is left alone",
|
|
1635
1601
|
"description": "",
|
|
1636
1602
|
"positionals": [],
|
|
1637
1603
|
"options": [
|
|
@@ -1711,19 +1677,6 @@
|
|
|
1711
1677
|
"help": "",
|
|
1712
1678
|
"description": "",
|
|
1713
1679
|
"positionals": [
|
|
1714
|
-
{
|
|
1715
|
-
"names": [],
|
|
1716
|
-
"dest": "ref",
|
|
1717
|
-
"metavar": null,
|
|
1718
|
-
"help": "",
|
|
1719
|
-
"choices": null,
|
|
1720
|
-
"default": null,
|
|
1721
|
-
"required": false,
|
|
1722
|
-
"nargs": "?",
|
|
1723
|
-
"is_flag": false,
|
|
1724
|
-
"type": null,
|
|
1725
|
-
"hidden": true
|
|
1726
|
-
},
|
|
1727
1680
|
{
|
|
1728
1681
|
"names": [],
|
|
1729
1682
|
"dest": "theme",
|
|
@@ -1746,19 +1699,6 @@
|
|
|
1746
1699
|
"help": "self-update: git pull the install's origin (ff-only), validate, then rebuild the bundle + every install",
|
|
1747
1700
|
"description": "",
|
|
1748
1701
|
"positionals": [
|
|
1749
|
-
{
|
|
1750
|
-
"names": [],
|
|
1751
|
-
"dest": "ref",
|
|
1752
|
-
"metavar": null,
|
|
1753
|
-
"help": "",
|
|
1754
|
-
"choices": null,
|
|
1755
|
-
"default": null,
|
|
1756
|
-
"required": false,
|
|
1757
|
-
"nargs": "?",
|
|
1758
|
-
"is_flag": false,
|
|
1759
|
-
"type": null,
|
|
1760
|
-
"hidden": true
|
|
1761
|
-
},
|
|
1762
1702
|
{
|
|
1763
1703
|
"names": [],
|
|
1764
1704
|
"dest": "theme",
|
package/js/hosts/activity.mjs
CHANGED
|
@@ -69,12 +69,12 @@ const SNAPSHOT_NAME = /^[A-Za-z0-9_.-]{1,128}\.json$/;
|
|
|
69
69
|
* a hook writer, with no pid, this is the only one, so a session left waiting on the user for
|
|
70
70
|
* longer than this moves to the archive at the next sweep and comes back on its next prompt.
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
const ACTIVITY_STALE_SECONDS = 1800;
|
|
73
73
|
/** The archive keeps the newest this many ended sessions, and none older than a week. */
|
|
74
74
|
export const ARCHIVE_KEEP = 50;
|
|
75
75
|
export const ARCHIVE_MAX_AGE_SECONDS = 7 * 24 * 3600;
|
|
76
76
|
/** One Stop reads at most this much new transcript; a longer delta keeps its newest bytes. */
|
|
77
|
-
|
|
77
|
+
const TRANSCRIPT_CAP = 2 * 1024 * 1024;
|
|
78
78
|
|
|
79
79
|
// The plugin's caps, so a hook snapshot is the same size as a plugin one.
|
|
80
80
|
const FILE_CAP = 8;
|
|
@@ -47,7 +47,7 @@ export function writeGeneseedGitignore(file) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** The seeded list, relative to the git root. */
|
|
50
|
-
|
|
50
|
+
const SEED_REL = '.geneseed/protected-checks.txt';
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* What a project's checks live in. A string ending `/` is a folder, any other string a file; a
|