Commit graph

13 commits

Author SHA1 Message Date
chenbaowang
c14b844c10 refactor(cli): merge list/check commands, unify skill status display
- 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.
2026-04-24 14:58:07 +08:00
chenbaowang
84a7288621 fix(cli): remove debug logging from api-client 2026-04-24 10:18:36 +08:00
chenbaowang
aa9fd5f771 feat(cli): add command aliases and unhide command 2026-04-24 10:16:16 +08:00
chenbaowang
273e14a26f feat(cli): 添加 --namespace 选项和智能 namespace 解析
- 新建 skill-resolver.ts 公共函数,提供 resolveSkillNamespace 和 parseSkillNamespace
- 为 resolve, download, star, rating, rate, report, delete, archive, hide, unhide 添加 --namespace 选项
- inspect 使用 resolveSkillNamespace 替代手动解析
- install 优化 --from 为主选项,-a, --add 为别名
- download 优化帮助界面,添加 Examples 和更清晰的描述
2026-04-23 15:20:38 +08:00
chenbaowang
4a7ebb4efc feat(cli): implement comprehensive sort strategy with backend and client-side sorting
- Backend sorts (direct API): newest, downloads, rating
- Client-side sorts (fetch then re-sort): hot, stars
- Add --rating option for rating-based sorting (backend supported)
- Add applyClientSort() function for client-side sorting logic
- Hot sort formula: downloads * 0.6 + stars * 0.4
- Update SearchSkill interface to include stars, rating, updatedAt fields
- Ensure all sort options work correctly with both list and search APIs
2026-04-22 16:35:06 +08:00
chenbaowang
2fffc2b377 fix(cli): remove unsupported rating sort, add stars sort, clean up versions command
- Remove --rating option and rating sort (API doesn't support it)
- Add --stars shorthand for star-based sorting
- Fix interactive-search.ts to use stars sort instead of rating
- Add ratingAvg field to SkillDetail and display in explore output
- Delete deprecated versions.ts command (functionality merged into inspect)
2026-04-22 16:01:12 +08:00
chenbaowang
d4ea485662 fix(cli): fix registry config priority for login and all commands
- Remove hardcoded default from Commander --registry option that
  overrode config file settings in ALL commands
- Login command now uses loadConfigFromProgram() like other commands
  instead of hardcoded http://localhost:8080
- Improved login error messages with registry URL context
2026-04-21 17:32:06 +08:00
chenbaowang
8815c1596c fix(cli): human-readable API error messages
ApiError previously displayed raw JSON like:
  API error 403: {"code":403,"msg":"Access denied..."}

Now extracts the msg field from the API response body and displays:
  Access denied to skill: find-skills
  Run `skillhub login` to authenticate.

Changes:
- Add extractHumanMessage() to pull msg/message/error from response
- ApiError.message now shows human text instead of raw JSON
- 401/403 responses append login hint
- whoami: remove redundant 'Not authenticated:' prefix
2026-04-21 10:21:32 +08:00
chenbaowang
2543cd52e7 fix(cli): make --registry parameter work for all commands
Fixed the issue where the --registry command-line parameter was defined
but not actually used by any commands.

Changes:
- Added loadConfigFromProgram() helper in config.ts to read registry from program.opts()
- Updated all 21 command files to use loadConfigFromProgram() instead of loadConfig()
- Ensured correct priority: CLI args > env vars > config file > defaults

Priority order:
1. --registry <url> (command-line flag) - highest priority
2. SKILLHUB_REGISTRY (environment variable)
3. ~/.skillhub/config.json (config file)
4. http://localhost:8080 (default value)

This allows users to temporarily override the registry without modifying
environment variables or config files, providing better flexibility for:
- Testing against different registries
- Multi-project/multi-environment setups
- CI/CD automation scripts

Updated commands:
- install, download, update, check, sync, uninstall
- explore, search
- publish, delete, archive, versions
- inspect, resolve, rating, rate, star, report, reviews
- whoami, me, namespaces, notifications
- transfer, hide, unhide

Fixes issue where `npx motovis-skillhub install <skill> --registry <url>`
would ignore the --registry parameter and use env vars or defaults instead.
2026-04-21 00:07:15 +08:00
chenbaowang
32395ee5c2 refactor(cli): use dynamic isUniversalForScope instead of static isUniversalAgent
- 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
2026-04-20 19:48:58 +08:00
chenbaowang
626490e554 feat(cli): support SKILLHUB_REGISTRY env var for registry URL
Priority: SKILLHUB_REGISTRY env var > ~/.skillhub/config.json > default
2026-04-16 10:49:40 +08:00
chenbaowang
c86d99f227 feat(explore): add --sort parameter for hot/newest/downloads ordering
- 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
2026-04-14 14:12:37 +08:00
chenbaowang
6c0d4f4f16 feat(skillhub-cli): add skillhub CLI with interactive multi-agent support
- 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
2026-04-14 10:21:09 +08:00