feat(04-02): integrate graph summary into regeneration flow
- regenerateEntitySummary() now async, prefers graph when available - Falls back to entity-file-based summary if no graph.db - Stdin handler properly awaits async regeneration - SessionStart hook injects graph-backed summary into context Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -718,12 +718,23 @@ async function syncEntityToGraph(entityPath) {
|
|||||||
/**
|
/**
|
||||||
* Regenerate summary.md from all entity files
|
* Regenerate summary.md from all entity files
|
||||||
* Creates a semantic overview of the codebase
|
* Creates a semantic overview of the codebase
|
||||||
|
* Prefers graph-backed summary when graph.db exists
|
||||||
*/
|
*/
|
||||||
function regenerateEntitySummary() {
|
async function regenerateEntitySummary() {
|
||||||
const intelDir = path.join(process.cwd(), '.planning', 'intel');
|
const intelDir = path.join(process.cwd(), '.planning', 'intel');
|
||||||
const entitiesDir = path.join(intelDir, 'entities');
|
const entitiesDir = path.join(intelDir, 'entities');
|
||||||
const summaryPath = path.join(intelDir, 'summary.md');
|
const summaryPath = path.join(intelDir, 'summary.md');
|
||||||
|
const dbPath = path.join(intelDir, 'graph.db');
|
||||||
|
|
||||||
|
// Try graph-backed summary first (preferred when graph.db exists)
|
||||||
|
if (fs.existsSync(dbPath)) {
|
||||||
|
const graphSummary = await generateGraphSummary();
|
||||||
|
if (graphSummary) {
|
||||||
|
return; // Graph summary written successfully
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: entity-file-based summary
|
||||||
// Check directories exist
|
// Check directories exist
|
||||||
if (!fs.existsSync(entitiesDir)) {
|
if (!fs.existsSync(entitiesDir)) {
|
||||||
return;
|
return;
|
||||||
@@ -932,8 +943,8 @@ process.stdin.on('end', () => {
|
|||||||
|
|
||||||
// Handle entity file writes - sync to graph, regenerate summary
|
// Handle entity file writes - sync to graph, regenerate summary
|
||||||
if (isEntityFile(filePath)) {
|
if (isEntityFile(filePath)) {
|
||||||
syncEntityToGraph(filePath).then(() => {
|
syncEntityToGraph(filePath).then(async () => {
|
||||||
regenerateEntitySummary();
|
await regenerateEntitySummary();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Silent failure
|
// Silent failure
|
||||||
|
|||||||
Reference in New Issue
Block a user