|
| 1 | +# CODA - CODing Assistant |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +<div align="center"> |
| 6 | + |
| 7 | +[](https://go.dev/) |
| 8 | +[](LICENSE) |
| 9 | +[](https://github.com/common-creation/coda/actions) |
| 10 | + |
| 11 | +An intelligent command-line coding assistant that helps create, understand, and manage code through natural language dialogue. |
| 12 | + |
| 13 | +</div> |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +- 🤖 **Multi-Model Support**: Compatible with OpenAI GPT and Azure OpenAI models |
| 18 | +- 💬 **Interactive Chat**: Natural language interface for coding tasks |
| 19 | +- 🛠️ **Tool Integration**: Built-in file operations (read, write, edit, search ...) |
| 20 | +- 🔒 **Security First**: Approval system to avoid unintended tool calls |
| 21 | +- 📝 **Context Aware**: Understands project structure and dependencies |
| 22 | +- 🎨 **Rich Terminal UI**: Beautiful interface powered by Bubbletea |
| 23 | +- 🔧 **Configurable**: Extensive configuration options via YAML/environment variables |
| 24 | + |
| 25 | +## Quick Start |
| 26 | + |
| 27 | +### Installation |
| 28 | + |
| 29 | +#### From Releases |
| 30 | + |
| 31 | +https://github.com/common-creation/coda/releases/latest |
| 32 | + |
| 33 | +#### Using Go |
| 34 | + |
| 35 | +```bash |
| 36 | +go install github.com/common-creation/coda@latest |
| 37 | +``` |
| 38 | + |
| 39 | +#### From Source |
| 40 | + |
| 41 | +```bash |
| 42 | +git clone https://github.com/common-creation/coda.git |
| 43 | +cd coda |
| 44 | +make build |
| 45 | +``` |
| 46 | + |
| 47 | +### Configuration |
| 48 | + |
| 49 | +1. Initialize configuration: |
| 50 | +```bash |
| 51 | +coda config init |
| 52 | +``` |
| 53 | + |
| 54 | +or |
| 55 | + |
| 56 | +```bash |
| 57 | +coda |
| 58 | +# Configuration file will be created on first launch or if API key is not set |
| 59 | +``` |
| 60 | + |
| 61 | +2. Set API keys: |
| 62 | +```bash |
| 63 | +# For OpenAI |
| 64 | +coda config set-api-key openai [key] |
| 65 | + |
| 66 | +# For Azure OpenAI |
| 67 | +coda config set-api-key azure [key] |
| 68 | +``` |
| 69 | + |
| 70 | +You can also edit the configuration file directly. |
| 71 | + |
| 72 | +3. (Optional) Customize configuration: |
| 73 | +```bash |
| 74 | +coda config set ai.model o4-mini # Default is o3 |
| 75 | +``` |
| 76 | + |
| 77 | +### Basic Usage |
| 78 | + |
| 79 | +#### Interactive Chat Mode |
| 80 | + |
| 81 | +```bash |
| 82 | +# Start interactive chat |
| 83 | +coda |
| 84 | + |
| 85 | +# Use specific model |
| 86 | +coda --model o4-mini |
| 87 | +``` |
| 88 | + |
| 89 | +## Commands |
| 90 | + |
| 91 | +### `coda` or `coda chat` |
| 92 | +Start an interactive chat session with the AI assistant. |
| 93 | + |
| 94 | +**Options:** |
| 95 | +- `--model`: Specify the AI model to use |
| 96 | + |
| 97 | +### `coda config` |
| 98 | +Manage CODA configuration. |
| 99 | + |
| 100 | +**Subcommands:** |
| 101 | +- `show`: Display current configuration |
| 102 | +- `set KEY VALUE`: Set a configuration value |
| 103 | +- `get KEY`: Get a specific value |
| 104 | +- `init`: Initialize configuration file |
| 105 | +- `validate`: Check configuration validity |
| 106 | +- `set-api-key PROVIDER`: Set API key without leaving it in history |
| 107 | + |
| 108 | +### `coda version` |
| 109 | +Display version information. |
| 110 | + |
| 111 | +**Options:** |
| 112 | +- `--verbose, -v`: Show detailed version information |
| 113 | +- `--json`: Output in JSON format |
| 114 | + |
| 115 | +## Configuration |
| 116 | + |
| 117 | +CODA loads configuration from the following locations (in order): |
| 118 | +1. Command-line flags: `--config` |
| 119 | +2. Environment variables: `CODA_CONFIG` |
| 120 | +3. `$HOME/.coda/config.yaml` |
| 121 | +4. `./config.yaml` |
| 122 | + |
| 123 | +### Example Configuration File |
| 124 | + |
| 125 | +```yaml |
| 126 | +ai: |
| 127 | + provider: openai # or "azure" |
| 128 | + model: o3 |
| 129 | + temperature: 1 |
| 130 | + max_tokens: 0 # 0 means no limit |
| 131 | + |
| 132 | +tools: |
| 133 | + enabled: true |
| 134 | + auto_approve: false |
| 135 | + allowed_paths: |
| 136 | + - "." |
| 137 | + denied_paths: |
| 138 | + - "/etc" |
| 139 | + - "/sys" |
| 140 | + |
| 141 | +session: |
| 142 | + max_history: 100 |
| 143 | + max_tokens: 8000 |
| 144 | + persistence: true |
| 145 | + |
| 146 | +logging: |
| 147 | + level: info |
| 148 | + file: ~/.coda/coda.log |
| 149 | +``` |
| 150 | +
|
| 151 | +### Environment Variables |
| 152 | +
|
| 153 | +All configuration options can be set via environment variables: |
| 154 | +
|
| 155 | +```bash |
| 156 | +export CODA_AI_PROVIDER=openai |
| 157 | +export CODA_AI_MODEL=o4-mini |
| 158 | +export CODA_AI_API_KEY=sk-... |
| 159 | +``` |
| 160 | + |
| 161 | +## Workspace Configuration |
| 162 | + |
| 163 | +CODA supports project-specific configuration through workspace files: |
| 164 | + |
| 165 | +### `.coda/CODA.md` or `.claude/CLAUDE.md` (experimental) |
| 166 | + |
| 167 | +```markdown |
| 168 | +# Project Instructions |
| 169 | + |
| 170 | +This is a React TypeScript project using Next.js 14. |
| 171 | + |
| 172 | +## Rules |
| 173 | +- Always use TypeScript strict mode |
| 174 | +- Prefer functional components with hooks |
| 175 | +- Follow the project's ESLint configuration |
| 176 | + |
| 177 | +## Context |
| 178 | +- Main API endpoint: /api/v1 |
| 179 | +- Database: PostgreSQL with Prisma ORM |
| 180 | +- Authentication: NextAuth.js |
| 181 | +``` |
| 182 | + |
| 183 | +## Available Tools |
| 184 | + |
| 185 | +CODA includes several built-in tools for file operations. |
| 186 | +Here are some representative examples: |
| 187 | + |
| 188 | +- **read_file**: Read file contents |
| 189 | +- **write_file**: Create or overwrite files |
| 190 | +- **edit_file**: Modify specific parts of files |
| 191 | +- **list_files**: List directory contents |
| 192 | +- **search_files**: Search files by content or name |
| 193 | + |
| 194 | +For security, all tool operations require user approval by default. |
| 195 | + |
| 196 | +## Security |
| 197 | + |
| 198 | +CODA implements multiple security measures: |
| 199 | + |
| 200 | +- **Restricted File Access**: Operations are limited to allowed paths |
| 201 | +- **Approval System**: Tool calls require explicit user consent |
| 202 | +- **Path Validation**: Prevents directory traversal attacks |
| 203 | + |
| 204 | +## Development |
| 205 | + |
| 206 | +### Prerequisites |
| 207 | + |
| 208 | +- Go 1.24 or higher |
| 209 | + |
| 210 | +### Project Structure |
| 211 | + |
| 212 | +``` |
| 213 | +coda/ |
| 214 | +├── cmd/ # CLI commands |
| 215 | +├── internal/ # Internal packages |
| 216 | +│ ├── ai/ # AI client implementations |
| 217 | +│ ├── chat/ # Chat processing logic |
| 218 | +│ ├── config/ # Configuration management |
| 219 | +│ ├── security/ # Security validation |
| 220 | +│ ├── tools/ # Tool implementations |
| 221 | +│ └── ui/ # Terminal UI (Bubbletea) |
| 222 | +├── docs/ # Documentation |
| 223 | +├── scripts/ # Build and utility scripts |
| 224 | +└── tests/ # Tests |
| 225 | +``` |
| 226 | + |
| 227 | +### Development Workflow |
| 228 | + |
| 229 | +1. Fork the repository |
| 230 | +2. Create a feature branch (`git checkout -b feature/amazing-feature`) |
| 231 | +3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
| 232 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 233 | +5. Open a Pull Request |
| 234 | + |
| 235 | +## Troubleshooting |
| 236 | + |
| 237 | +### Common Issues |
| 238 | + |
| 239 | +**API Key Not Found** |
| 240 | +```bash |
| 241 | +# Check if API key is set |
| 242 | +coda config get ai.api_key |
| 243 | + |
| 244 | +# Reset API key |
| 245 | +coda config set-api-key openai |
| 246 | +``` |
| 247 | + |
| 248 | +**File Operation Permission Denied** |
| 249 | +- Check `allowed_paths` configuration |
| 250 | +- Ensure you have proper file system permissions |
| 251 | + |
| 252 | +**Connection Timeout** |
| 253 | +- Check your internet connection |
| 254 | +- Verify if you're behind a proxy |
| 255 | + |
| 256 | +### Debug Mode |
| 257 | + |
| 258 | +Enable debug mode for detailed logging: |
| 259 | + |
| 260 | +```bash |
| 261 | +coda --debug chat |
| 262 | +``` |
| 263 | + |
| 264 | +Logs can be found at `~/.coda/coda.log` |
| 265 | + |
| 266 | +## License |
| 267 | + |
| 268 | +MIT License |
| 269 | + |
| 270 | +## Acknowledgments |
| 271 | + |
| 272 | +- Built with [Cobra](https://github.com/spf13/cobra) for CLI |
| 273 | +- UI powered by [Bubbletea](https://github.com/charmbracelet/bubbletea) |
| 274 | +- AI integration via OpenAI and Azure OpenAI APIs |
| 275 | + |
| 276 | +## Roadmap |
| 277 | + |
| 278 | +- [x] Basic chat functionality |
| 279 | +- [x] File operation tools |
| 280 | +- [x] Multi-model support |
| 281 | +- [x] Configuration management |
| 282 | +- [x] Rich terminal UI |
| 283 | +- [ ] Additional tools |
| 284 | +- [ ] Plugin system |
| 285 | +- [ ] Local model support |
| 286 | + |
| 287 | +--- |
| 288 | + |
| 289 | +<div align="center"> |
| 290 | +Made with ❤️ by the CODA team |
| 291 | +</div> |
0 commit comments