fix(cli): add json output for policy get#1410
Conversation
|
We added |
09ebe77 to
141d190
Compare
|
Updated in
I removed the visible
|
johntmyers
left a comment
There was a problem hiding this comment.
Code Review
I reviewed this with @principal-engineer-reviewer. No blocking P1/P2 correctness or security issues found. The implementation reuses the canonical policy serializer and does not affect policy enforcement.
Findings
-
[P3]
crates/openshell-cli/src/main.rs:1505
The--fullhelp text still says “Print the full policy as YAML,” but--full -o jsonnow emits JSON. Use format-neutral text likeInclude the full policy payload. -
[P3]
crates/openshell-cli/src/run.rs:5673
The JSON output path is not covered by a run-level test. Current tests cover clap parsing and policy schema serialization, but notpolicy get --full -o jsonstdout. Add a fake-gRPC CLI test that asserts valid JSON with metadata plus.policy.network_policies.
Testing: I did not run tests, builds, CI, or status checks. I inspected the diff and surrounding code; git diff --check origin/main...origin/pr-1410 was clean.
Summary
-o/--output jsontoopenshell policy get, matching the CLI output flag pattern already used by provider commands.--fullis set.Related Issue
Closes #1034
Changes
PolicyGetOutputvalue enum through the policy get CLI path.Testing
cargo test -p openshell-cli policy_get_json_output_parsescargo test -p openshell-policy serialized_json_uses_policy_schema_keysgit diff --checkMISE_DISABLE_UPDATE_CHECK=1 /root/.local/bin/mise run pre-commitChecklist