fix: auto-update tracks installed dist-tag, not hardcoded latest - #330
Merged
Conversation
- isAutoUpdatableSpec now accepts registry dist-tag words (stable, dev, pr-N) — previously rejected, so README installs (@stable) never auto-updated - specUpdateTag maps install spec → dist-tag: tag word → itself, */ranges → latest, exact pins/non-registry → undefined (never update) - fetchLatestVersion queries /name/<tag> so @stable follows the stable track - updateTarget returns {removeDir, spec}; updateRemoveDir kept as wrapper - tests: +5 (fail-first verified), docs: autoUpdate tag semantics in 4 files, devlog: 2026-08-21_autoupdate-by-tag
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-330 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-08-21_autoupdate-by-tag" --globalOption C — Download artifact
tar xzf opencode-acp-pr330.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
This comment is automatically updated on each push. |
- same-PR preview increments compare numerically (pr.327.47 > pr.327.46) - dev track moves forward; release outranks preview per semver - channel pinning keeps @Pr-N installs compared only against their own tag
6 tasks
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.
Fixes #328
Problem
The README's canonical install is
opencode plugin opencode-acp@stable --global. Two defects made auto-update dead for that install path:isAutoUpdatableSpec("stable")→ false — bare dist-tag words (stable,dev,pr-N) matched no allowed form, so auto-update silently never fired for every README install.fetchLatestVersionhardcoded thelatestdist-tag — even past the gate, an@stableinstall would compare against thelatesttrack; after removing the wrapper, opencode reinstalls@stable, so the update could never land and the toast would claim a version the user can't get.Root cause evidence
packages/core/src/npm.ts: wrapper dir is named after the user spec (~/.cache/opencode/packages/opencode-acp@stable/),savePrefix: ""pins the exact resolved version in the wrapperpackage.json, and an existingnode_modules/<name>short-circuits re-reify — so removing the wrapper is the only refresh path, and it must track the install tag.GET /opencode-acp/stable→ 1.14.19,GET /opencode-acp/pr-327→ 1.14.22-pr.327.46 (dist-tag resolution on the version endpoint confirmed; the package publisheslatest,stable,dev+ 25pr-*tags).Fix
Auto-update now tracks the dist-tag the user installed from:
opencode-acp@stable/@dev/@pr-N/opencode-acp/<tag>@latest/^ranges /*/opencode-acp/latest1.14.22)file:/github:/ bare namespecUpdateTag()(new): tag word → itself;*/ranges →latest; pins/non-registry →undefined(never update)isAutoUpdatableSpec(): accepts registry dist-tag words (pr-NCI preview installs now auto-updatable)fetchLatestVersion(name, tag): queries/name/<tag>instead of hardcoded/latestupdateTarget()returns{removeDir, spec};updateRemoveDirkept as compat wrapperisDistTag(): charset[A-Za-z0-9._-], rejects exact semver pins and x-rangesVerification
isAutoUpdatableSpec("stable") === false), then passing after fixtests/update.test.ts: 10/10 passtsc --noEmit: 0 errorsREADME.md,README.zh-CN.md,CONFIGURATION.md,CONFIGURATION.zh-CN.md2026-08-21_autoupdate-by-tag/(REQ + WORKLOG)