configure-completions
Shell completions for a released CLI: generator subcommand, Homebrew/archive/installer delivery, drift test. Use when a repo ships a CLI binary, to add or audit its completions.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 60
- Forks
- 6
01 前言 Front Matter
- args
- [--check-only] [--fix]
- name
- configure-completions
- created
- 1793318400000
- modified
- 1793318400000
- reviewed
- 1793318400000
- description
- Shell completions for a released CLI: generator subcommand, Homebrew/archive/installer delivery, drift test. Use when a repo ships a CLI binary, to add or audit its completions.
- allowed-tools
- Glob, Grep, Read, Write, Edit, Bash(cargo *), Bash(go *), Bash(uv *), Bash(just *), Bash(git status *), Bash(git diff *), Bash(git add *), Bash(find *), Bash(test *), Bash(bash -n *), Bash(zsh -n *), Bash(fish -n *), AskUserQuestion, TodoWrite
- argument-hint
- [--check-only] [--fix]
02 资源文件 1
- 参考文档REFERENCE.md6.2 KB
03 SKILL.md 正文
/configure:completions
Make every CLI a repo releases ship shell completions, through every channel a user can install it from, with a test that keeps committed scripts current.
When to Use This Skill
| Use this skill when... | Use another approach when... |
|---|---|
A repo releases a CLI binary and has no completions command |
The Typer/Click --install-completion mechanics themselves are the problem — python-plugin:typer-cli-completion |
| Auditing that Homebrew, archives and installers all deliver completions | Setting up the release pipeline itself — /configure:release-please, /configure:workflows |
| Completions exist but nothing stops the committed scripts drifting | The repo ships a library, not a CLI — this standard is N/A |
Context
- Rust bins: !
find . -maxdepth 3 -name Cargo.toml -not -path '*/target/*' - Go modules: !
find . -maxdepth 2 -name go.mod - Python projects: !
find . -maxdepth 2 -name pyproject.toml - cargo-dist config: !
find . -maxdepth 1 \( -name 'dist-workspace.toml' -o -name 'dist.toml' \) - GoReleaser config: !
find . -maxdepth 1 \( -name '.goreleaser.yml' -o -name '.goreleaser.yaml' \) - Committed completion scripts: !
find . -type d -name completions -not -path '*/.git/*' -not -path '*/target/*' -not -path '*/node_modules/*' - Project standards: !
find . -maxdepth 1 -name '.project-standards.yaml'
Parameters
| Parameter | Description |
|---|---|
--check-only |
Report the compliance table; write nothing |
--fix |
Apply every missing piece without prompting |
Default (no flag): report, then ask before applying fixes.
The Standard
A released CLI is compliant when all three hold:
-
Generator — the binary prints its own completion script, generated from the CLI definition:
<bin> completions <shell>(clap), the built-incompletioncommand (cobra), or--show-completion(Typer). Never a hand-written script. -
Every install channel delivers them:
Channel Delivery Homebrew formula/cask generate_completions_from_executableruns the generator at installRelease archives pre-generated bash/zsh/fish scripts in a completions/directoryShell installer, cargo install,go install,uv tool install/pipx, sourcedocumented eval "$(<bin> completions zsh)"lines (these installers cannot place completion files) -
No drift — committed scripts are compared with generator output by a test in the normal suite, and a recipe (
just completions) regenerates them. Channels that run the generator at install or shell start cannot drift; only committed copies can.
Execution
Execute this completions compliance workflow:
Step 1: Decide applicability
Find the released binaries: [[bin]]/[package.metadata.dist] (Rust),
package main + a .goreleaser.y*ml builds entry (Go),
[project.scripts] (Python). No released binary → report N/A and stop.
Step 2: Detect the framework and channels
- Framework:
clapin Cargo.toml,github.com/spf13/cobrain go.mod,typer/clickin pyproject.toml. Another framework → report it and check whether it has a generator before proposing anything. - Channels: cargo-dist
installers(shell, homebrew, powershell, npm), GoReleaserhomebrew_casks/brews/archives, a tap repo, PyPI.
Step 3: Check each requirement
Report one row per requirement, each with the evidence that decides it:
| Requirement | PASS evidence |
|---|---|
| Generator | <bin> completions bash (or the framework's form) exits 0 and prints a script |
| Homebrew | the published formula/cask contains generate_completions_from_executable — read the tap file, not the generator config |
| Archives | the archive listing contains completions/ (e.g. tar -tJf on a local dist build) |
| Installer docs | README or usage doc shows the eval/source lines |
| Drift test | a test reads the committed scripts and compares them with generator output |
| Regenerate recipe | a justfile/Makefile target writes the scripts from the generator |
Step 4: Apply fixes (--fix or confirmed)
Per framework, use the templates in REFERENCE.md:
- Rust / clap: add
clap_complete, aCompletions { shell: Shell }subcommand, committed scripts, the drift test; with cargo-dist,includethe scripts and patch the generated formula (dist's formula installs only executables). - Go / cobra: the default
completioncommand already exists unlessCompletionOptions.DisableDefaultCmdis set; wire GoReleaser'sgenerate_completions_from_executablewithshell_parameter_format: cobra. - Python / Typer or Click: see
python-plugin:typer-cli-completionfor generating scripts from a non-shell parent; Homebrew usesshell_parameter_format: :typeror:click.
Then add the docs section and the regenerate recipe, regenerate, and
syntax-check the scripts (bash -n, zsh -n, fish -n).
Step 5: Prove the drift test bites
Append a line to one committed script, run the test, confirm it fails with the regenerate hint, restore the file. A drift test never seen failing is not evidence.
Step 6: Update standards tracking
components:
completions: "2025.1"
completions_framework: "[clap|cobra|typer|click]"
completions_channels: [homebrew, archives, docs]
Step 7: Report
Print the compliance table, the files changed, and anything only a release can
verify (a patched formula is exercised by the next publish). Under
--check-only, prefix with "DRY RUN — no files modified".
Agentic Optimizations
| Context | Command |
|---|---|
| Audit only | /configure:completions --check-only |
| Apply all fixes | /configure:completions --fix |
| Generator smoke | <bin> completions bash > /dev/null && echo ok |
| Archive contents (cargo-dist) | dist build --artifacts=local --target <triple> then tar -tJf target/distrib/*.tar.xz |
| Syntax-check scripts | bash -n completions/<bin>.bash && zsh -n completions/_<bin> |
See Also
- REFERENCE.md — per-framework templates and the cargo-dist formula patch
python-plugin:typer-cli-completion— Typer/Click generation from a non-shell parent/configure:release-please— the release pipeline these channels hang off
04 同仓库更多 Skills
kitty-show-image
Show the user an image with a note on what to judge, via a file send or a labelled kitty tab. Use when the user must see an image, or icat fails with no /dev/tty.
kitty-session-persistence
Snapshot and restore kitty terminal sessions on macOS. Use when surviving WindowServer hangs without losing tabs, configuring snapshots, or restoring after a force-reboot.
kitty-remote-control
Safe kitty remote control from an agent — read panes with kitty @ ls/get-text, notify, and never mutate the live terminal unasked. Use when running inside kitty.
docs-reference-check
Dangling doc-reference gate: flag markdown naming repo paths or relative links that no longer exist. Use when docs cite moved/deleted files, or wiring a doc-drift lint.
youtube-upload
Upload a video to YouTube via the Data API v3 and edit its title, description, tags or thumbnail afterwards. Use when publishing or retitling a YouTube video.
youtube-studio-share
Share a private YouTube video with a whole Google Workspace organization by scripting YouTube Studio in the browser. Use when a video must be org-only.