Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(cli): display template version name in push output#21192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
matifali wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromfix/issue-21111-display-version-name

Conversation

@matifali
Copy link
Member

Summary

Display the template version name incoder templates push CLI output.

Problem

When runningcoder templates push without the--name flag, 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 atcli/templatepush.go:207 to include the version name in the output. The version name is styled with theKeyword style for consistency with other CLI output (like template names).

Before:

Updated version at Jan 2 15:04:05!

After:

Updated version kind_nightingale at Jan 2 15:04:05!

This works for both autogenerated names and user-specified names (via--name flag).

Test Plan

Added two new test cases incli/templatepush_test.go:

  1. TestTemplatePush/DisplayAutogeneratedVersionName - Verifies autogenerated names are displayed
  2. TestTemplatePush/DisplayUserSpecifiedVersionName - Verifies user-specified names are displayed

Both tests verify that:

  • The output contains "Updated version {name}"
  • The version name in the output matches the database record

Tests will run in CI (cannot run locally due to Docker requirements).

Closes#21111

🤖 Generated withClaude Code

Co-Authored-By: Claude Sonnet 4.5noreply@anthropic.com

Previously, when running `coder templates push` without specifying a`--name` flag, the backend would autogenerate a version name (e.g.,"kind_nightingale"), but the CLI never displayed this name to the user.This made it difficult to reference the version later.This change updates the success message to include the version name,whether it was autogenerated or user-specified.Output changes from:  "Updated version at Jan 2 15:04:05!"to:  "Updated version kind_nightingale at Jan 2 15:04:05!"Closes#21111🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The test was expecting the old output format "Updated version at" butthe new format is "Updated version {name} at". Updated the test tomatch the beginning of the output string.
The pty.Output() call was causing an error after the command completed.The test already verifies the output format with ExpectMatchContext,so we only need to verify the version was created in the database.
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull request overview

This PR enhances thecoder templates push CLI command to display the template version name (whether autogenerated or user-specified) in the success message, making it easier for users to reference the version later.

Key Changes:

  • Updated the success message format from "Updated version at {time}" to "Updated version {name} at {time}"
  • Added version name styling with the Keyword style for visual consistency
  • Added comprehensive test coverage for both autogenerated and user-specified version names

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

FileDescription
cli/templatepush.goModified success message to include version name with proper styling
cli/templatepush_test.goUpdated existing test assertion and added two new tests to verify version name display

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@matifalimatifali changed the titlefix(cli): display template version name in push outputfeat(cli): display template version name in push outputDec 9, 2025
@matifalimatifali marked this pull request as ready for reviewDecember 10, 2025 10:08
Copy link
Member

@phorcys420phorcys420 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good, and tests look fine, but i will let someone else cross check

w:=clitest.StartWithWaiter(t,inv)

pty.ExpectNoMatchBefore(ctx,"Template message is longer than 72 characters","Updated version at")
pty.ExpectNoMatchBefore(ctx,"Template message is longer than 72 characters","Updated version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we make sure that the template version matches the one exposed via API, and match the whole phraseUpdated version XYZ at?

EDIT:
I guess we could match the timestamp too, but it isn't crucial.

assert.NotEmpty(t,templateVersions[1].Name)
})

t.Run("DisplayUserSpecifiedVersionName",func(t*testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I guess we don't need a separate case for that, just modify "OK" test case :)

w:=clitest.StartWithWaiter(t,inv)

// Expect the output to contain "Updated version" followed by the version name.
pty.ExpectMatchContext(ctx,"Updated version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mtojekmtojekmtojek left review comments

@phorcys420phorcys420phorcys420 left review comments

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

@matifalimatifali

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

feat(cli): display autogenerated template name when runningcoder templates push

3 participants

@matifali@mtojek@phorcys420

[8]ページ先頭

©2009-2025 Movatter.jp