fix(cli): report unsupported-language projects instead of finishing silently (#1806)

A project CodeGraph has no grammar for was indistinguishable from an empty one: unsupported extensions are filtered out at discovery, so filesDiscovered was 0, the reconciliation in index.ts found no shortfall and recorded index_state as complete, and the CLI printed the same 'No files found to index' it prints for an empty repo.

That silence is what makes it costly over MCP: an empty result reads identically to 'no match', and the agent has been told to trust the graph rather than grep.

The scan already visits every file, so the tally of what it declined to index costs no extra I/O and no second pass. index_state itself is left alone: changing its values would change the status --json contract, which is a call for the maintainer to make.


(cherry picked from commit 2c20892789)

Co-authored-by: Max Hsu <maxmilian@gmail.com>
Co-authored-by: netbrah <netbrah@users.noreply.github.com>
This commit is contained in:
Colby Mchenry
2026-09-08 18:38:27 -05:00
committed by GitHub
co-authored by Max Hsu netbrah
parent e79d5df448
commit 799f8b2a45
4 changed files with 149 additions and 13 deletions
+16
View File
@@ -388,6 +388,8 @@ type IndexResult = {
edgesCreated: number;
errors: Array<{ message: string; filePath?: string; severity: string; code?: string }>;
durationMs: number;
filesSkippedUnsupported?: number;
topUnsupportedExtensions?: { ext: string; count: number }[];
};
/**
@@ -445,6 +447,20 @@ function printIndexResult(clack: typeof import('@clack/prompts'), result: IndexR
}
} else if (hasErrors) {
clack.log.error(`Indexing failed ${getGlyphs().dash} all ${formatNumber(result.filesErrored)} files had errors`);
} else if (result.filesSkippedUnsupported) {
// A project CodeGraph has no grammar for used to be indistinguishable from
// an empty one: same message, same `complete` state, same exit 0. Say which
// files were there and that the graph is empty on purpose, so nobody — and
// no agent trusting the graph — reads silence as "this code doesn't exist"
// (#1502).
const top = (result.topUnsupportedExtensions ?? [])
.map(e => `${e.ext} (${formatNumber(e.count)})`)
.join(', ');
clack.log.warn(
`No supported source files found ${getGlyphs().dash} ${formatNumber(result.filesSkippedUnsupported)} file(s) present, none in a language CodeGraph indexes`
+ (top ? `: ${top}` : '')
);
clack.log.info('CodeGraph is inactive for this workspace — searches will return nothing. Use your own file tools here.');
} else {
clack.log.warn('No files found to index');
}