Skip to content

fix(status): recommend a re-index when package.json alone adds or drops a framework - #3072

Merged
colbymchenry merged 1 commit into
mainfrom
claude/pr-3005-status-framework-hint
Oct 30, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
claude/pr-3005-status-framework-hint

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Summary

codegraph status now recommends a re-index when a framework comes or goes through package.json alone, with no source file changed. Before, adding express or @sveltejs/kit to package.json and running codegraph sync left status saying the index was up to date. Meanwhile an unchanged Express app's routes, or the goto('/login') in an unchanged +layout.svelte, stayed unlinked until a full codegraph index.

Lands #3005 by @inth3shadows.

Root cause

Since #2941 (#2516, unreleased), a sync records the frameworks that came or went since the last full index. But a sync detects again only when it extracts a file, so a manifest-only change recorded nothing.

The fix (from @inth3shadows, verbatim)

A full index also stamps the resolver's framework set (resolver_frameworks_at_index). getFrameworkChangesSinceIndex() now adds the difference between that stamp and the set the resolver detects now to what syncs recorded. The resolver already detects on every open, so this costs status nothing. A fresh codegraph status therefore sees a manifest-only change whether or not a sync ran.

Known limits, from the PR:

  • An index built before this has no stamp, so that half starts at its next full index.
  • A long-running server's resolver keeps its old set until it extracts a file, and the MCP codegraph_status tool doesn't show this hint at all. The hint is the CLI's.

What triggers the new advice

The frameworks the resolver detects when the project is opened, measured against the set it had at the end of the last full index: a framework dependency added to or dropped from a package.json (or another manifest detection reads), or files that change detection. A full codegraph index re-stamps and clears it.

Status output, before and after

SvelteKit fixture: indexed without @sveltejs/kit, then @sveltejs/kit added to package.json, then codegraph sync, then codegraph status.

main 6177692:

✓ Index is up to date

--json: "reindexRecommended": false, "frameworksChangedSinceIndex": null

This PR:

✓ Index is up to date

⚠ Frameworks changed since the last full index (added sveltekit-router); files indexed before then were read without the change.
ℹ Run "codegraph index" to re-index every file with them

--json: "reindexRecommended": true, "frameworksChangedSinceIndex": {"added":["sveltekit-router"],"removed":[]}

scenario (status after sync) main this PR
@sveltejs/kit added null {added: [sveltekit-router]}
@sveltejs/kit removed null {removed: [sveltekit-router]}
express added, Express app unchanged null {added: [express]}
nothing changed null null
after a full codegraph index null null

No false advice

A fresh index followed by status --json in a new process, on 18 real repos, reports no change on any. The repos: express, flask, gin, vuejs/core, excalidraw, vuejs/docs, NekoBox, starlight, the genkit docsite, wm-project-astro-components, codegraph's own source, justgage, element-plus-playground, diploi.com, devfest-website, a portfolio, nodejsdesignpatterns.com, and vscode's base+editor. Express, Flask, Next.js, React, Vue, Vue Router, Astro, Svelte, Spring, Go and UIKit were detected among them.

What we changed

The CHANGELOG only. The PR folds its note into the unreleased #2516 bullet, which is right for an unreleased feature; we added the credit and the issue number.

Validation (Windows 11, main 6177692)

  • Red/green: 3 of the 4 new tests fail with main's src/index.ts. The 4th, an unchanged project staying silent, passes on both. All 4 pass with the fix, as do the 8 sync-framework-detection tests.
  • Full suite on this exact commit: CODEGRAPH_KERNEL_EXPECT=1 npx vitest run --maxWorkers=4 --minWorkers=1, with CODEGRAPH_NO_DAEMON unset: Test Files 810 passed | 6 skipped (816); Tests 9611 passed | 86 skipped (9697); 0 failed.

Fixes #3007

Lands #3005 by @inth3shadows

🤖 Generated with Claude Code

…ps a framework

Since PR #2941, a sync records the frameworks that came or went since the
last full index, and `codegraph status` recommends a re-index. But a sync
detects frameworks again only when it extracts a file, so adding `express`
or `@sveltejs/kit` to package.json with no source file edited recorded
nothing: status said the index was up to date while an unchanged Express
app's routes, or the `goto('/login')` in an unchanged +layout.svelte,
stayed unlinked until a full index.

A full index now also stamps the resolver's framework set, and
getFrameworkChangesSinceIndex() adds the difference between that stamp and
the set the resolver detects now (it detects on every open) to what syncs
recorded. So a fresh `codegraph status` sees a manifest-only change whether
or not a sync ran. An index built before this has no stamp, so that half
starts at its next full index. A long-running server's resolver keeps its
old set until it extracts a file, as before.

Validation on main 6177692 (Windows 11):
- Red/green: 3 of the 4 new tests fail with main's src/index.ts; the 4th,
  an unchanged project staying silent, passes on both. All 4 pass with the
  fix, as do the 8 sync-framework-detection tests.
- The CLI before and after, on a SvelteKit fixture indexed without
  @sveltejs/kit, then given it in package.json, then synced: main's status
  says "Index is up to date", and --json has reindexRecommended false and
  frameworksChangedSinceIndex null. With the fix, status adds "Frameworks
  changed since the last full index (added sveltekit-router)", and --json
  has true and {added: [sveltekit-router]}. Dropping the dependency gives
  {removed: [sveltekit-router]}, adding express to an Express app gives
  {added: [express]}, an unchanged project gives null on both arms, and a
  full `codegraph index` clears the advice.
- No false advice: a fresh index and then `status --json` on 18 real repos
  reports no change on any. They include express, flask, gin, vuejs/core,
  excalidraw, vuejs/docs, starlight, codegraph's own source and vscode's
  base and editor; Express, Flask, Next.js, React, Vue, Vue Router, Astro,
  Svelte, Spring, Go and UIKit are detected among them.

Original PR #3005 by @inth3shadows.
Fixes #3007

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegraph status stays silent when package.json alone adds or drops a framework

2 participants