Does Automattic Harper Include Pre-Commit Hooks? A Complete Analysis

No, the Automattic Harper repository does not ship any active pre-commit hooks—only Git's default sample files that require manual activation.

The Harper codebase relies entirely on standard Git behavior without custom pre-commit automation. While sample hook scripts exist in the hidden .git/hooks directory, none are configured to run automatically during commits. This article examines exactly what hook-related files exist in Harper and how they function.

What Pre-Commit Files Exist in Harper

The Harper repository contains three sample hook files in .git/hooks/. These are standard Git artifacts created during repository initialization, not custom Harper tooling.

pre-commit.sample

The file .git/hooks/pre-commit.sample provides a template for running checks before commits. According to line 8 of this file, activation requires renaming it from pre-commit.sample to pre-commit and ensuring it has executable permissions. Without this manual step, Git ignores the file entirely.


# View the sample hook (inactive until renamed)

cat .git/hooks/pre-commit.sample

This sample demonstrates typical pre-commit behavior: inspecting commit contents for whitespace errors or unresolved merge conflict markers. Harper does not implement these checks automatically.

pre-applypatch.sample

Located at .git/hooks/pre-applypatch.sample, this template runs before git apply processes patches. Like all sample hooks in Harper, it remains inactive unless explicitly enabled.

pre-merge-commit.sample

The file .git/hooks/pre-merge-commit.sample serves as a template for merge operations. No merge-specific validation runs automatically in Harper.

Where Harper Does Not Use Pre-Commit Hooks

No other directory in the Harper source tree contains a pre-commit file. Build configurations, CI pipelines, and documentation do not reference custom pre-commit automation. Harper's quality assurance relies on other mechanisms rather than commit-time checks.

This design choice keeps the repository lightweight. Contributors commit freely, with validation deferred to subsequent stages in the development workflow.

How to Enable Pre-Commit Hooks in Harper

If you want active pre-commit behavior, you must manually configure it. The standard Git approach applies:


# Enable the sample pre-commit hook

cd /path/to/harper
cp .git/hooks/pre-commit.sample .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

For modern pre-commit management, you could alternatively install the pre-commit framework:


# Install pre-commit tool (not included in Harper)

pip install pre-commit
pre-commit install

Neither approach is pre-configured in the Harper repository.

Summary

  • Harper ships no active pre-commit hooks
  • Only Git default samples exist in .git/hooks/
  • Sample files require manual renaming and permissions to function
  • The .git/hooks/pre-commit.sample file at line 8 documents this activation requirement
  • No build or CI configuration references custom hooks
  • Quality checks occur outside commit-time automation

Frequently Asked Questions

Does Harper use pre-commit for linting or formatting?

No. Harper does not include pre-commit hook configurations for linting, formatting, or any other automated checks. The repository lacks both Git-native hooks and framework-based pre-commit setups.

Why doesn't Harper include active pre-commit hooks?

The Harper maintainers chose not to enforce commit-time automation. This avoids friction for contributors and delegates validation to CI pipelines, code review, or other downstream processes.

Can I add my own pre-commit hooks to Harper?

Yes. You can manually activate the sample hooks or install the pre-commit framework locally. However, custom hooks remain local to your clone and do not propagate to other contributors unless the project officially adopts them.

What checks does Harper use instead of pre-commit hooks?

Based on the source analysis, Harper relies on standard development workflows without commit-stage automation. Specific quality assurance mechanisms would be documented in CI configuration files elsewhere in the repository.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →