Skip to content

feat(rex): follow the window's shells into other repos - #8

Merged
owlnai merged 1 commit into
feat/rex-editor-panefrom
feat/rex-follow-shell
Nov 11, 2026
Merged

owlnai merged 1 commit into
feat/rex-editor-panefrom
feat/rex-follow-shell

Conversation

@owlnai

@owlnai owlnai commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Written by an AI agent on behalf of @owlnai. @owlnai has not reviewed it yet.

This is the third layer of four and sits on the editor layer. rex-git stayed on the directory it started in. When you cd'd into another project in the shell next to it, rex-git kept showing the old repo until you restarted it.

What changed

  • In a Rex pane, rex-git runs rex events for its session and watches for pwd_changed from the other terminals in its window.
  • When one moves into another repo or worktree, rex-git switches to that repo's root and says "following the shell to ". Each checkout's commit message is kept, as the worktree switcher already did.
  • It ignores folders that aren't in a repo, a shell reporting the same folder again at its prompt, and its own pane. When it starts, it records where each shell already is, so a prompt doesn't count as a move.
  • It waits while you're writing a message, or while a push, a draft or an editor is running, and then switches to the latest folder.
  • switch_worktree and following share a new switch_dir.

Evidence

This is from a throwaway Rex session with two temp repos, rex-git split beside a fish shell, captured with rex capture.

Started in repoA, then cd repoB in the shell:

 repoA ⎇ main                                                         ↑ publish
 not published yet

 changes  1
 ›○ M f.txt                                                               +1 −1
 repoB ⎇ main                                                         ↑ publish
 not published yet

 untracked  1
 ›○ ? b.txt                                                                  +1
 ...
 following the shell to repoB

Then cd /tmp (not a repo), then cd repoA. Here's the first header line after each:

 repoB ⎇ main                                                         ↑ publish
 repoA ⎇ main                                                         ↑ publish

No rex events process was left behind after the session closed. cargo fmt --check, cargo clippy --all-targets and cargo test (44 tests, including file_urls and pwd_events) pass on this branch.

Not checked:

  • zsh and bash. They only work if they report their directory to Rex. fish does by default.
  • An Axel thread window. If you cd in a shell there, rex-git leaves the thread's worktree.

ELI5

When you move to another project in the terminal next to the git panel, the panel moves with you.

In a Rex pane, rex-git listens for the other shells in its window
changing directory. When one moves into another repo or worktree,
rex-git switches to it, keeping each checkout's message as the
worktree switcher does. It waits while a message is being written or
something is running, and ignores folders that aren't repos.
@owlnai
owlnai added this pull request to stack #10 November 11, 2026 14:20
@owlnai
owlnai merged commit e23cd89 into main Nov 11, 2026
9 checks passed
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.

1 participant