MCPcopy Create free account
hub / github.com/SethGammon/Citadel / fireHookScript

Function fireHookScript

scripts/integration-test.js:61–81  ·  view source on GitHub ↗
(scriptName, payload, sandbox, extraEnv = {})

Source from the content-addressed store, hash-verified

59
60// ── Hook dispatch ──────────────────────────────────────────────────────────────
61
62function fireHookScript(scriptName, payload, sandbox, extraEnv = {}) {
63 const scriptPath = path.join(HOOKS_SRC, scriptName);
64 const input = JSON.stringify(payload);
65 const result = spawnSync('node', [scriptPath], {
66 input,
67 cwd: sandbox,
68 env: {
69 ...process.env,
70 CLAUDE_PROJECT_DIR: sandbox,
71 CLAUDE_PLUGIN_DATA: path.join(sandbox, '.claude'),
72 ...extraEnv,
73 },
74 encoding: 'utf8',
75 timeout: 10000,
76 });
77 return {
78 exitCode: result.status ?? -1,
79 stdout: result.stdout || '',
80 stderr: result.stderr || '',
81 };
82}
83
84function getHooksForEvent(sandbox, event, toolName) {

Callers 2

makeSandboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected