Capture completion hints in command metadata

This commit is contained in:
2026-11-03 03:47:23 +00:00
parent 1d193c87fe
commit 0bed76a6f7
6 changed files with 209 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
# Shell completion implementation plan
Status: Stage 1 complete. Stage 2 is next.
Status: Stages 1–2 complete. Stage 3 is next.
Implement the [shell completion roadmap](completion.md) from baseline
`2301872`. Follow the stages in order in one sprint. Intermediate stages may
@@ -62,6 +62,8 @@ this run; the focused adapter suite and the full interactive matrix pass.
## Stage 2: Capture completion hints
Status: complete.
1. Add the following public API in the root package. Add
`Completion CompletionHint` to both `FlagMeta` and `ArgumentMeta`;
existing binding constructors and their signatures stay in place.
@@ -97,6 +99,14 @@ this run; the focused adapter suite and the full interactive matrix pass.
suggestions, repeated/captured bindings keep hints, and values absent from
a suggestion list still reach the existing converter.
Completion: added the public choice and hint constructors, carried hints through
flag and operand bindings into neutral metadata, and supplied explicit boolean
choices for built-in help and reporting flags. Focused tests cover copied
choices, repeated and captured bindings, the empty-choice strategy, independent
bridge copies, and execution of values outside the suggested choices. Root,
internal adapter, and neutral metadata package tests pass with `GOWORK=off` and
`GOTOOLCHAIN=local`.
## Stage 3: Install completion as an ordinary declaration
1. Add `func Completion(executable string) Command`. The parameter is the