@mmnto/cli 1.50.0 → 1.52.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.
Files changed (34) hide show
  1. package/dist/commands/eject.d.ts.map +1 -1
  2. package/dist/commands/eject.js +12 -4
  3. package/dist/commands/eject.js.map +1 -1
  4. package/dist/commands/gate-install.d.ts +59 -0
  5. package/dist/commands/gate-install.d.ts.map +1 -0
  6. package/dist/commands/gate-install.js +111 -0
  7. package/dist/commands/gate-install.js.map +1 -0
  8. package/dist/commands/gate-install.test.d.ts +2 -0
  9. package/dist/commands/gate-install.test.d.ts.map +1 -0
  10. package/dist/commands/gate-install.test.js +472 -0
  11. package/dist/commands/gate-install.test.js.map +1 -0
  12. package/dist/commands/gate.d.ts +47 -0
  13. package/dist/commands/gate.d.ts.map +1 -0
  14. package/dist/commands/gate.js +102 -0
  15. package/dist/commands/gate.js.map +1 -0
  16. package/dist/commands/gate.test.d.ts +2 -0
  17. package/dist/commands/gate.test.d.ts.map +1 -0
  18. package/dist/commands/gate.test.js +104 -0
  19. package/dist/commands/gate.test.js.map +1 -0
  20. package/dist/commands/host-hooks.d.ts +745 -0
  21. package/dist/commands/host-hooks.d.ts.map +1 -0
  22. package/dist/commands/host-hooks.js +229 -0
  23. package/dist/commands/host-hooks.js.map +1 -0
  24. package/dist/commands/init-templates.d.ts +8 -0
  25. package/dist/commands/init-templates.d.ts.map +1 -1
  26. package/dist/commands/init-templates.js +240 -0
  27. package/dist/commands/init-templates.js.map +1 -1
  28. package/dist/commands/init.d.ts +6 -4
  29. package/dist/commands/init.d.ts.map +1 -1
  30. package/dist/commands/init.js +81 -94
  31. package/dist/commands/init.js.map +1 -1
  32. package/dist/index.js +39 -0
  33. package/dist/index.js.map +1 -1
  34. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-hooks.d.ts","sourceRoot":"","sources":["../../src/commands/host-hooks.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE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nD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,cAAc,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAgED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,aAAa,EACpB,gBAAgB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,GACpD,eAAe,CAgCjB;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,aAAa,EAC3B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACvC,iBAAiB,CAsEnB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,KAAK,OAAO,GAC3D,OAAO,CAKT"}
