Skip to content

alexeagle/rules-doctor

Repository files navigation

Rules Doctor

A simple TypeScript tool for checking GitHub repositories against configurable rules using regex patterns.

See a report of the latest nightly run at Run Rules Doctor

Setup

  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Usage

Run checks using the default config file:

npm start

Or specify a custom config file:

npm start path/to/your/config.json

For development (build and run in one command):

npm run dev

Configuration

Create a config.json file with the following structure:

{
  "repositories": [
    {
      "name": "my-repo",
      "url": "https://github.com/owner/repo",
      "checks": [
        {
          "name": "check-name",
          "file": "path/to/file.txt",
          "pattern": "regex-pattern",
          "description": "Optional description"
        }
      ]
    }
  ]
}

Example Checks

  • File exists: Use pattern .* to check if a file exists
  • Contains text: Use pattern some text to check if file contains specific text
  • Release script check: Use pattern docs\\.tar\\.gz to check if release_prep.sh includes docs.tar.gz
  • Package.json validation: Use pattern "name": to check if package.json has a name field

Output

The tool will:

  • Report progress as it checks each repository
  • Show ✅ if all checks pass
  • Show ❌ with details for any failed checks
  • Exit with code 1 if any checks fail (useful for CI/CD)

Project Structure

├── src/
│   ├── types.ts      # TypeScript interfaces
│   ├── checker.ts    # Repository checking logic
│   └── index.ts      # Main entry point
├── config.json       # Example configuration
├── package.json      # Dependencies and scripts
└── tsconfig.json     # TypeScript configuration

About

Some AI-generated garbage to help me track ruleset fixes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •