kodit 0.3.7__py3-none-any.whl → 0.3.8__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.
- kodit/_version.py +2 -2
- kodit/config.py +3 -2
- kodit/infrastructure/cloning/git/working_copy.py +23 -2
- kodit/infrastructure/slicing/slicer.py +12 -3
- {kodit-0.3.7.dist-info → kodit-0.3.8.dist-info}/METADATA +1 -1
- {kodit-0.3.7.dist-info → kodit-0.3.8.dist-info}/RECORD +9 -9
- {kodit-0.3.7.dist-info → kodit-0.3.8.dist-info}/WHEEL +0 -0
- {kodit-0.3.7.dist-info → kodit-0.3.8.dist-info}/entry_points.txt +0 -0
- {kodit-0.3.7.dist-info → kodit-0.3.8.dist-info}/licenses/LICENSE +0 -0
kodit/_version.py
CHANGED
kodit/config.py
CHANGED
|
@@ -23,7 +23,6 @@ if TYPE_CHECKING:
|
|
|
23
23
|
from kodit.database import Database
|
|
24
24
|
|
|
25
25
|
DEFAULT_BASE_DIR = Path.home() / ".kodit"
|
|
26
|
-
DEFAULT_DB_URL = f"sqlite+aiosqlite:///{DEFAULT_BASE_DIR}/kodit.db"
|
|
27
26
|
DEFAULT_LOG_LEVEL = "INFO"
|
|
28
27
|
DEFAULT_LOG_FORMAT = "pretty"
|
|
29
28
|
DEFAULT_DISABLE_TELEMETRY = False
|
|
@@ -160,7 +159,9 @@ class AppContext(BaseSettings):
|
|
|
160
159
|
)
|
|
161
160
|
|
|
162
161
|
data_dir: Path = Field(default=DEFAULT_BASE_DIR)
|
|
163
|
-
db_url: str = Field(
|
|
162
|
+
db_url: str = Field(
|
|
163
|
+
default_factory=lambda data: f"sqlite+aiosqlite:///{data['data_dir']}/kodit.db"
|
|
164
|
+
)
|
|
164
165
|
log_level: str = Field(default=DEFAULT_LOG_LEVEL)
|
|
165
166
|
log_format: str = Field(default=DEFAULT_LOG_FORMAT)
|
|
166
167
|
disable_telemetry: bool = Field(default=DEFAULT_DISABLE_TELEMETRY)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Working copy provider for git-based sources."""
|
|
2
2
|
|
|
3
3
|
import hashlib
|
|
4
|
+
import shutil
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
import git
|
|
@@ -47,6 +48,26 @@ class GitWorkingCopyProvider:
|
|
|
47
48
|
async def sync(self, uri: str) -> Path:
|
|
48
49
|
"""Refresh a Git working copy."""
|
|
49
50
|
clone_path = self.get_clone_path(uri)
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
# Check if the clone directory exists and is a valid Git repository
|
|
53
|
+
if not clone_path.exists() or not (clone_path / ".git").exists():
|
|
54
|
+
self.log.info(
|
|
55
|
+
"Clone directory does not exist or is not a Git repository, "
|
|
56
|
+
"preparing...",
|
|
57
|
+
uri=uri, clone_path=str(clone_path)
|
|
58
|
+
)
|
|
59
|
+
return await self.prepare(uri)
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
repo = git.Repo(clone_path)
|
|
63
|
+
repo.remotes.origin.pull()
|
|
64
|
+
except git.InvalidGitRepositoryError:
|
|
65
|
+
self.log.warning(
|
|
66
|
+
"Invalid Git repository found, re-cloning...",
|
|
67
|
+
uri=uri, clone_path=str(clone_path)
|
|
68
|
+
)
|
|
69
|
+
# Remove the invalid directory and re-clone
|
|
70
|
+
shutil.rmtree(clone_path)
|
|
71
|
+
return await self.prepare(uri)
|
|
72
|
+
|
|
52
73
|
return clone_path
|
|
@@ -399,7 +399,10 @@ class Slicer:
|
|
|
399
399
|
"""Get tag name from start_tag node."""
|
|
400
400
|
for child in start_tag.children:
|
|
401
401
|
if child.type == "tag_name" and child.text:
|
|
402
|
-
|
|
402
|
+
try:
|
|
403
|
+
return child.text.decode("utf-8")
|
|
404
|
+
except UnicodeDecodeError:
|
|
405
|
+
return None
|
|
403
406
|
return None
|
|
404
407
|
|
|
405
408
|
def _get_element_id(self, start_tag: Node) -> str | None:
|
|
@@ -424,7 +427,10 @@ class Slicer:
|
|
|
424
427
|
"""Get attribute name."""
|
|
425
428
|
for child in attr_node.children:
|
|
426
429
|
if child.type == "attribute_name" and child.text:
|
|
427
|
-
|
|
430
|
+
try:
|
|
431
|
+
return child.text.decode("utf-8")
|
|
432
|
+
except UnicodeDecodeError:
|
|
433
|
+
return None
|
|
428
434
|
return None
|
|
429
435
|
|
|
430
436
|
def _get_attr_value(self, attr_node: Node) -> str | None:
|
|
@@ -433,7 +439,10 @@ class Slicer:
|
|
|
433
439
|
if child.type == "quoted_attribute_value":
|
|
434
440
|
for val_child in child.children:
|
|
435
441
|
if val_child.type == "attribute_value" and val_child.text:
|
|
436
|
-
|
|
442
|
+
try:
|
|
443
|
+
return val_child.text.decode("utf-8")
|
|
444
|
+
except UnicodeDecodeError:
|
|
445
|
+
return None
|
|
437
446
|
return None
|
|
438
447
|
|
|
439
448
|
def _extract_css_rule_name(self, node: Node) -> str | None:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
kodit/.gitignore,sha256=ztkjgRwL9Uud1OEi36hGQeDGk3OLK1NfDEO8YqGYy8o,11
|
|
2
2
|
kodit/__init__.py,sha256=aEKHYninUq1yh6jaNfvJBYg-6fenpN132nJt1UU6Jxs,59
|
|
3
|
-
kodit/_version.py,sha256=
|
|
3
|
+
kodit/_version.py,sha256=gHWHfHNAKBB_bBMbV4M8RamJgUj-nflRcHf1dqqQ_W8,511
|
|
4
4
|
kodit/app.py,sha256=3_smkoioIQEYtRLIGHDtgGkmkP6Movd5CygQEMOStP8,3043
|
|
5
5
|
kodit/cli.py,sha256=ZOS_VzCHGjJRZzZpaVR00QXSPIwRXPYu-pTrbEtlyR0,19328
|
|
6
|
-
kodit/config.py,sha256=
|
|
6
|
+
kodit/config.py,sha256=Il_eeyg7s83QF5lmiFB6qX6pmpiqCWncHtPgPcdA4xA,8063
|
|
7
7
|
kodit/database.py,sha256=kI9yBm4uunsgV4-QeVoCBL0wLzU4kYmYv5qZilGnbPE,1740
|
|
8
8
|
kodit/log.py,sha256=r0o7IpNvV-dNW-cTNWu1ouJF71vD9wHYzvqDPzeDYfw,8768
|
|
9
9
|
kodit/mcp.py,sha256=aEcPc8dQiZaR0AswCZZNxcm_rhhUZNsEBimYti0ibSI,7221
|
|
@@ -35,7 +35,7 @@ kodit/infrastructure/bm25/vectorchord_bm25_repository.py,sha256=Jyic55V-38XeTad4
|
|
|
35
35
|
kodit/infrastructure/cloning/__init__.py,sha256=IzIvX-yeRRFZ-lfvPVSEe_qXszO6DGQdjKwwDigexyQ,30
|
|
36
36
|
kodit/infrastructure/cloning/metadata.py,sha256=GD2UnCC1oR82RD0SVUqk9CJOqzXPxhOAHVOp7jqN6Qc,3571
|
|
37
37
|
kodit/infrastructure/cloning/git/__init__.py,sha256=20ePcp0qE6BuLsjsv4KYB1DzKhMIMsPXwEqIEZtjTJs,34
|
|
38
|
-
kodit/infrastructure/cloning/git/working_copy.py,sha256=
|
|
38
|
+
kodit/infrastructure/cloning/git/working_copy.py,sha256=qYcrR5qP1rhWZiYGMT1p-1Alavi_YvQLXx4MgIV7eXs,2611
|
|
39
39
|
kodit/infrastructure/embedding/__init__.py,sha256=F-8nLlWAerYJ0MOIA4tbXHLan8bW5rRR84vzxx6tRKI,39
|
|
40
40
|
kodit/infrastructure/embedding/embedding_factory.py,sha256=SOVX3wGxW8Qo2lJmMZ0kRssXKn6A4W7DmSpgo0zWTfM,3625
|
|
41
41
|
kodit/infrastructure/embedding/local_vector_search_repository.py,sha256=ExweyNEL5cP-g3eDhGqZSih7zhdOrop2WdFPPJL-tB4,3505
|
|
@@ -61,7 +61,7 @@ kodit/infrastructure/mappers/__init__.py,sha256=QPHOjNreXmBPPovZ6elnYFS0vD-IsmrG
|
|
|
61
61
|
kodit/infrastructure/mappers/index_mapper.py,sha256=ZSfu8kjTaa8_UY0nTqr4b02NS3VrjqZYkduCN71AL2g,12743
|
|
62
62
|
kodit/infrastructure/slicing/__init__.py,sha256=x7cjvHA9Ay2weUYE_dpdAaPaStp20M-4U2b5MLgT5KM,37
|
|
63
63
|
kodit/infrastructure/slicing/language_detection_service.py,sha256=JGJXrq9bLyfnisWJXeP7y1jbZMmKAISdPBlRBCosUcE,684
|
|
64
|
-
kodit/infrastructure/slicing/slicer.py,sha256=
|
|
64
|
+
kodit/infrastructure/slicing/slicer.py,sha256=AuhEaNIe2871NQW415L8mEfz4_w_z-4MlzwlSn-MgK8,34629
|
|
65
65
|
kodit/infrastructure/sqlalchemy/__init__.py,sha256=UXPMSF_hgWaqr86cawRVqM8XdVNumQyyK5B8B97GnlA,33
|
|
66
66
|
kodit/infrastructure/sqlalchemy/embedding_repository.py,sha256=dC2Wzj_zQiWExwfScE1LAGiiyxPyg0YepwyLOgDwcs4,7905
|
|
67
67
|
kodit/infrastructure/sqlalchemy/entities.py,sha256=Dmh0z-dMI0wfMAPpf62kxU4md6NUH9P5Nx1QSTITOfg,5961
|
|
@@ -82,8 +82,8 @@ kodit/migrations/versions/__init__.py,sha256=9-lHzptItTzq_fomdIRBegQNm4Znx6pVjwD
|
|
|
82
82
|
kodit/migrations/versions/c3f5137d30f5_index_all_the_things.py,sha256=r7ukmJ_axXLAWewYx-F1fEmZ4JbtFd37i7cSb0tq3y0,1722
|
|
83
83
|
kodit/utils/__init__.py,sha256=DPEB1i8evnLF4Ns3huuAYg-0pKBFKUFuiDzOKG9r-sw,33
|
|
84
84
|
kodit/utils/path_utils.py,sha256=thK6YGGNvQThdBaCYCCeCvS1L8x-lwl3AoGht2jnjGw,1645
|
|
85
|
-
kodit-0.3.
|
|
86
|
-
kodit-0.3.
|
|
87
|
-
kodit-0.3.
|
|
88
|
-
kodit-0.3.
|
|
89
|
-
kodit-0.3.
|
|
85
|
+
kodit-0.3.8.dist-info/METADATA,sha256=Ohc2oFIK0kwB-BF2smc5DT6vCkKobEy_SOOlcTWh9EA,6973
|
|
86
|
+
kodit-0.3.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
87
|
+
kodit-0.3.8.dist-info/entry_points.txt,sha256=hoTn-1aKyTItjnY91fnO-rV5uaWQLQ-Vi7V5et2IbHY,40
|
|
88
|
+
kodit-0.3.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
89
|
+
kodit-0.3.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|