Skip to content

feat: add edit multi-repo paths dialog (p key)#450

Open
oryaacov wants to merge 3 commits intoasheshgoplani:mainfrom
oryaacov:feat/edit-multirepo-paths
Open

feat: add edit multi-repo paths dialog (p key)#450
oryaacov wants to merge 3 commits intoasheshgoplani:mainfrom
oryaacov:feat/edit-multirepo-paths

Conversation

@oryaacov
Copy link
Copy Markdown
Contributor

@oryaacov oryaacov commented Mar 28, 2026

Summary

  • Multi-repo sessions currently have no way to add/remove repos after creation — you must delete and recreate
  • This adds a new p hotkey that opens an edit dialog for multi-repo sessions, allowing path changes in-place with automatic session restart

Changes

New file: internal/ui/editpaths_dialog.go (578 lines)

  • EditPathsDialog modal for editing paths of an existing multi-repo session
  • Path list with add (a), remove (d), edit (Enter), navigate (j/k)
  • Tab completion via GetDirectoryCompletions (same as new session dialog)
  • Floating suggestions dropdown with overlay rendering and ^N/^P cycling
  • Validation: min 2 paths, no duplicates, all paths must exist
  • ANSI-aware overlay helpers (overlayDropdown, truncateVisible, sliceVisibleFrom) for z-index style dropdown rendering

internal/ui/home.go

  • p hotkey opens the dialog when a multi-repo session is focused
  • handleEditPathsDialogKey dispatches Enter/Esc to the dialog
  • applyMultiRepoPathChanges rebuilds the symlink directory and restarts the session
  • p: Paths hint added to bottom status bar, stopped/error Actions sections, and preview pane Multi-Repo section

internal/ui/hotkeys.go: Registered edit_paths action bound to p (customizable)

internal/ui/help.go: Added "Edit multi-repo paths" to help overlay

How it works

  1. User presses p on a multi-repo session
  2. Dialog shows current paths (resolved from symlinks back to real paths)
  3. User adds/removes/edits paths, confirms with Enter
  4. applyMultiRepoPathChanges: clears all symlinks in the session's temp dir, creates new symlinks for updated paths, updates ProjectPath/AdditionalPaths, saves to SQLite, calls Restart() (which does respawn-pane with updated --add-dir flags for Claude)

Test plan

  • All existing UI tests pass (47+ tests)
  • Clean build on main
  • Manual: create multi-repo session with 2 repos, press p, add a 3rd repo, confirm → session restarts with 3 repos
  • Manual: edit paths dialog shows path suggestions dropdown
  • Manual: remove a repo (must keep ≥2), confirm → session restarts with updated repos
  • Manual: verify p key is only active on multi-repo sessions (no-op on single-repo)
  • Manual: verify bottom bar shows "Paths" hint only for multi-repo sessions

🤖 Generated with Claude Code

Copy link
Copy Markdown
Owner

@asheshgoplani asheshgoplani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the multi-repo paths dialog, @oryaacov! A few issues:

  1. Duplicate overlay code with #449 — PR #449 (which introduced the shared overlay pattern) is now merged. This PR still has its own copy of the overlay code. Please rebase onto main and use the shared overlay infrastructure from #449.
  2. Race condition in applyMultiRepoPathChanges — this function mutates instance fields (ProjectPaths, etc.) without holding the instance mutex. Since the background status worker also reads these fields, this is a data race under -race. Wrap mutations in inst.mu.Lock()/Unlock().
  3. No tests for EditPathsDialog — the new dialog needs test coverage for: adding paths, removing paths, reordering, and the apply/cancel flows.

oryaacov and others added 2 commits April 8, 2026 20:54
Allow adding/removing repos from an existing multi-repo session without
recreating it. Press `p` on a multi-repo session to open the editor.

On confirm, the symlink directory is rebuilt and the session is restarted
with updated --add-dir flags. Includes floating path suggestions dropdown
with overlay rendering, tab completion, and validation (min 2 paths,
no duplicates, paths must exist).

UI hints added to: bottom status bar, preview pane Actions sections,
preview pane Multi-Repo section, and help overlay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Remove duplicate overlay/menu helpers from editpaths_dialog.go — now
   uses the shared infrastructure from newdialog.go (merged via asheshgoplani#449).
2. Wrap instance field mutations (ProjectPath, AdditionalPaths, WorkDir)
   in instancesMu write lock to avoid races with the background status
   worker.
3. Add 12 tests for EditPathsDialog covering: Show, HasChanged, add/
   remove paths, min-path enforcement, navigate, edit+save, edit+cancel,
   validation, GetSessionID, and Hide state reset.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@oryaacov oryaacov force-pushed the feat/edit-multirepo-paths branch from b3ed8dd to 9db71f1 Compare April 8, 2026 17:57
@oryaacov oryaacov requested a review from asheshgoplani April 8, 2026 17:58
@oryaacov
Copy link
Copy Markdown
Contributor Author

oryaacov commented Apr 8, 2026

@asheshgoplani , my pleasure, thank you for creating this amazing project!
updated my PR :)

Paths longer than the dialog's inner width pushed content past the right
border, breaking the frame. Now paths are truncated with a leading "…"
and the session title is capped to fit within the dialog width.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@oryaacov oryaacov force-pushed the feat/edit-multirepo-paths branch from a763fbd to 4b24109 Compare April 8, 2026 23:18
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.

2 participants