Metadata-Version: 2.4
Name: checkod-ai
Version: 0.1.2
Summary: AI Impact Assessment for Code Changes
Home-page: https://github.com/yourusername/checkod-ai
Author: Anup Moncy
Author-email: Anup Moncy <n93181165@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/checkod-ai
Project-URL: Bug Tracker, https://github.com/yourusername/checkod-ai/issues
Keywords: git,analysis,code-review,ai,impact-assessment
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.9.0
Requires-Dist: GitPython>=3.1.40
Requires-Dist: requests>=2.31.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# CheckodAI

AI Impact Assessment for code changes - understand what Copilot changed before you commit it.

## Overview

CheckodAI is a Python CLI tool that helps developers understand the scope and implications of their code changes by analyzing git diffs and extracting modified symbols (functions, classes, variables). It can optionally use a local LLM (Ollama) to assess the risk of each change.

## Privacy

CheckodAI runs entirely locally.

- No code is uploaded
- No cloud calls required
- No telemetry
- Works offline with local LLM (Ollama)

All analysis happens on your machine.

**Key Features:**
- 🚀 Local-first: Runs entirely on your machine - no cloud calls
- 🔍 Symbol-level analysis: Detects changed functions, classes, and variables
- 🏷️ Change type detection: Identifies what type of change (added, removed, modified, signature changed)
- 💡 Impact summaries: Human-readable recommendations for each changed symbol
- 🤖 AI-powered risk assessment: Uses local Ollama for intelligent impact analysis
- 🛡️ Commit guard: Advisory warnings for HIGH risk changes (non-blocking)
- 🎯 CLI-first interface: Simple `checkod assess` command
- 📊 Summary reports: Clear output of what changed and risk levels
- ⚡ Graceful fallback: Works without Ollama using heuristic analysis

## Installation

### Prerequisites
- Python 3.8+
- Git
- Ollama (optional, for AI risk assessment)


## Initial Setup

Install from PyPI:
```bash
pip install checkod-ai
```

## How to Use

1. **Make your code change** (or let Copilot make changes)

2. **Stage your changes with git**
  ```bash
  git add .
  # For new files, you may need:
  git add -N .
  ```


3. **Run the assessment (no AI)**
  ```bash
  checkod assess
  ```

  Or, to use AI-powered risk assessment (requires Ollama):
  ```bash
  checkod assess-ai
  ```


> **Note:** For newly created files, you must run `git add -N .` (intent-to-add) so that `checkod assess` or `checkod assess-ai` can detect them. This is a git limitation for diff tools.

## Usage

### Basic Commands

Analyze changes in the current repository:
```bash
checkod assess
```

Analyze a specific repository:
```bash
checkod assess --repo /path/to/repo
```

### Example Output

```
🔍 Starting Impact Assessment...

📊 Changed Symbols (3 detected):
  • calculateDiscount
  • OrderStatus
  • userTier

📈 Change Summary:
  Functions: 1 function added
  Classes: 1 class added
  Variables: 1 variable added

================================================================================
📋 Impact Summary
================================================================================
You changed: calculateDiscount()
Change Type: function added
Risk Level: MEDIUM

This may affect:
  • checkout_service (logic flow)
  • /api/orders (user-facing behavior)
  • test_checkout (test coverage)

Recommended Actions:
  • Write unit tests for calculateDiscount
  • Test integration with checkout service
  • Document function parameters and return type
```

### Optional: Install Ollama for AI Risk Assessment

Ollama enables intelligent risk scoring. Install and configure:

```bash
# macOS / Linux
curl -fsSL https://ollama.ai/install.sh | sh

# Or use Homebrew (macOS)
brew install ollama

# Pull the model
ollama pull llama3

# Start the server (runs on localhost:11434)
ollama serve
```

With Ollama running, you'll also get AI-powered risk assessment:

```
================================================================================
🤖 AI Risk Assessment (powered by local Ollama)
================================================================================
Symbol: calculateDiscount
────────────────────────────────
Risk Classification: MEDIUM

Reason: Used in multiple modules; requires testing and code review.

Validation Steps:
• Test discount calculation across pricing tiers
• Verify integration with checkout service
• Add regression tests if coverage is low
```

## How It Works

1. **Reads git diff** - Gets all staged and unstaged changes
2. **Extracts symbols** - Finds functions, classes, and variables
3. **Detects change type** - Identifies what kind of change was made
4. **Assesses risk** - Uses local AI (Ollama) or heuristics
5. **Generates recommendations** - Suggests testing and review actions
6. **Advisory warnings** - HIGH risk changes trigger warnings

---

**Note**: This is an early-stage project. The API and behavior are subject to change.
