prcodesnip


Nameprcodesnip JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryAI-powered GitHub PR analysis, risk prediction, and automated release notes generation
upload_time2025-08-11 22:11:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords github pr analysis ai release-notes code-quality devops ci-cd automation risk-prediction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PRCodeSnip 🚀

[![PyPI version](https://badge.fury.io/py/prcodesnip.svg)](https://badge.fury.io/py/prcodesnip)
[![Python Support](https://img.shields.io/pypi/pyversions/prcodesnip.svg)](https://pypi.org/project/prcodesnip/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

AI-powered GitHub PR analysis, risk prediction, and automated release notes generation. Make smarter merge decisions with intelligent pre-merge analysis.

## ✨ Features

- 🎯 **Smart Risk Prediction**: AI-powered analysis to predict PR risks before merge
- 📝 **Automated Release Notes**: Generate professional release notes from PR changes
- 🔍 **Code Quality Analysis**: Comprehensive pre-merge code quality checks
- 🌐 **Multi-language Support**: Interface available in 25+ languages
- 🤖 **GitHub Integration**: Post comments, create status checks, and workflow automation
- ⚡ **Lightning Fast**: Async processing with parallel analysis
- 🛡️ **Security First**: Built-in security scanning and vulnerability detection

## 🚀 Quick Start

### Installation

```bash
# Install from PyPI
pip install prcodesnip

# Or install in development mode
pip install -e .
```

### First-time Setup (Interactive)

```bash
prcodesnip setup
```

This will guide you through:
- Setting up GitHub token
- Configuring OpenAI API key (optional)
- Setting default repository
- Choosing language preferences

### Basic Usage

```bash
# Quick risk analysis
prcodesnip predict-risk --pr 123 --repo owner/repo

# Generate release notes
prcodesnip draft-release --pr 123 --repo owner/repo

# Complete pre-merge analysis
prcodesnip premerge-analyze --pr 123 --post-comment
```

## 📋 Complete Command Reference

### 🔧 Setup and Configuration

#### `prcodesnip setup`
Interactive setup wizard for first-time users.

```bash
prcodesnip setup
```

**What it does:**
- Guides you through GitHub token setup
- Configures OpenAI API key for AI features
- Sets default repository and preferences
- Creates configuration file

---

#### `prcodesnip config`
Manage configuration settings.

```bash
# Show current configuration
prcodesnip config --show

# Test your configuration
prcodesnip config --test

# Create sample config file
prcodesnip config --create

# Reset configuration (run setup again)
prcodesnip config --reset
```

**Options:**
- `--show`: Display current configuration with masked tokens
- `--test`: Test GitHub and OpenAI API connections
- `--create`: Create a sample configuration file
- `--reset`: Reset configuration and run interactive setup

---

### 🎯 Risk Analysis Commands

#### `prcodesnip predict-risk`
Analyze and predict risks for a PR before merging.

```bash
prcodesnip predict-risk --pr 123 --repo owner/repo [OPTIONS]
```

**Required Options:**
- `--pr INTEGER`: Pull Request number to analyze
- `--repo TEXT`: GitHub repository in format `owner/repo`

**Optional Options:**
- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)
- `--detailed`: Show detailed risk breakdown by category
- `--debug`: Enable debug logging

**Example Output:**
```
✅ Risk Prediction Results
========================================
Overall Risk: ⚠️ Moderate (0.65/1.0)
Confidence: 0.85

📊 Detailed Risk Breakdown:
  🐛 Bug Probability: 0.30
  🔒 Security Risk: 0.15
  ⚡ Performance Risk: 0.80
  🧩 Complexity Risk: 0.45

💡 Recommendations:
  1. Review performance impact of database changes
  2. Add unit tests for new authentication logic
  3. Consider breaking change into smaller PRs
```

---

### 📝 Release Notes Commands

#### `prcodesnip draft-release`
Generate draft release notes from PR changes.

```bash
prcodesnip draft-release --pr 123 --repo owner/repo [OPTIONS]
```

**Required Options:**
- `--pr INTEGER`: Pull Request number (or will prompt interactively)

**Optional Options:**
- `--repo TEXT`: GitHub repository (uses default from config if not provided)
- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)
- `--format [markdown|json|text]`: Output format (default: markdown)
- `--output TEXT`: Output file path (default: stdout)

**Format Examples:**

**Markdown (default):**
```markdown
## Draft Release Notes
*Generated from PR #123: Add user authentication system*

### ✨ New Features
- Add JWT-based user authentication
- Implement password reset functionality

### 🐛 Bug Fixes
- Fixed login form validation errors

### 📦 Dependencies
- Updated security packages to latest versions
```

**JSON:**
```json
{
  "version": "minor",
  "pr_number": 123,
  "title": "Add user authentication system",
  "generated_at": "2025-08-09T12:00:00.000000",
  "changes": {
    "features": ["Add JWT-based user authentication"],
    "bug_fixes": ["Fixed login form validation errors"]
  },
  "confidence_score": 0.85
}
```

**Text:**
```
Version: minor
Confidence: 0.85

## Draft Release Notes
*Generated from PR #123: Add user authentication system*

### New Features
- Add JWT-based user authentication
- Implement password reset functionality
```

---

### 🚀 Complete Analysis Commands

#### `prcodesnip premerge-analyze`
Complete pre-merge analysis with risk prediction and release notes.

```bash
prcodesnip premerge-analyze --pr 123 [OPTIONS]
```

**Optional Options:**
- `--pr INTEGER`: Pull Request number (will prompt if not provided)
- `--repo TEXT`: GitHub repository (uses default from config)
- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)
- `--commit-sha TEXT`: Commit SHA for GitHub status checks
- `--post-comment`: Post analysis results as PR comment
- `--create-status`: Create GitHub status check
- `--output TEXT`: Output file for analysis results (default: premerge-analysis.json)

**Example Usage:**
```bash
# Basic analysis
prcodesnip premerge-analyze --pr 123

# With GitHub integration
prcodesnip premerge-analyze --pr 123 --post-comment --create-status --commit-sha abc123def

# Save to custom file
prcodesnip premerge-analyze --pr 123 --output my-analysis.json
```

**Output Structure:**
```json
{
  "timestamp": "2025-08-09T12:00:00.000000",
  "pr_data": {
    "number": 123,
    "title": "Add new feature",
    "repository": "owner/repo"
  },
  "risk_analysis": {
    "risk_assessment": {
      "overall_score": 0.25,
      "risk_level": "low",
      "confidence": 0.90
    },
    "detailed_risks": {
      "bug_probability": 0.10,
      "security_risk": 0.05,
      "performance_risk": 0.30,
      "complexity_risk": 0.15
    },
    "recommendations": [
      "Add unit tests for new functionality",
      "Review performance impact"
    ]
  },
  "draft_release_notes": {
    "version": "minor",
    "release_notes": "## Draft Release Notes...",
    "confidence_score": 0.85
  }
}
```

---

#### `prprcodesnip analyze-fast`
Fast async analysis with parallel processing.

```bash
prprcodesnip analyze-fast --pr 123 --repo owner/repo [OPTIONS]
```

**Options:** Same as `analyze` command but optimized for speed.

**Features:**
- Parallel processing of analysis tasks
- Reduced memory usage
- Faster API calls
- Suitable for CI/CD pipelines

---

### 🤖 GitHub Integration Commands

#### `prprcodesnip setup-workflow`
Setup CI/CD workflow integration.

```bash
prprcodesnip setup-workflow [OPTIONS]
```

**Options:**
- `--provider [github-actions|gitlab-ci|jenkins]`: CI/CD provider (default: github-actions)
- `--output-dir TEXT`: Directory for workflow files (default: .github/workflows)

**Generated GitHub Actions Workflow:**
- Triggers on PR open/update
- Runs complete pre-merge analysis
- Posts results as PR comments
- Creates GitHub status checks
- Uploads analysis artifacts

**Setup Instructions After Generation:**
1. Add `OPENAI_API_KEY` to repository secrets
2. Ensure `GITHUB_TOKEN` has write permissions
3. Commit and push the workflow file
4. Create a test PR to see it in action

---

### 🌐 Multi-language Commands

#### `prcodesnip language`
Multi-language support commands for **programming language detection** and **interface languages**.

```bash
# Detect programming languages in repository
prcodesnip language detect-languages --repo owner/repo

# Setup development environment for programming language
prcodesnip language setup-environment python

# Set CLI interface language
prcodesnip language set-language es

# List available interface languages
prcodesnip language list-languages

# Show current locale information
prcodesnip language show-locale-info
```

**🖥️ CLI Interface Languages (25+ supported):**
- **European**: English, Spanish, French, German, Italian, Dutch, Portuguese, Russian, Polish, Czech
- **Asian**: Japanese, Korean, Chinese, Hindi, Thai, Vietnamese, Indonesian, Malay
- **Middle Eastern**: Arabic, Hebrew, Turkish
- **Nordic**: Swedish, Norwegian, Danish, Finnish
- **Other**: Romanian, Hungarian, Filipino

**💻 Programming Languages Supported (60+ languages):**

**Mainstream Languages:**
- Python, JavaScript, TypeScript, Go, Java, C#, Rust, C++, C
- PHP, Ruby, Swift, Kotlin, Scala

**Functional Languages:**
- Haskell, OCaml, Erlang, Elixir, F#, Clojure

**JVM Languages:**
- Java, Kotlin, Scala, Groovy, Clojure

**Systems Programming:**
- Rust, C, C++, Assembly, Zig

**Web Technologies:**
- HTML, CSS, JavaScript, TypeScript

**Mobile Development:**
- Swift (iOS), Kotlin (Android), Dart (Flutter), Objective-C

**Scientific Computing:**
- Python, R, MATLAB, Julia

**Scripting Languages:**
- Python, JavaScript, Bash, PowerShell, Perl, Lua, Fish

**Emerging Languages:**
- Crystal, Nim, V, Zig

**Blockchain:**
- Solidity, Vyper

**Game Development:**
- GDScript (Godot), ActionScript

**Hardware Description:**
- Verilog, VHDL, SystemVerilog

**Configuration & Markup:**
- YAML, TOML, JSON, XML, Markdown

**Infrastructure:**
- Dockerfile, Terraform, Makefile

**And many more!** See the complete list in the language detector.

---

### 🔍 Data and Analysis Commands

#### `prcodesnip analyze`
Legacy full analysis command (use `premerge-analyze` for new projects).

```bash
prcodesnip analyze --pr 123 --repo owner/repo [OPTIONS]
```

**Options:**
- `--pr INTEGER`: Pull Request number (required)
- `--repo TEXT`: GitHub repository
- `--token TEXT`: GitHub token
- `--openai-key TEXT`: OpenAI API key
- `--output TEXT`: Output file (default: release-notes.md)

---

#### `prcodesnip fetch`
Fetch raw PR data from GitHub (useful for debugging).

```bash
prcodesnip fetch --pr 123 --repo owner/repo [OPTIONS]
```

**Options:**
- `--pr INTEGER`: Pull Request number (required)
- `--repo TEXT`: GitHub repository
- `--token TEXT`: GitHub token

**Output:** Raw JSON data with PR title, body, diff, and metadata.

---

### 📚 Help and Information Commands

#### `prcodesnip quickstart`
Show quick start guide for new users.

```bash
prcodesnip quickstart
```

**Displays:**
- First-time setup instructions
- Basic usage examples
- Configuration tips
- GitHub integration guide

---

## 🔧 Configuration Options

### Environment Variables

```bash
# Required for GitHub integration
export GITHUB_TOKEN="ghp_your_token_here"

# Optional for AI-powered release notes
export OPENAI_API_KEY="sk-your_key_here"

# Optional language setting
export PRCODESNIP_LANGUAGE="es"
```

### Configuration File

PRCodeSnip looks for configuration in these locations (in order):
1. `./.prcodesnip.json` (current directory)
2. `~/.prcodesnip/config.json` (user home)
3. Environment variables

**Sample Configuration:**
```json
{
  "github": {
    "token": "env:GITHUB_TOKEN",
    "default_repo": "owner/repo"
  },
  "openai": {
    "api_key": "env:OPENAI_API_KEY",
    "model": "gpt-4o-mini"
  },
  "quality": {
    "tools": ["pytest", "pylint", "bandit", "coverage"],
    "timeout": 300
  },
  "output": {
    "default_format": "markdown",
    "default_file": "release-notes.md"
  },
  "language": "en"
}
```

## 📖 Usage Examples

### 🎯 Risk Analysis Examples

```bash
# Basic risk analysis
prcodesnip predict-risk --pr 42 --repo microsoft/vscode

# Detailed risk breakdown
prcodesnip predict-risk --pr 42 --repo owner/repo --detailed

# With debug information
prcodesnip predict-risk --pr 42 --repo owner/repo --detailed --debug
```

### 📝 Release Notes Examples

```bash
# Generate markdown release notes
prcodesnip draft-release --pr 42 --repo owner/repo

# Generate JSON format
prcodesnip draft-release --pr 42 --repo owner/repo --format json

# Save to file
prcodesnip draft-release --pr 42 --repo owner/repo --output changelog.md

# Interactive mode (prompts for PR and repo)
prcodesnip draft-release
```

### 🚀 Complete Analysis Examples

```bash
# Basic analysis
prcodesnip premerge-analyze --pr 42

# With GitHub integration
prcodesnip premerge-analyze --pr 42 --post-comment --create-status

# Production workflow
prcodesnip premerge-analyze \
  --pr 42 \
  --repo owner/repo \
  --commit-sha abc123def \
  --post-comment \
  --create-status \
  --output production-analysis.json
```

### 🌐 Multi-language Examples

```bash
# === PROGRAMMING LANGUAGE DETECTION ===
# Detect programming languages used in repository
prcodesnip language detect-languages --repo microsoft/vscode

# Setup development environment for specific programming language
prcodesnip language setup-environment python --project-path ./my-python-project

# === CLI INTERFACE LANGUAGES ===
# Set Spanish interface for CLI
prcodesnip language set-language es

# Analyze with Spanish interface
prcodesnip predict-risk --pr 42 --repo owner/repo --language es

# Show current locale and number formatting
prcodesnip language show-locale-info

# List all available interface languages
prcodesnip language list-languages
```

### 🔍 Language Support Explanation

**🖥️ CLI Interface Languages:**
- Changes the language of CodeSnip's interface (menus, messages, help text)
- Affects number formatting, currency display, date formats
- 25+ languages supported (Spanish, French, German, Japanese, etc.)
- Use: `prcodesnip language set-language es`

**💻 Programming Language Detection:**
- Detects which programming languages are used in your repository
- Analyzes code files, configuration files, and project structure
- 60+ programming languages supported (Python, JavaScript, Go, Rust, etc.)
- Automatically installs appropriate development tools and linters
- Use: `prcodesnip language detect-languages --repo owner/repo`

**Example Output for Programming Language Detection:**
```
🎯 Primary Language: python
📊 Detected Languages: python, javascript, dockerfile, yaml
⚙️ Installing tools for python, javascript...
✅ Tools installed: pytest, pylint, eslint, prettier, hadolint
```

## 🔒 Security and Privacy

- **Token Security**: Tokens are never logged or stored in plain text
- **API Calls**: Only necessary data is sent to external APIs
- **Local Processing**: Most analysis happens locally
- **Configurable**: All external integrations are optional

## ⚡ Performance Tips

1. **Use Fast Mode**: `analyze-fast` for CI/CD pipelines
2. **Set Timeouts**: Configure appropriate timeouts in config
3. **Cache Results**: Results are cached for repeated analyses
4. **Parallel Processing**: Multiple PRs can be analyzed simultaneously

## 🛠️ Development and Testing

### Local Development

```bash
# Clone repository
git clone https://github.com/your-org/prcodesnip
cd prcodesnip

# Setup development environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or venv\Scripts\activate  # Windows

# Install in development mode
pip install -e .[dev]

# Run tests
pytest

# Run with coverage
coverage run -m pytest
coverage report
```

**Note**: The `venv/` folder is automatically created and should not be committed to version control. It's included in `.gitignore`.

### Testing Your Changes

```bash
# Test with real PR
prcodesnip draft-release --pr 4 --repo your-username/your-repo

# Test risk prediction
prcodesnip predict-risk --pr 4 --repo your-username/your-repo --detailed

# Test full analysis
prcodesnip premerge-analyze --pr 4 --output test-analysis.json
```

## 🤝 Contributing

Contributions welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 📞 Support and Community

- 📖 [Documentation](https://docs.prcodesnip.com)
- 🐛 [Report Issues](https://github.com/prcodesnip/prcodesnip/issues)
- 💬 [Discussions](https://github.com/prcodesnip/prcodesnip/discussions)
- 📧 [Email Support](mailto:support@prcodesnip.com)

---

Made with ❤️ by the PRCodeSnip team. Happy coding! 🚀

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "prcodesnip",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "github, pr, analysis, ai, release-notes, code-quality, devops, ci-cd, automation, risk-prediction",
    "author": null,
    "author_email": "CodeSnip Team <support@codesnip.com>",
    "download_url": "https://files.pythonhosted.org/packages/a6/c3/dd0033270859c52923047a6e75fb3013246699661183c059097075c0ff82/prcodesnip-1.0.0.tar.gz",
    "platform": null,
    "description": "# PRCodeSnip \ud83d\ude80\n\n[![PyPI version](https://badge.fury.io/py/prcodesnip.svg)](https://badge.fury.io/py/prcodesnip)\n[![Python Support](https://img.shields.io/pypi/pyversions/prcodesnip.svg)](https://pypi.org/project/prcodesnip/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nAI-powered GitHub PR analysis, risk prediction, and automated release notes generation. Make smarter merge decisions with intelligent pre-merge analysis.\n\n## \u2728 Features\n\n- \ud83c\udfaf **Smart Risk Prediction**: AI-powered analysis to predict PR risks before merge\n- \ud83d\udcdd **Automated Release Notes**: Generate professional release notes from PR changes\n- \ud83d\udd0d **Code Quality Analysis**: Comprehensive pre-merge code quality checks\n- \ud83c\udf10 **Multi-language Support**: Interface available in 25+ languages\n- \ud83e\udd16 **GitHub Integration**: Post comments, create status checks, and workflow automation\n- \u26a1 **Lightning Fast**: Async processing with parallel analysis\n- \ud83d\udee1\ufe0f **Security First**: Built-in security scanning and vulnerability detection\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\n# Install from PyPI\npip install prcodesnip\n\n# Or install in development mode\npip install -e .\n```\n\n### First-time Setup (Interactive)\n\n```bash\nprcodesnip setup\n```\n\nThis will guide you through:\n- Setting up GitHub token\n- Configuring OpenAI API key (optional)\n- Setting default repository\n- Choosing language preferences\n\n### Basic Usage\n\n```bash\n# Quick risk analysis\nprcodesnip predict-risk --pr 123 --repo owner/repo\n\n# Generate release notes\nprcodesnip draft-release --pr 123 --repo owner/repo\n\n# Complete pre-merge analysis\nprcodesnip premerge-analyze --pr 123 --post-comment\n```\n\n## \ud83d\udccb Complete Command Reference\n\n### \ud83d\udd27 Setup and Configuration\n\n#### `prcodesnip setup`\nInteractive setup wizard for first-time users.\n\n```bash\nprcodesnip setup\n```\n\n**What it does:**\n- Guides you through GitHub token setup\n- Configures OpenAI API key for AI features\n- Sets default repository and preferences\n- Creates configuration file\n\n---\n\n#### `prcodesnip config`\nManage configuration settings.\n\n```bash\n# Show current configuration\nprcodesnip config --show\n\n# Test your configuration\nprcodesnip config --test\n\n# Create sample config file\nprcodesnip config --create\n\n# Reset configuration (run setup again)\nprcodesnip config --reset\n```\n\n**Options:**\n- `--show`: Display current configuration with masked tokens\n- `--test`: Test GitHub and OpenAI API connections\n- `--create`: Create a sample configuration file\n- `--reset`: Reset configuration and run interactive setup\n\n---\n\n### \ud83c\udfaf Risk Analysis Commands\n\n#### `prcodesnip predict-risk`\nAnalyze and predict risks for a PR before merging.\n\n```bash\nprcodesnip predict-risk --pr 123 --repo owner/repo [OPTIONS]\n```\n\n**Required Options:**\n- `--pr INTEGER`: Pull Request number to analyze\n- `--repo TEXT`: GitHub repository in format `owner/repo`\n\n**Optional Options:**\n- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)\n- `--detailed`: Show detailed risk breakdown by category\n- `--debug`: Enable debug logging\n\n**Example Output:**\n```\n\u2705 Risk Prediction Results\n========================================\nOverall Risk: \u26a0\ufe0f Moderate (0.65/1.0)\nConfidence: 0.85\n\n\ud83d\udcca Detailed Risk Breakdown:\n  \ud83d\udc1b Bug Probability: 0.30\n  \ud83d\udd12 Security Risk: 0.15\n  \u26a1 Performance Risk: 0.80\n  \ud83e\udde9 Complexity Risk: 0.45\n\n\ud83d\udca1 Recommendations:\n  1. Review performance impact of database changes\n  2. Add unit tests for new authentication logic\n  3. Consider breaking change into smaller PRs\n```\n\n---\n\n### \ud83d\udcdd Release Notes Commands\n\n#### `prcodesnip draft-release`\nGenerate draft release notes from PR changes.\n\n```bash\nprcodesnip draft-release --pr 123 --repo owner/repo [OPTIONS]\n```\n\n**Required Options:**\n- `--pr INTEGER`: Pull Request number (or will prompt interactively)\n\n**Optional Options:**\n- `--repo TEXT`: GitHub repository (uses default from config if not provided)\n- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)\n- `--format [markdown|json|text]`: Output format (default: markdown)\n- `--output TEXT`: Output file path (default: stdout)\n\n**Format Examples:**\n\n**Markdown (default):**\n```markdown\n## Draft Release Notes\n*Generated from PR #123: Add user authentication system*\n\n### \u2728 New Features\n- Add JWT-based user authentication\n- Implement password reset functionality\n\n### \ud83d\udc1b Bug Fixes\n- Fixed login form validation errors\n\n### \ud83d\udce6 Dependencies\n- Updated security packages to latest versions\n```\n\n**JSON:**\n```json\n{\n  \"version\": \"minor\",\n  \"pr_number\": 123,\n  \"title\": \"Add user authentication system\",\n  \"generated_at\": \"2025-08-09T12:00:00.000000\",\n  \"changes\": {\n    \"features\": [\"Add JWT-based user authentication\"],\n    \"bug_fixes\": [\"Fixed login form validation errors\"]\n  },\n  \"confidence_score\": 0.85\n}\n```\n\n**Text:**\n```\nVersion: minor\nConfidence: 0.85\n\n## Draft Release Notes\n*Generated from PR #123: Add user authentication system*\n\n### New Features\n- Add JWT-based user authentication\n- Implement password reset functionality\n```\n\n---\n\n### \ud83d\ude80 Complete Analysis Commands\n\n#### `prcodesnip premerge-analyze`\nComplete pre-merge analysis with risk prediction and release notes.\n\n```bash\nprcodesnip premerge-analyze --pr 123 [OPTIONS]\n```\n\n**Optional Options:**\n- `--pr INTEGER`: Pull Request number (will prompt if not provided)\n- `--repo TEXT`: GitHub repository (uses default from config)\n- `--token TEXT`: GitHub token (or set `GITHUB_TOKEN` env var)\n- `--commit-sha TEXT`: Commit SHA for GitHub status checks\n- `--post-comment`: Post analysis results as PR comment\n- `--create-status`: Create GitHub status check\n- `--output TEXT`: Output file for analysis results (default: premerge-analysis.json)\n\n**Example Usage:**\n```bash\n# Basic analysis\nprcodesnip premerge-analyze --pr 123\n\n# With GitHub integration\nprcodesnip premerge-analyze --pr 123 --post-comment --create-status --commit-sha abc123def\n\n# Save to custom file\nprcodesnip premerge-analyze --pr 123 --output my-analysis.json\n```\n\n**Output Structure:**\n```json\n{\n  \"timestamp\": \"2025-08-09T12:00:00.000000\",\n  \"pr_data\": {\n    \"number\": 123,\n    \"title\": \"Add new feature\",\n    \"repository\": \"owner/repo\"\n  },\n  \"risk_analysis\": {\n    \"risk_assessment\": {\n      \"overall_score\": 0.25,\n      \"risk_level\": \"low\",\n      \"confidence\": 0.90\n    },\n    \"detailed_risks\": {\n      \"bug_probability\": 0.10,\n      \"security_risk\": 0.05,\n      \"performance_risk\": 0.30,\n      \"complexity_risk\": 0.15\n    },\n    \"recommendations\": [\n      \"Add unit tests for new functionality\",\n      \"Review performance impact\"\n    ]\n  },\n  \"draft_release_notes\": {\n    \"version\": \"minor\",\n    \"release_notes\": \"## Draft Release Notes...\",\n    \"confidence_score\": 0.85\n  }\n}\n```\n\n---\n\n#### `prprcodesnip analyze-fast`\nFast async analysis with parallel processing.\n\n```bash\nprprcodesnip analyze-fast --pr 123 --repo owner/repo [OPTIONS]\n```\n\n**Options:** Same as `analyze` command but optimized for speed.\n\n**Features:**\n- Parallel processing of analysis tasks\n- Reduced memory usage\n- Faster API calls\n- Suitable for CI/CD pipelines\n\n---\n\n### \ud83e\udd16 GitHub Integration Commands\n\n#### `prprcodesnip setup-workflow`\nSetup CI/CD workflow integration.\n\n```bash\nprprcodesnip setup-workflow [OPTIONS]\n```\n\n**Options:**\n- `--provider [github-actions|gitlab-ci|jenkins]`: CI/CD provider (default: github-actions)\n- `--output-dir TEXT`: Directory for workflow files (default: .github/workflows)\n\n**Generated GitHub Actions Workflow:**\n- Triggers on PR open/update\n- Runs complete pre-merge analysis\n- Posts results as PR comments\n- Creates GitHub status checks\n- Uploads analysis artifacts\n\n**Setup Instructions After Generation:**\n1. Add `OPENAI_API_KEY` to repository secrets\n2. Ensure `GITHUB_TOKEN` has write permissions\n3. Commit and push the workflow file\n4. Create a test PR to see it in action\n\n---\n\n### \ud83c\udf10 Multi-language Commands\n\n#### `prcodesnip language`\nMulti-language support commands for **programming language detection** and **interface languages**.\n\n```bash\n# Detect programming languages in repository\nprcodesnip language detect-languages --repo owner/repo\n\n# Setup development environment for programming language\nprcodesnip language setup-environment python\n\n# Set CLI interface language\nprcodesnip language set-language es\n\n# List available interface languages\nprcodesnip language list-languages\n\n# Show current locale information\nprcodesnip language show-locale-info\n```\n\n**\ud83d\udda5\ufe0f CLI Interface Languages (25+ supported):**\n- **European**: English, Spanish, French, German, Italian, Dutch, Portuguese, Russian, Polish, Czech\n- **Asian**: Japanese, Korean, Chinese, Hindi, Thai, Vietnamese, Indonesian, Malay\n- **Middle Eastern**: Arabic, Hebrew, Turkish\n- **Nordic**: Swedish, Norwegian, Danish, Finnish\n- **Other**: Romanian, Hungarian, Filipino\n\n**\ud83d\udcbb Programming Languages Supported (60+ languages):**\n\n**Mainstream Languages:**\n- Python, JavaScript, TypeScript, Go, Java, C#, Rust, C++, C\n- PHP, Ruby, Swift, Kotlin, Scala\n\n**Functional Languages:**\n- Haskell, OCaml, Erlang, Elixir, F#, Clojure\n\n**JVM Languages:**\n- Java, Kotlin, Scala, Groovy, Clojure\n\n**Systems Programming:**\n- Rust, C, C++, Assembly, Zig\n\n**Web Technologies:**\n- HTML, CSS, JavaScript, TypeScript\n\n**Mobile Development:**\n- Swift (iOS), Kotlin (Android), Dart (Flutter), Objective-C\n\n**Scientific Computing:**\n- Python, R, MATLAB, Julia\n\n**Scripting Languages:**\n- Python, JavaScript, Bash, PowerShell, Perl, Lua, Fish\n\n**Emerging Languages:**\n- Crystal, Nim, V, Zig\n\n**Blockchain:**\n- Solidity, Vyper\n\n**Game Development:**\n- GDScript (Godot), ActionScript\n\n**Hardware Description:**\n- Verilog, VHDL, SystemVerilog\n\n**Configuration & Markup:**\n- YAML, TOML, JSON, XML, Markdown\n\n**Infrastructure:**\n- Dockerfile, Terraform, Makefile\n\n**And many more!** See the complete list in the language detector.\n\n---\n\n### \ud83d\udd0d Data and Analysis Commands\n\n#### `prcodesnip analyze`\nLegacy full analysis command (use `premerge-analyze` for new projects).\n\n```bash\nprcodesnip analyze --pr 123 --repo owner/repo [OPTIONS]\n```\n\n**Options:**\n- `--pr INTEGER`: Pull Request number (required)\n- `--repo TEXT`: GitHub repository\n- `--token TEXT`: GitHub token\n- `--openai-key TEXT`: OpenAI API key\n- `--output TEXT`: Output file (default: release-notes.md)\n\n---\n\n#### `prcodesnip fetch`\nFetch raw PR data from GitHub (useful for debugging).\n\n```bash\nprcodesnip fetch --pr 123 --repo owner/repo [OPTIONS]\n```\n\n**Options:**\n- `--pr INTEGER`: Pull Request number (required)\n- `--repo TEXT`: GitHub repository\n- `--token TEXT`: GitHub token\n\n**Output:** Raw JSON data with PR title, body, diff, and metadata.\n\n---\n\n### \ud83d\udcda Help and Information Commands\n\n#### `prcodesnip quickstart`\nShow quick start guide for new users.\n\n```bash\nprcodesnip quickstart\n```\n\n**Displays:**\n- First-time setup instructions\n- Basic usage examples\n- Configuration tips\n- GitHub integration guide\n\n---\n\n## \ud83d\udd27 Configuration Options\n\n### Environment Variables\n\n```bash\n# Required for GitHub integration\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\n\n# Optional for AI-powered release notes\nexport OPENAI_API_KEY=\"sk-your_key_here\"\n\n# Optional language setting\nexport PRCODESNIP_LANGUAGE=\"es\"\n```\n\n### Configuration File\n\nPRCodeSnip looks for configuration in these locations (in order):\n1. `./.prcodesnip.json` (current directory)\n2. `~/.prcodesnip/config.json` (user home)\n3. Environment variables\n\n**Sample Configuration:**\n```json\n{\n  \"github\": {\n    \"token\": \"env:GITHUB_TOKEN\",\n    \"default_repo\": \"owner/repo\"\n  },\n  \"openai\": {\n    \"api_key\": \"env:OPENAI_API_KEY\",\n    \"model\": \"gpt-4o-mini\"\n  },\n  \"quality\": {\n    \"tools\": [\"pytest\", \"pylint\", \"bandit\", \"coverage\"],\n    \"timeout\": 300\n  },\n  \"output\": {\n    \"default_format\": \"markdown\",\n    \"default_file\": \"release-notes.md\"\n  },\n  \"language\": \"en\"\n}\n```\n\n## \ud83d\udcd6 Usage Examples\n\n### \ud83c\udfaf Risk Analysis Examples\n\n```bash\n# Basic risk analysis\nprcodesnip predict-risk --pr 42 --repo microsoft/vscode\n\n# Detailed risk breakdown\nprcodesnip predict-risk --pr 42 --repo owner/repo --detailed\n\n# With debug information\nprcodesnip predict-risk --pr 42 --repo owner/repo --detailed --debug\n```\n\n### \ud83d\udcdd Release Notes Examples\n\n```bash\n# Generate markdown release notes\nprcodesnip draft-release --pr 42 --repo owner/repo\n\n# Generate JSON format\nprcodesnip draft-release --pr 42 --repo owner/repo --format json\n\n# Save to file\nprcodesnip draft-release --pr 42 --repo owner/repo --output changelog.md\n\n# Interactive mode (prompts for PR and repo)\nprcodesnip draft-release\n```\n\n### \ud83d\ude80 Complete Analysis Examples\n\n```bash\n# Basic analysis\nprcodesnip premerge-analyze --pr 42\n\n# With GitHub integration\nprcodesnip premerge-analyze --pr 42 --post-comment --create-status\n\n# Production workflow\nprcodesnip premerge-analyze \\\n  --pr 42 \\\n  --repo owner/repo \\\n  --commit-sha abc123def \\\n  --post-comment \\\n  --create-status \\\n  --output production-analysis.json\n```\n\n### \ud83c\udf10 Multi-language Examples\n\n```bash\n# === PROGRAMMING LANGUAGE DETECTION ===\n# Detect programming languages used in repository\nprcodesnip language detect-languages --repo microsoft/vscode\n\n# Setup development environment for specific programming language\nprcodesnip language setup-environment python --project-path ./my-python-project\n\n# === CLI INTERFACE LANGUAGES ===\n# Set Spanish interface for CLI\nprcodesnip language set-language es\n\n# Analyze with Spanish interface\nprcodesnip predict-risk --pr 42 --repo owner/repo --language es\n\n# Show current locale and number formatting\nprcodesnip language show-locale-info\n\n# List all available interface languages\nprcodesnip language list-languages\n```\n\n### \ud83d\udd0d Language Support Explanation\n\n**\ud83d\udda5\ufe0f CLI Interface Languages:**\n- Changes the language of CodeSnip's interface (menus, messages, help text)\n- Affects number formatting, currency display, date formats\n- 25+ languages supported (Spanish, French, German, Japanese, etc.)\n- Use: `prcodesnip language set-language es`\n\n**\ud83d\udcbb Programming Language Detection:**\n- Detects which programming languages are used in your repository\n- Analyzes code files, configuration files, and project structure\n- 60+ programming languages supported (Python, JavaScript, Go, Rust, etc.)\n- Automatically installs appropriate development tools and linters\n- Use: `prcodesnip language detect-languages --repo owner/repo`\n\n**Example Output for Programming Language Detection:**\n```\n\ud83c\udfaf Primary Language: python\n\ud83d\udcca Detected Languages: python, javascript, dockerfile, yaml\n\u2699\ufe0f Installing tools for python, javascript...\n\u2705 Tools installed: pytest, pylint, eslint, prettier, hadolint\n```\n\n## \ud83d\udd12 Security and Privacy\n\n- **Token Security**: Tokens are never logged or stored in plain text\n- **API Calls**: Only necessary data is sent to external APIs\n- **Local Processing**: Most analysis happens locally\n- **Configurable**: All external integrations are optional\n\n## \u26a1 Performance Tips\n\n1. **Use Fast Mode**: `analyze-fast` for CI/CD pipelines\n2. **Set Timeouts**: Configure appropriate timeouts in config\n3. **Cache Results**: Results are cached for repeated analyses\n4. **Parallel Processing**: Multiple PRs can be analyzed simultaneously\n\n## \ud83d\udee0\ufe0f Development and Testing\n\n### Local Development\n\n```bash\n# Clone repository\ngit clone https://github.com/your-org/prcodesnip\ncd prcodesnip\n\n# Setup development environment\npython -m venv venv\nsource venv/bin/activate  # Linux/Mac\n# or venv\\Scripts\\activate  # Windows\n\n# Install in development mode\npip install -e .[dev]\n\n# Run tests\npytest\n\n# Run with coverage\ncoverage run -m pytest\ncoverage report\n```\n\n**Note**: The `venv/` folder is automatically created and should not be committed to version control. It's included in `.gitignore`.\n\n### Testing Your Changes\n\n```bash\n# Test with real PR\nprcodesnip draft-release --pr 4 --repo your-username/your-repo\n\n# Test risk prediction\nprcodesnip predict-risk --pr 4 --repo your-username/your-repo --detailed\n\n# Test full analysis\nprcodesnip premerge-analyze --pr 4 --output test-analysis.json\n```\n\n## \ud83e\udd1d Contributing\n\nContributions welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests\n5. Submit a pull request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udcde Support and Community\n\n- \ud83d\udcd6 [Documentation](https://docs.prcodesnip.com)\n- \ud83d\udc1b [Report Issues](https://github.com/prcodesnip/prcodesnip/issues)\n- \ud83d\udcac [Discussions](https://github.com/prcodesnip/prcodesnip/discussions)\n- \ud83d\udce7 [Email Support](mailto:support@prcodesnip.com)\n\n---\n\nMade with \u2764\ufe0f by the PRCodeSnip team. Happy coding! \ud83d\ude80\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "AI-powered GitHub PR analysis, risk prediction, and automated release notes generation",
    "version": "1.0.0",
    "project_urls": {
        "Changelog": "https://github.com/codesnip/codesnip/blob/main/CHANGELOG.md",
        "Documentation": "https://docs.codesnip.com",
        "Homepage": "https://github.com/codesnip/codesnip",
        "Issues": "https://github.com/codesnip/codesnip/issues",
        "Repository": "https://github.com/codesnip/codesnip"
    },
    "split_keywords": [
        "github",
        " pr",
        " analysis",
        " ai",
        " release-notes",
        " code-quality",
        " devops",
        " ci-cd",
        " automation",
        " risk-prediction"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "68db36b42594d985b80104477cb25e4a1c5a856787553dc6aef5255be9ebb23c",
                "md5": "c8160fa6eb6d9430e3e2880b7fd4a729",
                "sha256": "69b824633e208e411d783e9620b4471658dc187cda87ba825cf25a75faa3a1b7"
            },
            "downloads": -1,
            "filename": "prcodesnip-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8160fa6eb6d9430e3e2880b7fd4a729",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 137692,
            "upload_time": "2025-08-11T22:11:24",
            "upload_time_iso_8601": "2025-08-11T22:11:24.310714Z",
            "url": "https://files.pythonhosted.org/packages/68/db/36b42594d985b80104477cb25e4a1c5a856787553dc6aef5255be9ebb23c/prcodesnip-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a6c3dd0033270859c52923047a6e75fb3013246699661183c059097075c0ff82",
                "md5": "d942e11937284ff8b1a6a35dc5844035",
                "sha256": "8c47be5f51491c5cf66338eaa7865d8ac77cd4f7a285fd3750bf58244cf0f7f9"
            },
            "downloads": -1,
            "filename": "prcodesnip-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d942e11937284ff8b1a6a35dc5844035",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 98543,
            "upload_time": "2025-08-11T22:11:26",
            "upload_time_iso_8601": "2025-08-11T22:11:26.152290Z",
            "url": "https://files.pythonhosted.org/packages/a6/c3/dd0033270859c52923047a6e75fb3013246699661183c059097075c0ff82/prcodesnip-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 22:11:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "codesnip",
    "github_project": "codesnip",
    "github_not_found": true,
    "lcname": "prcodesnip"
}
        
Elapsed time: 1.16235s