llm-ide-rules 0.2.0__py3-none-any.whl → 0.2.1__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.
- llm_ide_rules/__init__.py +1 -1
- llm_ide_rules/commands/download.py +27 -3
- {llm_ide_rules-0.2.0.dist-info → llm_ide_rules-0.2.1.dist-info}/METADATA +1 -1
- {llm_ide_rules-0.2.0.dist-info → llm_ide_rules-0.2.1.dist-info}/RECORD +6 -6
- llm_ide_rules-0.2.1.dist-info/entry_points.txt +3 -0
- llm_ide_rules-0.2.0.dist-info/entry_points.txt +0 -3
- {llm_ide_rules-0.2.0.dist-info → llm_ide_rules-0.2.1.dist-info}/WHEEL +0 -0
llm_ide_rules/__init__.py
CHANGED
|
@@ -7,7 +7,7 @@ from llm_ide_rules.commands.explode import explode_main
|
|
|
7
7
|
from llm_ide_rules.commands.implode import cursor, github
|
|
8
8
|
from llm_ide_rules.commands.download import download_main
|
|
9
9
|
|
|
10
|
-
__version__ = "0.2.
|
|
10
|
+
__version__ = "0.2.1"
|
|
11
11
|
|
|
12
12
|
app = typer.Typer(
|
|
13
13
|
name="llm_ide_rules",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Download command: Download LLM instruction files from GitHub repositories."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import re
|
|
4
5
|
import tempfile
|
|
5
6
|
import zipfile
|
|
6
7
|
from pathlib import Path
|
|
@@ -13,9 +14,31 @@ from typing_extensions import Annotated
|
|
|
13
14
|
|
|
14
15
|
logger = structlog.get_logger()
|
|
15
16
|
|
|
16
|
-
DEFAULT_REPO = "iloveitaly/
|
|
17
|
+
DEFAULT_REPO = "iloveitaly/llm-ide-rules"
|
|
17
18
|
DEFAULT_BRANCH = "master"
|
|
18
19
|
|
|
20
|
+
|
|
21
|
+
def normalize_repo(repo: str) -> str:
|
|
22
|
+
"""Normalize repository input to user/repo format.
|
|
23
|
+
|
|
24
|
+
Handles both formats:
|
|
25
|
+
- user/repo (unchanged)
|
|
26
|
+
- https://github.com/user/repo/ (extracts user/repo)
|
|
27
|
+
"""
|
|
28
|
+
# If it's already in user/repo format, return as-is
|
|
29
|
+
if "/" in repo and not repo.startswith("http"):
|
|
30
|
+
return repo
|
|
31
|
+
|
|
32
|
+
# Extract user/repo from GitHub URL
|
|
33
|
+
github_pattern = r"https?://github\.com/([^/]+/[^/]+)/?.*"
|
|
34
|
+
match = re.match(github_pattern, repo)
|
|
35
|
+
|
|
36
|
+
if match:
|
|
37
|
+
return match.group(1)
|
|
38
|
+
|
|
39
|
+
# If no pattern matches, assume it's already in the correct format
|
|
40
|
+
return repo
|
|
41
|
+
|
|
19
42
|
# Define what files/directories each instruction type includes
|
|
20
43
|
INSTRUCTION_TYPES = {
|
|
21
44
|
"cursor": {"directories": [".cursor"], "files": []},
|
|
@@ -35,9 +58,10 @@ DEFAULT_TYPES = list(INSTRUCTION_TYPES.keys())
|
|
|
35
58
|
|
|
36
59
|
def download_and_extract_repo(repo: str, branch: str = DEFAULT_BRANCH) -> Path:
|
|
37
60
|
"""Download a GitHub repository as a ZIP and extract it to a temporary directory."""
|
|
38
|
-
|
|
61
|
+
normalized_repo = normalize_repo(repo)
|
|
62
|
+
zip_url = f"https://github.com/{normalized_repo}/archive/{branch}.zip"
|
|
39
63
|
|
|
40
|
-
logger.info("Downloading repository", repo=repo, branch=branch, url=zip_url)
|
|
64
|
+
logger.info("Downloading repository", repo=repo, normalized_repo=normalized_repo, branch=branch, url=zip_url)
|
|
41
65
|
|
|
42
66
|
try:
|
|
43
67
|
response = requests.get(zip_url, timeout=30)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
llm_ide_rules/__init__.py,sha256=
|
|
1
|
+
llm_ide_rules/__init__.py,sha256=9f68d519624fd0727e5a90476799b634cc85f9630b484ee4d7502ec6903d4a12,1109
|
|
2
2
|
llm_ide_rules/__main__.py,sha256=881447dbad0fe837590fa8224f1d0dd70416fd5344779978d07744ff8e0cf868,144
|
|
3
|
-
llm_ide_rules/commands/download.py,sha256=
|
|
3
|
+
llm_ide_rules/commands/download.py,sha256=b2f311dda452722e2f26988c681de874b4b6d4724282877c28b1ed3c39c0a95f,9033
|
|
4
4
|
llm_ide_rules/commands/explode.py,sha256=a8ace601155055a0061e47da7e99a672334796f1ebb91b24c3adf905f65e1645,11196
|
|
5
5
|
llm_ide_rules/commands/implode.py,sha256=35282bfc83be808f12e9e9ce7af1bae4069e53bd8f441948e3551339b2e9418d,8847
|
|
6
6
|
llm_ide_rules/constants.py,sha256=1182b9757ca58d038a4878d1b55570aac4f0287f1a5ab5af8d68331b799b0686,1118
|
|
7
7
|
llm_ide_rules/sections.json,sha256=9ed1725e44d8a29364e5ac3f01e0e6e03ff17cd45c280846659b7f73940b668b,549
|
|
8
|
-
llm_ide_rules-0.2.
|
|
9
|
-
llm_ide_rules-0.2.
|
|
10
|
-
llm_ide_rules-0.2.
|
|
11
|
-
llm_ide_rules-0.2.
|
|
8
|
+
llm_ide_rules-0.2.1.dist-info/WHEEL,sha256=0f7d664a881437bddec71c703c3c2f01fd13581519f95130abcc96e296ef0426,79
|
|
9
|
+
llm_ide_rules-0.2.1.dist-info/entry_points.txt,sha256=c6c00b5d607048489fcfed8c8a47bbb364b0a8dbb5b5a2ecffe11c986ace35e3,54
|
|
10
|
+
llm_ide_rules-0.2.1.dist-info/METADATA,sha256=5a7df6883922e7010ea93322e14a2a1bc7324ab6be30e94241bd608ba48059c6,3777
|
|
11
|
+
llm_ide_rules-0.2.1.dist-info/RECORD,,
|
|
File without changes
|