Repository navigation
Split CLI theme command out of cmux.swift - #3226
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds comprehensive theme management to CMUXCLI: discovers and validates themes across multiple resource locations, reads/writes a managed theme override in Ghostty config, exposes a CLI Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CLI as CMUXCLI
participant Discovery as Theme Discovery
participant Config as Ghostty Config
participant Notify as Distributed Notify
participant Ghostty as Ghostty App
User->>CLI: themes list
CLI->>Discovery: availableThemeNames()
Discovery->>Config: scan candidate config URLs
Config-->>Discovery: last theme directives
Discovery-->>CLI: theme list
CLI-->>User: display themes
sequenceDiagram
actor User
participant CLI as CMUXCLI
participant Discovery as Theme Discovery
participant Config as Ghostty Config
participant Notify as Distributed Notify
participant Ghostty as Ghostty App
User->>CLI: themes set --light MyTheme
CLI->>Discovery: validatedThemeName("MyTheme")
Discovery-->>CLI: validated name
CLI->>Config: writeManagedThemeOverride(validated)
Config-->>CLI: override file URL
CLI->>Notify: post reload notification (bundle id)
Notify->>Ghostty: reload themes
Ghostty-->>User: apply theme
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR is a pure refactoring that extracts the CLI themes command (~716 lines) from the monolithic Confidence Score: 5/5Safe to merge — pure code movement with no functional changes. All logic is identical to the removed block in cmux.swift. The only observable change is access-level widening (private → internal) for methods that must cross file boundaries, which is the correct and necessary Swift idiom for multi-file extensions. Both new files respect the 500-line ceiling, the budget TSV is updated correctly, and the Xcode project registers both files. No files require special attention. Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
class `cmux.swift` {
+parseOption()
+jsonString()
+parentSearchURL()
+resolvedExecutableURL()
-runCommand()
}
class `CMUXCLI+Themes.swift` {
+cmuxThemeOverrideBundleIdentifier: String
+cmuxThemesBlockStart: String
+cmuxThemesBlockEnd: String
+cmuxThemesReloadNotificationName: String
+ThemeSelection
+ThemeReloadStatus
+ThemePickerTargetMode
+runThemes()
-printThemesList()
-runThemesSet()
-runThemesClear()
-currentThemeSelection()
-parseThemeSelection()
-runInteractiveThemes()
-bundledHelperURL()
-execInteractiveHelper()
}
class `CMUXCLI+ThemeSupport.swift` {
+availableThemeNames()
+validatedThemeName()
+themeConfigSearchURLs()
+lastThemeDirective()
+cmuxThemeOverrideConfigURL()
+writeManagedThemeOverride()
+clearManagedThemeOverride()
+reloadThemesIfPossible()
+currentCmuxAppBundleIdentifier()
-themeDirectoryURLs()
-removingManagedThemeOverride()
-readOptionalThemeOverrideContents()
-isThemeOverrideFileNotFoundError()
}
`cmux.swift` <|-- `CMUXCLI+Themes.swift` : extension CMUXCLI
`cmux.swift` <|-- `CMUXCLI+ThemeSupport.swift` : extension CMUXCLI
`CMUXCLI+Themes.swift` --> `CMUXCLI+ThemeSupport.swift` : calls helpers
Reviews (1): Last reviewed commit: "refactor: split CLI theme command" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CLI/CMUXCLI`+Themes.swift:
- Around line 400-402: parseThemeSelection currently backfills light from dark
and dark from light by using lightTheme ?? fallbackTheme ?? darkTheme and vice
versa; change this so one-sided directives remain one-sided by computing
resolvedLight = lightTheme ?? fallbackTheme and resolvedDark = darkTheme ??
fallbackTheme (keep using ThemeSelection(rawValue:rawValue, light:resolvedLight,
dark:resolvedDark, sourcePath:sourcePath)). This removes the fallback to the
opposite side (darkTheme/lightTheme) so an explicitly one-sided declaration
isn't treated as both.
In `@CLI/CMUXCLI`+ThemeSupport.swift:
- Around line 128-141: themeConfigSearchURLs() currently always includes the
legacy Application Support paths, which lets the CLI pick up legacy theme
settings the app may ignore; change themeConfigSearchURLs() to only include the
"~/Library/Application Support/com.mitchellh.ghostty/config" (and its .ghostty
variant) when shouldLoadLegacyGhosttyConfig(...) returns true (mirror the same
gating used by GhosttyApp.loadedGhosttyConfigScanPaths and
currentThemeSelection()); implement this by consulting
shouldLoadLegacyGhosttyConfig(...) inside themeConfigSearchURLs() and
conditionally appending the legacy paths instead of unconditionally listing
them.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 88a811e6-c9fb-4f46-86fb-43f403d838c5
⛔ Files ignored due to path filters (1)
.github/swift-file-length-budget.tsvis excluded by!**/*.tsv
📒 Files selected for processing (4)
CLI/CMUXCLI+ThemeSupport.swiftCLI/CMUXCLI+Themes.swiftCLI/cmux.swiftGhosttyTabs.xcodeproj/project.pbxproj
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bfec815df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary:
Verification:
Summary by cubic
Split the
cmux themescommand out ofCLI/cmux.swiftinto focusedCMUXCLIextensions. Also refined config search to preferconfig.ghostty, tightened the file-length budget, and fixed tagged reload to build the Ghostty CLI helper.Refactors
CLI/CMUXCLI+Themes.swiftandCLI/CMUXCLI+ThemeSupport.swift(each <500 lines); moved theme list/set/clear and helpers.CLI/cmux.swiftby 716 lines; tightened its file-length budget from 18,705 to 17,989.parseOption,jsonString,parentSearchURL,resolvedExecutableURL.Bug Fixes
config.ghosttyand only falls back to legacyconfigwhen the new file exists but is empty.CMUX_SKIP_ZIG_BUILD=1when set explicitly.Written for commit 70710c7. Summary will update on new commits. Review in cubic
Summary by CodeRabbit