feat: add -o yaml and -o json to tkn version - #3299
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The no-kubeconfig path rejects the valid hub component, and the generated examples are incorrectly formatted.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds JSON/YAML output support to tkn version, including component-specific output.
Changes:
- Adds
-o json|yamland validation. - Adds structured-output tests.
- Regenerates command and manpage documentation.
| File | Description |
|---|---|
pkg/cmd/version/version.go |
Implements structured version output. |
pkg/cmd/version/version_test.go |
Tests formats, components, and errors. |
docs/man/man1/tkn-version.1 |
Updates generated manpage. |
docs/cmd/tkn_version.md |
Updates generated command reference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6d08043 to
a3aad4a
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Invalid components can still exit successfully, and the new examples generate malformed documentation formatting.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (2)
a3aad4a to
f7f554a
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
divyansh42
left a comment
There was a problem hiding this comment.
Changes looks good to me.
One small observation (not blocking): the if formatted.IsStructured(output) check is now repeated for every component case, which adds quite a bit of duplication. This pattern was already there before your PR, but it got amplified. Might be worth filing a follow-up issue to refactor this later - something like collecting all the version data first, then deciding how to output it once. Would cut down a lot of the repetitive code. But that's definitely a separate cleanup task, not something to hold up this PR.
f7f554a to
4a60b75
Compare
|
/lgtm |
Allow `tkn version -o json|yaml` and allow the same with --component. Signed-off-by: Anwesha Palit [apalit@redhat.com] Assisted-by: Grok 4.6 via Cursor
4a60b75 to
59685f1
Compare
|
/lgtm |


Changes
Added
-o/--outputsupport totkn version.jsonandyamloutput fortkn version.--component.Examples:
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
make checkmake generatedSee [[the contribution guide](https://github.com/tektoncd/cli/blob/main/CONTRIBUTING.md)](https://github.com/tektoncd/cli/blob/main/CONTRIBUTING.md) for more details.
Release Notes