Skip to content

Feat/macos terminal - #16

Merged
mgreau merged 4 commits into
mgreau:mainfrom
imkarrer:feat/macos-terminal
Aug 28, 2026
Merged

Feat/macos terminal#16
mgreau merged 4 commits into
mgreau:mainfrom
imkarrer:feat/macos-terminal

Conversation

@imkarrer

@imkarrer imkarrer commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

zen already supports iTerm2 and Ghostty on macOS, but both are extra installs. Users who stay on Terminal.app had no way to open review/work tabs without switching emulators. This is the same backend abstraction as kitty: a small AppleScript wrapper behind terminal: macos.

Notes

  • If Terminal already has a window, zen opens a new tab in the front window; if none exist, it opens a new window.
  • The shell command is passed via the ZEN_MACOS_CMD env var so AppleScript does not have to escape the command string.
  • macOS-only. Config validation accepts iterm, ghostty, kitty, or macos.
  • Opt-in e2e (not part of go test ./...): ZEN_E2E_MACOS=1 go test -tags e2e ./internal/macos -run TestOpenTabE2E. Needs Automation permission for osascript → Terminal.

Test plan

  • zen setup accepts macos and writes terminal: macos to config
  • Invalid terminal values still error; empty still defaults to iterm
  • With terminal: macos, zen review / zen work new open a Terminal.app tab in the worktree and run the agent
  • With no Terminal windows open, a new window is created instead of a tab
  • Existing iterm / ghostty / kitty configs are unchanged
  • Optional: run the e2e above and confirm the marker file is created

Let users set terminal: macos so review and work sessions open in Terminal.app tabs. Default remains iterm.
Keep it out of go test ./... and go build; run with ZEN_E2E_MACOS=1 go test -tags e2e ./internal/macos -run TestOpenTabE2E.
@imkarrer
imkarrer marked this pull request as draft August 27, 2026 18:32
do script in front window targets the selected tab (queued until zen exits),
and each tab is its own AppleScript window, so a tab-count check always failed.
Create the tab via Shell → New Tab, then run the command there.
…r file

The previous e2e passed if touch ran in the selected tab. Compare window ids
so reuse of the current session fails.
@imkarrer
imkarrer marked this pull request as ready for review August 27, 2026 18:59
@imkarrer

imkarrer commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

@mgreau found a small issue with opening tabs when using this from my fork.

To do a proper zen review you will need to refresh the worktree and context manually. Sorry for opening that permaturely. #18

Loving the tool so far.

git -C ~/<checkoutpath>/zen fetch origin +pull/16/head:pr-16
git -C ~/<checkoutpath>/zen-pr-16 merge --ff-only pr-16
zen context inject ~/<checkoutpath>/zen-pr-16 --pr 16 --repo zen

@mgreau
mgreau self-requested a review August 28, 2026 14:32

@mgreau mgreau left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks, LGTM!

@mgreau
mgreau merged commit 7b61abc into mgreau:main Aug 28, 2026
1 check passed
mgreau added a commit that referenced this pull request Aug 28, 2026
…cher

* origin/main:
  Feat/macos terminal (#16)

# Conflicts:
#	docs/architecture.md
#	docs/configuration.md
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