Skip to content

Hell1213/OSSdev

Repository files navigation

OSS_dev - Autonomous Open Source Contributor CLI

An autonomous CLI tool that acts as an AI-powered open source contributor, automatically analyzing GitHub issues, generating verified fixes through iterative testing, and creating pull requests.

🎯 What It Does

  • βœ… Analyzes issues semantically using Gemini 3
  • βœ… Searches code surgically with 90% context reduction
  • βœ… Self-corrects through test failures (up to 5 iterations)
  • βœ… Creates verified PRs automatically

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git
  • Ripgrep (brew install ripgrep on macOS, apt install ripgrep on Ubuntu)

Installation

# Clone the repository
git clone <your-repo-url>
cd oss-dev

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env
# Edit .env with your API keys (already configured if you're the developer)

# Build the project
npm run build

# Run the CLI
npm run dev fix <github-issue-url>

πŸ“‹ API Keys Setup;

The project requires three API keys (already configured in .env):

1. Gemini API Key

2. E2B API Key

3. GitHub Personal Access Token

πŸ’» Usage

# Fix a GitHub issue
npm run dev fix https://github.com/owner/repo/issues/123

# Dry run (analyze only, no PR)
npm run dev fix https://github.com/owner/repo/issues/123 --dry-run

# Verbose output
npm run dev fix https://github.com/owner/repo/issues/123 --verbose

# Limit fix attempts
npm run dev fix https://github.com/owner/repo/issues/123 --max-attempts 3

πŸ—οΈ Architecture

CLI Layer (Commander.js)
    ↓
Orchestrator (Workflow coordination)
    ↓
β”œβ”€ GitHub Client (Octokit)
β”œβ”€ Agents (Gemini 3)
β”‚  β”œβ”€ Issue Analyzer (Pro)
β”‚  β”œβ”€ Scout Agent (Flash)
β”‚  └─ Engineer Agent (Pro)
β”œβ”€ Search (Ripgrep)
└─ Sandbox (E2B)

πŸ“ Project Structure

oss-dev/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli/              # CLI interface
β”‚   β”œβ”€β”€ agents/           # AI agents (Analyzer, Scout, Engineer)
β”‚   β”œβ”€β”€ tools/            # GitHub client, Ripgrep search
β”‚   β”œβ”€β”€ sandbox/          # E2B sandbox, fingerprinting
β”‚   β”œβ”€β”€ orchestrator/     # Workflow, fix loop
β”‚   β”œβ”€β”€ types/            # TypeScript interfaces
β”‚   └── utils/            # Logger, config
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/             # Unit tests
β”‚   β”œβ”€β”€ integration/      # Integration tests
β”‚   └── e2e/              # End-to-end tests
β”œβ”€β”€ .kiro/specs/          # Feature specifications
β”‚   └── oss-dev-cli/
β”‚       β”œβ”€β”€ requirements.md
β”‚       β”œβ”€β”€ design.md
β”‚       └── tasks.md
β”œβ”€β”€ DEVELOPMENT.md        # Complete build guide
β”œβ”€β”€ IMPLEMENTATION.md     # Technical implementation details
└── DEPLOYMENT.md         # Deployment guide

πŸ”¨ Development

Important Notes from DEVELOPMENT.md

ALWAYS DO CORE IMPLEMENTATION - Avoid patchwork completely. Build solid, maintainable code from the start.

KEEP CODE CLEAN - Only add comments when needed and keep them small and meaningful.

MAINTAIN CORE LOGIC - Keep core logic consistent throughout the app.

SIMPLE COMMIT MESSAGES - Write meaningful, short commit messages without FEAT/ECHO prefixes.

Build Commands

# Development mode with auto-reload
npm run dev

# Build TypeScript
npm run build

# Run tests
npm test

# Run tests with coverage
npm test -- --coverage

# Run linter
npm run lint

# Type check
npx tsc --noEmit

πŸ§ͺ Testing Strategy

The project uses a dual testing approach:

Unit Tests

  • Verify specific examples and edge cases
  • Test integration points between components
  • Test error conditions

Property-Based Tests

  • Verify universal properties across all inputs
  • Test with randomized inputs (100+ iterations)
  • Catch edge cases that unit tests might miss

Framework: Jest + fast-check

πŸ“š Documentation

🎯 Implementation Plan

Follow the tasks in .kiro/specs/oss-dev-cli/tasks.md:

  1. Project Setup - Initialize TypeScript, install dependencies
  2. Core Types - Define interfaces and data models
  3. Utilities - Logger, config management
  4. GitHub Integration - URL parser, GitHub client
  5. Agents - Issue Analyzer, Scout, Engineer
  6. Search - Ripgrep integration
  7. Sandbox - E2B sandbox, fingerprinting
  8. Orchestration - Fix loop, main workflow
  9. CLI - Command-line interface
  10. Testing - Unit, integration, E2E tests

πŸ”„ Workflow

  1. Parse URL β†’ Extract owner/repo/issue number
  2. Fetch Issue β†’ Get title, body, labels from GitHub
  3. Analyze Issue β†’ Extract structured information with Gemini
  4. Clone Repo β†’ Shallow clone to temp directory
  5. Detect Stack β†’ Identify language, package manager
  6. Search Code β†’ Generate targeted ripgrep queries
  7. Provision Sandbox β†’ Create E2B environment
  8. Fix Loop β†’ Iteratively generate and test fixes
  9. Create PR β†’ Commit changes and open pull request
  10. Cleanup β†’ Terminate sandbox, remove temp files

πŸ’‘ Key Features

Surgical Context Gathering

  • Uses targeted ripgrep searches instead of full codebase analysis
  • 90% reduction in context size
  • Significantly lower API costs

Self-Correction Loop

  • Generates fix β†’ Applies to sandbox β†’ Runs tests
  • If tests fail, diagnoses the issue and tries again
  • Up to 5 attempts with learning from previous failures

Cost Optimization

  • Gemini Flash for routing and search queries (10x cheaper)
  • Gemini Pro for reasoning and code generation (higher quality)
  • Strategic model selection based on task complexity

πŸŽ“ Learning Resources

πŸ“ License

MIT

🀝 Contributing

Contributions welcome after the initial implementation!


Ready to build? Start with task 1 in .kiro/specs/oss-dev-cli/tasks.md πŸš€

About

OSS contributor in your CLI

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published