Skip to content

Commit 2fdc8cf

Browse files
Fix gradio skills add (#13304)
* changes * changes * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent 77fca72 commit 2fdc8cf

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

.changeset/yummy-jars-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gradio": patch
3+
---
4+
5+
feat:Fix `gradio skills add`

gradio/cli/commands/skills.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@
3535
skills_app = typer.Typer(help="Manage Gradio skills for AI assistants.")
3636

3737

38-
def _import_hf_skills():
39-
try:
40-
from huggingface_hub.cli.skills import ( # type: ignore[import-not-found]
41-
CENTRAL_GLOBAL,
42-
CENTRAL_LOCAL,
43-
GLOBAL_TARGETS,
44-
LOCAL_TARGETS,
45-
)
46-
except (ImportError, ModuleNotFoundError):
47-
raise SystemExit(
48-
"The 'gradio skills' command requires huggingface_hub >= 1.4.0.\n"
49-
"Please upgrade: pip install --upgrade huggingface_hub"
50-
) from None
51-
return CENTRAL_GLOBAL, CENTRAL_LOCAL, GLOBAL_TARGETS, LOCAL_TARGETS
38+
def _get_skill_targets():
39+
central_local = Path(".agents/skills")
40+
central_global = Path("~/.agents/skills")
41+
claude_local = Path(".claude/skills")
42+
claude_global = Path("~/.claude/skills")
43+
global_targets = {
44+
"claude": claude_global,
45+
"codex": Path("~/.codex/skills"),
46+
"opencode": Path("~/.opencode/skills"),
47+
}
48+
local_targets = {
49+
"claude": claude_local,
50+
"codex": Path(".codex/skills"),
51+
"opencode": Path(".opencode/skills"),
52+
}
53+
return central_global, central_local, global_targets, local_targets
5254

5355

5456
def _download(url: str) -> str:
@@ -324,7 +326,7 @@ def skills_add(
324326
specific Gradio Space with Python, JS, and cURL usage examples.
325327
"""
326328
central_global, central_local, hf_global_targets, hf_local_targets = (
327-
_import_hf_skills()
329+
_get_skill_targets()
328330
)
329331

330332
if not (cursor or claude or codex or opencode or dest):

0 commit comments

Comments
 (0)