Skip to content

feat: add --json flag to proofline status - #70

Open
mnaveedkhtri-ui wants to merge 1 commit into
prooflinedev:mainfrom
mnaveedkhtri-ui:feat/status-json
Open

mnaveedkhtri-ui wants to merge 1 commit into
prooflinedev:mainfrom
mnaveedkhtri-ui:feat/status-json

Conversation

@mnaveedkhtri-ui

Copy link
Copy Markdown

Why

In automation scripts, CI/CD jobs, pre-commit/pre-push hooks, and developer environments (e.g. IDE extensions or local tooling), scripts need to verify if the Proofline CLI is authenticated and connected, check the active organization ID, and inspect token scopes or expiration time without fragile regex parsing of human-readable terminal output.

Currently, commands like proofline review, proofline ci review, proofline stop, and proofline reviews support structured JSON output, while proofline status only emitted plain text.

What changed

Added proofline status --json:

  • Added StatusArgs with a --json flag to Command::Status.
  • When --json is specified, outputs a structured JSON object containing:
    • console: origin URL
    • organization_id: UUID
    • token: token source name (PROOFLINE_TOKEN or OS keychain)
    • scopes: token scopes (or null)
    • expires_at: expiration timestamp (or null)
    • expires_in_hours: remaining hours (or null)
    • expired: boolean indicating expiration (or null)
    • server: object with accepted: bool and human-readable server verdict/message
  • Preserves 100% backward compatibility for standard terminal text output when --json is omitted.
  • Preserves the exit code contract: exits non-zero if the server rejects the token or reports an error.
  • Added comprehensive integration test in tests/http.rs (status_json_reports_structured_metadata_and_respects_server_outcome).
  • Documented --json flag on proofline status in README.md.

Example:

proofline status --json

Output:

{
  "console": "https://app.proofline.sh",
  "organization_id": "00000000-0000-0000-0000-000000000000",
  "token": "PROOFLINE_TOKEN",
  "scopes": "review:read review:write",
  "expires_at": null,
  "expires_in_hours": null,
  "expired": null,
  "server": {
    "accepted": true,
    "message": "accepted the token"
  }
}

Verification

  • tests/http.rs: Added status_json_reports_structured_metadata_and_respects_server_outcome covering both 200 OK acceptance and 401 Unauthorized refusal scenarios.
  • Verified schema shape and non-zero exit code propagation on server rejection.
  • Verified standard human-readable text output remains unchanged when --json is not provided.

This branch has not been deployed

No deployments
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.

1 participant