revert: remove codebase intelligence system
Rolled back the intel system due to overengineering concerns: - 1200+ line hook with SQLite graph database - 21MB sql.js dependency - Entity generation spawning additional Claude calls - Complex system with unclear value Removed: - /gsd:analyze-codebase command - /gsd:query-intel command - gsd-intel-index.js, gsd-intel-session.js, gsd-intel-prune.js hooks - gsd-entity-generator, gsd-indexer agents - entity.md template - sql.js dependency Preserved: - Model profiles feature - Statusline hook - All other v1.9.x improvements -3,065 lines removed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Intel Prune Hook (Stop event)
|
||||
*
|
||||
* Removes stale entries from index.json when files no longer exist.
|
||||
* Runs after each Claude response to keep intel fresh.
|
||||
*
|
||||
* Fast: Only does fs.existsSync checks, no file reading.
|
||||
* Silent: Never blocks or errors, always exits 0.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function pruneIndex() {
|
||||
const intelDir = path.join(process.cwd(), '.planning', 'intel');
|
||||
const indexPath = path.join(intelDir, 'index.json');
|
||||
|
||||
// Only run if intel directory exists (opt-in check)
|
||||
if (!fs.existsSync(intelDir)) {
|
||||
return { pruned: 0, total: 0 };
|
||||
}
|
||||
|
||||
// Read existing index
|
||||
let index;
|
||||
try {
|
||||
const content = fs.readFileSync(indexPath, 'utf8');
|
||||
index = JSON.parse(content);
|
||||
} catch (e) {
|
||||
// No index or invalid JSON
|
||||
return { pruned: 0, total: 0 };
|
||||
}
|
||||
|
||||
if (!index.files || typeof index.files !== 'object') {
|
||||
return { pruned: 0, total: 0 };
|
||||
}
|
||||
|
||||
// Check each file and collect deleted ones
|
||||
const filePaths = Object.keys(index.files);
|
||||
const deleted = filePaths.filter(filePath => !fs.existsSync(filePath));
|
||||
|
||||
if (deleted.length === 0) {
|
||||
return { pruned: 0, total: filePaths.length };
|
||||
}
|
||||
|
||||
// Remove deleted entries
|
||||
for (const filePath of deleted) {
|
||||
delete index.files[filePath];
|
||||
}
|
||||
index.updated = Date.now();
|
||||
|
||||
// Write updated index
|
||||
fs.writeFileSync(indexPath, JSON.stringify(index, null, 2));
|
||||
|
||||
// Regenerate conventions and summary after pruning
|
||||
// Import detection logic from intel-index.js would be complex,
|
||||
// so we just update the index. Conventions/summary stay until
|
||||
// next PostToolUse or /gsd:analyze-codebase refresh.
|
||||
|
||||
return { pruned: deleted.length, total: filePaths.length };
|
||||
}
|
||||
|
||||
// Read JSON from stdin (standard hook pattern)
|
||||
let input = '';
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', chunk => input += chunk);
|
||||
process.stdin.on('end', () => {
|
||||
try {
|
||||
// Stop hook receives session data, but we don't need it
|
||||
// Just prune stale entries
|
||||
pruneIndex();
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
// Silent failure - never block Claude
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Codebase Intelligence - SessionStart Context Injection Hook
|
||||
// Reads pre-generated summary.md and injects into Claude's context
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Read JSON from stdin (standard hook pattern)
|
||||
let input = '';
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', chunk => input += chunk);
|
||||
process.stdin.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(input);
|
||||
|
||||
// Only inject on startup or resume
|
||||
if (!['startup', 'resume'].includes(data.source)) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Read pre-generated summary (created by gsd-intel-index.js)
|
||||
const summaryPath = path.join(process.cwd(), '.planning', 'intel', 'summary.md');
|
||||
|
||||
if (!fs.existsSync(summaryPath)) {
|
||||
process.exit(0); // No intel, skip silently
|
||||
}
|
||||
|
||||
const summary = fs.readFileSync(summaryPath, 'utf8').trim();
|
||||
|
||||
if (summary) {
|
||||
process.stdout.write(`<codebase-intelligence>\n${summary}\n</codebase-intelligence>`);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
// Silent failure - never block Claude
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user