feat(cli): add codegraph upgrade self-update + stale-index re-index hint#710
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
codegraph upgradecommand (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:
install.sh, macOS/Linux) — re-runs the canonicalinstall.sh(single source of truth), reusing the detected install dir.install.ps1, Windows) — an in-place rename-and-extract swap: a runningnode.execan't be deleted, only renamed, so we rename it aside and extract the new bundle overcurrent\synchronously. (An earlier detached-helper design proved fragile under Windows job objects / PID reuse during VM testing.)npm i -g @colbymchenry/codegraph@latest(npm.cmdon Windows;v-prefix stripped from pinned specs).Flags:
--check(report only),--force, and a positional<version>to pin.Re-index notification
Every full index is stamped with the engine's
EXTRACTION_VERSIONin the existingproject_metadatatable (no schema change).codegraph status(and--json) flags an index built by an older engine and recommends a re-index;upgradeprints the same reminder. Gated onEXTRACTION_VERSION(bumped only when extraction output changes) so it never nags on extraction-neutral releases.Validation (end-to-end, not just unit tests)
install.sh, ran a forced upgrade that re-raninstall.shand repointed symlinks, contained in a temp dir.curl|shupgrade in a cleannode:22-bookwormcontainer; also fixed a portability bug (hasCommandnow scans PATH in pure Node instead of spawningcommand -v, which only worked on macOS).node.exemtime confirmed changed), detection,--check, and engine + stamping under the Windows ARM bundle.Closes #679
🤖 Generated with Claude Code