test(cli-rs): compare completion scripts directly to the TS CLI

C.0/completions-{bash,zsh,fish,powershell} run the actual commands on
both sides. Drift no longer runs the TS commands to write four scripts
that a second test compares with the Rust formatter. Keep the alias
check in completion_aliases_match_their_shells.
This commit is contained in:
Simon Klee
2026-11-18 11:42:00 +01:00
Unverified
parent 066a46bbb7
commit 895d6d0c80
10 changed files with 16 additions and 3062 deletions
@@ -1,4 +1,4 @@
//! Help, completion scripts, and usage errors against what the TypeScript CLI prints, recorded with colors by
//! Help and usage errors against what the TypeScript CLI prints, recorded with colors by
//! `script/gen/cli-output.ts` in `tests/fixtures/cli`. Without a terminal both print the same text without colors.
use std::path::Path;
@@ -56,14 +56,7 @@ fn help_flag_selects_the_command() {
}
#[test]
fn completions_match_the_typescript_cli() {
for (shell, file) in
[(Shell::Bash, "bash"), (Shell::Zsh, "zsh"), (Shell::Fish, "fish"), (Shell::Powershell, "powershell")]
{
let expected = std::fs::read_to_string(fixtures().join(format!("completions/{file}.txt"))).unwrap();
let actual = format!("{}\n", completions::generate(shell, PROGRAM));
assert!(actual == expected, "--completions {file}:\n{}", lines_diff(&expected, &actual));
}
fn completion_aliases_match_their_shells() {
assert_eq!(completions::generate(Shell::Sh, PROGRAM), completions::generate(Shell::Bash, PROGRAM));
assert_eq!(completions::generate(Shell::Pwsh, PROGRAM), completions::generate(Shell::Powershell, PROGRAM));
}
File diff suppressed because it is too large Load Diff
-292
View File
@@ -1,292 +0,0 @@
###-begin-opencode-completions-###
#
# Static completion script for Fish
#
# Installation:
# opencode --completions fish > ~/.config/fish/completions/opencode.fish
#
complete -c opencode -n '__fish_use_subcommand' -f
complete -c opencode -n '__fish_use_subcommand' -f -a 'upgrade' -d 'Upgrade OpenCode to the latest or a specific version'
complete -c opencode -n '__fish_use_subcommand' -f -a 'update' -d 'Upgrade OpenCode to the latest or a specific version'
complete -c opencode -n '__fish_use_subcommand' -f -a 'uninstall' -d 'Uninstall OpenCode, keeping session data, configuration, and state'
complete -c opencode -n '__fish_use_subcommand' -f -a 'acp' -d 'Start an Agent Client Protocol server'
complete -c opencode -n '__fish_use_subcommand' -f -a 'api' -d 'Make a request to the running server'
complete -c opencode -n '__fish_use_subcommand' -f -a 'debug' -d 'Debugging and troubleshooting tools'
complete -c opencode -n '__fish_use_subcommand' -f -a 'auth' -d 'manage integrations and credentials'
complete -c opencode -n '__fish_use_subcommand' -f -a 'mcp' -d 'Manage MCP (Model Context Protocol) servers'
complete -c opencode -n '__fish_use_subcommand' -f -a 'plugin' -d 'Manage plugins'
complete -c opencode -n '__fish_use_subcommand' -f -a 'models' -d 'List all available models'
complete -c opencode -n '__fish_use_subcommand' -f -a 'stats' -d 'Show shareable usage statistics'
complete -c opencode -n '__fish_use_subcommand' -f -a 'mini' -d 'Start the minimal interactive interface'
complete -c opencode -n '__fish_use_subcommand' -f -a 'run' -d 'Run OpenCode with a message'
complete -c opencode -n '__fish_use_subcommand' -f -a 'session' -d 'Manage sessions'
complete -c opencode -n '__fish_use_subcommand' -f -a 'service' -d 'Manage the background server'
complete -c opencode -n '__fish_use_subcommand' -f -a 'reload' -d 'Reload configuration'
complete -c opencode -n '__fish_use_subcommand' -f -a 'pair' -d 'Print one-time links to connect a browser or app'
complete -c opencode -n '__fish_use_subcommand' -f -a 'serve' -d 'Start the v2 API and web server'
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt standalone no-standalone' -l standalone -d 'Run with a private server instead of the background service'
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt standalone no-standalone' -l no-standalone -d 'Disable standalone'
complete -c opencode -n '__fish_use_subcommand; and begin; not __fish_contains_opt server; or contains -- (commandline -poc)[-1] --server; end' -l server -d 'Connect to a server URL instead of the background service' -r -f
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt auto no-auto' -l auto -d 'Auto-approve permissions that are not explicitly denied'
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt auto no-auto' -l no-auto -d 'Disable auto'
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt -s c continue no-continue' -l continue -s c -d 'Continue the last session'
complete -c opencode -n '__fish_use_subcommand; and not __fish_contains_opt -s c continue no-continue' -l no-continue -d 'Disable continue'
complete -c opencode -n '__fish_use_subcommand; and begin; not __fish_contains_opt -s s session; or contains -- (commandline -poc)[-1] --session -s; end' -l session -s s -d 'Session ID to continue, or to create if it does not exist' -r -f
complete -c opencode -n '__fish_use_subcommand; and begin; not __fish_contains_opt prompt; or contains -- (commandline -poc)[-1] --prompt; end' -l prompt -d 'Prompt to use' -r -f
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt standalone no-standalone' -f -a '--standalone' -d 'Run with a private server instead of the background service'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt standalone no-standalone' -f -a '--no-standalone' -d 'Disable standalone'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt server' -f -a '--server' -d 'Connect to a server URL instead of the background service'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt auto no-auto' -f -a '--auto' -d 'Auto-approve permissions that are not explicitly denied'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt auto no-auto' -f -a '--no-auto' -d 'Disable auto'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--continue' -d 'Continue the last session'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--no-continue' -d 'Disable continue'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s s session' -f -a '--session' -d 'Session ID to continue, or to create if it does not exist'
complete -c opencode -n '__fish_use_subcommand; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt prompt' -f -a '--prompt' -d 'Prompt to use'
complete -c opencode -n '__fish_seen_subcommand_from upgrade' -f
complete -c opencode -n '__fish_seen_subcommand_from upgrade; and begin; not __fish_contains_opt -s m method; or contains -- (commandline -poc)[-1] --method -m; end' -l method -s m -d 'Installation method to use' -r -f -a 'curl npm pnpm bun yarn vp brew winget'
complete -c opencode -n '__fish_seen_subcommand_from upgrade; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s m method' -f -a '--method' -d 'Installation method to use'
complete -c opencode -n '__fish_seen_subcommand_from update' -f
complete -c opencode -n '__fish_seen_subcommand_from update; and begin; not __fish_contains_opt -s m method; or contains -- (commandline -poc)[-1] --method -m; end' -l method -s m -d 'Installation method to use' -r -f -a 'curl npm pnpm bun yarn vp brew winget'
complete -c opencode -n '__fish_seen_subcommand_from update; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s m method' -f -a '--method' -d 'Installation method to use'
complete -c opencode -n '__fish_seen_subcommand_from uninstall' -f
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not __fish_contains_opt dry-run no-dry-run' -l dry-run -d 'Show what would be removed without removing'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not __fish_contains_opt dry-run no-dry-run' -l no-dry-run -d 'Disable dry-run'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not __fish_contains_opt -s f force no-force' -l force -s f -d 'Skip confirmation prompts'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not __fish_contains_opt -s f force no-force' -l no-force -d 'Disable force'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt dry-run no-dry-run' -f -a '--dry-run' -d 'Show what would be removed without removing'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt dry-run no-dry-run' -f -a '--no-dry-run' -d 'Disable dry-run'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s f force no-force' -f -a '--force' -d 'Skip confirmation prompts'
complete -c opencode -n '__fish_seen_subcommand_from uninstall; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s f force no-force' -f -a '--no-force' -d 'Disable force'
complete -c opencode -n '__fish_seen_subcommand_from acp' -f
complete -c opencode -n '__fish_seen_subcommand_from acp; and not __fish_contains_opt login no-login' -l login -d 'Run auth login instead of starting the server'
complete -c opencode -n '__fish_seen_subcommand_from acp; and not __fish_contains_opt login no-login' -l no-login -d 'Disable login'
complete -c opencode -n '__fish_seen_subcommand_from acp; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt login no-login' -f -a '--login' -d 'Run auth login instead of starting the server'
complete -c opencode -n '__fish_seen_subcommand_from acp; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt login no-login' -f -a '--no-login' -d 'Disable login'
complete -c opencode -n '__fish_seen_subcommand_from api' -f
complete -c opencode -n '__fish_seen_subcommand_from api; and begin; not __fish_contains_opt -s d data; or contains -- (commandline -poc)[-1] --data -d; end' -l data -s d -d 'Request body' -r -f
complete -c opencode -n '__fish_seen_subcommand_from api; and begin; not __fish_contains_opt -s H header; or contains -- (commandline -poc)[-1] --header -H; end' -l header -s H -d 'Request header in name:value form' -r -f
complete -c opencode -n '__fish_seen_subcommand_from api; and begin; not __fish_contains_opt param; or contains -- (commandline -poc)[-1] --param; end' -l param -d 'OpenAPI path or query parameter' -r -f
complete -c opencode -n '__fish_seen_subcommand_from api; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s d data' -f -a '--data' -d 'Request body'
complete -c opencode -n '__fish_seen_subcommand_from api; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s H header' -f -a '--header' -d 'Request header in name:value form'
complete -c opencode -n '__fish_seen_subcommand_from api; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt param' -f -a '--param' -d 'OpenAPI path or query parameter'
complete -c opencode -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from agents config heap-dump paths' -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from agents config heap-dump paths' -f -a 'agents' -d 'List all agents'
complete -c opencode -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from agents config heap-dump paths' -f -a 'config' -d 'List configuration sources'
complete -c opencode -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from agents config heap-dump paths' -f -a 'heap-dump' -d 'Write a heap snapshot of the running server and print its path'
complete -c opencode -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from agents config heap-dump paths' -f -a 'paths' -d 'Show global paths (data, config, cache, state)'
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from agents' -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from config' -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from heap-dump' -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from heap-dump; and begin; not __fish_contains_opt directory; or contains -- (commandline -poc)[-1] --directory; end' -l directory -d 'Directory to write the snapshot into instead of the server\'s log directory' -r -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from heap-dump; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt directory' -f -a '--directory' -d 'Directory to write the snapshot into instead of the server\'s log directory'
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from paths' -f
complete -c opencode -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from paths' -r -f -a 'db home data config cache state tmp bin log repos' -d 'Print only one path: db, home, data, config, cache, state, tmp, bin, log, repos'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'list' -d 'list integrations and credentials'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'login' -d 'connect an integration'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'logout' -d 'log out of a saved account'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'export' -d 'print stored credentials, including secrets, as JSON'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'import' -d 'import credentials exported by auth export'
complete -c opencode -n '__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from list login logout export import switch' -f -a 'switch' -d 'switch the active account for an integration'
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from list' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from list; and begin; not __fish_contains_opt format; or contains -- (commandline -poc)[-1] --format; end' -l format -d 'Output format' -r -f -a 'default json'
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from list; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt format' -f -a '--format' -d 'Output format'
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from login' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from login; and begin; not __fish_contains_opt method; or contains -- (commandline -poc)[-1] --method; end' -l method -d 'Authentication method ID' -r -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from login; and begin; not __fish_contains_opt answer; or contains -- (commandline -poc)[-1] --answer; end' -l answer -d 'Provider form answer (key=value; repeat for multiple fields)' -r -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from login; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt method' -f -a '--method' -d 'Authentication method ID'
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from login; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt answer' -f -a '--answer' -d 'Provider form answer (key=value; repeat for multiple fields)'
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from logout' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from export' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from import' -f
complete -c opencode -n '__fish_seen_subcommand_from auth; and __fish_seen_subcommand_from switch' -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from list add auth logout' -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from list add auth logout' -f -a 'list' -d 'List configured MCP servers and their status'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from list add auth logout' -f -a 'add' -d 'Add an MCP server to your configuration'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from list add auth logout' -f -a 'auth' -d 'Authenticate with an OAuth-capable remote MCP server'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from list add auth logout' -f -a 'logout' -d 'Remove stored OAuth credentials for an MCP server'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from list' -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add' -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and begin; not __fish_contains_opt url; or contains -- (commandline -poc)[-1] --url; end' -l url -d 'URL for a remote MCP server' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and begin; not __fish_contains_opt header; or contains -- (commandline -poc)[-1] --header; end' -l header -d 'HTTP header for a remote server, as name=value' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and begin; not __fish_contains_opt env; or contains -- (commandline -poc)[-1] --env; end' -l env -d 'Environment variable for a local server, as name=value' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not __fish_contains_opt global no-global' -l global -d 'Write to the global config instead of the project config'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not __fish_contains_opt global no-global' -l no-global -d 'Disable global'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt url' -f -a '--url' -d 'URL for a remote MCP server'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt header' -f -a '--header' -d 'HTTP header for a remote server, as name=value'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt env' -f -a '--env' -d 'Environment variable for a local server, as name=value'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt global no-global' -f -a '--global' -d 'Write to the global config instead of the project config'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from add; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt global no-global' -f -a '--no-global' -d 'Disable global'
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from auth' -f
complete -c opencode -n '__fish_seen_subcommand_from mcp; and __fish_seen_subcommand_from logout' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f -a 'list' -d 'List plugins'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f -a 'add' -d 'Install a plugin and add it to the global configuration'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f -a 'check' -d 'Check package plugins for updates'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f -a 'update' -d 'Update package plugins'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and not __fish_seen_subcommand_from list add check update remove' -f -a 'remove' -d 'Remove a plugin from global configuration'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from list' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from list; and not __fish_contains_opt builtin no-builtin' -l builtin -d 'Include built-in server plugins'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from list; and not __fish_contains_opt builtin no-builtin' -l no-builtin -d 'Disable builtin'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from list; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt builtin no-builtin' -f -a '--builtin' -d 'Include built-in server plugins'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from list; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt builtin no-builtin' -f -a '--no-builtin' -d 'Disable builtin'
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from add' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from check' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from update' -f
complete -c opencode -n '__fish_seen_subcommand_from plugin; and __fish_seen_subcommand_from remove' -f
complete -c opencode -n '__fish_seen_subcommand_from models' -f
complete -c opencode -n '__fish_seen_subcommand_from stats' -f
complete -c opencode -n '__fish_seen_subcommand_from stats; and begin; not __fish_contains_opt days; or contains -- (commandline -poc)[-1] --days; end' -l days -d 'Show the last N days; 0 means today' -r -f
complete -c opencode -n '__fish_seen_subcommand_from stats; and begin; not __fish_contains_opt year; or contains -- (commandline -poc)[-1] --year; end' -l year -d 'Show a calendar year' -r -f
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt all no-all' -l all -d 'Show lifetime statistics'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt all no-all' -l no-all -d 'Disable all'
complete -c opencode -n '__fish_seen_subcommand_from stats; and begin; not __fish_contains_opt project; or contains -- (commandline -poc)[-1] --project; end' -l project -d 'Filter by project ID, or use "." for the current project' -r -f
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt models no-models' -l models -d 'Show model usage'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt models no-models' -l no-models -d 'Disable models'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt tools no-tools' -l tools -d 'Show tool reliability'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt tools no-tools' -l no-tools -d 'Disable tools'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt cost no-cost' -l cost -d 'Show cost and token details'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt cost no-cost' -l no-cost -d 'Disable cost'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt full no-full' -l full -d 'Show every detailed section'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt full no-full' -l no-full -d 'Disable full'
complete -c opencode -n '__fish_seen_subcommand_from stats; and begin; not __fish_contains_opt limit; or contains -- (commandline -poc)[-1] --limit; end' -l limit -d 'Number of rows in detailed sections' -r -f
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt json no-json' -l json -d 'Output statistics as JSON'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not __fish_contains_opt json no-json' -l no-json -d 'Disable json'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt days' -f -a '--days' -d 'Show the last N days; 0 means today'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt year' -f -a '--year' -d 'Show a calendar year'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt all no-all' -f -a '--all' -d 'Show lifetime statistics'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt all no-all' -f -a '--no-all' -d 'Disable all'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt project' -f -a '--project' -d 'Filter by project ID, or use "." for the current project'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt models no-models' -f -a '--models' -d 'Show model usage'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt models no-models' -f -a '--no-models' -d 'Disable models'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt tools no-tools' -f -a '--tools' -d 'Show tool reliability'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt tools no-tools' -f -a '--no-tools' -d 'Disable tools'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt cost no-cost' -f -a '--cost' -d 'Show cost and token details'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt cost no-cost' -f -a '--no-cost' -d 'Disable cost'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt full no-full' -f -a '--full' -d 'Show every detailed section'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt full no-full' -f -a '--no-full' -d 'Disable full'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt limit' -f -a '--limit' -d 'Number of rows in detailed sections'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt json no-json' -f -a '--json' -d 'Output statistics as JSON'
complete -c opencode -n '__fish_seen_subcommand_from stats; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt json no-json' -f -a '--no-json' -d 'Disable json'
complete -c opencode -n '__fish_seen_subcommand_from mini' -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt -s c continue no-continue' -l continue -s c -d 'Continue the last session'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt -s c continue no-continue' -l no-continue -d 'Disable continue'
complete -c opencode -n '__fish_seen_subcommand_from mini; and begin; not __fish_contains_opt -s s session; or contains -- (commandline -poc)[-1] --session -s; end' -l session -s s -d 'Session ID to continue, or to create if it does not exist' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt fork no-fork' -l fork -d 'Fork the session when continuing'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt fork no-fork' -l no-fork -d 'Disable fork'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt replay no-replay' -l replay -d 'Restore session history on resume and resize (disable with --no-replay)'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not __fish_contains_opt replay no-replay' -l no-replay -d 'Disable replay'
complete -c opencode -n '__fish_seen_subcommand_from mini; and begin; not __fish_contains_opt replay-limit; or contains -- (commandline -poc)[-1] --replay-limit; end' -l replay-limit -d 'Limit replay to the newest N messages (default: 200)' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and begin; not __fish_contains_opt -s m model; or contains -- (commandline -poc)[-1] --model -m; end' -l model -s m -d 'Model to use in the format provider/model' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and begin; not __fish_contains_opt agent; or contains -- (commandline -poc)[-1] --agent; end' -l agent -d 'Agent to use' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and begin; not __fish_contains_opt prompt; or contains -- (commandline -poc)[-1] --prompt; end' -l prompt -d 'Prompt to use' -r -f
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--continue' -d 'Continue the last session'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--no-continue' -d 'Disable continue'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s s session' -f -a '--session' -d 'Session ID to continue, or to create if it does not exist'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt fork no-fork' -f -a '--fork' -d 'Fork the session when continuing'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt fork no-fork' -f -a '--no-fork' -d 'Disable fork'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt replay no-replay' -f -a '--replay' -d 'Restore session history on resume and resize (disable with --no-replay)'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt replay no-replay' -f -a '--no-replay' -d 'Disable replay'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt replay-limit' -f -a '--replay-limit' -d 'Limit replay to the newest N messages (default: 200)'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s m model' -f -a '--model' -d 'Model to use in the format provider/model'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt agent' -f -a '--agent' -d 'Agent to use'
complete -c opencode -n '__fish_seen_subcommand_from mini; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt prompt' -f -a '--prompt' -d 'Prompt to use'
complete -c opencode -n '__fish_seen_subcommand_from run' -f
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt -s c continue no-continue' -l continue -s c -d 'Continue the last session'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt -s c continue no-continue' -l no-continue -d 'Disable continue'
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt -s s session; or contains -- (commandline -poc)[-1] --session -s; end' -l session -s s -d 'Session ID to continue, or to create if it does not exist' -r -f
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt fork no-fork' -l fork -d 'Fork the session before continuing'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt fork no-fork' -l no-fork -d 'Disable fork'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt -s w worktree' -l worktree -s w -d 'Start a new session in a new git worktree, optionally with this name'
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt -s m model; or contains -- (commandline -poc)[-1] --model -m; end' -l model -s m -d 'Model to use in the format provider/model#variant' -r -f
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt agent; or contains -- (commandline -poc)[-1] --agent; end' -l agent -d 'Agent to use' -r -f
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt format; or contains -- (commandline -poc)[-1] --format; end' -l format -d 'Output format' -r -f -a 'default json'
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt -s f file; or contains -- (commandline -poc)[-1] --file -f; end' -l file -s f -d 'File to attach to the message' -r -f
complete -c opencode -n '__fish_seen_subcommand_from run; and begin; not __fish_contains_opt title; or contains -- (commandline -poc)[-1] --title; end' -l title -d 'Session title' -r -f
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt archived no-archived' -l archived -d 'Create the session archived so it stays out of session lists (useful for scripted or CI runs)'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt archived no-archived' -l no-archived -d 'Disable archived'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt thinking no-thinking' -l thinking -d 'Show thinking blocks'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt thinking no-thinking' -l no-thinking -d 'Disable thinking'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt auto no-auto' -l auto -d 'Auto-approve permissions that are not explicitly denied'
complete -c opencode -n '__fish_seen_subcommand_from run; and not __fish_contains_opt auto no-auto' -l no-auto -d 'Disable auto'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--continue' -d 'Continue the last session'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s c continue no-continue' -f -a '--no-continue' -d 'Disable continue'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s s session' -f -a '--session' -d 'Session ID to continue, or to create if it does not exist'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt fork no-fork' -f -a '--fork' -d 'Fork the session before continuing'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt fork no-fork' -f -a '--no-fork' -d 'Disable fork'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s w worktree' -f -a '--worktree' -d 'Start a new session in a new git worktree, optionally with this name'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s m model' -f -a '--model' -d 'Model to use in the format provider/model#variant'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt agent' -f -a '--agent' -d 'Agent to use'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt format' -f -a '--format' -d 'Output format'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s f file' -f -a '--file' -d 'File to attach to the message'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt title' -f -a '--title' -d 'Session title'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt archived no-archived' -f -a '--archived' -d 'Create the session archived so it stays out of session lists (useful for scripted or CI runs)'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt archived no-archived' -f -a '--no-archived' -d 'Disable archived'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt thinking no-thinking' -f -a '--thinking' -d 'Show thinking blocks'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt thinking no-thinking' -f -a '--no-thinking' -d 'Disable thinking'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt auto no-auto' -f -a '--auto' -d 'Auto-approve permissions that are not explicitly denied'
complete -c opencode -n '__fish_seen_subcommand_from run; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt auto no-auto' -f -a '--no-auto' -d 'Disable auto'
complete -c opencode -n '__fish_seen_subcommand_from session; and not __fish_seen_subcommand_from list delete export import' -f
complete -c opencode -n '__fish_seen_subcommand_from session; and not __fish_seen_subcommand_from list delete export import' -f -a 'list' -d 'List top-level sessions in the current project, newest first'
complete -c opencode -n '__fish_seen_subcommand_from session; and not __fish_seen_subcommand_from list delete export import' -f -a 'delete' -d 'Delete a session and its child sessions'
complete -c opencode -n '__fish_seen_subcommand_from session; and not __fish_seen_subcommand_from list delete export import' -f -a 'export' -d 'Export session data as JSON'
complete -c opencode -n '__fish_seen_subcommand_from session; and not __fish_seen_subcommand_from list delete export import' -f -a 'import' -d 'Import session data from a JSON file or URL'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from list' -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from list; and begin; not __fish_contains_opt -s n max-count; or contains -- (commandline -poc)[-1] --max-count -n; end' -l max-count -s n -d 'Limit to N most recent sessions (default: 100)' -r -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from list; and begin; not __fish_contains_opt format; or contains -- (commandline -poc)[-1] --format; end' -l format -d 'Output format' -r -f -a 'table json'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from list; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s n max-count' -f -a '--max-count' -d 'Limit to N most recent sessions (default: 100)'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from list; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt format' -f -a '--format' -d 'Output format'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from delete' -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from export' -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from export; and not __fish_contains_opt sanitize no-sanitize' -l sanitize -d 'Redact sensitive transcript and file data'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from export; and not __fish_contains_opt sanitize no-sanitize' -l no-sanitize -d 'Disable sanitize'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from export; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt sanitize no-sanitize' -f -a '--sanitize' -d 'Redact sensitive transcript and file data'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from export; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt sanitize no-sanitize' -f -a '--no-sanitize' -d 'Disable sanitize'
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from import' -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from import; and begin; not __fish_contains_opt directory; or contains -- (commandline -poc)[-1] --directory; end' -l directory -d 'Directory in which to import the session' -r -f
complete -c opencode -n '__fish_seen_subcommand_from session; and __fish_seen_subcommand_from import; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt directory' -f -a '--directory' -d 'Directory in which to import the session'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'start' -d 'Start the background server'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'restart' -d 'Restart the background server'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'status' -d 'Show background server status'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'stop' -d 'Stop the background server'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'get' -d 'Get service configuration'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'set' -d 'Set service configuration'
complete -c opencode -n '__fish_seen_subcommand_from service; and not __fish_seen_subcommand_from start restart status stop get set unset' -f -a 'unset' -d 'Unset service configuration'
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from start' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from restart' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from status' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from stop' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from get' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from set' -f
complete -c opencode -n '__fish_seen_subcommand_from service; and __fish_seen_subcommand_from unset' -f
complete -c opencode -n '__fish_seen_subcommand_from reload' -f
complete -c opencode -n '__fish_seen_subcommand_from pair' -f
complete -c opencode -n '__fish_seen_subcommand_from pair; and begin; not __fish_contains_opt url; or contains -- (commandline -poc)[-1] --url; end' -l url -d 'Use an external HTTP(S) server URL in pairing links' -r -f
complete -c opencode -n '__fish_seen_subcommand_from pair; and not __fish_contains_opt remote no-remote' -l remote -d 'Pair through the OpenTunnel remote address, enabling remote access if needed (exposes the server to the internet)'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not __fish_contains_opt remote no-remote' -l no-remote -d 'Disable remote'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not __fish_contains_opt -s y yes no-yes' -l yes -s y -d 'Accept exposing the server to the internet when --remote enables remote access for the first time (required without an interactive terminal)'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not __fish_contains_opt -s y yes no-yes' -l no-yes -d 'Disable yes'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt url' -f -a '--url' -d 'Use an external HTTP(S) server URL in pairing links'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt remote no-remote' -f -a '--remote' -d 'Pair through the OpenTunnel remote address, enabling remote access if needed (exposes the server to the internet)'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt remote no-remote' -f -a '--no-remote' -d 'Disable remote'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s y yes no-yes' -f -a '--yes' -d 'Accept exposing the server to the internet when --remote enables remote access for the first time (required without an interactive terminal)'
complete -c opencode -n '__fish_seen_subcommand_from pair; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt -s y yes no-yes' -f -a '--no-yes' -d 'Disable yes'
complete -c opencode -n '__fish_seen_subcommand_from serve' -f
complete -c opencode -n '__fish_seen_subcommand_from serve; and begin; not __fish_contains_opt hostname; or contains -- (commandline -poc)[-1] --hostname; end' -l hostname -r -f
complete -c opencode -n '__fish_seen_subcommand_from serve; and begin; not __fish_contains_opt port; or contains -- (commandline -poc)[-1] --port; end' -l port -r -f
complete -c opencode -n '__fish_seen_subcommand_from serve; and begin; not __fish_contains_opt cors; or contains -- (commandline -poc)[-1] --cors; end' -l cors -d 'Additional allowed CORS origin (repeat for multiple origins)' -r -f
complete -c opencode -n '__fish_seen_subcommand_from serve; and not __fish_contains_opt service no-service' -l service
complete -c opencode -n '__fish_seen_subcommand_from serve; and not __fish_contains_opt service no-service' -l no-service
complete -c opencode -n '__fish_seen_subcommand_from serve; and not __fish_contains_opt stdio no-stdio' -l stdio
complete -c opencode -n '__fish_seen_subcommand_from serve; and not __fish_contains_opt stdio no-stdio' -l no-stdio
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt hostname' -f -a '--hostname'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt port' -f -a '--port'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt cors' -f -a '--cors' -d 'Additional allowed CORS origin (repeat for multiple origins)'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt service no-service' -f -a '--service'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt service no-service' -f -a '--no-service'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt stdio no-stdio' -f -a '--stdio'
complete -c opencode -n '__fish_seen_subcommand_from serve; and not string match -q -- "-*" (commandline -ct); and not __fish_contains_opt stdio no-stdio' -f -a '--no-stdio'
###-end-opencode-completions-###
@@ -1,645 +0,0 @@
###-begin-opencode-completions-###
#
# Static completion script for PowerShell
#
# Installation:
# opencode --completions powershell > opencode-completion.ps1
# then add this line to your $PROFILE (use the full path to the file):
# . <PATH>\opencode-completion.ps1
#
$global:_opencode_Completions = [hashtable]::new([System.StringComparer]::Ordinal)
$global:_opencode_Completions[''] = @{
subcommands = @(
@{ name = 'upgrade'; description = 'Upgrade OpenCode to the latest or a specific version' }
@{ name = 'update'; description = 'Upgrade OpenCode to the latest or a specific version' }
@{ name = 'uninstall'; description = 'Uninstall OpenCode, keeping session data, configuration, and state' }
@{ name = 'acp'; description = 'Start an Agent Client Protocol server' }
@{ name = 'api'; description = 'Make a request to the running server' }
@{ name = 'debug'; description = 'Debugging and troubleshooting tools' }
@{ name = 'auth'; description = 'manage integrations and credentials' }
@{ name = 'mcp'; description = 'Manage MCP (Model Context Protocol) servers' }
@{ name = 'plugin'; description = 'Manage plugins' }
@{ name = 'models'; description = 'List all available models' }
@{ name = 'stats'; description = 'Show shareable usage statistics' }
@{ name = 'mini'; description = 'Start the minimal interactive interface' }
@{ name = 'run'; description = 'Run OpenCode with a message' }
@{ name = 'session'; description = 'Manage sessions' }
@{ name = 'service'; description = 'Manage the background server' }
@{ name = 'reload'; description = 'Reload configuration' }
@{ name = 'pair'; description = 'Print one-time links to connect a browser or app' }
@{ name = 'serve'; description = 'Start the v2 API and web server' }
)
flags = @(
@{ name = 'standalone'; forms = @('--standalone'); takesValue = $false; negation = '--no-standalone'; values = @(); pathType = $null; description = 'Run with a private server instead of the background service' }
@{ name = 'server'; forms = @('--server'); takesValue = $true; values = @(); pathType = $null; description = 'Connect to a server URL instead of the background service' }
@{ name = 'auto'; forms = @('--auto'); takesValue = $false; negation = '--no-auto'; values = @(); pathType = $null; description = 'Auto-approve permissions that are not explicitly denied' }
@{ name = 'continue'; forms = @('--continue', '-c'); takesValue = $false; negation = '--no-continue'; values = @(); pathType = $null; description = 'Continue the last session' }
@{ name = 'session'; forms = @('--session', '-s'); takesValue = $true; values = @(); pathType = $null; description = 'Session ID to continue, or to create if it does not exist' }
@{ name = 'prompt'; forms = @('--prompt'); takesValue = $true; values = @(); pathType = $null; description = 'Prompt to use' }
)
arguments = @(
@{ name = 'directory'; variadic = $false; values = @(); pathType = $null; description = 'Directory to start OpenCode in' }
)
}
$global:_opencode_Completions['upgrade'] = @{
subcommands = @()
flags = @(
@{ name = 'method'; forms = @('--method', '-m'); takesValue = $true; values = @('curl', 'npm', 'pnpm', 'bun', 'yarn', 'vp', 'brew', 'winget'); pathType = $null; description = 'Installation method to use' }
)
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Version to upgrade to (with or without a leading v)' }
)
}
$global:_opencode_Completions['update'] = @{
subcommands = @()
flags = @(
@{ name = 'method'; forms = @('--method', '-m'); takesValue = $true; values = @('curl', 'npm', 'pnpm', 'bun', 'yarn', 'vp', 'brew', 'winget'); pathType = $null; description = 'Installation method to use' }
)
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Version to upgrade to (with or without a leading v)' }
)
}
$global:_opencode_Completions['uninstall'] = @{
subcommands = @()
flags = @(
@{ name = 'dry-run'; forms = @('--dry-run'); takesValue = $false; negation = '--no-dry-run'; values = @(); pathType = $null; description = 'Show what would be removed without removing' }
@{ name = 'force'; forms = @('--force', '-f'); takesValue = $false; negation = '--no-force'; values = @(); pathType = $null; description = 'Skip confirmation prompts' }
)
arguments = @()
}
$global:_opencode_Completions['acp'] = @{
subcommands = @()
flags = @(
@{ name = 'login'; forms = @('--login'); takesValue = $false; negation = '--no-login'; values = @(); pathType = $null; description = 'Run auth login instead of starting the server' }
)
arguments = @()
}
$global:_opencode_Completions['api'] = @{
subcommands = @()
flags = @(
@{ name = 'data'; forms = @('--data', '-d'); takesValue = $true; values = @(); pathType = $null; description = 'Request body' }
@{ name = 'header'; forms = @('--header', '-H'); takesValue = $true; values = @(); pathType = $null; description = 'Request header in name:value form' }
@{ name = 'param'; forms = @('--param'); takesValue = $true; values = @(); pathType = $null; description = 'OpenAPI path or query parameter' }
)
arguments = @(
@{ name = 'operation | method path'; variadic = $true; values = @(); pathType = $null; description = 'OpenAPI operation ID, or an HTTP method followed by a path' }
)
}
$global:_opencode_Completions['debug'] = @{
subcommands = @(
@{ name = 'agents'; description = 'List all agents' }
@{ name = 'config'; description = 'List configuration sources' }
@{ name = 'heap-dump'; description = 'Write a heap snapshot of the running server and print its path' }
@{ name = 'paths'; description = 'Show global paths (data, config, cache, state)' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['debug agents'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['debug config'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['debug heap-dump'] = @{
subcommands = @()
flags = @(
@{ name = 'directory'; forms = @('--directory'); takesValue = $true; values = @(); pathType = $null; description = 'Directory to write the snapshot into instead of the server''s log directory' }
)
arguments = @()
}
$global:_opencode_Completions['debug paths'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'name'; variadic = $false; values = @('db', 'home', 'data', 'config', 'cache', 'state', 'tmp', 'bin', 'log', 'repos'); pathType = $null; description = 'Print only one path: db, home, data, config, cache, state, tmp, bin, log, repos' }
)
}
$global:_opencode_Completions['auth'] = @{
subcommands = @(
@{ name = 'list'; description = 'list integrations and credentials' }
@{ name = 'login'; description = 'connect an integration' }
@{ name = 'logout'; description = 'log out of a saved account' }
@{ name = 'export'; description = 'print stored credentials, including secrets, as JSON' }
@{ name = 'import'; description = 'import credentials exported by auth export' }
@{ name = 'switch'; description = 'switch the active account for an integration' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['auth list'] = @{
subcommands = @()
flags = @(
@{ name = 'format'; forms = @('--format'); takesValue = $true; values = @('default', 'json'); pathType = $null; description = 'Output format' }
)
arguments = @()
}
$global:_opencode_Completions['auth login'] = @{
subcommands = @()
flags = @(
@{ name = 'method'; forms = @('--method'); takesValue = $true; values = @(); pathType = $null; description = 'Authentication method ID' }
@{ name = 'answer'; forms = @('--answer'); takesValue = $true; values = @(); pathType = $null; description = 'Provider form answer (key=value; repeat for multiple fields)' }
)
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Integration ID, name, or well-known provider URL' }
)
}
$global:_opencode_Completions['auth logout'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Integration ID or name' }
@{ name = 'credential'; variadic = $false; values = @(); pathType = $null; description = 'Credential ID or label (opens an account picker when omitted)' }
)
}
$global:_opencode_Completions['auth export'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Integration ID or name (exports every integration when omitted)' }
)
}
$global:_opencode_Completions['auth import'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'file'; variadic = $false; values = @(); pathType = $null; description = 'JSON file to import (reads stdin when omitted)' }
)
}
$global:_opencode_Completions['auth switch'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Integration ID or name' }
@{ name = 'credential'; variadic = $false; values = @(); pathType = $null; description = 'Credential ID or label (opens an account picker when omitted)' }
)
}
$global:_opencode_Completions['mcp'] = @{
subcommands = @(
@{ name = 'list'; description = 'List configured MCP servers and their status' }
@{ name = 'add'; description = 'Add an MCP server to your configuration' }
@{ name = 'auth'; description = 'Authenticate with an OAuth-capable remote MCP server' }
@{ name = 'logout'; description = 'Remove stored OAuth credentials for an MCP server' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['mcp list'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['mcp add'] = @{
subcommands = @()
flags = @(
@{ name = 'url'; forms = @('--url'); takesValue = $true; values = @(); pathType = $null; description = 'URL for a remote MCP server' }
@{ name = 'header'; forms = @('--header'); takesValue = $true; values = @(); pathType = $null; description = 'HTTP header for a remote server, as name=value' }
@{ name = 'env'; forms = @('--env'); takesValue = $true; values = @(); pathType = $null; description = 'Environment variable for a local server, as name=value' }
@{ name = 'global'; forms = @('--global'); takesValue = $false; negation = '--no-global'; values = @(); pathType = $null; description = 'Write to the global config instead of the project config' }
)
arguments = @(
@{ name = 'name'; variadic = $false; values = @(); pathType = $null; description = 'Name of the MCP server' }
@{ name = 'command'; variadic = $true; values = @(); pathType = $null; description = 'Command and arguments for a local server, passed after --' }
)
}
$global:_opencode_Completions['mcp auth'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'name'; variadic = $false; values = @(); pathType = $null; description = 'Name of the MCP server' }
)
}
$global:_opencode_Completions['mcp logout'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'name'; variadic = $false; values = @(); pathType = $null; description = 'Name of the MCP server' }
)
}
$global:_opencode_Completions['plugin'] = @{
subcommands = @(
@{ name = 'list'; description = 'List plugins' }
@{ name = 'add'; description = 'Install a plugin and add it to the global configuration' }
@{ name = 'check'; description = 'Check package plugins for updates' }
@{ name = 'update'; description = 'Update package plugins' }
@{ name = 'remove'; description = 'Remove a plugin from global configuration' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['plugin list'] = @{
subcommands = @()
flags = @(
@{ name = 'builtin'; forms = @('--builtin'); takesValue = $false; negation = '--no-builtin'; values = @(); pathType = $null; description = 'Include built-in server plugins' }
)
arguments = @()
}
$global:_opencode_Completions['plugin add'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'package'; variadic = $false; values = @(); pathType = $null; description = 'npm registry or Git package specifier' }
)
}
$global:_opencode_Completions['plugin check'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Configured package target' }
)
}
$global:_opencode_Completions['plugin update'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'target'; variadic = $false; values = @(); pathType = $null; description = 'Configured package target; omit to update all outdated plugins' }
)
}
$global:_opencode_Completions['plugin remove'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'package'; variadic = $false; values = @(); pathType = $null; description = 'configured package specifier' }
)
}
$global:_opencode_Completions['models'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['stats'] = @{
subcommands = @()
flags = @(
@{ name = 'days'; forms = @('--days'); takesValue = $true; values = @(); pathType = $null; description = 'Show the last N days; 0 means today' }
@{ name = 'year'; forms = @('--year'); takesValue = $true; values = @(); pathType = $null; description = 'Show a calendar year' }
@{ name = 'all'; forms = @('--all'); takesValue = $false; negation = '--no-all'; values = @(); pathType = $null; description = 'Show lifetime statistics' }
@{ name = 'project'; forms = @('--project'); takesValue = $true; values = @(); pathType = $null; description = 'Filter by project ID, or use "." for the current project' }
@{ name = 'models'; forms = @('--models'); takesValue = $false; negation = '--no-models'; values = @(); pathType = $null; description = 'Show model usage' }
@{ name = 'tools'; forms = @('--tools'); takesValue = $false; negation = '--no-tools'; values = @(); pathType = $null; description = 'Show tool reliability' }
@{ name = 'cost'; forms = @('--cost'); takesValue = $false; negation = '--no-cost'; values = @(); pathType = $null; description = 'Show cost and token details' }
@{ name = 'full'; forms = @('--full'); takesValue = $false; negation = '--no-full'; values = @(); pathType = $null; description = 'Show every detailed section' }
@{ name = 'limit'; forms = @('--limit'); takesValue = $true; values = @(); pathType = $null; description = 'Number of rows in detailed sections' }
@{ name = 'json'; forms = @('--json'); takesValue = $false; negation = '--no-json'; values = @(); pathType = $null; description = 'Output statistics as JSON' }
)
arguments = @()
}
$global:_opencode_Completions['mini'] = @{
subcommands = @()
flags = @(
@{ name = 'continue'; forms = @('--continue', '-c'); takesValue = $false; negation = '--no-continue'; values = @(); pathType = $null; description = 'Continue the last session' }
@{ name = 'session'; forms = @('--session', '-s'); takesValue = $true; values = @(); pathType = $null; description = 'Session ID to continue, or to create if it does not exist' }
@{ name = 'fork'; forms = @('--fork'); takesValue = $false; negation = '--no-fork'; values = @(); pathType = $null; description = 'Fork the session when continuing' }
@{ name = 'replay'; forms = @('--replay'); takesValue = $false; negation = '--no-replay'; values = @(); pathType = $null; description = 'Restore session history on resume and resize (disable with --no-replay)' }
@{ name = 'replay-limit'; forms = @('--replay-limit'); takesValue = $true; values = @(); pathType = $null; description = 'Limit replay to the newest N messages (default: 200)' }
@{ name = 'model'; forms = @('--model', '-m'); takesValue = $true; values = @(); pathType = $null; description = 'Model to use in the format provider/model' }
@{ name = 'agent'; forms = @('--agent'); takesValue = $true; values = @(); pathType = $null; description = 'Agent to use' }
@{ name = 'prompt'; forms = @('--prompt'); takesValue = $true; values = @(); pathType = $null; description = 'Prompt to use' }
)
arguments = @()
}
$global:_opencode_Completions['run'] = @{
subcommands = @()
flags = @(
@{ name = 'continue'; forms = @('--continue', '-c'); takesValue = $false; negation = '--no-continue'; values = @(); pathType = $null; description = 'Continue the last session' }
@{ name = 'session'; forms = @('--session', '-s'); takesValue = $true; values = @(); pathType = $null; description = 'Session ID to continue, or to create if it does not exist' }
@{ name = 'fork'; forms = @('--fork'); takesValue = $false; negation = '--no-fork'; values = @(); pathType = $null; description = 'Fork the session before continuing' }
@{ name = 'worktree'; forms = @('--worktree', '-w'); takesValue = $true; optionalValue = $true; values = @(); pathType = $null; description = 'Start a new session in a new git worktree, optionally with this name' }
@{ name = 'model'; forms = @('--model', '-m'); takesValue = $true; values = @(); pathType = $null; description = 'Model to use in the format provider/model#variant' }
@{ name = 'agent'; forms = @('--agent'); takesValue = $true; values = @(); pathType = $null; description = 'Agent to use' }
@{ name = 'format'; forms = @('--format'); takesValue = $true; values = @('default', 'json'); pathType = $null; description = 'Output format' }
@{ name = 'file'; forms = @('--file', '-f'); takesValue = $true; values = @(); pathType = $null; description = 'File to attach to the message' }
@{ name = 'title'; forms = @('--title'); takesValue = $true; values = @(); pathType = $null; description = 'Session title' }
@{ name = 'archived'; forms = @('--archived'); takesValue = $false; negation = '--no-archived'; values = @(); pathType = $null; description = 'Create the session archived so it stays out of session lists (useful for scripted or CI runs)' }
@{ name = 'thinking'; forms = @('--thinking'); takesValue = $false; negation = '--no-thinking'; values = @(); pathType = $null; description = 'Show thinking blocks' }
@{ name = 'auto'; forms = @('--auto'); takesValue = $false; negation = '--no-auto'; values = @(); pathType = $null; description = 'Auto-approve permissions that are not explicitly denied' }
)
arguments = @(
@{ name = 'message'; variadic = $true; values = @(); pathType = $null; description = 'Message to send' }
)
}
$global:_opencode_Completions['session'] = @{
subcommands = @(
@{ name = 'list'; description = 'List top-level sessions in the current project, newest first' }
@{ name = 'delete'; description = 'Delete a session and its child sessions' }
@{ name = 'export'; description = 'Export session data as JSON' }
@{ name = 'import'; description = 'Import session data from a JSON file or URL' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['session list'] = @{
subcommands = @()
flags = @(
@{ name = 'max-count'; forms = @('--max-count', '-n'); takesValue = $true; values = @(); pathType = $null; description = 'Limit to N most recent sessions (default: 100)' }
@{ name = 'format'; forms = @('--format'); takesValue = $true; values = @('table', 'json'); pathType = $null; description = 'Output format' }
)
arguments = @()
}
$global:_opencode_Completions['session delete'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'sessionID'; variadic = $false; values = @(); pathType = $null; description = 'Session ID to delete' }
)
}
$global:_opencode_Completions['session export'] = @{
subcommands = @()
flags = @(
@{ name = 'sanitize'; forms = @('--sanitize'); takesValue = $false; negation = '--no-sanitize'; values = @(); pathType = $null; description = 'Redact sensitive transcript and file data' }
)
arguments = @(
@{ name = 'session'; variadic = $false; values = @(); pathType = $null; description = 'Session ID to export' }
)
}
$global:_opencode_Completions['session import'] = @{
subcommands = @()
flags = @(
@{ name = 'directory'; forms = @('--directory'); takesValue = $true; values = @(); pathType = $null; description = 'Directory in which to import the session' }
)
arguments = @(
@{ name = 'file'; variadic = $false; values = @(); pathType = $null; description = 'JSON file or URL to import' }
)
}
$global:_opencode_Completions['service'] = @{
subcommands = @(
@{ name = 'start'; description = 'Start the background server' }
@{ name = 'restart'; description = 'Restart the background server' }
@{ name = 'status'; description = 'Show background server status' }
@{ name = 'stop'; description = 'Stop the background server' }
@{ name = 'get'; description = 'Get service configuration' }
@{ name = 'set'; description = 'Set service configuration' }
@{ name = 'unset'; description = 'Unset service configuration' }
)
flags = @()
arguments = @()
}
$global:_opencode_Completions['service start'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['service restart'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['service status'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['service stop'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['service get'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'key'; variadic = $false; values = @(); pathType = $null; description = 'Service setting or env' }
@{ name = 'name'; variadic = $false; values = @(); pathType = $null; description = 'Environment variable name' }
)
}
$global:_opencode_Completions['service set'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'key'; variadic = $false; values = @(); pathType = $null; description = 'Service setting or env' }
@{ name = 'value'; variadic = $false; values = @(); pathType = $null; description = 'Setting value or environment variable name' }
@{ name = 'env-value'; variadic = $false; values = @(); pathType = $null; description = 'Environment variable value' }
)
}
$global:_opencode_Completions['service unset'] = @{
subcommands = @()
flags = @()
arguments = @(
@{ name = 'key'; variadic = $false; values = @(); pathType = $null; description = 'Service setting or env' }
@{ name = 'name'; variadic = $false; values = @(); pathType = $null; description = 'Environment variable name' }
)
}
$global:_opencode_Completions['reload'] = @{
subcommands = @()
flags = @()
arguments = @()
}
$global:_opencode_Completions['pair'] = @{
subcommands = @()
flags = @(
@{ name = 'url'; forms = @('--url'); takesValue = $true; values = @(); pathType = $null; description = 'Use an external HTTP(S) server URL in pairing links' }
@{ name = 'remote'; forms = @('--remote'); takesValue = $false; negation = '--no-remote'; values = @(); pathType = $null; description = 'Pair through the OpenTunnel remote address, enabling remote access if needed (exposes the server to the internet)' }
@{ name = 'yes'; forms = @('--yes', '-y'); takesValue = $false; negation = '--no-yes'; values = @(); pathType = $null; description = 'Accept exposing the server to the internet when --remote enables remote access for the first time (required without an interactive terminal)' }
)
arguments = @()
}
$global:_opencode_Completions['serve'] = @{
subcommands = @()
flags = @(
@{ name = 'hostname'; forms = @('--hostname'); takesValue = $true; values = @(); pathType = $null; description = $null }
@{ name = 'port'; forms = @('--port'); takesValue = $true; values = @(); pathType = $null; description = $null }
@{ name = 'cors'; forms = @('--cors'); takesValue = $true; values = @(); pathType = $null; description = 'Additional allowed CORS origin (repeat for multiple origins)' }
@{ name = 'service'; forms = @('--service'); takesValue = $false; negation = '--no-service'; values = @(); pathType = $null; description = $null }
@{ name = 'stdio'; forms = @('--stdio'); takesValue = $false; negation = '--no-stdio'; values = @(); pathType = $null; description = $null }
)
arguments = @()
}
Register-ArgumentCompleter -Native -CommandName 'opencode' -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$spec = $global:_opencode_Completions
$results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
$booleanLiterals = @('true', 'yes', 'on', '1', 'y', 'false', 'no', 'off', '0', 'n')
$index = {
param($context)
$lookup = [hashtable]::new([System.StringComparer]::Ordinal)
foreach ($flag in $context.flags) {
foreach ($form in $flag.forms) { $lookup[$form] = $flag }
}
$lookup
}
$add = {
param([string]$value, [string]$type, $tooltip, [string]$typed, [string]$textPrefix)
if (-not $value.StartsWith($typed, [System.StringComparison]::OrdinalIgnoreCase)) { return }
$text = $value
if ($value -notmatch '^[\w./:%+=\\-]+$') { $text = "'" + ($value -replace "['\u2018-\u201b]", '$0$0') + "'" }
$text = $textPrefix + $text
$label = $value
if (-not $label) { $label = $text }
if (-not $tooltip) { $tooltip = $label }
$results.Add([System.Management.Automation.CompletionResult]::new($text, $label, $type, $tooltip))
}
$addValues = {
param($entry, [string]$typed, [string]$textPrefix)
foreach ($value in $entry.values) {
if ($textPrefix -eq '' -and (& $optionLike $value)) { continue }
& $add $value 'ParameterValue' $entry.description $typed $textPrefix
}
if ($entry.pathType) {
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($typed)) {
if ($entry.pathType -eq 'directory' -and $file.ResultType -ne 'ProviderContainer') { continue }
$results.Add([System.Management.Automation.CompletionResult]::new($textPrefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip))
}
}
}
$addFlags = {
param([string]$typed)
foreach ($flag in $context.flags) {
if ($used.ContainsKey($flag.name)) { continue }
foreach ($form in $flag.forms) {
& $add $form 'ParameterName' $flag.description $typed ''
}
if ($flag.negation) {
$tooltip = $null
if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
& $add $flag.negation 'ParameterName' $tooltip $typed ''
}
}
}
# As in the CLI lexer, nothing after '--' is an option, and negative numbers
# and a lone '-' are values.
$optionLike = {
param([string]$word)
-not $endOfOptions -and $word -match '^-.' -and $word -notmatch '^-(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$'
}
# A typed value that has no candidates completes to itself, so the engine
# does not fall back to listing files.
$keepTyped = {
if ($results.Count -eq 0 -and $current) {
$results.Add([System.Management.Automation.CompletionResult]::new($current, $current, 'ParameterValue', $current))
}
}
$path = ''
$context = $spec[$path]
$lookup = & $index $context
$used = [hashtable]::new([System.StringComparer]::Ordinal)
$pending = $null
$endOfOptions = $false
$position = 0
# The engine strips the quotes from a quoted word.
$typed = [string]$wordToComplete
if ($typed -match '^([''"])(.*?)\1?$') { $typed = $Matches[2] }
$current = $null
$elements = $commandAst.CommandElements
for ($i = 1; $i -lt $elements.Count; $i++) {
$element = $elements[$i]
$word = $element.Extent.Text
if ($element -is [System.Management.Automation.Language.StringConstantExpressionAst]) { $word = $element.Value }
if ($element.Extent.EndOffset -ge $cursorPosition) {
if ($element -is [System.Management.Automation.Language.ConstantExpressionAst] -and $element.Extent.StartOffset -le $cursorPosition) {
$current = $element.Extent.Text
if ($element.Extent.EndOffset -eq $cursorPosition) { $typed = $word }
}
break
}
# A flag takes the next word as its value unless it is an option or '--';
# a boolean flag only takes a boolean literal.
$isOption = & $optionLike $word
if ($null -ne $pending) {
$flag = $pending
$pending = $null
if ($flag.takesValue) {
if (-not $isOption) { continue }
} elseif ($booleanLiterals -ccontains $word) { continue }
}
if ($endOfOptions) { $position++; continue }
if ($word -ceq '--') { $endOfOptions = $true; continue }
if ($isOption) {
$hasValue = $word.Contains('=')
if ($hasValue) {
$forms = @($word.Substring(0, $word.IndexOf('=')))
} elseif ($word.StartsWith('--')) {
$forms = @($word)
} else {
$forms = @(foreach ($char in $word.Substring(1).ToCharArray()) { '-' + $char })
}
foreach ($form in $forms) {
$pending = $null
$flag = $lookup[$form]
# As in the CLI parser, a negation wins over an alias but not over a
# canonical name.
if ($null -eq $flag -or $form -cne ('--' + $flag.name)) {
$negated = $null
foreach ($candidate in $context.flags) {
if ($candidate.negation -ceq $form) { $negated = $candidate }
}
if ($null -ne $negated) {
$used[$negated.name] = $true
continue
}
}
if ($null -eq $flag) { continue }
$used[$flag.name] = $true
# A flag with an optional value only takes a value attached with '='.
if (-not $hasValue -and -not $flag.optionalValue) { $pending = $flag }
}
continue
}
if ($position -eq 0 -and $context.subcommands.name -ccontains $word) {
if ($path) { $path = $path + ' ' + $word } else { $path = $word }
$context = $spec[$path]
$lookup = & $index $context
$used = [hashtable]::new([System.StringComparer]::Ordinal)
continue
}
$position++
}
$typedIsOption = & $optionLike $typed
if ($null -ne $pending -and $pending.takesValue -and -not $typedIsOption) {
& $addValues $pending $typed ''
& $keepTyped
return $results
}
if ($typedIsOption) {
if ($typed -match '^(-[^=]+)=(.*)$') {
$form = $Matches[1]
$flag = $lookup[$form]
if ($null -ne $flag -and $flag.takesValue) {
& $addValues $flag $Matches[2] ($form + '=')
& $keepTyped
}
} else {
& $addFlags $typed
}
return $results
}
if (-not $endOfOptions -and $position -eq 0) {
foreach ($sub in $context.subcommands) {
& $add $sub.name 'Command' $sub.description $typed ''
}
}
$arguments = $context.arguments
if ($position -lt $arguments.Count) {
& $addValues $arguments[$position] $typed ''
} elseif ($arguments.Count -gt 0 -and $arguments[-1].variadic) {
& $addValues $arguments[-1] $typed ''
}
if (-not $endOfOptions) {
& $addFlags $typed
}
return $results
}
###-end-opencode-completions-###
-800
View File
@@ -1,800 +0,0 @@
#compdef opencode
###-begin-opencode-completions-###
#
# Static completion script for Zsh
#
# Installation:
# opencode --completions zsh > ~/.zsh/completions/_opencode
# then add ~/.zsh/completions to your fpath
#
_opencode() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'upgrade:Upgrade OpenCode to the latest or a specific version'
'update:Upgrade OpenCode to the latest or a specific version'
'uninstall:Uninstall OpenCode, keeping session data, configuration, and state'
'acp:Start an Agent Client Protocol server'
'api:Make a request to the running server'
'debug:Debugging and troubleshooting tools'
'auth:manage integrations and credentials'
'mcp:Manage MCP (Model Context Protocol) servers'
'plugin:Manage plugins'
'models:List all available models'
'stats:Show shareable usage statistics'
'mini:Start the minimal interactive interface'
'run:Run OpenCode with a message'
'session:Manage sessions'
'service:Manage the background server'
'reload:Reload configuration'
'pair:Print one-time links to connect a browser or app'
'serve:Start the v2 API and web server'
)
local -a specs
specs=(
'(--standalone --no-standalone)--standalone[Run with a private server instead of the background service]'
'(--standalone --no-standalone)--no-standalone[Disable standalone]'
'(--server)--server[Connect to a server URL instead of the background service]:value:'
'(--auto --no-auto)--auto[Auto-approve permissions that are not explicitly denied]'
'(--auto --no-auto)--no-auto[Disable auto]'
'(--continue -c --no-continue)--continue[Continue the last session]'
'(--continue -c --no-continue)-c[Continue the last session]'
'(--continue -c --no-continue)--no-continue[Disable continue]'
'(--session -s)--session[Session ID to continue, or to create if it does not exist]:value:'
'(--session -s)-s[Session ID to continue, or to create if it does not exist]:value:'
'(--prompt)--prompt[Prompt to use]:value:'
-
parent-arguments
':Directory to start OpenCode in:'
-
subcommands
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
upgrade)
_opencode_upgrade
;;
update)
_opencode_update
;;
uninstall)
_opencode_uninstall
;;
acp)
_opencode_acp
;;
api)
_opencode_api
;;
debug)
_opencode_debug
;;
auth)
_opencode_auth
;;
mcp)
_opencode_mcp
;;
plugin)
_opencode_plugin
;;
models)
_opencode_models
;;
stats)
_opencode_stats
;;
mini)
_opencode_mini
;;
run)
_opencode_run
;;
session)
_opencode_session
;;
service)
_opencode_service
;;
reload)
_opencode_reload
;;
pair)
_opencode_pair
;;
serve)
_opencode_serve
;;
esac
;;
esac
}
_opencode_upgrade() {
local -a specs
specs=(
'(--method -m)--method[Installation method to use]:value:(curl npm pnpm bun yarn vp brew winget)'
'(--method -m)-m[Installation method to use]:value:(curl npm pnpm bun yarn vp brew winget)'
':Version to upgrade to (with or without a leading v):'
)
_arguments "${specs[@]}"
}
_opencode_update() {
local -a specs
specs=(
'(--method -m)--method[Installation method to use]:value:(curl npm pnpm bun yarn vp brew winget)'
'(--method -m)-m[Installation method to use]:value:(curl npm pnpm bun yarn vp brew winget)'
':Version to upgrade to (with or without a leading v):'
)
_arguments "${specs[@]}"
}
_opencode_uninstall() {
local -a specs
specs=(
'(--dry-run --no-dry-run)--dry-run[Show what would be removed without removing]'
'(--dry-run --no-dry-run)--no-dry-run[Disable dry-run]'
'(--force -f --no-force)--force[Skip confirmation prompts]'
'(--force -f --no-force)-f[Skip confirmation prompts]'
'(--force -f --no-force)--no-force[Disable force]'
)
_arguments "${specs[@]}"
}
_opencode_acp() {
local -a specs
specs=(
'(--login --no-login)--login[Run auth login instead of starting the server]'
'(--login --no-login)--no-login[Disable login]'
)
_arguments "${specs[@]}"
}
_opencode_api() {
local -a specs
specs=(
'(--data -d)--data[Request body]:value:'
'(--data -d)-d[Request body]:value:'
'(--header -H)--header[Request header in name\:value form]:value:'
'(--header -H)-H[Request header in name\:value form]:value:'
'(--param)--param[OpenAPI path or query parameter]:value:'
'*:OpenAPI operation ID, or an HTTP method followed by a path:'
)
_arguments "${specs[@]}"
}
_opencode_debug() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'agents:List all agents'
'config:List configuration sources'
'heap-dump:Write a heap snapshot of the running server and print its path'
'paths:Show global paths (data, config, cache, state)'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
agents)
_opencode_debug_agents
;;
config)
_opencode_debug_config
;;
heap-dump)
_opencode_debug_heap_dump
;;
paths)
_opencode_debug_paths
;;
esac
;;
esac
}
_opencode_debug_agents() {
}
_opencode_debug_config() {
}
_opencode_debug_heap_dump() {
local -a specs
specs=(
'(--directory)--directory[Directory to write the snapshot into instead of the server'\''s log directory]:value:'
)
_arguments "${specs[@]}"
}
_opencode_debug_paths() {
local -a specs
specs=(
':Print only one path\: db, home, data, config, cache, state, tmp, bin, log, repos:(db home data config cache state tmp bin log repos)'
)
_arguments "${specs[@]}"
}
_opencode_auth() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'list:list integrations and credentials'
'login:connect an integration'
'logout:log out of a saved account'
'export:print stored credentials, including secrets, as JSON'
'import:import credentials exported by auth export'
'switch:switch the active account for an integration'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
list)
_opencode_auth_list
;;
login)
_opencode_auth_login
;;
logout)
_opencode_auth_logout
;;
export)
_opencode_auth_export
;;
import)
_opencode_auth_import
;;
switch)
_opencode_auth_switch
;;
esac
;;
esac
}
_opencode_auth_list() {
local -a specs
specs=(
'(--format)--format[Output format]:value:(default json)'
)
_arguments "${specs[@]}"
}
_opencode_auth_login() {
local -a specs
specs=(
'(--method)--method[Authentication method ID]:value:'
'(--answer)--answer[Provider form answer (key=value; repeat for multiple fields)]:value:'
':Integration ID, name, or well-known provider URL:'
)
_arguments "${specs[@]}"
}
_opencode_auth_logout() {
local -a specs
specs=(
':Integration ID or name:'
':Credential ID or label (opens an account picker when omitted):'
)
_arguments "${specs[@]}"
}
_opencode_auth_export() {
local -a specs
specs=(
':Integration ID or name (exports every integration when omitted):'
)
_arguments "${specs[@]}"
}
_opencode_auth_import() {
local -a specs
specs=(
':JSON file to import (reads stdin when omitted):'
)
_arguments "${specs[@]}"
}
_opencode_auth_switch() {
local -a specs
specs=(
':Integration ID or name:'
':Credential ID or label (opens an account picker when omitted):'
)
_arguments "${specs[@]}"
}
_opencode_mcp() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'list:List configured MCP servers and their status'
'add:Add an MCP server to your configuration'
'auth:Authenticate with an OAuth-capable remote MCP server'
'logout:Remove stored OAuth credentials for an MCP server'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
list)
_opencode_mcp_list
;;
add)
_opencode_mcp_add
;;
auth)
_opencode_mcp_auth
;;
logout)
_opencode_mcp_logout
;;
esac
;;
esac
}
_opencode_mcp_list() {
}
_opencode_mcp_add() {
local -a specs
specs=(
'(--url)--url[URL for a remote MCP server]:value:'
'(--header)--header[HTTP header for a remote server, as name=value]:value:'
'(--env)--env[Environment variable for a local server, as name=value]:value:'
'(--global --no-global)--global[Write to the global config instead of the project config]'
'(--global --no-global)--no-global[Disable global]'
':Name of the MCP server:'
'*:Command and arguments for a local server, passed after --:'
)
_arguments "${specs[@]}"
}
_opencode_mcp_auth() {
local -a specs
specs=(
':Name of the MCP server:'
)
_arguments "${specs[@]}"
}
_opencode_mcp_logout() {
local -a specs
specs=(
':Name of the MCP server:'
)
_arguments "${specs[@]}"
}
_opencode_plugin() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'list:List plugins'
'add:Install a plugin and add it to the global configuration'
'check:Check package plugins for updates'
'update:Update package plugins'
'remove:Remove a plugin from global configuration'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
list)
_opencode_plugin_list
;;
add)
_opencode_plugin_add
;;
check)
_opencode_plugin_check
;;
update)
_opencode_plugin_update
;;
remove)
_opencode_plugin_remove
;;
esac
;;
esac
}
_opencode_plugin_list() {
local -a specs
specs=(
'(--builtin --no-builtin)--builtin[Include built-in server plugins]'
'(--builtin --no-builtin)--no-builtin[Disable builtin]'
)
_arguments "${specs[@]}"
}
_opencode_plugin_add() {
local -a specs
specs=(
':npm registry or Git package specifier:'
)
_arguments "${specs[@]}"
}
_opencode_plugin_check() {
local -a specs
specs=(
':Configured package target:'
)
_arguments "${specs[@]}"
}
_opencode_plugin_update() {
local -a specs
specs=(
':Configured package target; omit to update all outdated plugins:'
)
_arguments "${specs[@]}"
}
_opencode_plugin_remove() {
local -a specs
specs=(
':configured package specifier:'
)
_arguments "${specs[@]}"
}
_opencode_models() {
}
_opencode_stats() {
local -a specs
specs=(
'(--days)--days[Show the last N days; 0 means today]:integer:'
'(--year)--year[Show a calendar year]:integer:'
'(--all --no-all)--all[Show lifetime statistics]'
'(--all --no-all)--no-all[Disable all]'
'(--project)--project[Filter by project ID, or use "." for the current project]:value:'
'(--models --no-models)--models[Show model usage]'
'(--models --no-models)--no-models[Disable models]'
'(--tools --no-tools)--tools[Show tool reliability]'
'(--tools --no-tools)--no-tools[Disable tools]'
'(--cost --no-cost)--cost[Show cost and token details]'
'(--cost --no-cost)--no-cost[Disable cost]'
'(--full --no-full)--full[Show every detailed section]'
'(--full --no-full)--no-full[Disable full]'
'(--limit)--limit[Number of rows in detailed sections]:integer:'
'(--json --no-json)--json[Output statistics as JSON]'
'(--json --no-json)--no-json[Disable json]'
)
_arguments "${specs[@]}"
}
_opencode_mini() {
local -a specs
specs=(
'(--continue -c --no-continue)--continue[Continue the last session]'
'(--continue -c --no-continue)-c[Continue the last session]'
'(--continue -c --no-continue)--no-continue[Disable continue]'
'(--session -s)--session[Session ID to continue, or to create if it does not exist]:value:'
'(--session -s)-s[Session ID to continue, or to create if it does not exist]:value:'
'(--fork --no-fork)--fork[Fork the session when continuing]'
'(--fork --no-fork)--no-fork[Disable fork]'
'(--replay --no-replay)--replay[Restore session history on resume and resize (disable with --no-replay)]'
'(--replay --no-replay)--no-replay[Disable replay]'
'(--replay-limit)--replay-limit[Limit replay to the newest N messages (default\: 200)]:integer:'
'(--model -m)--model[Model to use in the format provider/model]:value:'
'(--model -m)-m[Model to use in the format provider/model]:value:'
'(--agent)--agent[Agent to use]:value:'
'(--prompt)--prompt[Prompt to use]:value:'
)
_arguments "${specs[@]}"
}
_opencode_run() {
local -a specs
specs=(
'(--continue -c --no-continue)--continue[Continue the last session]'
'(--continue -c --no-continue)-c[Continue the last session]'
'(--continue -c --no-continue)--no-continue[Disable continue]'
'(--session -s)--session[Session ID to continue, or to create if it does not exist]:value:'
'(--session -s)-s[Session ID to continue, or to create if it does not exist]:value:'
'(--fork --no-fork)--fork[Fork the session before continuing]'
'(--fork --no-fork)--no-fork[Disable fork]'
'(--worktree -w)--worktree=-[Start a new session in a new git worktree, optionally with this name]::value:'
'(--worktree -w)-w=-[Start a new session in a new git worktree, optionally with this name]::value:'
'(--model -m)--model[Model to use in the format provider/model#variant]:value:'
'(--model -m)-m[Model to use in the format provider/model#variant]:value:'
'(--agent)--agent[Agent to use]:value:'
'(--format)--format[Output format]:value:(default json)'
'(--file -f)--file[File to attach to the message]:value:'
'(--file -f)-f[File to attach to the message]:value:'
'(--title)--title[Session title]:value:'
'(--archived --no-archived)--archived[Create the session archived so it stays out of session lists (useful for scripted or CI runs)]'
'(--archived --no-archived)--no-archived[Disable archived]'
'(--thinking --no-thinking)--thinking[Show thinking blocks]'
'(--thinking --no-thinking)--no-thinking[Disable thinking]'
'(--auto --no-auto)--auto[Auto-approve permissions that are not explicitly denied]'
'(--auto --no-auto)--no-auto[Disable auto]'
'*:Message to send:'
)
_arguments "${specs[@]}"
}
_opencode_session() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'list:List top-level sessions in the current project, newest first'
'delete:Delete a session and its child sessions'
'export:Export session data as JSON'
'import:Import session data from a JSON file or URL'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
list)
_opencode_session_list
;;
delete)
_opencode_session_delete
;;
export)
_opencode_session_export
;;
import)
_opencode_session_import
;;
esac
;;
esac
}
_opencode_session_list() {
local -a specs
specs=(
'(--max-count -n)--max-count[Limit to N most recent sessions (default\: 100)]:integer:'
'(--max-count -n)-n[Limit to N most recent sessions (default\: 100)]:integer:'
'(--format)--format[Output format]:value:(table json)'
)
_arguments "${specs[@]}"
}
_opencode_session_delete() {
local -a specs
specs=(
':Session ID to delete:'
)
_arguments "${specs[@]}"
}
_opencode_session_export() {
local -a specs
specs=(
'(--sanitize --no-sanitize)--sanitize[Redact sensitive transcript and file data]'
'(--sanitize --no-sanitize)--no-sanitize[Disable sanitize]'
':Session ID to export:'
)
_arguments "${specs[@]}"
}
_opencode_session_import() {
local -a specs
specs=(
'(--directory)--directory[Directory in which to import the session]:value:'
':JSON file or URL to import:'
)
_arguments "${specs[@]}"
}
_opencode_service() {
local context state state_descr line
typeset -A opt_args
local -a commands
commands=(
'start:Start the background server'
'restart:Restart the background server'
'status:Show background server status'
'stop:Stop the background server'
'get:Get service configuration'
'set:Set service configuration'
'unset:Unset service configuration'
)
local -a specs
specs=(
'1:command:->command'
'*::arg:->args'
)
_arguments -C "${specs[@]}"
case "$state" in
command)
_describe -t commands 'commands' commands
;;
args)
case "$words[1]" in
start)
_opencode_service_start
;;
restart)
_opencode_service_restart
;;
status)
_opencode_service_status
;;
stop)
_opencode_service_stop
;;
get)
_opencode_service_get
;;
set)
_opencode_service_set
;;
unset)
_opencode_service_unset
;;
esac
;;
esac
}
_opencode_service_start() {
}
_opencode_service_restart() {
}
_opencode_service_status() {
}
_opencode_service_stop() {
}
_opencode_service_get() {
local -a specs
specs=(
':Service setting or env:'
':Environment variable name:'
)
_arguments "${specs[@]}"
}
_opencode_service_set() {
local -a specs
specs=(
':Service setting or env:'
':Setting value or environment variable name:'
':Environment variable value:'
)
_arguments "${specs[@]}"
}
_opencode_service_unset() {
local -a specs
specs=(
':Service setting or env:'
':Environment variable name:'
)
_arguments "${specs[@]}"
}
_opencode_reload() {
}
_opencode_pair() {
local -a specs
specs=(
'(--url)--url[Use an external HTTP(S) server URL in pairing links]:value:'
'(--remote --no-remote)--remote[Pair through the OpenTunnel remote address, enabling remote access if needed (exposes the server to the internet)]'
'(--remote --no-remote)--no-remote[Disable remote]'
'(--yes -y --no-yes)--yes[Accept exposing the server to the internet when --remote enables remote access for the first time (required without an interactive terminal)]'
'(--yes -y --no-yes)-y[Accept exposing the server to the internet when --remote enables remote access for the first time (required without an interactive terminal)]'
'(--yes -y --no-yes)--no-yes[Disable yes]'
)
_arguments "${specs[@]}"
}
_opencode_serve() {
local -a specs
specs=(
'(--hostname)--hostname:value:'
'(--port)--port:integer:'
'(--cors)--cors[Additional allowed CORS origin (repeat for multiple origins)]:value:'
'(--service --no-service)--service'
'(--service --no-service)--no-service'
'(--stdio --no-stdio)--stdio'
'(--stdio --no-stdio)--no-stdio'
)
_arguments "${specs[@]}"
}
# Handle both direct invocation and autoload
if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then
_opencode "$@"
else
compdef _opencode opencode
fi
###-end-opencode-completions-###
@@ -0,0 +1,3 @@
import { defineCli } from "../../cli/run"
export default defineCli({ args: ["--completions", "bash"] })
@@ -0,0 +1,3 @@
import { defineCli } from "../../cli/run"
export default defineCli({ args: ["--completions", "fish"] })
@@ -0,0 +1,3 @@
import { defineCli } from "../../cli/run"
export default defineCli({ args: ["--completions", "powershell"] })
@@ -0,0 +1,3 @@
import { defineCli } from "../../cli/run"
export default defineCli({ args: ["--completions", "zsh"] })
+2 -7
View File
@@ -1,4 +1,4 @@
// Records what the TypeScript CLI prints for help, completions, and usage errors, with colors (FORCE_COLOR=1),
// Records what the TypeScript CLI prints for help and usage errors, with colors (FORCE_COLOR=1),
// into crates/cli/tests/fixtures/cli. Each usage error records the environment it ran in. The Rust tests in
// crates/cli/src/tests/output.rs compare their own output with these files byte for byte, and with the colors
// stripped for a run without a terminal.
@@ -99,7 +99,6 @@ visit(root, [])
const out = path.resolve(import.meta.dir, "../../crates/cli/tests/fixtures/cli")
await rm(out, { recursive: true, force: true })
await mkdir(path.join(out, "help"), { recursive: true })
await mkdir(path.join(out, "completions"), { recursive: true })
const run = async (args: string[], env: Record<string, string> = { FORCE_COLOR: "1" }) => {
const box = await sandbox(env)
@@ -144,13 +143,9 @@ await pool(paths, 6, async (prefix) => {
const stdout = expectClean(await run([...prefix, "--help"]))
await Bun.write(path.join(out, "help", `${["opencode", ...prefix].join(" ")}.txt`), stdout)
})
await pool(["bash", "zsh", "fish", "powershell"], 4, async (shell) => {
const stdout = expectClean(await run(["--completions", shell]))
await Bun.write(path.join(out, "completions", `${shell}.txt`), stdout)
})
const failures = [
...(await pool(errors, 6, (args) => run(args))),
...(await pool(environments, 4, (item) => run(item.args, item.env))),
]
await Bun.write(path.join(out, "errors.json"), records(failures, ["[]"]))
console.log(`cli-output: wrote ${paths.length} help pages, 4 completion scripts, ${failures.length} errors to ${out}`)
console.log(`cli-output: wrote ${paths.length} help pages and ${failures.length} errors to ${out}`)