@venizia/vulcan 0.4.9-0 → 0.4.9-2

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 (141) hide show
  1. package/base/extensions/vulcan-guards.ts +48 -41
  2. package/base/hooks/antigravity-guards.ts +2 -2
  3. package/base/hooks/codex-guards.ts +15 -5
  4. package/base/hooks/guard-git.ts +8 -8
  5. package/base/hooks/guard-manifest.ts +4 -5
  6. package/base/hooks/guard-outside.ts +8 -8
  7. package/base/hooks/guard-package.ts +5 -6
  8. package/base/hooks/guard-remote-hosts.ts +6 -7
  9. package/base/hooks/guard-scripting.ts +5 -6
  10. package/base/hooks/guard-writes.ts +8 -9
  11. package/base/hooks/post-tool.ts +2 -2
  12. package/base/hooks/prompt-submit.ts +2 -2
  13. package/base/hooks/session-start.ts +3 -3
  14. package/base/hooks/stop.ts +2 -2
  15. package/base/hooks/subagent-start.ts +2 -2
  16. package/base/skills/docs-update/SKILL.md +4 -2
  17. package/base/skills/visualize-work/SKILL.md +9 -0
  18. package/package.json +3 -3
  19. package/src/agents/atlas-block.ts +43 -43
  20. package/src/agents/codex-hooks.ts +45 -43
  21. package/src/agents/detect.ts +19 -16
  22. package/src/agents/exclude.ts +96 -97
  23. package/src/agents/hooks-json.ts +38 -36
  24. package/src/agents/local.ts +46 -43
  25. package/src/agents/prompt.ts +45 -42
  26. package/src/agents/render.ts +201 -195
  27. package/src/agents/resolve.ts +133 -134
  28. package/src/agents/table.ts +12 -8
  29. package/src/commands/add.command.ts +2 -2
  30. package/src/commands/agents.command.ts +11 -17
  31. package/src/commands/clean.command.ts +6 -6
  32. package/src/commands/doctor.command.ts +4 -4
  33. package/src/commands/init.command.ts +12 -8
  34. package/src/commands/preset.command.ts +2 -2
  35. package/src/commands/profile.command.ts +42 -49
  36. package/src/commands/sync.command.ts +109 -111
  37. package/src/commands/upgrade.command.ts +80 -75
  38. package/src/commands/visualize.command.ts +7 -13
  39. package/src/commands/x.command.ts +55 -50
  40. package/src/common/format.ts +23 -21
  41. package/src/common/json.ts +8 -5
  42. package/src/common/layout-folder.ts +94 -91
  43. package/src/common/paths.ts +14 -12
  44. package/src/config/loader.ts +52 -49
  45. package/src/config/packages.ts +14 -11
  46. package/src/config/schema.ts +3 -3
  47. package/src/create/add-app.ts +519 -509
  48. package/src/create/add-lib.ts +237 -240
  49. package/src/create/bunfig.ts +26 -23
  50. package/src/create/checks.ts +36 -34
  51. package/src/create/diff.ts +21 -23
  52. package/src/create/dockerignore.ts +26 -24
  53. package/src/create/files.ts +7 -5
  54. package/src/create/init-monorepo.ts +75 -80
  55. package/src/create/lib-preset.ts +59 -63
  56. package/src/create/manifest-json.ts +10 -4
  57. package/src/create/names.ts +217 -210
  58. package/src/create/next.ts +26 -23
  59. package/src/create/plan.ts +15 -12
  60. package/src/create/preset-diff.ts +301 -303
  61. package/src/create/preset-menu.ts +38 -32
  62. package/src/create/preset.ts +202 -197
  63. package/src/create/process.ts +79 -72
  64. package/src/create/scratch.ts +48 -49
  65. package/src/create/workspace.ts +404 -396
  66. package/src/doctor/checks.ts +1027 -1014
  67. package/src/doctor/makefile.ts +17 -13
  68. package/src/doctor/runner.ts +88 -118
  69. package/src/doctor/skills.ts +97 -95
  70. package/src/doctor/tags.ts +42 -37
  71. package/src/hooks/codex-patch.ts +25 -22
  72. package/src/hooks/command-view.ts +44 -39
  73. package/src/hooks/decision.ts +37 -37
  74. package/src/hooks/guard-git.ts +51 -49
  75. package/src/hooks/guard-manifest.ts +58 -55
  76. package/src/hooks/guard-outside.ts +93 -91
  77. package/src/hooks/guard-package.ts +82 -79
  78. package/src/hooks/guard-scripting.ts +19 -14
  79. package/src/hooks/guard-writes.ts +154 -149
  80. package/src/hooks/owner-reply.ts +127 -127
  81. package/src/hooks/post-tool.ts +94 -93
  82. package/src/hooks/project-guards.ts +65 -62
  83. package/src/hooks/project-tmp.ts +27 -24
  84. package/src/hooks/remote-hosts.ts +153 -130
  85. package/src/hooks/session-digest.ts +98 -101
  86. package/src/hooks/shell.ts +509 -499
  87. package/src/hooks/subagent-card.ts +11 -7
  88. package/src/hooks/trusted-scripts.ts +106 -104
  89. package/src/init/scaffold.ts +135 -132
  90. package/src/local/clean.ts +38 -36
  91. package/src/local/format.ts +21 -17
  92. package/src/local/scan.ts +144 -138
  93. package/src/manifest/render.ts +110 -104
  94. package/src/owner/card.ts +51 -46
  95. package/src/owner/profile.ts +99 -93
  96. package/src/owner/reply-switch.ts +9 -6
  97. package/src/owner/shape.ts +71 -69
  98. package/src/owner/survey.ts +173 -171
  99. package/src/owner/view.ts +62 -59
  100. package/src/owner/violations.ts +119 -123
  101. package/src/rules/base.ts +15 -11
  102. package/src/rules/parser.ts +39 -32
  103. package/src/rules/slots.ts +8 -6
  104. package/src/signals/claims.ts +30 -28
  105. package/src/signals/classify.ts +38 -33
  106. package/src/signals/loop.ts +39 -37
  107. package/src/signals/state.ts +79 -81
  108. package/src/skills/frontmatter.ts +28 -28
  109. package/src/sync/agent-files.ts +217 -199
  110. package/src/sync/agent-removal.ts +56 -59
  111. package/src/sync/atlas-block.ts +45 -43
  112. package/src/sync/base-rules.ts +32 -30
  113. package/src/sync/claude-launch.ts +36 -34
  114. package/src/sync/exclude.ts +77 -69
  115. package/src/sync/local-choice.ts +50 -47
  116. package/src/sync/planner.ts +59 -61
  117. package/src/sync/prune.ts +52 -48
  118. package/src/sync/settings.ts +166 -167
  119. package/src/ui/capability.ts +12 -7
  120. package/src/ui/keyboard.ts +38 -38
  121. package/src/ui/prompt.ts +79 -77
  122. package/src/visualize/assets.ts +33 -24
  123. package/src/visualize/charts.ts +179 -176
  124. package/src/visualize/compare-css.ts +3 -2
  125. package/src/visualize/compare-render.ts +9 -7
  126. package/src/visualize/diagrams.ts +189 -174
  127. package/src/visualize/grid-span.ts +34 -0
  128. package/src/visualize/icons.ts +7 -5
  129. package/src/visualize/kinds-render.ts +50 -45
  130. package/src/visualize/kinds-validate.ts +12 -10
  131. package/src/visualize/labels.ts +21 -17
  132. package/src/visualize/layout.ts +112 -97
  133. package/src/visualize/page.ts +92 -104
  134. package/src/visualize/render.ts +143 -140
  135. package/src/visualize/sections.ts +395 -384
  136. package/src/visualize/sources.ts +2 -2
  137. package/src/visualize/theme.ts +12 -10
  138. package/src/visualize/validate.ts +13 -9
  139. package/src/wiki/anchors.ts +38 -36
  140. package/src/wiki/command.ts +4 -4
  141. package/src/wiki/source-links.ts +46 -44
