Files
codegraph/__tests__
Eric MinishandClaude Opus 5.5 5526e33d1d fix(status): recommend a re-index when package.json alone adds or drops 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 61776927 (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>
2026-10-30 14:36:12 +00:00
..