The architecture and behaviour reference (layout, command contracts, config,
release flow) is CLAUDE.md; user docs are README.md (short) and docs/.
These are the rules for changing the code.
- Understand the code you change: read the whole file, and the callers, before a non-trivial edit. Do not rely on search snippets.
cmd/declares commands, parses flags and prints. Logic lives ininternal/(and the public chat client in the separatesdk/module).- Keep it simple: fewer concepts, small functions, match the surrounding style. Inline single-line helpers that have one call site.
- Delete dead code instead of keeping it around. No backward-compatibility shims, aliases or flags unless asked for.
- Comments are short and only where the code is not obvious.
- Errors go to stderr; stdout is the answer or the data (tables, JSON, YAML), so it stays pipeable. Exit codes: 0 ok, 1 failure, 2 usage.
- A user-facing change updates its page in
docs/(andCLAUDE.mdwhen a contract or the layout changes). - Never print secrets: tokens are redacted (
config.RedactToken), webhook URLs render as.../api/webhooks/agents/....
Run before every commit and fix everything they report:
gofmt -l . # must print nothing
go build ./... && go vet ./... && go test ./...
(cd sdk && go test ./...) # when sdk/ changed- Build binaries outside the repo:
go build -o /tmp/dg ./cmd/docsgpt-cli. - Tests and manual runs never touch the real
~/.docsgpt: use a throwawayHOME,httptestservers or a local mock instead of live APIs. - Do not edit the
require .../sdkversion ingo.mod; the release workflow bumps it.
- Several sessions may share the checkout: stage explicit paths
(
git add <path>), nevergit add -A/git add ., and only commit files you changed. Nevergit reset --hard,git checkout .,git cleanor a baregit stash. - Small, focused commits with conventional messages:
fix(chat): …,feat(bench): …,refactor(host): …,docs: …,chore: …. - Do not push, tag or release; releases are cut from the Release workflow
(see
RELEASING.md).