feat(cli): standardize version conventions (F110)#379
Merged
Conversation
- `.gitignore`: add Tower workspace dir exclusion rules - `README.md`: update command table for `@version` syntax, `upgrade [version]`, `--version` flag, and breaking change notice - `docs/getting-started/installation.md`: replace `awf version` with `awf --version` and show full output format - `docs/getting-started/quickstart.md`: remove `-v` shorthand from `--verbose` flag table - `docs/user-guide/commands.md`: update `plugin install`, `workflow install`, `upgrade`, and `--version` entries; remove `--version` flag from install commands - `docs/user-guide/plugins.md`: update install syntax to `owner/repo[@Version]`; remove `--version` flag; add exact SemVer note - `docs/user-guide/tracing.md`: replace `-v` with `--verbose` - `docs/user-guide/upgrade.md`: replace `--version <tag>` with positional arg; add exact SemVer note; remove `--version` flag entry - `docs/user-guide/workflow-packs.md`: update install examples; remove range constraint examples; add exact SemVer note - `internal/interfaces/cli/doc.go`: update doc comment for version display mechanism - `internal/interfaces/cli/plugin_cmd.go`: replace `--version` flag with `owner/repo@version` inline syntax; introduce `pluginInstallSource` and `parsePluginInstallSource`; simplify `selectRelease` - `internal/interfaces/cli/plugin_cmd_unit_test.go`: rewrite tests for new install source parsing and simplified release selection - `internal/interfaces/cli/release_target.go`: add `exactReleaseTarget`, `parseExactReleaseTarget`, `parseInstallReleaseTarget`, and `selectExactRelease` - `internal/interfaces/cli/release_target_test.go`: comprehensive unit tests for release target parsing and selection - `internal/interfaces/cli/root.go`: replace `version` subcommand with cobra `Version` field and `--version` flag; remove `-v` shorthand from `--verbose` - `internal/interfaces/cli/root_nohints_test.go`: update tests to use `--version` instead of `version` subcommand; drop stale comments - `internal/interfaces/cli/root_test.go`: rewrite version tests for `--version` flag; add tests asserting `version` subcommand is removed and `-v` shorthand is gone - `internal/interfaces/cli/upgrade.go`: replace `--version` flag with positional `[version]` arg; remove `selectTargetRelease`; delegate to `selectExactRelease` - `internal/interfaces/cli/upgrade_test.go`: rewrite upgrade tests for positional version arg and exact SemVer validation - `internal/interfaces/cli/workflow_cmd.go`: replace `--version` flag with `owner/repo@version` inline syntax - `internal/interfaces/cli/workflow_cmd_test.go`: update workflow install tests for new syntax - `tests/integration/cli/plugin_install_test.go`: expand integration tests for `@version` install syntax - `tests/integration/cli/release_target_syntax_test.go`: new integration tests for release target syntax parsing - `tests/integration/cli/workflow_install_test.go`: expand integration tests for workflow `@version` install syntax - `tests/integration/features/cli_test.go`: update CLI feature tests for convention changes Closes #378
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.
Summary
awf versionsubcommand is removed in favour ofawf --version, the-vshorthand for--verboseis dropped,--versionflags onplugin install,workflow install, andupgradeare replaced with inlineowner/repo@versionsyntax and a positional argument respectively>=1.0.0 <2.0.0) with strict exact SemVer only — both bare (1.2.3) and v-prefixed (v1.2.3) are accepted; ranges,latest, and partial versions are rejected before any network callexactReleaseTargettype andselectExactReleasefunction to unify version parsing and release resolution acrossplugin install,workflow install, andupgradeeffectiveCLIVersionto treat dirty git-describe builds (v0.8.1-dirty) as dev builds, so pack version constraints behave correctly outside production releasesChanges
Core CLI
internal/interfaces/cli/root.go: RemovenewVersionCommand; wire Cobra's built-inVersionfield andSetVersionTemplateforawf --version; drop-vshorthand from--verboseinternal/interfaces/cli/doc.go: Update package-level comment to reflect--versionflag instead ofnewVersionCommandinternal/interfaces/cli/release_target.go: New file —exactReleaseTarget,parseExactReleaseTarget,parseInstallReleaseTarget,selectExactReleaseshared across all install/upgrade pathsPlugin Command
internal/interfaces/cli/plugin_cmd.go: Remove--versionflag and constraint-basedselectRelease; parse version fromowner/repo@versioninline arg viaparsePluginInstallSource; delegate release selection toselectExactReleaseWorkflow Command
internal/interfaces/cli/workflow_cmd.go: Remove--versionflag andparseOwnerRepoAndVersion; delegate toparseInstallReleaseTargetandselectExactRelease; fixeffectiveCLIVersionto cover dirty buildsUpgrade Command
internal/interfaces/cli/upgrade.go: Replace--versionflag with[version]positional argument; removeselectTargetReleasein favour ofselectExactRelease; validate exact SemVer before any release lookupTests — Unit
internal/interfaces/cli/release_target_test.go: New file — comprehensive unit tests forparseExactReleaseTarget,parseInstallReleaseTarget, andselectExactReleaseinternal/interfaces/cli/plugin_cmd_unit_test.go: Replace constraint-based test cases with@versionsyntax tests; verify--versionflag is unknown and invalid targets fail before network callsinternal/interfaces/cli/root_test.go: ReplaceTestVersionCommand/TestRootCommandHasVersionSubcommandwith--versionflag assertions; add tests confirming-vis no longer assignedinternal/interfaces/cli/root_nohints_test.go: Update all test args fromversionsubcommand to--version; remove stale inline commentsinternal/interfaces/cli/upgrade_test.go: ReplaceselectTargetReleasetests withselectExactRelease; add tests for positional arg, removed flag rejection, and pre-lookup validationinternal/interfaces/cli/workflow_cmd_test.go: Update callers toowner/repo@versioninline syntax; fixeffectiveCLIVersiondirty-build expectationTests — Integration
tests/integration/cli/release_target_syntax_test.go: New file — end-to-end integration tests validating@versionsyntax parsing for both plugin and workflow install commandstests/integration/cli/plugin_install_test.go: UpdateTestPluginInstall_VersionConstraintstoTestPluginInstall_Versionusing@versioninline syntax; addreadPluginSourceDatahelpertests/integration/cli/workflow_install_test.go: Migrate all version tests from--versionflag to@versioninline argtests/integration/features/cli_test.go: Update feature-level CLI tests for new conventionsDocumentation
README.md: Update command table and add breaking-change calloutdocs/getting-started/installation.md: Changeawf versiontoawf --version; fixAWF_VERSIONenv var placement in install script exampledocs/getting-started/quickstart.md: Remove-vshorthand from--verboseflag tabledocs/user-guide/commands.md: Update all command signatures, flag tables, and examples; replaceawf versionsection withawf --versiondocs/user-guide/plugins.md: Updateplugin installargument format and examples to@versionsyntax; remove--versionflag rowdocs/user-guide/tracing.md: Replace-vwith--verbosein exampledocs/user-guide/upgrade.md: Replace--version <tag>with positional[version]argumentdocs/user-guide/workflow-packs.md: Updateworkflow installexamples to@versionsyntax; remove constraint examplesRepo
.gitignore: Track Tower workspace config (!.tower/config.toml) while ignoring generated index and extension binariesTest plan
awf --versionprintsawf version X.Y.Z,commit: …,built: …on three lines;awf versionreturnsunknown command "version"awf plugin install owner/[email protected]resolves and installs exactly v1.2.3;--version 1.2.3is rejected as unknown flagawf workflow install owner/[email protected]resolves and installs exactly v1.2.0;--version >=1.0.0is rejected as unknown flag; range syntaxowner/repo@>=1.0.0fails before any network callawf upgrade v0.5.0installs v0.5.0;awf upgrade --version v0.5.0fails as unknown flag;awf upgrade latestfails before any release lookup with format errorgo test ./internal/interfaces/cli/... ./tests/integration/cli/...Closes #378
Generated with awf commit workflow