← Reference
Command line
The kcode binary: bare launch opens the Mission Control window; flags and subcommands cover headless runs, resumes, and admin.
13 entries · kcode 0.4.0
13 shown
| Command | Arguments | What it does |
|---|---|---|
| kcode | Open the GPU Mission Control window (the default frontend). Sessions live in the per-app daemon, which starts on demand and exits with the app. | |
| kcode -p <prompt> | --output-format text|json|ndjson [--json-schema <file>] | Headless one-shot: run a prompt non-interactively and print the result. --output-format ndjson streams one versioned JSON line per turn event (text/thinking deltas, tool start/finish, control-plane emissions, usage) with the final envelope last — built for scripting and CI. --json-schema <file> (R#40) requires the final answer to validate against the given JSON Schema: the turn gains a synthetic submit_result tool, concludes only on a valid payload (5 invalid attempts fail the turn), and the final envelope carries it as structured_output. |
| kcode --resume [id] / -c | --print | Resume a session. --resume with no value opens a picker scoped to the current directory; -c/--continue-last resumes the most recent. Add --print to dump the transcript to stdout and exit instead of opening the window. |
| --model <id> | Override the model for the run (any keyed provider — resolution, not relaunch). | |
| --permission-mode / --bypass-permissions | default|accept-edits|bypass|plan | Set the session's permission mode. --bypass-permissions auto-allows every tool call — use only in trusted environments; it persists for the running session only. |
| --config <path> | Layer an extra config file over the usual figment stack (compiled defaults → user → project → env → flags). Forwarded to re-exec'd children (shell host). | |
| kcode doctor | Environment health check, anchored to the exact running build: provider API keys (per-provider auth.*), DNS reachability, the git + Rust toolchains, the data directory, the daemon handshake (daemon.health — Attach → Hello over the socket; a stale/refusing socket fails), the layered-config lint (config.lint), OAuth token freshness per stored login (oauth.freshness), SQLite PRAGMA quick_check on the user + project stores (storage.user_db / storage.project_db), and a plugin validation sweep (plugins.<name> — the same checks kcode plugins validate runs, over the builtin/user/project plugin roots). Exit code 0 when every check passes. | |
| kcode auth | Manage provider credentials (the same ~/.kcode/auth.toml the Settings › Providers page writes). | |
| kcode mcp | list [--no-probe] | add <name> <url> | remove <name> | reconnect <name> [--session <title>] | login <name> [--session <title>] | Manage MCP servers (stdio, HTTP, SSE — remote entries take optional headers for API keys/auth). list enumerates the user ~/.kcode/mcp.json + project .mcp.json servers and probes each (connect → initialize → tool count, bounded per server by mcp_protocol.probe_timeout_secs, default 8s; --no-probe prints config only). add/remove edit the user-scope file (written 0600 — headers can hold keys). reconnect dials the daemon and bounces the server's live connection on the target session (unload + fresh connect, tools re-register in place) — the recovery path after restarting a local server or rotating a token. login <name> signs in to an OAuth-gated remote server (R#59): the daemon runs RFC 9728/8414 discovery from the server's URL (+ any resource_metadata pointer a 401's WWW-Authenticate carried), registers kcode via RFC 7591 dynamic client registration when the server offers it, and opens a browser PKCE flow on an ephemeral loopback port; tokens persist under [oauth."mcp.<server>"] in auth.toml, every (re)connect injects the bearer (an explicit authorization header in the config always wins), a stale token refreshes single-flight against the persisted token endpoint, and the connection bounces so the login takes effect at once. Cancel a running login with the generic OAuth cancel (mcp.<server> key). A connected server that pushes notifications/tools/list_changed re-lists live and the diff lands as <cp:mcp-tools-changed>. Remote (HTTP/SSE) connections are supervised: a dropped connection reconnects with backoff (5 attempts, 1s doubling to 30s) and re-registers in place — registered tools always invoke the current connection; on exhaustion the server's tools leave the registry (announced) until a manual reconnect. Servers can also ask the user questions (elicitation/create → the stock ask-user prompt) and read the project root (roots/list → file://<project root>) — both declared at initialize. |
| kcode plugins | scaffold | validate | Plugin authoring: scaffold a new plugin skeleton or validate a manifest/content bundle. |
| kcode config | defaults | kcode config defaults prints every deep-lib [section] with its compiled defaults — the complete power-user config surface, drift-tested against the code. |
| kcode upgrade / license | kcode upgrade [--force] self-updates from the signed release index: env KCODE_RELEASE_INDEX_URL overrides the compiled default (the newest GitHub release's signed index asset), and the production verifying key is compiled in from the committed release-pubkey.hex (env KCODE_RELEASE_PUBKEY_HEX/_PATH override for test builds). Install-shape policy: only the ~/.cargo/bin binary self-swaps; an .app bundle reports the download hint instead. The boot-time check (updater.check_on_startup) posts one OS notification when a newer release exists. In-app, /upgrade runs the same flow and posts the result to the chat. kcode license … manages the (deferred) licensing stack. | |
| kcode trigger <name> <text> | [--project <dir>] [--session <title>] | Fire an external trigger into a running session (R#39) — the integration point for CI, cron(8), and sidecars. Dials the daemon socket and injects text as the target session's next turn with <cp:external-trigger> provenance (queued at the turn boundary when the session is busy); prints the daemon's outcome line. Trust is the socket's same-UID boundary — no TCP listener, no auth. |