@@ -0,0 +1,229 @@
1
+ // ─── Host-hook settings-merge primitive (namespace-neutral) ──────────
2
+ //
3
+ // The single source of truth for idempotently merging ONE hook entry into a
4
+ // Claude settings JSON file (`settings.local.json` or committed
5
+ // `settings.json`) under `hooks.<key>`. Extracted from init.ts (PR-C,
6
+ // mmnto-ai/totem#2048) so `gate install`, `init --gates=`, and later
7
+ // Prop 257 / mmnto-ai/totem-strategy#448 share one merger — the
8
+ // "namespace-neutral install primitive" strategy-claude's T0225Z asked for.
9
+ //
10
+ // Deliberately NOT a vendor-neutral `installHostHook(vendor)` abstraction
11
+ // (YAGNI per ADR-109: the gate floor is Claude/PreToolUse-portability-
12
+ // conditional; no Gemini gate consumer exists — Gemini uses a separate
13
+ // whole-file scaffold path).
14
+ import * as fs from 'node:fs';
15
+ import * as path from 'node:path';
16
+ import { z } from 'zod';
17
+ // Zod schema for the subset of a Claude settings JSON file that we validate.
18
+ // `.passthrough()` everywhere preserves unknown keys across read/write so the
19
+ // merge never drops user-defined config it does not understand.
20
+ export const HookCommandSchema = z.union([
21
+ z.string(),
22
+ z.object({ type: z.string(), command: z.string() }).passthrough(),
23
+ ]);
24
+ const PreToolUseEntrySchema = z
25
+ .object({
26
+ matcher: z.string().optional(),
27
+ hooks: z.array(HookCommandSchema).optional(),
28
+ })
29
+ .passthrough();
30
+ const SessionStartEntrySchema = z
31
+ .object({
32
+ // SessionStart entries do NOT carry a `matcher` field (unlike
33
+ // PreToolUse entries). Adding it here would silently drop unknown
34
+ // shapes; passthrough preserves any future fields without breaking
35
+ // round-trip read/write.
36
+ hooks: z.array(HookCommandSchema).optional(),
37
+ })
38
+ .passthrough();
39
+ export const ClaudeSettingsSchema = z
40
+ .object({
41
+ hooks: z
42
+ .object({
43
+ PreToolUse: z.array(PreToolUseEntrySchema).optional(),
44
+ SessionStart: z.array(SessionStartEntrySchema).optional(),
45
+ })
46
+ .passthrough()
47
+ .optional(),
48
+ })
49
+ .passthrough();
50
+ /**
51
+ * Shared read step for the settings-merge family: ensure the parent dir
52
+ * exists, then (if the file is present) read → JSON.parse → safeParse against
53
+ * `ClaudeSettingsSchema`. Extracted so `mergeClaudeHooksKey` (append) and
54
+ * `upsertClaudeHookCommand` (in-place update) share ONE read+validate path
55
+ * without either re-implementing it. Behavior is byte-identical to the inline
56
+ * version `mergeClaudeHooksKey` carried before: same dir-create, same
57
+ * invalid-JSON throw, same shape-error message.
58
+ */
59
+ function readAndParseSettings(filePath) {
60
+ const dir = path.dirname(filePath);
61
+ if (!fs.existsSync(dir)) {
62
+ fs.mkdirSync(dir, { recursive: true });
63
+ }
64
+ if (!fs.existsSync(filePath)) {
65
+ return { kind: 'absent' };
66
+ }
67
+ const fileName = path.basename(filePath);
68
+ const raw = fs.readFileSync(filePath, 'utf-8');
69
+ let rawParsed;
70
+ try {
71
+ rawParsed = JSON.parse(raw);
72
+ }
73
+ catch (err) {
74
+ throw new Error(`[Totem Error] Could not parse ${fileName} (invalid JSON)`, {
75
+ cause: err instanceof Error ? err : new Error(String(err)),
76
+ });
77
+ }
78
+ const result = ClaudeSettingsSchema.safeParse(rawParsed);
79
+ if (!result.success) {
80
+ const detail = result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ');
81
+ // Prefix not added here — call site (initCommand) emits via
82
+ // log.error('Totem Error', ...) which adds the prefix automatically.
83
+ return {
84
+ kind: 'shape-error',
85
+ err: `Could not merge config: ${fileName} has unexpected shape: ${detail}`,
86
+ };
87
+ }
88
+ return { kind: 'parsed', parsed: result.data };
89
+ }
90
+ /**
91
+ * Shared merge logic for installing a single hook entry into a Claude
92
+ * settings JSON file (`settings.local.json` or `settings.json`) under
93
+ * `hooks.<key>`. Both `PreToolUse` and `SessionStart` lifecycles share
94
+ * the same read → safeparse → idempotency probe → append → write shape;
95
+ * this is the single source of truth.
96
+ *
97
+ * Idempotent: returns `'skipped'` if `alreadyInstalled(parsed)` is true.
98
+ */
99
+ export function mergeClaudeHooksKey(filePath, hookKind, entry, alreadyInstalled) {
100
+ try {
101
+ const read = readAndParseSettings(filePath);
102
+ if (read.kind === 'absent') {
103
+ const fullConfig = { hooks: { [hookKind]: [entry] } };
104
+ fs.writeFileSync(filePath, JSON.stringify(fullConfig, null, 2) + '\n', 'utf-8');
105
+ return { action: 'created' };
106
+ }
107
+ if (read.kind === 'shape-error') {
108
+ return { action: 'skipped', err: read.err };
109
+ }
110
+ const parsed = read.parsed;
111
+ if (alreadyInstalled(parsed)) {
112
+ return { action: 'skipped' };
113
+ }
114
+ const existing = parsed.hooks?.[hookKind] ?? [];
115
+ const hooks = parsed.hooks ?? {};
116
+ hooks[hookKind] = [...existing, entry];
117
+ parsed.hooks = hooks;
118
+ fs.writeFileSync(filePath, JSON.stringify(parsed, null, 2) + '\n', 'utf-8');
119
+ return { action: 'merged' };
120
+ // totem-context: intentional — mergeClaudeHooksKey is a Result-returning installer; failures are reported to the caller via ScaffoldOutcome.err (surfaced by initCommand's log.error), never silently swallowed. Rethrowing would break the callers that branch on { action, err }, so Tenet 4 is satisfied by reporting the failure, not by throwing.
121
+ }
122
+ catch (err) {
123
+ const message = err instanceof Error ? err.message : String(err);
124
+ return {
125
+ action: 'skipped',
126
+ err: message.startsWith('[Totem Error]') ? message : `[Totem Error] ${message}`,
127
+ };
128
+ }
129
+ }
130
+ /**
131
+ * Tier-AWARE upsert of a single `PreToolUse` command into a Claude settings
132
+ * JSON file under `hooks.PreToolUse`. Unlike `mergeClaudeHooksKey` (which only
133
+ * ever appends or no-ops), this guarantees AT MOST ONE entry can match
134
+ * `(matcher, identifies)` and rewrites that entry's command in place when it
135
+ * differs from `desiredEntry`'s command — so re-installing the same gate at a
136
+ * different tier flips the baked command rather than silently no-opping or
137
+ * duplicating the entry.
138
+ *
139
+ * `identifies(command)` decides whether an existing hook command is "the same
140
+ * gate" (tier-INDEPENDENT). `desiredEntry` carries the canonical
141
+ * matcher + the single hook whose `command` is the tier-correct target.
142
+ *
143
+ * Cases:
144
+ * 1. no existing match → append `desiredEntry` → `merged` (or
145
+ * `created` if the file did not exist)
146
+ * 2. match, same command → no write → `skipped`
147
+ * 3. match, different command → rewrite that hook's command → `updated`
148
+ *
149
+ * Result-returning (never throws past its own boundary), mirroring
150
+ * `mergeClaudeHooksKey`'s contract so callers branch on `{ action, err }`.
151
+ */
152
+ export function upsertClaudeHookCommand(filePath, matcher, desiredEntry, identifies) {
153
+ try {
154
+ const desiredCommand = desiredEntry.hooks[0]?.command;
155
+ if (typeof desiredCommand !== 'string') {
156
+ // Programmer error in the caller, not a user-file condition — fail loud.
157
+ throw new Error('[Totem Error] upsertClaudeHookCommand: desiredEntry has no command');
158
+ }
159
+ const read = readAndParseSettings(filePath);
160
+ if (read.kind === 'absent') {
161
+ const fullConfig = { hooks: { PreToolUse: [desiredEntry] } };
162
+ fs.writeFileSync(filePath, JSON.stringify(fullConfig, null, 2) + '\n', 'utf-8');
163
+ return { action: 'created' };
164
+ }
165
+ if (read.kind === 'shape-error') {
166
+ return { action: 'skipped', err: read.err };
167
+ }
168
+ const parsed = read.parsed;
169
+ const hooks = parsed.hooks ?? {};
170
+ const entries = parsed.hooks?.PreToolUse ?? [];
171
+ // Find the single existing hook (entry index + hook index) that installs
172
+ // this same gate under the gate matcher, tier-independently. This installer
173
+ // never CREATES a second matching entry (it updates in place or appends when
174
+ // none), so a file it produced has at most one match per gate. It does NOT
175
+ // dedupe PRE-EXISTING duplicates (e.g. a hand-edited config): it updates the
176
+ // first match and leaves any others as-is.
177
+ for (const entry of entries) {
178
+ if (entry.matcher !== matcher || !Array.isArray(entry.hooks)) {
179
+ continue;
180
+ }
181
+ for (const hook of entry.hooks) {
182
+ const cmd = typeof hook === 'string' ? hook : hook.command;
183
+ if (typeof cmd !== 'string' || !identifies(cmd)) {
184
+ continue;
185
+ }
186
+ // Case 2: already the desired command (same tier) → true no-op.
187
+ if (cmd === desiredCommand) {
188
+ return { action: 'skipped' };
189
+ }
190
+ // Case 3: same gate, different command (tier switch) → update in place.
191
+ // Object hooks are rewritten on `.command`; the degenerate
192
+ // string-hook shape is replaced with the canonical object hook.
193
+ if (typeof hook === 'string') {
194
+ const hookList = entry.hooks;
195
+ hookList[hookList.indexOf(hook)] = { type: 'command', command: desiredCommand };
196
+ }
197
+ else {
198
+ hook.command = desiredCommand;
199
+ }
200
+ parsed.hooks = hooks;
201
+ fs.writeFileSync(filePath, JSON.stringify(parsed, null, 2) + '\n', 'utf-8');
202
+ return { action: 'updated' };
203
+ }
204
+ }
205
+ // Case 1: no existing entry for this gate → append.
206
+ hooks.PreToolUse = [...entries, desiredEntry];
207
+ parsed.hooks = hooks;
208
+ fs.writeFileSync(filePath, JSON.stringify(parsed, null, 2) + '\n', 'utf-8');
209
+ return { action: 'merged' };
210
+ // totem-context: intentional — upsertClaudeHookCommand is a Result-returning installer; failures are reported to the caller via HookUpsertOutcome.err (surfaced by the gate install logger), never silently swallowed. Rethrowing would break callers that branch on { action, err }, so Tenet 4 is satisfied by reporting the failure.
211
+ }
212
+ catch (err) {
213
+ const message = err instanceof Error ? err.message : String(err);
214
+ return {
215
+ action: 'skipped',
216
+ err: message.startsWith('[Totem Error]') ? message : `[Totem Error] ${message}`,
217
+ };
218
+ }
219
+ }
220
+ /**
221
+ * True iff `parsed.hooks.PreToolUse` contains an entry under `matcher`
222
+ * whose hook list satisfies `probe`. The idempotency primitive both the
223
+ * shield-gate and gate-install installers key on.
224
+ */
225
+ export function preToolUseHasMatcher(parsed, matcher, probe) {
226
+ const preToolUse = parsed.hooks?.PreToolUse ?? [];
227
+ return preToolUse.some((h) => h.matcher === matcher && Array.isArray(h.hooks) && h.hooks.some(probe));
228
+ }
229
+ //# sourceMappingURL=host-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-hooks.js","sourceRoot":"","sources":["../../src/commands/host-hooks.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,gEAAgE;AAChE,sEAAsE;AACtE,qEAAqE;AACrE,gEAAgE;AAChE,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,uEAAuE;AACvE,6BAA6B;AAE7B,OAAO,KAAK,EAAE,MAAM,SAAS,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AC,CAAC,CAAC,iBAAiB,OAAO,EAAE;SAChF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAsB,EACtB,OAA0B,EAC1B,KAA4D;IAE5D,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,IAAI,EAAE,CAAC;IAClD,OAAO,UAAU,CAAC,IAAI,CACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAC9E,CAAC;AACJ,CAAC"}
@@ -35,6 +35,14 @@ export declare const CLAUDE_SESSION_START_ENTRY: {
35
35
  timeout: number;
36
36
  }[];
