Skip to content

koomatoz/osstriage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– OSSTriage

AI-driven Pull Request review & Issue triaging for Open Source maintainers.

Python 3.13+ License: MIT Built with DSPy Package Manager: uv

Stop drowning in PRs. Let AI handle the first pass.


πŸ”₯ The Problem

Open-source maintainer burnout is real. Popular repositories get flooded with pull requests and issues that need review, triaging, and labeling β€” and most of that work is repetitive. 60% of OSS maintainers report burnout, and the #1 cause is the sheer volume of contributions needing review.

πŸ’‘ The Solution

OSSTriage is a CLI tool and GitHub Action that uses AI (via DSPy) to:

  • πŸ” Review Pull Requests β€” Automatically analyse diffs for security risks, performance issues, logic flaws, and code quality
  • 🏷️ Triage Issues β€” Suggest labels, assign priority scores, and summarise issue content
  • 🀝 Reduce Toil β€” Let maintainers focus on the decisions that matter, not the first-pass review drudgery

OSSTriage doesn't replace humans β€” it gives maintainers a structured, AI-generated starting point for every PR and issue.


πŸ—οΈ Architecture

osstriage/
β”œβ”€β”€ src/osstriage/
β”‚   β”œβ”€β”€ cli.py                  # Typer CLI entry points
β”‚   β”œβ”€β”€ github_client.py        # GitHub API wrapper (PyGithub)
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ config.py           # Settings from env / .env
β”‚   β”‚   β”œβ”€β”€ logging.py          # Rich-powered structured logging
β”‚   β”‚   └── exceptions.py       # Custom exception hierarchy
β”‚   └── dspy_modules/
β”‚       β”œβ”€β”€ signatures.py       # DSPy I/O signatures
β”‚       β”œβ”€β”€ review_pr.py        # ReviewPRModule (ChainOfThought)
β”‚       └── triage_issue.py     # TriageIssueModule (ChainOfThought)
β”œβ”€β”€ .github/workflows/
β”‚   └── osstriage-ci.yml        # Ready-to-use GitHub Action
β”œβ”€β”€ action.yml                  # Composite action for marketplace
β”œβ”€β”€ pyproject.toml              # uv-compatible project manifest
└── README.md

Why DSPy? Unlike LangChain's prompt-centric approach, DSPy uses programmatic logic compilation β€” you define typed signatures and let the framework optimise the prompts. This makes the AI modules testable, composable, and reliable.


πŸš€ Quick Start

Prerequisites

  • Python 3.13+
  • uv (modern Python package manager)
  • A GitHub Personal Access Token
  • An OpenAI API key

Install

# Install as a CLI tool (recommended)
uv tool install osstriage

# Or clone and install locally for development
git clone https://github.com/koomatoz/osstriage.git
cd osstriage
uv sync

Configure

Create a .env file (or export the variables in your shell):

cp .env.example .env
# Edit .env with your actual tokens
Variable Required Description
GITHUB_TOKEN βœ… GitHub PAT with repo scope
OPENAI_API_KEY βœ… OpenAI API key
OSSTRIAGE_LOG_LEVEL ❌ DEBUG, INFO (default), WARNING, ERROR
OSSTRIAGE_MODEL ❌ LLM model (default: gpt-4o)

πŸ“– Usage

Review a Pull Request

# Full review with GitHub comment
osstriage review-pr https://github.com/owner/repo/pull/42

# Dry run (only show results locally, don't post to GitHub)
osstriage review-pr https://github.com/owner/repo/pull/42 --dry-run

# Use a specific model
osstriage review-pr https://github.com/owner/repo/pull/42 --model gpt-4o-mini

# Verbose output for debugging
osstriage review-pr https://github.com/owner/repo/pull/42 -v

What it analyses:

  • πŸ”’ Security risks β€” injection, exposed secrets, unsafe deserialization
  • ⚑ Performance issues β€” N+1 queries, unnecessary allocations, blocking calls
  • πŸ› Logic flaws β€” off-by-one errors, missing edge cases, race conditions
  • πŸ’‘ Suggestions β€” naming, structure, documentation, best practices

Triage an Issue

# Triage and display results
osstriage triage-issue https://github.com/owner/repo/issues/7

# Triage and automatically apply labels
osstriage triage-issue https://github.com/owner/repo/issues/7 --apply-labels

# Dry run
osstriage triage-issue https://github.com/owner/repo/issues/7 --dry-run

What it produces:

  • 🏷️ Suggested labels β€” bug, feature, docs, security, good-first-issue, etc.
  • πŸ“Š Priority score β€” 1 (low) to 5 (critical) with justification
  • πŸ“‹ Summary β€” Concise 1-2 sentence description
  • πŸ‘€ Ideal expertise β€” What skills are needed to address the issue

Set Up GitHub Action

# Scaffold the workflow file into .github/workflows/
osstriage setup-action

βš™οΈ GitHub Action

Option 1: Use the provided workflow (recommended)

Copy .github/workflows/osstriage-ci.yml to your repository, then add these secrets:

Secret Description
OPENAI_API_KEY Your OpenAI API key

GITHUB_TOKEN is automatically provided by GitHub Actions.

Option 2: Use as a composite action

name: AI Code Review
on:
  pull_request:
    types: [opened, synchronize, reopened]

permissions:
  contents: read
  pull-requests: write

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: koomatoz/osstriage@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          openai-api-key: ${{ secrets.OPENAI_API_KEY }}
          model: "gpt-4o"
          command: "review-pr"

πŸ› οΈ Development

# Clone and set up dev environment
git clone https://github.com/koomatoz/osstriage.git
cd osstriage
uv sync

# Run the CLI during development
uv run osstriage --help

# Run tests
uv run pytest

# Lint with ruff
uv run ruff check src/
uv run ruff format src/

πŸ—ΊοΈ Roadmap

  • DSPy optimisation β€” Compile review modules with labelled examples for higher accuracy
  • Multi-LLM support β€” Anthropic Claude, Google Gemini, local Ollama models
  • Inline comments β€” Post review feedback as inline PR comments on specific lines
  • Custom rules β€” Allow repos to define .osstriage.yml with project-specific review guidelines
  • Batch mode β€” Triage all open issues in a repository at once
  • Metrics dashboard β€” Track review accuracy and time saved

🀝 Contributing

Contributions are welcome! This project exists to help the OSS community, and we'd love your help making it better.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting (uv run pytest && uv run ruff check src/)
  5. Commit and push (git push origin feature/amazing-feature)
  6. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built with ❀️ for the open-source community.

Because maintainers deserve sleep too.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages