#Dock

Dock ti permette di aggiungere controlli terminale e browser alla barra laterale destra. I controlli terminale eseguono comandi in sezioni basate su Ghostty, mentre i controlli browser incorporano pagine web. Usalo per feed, log, code, stato git, server di sviluppo, dashboard o pagine di riferimento che il team vuole tenere vicino a ogni workspace.

#Configurazione

cmux cerca la configurazione Dock in questo ordine:

  1. .cmux/dock.json per il repository corrente, il progetto padre più vicino e le directory di progetti annidati.
  2. ~/.config/cmux/dock.json per il Dock personale predefinito o quando non c’è un repository.
Se esistono sia una configurazione di progetto sia una globale, vince quella di progetto. Le configurazioni di progetti annidati si applicano al loro albero di directory. Se non esiste una configurazione di progetto, Dock usa quella globale. Se nessun file esiste, Dock si apre vuoto.
Le configurazioni Dock di progetto possono avviare comandi. cmux ti chiede di considerare attendibile una configurazione di progetto prima di avviarne i controlli.

#Esempio dock.json

Un file Dock è un oggetto JSON con un array controls. Fai commit dei controlli di progetto in .cmux/dock.json quando vuoi che i compagni di team condividano lo stesso Dock. Sostituisci i comandi di esempio con strumenti realmente presenti nel repository.

.cmux/dock.json
{
  "controls": [
    {
      "id": "git",
      "title": "Git",
      "command": "lazygit",
      "height": 300
    },
    {
      "id": "logs",
      "title": "Logs",
      "command": "tail -f ./logs/development.log",
      "cwd": "."
    },
    {
      "id": "feed",
      "title": "Feed",
      "command": "cmux feed tui --opentui",
      "height": 320
    },
    {
      "id": "dashboard",
      "title": "Dashboard",
      "type": "browser",
      "url": "http://127.0.0.1:8877/sidebar",
      "chrome": false
    }
  ]
}

#Campi

CampoDescrizione
idIdentificatore unico e stabile del controllo. Mantienilo breve e non riutilizzarlo per un altro comando.
titleEtichetta mostrata nell'intestazione del Dock.
commandComando da eseguire nel terminale Dock. Obbligatorio per i controlli terminale e avviato nella shell di login.
typeTipo di controllo facoltativo: terminal (predefinito) o browser.
urlPagina da aprire. Obbligatoria per i controlli browser.
chromeVisibilità facoltativa dell’interfaccia del browser. Il valore predefinito è true; false nasconde la barra degli indirizzi e la barra degli strumenti, fa sì che l’azione Focalizza barra degli indirizzi non abbia effetto in quel riquadro e mantiene disponibili cmux browser goto/reload.
cwdDirectory di lavoro opzionale. I percorsi relativi vengono risolti dalla radice del progetto per le configurazioni di progetto o dalla home directory per le configurazioni globali.
heightAltezza facoltativa del controllo. I controlli senza height condividono lo spazio rimanente.
envVariabili d'ambiente opzionali passate solo a quel controllo.

#Condivisione con un team

Dock è progettato per essere condiviso tramite source control quando i comandi appartengono al repository.

  • Metti i controlli specifici del repo in .cmux/dock.json e committa il file.
  • Metti i controlli personali in ~/.config/cmux/dock.json, soprattutto fuori da un repository, e tieni quel file fuori dal controllo sorgente condiviso.
  • Non mettere segreti in dock.json. Leggi i segreti dalla shell, da un file env locale o dagli strumenti di sviluppo esistenti.

#Chiedi a un agente di configurarlo

Usa questo prompt quando vuoi che un agente di coding crei controlli Dock. Indica all’agente di eseguire `cmux docs dock`, ispezionare il progetto e chiedere prima di tirare a indovinare.

Prompt per l'agente
Set up cmux Dock controls for the current context.

First, learn the feature before editing:
1. Run `cmux docs dock` if the cmux CLI is available. If it is not, read https://cmux.com/docs/dock.
2. Inspect the repository or current directory to understand the project type, scripts, package manager, dev servers, logs, task runners, test commands, and any existing TUI tools.
3. If the desired Dock is ambiguous, ask the user what they want monitored or controlled before writing files.

Dock is cmux's right-sidebar terminal and browser control area. A Dock config is JSON with a top-level `controls` array. Terminal controls run commands in Ghostty-backed sections using the user's login shell; browser controls embed URLs. Controls are useful for project dashboards, git/status views, dev server or build status, test watchers, log tails, queues, local services, or fixed web dashboards.

Choose where to write the config:
- In a repository or project directory, create or edit `.cmux/dock.json` so teammates can share it.
- For a personal default outside a repo, create or edit `~/.config/cmux/dock.json`.
- If both exist, project `.cmux/dock.json` is more specific for that project. Nested project configs apply to that directory tree; use the nearest relevant project config instead of writing unrelated controls globally.
- If there is no repo and no clear project root, use the global config only after confirming the user wants a personal Dock.

Schema:
{
  "controls": [
    {
      "id": "short-stable-id",
      "title": "Human label",
      "command": "safe command to run",
      "cwd": "optional/path",
      "height": 220,
      "env": { "NAME": "value" }
    },
    {
      "id": "dashboard",
      "title": "Dashboard",
      "type": "browser",
      "url": "http://127.0.0.1:3000",
      "chrome": false
    }
  ]
}

Rules:
- Keep ids stable, lowercase, and unique.
- `type` is optional: `terminal` is the default, or use `browser`.
- Terminal controls require `command`; browser controls require `url`.
- Browser controls default to `chrome: true`. Set `chrome: false` to hide browser chrome, including the address bar and toolbar; Focus Address Bar then does nothing for that pane, while `cmux browser goto` and `cmux browser reload` remain available.
- Use `cwd` for subdirectories; relative paths resolve from the config base.
- Use `height` only when a control needs a fixed amount of vertical space.
- Use `env` only for non-secret values needed by one control.
- Do not put secrets, tokens, or machine-specific private paths in a shared project config.
- Prefer commands that are safe to start repeatedly and make sense in a terminal.
- Do not invent unavailable scripts. Read package files, Makefiles, Procfiles, README docs, config files, and existing tooling first.
- Keep shared project Docks portable for teammates. Put personal or machine-specific controls in the global Dock.

Deliverable:
- Create or update the appropriate dock.json.
- Preserve existing useful controls unless the user asked to replace them.
- Validate that the JSON parses.
- Summarize what each control does and any commands the user should review before trusting the Dock config.