Skip to content

feat(cli): add json output for policy get#1471

Closed
xmh1011 wants to merge 1 commit into
NVIDIA:mainfrom
xmh1011:fix/1034-policy-get-json
Closed

feat(cli): add json output for policy get#1471
xmh1011 wants to merge 1 commit into
NVIDIA:mainfrom
xmh1011:fix/1034-policy-get-json

Conversation

@xmh1011
Copy link
Copy Markdown

@xmh1011 xmh1011 commented May 20, 2026

Summary

Adds JSON output support to openshell policy get so users can inspect policy revision metadata and full policy payloads with tools like jq.

Related Issue

Fixes #1034

Changes

  • Added --json to openshell policy get.
  • Added JSON rendering for sandbox-scoped and global policy revisions.
  • Includes .revision.policy only when --full is passed.
  • Added CLI parsing and JSON-shape unit tests.
  • Updated policy workflow docs with a jq example.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Ran:

  • cargo fmt --all -- --check
  • cargo test -p openshell-cli policy_get_accepts_json --bin openshell
  • cargo test -p openshell-cli policy_get_json --lib
  • cargo clippy -p openshell-cli --all-targets -- -D warnings
  • git diff --check

Note: mise run pre-commit could not be run locally because mise is not installed in this environment.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 20, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions
Copy link
Copy Markdown

Thank you for your interest in contributing to OpenShell, @xmh1011.

This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer.

To get vouched:

  1. Open a Vouch Request discussion.
  2. Describe what you want to change and why.
  3. Write in your own words — do not have an AI generate the request.
  4. A maintainer will comment /vouch if approved.
  5. Once vouched, open a new PR (preferred) or reopen this one after a few minutes.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this May 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@xmh1011
Copy link
Copy Markdown
Author

xmh1011 commented May 20, 2026

I have read the DCO document and I hereby sign the DCO.

@xmh1011
Copy link
Copy Markdown
Author

xmh1011 commented May 20, 2026

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support --json in openshell policy get

1 participant