kodit 0.2.9__tar.gz → 0.3.1__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 (209) hide show
  1. kodit-0.3.1/.claude/commands/debug.md +121 -0
  2. kodit-0.3.1/.claude/commands/refactor.md +33 -0
  3. kodit-0.3.1/.claude/settings.json +3 -0
  4. kodit-0.3.1/CLAUDE.md +99 -0
  5. {kodit-0.2.9 → kodit-0.3.1}/PKG-INFO +14 -4
  6. {kodit-0.2.9 → kodit-0.3.1}/README.md +13 -3
  7. {kodit-0.2.9 → kodit-0.3.1}/docs/_index.md +12 -2
  8. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/deployment/docker-compose.yaml +4 -0
  9. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/deployment/kubernetes.yaml +4 -0
  10. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/indexing/index.md +58 -10
  11. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/_version.py +2 -2
  12. kodit-0.3.1/src/kodit/app.py +70 -0
  13. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/application/services/code_indexing_application_service.py +5 -6
  14. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/cli.py +20 -27
  15. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/config.py +101 -6
  16. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/indexing_service.py +4 -3
  17. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/snippet_service.py +16 -3
  18. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/value_objects.py +35 -0
  19. kodit-0.3.1/src/kodit/infrastructure/indexing/auto_indexing_service.py +84 -0
  20. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/indexing/index_repository.py +6 -24
  21. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/mcp.py +1 -1
  22. kodit-0.3.1/tests/kodit/config_test.py +110 -0
  23. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/snippet_domain_service_test.py +22 -6
  24. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/indexing/indexing_repository_test.py +4 -4
  25. kodit-0.3.1/tests/kodit/infrastructure/indexing/test_auto_indexing_service.py +234 -0
  26. {kodit-0.2.9 → kodit-0.3.1}/tests/smoke.sh +5 -0
  27. kodit-0.2.9/src/kodit/app.py +0 -35
  28. {kodit-0.2.9 → kodit-0.3.1}/.cursor/rules/kodit.mdc +0 -0
  29. {kodit-0.2.9 → kodit-0.3.1}/.cursor/rules/style.mdc +0 -0
  30. {kodit-0.2.9 → kodit-0.3.1}/.dockerignore +0 -0
  31. {kodit-0.2.9 → kodit-0.3.1}/.github/CODE_OF_CONDUCT.md +0 -0
  32. {kodit-0.2.9 → kodit-0.3.1}/.github/CONTRIBUTING.md +0 -0
  33. {kodit-0.2.9 → kodit-0.3.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  34. {kodit-0.2.9 → kodit-0.3.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  35. {kodit-0.2.9 → kodit-0.3.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  36. {kodit-0.2.9 → kodit-0.3.1}/.github/dependabot.yml +0 -0
  37. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/docker.yaml +0 -0
  38. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/docs.yaml +0 -0
  39. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/pull_request.yaml +0 -0
  40. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/pypi-test.yaml +0 -0
  41. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/pypi.yaml +0 -0
  42. {kodit-0.2.9 → kodit-0.3.1}/.github/workflows/test.yaml +0 -0
  43. {kodit-0.2.9 → kodit-0.3.1}/.gitignore +0 -0
  44. {kodit-0.2.9 → kodit-0.3.1}/.python-version +0 -0
  45. {kodit-0.2.9 → kodit-0.3.1}/.vscode/launch.json +0 -0
  46. {kodit-0.2.9 → kodit-0.3.1}/.vscode/settings.json +0 -0
  47. {kodit-0.2.9 → kodit-0.3.1}/Dockerfile +0 -0
  48. {kodit-0.2.9 → kodit-0.3.1}/LICENSE +0 -0
  49. {kodit-0.2.9 → kodit-0.3.1}/alembic.ini +0 -0
  50. {kodit-0.2.9 → kodit-0.3.1}/docs/demos/_index.md +0 -0
  51. {kodit-0.2.9 → kodit-0.3.1}/docs/demos/go-simple-microservice/index.md +0 -0
  52. {kodit-0.2.9 → kodit-0.3.1}/docs/demos/knock-knock-auth/index.md +0 -0
  53. {kodit-0.2.9 → kodit-0.3.1}/docs/developer/index.md +0 -0
  54. {kodit-0.2.9 → kodit-0.3.1}/docs/getting-started/_index.md +0 -0
  55. {kodit-0.2.9 → kodit-0.3.1}/docs/getting-started/installation/index.md +0 -0
  56. {kodit-0.2.9 → kodit-0.3.1}/docs/getting-started/integration/index.md +0 -0
  57. {kodit-0.2.9 → kodit-0.3.1}/docs/getting-started/quick-start/index.md +0 -0
  58. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/_index.md +0 -0
  59. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/configuration/index.md +0 -0
  60. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/deployment/index.md +0 -0
  61. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/mcp/index.md +0 -0
  62. {kodit-0.2.9 → kodit-0.3.1}/docs/reference/telemetry/index.md +0 -0
  63. {kodit-0.2.9 → kodit-0.3.1}/pyproject.toml +0 -0
  64. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/.gitignore +0 -0
  65. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/__init__.py +0 -0
  66. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/application/__init__.py +0 -0
  67. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/application/factories/__init__.py +0 -0
  68. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/application/factories/code_indexing_factory.py +0 -0
  69. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/application/services/__init__.py +0 -0
  70. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/database.py +0 -0
  71. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/__init__.py +0 -0
  72. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/entities.py +0 -0
  73. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/enums.py +0 -0
  74. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/errors.py +0 -0
  75. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/interfaces.py +0 -0
  76. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/repositories.py +0 -0
  77. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/__init__.py +0 -0
  78. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/bm25_service.py +0 -0
  79. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/embedding_service.py +0 -0
  80. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/enrichment_service.py +0 -0
  81. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/ignore_service.py +0 -0
  82. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/snippet_extraction_service.py +0 -0
  83. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/domain/services/source_service.py +0 -0
  84. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/__init__.py +0 -0
  85. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/bm25/__init__.py +0 -0
  86. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/bm25/bm25_factory.py +0 -0
  87. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/bm25/local_bm25_repository.py +0 -0
  88. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/bm25/vectorchord_bm25_repository.py +0 -0
  89. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/__init__.py +0 -0
  90. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/folder/__init__.py +0 -0
  91. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/folder/factory.py +0 -0
  92. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/folder/working_copy.py +0 -0
  93. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/git/__init__.py +0 -0
  94. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/git/factory.py +0 -0
  95. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/git/working_copy.py +0 -0
  96. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/cloning/metadata.py +0 -0
  97. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/__init__.py +0 -0
  98. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_factory.py +0 -0
  99. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_providers/__init__.py +0 -0
  100. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_providers/batching.py +0 -0
  101. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_providers/hash_embedding_provider.py +0 -0
  102. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_providers/local_embedding_provider.py +0 -0
  103. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/embedding_providers/openai_embedding_provider.py +0 -0
  104. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/local_vector_search_repository.py +0 -0
  105. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/embedding/vectorchord_vector_search_repository.py +0 -0
  106. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/enrichment/__init__.py +0 -0
  107. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/enrichment/enrichment_factory.py +0 -0
  108. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/enrichment/local_enrichment_provider.py +0 -0
  109. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/enrichment/null_enrichment_provider.py +0 -0
  110. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/enrichment/openai_enrichment_provider.py +0 -0
  111. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/git/__init__.py +0 -0
  112. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/git/git_utils.py +0 -0
  113. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/ignore/__init__.py +0 -0
  114. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/ignore/ignore_pattern_provider.py +0 -0
  115. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/indexing/__init__.py +0 -0
  116. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/indexing/fusion_service.py +0 -0
  117. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/indexing/indexing_factory.py +0 -0
  118. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/indexing/snippet_domain_service_factory.py +0 -0
  119. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/__init__.py +0 -0
  120. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/language_detection_service.py +0 -0
  121. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/csharp.scm +0 -0
  122. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/go.scm +0 -0
  123. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/java.scm +0 -0
  124. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/javascript.scm +0 -0
  125. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/python.scm +0 -0
  126. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/languages/typescript.scm +0 -0
  127. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/snippet_extraction_factory.py +0 -0
  128. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/snippet_query_provider.py +0 -0
  129. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/snippet_extraction/tree_sitter_snippet_extractor.py +0 -0
  130. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/sqlalchemy/__init__.py +0 -0
  131. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/sqlalchemy/embedding_repository.py +0 -0
  132. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/sqlalchemy/file_repository.py +0 -0
  133. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/sqlalchemy/repository.py +0 -0
  134. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/sqlalchemy/snippet_repository.py +0 -0
  135. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/ui/__init__.py +0 -0
  136. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/ui/progress.py +0 -0
  137. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/infrastructure/ui/spinner.py +0 -0
  138. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/log.py +0 -0
  139. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/middleware.py +0 -0
  140. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/README +0 -0
  141. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/__init__.py +0 -0
  142. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/env.py +0 -0
  143. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/script.py.mako +0 -0
  144. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py +0 -0
  145. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/versions/85155663351e_initial.py +0 -0
  146. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/versions/9e53ea8bb3b0_add_authors.py +0 -0
  147. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/versions/__init__.py +0 -0
  148. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/migrations/versions/c3f5137d30f5_index_all_the_things.py +0 -0
  149. {kodit-0.2.9 → kodit-0.3.1}/src/kodit/reporting.py +0 -0
  150. {kodit-0.2.9 → kodit-0.3.1}/tests/__init__.py +0 -0
  151. {kodit-0.2.9 → kodit-0.3.1}/tests/conftest.py +0 -0
  152. {kodit-0.2.9 → kodit-0.3.1}/tests/docker-smoke.sh +0 -0
  153. {kodit-0.2.9 → kodit-0.3.1}/tests/experiments/__init__.py +0 -0
  154. {kodit-0.2.9 → kodit-0.3.1}/tests/experiments/cline_prompt_tests/__init__.py +0 -0
  155. {kodit-0.2.9 → kodit-0.3.1}/tests/experiments/cline_prompt_tests/cline_prompt.txt +0 -0
  156. {kodit-0.2.9 → kodit-0.3.1}/tests/experiments/cline_prompt_tests/cline_prompt_test.py +0 -0
  157. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/__init__.py +0 -0
  158. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/application/__init__.py +0 -0
  159. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/application/test_code_indexing_application_service.py +0 -0
  160. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/cli_test.py +0 -0
  161. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/__init__.py +0 -0
  162. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/bm25_domain_service_test.py +0 -0
  163. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/enrichment_domain_service_test.py +0 -0
  164. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/snippet_extraction_domain_service_test.py +0 -0
  165. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/test_embedding_service.py +0 -0
  166. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/domain/test_language_mapping.py +0 -0
  167. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/e2e.py +0 -0
  168. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/__init__.py +0 -0
  169. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/cloning/git_cloning/__init__.py +0 -0
  170. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/cloning/git_cloning/factory_test.py +0 -0
  171. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/cloning/git_cloning/working_copy_test.py +0 -0
  172. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/__init__.py +0 -0
  173. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/embedding_factory_test.py +0 -0
  174. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/embedding_provider/__init__.py +0 -0
  175. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/embedding_provider/test_hash_embedding_provider.py +0 -0
  176. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/embedding_provider/test_local_embedding_provider.py +0 -0
  177. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/embedding_provider/test_openai_embedding_provider.py +0 -0
  178. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/test_batching.py +0 -0
  179. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/test_embedding_integration.py +0 -0
  180. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/test_local_vector_search_repository.py +0 -0
  181. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/embedding/test_vectorchord_vector_search_repository.py +0 -0
  182. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/__init__.py +0 -0
  183. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/enrichment_provider/__init__.py +0 -0
  184. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_local_enrichment_provider.py +0 -0
  185. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_null_enrichment_provider.py +0 -0
  186. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_openai_enrichment_provider.py +0 -0
  187. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/enrichment/test_enrichment_factory.py +0 -0
  188. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/git/__init__.py +0 -0
  189. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/git/test_git_utils.py +0 -0
  190. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/indexing/__init__.py +0 -0
  191. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/__init__.py +0 -0
  192. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/csharp.cs +0 -0
  193. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/golang.go +0 -0
  194. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/javascript.js +0 -0
  195. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/knock_knock_server.py +0 -0
  196. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/python.py +0 -0
  197. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/snippets/typescript.tsx +0 -0
  198. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/source/__init__.py +0 -0
  199. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/source/source_service_test.py +0 -0
  200. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/sqlalchemy/__init__.py +0 -0
  201. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/sqlalchemy/test_embedding_repository.py +0 -0
  202. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/sqlalchemy/test_snippet_repository.py +0 -0
  203. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/infrastructure/test_vectorchord_bm25_repository.py +0 -0
  204. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/log_test.py +0 -0
  205. {kodit-0.2.9 → kodit-0.3.1}/tests/kodit/mcp_test.py +0 -0
  206. {kodit-0.2.9 → kodit-0.3.1}/tests/performance/__init__.py +0 -0
  207. {kodit-0.2.9 → kodit-0.3.1}/tests/performance/similarity.py +0 -0
  208. {kodit-0.2.9 → kodit-0.3.1}/tests/vectorchord-smoke.sh +0 -0
  209. {kodit-0.2.9 → kodit-0.3.1}/uv.lock +0 -0
@@ -0,0 +1,121 @@
1
+ # Debug Error Command
2
+
3
+ Systematically debug and resolve errors in any codebase using a structured approach.
4
+
5
+ ## Instructions
6
+
7
+ Follow this comprehensive debugging methodology to resolve: **$ARGUMENTS**
8
+
9
+ 1. **Error Information Gathering**
10
+ - Collect the complete error message, stack trace, and error code
11
+ - Note when the error occurs (timing, conditions, frequency)
12
+ - Identify the environment where the error happens (dev, staging, prod)
13
+ - Gather relevant logs from before and after the error
14
+
15
+ 2. **Reproduce the Error**
16
+ - Create a minimal test case that reproduces the error consistently
17
+ - Document the exact steps needed to trigger the error
18
+ - Test in different environments if possible
19
+ - Note any patterns or conditions that affect error occurrence
20
+
21
+ 3. **Stack Trace Analysis**
22
+ - Read the stack trace from bottom to top to understand the call chain
23
+ - Identify the exact line where the error originates
24
+ - Trace the execution path leading to the error
25
+ - Look for any obvious issues in the failing code
26
+
27
+ 4. **Code Context Investigation**
28
+ - Examine the code around the error location
29
+ - Check recent changes that might have introduced the bug
30
+ - Review variable values and state at the time of error
31
+ - Analyze function parameters and return values
32
+
33
+ 5. **Hypothesis Formation**
34
+ - Based on evidence, form hypotheses about the root cause
35
+ - Consider common causes:
36
+ - Null pointer/undefined reference
37
+ - Type mismatches
38
+ - Race conditions
39
+ - Resource exhaustion
40
+ - Logic errors
41
+ - External dependency failures
42
+
43
+ 6. **Debugging Tools Setup**
44
+ - Set up appropriate debugging tools for the technology stack
45
+ - Use debugger, profiler, or logging as needed
46
+ - Configure breakpoints at strategic locations
47
+ - Set up monitoring and alerting if not already present
48
+
49
+ 7. **Systematic Investigation**
50
+ - Test each hypothesis methodically
51
+ - Use binary search approach to isolate the problem
52
+ - Add strategic logging or print statements
53
+ - Check data flow and transformations step by step
54
+
55
+ 8. **Data Validation**
56
+ - Verify input data format and validity
57
+ - Check for edge cases and boundary conditions
58
+ - Validate assumptions about data state
59
+ - Test with different data sets to isolate patterns
60
+
61
+ 9. **Dependency Analysis**
62
+ - Check external dependencies and their versions
63
+ - Verify network connectivity and API availability
64
+ - Review configuration files and environment variables
65
+ - Test database connections and query execution
66
+
67
+ 10. **Memory and Resource Analysis**
68
+ - Check for memory leaks or excessive memory usage
69
+ - Monitor CPU and I/O resource consumption
70
+ - Analyze garbage collection patterns if applicable
71
+ - Check for resource deadlocks or contention
72
+
73
+ 11. **Concurrency Issues Investigation**
74
+ - Look for race conditions in multi-threaded code
75
+ - Check synchronization mechanisms and locks
76
+ - Analyze async operations and promise handling
77
+ - Test under different load conditions
78
+
79
+ 12. **Root Cause Identification**
80
+ - Once the cause is identified, understand why it happened
81
+ - Determine if it's a logic error, design flaw, or external issue
82
+ - Assess the scope and impact of the problem
83
+ - Consider if similar issues exist elsewhere
84
+
85
+ 13. **Solution Implementation**
86
+ - Design a fix that addresses the root cause
87
+ - Consider multiple solution approaches and trade-offs
88
+ - Implement the fix with appropriate error handling
89
+ - Add validation and defensive programming where needed
90
+
91
+ 14. **Testing the Fix**
92
+ - Test the fix against the original error case
93
+ - Test edge cases and related scenarios
94
+ - Run regression tests to ensure no new issues
95
+ - Test under various load and stress conditions
96
+
97
+ 15. **Prevention Measures**
98
+ - Add appropriate unit and integration tests
99
+ - Improve error handling and logging
100
+ - Add input validation and defensive checks
101
+ - Update documentation and code comments
102
+
103
+ 16. **Monitoring and Alerting**
104
+ - Set up monitoring for similar issues
105
+ - Add metrics and health checks
106
+ - Configure alerts for error thresholds
107
+ - Implement better observability
108
+
109
+ 17. **Documentation**
110
+ - Document the error, investigation process, and solution
111
+ - Update troubleshooting guides
112
+ - Share learnings with the team
113
+ - Update code comments with context
114
+
115
+ 18. **Post-Resolution Review**
116
+ - Analyze why the error wasn't caught earlier
117
+ - Review development and testing processes
118
+ - Consider improvements to prevent similar issues
119
+ - Update coding standards or guidelines if needed
120
+
121
+ Remember to maintain detailed notes throughout the debugging process and consider the wider implications of both the error and the fix.
@@ -0,0 +1,33 @@
1
+ # Refactor Code Command
2
+
3
+ Safely improve code structure while preserving functionality.
4
+
5
+ ## Core Principles
6
+
7
+ - **Test First**: Ensure tests exist and pass before starting
8
+ - **Small Steps**: Make incremental changes, test after each
9
+ - **Preserve Behavior**: External functionality must remain identical
10
+
11
+ ## Refactoring Process
12
+
13
+ 1. **Analyze** - Understand current code and identify improvement areas
14
+ 2. **Test Coverage** - Verify/add tests before changing anything
15
+ 3. **Plan** - Choose refactoring technique (extract method, rename, simplify conditionals)
16
+ 4. **Execute** - Make one small change at a time, running tests after each
17
+ 5. **Verify** - Ensure all tests pass and performance hasn't degraded
18
+
19
+ ## Key Improvements
20
+
21
+ - **Clarity**: Better names, simpler logic, shorter methods
22
+ - **Structure**: Remove duplication, improve separation of concerns, improve cohesion
23
+ - **Maintainability**: Apply patterns where beneficial, standardize error handling
24
+ - **Documentation**: Update comments and docs to match changes
25
+
26
+ ## Safety Checklist
27
+
28
+ - [ ] All tests passing before and after
29
+ - [ ] No functionality changes
30
+ - [ ] Code reviewed for quality
31
+ - [ ] Changes documented
32
+
33
+ Remember: Working code > perfect code. Commit frequently, refactor incrementally.
@@ -0,0 +1,3 @@
1
+ {
2
+ "includeCoAuthoredBy": false
3
+ }
kodit-0.3.1/CLAUDE.md ADDED
@@ -0,0 +1,99 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Kodit is a code indexing MCP (Model Context Protocol) server that connects AI coding assistants to external codebases. It provides semantic and keyword search capabilities over indexed code snippets to improve AI-assisted development.
8
+
9
+ ## Development Commands
10
+
11
+ ### Testing
12
+
13
+ - `uv run pytest src/kodit` - Run all unit tests with coverage
14
+ - `uv run pytest tests/path/to/test.py` - Run specific test file
15
+ - `uv run pytest -k "test_name"` - Run specific test by name
16
+
17
+ ### Code Quality
18
+
19
+ - `uv run ruff check --fix` - Run linting
20
+ - `uv run ruff format` - Format code
21
+ - `uv run mypy src/` - Type checking
22
+
23
+ ### Application
24
+
25
+ - `uv run kodit --help` - Show CLI help
26
+ - `uv run kodit index <path>` - Index a codebase
27
+ - `uv run kodit serve` - Start MCP server
28
+
29
+ ### Database
30
+
31
+ - `uv run alembic upgrade head` - Apply database migrations
32
+ - `uv run alembic revision --autogenerate -m "description"` - Generate new migration
33
+
34
+ ## Architecture
35
+
36
+ ### Domain-Driven Design Structure
37
+
38
+ The codebase follows Domain-Driven Design (DDD) with clean architecture:
39
+
40
+ - `domain/` - Core business logic and interfaces
41
+ - `entities.py` - Domain entities (Snippet, File, etc.)
42
+ - `repositories.py` - Repository interfaces
43
+ - `services/` - Domain services for business logic
44
+ - `application/` - Application services and factories
45
+ - `infrastructure/` - External concerns and implementations
46
+ - `sqlalchemy/` - Database repositories
47
+ - `embedding/` - Vector embedding providers
48
+ - `bm25/` - BM25 search implementations
49
+ - `indexing/` - Code indexing services
50
+
51
+ ### Key Components
52
+
53
+ **Indexing Pipeline:**
54
+
55
+ 1. Clone/read source code
56
+ 2. Extract snippets using Tree-sitter
57
+ 3. Generate embeddings and BM25 indices
58
+ 4. Store in database
59
+
60
+ **Search System:**
61
+
62
+ - Hybrid search combining semantic (embeddings) and keyword (BM25)
63
+ - Multiple providers: local models, OpenAI, custom APIs
64
+ - Configurable via environment variables
65
+
66
+ **MCP Server:**
67
+
68
+ - FastMCP-based server exposing search tools
69
+ - Integrates with Cursor, Cline, and other AI assistants
70
+
71
+ ## Configuration
72
+
73
+ Key environment variables:
74
+
75
+ - `KODIT_EMBEDDING_PROVIDER` - embedding provider (local/openai)
76
+ - `KODIT_DATABASE_URL` - database connection string
77
+ - `KODIT_OPENAI_API_KEY` - for OpenAI embeddings
78
+ - `KODIT_LOG_LEVEL` - logging level
79
+
80
+ See `config.py` for full configuration options.
81
+
82
+ ## Database
83
+
84
+ Uses SQLAlchemy with async support. Supports:
85
+
86
+ - SQLite (default, local development)
87
+ - PostgreSQL with Vectorchord (production)
88
+
89
+ Migrations managed with Alembic in `migrations/` directory. DO NOT EDIT THESE FILES.
90
+
91
+ ## Testing Strategy
92
+
93
+ - Unit tests for domain services and repositories
94
+ - Integration tests for database operations
95
+ - E2E tests for full indexing pipeline
96
+ - Smoke tests for deployment validation
97
+ - Performance tests for similarity search
98
+
99
+ Test files mirror source structure under `tests/` directory.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kodit
3
- Version: 0.2.9
3
+ Version: 0.3.1
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/
@@ -83,7 +83,7 @@ If you're an engineer working with AI-powered coding assistants, Kodit helps by
83
83
  providing relevant and up-to-date examples of your task so that LLMs make less mistakes
84
84
  and produce fewer hallucinations.
85
85
 
86
- ## Features
86
+ ## Features
87
87
 
88
88
  ### Codebase Indexing
89
89
 
@@ -94,7 +94,11 @@ code. This index is used to build a snippet library, ready for ingestion into an
94
94
  - Build comprehensive snippet libraries for LLM ingestion
95
95
  - Support for multiple codebase types and languages
96
96
  - Efficient indexing and search capabilities
97
- - Privacy first: respects .gitignore and .noindex files.
97
+ - Privacy first: respects .gitignore and .noindex files
98
+ - **NEW in 0.3**: Auto-indexing configuration for shared server deployments
99
+ - **NEW in 0.3**: Enhanced Git provider support including Azure DevOps
100
+ - **NEW in 0.3**: Index private repositories via a PAT
101
+ - **NEW in 0.3**: Improved progress monitoring and reporting during indexing
98
102
 
99
103
  ### MCP Server
100
104
 
@@ -107,6 +111,7 @@ intent. Kodit has been tested to work well with:
107
111
  - [Cursor](https://docs.helix.ml/kodit/getting-started/integration/#integration-with-cursor)
108
112
  - [Cline](https://docs.helix.ml/kodit/getting-started/integration/#integration-with-cline)
109
113
  - Please contribute more instructions! ... any other assistant is likely to work ...
114
+ - **New in 0.3**: Filter snippets by source, language, author or timestamp.
110
115
 
111
116
  ### Enterprise Ready
112
117
 
@@ -127,7 +132,12 @@ Supported providers:
127
132
  - Secure, private LLM enclave with [Helix](https://helix.ml).
128
133
  - Any other OpenAI compatible API
129
134
 
130
- ## 🚀 Quick Start
135
+ **NEW in 0.3**: Enhanced deployment options:
136
+
137
+ - Docker Compose configurations with VectorChord
138
+ - Kubernetes manifests for production deployments
139
+
140
+ ## Quick Start
131
141
 
132
142
  1. [Install Kodit](https://docs.helix.ml/kodit/getting-started/installation/)
133
143
  2. [Index codebases](https://docs.helix.ml/kodit/getting-started/quick-start/)
@@ -30,7 +30,7 @@ If you're an engineer working with AI-powered coding assistants, Kodit helps by
30
30
  providing relevant and up-to-date examples of your task so that LLMs make less mistakes
31
31
  and produce fewer hallucinations.
32
32
 
33
- ## Features
33
+ ## Features
34
34
 
35
35
  ### Codebase Indexing
36
36
 
@@ -41,7 +41,11 @@ code. This index is used to build a snippet library, ready for ingestion into an
41
41
  - Build comprehensive snippet libraries for LLM ingestion
42
42
  - Support for multiple codebase types and languages
43
43
  - Efficient indexing and search capabilities
44
- - Privacy first: respects .gitignore and .noindex files.
44
+ - Privacy first: respects .gitignore and .noindex files
45
+ - **NEW in 0.3**: Auto-indexing configuration for shared server deployments
46
+ - **NEW in 0.3**: Enhanced Git provider support including Azure DevOps
47
+ - **NEW in 0.3**: Index private repositories via a PAT
48
+ - **NEW in 0.3**: Improved progress monitoring and reporting during indexing
45
49
 
46
50
  ### MCP Server
47
51
 
@@ -54,6 +58,7 @@ intent. Kodit has been tested to work well with:
54
58
  - [Cursor](https://docs.helix.ml/kodit/getting-started/integration/#integration-with-cursor)
55
59
  - [Cline](https://docs.helix.ml/kodit/getting-started/integration/#integration-with-cline)
56
60
  - Please contribute more instructions! ... any other assistant is likely to work ...
61
+ - **New in 0.3**: Filter snippets by source, language, author or timestamp.
57
62
 
58
63
  ### Enterprise Ready
59
64
 
@@ -74,7 +79,12 @@ Supported providers:
74
79
  - Secure, private LLM enclave with [Helix](https://helix.ml).
75
80
  - Any other OpenAI compatible API
76
81
 
77
- ## 🚀 Quick Start
82
+ **NEW in 0.3**: Enhanced deployment options:
83
+
84
+ - Docker Compose configurations with VectorChord
85
+ - Kubernetes manifests for production deployments
86
+
87
+ ## Quick Start
78
88
 
79
89
  1. [Install Kodit](https://docs.helix.ml/kodit/getting-started/installation/)
80
90
  2. [Index codebases](https://docs.helix.ml/kodit/getting-started/quick-start/)
@@ -40,7 +40,7 @@ If you're an engineer working with AI-powered coding assistants, Kodit helps by
40
40
  providing relevant and up-to-date examples of your task so that LLMs make less mistakes
41
41
  and produce fewer hallucinations.
42
42
 
43
- ## Features
43
+ ## Features
44
44
 
45
45
  ### Codebase Indexing
46
46
 
@@ -51,7 +51,11 @@ code. This index is used to build a snippet library, ready for ingestion into an
51
51
  - Build comprehensive snippet libraries for LLM ingestion
52
52
  - Support for multiple codebase types and languages
53
53
  - Efficient indexing and search capabilities
54
- - Privacy first: respects .gitignore and .noindex files.
54
+ - Privacy first: respects .gitignore and .noindex files
55
+ - **NEW in 0.3**: Auto-indexing configuration for shared server deployments
56
+ - **NEW in 0.3**: Enhanced Git provider support including Azure DevOps
57
+ - **NEW in 0.3**: Index private repositories via a PAT
58
+ - **NEW in 0.3**: Improved progress monitoring and reporting during indexing
55
59
 
56
60
  ### MCP Server
57
61
 
@@ -64,6 +68,7 @@ intent. Kodit has been tested to work well with:
64
68
  - [Cursor](./getting-started/integration/index.md#integration-with-cursor)
65
69
  - [Cline](./getting-started/integration/index.md#integration-with-cline)
66
70
  - Please contribute more instructions! ... any other assistant is likely to work ...
71
+ - **New in 0.3**: Filter snippets by source, language, author or timestamp.
67
72
 
68
73
  ### Enterprise Ready
69
74
 
@@ -84,6 +89,11 @@ Supported providers:
84
89
  - Secure, private LLM enclave with [Helix](https://helix.ml).
85
90
  - Any other OpenAI compatible API
86
91
 
92
+ **NEW in 0.3**: Enhanced deployment options:
93
+
94
+ - Docker Compose configurations with VectorChord
95
+ - Kubernetes manifests for production deployments
96
+
87
97
  ## Roadmap
88
98
 
89
99
  The roadmap is currently maintained as a [Github Project](https://github.com/orgs/helixml/projects/4).
@@ -29,6 +29,10 @@ services:
29
29
  ENRICHMENT_ENDPOINT_API_KEY: REPLACE_WITH_YOUR_API_KEY
30
30
  ENRICHMENT_ENDPOINT_MODEL: o3-mini
31
31
 
32
+ # Auto-indexing configuration
33
+ AUTO_INDEXING_SOURCES_0_URI: https://github.com/pydantic/pydantic
34
+ AUTO_INDEXING_SOURCES_1_URI: https://github.com/fastapi/fastapi
35
+ AUTO_INDEXING_SOURCES_2_URI: https://github.com/helix-ml/kodit
32
36
 
33
37
  vectorchord:
34
38
  image: tensorchord/vchord-suite:pg17-20250601
@@ -77,6 +77,10 @@ spec:
77
77
  value: "REPLACE_WITH_YOUR_API_KEY"
78
78
  - name: ENRICHMENT_ENDPOINT_MODEL
79
79
  value: "o3-mini"
80
+ - name: AUTO_INDEXING_SOURCES_0_URI
81
+ value: "https://github.com/pydantic/pydantic"
82
+ - name: AUTO_INDEXING_SOURCES_1_URI
83
+ value: "https://github.com/helix-ml/kodit"
80
84
  ports:
81
85
  - containerPort: 8080
82
86
  readinessProbe:
@@ -42,7 +42,7 @@ Kodit can index local directories on your filesystem:
42
42
 
43
43
  ## Basic Usage
44
44
 
45
- ### Indexing a Source
45
+ ### Manual Indexing
46
46
 
47
47
  To index a source, use the `kodit index` command followed by the source location:
48
48
 
@@ -75,6 +75,61 @@ This will display a table showing:
75
75
  - Source URI
76
76
  - Number of snippets extracted
77
77
 
78
+ ### Auto-Indexing
79
+
80
+ If you're running Kodit as a shared server, you need to configure what gets indexed.
81
+ Auto-indexing is a simple indexing configuration powered by environmental variables.
82
+
83
+ #### Configuration via Environment Variables
84
+
85
+ Configure auto-indexing sources using environment variables with the `AUTO_INDEXING_SOURCES_{X}_` prefix:
86
+
87
+ ```sh
88
+ # Configure a single auto-index source
89
+ export AUTO_INDEXING_SOURCES_0_URI="https://github.com/pydantic/pydantic"
90
+
91
+ # Configure multiple auto-index sources
92
+ export AUTO_INDEXING_SOURCES_0_URI="https://github.com/pydantic/pydantic"
93
+ export AUTO_INDEXING_SOURCES_1_URI="https://github.com/fastapi/fastapi"
94
+ export AUTO_INDEXING_SOURCES_2_URI="/path/to/local/project"
95
+
96
+ # Or use a .env file
97
+ echo "AUTO_INDEXING_SOURCES_0_URI=https://github.com/pydantic/pydantic" >> .env
98
+ echo "AUTO_INDEXING_SOURCES_1_URI=https://github.com/fastapi/fastapi" >> .env
99
+ echo "AUTO_INDEXING_SOURCES_2_URI=/path/to/local/project" >> .env
100
+ ```
101
+
102
+ **Configuration Format:**
103
+
104
+ - Use `AUTO_INDEXING_SOURCES_N_URI` where `N` is a zero-based index
105
+ - Sources are indexed in numerical order (0, 1, 2, etc.)
106
+ - Supports all source types: Git repositories (HTTPS/SSH) and local directories
107
+ - Gaps in numbering are allowed (e.g., 0, 2, 5 will work)
108
+
109
+ #### Using Auto-Indexing
110
+
111
+ To manually index all configured auto-index sources:
112
+
113
+ ```sh
114
+ kodit index --auto-index
115
+ ```
116
+
117
+ This command will:
118
+
119
+ 1. Read the auto-indexing configuration from environment variables
120
+ 2. Index each configured source in sequence
121
+ 3. Show progress for each source being indexed
122
+ 4. Handle errors gracefully and continue with remaining sources
123
+
124
+ If no auto-index sources are configured, the command will display a message indicating
125
+ that no sources are configured.
126
+
127
+ To automatically run index all configured auto-index sources:
128
+
129
+ ```sh
130
+ kodit serve
131
+ ```
132
+
78
133
  ## Git Protocol Support
79
134
 
80
135
  ### HTTPS Authentication
@@ -226,15 +281,6 @@ Kodit shows progress during indexing operations:
226
281
  - Snippet extraction progress
227
282
  - Index building progress (BM25, embeddings)
228
283
 
229
- ### Error Handling
230
-
231
- Common issues and solutions:
232
-
233
- 1. **Authentication Errors**: Ensure your credentials are correct
234
- 2. **Network Issues**: Check your internet connection and firewall settings
235
- 3. **Permission Errors**: Ensure you have read access to the source
236
- 4. **Unsupported Files**: Kodit will skip unsupported file types automatically
237
-
238
284
  ## Privacy and Security
239
285
 
240
286
  ### Local Processing
@@ -265,6 +311,8 @@ Kodit respects privacy by honoring:
265
311
  2. **"Unsupported source"**: Ensure the path or URL is valid and accessible
266
312
  3. **"No snippets found"**: Check if the source contains supported file types
267
313
  4. **"Permission denied"**: Ensure you have read access to the source
314
+ 5. **"No auto-index sources configured"**: Check your environment variables are set correctly
315
+ 6. **"Auto-indexing configuration error"**: Verify the environment variable format uses `AUTO_INDEXING_SOURCES_N_URI`
268
316
 
269
317
  ### Checking Index Status
270
318
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.2.9'
21
- __version_tuple__ = version_tuple = (0, 2, 9)
20
+ __version__ = version = '0.3.1'
21
+ __version_tuple__ = version_tuple = (0, 3, 1)
@@ -0,0 +1,70 @@
1
+ """FastAPI application for kodit API."""
2
+
3
+ from collections.abc import AsyncIterator
4
+ from contextlib import asynccontextmanager
5
+
6
+ from asgi_correlation_id import CorrelationIdMiddleware
7
+ from fastapi import FastAPI
8
+
9
+ from kodit.config import AppContext
10
+ from kodit.infrastructure.indexing.auto_indexing_service import AutoIndexingService
11
+ from kodit.mcp import mcp
12
+ from kodit.middleware import ASGICancelledErrorMiddleware, logging_middleware
13
+
14
+ # Global auto-indexing service
15
+ _auto_indexing_service: AutoIndexingService | None = None
16
+
17
+
18
+ @asynccontextmanager
19
+ async def app_lifespan(_: FastAPI) -> AsyncIterator[None]:
20
+ """Manage application lifespan for auto-indexing."""
21
+ global _auto_indexing_service # noqa: PLW0603
22
+ # Start auto-indexing service
23
+ app_context = AppContext()
24
+ db = await app_context.get_db()
25
+ _auto_indexing_service = AutoIndexingService(
26
+ app_context=app_context,
27
+ session_factory=db.session_factory,
28
+ )
29
+ await _auto_indexing_service.start_background_indexing()
30
+ yield
31
+ if _auto_indexing_service:
32
+ await _auto_indexing_service.stop()
33
+
34
+
35
+ # See https://gofastmcp.com/deployment/asgi#fastapi-integration
36
+ mcp_app = mcp.sse_app()
37
+
38
+
39
+ @asynccontextmanager
40
+ async def combined_lifespan(app: FastAPI) -> AsyncIterator[None]:
41
+ """Combine app and MCP lifespans."""
42
+ async with app_lifespan(app), mcp_app.router.lifespan_context(app):
43
+ yield
44
+
45
+
46
+ app = FastAPI(title="kodit API", lifespan=combined_lifespan)
47
+
48
+ # Add middleware
49
+ app.middleware("http")(logging_middleware)
50
+ app.add_middleware(CorrelationIdMiddleware)
51
+
52
+
53
+ @app.get("/")
54
+ async def root() -> dict[str, str]:
55
+ """Return a welcome message for the kodit API."""
56
+ return {"message": "Hello, World!"}
57
+
58
+
59
+ @app.get("/healthz")
60
+ async def healthz() -> dict[str, str]:
61
+ """Return a health check for the kodit API."""
62
+ return {"status": "ok"}
63
+
64
+
65
+ # Add mcp routes last, otherwise previous routes aren't added
66
+ app.mount("", mcp_app)
67
+
68
+ # Wrap the entire app with ASGI middleware after all routes are added to suppress
69
+ # CancelledError at the ASGI level
70
+ app = ASGICancelledErrorMiddleware(app)
@@ -27,7 +27,6 @@ from kodit.domain.value_objects import (
27
27
  MultiSearchResult,
28
28
  SearchRequest,
29
29
  SearchResult,
30
- SnippetListItem,
31
30
  )
32
31
  from kodit.log import log_event
33
32
  from kodit.reporting import Reporter
@@ -225,17 +224,17 @@ class CodeIndexingApplicationService:
225
224
 
226
225
  return [
227
226
  MultiSearchResult(
228
- id=snippet["id"],
229
- uri=file["uri"],
230
- content=snippet["content"],
227
+ id=result.snippet.id,
228
+ uri=result.file.uri,
229
+ content=result.snippet.content,
231
230
  original_scores=fr.original_scores,
232
231
  )
233
- for (file, snippet), fr in zip(search_results, final_results, strict=True)
232
+ for result, fr in zip(search_results, final_results, strict=True)
234
233
  ]
235
234
 
236
235
  async def list_snippets(
237
236
  self, file_path: str | None = None, source_uri: str | None = None
238
- ) -> list[SnippetListItem]:
237
+ ) -> list[MultiSearchResult]:
239
238
  """List snippets with optional filtering."""
240
239
  log_event("kodit.index.list_snippets")
241
240
  return await self.snippet_domain_service.list_snippets(file_path, source_uri)