Skip to content

feat: SkillHub CLI — Agent Skills 包管理工具#300

Open
Rsweater wants to merge 69 commits intoiflytek:mainfrom
Rsweater:feat/skillhub-cli-v2
Open

feat: SkillHub CLI — Agent Skills 包管理工具#300
Rsweater wants to merge 69 commits intoiflytek:mainfrom
Rsweater:feat/skillhub-cli-v2

Conversation

@Rsweater
Copy link
Copy Markdown
Contributor

@Rsweater Rsweater commented Apr 13, 2026

feat(skillhub-cli): SkillHub CLI — Agent Skills 包管理工具

Summary

skillhub-cli 是 SkillHub 的命令行工具,基于 clawhub、skills 开发,用于发布、搜索、安装和管理 Agent Skills。现有issue中提到的命名空间、版本等问题均已解决,另外添加交互式引的搜索、安装skill等。

主要特性

特性 说明
多源安装 支持从 Registry、Git 仓库、本地路径安装 Skills
交互式体验 TUI 搜索、多选菜单、安装确认
多 Agent 支持 自动检测已安装的 Agent,支持指定安装目标
版本管理 支持指定版本、Tag 安装,版本锁定文件
完整工作流 发布、同步、评分、收藏、通知等

技能中心注册

# 临时方案
export SKILLHUB_REGISTRY=http://<skillhub-ip>:<backend-port>      # Linux
set SKILLHUB_REGISTRY=http://<skillhub-ip>:<backend-port>            # CMD
$env:SKILLHUB_REGISTRY="http://<skillhub-ip>:<backend-port>"      # PowerShell

# 长期方案
# Linux
vim ~/.skillhub/config.json      #默认 http://localhost:8080
# CMD
setx SKILLHUB_REGISTRY "http://<skillhub-ip>:<backend-port>"
# PowerShell
[System.Environment]::SetEnvironmentVariable("SKILLHUB_REGISTRY", "http://<skillhub-ip>:<backend-port>", "User")

命令速查表

认证

skillhub login --token <TOKEN>      # Token 登录
skillhub logout                     # 登出
skillhub whoami                     # 查看当前用户
skillhub whoami --json              # JSON 输出

搜索发现

# 浏览/搜索 skills(主命令)
skillhub explore [query]              # 交互式浏览搜索
skillhub explore <query> -n 20     # 指定结果数

# 别名
skillhub search <query>            # explore 的别名
skillhub find <query>                # explore 的别名
skillhub find-skills <query>       # explore 的别名

# 命名空间
skillhub namespaces                  # 列出有权限的命名空间

# 查看详情
skillhub inspect <slug>              # 查看 skill 详情(别名: info, view)
skillhub inspect <ns/slug>         # 指定命名空间
skillhub inspect <slug> --namespace <ns>

# 版本列表
skillhub versions <slug>            # 列出所有版本
skillhub versions <ns/slug>        # 指定命名空间

# 解析版本
skillhub resolve <slug>             # 交互式选择 (如在不同空间有同名skill)
skillhub resolve <ns/slug>        # 指定命名空间
skillhub resolve <slug> --skill-version <ver>   # 指定版本
skillhub resolve <slug> --tag <tag>             # 按 tag 解析
skillhub resolve <slug> --hash <hash>            # 按内容 hash 解析

安装管理

# install - 从 registry 安装
skillhub install <slug>                     # 默认 global namespace
skillhub install <ns/slug>                  # 指定 namespace
skillhub install <slug> --namespace <ns>    # 同上
skillhub install <slug> --skill-version <ver>    # 指定版本(非交互)
skillhub install <slug> --tag <tag>              # 指定 tag(非交互)
skillhub install <slug> --copy                   # 复制模式
skillhub install <slug> --global                 # 全局安装
skillhub install <slug> -y                       # 跳过确认
skillhub install <slug> --agent <agents...>      # 指定 agents
skillhub install <slug> --list                  # 只列出不安装
skillhub i <slug>                              # 别名

