Add Cobra Version

Add a version subcommand with build metadata to an existing Cobra-based Go CLI. Use when the user says "add a version subcommand", "add the version command", "wire up version, commit, and date", "add build metadata to version", "add a /version command to this CLI", "make the version command print commit and build date", or wants `cmd/version.go` plus matching ldflags wired up in `main.go`, `cmd/root.go`, `.goreleaser.yml`, and the `Makefile`. Detects whether the project already has a basic `version` variable or no version wiring at all, then applies the changes idempotently. Pairs with scaffold-go-cli (which seeds the basic version variable) and add-goreleaser-homebrew (which sets up GoReleaser when it is missing).

cboone bf4bf08 6 files · 25.8 KB Updated

File contents

cboone/agent-harness-plugins/tree/main/plugins/add-cobra-version/skills/add-cobra-version commit bf4bf081db

Frequently asked questions

npx skillmds@latest add cboone/add-cobra-version