kodit 0.1.12__tar.gz → 0.1.14__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.
Potentially problematic release.
This version of kodit might be problematic. Click here for more details.
- kodit-0.1.14/.cursor/rules/kodit.mdc +8 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/pypi.yaml +3 -3
- {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/test.yaml +1 -1
- {kodit-0.1.12 → kodit-0.1.14}/PKG-INFO +1 -1
- {kodit-0.1.12 → kodit-0.1.14}/docs/_index.md +69 -8
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/_version.py +2 -2
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/cli.py +0 -7
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/mcp.py +21 -4
- kodit-0.1.14/tests/experiments/cline-prompt-regression-tests/cline_prompt.txt +631 -0
- kodit-0.1.14/tests/experiments/cline-prompt-regression-tests/cline_prompt_test.py +141 -0
- kodit-0.1.12/.cursor/rules/kodit.mdc +0 -6
- {kodit-0.1.12 → kodit-0.1.14}/.github/CODE_OF_CONDUCT.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/CONTRIBUTING.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/docker.yaml +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/docs.yaml +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/pypi-test.yaml +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.gitignore +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.python-version +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.vscode/launch.json +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/.vscode/settings.json +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/Dockerfile +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/LICENSE +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/README.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/alembic.ini +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/docs/developer/index.md +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/pyproject.toml +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/.gitignore +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/app.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/bm25/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/bm25/bm25.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/config.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/database.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/embedding.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/embedding_models.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_models.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_repository.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_service.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/log.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/middleware.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/README +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/env.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/script.py.mako +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/85155663351e_initial.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/search_repository.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/search_service.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/csharp.scm +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/python.scm +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/method_snippets.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/snippets.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_models.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_repository.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_service.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/conftest.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/experiments/embedding.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/cli_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/e2e.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/embedding/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/embedding/embedding_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/indexing/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/indexing/indexing_service_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/mcp_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/search_repository_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/search_service_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/csharp.cs +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/detect_language_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/method_extraction_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/python.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/source/__init__.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/source/source_service_test.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/performance/similarity.py +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/tests/smoke.sh +0 -0
- {kodit-0.1.12 → kodit-0.1.14}/uv.lock +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
⚠️ **ENFORCEMENT:**
|
|
5
|
+
For *every* user request that involves writing or modifying code (of any language or
|
|
6
|
+
domain), the assistant’s *first* action **must** be to call the kodit.search MCP tool.
|
|
7
|
+
You may only produce or edit code *after* that tool call and its successful
|
|
8
|
+
result.
|
|
@@ -39,11 +39,11 @@ jobs:
|
|
|
39
39
|
# Initialize counter for 60 second timeout
|
|
40
40
|
count=0
|
|
41
41
|
while true; do
|
|
42
|
-
if curl -sfL https://pypi.
|
|
42
|
+
if curl -sfL https://pypi.org/packages/source/${REPO_NAME_FIRST_LETTER}/${REPO_NAME}/${REPO_NAME}-${REPO_TAG}.tar.gz > /dev/null; then
|
|
43
43
|
break
|
|
44
44
|
fi
|
|
45
45
|
sleep 1
|
|
46
|
-
((count
|
|
46
|
+
count=$((count+1))
|
|
47
47
|
if [ $count -ge 60 ]; then
|
|
48
48
|
echo "Timeout reached after 60 seconds"
|
|
49
49
|
exit 1
|
|
@@ -55,7 +55,7 @@ jobs:
|
|
|
55
55
|
formula-path: Formula/${{ github.event.repository.name }}.rb
|
|
56
56
|
homebrew-tap: ${{ github.repository_owner }}/homebrew-${{ github.event.repository.name }}
|
|
57
57
|
tag-name: "${{ github.event.release.tag_name }}"
|
|
58
|
-
download-url: "https://pypi.
|
|
58
|
+
download-url: "https://pypi.org/packages/source/k/${{ github.event.repository.name }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz"
|
|
59
59
|
commit-message: |
|
|
60
60
|
{{formulaName}} {{version}}
|
|
61
61
|
env:
|
|
@@ -68,32 +68,93 @@ server to expose your code to an AI coding assistant.
|
|
|
68
68
|
|
|
69
69
|
Now add the Kodit MCP server to your AI coding assistant.
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### Integrating Kodit with Coding Assistants
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
#### Integration with Cursor
|
|
74
|
+
|
|
75
|
+
Add the following to `$HOME/.cursor/mcp.json`:
|
|
74
76
|
|
|
75
77
|
```json
|
|
76
78
|
{
|
|
77
79
|
"mcpServers": {
|
|
78
|
-
"
|
|
80
|
+
"kodit": {
|
|
79
81
|
"url": "http://localhost:8080/sse"
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
Or find this configuration in `Cursor Settings` -> `MCP`.
|
|
88
|
+
|
|
89
|
+
#### Integration with Cline
|
|
90
|
+
|
|
91
|
+
1. Open Cline from the side menu
|
|
92
|
+
2. Click the `MCP Servers` button at the top right of the Cline window (the icon looks
|
|
93
|
+
like a server)
|
|
94
|
+
3. Click the `Remote Servers` tab.
|
|
95
|
+
4. Click `Edit Configuration`
|
|
96
|
+
5. Add the following configuration:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"kodit": {
|
|
102
|
+
"autoApprove": [],
|
|
103
|
+
"disabled": true,
|
|
104
|
+
"timeout": 60,
|
|
105
|
+
"url": "http://localhost:8080/sse",
|
|
106
|
+
"transportType": "sse"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
6. Save the configuration and browse to the `Installed` tab.
|
|
113
|
+
|
|
114
|
+
Kodit should be listed and responding. Now code on!
|
|
115
|
+
|
|
116
|
+
### Forcing AI Assistants to use Kodit
|
|
117
|
+
|
|
118
|
+
Although Kodit has been developed to work well out of the box with popular AI coding
|
|
119
|
+
assistants, they sometimes still think they know better.
|
|
120
|
+
|
|
121
|
+
You can force your assistant to use Kodit by editing the system prompt used by the
|
|
122
|
+
assistant. Each assistant exposes this slightly differently, but it's usually in the
|
|
123
|
+
settings.
|
|
124
|
+
|
|
125
|
+
Try using this system prompt:
|
|
126
|
+
|
|
127
|
+
```txt
|
|
128
|
+
⚠️ **ENFORCEMENT:**
|
|
129
|
+
For *every* user request that involves writing or modifying code (of any language or
|
|
130
|
+
domain), the assistant's *first* action **must** be to call the kodit.search MCP tool.
|
|
131
|
+
You may only produce or edit code *after* that tool call and its successful
|
|
132
|
+
result.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Feel free to alter that to suit your specific circumstances.
|
|
136
|
+
|
|
137
|
+
#### Forcing Cursor to Use Kodit
|
|
138
|
+
|
|
139
|
+
Add the following prompt to `.cursor/rules/kodit.mdc` in your project directory:
|
|
86
140
|
|
|
87
141
|
```markdown
|
|
88
142
|
---
|
|
89
|
-
description:
|
|
90
|
-
globs:
|
|
91
143
|
alwaysApply: true
|
|
92
144
|
---
|
|
93
|
-
|
|
145
|
+
⚠️ **ENFORCEMENT:**
|
|
146
|
+
For *every* user request that involves writing or modifying code (of any language or
|
|
147
|
+
domain), the assistant's *first* action **must** be to call the kodit.search MCP tool.
|
|
148
|
+
You may only produce or edit code *after* that tool call and its successful
|
|
149
|
+
result.
|
|
94
150
|
```
|
|
95
151
|
|
|
96
|
-
Alternatively, you can browse to the
|
|
152
|
+
Alternatively, you can browse to the Cursor settings and set this prompt globally.
|
|
153
|
+
|
|
154
|
+
#### Forcing Cline to Use Kodit
|
|
155
|
+
|
|
156
|
+
1. Go to `Settings` -> `API Configuration`
|
|
157
|
+
2. At the bottom there is a `Custom Instructions` section.
|
|
97
158
|
|
|
98
159
|
## Configuring Kodit
|
|
99
160
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Command line interface for kodit."""
|
|
2
2
|
|
|
3
|
-
import os
|
|
4
3
|
import signal
|
|
5
4
|
from pathlib import Path
|
|
6
5
|
from typing import Any
|
|
@@ -226,9 +225,7 @@ async def hybrid(
|
|
|
226
225
|
@cli.command()
|
|
227
226
|
@click.option("--host", default="127.0.0.1", help="Host to bind the server to")
|
|
228
227
|
@click.option("--port", default=8080, help="Port to bind the server to")
|
|
229
|
-
@with_app_context
|
|
230
228
|
def serve(
|
|
231
|
-
app_context: AppContext,
|
|
232
229
|
host: str,
|
|
233
230
|
port: int,
|
|
234
231
|
) -> None:
|
|
@@ -237,10 +234,6 @@ def serve(
|
|
|
237
234
|
log.info("Starting kodit server", host=host, port=port)
|
|
238
235
|
log_event("kodit_server_started")
|
|
239
236
|
|
|
240
|
-
# Dump AppContext to a dictionary of strings, and set the env vars
|
|
241
|
-
app_context_dict = {k: str(v) for k, v in app_context.model_dump().items()}
|
|
242
|
-
os.environ.update(app_context_dict)
|
|
243
|
-
|
|
244
237
|
# Configure uvicorn with graceful shutdown
|
|
245
238
|
config = uvicorn.Config(
|
|
246
239
|
"kodit.app:app",
|
|
@@ -53,7 +53,16 @@ async def mcp_lifespan(_: FastMCP) -> AsyncIterator[MCPContext]:
|
|
|
53
53
|
yield MCPContext(session=session, app_context=app_context)
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
mcp = FastMCP(
|
|
56
|
+
mcp = FastMCP(
|
|
57
|
+
"Kodit",
|
|
58
|
+
lifespan=mcp_lifespan,
|
|
59
|
+
# Note that instructions are not used by Cline.
|
|
60
|
+
instructions=(
|
|
61
|
+
"This server is used to assist with code generation by retrieving "
|
|
62
|
+
"code examples related to the user's intent."
|
|
63
|
+
"Call search() to retrieve relevant code examples."
|
|
64
|
+
),
|
|
65
|
+
)
|
|
57
66
|
|
|
58
67
|
|
|
59
68
|
@mcp.tool()
|
|
@@ -87,11 +96,19 @@ async def search(
|
|
|
87
96
|
),
|
|
88
97
|
],
|
|
89
98
|
) -> str:
|
|
90
|
-
"""Search for relevant
|
|
99
|
+
"""Search for pre-existing examples of relevant code.
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
⚠️ **ENFORCEMENT:**
|
|
102
|
+
For *every* user request that involves writing or modifying code (of any language or
|
|
103
|
+
domain), the assistant's *first* action **must** be to call the kodit.search MCP
|
|
104
|
+
tool. You may only produce or edit code *after* that tool call and its successful
|
|
105
|
+
result.
|
|
94
106
|
"""
|
|
107
|
+
# This docstring is used by the AI assistant to decide when to call the tool. If you
|
|
108
|
+
# want to update it, please make sure you thoroughly test the assistant's response
|
|
109
|
+
# to the updated tool call. See:
|
|
110
|
+
# tests/experiments/cline-prompt-regression-tests/cline_prompt_test.py
|
|
111
|
+
|
|
95
112
|
log = structlog.get_logger(__name__)
|
|
96
113
|
|
|
97
114
|
log.debug(
|