### Install Dependencies and Start Development Server Source: https://github.com/manaflow-ai/cmux/blob/main/web/README.md Installs project dependencies using Bun and starts the development server. Secrets are sourced from environment files. ```bash bun install bun dev ``` -------------------------------- ### Setup All Supported Agent Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/docs/feed.md Installs all supported agent hooks that have their binaries on the system's PATH. Use this for a comprehensive setup. ```bash cmux hooks setup ``` -------------------------------- ### Quick Start: CmuxSettings Setup and Usage Source: https://github.com/manaflow-ai/cmux/blob/main/Packages/macOS/CmuxSettings/README.md Demonstrates how to initialize SettingCatalog, UserDefaultsSettingsStore, and JSONConfigStore. Shows reading, writing, and observing settings changes. ```swift import CmuxSettings // 1. Construct the catalog at app startup. let catalog = SettingCatalog() // 2. Construct each store (DI; no shared singletons). let userDefaultsStore = UserDefaultsSettingsStore( defaults: .standard, migrating: catalog.all ) let jsonConfigStore = JSONConfigStore( fileURL: CmuxConfigLocation().userConfigFile ) // 3. Read / write. let mode = await userDefaultsStore.value(for: catalog.app.appearance) await userDefaultsStore.set(.dark, for: catalog.app.appearance) try await jsonConfigStore.set( "hunter2", for: catalog.automation.socketPassword ) // 4. Observe changes. Returns AsyncStream that yields the current value // first, then every later change. for await newMode in userDefaultsStore.values(for: catalog.app.appearance) { applyAppearance(newMode) } ``` -------------------------------- ### Install Dependencies and Run Development Server Source: https://github.com/manaflow-ai/cmux/blob/main/docs/presence-service.md Navigate to the presence worker directory, install dependencies using bun, run tests, and start the development server with wrangler. ```bash cd workers/presence bun install bun test bun run dev # wrangler dev (needs .dev.vars or --var Stack config) ``` -------------------------------- ### Run Setup Script Source: https://github.com/manaflow-ai/cmux/blob/main/CONTRIBUTING.md Execute the setup script to initialize submodules, build the GhosttyKit, and create symlinks. ```bash ./scripts/setup.sh ``` -------------------------------- ### Open iOS Example App in Xcode Source: https://github.com/manaflow-ai/cmux/blob/main/vendor/stack-auth-swift-sdk-prerelease/README.md Navigate to the iOS example directory and open the Package.swift file in Xcode to launch the application. ```bash cd Examples/StackAuthiOS open Package.swift # Opens in Xcode ``` -------------------------------- ### Run macOS Example App Source: https://github.com/manaflow-ai/cmux/blob/main/vendor/stack-auth-swift-sdk-prerelease/README.md Navigate to the macOS example directory and run the application using Swift Package Manager. ```bash cd Examples/StackAuthMacOS swift run ``` -------------------------------- ### Install cmux with Homebrew Source: https://github.com/manaflow-ai/cmux/blob/main/README.md Use these commands to tap the repository and install cmux via Homebrew. This is a convenient method for installation and updates. ```bash brew tap manaflow-ai/cmux brew install --cask cmux ``` -------------------------------- ### Local Development Commands Source: https://github.com/manaflow-ai/cmux/blob/main/workers/presence/README.md Commands to install dependencies, run type checks, execute tests, and start the local development server for the worker. ```bash bun install bun run typecheck bun test bun run dev # wrangler dev; provide Stack config via .dev.vars or --var ``` -------------------------------- ### Setup and Uninstall Agent Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/docs/agent-hooks.md Use these commands to install or uninstall agent hooks for cmux. The setup command can be used generally or for a specific agent. Agents not found on PATH are skipped during general setup. ```bash cmux hooks setup cmux hooks setup cmux hooks setup --agent cmux hooks uninstall ``` -------------------------------- ### Setup cmux Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/README.md Install supported agent hooks for session resume functionality. This command should be run after installing the agent CLI to ensure it is on the system's PATH. ```bash cmux hooks setup cmux hooks setup codex cmux hooks setup --agent opencode ``` -------------------------------- ### Start Development Server and Keep Docker Postgres Running Source: https://github.com/manaflow-ai/cmux/blob/main/web/README.md Starts the development server and ensures the Docker Postgres container remains active after the server exits. Preserves local database state. ```bash CMUX_DEV_STOP_DB_ON_EXIT=0 bun dev ``` -------------------------------- ### Example: List workspace groups Source: https://github.com/manaflow-ai/cmux/blob/main/docs/workspace-groups.md Lists all workspace groups currently present in the focused window. ```bash cmux workspace-group list ``` -------------------------------- ### Start Provider Session Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-solid/index.html Initiates a provider session, handling the 'starting' and 'startAccepted' states. This is used when a user selects a provider and the system attempts to launch it. ```javascript async function Mt(e,t){t({type:"starting"});try{let n=await D("provider.start",{providerId:e.providerId,workingDirectory:e.workingDirectory});t({type:"startAccepted",sessionId:n.sessionId})}catch(n){t({type:"failed",message:ve(n,e.copy)})}} ``` -------------------------------- ### Run SDK Tests Source: https://github.com/manaflow-ai/cmux/blob/main/vendor/stack-auth-swift-sdk-prerelease/README.md Execute the SDK tests by first starting the development server and then running the Swift tests. ```bash pnpm dev cd sdks/implementations/swift swift test ``` -------------------------------- ### Team Dogfood Setup Source: https://github.com/manaflow-ai/cmux/blob/main/CONTRIBUTING.md Run this script once to set up your Stack account for debug builds. It prompts for credentials and creates a secrets file. ```bash scripts/setup-team-dev.sh ``` -------------------------------- ### Example: Create a workspace group Source: https://github.com/manaflow-ai/cmux/blob/main/docs/workspace-groups.md Groups the three currently selected workspaces under the name 'manaflow'. ```bash cmux workspace-group create --name manaflow ``` -------------------------------- ### Setup Specific Agent Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/docs/feed.md Installs a specific agent hook. Useful when only one agent's hooks are needed. You can specify the agent by name or by using the --agent flag. ```bash cmux hooks setup --agent codex ``` ```bash cmux hooks setup rovo ``` -------------------------------- ### Install Custom Sidebars Source: https://github.com/manaflow-ai/cmux/blob/main/Examples/CustomSidebars/README.md Copy the sidebar files into the custom sidebar directory. Ensure the directory exists. ```bash mkdir -p ~/.config/cmux/sidebars cp Examples/CustomSidebars/status-board.swift ~/.config/cmux/sidebars/status-board.swift cp Examples/CustomSidebars/finder.swift ~/.config/cmux/sidebars/finder.swift ``` -------------------------------- ### End-to-End Example: CmuxSettings Hermetic Test Source: https://github.com/manaflow-ai/cmux/blob/main/Packages/macOS/CmuxSettings/README.md A self-contained example using a temporary directory to test reading, writing, and observing settings via JSONConfigStore, simulating external edits. ```swift import CmuxSettings import Foundation // Scope the JSON store to a temp file so this example is hermetic. let tempDir = FileManager.default.temporaryDirectory .appending(path: "cmux-readme-\(UUID().uuidString)") try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true) let fileURL = tempDir.appending(path: "cmux.json") let catalog = SettingCatalog() let json = JSONConfigStore(fileURL: fileURL) // Initially missing → default. let initial = await json.value(for: catalog.automation.socketPassword) assert(initial == "") // Write → file is created with the parent directory. try await json.set("hunter2", for: catalog.automation.socketPassword) assert(await json.value(for: catalog.automation.socketPassword) == "hunter2") // Observe → react to external edits (simulated here). let task = Task { for await value in json.values(for: catalog.automation.socketPassword) { print("password is now:", value) } } try Data(#"{\"automation\":{\"socketPassword\":\"rotated\"}}"#.utf8) .write(to: fileURL, options: .atomic) // ... do other work; cancel when done observing. // task.cancel() ``` -------------------------------- ### Start Development Server Without Docker Postgres Source: https://github.com/manaflow-ai/cmux/blob/main/web/README.md Starts the development server without initializing or managing a Docker Postgres container. Useful for environments where a database is already available. ```bash CMUX_DEV_START_DB=0 bun dev ``` -------------------------------- ### Install Stack Auth Swift SDK Source: https://github.com/manaflow-ai/cmux/blob/main/vendor/stack-auth-swift-sdk-prerelease/README.md Add the SDK to your Swift Package Manager dependencies. ```swift dependencies: [ .package(url: "https://github.com/stack-auth/swift-sdk-prerelease", from: ) ] ``` -------------------------------- ### Example: Spin up a new workspace in an existing group Source: https://github.com/manaflow-ai/cmux/blob/main/docs/workspace-groups.md Spins up a new workspace inside an existing group, potentially wired to a worktree script. ```bash cmux workspace-group new-workspace workspace_group:1 ``` -------------------------------- ### Apply Dev Profile with Tag Source: https://github.com/manaflow-ai/cmux/blob/main/scripts/dev-profiles/README.md Build, launch, and pair the application, then seed a live agent for composer testing using a specific tag and profile. ```bash scripts/dev-setup.sh --tag grid --profile composer ``` -------------------------------- ### Quick Start: Initialize and Authenticate User Source: https://github.com/manaflow-ai/cmux/blob/main/vendor/stack-auth-swift-sdk-prerelease/README.md Initialize the StackClientApp and perform user authentication using email and password. Retrieves the current user and signs out. ```swift import StackAuth let stack = StackClientApp( projectId: "your-project-id", publishableClientKey: "your-key" ) // Sign in with email/password try await stack.signInWithCredential(email: "user@example.com", password: "password") // Get current user if let user = try await stack.getUser() { print("Signed in as \(user.displayName ?? \"Unknown\")") } // Sign out try await stack.signOut() ``` -------------------------------- ### Install Individual Agent Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/docs/feed.md Installs hooks for a specific agent. This command is used when an agent's binary is not on the PATH or for targeted installations. ```bash cmux hooks codex install ``` ```bash cmux hooks opencode install # global ``` ```bash cmux hooks opencode install --project # .opencode/plugins/cmux-feed.js in cwd ``` -------------------------------- ### Initialize Application Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-solid/index.html Finds the root element and initializes the application by calling Re() and ot() with provided parameters. ```javascript var qt=document.getElementById("root");qt&&(Re(),ot(Tn,qt)) ``` -------------------------------- ### EditorState Initialization and Reconfiguration Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-react/index.html Demonstrates how to create a new EditorState instance and how to reconfigure an existing one with new plugins. Useful for setting up the initial state of an editor or updating its behavior dynamically. ```javascript static create(e){let n=new yo(e.doc?e.doc.type.schema:e.schema,e.plugins),l=new t(n);for(let i=0;i{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof j&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(l=>l.type.spec.inclusive===!1)||we&&k2&&M8(t)))t.markCursor=t.state.storedMarks||n.marks(),Zs(t,!0),t.markCursor=null;else if(Zs(t,!e.selection.empty),Tt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let l=t.domSelectionRange();for(let i=l.focusNode,r=l.focusOffset;i&&i.nodeType==1&&r!=0;){let o=r<0?i.lastChild:i.childNodes\[r-1\];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,r=-1}}t.input.composing=!0}W2(t,C8)} ``` -------------------------------- ### Inspect CMUX Settings and Bindings Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-keyboard-shortcuts/SKILL.md Use these commands to inspect the CMUX settings path, retrieve current shortcut bindings, and validate the configuration. The `get` command redirects errors to `/dev/null` and prints an empty JSON object if no bindings are found. ```bash "$CMUX_SETTINGS" path ``` ```bash "$CMUX_SETTINGS" get shortcuts.bindings 2>/dev/null || printf '{} ' ``` ```bash "$CMUX_SETTINGS" validate ``` -------------------------------- ### Initialize and Control Socket Control Server Source: https://github.com/manaflow-ai/cmux/blob/main/Packages/macOS/CmuxControlSocket/README.md Demonstrates the initialization of SocketControlServer with a path and event recorder, starting the server, and stopping it. Assumes `connectToUnixSocket` is available for client connection. ```swift let server = SocketControlServer( initialSocketPath: path, events: recorder.makeEvents() // closures appending into a lock-guarded recorder ) #expect(server.start(socketPath: path, accessMode: .cmuxOnly)) let fd = connectToUnixSocket(path) // accept fires events.clientAccepted(fd, peerPid) server.stop() // unlinks the path, releases the lock ``` -------------------------------- ### Install Project-Local OpenCode Feed Hook Source: https://github.com/manaflow-ai/cmux/blob/main/docs/agent-hooks.md This command installs the cmux feed hook specifically for OpenCode within the current project directory. It creates a `.opencode/plugins/cmux-feed.js` file. ```bash cmux hooks opencode install --project ``` -------------------------------- ### Set Array and JSON Settings Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-settings/SKILL.md Demonstrates how to set configuration values that are arrays or require valid JSON formatting. This includes lists of hosts or keybindings. ```bash cmux-settings set shortcuts.bindings.newTab '["ctrl+b","c"]' ``` ```bash cmux-settings set browser.hostsToOpenInEmbeddedBrowser '["localhost","*.internal.example"]' ``` -------------------------------- ### Cloud WebSocket PTY Transport Client Control Frame Example Source: https://github.com/manaflow-ai/cmux/blob/main/daemon/remote/README.md Example of a text JSON control frame sent by the client after authentication to resize the terminal. Specifies the new column and row dimensions. ```json {"type":"resize","cols":120,"rows":40} ``` -------------------------------- ### Browser Core Workflow Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-browser/SKILL.md Demonstrates the fundamental steps for browser automation: opening a URL, getting the current URL, waiting for page load, taking a snapshot to get element references, filling input fields, clicking elements, and taking another snapshot. ```APIDOC ## Browser Core Workflow ### Description This workflow outlines the essential steps for automating browser interactions. It includes opening a URL, verifying navigation, capturing element references via snapshots, performing actions like filling forms and clicking, and re-snapshotting after changes. ### Method CLI Commands ### Endpoint N/A (CLI based) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash cmux --json browser open https://example.com cmux browser surface:7 get url cmux browser surface:7 wait --load-state complete --timeout-ms 15000 cmux browser surface:7 snapshot --interactive cmux browser surface:7 fill e1 "hello" cmux --json browser surface:7 click e2 --snapshot-after cmux browser surface:7 snapshot --interactive ``` ### Response #### Success Response (200) Output varies based on the command executed. For commands with `--json` flag, JSON output is provided. For others, CLI output with short refs is returned. #### Response Example ```json { "surface": "surface:7" } ``` ``` https://example.com/ ``` ```json { "element": "e1", "value": "hello" } ``` ``` -------------------------------- ### List and Create VMs Source: https://github.com/manaflow-ai/cmux/blob/main/web/services/vms/README.md Provides endpoints to list existing virtual machines and to create new ones. Authentication is required. ```APIDOC ## GET /api/vm ### Description Lists all available virtual machines for the authenticated user. ### Method GET ### Endpoint /api/vm ## POST /api/vm ### Description Creates a new virtual machine. ### Method POST ### Endpoint /api/vm ``` -------------------------------- ### Uninstall All Supported Agent Hooks Source: https://github.com/manaflow-ai/cmux/blob/main/docs/feed.md Removes all installed supported agent hooks from the system. ```bash cmux hooks uninstall ``` -------------------------------- ### Providing macOS Fallback with osascript Source: https://github.com/manaflow-ai/cmux/blob/main/docs/notifications.md This example demonstrates a best practice for providing a fallback mechanism on macOS using 'osascript' when a primary command (like cmux) might not be available or fails. This ensures a degree of functionality even in unsupported environments. ```bash || osascript ``` -------------------------------- ### Get cmux Configuration Path Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-settings/SKILL.md Prints the absolute path to the cmux configuration file. ```bash cmux-settings path ``` -------------------------------- ### Run Feed TUI with OpenTUI Source: https://github.com/manaflow-ai/cmux/blob/main/docs/feed.md Launches the Feed TUI using OpenTUI. This command may create configuration files and install dependencies on first run. Use `--opentui` to dogfood OpenTUI in isolation. Set `CMUX_FEED_TUI_BUN_PATH` to specify the Bun executable if it's not in your PATH. ```bash cmux feed tui ``` ```bash cmux feed tui --opentui ``` ```bash cmux feed tui --legacy ``` -------------------------------- ### Create a Browser Dock Pane Source: https://github.com/manaflow-ai/cmux/blob/main/docs/dock.md Use the `cmux new-pane --type browser --placement dock` command to open a URL in a browser pane within the Dock. ```sh cmux new-pane --type browser --placement dock --url https://example.com ``` -------------------------------- ### Setup cmux Logging and Event Handling Source: https://github.com/manaflow-ai/cmux/blob/main/cmuxUITests/BrowserFixtures/iframe-nested.html Initializes cmux logging and defines the `__cmuxPush` function to capture and display events. This function is crucial for tracking interactions across different frames. ```javascript window.__cmuxLog = []; const logEl = document.getElementById('event-log'); const statusEl = document.getElementById('status'); let seq = 0; window.__cmuxPush = function (entry) { window.__cmuxLog.push(Object.assign({ seq: ++seq }, entry)); logEl.textContent = JSON.stringify(window.__cmuxLog); if (window.__cmuxLog.some((e) => e.type === 'click' && e.target === '#deep-btn')) { statusEl.textContent = 'PASS'; } }; ``` -------------------------------- ### EditorState selection getter Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-react/index.html Gets the current selection, updating it based on applied steps if necessary. ```javascript get selection(){return this.curSelectionFor [--host-bundle-id ] [--example sample|tabs|both] ``` -------------------------------- ### Build Debug App Source: https://github.com/manaflow-ai/cmux/blob/main/CONTRIBUTING.md Build the debug version of the application. Use the --launch flag to automatically open the app. ```bash ./scripts/reload.sh --tag my-feature ``` -------------------------------- ### Codex Markdown Link Generation Source: https://github.com/manaflow-ai/cmux/blob/main/CLAUDE.md Example of how Codex generates a markdown link for an app, including URL encoding. ```markdown ------------------------------------------------------- [my-tag: file:///Users/someone/Library/Developer/Xcode/DerivedData/cmux-my-tag/Build/Products/Debug/cmux%20DEV%20my-tag.app](file:///Users/someone/Library/Developer/Xcode/DerivedData/cmux-my-tag/Build/Products/Debug/cmux%20DEV%20my-tag.app) ------------------------------------------------------- ``` -------------------------------- ### Execute Local Lifecycle Proof with Stack Authentication Source: https://github.com/manaflow-ai/cmux/blob/main/docs/presence-service.md Source environment variables from a secrets file and execute a local proof script against the Stack authentication service. Ensure all necessary Stack credentials are set in the environment. ```bash set -a; source ~/.secrets/cmuxterm-dev.env; set +a STACK_PROJECT_ID="$NEXT_PUBLIC_STACK_PROJECT_ID" \ STACK_PUBLISHABLE_CLIENT_KEY="$NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY" \ STACK_EMAIL="$CMUX_DOGFOOD_STACK_EMAIL" \ STACK_PASSWORD="$CMUX_DOGFOOD_STACK_PASSWORD" \ workers/presence/scripts/local-proof.sh ``` -------------------------------- ### Get Current Lane Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-react/index.html Returns the current lane based on global state and pending commits. Used for scheduling. ```javascript function ot(){return(X&2)!==0&&V!==0?V&-V:z.T!==null?Uf():_m()} ``` -------------------------------- ### List Supported cmux Settings Keys Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-settings/SKILL.md Lists all recognized JSON paths for cmux settings that the application supports. ```bash cmux-settings list-supported ``` -------------------------------- ### AllSelection replace method Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-react/index.html Replaces the entire document content. If no replacement is provided, it clears the document and sets the selection to the start. ```javascript replace(e,n=k.empty){if(n==k.empty){e.delete(0,e.doc.content.size);let l=Y.atStart(e.doc);l.eq(e.selection)||e.setSelection(l)}else super.replace(e,n)} ``` -------------------------------- ### Build and Launch Debug App Source: https://github.com/manaflow-ai/cmux/blob/main/AGENTS.md Use this command to build the Debug app and automatically launch it after a successful build. The script prints the .app path for manual opening if --launch is omitted. ```bash ./scripts/reload.sh --tag fix-zsh-autosuggestions --launch ``` -------------------------------- ### Check Replaceability of Node Content Source: https://github.com/manaflow-ai/cmux/blob/main/Resources/agent-session-react/index.html Determines if a node's content can be replaced within specified start and end indices. ```javascript function V5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))} ``` -------------------------------- ### Inspect CMUX Configuration Files Source: https://github.com/manaflow-ai/cmux/blob/main/skills/cmux-customization/SKILL.md Use sed to inspect the first 220 lines of global or project-local CMUX configuration files. ```bash test -f ~/.config/cmux/cmux.json && sed -n '1,220p' ~/.config/cmux/cmux.json test -f .cmux/cmux.json && sed -n '1,220p' .cmux/cmux.json ``` -------------------------------- ### Run Listener for Iroh Transport Source: https://github.com/manaflow-ai/cmux/blob/main/experiments/iroh-byte-transport/README.md Starts a listener for the Iroh byte transport experiment and prints an attach-route JSON snippet. ```bash cargo run -- listen ``` -------------------------------- ### CmuxEventBus Subscribe Method Source: https://github.com/manaflow-ai/cmux/blob/main/docs/data-driven-sidebar-plan.md Subscribe to events from the CmuxEventBus. Specify a starting sequence, and optionally filter by event names and categories. ```swift CmuxEventBus.subscribe(afterSequence:names:categories:) ```