feat: add shallow fetch and grouped skill selection
This commit is contained in:
+21
-2
@@ -150,7 +150,7 @@ def _ensure_registry_fetched(name: str, entry: dict[str, object]) -> None:
|
||||
)
|
||||
_print(f"拉取外部 skill: {name}")
|
||||
subprocess.run(
|
||||
["git", "clone", "--branch", ref, "--", repo, str(dest)],
|
||||
["git", "clone", "--depth", "1", "--branch", ref, "--", repo, str(dest)],
|
||||
check=True,
|
||||
)
|
||||
if not discover_external_skills(name, entry):
|
||||
@@ -563,6 +563,7 @@ def cmd_select(args: argparse.Namespace) -> None:
|
||||
expected: Path,
|
||||
kind: str,
|
||||
description: str,
|
||||
indent: int = 0,
|
||||
) -> SkillChoice:
|
||||
return SkillChoice(
|
||||
name=name,
|
||||
@@ -579,6 +580,7 @@ def cmd_select(args: argparse.Namespace) -> None:
|
||||
if project_root is not None
|
||||
else ""
|
||||
),
|
||||
indent=indent,
|
||||
)
|
||||
|
||||
choices = [
|
||||
@@ -628,9 +630,26 @@ def cmd_select(args: argparse.Namespace) -> None:
|
||||
expected=expected,
|
||||
kind=f"external:{package}",
|
||||
description=description,
|
||||
indent=1,
|
||||
)
|
||||
)
|
||||
choice_requests[choice_name] = (skill_name, f"registry:{package}")
|
||||
child_names = tuple(
|
||||
f"{package}/{skill_name}"
|
||||
for skill_name in skill_names
|
||||
if f"{package}/{skill_name}" in choice_requests
|
||||
)
|
||||
if child_names:
|
||||
first_child = len(choices) - len(child_names)
|
||||
choices.insert(
|
||||
first_child,
|
||||
SkillChoice(
|
||||
name=package,
|
||||
kind="repository",
|
||||
description=str(entry.get("description", "")),
|
||||
children=child_names,
|
||||
),
|
||||
)
|
||||
|
||||
try:
|
||||
scope_label = (
|
||||
@@ -807,7 +826,7 @@ def cmd_fetch(args: argparse.Namespace) -> None:
|
||||
else:
|
||||
_print(f"克隆: {repo} -> {dest}")
|
||||
subprocess.run(
|
||||
["git", "clone", "--branch", ref, "--", repo, str(dest)],
|
||||
["git", "clone", "--depth", "1", "--branch", ref, "--", repo, str(dest)],
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user