kodit 0.5.4__py3-none-any.whl → 0.5.6__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.
- kodit/_version.py +2 -2
- kodit/app.py +2 -0
- kodit/application/factories/server_factory.py +58 -32
- kodit/application/services/code_search_application_service.py +89 -12
- kodit/application/services/commit_indexing_application_service.py +527 -195
- kodit/application/services/enrichment_query_service.py +311 -43
- kodit/application/services/indexing_worker_service.py +1 -1
- kodit/application/services/queue_service.py +15 -10
- kodit/application/services/sync_scheduler.py +2 -1
- kodit/domain/enrichments/architecture/architecture.py +1 -1
- kodit/domain/enrichments/architecture/database_schema/__init__.py +1 -0
- kodit/domain/enrichments/architecture/database_schema/database_schema.py +17 -0
- kodit/domain/enrichments/architecture/physical/physical.py +1 -1
- kodit/domain/enrichments/development/development.py +1 -1
- kodit/domain/enrichments/development/snippet/snippet.py +12 -5
- kodit/domain/enrichments/enrichment.py +31 -4
- kodit/domain/enrichments/history/__init__.py +1 -0
- kodit/domain/enrichments/history/commit_description/__init__.py +1 -0
- kodit/domain/enrichments/history/commit_description/commit_description.py +17 -0
- kodit/domain/enrichments/history/history.py +18 -0
- kodit/domain/enrichments/usage/api_docs.py +1 -1
- kodit/domain/enrichments/usage/usage.py +1 -1
- kodit/domain/entities/git.py +30 -25
- kodit/domain/factories/git_repo_factory.py +20 -5
- kodit/domain/protocols.py +60 -125
- kodit/domain/services/embedding_service.py +14 -16
- kodit/domain/services/git_repository_service.py +60 -38
- kodit/domain/services/git_service.py +18 -11
- kodit/domain/tracking/resolution_service.py +6 -16
- kodit/domain/value_objects.py +6 -9
- kodit/infrastructure/api/v1/dependencies.py +12 -3
- kodit/infrastructure/api/v1/query_params.py +27 -0
- kodit/infrastructure/api/v1/routers/commits.py +91 -85
- kodit/infrastructure/api/v1/routers/repositories.py +53 -37
- kodit/infrastructure/api/v1/routers/search.py +1 -1
- kodit/infrastructure/api/v1/schemas/enrichment.py +14 -0
- kodit/infrastructure/api/v1/schemas/repository.py +1 -1
- kodit/infrastructure/cloning/git/git_python_adaptor.py +41 -0
- kodit/infrastructure/database_schema/__init__.py +1 -0
- kodit/infrastructure/database_schema/database_schema_detector.py +268 -0
- kodit/infrastructure/slicing/api_doc_extractor.py +0 -2
- kodit/infrastructure/sqlalchemy/embedding_repository.py +44 -34
- kodit/infrastructure/sqlalchemy/enrichment_association_repository.py +73 -0
- kodit/infrastructure/sqlalchemy/enrichment_v2_repository.py +145 -97
- kodit/infrastructure/sqlalchemy/entities.py +12 -116
- kodit/infrastructure/sqlalchemy/git_branch_repository.py +52 -244
- kodit/infrastructure/sqlalchemy/git_commit_repository.py +35 -324
- kodit/infrastructure/sqlalchemy/git_file_repository.py +70 -0
- kodit/infrastructure/sqlalchemy/git_repository.py +60 -230
- kodit/infrastructure/sqlalchemy/git_tag_repository.py +53 -240
- kodit/infrastructure/sqlalchemy/query.py +331 -0
- kodit/infrastructure/sqlalchemy/repository.py +203 -0
- kodit/infrastructure/sqlalchemy/task_repository.py +79 -58
- kodit/infrastructure/sqlalchemy/task_status_repository.py +45 -52
- kodit/migrations/versions/4b1a3b2c8fa5_refactor_git_tracking.py +190 -0
- {kodit-0.5.4.dist-info → kodit-0.5.6.dist-info}/METADATA +1 -1
- {kodit-0.5.4.dist-info → kodit-0.5.6.dist-info}/RECORD +60 -50
- kodit/infrastructure/mappers/enrichment_mapper.py +0 -83
- kodit/infrastructure/mappers/git_mapper.py +0 -193
- kodit/infrastructure/mappers/snippet_mapper.py +0 -104
- kodit/infrastructure/sqlalchemy/snippet_v2_repository.py +0 -479
- {kodit-0.5.4.dist-info → kodit-0.5.6.dist-info}/WHEEL +0 -0
- {kodit-0.5.4.dist-info → kodit-0.5.6.dist-info}/entry_points.txt +0 -0
- {kodit-0.5.4.dist-info → kodit-0.5.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
kodit/.gitignore,sha256=ztkjgRwL9Uud1OEi36hGQeDGk3OLK1NfDEO8YqGYy8o,11
|
|
2
2
|
kodit/__init__.py,sha256=aEKHYninUq1yh6jaNfvJBYg-6fenpN132nJt1UU6Jxs,59
|
|
3
|
-
kodit/_version.py,sha256=
|
|
4
|
-
kodit/app.py,sha256=
|
|
3
|
+
kodit/_version.py,sha256=cK44j3gESPDerYNsAlInZd36FaFcP1dYcSF1jeRDXF8,704
|
|
4
|
+
kodit/app.py,sha256=7WxSQcktnpYBmjO1skIjMeBu55rVVRf4lotBEq55pAM,5846
|
|
5
5
|
kodit/cli.py,sha256=QSTXIUDxZo3anIONY-grZi9_VSehWoS8QoVJZyOmWPQ,3086
|
|
6
6
|
kodit/cli_utils.py,sha256=umkvt4kWNapk6db6RGz6bmn7oxgDpsW2Vo09MZ37OGg,2430
|
|
7
7
|
kodit/config.py,sha256=x_67lawaejOenJvl8yMxzXgdIkeWx8Yyc2ISO37GCvc,8031
|
|
@@ -13,50 +13,56 @@ 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=
|
|
16
|
+
kodit/application/factories/server_factory.py,sha256=dr0X_zQRUlEybtGZ3NS-kkwTU-K96u2D1Qw5xhWkd88,17409
|
|
17
17
|
kodit/application/services/__init__.py,sha256=p5UQNw-H5sxQvs5Etfte93B3cJ1kKW6DNxK34uFvU1E,38
|
|
18
|
-
kodit/application/services/code_search_application_service.py,sha256=
|
|
19
|
-
kodit/application/services/commit_indexing_application_service.py,sha256=
|
|
20
|
-
kodit/application/services/enrichment_query_service.py,sha256=
|
|
21
|
-
kodit/application/services/indexing_worker_service.py,sha256=
|
|
22
|
-
kodit/application/services/queue_service.py,sha256=
|
|
18
|
+
kodit/application/services/code_search_application_service.py,sha256=ceyv5TTN-jvlOFOupGa9XwfTTraLNN2GU55kFeulVXY,7763
|
|
19
|
+
kodit/application/services/commit_indexing_application_service.py,sha256=CIJdBdAIdere6fEJ1KytQgDu0jNXoDiE748aFcEiOmQ,42631
|
|
20
|
+
kodit/application/services/enrichment_query_service.py,sha256=RMVze-DzS5zAki1iC96Kid7tbg-nHSv0z8eqPsiURqc,15002
|
|
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=
|
|
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=
|
|
28
|
-
kodit/domain/value_objects.py,sha256=
|
|
27
|
+
kodit/domain/protocols.py,sha256=KxTHnYbECvMoXdbvXNHVF-l-OEr2kzQsoxlVXbatgwg,7814
|
|
28
|
+
kodit/domain/value_objects.py,sha256=FW0sTMtcl0Q1qej7vzEg7-Gsv86Z01IbPrDdudsgU3g,18097
|
|
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=
|
|
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=
|
|
35
|
+
kodit/domain/enrichments/architecture/architecture.py,sha256=_3nF9qdBdcA8rTXPkb1KO2F7OXTcH9SajqNYB-ICaZA,507
|
|
36
|
+
kodit/domain/enrichments/architecture/database_schema/__init__.py,sha256=xS5UGMfHqOXjpr4ZZQup3IUtevJxBDXMH4fO7wuH5vM,35
|
|
37
|
+
kodit/domain/enrichments/architecture/database_schema/database_schema.py,sha256=OOiG5SrN4Jyw_L6_-UVg4DaGWNo5JLiii7e21ZLtDvY,529
|
|
36
38
|
kodit/domain/enrichments/architecture/physical/__init__.py,sha256=4jc89cGxALWo8d3Xzfb5t-YjcCyDb1dDVGwTqVYBFmc,48
|
|
37
39
|
kodit/domain/enrichments/architecture/physical/discovery_notes.py,sha256=Wdv41rkUcMgRqXWB5Q9roaGMGFznH4V_I7mELUvDShw,636
|
|
38
40
|
kodit/domain/enrichments/architecture/physical/formatter.py,sha256=V_JvHsGDPPJ-TqGS-G61P3OS3xe0QpS2NLBEk5jX6Yc,351
|
|
39
|
-
kodit/domain/enrichments/architecture/physical/physical.py,sha256=
|
|
41
|
+
kodit/domain/enrichments/architecture/physical/physical.py,sha256=2jHGYbX7Uivy3qP-e1njgG6QW_rRw6VzPqlU5-VJ5iY,524
|
|
40
42
|
kodit/domain/enrichments/development/__init__.py,sha256=ls7zlKUpSpyLZRl-WTuaow9C68c0COkjcoEEEenpMxk,38
|
|
41
|
-
kodit/domain/enrichments/development/development.py,sha256=
|
|
43
|
+
kodit/domain/enrichments/development/development.py,sha256=amzcheLEtXbOyhhmjlay_yt1Z2FRyW2CrR8wZWkpC0g,483
|
|
42
44
|
kodit/domain/enrichments/development/snippet/__init__.py,sha256=M5XVnlDgfqSE5UiAqkQwE1Mbr5Rg8zQpcspHKC3k_xU,34
|
|
43
|
-
kodit/domain/enrichments/development/snippet/snippet.py,sha256=
|
|
45
|
+
kodit/domain/enrichments/development/snippet/snippet.py,sha256=A1f385Bu3_ZBaDKQrGHZMb6GIiQoo-hORFSw2ca56yQ,791
|
|
46
|
+
kodit/domain/enrichments/history/__init__.py,sha256=OXS0MOFEjD76rBOmLl8yA2L3Q8NYebBkoGhAmgbO2O0,27
|
|
47
|
+
kodit/domain/enrichments/history/history.py,sha256=pdmkU2ZZGFBsZDQ7kKo1hj-GaVKUd0v4Q2Fu15WE2A8,464
|
|
48
|
+
kodit/domain/enrichments/history/commit_description/__init__.py,sha256=j0fVMIkao9RzkLa6JakBPP40KrELl1eb-dfOLvfADMQ,38
|
|
49
|
+
kodit/domain/enrichments/history/commit_description/commit_description.py,sha256=96yKz-YsyWPfUu7zFtnT9AhRe7DjLmky9z0jy7oreFo,518
|
|
44
50
|
kodit/domain/enrichments/usage/__init__.py,sha256=7W36rvCF6DH-VqW2RiqU6GMlkYYHZy9Wm0DL_3_fbRc,40
|
|
45
|
-
kodit/domain/enrichments/usage/api_docs.py,sha256=
|
|
46
|
-
kodit/domain/enrichments/usage/usage.py,sha256=
|
|
51
|
+
kodit/domain/enrichments/usage/api_docs.py,sha256=5cvkNXUfAWDb0HJGIViAzIEZDGEnBnWYhkacs4lHCYA,470
|
|
52
|
+
kodit/domain/enrichments/usage/usage.py,sha256=U_JrxwXWlFtOzCP7fbfMd-NH75W44MwVFliONMzYB4U,453
|
|
47
53
|
kodit/domain/entities/__init__.py,sha256=Wh05xl-8y0j3e7m4KkFcwT7d2R_dlGwphJeOUodDkWw,8633
|
|
48
|
-
kodit/domain/entities/git.py,sha256=
|
|
54
|
+
kodit/domain/entities/git.py,sha256=AUQ6dQxFR7jkzPJX76-SmhKs06Yl2T78hj7Iqqvv1Ts,5793
|
|
49
55
|
kodit/domain/factories/__init__.py,sha256=0JnpqMDhhbuCG4UoEbdc_SM7RfTyOCpotTUB7GN6glU,32
|
|
50
|
-
kodit/domain/factories/git_repo_factory.py,sha256=
|
|
56
|
+
kodit/domain/factories/git_repo_factory.py,sha256=EdeQo4HsBi2hVeVvnSnYtFdR3yGVZQWurrq624kakYg,3086
|
|
51
57
|
kodit/domain/services/__init__.py,sha256=Q1GhCK_PqKHYwYE4tkwDz5BIyXkJngLBBOHhzvX8nzo,42
|
|
52
58
|
kodit/domain/services/bm25_service.py,sha256=-E5k0td2Ucs25qygWkJlY0fl7ZckOUe5xZnKYff3hF8,3631
|
|
53
|
-
kodit/domain/services/embedding_service.py,sha256=
|
|
54
|
-
kodit/domain/services/git_repository_service.py,sha256=
|
|
55
|
-
kodit/domain/services/git_service.py,sha256=
|
|
59
|
+
kodit/domain/services/embedding_service.py,sha256=CEcQ2E9XvOcjKNCJEw5soYUNMHJ5LCJGyXzPCl75CPc,4812
|
|
60
|
+
kodit/domain/services/git_repository_service.py,sha256=suIBmiBG9OcXUFrw1uiYRidS9yvFEekZU8H-tsY0zs0,16545
|
|
61
|
+
kodit/domain/services/git_service.py,sha256=Lr7kPnnBEa_fWfGA9jpffMK7wcfxQ0wfXgynsbSKSzg,11661
|
|
56
62
|
kodit/domain/services/physical_architecture_service.py,sha256=0YgoAvbUxT_VwgIh_prftSYnil_XIqNPSoP0g37eIt4,7209
|
|
57
63
|
kodit/domain/services/task_status_query_service.py,sha256=rI93pTMHeycigQryCWkimXSDzRqx_nJOr07UzPAacPE,736
|
|
58
64
|
kodit/domain/tracking/__init__.py,sha256=5FvxhDxB2Fpr8Dw8BLtjfPE1YUWn2rr3u7njQlqcosk,30
|
|
59
|
-
kodit/domain/tracking/resolution_service.py,sha256=
|
|
65
|
+
kodit/domain/tracking/resolution_service.py,sha256=WBPFjjp49BNfUSJUDkAGjTD5Ug_s9g9RRCXaIiBKce0,2650
|
|
60
66
|
kodit/domain/tracking/trackable.py,sha256=-9UT-c5iDkg5LxLl-BEyysvrKgHoYfofuGUacjPhVk4,479
|
|
61
67
|
kodit/infrastructure/__init__.py,sha256=HzEYIjoXnkz_i_MHO2e0sIVYweUcRnl2RpyBiTbMObU,28
|
|
62
68
|
kodit/infrastructure/api/__init__.py,sha256=U0TSMPpHrlj1zbAtleuZjU3nXGwudyMe-veNBgvODwM,34
|
|
@@ -68,18 +74,19 @@ kodit/infrastructure/api/client/search_client.py,sha256=f4mM5ZJpAuR7w-i9yASbh4SY
|
|
|
68
74
|
kodit/infrastructure/api/middleware/__init__.py,sha256=6m7eE5k5buboJbuzyX5E9-Tf99yNwFaeJF0f_6HwLyM,30
|
|
69
75
|
kodit/infrastructure/api/middleware/auth.py,sha256=QSnMcMLWvfumqN1iG4ePj2vEZb2Dlsgr-WHptkEkkhE,1064
|
|
70
76
|
kodit/infrastructure/api/v1/__init__.py,sha256=xWtkR3UP7daksCXW_Eyvcqsh091OREqfBPnlFs027_o,22
|
|
71
|
-
kodit/infrastructure/api/v1/dependencies.py,sha256=
|
|
77
|
+
kodit/infrastructure/api/v1/dependencies.py,sha256=fqocBYrQ0RbLJ91Zt0GhXrzeKfOGG-DnucnSa7HOZyE,5173
|
|
78
|
+
kodit/infrastructure/api/v1/query_params.py,sha256=1STn1Pb4TM2PzdPgCUKRuGxz6Hlt_7XLkTYQdZUYv5M,694
|
|
72
79
|
kodit/infrastructure/api/v1/routers/__init__.py,sha256=pz_7kFwHcxztbTiFI-57Q2tCAllI7u0fgTP4rpQeUoQ,22
|
|
73
|
-
kodit/infrastructure/api/v1/routers/commits.py,sha256=
|
|
80
|
+
kodit/infrastructure/api/v1/routers/commits.py,sha256=roN9cxpG2EGTiAvHoFiVs5CU6N5SskGAN3Izrf8Cw5c,12070
|
|
74
81
|
kodit/infrastructure/api/v1/routers/queue.py,sha256=srZmOCZqvcCBlDcPYt1ZWhwVhvVWARWJ3Qp4Tn5eK4Y,2148
|
|
75
|
-
kodit/infrastructure/api/v1/routers/repositories.py,sha256=
|
|
76
|
-
kodit/infrastructure/api/v1/routers/search.py,sha256=
|
|
82
|
+
kodit/infrastructure/api/v1/routers/repositories.py,sha256=oAbFH2f7Ygibyafg_1zGgbvJ8iWxWgedsnCJXqoxBeo,13292
|
|
83
|
+
kodit/infrastructure/api/v1/routers/search.py,sha256=A77gTBx5qrXvxeS5JVsRUovLz-si4PHaxAhdUHWIsSQ,3181
|
|
77
84
|
kodit/infrastructure/api/v1/schemas/__init__.py,sha256=capaxPe7y28pWj6Pu5hfTOxLnVL9pwW-hJu7ZdN2klw,41
|
|
78
85
|
kodit/infrastructure/api/v1/schemas/commit.py,sha256=UVGkwZNjwUMiitUbFws1_mlZN7IALq99P99HJCg5h2c,1794
|
|
79
86
|
kodit/infrastructure/api/v1/schemas/context.py,sha256=E6gra1uByM8FYmIXlJeaM59j5VhG4M5E9MzgsGWWJHs,317
|
|
80
|
-
kodit/infrastructure/api/v1/schemas/enrichment.py,sha256=
|
|
87
|
+
kodit/infrastructure/api/v1/schemas/enrichment.py,sha256=44NxuLAaU_4Nvx1gkgf67CtvECewCzkyzNFCHxJowUA,966
|
|
81
88
|
kodit/infrastructure/api/v1/schemas/queue.py,sha256=oa4wumWOvGzi53Q3cjwIrQJRoentp5nsQSsaj-l-B4U,652
|
|
82
|
-
kodit/infrastructure/api/v1/schemas/repository.py,sha256=
|
|
89
|
+
kodit/infrastructure/api/v1/schemas/repository.py,sha256=MKcVyeuQfE9ZdiwcOmwa4n0JIvqJ3H5wpcG5F5NLft4,3158
|
|
83
90
|
kodit/infrastructure/api/v1/schemas/search.py,sha256=IrqPvIH4IA1QBfmWkD33JqhOmhOJVaZRvOfrNjzowCg,5768
|
|
84
91
|
kodit/infrastructure/api/v1/schemas/snippet.py,sha256=--WFiu-6SLevfbDsozo34lGaROOHTrebnVU9VR6bSFs,1181
|
|
85
92
|
kodit/infrastructure/api/v1/schemas/tag.py,sha256=hJSyaokIk3ggytGZjggLjfWQ-2lni21_L_scIh8kFfk,584
|
|
@@ -88,8 +95,10 @@ kodit/infrastructure/bm25/__init__.py,sha256=DmGbrEO34FOJy4e685BbyxLA7gPW1eqs2gA
|
|
|
88
95
|
kodit/infrastructure/bm25/local_bm25_repository.py,sha256=YE3pUkPS5n1JNu6oSM_HRBOXM8U04HiY8dMMZCf9CMQ,5197
|
|
89
96
|
kodit/infrastructure/bm25/vectorchord_bm25_repository.py,sha256=LjbUPj4nPMb9pdEudThUbZTmQjhxvpN314EzKGpXfi0,8621
|
|
90
97
|
kodit/infrastructure/cloning/git/__init__.py,sha256=20ePcp0qE6BuLsjsv4KYB1DzKhMIMsPXwEqIEZtjTJs,34
|
|
91
|
-
kodit/infrastructure/cloning/git/git_python_adaptor.py,sha256=
|
|
98
|
+
kodit/infrastructure/cloning/git/git_python_adaptor.py,sha256=GCBdswC5txbt8_TWbMEbhvRvlmOvPCLwb6qBlx7b3XU,21594
|
|
92
99
|
kodit/infrastructure/cloning/git/working_copy.py,sha256=sPKQN-A1gDVV_QJISNNP4PqxRWxyj5owv5tvWfXMl44,3909
|
|
100
|
+
kodit/infrastructure/database_schema/__init__.py,sha256=jgejYX70fjV69zCuOBiNw3oCQlCKYzxTkjnUUUU7DY0,48
|
|
101
|
+
kodit/infrastructure/database_schema/database_schema_detector.py,sha256=zXU7HqrZU4_EYckloKDbH0gZvZ3_TJG5-Bd5PAkEkXc,10167
|
|
93
102
|
kodit/infrastructure/embedding/__init__.py,sha256=F-8nLlWAerYJ0MOIA4tbXHLan8bW5rRR84vzxx6tRKI,39
|
|
94
103
|
kodit/infrastructure/embedding/embedding_factory.py,sha256=6nP8HKKlNWmDE8ATT5tNQHgPqeTDUMpRuWwn2rsfrOQ,3446
|
|
95
104
|
kodit/infrastructure/embedding/local_vector_search_repository.py,sha256=urccvadIF-uizmYuzK7ii7hl2HaV7swHCiS8P6n7U18,3507
|
|
@@ -112,9 +121,6 @@ kodit/infrastructure/ignore/ignore_pattern_provider.py,sha256=zdxun3GodLfXxyssBK
|
|
|
112
121
|
kodit/infrastructure/indexing/__init__.py,sha256=7UPRa2jwCAsa0Orsp6PqXSF8iIXJVzXHMFmrKkI9yH8,38
|
|
113
122
|
kodit/infrastructure/indexing/fusion_service.py,sha256=VJiSmE1XujtaZhi1lpkGwjUKdqI-XVRNDSRHOeJWMlo,1790
|
|
114
123
|
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
124
|
kodit/infrastructure/mappers/task_mapper.py,sha256=R4-hVJD0-wHP51MbX9yiWSBBdeCJ7UiZZWTJwYp2gK8,1511
|
|
119
125
|
kodit/infrastructure/mappers/task_status_mapper.py,sha256=5lo_jS2EKYg4czOOAFmrWfQl3OojIokwpzhaR3b1wE0,3433
|
|
120
126
|
kodit/infrastructure/physical_architecture/__init__.py,sha256=DLfszH6h_bRgksDS_TtzJ13Dfa5TuFas9eI99DdZbF4,54
|
|
@@ -130,20 +136,23 @@ kodit/infrastructure/reporting/db_progress.py,sha256=VVaCKjC_UFwdRptXbBroG9qhXCx
|
|
|
130
136
|
kodit/infrastructure/reporting/log_progress.py,sha256=yhzkjYulEn_sfpKwHKi--HdQHLb4h4uEolhFYqvdHS8,1261
|
|
131
137
|
kodit/infrastructure/reporting/telemetry_progress.py,sha256=uT9mNyF2bQ83a0bQvUAXXsidvTievc16DUYKUN0X4tY,581
|
|
132
138
|
kodit/infrastructure/slicing/__init__.py,sha256=x7cjvHA9Ay2weUYE_dpdAaPaStp20M-4U2b5MLgT5KM,37
|
|
133
|
-
kodit/infrastructure/slicing/api_doc_extractor.py,sha256=
|
|
139
|
+
kodit/infrastructure/slicing/api_doc_extractor.py,sha256=wKgClsV3yHCOLs0Dp2nLqYLKXiBwf-PZawMewO4mAX0,29421
|
|
134
140
|
kodit/infrastructure/slicing/ast_analyzer.py,sha256=Kd42XixjTmWWroQEmzwUSoRMiMIdNaLPXikQxrSHJ8M,43556
|
|
135
141
|
kodit/infrastructure/slicing/slicer.py,sha256=EDYkoLf6RsTVloudZUq6LS5X10JJAHWcKWx3pllYTFU,21975
|
|
136
142
|
kodit/infrastructure/sqlalchemy/__init__.py,sha256=UXPMSF_hgWaqr86cawRVqM8XdVNumQyyK5B8B97GnlA,33
|
|
137
|
-
kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=
|
|
138
|
-
kodit/infrastructure/sqlalchemy/
|
|
139
|
-
kodit/infrastructure/sqlalchemy/
|
|
140
|
-
kodit/infrastructure/sqlalchemy/
|
|
141
|
-
kodit/infrastructure/sqlalchemy/
|
|
142
|
-
kodit/infrastructure/sqlalchemy/
|
|
143
|
-
kodit/infrastructure/sqlalchemy/
|
|
144
|
-
kodit/infrastructure/sqlalchemy/
|
|
145
|
-
kodit/infrastructure/sqlalchemy/
|
|
146
|
-
kodit/infrastructure/sqlalchemy/
|
|
143
|
+
kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=OhSIuNEQ725WoxaIpK3jcZvUVPW-b95HKRXr1HjurmI,8824
|
|
144
|
+
kodit/infrastructure/sqlalchemy/enrichment_association_repository.py,sha256=mjlGH4vkIv1cPfhkZ4SUyGWpMbgeS7QljsK54yQvV4g,2615
|
|
145
|
+
kodit/infrastructure/sqlalchemy/enrichment_v2_repository.py,sha256=9C7y6aRzHHkKJYTTAFxU5p0kwJVBjhqHvs-wUZDWsmk,6350
|
|
146
|
+
kodit/infrastructure/sqlalchemy/entities.py,sha256=kvZqUPCN2TNgovdNAT_0h4Y8zrgFWwkk-OecvcHIz-A,14852
|
|
147
|
+
kodit/infrastructure/sqlalchemy/git_branch_repository.py,sha256=dW9kBr8aDBXXVmw1zEux2mueiKhTcpG0JxnLuz5yZ3w,3106
|
|
148
|
+
kodit/infrastructure/sqlalchemy/git_commit_repository.py,sha256=jzYpFV1gjI-Wfgai-hxesglYn6XD384mqIorV1AtNCA,1991
|
|
149
|
+
kodit/infrastructure/sqlalchemy/git_file_repository.py,sha256=s_CjSYafobjMEr0zV_NBV9rFgg1cvn5BqadUGVcSOjU,2548
|
|
150
|
+
kodit/infrastructure/sqlalchemy/git_repository.py,sha256=gSSxAKwYKXEN9Nzjbc5Jup7u49OXMHSFClAViYZKZqg,3560
|
|
151
|
+
kodit/infrastructure/sqlalchemy/git_tag_repository.py,sha256=-edeOmmz_FpPlk7x0v-EvMNwmT1HhPTRApjsoBWOBdg,2948
|
|
152
|
+
kodit/infrastructure/sqlalchemy/query.py,sha256=hzkN6cVKpJDqVvNMKvVB9JoFXfrduxFwqkHU-milGLQ,10414
|
|
153
|
+
kodit/infrastructure/sqlalchemy/repository.py,sha256=IC6wUU3GKwiaomm3zgr09mv-F_iOuPSW8nghxXIFtik,8485
|
|
154
|
+
kodit/infrastructure/sqlalchemy/task_repository.py,sha256=4FZAJ7W39WiZXeoA2A1dDCloyrfXA7UqlOsZX04JAgk,4969
|
|
155
|
+
kodit/infrastructure/sqlalchemy/task_status_repository.py,sha256=4F9XpXuubpzLmO1HMfSq7E4U8JV6KI-VwieS8Y-6lws,3139
|
|
147
156
|
kodit/infrastructure/sqlalchemy/unit_of_work.py,sha256=MAF8sBr-T5crSWx1wvjf00xboPNz9YMyzRfaKSLCbzQ,1970
|
|
148
157
|
kodit/migrations/README,sha256=ISVtAOvqvKk_5ThM5ioJE-lMkvf9IbknFUFVU_vPma4,58
|
|
149
158
|
kodit/migrations/__init__.py,sha256=lP5MuwlyWRMO6UcDWnQcQ3G-GYHcFb6rl9gYPHJ1sjo,40
|
|
@@ -153,6 +162,7 @@ kodit/migrations/versions/04b80f802e0c_foreign_key_review.py,sha256=zZjiRLx16JBV
|
|
|
153
162
|
kodit/migrations/versions/19f8c7faf8b9_add_generic_enrichment_type.py,sha256=5uFUwzscBslU7jGeu4WJ_To_mqrg77V8ML4c2FiL9pQ,9458
|
|
154
163
|
kodit/migrations/versions/4073b33f9436_add_file_processing_flag.py,sha256=c8dMcKQ-BBBr_2-92eJZFS3Fwe3__B2eNqvQeMZHs0w,917
|
|
155
164
|
kodit/migrations/versions/4552eb3f23ce_add_summary.py,sha256=WjyBQzFK8IXuvta15YBE23yaTMM1rZCXvPxW98MStng,870
|
|
165
|
+
kodit/migrations/versions/4b1a3b2c8fa5_refactor_git_tracking.py,sha256=2KyXllayA5yInnf2D48O2HJUnZVGw1EoX2OxENYKO8k,6733
|
|
156
166
|
kodit/migrations/versions/7c3bbc2ab32b_add_embeddings_table.py,sha256=JL6lxaYtGbXolrkNEujg5SWj3_aQBWReYP3I4vcibdo,1755
|
|
157
167
|
kodit/migrations/versions/7f15f878c3a1_add_new_git_entities.py,sha256=6RoJPwSZT_jfzhCR09lXGz9haYpvzKVeS1aZSh00TCA,25269
|
|
158
168
|
kodit/migrations/versions/85155663351e_initial.py,sha256=h8DWmSxVwTtWlmWNH8-S4AxfEIbCm_iWtR6Kg5psPnk,3605
|
|
@@ -167,8 +177,8 @@ kodit/utils/dump_config.py,sha256=dd5uPgqh6ATk02Zt59t2JFKR9X17YWjHudV0nE8VktE,11
|
|
|
167
177
|
kodit/utils/dump_openapi.py,sha256=EasYOnnpeabwb_sTKQUBrrOLHjPcOFQ7Zx0YKpx9fmM,1239
|
|
168
178
|
kodit/utils/generate_api_paths.py,sha256=TMtx9v55podDfUmiWaHgJHLtEWLV2sLL-5ejGFMPzAo,3569
|
|
169
179
|
kodit/utils/path_utils.py,sha256=UB_81rx7Y1G1jalVv2PX8miwaprBbcqEdtoQ3hPT3kU,2451
|
|
170
|
-
kodit-0.5.
|
|
171
|
-
kodit-0.5.
|
|
172
|
-
kodit-0.5.
|
|
173
|
-
kodit-0.5.
|
|
174
|
-
kodit-0.5.
|
|
180
|
+
kodit-0.5.6.dist-info/METADATA,sha256=7G7BfnWWbmDkwSSiKribmesiUY5NlzjcxwqsZiTJjUw,7703
|
|
181
|
+
kodit-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
182
|
+
kodit-0.5.6.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
|
|
183
|
+
kodit-0.5.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
184
|
+
kodit-0.5.6.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
|
-
)
|