# CLI Referansı

cmux, programatik kontrol için hem bir CLI aracı hem de bir Unix soketi sağlar. Her komut her iki arayüz aracılığıyla kullanılabilir.

## Socket

| Build | Yol |
| --- | --- |
| Release | `/tmp/cmux.sock` |
| Debug | `/tmp/cmux-debug.sock` |
| Etiketli debug build | `/tmp/cmux-debug-<tag>.sock` |

CMUX\_SOCKET\_PATH ortam değişkeni ile geçersiz kılın. Çağrı başına yeni satırla sonlandırılmış bir JSON isteği gönderin:

```
{"id":"req-1","method":"workspace.list","params":{}}
// Response:
{"id":"req-1","ok":true,"result":{"workspaces":[...]}}
```

JSON socket istekleri method ve params kullanmalıdır. `{"command":"..."}` gibi eski v1 JSON yükleri desteklenmez.

## Erişim modları

| Mod | Açıklama | Nasıl etkinleştirilir |
| --- | --- | --- |
| **Off** | Socket devre dışı | Ayarlar arayüzü veya CMUX\_SOCKET\_MODE=off |
| **cmux processes only** | Yalnızca cmux terminalleri içinde başlatılan süreçler bağlanabilir. | Ayarlar arayüzünde varsayılan mod |
| **allowAll** | Herhangi bir yerel sürecin bağlanmasına izin ver (köken kontrolü yok). | Yalnızca ortam değişkeni geçersiz kılma: CMUX\_SOCKET\_MODE=allowAll |

Paylaşılan makinelerde Kapalı veya Yalnızca cmux süreçleri kullanın.

## CLI seçenekleri

| Bayrak | Açıklama |
| --- | --- |
| `--socket PATH` | Özel socket yolu |
| `--json` | JSON formatında çıktı |
| `--window ID` | Belirli bir pencereyi hedefle |
| `--workspace ID` | Belirli bir çalışma alanını hedefle |
| `--surface ID` | Belirli bir yüzeyi hedefle |
| `--id-format refs|uuids|both` | JSON çıktısında tanımlayıcı formatını kontrol et |

## Çalışma alanı komutları

#### list-workspaces

Tüm açık çalışma alanlarını listele.

CLI

```
cmux list-workspaces
cmux list-workspaces --json
```

Socket

```
{"id":"ws-list","method":"workspace.list","params":{}}
```

#### new-workspace

Yeni bir çalışma alanı oluştur.

CLI

```
cmux new-workspace
```

Socket

```
{"id":"ws-new","method":"workspace.create","params":{}}
```

#### select-workspace

Belirli bir çalışma alanına geç.

CLI

```
cmux select-workspace --workspace <id>
```

Socket

```
{"id":"ws-select","method":"workspace.select","params":{"workspace_id":"<id>"}}
```

#### current-workspace

Şu anda aktif çalışma alanını al.

CLI

```
cmux current-workspace
cmux current-workspace --json
```

Socket

```
{"id":"ws-current","method":"workspace.current","params":{}}
```

#### close-workspace

Bir çalışma alanını kapat.

CLI

```
cmux close-workspace --workspace <id>
```

Socket

```
{"id":"ws-close","method":"workspace.close","params":{"workspace_id":"<id>"}}
```

## Bölme komutları

#### new-split

Yeni bir bölünmüş panel oluştur. Yönler: left, right, up, down.

CLI

```
cmux new-split right
cmux new-split down
cmux new-split down --command "npm run dev"
```

Socket

```
{"id":"split-new","method":"surface.split","params":{"direction":"right"}}
{"id":"split-cmd","method":"surface.split","params":{"direction":"down","initial_input":"npm run dev\r"}}
```

#### list-panels

Geçerli çalışma alanındaki tüm yüzeyleri listele.

CLI

```
cmux list-panels
cmux list-panels --json
```

Socket

```
{"id":"surface-list","method":"surface.list","params":{}}
```

#### list-pane-surfaces

Odaklanmış paneldeki yüzeyleri listele.

CLI

```
cmux list-pane-surfaces
cmux list-pane-surfaces --json
```

Socket

```
{"id":"pane-surfaces","method":"pane.surfaces","params":{}}
```

#### focus-panel

Belirli bir yüzeye odaklan.

CLI

```
cmux focus-panel --panel <id>
```

Socket

```
{"id":"surface-focus","method":"surface.focus","params":{"surface_id":"<id>"}}
```

