feat: add shell completions and improve switch UX#111
Conversation
|
Thanks, this looks great overall! A few requests before we move forward:
|
|
Thanks for the review. I addressed the requested follow-up changes in this PR:
I also rechecked the completion flows after the shell-specific updates and pushed the follow-up changes to this same PR. |
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge; all changed Zig paths are tested and the memory management in writeUniqueCandidate is correct. The memory ownership pattern in writeUniqueCandidate (dupe to errdefer to print to putNoClobber) is correct. Shell script generation is straightforward string output with good test coverage. The Bash colon word-break behavior and the unreachable Zsh switch branch are UX and maintenance concerns that do not affect correctness of the current release. src/cli/completion.zig — Bash colon word-break handling and the unreachable Zsh switch branch in the args state deserve a second look before the next completion iteration. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["codex-auth completion shell"] --> B["writeCompletion()"]
B --> C1["writeBashCompletion()"]
B --> C2["writeZshCompletion()"]
B --> C3["writeFishCompletion()"]
C1 & C2 & C3 --> D["Installed script calls: codex-auth completion query switch"]
D --> E["handleCompletion(.query)"]
E --> F["writeSwitchQueryCompletion()"]
F --> G["loadRegistry + buildDisplayRows"]
G --> H["writeUniqueCandidate() outputs NUM TAB EMAIL per line"]
H --> I1["Bash: awk to NUM:EMAIL + cut to EMAIL"]
H --> I2["Zsh: compadd NUM with email as description"]
H --> I3["Fish: NUM shown, email as hint"]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["codex-auth completion shell"] --> B["writeCompletion()"]
B --> C1["writeBashCompletion()"]
B --> C2["writeZshCompletion()"]
B --> C3["writeFishCompletion()"]
C1 & C2 & C3 --> D["Installed script calls: codex-auth completion query switch"]
D --> E["handleCompletion(.query)"]
E --> F["writeSwitchQueryCompletion()"]
F --> G["loadRegistry + buildDisplayRows"]
G --> H["writeUniqueCandidate() outputs NUM TAB EMAIL per line"]
H --> I1["Bash: awk to NUM:EMAIL + cut to EMAIL"]
H --> I2["Zsh: compadd NUM with email as description"]
H --> I3["Fish: NUM shown, email as hint"]
Reviews (6): Last reviewed commit: "fix: avoid completion key double free" | Re-trigger Greptile |
@loongphy/codex-auth-darwin-arm64
@loongphy/codex-auth-darwin-x64
@loongphy/codex-auth-linux-arm64
@loongphy/codex-auth-linux-x64
@loongphy/codex-auth-win32-arm64
@loongphy/codex-auth-win32-x64
@loongphy/codex-auth
commit: |
|
Merge review on 2026-07-05: not merging yet. Blockers: (1) PR checks are not green: GitHub reports mergeStateStatus=UNSTABLE and Build & Test (windows-latest) is failed/cancelled, while other checks are passing. (2) The branch is stale against current main: origin/main is 34 commits ahead of PR head 2ae55f1, so the successful checks are for an old head. (3) Existing completion review issues still reproduce in the PR diff: generated Bash/Zsh/Fish command lists omit the current top-level app command, and Zsh switch completion reads the number+email TSV but only offers the email column. Local probes: git merge-tree produced a clean synthetic merge tree and git diff --check was clean, so I did not find a textual conflict. Local Zig validation could not be run in the worker because zig is not installed. Please update/rebase the PR, fix the completion gaps, and rerun CI (including Windows) before merge. |
|
Additional merge review on 2026-07-05: still not merging. Evidence:
Please update/rebase the branch, fix/resolve the completion review issues, and rerun CI including Windows before merge. |
|
Worker merge review on 2026-07-05: not merging. Current blockers:
Please update/rebase the branch, fix the completion gaps, and rerun CI including Windows before merge. |
|
Worker merge review on 2026-07-05: still not merging PR #111. Fresh evidence:
Please update/rebase the branch onto current main, fix the completion command coverage and Zsh switch suggestions, and rerun CI including Windows before merge. |
2ae55f1 to
1f7d55d
Compare
|
I pushed the follow-up fixes in This update addresses the remaining completion review items:
Local validation:
GitHub created new CI runs for this commit, but they are currently marked |
Summary
codex-auth completion <shell>cxalias from the package and docsDetails
completion bash,completion zsh, andcompletion fishcxnpm binary alias and related docs/examplesEscexit handling and arrow-key navigationValidation
HOME=/tmp/codex-auth-pr-update ZIG_GLOBAL_CACHE_DIR=/tmp/codex-auth-pr-update/zig-global-cache ZIG_LOCAL_CACHE_DIR=/tmp/codex-auth-pr-update/zig-local-cache zig build run -- listScreenshots
Fish command completion
Fish switch suggestions
Bash switch suggestions
Zsh command completion
Zsh switch suggestions