Essential commands, structure, and patterns for AI agents.
make docs # Generate Swagger API documentation
make test # Run all tests with race detector and coverage
make lint # Run go vet (requires docs generated first)
make build # Clean, generate docs, lint, and build binaries
make clean # Remove dist/ and generated docs.
├── cmd/ # API and CLI entry points
├── pkg/ # Core packages (input, rules, category, format, docs)
├── generators/pg-docs/ # Tool to generate pg-docs.yml
├── rules.yml # Rule metadata (categories, abstracts, recommendations)
└── pg-docs.yml # PostgreSQL parameter documentation per version
- Go 1.25.1, module
github.com/pgconfig/api - Fiber for API, Cobra for CLI, Swagger for docs
- English Language: All code comments, documentation, and variable names must be in English.
- Input parsing:
pkg/input/bytes.Parse()for byte units,profile.Profilefor workload types - Rule pipeline in
pkg/rules/compute.go(order: arch → OS → profile → storage → AIO → version) - Three output formats:
json,alter_system,conf - Configuration files:
rules.ymlandpg-docs.ymlloaded at startup
make testruns all tests with coverage (generatescovprofile)- Test files follow
*_test.gopattern - CI runs tests on push/pull request (
.github/workflows/cover.yml)
- Create function in
pkg/rules/with signaturefunc(*input.Input, *category.ExportCfg) (*category.ExportCfg, error) - Add to
allRulesslice inpkg/rules/compute.go(mind order) - Write unit tests
- Update
rules.ymlif rule needs metadata
- cover.yml: runs
make buildandmake test, pushes coverage to Coveralls - release.yml: triggered on tags, runs goreleaser for multi‑arch binaries and Docker images
Follow commit conventions from ~/.claude/pgconfig.md:
<type>: <subject line (max 50 chars)>
<body wrapped at 80 cols, focus on WHY not WHAT>
Types: feat, fix, refactor, docs, chore, test, style
Rules:
- Title ≤50 chars, imperative mood ("fix" not "fixed").
- Body wrapped at 80 cols, focus on WHY.
- Sign‑off required (
-s). - STRICTLY FORBIDDEN: AI attribution footers (e.g., "Generated with Crush", "Assisted by...").
- STRICTLY FORBIDDEN: Adding "Co-authored-by" unless explicitly requested by the user.
- English Only: Commit messages must be in English.
- Swagger docs before building:
make builddepends onmake docs - Byte parsing: case‑insensitive, expects unit (KB, MB, GB, TB)
- PostgreSQL version defaults: default is 18, supported 9.1–18
- Rule order:
computeVersionmust be last (removes unsupported parameters) - AIO parameters (PostgreSQL 18+):
io_methodandio_workersonly available in ≥18.io_workersscaled by profile: Desktop 10%, WEB 20%, Mixed 25%, OLTP 30%, DW 40%, +10% for HDD.