Skip to content

fix + split: tmux new-window target honored, daemon files split#114

Merged
arzafran merged 4 commits into
mainfrom
nr/go
Jul 9, 2026
Merged

fix + split: tmux new-window target honored, daemon files split#114
arzafran merged 4 commits into
mainfrom
nr/go

Conversation

@arzafran

@arzafran arzafran commented Jul 9, 2026

Copy link
Copy Markdown
Member

What this does

tmux new-window -t now actually routes the workspace to the target session's window, with regression tests, and the two oversized Go files split along their own section comments.

Summary

  • tmuxNewWindow resolves -t via tmuxResolveWorkspaceTarget and passes workspace_id to workspace.create; shared body of new-session/new-window collapsed into two helpers
  • two regression tests in the existing mock-socket style (target honored, no routing param when -t absent)
  • tmux_compat.go split into 9 files, main.go into proxy vs session handlers, same package, zero import churn; verified no function/type dropped by signature diff
  • go.mod module renamed to github.com/darkroomengineering/programa/daemon/remote with import paths updated

Fixes #84. Fixes #102.

Test Plan

  • go build + go vet + go test green locally
  • CI green

arzafran added 4 commits July 9, 2026 14:18
tmuxNewWindow parsed -t but never used it, so the target session a
caller specified was silently ignored and the new workspace always
landed in the currently active window instead of the target's window.

Resolve -t via tmuxResolveWorkspaceTarget and route workspace.create
into that workspace's macOS window (mirroring how surface.split already
resolves -t for split-window), matching tmux's new-window semantics
where the target's session determines placement.

Also collapse the copy-pasted body shared by tmuxNewSession and
tmuxNewWindow into tmuxCreateWorkspace/tmuxPrintWorkspaceRef helpers.

Refs #84.
tmux_compat.go had grown to 1,801 lines covering nine unrelated
concerns in one file. File reorganization only, no behavior change:
every type and function moved verbatim (confirmed by diffing the
extracted func/type signatures against the pre-split file), all
staying in package main so there is zero import churn.

- tmux_compat.go: entry point (runTmuxCompat, rpcContext.call) + dispatchTmuxCommand
- tmux_args.go: tmux argument parsing (tmuxParsed, parseTmuxArgs, splitTmuxCmd)
- tmux_format.go: format string rendering + format context building
- tmux_target.go: session/window/pane target resolution
- tmux_store.go: TmuxCompatStore local JSON state
- tmux_keys.go: special key translation
- tmux_waitfor.go: wait-for signal path helper
- tmux_commands.go: per-command implementations (new-session, split-window, ...)
- tmux_helpers.go: small shared helpers (firstNonEmpty, parseInt, parseFloat)

Refs #102.
main.go had grown to 1,105 lines mixing the stdio RPC server
lifecycle with two unrelated groups of method handlers. File
reorganization only, no behavior change: every type and function
moved verbatim (confirmed by diffing extracted func/type signatures
against the pre-split file), all staying in package main.

- main.go: entry point, stdio RPC server lifecycle, frame I/O,
  handleRequest dispatch table, closeAll (shared teardown across
  both stream and session state), and the low-level param helpers
  shared by both handler groups
- main_proxy.go: proxy.* handlers (open/close/write/stream.subscribe)
  plus their stream bookkeeping (getStream/dropStream/streamPump)
- main_sessions.go: session.* handlers (open/close/attach/resize/
  detach/status) plus their snapshot/resize bookkeeping

Refs #102.
The module path was still the pre-rebrand github.com/manaflow-ai/cmux/daemon/remote
leftover from before this repo became darkroomengineering/programa. Rename to
github.com/darkroomengineering/programa/daemon/remote.

No internal import paths needed updating — the module is a single
package (cmd/programad-remote) with no intra-module imports, and a
repo-wide grep confirmed no other file references the old
manaflow-ai/cmux/daemon/remote import path.

Refs #102.
@arzafran arzafran merged commit 3d49fbd into main Jul 9, 2026
8 checks passed
@arzafran arzafran deleted the nr/go branch July 9, 2026 22:00
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