ref:6532c17ef9e6ac3f21d5e922c5486c95f2cbf1f3

feat(standards): anvil requirement matrix honors --json for both kinds

The global --json flag was already wired through set_json_mode/is_json in src/output.rs but the matrix path emitted human tables regardless. Both matrix_requirements and matrix_standards now short-circuit on output::is_json() and pretty-print the server's response verbatim. Useful for piping into compliance dashboards, SOC2 audit exports, or ad-hoc jq queries: anvil --json requirement matrix --kind standard --organization fangorn \ | jq '.matrix[] | select(.standard.mandatory) | .standard.requirement_id' Server response shape is stable per REQ-STD-025, so the JSON is already a documented contract — no transformation needed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
SHA: 6532c17ef9e6ac3f21d5e922c5486c95f2cbf1f3
Author: CI <ci@anvil.test>
Date: 2026-05-24 22:56
Parents: 40a6a03
1 files changed +16 -0
Type
src/commands/requirement.rs +16 −0
@@ -1093,6 +1093,12 @@
let resp: serde_json::Value = client
.get(&format!("/{org}/{name}/requirements/matrix"))
.await?;
if output::is_json() {
output::print_json(&resp);
return Ok(());
}
let entries = resp
.get("matrix")
.and_then(|v| v.as_array())
@@ -1125,6 +1131,16 @@
let org = organization.ok_or("--kind standard requires --organization <slug>")?;
let client = Client::from_config()?;
let resp: serde_json::Value = client.get(&format!("/{org}/standards/matrix")).await?;
// Pipeable JSON output when invoked with the global --json flag.
// Re-emits the server's response verbatim — the structure is already
// stable per REQ-STD-025 and downstream tools (compliance dashboards,
// SOC2 audit exports) can consume it directly.
if output::is_json() {
output::print_json(&resp);
return Ok(());
}
let entries = resp
.get("matrix")
.and_then(|v| v.as_array())