`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
@@ -9,6 +9,10 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- `codegraph init` now builds the initial index by default — you no longer need the `-i`/`--index` flag (it's still accepted, so existing commands and scripts keep working). (#483)
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
- Indexing a project that contains only config-style files (YAML, Twig, or `.properties`) no longer misleadingly reports "No files found to index" — these files are tracked at the file level and are now counted as indexed. Thanks @luojiyin1987 (#357).
|
- Indexing a project that contains only config-style files (YAML, Twig, or `.properties`) no longer misleadingly reports "No files found to index" — these files are tracked at the file level and are now counted as indexed. Thanks @luojiyin1987 (#357).
|
||||||
|
|||||||
+18
-21
@@ -416,8 +416,8 @@ function writeErrorLog(projectPath: string, errors: Array<{ message: string; fil
|
|||||||
*/
|
*/
|
||||||
program
|
program
|
||||||
.command('init [path]')
|
.command('init [path]')
|
||||||
.description('Initialize CodeGraph in a project directory')
|
.description('Initialize CodeGraph in a project directory and build the initial index')
|
||||||
.option('-i, --index', 'Run initial indexing after initialization')
|
.option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
|
||||||
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
||||||
.action(async (pathArg: string | undefined, options: { index?: boolean; verbose?: boolean }) => {
|
.action(async (pathArg: string | undefined, options: { index?: boolean; verbose?: boolean }) => {
|
||||||
const projectPath = path.resolve(pathArg || process.cwd());
|
const projectPath = path.resolve(pathArg || process.cwd());
|
||||||
@@ -441,27 +441,24 @@ program
|
|||||||
const cg = await CodeGraph.init(projectPath, { index: false });
|
const cg = await CodeGraph.init(projectPath, { index: false });
|
||||||
clack.log.success(`Initialized in ${projectPath}`);
|
clack.log.success(`Initialized in ${projectPath}`);
|
||||||
|
|
||||||
if (options.index) {
|
// Indexing runs by default now. The legacy -i/--index flag is still
|
||||||
let result: IndexResult;
|
// accepted (so existing muscle memory and scripts don't break) but is a
|
||||||
|
// no-op — initializing always builds the initial index.
|
||||||
if (options.verbose) {
|
let result: IndexResult;
|
||||||
result = await cg.indexAll({
|
if (options.verbose) {
|
||||||
onProgress: createVerboseProgress(),
|
result = await cg.indexAll({
|
||||||
verbose: true,
|
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);
|
|
||||||
} else {
|
} 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 {
|
try {
|
||||||
const { offerWatchFallback } = await import('../installer');
|
const { offerWatchFallback } = await import('../installer');
|
||||||
|
|||||||
Reference in New Issue
Block a user