Repository navigation
Gate sidebar extension system behind Beta Features toggle - #5084
austinywang wants to merge 6 commits into
Conversation
Add a "Sidebar Extensions" beta toggle (OFF by default) mirroring the existing Dock beta toggle end to end: catalog key, both Settings UIs (legacy + CmuxSettingsUI package), command palette setting toggle, settings navigation/search entries + aliases, and localized strings. When off, the sidebar always renders the default workspace list via a single effectiveExtensionSidebarProviderId that collapses the persisted provider selection and the beta flag into one value, so a stale persisted extension id can never surface. The "Sidebar: %@" palette entries are not registered and the provider picker menu no-ops while the flag is off. The gate observes the @AppStorage flag so toggling updates the UI live. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR introduces a new beta feature toggle for sidebar extensions. It adds the ChangesSidebar Extensions Beta Toggle
Sequence DiagramsequenceDiagram
participant User
participant SettingsUI
participant Catalog as Settings Catalog
participant ContentView
User->>SettingsUI: Toggle Sidebar Extensions
SettingsUI->>Catalog: Update betaFeatures.sidebarExtensions
Catalog->>ContentView: Flag change observable
alt Beta Enabled
ContentView->>ContentView: Register extension-sidebar commands
ContentView->>ContentView: Use selected provider ID
else Beta Disabled
ContentView->>ContentView: Skip extension commands
ContentView->>ContentView: Force default provider only
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (15 passed)
✨ 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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f593920. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swift (2)
4-6:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate the doc comment to reflect both beta features.
The comment still describes this section as having "a single
Docktoggle," but it now includes both Dock and Sidebar Extensions toggles.📝 Proposed fix
/// **Beta Features** section — mirrors the legacy -/// `BetaFeaturesSettingsView`: warning note followed by a single -/// `Dock` toggle. +/// `BetaFeaturesSettingsView`: warning note followed by +/// beta feature toggles (Dock, Sidebar Extensions).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swift` around lines 4 - 6, The doc comment for BetaFeaturesSection is outdated—update the header comment that mentions "a single `Dock` toggle" so it accurately documents both toggles now present (Dock and Sidebar Extensions); edit the comment above BetaFeaturesSection (which references BetaFeaturesSettingsView) to describe the warning note followed by both the Dock and Sidebar Extensions toggles.
21-23:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUpdate the warning message to cover all beta features.
The warning text only mentions "Dock" but now applies to both Dock and Sidebar Extensions. Users enabling Sidebar Extensions should also understand that it's unstable.
⚠️ Proposed fixBetaFeaturesWarningNote( - String(localized: "settings.betaFeatures.warning", defaultValue: "Dock is unstable and may change or break. Enable it only when you are testing it.") + String(localized: "settings.betaFeatures.warning", defaultValue: "Beta features are unstable and may change or break. Enable them only when you are testing.") )Note: This will require updating the corresponding localization key in
Resources/*.xcstringsfor all supported locales.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swift` around lines 21 - 23, Update the warning text used in BetaFeaturesWarningNote so it references "beta features" (or explicitly "Dock and Sidebar Extensions") instead of only "Dock": change the localized string for key "settings.betaFeatures.warning" (used in BetaFeaturesWarningNote) to a generic message like "Beta features are unstable and may change or break. Enable them only when you are testing." and update the corresponding localization entries in Resources/*.xcstrings for all locales to reflect the new wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swift`:
- Around line 54-57: The three new localization keys used in
BetaFeaturesSection.swift (settings.betaFeatures.sidebarExtensions,
settings.betaFeatures.sidebarExtensions.subtitleOn,
settings.betaFeatures.sidebarExtensions.subtitleOff) are only translated for en
and ja; update Resources/Localizable.xcstrings to add translations for the
missing locales (ar, bs, da, de, es, fr, it, km, ko, nb, pl, pt-BR, ru, th, tr,
uk, zh-Hans, zh-Hant) so every supported locale has entries for each key,
keeping the same key names and providing appropriate localized strings for each
language.
In `@Sources/cmuxApp.swift`:
- Around line 8452-8453: resetAllSettings() currently restores beta flags like
sidebarExtensionsEnabled but doesn't clear the persisted sidebar extension
selection, so update resetAllSettings() to remove or reset the keys
cmuxExtensionSidebar.providerId and cmuxExtensionSidebar.selectedExtensionName
(or explicitly set providerId to defaultWorkspacesID) when clearing settings;
ensure this runs alongside restoring
SidebarExtensionBetaFeatureSettings.defaultEnabled so re-enabling the toggle
uses the defaultWorkspacesID rather than a previously stored provider.
In `@Sources/ContentView.swift`:
- Around line 6723-6736: The command palette currently gates contributions with
the non‑reactive SidebarExtensionBetaFeatureSettings.isEnabled() so entries
won't update at runtime; update commandPaletteCommandContributions() (and the
handler registration that uses commandPaletteExtensionSidebarCommandID(_:)) to
read a reactive `@AppStorage` boolean for the same settings key (or otherwise
observe changes and rebuild contributions/handlers) so the list is recomputed
when effectiveExtensionSidebarProviderId/@AppStorage toggles; as a defensive
alternative, add a runtime guard inside the command handler to no‑op when
SidebarExtensionBetaFeatureSettings.isEnabled() is false so commands added
earlier won’t run when the feature is off.
---
Outside diff comments:
In
`@Packages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swift`:
- Around line 4-6: The doc comment for BetaFeaturesSection is outdated—update
the header comment that mentions "a single `Dock` toggle" so it accurately
documents both toggles now present (Dock and Sidebar Extensions); edit the
comment above BetaFeaturesSection (which references BetaFeaturesSettingsView) to
describe the warning note followed by both the Dock and Sidebar Extensions
toggles.
- Around line 21-23: Update the warning text used in BetaFeaturesWarningNote so
it references "beta features" (or explicitly "Dock and Sidebar Extensions")
instead of only "Dock": change the localized string for key
"settings.betaFeatures.warning" (used in BetaFeaturesWarningNote) to a generic
message like "Beta features are unstable and may change or break. Enable them
only when you are testing." and update the corresponding localization entries in
Resources/*.xcstrings for all locales to reflect the new wording.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5b924de0-fc71-4278-ae5e-e536b3b1dc0c
📒 Files selected for processing (12)
Packages/CmuxSettings/Sources/CmuxSettings/Keys/BetaFeaturesCatalogSection.swiftPackages/CmuxSettingsUI/Sources/CmuxSettingsUI/Navigation/CuratedSettingEntry+Default.swiftPackages/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BetaFeaturesSection.swiftPackages/CmuxSettingsUI/Tests/CmuxSettingsUITests/SettingsRowAnchorResolutionTests.swiftResources/Localizable.xcstringsSources/App/WorkspaceRuntimeSettings.swiftSources/BetaFeaturesSettingsView.swiftSources/CommandPalette/CommandPaletteSettingsToggle.swiftSources/ContentView.swiftSources/SettingsNavigation.swiftSources/SettingsSearchAliases.swiftSources/cmuxApp.swift
Greptile SummaryThis PR gates the existing
Confidence Score: 5/5Safe to merge — the change adds a well-scoped opt-in beta toggle that is off by default and cannot affect existing users who have never touched extension sidebar settings. The implementation faithfully mirrors the established Dock beta pattern end to end: the catalog key is consistent across BetaFeaturesCatalogSection, ExtensionsBetaFeatureSettings, the command-palette descriptor, the settings anchor map, and the isEnabled synchronous read. The effectiveExtensionSidebarProviderId property handles both the hosted-extensions and custom-sidebar fallback paths, and the canSelectProvider guard on stale AppKit/palette handlers closes the race between handler registration and flag state. The reset path correctly separates catalog-owned keys from host-owned keys. No correctness gaps were found. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["User action: sidebar switch"] --> B{Source}
B -->|"Command Palette handler"| C["canSelectProvider check"]
B -->|"AppKit menu callback"| C
B -->|"Settings toggle"| D["Writes extensions.beta.enabled"]
C -->|"hostedExtensionsProviderId"| E{isEnabled?}
C -->|"customSidebarProviderPrefix"| F{customSidebarsEnabled?}
C -->|"built-in provider"| G["setProviderId — allowed"]
E -->|"No"| H["guard return — no-op"]
E -->|"Yes"| G
F -->|"No"| H
F -->|"Yes"| G
D --> I["@LiveSetting reactive update"]
I --> J["effectiveExtensionSidebarProviderId re-evaluates"]
J --> K{persisted provider type}
K -->|"customSidebarProviderPrefix"| L{customSidebarsEnabled?}
K -->|"hostedExtensions or built-in"| M["effectiveProviderId()"]
L -->|"No"| N["render defaultProviderId"]
L -->|"Yes"| O["render custom sidebar"]
M -->|"extensions off and hosted"| N
M -->|"otherwise"| P["render persisted provider"]
Q["Reset All Settings"] --> R["defaultsStore.resetAll catalog keys"]
Q --> S["key.resetInJSON for each catalog key"]
Q --> T["hostActions.resetHostOnlySettings"]
T --> U["remove cmuxExtensionSidebar.providerId"]
T --> V["remove cmuxExtensionSidebar.selectedExtensionName"]
Reviews (6): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
There was a problem hiding this comment.
2 issues found across 12 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Dismissed after d6f6ecd/5b1d225b3 addressed the review findings; CodeRabbit confirmed the actionable threads as addressed and the current CodeRabbit check is passing.
…n-beta # Conflicts: # Sources/ContentView.swift
|
Closing — not pursuing this gating approach for now. |

Summary
Adds a new Sidebar Extensions toggle to Settings → Beta Features, OFF by default, exactly mirroring the existing Dock beta toggle. The toggle gates the custom left-sidebar extension provider system (built on
CmuxExtensionKit) that can replace the default workspace-list sidebar.Behavior
Sidebar: %@command-palette entries are absent, and the provider picker menu (right-click the sidebar toggle) is unavailable — regardless of any persistedcmuxExtensionSidebar.providerId.@AppStorageflag), mirroring how the Dock toggle auto-switches away when disabled.Design
The flag's UserDefaults key
sidebar.beta.extensions.enabledis the single source of truth, declared once as a catalogDefaultsKeyplus a thinSidebarExtensionBetaFeatureSettingsmirror enum — exactly the shape Dock uses (betaFeatures.rightSidebarDock+RightSidebarBetaFeatureSettings).The key invariant is a single computed
effectiveExtensionSidebarProviderIdthat collapses(persisted providerId, flag)into one value all render branches read. While the flag is off it is forced todefaultWorkspaces, making "extension sidebar visible while flag off" unrepresentable rather than guarded at each call site.Changes (mirrors Dock end to end)
BetaFeaturesCatalogSection— newsidebarExtensionscatalog key.SidebarExtensionBetaFeatureSettingsenum — key/default/isEnabled(defaults:).BetaFeaturesSettingsView(legacy) +cmuxApp@Settingbinding & reset.BetaFeaturesSection(CmuxSettingsUI package) — second row.CommandPaletteSettingsToggle— descriptor for the toggle itself.SettingsNavigation+SettingsSearchAliases+CuratedSettingEntry+Default— searchable/deep-linkable entries.ContentView(palette entries + registration + effective provider) and the picker menushowMenu.Localizable.xcstrings.SettingsRowAnchorResolutionTestsso the new curated entry stays reachable.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Touches core left-sidebar provider selection and reset behavior; wrong gating could hide UI or leave users on an invalid provider, but changes mirror existing Dock beta patterns with explicit guards.
Overview
Adds a Beta Features → Extensions toggle (default off) backed by
extensions.beta.enabledandExtensionsBetaFeatureSettings, wired through settings search, command palette, and broad localization updates.Reset All Settings now calls new
SettingsHostActions.resetHostOnlySettings()so the host clears persisted extension sidebar provider keys;ResetSectiontakeshostActionsandHostSettingsActionsimplements the clear.ContentView observes the extensions (and custom sidebars) beta flags for command-palette context, adds
canSelectProviderso palette handlers and the AppKit sidebar menu ignore stale switches when betas are off, and keeps effective provider resolution when extensions are disabled.Reviewed by Cursor Bugbot for commit 421032e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Gated the extension-based left sidebar behind a new Sidebar Extensions beta toggle (OFF by default). The toggle updates the UI live, hides related commands/menus when off, and mirrors the Dock beta flow.
New Features
CmuxSettings/CmuxSettingsUIand localized across many locales.ExtensionsBetaFeatureSettingswithextensions.beta.enabled(default false).canSelectProviderto block stale handlers; command-palette context exposesbetaFeatures.extensions.enabledandbetaFeatures.customSidebars.enabledfor gating.SettingsHostActions.resetHostOnlySettings()fromResetSection; added a curated entry, search aliases/anchors, and test coverage.Bug Fixes
Written for commit 421032e. Summary will update on new commits.
Summary by CodeRabbit