37
37
  };
38
+ export declare const CLAUDE_GATE_WRAPPER = "// [totem] auto-generated \u2014 Claude Code action-gate wrapper\n// ONE parameterized PreToolUse wrapper for the Totem gate engine (PR-C,\n// mmnto-ai/totem#2048). Reads --event <name> from argv (baked per-entry into\n// the installed command), reads the PreToolUse stdin envelope, shells to\n// `totem gate check`, and maps the GateVerdict disposition \u2192 host exit code.\n// `.cjs` extension because package.json may have \"type\": \"module\" \u2014 Claude\n// Code execs hooks via plain `node`, which would otherwise treat `.js` as ESM.\n//\n// Exit-code contract (LOAD-BEARING \u2014 ADR-109 \u00A72; branch ONLY on disposition):\n// 0 = allow | warn | --pilot deny | NOT-APPLICABLE fail-soft\n// (unparseable/non-object envelope, no-declared-subsystem pass-through)\n// 2 = deny (--strict, Claude block convention)\n// | APPLICABLE-gate-not-evaluable fail-closed (missing CLI, non-zero\n// `gate check`, unparseable verdict, or unknown disposition)\n'use strict';\n\nconst { spawnSync } = require('child_process');\nconst { existsSync } = require('fs');\nconst { join } = require('path');\n\n// \u2500\u2500\u2500 Parse baked args (--event <name>, optional --pilot / --strict) \u2500\u2500\u2500\u2500\u2500\n// The tier is read ONLY from argv (baked into the installed command at\n// install time). There is NO env-var override: env sourcing would be a\n// fail-open (any shell with TOTEM_GATE_TIER=pilot could silently downgrade\n// enforcement). Default (no flag) = strict, so a default install is\n// environment-immune; --pilot is an explicit install-time opt-in.\nconst argv = process.argv.slice(2);\nlet event = '';\nlet tier = 'strict';\nfor (let i = 0; i < argv.length; i++) {\n if (argv[i] === '--event') {\n event = argv[i + 1] || '';\n i++;\n } else if (argv[i] === '--pilot') {\n tier = 'pilot';\n } else if (argv[i] === '--strict') {\n tier = 'strict';\n }\n}\n\n// Read the PreToolUse stdin envelope.\nlet stdin = '';\nprocess.stdin.setEncoding('utf-8');\nprocess.stdin.on('data', (chunk) => {\n stdin += chunk;\n});\nprocess.stdin.on('end', () => {\n let parsed;\n try {\n parsed = stdin ? JSON.parse(stdin) : {};\n } catch (err) {\n // Fail-soft on a malformed envelope (mirror PreWriteShield): a broken\n // host envelope is not an applicable gate, so it must NOT block.\n process.stderr.write('[totem gate-wrapper] could not parse stdin JSON; allowing\\n');\n process.exit(0);\n }\n\n // Valid JSON can still be a non-object (the bytes `null`, `123`, or a bare\n // quoted string). Such an envelope carries no `tool_input` to dereference and\n // is NOT an applicable gate \u2192 fail-soft (exit 0). Guarding here also prevents\n // a TypeError-on-deref from leaking as exit 1.\n if (parsed === null || typeof parsed !== 'object') {\n process.stderr.write('[totem gate-wrapper] stdin JSON is not an object; allowing\\n');\n process.exit(0);\n }\n\n const input =\n typeof parsed.tool_input === 'object' && parsed.tool_input !== null ? parsed.tool_input : {};\n\n // \u2500\u2500\u2500 THE EMPTY-SUBSYSTEM GUARDRAIL \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // freeze-check's predicate is on a DECLARED subsystem. A normal Edit/Write\n // carries tool_input.file_path (a path), NOT a subsystem. With no declared\n // subsystem, NO GATE APPLIES \u2192 pass through (exit 0). Do NOT shell out \u2014 a\n // blanket fail-closed here would block every ordinary edit.\n const declaredSubsystem =\n typeof input.subsystem === 'string' && input.subsystem.trim() !== ''\n ? input.subsystem.trim()\n : '';\n if (declaredSubsystem === '') {\n process.exit(0);\n }\n\n // A gate genuinely applies. Build the --payload from the declared fields.\n // NOTE: this payload projection is freeze-check-shaped (subsystem-only). The\n // wrapper is --event-parameterized, but the payload it builds is currently\n // freeze-check-specific; a future gate needing a different payload field must\n // extend this projection (e.g. branch on `event`).\n const payload = JSON.stringify({ subsystem: declaredSubsystem });\n\n // Resolve the LOCAL Totem CLI (the global `totem` binary may be stale and\n // missing deps \u2014 the known repo gotcha). Invoke node on the installed dist\n // entry.\n //\n // FAIL-CLOSED on a missing CLI: we are PAST the empty-subsystem guardrail, so\n // a gate genuinely APPLIES here. freeze-check has NO commit-time hard floor\n // (unlike PreWriteShield, whose fail-soft is backed by `totem-lint` at\n // commit), so an APPLICABLE gate that cannot be evaluated for ANY reason\n // (missing CLI OR corrupt freeze.json) must fail closed \u2014 not silently allow\n // (guardrail rule + Tenet 4 fail-closed). Fail-SOFT (exit 0) is reserved for\n // genuinely NOT-APPLICABLE inputs (unparseable/non-object envelope, no\n // declared subsystem), all of which already returned above.\n const cliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');\n if (!existsSync(cliPath)) {\n process.stderr.write(\n '[totem gate] ' +\n event +\n ' applies but the totem CLI is not resolvable; failing closed. ' +\n 'Reinstall totem or run `totem eject` to remove the gate.\\n',\n );\n process.exit(2);\n }\n\n const result = spawnSync(\n process.execPath,\n [cliPath, 'gate', 'check', '--event', event, '--payload', payload],\n { encoding: 'utf-8', timeout: 30000 },\n );\n\n // \u2500\u2500\u2500 FAIL-CLOSED \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // A gate genuinely applies (a declared subsystem was present) and the\n // evaluation itself failed (non-zero exit: corrupt freeze.json, spawn\n // error, etc.). Never silently allow when an applicable gate's source is\n // broken \u2192 exit 2. (No-declared-subsystem already returned exit 0 above,\n // so this only blocks when a subsystem was actually declared.)\n if (result.error || typeof result.status !== 'number' || result.status !== 0) {\n process.stderr.write(\n '[totem gate-wrapper] gate \"' +\n event +\n '\" evaluation failed (source broken or unavailable) \u2014 blocking (fail-closed).\\n' +\n (result.stderr || (result.error ? String(result.error.message || result.error) : '')) +\n '\\n',\n );\n process.exit(2);\n }\n\n let verdict;\n try {\n verdict = JSON.parse(result.stdout || '');\n } catch (err) {\n // The command emitted unparseable stdout despite a 0 exit \u2014 an applicable\n // gate whose verdict we cannot read is a broken source \u2192 fail-closed.\n process.stderr.write(\n '[totem gate-wrapper] gate \"' + event + '\" emitted unparseable verdict \u2014 blocking (fail-closed).\\n',\n );\n process.exit(2);\n }\n\n // \u2500\u2500\u2500 Disposition \u2192 host exit code (branch ONLY on disposition) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const disposition = verdict && typeof verdict.disposition === 'string' ? verdict.disposition : '';\n // reason/provenance are OPAQUE stderr passthrough \u2014 never parsed for control flow.\n const detail =\n (verdict && verdict.reason ? verdict.reason : '') +\n (verdict && verdict.provenance ? ' [' + JSON.stringify(verdict.provenance) + ']' : '');\n\n if (disposition === 'allow') {\n process.exit(0);\n }\n if (disposition === 'warn') {\n process.stderr.write('[totem gate-wrapper] ' + event + ' (warn): ' + detail + '\\n');\n process.exit(0);\n }\n if (disposition === 'deny') {\n process.stderr.write('[totem gate-wrapper] ' + event + ' (deny): ' + detail + '\\n');\n process.exit(tier === 'pilot' ? 0 : 2);\n }\n\n // Unknown disposition from an applicable gate \u2014 fail-closed.\n process.stderr.write(\n '[totem gate-wrapper] gate \"' + event + '\" returned unknown disposition \"' + disposition + '\" \u2014 blocking (fail-closed).\\n',\n );\n process.exit(2);\n});\n";
39
+ export declare const CLAUDE_GATE_WRAPPER_ENTRY: {
40
+ matcher: string;
41
+ hooks: {
42
+ type: string;
43
+ command: string;
44
+ }[];
45
+ };
38
46
  export declare const SKILL_MARKER_START = "<!-- totem:skill-start -->";
