kodit 0.3.1__py3-none-any.whl → 0.3.3__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 (57) hide show
  1. kodit/_version.py +2 -2
  2. kodit/application/factories/code_indexing_factory.py +77 -28
  3. kodit/application/services/code_indexing_application_service.py +148 -119
  4. kodit/cli.py +49 -52
  5. kodit/domain/entities.py +268 -189
  6. kodit/domain/protocols.py +61 -0
  7. kodit/domain/services/embedding_service.py +1 -1
  8. kodit/domain/services/index_query_service.py +66 -0
  9. kodit/domain/services/index_service.py +323 -0
  10. kodit/domain/value_objects.py +225 -92
  11. kodit/infrastructure/cloning/git/working_copy.py +17 -8
  12. kodit/infrastructure/cloning/metadata.py +37 -67
  13. kodit/infrastructure/embedding/embedding_factory.py +1 -1
  14. kodit/infrastructure/embedding/local_vector_search_repository.py +1 -1
  15. kodit/infrastructure/embedding/vectorchord_vector_search_repository.py +1 -1
  16. kodit/infrastructure/enrichment/null_enrichment_provider.py +4 -10
  17. kodit/infrastructure/git/git_utils.py +1 -63
  18. kodit/infrastructure/ignore/ignore_pattern_provider.py +1 -2
  19. kodit/infrastructure/indexing/auto_indexing_service.py +2 -12
  20. kodit/infrastructure/indexing/fusion_service.py +1 -1
  21. kodit/infrastructure/mappers/__init__.py +1 -0
  22. kodit/infrastructure/mappers/index_mapper.py +344 -0
  23. kodit/infrastructure/snippet_extraction/factories.py +13 -0
  24. kodit/infrastructure/snippet_extraction/language_detection_service.py +1 -1
  25. kodit/infrastructure/snippet_extraction/snippet_query_provider.py +0 -1
  26. kodit/infrastructure/snippet_extraction/tree_sitter_snippet_extractor.py +1 -1
  27. kodit/infrastructure/sqlalchemy/embedding_repository.py +1 -1
  28. kodit/infrastructure/sqlalchemy/entities.py +203 -0
  29. kodit/infrastructure/sqlalchemy/file_repository.py +1 -1
  30. kodit/infrastructure/sqlalchemy/index_repository.py +550 -0
  31. kodit/log.py +4 -1
  32. kodit/mcp.py +1 -13
  33. kodit/migrations/env.py +1 -1
  34. kodit/migrations/versions/4073b33f9436_add_file_processing_flag.py +34 -0
  35. kodit/migrations/versions/4552eb3f23ce_add_summary.py +34 -0
  36. kodit/utils/__init__.py +1 -0
  37. kodit/utils/path_utils.py +54 -0
  38. {kodit-0.3.1.dist-info → kodit-0.3.3.dist-info}/METADATA +1 -1
  39. {kodit-0.3.1.dist-info → kodit-0.3.3.dist-info}/RECORD +42 -45
  40. kodit/domain/enums.py +0 -9
  41. kodit/domain/repositories.py +0 -128
  42. kodit/domain/services/ignore_service.py +0 -45
  43. kodit/domain/services/indexing_service.py +0 -204
  44. kodit/domain/services/snippet_extraction_service.py +0 -89
  45. kodit/domain/services/snippet_service.py +0 -211
  46. kodit/domain/services/source_service.py +0 -85
  47. kodit/infrastructure/cloning/folder/__init__.py +0 -1
  48. kodit/infrastructure/cloning/folder/factory.py +0 -128
  49. kodit/infrastructure/cloning/folder/working_copy.py +0 -38
  50. kodit/infrastructure/cloning/git/factory.py +0 -153
  51. kodit/infrastructure/indexing/index_repository.py +0 -273
  52. kodit/infrastructure/indexing/snippet_domain_service_factory.py +0 -37
  53. kodit/infrastructure/sqlalchemy/repository.py +0 -133
  54. kodit/infrastructure/sqlalchemy/snippet_repository.py +0 -251
  55. {kodit-0.3.1.dist-info → kodit-0.3.3.dist-info}/WHEEL +0 -0
  56. {kodit-0.3.1.dist-info → kodit-0.3.3.dist-info}/entry_points.txt +0 -0
  57. {kodit-0.3.1.dist-info → kodit-0.3.3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,54 @@
1
+ """Path utilities for Python compatibility."""
2
+
3
+ import sys
4
+ from pathlib import Path
5
+ from urllib.parse import urlparse
6
+ from urllib.request import url2pathname
7
+
8
+
9
+ def path_from_uri(uri: str) -> Path:
10
+ """Convert a file URI to a Path object.
11
+
12
+ This provides backwards compatibility for Path.from_uri which is only
13
+ available in Python 3.13+.
14
+
15
+ Args:
16
+ uri: File URI string (e.g., "file:///path/to/file")
17
+
18
+ Returns:
19
+ Path object representing the file path
20
+
21
+ Raises:
22
+ ValueError: If the URI is not a valid file URI
23
+
24
+ """
25
+ if sys.version_info >= (3, 13):
26
+ # For Python 3.13+, delegate to the standard library but catch its ValueError
27
+ # and re-raise with our format for consistency
28
+ try:
29
+ return Path.from_uri(uri)
30
+ except ValueError as e:
31
+ # Re-parse to get our own error format
32
+ parsed = urlparse(uri)
33
+ if not parsed.scheme:
34
+ raise ValueError("Expected file URI, got scheme: ") from e
35
+ if parsed.scheme != "file":
36
+ raise ValueError(
37
+ f"Expected file URI, got scheme: {parsed.scheme}"
38
+ ) from e
39
+ # Re-raise original error if it's something else
40
+ raise
41
+
42
+ # Manual implementation for Python 3.12 and earlier
43
+ parsed = urlparse(uri)
44
+
45
+ if not parsed.scheme:
46
+ raise ValueError("Expected file URI, got scheme: ")
47
+
48
+ if parsed.scheme != "file":
49
+ raise ValueError(f"Expected file URI, got scheme: {parsed.scheme}")
50
+
51
+ # Convert URL path to local path
52
+ path_str = url2pathname(parsed.path)
53
+
54
+ return Path(path_str)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kodit
3
- Version: 0.3.1
3
+ Version: 0.3.3
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/
@@ -1,52 +1,44 @@
1
1
  kodit/.gitignore,sha256=ztkjgRwL9Uud1OEi36hGQeDGk3OLK1NfDEO8YqGYy8o,11
2
2
  kodit/__init__.py,sha256=aEKHYninUq1yh6jaNfvJBYg-6fenpN132nJt1UU6Jxs,59
3
- kodit/_version.py,sha256=lOWWIGJeBi0KkFopWU_n3GH71C1PsaZ-ZYDfxFkne6c,511
3
+ kodit/_version.py,sha256=cRYgYV4ttw-FMlrA4-5pzcSpTjS7X8uVa-nRTEADKW4,511
4
4
  kodit/app.py,sha256=uv67TE83fZE7wrA7cz-sKosFrAXlKRr1B7fT-X_gMZQ,2103
5
- kodit/cli.py,sha256=fGk2VMJDrgaj0T9w-97Xh6LVqus6vVehWJUTkjgWtyk,16013
5
+ kodit/cli.py,sha256=xh2MNA4sUTA3_yVbHGz-CRpbS0TTzKwf33XbScA74Gw,16626
6
6
  kodit/config.py,sha256=VUoUi2t2yGhqOtm5MSZuaasNSklH50hfWn6GOrz3jnU,7518
7
7
  kodit/database.py,sha256=kI9yBm4uunsgV4-QeVoCBL0wLzU4kYmYv5qZilGnbPE,1740
8
- kodit/log.py,sha256=sHPHYetlMcKTor2VaFLMyao1_fZ_xhuzqXCAt5F5UMU,8575
9
- kodit/mcp.py,sha256=4rvj76SUbO-FfoJgOY31CR5r0y0VxMAKkVKNuKLgwB0,6431
8
+ kodit/log.py,sha256=WOsLRitpCBtJa5IcsyZpKr146kXXHK2nU5VA90gcJdQ,8736
9
+ kodit/mcp.py,sha256=OPscMbGQ05nFHJ_UkntobocZ6Y9wO2ZyRx1tVj7XSsY,6016
10
10
  kodit/middleware.py,sha256=I6FOkqG9-8RH5kR1-0ZoQWfE4qLCB8lZYv8H_OCH29o,2714
11
11
  kodit/reporting.py,sha256=icce1ZyiADsA_Qz-mSjgn2H4SSqKuGfLKnw-yrl9nsg,2722
12
12
  kodit/application/__init__.py,sha256=mH50wTpgP9dhbKztFsL8Dda9Hi18TSnMVxXtpp4aGOA,35
13
13
  kodit/application/factories/__init__.py,sha256=bU5CvEnaBePZ7JbkCOp1MGTNP752bnU2uEqmfy5FdRk,37
14
- kodit/application/factories/code_indexing_factory.py,sha256=pyGcTmqhBRjw0tDvp5UpG0roBf3ROqYvBcHyvaLZ-qQ,4927
14
+ kodit/application/factories/code_indexing_factory.py,sha256=VV-die0zKogN73ldLJtghI9CVtv77TAlgLOVARscWmk,6764
15
15
  kodit/application/services/__init__.py,sha256=p5UQNw-H5sxQvs5Etfte93B3cJ1kKW6DNxK34uFvU1E,38
16
- kodit/application/services/code_indexing_application_service.py,sha256=HGaZDZG0GPLxxQ1-GUgeEx_AsZhG0FAtdUugoD68uI0,12521
16
+ kodit/application/services/code_indexing_application_service.py,sha256=xykcpLBS-5hZrFca2vakuVqdlZ4sbj26FLaViFC3N5c,14247
17
17
  kodit/domain/__init__.py,sha256=TCpg4Xx-oF4mKV91lo4iXqMEfBT1OoRSYnbG-zVWolA,66
18
- kodit/domain/entities.py,sha256=fErA9ZTAqlofkqhBte8FOnV0PHf1MUORb37bW0-Dgc4,5624
19
- kodit/domain/enums.py,sha256=Ik_h3D3eZ0FsSlPsU0ikm-Yv3Rmvzicffi9yBn19UIE,191
18
+ kodit/domain/entities.py,sha256=Mcku1Wmk3Xl3YJhY65_RoiLeffOLKOHI0uCAXWJrmvQ,8698
20
19
  kodit/domain/errors.py,sha256=yIsgCjM_yOFIg8l7l-t7jM8pgeAX4cfPq0owf7iz3DA,106
21
20
  kodit/domain/interfaces.py,sha256=Jkd0Ob4qSvhZHI9jRPFQ1n5Cv0SvU-y3Z-HCw2ikc4I,742
22
- kodit/domain/repositories.py,sha256=KAIx_-qZD68pAByc1JNVxSCRLjseayHKn5ykqsE6uWw,3781
23
- kodit/domain/value_objects.py,sha256=7OtjtgdVB0rhWwezJB_-A6cCqk_ijmkefMRv2ql5AQ0,13479
21
+ kodit/domain/protocols.py,sha256=L94FwChhCoj39xicaVrK2UFhFbPzi5JEXW_KmgODsLA,1859
22
+ kodit/domain/value_objects.py,sha256=lNmbz9m39bP62lYvo6mQa-XzeYiQ7uFIZt-E6LUj0L4,17679
24
23
  kodit/domain/services/__init__.py,sha256=Q1GhCK_PqKHYwYE4tkwDz5BIyXkJngLBBOHhzvX8nzo,42
25
24
  kodit/domain/services/bm25_service.py,sha256=nsfTan3XtDwXuuAu1LUv-6Jukm6qFKVqqCVymjyepZQ,3625
26
- kodit/domain/services/embedding_service.py,sha256=Wh6Y2NR_GRnud8dq1Q7S6F40aNe-S2UyD5Nqz9LChTM,4507
25
+ kodit/domain/services/embedding_service.py,sha256=7drYRC2kjg0WJmo06a2E9N0vDnwInUlBB96twjz2BT8,4526
27
26
  kodit/domain/services/enrichment_service.py,sha256=XsXg3nV-KN4rqtC7Zro_ZiZ6RSq-1eA1MG6IDzFGyBA,1316
28
- kodit/domain/services/ignore_service.py,sha256=boEN-IRLmUtwO9ZnuACaVFZbIKrtUG8YwnsXKEDIG28,1136
29
- kodit/domain/services/indexing_service.py,sha256=vBjg9G75XoNfwH7m43l16zEmKdemHkzrgwunguiWix8,5911
30
- kodit/domain/services/snippet_extraction_service.py,sha256=QW_99bXWpr8g6ZI-hp4Aj57VCSrUf71dLwQca5T6pyg,3065
31
- kodit/domain/services/snippet_service.py,sha256=OyiDPJx5O2I1EyYnH_W-rvggti0DUefp4JaKIblHhR8,6867
32
- kodit/domain/services/source_service.py,sha256=9XGS3imJn65v855cztsJSaaFod6LhkF2xfUVMaytx-A,3068
27
+ kodit/domain/services/index_query_service.py,sha256=02UWfyB_HoHUskunGuHeq5XwQLSWxGSK4OhvxcqIfY0,2022
28
+ kodit/domain/services/index_service.py,sha256=lsHkiRJfJbBVuMMzM5TG6Z6EiT42RDwlXGKKHBLo8B4,12533
33
29
  kodit/infrastructure/__init__.py,sha256=HzEYIjoXnkz_i_MHO2e0sIVYweUcRnl2RpyBiTbMObU,28
34
30
  kodit/infrastructure/bm25/__init__.py,sha256=DmGbrEO34FOJy4e685BbyxLA7gPW1eqs2gAxsp6JOuM,34
35
31
  kodit/infrastructure/bm25/bm25_factory.py,sha256=I4eo7qRslnyXIRkBf-StZ5ga2Evrr5J5YFocTChFD3g,884
36
32
  kodit/infrastructure/bm25/local_bm25_repository.py,sha256=B1ggfHdjC9sFIh62MmSul2tsutWsWFQx5S1Xn07X_I8,4531
37
33
  kodit/infrastructure/bm25/vectorchord_bm25_repository.py,sha256=Jyic55V-38XeTad462Ge751iKyc0X8RNVBM9pr_DVJk,7439
38
34
  kodit/infrastructure/cloning/__init__.py,sha256=IzIvX-yeRRFZ-lfvPVSEe_qXszO6DGQdjKwwDigexyQ,30
39
- kodit/infrastructure/cloning/metadata.py,sha256=Z8Vtr7Nl5UuS7NZYf9Aooedr8SMk4nEkBjNUPyaPMVQ,4342
40
- kodit/infrastructure/cloning/folder/__init__.py,sha256=w6ykrVtbYJlUDEXAjqgf6w2rMsUMCrrpIbl3QMjubgY,37
41
- kodit/infrastructure/cloning/folder/factory.py,sha256=vl1hwnYA7lczjotn2fahJQAt7IK96CSArx8cSaRFKeY,4242
42
- kodit/infrastructure/cloning/folder/working_copy.py,sha256=FPhwzuPj40yGoYvwcm9VG8mv8MbJxwfby_N5JS-_daA,1154
35
+ kodit/infrastructure/cloning/metadata.py,sha256=GD2UnCC1oR82RD0SVUqk9CJOqzXPxhOAHVOp7jqN6Qc,3571
43
36
  kodit/infrastructure/cloning/git/__init__.py,sha256=20ePcp0qE6BuLsjsv4KYB1DzKhMIMsPXwEqIEZtjTJs,34
44
- kodit/infrastructure/cloning/git/factory.py,sha256=cY0cxapp0NCvjMRpzesW_qRzbWbh-tMKIeAj0Eodyhw,5409
45
- kodit/infrastructure/cloning/git/working_copy.py,sha256=IwXQ0Ta59ykVkrxAyhJk0ijOO6aaub7UI-bXFDyNT0k,1562
37
+ kodit/infrastructure/cloning/git/working_copy.py,sha256=SvaLAJa7FRsLuWjJz-xUeTJ-EkpPi_rIOP-gyuHLIdM,1835
46
38
  kodit/infrastructure/embedding/__init__.py,sha256=F-8nLlWAerYJ0MOIA4tbXHLan8bW5rRR84vzxx6tRKI,39
47
- kodit/infrastructure/embedding/embedding_factory.py,sha256=1AypjhWJGxvLnZt1SEH_FHPk9P0Vkt9fXdSGzFPp2ow,3432
48
- kodit/infrastructure/embedding/local_vector_search_repository.py,sha256=cEclb0tllFDsFBMKUUh8sL4FXFId1Nymh8WTqIORfow,3486
49
- kodit/infrastructure/embedding/vectorchord_vector_search_repository.py,sha256=BFB9txeoNKHkuB0PJA-mZ2zi78zJogW9XvAQzIFeroA,8011
39
+ kodit/infrastructure/embedding/embedding_factory.py,sha256=A6if4XW7Kp-23qrWlLLNyhijwxZLxmhcyCX-ayvQKY4,3451
40
+ kodit/infrastructure/embedding/local_vector_search_repository.py,sha256=ExweyNEL5cP-g3eDhGqZSih7zhdOrop2WdFPPJL-tB4,3505
41
+ kodit/infrastructure/embedding/vectorchord_vector_search_repository.py,sha256=PIoU0HsDlaoXDXnGjOR0LAkAcW4JiE3ymJy_SBhEopc,8030
50
42
  kodit/infrastructure/embedding/embedding_providers/__init__.py,sha256=qeZ-oAIAxMl5QqebGtO1lq-tHjl_ucAwOXePklcwwGk,34
51
43
  kodit/infrastructure/embedding/embedding_providers/batching.py,sha256=a8CL9PX2VLmbeg616fc_lQzfC4BWTVn32m4SEhXpHxc,3279
52
44
  kodit/infrastructure/embedding/embedding_providers/hash_embedding_provider.py,sha256=V6OdCuWyQQOvo3OJGRi-gBKDApIcrELydFg7T696P5s,2257
@@ -55,23 +47,24 @@ kodit/infrastructure/embedding/embedding_providers/openai_embedding_provider.py,
55
47
  kodit/infrastructure/enrichment/__init__.py,sha256=8acZKNzql8Fs0lceFu9U3KoUrOptRBtVIxr_Iw6lz3Y,40
56
48
  kodit/infrastructure/enrichment/enrichment_factory.py,sha256=Pz0Rb1I68udL_zXY3KvJ3LR3aK_9mdF1nMRGQUu4lM0,1828
57
49
  kodit/infrastructure/enrichment/local_enrichment_provider.py,sha256=8CATNtgMHgBRt24GrYEwaZKrroNCxMJS-39xQJoG3N0,3818
58
- kodit/infrastructure/enrichment/null_enrichment_provider.py,sha256=5Ksyxl3qDLxUjmOeIdHZ0UAIULy7RcbLXJoT7_CNXoQ,775
50
+ kodit/infrastructure/enrichment/null_enrichment_provider.py,sha256=DhZkJBnkvXg_XSAs-oKiFnKqYFPnmTl3ikdxrqeEfbc,713
59
51
  kodit/infrastructure/enrichment/openai_enrichment_provider.py,sha256=fenq4HiJ2UkrzsE2D0A0qpmro38z9mKaIzKKU5v7hnY,3189
60
52
  kodit/infrastructure/git/__init__.py,sha256=0iMosFzudj4_xNIMe2SRbV6l5bWqkjnUsZoFsoZFuM8,33
61
- kodit/infrastructure/git/git_utils.py,sha256=2DH6cyTjDRwFfL5Bzt1y2w0DwHZNypbC6R0Gm_A3hhg,2476
53
+ kodit/infrastructure/git/git_utils.py,sha256=KERwmhWDR4ooMQKS-nSPxjvdCzoWF9NS6nhdeXyzdtY,571
62
54
  kodit/infrastructure/ignore/__init__.py,sha256=VzFv8XOzHmsu0MEGnWVSF6KsgqLBmvHlRqAkT1Xb1MY,36
63
- kodit/infrastructure/ignore/ignore_pattern_provider.py,sha256=9m2XCsgW87UBTfzHr6Z0Ns6WpzwkLir3zyBY3PwsgXk,2225
55
+ kodit/infrastructure/ignore/ignore_pattern_provider.py,sha256=zdxun3GodLfXxyssBK8QDUK58xb4fBJ0SKcHUyn3pzM,2131
64
56
  kodit/infrastructure/indexing/__init__.py,sha256=7UPRa2jwCAsa0Orsp6PqXSF8iIXJVzXHMFmrKkI9yH8,38
65
- kodit/infrastructure/indexing/auto_indexing_service.py,sha256=uXggladN3PTU5Jzhz0Kq-0aObvq3Dq9YbjYKCSkaQA8,3131
66
- kodit/infrastructure/indexing/fusion_service.py,sha256=mXUUcx3-8e75mWkxXMfl30HIoFXrTNHzB1w90MmEbak,1806
67
- kodit/infrastructure/indexing/index_repository.py,sha256=qs1RiFuf29kbKX4unP98_4-f9vQCmpCo-q-zvCCFPCE,8287
57
+ kodit/infrastructure/indexing/auto_indexing_service.py,sha256=PgAyrmR8jNkAOlGnhQjFkqoE22oh-IwYTCg_v4o45Fo,2764
58
+ kodit/infrastructure/indexing/fusion_service.py,sha256=2B0guBsuKz19uWcs18sIJpUJPzXoRvULgl7UNWQGysA,1809
68
59
  kodit/infrastructure/indexing/indexing_factory.py,sha256=LPjPCps_wJ9M_fZGRP02bfc2pvYc50ZSTYI99XwRRPg,918
69
- kodit/infrastructure/indexing/snippet_domain_service_factory.py,sha256=OMp9qRJSAT3oWqsMyF1fgI2Mb_G-SA22crbbaCb7c-Q,1253
60
+ kodit/infrastructure/mappers/__init__.py,sha256=QPHOjNreXmBPPovZ6elnYFS0vD-IsmrGl4TT01FCKro,77
61
+ kodit/infrastructure/mappers/index_mapper.py,sha256=ZSfu8kjTaa8_UY0nTqr4b02NS3VrjqZYkduCN71AL2g,12743
70
62
  kodit/infrastructure/snippet_extraction/__init__.py,sha256=v6KqrRDjSj0nt87m7UwRGx2GN_fz_14VWq9Q0uABR_s,54
71
- kodit/infrastructure/snippet_extraction/language_detection_service.py,sha256=Lo9xPLVia-70yP9gzyH4cQcBQzsp7WXjGOa5NBggScg,1158
63
+ kodit/infrastructure/snippet_extraction/factories.py,sha256=kAPd6JQyw7mVM4qfWqy9oD9pHGSatIlqfAxzZPzFBOw,407
64
+ kodit/infrastructure/snippet_extraction/language_detection_service.py,sha256=nOw3W8KkSAx2tDCitth7b6DXmxQeKj_4FGoaUp1fqWo,1145
72
65
  kodit/infrastructure/snippet_extraction/snippet_extraction_factory.py,sha256=YA72kneJhR1nvgbYwH7fFAvTSMJw9bDoLGLhAAVpmq0,2272
73
- kodit/infrastructure/snippet_extraction/snippet_query_provider.py,sha256=pLjFExJx5bX4s6a_mMA4-AfjtfBaC2wjTV3GjYD2HVE,1284
74
- kodit/infrastructure/snippet_extraction/tree_sitter_snippet_extractor.py,sha256=8B14jy_QS9SBA5jNpLtSSOayKP1WgMeCQEsZPuyAs8o,6190
66
+ kodit/infrastructure/snippet_extraction/snippet_query_provider.py,sha256=4bj4YtxmIC4r7TyU0QQYajmmDR1eIQKqWuJ6aZING2A,1283
67
+ kodit/infrastructure/snippet_extraction/tree_sitter_snippet_extractor.py,sha256=y2C5plTDvHOGTNdwcG4v_1Q15Pvq4mW7UlWsR3l5nCg,6177
75
68
  kodit/infrastructure/snippet_extraction/languages/csharp.scm,sha256=gbBN4RiV1FBuTJF6orSnDFi8H9JwTw-d4piLJYsWUsc,222
76
69
  kodit/infrastructure/snippet_extraction/languages/go.scm,sha256=SEX9mTOrhP2KiQW7oflDKkd21u5dK56QbJ4LvTDxY8A,533
77
70
  kodit/infrastructure/snippet_extraction/languages/java.scm,sha256=kSEZT0QJAuhT7WpR2PklYiCX-03qRRpCAlcxfIbXPt4,227
@@ -79,24 +72,28 @@ kodit/infrastructure/snippet_extraction/languages/javascript.scm,sha256=Ini5TsVN
79
72
  kodit/infrastructure/snippet_extraction/languages/python.scm,sha256=ee85R9PBzwye3IMTE7-iVoKWd_ViU3EJISTyrFGrVeo,429
80
73
  kodit/infrastructure/snippet_extraction/languages/typescript.scm,sha256=U-ujbbv4tylbUBj9wuhL-e5cW6hmgPCNs4xrIX3r_hE,448
81
74
  kodit/infrastructure/sqlalchemy/__init__.py,sha256=UXPMSF_hgWaqr86cawRVqM8XdVNumQyyK5B8B97GnlA,33
82
- kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=u29RVt4W0WqHj6TkrydMHw2iF5_jERHtlidDjWRQvqc,7886
83
- kodit/infrastructure/sqlalchemy/file_repository.py,sha256=9_kXHJ1YiWA1ingpvBNq8cuxkMu59PHwl_m9_Ttnq2o,2353
84
- kodit/infrastructure/sqlalchemy/repository.py,sha256=EpZnOjR3wfPEqIauWw_KczpkSqBQPTq5sIyCpJCuW2w,4565
85
- kodit/infrastructure/sqlalchemy/snippet_repository.py,sha256=4Hb_K7rPevzCgqZDIJPBTM3lzF36QXjmUES9WwW9E2k,8252
75
+ kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=dC2Wzj_zQiWExwfScE1LAGiiyxPyg0YepwyLOgDwcs4,7905
76
+ kodit/infrastructure/sqlalchemy/entities.py,sha256=Dmh0z-dMI0wfMAPpf62kxU4md6NUH9P5Nx1QSTITOfg,5961
77
+ kodit/infrastructure/sqlalchemy/file_repository.py,sha256=1MBXh4ieE6W5LMcJl8V1YV0RUceH_PyiXPZ9IdA5_4g,2372
78
+ kodit/infrastructure/sqlalchemy/index_repository.py,sha256=vPK-gl3JqMGjK_vOyXCzR_P-sN_p-BpuXy0m_A7Nkpo,21524
86
79
  kodit/infrastructure/ui/__init__.py,sha256=CzbLOBwIZ6B6iAHEd1L8cIBydCj-n_kobxJAhz2I9_Y,32
87
80
  kodit/infrastructure/ui/progress.py,sha256=BaAeMEgXlSSb0c_t_NPxnThIktkzzCS9kegb5ExULJs,4791
88
81
  kodit/infrastructure/ui/spinner.py,sha256=GcP115qtR0VEnGfMEtsGoAUpRzVGUSfiUXfoJJERngA,2357
89
82
  kodit/migrations/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
90
83
  kodit/migrations/__init__.py,sha256=lP5MuwlyWRMO6UcDWnQcQ3G-GYHcFb6rl9gYPHJ1sjo,40
91
- kodit/migrations/env.py,sha256=j89vEWdSgfnreTAz5ZvFAPlsMGI8SfKti0MlWhm7Jbc,2364
84
+ kodit/migrations/env.py,sha256=m57TkFLYjQ4w2aw1YICXkeek27M6qjwRDMHvThWqIL0,2383
92
85
  kodit/migrations/script.py.mako,sha256=zWziKtiwYKEWuwPV_HBNHwa9LCT45_bi01-uSNFaOOE,703
86
+ kodit/migrations/versions/4073b33f9436_add_file_processing_flag.py,sha256=lntRkExB967OX0StZrcxEus9j2TmJvkwY5GO9ZNy7hM,903
87
+ kodit/migrations/versions/4552eb3f23ce_add_summary.py,sha256=_saoHs5HGzc_z2OzBkFKrifTLQfoNox3BpSBeiKg_f8,870
93
88
  kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py,sha256=-61qol9PfQKILCDQRA5jEaats9aGZs9Wdtp-j-38SF4,1644
94
89
  kodit/migrations/versions/85155663351e_initial.py,sha256=Cg7zlF871o9ShV5rQMQ1v7hRV7fI59veDY9cjtTrs-8,3306
95
90
  kodit/migrations/versions/9e53ea8bb3b0_add_authors.py,sha256=a32Zm8KUQyiiLkjKNPYdaJDgjW6VsV-GhaLnPnK_fpI,3884
96
91
  kodit/migrations/versions/__init__.py,sha256=9-lHzptItTzq_fomdIRBegQNm4Znx6pVjwD4MiqRIdo,36
97
92
  kodit/migrations/versions/c3f5137d30f5_index_all_the_things.py,sha256=rI8LmjF-I2OMxZ2nOIF_NRmqOLXe45hL_iz_nx97DTQ,1680
98
- kodit-0.3.1.dist-info/METADATA,sha256=iI5UCxq-ih4cF-GVJLyNQ8wdRxwC907Jj6pddwiIsJo,6358
99
- kodit-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
- kodit-0.3.1.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
101
- kodit-0.3.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
102
- kodit-0.3.1.dist-info/RECORD,,
93
+ kodit/utils/__init__.py,sha256=DPEB1i8evnLF4Ns3huuAYg-0pKBFKUFuiDzOKG9r-sw,33
94
+ kodit/utils/path_utils.py,sha256=thK6YGGNvQThdBaCYCCeCvS1L8x-lwl3AoGht2jnjGw,1645
95
+ kodit-0.3.3.dist-info/METADATA,sha256=nPUYBtjo5uMq6jYJSMGAdxNrNesYXsW8pQAixYUH0nw,6358
96
+ kodit-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
97
+ kodit-0.3.3.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
98
+ kodit-0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
99
+ kodit-0.3.3.dist-info/RECORD,,
kodit/domain/enums.py DELETED
@@ -1,9 +0,0 @@
1
- """Domain enums."""
2
-
3
- from enum import Enum
4
-
5
-
6
- class SnippetExtractionStrategy(str, Enum):
7
- """Different strategies for extracting snippets from files."""
8
-
9
- METHOD_BASED = "method_based"
@@ -1,128 +0,0 @@
1
- """Domain repositories with generic patterns."""
2
-
3
- from collections.abc import Sequence
4
- from typing import Protocol, TypeVar
5
-
6
- from kodit.domain.entities import (
7
- Author,
8
- AuthorFileMapping,
9
- File,
10
- Snippet,
11
- Source,
12
- SourceType,
13
- )
14
- from kodit.domain.value_objects import (
15
- MultiSearchRequest,
16
- SnippetListItem,
17
- )
18
-
19
- T = TypeVar("T")
20
-
21
-
22
- class GenericRepository(Protocol[T]):
23
- """Generic repository interface."""
24
-
25
- async def get(self, id: int) -> T | None: # noqa: A002
26
- """Get entity by ID."""
27
- ...
28
-
29
- async def save(self, entity: T) -> T:
30
- """Save entity."""
31
- ...
32
-
33
- async def delete(self, id: int) -> None: # noqa: A002
34
- """Delete entity by ID."""
35
- ...
36
-
37
- async def list(self) -> Sequence[T]:
38
- """List all entities."""
39
- ...
40
-
41
-
42
- class SourceRepository(GenericRepository[Source]):
43
- """Source repository with specific methods."""
44
-
45
- async def get_by_uri(self, uri: str) -> Source | None:
46
- """Get a source by URI."""
47
- raise NotImplementedError
48
-
49
- async def list_by_type(
50
- self, source_type: SourceType | None = None
51
- ) -> Sequence[Source]:
52
- """List sources by type."""
53
- raise NotImplementedError
54
-
55
- async def create_file(self, file: File) -> File:
56
- """Create a new file record."""
57
- raise NotImplementedError
58
-
59
- async def upsert_author(self, author: Author) -> Author:
60
- """Create a new author or return existing one if email already exists."""
61
- raise NotImplementedError
62
-
63
- async def upsert_author_file_mapping(
64
- self, mapping: "AuthorFileMapping"
65
- ) -> "AuthorFileMapping":
66
- """Create a new author file mapping or return existing one if already exists."""
67
- raise NotImplementedError
68
-
69
-
70
- class AuthorRepository(GenericRepository[Author]):
71
- """Author repository with specific methods."""
72
-
73
- async def get_by_name(self, name: str) -> Author | None:
74
- """Get an author by name."""
75
- raise NotImplementedError
76
-
77
- async def get_by_email(self, email: str) -> Author | None:
78
- """Get an author by email."""
79
- raise NotImplementedError
80
-
81
-
82
- class SnippetRepository(GenericRepository[Snippet]):
83
- """Snippet repository with specific methods."""
84
-
85
- async def get_by_index(self, index_id: int) -> Sequence[Snippet]:
86
- """Get all snippets for an index."""
87
- raise NotImplementedError
88
-
89
- async def delete_by_index(self, index_id: int) -> None:
90
- """Delete all snippets for an index."""
91
- raise NotImplementedError
92
-
93
- async def list_snippets(
94
- self, file_path: str | None = None, source_uri: str | None = None
95
- ) -> Sequence[SnippetListItem]:
96
- """List snippets with optional filtering by file path and source URI.
97
-
98
- Args:
99
- file_path: Optional file or directory path to filter by. Can be relative
100
- (uri) or absolute (cloned_path).
101
- source_uri: Optional source URI to filter by. If None, returns snippets from
102
- all sources.
103
-
104
- Returns:
105
- A sequence of SnippetListItem instances matching the criteria
106
-
107
- """
108
- raise NotImplementedError
109
-
110
- async def search(self, request: MultiSearchRequest) -> Sequence[SnippetListItem]:
111
- """Search snippets with filters.
112
-
113
- Args:
114
- request: The search request containing queries and optional filters.
115
-
116
- Returns:
117
- A sequence of SnippetListItem instances matching the search criteria.
118
-
119
- """
120
- raise NotImplementedError
121
-
122
-
123
- class FileRepository(GenericRepository[File]):
124
- """File repository with specific methods."""
125
-
126
- async def get_files_for_index(self, index_id: int) -> Sequence[File]:
127
- """Get all files for an index."""
128
- raise NotImplementedError
@@ -1,45 +0,0 @@
1
- """Domain service for ignore patterns."""
2
-
3
- from abc import ABC, abstractmethod
4
- from pathlib import Path
5
-
6
-
7
- class IgnorePatternProvider(ABC):
8
- """Abstract interface for ignore pattern providers."""
9
-
10
- @abstractmethod
11
- def should_ignore(self, path: Path) -> bool:
12
- """Check if a path should be ignored.
13
-
14
- Args:
15
- path: The path to check.
16
-
17
- Returns:
18
- True if the path should be ignored, False otherwise.
19
-
20
- """
21
-
22
-
23
- class IgnoreService:
24
- """Domain service for managing ignore patterns."""
25
-
26
- def __init__(self, ignore_pattern_provider: IgnorePatternProvider) -> None:
27
- """Initialize the ignore service.
28
-
29
- Args:
30
- ignore_pattern_provider: The ignore pattern provider to use.
31
-
32
- """
33
- self.ignore_pattern_provider = ignore_pattern_provider
34
-
35
- def should_ignore(self, path: Path) -> bool:
36
- """Check if a path should be ignored.
37
-
38
- Args:
39
- path: The path to check.
40
-
41
- Returns:
42
- True if the path should be ignored, False otherwise.
43
-
44
- """
45
- return self.ignore_pattern_provider.should_ignore(path)
@@ -1,204 +0,0 @@
1
- """Domain service for indexing operations."""
2
-
3
- from abc import ABC, abstractmethod
4
-
5
- from kodit.domain.entities import Snippet
6
- from kodit.domain.value_objects import (
7
- FusionRequest,
8
- FusionResult,
9
- IndexCreateRequest,
10
- IndexView,
11
- SnippetWithFile,
12
- )
13
-
14
-
15
- class IndexRepository(ABC):
16
- """Abstract index repository interface."""
17
-
18
- @abstractmethod
19
- async def create_index(self, source_id: int) -> IndexView:
20
- """Create a new index for a source."""
21
-
22
- @abstractmethod
23
- async def get_index_by_id(self, index_id: int) -> IndexView | None:
24
- """Get an index by its ID."""
25
-
26
- @abstractmethod
27
- async def get_index_by_source_id(self, source_id: int) -> IndexView | None:
28
- """Get an index by its source ID."""
29
-
30
- @abstractmethod
31
- async def list_indexes(self) -> list[IndexView]:
32
- """List all indexes."""
33
-
34
- @abstractmethod
35
- async def update_index_timestamp(self, index_id: int) -> None:
36
- """Update the timestamp of an index."""
37
-
38
- @abstractmethod
39
- async def delete_all_snippets(self, index_id: int) -> None:
40
- """Delete all snippets for an index."""
41
-
42
- @abstractmethod
43
- async def get_snippets_for_index(self, index_id: int) -> list[Snippet]:
44
- """Get all snippets for an index."""
45
-
46
- @abstractmethod
47
- async def add_snippet(self, snippet: dict) -> None:
48
- """Add a snippet to the database."""
49
-
50
- @abstractmethod
51
- async def update_snippet_content(self, snippet_id: int, content: str) -> None:
52
- """Update the content of an existing snippet."""
53
-
54
- @abstractmethod
55
- async def list_snippets_by_ids(self, ids: list[int]) -> list[SnippetWithFile]:
56
- """List snippets by IDs."""
57
-
58
-
59
- class FusionService(ABC):
60
- """Abstract fusion service interface."""
61
-
62
- @abstractmethod
63
- def reciprocal_rank_fusion(
64
- self, rankings: list[list[FusionRequest]], k: float = 60
65
- ) -> list[FusionResult]:
66
- """Perform reciprocal rank fusion on search results."""
67
-
68
-
69
- class IndexingDomainService:
70
- """Domain service for indexing operations."""
71
-
72
- def __init__(
73
- self, index_repository: IndexRepository, fusion_service: FusionService
74
- ) -> None:
75
- """Initialize the indexing domain service.
76
-
77
- Args:
78
- index_repository: Repository for index operations
79
- fusion_service: Service for result fusion
80
-
81
- """
82
- self.index_repository = index_repository
83
- self.fusion_service = fusion_service
84
-
85
- async def create_index(self, request: IndexCreateRequest) -> IndexView:
86
- """Create a new index.
87
-
88
- Args:
89
- request: The index create request.
90
-
91
- Returns:
92
- The created index view.
93
-
94
- """
95
- return await self.index_repository.create_index(request.source_id)
96
-
97
- async def get_index(self, index_id: int) -> IndexView | None:
98
- """Get an index by its ID.
99
-
100
- Args:
101
- index_id: The ID of the index to retrieve.
102
-
103
- Returns:
104
- The index view if found, None otherwise.
105
-
106
- """
107
- return await self.index_repository.get_index_by_id(index_id)
108
-
109
- async def get_index_by_source_id(self, source_id: int) -> IndexView | None:
110
- """Get an index by its source ID.
111
-
112
- Args:
113
- source_id: The ID of the source to retrieve an index for.
114
-
115
- Returns:
116
- The index view if found, None otherwise.
117
-
118
- """
119
- return await self.index_repository.get_index_by_source_id(source_id)
120
-
121
- async def list_indexes(self) -> list[IndexView]:
122
- """List all indexes.
123
-
124
- Returns:
125
- A list of index views.
126
-
127
- """
128
- return await self.index_repository.list_indexes()
129
-
130
- async def update_index_timestamp(self, index_id: int) -> None:
131
- """Update the timestamp of an index.
132
-
133
- Args:
134
- index_id: The ID of the index to update.
135
-
136
- """
137
- await self.index_repository.update_index_timestamp(index_id)
138
-
139
- async def delete_all_snippets(self, index_id: int) -> None:
140
- """Delete all snippets for an index.
141
-
142
- Args:
143
- index_id: The ID of the index to delete snippets for.
144
-
145
- """
146
- await self.index_repository.delete_all_snippets(index_id)
147
-
148
- async def get_snippets_for_index(self, index_id: int) -> list[Snippet]:
149
- """Get all snippets for an index.
150
-
151
- Args:
152
- index_id: The ID of the index to get snippets for.
153
-
154
- Returns:
155
- A list of Snippet entities.
156
-
157
- """
158
- return await self.index_repository.get_snippets_for_index(index_id)
159
-
160
- async def add_snippet(self, snippet: dict) -> None:
161
- """Add a snippet to the database.
162
-
163
- Args:
164
- snippet: The snippet to add.
165
-
166
- """
167
- await self.index_repository.add_snippet(snippet)
168
-
169
- async def update_snippet_content(self, snippet_id: int, content: str) -> None:
170
- """Update the content of an existing snippet.
171
-
172
- Args:
173
- snippet_id: The ID of the snippet to update.
174
- content: The new content for the snippet.
175
-
176
- """
177
- await self.index_repository.update_snippet_content(snippet_id, content)
178
-
179
- def perform_fusion(
180
- self, rankings: list[list[FusionRequest]], k: float = 60
181
- ) -> list[FusionResult]:
182
- """Perform fusion on search results.
183
-
184
- Args:
185
- rankings: List of rankings to fuse.
186
- k: Parameter for reciprocal rank fusion.
187
-
188
- Returns:
189
- Fused search results.
190
-
191
- """
192
- return self.fusion_service.reciprocal_rank_fusion(rankings, k)
193
-
194
- async def get_snippets_by_ids(self, ids: list[int]) -> list[SnippetWithFile]:
195
- """Get snippets by IDs.
196
-
197
- Args:
198
- ids: List of snippet IDs to retrieve.
199
-
200
- Returns:
201
- List of SnippetWithFile objects containing file and snippet information.
202
-
203
- """
204
- return await self.index_repository.list_snippets_by_ids(ids)