Commit graph

121 commits

Author SHA1 Message Date
Lawrence Chen
09e31448c9
Add Codex CLI hooks integration (#2103)
* Add Codex CLI hooks integration

Adds `cmux codex install-hooks` to install lifecycle hooks into
~/.codex/hooks.json and enable the codex_hooks feature flag. The hooks
call `cmux codex-hook <event>` which gracefully no-ops (exit 0, prints
{}) when not running inside cmux, so they're safe to leave installed
globally.

Supported events: SessionStart (session tracking), UserPromptSubmit
(set Running status), Stop (completion notification + Idle status).

Install merges with existing user hooks and is idempotent. Uninstall
(`cmux codex uninstall-hooks`) removes only cmux-owned hooks,
identified by the `cmux codex-hook` command prefix.

* Show diff and ask for confirmation before modifying user config

install-hooks and uninstall-hooks now preview changes to hooks.json and
config.toml before applying, with a [Y/n] prompt. Pass --yes/-y to
skip confirmation.

Hook commands use `command -v cmux` guard so they silently no-op
(echo '{}') when cmux CLI is not on PATH (e.g. user runs codex in a
non-cmux terminal or after uninstalling cmux).

* Improve diff output with line numbers and context

install-hooks and uninstall-hooks now show unified-diff-style output
with line numbers and surrounding context lines, making it easier to
see exactly what will change in hooks.json and config.toml.

* Check CMUX_SURFACE_ID in shell guard before calling cmux

The hook shell command now checks [ -n "$CMUX_SURFACE_ID" ] first,
so it short-circuits to echo '{}' without ever invoking cmux when
not inside a cmux terminal. Prevents usage text and socket errors
from leaking into Codex hook output.

* Uninstall reverts config.toml; fix [features] section handling

uninstall-hooks now also removes codex_hooks from config.toml and
shows the diff for both files before asking for confirmation.

buildConfigWithCodexHooks uses exact TOML key matching instead of
substring contains, and inserts after the first [features] header
only (not replacingOccurrences which hit all matches).

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-24 22:27:44 -07:00
Grimmer Kang
2a2374afcf
feat: expose per-surface TTY in tree output (#2040)
Add tty field to surface items in system.tree JSON response,
reading from existing surfaceTTYNames dictionary. Also show
tty= in the CLI text tree output for terminals that have a
registered TTY.

This enables external tools (e.g. CodeV) to cross-reference
claude process TTYs with cmux surfaces for accurate session
detection when multiple sessions share the same working directory.
2026-03-24 20:27:23 -07:00
Austin Wang
e8cf83ca57
Fix claude-hook stop teardown races (#1954)
* Add regression test for claude-hook stop teardown errors

* Handle claude-hook stop teardown races
2026-03-22 17:34:33 -07:00
Lawrence Chen
5cef77e456
Self-heal tmux attention routing for cmux panes 2026-03-21 03:26:11 -07:00
Lawrence Chen
656786fb71
Fix tmux notification attention routing 2026-03-20 20:20:54 -07:00
Lawrence Chen
4376e6e19a
Support image drag-and-drop into SSH terminals (#1838)
* Add remote image drag-and-drop uploads

* test: cover ssh image paste planning

* fix: upload images pasted into ssh terminals

* fix: share zsh history in cmux ssh relay shells

* fix: add cancellable ssh image transfer indicator

* fix: harden async ssh image transfer callbacks

* fix: address ssh image upload review feedback

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-20 18:31:19 -07:00
Zachary Salzbank
730d64b943
feat: add --direction flag to markdown open command (#1763)
Supports left/right/up/down, defaulting to right (existing behavior).
Matches the --direction flag convention used by new-pane and new-split.
2026-03-20 01:48:28 -07:00
bagelcode-jhkim
e0c301b277
feat: add set-color/clear-color to workspace-action CLI (#1833)
* [auto] cmux session changes (1 files) [03/19 17:38]

* feat: add set-color/clear-color to workspace-action

- CLI: parse --color option in runWorkspaceAction
- CLI: validate --color required for set-color action
- CLI: pass color param to v2 payload
- CLI: update help text and usage summary
- TerminalController: add set_color/clear_color to supportedActions
- TerminalController: handle set_color/clear_color cases via setTabColor

* fix: resolve named colors via palette, improve clear_color response

* fix: validate hex input via normalizedHex, fix synopsis typo
2026-03-19 22:34:31 -07:00
Lawrence Chen
5e5a88f973
Fix SSH notify bootstrap escaping 2026-03-19 02:32:03 -07:00
Lawrence Chen
387742a5a0
Update all remaining cmux.dev references to cmux.com (#1721)
- Swift app: feedback API endpoint, docs URLs, changelog URL, CLI help
- PostHog proxy: r.cmux.dev -> r.cmux.com
- All 20 README files: docs and blog links
- Homebrew cask: homepage URL in update-homebrew workflow

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-18 01:32:12 -07:00
Lawrence Chen
8d8fadbb27
Add hidden CLI command for live terminal debugging (#1599)
* Add hidden terminal debug CLI command

* Expand orphan terminal debug metadata

* Remove stray CLIProcessRunner test target wiring

* Tighten debug terminal diagnostics handling

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-17 04:03:49 -07:00
Lawrence Chen
832426af56
Stabilize SSH remote flow after merging main 2026-03-16 23:57:48 -07:00
Lawrence Chen
03dc055138
Merge remote-tracking branch 'origin/main' into pr-ssh-stack-main
# Conflicts:
#	CLI/cmux.swift
#	Sources/Panels/BrowserPanel.swift
#	Sources/TabManager.swift
#	Sources/Workspace.swift
#	cmuxTests/GhosttyConfigTests.swift
2026-03-16 23:16:12 -07:00
Lawrence Chen
ca4f4b7c69 Fix browser move and zsh bootstrap regressions 2026-03-13 21:04:48 -07:00
Lawrence Chen
623262493b
Fix stale Claude sidebar status: add missing hooks, OSC suppression, PID sweep (#1306)
* Fix stale Claude status in sidebar by adding missing hooks and OSC suppression

The Claude Code integration only used 3 hooks (SessionStart, Stop, Notification),
leaving gaps that caused stale sidebar status. Now uses 6 hooks:

- SessionEnd: clears status when Claude exits (covers Ctrl+C where Stop doesn't fire)
- UserPromptSubmit: clears "Needs input" and sets "Running" on new prompt
- PreToolUse (async): clears "Needs input" when Claude resumes after permission grant

Also:
- Suppress OSC 9/99 desktop notifications for workspaces with active Claude hook
  sessions to prevent duplicates from the raw OSC path
- Store Claude process PID in status entries for stale-session detection
- Add 30-second sweep timer that checks agent PIDs and clears stale entries
  (safety net for SIGKILL/crash where no hook fires)
- Update wrapper test expectations for the new hook set

Fixes https://github.com/manaflow-ai/cmux/issues/1301

* Don't show "Running" status on Claude launch, only when actually working

SessionStart now registers the PID for tracking and OSC suppression via
set_agent_pid without setting a visible status entry. "Running" only
appears when the user submits a prompt (UserPromptSubmit) or Claude
starts using tools (PreToolUse).

Added set_agent_pid / clear_agent_pid socket commands to decouple PID
tracking from visible status entries. OSC suppression checks agentPIDs
instead of statusEntries so it works during the initial idle period.

* Don't restore status entries across app restarts

Status entries are ephemeral runtime state tied to running processes
(e.g. claude_code "Running"). Restoring them after restart shows stale
status for processes that no longer exist.

* Address PR review comments and remove debug logging

- session-end: only clear status/PID/notifications when Stop didn't fire first
- PID sweep: check errno == ESRCH instead of treating all kill(pid,0) failures as dead
- Validate CMUX_CLAUDE_PID > 0
- Propagate tracked PID in pre-tool-use setClaudeStatus
- OSC suppression: use tabManagerFor(tabId:) for multi-window support
- clearAgentPID: resolve tab UUID before async dispatch
- restoreSessionSnapshot: also clear agentPIDs alongside statusEntries
- Fix AskUserQuestion surfaceId overwrite (wrong workspace notification)
- Fix notification text matching for "Claude Code needs your attention"
- AskUserQuestion: render option labels as bracketed inline text
- Remove artificial text truncation limits
- Remove temporary JSONL debug logging from all handlers

* Use resolveTabIdForSidebarMutation in clearAgentPID
2026-03-13 20:47:42 -07:00
Lawrence Chen
902ee03019 Fix SSH transport dedupe and loopback review issues 2026-03-13 20:23:44 -07:00
Lawrence Chen
2eae782739 Merge remote-tracking branch 'origin/main' into pr-ssh-stack-main
# Conflicts:
#	.github/workflows/ci.yml
#	CLI/cmux.swift
#	Sources/GhosttyTerminalView.swift
#	Sources/SocketControlSettings.swift
#	Sources/TabManager.swift
#	Sources/TerminalController.swift
#	Sources/Workspace.swift
#	ghostty
#	scripts/reload.sh
2026-03-13 17:56:38 -07:00
Lawrence Chen
89c1d6c255
Tag CLI Sentry events with app release 2026-03-13 17:53:25 -07:00
Lawrence Chen
8a0934b801
Fallback stable socket listener to a user-scoped path (#1351)
* Fallback stable socket listener to user socket path

* Move stable socket path out of /tmp

* Keep socket health checks active on fallback paths

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-13 17:37:01 -07:00
Lawrence Chen
7bd199b625
Address cmux themes PR feedback 2026-03-13 15:48:49 -07:00
Lawrence Chen
da8c616dfe
Fix cmux themes reload target resolution 2026-03-13 07:54:22 -07:00
Lawrence Chen
85e6a5aae4 Fix ssh stack review regressions 2026-03-13 07:29:22 -07:00
Lawrence Chen
815ed87eeb Avoid sourcing profile in ssh bootstrap 2026-03-13 07:09:46 -07:00
Lawrence Chen
e1f6d24655
Harden cmux theme override writes 2026-03-13 07:00:05 -07:00
Lawrence Chen
1309152bfc
Respect system theme in cmux picker 2026-03-13 04:52:23 -07:00
Lawrence Chen
7d178ad5c7
Fix interactive cmux themes launch 2026-03-13 04:32:52 -07:00
Lawrence Chen
ae24dad89f
Use Ghostty theme picker for cmux themes 2026-03-13 04:24:19 -07:00
Lawrence Chen
2e6856ff2f Fix ssh stack review regressions 2026-03-13 04:14:52 -07:00
Lawrence Chen
6584a01aef
Add cmux themes command 2026-03-13 03:26:51 -07:00
Lawrence Chen
19b59cae37 Reapply "Merge pull request #239 from manaflow-ai/issue-151-ssh-remote-port-proxying"
This reverts commit f7cbbad434.
2026-03-12 15:54:26 -07:00
Lawrence Chen
f7cbbad434 Revert "Merge pull request #239 from manaflow-ai/issue-151-ssh-remote-port-proxying"
This reverts commit 78e4bd32ba, reversing
changes made to cf75da8f8a.
2026-03-12 14:45:58 -07:00
Lawrence Chen
b12f70b26c Merge origin/main into issue-151-ssh-remote-port-proxying 2026-03-12 05:09:03 -07:00
Lawrence Chen
8a9e28e129 Secure remote daemon distribution and relay auth 2026-03-12 05:04:44 -07:00
Lawrence Chen
64b37fc121
Add Cmd+T (New tab) to welcome screen shortcuts (#1258) 2026-03-12 03:19:35 -07:00
tiffanysun1
85f9ad6ee9 Polish version guard follow-ups 2026-03-12 02:35:23 -07:00
tiffanysun1
f41a831778 Stop version lookup at root 2026-03-12 02:26:52 -07:00
Lawrence Chen
de47345538 Address ssh review feedback and CI blockers 2026-03-11 23:03:53 -07:00
Lawrence Chen
1b4f396a48 Merge remote-tracking branch 'origin/main' into issue-151-ssh-remote-port-proxying
# Conflicts:
#	Sources/Panels/BrowserPanel.swift
2026-03-11 22:52:47 -07:00
Lawrence Chen
f71c2c144b
Adapt welcome screen colors for light mode (#1214)
* Adapt welcome screen colors for light mode

Detect macOS appearance and use a darker cyan-to-purple gradient
with sufficient contrast (WCAG AA 4.5:1+) on light backgrounds.
Replace dim ANSI attribute with explicit true-color for light mode,
since dim can reduce contrast further against light backgrounds.

* Keep original gradient colors, only adapt tagline and dim text

The cyan-to-purple gradient looks good in both modes. Only the
tagline gray and dim description text need darker values for
light backgrounds.
2026-03-11 18:38:34 -07:00
Lawrence Chen
d67090994e Merge branch 'main' into issue-151-ssh-remote-port-proxying 2026-03-11 15:56:47 -07:00
Lawrence Chen
00587ed856
Add cmux claude-teams launcher (#1179)
* Add claude-teams CLI command

* Add claude-teams launcher regression test

* Exec claude-teams launcher in place

* Add existing-shim claude-teams regression test

* Reuse claude-teams shim and refresh dev CLI

* Add wrapper-selection claude-teams regression test

* Launch real claude binary for claude-teams

* Add claude-teams auto-mode launcher regression test

* Default claude-teams to fake tmux auto mode

* Build tagged reloads under DerivedData

* Add claude-teams tmux sequence regression test

* Fix claude-teams tmux teammate compatibility

* Add claude-teams split focus regression test

* Keep claude-teams leader pane focused

* Tighten claude-teams review fixes

* Pass claude-teams help through to Claude

* Use sentinel TERM_PROGRAM in claude-teams test
2026-03-11 02:42:33 -07:00
Lawrence Chen
52783bddf0
Polish welcome, feedback, and shortcuts flows (#1169)
* Add cmux welcome command with ASCII logo and shortcuts

Adds `cmux welcome` CLI command that prints a blue-to-purple gradient
chevron logo, version info, and key shortcuts. Auto-runs once on first
workspace creation via UserDefaults. Adds "Welcome" to the ? help menu
in the sidebar footer, which opens a new workspace running the command.

* Polish welcome, feedback, and shortcuts flows
2026-03-10 20:59:34 -07:00
Lawrence Chen
13b7300de8 Keep remote cmux wrapper on ssh shells 2026-03-10 00:38:02 -07:00
Lawrence Chen
e5445f4071 Fix cmux ssh startup isolation 2026-03-10 00:18:27 -07:00
Lawrence Chen
bdebc8ecc9 Merge branch 'main' into issue-151-ssh-remote-port-proxying
# Conflicts:
#	CLI/cmux.swift
#	Sources/ContentView.swift
#	Sources/GhosttyTerminalView.swift
#	Sources/Panels/BrowserPanel.swift
#	Sources/Panels/BrowserPanelView.swift
#	Sources/TabManager.swift
#	Sources/TerminalController.swift
#	Sources/Workspace.swift
#	Sources/WorkspaceContentView.swift
#	ghostty
2026-03-09 18:36:59 -07:00
Lawrence Chen
30bb74dc92 Merge branch 'pr-374-ssh-remote-cli-relay' into issue-151-ssh-remote-port-proxying
# Conflicts:
#	CLI/cmux.swift
#	Sources/ContentView.swift
#	Sources/GhosttyTerminalView.swift
#	Sources/Panels/TerminalPanel.swift
#	Sources/SocketControlSettings.swift
#	Sources/TabManager.swift
#	Sources/TerminalController.swift
#	Sources/Workspace.swift
#	daemon/remote/README.md
#	daemon/remote/cmd/cmuxd-remote/main.go
#	docs/remote-daemon-spec.md
#	tests_v2/test_ssh_remote_cli_metadata.py
2026-03-09 18:31:10 -07:00
Austin Wang
4ba967556e
Fix cmux --version memory blowup (#1121)
* Add version memory guard regression test

* Fix cmux --version plist lookup blowup
2026-03-09 16:35:05 -07:00
Lawrence Chen
e7c3961489
Revert "Add workspace pages in the titlebar (#1030)" (#1040)
This reverts commit 4de975e6a4.
2026-03-07 00:05:58 -08:00
Lawrence Chen
4de975e6a4
Add workspace pages in the titlebar (#1030)
* Add workspace pages in the titlebar

* Add workspace pages UI test target entry

* Relax workspace pages UI test titlebar checks

* Use page close button in workspace pages UI test

* Stabilize workspace pages UI test interruptions

* Skip page close confirms in UI tests

* Clean up superseded workspace handoffs

* Tighten page hint UI assertions

---------

Co-authored-by: cmux <cmux@cmuxs-Mac-mini.local>
2026-03-06 21:23:11 -08:00
Lawrence Chen
43f42b730c
Merge pull request #972 from manaflow-ai/task-browser-open-trailing-json-flags
Support trailing browser output flags
2026-03-05 22:39:14 -08:00