39
47
  export declare const SKILL_MARKER_END = "<!-- totem:skill-end -->";
40
48
  export declare const SIGNOFF_SKILL_CONTENT: string;
@@ -1 +1 @@
1
- {"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMpE,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,UAAU,gCAAgC,CAAC;AACxD,eAAO,MAAM,iBAAiB,QAA0C,CAAC;AACzE,eAAO,MAAM,eAAe,6CAA6C,CAAC;AAE1E,eAAO,MAAM,eAAe,+qKA4C3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAgB7D,eAAO,MAAM,qBAAqB,6CAA6C,CAAC;AAIhF,eAAO,MAAM,oBAAoB,kwBAiBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAqD9B,CAAC;AAEF,eAAO,MAAM,YAAY,4hBAUxB,CAAC;AAIF,eAAO,MAAM,kBAAkB,waAY9B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;CAQnC,CAAC;AAkBF,eAAO,MAAM,qBAAqB,QA8EjC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;CAQvC,CAAC;AA4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,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhD"}
@@ -383,6 +383,246 @@ export const CLAUDE_SESSION_START_ENTRY = {
383
383
  },
384
384
  ],
385
385
  };
386
+ // ─── Claude Code action-gate wrapper (PR-C, mmnto-ai/totem#2048) ───────
387
+ //
388
+ // ONE parameterized PreToolUse wrapper that generalizes the shipped
389
+ // `review-gate.sh` content-hash pattern into a reusable form. It reads the
390
+ // PreToolUse stdin envelope, shells to `totem gate check --event <name>
391
+ // --payload <json>`, parses the emitted `GateVerdict`, and maps
392
+ // `disposition` → host exit code (ADR-109 §2). One wrapper, N gates: each
393
+ // installed PreToolUse entry points at this same script with a different
394
+ // `--event` arg baked into the `command` string, so new gates need no new
395
+ // CLI flag (the `knownGateEvents()` registry is the single source of truth).
396
+ //
397
+ // `.cjs` extension is load-bearing: `type: module` repos resolve `.js` as
398
+ // ESM and reject the CommonJS `require()` calls; Claude Code execs hooks via
399
+ // plain `node`.
400
+ //
401
+ // Disposition → exit code (ADR-109 §2, branch ONLY on disposition — R2):
402
+ // allow → exit 0 (silent)
403
+ // warn → exit 0 + reason/provenance to stderr (advisory; NEVER blocks)
404
+ // deny → reason/provenance to stderr; --strict (default) → exit 2
405
+ // (Claude block convention), --pilot → exit 0
406
+ //
407
+ // THE EMPTY-SUBSYSTEM GUARDRAIL (strategy-claude T0041Z — LOAD-BEARING):
408
+ // A normal Edit/Write carries `tool_input.file_path` (a PATH), NOT a
409
+ // declared `subsystem`. Path→subsystem mapping is deferred (ADR-109
410
+ // line 112), so an Edit has NO declared subsystem → NO GATE APPLIES →
411
+ // exit 0 (pass through). The wrapper must NOT invoke `gate check` for it.
412
+ // Handing freeze-check an empty subsystem throws GATE_INVALID; a blanket
413
+ // fail-closed would then block EVERY edit (a gate meant to deny ONE frozen
414
+ // subsystem denying ALL edits — Tenet 19 drift). Only when a declared
415
+ // subsystem IS present does the wrapper shell out; only then can a broken
416
+ // deterministic source (corrupt freeze.json) fail-close (exit 2).
417
+ //
418
+ // Tier (--strict default / --pilot) is read by the WRAPPER, not the engine
419
+ // (the engine stays pure per ADR-109 [LOCKED]; freeze-check never emits
420
+ // `warn`). The tier is BAKED into the installed command string at install
421
+ // time and read ONLY from argv — there is NO env-var override, so a default
422
+ // (`--strict`) install is enforcement-immune to a consumer's environment
423
+ // (env-var sourcing would be a fail-open: a `TOTEM_GATE_TIER=pilot` in any
424
+ // shell could silently downgrade every gate to advisory). Pilot is an
425
+ // explicit, install-time opt-in only.
426
+ // totem-context: hook script template content — child_process is part of the
427
+ // rendered .cjs payload that Claude Code execs via plain `node`, not a runtime
428
+ // call from this cli source. Same shape as CLAUDE_SESSION_START above.
429
+ export const CLAUDE_GATE_WRAPPER = `// [totem] auto-generated — Claude Code action-gate wrapper
430
+ // ONE parameterized PreToolUse wrapper for the Totem gate engine (PR-C,
431
+ // mmnto-ai/totem#2048). Reads --event <name> from argv (baked per-entry into
432
+ // the installed command), reads the PreToolUse stdin envelope, shells to
433
+ // \`totem gate check\`, and maps the GateVerdict disposition → host exit code.
434
+ // \`.cjs\` extension because package.json may have "type": "module" — Claude
435
+ // Code execs hooks via plain \`node\`, which would otherwise treat \`.js\` as ESM.
436
+ //
437
+ // Exit-code contract (LOAD-BEARING — ADR-109 §2; branch ONLY on disposition):
438
+ // 0 = allow | warn | --pilot deny | NOT-APPLICABLE fail-soft
439
+ // (unparseable/non-object envelope, no-declared-subsystem pass-through)
440
+ // 2 = deny (--strict, Claude block convention)
441
+ // | APPLICABLE-gate-not-evaluable fail-closed (missing CLI, non-zero
442
+ // \`gate check\`, unparseable verdict, or unknown disposition)
443
+ 'use strict';
444
+
445
+ const { spawnSync } = require('child_process');
446
+ const { existsSync } = require('fs');
447
+ const { join } = require('path');
448
+
449
+ // ─── Parse baked args (--event <name>, optional --pilot / --strict) ─────
450
+ // The tier is read ONLY from argv (baked into the installed command at
451
+ // install time). There is NO env-var override: env sourcing would be a
452
+ // fail-open (any shell with TOTEM_GATE_TIER=pilot could silently downgrade
453
+ // enforcement). Default (no flag) = strict, so a default install is
454
+ // environment-immune; --pilot is an explicit install-time opt-in.
455
+ const argv = process.argv.slice(2);
456
+ let event = '';
457
+ let tier = 'strict';
458
+ for (let i = 0; i < argv.length; i++) {
459
+ if (argv[i] === '--event') {
460
+ event = argv[i + 1] || '';
461
+ i++;
462
+ } else if (argv[i] === '--pilot') {
463
+ tier = 'pilot';
464
+ } else if (argv[i] === '--strict') {
465
+ tier = 'strict';
466
+ }
467
+ }
468
+
469
+ // Read the PreToolUse stdin envelope.
470
+ let stdin = '';
471
+ process.stdin.setEncoding('utf-8');
472
+ process.stdin.on('data', (chunk) => {
473
+ stdin += chunk;
474
+ });
475
+ process.stdin.on('end', () => {
476
+ let parsed;
477
+ try {
478
+ parsed = stdin ? JSON.parse(stdin) : {};
479
+ } catch (err) {
480
+ // Fail-soft on a malformed envelope (mirror PreWriteShield): a broken
481
+ // host envelope is not an applicable gate, so it must NOT block.
482
+ process.stderr.write('[totem gate-wrapper] could not parse stdin JSON; allowing\\n');
483
+ process.exit(0);
484
+ }
485
+
486
+ // Valid JSON can still be a non-object (the bytes \`null\`, \`123\`, or a bare
487
+ // quoted string). Such an envelope carries no \`tool_input\` to dereference and
488
+ // is NOT an applicable gate → fail-soft (exit 0). Guarding here also prevents
489
+ // a TypeError-on-deref from leaking as exit 1.
490
+ if (parsed === null || typeof parsed !== 'object') {
491
+ process.stderr.write('[totem gate-wrapper] stdin JSON is not an object; allowing\\n');
492
+ process.exit(0);
493
+ }
494
+
495
+ const input =
496
+ typeof parsed.tool_input === 'object' && parsed.tool_input !== null ? parsed.tool_input : {};
497
+
498
+ // ─── THE EMPTY-SUBSYSTEM GUARDRAIL ────────────────────────────────────
499
+ // freeze-check's predicate is on a DECLARED subsystem. A normal Edit/Write
500
+ // carries tool_input.file_path (a path), NOT a subsystem. With no declared
501
+ // subsystem, NO GATE APPLIES → pass through (exit 0). Do NOT shell out — a
502
+ // blanket fail-closed here would block every ordinary edit.
503
+ const declaredSubsystem =
504
+ typeof input.subsystem === 'string' && input.subsystem.trim() !== ''
505
+ ? input.subsystem.trim()
506
+ : '';
507
+ if (declaredSubsystem === '') {
508
+ process.exit(0);
509
+ }
510
+
511
+ // A gate genuinely applies. Build the --payload from the declared fields.
512
+ // NOTE: this payload projection is freeze-check-shaped (subsystem-only). The
513
+ // wrapper is --event-parameterized, but the payload it builds is currently
514
+ // freeze-check-specific; a future gate needing a different payload field must
515
+ // extend this projection (e.g. branch on \`event\`).
516
+ const payload = JSON.stringify({ subsystem: declaredSubsystem });
517
+
518
+ // Resolve the LOCAL Totem CLI (the global \`totem\` binary may be stale and
519
+ // missing deps — the known repo gotcha). Invoke node on the installed dist
520
+ // entry.
521
+ //
522
+ // FAIL-CLOSED on a missing CLI: we are PAST the empty-subsystem guardrail, so
523
+ // a gate genuinely APPLIES here. freeze-check has NO commit-time hard floor
524
+ // (unlike PreWriteShield, whose fail-soft is backed by \`totem-lint\` at
525
+ // commit), so an APPLICABLE gate that cannot be evaluated for ANY reason
526
+ // (missing CLI OR corrupt freeze.json) must fail closed — not silently allow
527
+ // (guardrail rule + Tenet 4 fail-closed). Fail-SOFT (exit 0) is reserved for
528
+ // genuinely NOT-APPLICABLE inputs (unparseable/non-object envelope, no
529
+ // declared subsystem), all of which already returned above.
530
+ const cliPath = join(process.cwd(), 'node_modules', '@mmnto', 'cli', 'dist', 'index.js');
531
+ if (!existsSync(cliPath)) {
532
+ process.stderr.write(
533
+ '[totem gate] ' +
534
+ event +
535
+ ' applies but the totem CLI is not resolvable; failing closed. ' +
536
+ 'Reinstall totem or run \`totem eject\` to remove the gate.\\n',
537
+ );
538
+ process.exit(2);
539
+ }
540
+
541
+ const result = spawnSync(
542
+ process.execPath,
543
+ [cliPath, 'gate', 'check', '--event', event, '--payload', payload],
544
+ { encoding: 'utf-8', timeout: 30000 },
545
+ );
546
+
547
+ // ─── FAIL-CLOSED ──────────────────────────────────────────────────────
548
+ // A gate genuinely applies (a declared subsystem was present) and the
549
+ // evaluation itself failed (non-zero exit: corrupt freeze.json, spawn
550
+ // error, etc.). Never silently allow when an applicable gate's source is
551
+ // broken → exit 2. (No-declared-subsystem already returned exit 0 above,
552
+ // so this only blocks when a subsystem was actually declared.)
553
+ if (result.error || typeof result.status !== 'number' || result.status !== 0) {
554
+ process.stderr.write(
555
+ '[totem gate-wrapper] gate "' +
556
+ event +
557
+ '" evaluation failed (source broken or unavailable) — blocking (fail-closed).\\n' +
558
+ (result.stderr || (result.error ? String(result.error.message || result.error) : '')) +
559
+ '\\n',
560
+ );
561
+ process.exit(2);
562
+ }
563
+
564
+ let verdict;
565
+ try {
566
+ verdict = JSON.parse(result.stdout || '');
567
+ } catch (err) {
568
+ // The command emitted unparseable stdout despite a 0 exit — an applicable
569
+ // gate whose verdict we cannot read is a broken source → fail-closed.
570
+ process.stderr.write(
571
+ '[totem gate-wrapper] gate "' + event + '" emitted unparseable verdict — blocking (fail-closed).\\n',
572
+ );
573
+ process.exit(2);
574
+ }
575
+
576
+ // ─── Disposition → host exit code (branch ONLY on disposition) ─────────
577
+ const disposition = verdict && typeof verdict.disposition === 'string' ? verdict.disposition : '';
578
+ // reason/provenance are OPAQUE stderr passthrough — never parsed for control flow.
579
+ const detail =
580
+ (verdict && verdict.reason ? verdict.reason : '') +
581
+ (verdict && verdict.provenance ? ' [' + JSON.stringify(verdict.provenance) + ']' : '');
582
+
583
+ if (disposition === 'allow') {
584
+ process.exit(0);
585
+ }
586
+ if (disposition === 'warn') {
587
+ process.stderr.write('[totem gate-wrapper] ' + event + ' (warn): ' + detail + '\\n');
588
+ process.exit(0);
589
+ }
590
+ if (disposition === 'deny') {
591
+ process.stderr.write('[totem gate-wrapper] ' + event + ' (deny): ' + detail + '\\n');
592
+ process.exit(tier === 'pilot' ? 0 : 2);
593
+ }
594
+
595
+ // Unknown disposition from an applicable gate — fail-closed.
596
+ process.stderr.write(
597
+ '[totem gate-wrapper] gate "' + event + '" returned unknown disposition "' + disposition + '" — blocking (fail-closed).\\n',
598
+ );
599
+ process.exit(2);
600
+ });
601
+ `;
602
+ // The PreToolUse entry constant for the freeze-check gate. The \`--event\`
603
+ // is baked into the command string per-entry (one wrapper, N gates = N
604
+ // entries pointing at the same script with different --event args).
605
+ // Matches the \`Write|Edit\` matcher so the wrapper sees every write — the
606
+ // empty-subsystem guardrail (in the wrapper) is what keeps ordinary edits
607
+ // passing through. Installed into committed \`.claude/settings.json\`
608
+ // (team-level governance — gate opt-in is repo policy, Tenet 12).
609
+ //
610
+ // SOURCE OF TRUTH for the ACTUAL installed command is
611
+ // gate-install.ts \`gateCommand(event, tier)\` — it builds the per-gate,
612
+ // per-tier string at install time. This constant supplies ONLY the canonical
613
+ // \`matcher\` and hook \`type\` (the fields \`gateEntry()\` reads); its \`command\`
614
+ // here mirrors the DEFAULT install (freeze-check at the default \`--strict\`
615
+ // tier) so a reader sees exactly what a default \`totem gate install\` bakes,
616
+ // not a tier-less never-installed string.
617
+ export const CLAUDE_GATE_WRAPPER_ENTRY = {
618
+ matcher: 'Write|Edit',
619
+ hooks: [
620
+ {
621
+ type: 'command',
622
+ command: 'node .claude/hooks/gate-wrapper.cjs --event freeze-check --strict',
623
+ },
624
+ ],
625
+ };
386
626
  // ─── Claude Code skill distribution (mmnto-ai/totem#1890 Phase C slice 3) ───
