fix(cli): explore/node not-indexed error stops agents from running init themselves (#821)

The message said "run 'codegraph init' first" — an instruction-shaped
error that invites an agent hitting it (e.g. a subagent following the
global instructions block into an unindexed repo) to index the project
uninvited: minutes of CPU and a surprise .codegraph/ the user never
asked for. Every other layer already encodes indexing-is-the-user's-
decision (the MCP NotIndexedError guidance, the inactive instructions,
the conditional block); the CLI now matches: continue with your usual
tools, do not run init yourself, the project owner can enable it.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-06-12 00:24:08 -05:00
committed by GitHub
co-authored by Claude Opus 4.8
parent e2f1fe4b2a
commit adcb862f8e
+2 -2
View File
@@ -915,7 +915,7 @@ program
try {
if (!isInitialized(projectPath)) {
error(`CodeGraph not initialized in ${projectPath} — run 'codegraph init' first.`);
error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`);
process.exit(1);
}
@@ -957,7 +957,7 @@ program
try {
if (!isInitialized(projectPath)) {
error(`CodeGraph not initialized in ${projectPath} — run 'codegraph init' first.`);
error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`);
process.exit(1);
}