Skip to content

feat(cli): add codegraph upgrade self-update + stale-index re-index hint#710

Merged
colbymchenry merged 1 commit into
mainfrom
feat/codegraph-upgrade
Jun 6, 2026
Merged

feat(cli): add codegraph upgrade self-update + stale-index re-index hint#710
colbymchenry merged 1 commit into
mainfrom
feat/codegraph-upgrade

Conversation

@colbymchenry
Copy link
Copy Markdown
Owner

Adds a codegraph upgrade command (requested in #679) and a re-index notification when an index predates the running engine.

codegraph upgrade [version]

Detects how the CLI was installed and updates in place:

  • Bundle (install.sh, macOS/Linux) — re-runs the canonical install.sh (single source of truth), reusing the detected install dir.
  • Bundle (install.ps1, Windows) — an in-place rename-and-extract swap: a running node.exe can't be deleted, only renamed, so we rename it aside and extract the new bundle over current\ synchronously. (An earlier detached-helper design proved fragile under Windows job objects / PID reuse during VM testing.)
  • npmnpm i -g @colbymchenry/codegraph@latest (npm.cmd on Windows; v-prefix stripped from pinned specs).
  • npx / source checkout — explains the right action instead of pretending to upgrade.

Flags: --check (report only), --force, and a positional <version> to pin.

Re-index notification

Every full index is stamped with the engine's EXTRACTION_VERSION in the existing project_metadata table (no schema change). codegraph status (and --json) flags an index built by an older engine and recommends a re-index; upgrade prints the same reminder. Gated on EXTRACTION_VERSION (bumped only when extraction output changes) so it never nags on extraction-neutral releases.

Validation (end-to-end, not just unit tests)

  • macOS — built a real bundle, laid it out like install.sh, ran a forced upgrade that re-ran install.sh and repointed symlinks, contained in a temp dir.
  • Linux (Docker) — real curl|sh upgrade in a clean node:22-bookworm container; also fixed a portability bug (hasCommand now scans PATH in pure Node instead of spawning command -v, which only worked on macOS).
  • Windows (Parallels VM) — the real in-place rename swap (node.exe mtime confirmed changed), detection, --check, and engine + stamping under the Windows ARM bundle.
  • 32 new unit tests; full suite green (1219 passed / 2 skipped).

Closes #679

🤖 Generated with Claude Code

… hint

`codegraph upgrade [version]` detects how the CLI was installed — the standalone
install.sh/install.ps1 bundle, npm-global, npx, or a source checkout — and
updates in place: re-running the canonical install.sh on macOS/Linux, an
in-place rename-and-extract swap on Windows (a running node.exe can't be
deleted, only renamed, so the detached-helper approach is avoided), and
npm/npx/source-specific guidance otherwise. Flags: `--check` (report only),
`--force`, and a positional version to pin.

Each full index is now stamped with the engine's EXTRACTION_VERSION in
project_metadata; `codegraph status` (and `--json`) flags an index built by an
older engine and recommends re-indexing, and `upgrade` prints the same reminder.
Gated on EXTRACTION_VERSION so it never nags on extraction-neutral releases.

Validated end-to-end on macOS (real bundle upgrade), Linux (Docker, real
curl|sh) and Windows (Parallels VM, real in-place swap). 32 new unit tests.

Closes #679

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@colbymchenry colbymchenry merged commit 4e5cf2d into main Jun 6, 2026
@colbymchenry colbymchenry deleted the feat/codegraph-upgrade branch June 6, 2026 17:38
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.

Support codegraph upgrade command for CLI installed via install.sh

1 participant