Skip to content

feat(core): refactor project copies for v2#31943

Merged
jlongster merged 2 commits into
devfrom
jlongster/project-copy-location-refactor
Jun 12, 2026
Merged

feat(core): refactor project copies for v2#31943
jlongster merged 2 commits into
devfrom
jlongster/project-copy-location-refactor

Conversation

@jlongster

@jlongster jlongster commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 nullable strategy instead of main / root / git_worktree directory 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 typecheck in packages/core
  • bun typecheck in packages/server
  • bun typecheck in packages/opencode
  • bun typecheck in packages/tui
  • bun test test/project-directories.test.ts test/project-copy.test.ts in packages/core
  • bun test test/server/project-copy.test.ts in packages/opencode
  • bun run migration --check in packages/core
  • Regenerated the JavaScript SDK with ./packages/sdk/js/script/build.ts

Screenshots / recordings

Not included.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jlongster jlongster force-pushed the jlongster/project-copy-location-refactor branch from ae006a9 to 7d004ec Compare June 11, 2026 22:11
@jlongster jlongster marked this pull request as ready for review June 12, 2026 03:11
@jlongster jlongster force-pushed the jlongster/project-copy-location-refactor branch 2 times, most recently from 8746c78 to ecdfe48 Compare June 12, 2026 16:38
@jlongster jlongster changed the title refactor project directories feat(core): refactor project copies for v2 Jun 12, 2026
@jlongster jlongster changed the title feat(core): refactor project copies for v2 feat(core): make project copies location-aware Jun 12, 2026
@jlongster jlongster force-pushed the jlongster/project-copy-location-refactor branch 2 times, most recently from 49d786b to 79fb1e7 Compare June 12, 2026 17:47
@jlongster jlongster force-pushed the jlongster/project-copy-location-refactor branch from 3b9d6ea to 7f551fb Compare June 12, 2026 18:23
@jlongster jlongster changed the title feat(core): make project copies location-aware feat(core): refactor project copies for v2 Jun 12, 2026
@jlongster jlongster merged commit c2e6b18 into dev Jun 12, 2026
12 of 14 checks passed
@jlongster jlongster deleted the jlongster/project-copy-location-refactor branch June 12, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant