Skip to content

feat: generate pre-commit hooks in scaffolded repos#42

Merged
y0s3ph merged 1 commit into
mainfrom
feat/pre-commit-hooks
Mar 10, 2026
Merged

feat: generate pre-commit hooks in scaffolded repos#42
y0s3ph merged 1 commit into
mainfrom
feat/pre-commit-hooks

Conversation

@y0s3ph

@y0s3ph y0s3ph commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Every repo scaffolded by gostrap init now includes a .pre-commit-config.yaml with three validation layers:
    • check-yaml: YAML syntax validation (skips Go/Helm template files)
    • kubeconform: Kubernetes manifest schema validation (skips CRDs like Application, Kustomization, HelmRelease, SealedSecret, ExternalSecret)
    • gostrap validate: full structural integrity check (config, bootstrap dir, base manifests, overlays, app definitions)
  • Also includes trailing-whitespace, end-of-file-fixer, and check-merge-conflict hooks
  • Integrated into the scaffolding pipeline — idempotent, never overwrites existing files
  • Includes 5 unit tests covering generation, idempotency, template exclusion, Flux support, and CRD skip list
  • Updates README with pre-commit documentation section, generated repo structure, and project structure

Closes #22

Test plan

  • go test -race ./... — all tests pass
  • golangci-lint run — 0 issues
  • gostrap init generates .pre-commit-config.yaml in the scaffolded repo
  • Generated config includes all three hook layers with correct exclusion patterns
  • Re-running gostrap init on existing repo skips the file (idempotent)

Every repo created by gostrap init now includes a .pre-commit-config.yaml
with three validation layers:

- check-yaml: YAML syntax validation (skips Go/Helm templates)
- kubeconform: Kubernetes manifest schema validation (skips CRDs like
  Application, Kustomization, HelmRelease, SealedSecret, etc.)
- gostrap validate: full structural integrity check

Also includes trailing-whitespace, end-of-file-fixer, and
check-merge-conflict hooks for general hygiene.

Includes 5 unit tests covering generation, idempotency, template
exclusion patterns, Flux repo support, and CRD skip list.
Updates README with pre-commit documentation section, generated repo
structure, and project structure.
@y0s3ph y0s3ph self-assigned this Mar 10, 2026
@y0s3ph y0s3ph merged commit 7a168a2 into main Mar 10, 2026
3 checks passed
@y0s3ph y0s3ph deleted the feat/pre-commit-hooks branch March 10, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-commit hooks for manifest validation

1 participant