Skip to content

Add cmux import for settings from other terminals - #15004

Merged
teamleaderleo merged 2 commits into
mainfrom
import-from-other-terminals
Sep 27, 2026
Merged

teamleaderleo merged 2 commits into
mainfrom
import-from-other-terminals

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

People switching to cmux from another terminal had to rebuild their font, colors and cursor by hand in Ghostty syntax. cmux import now does it:

  • cmux import lists the terminals with settings on this Mac (iTerm2, Terminal, Alacritty, Kitty, WezTerm, Warp) and, in a TTY, asks which to import. Ghostty is listed as already loaded: cmux reads ~/.config/ghostty/config, so there is nothing to do.
  • cmux import <terminal> [--dry-run] [--yes] [--path <file>] [--json] prints every line it will write with the previous value (-/+), then asks before writing. Without a terminal to ask in (scripts, pipes) or with --json, it writes only with --yes. --dry-run writes nothing.
  • Settings > Terminal gets an "Import from Another Terminal" row whose Import… button opens a terminal tab running cmux import, through the same helper the Theme "Choose…" button now uses.

What gets mapped:

Ghostty key
16 ANSI colors, foreground, background, cursor, cursor text, selection generated theme file cmux-import-<terminal> in cmux's themes folder, selected by absolute path through the existing # cmux themes block (iTerm2 profiles with separate light/dark colors get a light:...,dark:... pair)
font family and size font-family, font-size (iTerm2/Terminal PostScript names resolved to families via CoreText; a font that isn't installed system-wide, like Terminal's bundled SF Mono Terminal, is skipped and reported)
cursor shape and blink cursor-style, cursor-style-blink
iTerm2 Option "Esc+"/"Meta", Terminal useOptionAsMetaKey, Kitty/Alacritty/WezTerm equivalents macos-option-as-alt
padding window-padding-x, window-padding-y
opacity, blur background-opacity, background-blur
scrollback lines scrollback-limit only when the line count needs more than Ghostty's 50 MB default (estimated at 2 KB a line); otherwise the report says the default already covers it

Writes go only to cmux's own config.ghostty and its themes folder. The user's ~/.config/ghostty/config and the other terminal's files and preferences are only read. Each written key ends up assigned once (repeatable keys like font-family would otherwise stack), existing keys are replaced in place, and new ones are appended under a # Imported from <terminal> by cmux import comment.

Honest limits, each printed under "Not imported or approximated": WezTerm is read without running Lua, so only literal top-level config.x = ... and return { ... } values are imported and anything computed or inside if/functions is named as skipped; a WezTerm color_scheme name is reported with a cmux themes set hint. Warp imports theme colors only (it keeps fonts in app state). Kitty globinclude/envinclude, bold/italic font overrides, line spacing, background images and dim colors are reported, not mapped.

