feat(bun): track provider packages for automatic cleanup#10275
Open
jerome-benoit wants to merge 15 commits intoanomalyco:devfrom
Open
feat(bun): track provider packages for automatic cleanup#10275jerome-benoit wants to merge 15 commits intoanomalyco:devfrom
jerome-benoit wants to merge 15 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds automatic tracking and cleanup of npm packages used by providers to prevent accumulation of unused dependencies when providers switch SDKs.
Changes:
- Adds provider-to-package tracking in
package.jsonunderopencode.providerssection - Modifies
BunProc.install()to accept an optionalproviderIDparameter for tracking - Implements automatic removal of old packages when a provider switches to a different SDK
- Adds
OPENCODE_TEST_CACHEenvironment variable for test isolation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/opencode/src/bun/index.ts | Implements provider tracking logic, package switching detection, and automatic cleanup of old packages |
| packages/opencode/src/provider/provider.ts | Passes model.providerID to BunProc.install() to enable tracking |
| packages/opencode/src/global/index.ts | Adds dynamic getter for cache path that respects OPENCODE_TEST_CACHE env var |
| packages/opencode/test/bun.test.ts | Adds 10 integration tests covering provider tracking, package switching, and backward compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
326ca0e to
0607311
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
When a provider switches SDK packages, the old package is now automatically removed to avoid accumulating unused dependencies in the cache. - Add provider tracking in package.json under opencode.providers section - Modify BunProc.install() to accept optional providerID parameter - Remove old package when provider switches to a different SDK - Add comprehensive integration tests for provider tracking
- Don't remove package if other providers still use it - Fix version comparison to handle "latest" correctly - Add test for shared package scenario
efaf2f4 to
29ccd76
Compare
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 #10276
What changed
Track provider→package mappings in
package.jsonunderopencode.providers. Reference counting ensures packages are only removed when no provider uses them.Key changes:
opencode.providerssection to track which provider uses which packageversion=latestwithPackageRegistry.isOutdated()for proper staleness detectionreadPackageJson,writePackageJson,track,cleanup,resolveVersion,finalizeHow to verify
19 tests cover the full decision tree for
BunProc.install().