From 306e55f408d962bb572fe3c3234c38e2f7d6eada Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 22 Nov 2026 11:37:14 -0500 Subject: [PATCH] consolidated repo commands in a justfile. --- AGENTS.md | 14 ++++++++- c2p | 1 - cmd/gen-fixtures/main.go | 2 +- fixtures_test.go | 2 +- justfile | 60 ++++++++++++++++++++++++++++++++++++++ bump.sh => scripts/bump.sh | 0 test | 18 ------------ 7 files changed, 75 insertions(+), 22 deletions(-) delete mode 100755 c2p create mode 100644 justfile rename bump.sh => scripts/bump.sh (100%) delete mode 100755 test diff --git a/AGENTS.md b/AGENTS.md index 7d380e8..6b0c44e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,17 @@ # go-heartwood +## Commands +- List available repo commands with `just` + ## Testing -- Baseline: `./test dev -race -gcflags "all=-d=checkptr=0" ./...` +- Bring up the dev environment: `just up` +- Baseline: `just test-race` +- During iteration: + - All tests: `just test` + - Specific tests: `just test -run TestName -v` + - Only when analyzing race conditions: `just test-race` - `boltdb/bolt@v1.3.1` triggers a `checkptr` panic under race instrumentation; this is an upstream bug, not a project defect. +- Use `just fixtures` to regenerate test fixtures. + +## Quality gate +- Run `just fmt && just ci` before staging any changes. diff --git a/c2p b/c2p deleted file mode 100755 index dabfe21..0000000 --- a/c2p +++ /dev/null @@ -1 +0,0 @@ -code2prompt -c -e go.sum -e bump.sh -e LICENSE -e AGENTS.md -e c2p diff --git a/cmd/gen-fixtures/main.go b/cmd/gen-fixtures/main.go index af696e1..e39b49a 100644 --- a/cmd/gen-fixtures/main.go +++ b/cmd/gen-fixtures/main.go @@ -24,7 +24,7 @@ const ( ) type fixtureEvent struct { - Description string `json:"description"` + Description string `json:"description"` Event roots.Event `json:"event"` } diff --git a/fixtures_test.go b/fixtures_test.go index 0d240fa..5890ffe 100644 --- a/fixtures_test.go +++ b/fixtures_test.go @@ -16,7 +16,7 @@ type Fixtures struct { // FixtureEvent is a single entry from the fixtures file. type FixtureEvent struct { - Description string `json:"description"` + Description string `json:"description"` Event roots.Event `json:"event"` } diff --git a/justfile b/justfile new file mode 100644 index 0000000..ea53ca0 --- /dev/null +++ b/justfile @@ -0,0 +1,60 @@ +# list commands +default: + just --list + +# build the library +build: + go build ./... + +# format source files +fmt: + go fmt ./... + +# check formatting +fmt-check: + test -z "$(gofmt -l .)" + +# vet source files +vet: + go vet ./... + +# tidy go modules +tidy: + go mod tidy + +# cut a new release version +bump *args: + ./scripts/bump.sh {{ args }} + +# set up the dev environment +up: + docker compose up -d --wait + +# tear down the dev environment +down: + docker compose down + +# check the dev environment status +ps: + docker compose ps -a + +# run tests in the dev environment +test *args="./...": + docker compose exec test go test {{ args }} + +raceargs := '-race -gcflags "all=-d=checkptr=0"' + +# run race tests in the dev environment +test-race *args="./...": + docker compose exec test go test {{ raceargs }} {{ args }} + +# run ci tests in a one-shot environment +test-ci *args="./...": + docker compose run --rm test go test {{ raceargs }} {{ args }} + +# run all checks +ci: fmt-check vet test-ci + +# regenerate test fixtures +fixtures: + go run ./cmd/gen-fixtures diff --git a/bump.sh b/scripts/bump.sh similarity index 100% rename from bump.sh rename to scripts/bump.sh diff --git a/test b/test deleted file mode 100755 index 9dfeab1..0000000 --- a/test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -eou pipefail -case "${1:-dev}" in -dev) docker compose up -d --wait && docker compose exec test go test "${@:2}" ;; -ci) docker compose run --rm test go test "${@:2}" ;; -*) - echo "Usage: $0 [dev|ci] [go test arguments...]" - echo - echo "Commands:" - echo " dev Start services and run tests in the existing test container (default)." - echo " ci Execute tests in a new, one-off container and clean up." - echo - echo "Examples:" - echo " $0 dev ./... -v" - echo " $0 ci -run TestSpecificFunction" - exit 1 - ;; -esac