# install - 从 GitHub/Local 安装(使用 --from/-a)
skillhub install <name> --from <git-url>         # Git source
skillhub install <name> --from <local-path>      # Local source
skillhub install <name> --from ./my-skill        # 相对路径
skillhub install <name> --from /path/to/skill    # 绝对路径
skillhub install <name> --from github:owner/repo # GitHub 简写
skillhub install <name> --from ~/.agents/skills  # 展开 tilde 路径
skillhub install owner/repo                     # 自动检测为 git

# list - 已安装列表
skillhub list                      # 列出所有已安装(交互式选择 scope 和 agents)
skillhub list --global             # 只显示全局
skillhub list --project           # 只显示项目级
skillhub list --all               # 显示全部
skillhub list --agent <agents>    # 按 agent 过滤
skillhub ls                       # 别名

# uninstall - 卸载
skillhub uninstall <name>                        # 交互式选择 agent
skillhub uninstall <name> --all                 # 从所有 agent 卸载
skillhub uninstall <name> --global               # 卸载全局
skillhub uninstall <name> --agent <agents...>    # 指定 agents
skillhub uninstall <name> -y                    # 跳过确认
skillhub un <name>                              # 别名

# update - 更新
skillhub update <slug>              # 更新指定 skill
skillhub update --all              # 更新全部
skillhub update --global           # 更新全局
skillhub up <slug>                 # 别名

# check - 检查
skillhub check                         # 交互式:选择 scope → agents → statuses                           
skillhub check --global            # 检查全局                                                         
skillhub check --local             # 检查项目                                                         
skillhub check --all               # 检查所有 scope                                                   
skillhub check --agent "Claude Code" --agent Cline    # 只检查特定 agents                             
skillhub check --status ok --status missing          # 只显示 OK + Missing                            
skillhub check --json              # JSON 输出

# download - 下载
skillhub download <slug>                            # 下载 skill 包
skillhub download <ns/slug>                        # 指定命名空间
skillhub download <slug> --skill-version <ver>     # 指定版本
skillhub download <slug> --tag <tag>               # 按 tag 下载
skillhub download <slug> --output <dir>            # 指定输出目录

发布

skillhub publish [path]                        # 发布 skill
skillhub publish [path] --namespace <ns>       # 发布到指定 NS
skillhub publish [path] -v <ver>              # 指定版本(semver)
skillhub publish [path] --tag <tags>           # 指定标签(逗号分隔)
skillhub publish [path] --name <name>          # 指定显示名
skillhub publish [path] --changelog <text>    # 添加更新日志

skillhub sync [path]                          # 批量发布目录中所有 skills
skillhub sync [path] --namespace <ns>         # 发布到指定 NS
skillhub sync [path] --all                    # 包含所有(即使有变更)
skillhub sync [path] -y                       # 跳过确认

skillhub init [name]                          # 创建 SKILL.md 模板

skillhub archive <slug>                       # 归档 skill
skillhub archive <slug> --namespace <ns>      # 指定命名空间
skillhub archive <slug> -y                    # 跳过确认

社交

skillhub star <slug>                    # 收藏 skill
skillhub star <slug> --namespace <ns>    # 指定命名空间
skillhub star <slug> --unstar            # 取消收藏

skillhub rating <slug>                   # 查看评分
skillhub rating <slug> --namespace <ns>  # 指定命名空间
skillhub rate <slug> <score>             # 评分(1-5 分)

skillhub me skills                       # 我的发布
skillhub me stars                        # 我的收藏

skillhub notifications list              # 通知列表
skillhub notifications list --unread     # 只显示未读
skillhub notifications read <id>        # 标记已读
skillhub notifications read-all          # 全部已读
skillhub notif list                      # 别名

skillhub reviews my                       # 我的审核提交
skillhub reviews submissions             # 别名

