Skip to main content

repository-hygiene

Breaking change: v1.0.0 uses English configuration keys. See docs/MIGRATION.md to rename your auditoria.yaml.

Audit hygiene for Git repositories. Checks for secrets, broken links, missing references, untracked artifacts, GitHub Actions workflow security, and more.

Installation

# ephemeral (recommended — no global install)
uvx repository-hygiene install .

# persistent
uv tool install repository-hygiene
# or
pip install repository-hygiene

Note: after pip install, run repository-hygiene install . in the target repository to provision configuration, CI workflow, and the agent-hygiene-flow OpenCode skill.

To install directly from GitHub (versions not published on PyPI):

pip install git+https://github.com/frederico-mello/repository-hygiene.git

Usage

Initialize repository (install)

repository-hygiene install .             # create auditoria.yaml + workflow + skill
repository-hygiene install --force .     # overwrite existing files
repository-hygiene install --dry-run .   # preview without writing

install creates:

  • auditoria.yaml — rule configuration and exceptions
  • .github/workflows/repository-hygiene.yml — weekly CI workflow
  • .opencode/skills/agent-hygiene-flow/ — OpenCode skill for agents

Audit

repository-hygiene .                        # text report (stdout) + JSON (.repository-hygiene/)
repository-hygiene . --format json          # JSON only
repository-hygiene . --format sarif         # SARIF only
repository-hygiene . --output audit.txt     # write to file

Pre-commit hook

repository-hygiene install --install-hook .   # install hook on first run

Blocks commits with error-severity findings in staged content. Warnings (warning) are displayed but do not block. To skip:

git commit --no-verify

Exit codes

Code Audit Pre-commit hook
0 clean commit allowed
1 errors found commit blocked
2 invalid config execution failure

Configuration

auditoria.yaml at the repository root:

config_version: 1

rules:
  tracked_secrets:
    enabled: true
    severity: error
  broken_internal_links:
    enabled: true
    severity: error
  missing_references:
    enabled: true
    severity: error
  untracked_artifacts:
    enabled: true
    severity: error
  empty_gitkeep_directories:
    enabled: true
    severity: warning
  unreferenced_files:
    enabled: true
    severity: warning
  outdated_documentation:
    enabled: true
    severity: warning
  unintegrated_configurations:
    enabled: true
    severity: warning
  stale_openspec_changes:
    enabled: true
    severity: warning
  insecure_workflows:
    enabled: true
    severity: warning

exceptions:
  tracked_secrets:
    - .secrets.baseline
    - .env.example
  untracked_artifacts:
    - .git
  unreferenced_files:
    - .gitignore
    - Makefile

Rules

Rule Severity Description
tracked_secrets error Passwords, tokens, and credentials in tracked files
broken_internal_links error Markdown links pointing to missing files
missing_references error References to files that do not exist in the repo
untracked_artifacts error Generated files not covered by .gitignore
empty_gitkeep_directories warning Directories containing only .gitkeep
unreferenced_files warning Files not referenced by any other file
outdated_documentation warning Documentation referencing nonexistent files
unintegrated_configurations warning Tool config without workflow, command, or docs
stale_openspec_changes warning OpenSpec changes stalled for 30+ days
insecure_workflows warning Excessive permissions, actions without pinned version

GitHub Actions

The generated workflow (repository-hygiene.yml):

  • Runs weekly and on push/PR to relevant paths
  • Publishes the report to $GITHUB_STEP_SUMMARY
  • Creates/updates a consolidated issue with findings (error); closes when clean

Minimum permissions:

permissions:
  contents: read
  issues: write
  pull-requests: read

Migration v0.1 to v0.2

Command v0.1 Equivalent v0.2+
repository-hygiene audit . repository-hygiene .
repository-hygiene install . repository-hygiene install .
repository-hygiene update removed

Development

uv pip install -e . pytest
uv run pytest tests_package/

License

MIT

Metadata

Release files for repository-hygiene 1.0.0

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

Source distribution (sdist)

Source distribution for repository-hygiene 1.0.0
File Size Uploaded
repository_hygiene-1.0.0.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repository-hygiene 1.0.0
File Interpreter ABI Platform
repository_hygiene-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.0 kB

Release files / repository_hygiene-1.0.0.tar.gz

Download URL repository_hygiene-1.0.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4fb311a653cc47ec3e9d9617f226de3e5d7559cf59dee4856fa146a8bcbc08a4
BLAKE2b-256 checksum
How to use checksums
33c908b49e34d0fcfff5bc7425d607c4d251a162ddfff12da70f5f11afc4de4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.21

Release files / repository_hygiene-1.0.0-py3-none-any.whl

Download URL repository_hygiene-1.0.0-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9bedb631c48d79340b36d5a88b7e4e6cf29a332c0515b42ff1973b93eb6d29e
BLAKE2b-256 checksum
How to use checksums
b2859be2dc03411bcb1e4c865427a2c63adf343cbba96901d8c4a32f86171d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.21

Release history Release notifications | RSS feed

1.1.1

2 release files

1.1.0

2 release files

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.0

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