koder 0.4.8__tar.gz → 0.4.10__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.
Files changed (95) hide show
  1. koder-0.4.10/PKG-INFO +361 -0
  2. koder-0.4.10/README.md +323 -0
  3. koder-0.4.10/koder_agent/auth/__init__.py +28 -0
  4. koder-0.4.10/koder_agent/auth/base.py +333 -0
  5. koder-0.4.10/koder_agent/auth/callback_server.py +263 -0
  6. koder-0.4.10/koder_agent/auth/cli_handler.py +450 -0
  7. koder-0.4.10/koder_agent/auth/client_integration.py +242 -0
  8. koder-0.4.10/koder_agent/auth/codex_prompts.py +21 -0
  9. koder-0.4.10/koder_agent/auth/constants.py +111 -0
  10. koder-0.4.10/koder_agent/auth/litellm_oauth.py +2687 -0
  11. koder-0.4.10/koder_agent/auth/providers/__init__.py +58 -0
  12. koder-0.4.10/koder_agent/auth/providers/antigravity.py +297 -0
  13. koder-0.4.10/koder_agent/auth/providers/chatgpt.py +199 -0
  14. koder-0.4.10/koder_agent/auth/providers/claude.py +261 -0
  15. koder-0.4.10/koder_agent/auth/providers/google.py +194 -0
  16. koder-0.4.10/koder_agent/auth/token_storage.py +179 -0
  17. koder-0.4.10/koder_agent/auth/tool_utils.py +1274 -0
  18. {koder-0.4.8 → koder-0.4.10}/koder_agent/cli.py +51 -3
  19. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/scheduler.py +12 -32
  20. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/security.py +1 -1
  21. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/client.py +171 -4
  22. {koder-0.4.8 → koder-0.4.10}/pyproject.toml +19 -3
  23. koder-0.4.8/.claude/settings.local.json +0 -24
  24. koder-0.4.8/.github/dependabot.yml +0 -11
  25. koder-0.4.8/.uv-cache/.gitignore +0 -1
  26. koder-0.4.8/.uv-cache/CACHEDIR.TAG +0 -1
  27. koder-0.4.8/.uv-cache/interpreter-v4/aarch64/72afda6228b75bee.msgpack +0 -1
  28. koder-0.4.8/.uv-cache/sdists-v7/.git +0 -0
  29. koder-0.4.8/.uv-cache/sdists-v7/.gitignore +0 -0
  30. koder-0.4.8/AGENTS.md +0 -111
  31. koder-0.4.8/CLAUDE.md +0 -98
  32. koder-0.4.8/CONTRIBUTING.md +0 -165
  33. koder-0.4.8/GEMINI.md +0 -1
  34. koder-0.4.8/PKG-INFO +0 -581
  35. koder-0.4.8/README.md +0 -544
  36. koder-0.4.8/scripts/upgrade_dependency.py +0 -105
  37. koder-0.4.8/tests/fixtures/skills/large-skill/SKILL.md +0 -106
  38. koder-0.4.8/tests/fixtures/skills/large-skill/reference.md +0 -24
  39. koder-0.4.8/tests/fixtures/skills/medium-skill/SKILL.md +0 -74
  40. koder-0.4.8/tests/fixtures/skills/small-skill/SKILL.md +0 -56
  41. koder-0.4.8/tests/fixtures/skills/template-skill/SKILL.md +0 -20
  42. koder-0.4.8/tests/test_capture_usage.py +0 -217
  43. koder-0.4.8/tests/test_file_tools.py +0 -1071
  44. koder-0.4.8/tests/test_llm_completion_responses.py +0 -65
  45. koder-0.4.8/tests/test_model_info.py +0 -144
  46. koder-0.4.8/tests/test_model_resolution.py +0 -129
  47. koder-0.4.8/tests/test_shell_background.py +0 -378
  48. koder-0.4.8/tests/test_skill_loader.py +0 -518
  49. koder-0.4.8/tests/test_skill_restrictions.py +0 -713
  50. koder-0.4.8/tests/test_skill_token_efficiency.py +0 -241
  51. koder-0.4.8/tests/test_streaming_display.py +0 -381
  52. koder-0.4.8/tests/test_usage_tracker.py +0 -233
  53. koder-0.4.8/tests/test_web.py +0 -402
  54. koder-0.4.8/uv.lock +0 -4034
  55. {koder-0.4.8 → koder-0.4.10}/.gitignore +0 -0
  56. {koder-0.4.8 → koder-0.4.10}/LICENSE +0 -0
  57. {koder-0.4.8 → koder-0.4.10}/koder_agent/__init__.py +0 -0
  58. {koder-0.4.8 → koder-0.4.10}/koder_agent/agentic/__init__.py +0 -0
  59. {koder-0.4.8 → koder-0.4.10}/koder_agent/agentic/agent.py +0 -0
  60. {koder-0.4.8 → koder-0.4.10}/koder_agent/agentic/approval_hooks.py +0 -0
  61. {koder-0.4.8 → koder-0.4.10}/koder_agent/agentic/hooks.py +0 -0
  62. {koder-0.4.8 → koder-0.4.10}/koder_agent/agentic/skill_guardrail.py +0 -0
  63. {koder-0.4.8 → koder-0.4.10}/koder_agent/config/__init__.py +0 -0
  64. {koder-0.4.8 → koder-0.4.10}/koder_agent/config/cli_handler.py +0 -0
  65. {koder-0.4.8 → koder-0.4.10}/koder_agent/config/manager.py +0 -0
  66. {koder-0.4.8 → koder-0.4.10}/koder_agent/config/models.py +0 -0
  67. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/__init__.py +0 -0
  68. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/commands.py +0 -0
  69. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/interactive.py +0 -0
  70. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/keyboard_listener.py +0 -0
  71. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/session.py +0 -0
  72. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/status_line.py +0 -0
  73. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/streaming_display.py +0 -0
  74. {koder-0.4.8 → koder-0.4.10}/koder_agent/core/usage_tracker.py +0 -0
  75. {koder-0.4.8 → koder-0.4.10}/koder_agent/mcp/__init__.py +0 -0
  76. {koder-0.4.8 → koder-0.4.10}/koder_agent/mcp/cli_handler.py +0 -0
  77. {koder-0.4.8 → koder-0.4.10}/koder_agent/mcp/server_config.py +0 -0
  78. {koder-0.4.8 → koder-0.4.10}/koder_agent/mcp/server_factory.py +0 -0
  79. {koder-0.4.8 → koder-0.4.10}/koder_agent/mcp/server_manager.py +0 -0
  80. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/__init__.py +0 -0
  81. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/engine.py +0 -0
  82. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/file.py +0 -0
  83. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/search.py +0 -0
  84. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/shell.py +0 -0
  85. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/skill.py +0 -0
  86. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/skill_context.py +0 -0
  87. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/task.py +0 -0
  88. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/todo.py +0 -0
  89. {koder-0.4.8 → koder-0.4.10}/koder_agent/tools/web.py +0 -0
  90. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/__init__.py +0 -0
  91. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/model_info.py +0 -0
  92. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/prompts.py +0 -0
  93. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/queue.py +0 -0
  94. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/sessions.py +0 -0
  95. {koder-0.4.8 → koder-0.4.10}/koder_agent/utils/terminal_theme.py +0 -0
