koder 0.3.3__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- koder-0.4.1/.claude/settings.local.json +10 -0
- koder-0.4.1/CLAUDE.md +98 -0
- koder-0.4.1/PKG-INFO +500 -0
- koder-0.4.1/README.md +465 -0
- koder-0.4.1/koder_agent/agentic/agent.py +67 -0
- koder-0.4.1/koder_agent/agentic/hooks.py +106 -0
- koder-0.4.1/koder_agent/cli.py +380 -0
- koder-0.4.1/koder_agent/config/__init__.py +27 -0
- koder-0.4.1/koder_agent/config/cli_handler.py +279 -0
- koder-0.4.1/koder_agent/config/manager.py +122 -0
- koder-0.4.1/koder_agent/config/models.py +79 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/commands.py +82 -18
- koder-0.4.1/koder_agent/core/context.py +433 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/interactive.py +47 -22
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/scheduler.py +62 -3
- koder-0.4.1/koder_agent/core/status_line.py +139 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/streaming_display.py +202 -25
- koder-0.4.1/koder_agent/core/usage_tracker.py +98 -0
- koder-0.4.1/koder_agent/mcp/server_manager.py +231 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/tools/__init__.py +32 -6
- {koder-0.3.3 → koder-0.4.1}/koder_agent/tools/engine.py +1 -0
- koder-0.4.1/koder_agent/tools/file.py +235 -0
- koder-0.4.1/koder_agent/tools/shell.py +437 -0
- koder-0.3.3/koder_agent/tools/task_ops.py → koder-0.4.1/koder_agent/tools/task.py +11 -1
- koder-0.4.1/koder_agent/tools/todo.py +86 -0
- koder-0.3.3/koder_agent/tools/web_ops.py → koder-0.4.1/koder_agent/tools/web.py +32 -30
- {koder-0.3.3 → koder-0.4.1}/koder_agent/utils/__init__.py +8 -1
- koder-0.4.1/koder_agent/utils/client.py +299 -0
- koder-0.4.1/koder_agent/utils/model_info.py +110 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/utils/prompts.py +8 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/utils/sessions.py +60 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/utils/terminal_theme.py +21 -0
- {koder-0.3.3 → koder-0.4.1}/pyproject.toml +28 -17
- koder-0.4.1/scripts/upgrade_dependency.py +105 -0
- koder-0.4.1/tests/test_file_tools.py +496 -0
- koder-0.4.1/tests/test_shell_background.py +378 -0
- koder-0.4.1/tests/test_web.py +402 -0
- koder-0.4.1/uv.lock +4736 -0
- koder-0.3.3/.claude/settings.local.json +0 -22
- koder-0.3.3/CLAUDE.md +0 -1
- koder-0.3.3/PKG-INFO +0 -254
- koder-0.3.3/README.md +0 -221
- koder-0.3.3/koder_agent/agentic/agent.py +0 -44
- koder-0.3.3/koder_agent/agentic/hooks.py +0 -73
- koder-0.3.3/koder_agent/cli.py +0 -247
- koder-0.3.3/koder_agent/core/context.py +0 -154
- koder-0.3.3/koder_agent/mcp/server_manager.py +0 -141
- koder-0.3.3/koder_agent/tools/file_ops.py +0 -109
- koder-0.3.3/koder_agent/tools/shell_ops.py +0 -92
- koder-0.3.3/koder_agent/tools/todo_ops.py +0 -76
- koder-0.3.3/koder_agent/utils/client.py +0 -55
- koder-0.3.3/uv.lock +0 -3477
- {koder-0.3.3 → koder-0.4.1}/.github/dependabot.yml +0 -0
- {koder-0.3.3 → koder-0.4.1}/.gitignore +0 -0
- {koder-0.3.3 → koder-0.4.1}/AGENTS.md +0 -0
- {koder-0.3.3 → koder-0.4.1}/CONTRIBUTING.md +0 -0
- {koder-0.3.3 → koder-0.4.1}/LICENSE +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/__init__.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/agentic/__init__.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/agentic/approval_hooks.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/__init__.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/core/security.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/mcp/__init__.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/mcp/cli_handler.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/mcp/server_config.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/mcp/server_factory.py +0 -0
- /koder-0.3.3/koder_agent/tools/search_ops.py → /koder-0.4.1/koder_agent/tools/search.py +0 -0
- {koder-0.3.3 → koder-0.4.1}/koder_agent/utils/queue.py +0 -0
koder-0.4.1/CLAUDE.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Development Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install dependencies
|
|
11
|
+
uv sync
|
|
12
|
+
|
|
13
|
+
# Run the CLI in development
|
|
14
|
+
uv run koder
|
|
15
|
+
|
|
16
|
+
# Run with a single prompt
|
|
17
|
+
uv run koder "Your prompt here"
|
|
18
|
+
|
|
19
|
+
# Run with specific session
|
|
20
|
+
uv run koder --session my-session "Your prompt"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Code Quality
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Code formatting
|
|
27
|
+
black .
|
|
28
|
+
|
|
29
|
+
# Linting with auto-fix
|
|
30
|
+
ruff check --fix
|
|
31
|
+
|
|
32
|
+
# Error-only pylint check
|
|
33
|
+
pylint koder_agent/ --disable=C,R,W --errors-only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Testing
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Run all tests
|
|
40
|
+
pytest
|
|
41
|
+
|
|
42
|
+
# Run a single test file
|
|
43
|
+
pytest tests/test_file_tools.py
|
|
44
|
+
|
|
45
|
+
# Run with verbose output
|
|
46
|
+
pytest -v
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Architecture
|
|
50
|
+
|
|
51
|
+
Koder is a terminal-based AI coding assistant built on the `openai-agents` library with multi-provider support via LiteLLM.
|
|
52
|
+
|
|
53
|
+
### Package Structure
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
koder_agent/
|
|
57
|
+
├── agentic/ # Agent creation, hooks, and approval system
|
|
58
|
+
├── cli.py # Main CLI entry point
|
|
59
|
+
├── config/ # Configuration management (YAML, env vars)
|
|
60
|
+
├── core/ # Scheduler, context, streaming, security, commands
|
|
61
|
+
├── mcp/ # Model Context Protocol server integration
|
|
62
|
+
├── tools/ # Tool implementations (file, search, shell, web, task, todo)
|
|
63
|
+
└── utils/ # Helpers (client setup, prompts, sessions, model info)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Core Flow
|
|
67
|
+
|
|
68
|
+
1. **CLI Entry** (`cli.py`) → parses args, initializes session
|
|
69
|
+
2. **AgentScheduler** (`core/scheduler.py`) → orchestrates agent execution with streaming
|
|
70
|
+
3. **Agent Creation** (`agentic/agent.py`) → builds agent with tools, MCP servers, model settings
|
|
71
|
+
4. **Tool Engine** (`tools/engine.py`) → registers tools, validates inputs, filters sensitive output
|
|
72
|
+
5. **Context Manager** (`core/context.py`) → persists conversations in SQLite with token-aware compression
|
|
73
|
+
|
|
74
|
+
### Key Design Patterns
|
|
75
|
+
|
|
76
|
+
- **Provider Abstraction**: `utils/client.py` detects providers from environment and configures either native OpenAI client or LiteLLM wrapper
|
|
77
|
+
- **Streaming Display**: `core/streaming_display.py` manages Rich Live displays for real-time output
|
|
78
|
+
- **Approval Hooks**: `agentic/approval_hooks.py` wraps tool execution with permission checks
|
|
79
|
+
- **Security Guard**: `core/security.py` validates shell commands before execution
|
|
80
|
+
|
|
81
|
+
### Configuration Priority
|
|
82
|
+
|
|
83
|
+
CLI Arguments > Environment Variables > Config File (`~/.koder/config.yaml`) > Defaults
|
|
84
|
+
|
|
85
|
+
Key environment variables:
|
|
86
|
+
- `KODER_MODEL` - Model name (e.g., `gpt-4o`, `claude-opus-4-20250514`)
|
|
87
|
+
- Provider API keys: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, etc.
|
|
88
|
+
|
|
89
|
+
### Database
|
|
90
|
+
|
|
91
|
+
SQLite at `~/.koder/koder.db` stores:
|
|
92
|
+
- Conversation history with token-aware compression (50k limit)
|
|
93
|
+
- Session metadata
|
|
94
|
+
- MCP server configurations
|
|
95
|
+
|
|
96
|
+
### Project Context
|
|
97
|
+
|
|
98
|
+
The CLI loads `AGENTS.md` from the working directory as project-specific context for the agent.
|
koder-0.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: koder
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support.
|
|
5
|
+
Project-URL: Homepage, https://github.com/feiskyer/koder
|
|
6
|
+
Project-URL: Repository, https://github.com/feiskyer/koder
|
|
7
|
+
Author: Pengfei Ni
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agent,agentic,ai,copilot,litellm,openai,vibe coding
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: aiosqlite>=0.21.0
|
|
12
|
+
Requires-Dist: apscheduler>=3.11.1
|
|
13
|
+
Requires-Dist: backoff>=2.2.1
|
|
14
|
+
Requires-Dist: beautifulsoup4>=4.14.2
|
|
15
|
+
Requires-Dist: cryptography>=46.0.3
|
|
16
|
+
Requires-Dist: ddgs>=8.0.1
|
|
17
|
+
Requires-Dist: fastapi-sso>=0.18.0
|
|
18
|
+
Requires-Dist: fastapi>=0.122.0
|
|
19
|
+
Requires-Dist: google-cloud-aiplatform>=1.128.0
|
|
20
|
+
Requires-Dist: httpx[socks]>=0.28.1
|
|
21
|
+
Requires-Dist: openai-agents[litellm]>=0.6.1
|
|
22
|
+
Requires-Dist: openai>=2.8.1
|
|
23
|
+
Requires-Dist: orjson>=3.11.4
|
|
24
|
+
Requires-Dist: prompt-toolkit>=3.0.52
|
|
25
|
+
Requires-Dist: pydantic>=2.12.4
|
|
26
|
+
Requires-Dist: pyjwt>=2.10.1
|
|
27
|
+
Requires-Dist: pynacl>=1.6.1
|
|
28
|
+
Requires-Dist: python-multipart>=0.0.20
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Requires-Dist: requests>=2.32.5
|
|
31
|
+
Requires-Dist: rich>=14.2.0
|
|
32
|
+
Requires-Dist: tiktoken>=0.12.0
|
|
33
|
+
Requires-Dist: websockets>=15.0.1
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Koder
|
|
37
|
+
|
|
38
|
+
[](https://www.python.org/downloads/) [](LICENSE) [](https://github.com/psf/black) [](https://github.com/astral-sh/ruff) [](https://pepy.tech/projects/koder)
|
|
39
|
+
|
|
40
|
+
Koder is an experimental, universal AI coding assistant designed to explore how to build an advanced terminal-based AI coding assistant. Written entirely in Python, it serves as both a functional tool and a learning playground for AI agent development.
|
|
41
|
+
|
|
42
|
+
**🎯 Project Status**: Under active vibe coding! This is a learning-focused project where we explore building AI coding agents.
|
|
43
|
+
|
|
44
|
+
## ✨ Features
|
|
45
|
+
|
|
46
|
+
- **🤖 Universal AI Support**: Works with OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers via LiteLLM with intelligent auto-detection
|
|
47
|
+
- **💾 Smart Context Management**: Persistent sessions with SQLite storage and automatic token-aware compression (50k token limit)
|
|
48
|
+
- **🔄 Real-time Streaming**: Rich Live displays with intelligent terminal cleanup for responsive user experience
|
|
49
|
+
- **🛠️ Comprehensive Toolset**: file operations, search, shell, task delegation and todos.
|
|
50
|
+
- **🔌 MCP Integration**: Model Context Protocol support with stdio, SSE, and HTTP transports for extensible tool ecosystem
|
|
51
|
+
- **🛡️ Enterprise Security**: SecurityGuard validation, output filtering, permission system, and input sanitization
|
|
52
|
+
- **🎯 Zero Configuration**: Automatic provider detection with fallback defaults
|
|
53
|
+
|
|
54
|
+
## 🛠️ Installation
|
|
55
|
+
|
|
56
|
+
### Using uv (Recommended)
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
uv tool install koder
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Using pip
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install koder
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## ⚡ Quick Start
|
|
69
|
+
|
|
70
|
+
Simply run Koder with your question or request:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Configure one provider (example: OpenAI)
|
|
74
|
+
export OPENAI_API_KEY="your-openai-api-key"
|
|
75
|
+
export KODER_MODEL="gpt-4o"
|
|
76
|
+
|
|
77
|
+
# Run in interactive mode
|
|
78
|
+
koder
|
|
79
|
+
|
|
80
|
+
# Run with prompt
|
|
81
|
+
koder "create a Python function to calculate fibonacci numbers"
|
|
82
|
+
|
|
83
|
+
# Execute a single prompt in a named session
|
|
84
|
+
koder -s my-project "Help me implement a new feature"
|
|
85
|
+
|
|
86
|
+
# Use an explicit session flag
|
|
87
|
+
koder -s my-project "Your prompt here"
|
|
88
|
+
|
|
89
|
+
# Use high reasoning effort for complex problems (OpenAI reasoning models)
|
|
90
|
+
koder --reasoning high "Solve this complex algorithm problem"
|
|
91
|
+
|
|
92
|
+
# Use low reasoning for simple tasks
|
|
93
|
+
koder --reasoning low "Add a print statement"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 🤖 Configuration
|
|
97
|
+
|
|
98
|
+
Koder supports flexible configuration through three mechanisms (in order of priority):
|
|
99
|
+
|
|
100
|
+
1. **CLI Arguments** - Highest priority, for runtime overrides
|
|
101
|
+
2. **Environment Variables** - For secrets and runtime configuration
|
|
102
|
+
3. **Config File** - For persistent defaults (`~/.koder/config.yaml`)
|
|
103
|
+
|
|
104
|
+
### Quick Setup
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Minimal setup - just set your API key and go
|
|
108
|
+
export OPENAI_API_KEY="your-api-key"
|
|
109
|
+
koder
|
|
110
|
+
|
|
111
|
+
# Or use a different provider
|
|
112
|
+
export ANTHROPIC_API_KEY="your-api-key"
|
|
113
|
+
export KODER_MODEL="claude-opus-4-20250514"
|
|
114
|
+
koder
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Config File
|
|
118
|
+
|
|
119
|
+
Koder uses a YAML config file at `~/.koder/config.yaml` for persistent settings.
|
|
120
|
+
|
|
121
|
+
#### Config File Format
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
# ~/.koder/config.yaml
|
|
125
|
+
|
|
126
|
+
# Model configuration
|
|
127
|
+
model:
|
|
128
|
+
name: "gpt-4.1" # Model name (default: gpt-4.1)
|
|
129
|
+
provider: "openai" # Provider name (default: openai)
|
|
130
|
+
api_key: null # API key (prefer env vars for security)
|
|
131
|
+
base_url: null # Custom API endpoint (optional)
|
|
132
|
+
|
|
133
|
+
# Reasoning effort for OpenAI reasoning models (o1, o3, gpt-5.1, etc.)
|
|
134
|
+
reasoning_effort: "medium" # none, minimal, low, medium, high, or null
|
|
135
|
+
|
|
136
|
+
# CLI defaults
|
|
137
|
+
cli:
|
|
138
|
+
session: null # Default session name (auto-generated if null)
|
|
139
|
+
stream: true # Enable streaming output (default: true)
|
|
140
|
+
|
|
141
|
+
# MCP servers for extended functionality
|
|
142
|
+
mcp_servers: []
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Environment Variables
|
|
146
|
+
|
|
147
|
+
#### Core Variables
|
|
148
|
+
|
|
149
|
+
| Variable | Purpose | Example |
|
|
150
|
+
|----------|---------|---------|
|
|
151
|
+
| `KODER_MODEL` | Model selection (highest priority) | `gpt-4o`, `claude-opus-4-20250514` |
|
|
152
|
+
| `KODER_REASONING_EFFORT` | Reasoning effort for reasoning models | `medium`, `high`, `low`, `null` |
|
|
153
|
+
| `EDITOR` | Editor for `koder config edit` | `vim`, `code` |
|
|
154
|
+
|
|
155
|
+
#### Provider API Keys
|
|
156
|
+
|
|
157
|
+
| Provider | API Key Variable | Additional Variables |
|
|
158
|
+
|----------|------------------|---------------------|
|
|
159
|
+
| OpenAI | `OPENAI_API_KEY` | `OPENAI_BASE_URL` |
|
|
160
|
+
| Anthropic | `ANTHROPIC_API_KEY` | - |
|
|
161
|
+
| Google/Gemini | `GOOGLE_API_KEY` or `GEMINI_API_KEY` | - |
|
|
162
|
+
| Azure | `AZURE_API_KEY` | `AZURE_API_BASE`, `AZURE_API_VERSION` |
|
|
163
|
+
| Vertex AI | `GOOGLE_APPLICATION_CREDENTIALS` | `VERTEXAI_LOCATION` |
|
|
164
|
+
| GitHub Copilot | `GITHUB_TOKEN` | - |
|
|
165
|
+
| Groq | `GROQ_API_KEY` | - |
|
|
166
|
+
| Together AI | `TOGETHERAI_API_KEY` | - |
|
|
167
|
+
| OpenRouter | `OPENROUTER_API_KEY` | - |
|
|
168
|
+
| Mistral | `MISTRAL_API_KEY` | - |
|
|
169
|
+
| Cohere | `COHERE_API_KEY` | - |
|
|
170
|
+
| Bedrock | `AWS_ACCESS_KEY_ID` | `AWS_SECRET_ACCESS_KEY` |
|
|
171
|
+
|
|
172
|
+
### Supported Providers
|
|
173
|
+
|
|
174
|
+
<details>
|
|
175
|
+
<summary><b>OpenAI</b></summary>
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
export OPENAI_API_KEY=your-api-key
|
|
179
|
+
export KODER_MODEL="gpt-4o" # Optional, default: gpt-4.1
|
|
180
|
+
|
|
181
|
+
# Optional: Custom endpoint
|
|
182
|
+
export OPENAI_BASE_URL=https://your-endpoint.com/v1
|
|
183
|
+
|
|
184
|
+
koder
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
</details>
|
|
188
|
+
|
|
189
|
+
<details>
|
|
190
|
+
<summary><b>Anthropic</b></summary>
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
export ANTHROPIC_API_KEY=your-api-key
|
|
194
|
+
export KODER_MODEL="claude-opus-4-20250514"
|
|
195
|
+
koder
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
<details>
|
|
201
|
+
<summary><b>Google Gemini</b></summary>
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
export GOOGLE_API_KEY=your-api-key
|
|
205
|
+
export KODER_MODEL="gemini/gemini-2.5-pro"
|
|
206
|
+
koder
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
</details>
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary><b>GitHub Copilot</b></summary>
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
export KODER_MODEL="github_copilot/claude-sonnet-4"
|
|
216
|
+
koder
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
On first run you will see a device code in the terminal. Visit <https://github.com/login/device> and enter the code to authenticate.
|
|
220
|
+
|
|
221
|
+
</details>
|
|
222
|
+
|
|
223
|
+
<details>
|
|
224
|
+
<summary><b>Azure OpenAI</b></summary>
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
export AZURE_API_KEY="your-azure-api-key"
|
|
228
|
+
export AZURE_API_BASE="https://your-resource.openai.azure.com"
|
|
229
|
+
export AZURE_API_VERSION="2025-04-01-preview"
|
|
230
|
+
export KODER_MODEL="azure/gpt-4"
|
|
231
|
+
koder
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Or configure in `~/.koder/config.yaml`:
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
model:
|
|
238
|
+
name: "gpt-4"
|
|
239
|
+
provider: "azure"
|
|
240
|
+
azure_api_version: "2025-04-01-preview"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
</details>
|
|
244
|
+
|
|
245
|
+
<details>
|
|
246
|
+
<summary><b>Google Vertex AI</b></summary>
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
export GOOGLE_APPLICATION_CREDENTIALS="path/to/service-account.json"
|
|
250
|
+
export VERTEXAI_LOCATION="us-central1"
|
|
251
|
+
export KODER_MODEL="vertex_ai/claude-sonnet-4@20250514"
|
|
252
|
+
koder
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Or configure in `~/.koder/config.yaml`:
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
model:
|
|
259
|
+
name: "claude-sonnet-4@20250514"
|
|
260
|
+
provider: "vertex_ai"
|
|
261
|
+
vertex_ai_location: "us-central1"
|
|
262
|
+
vertex_ai_credentials_path: "path/to/service-account.json"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
</details>
|
|
266
|
+
|
|
267
|
+
<details>
|
|
268
|
+
<summary><b>Other Providers (100+ via LiteLLM)</b></summary>
|
|
269
|
+
|
|
270
|
+
[LiteLLM](https://docs.litellm.ai/docs/providers) supports 100+ providers. Use the format `provider/model`:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# Groq
|
|
274
|
+
export GROQ_API_KEY=your-key
|
|
275
|
+
export KODER_MODEL="groq/llama-3.3-70b-versatile"
|
|
276
|
+
|
|
277
|
+
# Together AI
|
|
278
|
+
export TOGETHERAI_API_KEY=your-key
|
|
279
|
+
export KODER_MODEL="together_ai/meta-llama/Llama-3-70b-chat-hf"
|
|
280
|
+
|
|
281
|
+
# OpenRouter
|
|
282
|
+
export OPENROUTER_API_KEY=your-key
|
|
283
|
+
export KODER_MODEL="openrouter/anthropic/claude-3-opus"
|
|
284
|
+
|
|
285
|
+
# Custom OpenAI-compatible endpoints
|
|
286
|
+
export OPENAI_API_KEY="your-key"
|
|
287
|
+
export OPENAI_BASE_URL="https://your-custom-endpoint.com/v1"
|
|
288
|
+
export KODER_MODEL="openai/your-model-name"
|
|
289
|
+
|
|
290
|
+
koder
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
</details>
|
|
294
|
+
|
|
295
|
+
### MCP Server Configuration
|
|
296
|
+
|
|
297
|
+
Model Context Protocol (MCP) servers extend Koder's capabilities with additional tools.
|
|
298
|
+
|
|
299
|
+
#### MCP CLI Commands
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Add an MCP server (stdio transport)
|
|
303
|
+
koder mcp add myserver "python -m my_mcp_server" --transport stdio
|
|
304
|
+
|
|
305
|
+
# Add with environment variables
|
|
306
|
+
koder mcp add myserver "python -m server" -e API_KEY=xxx -e DEBUG=true
|
|
307
|
+
|
|
308
|
+
# Add HTTP/SSE server
|
|
309
|
+
koder mcp add webserver --transport http --url http://localhost:8000
|
|
310
|
+
|
|
311
|
+
# List all MCP servers
|
|
312
|
+
koder mcp list
|
|
313
|
+
|
|
314
|
+
# Get server details
|
|
315
|
+
koder mcp get myserver
|
|
316
|
+
|
|
317
|
+
# Remove a server
|
|
318
|
+
koder mcp remove myserver
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### MCP Config Format
|
|
322
|
+
|
|
323
|
+
```yaml
|
|
324
|
+
# In ~/.koder/config.yaml
|
|
325
|
+
|
|
326
|
+
mcp_servers:
|
|
327
|
+
# stdio transport (runs a local command)
|
|
328
|
+
- name: "filesystem"
|
|
329
|
+
transport_type: "stdio"
|
|
330
|
+
command: "python"
|
|
331
|
+
args: ["-m", "mcp.server.filesystem"]
|
|
332
|
+
env_vars:
|
|
333
|
+
ROOT_PATH: "/home/user/projects"
|
|
334
|
+
cache_tools_list: true
|
|
335
|
+
allowed_tools: # Optional: whitelist specific tools
|
|
336
|
+
- "read_file"
|
|
337
|
+
- "write_file"
|
|
338
|
+
|
|
339
|
+
# HTTP transport (connects to remote server)
|
|
340
|
+
- name: "web-tools"
|
|
341
|
+
transport_type: "http"
|
|
342
|
+
url: "http://localhost:8000"
|
|
343
|
+
headers:
|
|
344
|
+
Authorization: "Bearer token123"
|
|
345
|
+
|
|
346
|
+
# SSE transport (server-sent events)
|
|
347
|
+
- name: "streaming-server"
|
|
348
|
+
transport_type: "sse"
|
|
349
|
+
url: "http://localhost:9000/sse"
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Example Configurations
|
|
353
|
+
|
|
354
|
+
<details>
|
|
355
|
+
<summary><b>Minimal (OpenAI)</b></summary>
|
|
356
|
+
|
|
357
|
+
```yaml
|
|
358
|
+
# ~/.koder/config.yaml
|
|
359
|
+
model:
|
|
360
|
+
name: "gpt-4o"
|
|
361
|
+
provider: "openai"
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
export OPENAI_API_KEY="sk-..."
|
|
366
|
+
koder
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
</details>
|
|
370
|
+
|
|
371
|
+
<details>
|
|
372
|
+
<summary><b>Enterprise Azure Setup</b></summary>
|
|
373
|
+
|
|
374
|
+
```yaml
|
|
375
|
+
# ~/.koder/config.yaml
|
|
376
|
+
model:
|
|
377
|
+
name: "gpt-4"
|
|
378
|
+
provider: "azure"
|
|
379
|
+
azure_api_version: "2025-04-01-preview"
|
|
380
|
+
|
|
381
|
+
cli:
|
|
382
|
+
session: "enterprise-project"
|
|
383
|
+
stream: true
|
|
384
|
+
|
|
385
|
+
mcp_servers:
|
|
386
|
+
- name: "company-tools"
|
|
387
|
+
transport_type: "http"
|
|
388
|
+
url: "https://internal-mcp.company.com"
|
|
389
|
+
headers:
|
|
390
|
+
X-API-Key: "${COMPANY_API_KEY}"
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
export AZURE_API_KEY="..."
|
|
395
|
+
export AZURE_API_BASE="https://your-resource.openai.azure.com"
|
|
396
|
+
koder
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
</details>
|
|
400
|
+
|
|
401
|
+
<details>
|
|
402
|
+
<summary><b>Multi-Provider Development</b></summary>
|
|
403
|
+
|
|
404
|
+
```yaml
|
|
405
|
+
# ~/.koder/config.yaml - set a default
|
|
406
|
+
model:
|
|
407
|
+
name: "gpt-4o"
|
|
408
|
+
provider: "openai"
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Override at runtime with KODER_MODEL
|
|
413
|
+
export OPENAI_API_KEY="..."
|
|
414
|
+
export ANTHROPIC_API_KEY="..."
|
|
415
|
+
|
|
416
|
+
# Use default (OpenAI)
|
|
417
|
+
koder
|
|
418
|
+
|
|
419
|
+
# Switch to Claude for specific tasks
|
|
420
|
+
KODER_MODEL="claude-opus-4-20250514" koder "complex reasoning task"
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
</details>
|
|
424
|
+
|
|
425
|
+
### Configuration Priority
|
|
426
|
+
|
|
427
|
+
When the same setting is defined in multiple places, the priority is:
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
CLI Arguments > Environment Variables > Config File > Defaults
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Example:**
|
|
434
|
+
|
|
435
|
+
```yaml
|
|
436
|
+
# ~/.koder/config.yaml
|
|
437
|
+
model:
|
|
438
|
+
name: "gpt-4o"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
# Environment variable overrides config file
|
|
443
|
+
export KODER_MODEL="claude-opus-4-20250514"
|
|
444
|
+
koder # Uses claude-opus-4-20250514
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## 🛠️ Development
|
|
448
|
+
|
|
449
|
+
### Setup Development Environment
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
# Clone the repository
|
|
453
|
+
git clone https://github.com/feiskyer/koder.git
|
|
454
|
+
cd koder
|
|
455
|
+
|
|
456
|
+
uv sync
|
|
457
|
+
uv run koder
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Code Quality
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Code formatting
|
|
464
|
+
black .
|
|
465
|
+
|
|
466
|
+
# Linting
|
|
467
|
+
ruff check --fix
|
|
468
|
+
|
|
469
|
+
# pylint
|
|
470
|
+
pylint koder_agent/ --disable=C,R,W --errors-only
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
## 🔒 Security
|
|
474
|
+
|
|
475
|
+
- **API Keys**: All API keys are stored in environment variables and never in code.
|
|
476
|
+
- **Local Storage**: Sessions are stored locally in your home directory.
|
|
477
|
+
- **No Telemetry**: Koder doesn't send any data besides API requests to your chosen provider.
|
|
478
|
+
- **Code Execution**: Shell commands require explicit user confirmation.
|
|
479
|
+
|
|
480
|
+
## 🤝 Contributing
|
|
481
|
+
|
|
482
|
+
Contributions are welcome! Here's how you can help:
|
|
483
|
+
|
|
484
|
+
1. **Fork** the repository
|
|
485
|
+
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
|
|
486
|
+
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
|
|
487
|
+
4. **Push** to the branch (`git push origin feature/amazing-feature`)
|
|
488
|
+
5. **Open** a Pull Request
|
|
489
|
+
|
|
490
|
+
Please read our [Contributing Guidelines](CONTRIBUTING.md) for more details.
|
|
491
|
+
|
|
492
|
+
## 🌐 Code of Conduct
|
|
493
|
+
|
|
494
|
+
This project follows a Code of Conduct based on the Contributor Covenant. Be kind and respectful. If you observe unacceptable behavior, please open an issue.
|
|
495
|
+
|
|
496
|
+
## 📄 License
|
|
497
|
+
|
|
498
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
499
|
+
|
|
500
|
+
Use of third-party AI services is governed by their respective provider terms.
|