## Girdi komutları

#### send

Odaklanılan terminale metin girdisi gönder.

CLI

```
cmux send "echo hello"
cmux send "ls -la\n"
```

Socket

```
{"id":"send-text","method":"surface.send_text","params":{"text":"echo hello\n"}}
```

#### send-key

Bir tuş vuruşu gönder. Tuşlar: enter, tab, escape, backspace, delete, up, down, left, right.

CLI

```
cmux send-key enter
```

Socket

```
{"id":"send-key","method":"surface.send_key","params":{"key":"enter"}}
```

#### send --surface

Belirli bir yüzeye metin gönder.

CLI

```
cmux send --surface <id> "command"
```

Socket

```
{"id":"send-surface","method":"surface.send_text","params":{"surface_id":"<id>","text":"command"}}
```

#### send-key --surface

Belirli bir yüzeye tuş vuruşu gönder.

CLI

```
cmux send-key --surface <id> enter
```

Socket

```
{"id":"send-key-surface","method":"surface.send_key","params":{"surface_id":"<id>","key":"enter"}}
```

## Bildirim komutları

#### notify

Bir bildirim gönder.

CLI

```
cmux notify --title "Title" --body "Body"
cmux notify --title "T" --subtitle "S" --body "B"
```

Socket

```
{"id":"notify","method":"notification.create","params":{"title":"Title","subtitle":"S","body":"Body"}}
```

#### list-notifications

Tüm bildirimleri listele.

CLI

```
cmux list-notifications
cmux list-notifications --json
```

Socket

```
{"id":"notif-list","method":"notification.list","params":{}}
```

#### clear-notifications

Tüm bildirimleri temizle.

CLI

```
cmux clear-notifications
```

Socket

```
{"id":"notif-clear","method":"notification.clear","params":{}}
```

## Kenar çubuğu meta veri komutları

Herhangi bir çalışma alanı için kenar çubuğunda durum rozetleri, ilerleme çubukları ve günlük girişleri ayarlayın. Build betikleri, CI entegrasyonları ve durumu bir bakışta göstermek isteyen AI kodlama ajanları için kullanışlıdır.

#### set-status

Kenar çubuğu durum rozeti ayarlayın. Farklı araçların kendi girişlerini yönetebilmesi için benzersiz bir anahtar kullanın.

CLI

```
cmux set-status build "compiling" --icon hammer --color "#ff9500" --priority 80
cmux set-status deploy "v1.2.3" --workspace workspace:2
```

Socket

```
set_status build compiling --icon=hammer --color=#ff9500 --priority=80 --tab=<workspace-uuid>
```

#### clear-status

Anahtara göre kenar çubuğu durum girişini kaldırın.

CLI

```
cmux clear-status build
```

Socket

```
clear_status build --tab=<workspace-uuid>
```

#### list-status

Bir çalışma alanı için tüm kenar çubuğu durum girişlerini listeleyin.

CLI

```
cmux list-status
```

Socket

```
list_status --tab=<workspace-uuid>
```

#### set-progress

Kenar çubuğunda bir ilerleme çubuğu ayarlayın (0.0 ile 1.0).

CLI

```
cmux set-progress 0.5 --label "Building..."
cmux set-progress 1.0 --label "Done"
```

Socket

```
set_progress 0.5 --label=Building... --tab=<workspace-uuid>
```

#### clear-progress

Kenar çubuğu ilerleme çubuğunu temizleyin.

CLI

```
cmux clear-progress
```

Socket

```
clear_progress --tab=<workspace-uuid>
```

#### log

Kenar çubuğuna bir günlük girişi ekleyin. Seviyeler: info, progress, success, warning, error.

CLI

```
cmux log "Build started"
cmux log --level error --source build "Compilation failed"
cmux log --level success -- "All 42 tests passed"
```

Socket

```
log --level=error --source=build --tab=<workspace-uuid> -- Compilation failed
```

#### clear-log

Tüm kenar çubuğu günlük girişlerini temizleyin.

CLI

```
cmux clear-log
```

Socket

```
clear_log --tab=<workspace-uuid>
```

#### list-log

Kenar çubuğu günlük girişlerini listeleyin.

CLI

```
cmux list-log
cmux list-log --limit 5
```

Socket

```
list_log --limit=5 --tab=<workspace-uuid>
```

#### sidebar-state

