cli: add version command
Metadata
Current evaluation
Merged after reviewer approval and passing CI. Adds a CLI version command to snapcraft, resolving feedback on click message parameters, type checking, and whitespace before final merge.
Suggested action: —
No scores available.
Issue body
* As discussed in [LP #1590349](https://bugs.launchpad.net/snapcraft/+bug/1590349), snapcraft should return the version
number when called like snapcraft version and snapcraft --version.
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged after reviewer approval and passing CI. Adds a CLI version command to snapcraft, resolving feedback on click message parameters, type checking, and whitespace before final merge. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to add snapcraft version and snapcraft --version CLI commands. Implementation uses Click's version_option with a custom message. Static analysis, type checking, and whitespace issues were resolved during review before integration. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds a version command to the snapcraft CLI. The author addressed feedback on click usage and mypy type checking, fixed static test failures and whitespace, resolved conflicts, and updated tests before integration. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2063 many: add snapcraftctl set-version | snapcraft | merged | Merged. Adds snapcraftctl set-version to configure snap versions from scriptlets, resolving issue 1676. Provides reusable infrastructure for future setter commands. Approved by reviewer and passed CI checks. | |
| #1845 cli: implement help <command> | snapcraft | merged | Implemented snapcraft help <command> CLI functionality. Merged after passing CI checks and receiving reviewer approval. Closes issue #1699. | |
| #3626 cli: integrate craft-cli and add version command (CRAFT-730) | snapcraft | merged | Merged after integrating craft-cli and adding a version command, falling back to the legacy implementation for other functionality. Passed CI, approved, and merged. Help output remains handled by the legacy system until fully updated. | |
| #1366 cli: Add --version command | snapcraft | merged | Merged. Adds a --version CLI flag. Reviewers suggested extracting version logic to prevent circular imports. The author explained import constraints and structured the code to calculate __version__ first, resolving concerns and enabling the merge. | |
| #3683 commands: add snap command | snapcraft | merged | Merged into snapcraft/7.0. Implements legacy snap command support for package creation and fixes output parameter passing to managed instances. Approved by reviewer with passing CI checks. | |
| #3630 cli: add lifecycle command stubs (CRAFT-764) | snapcraft | merged | Merged into snapcraft/7.0. Added CLI stubs for pull, build, stage, and prime phases, falling back to legacy. Reorganized CLI tests and fixed version command tests. Approved and passed CI. |