使い方
- インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
- 必要なツール、認証情報、対応環境を原文で確認します。
- 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/manaflow-ai/cmux --skill cmux-debugging開始前の確認
- 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
- スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。
cmux Debugging
Debug event log
Put debug event instrumentation (keys, mouse, focus, splits, tabs) in the unified DEBUG build log. This is not a requirement to log every new code path; most probes belong to a dogfood debug loop and are removed before merge.
tail -f "$(cat /tmp/cmux-last-debug-log-path 2>/dev/null || echo /tmp/cmux-debug.log)"- Untagged Debug app logs to
/tmp/cmux-debug.log; tagged (./scripts/reload.sh --tag <tag>) to/tmp/cmux-debug-<tag>.log. reload.shwrites the current log path to/tmp/cmux-last-debug-log-pathand the selected dev CLI path to/tmp/cmux-last-cli-path, and points/tmp/cmux-cliand$HOME/.local/bin/cmux-devat that CLI.- Implementation:
Packages/macOS/CMUXDebugLog/Sources/CMUXDebugLog/DebugEventLog.swift. App shim:Sources/App/DebugLogging.swift. Both are#if DEBUG, so every call site must be wrapped in#if DEBUG/#endif. cmuxDebugLog("message")timestamps and appends in real time. A 500-entry ring buffer backs it;CMUXDebugLog.DebugEventLog.shared.dump()writes the full buffer to file.- Key events are logged in
AppDelegate.swift(monitor,performKeyEquivalent); mouse/UI events inline in views (ContentView,BrowserPanelView). - Stable event prefixes:
focus.panel,focus.bonsplit,focus.firstResponder,focus.moveFocus,tab.select,tab.close,tab.dragStart,tab.drop,pane.focus,pane.drop,divider.dragStart.
Profiling
Profile a tagged build by attaching to its pid (xctrace record --attach <pid>, sample <pid>). Never use xctrace --launch or Instruments' launch mode on any cmux bundle, and never quit, kill or relaunch the user's running cmux (com.cmuxterm.app): it holds their live agent sessions, and on 2026-09-26 a suspected profiler relaunch took five of them down.
Debug menu
DEBUG builds get a Debug menu in the macOS menu bar. When the user says "debug menu" or "debug window" they mean this, not defaults write.
Debug > Debug Windows holds panels for tuning layout, colors, and behavior, listed alphabetically with no dividers. To add one: create an NSWindowController subclass with a shared singleton, register it in the "Debug Windows" menu in Sources/cmuxApp.swift, and back it with a SwiftUI view using @AppStorage bindings for live changes.
Runtime pitfalls
- Custom drag-and-drop UTTypes must be declared in
Resources/Info.plistunderUTExportedTypeDeclarations. - Do not add an app-level display link or manual
ghostty_surface_drawloop; rely on Ghostty wakeups/renderer to avoid typing lag. WindowTerminalHostView.hitTest()inSources/TerminalWindowPortal.swiftruns on every event including keyboard. Add no work outside theallowsPortalPointerHitTestingguard inperformHitTest.TabItemViewinSources/ContentView.swiftusesEquatableplus.equatable()to skip body re-evaluation during typing. Do not add environment/store/binding reads without updating==and keeping.equatable()at the call site.TerminalSurface.forceRefresh()inPackages/macOS/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+ForceRefresh.swiftruns on every keystroke. No allocations, file I/O, or formatting.SurfaceSearchOverlaymust be mounted fromGhosttySurfaceScrollViewinSources/GhosttyTerminalView.swift, not from SwiftUI panel containers.- Views below a
LazyVStack/LazyHStack/List/ForEachboundary receive immutable snapshots plus closures, never an observable store. - Functions called from SwiftUI
bodymust not mutate state or schedule store writes. - Foundation, SwiftUI, AttributeGraph, and WebKit semantics change between macOS majors. Test on the reporter's macOS before declaring a user repro disproven.
Detailed references
- references/debug-event-log.md: when to add probes and how to name them.
- references/runtime-pitfalls.md: read before touching terminal rendering, hit testing, tab rows, list virtualization, search overlay layering, or OS-version-sensitive code.