Parsing and mapping live in a new pure package, Packages/macOS/CmuxTerminalImport (no AppKit: Terminal's NSColor/NSFont archives are decoded with secure coding on, through stand-in NSSecureCoding classes that are the only allowed classes), with fixture-based tests for every source plus the mapper and config patcher. NaN, infinity and overflowing numbers (1e999) are rejected and huge values clamped, so a malformed config can't trap; a malformed-numbers fixture covers it. CRLF configs stay CRLF. It is linked into cmux-cli only and added to the swift-package-tests list.

Verification

  • swift test --package-path Packages/macOS/CmuxTerminalImport: 25 tests in 6 suites passed locally on the first commit. The follow-up hardening commit (number guards, secure-coding decode, CRLF, --yes gating, new tests) was not compiled or run locally; CI is the first check of it.
  • CMUXCLI+Import.swift typechecked locally against the built package with stubbed CLI helpers, and a throwaway runner exercised list, --dry-run and a real write against a temp home using the Kitty fixtures.
  • Parsed this Mac's real Terminal preferences (not committed) to confirm the archive decoding on live data.
  • python3 scripts/verify-local.py: 13/13 static checks passed. The app and CLI targets were not built locally; CI compiles them.

Not included: the Settings search index entry (the neighboring Theme row isn't indexed either) and web docs (the command is documented where cmux themes is: CLI help, docs/cli-contract.md and the customization skill).

Changelog

Added: cmux import and a Settings > Terminal "Import from Another Terminal" button bring font, colors, cursor, Option-as-Alt, padding, opacity and scrollback over from iTerm2, Terminal, Alacritty, Kitty, WezTerm or Warp.

🤖 Generated with Claude Code

`cmux import` lists iTerm2, Terminal, Alacritty, Kitty, WezTerm and Warp
settings found on this Mac; `cmux import <terminal> [--dry-run]` maps the
font, 16 ANSI plus special colors, cursor style and blink, Option-as-Alt,
padding, opacity/blur and scrollback into a generated Ghostty theme and
cmux's own Ghostty config, printing each line with its previous value and
listing what was not imported. Ghostty users get a notice, since cmux
already loads their config.

Parsing and mapping live in the new pure CmuxTerminalImport package with
fixture tests per source. Settings > Terminal gains an "Import from
Another Terminal" row that opens a terminal tab running `cmux import`,
sharing the theme picker's launch path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4b26de98-2b17-4773-99ba-a4530cefa684

📥 Commits

Reviewing files that changed from the base of the PR and between 8685bf5 and d01077c.

⛔ Files ignored due to path filters (1)
  • cmux.xcworkspace/contents.xcworkspacedata is excluded by !**/*.xcworkspace/contents.xcworkspacedata
📒 Files selected for processing (68)
  • .github/workflows/ci-macos.yml
  • CLI/CMUXCLI+CommandSuggestions.swift
  • CLI/CMUXCLI+Import.swift
  • CLI/CMUXCLI+TaskHelp.swift
  • CLI/cmux.swift
  • Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Environment/SettingsHostActions.swift
  • Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/TerminalSection.swift
  • Packages/macOS/CmuxTerminalImport/Package.swift
  • Packages/macOS/CmuxTerminalImport/README.md
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Discovery/DetectedTerminal.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Discovery/TerminalConfigFileReading.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Discovery/TerminalImportError.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Discovery/TerminalImporter.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Discovery/TerminalPreferencesReading.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/CoreTextFontFamilyResolver.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/FontFamilyResolving.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyConfigPatch.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyConfigPatcher.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyConfigSetting.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyImportMapper.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyImportPlan.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Mapping/GhosttyThemeFile.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Model/ImportedTerminalSettings.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Model/TerminalColor.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Model/TerminalColorScheme.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Model/TerminalImportSource.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/AlacrittyConfigParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/CharacterScanner.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/ConfigValue.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/ITerm2ProfileParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/IncludePathResolver.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/KeyedArchiveValueDecoder.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/KittyConfigParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/LuaStaticConfigReader.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/LuaToken.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/LuaTokenizer.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/LuaValue.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/MiniTOMLParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/MiniYAMLParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/TerminalAppProfileParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/WarpThemeParser.swift
  • Packages/macOS/CmuxTerminalImport/Sources/CmuxTerminalImport/Parsers/WezTermConfigParser.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/alacritty/alacritty.toml
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/alacritty/alacritty.yml
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/alacritty/themes/tokyo.toml
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/iterm2-split.plist
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/iterm2.plist
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/kitty/current-theme.conf
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/kitty/kitty.conf
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/kitty/malformed.conf
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/terminal-app-builtin.plist
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/terminal-app.plist
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/warp/solarized.yaml
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/wezterm/return-table.lua
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/Fixtures/wezterm/wezterm.lua
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/GhosttyConfigPatcherTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/GhosttyImportMapperTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/ITerm2ProfileParserTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/MalformedNumberTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/TerminalAppProfileParserTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/TerminalImporterTests.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/TestFixtures.swift
  • Packages/macOS/CmuxTerminalImport/Tests/CmuxTerminalImportTests/TextConfigParserTests.swift
  • Resources/Localizable.xcstrings
  • Sources/HostSettingsActions.swift
  • cmux.xcodeproj/project.pbxproj
  • docs/cli-contract.md
  • skills/cmux-customization/SKILL.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

- Reject NaN, infinity and overflowing numbers from every source and clamp
  huge ones before converting to Int, so values like `1e999` can no longer
  trap. The mapper caps padding and blur and computes scrollback bytes with
  overflow checking. Adds malformed-number fixture tests.
- Decode Terminal's NSColor/NSFont archives with secure coding on; the
  stand-in classes adopt NSSecureCoding and are the only allowed classes.
- Writing from a script, pipe or with --json now requires --yes.
- The config patcher keeps CRLF files CRLF and drops the stray `\r` from
  values; CRLF test added.
- Help usage lists --yes, --path and --json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

CI failure attribution

CI passes on d01077c5a5 (run 36323906557 attempt 3).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Toolbox g1 🔔 reviewed the importer’s parser/mapper fixtures, hostile-number and secure-archive hardening, CLI confirmation gate, and settings entrypoint. Required checks are green and the branch is clean against main; landing this self-contained feature before the currently-running CI repair PRs.

@teamleaderleo
teamleaderleo merged commit 8c98e64 into main Sep 27, 2026
145 of 153 checks passed
@teamleaderleo
teamleaderleo deleted the import-from-other-terminals branch September 27, 2026 16:09
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for d01077c5a5: every check was green at merge (24 verified; 16 skipped by policy). Full suite runs on main after merge.

rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 27, 2026
8efe28d Add terminal.confirmUnsafePaste to confirm unsafe pastes in a window sheet (manaflow-ai#14951)
368ec9f fix(ci): restore app-host artifact rerun setup (manaflow-ai#15029)
e67ea0f perf: stop launching the cmux CLI for every queued Claude hook (manaflow-ai#14931)
badf9f6 test: give the tmux split mapping test its own portal authority (manaflow-ai#15028)
41a0c37 current-work: preserve remote machine kinds (manaflow-ai#14914)
c842f7d test(hermes): wait for the hook installer instead of racing a 1 s deadline (manaflow-ai#15027)
810ffba fix(ci): resolve binary modules in detached test reruns (manaflow-ai#15026)
d363290 test: await fork probe fixture start signals (manaflow-ai#15025)
8c98e64 Add cmux import for settings from other terminals (manaflow-ai#15004)
30aa6c1 Keep SSH workspace titles when cmux-tui creates the remote workspace (manaflow-ai#14976)
b33c467 Restore workspace group color and icon key handling from manaflow-ai#13877 (manaflow-ai#15000)

# Conflicts:
#	.github/workflows/app-host-test-rerun.yml
#	.github/workflows/ci-macos.yml
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.

1 participant