Skip to content

fix(tui): allow custom destination path in move session - #49560

Open
mavasbel wants to merge 1 commit into
anomalyco:devfrom
mavasbel:cross-project-move
Open

mavasbel wants to merge 1 commit into
anomalyco:devfrom
mavasbel:cross-project-move

Conversation

@mavasbel

Copy link
Copy Markdown

Issue for this PR

Closes #49212
Closes #43938
Closes #35306

Type of change

  • Bug fix

What does this PR do?

The /move session command currently only surfaces worktrees of the current project and rejects destinations outside the project's worktree (DestinationProjectMismatchError). Searching for nested projects returns "No results found", the footer directory indicator stays stale after moving, and the palette description duplicates the command title.

This PR:

  • Extends moveSession to allow moving sessions to arbitrary directories and across distinct projects.
  • Automatically creates missing destination directories on disk via fs.ensureDir.
  • Registers the target in ProjectTable upon move (including "global" for plain non-git directories).
  • Guards git working-copy patch transfer to only apply within the same git repository.
  • Surfaces registered project directories from all known sessions in the TUI picker so nested projects match search queries (closing TUI "Move session" picker can't reach nested project directories; Search returns "No results found" #49212).
  • Adds live directory autocompletion under a unified "Directories" section with the target root at the top and subdirectories sorted alphabetically.
  • Supports Left/Right arrow directory traversal (➔ to drill down, ⬅ to move to parent) while preserving Tab navigation for footer action buttons.
  • Normalizes path casing against the true filesystem casing on disk via fs.realpathSync.native and expands ~.
  • Updates useDirectory() to read the active session's directory, fixing the stale footer indicator (closing tui: directory indicator stays stale after /move in a new session #43938).
  • Cleans up the command palette entry, removing redundant description text (closing TUI move session command description is unclear #35306).

How did you verify your code works?

  • Added schema contract tests in packages/schema/test/session-event.test.ts.
  • Added live integration tests in packages/core/test/move-session.test.ts:
    moves session across distinct project repositories without transferring git changes.
    All 4 move-session tests pass (bun test test/move-session.test.ts).
  • Added TUI component and context unit tests in packages/tui/test/component/dialog-move-session.test.ts and packages/tui/test/context/directory.test.ts.
  • Verified full monorepo typecheck: bun turbo typecheck passes cleanly across all 30 workspace packages.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

Labels

None yet

Projects

None yet

1 participant