id = "opencode" name = "OpenCode" homepage = "https://opencode.ai/docs/config/" description = "The open source coding agent, model-agnostic by design." icon = "theSVG:opencode" executables = ["opencode"] [dotfiles] # https://opencode.ai/docs/config/ — the global config is # $XDG_CONFIG_HOME/opencode/opencode.json, with plugins, commands, themes and # skills alongside it. That variable, and not a hard-coded ~/.config, is # [configHome]. paths = [ "[configHome]/opencode/opencode.json", "[configHome]/opencode/AGENTS.md", "[configHome]/opencode/plugins/", "[configHome]/opencode/commands/", "[configHome]/opencode/themes/", "[configHome]/opencode/skills/", ] # The plugin directory is a real npm project, so it carries a lockfile and a # node_modules tree. Sessions, storage and logs live under XDG data, which is # [xdgData] and not [dataHome]: that name is ~/Library/Application Support on # macOS, and opencode writes to ~/.local/share there too. It honours the # variable rather than hard-coding the default — running it with XDG_DATA_HOME # set puts the opencode directory under that instead. exclude = [ "[configHome]/opencode/node_modules/", "[configHome]/opencode/bun.lock", "[configHome]/opencode/package-lock.json", "[configHome]/opencode/tui.json", "[configHome]/opencode/opencode.json.tui-migration.bak", "[xdgData]/opencode/log/", "[xdgData]/opencode/storage/", "[xdgData]/opencode/cache/", ] # Mode 0600, holds the provider API keys and OAuth refresh tokens. secret = ["[xdgData]/opencode/auth.json"] # No machine_lines: the global opencode.json is provider and LSP selection, # which is the same wherever you run it. Absolute paths show up in plugin # source, not in config. [commands] format = 1 label = "OpenCode" description = "Start the opencode TUI, run one-off messages or serve headless. Other subcommands are left out." quality = "ai-draft" base = "fig:opencode" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/opencode.ts" license = "MIT" [[commands.field]] id = "project" label = "Project directory" type = "path" position = 0 path = { kind = "directory", role = "input", must_exist = true } sources = ["fig"] [[commands.field]] id = "model" label = "Model" description = "Format provider/model." type = "string" option = ["-m", "--model"] sources = ["fig"] [[commands.field]] id = "continue" label = "Continue last session" type = "boolean" option = ["-c", "--continue"] sources = ["fig"] [[commands.field]] id = "session" label = "Session ID" type = "string" option = ["-s", "--session"] sources = ["fig"] [[commands.field]] id = "fork" label = "Fork session" description = "Use with continue or a session ID." type = "boolean" option = ["--fork"] sources = ["fig"] [[commands.field]] id = "prompt" label = "Prompt" type = "string" option = ["--prompt"] sources = ["fig"] [[commands.field]] id = "agent" label = "Agent" type = "string" option = ["--agent"] sources = ["fig"] [[commands.field]] id = "pure" label = "No external plugins" type = "boolean" option = ["--pure"] sources = ["fig"] [[commands.task]] id = "open" label = "Open in a project" fields = ["project", "model", "agent"] required = [] [[commands.task]] id = "continue" label = "Continue last session" fields = ["project", "continue", "model"] required = ["continue"] [[commands.group]] id = "basic" label = "Basic" fields = ["project", "model", "continue", "session", "prompt", "agent"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["fork", "pure"] [[commands.subcommand]] path = ["run"] label = "Run with a message" description = "Run opencode non-interactively with a message. Server attach options are left out." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/opencode.ts" license = "MIT" [[commands.subcommand.field]] id = "message" label = "Message" type = "string" position = 0 multiple = true sources = ["fig"] [[commands.subcommand.field]] id = "model" label = "Model" description = "Format provider/model." type = "string" option = ["-m", "--model"] sources = ["fig"] [[commands.subcommand.field]] id = "agent" label = "Agent" type = "string" option = ["--agent"] sources = ["fig"] [[commands.subcommand.field]] id = "continue" label = "Continue last session" type = "boolean" option = ["-c", "--continue"] sources = ["fig"] [[commands.subcommand.field]] id = "session" label = "Session ID" type = "string" option = ["-s", "--session"] sources = ["fig"] [[commands.subcommand.field]] id = "format" label = "Output format" type = "enum" option = ["--format"] choices = [{ value = "default", label = "Formatted" }, { value = "json", label = "Raw JSON events" }] sources = ["fig"] [[commands.subcommand.field]] id = "file" label = "Attach files" type = "path" option = ["-f", "--file"] multiple = true path = { kind = "file", role = "input", must_exist = true } sources = ["fig"] [[commands.subcommand.field]] id = "dir" label = "Directory" type = "path" option = ["--dir"] path = { kind = "directory", role = "input", must_exist = true } sources = ["fig"] [[commands.subcommand.field]] id = "thinking" label = "Show thinking" type = "boolean" option = ["--thinking"] sources = ["fig"] [[commands.subcommand.field]] id = "share" label = "Share session" type = "boolean" option = ["--share"] sources = ["fig"] [[commands.subcommand.task]] id = "ask" label = "Ask a question" fields = ["message", "model", "file"] required = ["message"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["message", "model", "agent", "continue", "file", "format"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["session", "dir", "thinking", "share"] [[commands.subcommand]] path = ["serve"] label = "Start a headless server" description = "Run an opencode server without the TUI." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/opencode.ts" license = "MIT" [[commands.subcommand.field]] id = "port" label = "Port" type = "integer" option = ["--port"] sources = ["fig"] [[commands.subcommand.field]] id = "hostname" label = "Hostname" type = "string" option = ["--hostname"] sources = ["fig"] [[commands.subcommand.field]] id = "mdns" label = "mDNS discovery" type = "boolean" option = ["--mdns"] sources = ["fig"] [[commands.subcommand.field]] id = "cors" label = "CORS domains" type = "string" option = ["--cors"] multiple = true sources = ["fig"] [[commands.subcommand.task]] id = "serve" label = "Start server" fields = ["port", "hostname"] required = [] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["port", "hostname", "mdns", "cors"]