fix(version-check): recover devkit clone when DEVKIT_CLONE env unset (#17)#23
Merged
Conversation
…unset Closes Invenco-Cloud-Systems-ICS/ai-devkit#17. `_wb_local_version` previously returned `0.0.0` whenever `$DEVKIT_CLONE` was empty, so any shell that had not sourced `~/.zprofile` saw `devkit doctor` and `devkit.upgrade` report a stale `0.0.0` local version even after a successful pull. The pull itself worked; only the version read-out was wrong, making the upgrade look like a silent no-op. `_wb_clone_path` now falls back through three layers: 1. env var (canonical) 2. install-time state file at `~/.local/share/wb-versioncheck/<tool>-clone.path` 3. resolve installed command symlink, walk up to `version.json` `install.zsh` writes the devkit state file alongside the existing lib distribution. Ralph relies on the symlink-discovery fallback (no change needed in ai-ralph). Tests cover all three fallback paths and the end-to-end issue #17 scenario. Co-Authored-By: Claude Opus 4.7 (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.
Summary
devkit upgrade/devkit doctorreported0.0.0as local version (and[devkit] upgrade 0.0.0 -> X.Y.Zlooked like the upgrade had silently failed)._wb_local_versionshort-circuits to0.0.0when$DEVKIT_CLONEis unset. Any shell that had not yet sourced~/.zprofile(e.g. after a fresh install in the same session, ordevkit doctorimmediately aftergit clone) hit this path._wb_clone_pathnow falls back through three layers — env var, install-time state file at~/.local/share/wb-versioncheck/<tool>-clone.path, and symlink-discovery fromcommand -v <tool>.upgradewalking up toversion.json.Changes
lib/version-check.sh_wb_state_dir,_wb_resolve_link,_wb_find_version_root,_wb_discover_clone_via_symlink._wb_clone_pathextended with state-file + symlink fallbacks.WB_DISABLE_DISCOVERY=1opts out of fallback 2 (tests).install.zsh$SHARE_DIR/devkit-clone.pathnext to the existing lib distribution.tests/test-version-check.zshdocs/versioning.mdTest plan
zsh tests/run-all.zsh— all green, no regressions._wb_local_version devkitreturns the correct version withDEVKIT_CLONE=(empty) andWB_DISABLE_DISCOVERY=1.devkit-upgrade.zsh --yes --skip-installagainst the fixture; post-upgrade version read with env unset returns the bumped version (1.1.0).install.zshagainst a fake$HOME; state file is written with mode 0644 and the correct absolute clone path.Migration
Existing users get the fix the next time they upgrade —
devkit.upgraderunsinstall.zshas part of the upgrade flow, which writes the state file. The first upgrade after this PR still shows the old0.0.0 -> X.Y.Zline (because the local version is read beforeinstall.zshruns), but every subsequentdevkit doctor/devkit upgradeinvocation reads the correct version regardless of shell session state.Ralph picks up the fix via the symlink-discovery fallback — no change required in
ai-ralph.🤖 Generated with Claude Code