Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repo CLI tool with analysis and test coverage features #594

Merged
merged 77 commits into from
Jan 24, 2025
Merged

Conversation

AtlantisPleb
Copy link
Contributor

@AtlantisPleb AtlantisPleb commented Jan 24, 2025

This PR adds a new repo CLI tool that provides repository analysis, test coverage analysis, and GitHub integration.

Major Features Added

1. Repository Analysis CLI Tool

  • New repo binary for repository analysis
  • Clones target repository into temp directory
  • Generates repository map using tree-sitter
  • Analyzes repository structure and content
  • Cleans up temp directories automatically

2. Test Coverage Analysis (--test flag)

  • Analyzes test coverage using DeepSeek
  • Generates test suggestions for uncovered functionality
  • Provides complete test implementations
  • Posts recommendations as GitHub comments
  • Features colored streaming output for reasoning and results

3. GitHub Integration

  • Fetches and analyzes GitHub issues
  • Posts analysis results as comments
  • Integrates with DeepSeek for intelligent analysis
  • Handles GitHub tokens and authentication

Implementation Details

Repository Analysis

  • Uses tree-sitter for Rust code parsing
  • Generates detailed repository maps
  • Analyzes code structure and patterns
  • Supports multiple file types (Rust, HTML, CSS, JS)

Test Coverage Features

  • Streaming output for analysis phases
  • Complete test implementation generation:
    • Necessary imports
    • Test module setup
    • Test fixtures and mocks
    • Multiple test cases
    • Edge case handling

Environment Management

  • Secure temporary directory handling
  • Automatic cleanup
  • Environment variable management
  • Error handling and recovery

Usage

Basic repository analysis:

cargo run --bin repo

Test coverage analysis:

cargo run --bin repo -- --test

Changes

  • Added src/bin/repo.rs - Main CLI implementation
  • Added src/repomap.rs - Repository mapping functionality
  • Modified src/server/services/github_issue.rs - GitHub integration
  • Added test coverage analysis features
  • Added colored output handling
  • Added GitHub comment integration
  • Improved prompts for analysis

Testing

The features have been tested with:

  • Repository structure analysis
  • Test coverage analysis
  • Test implementation generation
  • GitHub issue integration
  • Comment posting
  • Streaming output display
  • Temporary directory management

Dependencies Added

  • clap - CLI argument parsing
  • tree-sitter - Code parsing
  • termcolor - Colored output
  • git2 - Repository operations

Closes #592

@AtlantisPleb AtlantisPleb changed the title Add test coverage analysis to repo CLI Add repo CLI tool with analysis and test coverage features Jan 24, 2025
@AtlantisPleb AtlantisPleb merged commit 884ae3e into main Jan 24, 2025
4 checks passed
@AtlantisPleb AtlantisPleb deleted the repo branch January 24, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust environment isolation
1 participant