# How to Trigger the No-Mistakes Validation Gate: 3 Entry Points Explained

> Learn the 3 ways to trigger the no-mistakes validation gate: Git hooks, CLI commands, and CI pipelines. Ensure error-free code with this essential guide.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-14

---

**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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/git/hook.go), this implementation ensures every push is vetted by invoking the validation gate directly.

```go
// 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`](https://github.com/kunchenguid/no-mistakes/blob/main/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.

```go
// 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`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/ci/ci_step.go). This ensures automated builds adhere to the same validation rules as manual and hook-based triggers.

```yaml

# .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`](https://github.com/kunchenguid/no-mistakes/blob/main/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.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/git/hook.go) automatically validate every push at the remote server level before commits are accepted.
- **CLI commands** in [`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go) enable manual validation runs during local development using the `no-mistakes run` command.
- **CI pipeline steps** integrating through [`internal/ci/ci_step.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/ci/ci_step.go) enforce policies in automated builds across different CI platforms.
- All paths execute **`daemon.ValidateGate`** from [`internal/daemon/manager.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/manager.go) for 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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/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.