Metadata-Version: 2.4
Name: cognify-code
Version: 1.2.0
Summary: Your local AI-powered code assistant. Review, generate, search, and refactor code with an intelligent AI agent—all running locally with complete privacy.
Author-email: Ashok Kumar <akkssy@users.noreply.github.com>
Maintainer-email: Ashok Kumar <akkssy@users.noreply.github.com>
License: MIT
Project-URL: Homepage, https://akkssy.github.io/cognify-ai-website/
Project-URL: Documentation, https://github.com/akkssy/cognify-ai#readme
Project-URL: Repository, https://github.com/akkssy/cognify-ai
Project-URL: Issues, https://github.com/akkssy/cognify-ai/issues
Project-URL: Changelog, https://github.com/akkssy/cognify-ai/releases
Keywords: ai,code-review,code-generation,code-assistant,ai-agent,langchain,ollama,groq,gemini,cli,developer-tools,refactoring,semantic-search,local-llm,privacy
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: langchain>=0.1.0
Requires-Dist: langchain-core>=0.1.0
Requires-Dist: langchain-ollama>=0.1.0
Requires-Dist: langchain-openai>=0.1.0
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: tenacity>=8.0.0
Requires-Dist: tiktoken>=0.5.0
Requires-Dist: chromadb>=0.4.0
Requires-Dist: sentence-transformers>=2.0.0
Requires-Dist: watchdog>=4.0.0
Provides-Extra: google
Requires-Dist: langchain-google-genai>=1.0.0; extra == "google"
Provides-Extra: groq
Requires-Dist: langchain-groq>=0.1.0; extra == "groq"
Provides-Extra: all-providers
Requires-Dist: langchain-google-genai>=1.0.0; extra == "all-providers"
Requires-Dist: langchain-groq>=0.1.0; extra == "all-providers"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Dynamic: license-file

# 🧠 Cognify AI

<p align="center">
  <strong>Code Cognition — Your AI-Powered Code Assistant</strong>
</p>

<p align="center">
  <a href="#features">Features</a> •
  <a href="#vscode-extension">VSCode Extension</a> •
  <a href="#installation">Installation</a> •
  <a href="#providers">Providers</a> •
  <a href="#usage">Usage</a> •
  <a href="#documentation">Docs</a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="Python 3.9+">
  <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT License">
  <img src="https://img.shields.io/badge/tests-144%20passed-brightgreen.svg" alt="Tests">
  <img src="https://img.shields.io/badge/providers-6%20supported-purple.svg" alt="6 Providers">
  <img src="https://img.shields.io/badge/VSCode-Extension-blue.svg" alt="VSCode Extension">
</p>

---

A powerful CLI tool and **VSCode extension** that brings AI-powered code cognition to your development workflow. Review code, generate functions, search your codebase semantically, and refactor projects—with support for **multiple LLM providers** including local (Ollama) and cloud options with free tiers.

## ✨ Features

| Feature | Description |
|---------|-------------|
| 🔍 **Code Review** | Analyze code for bugs, security issues, and style problems |
| ⚡ **Code Generation** | Generate functions, classes, and tests from natural language |
| 🔎 **Semantic Search** | Search your codebase using natural language queries |
| 📝 **AI File Editing** | Edit files with natural language instructions |
| 🔄 **Multi-File Refactor** | Refactor across multiple files at once |
| ✏️ **Symbol Renaming** | Rename functions, classes, variables across your project |
| 💬 **Interactive Chat** | Chat with AI about your code |
| 📊 **Codebase Indexing** | Create searchable semantic index with RAG |
| 🌐 **Multi-Provider** | Support for 6 LLM providers (local & cloud) |
| 🖥️ **VSCode Extension** | Full IDE integration with sidebar chat |
| 📁 **File Operations** | Create/modify/delete files directly from chat |
| 🗂️ **Multi-Session Chat** | Multiple persistent chat sessions |
| 🤖 **Multi-Agent System** | 6 specialized AI agents with auto-selection |
| 🧠 **Project Intelligence** | Auto-detect project type, frameworks, architecture |
| 🐛 **Debug Helper** | Stack trace analysis and error debugging |
| 🔍 **Error Detection** | Auto-detect errors in 7 languages |
| 📱 **Android/Termux** | Mobile development support |
| ⏹️ **Stop Generation** | Cancel AI responses mid-generation (NEW) |
| 🧠 **Smart Progress** | Context-aware progress indicators (NEW) |

## 🖥️ VSCode Extension

<p align="center">
  <img src="vscode-extension/images/icon.png" width="64" alt="Cognify VSCode">
</p>

The Cognify AI VSCode extension brings all the power of Cognify directly into your IDE with a beautiful sidebar chat interface.

### Extension Features (v1.2.0)

- ⚛️ **Sidebar Chat Panel** - Chat with AI directly in VSCode sidebar
- 📎 **Add Context** - Include code from your editor in conversations
- 🔍 **Code Review** - Review files with inline diagnostics
- ✨ **Code Generation** - Generate code from descriptions
- 💡 **Code Explanation** - Get explanations for selected code
- ✏️ **AI Editing** - Edit code with natural language
- 📁 **File Operations** - Create, modify, delete files from chat
- 🗂️ **Multi-Session Chat** - Multiple persistent chat sessions
- 🤖 **Multi-Agent System** - 6 specialized agents with auto-selection
- 🧠 **Project Intelligence** - Auto-detect project type & tech stack
- 🔄 **Diff Engine** - View and approve code changes before applying
- 🐛 **Debug Helper** - Stack trace analysis & error debugging
- 🔍 **Error Detection** - Auto-detect errors in 7 languages
- 📱 **Android/Termux** - Custom CLI path for mobile dev
- ⏹️ **Stop Generation** - Cancel AI responses mid-stream (NEW v1.2.0)
- 🧠 **Smart Progress** - Context-aware progress steps (NEW v1.2.0)