skillhub report <slug>                   # 举报 skill
skillhub report <slug> --reason <reason> # 指定原因

管理

skillhub delete <slug>                    # 删除 skill(需 owner)
skillhub delete <slug> --namespace <ns>   # 指定命名空间
skillhub delete <slug> -y                 # 跳过确认
skillhub del <slug>                       # 别名
skillhub unpublish <slug>                 # 别名

skillhub transfer <namespace> <newOwnerId>  # 转移所有权
skillhub transfer <namespace> <newOwnerId> -y  # 跳过确认

skillhub hide <slug>                      # 隐藏 skill(admin)
skillhub hide <slug> --namespace <ns>      # 指定命名空间
skillhub hide <slug> -y                    # 跳过确认
skillhub hide unhide <slug>                # 取消隐藏
skillhub hide unhide <slug> --namespace <ns>

全局选项

--registry <url>      # 指定 Registry(默认: http://localhost:8080)
--json               # JSON 输出
--version / -V      # 显示版本
--help / -h         # 显示帮助

Source 类型与自动检测

Type 说明 检测方式
registry 从 SkillHub registry 安装 默认,或 ns/slug 格式
git 从 Git repository 安装 owner/repogithub.com/...
local 从本地路径安装 ./ 开头、/ 开头、~ 开头

支持的 Agent:npx skills 支持的所有 agent

完整兼容 npx skills 支持的所有 Agent,并将静态分类机制改成动态分类机制,避免冗余安装

Universal Agents(通用路径 .agents/skills

Agent-Specific Path Agents


安装路径

Scope 路径
Global ~/.agents/skills/
Project <repo>/.agents/skills/

安装方式

# 编译
cd skillhub-cli && pnpm install && pnpm build

# 使用
node dist/cli.mjs --help
node dist/cli.mjs --version

# 或创建 alias
alias skillhub="node /path/to/skillhub-cli/dist/cli.mjs"
> 还未安装 npm 包,测试使用 "node /path/to/skillhub-cli/dist/cli.mjs"
> 临时 npm 包,npm install -g motovis-skillhub
> 还在充分测试阶段,欢迎尝鲜抓虫子~截止0418已知问题:
> - 交互式安装进度提示Fetching显示问题,已修复,改为发新的包
> - 前端等关于命令的显示、文档使用并未同步更新

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

…port

- Interactive agent selection for install/uninstall/list
- Namespace search selection for unspecified namespace
- --skill-version option to skip interactive selection
- --from option for local/github source installation
- Remove deprecated add command (use install --from instead)
- Path-based grouping for uninstall results
@Rsweater Rsweater force-pushed the feat/skillhub-cli-v2 branch from e66a986 to 6c0d4f4 Compare April 14, 2026 02:21
Rsweater and others added 27 commits April 14, 2026 10:32
… and fixed status

- Show '(default)' suffix when namespace is global (user didn't specify --namespace)
- Display 'Status: Published' on success instead of 'undefined'
- Keep output clean and informative for user feedback
- Use /api/v1/skills (compat API) when query is empty to get full stats
- Map sort options: hot=rating, newest=newest, downloads=downloads
- Remove vim-style k/j navigation to fix 'k' key input issue
Features:
- Add --sort option: hot (rating), newest (date), downloads (download count)
- Use /api/v1/skills (compat API) for empty queries to get full download stats
- Sort mapping: hot->rating, newest->newest, downloads->downloads

Bug fixes:
- Remove vim-style k/j navigation keys to fix 'k' character input issue
- Fix undefined namespace/status display in publish output

Testing:
- Verify --sort downloads: openspec(102) > test-publish(46) > openspec[vision2group](11) > test(9)
- Verify --sort hot: test-publish(2 stars) ranked first
- Verify --sort newest: most recently updated first
- Interactive mode: k key now inputs correctly
- Always display tags in publish output
- Show changelog when --changelog flag is provided

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…ion parsing

- undici does not auto-follow HTTP redirects, manually follow 302/307/308
  to MinIO presigned URL before piping response body
- Commander.js parses --skill-version as skillVersion (camelCase), not
  skill-version (kebab-case), fix option access in install and download
  commands
Priority: SKILLHUB_REGISTRY env var > ~/.skillhub/config.json > default
…port

- Add @types/unzipper for TypeScript support
- Fix location header type assertion (string | string[] -> string)
- Bump version to 1.0.5
… download stream completion

- install: use actualSlug instead of raw slug in addToLock to prevent
  namespace doubling (vision2group/vision2group/slug)
- update: remove hardcoded 'node dist/cli.mjs' fallback, rely on
  process.argv[1] which is always reliable
- download: use finished() to ensure stream write completes before
  proceeding
- Replace all `npx clawhub` references with `npx motovis-skillhub` / `skillhub`
- Update namespace separator from `--` to `/` in install commands
- Change env var CLAWHUB_REGISTRY to SKILLHUB_REGISTRY
- Add vite dev server plugin to serve /registry/skill.md
- Update i18n strings (zh/en): ClawHub CLI → SkillHub CLI
- Update skill.md/skill.md.template with new CLI commands
- Update quick-start.tsx syntax highlighting and env config
- Update e2e test assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ora spinner was still running during p.select() interactive prompt,
causing the spinner to continuously overwrite the terminal and block
the version selection UI. The user would see "Fetching..." stuck until
pressing Enter.

Stop spinner before p.select() and restart after selection completes.
… conflict

- Stop spinner before runInteractiveSearch to prevent terminal UI conflict
  (same issue as version selection p.select)
- Make spinner messages more specific: include skill name, version, path
  instead of generic "Fetching"/"Downloading"/"Extracting"
- Remove "还未发布" from .npmignore, add src/ to excludes
- Add scripts/notify-feishu.sh for Feishu bot release notifications
- Add scripts/release-cli.sh for one-click CLI release workflow
…iversalAgent

- Add isUniversalForScope(agent, isGlobal) and getAgentTargetDir(agent, isGlobal) to agent-detector.ts
- An agent is 'universal' when its target install dir equals the canonical .agents/skills directory
- This fixes incorrect symlink skipping for agents like Codex/Cursor whose globalSkillsDir
  differs from .agents/skills (e.g. .codex/skills, .cursor/skills)
- Update installer.ts to use dynamic check via optional AgentInfo parameter
- Update install.ts to use getAgentTargetDir and pass agent info to installSkill
- Update uninstall.ts to use isUniversalForScope for correct path resolution
- Clean up unused isUniversalAgent import in list.ts
…l grouping

- Move scope selection before agent selection in both installFromRegistry
  and installFromGit flows
- Use isUniversalForScope in selectAgentsInteractive so that the Universal
  locked section correctly reflects the actual scope:
  - Project: agents with skillsDir='.agents/skills' (Cline, Codex, Cursor, etc.)
  - Global: agents with globalSkillsDir='.agents/skills' (Cline, Warp only)
- Clean up unused getUniversalAgents/getNonUniversalAgents imports
- Sort universal and non-universal agent lists by name in selectAgentsInteractive
- Exclude agents with showInUniversalList===false from locked section
- Replace spinner.stop() with spinner.succeed() before interactive prompts
  to prevent 'Fetching' text from appearing as the step title
- Also fix spinner.stop -> spinner.succeed for 'Installation complete'
Group agents that share the same install path into a single line.
When more than 5 agents share a path, show first 5 names + count.
Sort agent names alphabetically within each group.
Extract buildInstallResultLines utility function to DRY up
duplicate output logic in installFromRegistry and installFromGit.
@Rsweater Rsweater force-pushed the feat/skillhub-cli-v2 branch from d15c8de to 71bc00e Compare April 22, 2026 09:19
…help sections

- Add interactive namespace selection to inspect command (like install)
- Add version selection when multiple versions exist (--version to skip)
- Skip version selection when --details is specified (shows all versions)
- Add error handling for 403/404 errors with helpful messages
- Add 'for installation' and 'for details' hints to explore command
- Reorganize help: separate 'Discover & Info' and 'Social & Reviews' sections
@Rsweater Rsweater force-pushed the feat/skillhub-cli-v2 branch from 71bc00e to c7d4f82 Compare April 22, 2026 10:03
Rsweater and others added 8 commits April 23, 2026 12:33
- 重新组织帮助分类(Publish → Publish & Manage)
- 统一参数命名为 <skill>,添加参数说明
- 简化 config 命令描述
- 优化 explore 帮助,添加选项分组和示例
- 修复参数重复显示问题
- 子命令帮助显示 Arguments 部分
将 inspect 命令的版本选项从 --version 改为 --skill-version,
避免与 skillhub --version 全局版本选项冲突
将 --from 描述改为 'Alias for --add',避免与 -a, --add 的
描述互相引用导致循环感
- 新建 skill-resolver.ts 公共函数,提供 resolveSkillNamespace 和 parseSkillNamespace
- 为 resolve, download, star, rating, rate, report, delete, archive, hide, unhide 添加 --namespace 选项
- inspect 使用 resolveSkillNamespace 替代手动解析
- install 优化 --from 为主选项,-a, --add 为别名
- download 优化帮助界面,添加 Examples 和更清晰的描述
- download: 添加智能搜索 namespace 和交互式版本选择
- download: 修复下载失败仍创建文件的问题
- update: 重写为带版本对比的更新流程
- update: 添加 -y/--yes 选项跳过确认
- star/rating/rate/report/delete/archive/hide/unhide: 添加 404 友好错误提示
- 提示用户使用 namespace/skill-name 格式
## 后端修改
- 添加 RouteSecurityPolicyRegistry 权限配置(修复12个CLI命令403错误)
  - /api/v1/me/** - 用户个人相关
  - /api/v1/notifications/** - 通知相关
  - /api/v1/reviews/** - 审核相关
  - /api/v1/skills/** POST/PUT - archive, rating, report
  - /api/v1/namespaces/** POST - transfer
  - DELETE /api/v1/skills/*/* - 改为所有者可删除
- AdminSkillController: hide/unhide 允许 SKILL_ADMIN
- SkillDeleteController: delete 允许 SKILL_ADMIN
- 新增 AdminAuditorController: 审计员专用控制器

## CLI修改
- publish.ts: 修复 -v 选项冲突,改为只使用 --skill-version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Rsweater Rsweater force-pushed the feat/skillhub-cli-v2 branch 2 times, most recently from 08ecff8 to 9c353c5 Compare April 24, 2026 02:22
@Rsweater Rsweater force-pushed the feat/skillhub-cli-v2 branch from 8891a01 to 898325a Compare April 24, 2026 02:25
@dongmucat
Copy link
Copy Markdown
Collaborator

dongmucat commented Apr 24, 2026

Hi @Rsweater,感谢你的贡献和对 SkillHub CLI 方向的关注!

这个 PR 的思路和我们内部正在推进的方向高度一致。我们目前已经有一份官方 SkillHub CLI 的设计 spec,正在按计划实现,会作为第一方工具集成进主仓库(cli/ 目录),基于 Bun + TypeScript 构建,并配套原生服务端适配层(/api/cli/v1)。

考虑到官方 CLI 已在开发中,我们暂时不会合并这个 PR,以避免维护两套并行实现带来的复杂度。但你的工作对我们很有参考价值,再次感谢你的投入!

Rsweater and others added 13 commits April 24, 2026 10:58
- Merge list and check into unified list command with status filtering
- Add skill-status.ts core module for shared discovery logic
- Unify interaction flow: scope -> agent -> status -> display
- Replace -g/-p/-a flags with --scope option
- Simplify check as alias for list --status managed,missing
- Fix uninstall to properly handle 'All' scope selection
- Display orphaned skills with [orphaned] marker in uninstall
- Update help text and examples

BREAKING CHANGE: Removed -g/--global, -p/--project, -a/--all flags from list command.
Use --scope global|project|all instead.
Add unified permission model for skill lifecycle operations:
- Skill owners can hide/unhide/archive their own skills
- Namespace admins/owners can manage skills in their namespace
- Platform admins retain full access via admin endpoints

Changes:
- SkillGovernanceService: add permission checks to hideSkill/unhideSkill
- SkillLifecycleAppService: add hideSkill/unhideSkill methods
- GovernanceWorkflowAppService: add facade methods for hide/unhide
- SkillLifecycleController: add POST /{namespace}/{slug}/hide and /unhide endpoints

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Remove 'admin only' restriction from hide/unhide commands
- Update API endpoint from admin path to portal path
- Reorganize help categories:
  - Move rating to My Skills section
  - Create new Skill Lifecycle section (archive, hide, unhide)
  - Remove hide/unhide from Notifications & Admin

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ories

- Add 'me namespaces' subcommand to list accessible namespaces
- Remove standalone 'namespaces' command from CLI
- Rename 'My Skills' help section to 'My Profile'
- Move namespaces listing under My Profile section

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…blish & Manage

- Merge 'Skill Lifecycle' commands (archive, hide, unhide) into 'Publish & Manage'
- Move 'reviews' from My Profile to Publish & Manage (related to publish workflow)
- Rename section from 'Publish & Content' to 'Publish & Manage'

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Fix SkillStarController to use @RequestAttribute instead of @AuthenticationPrincipal
- Fix SkillRatingController to use @RequestAttribute instead of @AuthenticationPrincipal
- Fix SkillGovernanceService NPE when userNamespaceRoles is null
- Update ApiTokenAuthenticationFilter to properly populate userNsRoles
- Enhance error messages for 403 vs 401 status codes

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add platformRoles parameter to skill lifecycle methods:
- hideSkill, archiveSkill, unhideSkill, unarchiveSkill, deleteVersion
- Support SUPER_ADMIN and SKILL_ADMIN role bypass
- Add hideSkillAsAdmin and unhideSkillAsAdmin for admin controllers
- Fix userId null checks in rating and star controllers

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…nance methods

All lifecycle methods (hideSkill, archiveSkill, unarchiveSkill, deleteVersion,
unhideSkill) now accept a Set<String> platformRoles parameter for SUPER_ADMIN/
SKILL_ADMIN bypass. Updated all test calls to pass null for this parameter.
AdminSkillControllerTest now mocks hideSkillAsAdmin instead of hideSkill.
… policies

- Add require(skill:manage) for hide/unhide/archive/unarchive endpoints
- Add allow (no scope) for social ops: star, rate, report, notifications
- Update DeviceAuthService default scope to include skill:manage
- Update TokenController default scope to include skill:manage
@Rsweater
Copy link
Copy Markdown
Contributor Author

Hi @Rsweater,感谢你的贡献和对 SkillHub CLI 方向的关注!

这个 PR 的思路和我们内部正在推进的方向高度一致。我们目前已经有一份官方 SkillHub CLI 的设计 spec,正在按计划实现,会作为第一方工具集成进主仓库(cli/ 目录),基于 Bun + TypeScript 构建,并配套原生服务端适配层(/api/cli/v1)。

考虑到官方 CLI 已在开发中,我们暂时不会合并这个 PR,以避免维护两套并行实现带来的复杂度。但你的工作对我们很有参考价值,再次感谢你的投入!

Hello @dongmucat, 非常感谢您的回复~ 虽然有点遗憾,但还是很期待官方的 CLI 发布的。

现已获悉这个情况~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants