feat(cli): teach completion scripts to surface config profiles #5651
+247
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
This small PR was written to solve a pain point I was experiencing. In trying to use the profiles feature extensively with local LLMs including
gpt-oss-20bandgpt-oss-120b, I wanted to be able to more quickly type out the names, and I wanted to avoid the need to reference theconfig.tomlfile to remember names, so I added tab completion. Originally developed forfish, but I added support forbashandzshas well.Description
Generates dynamic
--profilesuggestions for fish, bash, and zsh by appending small helpers that callcodex profiles list. Each script now delegates profile name discovery to the CLI instead of guessing from the filesystem, so completions stay accurate as users editconfig.toml.Adds a lightweight
codex profiles listsubcommand to feed those helpers and writes integration tests that assert the command output is wired into every supported shell. Updates the configuration docs to mention the inspection command for users who prefer to check profiles manually.(I wish there were a more elegant way to support dynamic completions in
clap, but modifying your own custom completions into the output is the most elegant way that appears to be available.clapstill does most of the work.)