Skip to content

feat(skills): downloads count/sort, update scope, and Skills Hub docs - #91

Merged
liuxy0551 merged 16 commits into
DTStack:masterfrom
TreeTreeDi:feat_skill_pr90_base
Aug 6, 2026
Merged

feat(skills): downloads count/sort, update scope, and Skills Hub docs#91
liuxy0551 merged 16 commits into
DTStack:masterfrom
TreeTreeDi:feat_skill_pr90_base

Conversation

@TreeTreeDi

@TreeTreeDi TreeTreeDi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

摘要

基于 feat_skill(PR #90 相关基线)的增量改动:

  • 下载量:仅在 zip 成功下发时计次(Web 与 Registry controller 同一 seam);市场列表支持按下载量排序;技能包汇总走公共 skill-stats
  • update 作用域dt-skill update 对齐 vercel 的 project / global / both(-g / -p、交互选择、非 TTY 下 hasProjectSkills 兜底)
  • 文档:Skills Hub wiki(docs/docsify/.../dt-skill.md)+ 市场帮助入口(skillsHelpDocUrl
  • review 收尾buildSkillZip 纯打包、测试类型收敛、去掉计数兜底 / 计次 seam 不一致

测试计划

  • 单测 / 契约:registry contract + integration;dt-skill skills.test.ts(scope 解析)
  • E2E(本地 npm run dev + ego-lite):列表按下载量排序、详情计次/时间、zip 计次 seam
  • CLI 手跑:交互 update → 选择 Globalupdate -g 命中 ~/.agents
  • 评审:docsify 发布后确认 skillsHelpDocUrl 路径(当前 GH 页 404)

说明

  • 基线分支:feat_skill(非 master/dev)
  • E2E 截图未提交到本分支,见 PR 评论
  • 本地设计草稿 CONTEXT.md / update-scope design 已从本 PR 移除

liuxy0551 and others added 10 commits August 4, 2026 10:32
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.
@TreeTreeDi

TreeTreeDi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

E2E / 手跑验证(截图不进 PR 提交)

环境:本地 npm run dev(Herdr)+ ego-lite UI + dt-skill 指向 http://127.0.0.1:7001
截图仅放在 fork release tag e2e-pr91-screenshots未提交到本分支。

市场 UI — 下载量排序与展示

用例 结果
列表「按下载量排序」 PASS — e2e-node18-skill 置顶且下载量最高
列表最近更新时间格式 PASS — YYYY-MM-DD HH:mm:ss
详情下载量 + 时间 PASS — hero「下载 N」+ 最近更新完整时间
Web zip /api/skills/download 计次 PASS — 成功下发 +1
Registry zip /api/v1/download 计次 PASS — +1;与 Web 同一 controller seam
CLI dt-skill install 计次 PASS — 3 → 4

列表 · 按下载量排序

13-sorted-by-downloads

列表 · 最终状态

14-final-list

详情 · zip 后 downloads=3

10-detail

详情 · CLI install 后 downloads=4

15-detail

dt-skill update · 全局路径(Herdr TTY 手跑)

  1. dt-skill --global install e2e-node18-skill -y~/.agents/skills/e2e-node18-skill
  2. update -g e2e-node18-skill → 命中全局 skill,EXIT 0
  3. 交互式 bare update → 提示 Update scope → 选择 Global
    • 只处理全局 lock(e2e-node18-skillhuaiju-test
    • 处理项目 lock(如 my-hash-skill / zentao-api
    • e2e-node18-skill: up to datehuaiju-test 因本地 registry 无该技能失败(全局残留,非 scope 选错)

已知残留

  • 市场帮助入口能打开 skillsHelpDocUrl,但 GH docsify 页仍 404(待文档发布):

11-wiki-404

完整笔记:E2E-REPORT.md

Remove CONTEXT.md and the update-scope design draft; keep product code only.
@TreeTreeDi TreeTreeDi changed the title feat(skills): downloads sort/count, update scope, Skills Hub docs feat(skills): 下载量统计排序、update 作用域、Skills Hub 文档 Aug 4, 2026
Align changed sources with repo prettier/stylelint so GitHub CI passes.
@TreeTreeDi

Copy link
Copy Markdown
Contributor Author

本地流水线自查(对齐 .github/workflows/CI.yml

已在 Node 18 + NODE_OPTIONS=--openssl-legacy-provider 下跑完再推:

步骤 结果
yarn prettier PASS(仓库内变更文件;本地 .agents/.scratch 未提交)
yarn eslint PASS(0 error,仅既有 warning)
yarn stylelint PASS(修了 skills/style.scsscolor-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

@TreeTreeDi TreeTreeDi changed the title feat(skills): 下载量统计排序、update 作用域、Skills Hub 文档 feat(skills): downloads count/sort, update scope, and Skills Hub docs Aug 4, 2026
@@ -0,0 +1,17 @@
# dt-skill update scope Implementation Plan

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件可移除

},
{
label: '下载',
value: String(detail.downloads),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String(detail.downloads || 0) ,参考 String(detail.stars || 0)

},
{
label: '下载',
value: String(detail.downloads),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@TreeTreeDi

Copy link
Copy Markdown
Contributor Author

Review 已跟进

评论 处理
docs/superpowers/plans/2026-08-03-dt-skill-update-scope.md 可移除 已删除
SkillDetailHero / SkillSummaryModalContent 下载量参考 stars 用 String(… || 0) 已改

本地流水线:prettier / eslint(改动文件)/ stylelint / check-types / build 均通过后提交。

提交:9dd37fd fix(skills): address PR review on downloads display and plans

@liuxy0551
liuxy0551 changed the base branch from feat_skill to master August 5, 2026 13:03
Keep both master market-card description helpers and PR download
stats helpers after merging DTStack#89/DTStack#90 into feat_skill_pr90_base.
Copilot AI lite review requested due to automatic review settings August 6, 2026 02:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 downloads to skills storage/model/DTOs, count downloads on successful zip delivery, and support sorting by downloads.
  • Update dt-skill update to resolve scope via -g/-p flags, 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.

Comment on lines 29 to 33
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';
Comment on lines +329 to +337
{config.skillsHelpDocUrl ? (
<img
className="help-icon"
src={helpIcon}
onClick={handleHelpIcon}
alt="帮助文档"
title="Skills Hub 帮助文档"
/>
) : null}
Comment thread app/controller/skills.js
Comment on lines +41 to 43
// Count only on actual zip download (not install-meta sha256 rebuild).
await ctx.service.skills.incrementDownloads(resolvedSlug);
ctx.set('Content-Type', 'application/zip');
Comment on lines +90 to 92
// Count only on successful zip download (same seam as web controller).
await ctx.service.skills.incrementDownloads(result.slug);
ctx.set('Content-Type', 'application/zip');
huaiju added 2 commits August 6, 2026 11:35
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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="帮助文档"

@liuxy0551
liuxy0551 merged commit 203a3fd into DTStack:master Aug 6, 2026
1 check passed
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