kodit 0.5.3__py3-none-any.whl → 0.5.5__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 (55) hide show
  1. kodit/_version.py +2 -2
  2. kodit/application/factories/server_factory.py +54 -32
  3. kodit/application/services/code_search_application_service.py +89 -12
  4. kodit/application/services/commit_indexing_application_service.py +314 -195
  5. kodit/application/services/enrichment_query_service.py +274 -43
  6. kodit/application/services/indexing_worker_service.py +1 -1
  7. kodit/application/services/queue_service.py +15 -10
  8. kodit/application/services/sync_scheduler.py +2 -1
  9. kodit/domain/enrichments/architecture/architecture.py +1 -1
  10. kodit/domain/enrichments/architecture/physical/physical.py +1 -1
  11. kodit/domain/enrichments/development/development.py +1 -1
  12. kodit/domain/enrichments/development/snippet/snippet.py +12 -5
  13. kodit/domain/enrichments/enrichment.py +31 -4
  14. kodit/domain/enrichments/usage/api_docs.py +1 -1
  15. kodit/domain/enrichments/usage/usage.py +1 -1
  16. kodit/domain/entities/git.py +30 -25
  17. kodit/domain/factories/git_repo_factory.py +20 -5
  18. kodit/domain/protocols.py +56 -125
  19. kodit/domain/services/embedding_service.py +14 -16
  20. kodit/domain/services/git_repository_service.py +60 -38
  21. kodit/domain/services/git_service.py +18 -11
  22. kodit/domain/tracking/resolution_service.py +6 -16
  23. kodit/domain/value_objects.py +2 -9
  24. kodit/infrastructure/api/v1/dependencies.py +12 -3
  25. kodit/infrastructure/api/v1/query_params.py +27 -0
  26. kodit/infrastructure/api/v1/routers/commits.py +91 -85
  27. kodit/infrastructure/api/v1/routers/repositories.py +53 -37
  28. kodit/infrastructure/api/v1/routers/search.py +1 -1
  29. kodit/infrastructure/api/v1/schemas/enrichment.py +14 -0
  30. kodit/infrastructure/api/v1/schemas/repository.py +1 -1
  31. kodit/infrastructure/providers/litellm_provider.py +23 -1
  32. kodit/infrastructure/slicing/api_doc_extractor.py +0 -2
  33. kodit/infrastructure/sqlalchemy/embedding_repository.py +44 -34
  34. kodit/infrastructure/sqlalchemy/enrichment_association_repository.py +73 -0
  35. kodit/infrastructure/sqlalchemy/enrichment_v2_repository.py +116 -97
  36. kodit/infrastructure/sqlalchemy/entities.py +12 -116
  37. kodit/infrastructure/sqlalchemy/git_branch_repository.py +52 -244
  38. kodit/infrastructure/sqlalchemy/git_commit_repository.py +35 -324
  39. kodit/infrastructure/sqlalchemy/git_file_repository.py +70 -0
  40. kodit/infrastructure/sqlalchemy/git_repository.py +60 -230
  41. kodit/infrastructure/sqlalchemy/git_tag_repository.py +53 -240
  42. kodit/infrastructure/sqlalchemy/query.py +331 -0
  43. kodit/infrastructure/sqlalchemy/repository.py +203 -0
  44. kodit/infrastructure/sqlalchemy/task_repository.py +79 -58
  45. kodit/infrastructure/sqlalchemy/task_status_repository.py +45 -52
  46. kodit/migrations/versions/4b1a3b2c8fa5_refactor_git_tracking.py +190 -0
  47. {kodit-0.5.3.dist-info → kodit-0.5.5.dist-info}/METADATA +1 -1
  48. {kodit-0.5.3.dist-info → kodit-0.5.5.dist-info}/RECORD +51 -49
  49. kodit/infrastructure/mappers/enrichment_mapper.py +0 -83
  50. kodit/infrastructure/mappers/git_mapper.py +0 -193
  51. kodit/infrastructure/mappers/snippet_mapper.py +0 -104
  52. kodit/infrastructure/sqlalchemy/snippet_v2_repository.py +0 -479
  53. {kodit-0.5.3.dist-info → kodit-0.5.5.dist-info}/WHEEL +0 -0
  54. {kodit-0.5.3.dist-info → kodit-0.5.5.dist-info}/entry_points.txt +0 -0
  55. {kodit-0.5.3.dist-info → kodit-0.5.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  kodit/.gitignore,sha256=ztkjgRwL9Uud1OEi36hGQeDGk3OLK1NfDEO8YqGYy8o,11
2
2
  kodit/__init__.py,sha256=aEKHYninUq1yh6jaNfvJBYg-6fenpN132nJt1UU6Jxs,59
3
- kodit/_version.py,sha256=EWl7XaGZUG57Di8WiRltpKAkwy1CShJuJ-i6_rAPr-w,704
3
+ kodit/_version.py,sha256=0gHg6pqkExJvz1iV3rjNnM6ZmxmZPlhVrGzZVWp6WuA,704
4
4
  kodit/app.py,sha256=niIfZiuuDp7mLzrBwQhx_FU7RvKfUALNV5y0o43miss,5802
5
5
  kodit/cli.py,sha256=QSTXIUDxZo3anIONY-grZi9_VSehWoS8QoVJZyOmWPQ,3086
6
6
  kodit/cli_utils.py,sha256=umkvt4kWNapk6db6RGz6bmn7oxgDpsW2Vo09MZ37OGg,2430
@@ -13,50 +13,50 @@ kodit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  kodit/application/__init__.py,sha256=mH50wTpgP9dhbKztFsL8Dda9Hi18TSnMVxXtpp4aGOA,35
14
14
  kodit/application/factories/__init__.py,sha256=bU5CvEnaBePZ7JbkCOp1MGTNP752bnU2uEqmfy5FdRk,37
15
15
  kodit/application/factories/reporting_factory.py,sha256=3IpRiAw_olM69db-jbDAtjyGtd6Nh5o8jUJX3-rXCA8,1421
16
- kodit/application/factories/server_factory.py,sha256=RJ-u0IpKSahq__ZzxP3yPyJ5sVWgGJhyxNbI9uIu-ZY,16251
16
+ kodit/application/factories/server_factory.py,sha256=Y99haqn_cv9Gci4cC4YRzkfoLUTWtERS9Ghgo5NjGFI,17236
17
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=S5Gep4aXB9_1CWxs9xcIMnGmsrfrwJqvfDAHIPhoS1k,29860
20
- kodit/application/services/enrichment_query_service.py,sha256=4wtBPwLbmgFCDgYam1D6x6EgSDGEJeQgAt_opzQz5rs,3102
21
- kodit/application/services/indexing_worker_service.py,sha256=8J8CaUdPd5nF6MyvJbJQpXeGkP2oClmFjZel1xBXELU,4065
22
- kodit/application/services/queue_service.py,sha256=nXplzN-nehPEeEvygzjJwWg4oQmu3SPodsZzY1Z3MtE,2509
18
+ kodit/application/services/code_search_application_service.py,sha256=ceyv5TTN-jvlOFOupGa9XwfTTraLNN2GU55kFeulVXY,7763
19
+ kodit/application/services/commit_indexing_application_service.py,sha256=SZEWjgFR1dd1yFsWnVxtOUQ_Dh_AA37cXhIsbrmAvd0,34746
20
+ kodit/application/services/enrichment_query_service.py,sha256=ICAuMY8iw1LlioXXGDPLCcxeL9kPQYMbNg9YNvOpbXk,13362
21
+ kodit/application/services/indexing_worker_service.py,sha256=59cZthlzViOVrAWEoZqUTCfLzxx2OO_FOGdM3pYf9Mc,4065
22
+ kodit/application/services/queue_service.py,sha256=pIHTS8M65FzAhZH5kn54BTiZ43sCbsALYdCFTz9wdqE,2692
23
23
  kodit/application/services/reporting.py,sha256=cwe-S-UpSOE6xSAEhoD1hi4hSWk1bW3YRLJ7463fIvM,3518
24
- kodit/application/services/sync_scheduler.py,sha256=Oy4Hw64SBkNmgXEIAJqXNkMM1nVGnwrP70-htrngCOU,2779
24
+ kodit/application/services/sync_scheduler.py,sha256=hVT3dlmvfbqXKOV_KU5ZQ5gEKBGPJTlvJcF9gP2ZHQM,2853
25
25
  kodit/domain/__init__.py,sha256=TCpg4Xx-oF4mKV91lo4iXqMEfBT1OoRSYnbG-zVWolA,66
26
26
  kodit/domain/errors.py,sha256=yIsgCjM_yOFIg8l7l-t7jM8pgeAX4cfPq0owf7iz3DA,106
27
- kodit/domain/protocols.py,sha256=7PyGVkSEdTYW0CuROmxZALHppMtkd6H0S7lyJs-mbAs,9794
28
- kodit/domain/value_objects.py,sha256=PyoH1JUPdz95GGfASjWFnL1Kjhpn4hI2H_eCgpJku7I,17940
27
+ kodit/domain/protocols.py,sha256=YQqL1XO2OWqYhPC8W7nyPrqGW3NKafMEJn2HEGXwHIk,7664
28
+ kodit/domain/value_objects.py,sha256=svHQixeLa8fzaJ5NuKl3rBLBVrPfV7VvFd2-U-Vh_Sk,17818
29
29
  kodit/domain/enrichments/__init__.py,sha256=UpQMnMEHqaK3u3K-eJZOC28kfBPHALLAjFMdyYBXSPE,33
30
30
  kodit/domain/enrichments/enricher.py,sha256=jnZ5X9RmZA8Acy-RBS2TbEoBg9QSm8AgleqwS9h5WlY,512
31
- kodit/domain/enrichments/enrichment.py,sha256=C4TbzyZXWjZTIYDZFbM9VESU-1Se3tCfYflkTvnuXdc,993
31
+ kodit/domain/enrichments/enrichment.py,sha256=_4lAOFibvSRN-01HB7it61k38IGQsub0gVERqRrhWPs,1776
32
32
  kodit/domain/enrichments/request.py,sha256=6zBQhliDcdw8vS4sYPG2mqZSDSbQ5VzY1YQ-4bMkuQE,244
33
33
  kodit/domain/enrichments/response.py,sha256=NzoMAKgs7c2yo9vvgWjQDo1yO0koKHbbY_SrsqsalAk,205
34
34
  kodit/domain/enrichments/architecture/__init__.py,sha256=hBSliXMuixUZKtF-_zvcgQjnqrdyc4_SjYG2PTRFYpg,39
35
- kodit/domain/enrichments/architecture/architecture.py,sha256=P229vroi9Hk3mvPDMVyInjJZiHNuh0AkWq0lCm0htvY,494
35
+ kodit/domain/enrichments/architecture/architecture.py,sha256=_3nF9qdBdcA8rTXPkb1KO2F7OXTcH9SajqNYB-ICaZA,507
36
36
  kodit/domain/enrichments/architecture/physical/__init__.py,sha256=4jc89cGxALWo8d3Xzfb5t-YjcCyDb1dDVGwTqVYBFmc,48
37
37
  kodit/domain/enrichments/architecture/physical/discovery_notes.py,sha256=Wdv41rkUcMgRqXWB5Q9roaGMGFznH4V_I7mELUvDShw,636
38
38
  kodit/domain/enrichments/architecture/physical/formatter.py,sha256=V_JvHsGDPPJ-TqGS-G61P3OS3xe0QpS2NLBEk5jX6Yc,351
39
- kodit/domain/enrichments/architecture/physical/physical.py,sha256=BT7qR-Y0LZNBxx5AZpyAVZFmrXQdY1Q6HwgvCf8Y1AA,511
39
+ kodit/domain/enrichments/architecture/physical/physical.py,sha256=2jHGYbX7Uivy3qP-e1njgG6QW_rRw6VzPqlU5-VJ5iY,524
40
40
  kodit/domain/enrichments/development/__init__.py,sha256=ls7zlKUpSpyLZRl-WTuaow9C68c0COkjcoEEEenpMxk,38
41
- kodit/domain/enrichments/development/development.py,sha256=cFmtOnFUEHLxINn7FR4L4F8NAP_LgoPH8ulInFszZ2k,470
41
+ kodit/domain/enrichments/development/development.py,sha256=amzcheLEtXbOyhhmjlay_yt1Z2FRyW2CrR8wZWkpC0g,483
42
42
  kodit/domain/enrichments/development/snippet/__init__.py,sha256=M5XVnlDgfqSE5UiAqkQwE1Mbr5Rg8zQpcspHKC3k_xU,34
43
- kodit/domain/enrichments/development/snippet/snippet.py,sha256=nRsCcWpr6d2nves7u13gQWLWuen7w-W4znfjJ2N9SAs,603
43
+ kodit/domain/enrichments/development/snippet/snippet.py,sha256=A1f385Bu3_ZBaDKQrGHZMb6GIiQoo-hORFSw2ca56yQ,791
44
44
  kodit/domain/enrichments/usage/__init__.py,sha256=7W36rvCF6DH-VqW2RiqU6GMlkYYHZy9Wm0DL_3_fbRc,40
45
- kodit/domain/enrichments/usage/api_docs.py,sha256=AvkywyWAd4_UOk4ayBxBOTjxAIJPyzYrAM4kOeiI0FE,457
46
- kodit/domain/enrichments/usage/usage.py,sha256=A2GZCK_Xc5XS3R2aCoFnsmN0irViX0f_rK8QGmWm1tw,440
45
+ kodit/domain/enrichments/usage/api_docs.py,sha256=5cvkNXUfAWDb0HJGIViAzIEZDGEnBnWYhkacs4lHCYA,470
46
+ kodit/domain/enrichments/usage/usage.py,sha256=U_JrxwXWlFtOzCP7fbfMd-NH75W44MwVFliONMzYB4U,453
47
47
  kodit/domain/entities/__init__.py,sha256=Wh05xl-8y0j3e7m4KkFcwT7d2R_dlGwphJeOUodDkWw,8633
48
- kodit/domain/entities/git.py,sha256=b86MtNJgpJbZ_0z3E5oQX5bXNAeeAGnsC4SyH2DPGq0,5970
48
+ kodit/domain/entities/git.py,sha256=AUQ6dQxFR7jkzPJX76-SmhKs06Yl2T78hj7Iqqvv1Ts,5793
49
49
  kodit/domain/factories/__init__.py,sha256=0JnpqMDhhbuCG4UoEbdc_SM7RfTyOCpotTUB7GN6glU,32
50
- kodit/domain/factories/git_repo_factory.py,sha256=4yaa-waMbzapNtldHG1oxBVMuI6JB-iMLzf3dzgJm0M,2496
50
+ kodit/domain/factories/git_repo_factory.py,sha256=EdeQo4HsBi2hVeVvnSnYtFdR3yGVZQWurrq624kakYg,3086
51
51
  kodit/domain/services/__init__.py,sha256=Q1GhCK_PqKHYwYE4tkwDz5BIyXkJngLBBOHhzvX8nzo,42
52
52
  kodit/domain/services/bm25_service.py,sha256=-E5k0td2Ucs25qygWkJlY0fl7ZckOUe5xZnKYff3hF8,3631
53
- kodit/domain/services/embedding_service.py,sha256=al-vBd7H9KuCqZTWtC7q8CEDVXaIQhDhvMFV9IxWasU,4663
54
- kodit/domain/services/git_repository_service.py,sha256=b-zAAFVxU22KKp2ACyKUgOpFKK7uar4PV5mqoN0Vgzk,15534
55
- kodit/domain/services/git_service.py,sha256=nVQCfXQ8kW-MAAoAd8bgSQmCdgPMVftUh5qd4du_bes,11352
53
+ kodit/domain/services/embedding_service.py,sha256=CEcQ2E9XvOcjKNCJEw5soYUNMHJ5LCJGyXzPCl75CPc,4812
54
+ kodit/domain/services/git_repository_service.py,sha256=suIBmiBG9OcXUFrw1uiYRidS9yvFEekZU8H-tsY0zs0,16545
55
+ kodit/domain/services/git_service.py,sha256=Lr7kPnnBEa_fWfGA9jpffMK7wcfxQ0wfXgynsbSKSzg,11661
56
56
  kodit/domain/services/physical_architecture_service.py,sha256=0YgoAvbUxT_VwgIh_prftSYnil_XIqNPSoP0g37eIt4,7209
57
57
  kodit/domain/services/task_status_query_service.py,sha256=rI93pTMHeycigQryCWkimXSDzRqx_nJOr07UzPAacPE,736
58
58
  kodit/domain/tracking/__init__.py,sha256=5FvxhDxB2Fpr8Dw8BLtjfPE1YUWn2rr3u7njQlqcosk,30
59
- kodit/domain/tracking/resolution_service.py,sha256=w9OMgNv0ZS1DiduY-XFTA_pWK9vXgoEvEGLBl1vqRHE,2765
59
+ kodit/domain/tracking/resolution_service.py,sha256=WBPFjjp49BNfUSJUDkAGjTD5Ug_s9g9RRCXaIiBKce0,2650
60
60
  kodit/domain/tracking/trackable.py,sha256=-9UT-c5iDkg5LxLl-BEyysvrKgHoYfofuGUacjPhVk4,479
61
61
  kodit/infrastructure/__init__.py,sha256=HzEYIjoXnkz_i_MHO2e0sIVYweUcRnl2RpyBiTbMObU,28
62
62
  kodit/infrastructure/api/__init__.py,sha256=U0TSMPpHrlj1zbAtleuZjU3nXGwudyMe-veNBgvODwM,34
@@ -68,18 +68,19 @@ kodit/infrastructure/api/client/search_client.py,sha256=f4mM5ZJpAuR7w-i9yASbh4SY
68
68
  kodit/infrastructure/api/middleware/__init__.py,sha256=6m7eE5k5buboJbuzyX5E9-Tf99yNwFaeJF0f_6HwLyM,30
69
69
  kodit/infrastructure/api/middleware/auth.py,sha256=QSnMcMLWvfumqN1iG4ePj2vEZb2Dlsgr-WHptkEkkhE,1064
70
70
  kodit/infrastructure/api/v1/__init__.py,sha256=xWtkR3UP7daksCXW_Eyvcqsh091OREqfBPnlFs027_o,22
71
- kodit/infrastructure/api/v1/dependencies.py,sha256=VZhSBgPF1lTc7UnayXl5RsHkA6EvHkGl8NLHPUedjU0,4875
71
+ kodit/infrastructure/api/v1/dependencies.py,sha256=fqocBYrQ0RbLJ91Zt0GhXrzeKfOGG-DnucnSa7HOZyE,5173
72
+ kodit/infrastructure/api/v1/query_params.py,sha256=1STn1Pb4TM2PzdPgCUKRuGxz6Hlt_7XLkTYQdZUYv5M,694
72
73
  kodit/infrastructure/api/v1/routers/__init__.py,sha256=pz_7kFwHcxztbTiFI-57Q2tCAllI7u0fgTP4rpQeUoQ,22
73
- kodit/infrastructure/api/v1/routers/commits.py,sha256=osjmm2Po-MOshD7zBv01C12UcYukkaKATtjEa3hSAJU,11624
74
+ kodit/infrastructure/api/v1/routers/commits.py,sha256=roN9cxpG2EGTiAvHoFiVs5CU6N5SskGAN3Izrf8Cw5c,12070
74
75
  kodit/infrastructure/api/v1/routers/queue.py,sha256=srZmOCZqvcCBlDcPYt1ZWhwVhvVWARWJ3Qp4Tn5eK4Y,2148
75
- kodit/infrastructure/api/v1/routers/repositories.py,sha256=fDc73mt9tc1oqa35LGXr8WpG3zIS6QNuQu9qu15l0I0,12758
76
- kodit/infrastructure/api/v1/routers/search.py,sha256=eMlofqcy9xWCsE9ugfBZHtcPo1hb-A06_Xfv4XR3FfY,3187
76
+ kodit/infrastructure/api/v1/routers/repositories.py,sha256=oAbFH2f7Ygibyafg_1zGgbvJ8iWxWgedsnCJXqoxBeo,13292
77
+ kodit/infrastructure/api/v1/routers/search.py,sha256=A77gTBx5qrXvxeS5JVsRUovLz-si4PHaxAhdUHWIsSQ,3181
77
78
  kodit/infrastructure/api/v1/schemas/__init__.py,sha256=capaxPe7y28pWj6Pu5hfTOxLnVL9pwW-hJu7ZdN2klw,41
78
79
  kodit/infrastructure/api/v1/schemas/commit.py,sha256=UVGkwZNjwUMiitUbFws1_mlZN7IALq99P99HJCg5h2c,1794
79
80
  kodit/infrastructure/api/v1/schemas/context.py,sha256=E6gra1uByM8FYmIXlJeaM59j5VhG4M5E9MzgsGWWJHs,317
80
- kodit/infrastructure/api/v1/schemas/enrichment.py,sha256=pV9VnVqnr9Sud1CYdZOS97GyyL3y5aBjTxG5tlM7X2s,616
81
+ kodit/infrastructure/api/v1/schemas/enrichment.py,sha256=44NxuLAaU_4Nvx1gkgf67CtvECewCzkyzNFCHxJowUA,966
81
82
  kodit/infrastructure/api/v1/schemas/queue.py,sha256=oa4wumWOvGzi53Q3cjwIrQJRoentp5nsQSsaj-l-B4U,652
82
- kodit/infrastructure/api/v1/schemas/repository.py,sha256=BRVXlajqQDxoi9RGPeO434RQvyxFYTXp68V7L3wwYXE,3192
83
+ kodit/infrastructure/api/v1/schemas/repository.py,sha256=MKcVyeuQfE9ZdiwcOmwa4n0JIvqJ3H5wpcG5F5NLft4,3158
83
84
  kodit/infrastructure/api/v1/schemas/search.py,sha256=IrqPvIH4IA1QBfmWkD33JqhOmhOJVaZRvOfrNjzowCg,5768
84
85
  kodit/infrastructure/api/v1/schemas/snippet.py,sha256=--WFiu-6SLevfbDsozo34lGaROOHTrebnVU9VR6bSFs,1181
85
86
  kodit/infrastructure/api/v1/schemas/tag.py,sha256=hJSyaokIk3ggytGZjggLjfWQ-2lni21_L_scIh8kFfk,584
@@ -112,9 +113,6 @@ kodit/infrastructure/ignore/ignore_pattern_provider.py,sha256=zdxun3GodLfXxyssBK
112
113
  kodit/infrastructure/indexing/__init__.py,sha256=7UPRa2jwCAsa0Orsp6PqXSF8iIXJVzXHMFmrKkI9yH8,38
113
114
  kodit/infrastructure/indexing/fusion_service.py,sha256=VJiSmE1XujtaZhi1lpkGwjUKdqI-XVRNDSRHOeJWMlo,1790
114
115
  kodit/infrastructure/mappers/__init__.py,sha256=QPHOjNreXmBPPovZ6elnYFS0vD-IsmrGl4TT01FCKro,77
115
- kodit/infrastructure/mappers/enrichment_mapper.py,sha256=kc8TFmjKvhKrKo0UJ8t-wamg8Db1jNNAhYqbfU1SzdY,3143
116
- kodit/infrastructure/mappers/git_mapper.py,sha256=AhFqPxGT7ZeFcUui7P1XnqDuVhooSSDoGuzwIDY5CGc,8214
117
- kodit/infrastructure/mappers/snippet_mapper.py,sha256=za9FUB3s_K4xszHWJAz8nqABMUvaj_haqDPqppclz4g,4035
118
116
  kodit/infrastructure/mappers/task_mapper.py,sha256=R4-hVJD0-wHP51MbX9yiWSBBdeCJ7UiZZWTJwYp2gK8,1511
119
117
  kodit/infrastructure/mappers/task_status_mapper.py,sha256=5lo_jS2EKYg4czOOAFmrWfQl3OojIokwpzhaR3b1wE0,3433
120
118
  kodit/infrastructure/physical_architecture/__init__.py,sha256=DLfszH6h_bRgksDS_TtzJ13Dfa5TuFas9eI99DdZbF4,54
@@ -124,26 +122,29 @@ kodit/infrastructure/physical_architecture/formatters/__init__.py,sha256=2OCvhVK
124
122
  kodit/infrastructure/physical_architecture/formatters/narrative_formatter.py,sha256=43bERS_iGhL94pkUV2Bn5vjeaHPxjHatuDh7dHreh_M,5713
125
123
  kodit/infrastructure/providers/__init__.py,sha256=XjB6DIQIXRrwRhSY32EF3QhZGTWNWsBZA5pwUc--ZZc,65
126
124
  kodit/infrastructure/providers/async_batch_processor.py,sha256=0GkfBfOdQWoZ9JL-_ZCqtlpL2R19nUUn-fhK9y0O0s0,1466
127
- kodit/infrastructure/providers/litellm_provider.py,sha256=Ybxws56fUKhN-Cku43vdmhlIINmwM7v9LckWnfowjCc,4504
125
+ kodit/infrastructure/providers/litellm_provider.py,sha256=DWGlvuhAOLZplo9cTm5plF0wvEQUklAc1TsVrtLsNe0,5426
128
126
  kodit/infrastructure/reporting/__init__.py,sha256=4Qu38YbDOaeDqLdT_CbK8tOZHTKGrHRXncVKlGRzOeQ,32
129
127
  kodit/infrastructure/reporting/db_progress.py,sha256=VVaCKjC_UFwdRptXbBroG9qhXCxI4bZmElf1PMsBzWA,819
130
128
  kodit/infrastructure/reporting/log_progress.py,sha256=yhzkjYulEn_sfpKwHKi--HdQHLb4h4uEolhFYqvdHS8,1261
131
129
  kodit/infrastructure/reporting/telemetry_progress.py,sha256=uT9mNyF2bQ83a0bQvUAXXsidvTievc16DUYKUN0X4tY,581
132
130
  kodit/infrastructure/slicing/__init__.py,sha256=x7cjvHA9Ay2weUYE_dpdAaPaStp20M-4U2b5MLgT5KM,37
133
- kodit/infrastructure/slicing/api_doc_extractor.py,sha256=XZF3GdQQRdDr0f6rq_3gJZ54ZsSceAdIgqwSQjebojc,29480
131
+ kodit/infrastructure/slicing/api_doc_extractor.py,sha256=wKgClsV3yHCOLs0Dp2nLqYLKXiBwf-PZawMewO4mAX0,29421
134
132
  kodit/infrastructure/slicing/ast_analyzer.py,sha256=Kd42XixjTmWWroQEmzwUSoRMiMIdNaLPXikQxrSHJ8M,43556
135
133
  kodit/infrastructure/slicing/slicer.py,sha256=EDYkoLf6RsTVloudZUq6LS5X10JJAHWcKWx3pllYTFU,21975
136
134
  kodit/infrastructure/sqlalchemy/__init__.py,sha256=UXPMSF_hgWaqr86cawRVqM8XdVNumQyyK5B8B97GnlA,33
137
- kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=2JCDc-nSau6B3GA-e1rGian5zfJZpgJZ0TbN5hc1nRE,8866
138
- kodit/infrastructure/sqlalchemy/enrichment_v2_repository.py,sha256=SBi2YU3yqv0YpCZKc8sTURQfySBAhygTqB0oXcqcT7M,4336
139
- kodit/infrastructure/sqlalchemy/entities.py,sha256=TfRkQoCBa77dr6vrj0fYlXkNuXkjxe4zcC21i2BBq0Q,18155
140
- kodit/infrastructure/sqlalchemy/git_branch_repository.py,sha256=UWug5qb6HPljcm_2cBdW_4FlsJhDxtx3wyt4VUGAjXs,11515
141
- kodit/infrastructure/sqlalchemy/git_commit_repository.py,sha256=FgHwwUBVKW2BQtM5qfhOU7gZNhK_jMMSGy4FJ_cP8CE,14362
142
- kodit/infrastructure/sqlalchemy/git_repository.py,sha256=LnqhN80xtpSyH69n16hYvot9XRRYoFQUpIV_zlc7-CQ,10590
143
- kodit/infrastructure/sqlalchemy/git_tag_repository.py,sha256=rOGQTZy1cFuGnkGSdmGcN3TagEVpksIDN1IauODdcIA,10943
144
- kodit/infrastructure/sqlalchemy/snippet_v2_repository.py,sha256=COsj9mLTk25vwovY09m-hj5fw9hoy363N38DdME35HM,19203
145
- kodit/infrastructure/sqlalchemy/task_repository.py,sha256=ZrPKxw0IbIcfcP_AOtyEJ8TDhVjODTI5xQg5ZhGkF8M,4072
146
- kodit/infrastructure/sqlalchemy/task_status_repository.py,sha256=WouXNu8iZSzaKPqKXrUOEO_lskHbPtt4_kEgmjaiZcU,4014
135
+ kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=OhSIuNEQ725WoxaIpK3jcZvUVPW-b95HKRXr1HjurmI,8824
136
+ kodit/infrastructure/sqlalchemy/enrichment_association_repository.py,sha256=mjlGH4vkIv1cPfhkZ4SUyGWpMbgeS7QljsK54yQvV4g,2615
137
+ kodit/infrastructure/sqlalchemy/enrichment_v2_repository.py,sha256=9Yiv8I86qOD3YiNcucs6686JtY_8DOQFpEFJmx1_8HM,5177
138
+ kodit/infrastructure/sqlalchemy/entities.py,sha256=kvZqUPCN2TNgovdNAT_0h4Y8zrgFWwkk-OecvcHIz-A,14852
139
+ kodit/infrastructure/sqlalchemy/git_branch_repository.py,sha256=dW9kBr8aDBXXVmw1zEux2mueiKhTcpG0JxnLuz5yZ3w,3106
140
+ kodit/infrastructure/sqlalchemy/git_commit_repository.py,sha256=jzYpFV1gjI-Wfgai-hxesglYn6XD384mqIorV1AtNCA,1991
141
+ kodit/infrastructure/sqlalchemy/git_file_repository.py,sha256=s_CjSYafobjMEr0zV_NBV9rFgg1cvn5BqadUGVcSOjU,2548
142
+ kodit/infrastructure/sqlalchemy/git_repository.py,sha256=gSSxAKwYKXEN9Nzjbc5Jup7u49OXMHSFClAViYZKZqg,3560
143
+ kodit/infrastructure/sqlalchemy/git_tag_repository.py,sha256=-edeOmmz_FpPlk7x0v-EvMNwmT1HhPTRApjsoBWOBdg,2948
144
+ kodit/infrastructure/sqlalchemy/query.py,sha256=hzkN6cVKpJDqVvNMKvVB9JoFXfrduxFwqkHU-milGLQ,10414
145
+ kodit/infrastructure/sqlalchemy/repository.py,sha256=IC6wUU3GKwiaomm3zgr09mv-F_iOuPSW8nghxXIFtik,8485
146
+ kodit/infrastructure/sqlalchemy/task_repository.py,sha256=4FZAJ7W39WiZXeoA2A1dDCloyrfXA7UqlOsZX04JAgk,4969
147
+ kodit/infrastructure/sqlalchemy/task_status_repository.py,sha256=4F9XpXuubpzLmO1HMfSq7E4U8JV6KI-VwieS8Y-6lws,3139
147
148
  kodit/infrastructure/sqlalchemy/unit_of_work.py,sha256=MAF8sBr-T5crSWx1wvjf00xboPNz9YMyzRfaKSLCbzQ,1970
148
149
  kodit/migrations/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
149
150
  kodit/migrations/__init__.py,sha256=lP5MuwlyWRMO6UcDWnQcQ3G-GYHcFb6rl9gYPHJ1sjo,40
@@ -153,6 +154,7 @@ kodit/migrations/versions/04b80f802e0c_foreign_key_review.py,sha256=zZjiRLx16JBV
153
154
  kodit/migrations/versions/19f8c7faf8b9_add_generic_enrichment_type.py,sha256=5uFUwzscBslU7jGeu4WJ_To_mqrg77V8ML4c2FiL9pQ,9458
154
155
  kodit/migrations/versions/4073b33f9436_add_file_processing_flag.py,sha256=c8dMcKQ-BBBr_2-92eJZFS3Fwe3__B2eNqvQeMZHs0w,917
155
156
  kodit/migrations/versions/4552eb3f23ce_add_summary.py,sha256=WjyBQzFK8IXuvta15YBE23yaTMM1rZCXvPxW98MStng,870
157
+ kodit/migrations/versions/4b1a3b2c8fa5_refactor_git_tracking.py,sha256=2KyXllayA5yInnf2D48O2HJUnZVGw1EoX2OxENYKO8k,6733
156
158
  kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py,sha256=JL6lxaYtGbXolrkNEujg5SWj3_aQBWReYP3I4vcibdo,1755
157
159
  kodit/migrations/versions/7f15f878c3a1_add_new_git_entities.py,sha256=6RoJPwSZT_jfzhCR09lXGz9haYpvzKVeS1aZSh00TCA,25269
158
160
  kodit/migrations/versions/85155663351e_initial.py,sha256=h8DWmSxVwTtWlmWNH8-S4AxfEIbCm_iWtR6Kg5psPnk,3605
@@ -167,8 +169,8 @@ kodit/utils/dump_config.py,sha256=dd5uPgqh6ATk02Zt59t2JFKR9X17YWjHudV0nE8VktE,11
167
169
  kodit/utils/dump_openapi.py,sha256=EasYOnnpeabwb_sTKQUBrrOLHjPcOFQ7Zx0YKpx9fmM,1239
168
170
  kodit/utils/generate_api_paths.py,sha256=TMtx9v55podDfUmiWaHgJHLtEWLV2sLL-5ejGFMPzAo,3569
169
171
  kodit/utils/path_utils.py,sha256=UB_81rx7Y1G1jalVv2PX8miwaprBbcqEdtoQ3hPT3kU,2451
170
- kodit-0.5.3.dist-info/METADATA,sha256=340z0xqhe7h6HOYh85xfIIryGRIBuNLzHI50L2-EdFI,7703
171
- kodit-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
172
- kodit-0.5.3.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
173
- kodit-0.5.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
174
- kodit-0.5.3.dist-info/RECORD,,
172
+ kodit-0.5.5.dist-info/METADATA,sha256=KprUWaNcvHEDmwR0zjo59ln_jUNOC_d6-AokObNZbk4,7703
173
+ kodit-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
174
+ kodit-0.5.5.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
175
+ kodit-0.5.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
176
+ kodit-0.5.5.dist-info/RECORD,,
@@ -1,83 +0,0 @@
1
- """Enrichment mapper."""
2
-
3
- from kodit.domain.enrichments.architecture.architecture import (
4
- ENRICHMENT_TYPE_ARCHITECTURE,
5
- )
6
- from kodit.domain.enrichments.architecture.physical.physical import (
7
- ENRICHMENT_SUBTYPE_PHYSICAL,
8
- PhysicalArchitectureEnrichment,
9
- )
10
- from kodit.domain.enrichments.development.development import ENRICHMENT_TYPE_DEVELOPMENT
11
- from kodit.domain.enrichments.development.snippet.snippet import (
12
- ENRICHMENT_SUBTYPE_SNIPPET_SUMMARY,
13
- SnippetEnrichment,
14
- )
15
- from kodit.domain.enrichments.enrichment import EnrichmentV2
16
- from kodit.domain.enrichments.usage.api_docs import (
17
- ENRICHMENT_SUBTYPE_API_DOCS,
18
- APIDocEnrichment,
19
- )
20
- from kodit.domain.enrichments.usage.usage import ENRICHMENT_TYPE_USAGE
21
- from kodit.infrastructure.sqlalchemy import entities as db_entities
22
-
23
-
24
- class EnrichmentMapper:
25
- """Maps between domain enrichment entities and database entities."""
26
-
27
- @staticmethod
28
- def to_database(domain_enrichment: EnrichmentV2) -> db_entities.EnrichmentV2:
29
- """Convert domain enrichment to database entity."""
30
- return db_entities.EnrichmentV2(
31
- id=domain_enrichment.id,
32
- type=domain_enrichment.type,
33
- subtype=domain_enrichment.subtype,
34
- content=domain_enrichment.content,
35
- created_at=domain_enrichment.created_at,
36
- updated_at=domain_enrichment.updated_at,
37
- )
38
-
39
- @staticmethod
40
- def to_domain(
41
- db_enrichment: db_entities.EnrichmentV2,
42
- entity_type: str, # noqa: ARG004
43
- entity_id: str,
44
- ) -> EnrichmentV2:
45
- """Convert database enrichment to domain entity."""
46
- # Use the stored type and subtype to determine the correct domain class
47
- if (
48
- db_enrichment.type == ENRICHMENT_TYPE_DEVELOPMENT
49
- and db_enrichment.subtype == ENRICHMENT_SUBTYPE_SNIPPET_SUMMARY
50
- ):
51
- return SnippetEnrichment(
52
- id=db_enrichment.id,
53
- entity_id=entity_id,
54
- content=db_enrichment.content,
55
- created_at=db_enrichment.created_at,
56
- updated_at=db_enrichment.updated_at,
57
- )
58
- if (
59
- db_enrichment.type == ENRICHMENT_TYPE_USAGE
60
- and db_enrichment.subtype == ENRICHMENT_SUBTYPE_API_DOCS
61
- ):
62
- return APIDocEnrichment(
63
- id=db_enrichment.id,
64
- entity_id=entity_id,
65
- content=db_enrichment.content,
66
- created_at=db_enrichment.created_at,
67
- updated_at=db_enrichment.updated_at,
68
- )
69
- if (
70
- db_enrichment.type == ENRICHMENT_TYPE_ARCHITECTURE
71
- and db_enrichment.subtype == ENRICHMENT_SUBTYPE_PHYSICAL
72
- ):
73
- return PhysicalArchitectureEnrichment(
74
- id=db_enrichment.id,
75
- entity_id=entity_id,
76
- content=db_enrichment.content,
77
- created_at=db_enrichment.created_at,
78
- updated_at=db_enrichment.updated_at,
79
- )
80
-
81
- raise ValueError(
82
- f"Unknown enrichment type: {db_enrichment.type}/{db_enrichment.subtype}"
83
- )
@@ -1,193 +0,0 @@
1
- """Mapping between domain Git entities and SQLAlchemy entities."""
2
-
3
- from collections import defaultdict
4
- from pathlib import Path
5
-
6
- from pydantic import AnyUrl
7
-
8
- import kodit.domain.entities.git as domain_git_entities
9
- from kodit.infrastructure.sqlalchemy import entities as db_entities
10
-
11
-
12
- class GitMapper:
13
- """Mapper for converting between domain Git entities and database entities."""
14
-
15
- def to_domain_commits(
16
- self,
17
- db_commits: list[db_entities.GitCommit],
18
- db_commit_files: list[db_entities.GitCommitFile],
19
- ) -> list[domain_git_entities.GitCommit]:
20
- """Convert SQLAlchemy GitCommit to domain GitCommit."""
21
- commit_files_map = defaultdict(list)
22
- for file in db_commit_files:
23
- commit_files_map[file.commit_sha].append(file.blob_sha)
24
-
25
- commit_domain_files_map = defaultdict(list)
26
- for file in db_commit_files:
27
- commit_domain_files_map[file.commit_sha].append(
28
- domain_git_entities.GitFile(
29
- created_at=file.created_at,
30
- blob_sha=file.blob_sha,
31
- path=file.path,
32
- mime_type=file.mime_type,
33
- size=file.size,
34
- extension=file.extension,
35
- )
36
- )
37
-
38
- domain_commits = []
39
- for db_commit in db_commits:
40
- domain_commit = domain_git_entities.GitCommit(
41
- created_at=db_commit.created_at,
42
- updated_at=db_commit.updated_at,
43
- commit_sha=db_commit.commit_sha,
44
- date=db_commit.date,
45
- message=db_commit.message,
46
- parent_commit_sha=db_commit.parent_commit_sha,
47
- files=commit_domain_files_map[db_commit.commit_sha],
48
- author=db_commit.author,
49
- )
50
- domain_commits.append(domain_commit)
51
- return domain_commits
52
-
53
- def to_domain_branches(
54
- self,
55
- db_branches: list[db_entities.GitBranch],
56
- domain_commits: list[domain_git_entities.GitCommit],
57
- ) -> list[domain_git_entities.GitBranch]:
58
- """Convert SQLAlchemy GitBranch to domain GitBranch."""
59
- commit_map = {commit.commit_sha: commit for commit in domain_commits}
60
- domain_branches = []
61
- for db_branch in db_branches:
62
- if db_branch.head_commit_sha not in commit_map:
63
- raise ValueError(
64
- f"Commit {db_branch.head_commit_sha} for "
65
- f"branch {db_branch.name} not found in commits: {commit_map.keys()}"
66
- )
67
- domain_branch = domain_git_entities.GitBranch(
68
- repo_id=db_branch.repo_id,
69
- name=db_branch.name,
70
- created_at=db_branch.created_at,
71
- updated_at=db_branch.updated_at,
72
- head_commit=commit_map[db_branch.head_commit_sha],
73
- )
74
- domain_branches.append(domain_branch)
75
- return domain_branches
76
-
77
- def to_domain_tags(
78
- self,
79
- db_tags: list[db_entities.GitTag],
80
- domain_commits: list[domain_git_entities.GitCommit],
81
- ) -> list[domain_git_entities.GitTag]:
82
- """Convert SQLAlchemy GitTag to domain GitTag."""
83
- commit_map = {commit.commit_sha: commit for commit in domain_commits}
84
- domain_tags = []
85
- for db_tag in db_tags:
86
- if db_tag.target_commit_sha not in commit_map:
87
- raise ValueError(
88
- f"Commit {db_tag.target_commit_sha} for tag {db_tag.name} not found"
89
- )
90
- domain_tag = domain_git_entities.GitTag(
91
- created_at=db_tag.created_at,
92
- updated_at=db_tag.updated_at,
93
- repo_id=db_tag.repo_id,
94
- name=db_tag.name,
95
- target_commit=commit_map[db_tag.target_commit_sha],
96
- )
97
- domain_tags.append(domain_tag)
98
- return domain_tags
99
-
100
- def to_domain_tracking_branch(
101
- self,
102
- db_tracking_branch: db_entities.GitTrackingBranch | None,
103
- db_tracking_branch_entity: db_entities.GitBranch | None,
104
- domain_commits: list[domain_git_entities.GitCommit],
105
- ) -> domain_git_entities.GitBranch | None:
106
- """Convert SQLAlchemy GitTrackingBranch to domain GitBranch."""
107
- if db_tracking_branch is None or db_tracking_branch_entity is None:
108
- return None
109
-
110
- commit_map = {commit.commit_sha: commit for commit in domain_commits}
111
- if db_tracking_branch_entity.head_commit_sha not in commit_map:
112
- raise ValueError(
113
- f"Commit {db_tracking_branch_entity.head_commit_sha} for "
114
- f"tracking branch {db_tracking_branch.name} not found"
115
- )
116
-
117
- return domain_git_entities.GitBranch(
118
- repo_id=db_tracking_branch_entity.repo_id,
119
- name=db_tracking_branch_entity.name,
120
- created_at=db_tracking_branch_entity.created_at,
121
- updated_at=db_tracking_branch_entity.updated_at,
122
- head_commit=commit_map[db_tracking_branch_entity.head_commit_sha],
123
- )
124
-
125
- def to_domain_git_repo( # noqa: PLR0913
126
- self,
127
- db_repo: db_entities.GitRepo,
128
- db_tracking_branch_entity: db_entities.GitBranch | None,
129
- db_commits: list[db_entities.GitCommit],
130
- db_tags: list[db_entities.GitTag],
131
- db_commit_files: list[db_entities.GitCommitFile],
132
- db_tracking_branch: db_entities.GitTrackingBranch | None,
133
- ) -> domain_git_entities.GitRepo:
134
- """Convert SQLAlchemy GitRepo to domain GitRepo."""
135
- # Build commits needed for tags and tracking branch
136
- domain_commits = self.to_domain_commits(
137
- db_commits=db_commits, db_commit_files=db_commit_files
138
- )
139
- self.to_domain_tags(
140
- db_tags=db_tags, domain_commits=domain_commits
141
- )
142
- tracking_branch = self.to_domain_tracking_branch(
143
- db_tracking_branch=db_tracking_branch,
144
- db_tracking_branch_entity=db_tracking_branch_entity,
145
- domain_commits=domain_commits,
146
- )
147
-
148
- from kodit.domain.factories.git_repo_factory import GitRepoFactory
149
-
150
- return GitRepoFactory.create_from_components(
151
- repo_id=db_repo.id,
152
- created_at=db_repo.created_at,
153
- updated_at=db_repo.updated_at,
154
- sanitized_remote_uri=AnyUrl(db_repo.sanitized_remote_uri),
155
- remote_uri=AnyUrl(db_repo.remote_uri),
156
- tracking_branch=tracking_branch,
157
- cloned_path=Path(db_repo.cloned_path) if db_repo.cloned_path else None,
158
- last_scanned_at=db_repo.last_scanned_at,
159
- num_commits=db_repo.num_commits,
160
- num_branches=db_repo.num_branches,
161
- num_tags=db_repo.num_tags,
162
- )
163
-
164
- def to_domain_commit_index(
165
- self,
166
- db_commit_index: db_entities.CommitIndex,
167
- snippets: list[domain_git_entities.SnippetV2],
168
- ) -> domain_git_entities.CommitIndex:
169
- """Convert SQLAlchemy CommitIndex to domain CommitIndex."""
170
- return domain_git_entities.CommitIndex(
171
- commit_sha=db_commit_index.commit_sha,
172
- created_at=db_commit_index.created_at,
173
- updated_at=db_commit_index.updated_at,
174
- snippets=snippets,
175
- status=domain_git_entities.IndexStatus(db_commit_index.status),
176
- indexed_at=db_commit_index.indexed_at,
177
- error_message=db_commit_index.error_message,
178
- files_processed=db_commit_index.files_processed,
179
- processing_time_seconds=float(db_commit_index.processing_time_seconds),
180
- )
181
-
182
- def from_domain_commit_index(
183
- self, domain_commit_index: domain_git_entities.CommitIndex
184
- ) -> db_entities.CommitIndex:
185
- """Convert domain CommitIndex to SQLAlchemy CommitIndex."""
186
- return db_entities.CommitIndex(
187
- commit_sha=domain_commit_index.commit_sha,
188
- status=domain_commit_index.status,
189
- indexed_at=domain_commit_index.indexed_at,
190
- error_message=domain_commit_index.error_message,
191
- files_processed=domain_commit_index.files_processed,
192
- processing_time_seconds=domain_commit_index.processing_time_seconds,
193
- )
@@ -1,104 +0,0 @@
1
- """Mapping between domain Git entities and SQLAlchemy entities."""
2
-
3
- import kodit.domain.entities.git as domain_git_entities
4
- from kodit.domain.enrichments.development.snippet.snippet import SnippetEnrichment
5
- from kodit.domain.enrichments.enrichment import EnrichmentV2
6
- from kodit.domain.value_objects import Enrichment, EnrichmentType
7
- from kodit.infrastructure.sqlalchemy import entities as db_entities
8
-
9
-
10
- class SnippetMapper:
11
- """Mapper for converting between domain Git entities and database entities."""
12
-
13
- def to_domain_snippet_v2(
14
- self,
15
- db_snippet: db_entities.SnippetV2,
16
- db_files: list[db_entities.GitCommitFile],
17
- db_enrichments: list[EnrichmentV2],
18
- ) -> domain_git_entities.SnippetV2:
19
- """Convert SQLAlchemy SnippetV2 to domain SnippetV2."""
20
- # Convert enrichments from SnippetEnrichment to Enrichment value objects
21
- enrichments: list[Enrichment] = [
22
- Enrichment(
23
- type=EnrichmentType.SUMMARIZATION,
24
- content=enrichment.content,
25
- )
26
- for enrichment in db_enrichments
27
- ]
28
-
29
- derives_from = [
30
- domain_git_entities.GitFile(
31
- created_at=file.created_at,
32
- blob_sha=file.blob_sha,
33
- path=file.path,
34
- mime_type=file.mime_type,
35
- size=file.size,
36
- extension=file.extension,
37
- )
38
- for file in db_files
39
- ]
40
-
41
- return domain_git_entities.SnippetV2(
42
- sha=db_snippet.sha,
43
- created_at=db_snippet.created_at,
44
- updated_at=db_snippet.updated_at,
45
- derives_from=derives_from,
46
- content=db_snippet.content,
47
- enrichments=enrichments,
48
- extension=db_snippet.extension,
49
- )
50
-
51
- def from_domain_snippet_v2(
52
- self, domain_snippet: domain_git_entities.SnippetV2
53
- ) -> db_entities.SnippetV2:
54
- """Convert domain SnippetV2 to SQLAlchemy SnippetV2."""
55
- return db_entities.SnippetV2(
56
- sha=domain_snippet.sha,
57
- content=domain_snippet.content,
58
- extension=domain_snippet.extension,
59
- )
60
-
61
- def from_domain_enrichments(
62
- self,
63
- snippet_sha: str,
64
- enrichments: list[Enrichment],
65
- ) -> list[SnippetEnrichment]:
66
- """Convert domain enrichments to SnippetEnrichment entities."""
67
- return [
68
- SnippetEnrichment(
69
- entity_id=snippet_sha,
70
- content=enrichment.content,
71
- )
72
- for enrichment in enrichments
73
- ]
74
-
75
- def to_domain_commit_index(
76
- self,
77
- db_commit_index: db_entities.CommitIndex,
78
- snippets: list[domain_git_entities.SnippetV2],
79
- ) -> domain_git_entities.CommitIndex:
80
- """Convert SQLAlchemy CommitIndex to domain CommitIndex."""
81
- return domain_git_entities.CommitIndex(
82
- commit_sha=db_commit_index.commit_sha,
83
- created_at=db_commit_index.created_at,
84
- updated_at=db_commit_index.updated_at,
85
- snippets=snippets,
86
- status=domain_git_entities.IndexStatus(db_commit_index.status),
87
- indexed_at=db_commit_index.indexed_at,
88
- error_message=db_commit_index.error_message,
89
- files_processed=db_commit_index.files_processed,
90
- processing_time_seconds=float(db_commit_index.processing_time_seconds),
91
- )
92
-
93
- def from_domain_commit_index(
94
- self, domain_commit_index: domain_git_entities.CommitIndex
95
- ) -> db_entities.CommitIndex:
96
- """Convert domain CommitIndex to SQLAlchemy CommitIndex."""
97
- return db_entities.CommitIndex(
98
- commit_sha=domain_commit_index.commit_sha,
99
- status=domain_commit_index.status,
100
- indexed_at=domain_commit_index.indexed_at,
101
- error_message=domain_commit_index.error_message,
102
- files_processed=domain_commit_index.files_processed,
103
- processing_time_seconds=domain_commit_index.processing_time_seconds,
104
- )