feat(commit): add --tag and --public flags to commit create#203
Merged
Conversation
Contributor
Author
|
Ran the live-API smoke checks the worker flagged. All six scenarios behave correctly against prod:
The stderr warning is particularly nice — it's a textbook agent-native error message: tells the agent what went wrong, why it matters ("tag references a private commit and will not be reachable"), and exactly how to fix it. Both Test artifacts cleaned up: tags deleted, commits deleted, VMs deleted. Ready to merge from my end. Unblocks #202. |
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.
Closes #201. Unblocks #202.
Collapses the create+tag+publish dance into a single
vers commit createinvocation.What ships
Two new flags on
vers commit create:--tag <repo>:<tag>(repeatable,StringSliceVar)<repo>:<tag>shape before any side effects. Malformed input emits the enumerated form from principle 3:error: --tag must be in <repo>:<tag> form (got: "v1.2").error: repo "<name>" not found. Create it first with: vers repo create <name>— no commit is created.HandleRepoTagUpdateto point at the new commitHandleRepoTagCreatepointing at the new commit--publicis_public=trueon the new commit via the existingHandleCommitUpdatepath.--tagtarget repo isis_public: trueand--publicwas not supplied, awarning:line goes to stderr suggesting--public. Does not auto-publish (the conservative recommendation in Add--tag(repeatable) and auto-publish tovers commit create#201).Output shape
{ "commit_id": "...", "vm_id": "...", "name": "...", "tags_written": [ { "reference": "my-app:v1", "tag_id": "..." }, { "reference": "my-app:latest", "tag_id": "..." } ], "is_public": true }tags_writtenandis_publicareomitempty, so unaffected flows still produce the existing JSON shape byte-for-byte.Files
cmd/commit.go— flag declarations + wiring; text-mode render delegated to a new presenter helper.internal/handlers/commit_create.go— validation, repo pre-flight, tag create/update branch, publish, warning.internal/presenters/commits_types.go—CommitCreateView+CommitTagWrittenmoved here (handlers re-exports via type alias to keep callers stable).internal/presenters/commits_presenter.go—RenderCommitCreatefor text mode (mentions tags written + visibility).internal/handlers/commit_create_test.go— table of new cases: bad format, missing repo (no commit created), tag-create-new, tag-update-existing,--publictriggers publish, public-repo visibility warning.README.md— short mention of the new flags.Verification
make build✓gofmt -l cmd/ internal/empty ✓go test ./internal/... ./cmd/...✓./bin/vers agent-context | jq '.commands.commit.subcommands.create.flags."--tag"'returns the newstringSliceflag ✓Manual smoke against an authenticated API is left to the reviewer; the unit tests cover every branch with a mock server matching the SDK's URL shape.
Out of scope
vers publishtop-level command — tracked in #202 as a separate PR that depends on this one.