How to Trigger the No-Mistakes Validation Gate: 3 Entry Points Explained
TLDR: The no-mistakes validation gate can be triggered through three entry points: a Git server hook (post-receive/pre-receive), the no-mistakes run CLI command, and a CI pipeline step, all converging on the central daemon.ValidateGate function in internal/daemon/manager.go.
The no-mistakes tool in the kunchenguid/no-mistakes repository protects codebases by enforcing a validation gate that must be satisfied before changes are accepted. Understanding the three distinct entry points to trigger this no-mistakes validation gate allows teams to integrate policy enforcement across local development, remote pushes, and automated build pipelines.
Git Hook Entry Point (Post-Receive/Pre-Receive)
The first entry point leverages Git hooks on the remote server. When developers push commits, the post-receive (or pre-receive) hook script intercepts the operation before final acceptance. Located in internal/git/hook.go, this implementation ensures every push is vetted by invoking the validation gate directly.
// internal/git/hook.go – simplified excerpt
func postReceiveHook(gateDir string) error {
// Resolve absolute gate directory, then invoke the validator
return daemon.ValidateGate(context.Background(), gateDir)
}
CLI Command Entry Point
Developers can manually trigger validation using the no-mistakes run command. This CLI entry point, defined in cmd/no-mistakes/main.go, creates a temporary worktree, loads repository configuration, and drives the pipeline through the same gate logic used by automated triggers.
// cmd/no-mistakes/main.go – simplified excerpt
func main() {
// Parse flags, then start a validation run
if err := daemon.ValidateGate(context.Background(), cfg.GateDir); err != nil {
log.Fatalf("validation failed: %v", err)
}
}
CI Pipeline Step Entry Point
Continuous Integration systems invoke the gate as a pipeline step. Whether using GitHub Actions, GitLab CI, or similar platforms, the CI job executes no-mistakes run (or equivalent internal APIs) via logic typically found in internal/ci/ci_step.go. This ensures automated builds adhere to the same validation rules as manual and hook-based triggers.
# .github/workflows/ci.yml – example CI step
- name: Run no‑mistakes validation
run: |
no-mistakes run --root .
Shared Core Implementation
All three entry points converge on a single orchestration layer. The daemon.ValidateGate function in internal/daemon/manager.go serves as the central dispatcher, handling repository-config trust verification, safe-force-push logic, and automated lint checks. This architecture guarantees consistent enforcement regardless of how the gate was invoked.
Summary
- Git hooks in
internal/git/hook.goautomatically validate every push at the remote server level before commits are accepted. - CLI commands in
cmd/no-mistakes/main.goenable manual validation runs during local development using theno-mistakes runcommand. - CI pipeline steps integrating through
internal/ci/ci_step.goenforce policies in automated builds across different CI platforms. - All paths execute
daemon.ValidateGatefrominternal/daemon/manager.gofor unified policy enforcement and consistent validation results.
Frequently Asked Questions
What is the primary source file for the Git hook entry point?
The Git hook entry point is implemented in internal/git/hook.go. This file contains the postReceiveHook function that invokes daemon.ValidateGate when the remote server receives a push, ensuring every change is validated before acceptance.
Can I run the no-mistakes validation gate manually?
Yes. Use the no-mistakes run command from your terminal. This CLI entry point defined in cmd/no-mistakes/main.go creates a temporary worktree and executes the same validation logic used by automated triggers, making it ideal for pre-push local checks.
How does the CI pipeline step integrate with the validation gate?
CI systems integrate by executing no-mistakes run as a pipeline step, typically configured in internal/ci/ci_step.go. This approach ensures that automated builds pass through the same daemon.ValidateGate function used by Git hooks and CLI commands, maintaining consistent policy enforcement across all development workflows.
Where is the core validation logic centralized?
The core logic resides in internal/daemon/manager.go. Regardless of whether the gate is triggered by a Git hook, CLI command, or CI step, all paths converge on the daemon.ValidateGate function in this file to ensure consistent policy enforcement and centralized orchestration of validation checks.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →