|
| 1 | +# WARP.md |
| 2 | + |
| 3 | +This file provides guidance to WARP (warp.dev) when working with code in this repository. |
| 4 | + |
| 5 | +## Essential Development Commands |
| 6 | + |
| 7 | +### Installation & Setup |
| 8 | +```bash |
| 9 | +# Install Python dependencies |
| 10 | +pip install -r requirements.txt |
| 11 | + |
| 12 | +# Set up for Gemini environment (copies scripts to ~/.gemini) |
| 13 | +make setup-gemini |
| 14 | + |
| 15 | +# Set up for Qwen environment (copies scripts to ~/.qwen) |
| 16 | +make setup-qwen |
| 17 | + |
| 18 | +# Install development tools |
| 19 | +pip install pytest pytest-cov pytest-mock flake8 black isort pylint |
| 20 | +``` |
| 21 | + |
| 22 | +### Environment Configuration |
| 23 | +```bash |
| 24 | +# Required: Set Venice AI API key |
| 25 | +export VENICE_API_KEY="your_api_key_here" |
| 26 | + |
| 27 | +# Verify Venice API configuration |
| 28 | +python auto_config.py --verify |
| 29 | + |
| 30 | +# Check API key is set |
| 31 | +echo $VENICE_API_KEY |
| 32 | +``` |
| 33 | + |
| 34 | +### Running Tests |
| 35 | +```bash |
| 36 | +# Run all tests |
| 37 | +pytest tests/ |
| 38 | + |
| 39 | +# Run tests quietly |
| 40 | +pytest -q tests/ |
| 41 | + |
| 42 | +# Run with fail-fast and last-failed optimization |
| 43 | +pytest -x --ff tests/ |
| 44 | + |
| 45 | +# Run with coverage report |
| 46 | +pytest --cov=. --cov-report=term-missing tests/ |
| 47 | + |
| 48 | +# Run specific test file |
| 49 | +pytest tests/test_integration.py -v |
| 50 | +``` |
| 51 | + |
| 52 | +### Code Quality & Linting |
| 53 | +```bash |
| 54 | +# Run flake8 linter |
| 55 | +flake8 . --max-line-length=120 |
| 56 | + |
| 57 | +# Format code with Black (120 char line length) |
| 58 | +black . --line-length 120 |
| 59 | + |
| 60 | +# Sort imports with isort |
| 61 | +isort . --profile black |
| 62 | + |
| 63 | +# Check formatting without changes |
| 64 | +black --check . --line-length 120 |
| 65 | +isort --check-only . --profile black |
| 66 | +``` |
| 67 | + |
| 68 | +### CLI Usage |
| 69 | +```bash |
| 70 | +# Get help |
| 71 | +python qwen_cli_integrator.py --help |
| 72 | + |
| 73 | +# Generate image with Venice AI |
| 74 | +python qwen_cli_integrator.py venice generate --prompt "description" --model lustify-sdxl |
| 75 | + |
| 76 | +# GitKraken operations |
| 77 | +python qwen_cli_integrator.py gitkraken ai_commit |
| 78 | +python qwen_cli_integrator.py gitkraken workspace_list |
| 79 | +``` |
| 80 | + |
| 81 | +## High-Level Architecture |
| 82 | + |
| 83 | +### Unified CLI Integration |
| 84 | +This is a **unified CLI tool** that bridges three distinct integrations: |
| 85 | +- **Venice AI**: Uncensored image generation and upscaling |
| 86 | +- **GitKraken CLI**: AI-powered Git workflow operations |
| 87 | +- **External API Providers**: Generic provider abstraction layer |
| 88 | + |
| 89 | +### Core Entry Point |
| 90 | +- **`qwen_cli_integrator.py`**: Main orchestrator providing the `QwenCLIIntegrator` class |
| 91 | + - Dispatches commands to appropriate integration modules |
| 92 | + - Handles cross-tool workflows |
| 93 | + - Provides unified CLI interface via argparse |
| 94 | + |
| 95 | +### Integration Modules (Flat Structure) |
| 96 | +All modules are in the repository root (no nested packages): |
| 97 | + |
| 98 | +- **`venice_integration.py`**: Venice AI image generation |
| 99 | + - Default model: `lustify-sdxl` with 50 steps |
| 100 | + - Supports image generation, upscaling (4x), and model listing |
| 101 | + - Authentication: `VENICE_API_KEY` environment variable |
| 102 | + - Key classes: `VeniceAIImageGenerator`, `VeniceAIVerifier`, `VeniceAIConfigUpdater` |
| 103 | + |
| 104 | +- **`gitkraken_integration.py`**: GitKraken CLI wrapper |
| 105 | + - Wraps `gk` command-line tool for Git operations |
| 106 | + - AI-powered features: commit generation, conflict resolution, PR creation |
| 107 | + - Standard operations: branch management, workspace operations, status queries |
| 108 | + - Key class: `GitKrakenCLI` |
| 109 | + |
| 110 | +- **`external_api_integrator.py`**: External API provider support |
| 111 | + - Provider-agnostic abstraction layer |
| 112 | + - Loads configurations from Raycast YAML format (optional) |
| 113 | + - Centralizes authentication and configuration |
| 114 | + - Config path: `~/.config/raycast/ai/providers.yaml` |
| 115 | + - Key class: `ExternalAPIIntegrator` |
| 116 | + |
| 117 | +- **`auto_config.py`**: Configuration verification utility |
| 118 | + - Standalone tool for API key verification |
| 119 | + - Can automatically update Raycast configurations |
| 120 | + - Usage: `python auto_config.py --verify` or `python auto_config.py --auto` |
| 121 | + |
| 122 | +### Configuration Philosophy |
| 123 | +- **No secrets in repository**: All API keys loaded from environment variables |
| 124 | +- **Environment-based setup**: Uses `.gemini` or `.qwen` home directory structure |
| 125 | +- **Settings file**: `setting_to_apply.json` copied during setup but contains no secrets |
| 126 | + |
| 127 | +### Scripts Directory Structure |
| 128 | +``` |
| 129 | +scripts/ |
| 130 | +├── gemini/ # Full set of modules for Gemini environment |
| 131 | +└── qwen/ # Full set of modules for Qwen environment |
| 132 | +``` |
| 133 | +Setup targets copy these to `~/.gemini/` or `~/.qwen/` respectively. |
| 134 | + |
| 135 | +## Ongoing Improvement Work |
| 136 | + |
| 137 | +### Current Development Context |
| 138 | +- **Branch**: `chore/docs-tests-bugfix-qwen-cli` |
| 139 | +- **Recent commit**: `dc78083` (fixed merge conflicts and test syntax errors) |
| 140 | +- **Test baseline**: 60 tests passing, 5 tests failing (pre-existing issues, not regressions) |
| 141 | +- **Repository state**: Clean working state on feature branch, ready for enhancement |
| 142 | + |
| 143 | +### In-Progress Tasks |
| 144 | +1. **Comprehensive Docstrings**: Adding complete docstrings across 5 core modules |
| 145 | +2. **Test Coverage Expansion**: Creating new test files to cover high-risk code paths |
| 146 | +3. **Security Hardening**: `yaml.safe_load()` already implemented (was security issue) |
| 147 | +4. **Documentation Overhaul**: README enhancement, architecture guides, this WARP.md |
| 148 | + |
| 149 | +### Priority Items (from previous session) |
| 150 | +- **Critical bug fix**: Security issue with yaml loading (✓ already fixed) |
| 151 | +- **Core module documentation**: Focus on `qwen_cli_integrator`, `venice_integration`, `external_api_integrator` |
| 152 | +- **Essential test coverage**: New test files targeting highest-risk paths |
| 153 | +- **Architecture documentation**: This WARP.md and README updates |
| 154 | + |
| 155 | +## Important Development Notes |
| 156 | + |
| 157 | +### Requirements |
| 158 | +- **Python**: 3.7+ required |
| 159 | +- **Optional**: GitKraken CLI (`gk` command) for Git operations |
| 160 | +- **Required for image gen**: Venice AI API key |
| 161 | + |
| 162 | +### Code Style & Standards |
| 163 | +- **Commit format**: Conventional commits enforced (`feat:`, `fix:`, `docs:`, `chore:`, etc.) |
| 164 | +- **Formatting**: Black with 120 character line length |
| 165 | +- **Import sorting**: isort with black profile |
| 166 | +- **Linting**: flake8 with max-complexity=10 |
| 167 | + |
| 168 | +### Security Best Practices |
| 169 | +- Never commit API keys or secrets |
| 170 | +- Always use environment variables for configuration |
| 171 | +- API keys are automatically redacted in logs |
| 172 | +- Client-side CSAM guard implemented (content filtering) |
| 173 | + |
| 174 | +### Testing Stack |
| 175 | +- **pytest**: Test framework |
| 176 | +- **pytest-cov**: Coverage reporting |
| 177 | +- **pytest-mock**: Mocking support |
| 178 | +- Test files located in `tests/` directory |
| 179 | + |
| 180 | +### GitHub Workflows |
| 181 | +- **tests.yml**: Runs pytest on push/PR to main |
| 182 | +- **linting.yml**: Runs flake8, black, isort checks |
| 183 | +- **security.yml**: Security scanning |
| 184 | + |
| 185 | +### Notable Defaults |
| 186 | +- **Venice model**: `lustify-sdxl` (uncensored) |
| 187 | +- **Generation steps**: 50 (optimal for lustify-sdxl) |
| 188 | +- **Safe mode**: Disabled by default |
| 189 | +- **CFG scale**: 5.0 |
| 190 | + |
| 191 | +### Module Dependencies |
| 192 | +``` |
| 193 | +qwen_cli_integrator.py |
| 194 | +├── gitkraken_integration.py (no external deps) |
| 195 | +├── venice_integration.py (requires: requests, urllib3) |
| 196 | +└── external_api_integrator.py (requires: requests, pyyaml [optional]) |
| 197 | +``` |
0 commit comments