feat(intel): add Stop hook to prune deleted files

New intel-prune.js hook runs after each Claude response.
Checks if indexed files still exist, removes stale entries.

Fast (only fs.existsSync checks) and silent (never blocks).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-01-20 00:49:07 -06:00
parent f0b8afe7cc
commit fa48a13c9c
2 changed files with 101 additions and 0 deletions

View File

@@ -456,6 +456,29 @@ function install(isGlobal) {
console.log(` ${green}✓${reset} Configured intel session hook`);
}
// Stop hook for pruning deleted files
const intelPruneCommand = isGlobal
? 'node "$HOME/.claude/hooks/intel-prune.js"'
: 'node .claude/hooks/intel-prune.js';
if (!settings.hooks.Stop) {
settings.hooks.Stop = [];
}
const hasIntelPruneHook = settings.hooks.Stop.some(entry =>
entry.hooks && entry.hooks.some(h => h.command && h.command.includes('intel-prune'))
);
if (!hasIntelPruneHook) {
settings.hooks.Stop.push({
hooks: [{
type: 'command',
command: intelPruneCommand
}]
});
console.log(` ${green}✓${reset} Configured intel prune hook`);
}
return { settingsPath, settings, statuslineCommand };
}