387
627
  //
388
628
  // Skills are surfaced into consumer repos at `.claude/skills/<name>/SKILL.md`.
@@ -1 +1 @@
1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CAAC;QACJ,KAAK,MAAM;YACT,OAAO;gBACL,OAAO,EAAE,MAAM,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC;gBAC9D,QAAQ,EAAE,YAAY;aACvB,CAAC;QACJ;YACE,OAAO;gBACL,OAAO,EAAE,MAAM,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC;gBAC1D,QAAQ,EAAE,iBAAiB;aAC5B,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type ScaffoldOutcome } from './host-hooks.js';
1
2
  import { type Ecosystem } from './init-detect.js';
2
3
  export type { AiToolInfo, HookInstallerResult } from './init-detect.js';
3
4
  export { buildNpxCommand, detectEmbeddingTier } from './init-detect.js';
@@ -16,10 +17,6 @@ export declare function scaffoldFile(filePath: string, content: string, marker?:
16
17
  action: 'created' | 'exists' | 'skipped';
17
18
  err?: string;
18
19
  };
19
- type ScaffoldOutcome = {
20
- action: 'created' | 'merged' | 'skipped';
21
- err?: string;
22
- };
23
20
  /**
24
21
  * Merge Totem hooks into .claude/settings.local.json without overwriting
25
22
  * existing user-defined hooks. Installs the Bash matcher for shield-gate.
@@ -109,6 +106,11 @@ export declare function initCommand(options?: {
109
106
  * or pre-marker scaffold files; force-mode suppresses ONLY the no-marker
110
107
  * guard. Marker-bearing files refresh via the normal path regardless. */
111
108
  forceSkillRefresh?: boolean;
109
+ /** Install action-gate PreToolUse hooks (PR-C, mmnto-ai/totem#2048): a
110
+ * comma-list of gate names (validated against `knownGateEvents()`) or
111
+ * the literal `all`. Routes through the SAME `installGates` path the
112
+ * `gate install` verb uses — no second copy of the merge logic. */
113
+ gates?: string;
112
114
  /** Override home directory for testing. */
113
115
  _homeDir?: string;
114
116
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,kBAA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