From e5c9abaa557926cd5277eed9d9cf56cd6bd46a03 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Tue, 20 Jan 2026 00:05:54 -0600 Subject: [PATCH] feat(03-02): register intel hooks in install.js - Add intel-index PostToolUse hook for codebase indexing - Add intel-session SessionStart hook for context injection - Hooks registered conditionally (skip if already exists) --- bin/install.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/bin/install.js b/bin/install.js index d14c1f8de..3d299c294 100755 --- a/bin/install.js +++ b/bin/install.js @@ -413,6 +413,49 @@ function install(isGlobal) { console.log(` ${green}✓${reset} Configured update check hook`); } + // Register intel hooks for codebase intelligence + const intelIndexCommand = isGlobal + ? 'node "$HOME/.claude/hooks/intel-index.js"' + : 'node .claude/hooks/intel-index.js'; + + const intelSessionCommand = isGlobal + ? 'node "$HOME/.claude/hooks/intel-session.js"' + : 'node .claude/hooks/intel-session.js'; + + // PostToolUse hook for indexing + if (!settings.hooks.PostToolUse) { + settings.hooks.PostToolUse = []; + } + + const hasIntelIndexHook = settings.hooks.PostToolUse.some(entry => + entry.hooks && entry.hooks.some(h => h.command && h.command.includes('intel-index')) + ); + + if (!hasIntelIndexHook) { + settings.hooks.PostToolUse.push({ + hooks: [{ + type: 'command', + command: intelIndexCommand + }] + }); + console.log(` ${green}✓${reset} Configured intel indexing hook`); + } + + // SessionStart hook for context injection + const hasIntelSessionHook = settings.hooks.SessionStart.some(entry => + entry.hooks && entry.hooks.some(h => h.command && h.command.includes('intel-session')) + ); + + if (!hasIntelSessionHook) { + settings.hooks.SessionStart.push({ + hooks: [{ + type: 'command', + command: intelSessionCommand + }] + }); + console.log(` ${green}✓${reset} Configured intel session hook`); + } + return { settingsPath, settings, statuslineCommand }; }