Repository navigation
Add cmux sidebar builder skill #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| name: cmux-sidebar-builder | ||
| description: "Build, inspect, or revise cmux left-sidebar custom views using the runtime SwiftUI-style interpreter. Use for custom sidebars, left sidebar building, sidebar vibe coding, interpreted Swift sidebars, ~/.config/cmux/sidebars/*.swift, cmux docs sidebars, or Aziz's Swift interpreter work." | ||
| --- | ||
|
|
||
| # cmux sidebar builder | ||
|
|
||
| Use this skill when the task is to create or modify a cmux left-sidebar custom view. These are user/agent-authored `.swift` files in `~/.config/cmux/sidebars/` rendered by cmux's runtime SwiftUI-style interpreter, not compiled app code. | ||
|
|
||
| ## Orientation | ||
|
|
||
| - The original work is PR `https://github.com/manaflow-ai/cmux/pull/5254` by Aziz Albahar. | ||
| - The feature is opt-in behind the UserDefaults-backed key `customSidebars.beta.enabled`. | ||
| - Custom sidebars live under `~/.config/cmux/sidebars/` and appear in the left sidebar picker when the beta is enabled. | ||
| - Start from the cmux app checkout docs: `repo/docs/custom-sidebars.md`. | ||
|
|
||
| Important cmux source entrypoints: | ||
|
|
||
| - `repo/Packages/CmuxSwiftRender/Sources/CmuxSwiftRender/SwiftViewInterpreter.swift` | ||
| - `repo/Packages/CmuxSwiftRender/Sources/CmuxSwiftRender/ExpressionEvaluator.swift` | ||
| - `repo/Packages/CmuxSwiftRender/Sources/CmuxSwiftRender/RenderNode.swift` | ||
| - `repo/Packages/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Sidebar/CustomSidebarView.swift` | ||
| - `repo/Sources/ContentView.swift`, around `customSidebarsDirectory`, `customSidebarDataContext`, and `CustomSidebarView(...)`. | ||
|
|
||
| Follow-up implementation branches to inspect when needed: | ||
|
|
||
| - `origin/feat-interpreter-primitives` for the broader supported SwiftUI-ish primitive surface. | ||
| - `origin/feat-sidebar-interpreter-isolation` for the out-of-process crash-isolated interpreter worker. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Inspect the current app docs and interpreter surface before authoring: | ||
| ```bash | ||
| sed -n '1,220p' repo/docs/custom-sidebars.md | ||
| rg -n "struct SwiftViewInterpreter|func evaluate|func parse|enum RenderNode|customSidebarDataContext|customSidebarsDirectory" repo/Packages/CmuxSwiftRender repo/Packages/CmuxSwiftRenderUI repo/Sources/ContentView.swift | ||
| ``` | ||
|
|
||
| 2. Create or edit the sidebar file in the user's config directory: | ||
| ```bash | ||
| mkdir -p ~/.config/cmux/sidebars | ||
| $EDITOR ~/.config/cmux/sidebars/<name>.swift | ||
| ``` | ||
|
|
||
| 3. Stay inside the interpreted subset. Prefer simple SwiftUI-style expressions: `VStack`, `HStack`, `Text`, `Image`, `Button`, `ForEach`, conditionals, supported modifiers, and data from the provided context. Do not assume arbitrary Swift, imports, async work, filesystem access, networking, custom types, or compiled dependencies are available. | ||
|
|
||
| 4. Use the provided data context instead of shelling out. If the sidebar needs data that is not exposed, identify the missing field in `customSidebarDataContext` and treat adding it as an app code change in a cmux worktree. | ||
|
|
||
| 5. If you change app/runtime code, follow the cmux repo workflow: create a worktree, read repo-local instructions, localize user-facing strings, test appropriately, and reload with a tag before dogfood handoff. Config-only sidebar `.swift` edits do not require an app rebuild. | ||
|
|
||
| ## Authoring rules | ||
|
|
||
| - This is the left sidebar. Do not use right-sidebar configuration or ExtensionKit unless the user explicitly asks for that surface. | ||
| - Keep custom sidebar files small and inspectable. If a design gets complicated, split behavior into simple helper functions only if the interpreter supports them. | ||
| - Make every visible action explicit through supported `Button` action payloads. Do not invent action ids without checking `repo/Packages/CmuxSwiftRender/Sources/CmuxSwiftRender/ActionCommand.swift` and app dispatch wiring. | ||
| - Prefer real workspace, surface, notification, port, git, and progress fields from the cmux context. Avoid placeholder dashboards unless the task is only a mockup. | ||
| - When a rendering failure happens, reduce to the smallest sidebar file that reproduces it, then compare against `CmuxSwiftRender` tests and corpus examples. | ||
|
|
||
| ## Verification | ||
|
|
||
| For config-only sidebars: | ||
|
|
||
| ```bash | ||
| ls ~/.config/cmux/sidebars | ||
| ``` | ||
|
|
||
| Then ensure `customSidebars.beta.enabled` is on and ask the user to select the named sidebar from the left sidebar picker. This is not a `cmux.json` setting in current cmux builds; it is stored in the app's `UserDefaults.standard` domain. For temporary local dogfood only, it is acceptable to set the running app domain directly: | ||
|
|
||
| ```bash | ||
| defaults write <bundle-id> customSidebars.beta.enabled -bool true | ||
| defaults write <bundle-id> cmuxExtensionSidebar.providerId "cmux.sidebar.custom.<name>" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Verification step uses an Extension sidebar provider key, which conflicts with this skill’s left-sidebar interpreted workflow and can misconfigure the wrong sidebar surface. Prompt for AI agents |
||
| ``` | ||
|
|
||
| Use the actual running bundle id, often `com.cmuxterm.app.nightly` for nightly or `com.manaflow.cmux.dev` for the default dev app. State that this is temporary dogfood setup, not a product default. | ||
|
|
||
| For interpreter or app changes, prefer focused package tests for `CmuxSwiftRender` plus the smallest real dogfood reload. Do not run local cmux `xcodebuild ... test`; use the project's remote or CI test guidance. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| interface: | ||
| display_name: "cmux Sidebar Builder" | ||
| short_description: "Build left-sidebar custom views with cmux's runtime SwiftUI-style interpreter." | ||
| default_prompt: "Use this skill to create, inspect, or revise cmux left-sidebar custom sidebars in ~/.config/cmux/sidebars using the runtime Swift interpreter and current cmux docs/source entrypoints." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Terminology inconsistency: Prompt for AI agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2:
<bundle-id>in thedefaults writecommands is parsed by the shell as a stdin redirection (redirect from filebundle-id), not as a literal placeholder argument. Bothdefaults writecommands will fail because the bundle-id domain argument is consumed by the redirection parser rather than passed todefaults write.Fix: Replace
<bundle-id>with a concrete example bundle ID such ascom.manaflow.cmux.dev, since the surrounding note already lists the actual bundle IDs to use.Prompt for AI agents