Skip to main content

Repo Preflight

Repo Preflight is a read-only Git CLI that turns a branch diff into an integration-focused report: ownership, technical risk, governance gaps, required checks, and a focused manual-review list.

It is designed for small teams and solo developers who want a repeatable pre-merge or pre-integration check without giving the tool permission to modify the repository.

What it does

Repo Preflight can:

  • compare a base revision against HEAD or another fetched revision;
  • classify changed files using exact names, path prefixes, and extensions;
  • resolve repository ownership with prefix and path_exact rules;
  • flag ownership gaps and ownership-boundary crossings;
  • separate technical risk from governance status;
  • emit required verification checks;
  • produce a focused manual-review list instead of treating every changed file equally;
  • warn when the working tree is dirty;
  • output human-readable text or deterministic JSON.

It does not merge, checkout, commit, delete, modify, or automatically approve repository changes.

Example

=== Repository Preflight ===
Current branch: dev
Base: dev
Head: origin/feature/environment-pass
Repository state: CLEAN

Technical risk: MEDIUM
Governance: PASS

Changed files: 14
High risk: 0
Medium risk: 14
Low risk: 0
Manual reviews: 1
Git status mix: A=13, M=1
File types: asset=13, map=1
Owners: Art=13, Shared=1

Required checks:
- asset verification
- map integration verification

Manual review:
- Content/Maps/Level_Art.umap

Governance issues:
- None

Requirements

  • Python 3.10+
  • Git available on PATH

Runtime dependencies: none outside the Python standard library.

Install

Install from PyPI:

pip install repo-preflight

For isolated CLI installation with pipx:

pipx install repo-preflight

Install for development

Clone the repository and run:

python -m pip install -e .

Verify the CLI:

preflight --help

Install test dependencies and run the suite:

python -m pip install -e '.[dev]'
python -m pytest -q

Minimal configuration

Create .preflight.json in your repository root:

{
  "ownership": [
    {
      "match": "prefix",
      "path": "src/",
      "owner": "Backend"
    },
    {
      "match": "path_exact",
      "path": "Dockerfile",
      "owner": "Platform"
    }
  ]
}

ownership is required. Governance thresholds and file-type rules have defaults.

Ownership matching

A repository can contain many ownership rules. Each changed path resolves to one effective owner.

A prefix rule owns a path subtree:

{"match": "prefix", "path": "src/payment/", "owner": "Payments"}

A path_exact rule owns one exact repository-relative path:

{"match": "path_exact", "path": "Dockerfile", "owner": "Platform"}

When several rules match, the most specific rule wins. An exact-path rule wins over an equivalent prefix rule.

Prefix matching is path-segment aware. For example, a rule for src matches src/app.py but not src2/app.py.

An unmatched path becomes Unknown. Analysis continues and the path is reported as an ownership governance gap.

Current ownership resolution returns one effective owner per path. Multiple co-owners for the same path are not modeled in v0.1.4.

Run

Compare the current checked-out revision against dev:

preflight --base dev

Analyze a fetched branch without checking it out:

preflight --base dev --head origin/feature/my-change

Use a config outside the repository:

preflight --base main --config /path/to/preflight.json

Machine-readable output:

preflight --base main --json

If JSON is redirected into a file inside the inspected repository, the shell creates that file before Repo Preflight starts, so the working tree can correctly appear as DIRTY. Redirect outside the repository if you want an unchanged worktree state.

Exit codes

Code Meaning
0 Analysis completed successfully, even if risk/governance warnings were found
2 Configuration error
3 Git/repository/revision error
4 Known Repo Preflight domain error

HIGH technical risk, CRITICAL governance, or a dirty worktree do not block by default. Repo Preflight is advisory in the current release.

Security model

Repo Preflight is intentionally read-only.

The CLI:

  • never uses shell=True;
  • passes Git arguments as an argument list;
  • validates user-supplied Git revisions before invoking Git;
  • uses a Git command timeout;
  • checks Git return codes and stderr;
  • disables external diff and textconv helpers for diff inspection;
  • disables fsmonitor hooks for worktree status inspection;
  • escapes terminal control characters from repository/config-derived display text;
  • does not execute commands from .preflight.json;
  • does not require API keys, credentials, or network access.

See SECURITY.md for vulnerability reporting guidance.

File classification

Default semantic types include:

  • source
  • asset
  • map
  • build_config
  • fallback other

Classification precedence:

  1. exact filename;
  2. most-specific path prefix;
  3. extension;
  4. other.

Custom file_types replace the default classification rules.

Governance defaults

If omitted, governance uses:

{
  "critical_escalation": true,
  "critical_unknown_count": 5,
  "critical_unknown_ratio": 0.25
}

Ownership gaps produce ATTENTION until the configured count/ratio threshold is crossed. A confirmed ownership-boundary crossing is CRITICAL.

Project status

Current release: 0.1.5

The project is intentionally conservative: it reports and prioritizes integration signals instead of automatically merging or blocking changes.

Known scope limits include detached-HEAD handling, one effective owner per path, and richer language/framework-specific semantic analysis.

Contributing

Issues, tests, rule improvements, documentation changes, and focused pull requests are welcome. See CONTRIBUTING.md.

License

MIT License. See LICENSE.

Release files for repo-preflight 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo-preflight 0.1.5
File Size Uploaded
repo_preflight-0.1.5.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repo-preflight 0.1.5
File Interpreter ABI Platform
repo_preflight-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / repo_preflight-0.1.5.tar.gz

Download URL repo_preflight-0.1.5.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c651c44fc309f40674ce1070ce0228693e0801d73968760ff2f0eb7312496d19
BLAKE2b-256 checksum
How to use checksums
a3889a4cad9792e2a3eafd3b99a790a34f6687f3008536f5b62a179111838b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / repo_preflight-0.1.5-py3-none-any.whl

Download URL repo_preflight-0.1.5-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d844f279c0887452dda08633cba2270800615128ebc4750757dd5121a9bd6e94
BLAKE2b-256 checksum
How to use checksums
d44b2c1c657252580e83de71891d364d5ffed512d2a921e12499bfc5a1e381e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page