Skip to content

Commit 0bc5a77

Browse files
authored
fix(cli): show cold-start preparation (#160)
* fix(cli): show cold-start preparation * fix(cli): scope startup preparation accurately * test(cli): verify cold-start timing and modes * test(cli): cover MCP startup preparation * lockfile * docs(cli): avoid exact preparation message literal Describe the preparation progress message generically so docs stay accurate across interactive and redirected/log presentations.
1 parent a5a30a9 commit 0bc5a77

15 files changed

Lines changed: 543 additions & 109 deletions

codegraph-skill/codegraph/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Use `--root` to define the boundary for config lookup, cache scope, path confine
3636
- `codegraph.config.json` discovery globs are project-root-relative.
3737
- CLI `--include-glob` and `--ignore-glob` values are one-off filters relative to each active scan root.
3838
- Use `--no-gitignore` only when ignored files are intentionally in scope.
39-
- Index builds and updates report progress automatically on interactive stderr while reusable cache hits stay quiet. Use `--progress` for redirected progress logs or `--no-progress` to suppress feedback; JSON stdout is unchanged.
39+
- Every command that starts by loading the project index reports preparation on stderr when startup checks exceed a brief threshold, then reports builds or updates automatically. Fast reusable cache hits stay quiet; use `--progress` for redirected logs or `--no-progress` to suppress feedback, and JSON stdout remains unchanged.
4040

4141
## Choose the Smallest Follow-up
4242

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Short JSON shape:
311311
- Small orientation budgets default to `--health skip`. Medium and large default to `--health summary`, which counts cycles and unresolved imports while omitting duplicate health; use `--health full` when exhaustive duplicate counts matter.
312312
- Use `packet get` with file paths, symbol names, SQL object names, file/symbol/chunk/SQL/graph handles, or review handles to retrieve bounded evidence plus follow-up commands.
313313
- Agent commands reuse the incremental index path and default to disk cache. Use shared index flags such as `--cache`, `--cache-strict`, `--cache-verify`, `--threads`, `--native`, `--workers`, `--include-glob`, `--ignore-glob`, and `--no-gitignore` when the packet should match a specific scan mode.
314-
- When an index must be built or updated, interactive terminals immediately show progress on stderr; cache and snapshot hits stay quiet. Use `--progress` to force newline-delimited updates when stderr is redirected, or `--no-progress` to suppress feedback.
314+
- Every command that starts by loading the project index reports a preparation progress message on stderr when startup checks exceed a brief threshold, then transitions to build or update progress when work is required. Fast cache and snapshot hits stay quiet; use `--progress` for redirected progress logs or `--no-progress` to suppress feedback.
315315
316316
#### Live file views
317317

docs/coverage/js.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,52 @@ Source: `coverage/js/lcov.info`
44

55
## Summary
66

7-
| Metric | Hit | Found | Coverage |
8-
| --- | ---: | ---: | ---: |
9-
| Lines | 21778 | 24063 | 90.50% |
10-
| Functions | 3682 | 3906 | 94.27% |
11-
| Branches | 16357 | 20980 | 77.96% |
7+
| Metric | Hit | Found | Coverage |
8+
| --------- | ----: | ----: | -------: |
9+
| Lines | 21778 | 24063 | 90.50% |
10+
| Functions | 3682 | 3906 | 94.27% |
11+
| Branches | 16357 | 20980 | 77.96% |
1212

1313
## Least-covered Files
1414

15-
| File | Lines | Functions | Branches |
16-
| --- | ---: | ---: | ---: |
17-
| `src/languages/definitions/htmlStub.ts` | 50.00% | 50.00% | n/a |
18-
| `src/cli/index.ts` | 54.29% | 33.33% | 48.84% |
19-
| `src/cli/navigation.ts` | 55.36% | 66.67% | 56.25% |
20-
| `src/languages/definitions/javascript.ts` | 62.50% | 83.33% | 55.56% |
21-
| `src/cli/explore.ts` | 62.50% | 100.00% | 50.00% |
22-
| `src/languages/definitions/typescript.ts` | 62.86% | 81.82% | 41.18% |
23-
| `src/cli/install.ts` | 63.41% | 71.43% | 63.33% |
24-
| `src/util/projectFiles/parsers.ts` | 64.29% | 76.92% | 41.67% |
25-
| `src/indexer/parsed-cache.ts` | 64.71% | 100.00% | 58.33% |
26-
| `src/indexer.ts` | 66.67% | 66.67% | 100.00% |
27-
| `src/languages/definitions/css.ts` | 66.67% | 0.00% | n/a |
28-
| `src/languages/definitions/html.ts` | 66.67% | 0.00% | n/a |
29-
| `src/languages/definitions/less.ts` | 66.67% | 0.00% | n/a |
30-
| `src/languages/definitions/sql.ts` | 66.67% | 0.00% | n/a |
31-
| `src/languages/definitions/svelte.ts` | 66.67% | 0.00% | n/a |
32-
| `src/languages/definitions/vue.ts` | 66.67% | 0.00% | n/a |
33-
| `src/drift/report.ts` | 67.44% | 100.00% | 46.58% |
34-
| `src/cli/graph.ts` | 67.55% | 63.16% | 43.11% |
35-
| `src/agent/handles.ts` | 68.00% | 91.67% | 45.45% |
36-
| `src/impact/testPatterns.ts` | 69.70% | 63.64% | 61.54% |
15+
| File | Lines | Functions | Branches |
16+
| ----------------------------------------- | -----: | --------: | -------: |
17+
| `src/languages/definitions/htmlStub.ts` | 50.00% | 50.00% | n/a |
18+
| `src/cli/index.ts` | 54.29% | 33.33% | 48.84% |
19+
| `src/cli/navigation.ts` | 55.36% | 66.67% | 56.25% |
20+
| `src/languages/definitions/javascript.ts` | 62.50% | 83.33% | 55.56% |
21+
| `src/cli/explore.ts` | 62.50% | 100.00% | 50.00% |
22+
| `src/languages/definitions/typescript.ts` | 62.86% | 81.82% | 41.18% |
23+
| `src/cli/install.ts` | 63.41% | 71.43% | 63.33% |
24+
| `src/util/projectFiles/parsers.ts` | 64.29% | 76.92% | 41.67% |
25+
| `src/indexer/parsed-cache.ts` | 64.71% | 100.00% | 58.33% |
26+
| `src/indexer.ts` | 66.67% | 66.67% | 100.00% |
27+
| `src/languages/definitions/css.ts` | 66.67% | 0.00% | n/a |
28+
| `src/languages/definitions/html.ts` | 66.67% | 0.00% | n/a |
29+
| `src/languages/definitions/less.ts` | 66.67% | 0.00% | n/a |
30+
| `src/languages/definitions/sql.ts` | 66.67% | 0.00% | n/a |
31+
| `src/languages/definitions/svelte.ts` | 66.67% | 0.00% | n/a |
32+
| `src/languages/definitions/vue.ts` | 66.67% | 0.00% | n/a |
33+
| `src/drift/report.ts` | 67.44% | 100.00% | 46.58% |
34+
| `src/cli/graph.ts` | 67.55% | 63.16% | 43.11% |
35+
| `src/agent/handles.ts` | 68.00% | 91.67% | 45.45% |
36+
| `src/impact/testPatterns.ts` | 69.70% | 63.64% | 61.54% |
3737

3838
## Type-Only Or Re-Export Files
3939

4040
These files have line records but no function or branch records, so they are tracked outside the runtime ranking.
4141

42-
| File | Lines | Functions | Branches |
43-
| --- | ---: | ---: | ---: |
44-
| `src/languages/definitions/jsFamily.ts` | 100.00% | n/a | n/a |
45-
| `src/duplicate-keywords.ts` | 100.00% | n/a | n/a |
46-
| `src/impact/types.ts` | 100.00% | n/a | n/a |
47-
| `src/languages/definitions/adoc.ts` | 100.00% | n/a | n/a |
48-
| `src/languages/definitions/astro.ts` | 100.00% | n/a | n/a |
49-
| `src/languages/definitions/hbs.ts` | 100.00% | n/a | n/a |
50-
| `src/languages/definitions/markdown.ts` | 100.00% | n/a | n/a |
51-
| `src/languages/definitions/mdx.ts` | 100.00% | n/a | n/a |
52-
| `src/languages/definitions/rst.ts` | 100.00% | n/a | n/a |
53-
| `src/util/graphOnlyExtensions.ts` | 100.00% | n/a | n/a |
42+
| File | Lines | Functions | Branches |
43+
| --------------------------------------- | ------: | --------: | -------: |
44+
| `src/languages/definitions/jsFamily.ts` | 100.00% | n/a | n/a |
45+
| `src/duplicate-keywords.ts` | 100.00% | n/a | n/a |
46+
| `src/impact/types.ts` | 100.00% | n/a | n/a |
47+
| `src/languages/definitions/adoc.ts` | 100.00% | n/a | n/a |
48+
| `src/languages/definitions/astro.ts` | 100.00% | n/a | n/a |
49+
| `src/languages/definitions/hbs.ts` | 100.00% | n/a | n/a |
50+
| `src/languages/definitions/markdown.ts` | 100.00% | n/a | n/a |
51+
| `src/languages/definitions/mdx.ts` | 100.00% | n/a | n/a |
52+
| `src/languages/definitions/rst.ts` | 100.00% | n/a | n/a |
53+
| `src/util/graphOnlyExtensions.ts` | 100.00% | n/a | n/a |
5454

5555
Generated from LCOV by `node ./scripts/coverage-markdown.mjs`.

docs/coverage/native.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ Source: `coverage/native/lcov.info`
44

55
## Summary
66

7-
| Metric | Hit | Found | Coverage |
8-
| --- | ---: | ---: | ---: |
9-
| Lines | 604 | 626 | 96.49% |
10-
| Functions | 45 | 51 | 88.24% |
11-
| Branches | 0 | 0 | n/a |
7+
| Metric | Hit | Found | Coverage |
8+
| --------- | --: | ----: | -------: |
9+
| Lines | 604 | 626 | 96.49% |
10+
| Functions | 45 | 51 | 88.24% |
11+
| Branches | 0 | 0 | n/a |
1212

1313
## Least-covered Files
1414

15-
| File | Lines | Functions | Branches |
16-
| --- | ---: | ---: | ---: |
17-
| `packages/codegraph-native/src/lib.rs` | 89.47% | 70.00% | n/a |
18-
| `packages/codegraph-native/src/parser_pool.rs` | 92.86% | 66.67% | n/a |
19-
| `packages/codegraph-native/src/duplicate_tokens.rs` | 93.20% | 100.00% | n/a |
20-
| `packages/codegraph-native/src/projection.rs` | 97.50% | 100.00% | n/a |
21-
| `packages/codegraph-native/src/query.rs` | 99.31% | 92.86% | n/a |
22-
| `packages/codegraph-native/src/duplicate_keywords.rs` | 100.00% | 100.00% | n/a |
23-
| `packages/codegraph-native/src/languages.rs` | 100.00% | 100.00% | n/a |
24-
| `packages/codegraph-native/src/types.rs` | 100.00% | 100.00% | n/a |
15+
| File | Lines | Functions | Branches |
16+
| ----------------------------------------------------- | ------: | --------: | -------: |
17+
| `packages/codegraph-native/src/lib.rs` | 89.47% | 70.00% | n/a |
18+
| `packages/codegraph-native/src/parser_pool.rs` | 92.86% | 66.67% | n/a |
19+
| `packages/codegraph-native/src/duplicate_tokens.rs` | 93.20% | 100.00% | n/a |
20+
| `packages/codegraph-native/src/projection.rs` | 97.50% | 100.00% | n/a |
21+
| `packages/codegraph-native/src/query.rs` | 99.31% | 92.86% | n/a |
22+
| `packages/codegraph-native/src/duplicate_keywords.rs` | 100.00% | 100.00% | n/a |
23+
| `packages/codegraph-native/src/languages.rs` | 100.00% | 100.00% | n/a |
24+
| `packages/codegraph-native/src/types.rs` | 100.00% | 100.00% | n/a |
2525

2626
Generated from LCOV by `node ./scripts/coverage-markdown.mjs`.

docs/plans/2026-07-03-08-framework-route-nodes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type RouteNode = {
2929
id: string;
3030
kind: "route";
3131
file: string;
32-
name: string; // GET /users/:id
32+
name: string; // GET /users/:id
3333
method?: string;
3434
pathPattern: string;
3535
range: SourceRange;

docs/plans/2026-07-03-core-command-performance-cache-sync.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Measured from the local `dist` CLI on 2026-07-03:
4747
### Task 1: Add Timing Reports for `search`
4848

4949
**Files:**
50+
5051
- Modify: `src/cli/search.ts`
5152
- Modify: `src/cli.ts`
5253
- Test: `tests/cli-command-modules.test.ts`
@@ -182,6 +183,7 @@ git commit -m "feat: add search timing report"
182183
### Task 2: Add Timing Reports for `inspect`
183184

184185
**Files:**
186+
185187
- Modify: `src/cli/inspect.ts`
186188
- Modify: `src/cli.ts`
187189
- Test: `tests/cli-command-modules.test.ts`
@@ -288,6 +290,7 @@ git commit -m "feat: add inspect timing report"
288290
### Task 3: Make `inspect` Duplicate Detection Opt-In
289291

290292
**Files:**
293+
291294
- Modify: `src/cli/inspect.ts`
292295
- Modify: `src/cli/help.ts`
293296
- Modify: `docs/cli.md`
@@ -362,18 +365,18 @@ In `src/cli/inspect.ts`, change `InspectReport["duplicates"]` to a union:
362365
In `buildInspectReport`, add `includeDuplicates: boolean` and wrap duplicate detection:
363366

364367
```ts
365-
const duplicates: InspectReport["duplicates"] = includeDuplicates
366-
? {
367-
enabled: true,
368-
total:
369-
duplicateResult.groups.length +
370-
duplicateResult.omittedCounts.groups +
371-
duplicateResult.omittedCounts.candidatePairs,
372-
omitted: duplicateResult.omittedCounts.groups + duplicateResult.omittedCounts.candidatePairs,
373-
minConfidence: duplicateMinConfidence,
374-
top: duplicateResult.groups.map(summarizeDuplicateGroup),
375-
}
376-
: { enabled: false };
368+
const duplicates: InspectReport["duplicates"] = includeDuplicates
369+
? {
370+
enabled: true,
371+
total:
372+
duplicateResult.groups.length +
373+
duplicateResult.omittedCounts.groups +
374+
duplicateResult.omittedCounts.candidatePairs,
375+
omitted: duplicateResult.omittedCounts.groups + duplicateResult.omittedCounts.candidatePairs,
376+
minConfidence: duplicateMinConfidence,
377+
top: duplicateResult.groups.map(summarizeDuplicateGroup),
378+
}
379+
: { enabled: false };
377380
```
378381

379382
Use `if` blocks instead of a nested ternary if the expression grows.
@@ -413,6 +416,7 @@ git commit -m "perf: make inspect duplicates opt-in"
413416
### Task 4: Add Safe Bloom Prefilter for Text Search
414417

415418
**Files:**
419+
416420
- Modify: `src/agent/search.ts`
417421
- Test: `tests/agent-search.test.ts`
418422

@@ -536,6 +540,7 @@ git commit -m "perf: prefilter identifier text search"
536540
### Task 5: Add Agent Session File Fingerprints
537541

538542
**Files:**
543+
539544
- Modify: `src/agent/session.ts`
540545
- Test: `tests/agent-session.test.ts`
541546

@@ -590,7 +595,7 @@ Use this helper in both `loadFiles` and `loadBase`.
590595
Extend the type:
591596

592597
```ts
593-
fileFingerprint: () => Promise<string>;
598+
fileFingerprint: () => Promise<string>;
594599
```
595600

596601
Implement it with fresh discovery:
@@ -599,7 +604,10 @@ Implement it with fresh discovery:
599604
const fileFingerprint = async (): Promise<string> => {
600605
const discoveryOptions = await resolveAgentDiscovery(options);
601606
const files = await listProjectFiles(options.root, undefined, discoveryOptions);
602-
return files.map((file) => normalizePath(file)).sort().join("\n");
607+
return files
608+
.map((file) => normalizePath(file))
609+
.sort()
610+
.join("\n");
603611
};
604612
```
605613

@@ -627,6 +635,7 @@ git commit -m "feat: expose agent session file fingerprint"
627635
### Task 6: Add MCP Cache Sync Controller
628636

629637
**Files:**
638+
630639
- Create: `src/mcp/cacheSync.ts`
631640
- Modify: `src/mcp/server.ts`
632641
- Test: `tests/mcp-server.test.ts`
@@ -790,6 +799,7 @@ git commit -m "feat: add mcp cache sync controller"
790799
### Task 7: Add MCP Cache Sync CLI Flags and Docs
791800

792801
**Files:**
802+
793803
- Modify: `src/cli/mcp.ts`
794804
- Modify: `src/cli/help.ts`
795805
- Modify: `docs/cli.md`
@@ -907,6 +917,7 @@ git commit -m "feat: expose mcp cache sync flags"
907917
### Task 8: Add Lifecycle Sync for HTTP Session Initialize
908918

909919
**Files:**
920+
910921
- Modify: `src/mcp/server.ts`
911922
- Test: `tests/mcp-server.test.ts`
912923

@@ -1003,6 +1014,7 @@ git commit -m "feat: sync mcp cache on lifecycle"
10031014
### Task 9: Final Verification and Timing Evidence
10041015

10051016
**Files:**
1017+
10061018
- Modify: `docs/plans/2026-06-06-performance-and-cache-opportunities.md` only if status boxes need updating.
10071019
- No production code changes.
10081020

0 commit comments

Comments
 (0)