kodit 0.2.8__tar.gz → 0.3.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.
Potentially problematic release.
This version of kodit might be problematic. Click here for more details.
- kodit-0.3.0/.cursor/rules/style.mdc +11 -0
- {kodit-0.2.8 → kodit-0.3.0}/PKG-INFO +1 -1
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/deployment/docker-compose.yaml +4 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/deployment/kubernetes.yaml +4 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/indexing/index.md +58 -10
- kodit-0.3.0/docs/reference/mcp/index.md +217 -0
- {kodit-0.2.8 → kodit-0.3.0}/pyproject.toml +0 -1
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/_version.py +2 -2
- kodit-0.3.0/src/kodit/app.py +70 -0
- kodit-0.3.0/src/kodit/application/factories/__init__.py +1 -0
- kodit-0.3.0/src/kodit/application/factories/code_indexing_factory.py +119 -0
- kodit-0.2.8/src/kodit/application/services/indexing_application_service.py → kodit-0.3.0/src/kodit/application/services/code_indexing_application_service.py +159 -198
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/cli.py +214 -62
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/config.py +40 -3
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/entities.py +7 -5
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/repositories.py +33 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/bm25_service.py +14 -17
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/embedding_service.py +10 -14
- kodit-0.3.0/src/kodit/domain/services/snippet_service.py +198 -0
- kodit-0.3.0/src/kodit/domain/value_objects.py +495 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/bm25/local_bm25_repository.py +20 -12
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/bm25/vectorchord_bm25_repository.py +31 -11
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/metadata.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_providers/hash_embedding_provider.py +14 -25
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/local_vector_search_repository.py +26 -38
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/vectorchord_vector_search_repository.py +50 -35
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/enrichment/enrichment_factory.py +1 -1
- kodit-0.3.0/src/kodit/infrastructure/indexing/auto_indexing_service.py +84 -0
- kodit-0.3.0/src/kodit/infrastructure/indexing/indexing_factory.py +30 -0
- kodit-0.3.0/src/kodit/infrastructure/indexing/snippet_domain_service_factory.py +37 -0
- kodit-0.3.0/src/kodit/infrastructure/snippet_extraction/languages/java.scm +12 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/snippet_extraction_factory.py +3 -31
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/sqlalchemy/embedding_repository.py +14 -3
- kodit-0.3.0/src/kodit/infrastructure/sqlalchemy/snippet_repository.py +251 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/mcp.py +61 -49
- {kodit-0.2.8 → kodit-0.3.0}/tests/conftest.py +4 -15
- kodit-0.3.0/tests/experiments/__init__.py +1 -0
- kodit-0.3.0/tests/experiments/cline_prompt_tests/__init__.py +1 -0
- {kodit-0.2.8/tests/experiments/cline-prompt-regression-tests → kodit-0.3.0/tests/experiments/cline_prompt_tests}/cline_prompt_test.py +38 -24
- kodit-0.3.0/tests/kodit/application/test_code_indexing_application_service.py +499 -0
- kodit-0.3.0/tests/kodit/cli_test.py +555 -0
- kodit-0.3.0/tests/kodit/config_test.py +73 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/domain/bm25_domain_service_test.py +50 -91
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/domain/enrichment_domain_service_test.py +29 -25
- kodit-0.3.0/tests/kodit/domain/snippet_domain_service_test.py +266 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/domain/snippet_extraction_domain_service_test.py +7 -5
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/domain/test_embedding_service.py +70 -54
- kodit-0.3.0/tests/kodit/domain/test_language_mapping.py +181 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/e2e.py +5 -12
- kodit-0.3.0/tests/kodit/infrastructure/cloning/git_cloning/__init__.py +1 -0
- {kodit-0.2.8/tests/kodit/infrastructure/cloning/git → kodit-0.3.0/tests/kodit/infrastructure/cloning/git_cloning}/factory_test.py +58 -62
- {kodit-0.2.8/tests/kodit/infrastructure/cloning/git → kodit-0.3.0/tests/kodit/infrastructure/cloning/git_cloning}/working_copy_test.py +12 -14
- kodit-0.3.0/tests/kodit/infrastructure/embedding/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/embedding_factory_test.py +5 -2
- kodit-0.3.0/tests/kodit/infrastructure/embedding/embedding_provider/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/embedding_provider/test_hash_embedding_provider.py +26 -25
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/embedding_provider/test_local_embedding_provider.py +21 -97
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/embedding_provider/test_openai_embedding_provider.py +16 -15
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/test_batching.py +3 -4
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/test_embedding_integration.py +99 -86
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/embedding/test_local_vector_search_repository.py +198 -52
- kodit-0.3.0/tests/kodit/infrastructure/embedding/test_vectorchord_vector_search_repository.py +677 -0
- kodit-0.3.0/tests/kodit/infrastructure/enrichment/__init__.py +1 -0
- kodit-0.3.0/tests/kodit/infrastructure/enrichment/enrichment_provider/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_local_enrichment_provider.py +26 -35
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_null_enrichment_provider.py +12 -22
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/enrichment/enrichment_provider/test_openai_enrichment_provider.py +38 -49
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/enrichment/test_enrichment_factory.py +30 -23
- kodit-0.3.0/tests/kodit/infrastructure/git/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/git/test_git_utils.py +14 -14
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/indexing/indexing_repository_test.py +18 -3
- kodit-0.3.0/tests/kodit/infrastructure/indexing/test_auto_indexing_service.py +234 -0
- kodit-0.2.8/tests/kodit/infrastructure/snippets/knock-knock-server.py → kodit-0.3.0/tests/kodit/infrastructure/snippets/knock_knock_server.py +11 -4
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/source/source_service_test.py +6 -11
- kodit-0.3.0/tests/kodit/infrastructure/sqlalchemy/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/sqlalchemy/test_embedding_repository.py +144 -19
- kodit-0.3.0/tests/kodit/infrastructure/sqlalchemy/test_snippet_repository.py +354 -0
- kodit-0.3.0/tests/kodit/infrastructure/test_vectorchord_bm25_repository.py +540 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/log_test.py +3 -1
- kodit-0.3.0/tests/performance/__init__.py +1 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/performance/similarity.py +49 -30
- {kodit-0.2.8 → kodit-0.3.0}/tests/smoke.sh +14 -0
- kodit-0.2.8/src/kodit/app.py +0 -35
- kodit-0.2.8/src/kodit/application/commands/__init__.py +0 -1
- kodit-0.2.8/src/kodit/application/commands/snippet_commands.py +0 -22
- kodit-0.2.8/src/kodit/application/services/snippet_application_service.py +0 -149
- kodit-0.2.8/src/kodit/domain/value_objects.py +0 -215
- kodit-0.2.8/src/kodit/infrastructure/enrichment/legacy_enrichment_models.py +0 -42
- kodit-0.2.8/src/kodit/infrastructure/indexing/indexing_factory.py +0 -113
- kodit-0.2.8/src/kodit/infrastructure/sqlalchemy/snippet_repository.py +0 -79
- kodit-0.2.8/tests/experiments/embedding.py +0 -89
- kodit-0.2.8/tests/experiments/similarity_test.py +0 -73
- kodit-0.2.8/tests/kodit/application/indexing_application_service_test.py +0 -416
- kodit-0.2.8/tests/kodit/application/snippet_application_service_test.py +0 -161
- kodit-0.2.8/tests/kodit/cli_test.py +0 -69
- kodit-0.2.8/tests/kodit/domain/test_models.py +0 -160
- kodit-0.2.8/tests/kodit/infrastructure/embedding/__init__.py +0 -0
- kodit-0.2.8/tests/kodit/infrastructure/embedding/test_vectorchord_vector_search_repository.py +0 -443
- kodit-0.2.8/tests/kodit/infrastructure/enrichment/__init__.py +0 -0
- kodit-0.2.8/tests/kodit/infrastructure/enrichment/enrichment_provider/__init__.py +0 -0
- kodit-0.2.8/tests/kodit/infrastructure/enrichment/test_enrichment_integration.py +0 -239
- {kodit-0.2.8 → kodit-0.3.0}/.cursor/rules/kodit.mdc +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.dockerignore +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/CODE_OF_CONDUCT.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/CONTRIBUTING.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/dependabot.yml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/docker.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/docs.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/pull_request.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/pypi-test.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/pypi.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.github/workflows/test.yaml +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.gitignore +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.python-version +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.vscode/launch.json +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/.vscode/settings.json +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/Dockerfile +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/LICENSE +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/README.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/alembic.ini +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/_index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/demos/_index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/demos/go-simple-microservice/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/demos/knock-knock-auth/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/developer/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/getting-started/_index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/getting-started/installation/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/getting-started/integration/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/getting-started/quick-start/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/_index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/configuration/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/deployment/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/docs/reference/telemetry/index.md +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/.gitignore +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/application/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/application/services/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/database.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/enums.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/errors.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/interfaces.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/enrichment_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/ignore_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/indexing_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/snippet_extraction_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/domain/services/source_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/bm25/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/bm25/bm25_factory.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/folder/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/folder/factory.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/folder/working_copy.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/git/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/git/factory.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/cloning/git/working_copy.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_factory.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_providers/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_providers/batching.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_providers/local_embedding_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/embedding/embedding_providers/openai_embedding_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/enrichment/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/enrichment/local_enrichment_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/enrichment/null_enrichment_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/enrichment/openai_enrichment_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/git/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/git/git_utils.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/ignore/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/ignore/ignore_pattern_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/indexing/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/indexing/fusion_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/indexing/index_repository.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/language_detection_service.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/languages/csharp.scm +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/languages/go.scm +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/languages/javascript.scm +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/languages/python.scm +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/languages/typescript.scm +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/snippet_query_provider.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/snippet_extraction/tree_sitter_snippet_extractor.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/sqlalchemy/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/sqlalchemy/file_repository.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/sqlalchemy/repository.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/ui/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/ui/progress.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/infrastructure/ui/spinner.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/log.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/middleware.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/README +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/env.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/script.py.mako +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/versions/85155663351e_initial.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/versions/9e53ea8bb3b0_add_authors.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/versions/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/migrations/versions/c3f5137d30f5_index_all_the_things.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/src/kodit/reporting.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/docker-smoke.sh +0 -0
- {kodit-0.2.8/tests/experiments/cline-prompt-regression-tests → kodit-0.3.0/tests/experiments/cline_prompt_tests}/cline_prompt.txt +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/application/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/domain/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/indexing/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/csharp.cs +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/golang.go +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/javascript.js +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/python.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/snippets/typescript.tsx +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/infrastructure/source/__init__.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/kodit/mcp_test.py +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/tests/vectorchord-smoke.sh +0 -0
- {kodit-0.2.8 → kodit-0.3.0}/uv.lock +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
Please maintain the following coding standards while developing code:
|
|
7
|
+
|
|
8
|
+
1. This project uses a domain-driven design approach. Please consider in which layer
|
|
9
|
+
your code belongs.
|
|
10
|
+
2. Run `uv run ruff check --fix` to lint the code.
|
|
11
|
+
3. Run `uv run pytest ...` to test the code.
|
|
@@ -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
|
|
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
|
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MCP
|
|
3
|
+
description: Model Context Protocol (MCP) server implementation for AI coding assistants
|
|
4
|
+
weight: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Kodit provides an MCP (Model Context Protocol) server that enables AI coding assistants to search and retrieve relevant code snippets from your indexed codebases. This allows AI assistants to provide more accurate and contextually relevant code suggestions.
|
|
8
|
+
|
|
9
|
+
## What is MCP?
|
|
10
|
+
|
|
11
|
+
The Model Context Protocol (MCP) is a standard that enables AI assistants to communicate with external tools and data sources. Kodit implements an MCP server that exposes your indexed codebases to AI assistants, allowing them to:
|
|
12
|
+
|
|
13
|
+
- Search for relevant code examples
|
|
14
|
+
- Retrieve specific code snippets
|
|
15
|
+
- Filter results by various criteria
|
|
16
|
+
- Provide context-aware code suggestions
|
|
17
|
+
|
|
18
|
+
## How Kodit MCP Works
|
|
19
|
+
|
|
20
|
+
The Kodit MCP server runs as a separate service that:
|
|
21
|
+
|
|
22
|
+
1. **Connects to your indexed codebases** - Uses the same database and indexes created by the `kodit index` command
|
|
23
|
+
2. **Exposes search functionality** - Provides a `search` tool that AI assistants can call
|
|
24
|
+
3. **Handles filtering** - Supports filtering by language, author, date range, and source repository
|
|
25
|
+
4. **Returns relevant snippets** - Combines keyword, semantic code, and semantic text search for optimal results
|
|
26
|
+
|
|
27
|
+
## Integration with AI Assistants
|
|
28
|
+
|
|
29
|
+
To use Kodit with your AI coding assistant, you need to:
|
|
30
|
+
|
|
31
|
+
1. **Start the Kodit MCP server**:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
kodit serve
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. **Configure your AI assistant** to connect to the MCP server. See the [Integration Guide](../../getting-started/integration/index.md) for detailed instructions for:
|
|
38
|
+
- Cursor
|
|
39
|
+
- Cline
|
|
40
|
+
- Other MCP-compatible assistants
|
|
41
|
+
|
|
42
|
+
## Search Tool
|
|
43
|
+
|
|
44
|
+
The primary tool exposed by the Kodit MCP server is the `search` function, which provides comprehensive code search capabilities.
|
|
45
|
+
|
|
46
|
+
### Search Parameters
|
|
47
|
+
|
|
48
|
+
The search tool accepts the following parameters:
|
|
49
|
+
|
|
50
|
+
| Parameter | Type | Description | Example |
|
|
51
|
+
|-----------|------|-------------|---------|
|
|
52
|
+
| `user_intent` | string | Description of what the user wants to achieve | "Create a REST API endpoint for user authentication" |
|
|
53
|
+
| `related_file_paths` | list[Path] | Absolute paths to relevant files | `["/path/to/auth.py"]` |
|
|
54
|
+
| `related_file_contents` | list[string] | Contents of relevant files | `["def authenticate(): ..."]` |
|
|
55
|
+
| `keywords` | list[string] | Relevant keywords for the search | `["authentication", "jwt", "login"]` |
|
|
56
|
+
| `language` | string \| None | Filter by programming language | `"python"`, `"go"`, `"javascript"` |
|
|
57
|
+
| `author` | string \| None | Filter by author name | `"john.doe"` |
|
|
58
|
+
| `created_after` | string \| None | Filter by creation date (YYYY-MM-DD) | `"2023-01-01"` |
|
|
59
|
+
| `created_before` | string \| None | Filter by creation date (YYYY-MM-DD) | `"2023-12-31"` |
|
|
60
|
+
| `source_repo` | string \| None | Filter by source repository | `"github.com/example/repo"` |
|
|
61
|
+
|
|
62
|
+
### Search Functionality
|
|
63
|
+
|
|
64
|
+
The search tool combines multiple search strategies:
|
|
65
|
+
|
|
66
|
+
1. **Keyword Search** - Uses BM25 algorithm for exact keyword matching
|
|
67
|
+
2. **Semantic Code Search** - Uses embeddings to find semantically similar code
|
|
68
|
+
3. **Semantic Text Search** - Uses embeddings to find code matching natural language descriptions
|
|
69
|
+
|
|
70
|
+
Results are fused together to provide the most relevant snippets for the user's intent.
|
|
71
|
+
|
|
72
|
+
## Filtering Capabilities
|
|
73
|
+
|
|
74
|
+
Kodit's MCP server supports comprehensive filtering to help AI assistants find the most relevant code examples. These filters work the same way as the CLI search filters.
|
|
75
|
+
|
|
76
|
+
### Language Filtering
|
|
77
|
+
|
|
78
|
+
Filter results by programming language:
|
|
79
|
+
|
|
80
|
+
**Example prompts:**
|
|
81
|
+
> "I need to create a web server in Python. Please search for Flask or FastAPI examples and show me the best practices."
|
|
82
|
+
> "I'm working on a Go microservice. Can you search for Go-specific patterns for handling HTTP requests and database connections?"
|
|
83
|
+
> "I need JavaScript examples for form validation. Please search for modern JavaScript/TypeScript validation patterns."
|
|
84
|
+
|
|
85
|
+
### Author Filtering
|
|
86
|
+
|
|
87
|
+
Filter results by code author:
|
|
88
|
+
|
|
89
|
+
**Example prompts:**
|
|
90
|
+
> "I'm reviewing code written by john.doe. Can you search for their authentication implementations to understand their coding style?"
|
|
91
|
+
> "I need to find all the database-related code written by alice.smith. Please search for her database connection and query patterns."
|
|
92
|
+
|
|
93
|
+
### Date Range Filtering
|
|
94
|
+
|
|
95
|
+
Filter results by creation date:
|
|
96
|
+
|
|
97
|
+
**Example prompts:**
|
|
98
|
+
> "I need to see authentication patterns from 2023. Please search for JWT and OAuth implementations created in 2023."
|
|
99
|
+
> "Show me modern React patterns from the last year. Search for React components and hooks created after 2023."
|
|
100
|
+
|
|
101
|
+
### Source Repository Filtering
|
|
102
|
+
|
|
103
|
+
Filter results by source repository:
|
|
104
|
+
|
|
105
|
+
**Example prompts:**
|
|
106
|
+
> "I'm working on the auth-service project. Please search for authentication patterns specifically from github.com/company/auth-service."
|
|
107
|
+
> "I need to understand how the user-service handles user management. Search for user-related code from github.com/company/user-service."
|
|
108
|
+
|
|
109
|
+
### Combining Filters
|
|
110
|
+
|
|
111
|
+
You can combine multiple filters for precise results:
|
|
112
|
+
|
|
113
|
+
**Example prompts:**
|
|
114
|
+
> "I need Python authentication code written by alice.smith in 2023 from the auth-service repository. Please search for JWT token validation patterns."
|
|
115
|
+
> "Show me Go microservice patterns from john.doe created in 2023 from the backend-services repository."
|
|
116
|
+
> "I'm looking for modern React patterns from the frontend team (search for authors: alice.smith, bob.jones) created in 2024 from the web-app repository."
|
|
117
|
+
|
|
118
|
+
## AI Assistant Integration Tips
|
|
119
|
+
|
|
120
|
+
To get the best results from Kodit with your AI assistant, follow these prompting strategies:
|
|
121
|
+
|
|
122
|
+
### 1. Provide Clear User Intent
|
|
123
|
+
|
|
124
|
+
When the AI assistant calls the search tool, ensure it provides a clear, descriptive `user_intent`:
|
|
125
|
+
|
|
126
|
+
**Good examples:**
|
|
127
|
+
|
|
128
|
+
- "Create a REST API endpoint for user authentication with JWT tokens"
|
|
129
|
+
- "Implement a database connection pool for PostgreSQL"
|
|
130
|
+
- "Write a function to validate email addresses using regex"
|
|
131
|
+
|
|
132
|
+
**Poor examples:**
|
|
133
|
+
|
|
134
|
+
- "Help me with auth"
|
|
135
|
+
- "Database stuff"
|
|
136
|
+
- "Email validation"
|
|
137
|
+
|
|
138
|
+
### 2. Use Relevant Keywords
|
|
139
|
+
|
|
140
|
+
Provide specific, technical keywords that are relevant to your task, where applicable.
|
|
141
|
+
Remember that the language model is more than capable of generating appropriate keywords
|
|
142
|
+
for your intent.
|
|
143
|
+
|
|
144
|
+
**Good examples:**
|
|
145
|
+
|
|
146
|
+
- `["authentication", "jwt", "login", "password"]`
|
|
147
|
+
- `["database", "postgresql", "connection", "pool"]`
|
|
148
|
+
- `["email", "validation", "regex", "format"]`
|
|
149
|
+
|
|
150
|
+
### 3. Leverage File Context
|
|
151
|
+
|
|
152
|
+
If you're working with existing files, mention them in your prompt:
|
|
153
|
+
|
|
154
|
+
**Example prompts:**
|
|
155
|
+
> "I'm working on the authentication function in auth.py. Can you search for similar error handling patterns and show me how to improve the error handling in my existing code?"
|
|
156
|
+
> "I have a database connection setup in database.py. Please search for connection pooling patterns and show me how to optimize my current implementation."
|
|
157
|
+
|
|
158
|
+
### 4. Use Language Filtering
|
|
159
|
+
|
|
160
|
+
Specify the programming language in your prompt:
|
|
161
|
+
|
|
162
|
+
**Example prompts:**
|
|
163
|
+
> "I need to create a web server in Python. Please search for Flask and FastAPI examples and show me the best practices."
|
|
164
|
+
> "I'm building a Go microservice. Can you search for Go-specific patterns for handling HTTP requests and database connections?"
|
|
165
|
+
> "I need JavaScript examples for form validation. Please search for modern JavaScript/TypeScript validation patterns."
|
|
166
|
+
|
|
167
|
+
### 5. Filter by Source Repository
|
|
168
|
+
|
|
169
|
+
If you have multiple codebases indexed, mention the specific repository:
|
|
170
|
+
|
|
171
|
+
**Example prompts:**
|
|
172
|
+
> "I'm working on the user-service project. Please search for user management patterns specifically from github.com/company/user-service."
|
|
173
|
+
> "I need to understand how the auth-service handles authentication. Search for auth-related code from github.com/company/auth-service."
|
|
174
|
+
|
|
175
|
+
### 6. Example Prompts for AI Assistants
|
|
176
|
+
|
|
177
|
+
Here are some example prompts you can use with your AI assistant:
|
|
178
|
+
|
|
179
|
+
**For new code development:**
|
|
180
|
+
> "I want to create a new Python web API. Please search for examples of Flask/FastAPI authentication patterns and show me the best practices."
|
|
181
|
+
|
|
182
|
+
**For debugging existing code:**
|
|
183
|
+
> "I'm having issues with this database connection code. Can you search for similar patterns and show me how others handle connection errors?"
|
|
184
|
+
|
|
185
|
+
**For learning new patterns:**
|
|
186
|
+
> "I need to implement JWT authentication in Go. Please search for production-ready examples and show me the security best practices."
|
|
187
|
+
|
|
188
|
+
**For code review:**
|
|
189
|
+
> "I'm reviewing this authentication function. Can you search for similar implementations and show me potential security issues or improvements?"
|
|
190
|
+
|
|
191
|
+
## Troubleshooting
|
|
192
|
+
|
|
193
|
+
### Common Issues
|
|
194
|
+
|
|
195
|
+
1. **AI assistant not using Kodit**: Ensure you've configured the enforcement prompt and MCP server connection properly.
|
|
196
|
+
|
|
197
|
+
2. **No search results**: Check that you have indexed codebases and that your search terms are relevant.
|
|
198
|
+
|
|
199
|
+
3. **Filter not working**: Verify that the filter values match your indexed data (e.g., correct language names, author names, repository URLs).
|
|
200
|
+
|
|
201
|
+
4. **Connection issues**: Ensure the Kodit MCP server is running (`kodit serve`) and accessible to your AI assistant.
|
|
202
|
+
|
|
203
|
+
### Debugging
|
|
204
|
+
|
|
205
|
+
Enable debug logging to see what's happening:
|
|
206
|
+
|
|
207
|
+
```sh
|
|
208
|
+
export LOG_LEVEL=DEBUG
|
|
209
|
+
kodit serve
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This will show you:
|
|
213
|
+
|
|
214
|
+
- Search queries being executed
|
|
215
|
+
- Filter parameters being applied
|
|
216
|
+
- Results being returned
|
|
217
|
+
- Any errors or issues
|
|
@@ -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)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Application factories package."""
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Factory for creating the unified code indexing application service."""
|
|
2
|
+
|
|
3
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
4
|
+
|
|
5
|
+
from kodit.application.services.code_indexing_application_service import (
|
|
6
|
+
CodeIndexingApplicationService,
|
|
7
|
+
)
|
|
8
|
+
from kodit.config import AppContext
|
|
9
|
+
from kodit.domain.entities import EmbeddingType
|
|
10
|
+
from kodit.domain.services.bm25_service import BM25DomainService
|
|
11
|
+
from kodit.domain.services.embedding_service import EmbeddingDomainService
|
|
12
|
+
from kodit.domain.services.enrichment_service import EnrichmentDomainService
|
|
13
|
+
from kodit.domain.services.source_service import SourceService
|
|
14
|
+
from kodit.infrastructure.bm25.bm25_factory import bm25_repository_factory
|
|
15
|
+
from kodit.infrastructure.embedding.embedding_factory import (
|
|
16
|
+
embedding_domain_service_factory,
|
|
17
|
+
)
|
|
18
|
+
from kodit.infrastructure.embedding.embedding_providers import (
|
|
19
|
+
hash_embedding_provider,
|
|
20
|
+
)
|
|
21
|
+
from kodit.infrastructure.embedding.local_vector_search_repository import (
|
|
22
|
+
LocalVectorSearchRepository,
|
|
23
|
+
)
|
|
24
|
+
from kodit.infrastructure.enrichment.enrichment_factory import (
|
|
25
|
+
enrichment_domain_service_factory,
|
|
26
|
+
)
|
|
27
|
+
from kodit.infrastructure.enrichment.null_enrichment_provider import (
|
|
28
|
+
NullEnrichmentProvider,
|
|
29
|
+
)
|
|
30
|
+
from kodit.infrastructure.indexing.indexing_factory import (
|
|
31
|
+
indexing_domain_service_factory,
|
|
32
|
+
)
|
|
33
|
+
from kodit.infrastructure.indexing.snippet_domain_service_factory import (
|
|
34
|
+
snippet_domain_service_factory,
|
|
35
|
+
)
|
|
36
|
+
from kodit.infrastructure.sqlalchemy.embedding_repository import (
|
|
37
|
+
SqlAlchemyEmbeddingRepository,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def create_code_indexing_application_service(
|
|
42
|
+
app_context: AppContext,
|
|
43
|
+
session: AsyncSession,
|
|
44
|
+
source_service: SourceService,
|
|
45
|
+
) -> CodeIndexingApplicationService:
|
|
46
|
+
"""Create a unified code indexing application service with all dependencies."""
|
|
47
|
+
# Create domain services
|
|
48
|
+
indexing_domain_service = indexing_domain_service_factory(session)
|
|
49
|
+
snippet_domain_service = snippet_domain_service_factory(session)
|
|
50
|
+
bm25_service = BM25DomainService(bm25_repository_factory(app_context, session))
|
|
51
|
+
code_search_service = embedding_domain_service_factory("code", app_context, session)
|
|
52
|
+
text_search_service = embedding_domain_service_factory("text", app_context, session)
|
|
53
|
+
enrichment_service = enrichment_domain_service_factory(app_context)
|
|
54
|
+
|
|
55
|
+
# Create and return the unified application service
|
|
56
|
+
return CodeIndexingApplicationService(
|
|
57
|
+
indexing_domain_service=indexing_domain_service,
|
|
58
|
+
snippet_domain_service=snippet_domain_service,
|
|
59
|
+
source_service=source_service,
|
|
60
|
+
bm25_service=bm25_service,
|
|
61
|
+
code_search_service=code_search_service,
|
|
62
|
+
text_search_service=text_search_service,
|
|
63
|
+
enrichment_service=enrichment_service,
|
|
64
|
+
session=session,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def create_fast_test_code_indexing_application_service(
|
|
69
|
+
app_context: AppContext,
|
|
70
|
+
session: AsyncSession,
|
|
71
|
+
source_service: SourceService,
|
|
72
|
+
) -> CodeIndexingApplicationService:
|
|
73
|
+
"""Create a fast test version of CodeIndexingApplicationService."""
|
|
74
|
+
# Create domain services
|
|
75
|
+
indexing_domain_service = indexing_domain_service_factory(session)
|
|
76
|
+
snippet_domain_service = snippet_domain_service_factory(session)
|
|
77
|
+
bm25_service = BM25DomainService(bm25_repository_factory(app_context, session))
|
|
78
|
+
|
|
79
|
+
# Create fast embedding services using HashEmbeddingProvider
|
|
80
|
+
embedding_repository = SqlAlchemyEmbeddingRepository(session=session)
|
|
81
|
+
|
|
82
|
+
# Fast code search service
|
|
83
|
+
code_search_repository = LocalVectorSearchRepository(
|
|
84
|
+
embedding_repository=embedding_repository,
|
|
85
|
+
embedding_provider=hash_embedding_provider.HashEmbeddingProvider(),
|
|
86
|
+
embedding_type=EmbeddingType.CODE,
|
|
87
|
+
)
|
|
88
|
+
code_search_service = EmbeddingDomainService(
|
|
89
|
+
embedding_provider=hash_embedding_provider.HashEmbeddingProvider(),
|
|
90
|
+
vector_search_repository=code_search_repository,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# Fast text search service
|
|
94
|
+
text_search_repository = LocalVectorSearchRepository(
|
|
95
|
+
embedding_repository=embedding_repository,
|
|
96
|
+
embedding_provider=hash_embedding_provider.HashEmbeddingProvider(),
|
|
97
|
+
embedding_type=EmbeddingType.TEXT,
|
|
98
|
+
)
|
|
99
|
+
text_search_service = EmbeddingDomainService(
|
|
100
|
+
embedding_provider=hash_embedding_provider.HashEmbeddingProvider(),
|
|
101
|
+
vector_search_repository=text_search_repository,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# Fast enrichment service using NullEnrichmentProvider
|
|
105
|
+
enrichment_service = EnrichmentDomainService(
|
|
106
|
+
enrichment_provider=NullEnrichmentProvider()
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Create and return the unified application service
|
|
110
|
+
return CodeIndexingApplicationService(
|
|
111
|
+
indexing_domain_service=indexing_domain_service,
|
|
112
|
+
snippet_domain_service=snippet_domain_service,
|
|
113
|
+
source_service=source_service,
|
|
114
|
+
bm25_service=bm25_service,
|
|
115
|
+
code_search_service=code_search_service,
|
|
116
|
+
text_search_service=text_search_service,
|
|
117
|
+
enrichment_service=enrichment_service,
|
|
118
|
+
session=session,
|
|
119
|
+
)
|