From 966c44b88d742c149f334313e2d3cdecb8024f23 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Thu, 23 Apr 2026 13:23:20 +1000 Subject: [PATCH] Add local fix script and codex validation guidance --- AGENTS.md | 13 +++++++++++++ README.md | 12 ++++++++++++ scripts/fix.sh | 20 ++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100755 scripts/fix.sh diff --git a/AGENTS.md b/AGENTS.md index bec7027..c8eef08 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -59,6 +59,19 @@ Changes should keep the provider idiomatic, easy to contribute to, and ready for ## Agent instructions +## Validation workflow (Codex and local) + +When you modify **Go** or **Terraform** files, always run this sequence before concluding work: + +1. `./scripts/fix.sh` +2. `./scripts/check.sh` + +### Expectations +- Do not leave formatting changes unapplied. +- Do not hand-edit formatting that `gofmt` or `terraform fmt` can apply automatically. +- Treat `./scripts/check.sh` as the required final validation gate. +- If Terraform is unavailable in the environment, note that Terraform formatting/checking could not be run locally. + ### Local validation for this repository This provider is not yet published to the Terraform Registry. diff --git a/README.md b/README.md index d5c1ffe..3765f18 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,18 @@ data "dynu_dns_records" "selected" { - Symptom: Terraform behavior doesn't reflect latest code. - Fix: rebuild binary (`go build -o terraform-provider-dynu`) and re-run `terraform validate` and `terraform plan`. +## Development checks + +Before committing, run: + +```bash +./scripts/fix.sh +./scripts/check.sh +``` + +`fix.sh` applies standard formatting and module hygiene. +`check.sh` is the strict verification script used by CI. + ## Developer workflow - `./scripts/setup-dev.sh` - validate local toolchain requirements diff --git a/scripts/fix.sh b/scripts/fix.sh new file mode 100755 index 0000000..8c41967 --- /dev/null +++ b/scripts/fix.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "[fix] formatting Go files" +files="$(git ls-files '*.go')" +if [[ -n "${files}" ]]; then + gofmt -w ${files} +fi + +echo "[fix] running go mod tidy" +go mod tidy + +if command -v terraform >/dev/null 2>&1; then + echo "[fix] running terraform fmt for examples/" + terraform fmt -recursive examples +else + echo "[fix][warn] terraform not found; skipping examples/ formatting" >&2 +fi + +echo "[fix] complete"