Skip to content

Commit 3916648

Browse files
committed
fix(cli): preserve GitHub tree tap paths
1 parent 6e7c5dc commit 3916648

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

packages/data-designer/src/data_designer/cli/repositories/plugin_tap_repository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ def _normalize_tap_url(url: str) -> str:
257257
return f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}"
258258
if len(segments) >= 4 and segments[2] == "tree":
259259
ref = segments[3]
260-
return f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/catalog/plugins.json"
260+
tap_root = "/".join(segments[4:])
261+
catalog_path = f"{tap_root}/catalog/plugins.json" if tap_root else "catalog/plugins.json"
262+
return f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{catalog_path}"
261263

262264
return url
263265

packages/data-designer/tests/cli/repositories/test_plugin_tap_repository.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ def test_add_tap_normalizes_github_repository_url(tmp_path: Path) -> None:
4343
assert repository.get_tap("research") == tap
4444

4545

46+
def test_add_tap_normalizes_github_tree_url_with_subdirectory(tmp_path: Path) -> None:
47+
repository = PluginTapRepository(tmp_path)
48+
49+
tap = repository.add_tap("research", "https://github.com/acme/dd-plugins/tree/main/custom-catalog")
50+
51+
assert tap.url == "https://raw.githubusercontent.com/acme/dd-plugins/main/custom-catalog/catalog/plugins.json"
52+
53+
4654
def test_tap_aliases_are_case_insensitive(tmp_path: Path) -> None:
4755
repository = PluginTapRepository(tmp_path)
4856

0 commit comments

Comments
 (0)