version: "3" vars: BIN_DIR: "bin" tasks: fmt: desc: Fix and format Go source with the gate's configured formatters cmds: # One go fix pass is not a fixpoint: it applies each fixer once, to the # parse it started with, so a rewrite made by one fixer is only fixed up # by the next pass. stditerators turns `for i := range t.NumField()` into # a field iterator that copies its loop variable, and forvar deletes that # copy on the following pass -- leaving the copy behind for copyloopvar # to reject. Apply passes until a dry run reports nothing left to fix, # and fail rather than hand the lint step a tree it must reject. - | set -eu converged=false for pass in 1 2 3 4 5 6 7 8 9 10; do go fix ./... if go fix -diff ./... >/dev/null; then converged=true break fi done if [ "$converged" != true ]; then echo "go fix still rewrites the tree after 10 passes" >&2 exit 1 fi # This must use the same engine and configuration as task lint. Running # standalone gofumpt cannot reproduce gci's custom import grouping, so it # can leave a tree that the gate rejects. - golangci-lint fmt proto:install: desc: Install the pinned Buf and protobuf Go generators cmds: - bash tools/proto.sh install proto:generate: desc: Generate and format committed grpc-go service contracts cmds: - bash tools/proto.sh generate proto:lint: desc: Lint protobuf contracts and check compatibility with main cmds: - bash tools/proto.sh lint db:generate: desc: "Regenerate the sqlc query code from the schema and query files" cmds: - go -C tools tool sqlc generate -f {{.ROOT_DIR}}/internal/infrastructure/postgres/sqlc.yaml db:check: desc: "Regenerate the sqlc code and reject uncommitted generated differences" cmds: - task: db:generate - git diff --exit-code -- internal/infrastructure/postgres/postgresdb proto:check: desc: Regenerate contracts and reject uncommitted generated differences cmds: - bash tools/proto.sh check news: desc: Regenerate the release data artifacts from the changelog cmds: - go -C tools run -mod=readonly ./newsgen --repo-root .. news:check: desc: Verify the committed release notes match the changelog cmds: - go -C tools run -mod=readonly ./newsgen check --repo-root .. vet: desc: Run go vet cmds: - go vet ./... lint: desc: Run golangci-lint cmds: - golangci-lint run ./... - cd tools && golangci-lint run ./... ui:deps: desc: Install dashboard dependencies internal: true # Parallel UI checks must share one dependency install. run: once dir: ui env: OPENUI_TELEMETRY_DISABLED: "1" cmds: - npm ci --no-audit --no-fund ui: desc: Build the dashboard into ui/dist (committed; the Go build embeds it) dir: ui deps: [ui:deps] cmds: - task: ui:prompt - npm run build ui:prompt: desc: Generate the agent prompt for the dashboard's view components (committed; the Go build embeds it) deps: [ui:deps] env: OPENUI_TELEMETRY_DISABLED: "1" cmds: - node --experimental-strip-types ui/scripts/genui-prompt.ts internal/domain/genui/prompt.md ui:check: desc: Rebuild the dashboard into a temporary directory and reject a stale ui/dist deps: [ui:deps] cmds: - bash tools/uidist.sh check test:ui: desc: Test and type-check the dashboard dir: ui deps: [ui:deps] cmds: - npm test - npm run typecheck bench:prreview: desc: Run the PR review benchmark on the configured models and write docs/benchmarks/pr-review-*.md (-- -model ALIAS -judge-model REF; --help for flags) cmds: - go run ./cmd/archied prbench {{.CLI_ARGS}} dev: desc: Run development services and Vite at http://localhost:5173 deps: [dev:daemon, dev:gateway, dev:messaging, dev:state-store, dev:dashboard, dev:ui] dev:tls: desc: Issue the development CA and service certificates deployments/dev.toml names status: - test -f tmp/dev-tls/archie-ui.pem cmds: - | # Task containers reach the State Store over the Docker bridge, which # services may only do over TLS. set -eu d=tmp/dev-tls mkdir -p "$d" openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 3650 \ -subj /CN=archie-dev-ca -keyout "$d/ca-key.pem" -out "$d/ca.pem" 2>/dev/null for s in archied archie-gateway archie-messaging archie-state-store archie-ui; do openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -days 3650 \ -subj "/CN=$s" -addext "subjectAltName=DNS:$s" -addext extendedKeyUsage=serverAuth,clientAuth \ -CA "$d/ca.pem" -CAkey "$d/ca-key.pem" -keyout "$d/$s-key.pem" -out "$d/$s.pem" 2>/dev/null done dev:postgres: desc: Start PostgreSQL and wait for readiness cmds: - docker compose up -d postgres - | set -eu for _ in $(seq 1 60); do status=$(docker inspect --format '{{`{{.State.Health.Status}}`}}' "$(docker compose ps -q postgres)" 2>/dev/null || true) if [ "$status" = "healthy" ]; then exit 0 fi sleep 1 done echo "postgres did not become healthy within 60s" >&2 exit 1 dev:wait-state: internal: true cmds: - | # Services read their settings from the State Store at boot and exit # if it is not up yet, so wait for its port ([services.state] in # deployments/dev.toml). for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2 exit 1 dev:daemon: desc: Run archied with live reload cmds: - task: dev:wait-state - air -build.args_bin="-config-overlay,deployments/dev.toml" dev:dashboard: desc: Run the dashboard backend cmds: - go run ./cmd/archie-ui -config-overlay deployments/dev.toml dev:state-store: desc: Run the State Store with development PostgreSQL deps: [dev:postgres, dev:tls] cmds: - go run ./cmd/archie-state-store -config-overlay deployments/dev.toml dev:gateway: desc: Run the development Gateway cmds: - task: dev:wait-state - go run ./cmd/archie-gateway -config-overlay deployments/dev.toml dev:messaging: desc: Run the development Messaging Service cmds: - task: dev:wait-state - go run ./cmd/archie-messaging -config-overlay deployments/dev.toml dev:ui: desc: Run Vite (requires the dashboard backend) dir: ui cmds: - npm install --no-audit --no-fund - npm run dev e2e:up: desc: Start the local stack without Docker (PostgreSQL 18, services, Vite) and seed it cmds: - bash e2e/stack.sh start - bash e2e/seed.sh e2e:down: desc: Stop the local e2e stack cmds: - bash e2e/stack.sh stop e2e:check: desc: List browser checks; use -- all or -- CHECK to run, add --headed to watch cmds: - node e2e/run.cjs {{.CLI_ARGS}} build: desc: Build archie services and agent binaries vars: GATEWAY_VERSION: '{{.GATEWAY_VERSION | default "dev"}}' RUNTIME_VERSION: '{{.RUNTIME_VERSION | default "dev"}}' SERVICE_LDFLAGS: >- -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version={{.GATEWAY_VERSION}} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime={{.RUNTIME_VERSION}} sources: - Taskfile.yml - "**/*.go" # Files the binaries embed. - "internal/**/*.sql" - "internal/**/*.yaml" - "internal/**/*.json" - "internal/**/*.tpl" - "internal/**/*.md" - go.mod - go.sum - "ui/dist/**" generates: - "{{.BIN_DIR}}/archied" - "{{.BIN_DIR}}/archie-gateway" - "{{.BIN_DIR}}/archie-state-store" - "{{.BIN_DIR}}/archie-ui" - "{{.BIN_DIR}}/archie-messaging" - "{{.BIN_DIR}}/archie-agent" cmds: # One flag set for every service, matching the release workflow, so each # binary reports the same version. - for: [archied, archie-gateway, archie-state-store, archie-ui, archie-messaging] cmd: go build -trimpath -ldflags "{{.SERVICE_LDFLAGS}}" -o {{.BIN_DIR}}/{{.ITEM}} ./cmd/{{.ITEM}} - go build -trimpath -ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent test: desc: Run short Go tests with caching cmds: - go test -short ./... check: desc: Run the full quality gate # Finish mutations before starting parallel checks. cmds: - task: fmt - task: proto:check - task: db:check - task: check:readonly check:readonly: internal: true deps: - task: proto:lint - task: news:check - task: vet - task: lint - task: build - task: test - task: test:ui - task: ui:check release:preview: desc: "Show the release notes that would be generated (VERSION=1.2.0)" cmds: - tools/release.sh --version {{.VERSION}} --dry-run requires: vars: [VERSION] release:prepare: desc: Prepare changelog notes for editing (VERSION=1.2.0) cmds: - tools/release.sh --version {{.VERSION}} --prepare requires: vars: [VERSION] release: desc: Commit and tag the prepared release (VERSION=1.2.0) cmds: - tools/release.sh --version {{.VERSION}} --tag requires: vars: [VERSION] release:publish: desc: Push the images and publish the pushed tag to the public releases repository (VERSION=1.2.0) cmds: - tools/publish.sh {{.VERSION}} requires: vars: [VERSION]