Add Cobra-backed command parsing

This commit is contained in:
2026-10-07 13:27:00 +00:00
parent 82128463cd
commit f206c531f1
7 changed files with 500 additions and 4 deletions

View File

@@ -2,8 +2,9 @@
CommandKit currently contains adopted repository policies, accepted architectural
decisions, implementation plans, identity and outcome primitives, typed command
declarations, and an instance-owned registry. Command execution is not implemented
yet. The [README](../README.md) provides project orientation; the
declarations, an instance-owned registry, and a Cobra-backed routing and parsing
adapter. Public invocation coordination is not implemented yet. The
[README](../README.md) provides project orientation; the
[documentation policy](policy/documentation.md#canonical-ownership) assigns
canonical documentation owners.

View File

@@ -1,6 +1,6 @@
# Initial CommandKit implementation plan
Status: implementation underway; Stages 1-3 complete and Stages 4-14 pending.
Status: implementation underway; Stages 1-4 complete and Stages 5-14 pending.
Date: 2026-10-07.
@@ -294,7 +294,7 @@ preparation parses supplied values without enforcing omitted required values.
## Stage 4: implement the internal Cobra adapter
**Status:** pending. **Prerequisite:** Stage 3.
**Status:** complete. **Prerequisite:** Stage 3.
1. Create `internal/cobra` with neutral tree/flag/operand declarations and fresh
per-run binding factories. A bridge declaration contains path metadata,
@@ -338,6 +338,12 @@ parser causes without scanning their object graphs.
unknown flags, boolean spellings, last-wins/repetition, help with missing required
inputs, and fresh consecutive parses. Confirm the root does not import Cobra/pflag.
**Completion evidence:** internal adapter and root-to-adapter integration tests
cover command routing, local flags, interspersed operands, `--`, boolean presence
and explicit false, repeated raw values, help parsing, group failures, and fresh
parse state. `go test ./...` passes; the root package's direct imports include
only the internal adapter and not Cobra or pflag.
## Stage 5: implement invocation and diagnostic delivery
**Status:** pending. **Prerequisite:** Stage 4.