### Quick Actions
- 📋 Review current file
- 💡 Explain selected code
- ✨ Suggest improvements
- 🧪 Generate tests

### Install VSCode Extension

```bash
# Build from source
cd vscode-extension
npm install
npm run compile
npx vsce package --no-dependencies

# Install the extension
code --install-extension cognify-code-1.2.0.vsix
```

Or install via VSCode:
1. Open VSCode
2. Go to Extensions sidebar
3. Click "..." → "Install from VSIX..."
4. Select `cognify-code-1.2.0.vsix`

### Using the Extension

1. Click the ⚛️ Cognify icon in the Activity Bar (left sidebar)
2. Use quick actions or type your question
3. Click "📎 Add Context" to include code from your editor
4. Press Enter or click Send

**Keyboard Shortcuts:**
| Command | Mac | Windows/Linux |
|---------|-----|---------------|
| Review File | `Cmd+Shift+R` | `Ctrl+Shift+R` |
| Generate Code | `Cmd+Shift+G` | `Ctrl+Shift+G` |
| Explain Code | `Cmd+Shift+E` | `Ctrl+Shift+E` |
| Open Chat | `Cmd+Shift+C` | `Ctrl+Shift+C` |

## 🤖 Supported Providers

| Provider | Free Tier | API Key | Best For |
|----------|-----------|---------|----------|
| **Ollama** | ✅ Unlimited | ❌ None | Privacy, offline use |
| **Google AI** | ✅ Generous | ✅ Required | 1M+ token context |
| **Groq** | ✅ 1000 req/day | ✅ Required | Fastest inference |
| **Cerebras** | ✅ Available | ✅ Required | Fast inference |
| **OpenRouter** | ✅ Free models | ✅ Required | Model variety |
| **OpenAI** | ❌ Paid only | ✅ Required | GPT-4 quality |

## 🚀 Quick Start

### Option 1: Local with Ollama (No API Key)

```bash
# Install Ollama from https://ollama.ai
ollama pull deepseek-coder:6.7b
ollama serve
```

### Option 2: Cloud with Free Tier

```bash
# Google AI Studio (1M token context, free)
export GOOGLE_API_KEY="your-key"  # Get from https://aistudio.google.com/apikey

# OR Groq (fastest inference, free tier)
export GROQ_API_KEY="your-key"    # Get from https://console.groq.com/keys

# OR OpenRouter (free models available)
export OPENROUTER_API_KEY="your-key"  # Get from https://openrouter.ai/keys
```

### Installation

#### Quick Install

```bash
pip install cognify-code
```

#### Complete Installation Guide

For detailed setup including:
- **Offline LLMs** with Ollama (DeepSeek Coder, Qwen, CodeLlama)
- **Cloud Providers** (Groq, Google AI, Cerebras, OpenAI)
- **VSCode Extension** installation
- **Android/Termux** support
- **Troubleshooting** guide

👉 **[Complete Installation Guide](docs/guides/installation.md)**

#### Install from Source

```bash
# Clone the repository
git clone https://github.com/akkssy/cognify-ai.git
cd cognify-ai

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the package
pip install -e .
```

### Verify Installation

```bash
# Check status and available providers
cognify status
cognify providers
```

## 📖 CLI Usage

### Code Review
```bash
cognify review path/to/file.py
cognify review src/ --format json
```

### Code Generation
```bash
cognify generate "binary search function" --language python
cognify generate "REST API client class" --mode class
```

### Semantic Search
```bash
# First, index your codebase
cognify index .

# Then search
cognify search "error handling"
```

### File Editing
```bash
cognify edit config.py "add logging to all functions" --preview
```

### Interactive Chat
```bash
cognify chat
```

### All Commands
```bash
cognify --help
```

## ⚙️ Configuration

Configuration is managed via `config.yaml`:

```yaml
llm:
  provider: "ollama"
  model: "deepseek-coder:6.7b"
  base_url: "http://localhost:11434"
  temperature: 0.1
  max_tokens: 4096
```

Or use environment variables:
```bash
export AI_ASSISTANT_LLM_PROVIDER="groq"
export AI_ASSISTANT_LLM_MODEL="llama-3.3-70b-versatile"
export GROQ_API_KEY="your-key"
```

## 📁 Project Structure

```
cognify-ai/
├── src/ai_code_assistant/    # Core Python package
│   ├── cli.py                # Command-line interface
│   ├── providers/            # LLM providers
│   ├── reviewer/             # Code review
│   ├── generator/            # Code generation
│   ├── retrieval/            # Semantic search
│   ├── editor/               # AI file editing
│   └── chat/                 # Interactive chat
├── vscode-extension/         # VSCode Extension
│   ├── src/                  # Extension source
│   ├── images/               # Icons
│   └── package.json          # Extension manifest
├── tests/                    # Unit tests
├── docs/                     # Documentation
└── config.yaml               # Configuration
```

## 🧪 Testing

```bash
PYTHONPATH=src pytest tests/ -v
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.

---

<p align="center">
  Made with ❤️ for developers who want flexible AI-powered coding assistance
</p>