@@ -1,4 +1,4 @@
1
- import { basenameOf, parseShell, programOf, splitHeredocs } from './shell.ts';
1
+ import { ShellParser } from './shell.ts';
2
2
  import type { ISimpleCommand } from './shell.ts';
3
3
 
4
4
  /** Programs that only read or print what they are given: their arguments are text to find or show, never a command to run. */
@@ -65,7 +65,7 @@ const PIPED_INTO_RUNNER =
65
65
 
66
66
  /** Whether a `gh` command is a request: its subcommand (the first word that is not an option or an option's value) is one of `GH_REQUESTS`. */
67
67
  const isGhRequest = (opts: { command: ISimpleCommand }): boolean => {
68
- const { args } = programOf({ command: opts.command });
68
+ const { args } = ShellParser.programOf({ command: opts.command });
69
69
  const subcommand = args.find(
70
70
  (word, index) =>
71
71
  !word.startsWith('-') && !(index > 0 && GH_REPOSITORY_FLAGS.has(args[index - 1] ?? '')),
@@ -74,48 +74,53 @@ const isGhRequest = (opts: { command: ISimpleCommand }): boolean => {
74
74
  return subcommand !== undefined && GH_REQUESTS.has(subcommand);
75
75
  };
76
76
 
77
- /**
78
- * Whether the arguments of a command are data. `withMessages` adds `git` and `gh` (their arguments are
79
- * messages to the write guards, but a `git` remote is a host to the remote-host guard).
80
- */
81
- export const isDataOnly = (opts: { command: ISimpleCommand; withMessages: boolean }): boolean => {
82
- const name = basenameOf({ word: programOf({ command: opts.command }).name });
77
+ export class CommandView {
78
+ /** The texts of the simple commands: the words, a bare name for data, a reader's heredoc body appended. */
79
+ private static textsOf(opts: { command: string; withMessages: boolean }): string[] {
80
+ return ShellParser.parse({ command: opts.command }).map((command) => {
81
+ const name = ShellParser.basenameOf({ word: ShellParser.programOf({ command }).name });
83
82
 
84
- if (name === 'find') {
85
- return !opts.command.words.some((word) => FIND_RUNS.has(word));
86
- }
83
+ if (CommandView.isDataOnly({ command, withMessages: opts.withMessages })) {
84
+ return name;
85
+ }
87
86
 
88
- if (name === 'gh' && isGhRequest({ command: opts.command })) {
89
- return false;
90
- }
87
+ const body =
88
+ command.heredoc !== undefined && HEREDOC_READERS.has(name) ? `\n${command.heredoc}` : '';
91
89
 
92
- return READ_ONLY_PROGRAMS.has(name) || (opts.withMessages && MESSAGE_PROGRAMS.has(name));
93
- };
94
-
95
- /** The texts of the simple commands: the words, a bare name for data, a reader's heredoc body appended. */
96
- const textsOf = (opts: { command: string; withMessages: boolean }): string[] =>
97
- parseShell({ command: opts.command }).map((command) => {
98
- const name = basenameOf({ word: programOf({ command }).name });
90
+ return `${command.words.join(' ')}${body}`;
91
+ });
92
+ }
99
93
 
100
- if (isDataOnly({ command, withMessages: opts.withMessages })) {
101
- return name;
94
+ /**
95
+ * Whether the arguments of a command are data. `withMessages` adds `git` and `gh` (their arguments are
96
+ * messages to the write guards, but a `git` remote is a host to the remote-host guard).
97
+ */
98
+ static isDataOnly(opts: { command: ISimpleCommand; withMessages: boolean }): boolean {
99
+ const name = ShellParser.basenameOf({
100
+ word: ShellParser.programOf({ command: opts.command }).name,
101
+ });
102
+
103
+ if (name === 'find') {
104
+ return !opts.command.words.some((word) => FIND_RUNS.has(word));
102
105
  }
103
106
 
104
- const body =
105
- command.heredoc !== undefined && HEREDOC_READERS.has(name) ? `\n${command.heredoc}` : '';
106
-
107
- return `${command.words.join(' ')}${body}`;
108
- });
107
+ if (name === 'gh' && isGhRequest({ command: opts.command })) {
108
+ return false;
109
+ }
109
110
 
110
- /**
111
- * What a command line runs, one text per simple command, for a guard that matches text: the words of each
112
- * command with the quotes resolved, nothing but the name for a command whose arguments are data
113
- * (`rg -n "kubectl apply" docs/`), and the body of a heredoc appended only where its reader runs it
114
- * (`psql <<EOF`). The body of `cat > f <<EOF` is data and is not here. A line that pipes into a program
115
- * that runs its input (`echo "kubectl apply -f x" | sh`) stands as one text, because what it prints is code.
116
- */
117
- export const commandTextsOf = (opts: { command: string; withMessages: boolean }): string[] => {
118
- const { text } = splitHeredocs({ command: opts.command });
111
+ return READ_ONLY_PROGRAMS.has(name) || (opts.withMessages && MESSAGE_PROGRAMS.has(name));
112
+ }
119
113
 
120
- return PIPED_INTO_RUNNER.test(text) ? [text] : textsOf(opts);
121
- };
114
+ /**
115
+ * What a command line runs, one text per simple command, for a guard that matches text: the words of each
116
+ * command with the quotes resolved, nothing but the name for a command whose arguments are data
117
+ * (`rg -n "kubectl apply" docs/`), and the body of a heredoc appended only where its reader runs it
118
+ * (`psql <<EOF`). The body of `cat > f <<EOF` is data and is not here. A line that pipes into a program
119
+ * that runs its input (`echo "kubectl apply -f x" | sh`) stands as one text, because what it prints is code.
120
+ */
121
+ static commandTextsOf(opts: { command: string; withMessages: boolean }): string[] {
122
+ const { text } = ShellParser.splitHeredocs({ command: opts.command });
123
+
124
+ return PIPED_INTO_RUNNER.test(text) ? [text] : CommandView.textsOf(opts);
125
+ }
126
+ }
@@ -9,45 +9,45 @@ interface IDecisionOutput {
9
9
  };
10
10
  }
11
11
 
12
- /**
13
- * The decision as every host that reads our hooks understands it. Claude Code and Cursor read
14
- * \`hookSpecificOutput\`; Copilot documents the same two fields at the top level, so they are written there
15
- * too (Claude Code ignores them: checked). Cursor does not enforce an \`ask\` on a tool call, so where it
16
- * says it is running the hook (\`CURSOR_PROJECT_DIR\`) an ask is a deny that says why.
17
- */
18
- export const forHost = (opts: {
19
- output: IDecisionOutput;
20
- env?: Record<string, string | undefined>;
21
- }) => {
22
- const specific = opts.output.hookSpecificOutput;
23
- const env = opts.env ?? process.env;
24
- const isCursorAsk =
25
- specific.permissionDecision === GuardDecisions.ASK &&
26
- env[HookConstants.CURSOR_PROJECT_DIR_ENV] !== undefined;
27
- const decision = isCursorAsk ? GuardDecisions.DENY : specific.permissionDecision;
28
- const reason = isCursorAsk
29
- ? `${specific.permissionDecisionReason}\n(Cursor cannot ask about a tool call: hand this to the owner)`
30
- : specific.permissionDecisionReason;
12
+ export class HookDecision {
13
+ /**
14
+ * The decision as every host that reads our hooks understands it. Claude Code and Cursor read
15
+ * \`hookSpecificOutput\`; Copilot documents the same two fields at the top level, so they are written there
16
+ * too (Claude Code ignores them: checked). Cursor does not enforce an \`ask\` on a tool call, so where it
17
+ * says it is running the hook (\`CURSOR_PROJECT_DIR\`) an ask is a deny that says why.
18
+ */
19
+ static forHost(opts: { output: IDecisionOutput; env?: Record<string, string | undefined> }) {
20
+ const specific = opts.output.hookSpecificOutput;
21
+ const env = opts.env ?? process.env;
22
+ const isCursorAsk =
23
+ specific.permissionDecision === GuardDecisions.ASK &&
24
+ env[HookConstants.CURSOR_PROJECT_DIR_ENV] !== undefined;
25
+ const decision = isCursorAsk ? GuardDecisions.DENY : specific.permissionDecision;
26
+ const reason = isCursorAsk
27
+ ? `${specific.permissionDecisionReason}\n(Cursor cannot ask about a tool call: hand this to the owner)`
28
+ : specific.permissionDecisionReason;
31
29
 
32
- return {
33
- hookSpecificOutput: {
34
- ...specific,
30
+ return {
31
+ hookSpecificOutput: {
32
+ ...specific,
33
+ permissionDecision: decision,
34
+ permissionDecisionReason: reason,
35
+ },
35
36
  permissionDecision: decision,
36
37
  permissionDecisionReason: reason,
37
- },
38
- permissionDecision: decision,
39
- permissionDecisionReason: reason,
40
- };
41
- };
38
+ };
39
+ }
42
40
 
43
- /** The PreToolUse answer Claude Code reads from stdout: the decision and why, shown to the human or to the model. */
44
- export const buildToolDecision = (opts: { decision: TGuardDecision; reason: string[] }) =>
45
- forHost({
46
- output: {
47
- hookSpecificOutput: {
48
- hookEventName: HookConstants.PRE_TOOL_USE,
49
- permissionDecision: opts.decision,
50
- permissionDecisionReason: opts.reason.join('\n'),
41
+ /** The PreToolUse answer Claude Code reads from stdout: the decision and why, shown to the human or to the model. */
42
+ static buildTool(opts: { decision: TGuardDecision; reason: string[] }) {
43
+ return HookDecision.forHost({
44
+ output: {
45
+ hookSpecificOutput: {
46
+ hookEventName: HookConstants.PRE_TOOL_USE,
47
+ permissionDecision: opts.decision,
48
+ permissionDecisionReason: opts.reason.join('\n'),
49
+ },
51
50
  },
52
- },
53
- });
51
+ });
52
+ }
53
+ }
@@ -1,9 +1,9 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { basenameOf, parseShellChecked, programOf } from './shell.ts';
2
+ import { ShellParser } from './shell.ts';
3
3
  import type { ISimpleCommand } from './shell.ts';
4
4
  import { GuardDecisions, HookConstants } from './common/index.ts';
5
5
  import type { IGitHit, IGitRunner } from './common/index.ts';
6
- import { matchesBranch } from './project-guards.ts';
6
+ import { ProjectGuards } from './project-guards.ts';
7
7
 
8
8
  /** `git` and `gh` read-only queries the guard makes; `undefined` when the tool is missing, slow or fails. */
9
9
  const runQuery: IGitRunner = (opts) => {
@@ -104,7 +104,7 @@ const inspectPush = (opts: {
104
104
  for (const name of targets) {
105
105
  const branch = name.replace(/^\+/, '').replace(/^refs\/heads\//, '');
106
106
 
107
- if (matchesBranch({ name: branch, patterns: opts.askPush })) {
107
+ if (ProjectGuards.matchesBranch({ name: branch, patterns: opts.askPush })) {
108
108
  hits.push({
109
109
  decision: GuardDecisions.ASK,
110
110
  rule: 'V-W-06',
@@ -387,8 +387,8 @@ const inspectOne = (opts: {
387
387
  run: IGitRunner;
388
388
  askPush: string[];
389
389
  }): IGitHit[] => {
390
- const program = programOf({ command: opts.command });
391
- const name = basenameOf({ word: program.name });
390
+ const program = ShellParser.programOf({ command: opts.command });
391
+ const name = ShellParser.basenameOf({ word: program.name });
392
392
 
393
393
  if (name === 'gh') {
394
394
  return [
@@ -441,53 +441,55 @@ const inspectOne = (opts: {
441
441
  return [];
442
442
  };
443
443
 
444
- /** Every reason `command` is a git or gh action that loses history or a protected branch. */
445
- export const inspectGit = (opts: {
446
- command: string;
447
- cwd: string | undefined;
448
- run?: IGitRunner;
449
- /** Branches (names, `*` allowed) a plain `git push` asks about: `guard.git.askPush`. */
450
- askPush?: string[];
451
- }): IGitHit[] => {
452
- const parsed = parseShellChecked({ command: opts.command });
453
- const run = opts.run ?? runQuery;
454
- let queries = 0;
455
- let isCapped = false;
456
-
457
- // Every query is a process and can take seconds: a line may make a few, and asks past them.
458
- const limited: IGitRunner = (call) => {
459
- queries += 1;
444
+ export class GitGuard {
445
+ /** Every reason `command` is a git or gh action that loses history or a protected branch. */
446
+ static inspect(opts: {
447
+ command: string;
448
+ cwd: string | undefined;
449
+ run?: IGitRunner;
450
+ /** Branches (names, `*` allowed) a plain `git push` asks about: `guard.git.askPush`. */
451
+ askPush?: string[];
452
+ }): IGitHit[] {
453
+ const parsed = ShellParser.parseChecked({ command: opts.command });
454
+ const run = opts.run ?? runQuery;
455
+ let queries = 0;
456
+ let isCapped = false;
457
+
458
+ // Every query is a process and can take seconds: a line may make a few, and asks past them.
459
+ const limited: IGitRunner = (call) => {
460
+ queries += 1;
461
+
462
+ if (queries > HookConstants.MAX_QUERIES) {
463
+ isCapped = true;
464
+
465
+ return undefined;
466
+ }
460
467
 
461
- if (queries > HookConstants.MAX_QUERIES) {
462
- isCapped = true;
468
+ return run(call);
469
+ };
470
+ const hits = parsed.commands.flatMap((command) =>
471
+ inspectOne({ command, cwd: opts.cwd, run: limited, askPush: opts.askPush ?? [] }),
472
+ );
463
473
 
464
- return undefined;
474
+ // Part of the line was not read: never an allow.
475
+ if (parsed.isOverBudget) {
476
+ hits.push({
477
+ decision: GuardDecisions.ASK,
478
+ rule: 'V-W-06',
479
+ message:
480
+ 'this command line is larger, or nests deeper, than the guard reads, so it could not be checked',
481
+ });
465
482
  }
466
483
 
467
- return run(call);
468
- };
469
- const hits = parsed.commands.flatMap((command) =>
470
- inspectOne({ command, cwd: opts.cwd, run: limited, askPush: opts.askPush ?? [] }),
471
- );
472
-
473
- // Part of the line was not read: never an allow.
474
- if (parsed.isOverBudget) {
475
- hits.push({
476
- decision: GuardDecisions.ASK,
477
- rule: 'V-W-06',
478
- message:
479
- 'this command line is larger, or nests deeper, than the guard reads, so it could not be checked',
480
- });
481
- }
484
+ if (isCapped) {
485
+ hits.push({
486
+ decision: GuardDecisions.ASK,
487
+ rule: 'V-W-06',
488
+ message:
489
+ 'this command line needs more git or gh queries than the guard runs, so part of it could not be checked',
490
+ });
491
+ }
482
492
 
483
- if (isCapped) {
484
- hits.push({
485
- decision: GuardDecisions.ASK,
486
- rule: 'V-W-06',
487
- message:
488
- 'this command line needs more git or gh queries than the guard runs, so part of it could not be checked',
489
- });
493
+ return hits;
490
494
  }
491
-
492
- return hits;
493
- };
495
+ }
@@ -1,7 +1,7 @@
1
1
  import { isAbsolute, join, normalize } from 'node:path';
2
2
  import { GuardDecisions, HookConstants } from './common/index.ts';
3
3
  import type { IManifestHookInput } from './common/index.ts';
4
- import { forHost } from './decision.ts';
4
+ import { HookDecision } from './decision.ts';
5
5
 
6
6
  /** The shell tool under the names the hosts give it: Cursor's `Shell`, and a lower-case `bash`. */
7
7
  const SHELL_NAMES = new Set(['Shell', 'shell', 'bash']);
@@ -41,66 +41,69 @@ const toolOf = (opts: { value: unknown }): string | undefined => {
41
41
  return name !== undefined && SHELL_NAMES.has(name) ? BASH_TOOL : name;
42
42
  };
43
43
 
44
- /** The tool call from the hook's JSON; `undefined` when it is not what Claude Code sends. */
45
- export const parseManifestHookInput = (opts: { text: string }): IManifestHookInput | undefined => {
46
- let payload: unknown;
47
-
48
- try {
49
- payload = JSON.parse(opts.text);
50
- } catch (error) {
51
- console.error(
52
- `[parseManifestHookInput] unreadable hook input - letting the call through | ${error instanceof Error ? error.message : String(error)}`,
53
- );
54
-
55
- return undefined;
44
+ export class ManifestGuard {
45
+ /** The tool call from the hook's JSON; `undefined` when it is not what Claude Code sends. */
46
+ static parseHookInput(opts: { text: string }): IManifestHookInput | undefined {
47
+ let payload: unknown;
48
+
49
+ try {
50
+ payload = JSON.parse(opts.text);
51
+ } catch (error) {
52
+ console.error(
53
+ `[ManifestGuard.parseHookInput] unreadable hook input - letting the call through | ${error instanceof Error ? error.message : String(error)}`,
54
+ );
55
+
56
+ return undefined;
57
+ }
58
+
59
+ const holder = { value: payload };
60
+
61
+ if (!isRecord(holder)) {
62
+ return undefined;
63
+ }
64
+
65
+ // The wire names are snake_case; they stay behind string-literal access here, at the boundary (V-C-14).
66
+ const toolInput = { value: holder.value['tool_input'] };
67
+ const input = isRecord(toolInput) ? toolInput.value : {};
68
+ const tool = toolOf({ value: holder.value['tool_name'] });
69
+
70
+ return tool === undefined
71
+ ? undefined
72
+ : {
73
+ tool,
74
+ filePath:
75
+ toText({ value: input['file_path'] }) ?? toText({ value: input['notebook_path'] }),
76
+ command: toText({ value: input['command'] }),
77
+ cwd: toText({ value: holder.value['cwd'] }),
78
+ };
56
79
  }
57
80
 
58
- const holder = { value: payload };
81
+ /** Whether this tool call writes `.agents/vulcan.manifest.json` - which only `vulcan sync` may do. */
82
+ static inspectWrite(opts: { input: IManifestHookInput }): boolean {
83
+ const { tool, filePath, command, cwd } = opts.input;
59
84
 
60
- if (!isRecord(holder)) {
61
- return undefined;
62
- }
63
-
64
- // The wire names are snake_case; they stay behind string-literal access here, at the boundary (V-C-14).
65
- const toolInput = { value: holder.value['tool_input'] };
66
- const input = isRecord(toolInput) ? toolInput.value : {};
67
- const tool = toolOf({ value: holder.value['tool_name'] });
68
-
69
- return tool === undefined
70
- ? undefined
71
- : {
72
- tool,
73
- filePath:
74
- toText({ value: input['file_path'] }) ?? toText({ value: input['notebook_path'] }),
75
- command: toText({ value: input['command'] }),
76
- cwd: toText({ value: holder.value['cwd'] }),
77
- };
78
- };
85
+ if (tool === BASH_TOOL) {
86
+ return command !== undefined && WRITE_PATTERNS.some((pattern) => pattern.test(command));
87
+ }
79
88
 
80
- /** Whether this tool call writes `.agents/vulcan.manifest.json` - which only `vulcan sync` may do. */
81
- export const inspectManifestWrite = (opts: { input: IManifestHookInput }): boolean => {
82
- const { tool, filePath, command, cwd } = opts.input;
89
+ if (filePath === undefined) {
90
+ return false;
91
+ }
83
92
 
84
- if (tool === BASH_TOOL) {
85
- return command !== undefined && WRITE_PATTERNS.some((pattern) => pattern.test(command));
86
- }
93
+ const absolute = isAbsolute(filePath) ? filePath : join(cwd ?? process.cwd(), filePath);
87
94
 
88
- if (filePath === undefined) {
89
- return false;
95
+ return normalize(absolute).endsWith(MANIFEST_SUFFIX);
90
96
  }
91
97
 
92
- const absolute = isAbsolute(filePath) ? filePath : join(cwd ?? process.cwd(), filePath);
93
-
94
- return normalize(absolute).endsWith(MANIFEST_SUFFIX);
95
- };
96
-
97
- export const buildManifestDecision = () =>
98
- forHost({
99
- output: {
100
- hookSpecificOutput: {
101
- hookEventName: HookConstants.PRE_TOOL_USE,
102
- permissionDecision: GuardDecisions.DENY,
103
- permissionDecisionReason: MANIFEST_BLOCK_MESSAGE,
98
+ static buildDecision() {
99
+ return HookDecision.forHost({
100
+ output: {
101
+ hookSpecificOutput: {
102
+ hookEventName: HookConstants.PRE_TOOL_USE,
103
+ permissionDecision: GuardDecisions.DENY,
104
+ permissionDecisionReason: MANIFEST_BLOCK_MESSAGE,
105
+ },
104
106
  },
105
- },
106
- });
107
+ });
108
+ }
109
+ }