koder-0.4.10/PKG-INFO ADDED
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.4
2
+ Name: koder
3
+ Version: 0.4.10
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.10
11
+ Requires-Dist: aiosqlite>=0.22.1
12
+ Requires-Dist: anthropic>=0.75.0
13
+ Requires-Dist: apscheduler>=3.11.2
14
+ Requires-Dist: backoff>=2.2.1
15
+ Requires-Dist: beautifulsoup4>=4.14.3
16
+ Requires-Dist: cryptography>=46.0.3
17
+ Requires-Dist: ddgs>=9.10.0
18
+ Requires-Dist: fastapi-sso>=0.19.0
19
+ Requires-Dist: fastapi>=0.128.0
20
+ Requires-Dist: google-cloud-aiplatform>=1.132.0
21
+ Requires-Dist: httpx[socks]>=0.28.1
22
+ Requires-Dist: litellm>=1.80.11
23
+ Requires-Dist: openai-agents[litellm]>=0.6.4
24
+ Requires-Dist: openai>=2.14.0
25
+ Requires-Dist: orjson>=3.11.5
26
+ Requires-Dist: prompt-toolkit>=3.0.52
27
+ Requires-Dist: pydantic>=2.12.5
28
+ Requires-Dist: pyjwt>=2.10.1
29
+ Requires-Dist: pynacl>=1.6.2
30
+ Requires-Dist: python-multipart>=0.0.21
31
+ Requires-Dist: pyyaml>=6.0.3
32
+ Requires-Dist: requests>=2.32.5
33
+ Requires-Dist: rich>=14.2.0
34
+ Requires-Dist: tiktoken>=0.12.0
35
+ Requires-Dist: websockets>=15.0.1
36
+ Requires-Dist: whatthepatch>=1.0.7
37
+ Description-Content-Type: text/markdown
38
+
39
+ # Koder
40
+
41
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
42
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
43
+ [![PyPI Downloads](https://static.pepy.tech/badge/koder)](https://pepy.tech/projects/koder)
44
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
45
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
46
+
47
+ An experimental, universal AI coding assistant for the terminal. Built in Python, Koder works with OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers via LiteLLM.
48
+
49
+ 🎯 **Status**: Alpha - This is a learning-focused project exploring AI agent development.
50
+
51
+ ## Features
52
+
53
+ - **Universal AI Support** - Works with ChatGPT/Gemini/Claude subscriptions and API keys via OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers
54
+ - **Smart Context** - Persistent sessions with SQLite storage and automatic token-aware compression
55
+ - **Real-time Streaming** - Rich terminal displays with live output
56
+ - **Comprehensive Tools** - File operations, search, shell, task delegation, todos, and skills
57
+ - **MCP Integration** - Extensible tool ecosystem via Model Context Protocol
58
+ - **Zero Config** - Automatic provider detection with sensible defaults
59
+
60
+ ## Installation
61
+
62
+ ### Using uv (Recommended)
63
+
64
+ ```bash
65
+ uv tool install koder
66
+ ```
67
+
68
+ ### Using pip
69
+
70
+ ```bash
71
+ pip install koder
72
+ ```
73
+
74
+ ## Quick Start
75
+
76
+ ```bash
77
+ # 1. Set your API key
78
+ export OPENAI_API_KEY="your-api-key"
79
+
80
+ # 2. Run Koder
81
+ koder
82
+ ```
83
+
84
+ That's it! Koder auto-detects your provider from the API key.
85
+
86
+ ### Basic Usage
87
+
88
+ ```bash
89
+ # Interactive mode
90
+ koder
91
+
92
+ # Single prompt
93
+ koder "create a Python function to calculate fibonacci numbers"
94
+
95
+ # Named session (persists conversation)
96
+ koder -s my-project "help me implement a new feature"
97
+
98
+ # Use a different model
99
+ KODER_MODEL="claude-opus-4-20250514" koder "your prompt"
100
+ ```
101
+
102
+ ## Configuration
103
+
104
+ Koder can be configured via (in priority order):
105
+
106
+ 1. **CLI arguments** - Highest priority
107
+ 2. **Environment variables** - `KODER_MODEL`, `KODER_REASONING_EFFORT`
108
+ 3. **Config file** - `~/.koder/config.yaml`
109
+
110
+ ### Providers
111
+
112
+ | Provider | Environment Variable | Model Example |
113
+ |----------|---------------------|---------------|
114
+ | OpenAI | `OPENAI_API_KEY` | `gpt-4o`, `gpt-4.1` |
115
+ | Anthropic | `ANTHROPIC_API_KEY` | `claude-opus-4-20250514` |
116
+ | Google | `GOOGLE_API_KEY` | `gemini/gemini-2.5-pro` |
117
+ | GitHub Copilot | *(device auth)* | `github_copilot/claude-sonnet-4` |
118
+ | Azure | `AZURE_API_KEY` | `azure/gpt-4` |
119
+
120
+ See [Configuration Guide](docs/configuration.md) for all 100+ providers.
121
+
122
+ ### OAuth Providers (Subscription-Based)
123
+
124
+ Use your existing subscriptions (Claude Max, ChatGPT Plus/Pro, Google Gemini) without API keys:
125
+
126
+ ```bash
127
+ # Authenticate with a provider
128
+ koder auth login google # Google/Gemini CLI (free with Google account)
129
+ koder auth login claude # Claude Max subscription
130
+ koder auth login chatgpt # ChatGPT Plus/Pro subscription
131
+ koder auth login antigravity # Antigravity (Gemini 3 + Claude models)
132
+
133
+ # Check authentication status
134
+ koder auth list # List configured providers
135
+ koder auth status # Show detailed token status
136
+
137
+ # Revoke access
138
+ koder auth revoke google # Remove stored tokens
139
+ ```
140
+
141
+ **OAuth Providers:**
142
+
143
+ | OAuth Provider | Subscription | Description |
144
+ |----------------|--------------|-------------|
145
+ | `google` | Google Gemini | Access to Gemini models via Google account |
146
+ | `claude` | Claude Pro/Max | Access to Claude models via subscription |
147
+ | `chatgpt` | ChatGPT Plus/Pro | Access to GPT models via subscription |
148
+ | `antigravity` | Antigravity | Access to Gemini 3 + Claude models |
149
+
150
+ Available models are fetched from each provider's API after login and cached locally (1 day TTL).
151
+ Use `koder auth list` to see all available models for your authenticated providers.
152
+
153
+ **Usage after authentication:**
154
+
155
+ ```bash
156
+ # Use OAuth-authenticated models (OAuth provider prefix required)
157
+ KODER_MODEL="google/gemini-3-pro-preview" koder "your prompt" # Google OAuth
158
+ KODER_MODEL="claude/claude-opus-4-5-20250514" koder "your prompt" # Claude Max
159
+ KODER_MODEL="chatgpt/gpt-5.2" koder "your prompt" # ChatGPT OAuth
160
+ KODER_MODEL="antigravity/antigravity-gemini-3-pro-high" koder "your prompt" # Antigravity
161
+ ```
162
+
163
+ OAuth tokens and cached models are stored in `~/.koder/tokens/` and automatically refreshed before expiry.
164
+
165
+ ### Config File Example
166
+
167
+ ```yaml
168
+ # ~/.koder/config.yaml
169
+
170
+ model:
171
+ name: "gpt-4o"
172
+ provider: "openai"
173
+ reasoning_effort: null # For reasoning models: low, medium, high
174
+
175
+ cli:
176
+ session: null # Default session name
177
+ stream: true # Enable streaming output
178
+
179
+ mcp_servers: [] # MCP server configurations
180
+ ```
181
+
182
+ ### Commands
183
+
184
+ ```bash
185
+ koder config show # Show current config
186
+ koder config edit # Edit config file
187
+ koder -s SESSION_NAME # Use named session
188
+ ```
189
+
190
+ ## MCP Servers
191
+
192
+ Model Context Protocol (MCP) servers extend Koder with additional tools.
193
+
194
+ ### CLI Commands
195
+
196
+ ```bash
197
+ # Add servers
198
+ koder mcp add myserver "python -m my_mcp_server"
199
+ koder mcp add myserver "python -m server" -e API_KEY=xxx
200
+
201
+ # HTTP/SSE transport
202
+ koder mcp add webserver --transport http --url http://localhost:8000
203
+
204
+ # Manage servers
205
+ koder mcp list
206
+ koder mcp get myserver
207
+ koder mcp remove myserver
208
+ ```
209
+
210
+ ### Config Example
211
+
212
+ ```yaml
213
+ # In ~/.koder/config.yaml
214
+ mcp_servers:
215
+ # stdio transport (local command)
216
+ - name: "filesystem"
217
+ transport_type: "stdio"
218
+ command: "python"
219
+ args: ["-m", "mcp.server.filesystem"]
220
+ env_vars:
221
+ ROOT_PATH: "/home/user/projects"
222
+ cache_tools_list: true
223
+ allowed_tools:
224
+ - "read_file"
225
+ - "write_file"
226
+
227
+ # HTTP transport (remote server)
228
+ - name: "web-tools"
229
+ transport_type: "http"
230
+ url: "http://localhost:8000"
231
+ headers:
232
+ Authorization: "Bearer token123"
233
+
234
+ # SSE transport
235
+ - name: "streaming-server"
236
+ transport_type: "sse"
237
+ url: "http://localhost:9000/sse"
238
+ ```
239
+
240
+ ## Skills
241
+
242
+ Skills provide specialized knowledge loaded on-demand, saving 90%+ tokens via progressive disclosure.
243
+
244
+ ### Directory Structure
245
+
246
+ Skills are loaded from (project skills take priority):
247
+
248
+ 1. **Project**: `.koder/skills/`
249
+ 2. **User**: `~/.koder/skills/`
250
+
251
+ ```
252
+ .koder/skills/
253
+ ├── api-design/
254
+ │ └── SKILL.md
255
+ ├── code-review/
256
+ │ ├── SKILL.md
257
+ │ └── checklist.md
258
+ └── testing/
259
+ └── SKILL.md
260
+ ```
261
+
262
+ ### Creating a Skill
263
+
264
+ Create a `SKILL.md` with YAML frontmatter:
265
+
266
+ ```markdown
267
+ ---
268
+ name: api-design
269
+ description: Best practices for designing RESTful APIs
270
+ allowed_tools:
271
+ - read_file
272
+ - write_file
273
+ ---
274
+
275
+ # API Design Guidelines
276
+
277
+ ## RESTful Principles
278
+
279
+ Use nouns for resources, HTTP verbs for actions...
280
+ ```
281
+
282
+ ### How Skills Work
283
+
284
+ 1. **Startup**: Only skill names and descriptions are loaded (minimal tokens)
285
+ 2. **On-demand**: Full content fetched when needed via `get_skill(name)`
286
+ 3. **Supplementary**: Skills can reference additional files
287
+
288
+ ## Architecture
289
+
290
+ ```
291
+ koder_agent/
292
+ ├── agentic/ # Agent creation, hooks, and approval system
293
+ ├── cli.py # Main CLI entry point
294
+ ├── config/ # Configuration management
295
+ ├── core/ # Scheduler, context, streaming, security
296
+ ├── mcp/ # Model Context Protocol integration
297
+ ├── tools/ # Tool implementations
298
+ └── utils/ # Helpers and utilities
299
+ ```
300
+
301
+ ### Core Flow
302
+
303
+ 1. **CLI** (`cli.py`) parses arguments, initializes session
304
+ 2. **AgentScheduler** (`core/scheduler.py`) orchestrates execution with streaming
305
+ 3. **Agent** (`agentic/agent.py`) builds agent with tools, MCP servers, model settings
306
+ 4. **Tools** (`tools/engine.py`) register tools, validate inputs, filter output
307
+ 5. **Context** (`core/context.py`) persists conversations in SQLite
308
+
309
+ ### Data Storage
310
+
311
+ - **Database**: `~/.koder/koder.db` (SQLite)
312
+ - **Config**: `~/.koder/config.yaml`
313
+ - **Skills**: `~/.koder/skills/` or `.koder/skills/`
314
+
315
+ ## Development
316
+
317
+ ### Setup
318
+
319
+ ```bash
320
+ git clone https://github.com/feiskyer/koder.git
321
+ cd koder
322
+ uv sync
323
+ uv run koder
324
+ ```
325
+
326
+ ### Code Quality
327
+
328
+ ```bash
329
+ uv run black . # Format
330
+ uv run ruff check --fix # Lint
331
+ uv run pytest # Test
332
+ ```
333
+
334
+ ## Security
335
+
336
+ - **API Keys**: Stored in environment variables, never in code
337
+ - **Local Storage**: Sessions stored in `~/.koder/`
338
+ - **No Telemetry**: Only API requests to your chosen provider
339
+ - **Shell Commands**: Require explicit user confirmation
340
+
341
+ ## Contributing
342
+
343
+ Contributions are welcome!
344
+
345
+ 1. Fork the repository
346
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
347
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
348
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
349
+ 5. Open a Pull Request
350
+
351
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
352
+
353
+ ## License
354
+
355
+ MIT License - see [LICENSE](LICENSE) for details.
356
+
357
+ ---
358
+
359
+ <p align="center">
360
+ <sub>Built with Python and curiosity</sub>
361
+ </p>
koder-0.4.10/README.md ADDED
@@ -0,0 +1,323 @@
1
+ # Koder
2
+
3
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
4
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
+ [![PyPI Downloads](https://static.pepy.tech/badge/koder)](https://pepy.tech/projects/koder)
6
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8
+
9
+ An experimental, universal AI coding assistant for the terminal. Built in Python, Koder works with OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers via LiteLLM.
10
+
11
+ 🎯 **Status**: Alpha - This is a learning-focused project exploring AI agent development.
12
+
13
+ ## Features
14
+
15
+ - **Universal AI Support** - Works with ChatGPT/Gemini/Claude subscriptions and API keys via OpenAI, Anthropic, Google, GitHub Copilot, and 100+ providers
16
+ - **Smart Context** - Persistent sessions with SQLite storage and automatic token-aware compression
17
+ - **Real-time Streaming** - Rich terminal displays with live output
18
+ - **Comprehensive Tools** - File operations, search, shell, task delegation, todos, and skills
19
+ - **MCP Integration** - Extensible tool ecosystem via Model Context Protocol
20
+ - **Zero Config** - Automatic provider detection with sensible defaults
21
+
22
+ ## Installation
23
+
24
+ ### Using uv (Recommended)
25
+
26
+ ```bash
27
+ uv tool install koder
28
+ ```
29
+
30
+ ### Using pip
31
+
32
+ ```bash
33
+ pip install koder
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```bash
39
+ # 1. Set your API key
40
+ export OPENAI_API_KEY="your-api-key"
41
+
42
+ # 2. Run Koder
43
+ koder
44
+ ```
45
+
46
+ That's it! Koder auto-detects your provider from the API key.
47
+
48
+ ### Basic Usage
49
+
50
+ ```bash
51
+ # Interactive mode
52
+ koder
53
+
54
+ # Single prompt
55
+ koder "create a Python function to calculate fibonacci numbers"
56
+
57
+ # Named session (persists conversation)
58
+ koder -s my-project "help me implement a new feature"
59
+
60
+ # Use a different model
61
+ KODER_MODEL="claude-opus-4-20250514" koder "your prompt"
62
+ ```
63
+
64
+ ## Configuration
65
+
66
+ Koder can be configured via (in priority order):
67
+
68
+ 1. **CLI arguments** - Highest priority
69
+ 2. **Environment variables** - `KODER_MODEL`, `KODER_REASONING_EFFORT`
70
+ 3. **Config file** - `~/.koder/config.yaml`
71
+
72
+ ### Providers
73
+
74
+ | Provider | Environment Variable | Model Example |
75
+ |----------|---------------------|---------------|
76
+ | OpenAI | `OPENAI_API_KEY` | `gpt-4o`, `gpt-4.1` |
77
+ | Anthropic | `ANTHROPIC_API_KEY` | `claude-opus-4-20250514` |
78
+ | Google | `GOOGLE_API_KEY` | `gemini/gemini-2.5-pro` |
79
+ | GitHub Copilot | *(device auth)* | `github_copilot/claude-sonnet-4` |
80
+ | Azure | `AZURE_API_KEY` | `azure/gpt-4` |
81
+
82
+ See [Configuration Guide](docs/configuration.md) for all 100+ providers.
83
+
84
+ ### OAuth Providers (Subscription-Based)
85
+
86
+ Use your existing subscriptions (Claude Max, ChatGPT Plus/Pro, Google Gemini) without API keys:
87
+
88
+ ```bash
89
+ # Authenticate with a provider
90
+ koder auth login google # Google/Gemini CLI (free with Google account)
91
+ koder auth login claude # Claude Max subscription
92
+ koder auth login chatgpt # ChatGPT Plus/Pro subscription
93
+ koder auth login antigravity # Antigravity (Gemini 3 + Claude models)
94
+
95
+ # Check authentication status
96
+ koder auth list # List configured providers
97
+ koder auth status # Show detailed token status
98
+
99
+ # Revoke access
100
+ koder auth revoke google # Remove stored tokens
101
+ ```
102
+
103
+ **OAuth Providers:**
104
+
105
+ | OAuth Provider | Subscription | Description |
106
+ |----------------|--------------|-------------|
107
+ | `google` | Google Gemini | Access to Gemini models via Google account |
108
+ | `claude` | Claude Pro/Max | Access to Claude models via subscription |
109
+ | `chatgpt` | ChatGPT Plus/Pro | Access to GPT models via subscription |
110
+ | `antigravity` | Antigravity | Access to Gemini 3 + Claude models |
111
+
112
+ Available models are fetched from each provider's API after login and cached locally (1 day TTL).
113
+ Use `koder auth list` to see all available models for your authenticated providers.
114
+
115
+ **Usage after authentication:**
116
+
117
+ ```bash
118
+ # Use OAuth-authenticated models (OAuth provider prefix required)
119
+ KODER_MODEL="google/gemini-3-pro-preview" koder "your prompt" # Google OAuth
120
+ KODER_MODEL="claude/claude-opus-4-5-20250514" koder "your prompt" # Claude Max
121
+ KODER_MODEL="chatgpt/gpt-5.2" koder "your prompt" # ChatGPT OAuth
122
+ KODER_MODEL="antigravity/antigravity-gemini-3-pro-high" koder "your prompt" # Antigravity
123
+ ```
124
+
125
+ OAuth tokens and cached models are stored in `~/.koder/tokens/` and automatically refreshed before expiry.
126
+
127
+ ### Config File Example
128
+
129
+ ```yaml
130
+ # ~/.koder/config.yaml
131
+
132
+ model:
133
+ name: "gpt-4o"
134
+ provider: "openai"
135
+ reasoning_effort: null # For reasoning models: low, medium, high
136
+
137
+ cli:
138
+ session: null # Default session name
139
+ stream: true # Enable streaming output
140
+
141
+ mcp_servers: [] # MCP server configurations
142
+ ```
143
+
144
+ ### Commands
145
+
146
+ ```bash
147
+ koder config show # Show current config
148
+ koder config edit # Edit config file
149
+ koder -s SESSION_NAME # Use named session
150
+ ```
151
+
152
+ ## MCP Servers
153
+
154
+ Model Context Protocol (MCP) servers extend Koder with additional tools.
155
+
156
+ ### CLI Commands
157
+
158
+ ```bash
159
+ # Add servers
160
+ koder mcp add myserver "python -m my_mcp_server"
161
+ koder mcp add myserver "python -m server" -e API_KEY=xxx
162
+
163
+ # HTTP/SSE transport
164
+ koder mcp add webserver --transport http --url http://localhost:8000
165
+
166
+ # Manage servers
167
+ koder mcp list
168
+ koder mcp get myserver
169
+ koder mcp remove myserver
170
+ ```
171
+
172
+ ### Config Example
173
+
174
+ ```yaml
175
+ # In ~/.koder/config.yaml
176
+ mcp_servers:
177
+ # stdio transport (local command)
178
+ - name: "filesystem"
179
+ transport_type: "stdio"
180
+ command: "python"
181
+ args: ["-m", "mcp.server.filesystem"]
182
+ env_vars:
183
+ ROOT_PATH: "/home/user/projects"
184
+ cache_tools_list: true
185
+ allowed_tools:
186
+ - "read_file"
187
+ - "write_file"
188
+
189
+ # HTTP transport (remote server)
190
+ - name: "web-tools"
191
+ transport_type: "http"
192
+ url: "http://localhost:8000"
193
+ headers:
194
+ Authorization: "Bearer token123"
195
+
196
+ # SSE transport
197
+ - name: "streaming-server"
198
+ transport_type: "sse"
199
+ url: "http://localhost:9000/sse"
200
+ ```
201
+
202
+ ## Skills
203
+
204
+ Skills provide specialized knowledge loaded on-demand, saving 90%+ tokens via progressive disclosure.
205
+
206
+ ### Directory Structure
207
+
208
+ Skills are loaded from (project skills take priority):
209
+
210
+ 1. **Project**: `.koder/skills/`
211
+ 2. **User**: `~/.koder/skills/`
212
+
213
+ ```
214
+ .koder/skills/
215
+ ├── api-design/
216
+ │ └── SKILL.md
217
+ ├── code-review/
218
+ │ ├── SKILL.md
219
+ │ └── checklist.md
220
+ └── testing/
221
+ └── SKILL.md
222
+ ```
223
+
224
+ ### Creating a Skill
225
+
226
+ Create a `SKILL.md` with YAML frontmatter:
227
+
228
+ ```markdown
229
+ ---
230
+ name: api-design
231
+ description: Best practices for designing RESTful APIs
232
+ allowed_tools:
233
+ - read_file
234
+ - write_file
235
+ ---
236
+
237
+ # API Design Guidelines
238
+
239
+ ## RESTful Principles
240
+
241
+ Use nouns for resources, HTTP verbs for actions...
242
+ ```
243
+
244
+ ### How Skills Work
245
+
246
+ 1. **Startup**: Only skill names and descriptions are loaded (minimal tokens)
247
+ 2. **On-demand**: Full content fetched when needed via `get_skill(name)`
248
+ 3. **Supplementary**: Skills can reference additional files
249
+
250
+ ## Architecture
251
+
252
+ ```
253
+ koder_agent/
254
+ ├── agentic/ # Agent creation, hooks, and approval system
255
+ ├── cli.py # Main CLI entry point
256
+ ├── config/ # Configuration management
257
+ ├── core/ # Scheduler, context, streaming, security
258
+ ├── mcp/ # Model Context Protocol integration
259
+ ├── tools/ # Tool implementations
260
+ └── utils/ # Helpers and utilities
261
+ ```
262
+
263
+ ### Core Flow
264
+
265
+ 1. **CLI** (`cli.py`) parses arguments, initializes session
266
+ 2. **AgentScheduler** (`core/scheduler.py`) orchestrates execution with streaming
267
+ 3. **Agent** (`agentic/agent.py`) builds agent with tools, MCP servers, model settings
268
+ 4. **Tools** (`tools/engine.py`) register tools, validate inputs, filter output
269
+ 5. **Context** (`core/context.py`) persists conversations in SQLite
270
+
271
+ ### Data Storage
272
+
273
+ - **Database**: `~/.koder/koder.db` (SQLite)
274
+ - **Config**: `~/.koder/config.yaml`
275
+ - **Skills**: `~/.koder/skills/` or `.koder/skills/`
276
+
277
+ ## Development
278
+
279
+ ### Setup
280
+
281
+ ```bash
282
+ git clone https://github.com/feiskyer/koder.git
283
+ cd koder
284
+ uv sync
285
+ uv run koder
286
+ ```
287
+
288
+ ### Code Quality
289
+
290
+ ```bash
291
+ uv run black . # Format
292
+ uv run ruff check --fix # Lint
293
+ uv run pytest # Test
294
+ ```
295
+
296
+ ## Security
297
+
298
+ - **API Keys**: Stored in environment variables, never in code
299
+ - **Local Storage**: Sessions stored in `~/.koder/`
300
+ - **No Telemetry**: Only API requests to your chosen provider
301
+ - **Shell Commands**: Require explicit user confirmation
302
+
303
+ ## Contributing
304
+
305
+ Contributions are welcome!
306
+
307
+ 1. Fork the repository
308
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
309
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
310
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
311
+ 5. Open a Pull Request
312
+
313
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
314
+
315
+ ## License
316
+
317
+ MIT License - see [LICENSE](LICENSE) for details.
318
+
319
+ ---
320
+
321
+ <p align="center">
322
+ <sub>Built with Python and curiosity</sub>
323
+ </p>
@@ -0,0 +1,28 @@
1
+ """OAuth authentication module for Koder.
2
+
3
+ This module provides OAuth authentication support for multiple providers:
4
+ - Google (Gemini API)
5
+ - Anthropic (Claude API)
6
+ - OpenAI (ChatGPT/Codex API)
7
+ - Antigravity (Google-based access to Gemini 3 + Claude)
8
+ """
9
+
10
+ from koder_agent.auth.base import OAuthProvider, OAuthResult, OAuthTokens
11
+ from koder_agent.auth.constants import (
12
+ ANTHROPIC_CLIENT_ID,
13
+ GOOGLE_CLIENT_ID,
14
+ OPENAI_CLIENT_ID,
15
+ SUPPORTED_PROVIDERS,
16
+ )
17
+ from koder_agent.auth.token_storage import TokenStorage
18
+
19
+ __all__ = [
20
+ "OAuthProvider",
21
+ "OAuthTokens",
22
+ "OAuthResult",
23
+ "TokenStorage",
24
+ "SUPPORTED_PROVIDERS",
25
+ "GOOGLE_CLIENT_ID",
26
+ "ANTHROPIC_CLIENT_ID",
27
+ "OPENAI_CLIENT_ID",
28
+ ]