create-claude-cabinet 0.47.0 → 0.48.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/README.md +1 -0
- package/lib/CLAUDE.md +218 -0
- package/lib/cli.js +102 -344
- package/lib/copy.js +75 -1
- package/lib/engagement-server-setup.js +1 -17
- package/lib/engagement-setup.js +1 -1
- package/lib/installer-gate.js +135 -0
- package/lib/modules.js +292 -0
- package/lib/mux-setup.js +1 -17
- package/lib/project-context.js +16 -96
- package/lib/settings-merge.js +148 -9
- package/lib/site-audit-setup.js +23 -7
- package/lib/verify-setup.js +20 -9
- package/lib/watchtower-setup.js +1 -5
- package/package.json +1 -1
- package/templates/CLAUDE.md +959 -0
- package/templates/briefing/_briefing-template.md +6 -11
- package/templates/cabinet/eval-protocol.md +27 -10
- package/templates/cabinet/watchtower-contracts.md +39 -0
- package/templates/cabinet/worktree-invocation-contract.md +24 -0
- package/templates/engagement/__tests__/checklist-visibility.test.mjs +76 -0
- package/templates/engagement/engagement-checklist.mjs +26 -2
- package/templates/engagement/engagement-schema.md +8 -6
- package/templates/engagement/pib-db-patches/pib-db-lib.mjs +49 -9
- package/templates/engagement/pib-db-patches/pib-db-schema.sql +1 -1
- package/templates/engagement/pib-db-patches/pib-db.mjs +4 -1
- package/templates/engagement/sql-constants.mjs +9 -1
- package/templates/engagement-server/__tests__/cross-tenant-auth.test.mjs +87 -0
- package/templates/engagement-server/server.mjs +65 -40
- package/templates/hooks/action-completion-gate.sh +10 -0
- package/templates/hooks/action-quality-gate.sh +10 -0
- package/templates/hooks/skill-telemetry.sh +10 -5
- package/templates/hooks/skill-tool-telemetry.sh +11 -5
- package/templates/mcp/pib-db.json +1 -1
- package/templates/rules/enforcement-pipeline.md +0 -12
- package/templates/scripts/__tests__/api-usage-idle-gate.test.mjs +81 -0
- package/templates/scripts/__tests__/bsql-loader-verify.test.mjs +47 -0
- package/templates/scripts/__tests__/inbox-assessment.test.mjs +341 -0
- package/templates/scripts/__tests__/memory-reachability.test.mjs +150 -0
- package/templates/scripts/__tests__/ring1-pib-error-surfacing.test.mjs +69 -0
- package/templates/scripts/__tests__/ring1-stale-open-counts.test.mjs +143 -0
- package/templates/scripts/__tests__/ring3-thread-capture.test.mjs +213 -0
- package/templates/scripts/__tests__/watchtower-status-ring4.test.mjs +89 -0
- package/templates/scripts/audit-coherence-check.mjs +123 -0
- package/templates/scripts/audit-synth.mjs +117 -0
- package/templates/scripts/merge-findings.js +4 -1
- package/templates/scripts/patterns-scope-check.mjs +122 -0
- package/templates/scripts/pib-db-lib.mjs +61 -11
- package/templates/scripts/pib-db-mcp-server.mjs +2 -1
- package/templates/scripts/pib-db.mjs +2 -1
- package/templates/scripts/review-server.mjs +7 -12
- package/templates/scripts/triage-server.mjs +7 -8
- package/templates/scripts/watchtower-cross-ring-reader.mjs +20 -6
- package/templates/scripts/watchtower-inbox-assessment.mjs +706 -0
- package/templates/scripts/watchtower-lib.mjs +282 -4
- package/templates/scripts/watchtower-ring1.mjs +78 -38
- package/templates/scripts/watchtower-ring2.mjs +38 -12
- package/templates/scripts/watchtower-ring3-close.mjs +160 -21
- package/templates/scripts/watchtower-status.sh +17 -0
- package/templates/scripts/work-tracker-server.mjs +26 -22
- package/templates/skills/audit/SKILL.md +18 -5
- package/templates/skills/audit/phases/structural-checks.md +22 -0
- package/templates/skills/briefing/SKILL.md +8 -0
- package/templates/skills/cabinet-accessibility/SKILL.md +1 -1
- package/templates/skills/cc-publish/SKILL.md +41 -7
- package/templates/skills/debrief/phases/audit-pattern-capture.md +13 -0
- package/templates/skills/inbox/SKILL.md +95 -5
- package/templates/skills/orient/SKILL.md +4 -0
- package/templates/skills/pulse/SKILL.md +10 -8
- package/templates/skills/spring-clean/SKILL.md +1 -1
- package/templates/skills/spring-clean/phases/execute-decisions.md +1 -1
- package/templates/skills/validate/phases/validators.md +86 -0
- package/templates/skills/watchtower/SKILL.md +18 -26
- package/templates/workflows/deliberative-audit.js +258 -87
- package/templates/workflows/execute-group-complete.js +16 -2
- package/templates/workflows/execute-group-implement.js +16 -2
package/README.md
CHANGED
|
@@ -227,6 +227,7 @@ customization. You can pass multiple modules: `--modules verify,audit`.
|
|
|
227
227
|
| **engagement-server** | Central multi-engagement API server (Railway/Fly deploy) |
|
|
228
228
|
| **watchtower** | Continuous background state management replacing orient/debrief |
|
|
229
229
|
| **mux** | Multi-project terminal manager — desks, auto-worktrees with shared identity, trail logging, DX captures, portal color-switching, durable tmux bindings, clipboard copy with hard-wrap removal, screenshot-to-clipboard launchd watcher |
|
|
230
|
+
| **bash-compress** | PostToolUse hook that compresses noisy Bash stdout (git status walls, npm/yarn install output) to reclaim context in long sessions; stderr and error lines pass through verbatim, fail-open |
|
|
230
231
|
|
|
231
232
|
## CLI Options
|
|
232
233
|
|
package/lib/CLAUDE.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# `lib/` — Installer Internals (detailed reference)
|
|
2
|
+
|
|
3
|
+
This is the on-demand detail tier for `lib/`. Root `CLAUDE.md` § Key Files
|
|
4
|
+
carries the one-line current contract for each file; this file carries the
|
|
5
|
+
full per-file contract **and** the layered `act:`-by-`act:` evolution history.
|
|
6
|
+
Read this when working in `lib/`; skim root `CLAUDE.md` otherwise.
|
|
7
|
+
|
|
8
|
+
`lib/` is the installer core plus one setup engine per heavier subsystem.
|
|
9
|
+
No build step; CommonJS.
|
|
10
|
+
|
|
11
|
+
## Installer core
|
|
12
|
+
|
|
13
|
+
- `lib/cli.js` — main orchestration and all CLI logic. The `MODULES`
|
|
14
|
+
registry MOVED to `lib/modules.js` (act:e82baead, architecture-0005);
|
|
15
|
+
`cli.js` re-exports it for back-compat (`require('../lib/cli').MODULES`
|
|
16
|
+
still works). `cli.js` keeps orchestration, arg parsing, the postInstall
|
|
17
|
+
pipeline, and generators.
|
|
18
|
+
The `--reindex` flag (act:98d41fa2) regenerates
|
|
19
|
+
`.claude/skills/_index.json` in place and exits (no install body, no
|
|
20
|
+
global side effects; no-op without `.claude/skills/`) — so a consumer
|
|
21
|
+
editing its `directives-project.yaml` overlay (a new session-close
|
|
22
|
+
mandate or routine, both read from `_index.json`) can pick it up
|
|
23
|
+
without a full reinstall. `generateSkillIndex` is exported.
|
|
24
|
+
The `--freeze`/`--unfreeze`/`--list-frozen` flags (act:c1013967) edit
|
|
25
|
+
`.ccrc.json` `frozenModules` and exit; the install body then expands
|
|
26
|
+
the declared list by its `requires` closure (`expandFrozenClosure` —
|
|
27
|
+
freezing engagement also pins work-tracking), intersects with what's
|
|
28
|
+
actually installed (`effectiveFrozen` — never the raw declared list),
|
|
29
|
+
and HOLDS those modules' CC-owned files at the current version (loud
|
|
30
|
+
per-module frozen report; an auto pib.db backup runs first when a
|
|
31
|
+
frozen install still has a pending schema migration). The
|
|
32
|
+
upstream-cleanup classifier is extracted to a pure `computeRemovals`;
|
|
33
|
+
it, `expandFrozenClosure`, and the hoisted top-level `manifestPath`
|
|
34
|
+
are exported + unit-tested. `generateAgentWrappers()` (see root
|
|
35
|
+
§ Generated artifacts) also lives here.
|
|
36
|
+
- `lib/modules.js` — the `MODULES` manifest: every module → the template
|
|
37
|
+
paths it copies into `.claude/` (architecture-0005; extracted from
|
|
38
|
+
`cli.js` in act:e82baead). `cli.js` requires + re-exports it for
|
|
39
|
+
back-compat. This is the SINGLE source for "which files does module X
|
|
40
|
+
ship" — the module template arrays that older docs said "live in
|
|
41
|
+
`lib/cli.js`" now live here. Exports `{ MODULES }`. Unit-tested that
|
|
42
|
+
each module ships its declared scripts (e.g. the audit module ships
|
|
43
|
+
`patterns-scope-check.mjs`).
|
|
44
|
+
- `lib/installer-gate.js` — shared version/hash gating for the setup
|
|
45
|
+
engines (Wave 1, act:a6377c82). Exports `sha256`, `compareVersions`,
|
|
46
|
+
`hashSourceDir`, `tarballIsStale`. Before it, `sha256()` was
|
|
47
|
+
copy-pasted three times and `compareVersions()` twice, and the
|
|
48
|
+
equal-version "don't hard-skip, fall through to a per-file hash-compare"
|
|
49
|
+
rule was re-implemented per installer. Per-file-manifest installers
|
|
50
|
+
(mux, watchtower, engagement-server) use `sha256` + `compareVersions`;
|
|
51
|
+
versioned-tarball installers (verify, site-audit) use `tarballIsStale`
|
|
52
|
+
+ `hashSourceDir` for the equal-version source-hash re-pack. All five
|
|
53
|
+
setup engines delegate here.
|
|
54
|
+
- `lib/copy.js` — template copying with conflict detection; exports
|
|
55
|
+
`recordSkip()`, the single skip-ownership helper used by every skip
|
|
56
|
+
site in both `lib/cli.js` and `lib/copy.js` (skipped project-created
|
|
57
|
+
files are omitted from the `.ccrc.json` manifest — omission means
|
|
58
|
+
"not ours", so a reinstall can't claim them). Also exports
|
|
59
|
+
`isProjectOwnedSeed()` (act:2001bf54): the basename rule for files
|
|
60
|
+
shipped as STARTER content but PROJECT-OWNED by declaration the moment
|
|
61
|
+
they land — today `directives-project.yaml`. The installer seeds them
|
|
62
|
+
if absent, NEVER overwrites them, and ALWAYS omits them from the
|
|
63
|
+
manifest (a recorded seed false-blocks the very first edit via
|
|
64
|
+
cc-upstream-guard and a `--yes` reinstall would clobber it). The
|
|
65
|
+
cli.js upstream-cleanup loop exempts these too — dropping the key
|
|
66
|
+
means "project-owned", NOT "removed upstream", so the freeing
|
|
67
|
+
reinstall can't delete the consumer's overlay. Also exports
|
|
68
|
+
`classifyFileOwnership()` (Wave 1, act:a6377c82): the single-file
|
|
69
|
+
ownership cascade used by cli.js's single-file branch — it closes the
|
|
70
|
+
missing `isProjectOwnedSeed` guard on that path, so a project-owned
|
|
71
|
+
seed reached via the single-file route is classified the same as via
|
|
72
|
+
the directory walk. Also exports `freezeRetain()` (act:c1013967): the
|
|
73
|
+
canonical FREEZE rule — a THIRD ownership state between CC-owned and
|
|
74
|
+
project-owned. When a module is frozen (`.ccrc.json` `frozenModules`,
|
|
75
|
+
threaded as `copyTemplates({frozen})`), a differing CC-managed file is
|
|
76
|
+
HELD instead of overwritten: an ALREADY-CC-owned file (in the prior
|
|
77
|
+
manifest) is RETAINED in the new manifest at its ON-DISK hash (keeps
|
|
78
|
+
cc-drift-check/reset green and the cleanup loop from deleting it, while
|
|
79
|
+
cc-upstream-guard keeps it edit-blocked), recorded in `results.frozen[]`;
|
|
80
|
+
a project-owned file FALLS THROUGH to skip-and-omit (retaining it would
|
|
81
|
+
adopt + clobber it on unfreeze). A held-back NEW file in a frozen module
|
|
82
|
+
is reported but gets no manifest entry (no on-disk content to hash).
|
|
83
|
+
Single source of truth for the rule across both copy paths (the
|
|
84
|
+
directory walk and cli.js's single-file branch). 23 tests in `test/freeze/`.
|
|
85
|
+
- `lib/metadata.js` — `.ccrc.json` read/write/merge/create. `create()`
|
|
86
|
+
accepts + persists `dbSchemaVersion` (top-level field, set only when a
|
|
87
|
+
real version is confirmed — undefined rides the prior value through via
|
|
88
|
+
`...existing`); `lib/cli.js` threads `setupDb`'s returned `schemaVersion`
|
|
89
|
+
into it. Also exposes `readFrozenModules`/`setFrozenModules`
|
|
90
|
+
(act:c1013967): the `.ccrc.json` `frozenModules` accessors for the
|
|
91
|
+
freeze-module mechanism (a non-array reads as empty — shape-drift
|
|
92
|
+
defensive; `create()` preserves the field via `...existing`).
|
|
93
|
+
`normalize()` guards shape drift (non-object top level reads as
|
|
94
|
+
'no metadata').
|
|
95
|
+
- `lib/settings-merge.js` — merges CC hooks into `.claude/settings.json`.
|
|
96
|
+
CC-owned hook commands ship with a `$CLAUDE_PROJECT_DIR/` prefix so they
|
|
97
|
+
resolve from any cwd (a bare-relative `.claude/hooks/X.sh` breaks when a
|
|
98
|
+
hook fires from a non-root directory; commit 81693f8). A reinstall
|
|
99
|
+
migration REPLACES (not duplicates) any superseded bare-relative form
|
|
100
|
+
with the prefixed one — `bareForm()` derives the legacy spelling,
|
|
101
|
+
`dropHookCommands()` removes it, then the prefixed form is added;
|
|
102
|
+
exact-match on CC-owned command strings only, so consumer-custom hooks
|
|
103
|
+
are never touched. `mergeSettings` ALSO migrates the stale pib action
|
|
104
|
+
gate matchers to their `mcp__pib-db__*` MCP tool-name form (act:ff693d4c —
|
|
105
|
+
the old bare matchers never matched the real MCP tool names, so the
|
|
106
|
+
gates were dead since shipping); the fired-at-least-once telemetry record
|
|
107
|
+
in `.claude/state/hooks-fired.jsonl` is written by the gate SCRIPTS
|
|
108
|
+
themselves (`action-quality-gate.sh`, `action-completion-gate.sh`), NOT by
|
|
109
|
+
settings-merge. Also heals `~/.claude/settings.json` by
|
|
110
|
+
stripping CC hook entries with project-relative paths (runs
|
|
111
|
+
unconditionally on every install). Exports `mergeBashCompressHooks()`
|
|
112
|
+
for the opt-in bash-compress module; `mergeSkillOverrides()` — the
|
|
113
|
+
installer sets the 34 cabinet-* skills to `skillOverrides: name-only`
|
|
114
|
+
so their long descriptions don't overflow the skill-listing budget
|
|
115
|
+
(act:bee0fa16); and `mergeCcDevHooks()` + `CC_DEV_HOOKS` — the
|
|
116
|
+
repo-local `node --check` PostToolUse dev hook
|
|
117
|
+
(`$CLAUDE_PROJECT_DIR/scripts/node-check-hook.sh`), gated on
|
|
118
|
+
package.json name === `create-claude-cabinet` so it installs only in
|
|
119
|
+
the source repo, never in consumers (act:ff693d4c). 10 tests in
|
|
120
|
+
`test/settings-merge/settings-merge.test.js`.
|
|
121
|
+
- `lib/reset.js` — manifest-safe uninstall/removal. Exports `reset()`:
|
|
122
|
+
removes CC-managed files per the `.ccrc.json` manifest and strips
|
|
123
|
+
CC-managed hook entries from `.claude/settings.json` (matched against
|
|
124
|
+
`CC_HOOK_PATTERNS` / `DEFAULT_HOOKS`), never touching project-owned files.
|
|
125
|
+
|
|
126
|
+
## Work-tracking / DB
|
|
127
|
+
|
|
128
|
+
- `lib/db-setup.js` — pib-db init step (runs after the copy loop). Exports
|
|
129
|
+
the pure helpers `isAbiMismatch`, `readBundledSchemaVersion`,
|
|
130
|
+
`shouldSkipInit` plus `setupDb(projectDir, opts)` (injectable
|
|
131
|
+
`opts.exec`/`opts.log` for tests). `setupDb` returns `{results,
|
|
132
|
+
schemaVersion}` (a bare array before act:f5dab71f). LAZY-INIT: skips DB
|
|
133
|
+
init when the recorded `.ccrc.json` `dbSchemaVersion` already equals the
|
|
134
|
+
bundled `SCHEMA_VERSION` (read as TEXT from `pib-db-lib.mjs`, never
|
|
135
|
+
imported — so a no-migration reinstall never loads the native module).
|
|
136
|
+
SELF-HEALS a better-sqlite3 ABI mismatch (`npm rebuild` + retry once,
|
|
137
|
+
else one actionable line — never a throw or silent skip; act:e7c69b5c).
|
|
138
|
+
`schemaVersion` is null when init couldn't confirm a version, so the
|
|
139
|
+
caller never records a false 'schema current' claim. 10 tests in
|
|
140
|
+
`test/db-setup/db-setup.test.js`.
|
|
141
|
+
- `lib/engagement-setup.js` — extends the pib-db files with the engagement
|
|
142
|
+
schema when the engagement module is installed. Dispatched from cli.js's
|
|
143
|
+
postInstall pipeline. Two duties: (1) a marker-aware FILE OVERLAY —
|
|
144
|
+
copies the engagement-inclusive pib-db files over the base versions,
|
|
145
|
+
deciding by whether the installed file already contains engagement code
|
|
146
|
+
(not just its `SCHEMA_VERSION` number), so an equal-version reinstall
|
|
147
|
+
still upgrades a base→engagement file; (2) a postInstall schema-ensure.
|
|
148
|
+
Exports `setupEngagement()`.
|
|
149
|
+
|
|
150
|
+
## Project identity
|
|
151
|
+
|
|
152
|
+
- `lib/project-context.js` — a THIN RE-EXPORT of
|
|
153
|
+
`templates/scripts/project-context.cjs` (Wave 1, act:a6377c82). The
|
|
154
|
+
logic lives in the template copy (co-located with the memory scripts,
|
|
155
|
+
which `require` it as a sibling; consumers have no `lib/`); this file
|
|
156
|
+
re-exports it so CC-source-repo callers (`lib/` code and the
|
|
157
|
+
memory/orient SKILL.md best-effort `require('./lib/project-context')`)
|
|
158
|
+
resolve the exact same implementation. Collapsed the byte-identical
|
|
159
|
+
twins that had already drifted once ("one concept, one place").
|
|
160
|
+
|
|
161
|
+
## Setup engines (per opt-in module)
|
|
162
|
+
|
|
163
|
+
- `lib/verify-setup.js` — cabinet-verify runtime installer (creates
|
|
164
|
+
`~/.claude-cabinet/verify/<version>/dist/cabinet-verify-<version>.tgz`
|
|
165
|
+
via `npm pack`; writes `~/.claude-cabinet/verify/current/VERSION`
|
|
166
|
+
pointer; equal-version source-hash re-pack via `installer-gate.js`).
|
|
167
|
+
- `lib/site-audit-setup.js` — site-audit runtime installer (mirrors
|
|
168
|
+
verify-setup; packs `templates/site-audit-runtime/` to
|
|
169
|
+
`~/.claude-cabinet/site-audit/<version>/`; equal-version source-hash
|
|
170
|
+
re-pack via `installer-gate.js`).
|
|
171
|
+
- `lib/engagement-server-setup.js` — engagement-server runtime installer
|
|
172
|
+
(copies server files to `~/.claude-cabinet/engagement-server/`;
|
|
173
|
+
follows mux-setup.js pattern with global manifest SHA256 tracking,
|
|
174
|
+
incl. the equal-version hash-compare fall-through of act:df1a1dc3 —
|
|
175
|
+
equal versions copy only changed files, `'unchanged'` when none do).
|
|
176
|
+
- `lib/mux-setup.js` — mux runtime installer (copies bin/mux, config
|
|
177
|
+
scripts, and popup to user-level paths; creates data dirs;
|
|
178
|
+
`setupDarwinIntegration()` appends source-file to `~/.tmux.conf`,
|
|
179
|
+
reloads live tmux, and writes/bootstraps the
|
|
180
|
+
`com.mux.screenshot-to-clipboard` launchd plist; migrates legacy
|
|
181
|
+
`com.orenmagid.*` agent). Version gate (act:df1a1dc3): equal
|
|
182
|
+
CC-vs-installed version does NOT early-return — it falls through to
|
|
183
|
+
the SHA256 manifest hash-compare and copies only changed files
|
|
184
|
+
(new `'unchanged'` status when nothing differs), so a
|
|
185
|
+
dogfood-from-source template edit without a version bump still
|
|
186
|
+
propagates on reinstall.
|
|
187
|
+
- `lib/watchtower-setup.js` — global watchtower runtime refresher
|
|
188
|
+
(`refreshWatchtowerRuntime`, act:2da80102). REFRESH-ONLY: content-hash
|
|
189
|
+
refreshes the EXISTING `~/.claude-cabinet/watchtower/` runtime
|
|
190
|
+
(scripts/ = all globbed `watchtower-*.mjs` + the shell runners,
|
|
191
|
+
hooks/ = the session hooks, cabinet/ = the two docs) on every
|
|
192
|
+
reinstall by comparing each template against the runtime file's ACTUAL
|
|
193
|
+
on-disk bytes — act:4e05ff53 SEVERED the old manifest-driven skip, so
|
|
194
|
+
the shared `global-manifest.json` SHA256 record is now bookkeeping only,
|
|
195
|
+
not the skip signal; a stale or hand-edited runtime file therefore
|
|
196
|
+
reconverges on the next reinstall (self-heal). Dests keyed by absolute
|
|
197
|
+
path so no collision with mux's entries. No-ops with status `'absent'`
|
|
198
|
+
and zero writes when no runtime exists yet — fresh setup (launchd/cron,
|
|
199
|
+
config.json, migrate-keys, coherence assertion) stays the
|
|
200
|
+
`/watchtower install` SKILL.md step's job. Wired in lib/cli.js after the
|
|
201
|
+
postInstall loop, gated on `selectedModules.includes('watchtower')`. 5
|
|
202
|
+
hermetic tests in `test/watchtower-runtime-refresh/`.
|
|
203
|
+
|
|
204
|
+
## Memory migration (one-time, off omega)
|
|
205
|
+
|
|
206
|
+
- `lib/migrate-from-omega.js` — one-time omega → built-in memory migration
|
|
207
|
+
engine (`--migrate-memory`): exports omega memories to Claude Code's
|
|
208
|
+
built-in memory layout (fresh-write or additive `omega-migrated/` merge
|
|
209
|
+
when native memory already exists), backs up first, then tears down
|
|
210
|
+
omega hooks/MCP. Never overwrites native files.
|
|
211
|
+
- `lib/migrate-memory-cmd.js` — CLI command wrapper for the migration
|
|
212
|
+
(`--migrate-memory`, `--dry-run`, `--unmigrate-memory` rollback).
|
|
213
|
+
- `lib/migration-snapshot.js` — captures pre-migration omega state to a
|
|
214
|
+
JSON snapshot so `--migrate-memory` can do DETERMINISTIC removal of
|
|
215
|
+
hooks / MCP entries / the OMEGA block (match against captured contents,
|
|
216
|
+
not pattern-guess against live state). Searches all three MCP config
|
|
217
|
+
locations and matches omega by command path (contains `omega-venv`)
|
|
218
|
+
rather than key name.
|