feat(skiff): align CLI with Vercel skills and fix entry symlink
Replace install/uninstall with add/remove, add publish for git ops in ~/.skills, and resolve bin/skiff symlinks so commands work from any cwd. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Agent 名称解析(兼容 Vercel skills CLI 别名)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from skiff.paths import ALL_TARGETS
|
||||
|
||||
AGENT_ALIASES: dict[str, str] = {
|
||||
"cursor": "cursor",
|
||||
"claude": "claude",
|
||||
"claude-code": "claude",
|
||||
"codex": "codex",
|
||||
"*": "*",
|
||||
}
|
||||
|
||||
AGENT_CHOICES = sorted({*ALL_TARGETS, *AGENT_ALIASES.keys()})
|
||||
|
||||
|
||||
def flatten_agent_args(groups: list[list[str]] | None) -> list[str] | None:
|
||||
if not groups:
|
||||
return None
|
||||
flat = [item for group in groups for item in group]
|
||||
return flat or None
|
||||
|
||||
|
||||
def resolve_agent_args(agents: list[str] | None) -> list[str]:
|
||||
if not agents or agents == ["*"] or "*" in agents:
|
||||
return list(ALL_TARGETS)
|
||||
|
||||
resolved: list[str] = []
|
||||
for raw in agents:
|
||||
key = raw.lower()
|
||||
if key == "*":
|
||||
return list(ALL_TARGETS)
|
||||
target = AGENT_ALIASES.get(key)
|
||||
if target is None:
|
||||
choices = ", ".join(AGENT_CHOICES)
|
||||
raise SystemExit(f"未知 agent: {raw!r},可选: {choices}")
|
||||
if target != "*" and target not in resolved:
|
||||
resolved.append(target)
|
||||
return resolved
|
||||
Reference in New Issue
Block a user