feat(cli): display template version name in push output #21192
+85
−2
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
Display the template version name in
coder templates pushCLI output.Problem
When running
coder templates pushwithout the--nameflag, the backend autogenerates a version name (e.g., "kind_nightingale") using Docker-style random names. However, the CLI never displayed this autogenerated name to the user, making it difficult to reference the version later.Fix
Updated the success message at
cli/templatepush.go:207to include the version name in the output. The version name is styled with theKeywordstyle for consistency with other CLI output (like template names).Before:
After:
This works for both autogenerated names and user-specified names (via
--nameflag).Test Plan
Added two new test cases in
cli/templatepush_test.go:TestTemplatePush/DisplayAutogeneratedVersionName- Verifies autogenerated names are displayedTestTemplatePush/DisplayUserSpecifiedVersionName- Verifies user-specified names are displayedBoth tests verify that:
Tests will run in CI (cannot run locally due to Docker requirements).
Closes #21111
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com