- Go 1.22 or later
- Git
git clone https://github.com/vngcloud/greennode-cli.git
cd greennode-cli/go
go build -o grn .
./grn --versioncd go
CGO_ENABLED=0 go build -o grn .Each product is a self-registering command group under go/cmd/<product>/, mounted
into the single grn binary. Scaffold one in seconds:
./scripts/new-product <product> # e.g. vdb (lowercase, valid Go package name)This generates go/cmd/<product>/ (parent command, an example command, shared
createClient/outputResult helpers, a starter test, and a product CLAUDE.md),
creates docs/commands/<product>/, wires self-registration in go/cmd/register.go,
and appends .github/CODEOWNERS lines. CI and the conventions test pick up the new
package automatically. Then follow the "Next steps" the script prints (add your
<product>_endpoint to internal/config REGIONS, replace the example command, etc.).
git checkout main && git pull
git checkout -b feat/your-feature-namecd go
# Write code
CGO_ENABLED=0 go build -o grn .
./grn vks <your-command> --helpDo not edit the version or CHANGELOG by hand. release-please
derives the version bump and CHANGELOG.md from commit messages. Because PRs are
squash-merged, the PR title becomes the commit message, so it must be a
valid Conventional Commit — this is
enforced by the Conventional Commits title check.
feat(vks): add describe-events command # minor bump
fix(auth): fix token refresh race condition # patch bump
feat!: drop deprecated --foo flag # breaking (see note)
docs(readme): update installation # no release
Bump rules: fix: → patch, feat: → minor, feat!:/BREAKING CHANGE: → major.
Getting a wrong bump? Fix the PR title — never touch the version file.
- PR to
main; use a Conventional Commit title (theConventional Commits titlecheck gates it). - CI (
Run Tests) must pass before merge. - Squash-merge so the PR title lands as the release commit.
release-please opens/refreshes a chore: release main PR that bumps the version
(in go/cmd/root.go) and updates CHANGELOG.md. Merge that PR to publish: it
tags vX.Y.Z, creates the GitHub Release, and the release workflow attaches the
built binaries.
- Create
go/cmd/vks/<command_name>.go - Define
cobra.Commandwith Use, Short, RunE - Register in
go/cmd/vks/vks.go:VksCmd.AddCommand(newCmd) - Add
validator.ValidateID()for any ID args - Add
--dry-runfor create/update/delete - Add
--force+ confirmation for delete - Create
docs/commands/vks/<command-name>.md— command reference page - Add entry to
docs/commands/vks/index.mdtable - Add nav entry to
mkdocs.yml
- Create
go/cmd/<service>/directory - Create parent command with
cobra.Command - Register in
go/cmd/root.go:rootCmd.AddCommand(serviceCmd)
- All source code text in English
- Use cobra patterns for all commands
- Validate user inputs (IDs used in URLs)
- Use
--dry-runfor create/update/delete commands - Add
--forceto skip confirmation on delete commands
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.