Skip to content

feat: add --name and --description flags to commit create#183

Open
AlephNotation wants to merge 2 commits intomainfrom
fix/commit-create-name-description
Open

feat: add --name and --description flags to commit create#183
AlephNotation wants to merge 2 commits intomainfrom
fix/commit-create-name-description

Conversation

@AlephNotation
Copy link
Copy Markdown
Contributor

@AlephNotation AlephNotation commented Apr 7, 2026

Summary

Adds --name/-n and --description/-d flags to vers commit create so commits can be given human-readable names instead of the auto-generated commit: of_vm=<uuid> timestamp=<ts> format.

Closes #177

Requires: hdresearch/chelsea#1070 (API support for name/description on commit)

Usage

vers commit create --name "golden-image-v3"
vers commit create --name "pre-deploy" --description "Before deploying auth changes"
vers commit create vm-123 --name "checkpoint" --format json

Implementation

Name and description are sent directly in the POST /vm/{id}/commit request body via option.WithJSONSet. This is atomic — no follow-up PATCH call needed.

Changes

  • cmd/commit.go — Added --name/-n and --description/-d flags, updated help text and output formatting
  • internal/handlers/commit_create.go — Extended request/view with Name/Description, sends them in commit request body
  • internal/handlers/commit_create_test.go — 3 test cases: name+description, no name, name only

Tests

All unit tests pass:

ok  github.com/hdresearch/vers-cli/cmd
ok  github.com/hdresearch/vers-cli/internal/handlers

Add --name/-n and --description/-d flags to 'vers commit create' so
commits can be given human-readable names instead of the auto-generated
'commit: of_vm=<uuid> timestamp=<ts>' format.

After creating the commit, if name or description is provided, a follow-up
PATCH call is made to update the commit metadata. If the update fails, the
error is returned but the commit ID is still available.

Note: The API currently ignores name/description on the PATCH endpoint
(see #177). The CLI is ready and will work end-to-end once the API
supports it.

Closes #177
Instead of a follow-up PATCH call, send name and description in the
POST /vm/{id}/commit request body using WithJSONSet. This is simpler,
atomic, and avoids the race window where a commit exists briefly
without its metadata.

Requires the companion chelsea change that accepts name/description
on the commit endpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --name and --description flags to commit create

1 participant