ref:main

feat(standards): Phase 2 CLI — STD-/REQ- prefix routing + standards flags #19

merged colechristensen cole.christensen@gmail.com wants to merge phase-2-standards-cli into main

CLI half of Phase 2 of fangorn/anvil#250 (issue #252). Pairs with the server PR fangorn/anvil#152.

Summary

`anvil requirement create` now infers kind from the `requirement_id` prefix:

  • `STD-…` → POSTs to the new org-scoped `/:org/standards`
  • `REQ-…` → POSTs to the existing repo-scoped `/:org/:repo/requirements`

New flags

  • `–organization ` — required for `STD-*`
  • `–framework`, `–citation`, `–framework-version`, `–authority`, `–effective-date`, `–mandatory` — standards-only
  • `–external-url`, `–source` — both kinds
  • `–kind requirement|standard|all` on `list` — default `requirement` (no behavior change)
  • `–framework`, `–mandatory` on `list –kind standard` — server-side filters

Helpful errors (instead of silent misroutes)

Trigger Message
`–repo` with `STD-*` ID "drop –repo and pass –organization"
`–organization` with `REQ-*` ID "REQ-* are repo-scoped"
`–framework` (etc) with `REQ-*` "standards-only flags cannot be used"
Unknown prefix "IDs must start with REQ- or STD-"

`anvil requirement view ` also infers kind from the prefix and renders the standards metadata block (framework / citation / authority / etc) for `STD-*` IDs.

Implementation notes

The `Create` enum variant grew enough to trip `clippy::large_enum_variant` — moved its fields into a named `CreateArgs` struct and wrapped the variant in `Box`, matching the existing pattern used by the `Status` variant.

Requirements

  • REQ-STD-012 — create/view/list route by STD-/REQ- prefix and surface standards-specific flags.
  • REQ-STD-013 — `list –kind` filter.

Test plan

  • `cargo test –release` — 50/50 (7 new tests for prefix inference, standards-flag detection, and each helpful-error path).
  • `cargo clippy –all-targets – -D warnings` — clean.
  • `cargo fmt –all – –check` — clean.
  • `cargo build –release` — clean.

Pair PR

Server: fangorn/anvil#152.

Created May 23, 2026 at 22:38 UTC | Merged May 24, 2026 at 01:44 UTC by colechristensen cole.christensen@gmail.com