Conversation
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.
Summary
Kmux's branch-derived workspace model leaves externally created and detached worktrees outside the normal restore workflow. This change uses Git's registered worktrees as the inventory and records ownership, retention, presentation, and lineage separately. Users can bring an existing checkout into tmux and keep working across branch changes without moving its directory or implicitly changing who may remove it.
Changes
workspace openandclosefor presentation control. New windows use the configured default launcher; existing windows are reused without restarting it or replaying input. Closing an external window does not exclude its worktree from the next restore.workspace createproduce a detached ephemeral worktree under the configurable~/.kmux/worktrees/<random-id>/<repo>root. Optional display names remain independent of storage paths, and lists/windows explicitly identify ephemeral retention.workspace promote. Promotion preserves the path, workspace ID, checkout, and running panes. Creating, switching, renaming, or publishing branches does not change retention or grant branch-deletion authority.--force, and recovery failures stop removal.Compatibility / migration
Supplying a branch to
workspace createretains persistent sibling creation and remote-tracking behavior. Existing directories remain in place. No automatic cleanup, relocation, or recovery-ref expiration is introduced.Missing or version-1 policy state triggers a one-time import of worktrees matching the old strict sibling path and branch-derived basename. These become owned persistent workspaces with their parent links and window names preserved. Later registrations remain external regardless of naming. The first-run ownership boundary warrants review: an externally created worktree matching the legacy pattern is also imported when no prior state exists, while requiring an existing state file would exclude some legacy partial creations.
Validation
nix develop --command just checkpassed: formatting, both Clippy configurations, 275 process-free library tests, the Rust workflow suite, 36 adapter contracts, and OpenCode formatting, 47 Bun tests, TypeScript, and bundle checks.primarywindow/lineage preservation and correct or refused forced-removal targeting under default and custom prefixes. Recovery failure tests cover ref creation, readback verification, and HEAD changes during removal.No live user-worktree migration or installation was performed. Lifecycle locks coordinate kmux commands; checkout revalidation does not provide an atomic transaction against arbitrary concurrent external Git writers.