Skip to content

Add completion spec: Codex CLI (codex)#217

Merged
lucieleblanc merged 4 commits into
mainfrom
app-3520/command-spec-codex
Apr 3, 2026
Merged

Add completion spec: Codex CLI (codex)#217
lucieleblanc merged 4 commits into
mainfrom
app-3520/command-spec-codex

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Summary

Add a comprehensive completion spec for the OpenAI Codex CLI (codex), covering all subcommands, flags, and arguments.

What's included

  • 16 top-level subcommands: exec (alias e), review, login, logout, mcp, mcp-server, app-server, completion, sandbox, debug, apply (alias a), resume, fork, cloud (alias cloud-tasks), features, execpolicy
  • Nested sub-subcommands: exec resume, exec review, mcp {list,get,add,remove,login,logout}, cloud {exec,status,list,apply,diff}, sandbox {macos,linux,windows}, features {list,enable,disable}, app-server {generate-ts,generate-json-schema}, debug app-server send-message-v2, execpolicy check, login status
  • Argument types: file/folder templates for paths (--image, --cd, --add-dir, --output-schema, etc.), enum suggestions for --sandbox, --ask-for-approval, --color, completion SHELL, --local-provider, --ws-auth
  • No generators needed — all completions are static subcommands, flags, and enum values

Verification

  • All presubmit checks pass (cargo fmt, cargo clippy, cargo test, prettier)
  • Tested in a local Warp build — completions dropdown correctly shows subcommands, flags, and enum suggestions

Screenshots

Top-level subcommands (codex <TAB>):
Completions show: a, app-server, apply, cloud, cloud-tasks, completion, debug, e, exec, execpolicy, features, fork, login, logout, mcp, mcp-server, resume, review, sandbox

Exec subcommand (codex exec <TAB>):
Completions show: resume, review + all exec-specific flags (--add-dir, --cd, --color, --config, --json, --model, --sandbox, etc.)

Sandbox enum suggestions (codex exec --sandbox <TAB>):
Completions show: danger-full-access, read-only, workspace-write

Shell completions (codex completion <TAB>):
Completions show: bash, elvish, fish, powershell, zsh

Closes APP-3520

Conversation: https://staging.warp.dev/conversation/0b0973ea-2eec-44aa-97d9-47e5bbbebbc9
Run: https://oz.staging.warp.dev/runs/019d4aa5-67b0-74ff-b408-ea50ffb0ade5

This PR was generated with Oz.

Add a comprehensive completion spec for the OpenAI Codex CLI tool,
covering all subcommands (exec, review, login, logout, mcp, mcp-server,
app-server, completion, sandbox, debug, apply, resume, fork, cloud,
features, execpolicy) with their nested subcommands, flags, and arguments.

No generators needed — all completions are static.

Co-Authored-By: Oz <oz-agent@warp.dev>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 1, 2026

Add dynamic generators for:
- local_branches: git branch completion for review --base and cloud exec --branch
- commits: git commit completion for review --commit
- mcp_servers: MCP server name completion for mcp get/remove/login/logout
- feature_flags: feature flag completion for features enable/disable

Co-Authored-By: Oz <oz-agent@warp.dev>
@zachlloyd
Copy link
Copy Markdown
Contributor

Generators Added

This PR originally stated no generators were needed, but after analysis of the codex CLI, I identified several arguments that benefit from dynamic completion generators:

Generators implemented:

  1. local_branches — Completes git branch names for codex review --base, codex exec review --base, and codex cloud exec --branch. Reuses the existing git local branches generator.

  2. commits — Completes git commit SHAs for codex review --commit and codex exec review --commit. Reuses the existing git commits generator.

  3. mcp_servers — Completes configured MCP server names for codex mcp get, codex mcp remove, codex mcp login, and codex mcp logout. Parses output of codex mcp list.

  4. feature_flags — Completes feature flag names for codex features enable and codex features disable. Parses output of codex features list.

Evidence / Sources:

  • OpenAI Codex CLI reference docs — documents the --base, --commit, mcp, and features subcommands with their argument types
  • Codex CLI source repocodex mcp list and codex features list output parseable tabular data
  • Tested locally: codex mcp list outputs server names in first column, codex features list outputs feature names with stage/state columns

Screenshots of each generator working in a local Warp build follow below.

@zachlloyd
Copy link
Copy Markdown
Contributor

Generator Screenshots (Local Warp Build)

All 4 generators were tested in a local Warp build pointed at this branch. Completions were triggered by pressing Tab:

1. codex review --base — Git branches generator

Dropdown showed:

  • app-3520/command-spec-codex (labeled "Current branch")
  • main (labeled "Branch")

2. codex review --commit — Git commits generator

Dropdown showed commit SHAs with messages:

3. codex features enable — Feature flags generator

Dropdown showed all feature flags with stage and state:

  • apply_patch_freeform — under (development)
  • apps — stable (true)
  • artifact — under (development)
  • child_agents_md — under (development)
  • code_mode — under (development)
  • (more flags available via scrolling)

4. codex mcp get — MCP servers generator

Dropdown showed configured MCP server:

  • test-server — MCP server

All generators are functioning correctly.

Co-Authored-By: Oz <oz-agent@warp.dev>
@zachlloyd
Copy link
Copy Markdown
Contributor

Generator Screenshots

1. codex review --base — Git branches

branches

2. codex review --commit — Git commits

commits

3. codex features enable — Feature flags

features

4. codex mcp get — MCP servers

mcp

Add a new cloud_tasks generator that dynamically completes Codex Cloud
task IDs by parsing output from 'codex cloud list'. Wire it up for:
- codex apply TASK_ID
- codex cloud status TASK_ID
- codex cloud apply TASK_ID
- codex cloud diff TASK_ID

The generator gracefully handles unauthenticated users by returning
empty results when 'codex cloud list' reports 'Not signed in'.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link
Copy Markdown
Contributor Author

lucieleblanc commented Apr 1, 2026

Generator Testing Results

Added a new cloud_tasks generator and tested all codex generators in a local Warp build. Here are the results:

feature_flags generator (codex features enable/disable)

Shows feature flag names with their stage and state. Works for both enable and disable subcommands.

feature_flags generator - enable

feature_flags generator - disable

local_branches generator (codex review --base)

Shows local git branches with current branch marked.

local_branches generator

commits generator (codex review --commit)

Shows commit hashes with their messages.

commits generator

mcp_servers generator (codex mcp get/remove/login/logout)

Shows configured MCP servers after adding a test server (codex mcp add test-server -- echo hello).

mcp_servers generator

cloud_tasks generator (NEW - codex cloud status/apply/diff, codex apply)

The new generator runs codex cloud list to dynamically complete Codex Cloud task IDs. Since testing requires Codex Cloud authentication (not available in the test sandbox), the generator correctly returns empty results and falls back to flag completions. The code pattern is identical to the feature_flags generator above, which is confirmed working.

cloud_tasks generator (empty - not authenticated)

Summary of changes

  • Added cloud_tasks generator to codex.rs that parses codex cloud list output
  • Wired up cloud_tasks generator to TASK_ID args in: codex apply, codex cloud status, codex cloud apply, codex cloud diff
  • All tests pass including all_referenced_generators_exist

@lucieleblanc lucieleblanc marked this pull request as ready for review April 3, 2026 17:02
@lucieleblanc lucieleblanc merged commit 76ee0fb into main Apr 3, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the app-3520/command-spec-codex branch April 3, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants