|
| 1 | +# PicoCode PyCharm Plugin |
| 2 | + |
| 3 | +PyCharm/IntelliJ IDEA plugin for PicoCode RAG Assistant with per-project persistent storage. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Per-Project Storage**: Indexes each project into `.local_rag` directory |
| 8 | +- **Secure API Key Storage**: Uses IDE's built-in password safe |
| 9 | +- **Real-time Responses**: Streams responses from the coding model |
| 10 | +- **File Navigation**: Click on retrieved files to open them in the editor |
| 11 | +- **Progress Tracking**: Visual progress indicator during indexing |
| 12 | + |
| 13 | +## Building the Plugin |
| 14 | + |
| 15 | +```bash |
| 16 | +cd plugin |
| 17 | +./gradlew buildPlugin |
| 18 | +``` |
| 19 | + |
| 20 | +The plugin ZIP will be in `build/distributions/`. |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +1. Build the plugin or download from releases |
| 25 | +2. In PyCharm/IntelliJ IDEA: `Settings` → `Plugins` → `⚙️` → `Install Plugin from Disk` |
| 26 | +3. Select the plugin ZIP file |
| 27 | +4. Restart IDE |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +1. Open the PicoCode RAG tool window (right sidebar) |
| 32 | +2. Configure your OpenAI-compatible API: |
| 33 | + - API Base URL (e.g., `https://api.openai.com/v1`) |
| 34 | + - API Key (stored securely in IDE password safe) |
| 35 | + - Embedding Model (e.g., `text-embedding-3-small`) |
| 36 | + - Coding Model (e.g., `gpt-4`) |
| 37 | +3. Click "Save API Key" to store it securely |
| 38 | +4. Click "Start Server" to launch the Python backend |
| 39 | +5. Click "Index Project" to index your current project |
| 40 | +6. Ask questions in the query box and click "Query" |
| 41 | + |
| 42 | +## Requirements |
| 43 | + |
| 44 | +- PyCharm/IntelliJ IDEA 2023.1 or later |
| 45 | +- Python 3.8+ installed and in PATH |
| 46 | +- PicoCode backend dependencies installed (`pip install -r pyproject.toml`) |
| 47 | + |
| 48 | +## Project Structure |
| 49 | + |
| 50 | +``` |
| 51 | +plugin/ |
| 52 | +├── build.gradle.kts # Gradle build configuration |
| 53 | +└── src/ |
| 54 | + └── main/ |
| 55 | + ├── kotlin/ |
| 56 | + │ └── com/picocode/ |
| 57 | + │ ├── PicoCodeToolWindowFactory.kt # Tool window factory |
| 58 | + │ └── PicoCodeToolWindowContent.kt # Main UI and logic |
| 59 | + └── resources/ |
| 60 | + └── META-INF/ |
| 61 | + └── plugin.xml # Plugin descriptor |
| 62 | +``` |
| 63 | + |
| 64 | +## Architecture |
| 65 | + |
| 66 | +1. **Server Management**: Plugin starts Python server as subprocess in project directory |
| 67 | +2. **API Communication**: HTTP REST API for project management and queries |
| 68 | +3. **Secure Storage**: API keys stored using IntelliJ's `PasswordSafe` API |
| 69 | +4. **File Navigation**: Uses IntelliJ's Open API to navigate to retrieved files |
| 70 | + |
| 71 | +## API Endpoints Used |
| 72 | + |
| 73 | +- `POST /api/projects` - Create/get project |
| 74 | +- `POST /api/projects/index` - Start indexing |
| 75 | +- `POST /api/code` - Query with RAG context |
| 76 | +- `GET /api/projects` - List projects |
| 77 | + |
| 78 | +## Development |
| 79 | + |
| 80 | +To modify the plugin: |
| 81 | + |
| 82 | +1. Open `plugin/` in IntelliJ IDEA |
| 83 | +2. Make changes to Kotlin files |
| 84 | +3. Run `./gradlew runIde` to test in a sandbox IDE |
| 85 | +4. Build with `./gradlew buildPlugin` |
| 86 | + |
| 87 | +## Troubleshooting |
| 88 | + |
| 89 | +**Server won't start** |
| 90 | +- Check Python is in PATH |
| 91 | +- Verify PicoCode dependencies are installed |
| 92 | +- Check console for error messages |
| 93 | + |
| 94 | +**Indexing fails** |
| 95 | +- Ensure project path is accessible |
| 96 | +- Check API key is configured correctly |
| 97 | +- Verify API base URL is reachable |
| 98 | + |
| 99 | +**No query results** |
| 100 | +- Index the project first |
| 101 | +- Check server is running |
| 102 | +- Verify embeddings model is correct |
0 commit comments