Implements MCP server for semantic search across GSD projects: MCP Tools: - gsd_memory_search: Search across all registered projects - gsd_memory_decisions: Find decisions from SUMMARY/PROJECT.md - gsd_memory_patterns: Find patterns from SUMMARY.md - gsd_memory_pitfalls: Find pitfalls from RESEARCH.md - gsd_memory_stack: Find tech stack entries - gsd_memory_register: Register project with memory - gsd_memory_index: Trigger indexing/update - gsd_memory_status: Show system status Architecture: - QMD wrapper with grep fallback when QMD unavailable - YAML frontmatter extractors for GSD document types - Project registry at ~/.gsd/projects.json - Auto-install via bin/install.js for Claude Code Workflow integrations: - new-project: Registers project with memory - plan-phase: Indexes after planning - execute-phase: Indexes after execution - complete-milestone: Indexes milestone completion - Researcher agents query memory before Context7 Tests: 117 passing (66 unit + 51 integration) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
67 lines
2.1 KiB
JavaScript
67 lines
2.1 KiB
JavaScript
import { getAllProjects } from '../registry.js';
|
|
import { qmd } from '../qmd.js';
|
|
import { existsSync, readdirSync, statSync } from 'fs';
|
|
import { join } from 'path';
|
|
/**
|
|
* Get comprehensive status of GSD memory system
|
|
*/
|
|
export async function getStatus() {
|
|
const qmdAvailable = await qmd.isAvailable();
|
|
const projects = getAllProjects();
|
|
let totalDocuments = 0;
|
|
const projectStatuses = [];
|
|
for (const project of projects) {
|
|
const planningPath = join(project.path, '.planning');
|
|
const exists = existsSync(project.path);
|
|
const hasPlanningDir = existsSync(planningPath);
|
|
// Count documents in .planning directory
|
|
const documentCount = hasPlanningDir ? countMarkdownFiles(planningPath) : 0;
|
|
totalDocuments += documentCount;
|
|
projectStatuses.push({
|
|
name: project.name,
|
|
path: project.path,
|
|
exists,
|
|
hasPlanningDir,
|
|
qmdCollection: project.qmdCollection,
|
|
qmdAvailable: qmdAvailable && !!project.qmdCollection,
|
|
documentCount,
|
|
registeredAt: project.registeredAt,
|
|
lastIndexed: project.lastIndexed
|
|
});
|
|
}
|
|
return {
|
|
qmdAvailable,
|
|
totalProjects: projects.length,
|
|
totalDocuments,
|
|
projects: projectStatuses
|
|
};
|
|
}
|
|
/**
|
|
* Count markdown files in a directory recursively
|
|
*/
|
|
function countMarkdownFiles(dir) {
|
|
let count = 0;
|
|
try {
|
|
const entries = readdirSync(dir);
|
|
for (const entry of entries) {
|
|
const fullPath = join(dir, entry);
|
|
try {
|
|
const stat = statSync(fullPath);
|
|
if (stat.isDirectory() && !entry.startsWith('.')) {
|
|
count += countMarkdownFiles(fullPath);
|
|
}
|
|
else if (stat.isFile() && entry.endsWith('.md')) {
|
|
count++;
|
|
}
|
|
}
|
|
catch {
|
|
// Skip entries that can't be accessed
|
|
}
|
|
}
|
|
}
|
|
catch {
|
|
// Return 0 if directory can't be read
|
|
}
|
|
return count;
|
|
}
|
|
//# sourceMappingURL=status.js.map
|