Skip to content

fix: unify adoption marker format across CLI and plugin#36

Merged
guodong-sq merged 1 commit intomainfrom
parity/1-unify-adoption-marker
Mar 21, 2026
Merged

fix: unify adoption marker format across CLI and plugin#36
guodong-sq merged 1 commit intomainfrom
parity/1-unify-adoption-marker

Conversation

@guodong-sq
Copy link
Collaborator

@guodong-sq guodong-sq commented Mar 21, 2026

Summary

Replace the plugin's JSON wt-provisioned marker with the CLI's original directory-based wt/adopted approach. The marker is now a plain text file at <gitdir>/wt/adopted containing the context name.

CLI changes:

  • Upgrade wt/adopted from empty sentinel to carry the context name (echo "$context" > wt/adopted)
  • Add wt_read_adopted_context to read context name from marker
  • No awareness of plugin's wt-provisioned format — the CLI only knows wt/adopted

Plugin changes:

  • Rewrite ProvisionMarkerService to use wt/adopted plain text (Files.readString/writeString)
  • Delete ProvisionMarker and ProvisionEntry data classes (Gson no longer needed for markers)
  • Add fallback read from legacy wt-provisioned JSON during transition (plugin's own migration responsibility)
  • Fix marker write timing — write only after successful metadata import + Bazel symlinks (matching CLI semantics)
  • Simplify WorktreePanel tooltip (no multi-context provision display)
  • Clean up legacy wt-provisioned on write

Design rationale:

Investigation confirmed provisioned_at and provisioned_by JSON fields were write-only (never read in production code), and multi-context provision tracking added complexity without value. The CLI's wt/ namespace directory with a simple text file is portable, extensible, and equally functional.

Backward compatibility:

  • Old empty wt/adopted files still recognized (existence check unchanged)
  • Plugin reads legacy wt-provisioned JSON via regex fallback during transition
  • Legacy markers cleaned up by the plugin on next write

Test plan

  • CLI unit tests pass: cd test && bats unit/wt-adopt.bats (22 tests)
  • Plugin tests pass: cd wt-jetbrains-plugin && ./gradlew test
  • Cross-tool: adopt via CLI → plugin shows as adopted
  • Cross-tool: provision via plugin → wt list shows as adopted
  • Old empty wt/adopted files handled gracefully

🤖 Generated with Claude Code

@guodong-sq guodong-sq force-pushed the parity/1-unify-adoption-marker branch 3 times, most recently from 6cc35c7 to 9e40100 Compare March 21, 2026 21:00
Replace the plugin's JSON wt-provisioned marker with the CLI's
directory-based wt/adopted approach. The marker is now a plain text
file at <gitdir>/wt/adopted containing the context name.

Changes:
- CLI: upgrade wt/adopted from empty sentinel to carry context name
- CLI: add wt_read_adopted_context to read context from marker
- CLI: add fallback reads from plugin's legacy wt-provisioned JSON
- Plugin: rewrite ProvisionMarkerService to use wt/adopted plain text
  instead of wt-provisioned JSON
- Plugin: remove ProvisionMarker/ProvisionEntry data classes and Gson
  dependency from marker service
- Plugin: fix marker write timing — write only after successful
  metadata import and Bazel symlinks (matching CLI semantics)
- Plugin: simplify WorktreePanel tooltip (no multi-context display)
- Both sides clean up legacy wt-provisioned on write

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@guodong-sq guodong-sq force-pushed the parity/1-unify-adoption-marker branch from 9e40100 to cde8056 Compare March 21, 2026 21:07
@guodong-sq guodong-sq merged commit f714be1 into main Mar 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant