Documentation
¶
Overview ¶
Package argv builds Codex CLI command lines from structured options.
Index ¶
- func Argv(opts Options) ([]string, error)
- func EnsureBoolFlag(args []string, flag string) []string
- func EnsureConfigFlag(args []string, key, value string) []string
- func EnsureDisableFeature(args []string, name string) []string
- func HasConfigKey(args []string, key string) bool
- func ParseShellWords(line string) ([]string, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureBoolFlag ¶
EnsureBoolFlag ensures argv contains a bare boolean flag token exactly once.
func EnsureConfigFlag ¶
EnsureConfigFlag ensures argv has paired "-c" "key=value" (preferred form).
func EnsureDisableFeature ¶
EnsureDisableFeature ensures "--disable" "<name>" appears once.
func HasConfigKey ¶
HasConfigKey reports whether args already contain -c/--config for key (either "key=…" or bare "key" as the config value token).
func ParseShellWords ¶
ParseShellWords splits a shell-style command line into argv words.
Types ¶
type Options ¶
type Options struct {
// Bin is argv[0] when CommandOverride is empty.
Bin string
// UserFlags are inserted after Bin (settings / runner-spec extras).
UserFlags []string
Model string
ResumeSession string
ReasoningEffort string
BypassApprovalsAndSandbox bool
BypassHookTrust bool
DisableUpdateCheck bool
EmptyMCPServers bool
// DisableFeatures appends --disable <name> for each entry (deduped).
DisableFeatures []string
ExtraConfig map[string]string
ExtraBool []string
// CommandOverride, when set, replaces Bin+UserFlags with shell-split words.
// Session fields (Model/Resume) are not applied on override; knobs still apply
// when set on Options (callers choose which knobs for hooks).
CommandOverride string
}
Options configures a Codex process argv. Callers resolve the binary (and optional user flags) then set Bin / UserFlags, or set CommandOverride for test/fake TUI hooks.
func Interactive ¶
func Interactive() Options
Interactive returns agent-run TTY defaults (approvals bypass, no update check, hook-trust bypass). Does not empty MCP or disable features.
func StatusInspect ¶
func StatusInspect() Options
StatusInspect returns the stronger ephemeral /status fetch defaults: approvals + hook-trust bypass, no update check, empty mcp_servers, and disable plugins / computer_use / in_app_updates / hooks.