kodit 0.4.3__py3-none-any.whl → 0.5.0__py3-none-any.whl

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 (95) hide show
  1. kodit/_version.py +2 -2
  2. kodit/app.py +53 -23
  3. kodit/application/factories/reporting_factory.py +6 -2
  4. kodit/application/factories/server_factory.py +311 -0
  5. kodit/application/services/code_search_application_service.py +144 -0
  6. kodit/application/services/commit_indexing_application_service.py +543 -0
  7. kodit/application/services/indexing_worker_service.py +13 -44
  8. kodit/application/services/queue_service.py +24 -3
  9. kodit/application/services/reporting.py +0 -2
  10. kodit/application/services/sync_scheduler.py +15 -31
  11. kodit/cli.py +2 -753
  12. kodit/cli_utils.py +2 -9
  13. kodit/config.py +1 -94
  14. kodit/database.py +38 -1
  15. kodit/domain/{entities.py → entities/__init__.py} +50 -195
  16. kodit/domain/entities/git.py +190 -0
  17. kodit/domain/factories/__init__.py +1 -0
  18. kodit/domain/factories/git_repo_factory.py +76 -0
  19. kodit/domain/protocols.py +263 -64
  20. kodit/domain/services/bm25_service.py +5 -1
  21. kodit/domain/services/embedding_service.py +3 -0
  22. kodit/domain/services/git_repository_service.py +429 -0
  23. kodit/domain/services/git_service.py +300 -0
  24. kodit/domain/services/task_status_query_service.py +2 -2
  25. kodit/domain/value_objects.py +83 -114
  26. kodit/infrastructure/api/client/__init__.py +0 -2
  27. kodit/infrastructure/api/v1/__init__.py +0 -4
  28. kodit/infrastructure/api/v1/dependencies.py +92 -46
  29. kodit/infrastructure/api/v1/routers/__init__.py +0 -6
  30. kodit/infrastructure/api/v1/routers/commits.py +271 -0
  31. kodit/infrastructure/api/v1/routers/queue.py +2 -2
  32. kodit/infrastructure/api/v1/routers/repositories.py +282 -0
  33. kodit/infrastructure/api/v1/routers/search.py +31 -14
  34. kodit/infrastructure/api/v1/schemas/__init__.py +0 -24
  35. kodit/infrastructure/api/v1/schemas/commit.py +96 -0
  36. kodit/infrastructure/api/v1/schemas/context.py +2 -0
  37. kodit/infrastructure/api/v1/schemas/repository.py +128 -0
  38. kodit/infrastructure/api/v1/schemas/search.py +12 -9
  39. kodit/infrastructure/api/v1/schemas/snippet.py +58 -0
  40. kodit/infrastructure/api/v1/schemas/tag.py +31 -0
  41. kodit/infrastructure/api/v1/schemas/task_status.py +2 -0
  42. kodit/infrastructure/bm25/local_bm25_repository.py +16 -4
  43. kodit/infrastructure/bm25/vectorchord_bm25_repository.py +68 -52
  44. kodit/infrastructure/cloning/git/git_python_adaptor.py +467 -0
  45. kodit/infrastructure/cloning/git/working_copy.py +1 -1
  46. kodit/infrastructure/embedding/embedding_factory.py +3 -2
  47. kodit/infrastructure/embedding/local_vector_search_repository.py +1 -1
  48. kodit/infrastructure/embedding/vectorchord_vector_search_repository.py +111 -84
  49. kodit/infrastructure/enrichment/litellm_enrichment_provider.py +19 -26
  50. kodit/infrastructure/indexing/fusion_service.py +1 -1
  51. kodit/infrastructure/mappers/git_mapper.py +193 -0
  52. kodit/infrastructure/mappers/snippet_mapper.py +106 -0
  53. kodit/infrastructure/mappers/task_mapper.py +5 -44
  54. kodit/infrastructure/reporting/log_progress.py +8 -5
  55. kodit/infrastructure/reporting/telemetry_progress.py +21 -0
  56. kodit/infrastructure/slicing/slicer.py +32 -31
  57. kodit/infrastructure/sqlalchemy/embedding_repository.py +43 -23
  58. kodit/infrastructure/sqlalchemy/entities.py +394 -158
  59. kodit/infrastructure/sqlalchemy/git_branch_repository.py +263 -0
  60. kodit/infrastructure/sqlalchemy/git_commit_repository.py +337 -0
  61. kodit/infrastructure/sqlalchemy/git_repository.py +252 -0
  62. kodit/infrastructure/sqlalchemy/git_tag_repository.py +257 -0
  63. kodit/infrastructure/sqlalchemy/snippet_v2_repository.py +484 -0
  64. kodit/infrastructure/sqlalchemy/task_repository.py +29 -23
  65. kodit/infrastructure/sqlalchemy/task_status_repository.py +24 -12
  66. kodit/infrastructure/sqlalchemy/unit_of_work.py +10 -14
  67. kodit/mcp.py +12 -30
  68. kodit/migrations/env.py +1 -0
  69. kodit/migrations/versions/04b80f802e0c_foreign_key_review.py +100 -0
  70. kodit/migrations/versions/7f15f878c3a1_add_new_git_entities.py +690 -0
  71. kodit/migrations/versions/f9e5ef5e688f_add_git_commits_number.py +43 -0
  72. kodit/py.typed +0 -0
  73. kodit/utils/dump_openapi.py +7 -4
  74. kodit/utils/path_utils.py +29 -0
  75. {kodit-0.4.3.dist-info → kodit-0.5.0.dist-info}/METADATA +3 -3
  76. kodit-0.5.0.dist-info/RECORD +137 -0
  77. kodit/application/factories/code_indexing_factory.py +0 -195
  78. kodit/application/services/auto_indexing_service.py +0 -99
  79. kodit/application/services/code_indexing_application_service.py +0 -410
  80. kodit/domain/services/index_query_service.py +0 -70
  81. kodit/domain/services/index_service.py +0 -269
  82. kodit/infrastructure/api/client/index_client.py +0 -57
  83. kodit/infrastructure/api/v1/routers/indexes.py +0 -164
  84. kodit/infrastructure/api/v1/schemas/index.py +0 -101
  85. kodit/infrastructure/bm25/bm25_factory.py +0 -28
  86. kodit/infrastructure/cloning/__init__.py +0 -1
  87. kodit/infrastructure/cloning/metadata.py +0 -98
  88. kodit/infrastructure/mappers/index_mapper.py +0 -345
  89. kodit/infrastructure/reporting/tdqm_progress.py +0 -38
  90. kodit/infrastructure/slicing/language_detection_service.py +0 -18
  91. kodit/infrastructure/sqlalchemy/index_repository.py +0 -646
  92. kodit-0.4.3.dist-info/RECORD +0 -125
  93. {kodit-0.4.3.dist-info → kodit-0.5.0.dist-info}/WHEEL +0 -0
  94. {kodit-0.4.3.dist-info → kodit-0.5.0.dist-info}/entry_points.txt +0 -0
  95. {kodit-0.4.3.dist-info → kodit-0.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,43 @@
1
+ # ruff: noqa
2
+ """add git commits number
3
+
4
+ Revision ID: f9e5ef5e688f
5
+ Revises: 04b80f802e0c
6
+ Create Date: 2025-09-23 10:55:15.553741
7
+
8
+ """
9
+
10
+ from typing import Sequence, Union
11
+
12
+ from alembic import op
13
+ import sqlalchemy as sa
14
+
15
+
16
+ # revision identifiers, used by Alembic.
17
+ revision: str = "f9e5ef5e688f"
18
+ down_revision: Union[str, None] = "04b80f802e0c"
19
+ branch_labels: Union[str, Sequence[str], None] = None
20
+ depends_on: Union[str, Sequence[str], None] = None
21
+
22
+
23
+ def upgrade() -> None:
24
+ """Upgrade schema."""
25
+ op.add_column(
26
+ "git_repos",
27
+ sa.Column("num_commits", sa.Integer(), nullable=False, server_default="0"),
28
+ )
29
+ op.add_column(
30
+ "git_repos",
31
+ sa.Column("num_branches", sa.Integer(), nullable=False, server_default="0"),
32
+ )
33
+ op.add_column(
34
+ "git_repos",
35
+ sa.Column("num_tags", sa.Integer(), nullable=False, server_default="0"),
36
+ )
37
+
38
+
39
+ def downgrade() -> None:
40
+ """Downgrade schema."""
41
+ op.drop_column("git_repos", "num_commits")
42
+ op.drop_column("git_repos", "num_branches")
43
+ op.drop_column("git_repos", "num_tags")
kodit/py.typed ADDED
File without changes
@@ -2,6 +2,7 @@
2
2
 
3
3
  import argparse
4
4
  import json
5
+ import re
5
6
  from pathlib import Path
6
7
  from typing import Any
7
8
 
@@ -19,11 +20,13 @@ if __name__ == "__main__":
19
20
 
20
21
  app = import_from_string(args.app)
21
22
  openapi = app.openapi()
22
- version = openapi.get("openapi", "unknown version")
23
23
 
24
- # Remove any dev tags from the version by retaining only the semver part
25
- git_tag = openapi["info"]["version"].split(".")[:3]
26
- openapi["info"]["version"] = ".".join(git_tag)
24
+ # A regex that maches semver only (nothing after the final minor version)
25
+ re_version = re.compile(r"^([\d.]+)(?:.+)$")
26
+ git_tag = re_version.match(openapi["info"]["version"])
27
+ if not git_tag:
28
+ raise ValueError(f"Invalid version: {openapi['info']['version']}")
29
+ openapi["info"]["version"] = git_tag.group(1)
27
30
 
28
31
  output_json_file = Path(args.out_dir) / "openapi.json"
29
32
 
kodit/utils/path_utils.py CHANGED
@@ -1,10 +1,13 @@
1
1
  """Path utilities for Python compatibility."""
2
2
 
3
+ import hashlib
3
4
  import sys
4
5
  from pathlib import Path
5
6
  from urllib.parse import urlparse
6
7
  from urllib.request import url2pathname
7
8
 
9
+ from pydantic import AnyUrl
10
+
8
11
 
9
12
  def path_from_uri(uri: str) -> Path:
10
13
  """Convert a file URI to a Path object.
@@ -52,3 +55,29 @@ def path_from_uri(uri: str) -> Path:
52
55
  path_str = url2pathname(parsed.path)
53
56
 
54
57
  return Path(path_str)
58
+
59
+
60
+ def repo_id_from_uri(sanitized_uri: AnyUrl) -> str:
61
+ """Create a unique id for a repository."""
62
+ # Get the last part of the sanitized remote URI,
63
+ uri_end = clean_end_of_uri(sanitized_uri)
64
+ dir_hash = hashlib.sha256(str(sanitized_uri).encode("utf-8")).hexdigest()[:16]
65
+ return f"{dir_hash}-{uri_end}"
66
+
67
+
68
+ def clean_end_of_uri(sanitized_uri: AnyUrl) -> str:
69
+ """Clean the end of a URI."""
70
+ path = sanitized_uri.path
71
+ if not path:
72
+ path = str(sanitized_uri)
73
+
74
+ # Extract the last part of the path (it might not have any slashes)
75
+ part = path.split("/")[-1]
76
+ if not part:
77
+ part = path
78
+
79
+ # Now get up to the LAST 8 characters of the part, if they exist
80
+ if len(part) > 8:
81
+ part = part[-8:]
82
+
83
+ return part
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kodit
3
- Version: 0.4.3
3
+ Version: 0.5.0
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/
@@ -35,7 +35,7 @@ Requires-Dist: gitpython>=3.1.44
35
35
  Requires-Dist: hf-xet>=1.1.2
36
36
  Requires-Dist: httpx-retries>=0.3.2
37
37
  Requires-Dist: httpx>=0.28.1
38
- Requires-Dist: litellm>=1.75.8
38
+ Requires-Dist: litellm>=1.77.1
39
39
  Requires-Dist: openai==1.99.9
40
40
  Requires-Dist: pathspec>=0.12.1
41
41
  Requires-Dist: pydantic-settings>=2.9.1
@@ -45,8 +45,8 @@ Requires-Dist: rudder-sdk-python>=2.1.4
45
45
  Requires-Dist: sentence-transformers>=4.1.0
46
46
  Requires-Dist: sqlalchemy[asyncio]>=2.0.40
47
47
  Requires-Dist: structlog>=25.3.0
48
- Requires-Dist: tdqm>=0.0.1
49
48
  Requires-Dist: tiktoken>=0.9.0
49
+ Requires-Dist: torch>=2.7.0
50
50
  Requires-Dist: transformers>=4.51.3
51
51
  Requires-Dist: tree-sitter-language-pack>=0.7.3
52
52
  Requires-Dist: tree-sitter>=0.24.0
@@ -0,0 +1,137 @@
1
+ kodit/.gitignore,sha256=ztkjgRwL9Uud1OEi36hGQeDGk3OLK1NfDEO8YqGYy8o,11
2
+ kodit/__init__.py,sha256=aEKHYninUq1yh6jaNfvJBYg-6fenpN132nJt1UU6Jxs,59
3
+ kodit/_version.py,sha256=fvHpBU3KZKRinkriKdtAt3crenOyysELF-M9y3ozg3U,704
4
+ kodit/app.py,sha256=0pNZ7z3ZV4i081Ak1OH1G_AlUCYvBxIa18YM7tHjbYE,5780
5
+ kodit/cli.py,sha256=QSTXIUDxZo3anIONY-grZi9_VSehWoS8QoVJZyOmWPQ,3086
6
+ kodit/cli_utils.py,sha256=umkvt4kWNapk6db6RGz6bmn7oxgDpsW2Vo09MZ37OGg,2430
7
+ kodit/config.py,sha256=dseNZmhYyeK2CF1QVUACQvsYqAI1cTe_NndeX5xSmmQ,7692
8
+ kodit/database.py,sha256=Pjxx0k431_lCqAJwE3FpLfs74qz1l5JFUQX1TD-wgSs,3264
9
+ kodit/log.py,sha256=ZpM0eMo_DVGQqrHxg0VV6dMrN2AAmu_3C0I3G7p2nMw,8828
10
+ kodit/mcp.py,sha256=PwMogCaYwEJ289y_8-LkLQrL00q2vesYRVxix6-4nuE,7166
11
+ kodit/middleware.py,sha256=TiwebNpaEmiP7QRuZrfZcCL51IUefQyNLSPuzVyk8UM,2813
12
+ kodit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ kodit/application/__init__.py,sha256=mH50wTpgP9dhbKztFsL8Dda9Hi18TSnMVxXtpp4aGOA,35
14
+ kodit/application/factories/__init__.py,sha256=bU5CvEnaBePZ7JbkCOp1MGTNP752bnU2uEqmfy5FdRk,37
15
+ kodit/application/factories/reporting_factory.py,sha256=3IpRiAw_olM69db-jbDAtjyGtd6Nh5o8jUJX3-rXCA8,1421
16
+ kodit/application/factories/server_factory.py,sha256=GiUnZS2c4h5EvAFhc4fav_Y9J5Ye6I6N6VBbIX3ejdw,13299
17
+ kodit/application/services/__init__.py,sha256=p5UQNw-H5sxQvs5Etfte93B3cJ1kKW6DNxK34uFvU1E,38
18
+ kodit/application/services/code_search_application_service.py,sha256=sqMgyAw7e2d2FWroaonaL8G1Hwigb-Yku71dut3wOpQ,4963
19
+ kodit/application/services/commit_indexing_application_service.py,sha256=lRNlrLyc9le6BQ5nxcF1W7nl4VP1bNuKHN9vccw4yQE,23346
20
+ kodit/application/services/indexing_worker_service.py,sha256=8J8CaUdPd5nF6MyvJbJQpXeGkP2oClmFjZel1xBXELU,4065
21
+ kodit/application/services/queue_service.py,sha256=nXplzN-nehPEeEvygzjJwWg4oQmu3SPodsZzY1Z3MtE,2509
22
+ kodit/application/services/reporting.py,sha256=cwe-S-UpSOE6xSAEhoD1hi4hSWk1bW3YRLJ7463fIvM,3518
23
+ kodit/application/services/sync_scheduler.py,sha256=Oy4Hw64SBkNmgXEIAJqXNkMM1nVGnwrP70-htrngCOU,2779
24
+ kodit/domain/__init__.py,sha256=TCpg4Xx-oF4mKV91lo4iXqMEfBT1OoRSYnbG-zVWolA,66
25
+ kodit/domain/errors.py,sha256=yIsgCjM_yOFIg8l7l-t7jM8pgeAX4cfPq0owf7iz3DA,106
26
+ kodit/domain/protocols.py,sha256=Y6ZzmCsnZ94_9F-nUOMJRszNWDG6KymtG2jSRXEtTG0,9724
27
+ kodit/domain/value_objects.py,sha256=GmeJ-9uUSBEanLYD5USYvvmge8jl6b2yc9ey_oOYAw8,18007
28
+ kodit/domain/entities/__init__.py,sha256=Wh05xl-8y0j3e7m4KkFcwT7d2R_dlGwphJeOUodDkWw,8633
29
+ kodit/domain/entities/git.py,sha256=b86MtNJgpJbZ_0z3E5oQX5bXNAeeAGnsC4SyH2DPGq0,5970
30
+ kodit/domain/factories/__init__.py,sha256=0JnpqMDhhbuCG4UoEbdc_SM7RfTyOCpotTUB7GN6glU,32
31
+ kodit/domain/factories/git_repo_factory.py,sha256=4yaa-waMbzapNtldHG1oxBVMuI6JB-iMLzf3dzgJm0M,2496
32
+ kodit/domain/services/__init__.py,sha256=Q1GhCK_PqKHYwYE4tkwDz5BIyXkJngLBBOHhzvX8nzo,42
33
+ kodit/domain/services/bm25_service.py,sha256=-E5k0td2Ucs25qygWkJlY0fl7ZckOUe5xZnKYff3hF8,3631
34
+ kodit/domain/services/embedding_service.py,sha256=al-vBd7H9KuCqZTWtC7q8CEDVXaIQhDhvMFV9IxWasU,4663
35
+ kodit/domain/services/enrichment_service.py,sha256=XsXg3nV-KN4rqtC7Zro_ZiZ6RSq-1eA1MG6IDzFGyBA,1316
36
+ kodit/domain/services/git_repository_service.py,sha256=b-zAAFVxU22KKp2ACyKUgOpFKK7uar4PV5mqoN0Vgzk,15534
37
+ kodit/domain/services/git_service.py,sha256=nVQCfXQ8kW-MAAoAd8bgSQmCdgPMVftUh5qd4du_bes,11352
38
+ kodit/domain/services/task_status_query_service.py,sha256=rI93pTMHeycigQryCWkimXSDzRqx_nJOr07UzPAacPE,736
39
+ kodit/infrastructure/__init__.py,sha256=HzEYIjoXnkz_i_MHO2e0sIVYweUcRnl2RpyBiTbMObU,28
40
+ kodit/infrastructure/api/__init__.py,sha256=U0TSMPpHrlj1zbAtleuZjU3nXGwudyMe-veNBgvODwM,34
41
+ kodit/infrastructure/api/client/__init__.py,sha256=8MjEc6cHCqiI-LtIyng3uKD7a2wUaR-QUdIAePYyIRg,292
42
+ kodit/infrastructure/api/client/base.py,sha256=CIx0Cth8u845T1_6Q71Nj8BkXnh9m_v6d7OlJsZQsyQ,3105
43
+ kodit/infrastructure/api/client/exceptions.py,sha256=wK1OGiImIbNW-fz1juOExd5pKmkKK-xDhI_YFj4Q5Ic,401
44
+ kodit/infrastructure/api/client/generated_endpoints.py,sha256=8qhAg_gDuHsH_nKqGLialZCmEEuDDjLtSnEr-za82XU,641
45
+ kodit/infrastructure/api/client/search_client.py,sha256=f4mM5ZJpAuR7w-i9yASbh4SYMxOq7_f4hXgaQesGquI,2614
46
+ kodit/infrastructure/api/middleware/__init__.py,sha256=6m7eE5k5buboJbuzyX5E9-Tf99yNwFaeJF0f_6HwLyM,30
47
+ kodit/infrastructure/api/middleware/auth.py,sha256=QSnMcMLWvfumqN1iG4ePj2vEZb2Dlsgr-WHptkEkkhE,1064
48
+ kodit/infrastructure/api/v1/__init__.py,sha256=xWtkR3UP7daksCXW_Eyvcqsh091OREqfBPnlFs027_o,22
49
+ kodit/infrastructure/api/v1/dependencies.py,sha256=S0U1oY0CH8rQpF685d1eT2TE6KgbCWsav1E4HIss5KQ,4457
50
+ kodit/infrastructure/api/v1/routers/__init__.py,sha256=pz_7kFwHcxztbTiFI-57Q2tCAllI7u0fgTP4rpQeUoQ,22
51
+ kodit/infrastructure/api/v1/routers/commits.py,sha256=ytlzRzUV6nv-g-Q9J1mKOab1DxX7EfFJbOMKxuxyFDE,8856
52
+ kodit/infrastructure/api/v1/routers/queue.py,sha256=srZmOCZqvcCBlDcPYt1ZWhwVhvVWARWJ3Qp4Tn5eK4Y,2148
53
+ kodit/infrastructure/api/v1/routers/repositories.py,sha256=pxdCCMQWAsezkwyj-rNG-eQbtlW8wMaXZwfzHmae3sI,9328
54
+ kodit/infrastructure/api/v1/routers/search.py,sha256=eMlofqcy9xWCsE9ugfBZHtcPo1hb-A06_Xfv4XR3FfY,3187
55
+ kodit/infrastructure/api/v1/schemas/__init__.py,sha256=capaxPe7y28pWj6Pu5hfTOxLnVL9pwW-hJu7ZdN2klw,41
56
+ kodit/infrastructure/api/v1/schemas/commit.py,sha256=UVGkwZNjwUMiitUbFws1_mlZN7IALq99P99HJCg5h2c,1794
57
+ kodit/infrastructure/api/v1/schemas/context.py,sha256=E6gra1uByM8FYmIXlJeaM59j5VhG4M5E9MzgsGWWJHs,317
58
+ kodit/infrastructure/api/v1/schemas/queue.py,sha256=oa4wumWOvGzi53Q3cjwIrQJRoentp5nsQSsaj-l-B4U,652
59
+ kodit/infrastructure/api/v1/schemas/repository.py,sha256=BRVXlajqQDxoi9RGPeO434RQvyxFYTXp68V7L3wwYXE,3192
60
+ kodit/infrastructure/api/v1/schemas/search.py,sha256=IrqPvIH4IA1QBfmWkD33JqhOmhOJVaZRvOfrNjzowCg,5768
61
+ kodit/infrastructure/api/v1/schemas/snippet.py,sha256=--WFiu-6SLevfbDsozo34lGaROOHTrebnVU9VR6bSFs,1181
62
+ kodit/infrastructure/api/v1/schemas/tag.py,sha256=hJSyaokIk3ggytGZjggLjfWQ-2lni21_L_scIh8kFfk,584
63
+ kodit/infrastructure/api/v1/schemas/task_status.py,sha256=9YIyeYuPWVw48lF0qdmnYPaoQtTjKNWmi8EDvaXAgto,1344
64
+ kodit/infrastructure/bm25/__init__.py,sha256=DmGbrEO34FOJy4e685BbyxLA7gPW1eqs2gAxsp6JOuM,34
65
+ kodit/infrastructure/bm25/local_bm25_repository.py,sha256=YE3pUkPS5n1JNu6oSM_HRBOXM8U04HiY8dMMZCf9CMQ,5197
66
+ kodit/infrastructure/bm25/vectorchord_bm25_repository.py,sha256=LjbUPj4nPMb9pdEudThUbZTmQjhxvpN314EzKGpXfi0,8621
67
+ kodit/infrastructure/cloning/git/__init__.py,sha256=20ePcp0qE6BuLsjsv4KYB1DzKhMIMsPXwEqIEZtjTJs,34
68
+ kodit/infrastructure/cloning/git/git_python_adaptor.py,sha256=8gAx_45uuBrC_3yw6Bc78J2xwuTLidw-5sftaQIkEKE,17199
69
+ kodit/infrastructure/cloning/git/working_copy.py,sha256=sPKQN-A1gDVV_QJISNNP4PqxRWxyj5owv5tvWfXMl44,3909
70
+ kodit/infrastructure/embedding/__init__.py,sha256=F-8nLlWAerYJ0MOIA4tbXHLan8bW5rRR84vzxx6tRKI,39
71
+ kodit/infrastructure/embedding/embedding_factory.py,sha256=6nP8HKKlNWmDE8ATT5tNQHgPqeTDUMpRuWwn2rsfrOQ,3446
72
+ kodit/infrastructure/embedding/local_vector_search_repository.py,sha256=urccvadIF-uizmYuzK7ii7hl2HaV7swHCiS8P6n7U18,3507
73
+ kodit/infrastructure/embedding/vectorchord_vector_search_repository.py,sha256=nIcy4DBKM2yb_azKe_N76WpYIMuE1zFtdeZj16NWV6Q,9530
74
+ kodit/infrastructure/embedding/embedding_providers/__init__.py,sha256=qeZ-oAIAxMl5QqebGtO1lq-tHjl_ucAwOXePklcwwGk,34
75
+ kodit/infrastructure/embedding/embedding_providers/batching.py,sha256=a8CL9PX2VLmbeg616fc_lQzfC4BWTVn32m4SEhXpHxc,3279
76
+ kodit/infrastructure/embedding/embedding_providers/hash_embedding_provider.py,sha256=V6OdCuWyQQOvo3OJGRi-gBKDApIcrELydFg7T696P5s,2257
77
+ kodit/infrastructure/embedding/embedding_providers/litellm_embedding_provider.py,sha256=9Q5he_MI8xXENODwCvYCbhVawTjTv1bArGQrmxoWLas,5297
78
+ kodit/infrastructure/embedding/embedding_providers/local_embedding_provider.py,sha256=9aLV1Zg4KMhYWlGRwgAUtswW4aIabNqbsipWhAn64RI,4133
79
+ kodit/infrastructure/enrichment/__init__.py,sha256=8acZKNzql8Fs0lceFu9U3KoUrOptRBtVIxr_Iw6lz3Y,40
80
+ kodit/infrastructure/enrichment/enrichment_factory.py,sha256=NFGY6u9SJ_GOgiB_RtotbQmte0kGFQUymwzZCbbsx34,1530
81
+ kodit/infrastructure/enrichment/litellm_enrichment_provider.py,sha256=SN1l93-dxMvwNSKRkuPgd9dGoebuwur_dVKhHA27xkI,5667
82
+ kodit/infrastructure/enrichment/local_enrichment_provider.py,sha256=6WVVt5Nlq8mDGSRCOTjjVPMDCUyMgW-cxCzZv3WfP7k,4589
83
+ kodit/infrastructure/enrichment/null_enrichment_provider.py,sha256=DhZkJBnkvXg_XSAs-oKiFnKqYFPnmTl3ikdxrqeEfbc,713
84
+ kodit/infrastructure/enrichment/utils.py,sha256=FE9UCuxxzSdoHrmAC8Si2b5D6Nf6kVqgM1yjUVyCvW0,930
85
+ kodit/infrastructure/git/__init__.py,sha256=0iMosFzudj4_xNIMe2SRbV6l5bWqkjnUsZoFsoZFuM8,33
86
+ kodit/infrastructure/git/git_utils.py,sha256=5lH94AcF7Hac4h6kBzo_B9pzC1S6AK2-Dy13gz--Zf0,781
87
+ kodit/infrastructure/ignore/__init__.py,sha256=VzFv8XOzHmsu0MEGnWVSF6KsgqLBmvHlRqAkT1Xb1MY,36
88
+ kodit/infrastructure/ignore/ignore_pattern_provider.py,sha256=zdxun3GodLfXxyssBK8QDUK58xb4fBJ0SKcHUyn3pzM,2131
89
+ kodit/infrastructure/indexing/__init__.py,sha256=7UPRa2jwCAsa0Orsp6PqXSF8iIXJVzXHMFmrKkI9yH8,38
90
+ kodit/infrastructure/indexing/fusion_service.py,sha256=VJiSmE1XujtaZhi1lpkGwjUKdqI-XVRNDSRHOeJWMlo,1790
91
+ kodit/infrastructure/mappers/__init__.py,sha256=QPHOjNreXmBPPovZ6elnYFS0vD-IsmrGl4TT01FCKro,77
92
+ kodit/infrastructure/mappers/git_mapper.py,sha256=AhFqPxGT7ZeFcUui7P1XnqDuVhooSSDoGuzwIDY5CGc,8214
93
+ kodit/infrastructure/mappers/snippet_mapper.py,sha256=aI-ppCzcLGWmDkRZSuLH29T_h_ZAlqHd2fToLjfhzSg,4256
94
+ kodit/infrastructure/mappers/task_mapper.py,sha256=R4-hVJD0-wHP51MbX9yiWSBBdeCJ7UiZZWTJwYp2gK8,1511
95
+ kodit/infrastructure/mappers/task_status_mapper.py,sha256=5lo_jS2EKYg4czOOAFmrWfQl3OojIokwpzhaR3b1wE0,3433
96
+ kodit/infrastructure/reporting/__init__.py,sha256=4Qu38YbDOaeDqLdT_CbK8tOZHTKGrHRXncVKlGRzOeQ,32
97
+ kodit/infrastructure/reporting/db_progress.py,sha256=VVaCKjC_UFwdRptXbBroG9qhXCxI4bZmElf1PMsBzWA,819
98
+ kodit/infrastructure/reporting/log_progress.py,sha256=yhzkjYulEn_sfpKwHKi--HdQHLb4h4uEolhFYqvdHS8,1261
99
+ kodit/infrastructure/reporting/telemetry_progress.py,sha256=uT9mNyF2bQ83a0bQvUAXXsidvTievc16DUYKUN0X4tY,581
100
+ kodit/infrastructure/slicing/__init__.py,sha256=x7cjvHA9Ay2weUYE_dpdAaPaStp20M-4U2b5MLgT5KM,37
101
+ kodit/infrastructure/slicing/slicer.py,sha256=WoYzFIXTvfBfgy4H2Rfn4gku5AjoHtzFjnUK6O4IB3Y,35842
102
+ kodit/infrastructure/sqlalchemy/__init__.py,sha256=UXPMSF_hgWaqr86cawRVqM8XdVNumQyyK5B8B97GnlA,33
103
+ kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=2JCDc-nSau6B3GA-e1rGian5zfJZpgJZ0TbN5hc1nRE,8866
104
+ kodit/infrastructure/sqlalchemy/entities.py,sha256=7Prl-FvdW9BqOaM_sxJ-bbDdgjnJsUCK3P7uiM3WYzo,17829
105
+ kodit/infrastructure/sqlalchemy/git_branch_repository.py,sha256=UweUWquXUNrcOXfwx_VRoVfJHhNbBYNmyZV8CdflNbU,10915
106
+ kodit/infrastructure/sqlalchemy/git_commit_repository.py,sha256=Wpj3Orv04iCFwcc-b1e6GNNH1Nv2MD1qzp2aEB5aq5s,13775
107
+ kodit/infrastructure/sqlalchemy/git_repository.py,sha256=QrauLT4ZUBAojnMMD9paMqskEalnmuIVCSubySgLxNM,10070
108
+ kodit/infrastructure/sqlalchemy/git_tag_repository.py,sha256=bi9uJpEFLwjpCJ-IGxKUuDfF-9HHG-z2bMOpV81iWRM,10343
109
+ kodit/infrastructure/sqlalchemy/snippet_v2_repository.py,sha256=B4TVjx1pRdPVJAX90XoVjC5i7jDEXPebrac2J3_Zqlw,19634
110
+ kodit/infrastructure/sqlalchemy/task_repository.py,sha256=ZrPKxw0IbIcfcP_AOtyEJ8TDhVjODTI5xQg5ZhGkF8M,4072
111
+ kodit/infrastructure/sqlalchemy/task_status_repository.py,sha256=WouXNu8iZSzaKPqKXrUOEO_lskHbPtt4_kEgmjaiZcU,4014
112
+ kodit/infrastructure/sqlalchemy/unit_of_work.py,sha256=MAF8sBr-T5crSWx1wvjf00xboPNz9YMyzRfaKSLCbzQ,1970
113
+ kodit/migrations/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
114
+ kodit/migrations/__init__.py,sha256=lP5MuwlyWRMO6UcDWnQcQ3G-GYHcFb6rl9gYPHJ1sjo,40
115
+ kodit/migrations/env.py,sha256=7lJWv-fp2bV9Mb4dfgVh1h0IYGq3YQJaZuNdiBT7WmY,2394
116
+ kodit/migrations/script.py.mako,sha256=zWziKtiwYKEWuwPV_HBNHwa9LCT45_bi01-uSNFaOOE,703
117
+ kodit/migrations/versions/04b80f802e0c_foreign_key_review.py,sha256=zZjiRLx16JBVOOuY912S_rest83kgnEN3AXM3TCPdOs,4129
118
+ kodit/migrations/versions/4073b33f9436_add_file_processing_flag.py,sha256=c8dMcKQ-BBBr_2-92eJZFS3Fwe3__B2eNqvQeMZHs0w,917
119
+ kodit/migrations/versions/4552eb3f23ce_add_summary.py,sha256=WjyBQzFK8IXuvta15YBE23yaTMM1rZCXvPxW98MStng,870
120
+ kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py,sha256=JL6lxaYtGbXolrkNEujg5SWj3_aQBWReYP3I4vcibdo,1755
121
+ kodit/migrations/versions/7f15f878c3a1_add_new_git_entities.py,sha256=6RoJPwSZT_jfzhCR09lXGz9haYpvzKVeS1aZSh00TCA,25269
122
+ kodit/migrations/versions/85155663351e_initial.py,sha256=h8DWmSxVwTtWlmWNH8-S4AxfEIbCm_iWtR6Kg5psPnk,3605
123
+ kodit/migrations/versions/9cf0e87de578_add_queue.py,sha256=FYrco38f3_-1ZRfGOU617bgR1Ta0YTwwz3QDQMw_NKY,1600
124
+ kodit/migrations/versions/9e53ea8bb3b0_add_authors.py,sha256=a32Zm8KUQyiiLkjKNPYdaJDgjW6VsV-GhaLnPnK_fpI,3884
125
+ kodit/migrations/versions/__init__.py,sha256=9-lHzptItTzq_fomdIRBegQNm4Znx6pVjwD4MiqRIdo,36
126
+ kodit/migrations/versions/b9cd1c3fd762_add_task_status.py,sha256=7cgdMKu4OBidL0ER8AGgyerfSfEk1I3XHo6Kh0sCzIQ,2754
127
+ kodit/migrations/versions/c3f5137d30f5_index_all_the_things.py,sha256=r7ukmJ_axXLAWewYx-F1fEmZ4JbtFd37i7cSb0tq3y0,1722
128
+ kodit/migrations/versions/f9e5ef5e688f_add_git_commits_number.py,sha256=tI2GoZthhdXm8yyZqnpmfuFoUqbXDKh-tpbPHfJrXco,1078
129
+ kodit/utils/__init__.py,sha256=DPEB1i8evnLF4Ns3huuAYg-0pKBFKUFuiDzOKG9r-sw,33
130
+ kodit/utils/dump_openapi.py,sha256=0zjNvR03K97al5_Yjpn8yPjCjmAY_xrBJLhAp4_TLGs,1348
131
+ kodit/utils/generate_api_paths.py,sha256=TMtx9v55podDfUmiWaHgJHLtEWLV2sLL-5ejGFMPzAo,3569
132
+ kodit/utils/path_utils.py,sha256=UB_81rx7Y1G1jalVv2PX8miwaprBbcqEdtoQ3hPT3kU,2451
133
+ kodit-0.5.0.dist-info/METADATA,sha256=IlJ3uKktEFtQl_-eDiqj8KYCiYGEb_EeBMN2a6HfG9Q,7703
134
+ kodit-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
135
+ kodit-0.5.0.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
136
+ kodit-0.5.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
137
+ kodit-0.5.0.dist-info/RECORD,,
@@ -1,195 +0,0 @@
1
- """Factory for creating the unified code indexing application service."""
2
-
3
- from collections.abc import Callable
4
-
5
- from sqlalchemy.ext.asyncio import AsyncSession
6
-
7
- from kodit.application.factories.reporting_factory import (
8
- create_cli_operation,
9
- create_noop_operation,
10
- create_server_operation,
11
- )
12
- from kodit.application.services.code_indexing_application_service import (
13
- CodeIndexingApplicationService,
14
- )
15
- from kodit.application.services.reporting import (
16
- ProgressTracker,
17
- )
18
- from kodit.config import AppContext
19
- from kodit.domain.services.bm25_service import BM25DomainService
20
- from kodit.domain.services.embedding_service import EmbeddingDomainService
21
- from kodit.domain.services.enrichment_service import EnrichmentDomainService
22
- from kodit.domain.services.index_query_service import IndexQueryService
23
- from kodit.domain.services.index_service import (
24
- IndexDomainService,
25
- )
26
- from kodit.domain.value_objects import LanguageMapping
27
- from kodit.infrastructure.bm25.bm25_factory import bm25_repository_factory
28
- from kodit.infrastructure.embedding.embedding_factory import (
29
- embedding_domain_service_factory,
30
- )
31
- from kodit.infrastructure.embedding.embedding_providers.hash_embedding_provider import (
32
- HashEmbeddingProvider,
33
- )
34
- from kodit.infrastructure.embedding.local_vector_search_repository import (
35
- LocalVectorSearchRepository,
36
- )
37
- from kodit.infrastructure.enrichment.enrichment_factory import (
38
- enrichment_domain_service_factory,
39
- )
40
- from kodit.infrastructure.enrichment.null_enrichment_provider import (
41
- NullEnrichmentProvider,
42
- )
43
- from kodit.infrastructure.indexing.fusion_service import ReciprocalRankFusionService
44
- from kodit.infrastructure.slicing.language_detection_service import (
45
- FileSystemLanguageDetectionService,
46
- )
47
- from kodit.infrastructure.sqlalchemy.embedding_repository import (
48
- create_embedding_repository,
49
- )
50
- from kodit.infrastructure.sqlalchemy.entities import EmbeddingType
51
- from kodit.infrastructure.sqlalchemy.index_repository import (
52
- create_index_repository,
53
- )
54
- from kodit.infrastructure.sqlalchemy.task_status_repository import (
55
- create_task_status_repository,
56
- )
57
-
58
-
59
- def create_code_indexing_application_service(
60
- app_context: AppContext,
61
- session_factory: Callable[[], AsyncSession],
62
- operation: ProgressTracker,
63
- ) -> CodeIndexingApplicationService:
64
- """Create a unified code indexing application service with all dependencies."""
65
- # Create domain services
66
- bm25_service = BM25DomainService(
67
- bm25_repository_factory(app_context, session_factory())
68
- )
69
- code_search_service = embedding_domain_service_factory(
70
- "code", app_context, session_factory(), session_factory
71
- )
72
- text_search_service = embedding_domain_service_factory(
73
- "text", app_context, session_factory(), session_factory
74
- )
75
- enrichment_service = enrichment_domain_service_factory(app_context)
76
- index_repository = create_index_repository(session_factory=session_factory)
77
- # Use the unified language mapping from the domain layer
78
- language_map = LanguageMapping.get_extension_to_language_map()
79
-
80
- # Create infrastructure services
81
- language_detector = FileSystemLanguageDetectionService(language_map)
82
-
83
- index_domain_service = IndexDomainService(
84
- language_detector=language_detector,
85
- enrichment_service=enrichment_service,
86
- clone_dir=app_context.get_clone_dir(),
87
- )
88
- index_query_service = IndexQueryService(
89
- index_repository=index_repository,
90
- fusion_service=ReciprocalRankFusionService(),
91
- )
92
-
93
- # Create and return the unified application service
94
- return CodeIndexingApplicationService(
95
- indexing_domain_service=index_domain_service,
96
- index_repository=index_repository,
97
- index_query_service=index_query_service,
98
- bm25_service=bm25_service,
99
- code_search_service=code_search_service,
100
- text_search_service=text_search_service,
101
- enrichment_service=enrichment_service,
102
- operation=operation,
103
- )
104
-
105
-
106
- def create_cli_code_indexing_application_service(
107
- app_context: AppContext,
108
- session_factory: Callable[[], AsyncSession],
109
- ) -> CodeIndexingApplicationService:
110
- """Create a CLI code indexing application service."""
111
- return create_code_indexing_application_service(
112
- app_context,
113
- session_factory,
114
- create_cli_operation(),
115
- )
116
-
117
-
118
- def create_server_code_indexing_application_service(
119
- app_context: AppContext,
120
- session_factory: Callable[[], AsyncSession],
121
- ) -> CodeIndexingApplicationService:
122
- """Create a server code indexing application service."""
123
- return create_code_indexing_application_service(
124
- app_context,
125
- session_factory,
126
- create_server_operation(create_task_status_repository(session_factory)),
127
- )
128
-
129
-
130
- def create_fast_test_code_indexing_application_service(
131
- app_context: AppContext,
132
- session_factory: Callable[[], AsyncSession],
133
- ) -> CodeIndexingApplicationService:
134
- """Create a fast test code indexing application service."""
135
- # Create domain services
136
- bm25_service = BM25DomainService(
137
- bm25_repository_factory(app_context, session_factory())
138
- )
139
- embedding_repository = create_embedding_repository(session_factory=session_factory)
140
- operation = create_noop_operation()
141
-
142
- code_search_repository = LocalVectorSearchRepository(
143
- embedding_repository=embedding_repository,
144
- embedding_provider=HashEmbeddingProvider(),
145
- embedding_type=EmbeddingType.CODE,
146
- )
147
- code_search_service = EmbeddingDomainService(
148
- embedding_provider=HashEmbeddingProvider(),
149
- vector_search_repository=code_search_repository,
150
- )
151
-
152
- # Fast text search service
153
- text_search_repository = LocalVectorSearchRepository(
154
- embedding_repository=embedding_repository,
155
- embedding_provider=HashEmbeddingProvider(),
156
- embedding_type=EmbeddingType.TEXT,
157
- )
158
- text_search_service = EmbeddingDomainService(
159
- embedding_provider=HashEmbeddingProvider(),
160
- vector_search_repository=text_search_repository,
161
- )
162
-
163
- # Fast enrichment service using NullEnrichmentProvider
164
- enrichment_service = EnrichmentDomainService(
165
- enrichment_provider=NullEnrichmentProvider()
166
- )
167
-
168
- index_repository = create_index_repository(session_factory=session_factory)
169
- # Use the unified language mapping from the domain layer
170
- language_map = LanguageMapping.get_extension_to_language_map()
171
-
172
- # Create infrastructure services
173
- language_detector = FileSystemLanguageDetectionService(language_map)
174
-
175
- index_domain_service = IndexDomainService(
176
- language_detector=language_detector,
177
- enrichment_service=enrichment_service,
178
- clone_dir=app_context.get_clone_dir(),
179
- )
180
- index_query_service = IndexQueryService(
181
- index_repository=index_repository,
182
- fusion_service=ReciprocalRankFusionService(),
183
- )
184
-
185
- # Create and return the unified application service
186
- return CodeIndexingApplicationService(
187
- indexing_domain_service=index_domain_service,
188
- index_repository=index_repository,
189
- index_query_service=index_query_service,
190
- bm25_service=bm25_service,
191
- code_search_service=code_search_service,
192
- text_search_service=text_search_service,
193
- enrichment_service=enrichment_service,
194
- operation=operation,
195
- )
@@ -1,99 +0,0 @@
1
- """Service for automatically indexing configured sources."""
2
-
3
- import asyncio
4
- import warnings
5
- from collections.abc import Callable
6
- from contextlib import suppress
7
-
8
- import structlog
9
- from sqlalchemy.ext.asyncio import AsyncSession
10
-
11
- from kodit.application.factories.code_indexing_factory import (
12
- create_code_indexing_application_service,
13
- )
14
- from kodit.application.factories.reporting_factory import create_noop_operation
15
- from kodit.application.services.queue_service import QueueService
16
- from kodit.application.services.reporting import ProgressTracker
17
- from kodit.config import AppContext
18
- from kodit.domain.entities import Task
19
- from kodit.domain.value_objects import QueuePriority
20
-
21
-
22
- class AutoIndexingService:
23
- """Service for automatically indexing configured sources."""
24
-
25
- def __init__(
26
- self,
27
- app_context: AppContext,
28
- session_factory: Callable[[], AsyncSession],
29
- ) -> None:
30
- """Initialize the auto-indexing service."""
31
- self.app_context = app_context
32
- self.session_factory = session_factory
33
- self.log = structlog.get_logger(__name__)
34
- self._indexing_task: asyncio.Task | None = None
35
-
36
- async def start_background_indexing(
37
- self, operation: ProgressTracker | None = None
38
- ) -> None:
39
- """Start background indexing of configured sources."""
40
- operation = operation or create_noop_operation()
41
- if (
42
- not self.app_context.auto_indexing
43
- or len(self.app_context.auto_indexing.sources) == 0
44
- ):
45
- self.log.info("Auto-indexing is disabled (no sources configured)")
46
- return
47
-
48
- warnings.warn(
49
- "Auto-indexing is deprecated and will be removed in a future version, please use the API to index sources.", # noqa: E501
50
- DeprecationWarning,
51
- stacklevel=2,
52
- )
53
-
54
- auto_sources = [source.uri for source in self.app_context.auto_indexing.sources]
55
- self.log.info("Starting background indexing", num_sources=len(auto_sources))
56
- self._indexing_task = asyncio.create_task(
57
- self._index_sources(auto_sources, operation)
58
- )
59
-
60
- async def _index_sources(
61
- self, sources: list[str], operation: ProgressTracker | None = None
62
- ) -> None:
63
- """Index all configured sources in the background."""
64
- operation = operation or create_noop_operation()
65
- queue_service = QueueService(session_factory=self.session_factory)
66
- service = create_code_indexing_application_service(
67
- app_context=self.app_context,
68
- session_factory=self.session_factory,
69
- operation=operation,
70
- )
71
-
72
- for source in sources:
73
- try:
74
- # Only auto-index a source if it is new
75
- if await service.does_index_exist(source):
76
- self.log.info("Index already exists, skipping", source=source)
77
- continue
78
-
79
- self.log.info("Adding auto-indexing task to queue", source=source)
80
-
81
- # Create index
82
- index = await service.create_index_from_uri(source)
83
-
84
- await queue_service.enqueue_task(
85
- Task.create_index_update_task(index.id, QueuePriority.BACKGROUND)
86
- )
87
-
88
- except Exception as exc:
89
- self.log.exception(
90
- "Failed to auto-index source", source=source, error=str(exc)
91
- )
92
- # Continue with other sources even if one fails
93
-
94
- async def stop(self) -> None:
95
- """Stop background indexing."""
96
- if self._indexing_task:
97
- self._indexing_task.cancel()
98
- with suppress(asyncio.CancelledError):
99
- await self._indexing_task