feat(skills): downloads count/sort, update scope, and Skills Hub docs - #91
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add copy link button next to download .zip button with tooltip - Use terminal style (BASH) for all command displays - Simplify human install section to single command - Remove SOON badge from install section Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add lodash debounce (300ms) to search input to prevent excessive API calls - Fix pagination/sort/category not fetching by calling fetchSkills in updateQueryAndFetch - Remove dead code renderInlineCommand function - Remove orphaned CSS selectors .human-command-card and .human-command-title Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Track successful zip deliveries on skills_items.downloads (web download and registry CLI install), surface counts in the market UI, and support sortBy=downloads. Aligns registry stats.downloads with the real counter.
Add Project/Global/Both selection for update (-g/-p, interactive prompt, named-slug both, -y auto-detect), with design docs and domain glossary.
Document install/list/update/uninstall/upload with screenshots, and open the docsify guide from the skills page help icon (same pattern as proxy).
Extract shared count helpers, use MySQL errno for duplicate index, drop as-assertions in scope prompts, and tighten count display defaults.
Move download counting out of buildSkillZip into the registry controller so CLI and web share one seam. Prefer coerceCount and typed mocks over truthy fallbacks and as const in tests.
E2E / 手跑验证(截图不进 PR 提交)环境:本地 市场 UI — 下载量排序与展示
列表 · 按下载量排序 列表 · 最终状态 详情 · zip 后 downloads=3 详情 · CLI install 后 downloads=4
|
Remove CONTEXT.md and the update-scope design draft; keep product code only.
Align changed sources with repo prettier/stylelint so GitHub CI passes.
本地流水线自查(对齐
|
| 步骤 | 结果 |
|---|---|
yarn prettier |
PASS(仓库内变更文件;本地 .agents/.scratch 未提交) |
yarn eslint |
PASS(0 error,仅既有 warning) |
yarn stylelint |
PASS(修了 skills/style.scss 的 color-hex-case:#fff → #FFF) |
yarn check-types |
PASS |
yarn build |
PASS |
| registry contract + integration | 50 pass |
dt-skill skills.test.ts |
49 pass |
自查修复提交:5657a63 style: fix prettier and stylelint for CI
| @@ -0,0 +1,17 @@ | |||
| # dt-skill update scope Implementation Plan | |||
| }, | ||
| { | ||
| label: '下载', | ||
| value: String(detail.downloads), |
There was a problem hiding this comment.
String(detail.downloads || 0) ,参考 String(detail.stars || 0) 的
| }, | ||
| { | ||
| label: '下载', | ||
| value: String(detail.downloads), |
There was a problem hiding this comment.
String(detail.downloads || 0) ,参考 String(detail.stars || 0) 的
Match detail downloads fallback to stars (|| 0) and drop the local update-scope plan file from the branch.
Review 已跟进
本地流水线:prettier / eslint(改动文件)/ stylelint / check-types / build 均通过后提交。 提交: |
Keep both master market-card description helpers and PR download stats helpers after merging DTStack#89/DTStack#90 into feat_skill_pr90_base.
There was a problem hiding this comment.
Pull request overview
This PR extends the Doraemon Skills ecosystem (Web marketplace + Registry + dt-skill CLI) by adding download counting/sorting, aligning dt-skill update scope behavior with vercel-style project/global/both semantics, and publishing Skills Hub documentation with a new help entry point from the Skills market UI.
Changes:
- Add
downloadsto skills storage/model/DTOs, count downloads on successful zip delivery, and support sorting by downloads. - Update
dt-skill updateto resolve scope via-g/-pflags, interactive selection, and non-interactive fallback. - Add Skills Hub docs (docsify) and wire a Skills market help icon to
skillsHelpDocUrl.
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/skills-registry-integration.test.js | Updates integration test to assert downloads are incremented on successful download. |
| test/skills-registry-contract.test.js | Extends contract tests for downloads field and downloads-based sorting. |
| sql/doraemon.sql | Adds downloads column and index to skills_items schema. |
| env.json | Adds skillsHelpDocUrl used by the Web UI help entry point. |
| dt-skill/src/cli/ui.ts | Adds update-scope selection UI and refactors scope selection helpers. |
| dt-skill/src/cli/commands/update.ts | Implements vercel-aligned update scope resolution and multi-scope update execution. |
| dt-skill/src/cli/commands/skills.test.ts | Adds tests for update-scope resolution and adjusts update tests for scoped behavior. |
| dt-skill/src/cli.ts | Adds -g/-p options for update and maps CLI options into the new update scope options. |
| docs/docsify/zh-cn/guide/dt-skill.md | Adds Skills Hub (dt-skill) documentation page. |
| docs/docsify/zh-cn/_sidebar.md | Adds Skills Hub link to the Chinese sidebar. |
| docs/docsify/_sidebar.md | Adds Skills Hub link to the root sidebar. |
| app/web/pages/skills/types.ts | Adds downloads to the Web Skill types. |
| app/web/pages/skills/style.scss | Adds styling for the fixed help icon entry point. |
| app/web/pages/skills/index.tsx | Adds help icon linking to docs; supports downloads sort option and query/input sync. |
| app/web/pages/skills/detail/SkillSummaryModalContent.tsx | Displays downloads in detail summary and normalizes date formatting. |
| app/web/pages/skills/detail/components/SkillDetailHero.tsx | Displays downloads in the detail hero stats. |
| app/web/components/skills/style.scss | Adds styling hook for a downloads badge in skill cards. |
| app/web/components/skills/SkillCard.tsx | Displays downloads badge and normalizes date formatting. |
| app/utils/skill-stats.js | Introduces shared helpers for count coercion and aggregation. |
| app/service/skillsRegistry.js | Adds downloads stats, downloads sort, and aggregates package stats via shared helpers. |
| app/service/skills.js | Adds downloads column/index migration, download increment service, downloads sort, and aggregation. |
| app/model/skills_item.js | Adds downloads field to the Sequelize model definition. |
| app/controller/skillsRegistry.js | Counts downloads on successful registry zip downloads. |
| app/controller/skills.js | Counts downloads on successful Web zip downloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { API } from '@/api'; | ||
| import helpIcon from '@/asset/images/help-icon.png'; | ||
| import { SkillCard } from '@/components/skills/SkillCard'; | ||
| import config from '../../../../env.json'; | ||
| import { SkillItem, SkillListResponse } from './types'; |
| {config.skillsHelpDocUrl ? ( | ||
| <img | ||
| className="help-icon" | ||
| src={helpIcon} | ||
| onClick={handleHelpIcon} | ||
| alt="帮助文档" | ||
| title="Skills Hub 帮助文档" | ||
| /> | ||
| ) : null} |
| // Count only on actual zip download (not install-meta sha256 rebuild). | ||
| await ctx.service.skills.incrementDownloads(resolvedSlug); | ||
| ctx.set('Content-Type', 'application/zip'); |
| // Count only on successful zip download (same seam as web controller). | ||
| await ctx.service.skills.incrementDownloads(result.slug); | ||
| ctx.set('Content-Type', 'application/zip'); |
Ship CLI version for update-scope and related Skills Hub work on this branch.
Ask Copilot PR reviews to comment in Simplified Chinese while keeping identifiers and paths untranslated.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 28 changed files in this pull request and generated no new comments.
Suppressed comments (3)
app/controller/skills.js:43
- 这里
incrementDownloads的注释写明“download response must not depend on this”,但 controller 仍然await计次写库。若 DB/网络抖动,会直接拉长 zip 下载响应时间(甚至卡住),与“成功下发不受计数影响”的目标不一致。建议改为 fire-and-forget(例如void ...),让下载响应不阻塞在计数逻辑上。
} = await ctx.service.skills.getSkillArchive(slug);
// Count only on actual zip download (not install-meta sha256 rebuild).
await ctx.service.skills.incrementDownloads(resolvedSlug);
ctx.set('Content-Type', 'application/zip');
app/controller/skillsRegistry.js:92
- 这里同样
await ctx.service.skills.incrementDownloads(...)会把 DB 写入延迟叠加到 zip 下载接口上;且incrementDownloads自身已做 try/catch 日志兜底,完全可以异步触发,避免影响下载吞吐与尾延迟。建议不要await。
return;
}
// Count only on successful zip download (same seam as web controller).
await ctx.service.skills.incrementDownloads(result.slug);
ctx.set('Content-Type', 'application/zip');
app/web/pages/skills/index.tsx:334
- 帮助入口用
<img onClick>实现会导致键盘不可达(无法 Tab 聚焦/Enter 触发),对无鼠标用户不友好。建议至少补齐role="button"、tabIndex和键盘事件(或改为<button>)。
<img
className="help-icon"
src={helpIcon}
onClick={handleHelpIcon}
alt="帮助文档"





摘要
基于
feat_skill(PR #90 相关基线)的增量改动:skill-statsdt-skill update对齐 vercel 的 project / global / both(-g/-p、交互选择、非 TTY 下hasProjectSkills兜底)docs/docsify/.../dt-skill.md)+ 市场帮助入口(skillsHelpDocUrl)buildSkillZip纯打包、测试类型收敛、去掉计数兜底 / 计次 seam 不一致测试计划
dt-skillskills.test.ts(scope 解析)npm run dev+ ego-lite):列表按下载量排序、详情计次/时间、zip 计次 seamupdate→ 选择 Global;update -g命中~/.agentsskillsHelpDocUrl路径(当前 GH 页 404)说明
feat_skill(非 master/dev)CONTEXT.md/ update-scope design 已从本 PR 移除