Skip to content

feat(settings): support worktree layout mappings (#582)#993

Open
rodboev wants to merge 3 commits into
kenn-io:mainfrom
rodboev:pr/worktree-layout-resolver
Open

feat(settings): support worktree layout mappings (#582)#993
rodboev wants to merge 3 commits into
kenn-io:mainfrom
rodboev:pr/worktree-layout-resolver

Conversation

@rodboev

@rodboev rodboev commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Worktree mappings currently preserve project names only when each repository has its own explicit path-prefix row. That works for a few deleted worktrees, but it does not scale for layouts such as {repo}.worktrees/{branch} where the canonical project is already present in the path segment.

This adds a layout mode to the existing worktree mapping row instead of creating a separate template system. Existing rows stay explicit and keep their current behavior. A new {repo}.worktrees/{branch} layout lets one parent-directory mapping derive the project from service.worktrees style directories, while the existing longest-prefix precedence still lets a more specific explicit mapping override the generic layout.

The resolver stays in the worktree mapping layer, and the settings API and UI only adapt that row shape. Scope is limited to the local worktree mapping path; parser behavior, backend sync semantics, and unrelated project inference remain unchanged.

Fixes #582

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (54f232e)

No Medium, High, or Critical findings were reported.

Review 1 reported only a Low-severity resolver fallback issue, which is omitted per instructions. Review 2 found no issues.


Reviewers: 2 done | Synthesis: codex, 6s | Total: 7m36s

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (989c1f0)

Medium findings need attention before merge.

Medium

  • internal/db/worktree_mappings.go:417 - A repo_dot_worktrees mapping can shadow broader valid mappings even when the cwd is not inside a {repo}.worktrees/{branch} directory. bestWorktreeProjectMapping stops on the first path-prefix match, then resolveRepoDotWorktreesProject returns false, so resolution never falls through to a less-specific explicit mapping such as the supported root-prefix mapping.

    Fix: Resolve mappings in order and continue to the next mapping when the selected layout cannot resolve for that cwd, or make the “best mapping” predicate layout-aware.


Reviewers: 2 done | Synthesis: codex, 6s | Total: 6m7s

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (6d8026f)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 6m3s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: support for user-configurable worktree layouts

1 participant