feat(core): refactor project copies for v2#31943
Merged
Merged
Conversation
ae006a9 to
7d004ec
Compare
8746c78 to
ecdfe48
Compare
49d786b to
79fb1e7
Compare
3b9d6ea to
7f551fb
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.
Type of change
What does this PR do?
Makes project-copy behavior location-aware so each core location owns its strategy registry. Strategy IDs are now open strings, while the built-in Git worktree implementation registers through the same internal registry.
Project directory persistence is centralized in
ProjectDirectories. The database now stores a nullablestrategyinstead ofmain/root/git_worktreedirectory types. Existing classifications are intentionally cleared by the migration and repopulated by project refresh. Refresh discovers ordinary Git roots and strategy-managed copies, updates changed strategies, and removes missing paths.Create, remove, and refresh are exposed through the V2 server with
LocationMiddleware. Legacy OpenCode keeps only the LLM-backed name-generation endpoint so the TUI can generate a name first, then create the copy through the location-aware API.The move-session dialog now uses the canonical project directory list, keeps the current checkout grouped separately, sorts other checkout roots before managed copies, and only enables deletion for non-current strategy-managed copies.
How did you verify your code works?
bun typecheckinpackages/corebun typecheckinpackages/serverbun typecheckinpackages/opencodebun typecheckinpackages/tuibun test test/project-directories.test.ts test/project-copy.test.tsinpackages/corebun test test/server/project-copy.test.tsinpackages/opencodebun run migration --checkinpackages/core./packages/sdk/js/script/build.tsScreenshots / recordings
Not included.
Checklist