feat(cli): add version, indexPath, lastIndexed to status --json (#329)

Adds `version`, `indexPath`, and an ISO `lastIndexed` to `codegraph status --json`, plus a `CodeGraph.getLastIndexedAt()` library method. `agentCount` dropped (no clear consumer). Reworked from contributor PRs #333 and #480.

Co-Authored-By: Javier Gómez <199902626+12122J@users.noreply.github.com>
Co-Authored-By: Ran <8403607+eddieran@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-06-02 17:50:33 -05:00
committed by GitHub
co-authored by Javier Gómez Ran Claude Opus 4.8
parent ddb1a8f72d
commit 7b62356f53
5 changed files with 124 additions and 1 deletions
+11 -1
View File
@@ -676,7 +676,13 @@ program
try {
if (!isInitialized(projectPath)) {
if (options.json) {
console.log(JSON.stringify({ initialized: false, projectPath }));
console.log(JSON.stringify({
initialized: false,
version: packageJson.version,
projectPath,
indexPath: getCodeGraphDir(projectPath),
lastIndexed: null,
}));
return;
}
console.log(chalk.bold('\nCodeGraph Status\n'));
@@ -695,9 +701,13 @@ program
// JSON output mode
if (options.json) {
const lastIndexedMs = cg.getLastIndexedAt();
console.log(JSON.stringify({
initialized: true,
version: packageJson.version,
projectPath,
indexPath: getCodeGraphDir(projectPath),
lastIndexed: lastIndexedMs != null ? new Date(lastIndexedMs).toISOString() : null,
fileCount: stats.fileCount,
nodeCount: stats.nodeCount,
edgeCount: stats.edgeCount,