feat(version): print complete version information as JSON - #4821
Merged
Merged
Conversation
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches the documented contract and has appropriate positive and negative test coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Adds complete, script-friendly JSON output to specify version while preserving existing human-readable views.
Changes:
- Adds runtime, system, CLI version, and feature fields to JSON output.
- Provides sanitized JSON errors and stable OpenSSL-unavailable handling.
- Adds comprehensive tests and command-reference documentation.
| File | Description |
|---|---|
src/specify_cli/command_version.py |
Implements complete JSON output and error handling. |
tests/specify_cli/test_command_version.py |
Covers success, failure, compatibility, and OpenSSL cases. |
docs/reference/core.md |
Documents the new JSON contract. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make
specify version --jsonprint complete version information directly as JSON, with top-levelcli_version,runtime,system, andfeaturesfields. The existing human version display and focused--featuresview remain unchanged. Combining--featuresand--jsonproduces the same complete JSON output.The existing command rejects
--jsonalone and writes its human error to stdout; combining the options emits a provisional features-only object. This change makes--jsonusable directly and intentionally replaces that provisional shape with the complete version data.Success writes one JSON object to stdout with empty stderr. Unavailable OpenSSL information is represented by
runtime.openssl: null. Unexpected information-collection failures exit nonzero, leave stdout empty, and emit one sanitized JSON error object to stderr without exposing exception text or tracebacks.Scope is limited to the version command, its mirrored tests, and concise command-reference documentation. No sibling commands or shared JSON infrastructure are changed.
Testing
uv run specify --helpuv sync && uv run pytestThe test checkbox above is left unchecked because validation used the documented worktree-local interpreter instead of
uv run pytest. A sample project is not applicable to this project-independent command.Validation after merging upstream
main:uv sync --extra test— passed..venv/bin/python -m pytest tests/specify_cli/test_command_version.py -q— 9 passed..venv/bin/python -m pytest tests/specify_cli/test_*version*.py -q— 140 passed, 1 skipped..venv/bin/python -m pytest tests -q— 9,511 passed, 19 skipped; 9,530 tests collected. The command suite increases from 7 tests upstream to 9; no collection is removed.uvx ruff@0.15.0 check src tests— passed.npx --yes markdownlint-cli2 docs/reference/core.md— passed.git diff --check upstream/main...HEAD— passed.uv run specify --help— passed..venv/bin/specify version --jsonand.venv/bin/specify version --features --json— passed; output was checked for the exact four top-level fields, byte-identical payloads, and empty stderr..venv/bin/specify versionand.venv/bin/specify version --features— passed with empty stderr.Tests assert deterministic output and stream purity, equivalence of the combined options, unavailable OpenSSL handling, and sanitized unexpected failures. Before the implementation, the canonical invocation exited 1 with a human error on stdout; after it, the regression tests pass with complete JSON output.
AI Disclosure
AI disclosure: GitHub Copilot, using GPT-5.6 Sol and subsequently GPT-6.1 Sol, implemented the code, tests, and documentation on behalf of @mnriem. The agents ran in autonomous mode with the session-provided reasoning configuration and applied the contributor's requested output and documentation adjustments. Copilot ran the reported automated validation, authored the commits and PR text, and merged upstream updates without rewriting published history. No personal human execution of the tests or line-by-line human review is claimed.