Skip to content

AsafMah/omp-windows-terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

omp-windows-terminal

Windows Terminal integration for oh-my-pi.

When you /fork a session, the session you just left is reopened in a new Windows Terminal split pane instead of being lost — and you get commands and a tool for opening forks/sessions in panes, tabs, or windows on demand. All via wt.exe; no oh-my-pi core changes.

Requires Windows Terminal (wt.exe). Everything is a no-op outside it (gated on the WT_SESSION environment variable). Works on native Windows and inside WSL (panes are wrapped through wsl.exe — see WSL).

What you get

Surface Behavior
Auto-pane on /fork After the built-in /fork, the previous session is reopened in a split pane (omp --resume <previous>). The native /fork is otherwise unchanged.
/wtpane [fork|current] Open this session in an adjacent split pane.
/wtwindow [fork|current] Open this session in a new window.
spawn_session_pane (tool) LLM-callable: open a fork / resume / new session in a pane / tab / window.
windows-terminal-control (skill) Teaches the agent to drive wt.exe for multi-pane layouts — split/tile panes, open tabs/windows, and arrange omp sessions into a grid. Activates on "arrange/split/organize my terminal" or "arrange all my omps".

/branch is not hooked on purpose — branching is a lightweight "escape and pick a message" navigation, not something that warrants a new pane.

fork vs current

  • fork (default) launches an independent clone via omp --fork — safe, no shared state.
  • current reopens the same session via omp --resume. Two live processes then append to the same session file; oh-my-pi's session journal is not designed for concurrent writers, so prefer fork unless you specifically want a second view and accept the risk.

Install

Requires oh-my-pi ≥ 16.0.0.

# From the Git repo (recommended)
omp plugin install https://github.com/AsafMah/omp-windows-terminal

# ...or clone and link a local checkout
git clone https://github.com/AsafMah/omp-windows-terminal
omp plugin link ./omp-windows-terminal

The extension is a TypeScript module loaded directly by oh-my-pi (which runs on Bun) — there is no build step. The @oh-my-pi/pi-coding-agent dependency is type-only and provided by the host at load time.

Configuration

Env var Default Effect
OMP_WT_AUTOPANE on Set to 0 to disable the auto-pane-on-/fork behavior.
OMP_BIN omp Executable used to launch the spawned session.

How it works

oh-my-pi's /fork emits a session_switch event with reason: "fork" and the previousSessionFile being left. The extension listens for it and runs wt.exe -w 0 sp -d <cwd> omp --resume <previous> to reopen that session beside the current pane. The commands and tool build the same wt.exe invocation with --fork / --resume / a fresh session and a pane / tab / window target.

wt -w 0 targets the current window; -w new opens a new one. Every call is routed through cmd.exe /d /s /c wt.exe …: wt.exe is a Windows App Execution Alias that Bun/ptree can't resolve on PATH (a direct spawn fails with "Executable not found"), and cmd.exe resolves the alias natively.

WSL

Inside WSL, WT_SESSION is inherited but wt.exe is still a Windows program, so a raw POSIX cwd and a Linux omp command can't be handed to it directly. Under WSL the extension translates the -d start directory to a Windows path via wslpath -w and wraps the child in wsl.exe -d <distro> --cd <cwd> -- omp …, so the pane re-enters the current distro and runs the real Linux omp in the right directory. If wslpath can't map the directory, -d is dropped (WT falls back to its default) while wsl.exe --cd still places the session correctly.

Pairs well with

OSC 7 / OSC 9;9 cwd reporting in oh-my-pi core (can1357/oh-my-pi#2718): with that, the reopened/duplicated panes also start in the session's working directory.

Develop

bun install
bun test        # pure wt.exe argv / launcher builders
bun run check   # tsc --noEmit

License

MIT

About

Windows Terminal integration for oh-my-pi: reopen forked sessions in panes and open session panes/tabs/windows via wt.exe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors