Skip to content

feat(cli): generate registry-backed shell completions - #414

Merged
BramVR merged 2 commits into
mainfrom
codex/issue-400-shell-completions
Jul 31, 2026
Merged

feat(cli): generate registry-backed shell completions#414
BramVR merged 2 commits into
mainfrom
codex/issue-400-shell-completions

Conversation

@BramVR

@BramVR BramVR commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • add deterministic Bash, Zsh, Fish, and PowerShell completion generation projected from the canonical command registry
  • keep Cobra bounded to script generation and hidden completion callbacks; production parsing remains on the standard library
  • exclude hidden commands/protocols and avoid config, archive, credential, provider, and file-write effects
  • document current-session and persistent installation for all four shells

Proof

  • go test ./...
  • go test -race ./...
  • make fmt-check
  • pinned golangci-lint v2.12.2: 0 issues
  • make docs-check
  • node --test scripts/*.test.mjs
  • make docs-site
  • govulncheck ./...: no vulnerabilities found
  • Windows amd64 cross-build
  • built-script byte determinism for all four shells with and without descriptions
  • installed-shell parse/load smoke (Bash and Zsh locally; conditional Fish/PowerShell parser coverage in the test suite)
  • Codex AutoReview: clean; TruffleHog: clean

Closes #400

Copilot AI review requested due to automatic review settings July 31, 2026 06:29
@BramVR
BramVR merged commit cbf5058 into main Jul 31, 2026
7 checks passed
@BramVR
BramVR deleted the codex/issue-400-shell-completions branch July 31, 2026 06:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new gohealthcli completion subcommand that generates deterministic, registry-projected shell completion scripts (Bash, Zsh, Fish, PowerShell) while keeping the CLI’s production parsing on the standard library and using Cobra only for completion script/protocol handling.

Changes:

  • Introduces a registry-backed completion command (with --no-descriptions) and wires Cobra-based completion protocol handling ahead of stdlib flag parsing.
  • Adds comprehensive tests for script validity, determinism, completion protocol behavior, and “no side effects” (no config/archive/provider reads/writes).
  • Updates user documentation and generated command reference pages to include completion setup instructions for all four shells.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Adds completion to the top-level command list.
go.mod Adds Cobra as a dependency for completion generation/protocol support.
go.sum Records new dependency checksums (Cobra + transitive deps).
docs/install.md Documents current-session and persistent completion installation for Bash/Zsh/Fish/PowerShell.
docs/commands/completion.md New command reference page for gohealthcli completion.
docs/commands.md Adds completion to the command index.
cmd/gohealthcli/schema_test.go Updates registry coverage test to include completion.
cmd/gohealthcli/main.go Routes Cobra completion protocol requests before stdlib parsing/runtime defaults.
cmd/gohealthcli/completion.go Implements registry-projected Cobra command tree and completion script generation.
cmd/gohealthcli/completion_test.go Adds determinism/protocol/side-effect tests for completion generation.
cmd/gohealthcli/commands.go Registers the completion command and wires its Run adapter in init().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

feat(cli): generate registry-backed completions for four shells

2 participants