Development¶
Prerequisites¶
- Go 1.26+ (see
go.mod) diveon yourPATH- Docker or Podman (for integration / compatibility checks)
- pre-commit (
pip install pre-commitorbrew install pre-commit)
Commands¶
make build # ./bin/dive-mcp
make install # go install into $GOBIN / $GOPATH/bin
make run # go run ./cmd/dive-mcp
make test # unit tests
make lint # golangci-lint, or go vet as fallback
make fmt # gofmt + go fmt
make pre-commit # run all pre-commit hooks
make hooks-install # install pre-commit git hooks for this clone
make clean # remove bin/, dist/, and site/
make docs # serve docs locally (requires MkDocs)
make docs-build # build static site to ./site
make release # cross-compile darwin/linux amd64+arm64 into ./dist
Pre-commit hooks¶
Hook definitions live in .pre-commit-config.yaml. Install
once per clone:
Run checks manually anytime:
Project layout¶
cmd/dive-mcp/ main entrypoint, --version flag
internal/dive/ dive CLI runner + JSON types
internal/server/ MCP tool registration and handlers
examples/ ready-to-copy client configs
scripts/ dive install and compat verification
testdata/ fixtures and CI test image Dockerfile
Keep new code inside internal/ unless it is a new command. The server should shell out
to dive rather than reimplementing dive's analysis logic.
Testing¶
Unit tests¶
Parser and helper tests live in internal/dive/. Fixture data is in
internal/dive/testdata/sample.json. Regenerate when the expected JSON shape changes:
Dive compatibility¶
CI verifies that multiple dive releases produce JSON dive-mcp can parse:
See dive-compatibility.md for the full maintenance workflow.