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.

Files changed (89) hide show
  1. kodit-0.1.14/.cursor/rules/kodit.mdc +8 -0
  2. {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/pypi.yaml +3 -3
  3. {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/test.yaml +1 -1
  4. {kodit-0.1.12 → kodit-0.1.14}/PKG-INFO +1 -1
  5. {kodit-0.1.12 → kodit-0.1.14}/docs/_index.md +69 -8
  6. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/_version.py +2 -2
  7. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/cli.py +0 -7
  8. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/mcp.py +21 -4
  9. kodit-0.1.14/tests/experiments/cline-prompt-regression-tests/cline_prompt.txt +631 -0
  10. kodit-0.1.14/tests/experiments/cline-prompt-regression-tests/cline_prompt_test.py +141 -0
  11. kodit-0.1.12/.cursor/rules/kodit.mdc +0 -6
  12. {kodit-0.1.12 → kodit-0.1.14}/.github/CODE_OF_CONDUCT.md +0 -0
  13. {kodit-0.1.12 → kodit-0.1.14}/.github/CONTRIBUTING.md +0 -0
  14. {kodit-0.1.12 → kodit-0.1.14}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  15. {kodit-0.1.12 → kodit-0.1.14}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  16. {kodit-0.1.12 → kodit-0.1.14}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  17. {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/docker.yaml +0 -0
  18. {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/docs.yaml +0 -0
  19. {kodit-0.1.12 → kodit-0.1.14}/.github/workflows/pypi-test.yaml +0 -0
  20. {kodit-0.1.12 → kodit-0.1.14}/.gitignore +0 -0
  21. {kodit-0.1.12 → kodit-0.1.14}/.python-version +0 -0
  22. {kodit-0.1.12 → kodit-0.1.14}/.vscode/launch.json +0 -0
  23. {kodit-0.1.12 → kodit-0.1.14}/.vscode/settings.json +0 -0
  24. {kodit-0.1.12 → kodit-0.1.14}/Dockerfile +0 -0
  25. {kodit-0.1.12 → kodit-0.1.14}/LICENSE +0 -0
  26. {kodit-0.1.12 → kodit-0.1.14}/README.md +0 -0
  27. {kodit-0.1.12 → kodit-0.1.14}/alembic.ini +0 -0
  28. {kodit-0.1.12 → kodit-0.1.14}/docs/developer/index.md +0 -0
  29. {kodit-0.1.12 → kodit-0.1.14}/pyproject.toml +0 -0
  30. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/.gitignore +0 -0
  31. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/__init__.py +0 -0
  32. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/app.py +0 -0
  33. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/bm25/__init__.py +0 -0
  34. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/bm25/bm25.py +0 -0
  35. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/config.py +0 -0
  36. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/database.py +0 -0
  37. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/__init__.py +0 -0
  38. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/embedding.py +0 -0
  39. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/embedding/embedding_models.py +0 -0
  40. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/__init__.py +0 -0
  41. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_models.py +0 -0
  42. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_repository.py +0 -0
  43. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/indexing/indexing_service.py +0 -0
  44. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/log.py +0 -0
  45. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/middleware.py +0 -0
  46. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/README +0 -0
  47. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/__init__.py +0 -0
  48. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/env.py +0 -0
  49. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/script.py.mako +0 -0
  50. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py +0 -0
  51. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/85155663351e_initial.py +0 -0
  52. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/migrations/versions/__init__.py +0 -0
  53. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/__init__.py +0 -0
  54. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/search_repository.py +0 -0
  55. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/search/search_service.py +0 -0
  56. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/__init__.py +0 -0
  57. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/__init__.py +0 -0
  58. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/csharp.scm +0 -0
  59. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/languages/python.scm +0 -0
  60. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/method_snippets.py +0 -0
  61. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/snippets/snippets.py +0 -0
  62. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/__init__.py +0 -0
  63. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_models.py +0 -0
  64. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_repository.py +0 -0
  65. {kodit-0.1.12 → kodit-0.1.14}/src/kodit/source/source_service.py +0 -0
  66. {kodit-0.1.12 → kodit-0.1.14}/tests/__init__.py +0 -0
  67. {kodit-0.1.12 → kodit-0.1.14}/tests/conftest.py +0 -0
  68. {kodit-0.1.12 → kodit-0.1.14}/tests/experiments/embedding.py +0 -0
  69. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/__init__.py +0 -0
  70. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/cli_test.py +0 -0
  71. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/e2e.py +0 -0
  72. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/embedding/__init__.py +0 -0
  73. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/embedding/embedding_test.py +0 -0
  74. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/indexing/__init__.py +0 -0
  75. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/indexing/indexing_service_test.py +0 -0
  76. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/mcp_test.py +0 -0
  77. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/__init__.py +0 -0
  78. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/search_repository_test.py +0 -0
  79. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/search/search_service_test.py +0 -0
  80. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/__init__.py +0 -0
  81. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/csharp.cs +0 -0
  82. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/detect_language_test.py +0 -0
  83. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/method_extraction_test.py +0 -0
  84. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/snippets/python.py +0 -0
  85. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/source/__init__.py +0 -0
  86. {kodit-0.1.12 → kodit-0.1.14}/tests/kodit/source/source_service_test.py +0 -0
  87. {kodit-0.1.12 → kodit-0.1.14}/tests/performance/similarity.py +0 -0
  88. {kodit-0.1.12 → kodit-0.1.14}/tests/smoke.sh +0 -0
  89. {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.io/packages/source/${REPO_NAME_FIRST_LETTER}/${REPO_NAME}/${REPO_NAME}-${REPO_TAG}.tar.gz > /dev/null; then
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.io/packages/source/k/${{ github.event.repository.name }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz"
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:
@@ -35,7 +35,7 @@ jobs:
35
35
  run: uv run ruff check
36
36
 
37
37
  - name: Run tests
38
- run: uv run pytest -s --cov=src --cov-report=xml
38
+ run: uv run pytest -s --cov=src --cov-report=xml tests/kodit
39
39
 
40
40
  - name: Pytest coverage comment
41
41
  if: github.event_name == 'pull_request'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kodit
3
- Version: 0.1.12
3
+ Version: 0.1.14
4
4
  Summary: Code indexing for better AI code generation
5
5
  Project-URL: Homepage, https://docs.helixml.tech/kodit/
6
6
  Project-URL: Documentation, https://docs.helixml.tech/kodit/
@@ -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
- ### Integration with Cursor
71
+ ### Integrating Kodit with Coding Assistants
72
72
 
73
- Add the following to `.cursor/mcp.json`:
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
- "code-search": {
80
+ "kodit": {
79
81
  "url": "http://localhost:8080/sse"
80
82
  }
81
83
  }
82
84
  }
83
85
  ```
84
86
 
85
- Now add the following prompt to `.cursor/rules/kodit.mdc` in your project directory:
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
- You MUST use the code-search MCP tool and always include any file context the user has provided in the chat.
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 cursor settings and set this prompt globally.
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
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.12'
21
- __version_tuple__ = version_tuple = (0, 1, 12)
20
+ __version__ = version = '0.1.14'
21
+ __version_tuple__ = version_tuple = (0, 1, 14)
@@ -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("kodit MCP Server", lifespan=mcp_lifespan)
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 snippets.
99
+ """Search for pre-existing examples of relevant code.
91
100
 
92
- This tool searches for relevant snippets from indexed datasources. Call this tool
93
- when you wish to search for high quality example code snippets to use in your code.
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(