diff --git a/README.md b/README.md index 45027e8..fc1e909 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ You can also clone the repo and symlink the skills you want into your agent's sk | [`cmux-customize`](skills/cmux-customize) | Customize tab bar buttons, plus-button menus, custom actions, commands, and right sidebar entries through `cmux.json`. | | [`cmux-ref`](skills/cmux-ref) | Interpret pasted cmux workspace, pane, surface, and window refs or UUIDs as explicit target context. | | [`cmux-groups`](skills/cmux-groups) | Manage collapsible sidebar workspace groups, anchor workspaces, group placement, and per-cwd group config. | +| [`cmux-sidebar-builder`](skills/cmux-sidebar-builder) | Build left-sidebar custom views with cmux's runtime SwiftUI-style interpreter. | | [`cmux-workspace`](skills/cmux-workspace) | Work inside the current cmux workspace: caller surface, panes, surfaces, tagged reloads, socket targeting, non-interfering automation. | | [`cmux-browser`](skills/cmux-browser) | Drive cmux browser surfaces: snapshot refs, DOM actions, waits, screenshots, cookies, storage, tabs, downloads, console, errors. | | [`cmux-artifact`](skills/cmux-artifact) | Build durable HTML walkthrough artifacts for dogfood, verification, demos, and evidence pages, and open them in the current workspace. | @@ -45,6 +46,7 @@ skills/ cmux-customize/SKILL.md cmux-freestyle/SKILL.md cmux-groups/SKILL.md + cmux-sidebar-builder/SKILL.md cmux-ref/SKILL.md cmux-settings/SKILL.md cmux-workspace/SKILL.md diff --git a/skills.sh.json b/skills.sh.json index efc0732..02ed376 100644 --- a/skills.sh.json +++ b/skills.sh.json @@ -17,6 +17,7 @@ "skills": [ "cmux-ref", "cmux-groups", + "cmux-sidebar-builder", "cmux-workspace", "cmux-browser", "cmux-artifact" diff --git a/skills/cmux-sidebar-builder/SKILL.md b/skills/cmux-sidebar-builder/SKILL.md new file mode 100644 index 0000000..456ae19 --- /dev/null +++ b/skills/cmux-sidebar-builder/SKILL.md @@ -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/.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 customSidebars.beta.enabled -bool true +defaults write cmuxExtensionSidebar.providerId "cmux.sidebar.custom." +``` + +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. diff --git a/skills/cmux-sidebar-builder/agents/openai.yaml b/skills/cmux-sidebar-builder/agents/openai.yaml new file mode 100644 index 0000000..d713f83 --- /dev/null +++ b/skills/cmux-sidebar-builder/agents/openai.yaml @@ -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."