koder 0.1.0__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 (38) hide show
  1. koder-0.1.0/.claude/settings.local.json +17 -0
  2. koder-0.1.0/.github/dependabot.yml +11 -0
  3. koder-0.1.0/.gitignore +185 -0
  4. koder-0.1.0/CLAUDE.md +79 -0
  5. koder-0.1.0/KODER.md +1 -0
  6. koder-0.1.0/LICENSE +21 -0
  7. koder-0.1.0/PKG-INFO +213 -0
  8. koder-0.1.0/README.md +192 -0
  9. koder-0.1.0/koder_agent/__init__.py +7 -0
  10. koder-0.1.0/koder_agent/agentic/__init__.py +16 -0
  11. koder-0.1.0/koder_agent/agentic/agent.py +44 -0
  12. koder-0.1.0/koder_agent/agentic/hooks.py +73 -0
  13. koder-0.1.0/koder_agent/cli.py +231 -0
  14. koder-0.1.0/koder_agent/core/__init__.py +7 -0
  15. koder-0.1.0/koder_agent/core/commands.py +253 -0
  16. koder-0.1.0/koder_agent/core/context.py +154 -0
  17. koder-0.1.0/koder_agent/core/interactive.py +242 -0
  18. koder-0.1.0/koder_agent/core/scheduler.py +349 -0
  19. koder-0.1.0/koder_agent/core/security.py +67 -0
  20. koder-0.1.0/koder_agent/mcp/__init__.py +36 -0
  21. koder-0.1.0/koder_agent/mcp/cli_handler.py +292 -0
  22. koder-0.1.0/koder_agent/mcp/server_config.py +134 -0
  23. koder-0.1.0/koder_agent/mcp/server_factory.py +148 -0
  24. koder-0.1.0/koder_agent/mcp/server_manager.py +141 -0
  25. koder-0.1.0/koder_agent/tools/__init__.py +98 -0
  26. koder-0.1.0/koder_agent/tools/engine.py +134 -0
  27. koder-0.1.0/koder_agent/tools/file_ops.py +109 -0
  28. koder-0.1.0/koder_agent/tools/search_ops.py +141 -0
  29. koder-0.1.0/koder_agent/tools/shell_ops.py +92 -0
  30. koder-0.1.0/koder_agent/tools/task_ops.py +90 -0
  31. koder-0.1.0/koder_agent/tools/todo_ops.py +81 -0
  32. koder-0.1.0/koder_agent/tools/web_ops.py +128 -0
  33. koder-0.1.0/koder_agent/utils/__init__.py +7 -0
  34. koder-0.1.0/koder_agent/utils/client.py +82 -0
  35. koder-0.1.0/koder_agent/utils/prompts.py +97 -0
  36. koder-0.1.0/koder_agent/utils/queue.py +59 -0
  37. koder-0.1.0/pyproject.toml +68 -0
  38. koder-0.1.0/uv.lock +3055 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(mkdir -p koder_agent/{core,tools,utils,agents})",
