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:
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user