cli/cli
How to contribute
This section collects everything a new contributor needs to ship a change to cli/cli. The authoritative source is .github/CONTRIBUTING.md; this wiki summarises and groups it.
At a glance
- Pick up work. New commands need triage approval (see
docs/working-with-us.md). Bug fixes can go straight to a PR. - Branch off
trunk. PRs target thetrunkbranch. - Implement using the Options + Factory pattern. Every command has
NewCmdFoo(f *cmdutil.Factory, runF func(*FooOptions) error)plus a separatefooRun(opts)for the business logic. See Patterns and conventions. - Cover with tests. HTTP via
httpmock.Registry, terminal viaiostreams.Test(), prompts via thePromptermock. See Testing. - Run the gates.
go test ./...andmake lintmust pass before commit. The CI workflows in.github/workflows/re-run both. - Open a PR. The triage workflow (
.github/workflows/triage-pull-requests.yml) labels and routes it. Reviews go to@cli/code-reviewersplus any subsystem owners listed in.github/CODEOWNERS.
Definition of done
- New behaviour has unit tests; HTTP-touching code uses
httpmockanddefer reg.Verify(t)to assert all stubs were hit. - Feature-detected branches carry a
// TODO <cleanupIdentifier>comment, otherwise the lint fails. - Public Go symbols have godoc comments. Do not restate behaviour in inline comments.
- No em dashes (
-) anywhere in code, comments, or docs. - Help text uses
heredoc.Docand matches the# commentplus$ commandexample style. - If your change adds a new top-level command, register it in
pkg/cmd/root/root.goand update the relevant help group.
Sub-pages
- Development workflow - branches, commits, the merge cycle.
- Testing - frameworks, mocks, table-driven patterns.
- Debugging - logs, common errors, environment variables.
- Patterns and conventions - the Options + Factory pattern, error types, JSON output flags.
- Tooling - lint, build, generate, manpages, and CI.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.