5
+ "Bash(touch koder_agent/__init__.py koder_agent/core/__init__.py koder_agent/tools/__init__.py koder_agent/utils/__init__.py koder_agent/agents/__init__.py)",
6
+ "Bash(cd koder_agent)",
7
+ "Bash(uv sync)",
8
+ "Bash(uv run ruff check koder_agent/)",
9
+ "WebFetch(domain:openai.github.io)",
10
+ "Bash(python:*)",
11
+ "Bash(ruff check:*)",
12
+ "Bash(black:*)",
13
+ "WebFetch(domain:python-prompt-toolkit.readthedocs.io)"
14
+ ],
15
+ "deny": []
16
+ }
17
+ }
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "uv" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "daily"
koder-0.1.0/.gitignore ADDED
@@ -0,0 +1,185 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .DS_Store
6
+
7
+ # Helm files
8
+ .cr-index
9
+ .cr-release-packages
10
+ index.yaml
11
+
12
+ # C extensions
13
+ *.so
14
+
15
+ # Distribution / packaging
16
+ .Python
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ pip-wheel-metadata/
30
+ share/python-wheels/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ .ruff_cache
34
+ *.egg
35
+ MANIFEST
36
+
37
+ # PyInstaller
38
+ # Usually these files are written by a python script from a template
39
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40
+ *.manifest
41
+ *.spec
42
+
43
+ # Installer logs
44
+ pip-log.txt
45
+ pip-delete-this-directory.txt
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+ .coverage
52
+ .coverage.*
53
+ .cache
54
+ nosetests.xml
55
+ coverage.xml
56
+ *.cover
57
+ *.py,cover
58
+ .hypothesis/
59
+ .pytest_cache/
60
+ cover/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+ db.sqlite3
70
+ db.sqlite3-journal
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+
82
+ # PyBuilder
83
+ .pybuilder/
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # IPython
90
+ profile_default/
91
+ ipython_config.py
92
+
93
+ # pyenv
94
+ .python-version
95
+
96
+ # pipenv
97
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
99
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
100
+ # install all needed dependencies.
101
+ #Pipfile.lock
102
+
103
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
104
+ __pypackages__/
105
+
106
+ # Celery stuff
107
+ celerybeat-schedule
108
+ celerybeat.pid
109
+
110
+ # SageMath parsed files
111
+ *.sage.py
112
+
113
+ # Environments
114
+ .env
115
+ .envrc
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+ .streamlit/
141
+ .koder.db
142
+
143
+ # pytype static type analyzer
144
+ .pytype/
145
+
146
+ # Cython debug symbols
147
+ cython_debug/
148
+
149
+ # PyCharm
150
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
151
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
152
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
153
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
154
+ #.idea/
155
+
156
+ # Abstra
157
+ # Abstra is an AI-powered process automation framework.
158
+ # Ignore directories containing user credentials, local state, and settings.
159
+ # Learn more at https://abstra.io/docs
160
+ .abstra/
161
+
162
+ # Visual Studio Code
163
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
164
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
165
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
166
+ # you could uncomment the following to ignore the entire vscode folder
167
+ # .vscode/
168
+
169
+ # Ruff stuff:
170
+ .ruff_cache/
171
+
172
+ # PyPI configuration file
173
+ .pypirc
174
+
175
+ # Cursor
176
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
177
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
178
+ # refer to https://docs.cursor.com/context/ignore-files
179
+ .cursorignore
180
+ .cursorindexingignore
181
+
182
+ # Marimo
183
+ marimo/_static/
184
+ marimo/_lsp/
185
+ __marimo__/
koder-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,79 @@
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 interactive mode
14
+ koder
15
+
16
+ # Run with a single prompt
17
+ koder "Help me implement a new feature"
18
+
19
+ # Run with specific session
20
+ koder --session my-session "Your prompt"
21
+
22
+ # Enable streaming mode
23
+ koder --stream "Your prompt"
24
+
25
+ # MCP server management
26
+ koder mcp list
27
+ koder mcp add myserver command arg1 arg2
28
+ koder mcp remove myserver
29
+ ```
30
+
31
+ ### Development Commands
32
+
33
+ ```bash
34
+ # Code formatting
35
+ black .
36
+
37
+ # Linting
38
+ ruff check .
39
+
40
+ # Type checking
41
+ mypy .
42
+ ```
43
+
44
+ ## Architecture
45
+
46
+ ### Core Components
47
+
48
+ **Agent Scheduler (`koder_agent/core/scheduler.py`)**: Central orchestrator that manages agent execution, handles streaming, and coordinates context management. Uses semaphores for concurrency control.
49
+
50
+ **Context Manager (`koder_agent/core/context.py`)**: Manages conversation history with SQLite storage, implements token-aware compression (50k token limit), and handles session management. Database stored at `~/.koder/koder.db`.
51
+
52
+ **Tool Engine (`koder_agent/tools/engine.py`)**: Registers and executes tools with Pydantic validation. Filters sensitive information from outputs and enforces allowed tool lists.
53
+
54
+ ### Agent System
55
+
56
+ The project uses the `openai-agents` library with:
57
+
58
+ - **Main Agent**: `create_dev_agent()` - Primary development agent with full tool access
59
+ - **Planner Agent**: `create_planner_agent()` - Returns numbered planning lists when needed
60
+ - **Model Selection**: Automatically chooses appropriate OpenAI model via `get_model_name()`
61
+
62
+ ### Tool Categories
63
+
64
+ 1. **File Operations**: `read_file`, `write_file`, `append_file`, `list_directory`
65
+ 2. **Search Operations**: `glob_search`, `grep_search`
66
+ 3. **Shell Operations**: `run_shell`, `git_command`
67
+ 4. **Web Operations**: `web_search`, `web_fetch`
68
+ 5. **Task Management**: `todo_read`, `todo_write`, `task_delegate`
69
+
70
+ ### Key Features
71
+
72
+ - **Streaming Support**: Real-time output with Rich Live displays
73
+ - **Context Persistence**: Conversation history across sessions
74
+ - **Tool Validation**: Pydantic schemas with security checks
75
+ - **Interactive CLI**: Rich-formatted panels and prompts
76
+
77
+ ### Configuration
78
+
79
+ The CLI looks for `KODER.md` in the working directory to load project-specific context. Set OpenAI API credentials via environment variables or the `openai-agents` configuration system.
koder-0.1.0/KODER.md ADDED
@@ -0,0 +1 @@
1
+ CLAUDE.md
koder-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pengfei Ni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
koder-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: koder
3
+ Version: 0.1.0
4
+ Summary: An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support.
5
+ Author: Pengfei Ni
6
+ License-File: LICENSE
7
+ Keywords: agent,agentic,ai,copilot,litellm,openai,vibe coding
8
+ Requires-Python: >=3.9
9
+ Requires-Dist: aiosqlite>=0.19.0
10
+ Requires-Dist: beautifulsoup4>=4.12.0
11
+ Requires-Dist: google-cloud-aiplatform>=1.105.0
12
+ Requires-Dist: httpx[socks]>=0.25.0
13
+ Requires-Dist: openai-agents[litellm]>=0.1.0
14
+ Requires-Dist: openai==1.96.1
15
+ Requires-Dist: prompt-toolkit>=3.0.51
16
+ Requires-Dist: pydantic>=2.0.0
17
+ Requires-Dist: requests>=2.31.0
18
+ Requires-Dist: rich>=13.0.0
19
+ Requires-Dist: tiktoken>=0.5.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Koder
23
+
24
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
25
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
26
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
27
+ [![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)
28
+
29
+ An intuitive AI coding assistant and interactive CLI tool that boosts developer productivity with intelligent automation and context-aware support.
30
+
31
+ ## ๐Ÿš€ Why this project
32
+
33
+ Yet another vibe coding assistant that aims to provide:
34
+
35
+ - Universal AI provider support - Works with OpenAI, Claude, Gemini, and 100+ providers through intelligent auto-detection.
36
+ - Persistent context - Remembers your conversations across sessions with smart token management.
37
+ - Rich toolset - File operations, search, shell commands, and web access in one unified interface.
38
+ - Zero-config start - Just set your API key and go, with automatic model selection and streaming support.
39
+ - Session management - Organize work by project with isolated conversation histories.
40
+
41
+ ## ๐Ÿ“‹ Requirements
42
+
43
+ - Python 3.9 or higher.
44
+ - API key and optional baseURL from OpenAI, Gemini, Anthropic or other AI providers.
45
+
46
+ ## ๐Ÿ› ๏ธ Installation
47
+
48
+ ### Using uv (Recommended)
49
+
50
+ ```sh
51
+ uv tool install koder
52
+ ```
53
+
54
+ ### Using pip
55
+
56
+ ```bash
57
+ pip install koder
58
+ ```
59
+
60
+ ## ๐Ÿค– AI Provider Configuration
61
+
62
+ Koder automatically detects and uses the LLM provider from environment variables.
63
+
64
+ **Model Selection**
65
+
66
+ The `KODER_MODEL` environment variable controls which model to use:
67
+
68
+ ```bash
69
+ # OpenAI models
70
+ export KODER_MODEL="gpt-4.1"
71
+
72
+ # Claude models (via LiteLLM)
73
+ export KODER_MODEL="claude-opus-4-20250514"
74
+
75
+ # Google models (via LiteLLM)
76
+ export KODER_MODEL="gemini/gemini-2.5-pro"
77
+ ```
78
+
79
+ **AI Providers:**
80
+
81
+ <details>
82
+
83
+ <summary>OpenAI</summary>
84
+
85
+ ```bash
86
+ # Required
87
+ export OPENAI_API_KEY="your-openai-api-key"
88
+
89
+ # Optional: Custom OpenAI-compatible endpoint
90
+ export OPENAI_BASE_URL="https://api.openai.com/v1" # Default
91
+
92
+ # Optional: Specify model (default: gpt-4.1)
93
+ export KODER_MODEL="gpt-4o"
94
+ ```
95
+
96
+ </details>
97
+
98
+ <details>
99
+
100
+ <summary>Gemini</summary>
101
+
102
+ ```bash
103
+ # Required
104
+ export GEMINI_API_KEY="your-openai-api-key"
105
+
106
+ # Specify model (default: gemini/gemini-2.5-pro)
107
+ export KODER_MODEL="gemini/gemini-2.5-pro"
108
+ ```
109
+
110
+ </details>
111
+
112
+ <details>
113
+
114
+ <summary>Azure OpenAI</summary>
115
+
116
+ ```bash
117
+ # Required
118
+ export AZURE_OPENAI_API_KEY="your-azure-api-key"
119
+ export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
120
+ export KODER_MODEL="gpt-4o" # Your Azure deployment model
121
+
122
+ # Optional
123
+ export AZURE_OPENAI_DEPLOYMENT="your-deployment-name" # Defaults to KODER_MODEL
124
+ export AZURE_OPENAI_API_VERSION="2025-04-01-preview" # Default version
125
+ ```
126
+
127
+ </details>
128
+
129
+ <details>
130
+
131
+ <summary>Other AI providers (via LiteLLM)</summary>
132
+
133
+ [LiteLLM](https://docs.litellm.ai/docs/providers) supports 100+ providers including Anthropic, Google, Cohere, Hugging Face, and more:
134
+
135
+ ```bash
136
+ # Anthropic Claude
137
+ export ANTHROPIC_API_KEY="your-anthropic-key"
138
+ export KODER_MODEL="claude-opus-4-20250514"
139
+
140
+ # Google Vertex AI
141
+ export GOOGLE_APPLICATION_CREDENTIALS="your-sa-path.json"
142
+ export VERTEXAI_LOCATION="<your-region>"
143
+ export KODER_MODEL="vertex_ai/claude-sonnet-4@20250514"
144
+
145
+ # Custom OpenAI-compatible endpoints
146
+ export OPENAI_API_KEY="your-key"
147
+ export OPENAI_BASE_URL="https://your-custom-endpoint.com/v1"
148
+ export KODER_MODEL="openai/<your-model-name>"
149
+ ```
150
+
151
+ </details>
152
+
153
+
154
+
155
+ ## โšก Quick Start
156
+
157
+ ### Basic Usage
158
+
159
+ ```bash
160
+ # Run in interactive mode
161
+ koder
162
+
163
+ # Execute a single prompt
164
+ koder -s my-project "Help me implement a new feature"
165
+
166
+ # Use a specific session
167
+ koder --session my-project "Your prompt here"
168
+
169
+ # Enable streaming mode
170
+ koder --stream "Your prompt here"
171
+ ```
172
+
173
+
174
+
175
+ ## ๐Ÿงช Development
176
+
177
+ ### Setup Development Environment
178
+
179
+ ```bash
180
+ # Clone and setup
181
+ git clone https://github.com/feiskyer/koder.git
182
+ cd koder
183
+ uv sync
184
+
185
+ uv run koder
186
+ ```
187
+
188
+ ### Code Quality
189
+
190
+ ```bash
191
+ # Format code
192
+ black .
193
+
194
+ # Lint code
195
+ ruff check .
196
+
197
+ # Type checking
198
+ mypy .
199
+ ```
200
+
201
+ ## ๐Ÿค Contributing
202
+
203
+ 1. Fork the repository
204
+ 2. Create a feature branch: `git checkout -b feature/your-feature`
205
+ 3. Make your changes
206
+ 4. Run formating and linting: `black . && ruff check .`
207
+ 5. Commit your changes: `git commit -am 'Add your feature'`
208
+ 6. Push to the branch: `git push origin feature/your-feature`
209
+ 7. Submit a pull request
210
+
211
+ ## ๐Ÿ“„ License
212
+
213
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.