koder 0.4.8__tar.gz → 0.4.9__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.9/.claude/settings.local.json +47 -0
- koder-0.4.9/AGENTS.md +112 -0
- koder-0.4.9/CLAUDE.md +112 -0
- koder-0.4.9/PKG-INFO +361 -0
- koder-0.4.9/README.md +323 -0
- koder-0.4.8/README.md → koder-0.4.9/docs/configuration.md +34 -186
- koder-0.4.9/koder_agent/auth/__init__.py +28 -0
- koder-0.4.9/koder_agent/auth/base.py +329 -0
- koder-0.4.9/koder_agent/auth/callback_server.py +263 -0
- koder-0.4.9/koder_agent/auth/cli_handler.py +386 -0
- koder-0.4.9/koder_agent/auth/client_integration.py +242 -0
- koder-0.4.9/koder_agent/auth/codex_prompts.py +21 -0
- koder-0.4.9/koder_agent/auth/constants.py +111 -0
- koder-0.4.9/koder_agent/auth/litellm_oauth.py +2687 -0
- koder-0.4.9/koder_agent/auth/providers/__init__.py +58 -0
- koder-0.4.9/koder_agent/auth/providers/antigravity.py +219 -0
- koder-0.4.9/koder_agent/auth/providers/chatgpt.py +192 -0
- koder-0.4.9/koder_agent/auth/providers/claude.py +254 -0
- koder-0.4.9/koder_agent/auth/providers/google.py +187 -0
- koder-0.4.9/koder_agent/auth/token_storage.py +179 -0
- koder-0.4.9/koder_agent/auth/tool_utils.py +1278 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/cli.py +51 -3
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/scheduler.py +12 -32
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/security.py +1 -1
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/client.py +171 -4
- {koder-0.4.8 → koder-0.4.9}/pyproject.toml +4 -3
- koder-0.4.9/scripts/generate_codex_prompts.py +161 -0
- koder-0.4.9/tests/auth/__init__.py +1 -0
- koder-0.4.9/tests/auth/test_oauth_providers.py +376 -0
- koder-0.4.9/tests/auth/test_token_refresh.py +299 -0
- koder-0.4.9/tests/auth/test_token_storage.py +201 -0
- koder-0.4.9/tests/auth/test_tool_calling.py +514 -0
- koder-0.4.9/tests/auth/test_tool_utils.py +574 -0
- koder-0.4.9/tests/integration/__init__.py +10 -0
- koder-0.4.9/tests/integration/conftest.py +33 -0
- koder-0.4.9/tests/integration/test_antigravity_oauth.py +95 -0
- koder-0.4.9/tests/integration/test_chatgpt_oauth.py +87 -0
- koder-0.4.9/tests/integration/test_claude_oauth.py +108 -0
- koder-0.4.9/tests/integration/test_google_oauth.py +86 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_model_info.py +0 -2
- koder-0.4.9/tests/test_security_guard.py +11 -0
- {koder-0.4.8 → koder-0.4.9}/uv.lock +54 -35
- koder-0.4.8/.claude/settings.local.json +0 -24
- koder-0.4.8/AGENTS.md +0 -111
- koder-0.4.8/CLAUDE.md +0 -98
- koder-0.4.8/PKG-INFO +0 -581
- {koder-0.4.8 → koder-0.4.9}/.github/dependabot.yml +0 -0
- {koder-0.4.8 → koder-0.4.9}/.gitignore +0 -0
- {koder-0.4.8 → koder-0.4.9}/.uv-cache/.gitignore +0 -0
- {koder-0.4.8 → koder-0.4.9}/.uv-cache/CACHEDIR.TAG +0 -0
- {koder-0.4.8 → koder-0.4.9}/.uv-cache/interpreter-v4/aarch64/72afda6228b75bee.msgpack +0 -0
- {koder-0.4.8 → koder-0.4.9}/.uv-cache/sdists-v7/.git +0 -0
- {koder-0.4.8 → koder-0.4.9}/.uv-cache/sdists-v7/.gitignore +0 -0
- {koder-0.4.8 → koder-0.4.9}/CONTRIBUTING.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/GEMINI.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/LICENSE +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/agentic/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/agentic/agent.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/agentic/approval_hooks.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/agentic/hooks.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/agentic/skill_guardrail.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/config/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/config/cli_handler.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/config/manager.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/config/models.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/commands.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/interactive.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/keyboard_listener.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/session.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/status_line.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/streaming_display.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/core/usage_tracker.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/mcp/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/mcp/cli_handler.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/mcp/server_config.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/mcp/server_factory.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/mcp/server_manager.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/engine.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/file.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/search.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/shell.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/skill.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/skill_context.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/task.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/todo.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/tools/web.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/__init__.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/model_info.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/prompts.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/queue.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/sessions.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/koder_agent/utils/terminal_theme.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/scripts/upgrade_dependency.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/fixtures/skills/large-skill/SKILL.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/fixtures/skills/large-skill/reference.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/fixtures/skills/medium-skill/SKILL.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/fixtures/skills/small-skill/SKILL.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/fixtures/skills/template-skill/SKILL.md +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_capture_usage.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_file_tools.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_llm_completion_responses.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_model_resolution.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_shell_background.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_skill_loader.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_skill_restrictions.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_skill_token_efficiency.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_streaming_display.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_usage_tracker.py +0 -0
- {koder-0.4.8 → koder-0.4.9}/tests/test_web.py +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(uv run python:*)",
|
|
5
|
+
"Bash(cat:*)",
|
|
6
|
+
"Bash(python -m py_compile:*)",
|
|
7
|
+
"Bash(uv run pytest:*)",
|
|
8
|
+
"mcp__plugin_claude-code-settings_exa__get_code_context_exa",
|
|
9
|
+
"Bash(find:*)",
|
|
10
|
+
"WebFetch(domain:www.anthropic.com)",
|
|
11
|
+
"Bash(uv run ruff check:*)",
|
|
12
|
+
"mcp__firecrawl__firecrawl_scrape",
|
|
13
|
+
"Bash(uv run:*)",
|
|
14
|
+
"Bash(uv run pip:*)",
|
|
15
|
+
"Bash(KODER_MODEL=\"github_copilot/gpt-5.1-codex\" uv run koder:*)",
|
|
16
|
+
"Bash(python3:*)",
|
|
17
|
+
"Bash(timeout 90 bash -c \"KODER_MODEL=''github_copilot/gpt-5.1-codex'' uv run koder ''respond with just hello''\")",
|
|
18
|
+
"Bash(git add:*)",
|
|
19
|
+
"Bash(git commit:*)",
|
|
20
|
+
"Bash(grep:*)",
|
|
21
|
+
"Bash(xargs:*)",
|
|
22
|
+
"WebFetch(domain:github.com)",
|
|
23
|
+
"Skill(ralph-wiggum:ralph-loop)",
|
|
24
|
+
"WebFetch(domain:docs.litellm.ai)",
|
|
25
|
+
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-sonnet-4-5-thinking-high\" uv run koder 'list me your tools')",
|
|
26
|
+
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-sonnet-4-5-thinking-high\" uv run koder:*)",
|
|
27
|
+
"Bash(KODER_MODEL=\"antigravity/antigravity-gemini-3-flash\" uv run koder:*)",
|
|
28
|
+
"Bash(KODER_MODEL=\"antigravity/antigravity-claude-opus-4-5-thinking-high\" uv run koder:*)",
|
|
29
|
+
"Bash(export KODER_MODEL=\"chatgpt/gpt-5.2\")",
|
|
30
|
+
"Bash(timeout 60 uv run:*)",
|
|
31
|
+
"Bash(export LITELLM_LOG=DEBUG)",
|
|
32
|
+
"Bash(done)",
|
|
33
|
+
"Bash(KODER_MODEL=\"antigravity/antigravity-gemini-3-pro-high\" timeout 30 uv run koder 'say hello')",
|
|
34
|
+
"Bash(timeout 90 uv run python3:*)",
|
|
35
|
+
"Bash(KODER_MODEL=\"google/gemini-2.0-flash\" timeout 90 uv run koder:*)",
|
|
36
|
+
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"chatgpt/gpt-5.2\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
37
|
+
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"google/gemini-2.0-flash\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
38
|
+
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"claude/claude-sonnet-4-20250514\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
39
|
+
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"antigravity/antigravity-gemini-2.5-flash\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
40
|
+
"Bash(timeout 120 uv run python3:*)",
|
|
41
|
+
"Bash(timeout 60 bash -c 'KODER_MODEL=\"\"\"\"antigravity/antigravity-gemini-3-pro-high\"\"\"\" uv run koder \"\"\"\"read the first 3 lines of pyproject.toml\"\"\"\"')",
|
|
42
|
+
"WebFetch(domain:ai.google.dev)"
|
|
43
|
+
],
|
|
44
|
+
"deny": [],
|
|
45
|
+
"ask": []
|
|
46
|
+
}
|
|
47
|
+
}
|
koder-0.4.9/AGENTS.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to KODER and Agentic AI when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Development Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv sync # Install dependencies
|
|
11
|
+
uv run koder # Run in interactive mode
|
|
12
|
+
uv run koder "Your prompt" # Single prompt
|
|
13
|
+
uv run koder -s my-session "Your prompt" # Named session
|
|
14
|
+
uv run koder --resume # Resume previous session
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Code Quality
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run black . # Format
|
|
21
|
+
uv run ruff check --fix # Lint with auto-fix
|
|
22
|
+
uv run pylint koder_agent/ --disable=C,R,W --errors-only # Error-only check
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Testing
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv run pytest # All tests
|
|
29
|
+
uv run pytest tests/test_file_tools.py # Single file
|
|
30
|
+
uv run pytest -v -k "test_name" # Single test by name
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### MCP Server Management
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv run koder mcp list # List servers
|
|
37
|
+
uv run koder mcp add myserver "python -m server" # Add server
|
|
38
|
+
uv run koder mcp remove myserver # Remove server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
Koder is a terminal-based AI coding assistant built on the `openai-agents` library with multi-provider support via LiteLLM.
|
|
44
|
+
|
|
45
|
+
### Package Structure
|
|
46
|
+
|
|
47
|
+
```md
|
|
48
|
+
koder_agent/
|
|
49
|
+
├── agentic/ # Agent creation, hooks, guardrails, approval system
|
|
50
|
+
├── cli.py # Main CLI entry point
|
|
51
|
+
├── config/ # Configuration management (YAML, env vars)
|
|
52
|
+
├── core/ # Scheduler, context, streaming, security, interactive mode, commands
|
|
53
|
+
├── mcp/ # Model Context Protocol server integration (stdio, SSE, HTTP)
|
|
54
|
+
├── tools/ # Tool implementations (file, search, shell, web, task, todo, skill)
|
|
55
|
+
└── utils/ # Client setup, prompts, sessions, model info, terminal theme
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Core Flow
|
|
59
|
+
|
|
60
|
+
1. **CLI Entry** (`cli.py`) → parses args, initializes session
|
|
61
|
+
2. **AgentScheduler** (`core/scheduler.py`) → orchestrates execution with streaming and usage tracking
|
|
62
|
+
3. **Agent Creation** (`agentic/agent.py`) → builds agent with tools, MCP servers, model settings
|
|
63
|
+
4. **Tool Engine** (`tools/engine.py`) → registers tools, validates inputs, filters sensitive output
|
|
64
|
+
5. **Context Manager** (`core/context.py`) → persists conversations in SQLite with token-aware compression
|
|
65
|
+
|
|
66
|
+
### Key Design Patterns
|
|
67
|
+
|
|
68
|
+
- **Provider Abstraction**: `utils/client.py` detects providers from environment; uses native OpenAI client for OpenAI/Azure, LiteLLM wrapper for others
|
|
69
|
+
- **RetryingLitellmModel**: `agentic/agent.py` wraps LiteLLM with exponential backoff retry (3-5 attempts) for rate limits and transient errors
|
|
70
|
+
- **Progressive Disclosure Skills**: `tools/skill.py` loads skill metadata at startup (Level 1), full content on-demand (Level 2), saving 90%+ tokens
|
|
71
|
+
- **Skill Restrictions**: `tools/skill_context.py` + `agentic/skill_guardrail.py` limit tool access when specific skills are active
|
|
72
|
+
- **Streaming Display**: `core/streaming_display.py` manages Rich Live displays for real-time output
|
|
73
|
+
- **Approval Hooks**: `agentic/approval_hooks.py` wraps tool execution with permission checks
|
|
74
|
+
- **Security Guard**: `core/security.py` validates shell commands before execution
|
|
75
|
+
- **Background Shells**: `tools/shell.py` `BackgroundShellManager` tracks async shell commands
|
|
76
|
+
|
|
77
|
+
### Tool Categories
|
|
78
|
+
|
|
79
|
+
| Category | Tools |
|
|
80
|
+
|----------|-------------------------------------------------------------------------|
|
|
81
|
+
| File | `read_file`, `write_file`, `append_file`, `edit_file`, `list_directory` |
|
|
82
|
+
| Search | `glob_search`, `grep_search` |
|
|
83
|
+
| Shell | `run_shell`, `shell_output`, `shell_kill`, `git_command` |
|
|
84
|
+
| Web | `web_search`, `web_fetch` |
|
|
85
|
+
| Task | `task_delegate`, `todo_read`, `todo_write` |
|
|
86
|
+
| Skills | `get_skill` |
|
|
87
|
+
|
|
88
|
+
### Configuration Priority
|
|
89
|
+
|
|
90
|
+
CLI Arguments > Environment Variables > Config File (`~/.koder/config.yaml`) > Defaults
|
|
91
|
+
|
|
92
|
+
Key environment variables:
|
|
93
|
+
|
|
94
|
+
- `KODER_MODEL` - Model name (e.g., `gpt-4o`, `claude-opus-4-20250514`, `github_copilot/gpt-5.1-codex`)
|
|
95
|
+
- `KODER_REASONING_EFFORT` - Reasoning effort for o1/o3/gpt-5.1 models (`low`, `medium`, `high`)
|
|
96
|
+
- Provider API keys: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `GITHUB_TOKEN`, etc.
|
|
97
|
+
|
|
98
|
+
### Database
|
|
99
|
+
|
|
100
|
+
SQLite at `~/.koder/koder.db` stores:
|
|
101
|
+
|
|
102
|
+
- Conversation history with token-aware compression (50k token limit via tiktoken)
|
|
103
|
+
- Session metadata with auto-generated titles
|
|
104
|
+
- MCP server configurations
|
|
105
|
+
|
|
106
|
+
### Project Context
|
|
107
|
+
|
|
108
|
+
The CLI loads `AGENTS.md` from the working directory as project-specific context for the agent.
|
|
109
|
+
|
|
110
|
+
### Skills System
|
|
111
|
+
|
|
112
|
+
Skills are loaded from `.koder/skills/` (project) and `~/.koder/skills/` (user). Each skill has a `SKILL.md` with YAML frontmatter defining `name`, `description`, and optional `allowed_tools`.
|
koder-0.4.9/CLAUDE.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
uv sync # Install dependencies
|
|
11
|
+
uv run koder # Run in interactive mode
|
|
12
|
+
uv run koder "Your prompt" # Single prompt
|
|
13
|
+
uv run koder -s my-session "Your prompt" # Named session
|
|
14
|
+
uv run koder --resume # Resume previous session
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Code Quality
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run black . # Format
|
|
21
|
+
uv run ruff check --fix # Lint with auto-fix
|
|
22
|
+
uv run pylint koder_agent/ --disable=C,R,W --errors-only # Error-only check
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Testing
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv run pytest # All tests
|
|
29
|
+
uv run pytest tests/test_file_tools.py # Single file
|
|
30
|
+
uv run pytest -v -k "test_name" # Single test by name
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### MCP Server Management
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv run koder mcp list # List servers
|
|
37
|
+
uv run koder mcp add myserver "python -m server" # Add server
|
|
38
|
+
uv run koder mcp remove myserver # Remove server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
Koder is a terminal-based AI coding assistant built on the `openai-agents` library with multi-provider support via LiteLLM.
|
|
44
|
+
|
|
45
|
+
### Package Structure
|
|
46
|
+
|
|
47
|
+
```md
|
|
48
|
+
koder_agent/
|
|
49
|
+
├── agentic/ # Agent creation, hooks, guardrails, approval system
|
|
50
|
+
├── cli.py # Main CLI entry point
|
|
51
|
+
├── config/ # Configuration management (YAML, env vars)
|
|
52
|
+
├── core/ # Scheduler, context, streaming, security, interactive mode, commands
|
|
53
|
+
├── mcp/ # Model Context Protocol server integration (stdio, SSE, HTTP)
|
|
54
|
+
├── tools/ # Tool implementations (file, search, shell, web, task, todo, skill)
|
|
55
|
+
└── utils/ # Client setup, prompts, sessions, model info, terminal theme
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Core Flow
|
|
59
|
+
|
|
60
|
+
1. **CLI Entry** (`cli.py`) → parses args, initializes session
|
|
61
|
+
2. **AgentScheduler** (`core/scheduler.py`) → orchestrates execution with streaming and usage tracking
|
|
62
|
+
3. **Agent Creation** (`agentic/agent.py`) → builds agent with tools, MCP servers, model settings
|
|
63
|
+
4. **Tool Engine** (`tools/engine.py`) → registers tools, validates inputs, filters sensitive output
|
|
64
|
+
5. **Context Manager** (`core/context.py`) → persists conversations in SQLite with token-aware compression
|
|
65
|
+
|
|
66
|
+
### Key Design Patterns
|
|
67
|
+
|
|
68
|
+
- **Provider Abstraction**: `utils/client.py` detects providers from environment; uses native OpenAI client for OpenAI/Azure, LiteLLM wrapper for others
|
|
69
|
+
- **RetryingLitellmModel**: `agentic/agent.py` wraps LiteLLM with exponential backoff retry (3-5 attempts) for rate limits and transient errors
|
|
70
|
+
- **Progressive Disclosure Skills**: `tools/skill.py` loads skill metadata at startup (Level 1), full content on-demand (Level 2), saving 90%+ tokens
|
|
71
|
+
- **Skill Restrictions**: `tools/skill_context.py` + `agentic/skill_guardrail.py` limit tool access when specific skills are active
|
|
72
|
+
- **Streaming Display**: `core/streaming_display.py` manages Rich Live displays for real-time output
|
|
73
|
+
- **Approval Hooks**: `agentic/approval_hooks.py` wraps tool execution with permission checks
|
|
74
|
+
- **Security Guard**: `core/security.py` validates shell commands before execution
|
|
75
|
+
- **Background Shells**: `tools/shell.py` `BackgroundShellManager` tracks async shell commands
|
|
76
|
+
|
|
77
|
+
### Tool Categories
|
|
78
|
+
|
|
79
|
+
| Category | Tools |
|
|
80
|
+
|----------|-------|
|
|
81
|
+
| File | `read_file`, `write_file`, `append_file`, `edit_file`, `list_directory` |
|
|
82
|
+
| Search | `glob_search`, `grep_search` |
|
|
83
|
+
| Shell | `run_shell`, `shell_output`, `shell_kill`, `git_command` |
|
|
84
|
+
| Web | `web_search`, `web_fetch` |
|
|
85
|
+
| Task | `task_delegate`, `todo_read`, `todo_write` |
|
|
86
|
+
| Skills | `get_skill` |
|
|
87
|
+
|
|
88
|
+
### Configuration Priority
|
|
89
|
+
|
|
90
|
+
CLI Arguments > Environment Variables > Config File (`~/.koder/config.yaml`) > Defaults
|
|
91
|
+
|
|
92
|
+
Key environment variables:
|
|
93
|
+
|
|
94
|
+
- `KODER_MODEL` - Model name (e.g., `gpt-4o`, `claude-opus-4-20250514`, `github_copilot/gpt-5.1-codex`)
|
|
95
|
+
- `KODER_REASONING_EFFORT` - Reasoning effort for o1/o3/gpt-5.1 models (`low`, `medium`, `high`)
|
|
96
|
+
- Provider API keys: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `GITHUB_TOKEN`, etc.
|
|
97
|
+
|
|
98
|
+
### Database
|
|
99
|
+
|
|
100
|
+
SQLite at `~/.koder/koder.db` stores:
|
|
101
|
+
|
|
102
|
+
- Conversation history with token-aware compression (50k token limit via tiktoken)
|
|
103
|
+
- Session metadata with auto-generated titles
|
|
104
|
+
- MCP server configurations
|
|
105
|
+
|
|
106
|
+
### Project Context
|
|
107
|
+
|
|
108
|
+
The CLI loads `AGENTS.md` from the working directory as project-specific context for the agent.
|
|
109
|
+
|
|
110
|
+
### Skills System
|
|
111
|
+
|
|
112
|
+
Skills are loaded from `.koder/skills/` (project) and `~/.koder/skills/` (user). Each skill has a `SKILL.md` with YAML frontmatter defining `name`, `description`, and optional `allowed_tools`.
|
koder-0.4.9/PKG-INFO
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: koder
|
|
3
|
+
Version: 0.4.9
|
|
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
|
+
[](https://www.python.org/downloads/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](https://pepy.tech/projects/koder)
|
|
44
|
+
[](https://github.com/psf/black)
|
|
45
|
+
[](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>
|