feat(worktree): apply the layout when opening an existing worktree - #31
Open
nilp0inter wants to merge 2 commits into
Open
feat(worktree): apply the layout when opening an existing worktree#31nilp0inter wants to merge 2 commits into
nilp0inter wants to merge 2 commits into
Conversation
Opening an existing worktree checkout previously left Herdr's default single-shell workspace, while creating a worktree bootstrapped the configured tab layout. Add an opt-in [worktree].layout_on_open config that runs the same layout bootstrap when a worktree is opened from the candidate picker or by project and branch. The field defaults to false so existing configs keep the current focus-only behavior; newly generated configs set it to true.
Add a CHANGELOG entry under Unreleased, the README config field reference plus layout-source table rows, and update the sessionizer-layout-editor skill bootstrap note, global scope, and examples.
Owner
|
Thanks — the three open-checkout paths and leaving Direction change: drop
Conflicts: PR currently conflicts with Changelog: yes, keep an Unreleased entry; reword after dropping the flag, e.g. “Opening an existing worktree checkout now applies the tab layout (same as create). Focusing an existing Herdr workspace is unchanged.” Happy to re-review after that. |
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.
Problem
Opening an existing worktree (via the
worktree-openaction) leaves Herdr's default single-shell workspace, while creating a worktree bootstraps the configured tab layout. The two paths are inconsistent: opening a previously checked-out worktree gives a bare shell instead of the user's layout.Solution
Add an opt-in
[worktree].layout_on_openconfig. When enabled, the three "open existing worktree" paths in the worktree flow run the samecreateProjectLayoutbootstrap that creation uses (resolving the checkoutcwd, honoring repo-local.sessionizer/config.tomloverrides, then focusing):open-worktreeintent (an existing checkout picked from the candidate picker)worktrees.openattempt inopenOrCreateWorktree(the branch already has a worktree)createfailsThe
open-workspaceintent (focusing a workspace that already exists) is intentionally left untouched — it may carry user state.The shared logic lives in a new
bootstrapOpenedWorktreehelper;bootstrapWorktreegains averbso the success log reads "opened and focused" vs "created and focused".Default
Follows the
git_onlyprecedent from 0.5.1:layout_on_openomitted →false(current focus-only behavior, non-breaking)[worktree] layout_on_open = trueHappy to flip the missing-field default to
trueif you'd prefer open and create to be consistent out of the box — the gate makes either trivial.Tests
config:layout_on_opendefaults tofalsein existing configs,truein generated configs, and parses from[worktree]worktreeflow: layout applied when opening an existing worktree with the gate on (picker path, asserting exactcreateLayoutargs; and CLI--project --branchpath)bun run typecheckandbun test(140 passing) are green.Docs
CHANGELOG (Unreleased), README config field reference + layout-source table, and the
sessionizer-layout-editorskill bootstrap note/scope.