`codegraph init` now runs the initial index automatically. The -i/--index flag is kept but is now a no-op, accepted for backward compatibility so existing muscle memory and scripts don't break. Addresses #483, where a user asked why -i wasn't implicit. README and site/ docs are intentionally NOT updated in this commit — they describe the currently-released 0.9.7 behavior (where -i is still required). Update them at the 0.9.8 release so users on 0.9.7 aren't misled. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
5fbb9f6787
commit
7a75c82dd9
+18
-21
@@ -416,8 +416,8 @@ function writeErrorLog(projectPath: string, errors: Array<{ message: string; fil
|
||||
*/
|
||||
program
|
||||
.command('init [path]')
|
||||
.description('Initialize CodeGraph in a project directory')
|
||||
.option('-i, --index', 'Run initial indexing after initialization')
|
||||
.description('Initialize CodeGraph in a project directory and build the initial index')
|
||||
.option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
|
||||
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
||||
.action(async (pathArg: string | undefined, options: { index?: boolean; verbose?: boolean }) => {
|
||||
const projectPath = path.resolve(pathArg || process.cwd());
|
||||
@@ -441,27 +441,24 @@ program
|
||||
const cg = await CodeGraph.init(projectPath, { index: false });
|
||||
clack.log.success(`Initialized in ${projectPath}`);
|
||||
|
||||
if (options.index) {
|
||||
let result: IndexResult;
|
||||
|
||||
if (options.verbose) {
|
||||
result = await cg.indexAll({
|
||||
onProgress: createVerboseProgress(),
|
||||
verbose: true,
|
||||
});
|
||||
} else {
|
||||
process.stdout.write(`${colors.dim}${getGlyphs().rail}${colors.reset}\n`);
|
||||
const progress = createShimmerProgress();
|
||||
result = await cg.indexAll({
|
||||
onProgress: progress.onProgress,
|
||||
});
|
||||
await progress.stop();
|
||||
}
|
||||
|
||||
printIndexResult(clack, result, projectPath);
|
||||
// Indexing runs by default now. The legacy -i/--index flag is still
|
||||
// accepted (so existing muscle memory and scripts don't break) but is a
|
||||
// no-op — initializing always builds the initial index.
|
||||
let result: IndexResult;
|
||||
if (options.verbose) {
|
||||
result = await cg.indexAll({
|
||||
onProgress: createVerboseProgress(),
|
||||
verbose: true,
|
||||
});
|
||||
} else {
|
||||
clack.log.info('Run "codegraph index" to index the project');
|
||||
process.stdout.write(`${colors.dim}${getGlyphs().rail}${colors.reset}\n`);
|
||||
const progress = createShimmerProgress();
|
||||
result = await cg.indexAll({
|
||||
onProgress: progress.onProgress,
|
||||
});
|
||||
await progress.stop();
|
||||
}
|
||||
printIndexResult(clack, result, projectPath);
|
||||
|
||||
try {
|
||||
const { offerWatchFallback } = await import('../installer');
|
||||
|
||||
Reference in New Issue
Block a user