Tüm kenar çubuğu meta verilerini dökün (cwd, git dalı, portlar, durum, ilerleme, günlükler).

CLI

```
cmux sidebar-state
cmux sidebar-state --workspace workspace:2
```

Socket

```
sidebar_state --tab=<workspace-uuid>
```

## Yardımcı komutlar

#### ping

cmux'un çalışıp çalışmadığını ve yanıt verip vermediğini kontrol edin.

CLI

```
cmux ping
```

Socket

```
{"id":"ping","method":"system.ping","params":{}}
// Response: {"id":"ping","ok":true,"result":{"pong":true}}
```

#### capabilities

Mevcut socket yöntemlerini ve geçerli erişim modunu listeleyin.

CLI

```
cmux capabilities
cmux capabilities --json
```

Socket

```
{"id":"caps","method":"system.capabilities","params":{}}
```

#### identify

Odaklanılan pencere/çalışma alanı/panel/yüzey bağlamını gösterin.

CLI

```
cmux identify
cmux identify --json
```

Socket

```
{"id":"identify","method":"system.identify","params":{}}
```

## Ortam değişkenleri

| Değişken | Açıklama |
| --- | --- |
| `CMUX_SOCKET_PATH` | CLI ve entegrasyonlar tarafından kullanılan socket yolunu geçersiz kılın |
| `CMUX_SOCKET_ENABLE` | Soketi zorla etkinleştir/devre dışı bırak (1/0, true/false, on/off) |
| `CMUX_SOCKET_MODE` | Erişim modunu geçersiz kılın (cmuxOnly, allowAll, off). Ayrıca cmux-only/cmux\_only ve allow-all/allow\_all kabul eder |
| `CMUX_WORKSPACE_ID` | Otomatik ayarlı: geçerli çalışma alanı ID |
| `CMUX_SURFACE_ID` | Otomatik ayarlı: geçerli yüzey ID |
| `TERM_PROGRAM` | ghostty olarak ayarlı |
| `TERM` | xterm-ghostty olarak ayarlı |

Eski CMUX\_SOCKET\_MODE değerleri full ve notifications uyumluluk için hâlâ kabul edilir.

## cmux'u algılama

bash

```
# Prefer explicit socket path if set
SOCK="${CMUX_SOCKET_PATH:-/tmp/cmux.sock}"
[ -S "$SOCK" ] && echo "Socket available"

# Check for the CLI
command -v cmux &>/dev/null && echo "cmux available"

# In cmux-managed terminals these are auto-set
[ -n "${CMUX_WORKSPACE_ID:-}" ] && [ -n "${CMUX_SURFACE_ID:-}" ] && echo "Inside cmux surface"

# Distinguish from regular Ghostty
[ "$TERM_PROGRAM" = "ghostty" ] && [ -n "${CMUX_WORKSPACE_ID:-}" ] && echo "In cmux"
```

## Örnekler

### Python istemcisi

python

```
import json
import os
import socket

SOCKET_PATH = os.environ.get("CMUX_SOCKET_PATH", "/tmp/cmux.sock")

def rpc(method, params=None, req_id=1):
    payload = {"id": req_id, "method": method, "params": params or {}}
    with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
        sock.connect(SOCKET_PATH)
        sock.sendall(json.dumps(payload).encode("utf-8") + b"\n")
        return json.loads(sock.recv(65536).decode("utf-8"))

# List workspaces
print(rpc("workspace.list", req_id="ws"))

# Send notification
print(rpc(
    "notification.create",
    {"title": "Hello", "body": "From Python!"},
    req_id="notify"
))
```

### Shell betiği

bash

```
#!/bin/bash
SOCK="${CMUX_SOCKET_PATH:-/tmp/cmux.sock}"

cmux_cmd() {
    printf "%s\n" "$1" | nc -U "$SOCK"
}

cmux_cmd '{"id":"ws","method":"workspace.list","params":{}}'
cmux_cmd '{"id":"notify","method":"notification.create","params":{"title":"Done","body":"Task complete"}}'
```

### Bildirimli build betiği

bash

```
#!/bin/bash
npm run build
if [ $? -eq 0 ]; then
    cmux notify --title "✓ Build Success" --body "Ready to deploy"
else
    cmux notify --title "✗ Build Failed" --body "Check the logs"
fi
```

Canonical: https://cmux.com/tr/docs/api

Documentation index: https://cmux.com/llms.txt
