Skip to content

refactor(sprint-2): DSH 插件目录拆为 @innate/domain-dsh 域插件 + datasource 抽离 - #22

Merged
qdriven merged 8 commits into
mainfrom
qdriven/issue-13
Oct 26, 2026
Merged

qdriven merged 8 commits into
mainfrom
qdriven/issue-13

Conversation

@qdriven

@qdriven qdriven commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

closes #13
closes #18, closes #19, closes #20, closes #21

结论(issue #13 的「检查并确认」)

可行,已实施。 完整调研:tasks/sprint-2/research/dsh-domain-split.md;架构记录:docs/arch-design/dsh-domain-split.md。

改动

层 结果
域插件 新包 dsh/(@innate/domain-dsh,pluginOrder 30):/dsh 四页自包含,src/index.ts 导出 webDomain;基础仓 scanDomains 真机验证通过
datasource 抽离 backend/src/dsh/(catalog / routes / export):YAML 加载 + 搜索、/api/plugins* Hono 子应用、plugins.json 静态导出——域包不持有数据逻辑(issue 要求的抽离口径)
feeds 域瘦身 frontend 删 /dsh 路由、navItem 与迁移文件;standalone 宿主经 collectWebDomainRoutes/collectNavItems 组合双域,单站导航与 URL 不变
死代码 删除 dsh-plugin-directory/(未用 Next.js 原型,-6k 行)
CI/文档 ci.yml 加 dsh typecheck;根脚本覆盖 dsh;AGENTS.md / README / arch-design 更新(含 innate-fe registry 登记片段,与 feeds P3 同批)

验证

  • /api/plugins* 五端点迁移前后对拍等价(2716 plugins / 20 categories)
  • 三包 typecheck + bun test 41/41 + format check 全绿
  • 双域路由内存实测:/trending|/digest → feeds,/dsh|/dsh/categories|/dsh/plugins/$slug → dsh
  • build:static 产物含 plugins.json(3.9MB);preview /、/dsh、/data/plugins.json 全 200
  • Bun.build 对跨包相对导入解析正常;Tailwind 扫描源已扩展至 dsh/src(dsh 专属类已入 CSS)

实施中发现的两个关键事实(已记入 task-03 文档)

  1. tsc 的 paths 是 program 级全局 —— dsh 包内 @/ 别名被 frontend typecheck 拉入同 program 时会错解析 → dsh 内全改相对导入。
  2. frontend/package.json 不得声明 @innate/domain-dsh(@innate/* + workspace: 会被 innate-fe-cli 的 rewriteWorkspaceDeps 拒绝)→ 宿主以相对导入消费(host-only 文件,不进打包面)。

🤖 Generated with Claude Code

qdriven and others added 6 commits October 26, 2026 15:51
…#18)

- backend/src/dsh/catalog.ts: YAML catalog loading + search (moved from
  backend/src/data/plugin-catalog.ts, unchanged behavior)
- backend/src/dsh/routes.ts: Hono sub-app with the five /api/plugins*
  routes (moved out of server.ts, mounted via app.route)
- backend/src/dsh/export.ts: plugins.json static export slice extracted
  from export-incremental.ts
- API responses verified field-equivalent on live endpoints; 41 tests pass

Co-Authored-By: Claude Code <noreply@anthropic.com>
- new top-level dsh/ package: pages/components/services/types moved from
  frontend (unchanged content), self-contained via vendored
  markdown-body / copy-install-button / cn utils / vite-env types
- src/web-domain.tsx: createWebDomain("dsh") with /dsh-prefixed routes
  + navItems/homeTile capabilities; src/index.ts exports webDomain
- scanDomains contract verified against the real base-repo scanner
  (id=dsh, pluginOrder=30, hasStyles=false — theme comes from host)
- workspace wiring: root package.json workspaces + local
  pnpm-workspace.yaml (untracked)
- frontend untouched in this step (slimming is T3)

Co-Authored-By: Claude Code <noreply@anthropic.com>
…alone host (issue #20)

- web-domain.tsx: drop /dsh routes and the Plugins navItem (now owned by
  @innate/domain-dsh); tsconfig drops the plugin-categories mapping
- delete migrated files: pages/dsh, plugin-* components, services/plugins,
  types/plugin, types/dsh (markdown-body / copy-install-button stay —
  feeds pages still use them)
- main.tsx (host-only): compose feeds + dsh via collectWebDomainRoutes
  onto one root route; HostShell aggregates navItems via collectNavItems
- dsh package internals switched to relative imports — tsc paths are
  program-global, so @/ aliases inside dsh would misresolve when pulled
  into the frontend typecheck program
- build.ts / dev.ts: Tailwind oxide scan extended with dsh/src (plus dev
  watch); verified dsh pages + dsh-only classes land in both bundles
- runtime-verified dual-domain router: /trending|/digest → feeds,
  /dsh|/dsh/categories|/dsh/plugins/$slug → dsh, unknown → root only

Co-Authored-By: Claude Code <noreply@anthropic.com>
…follow-up)

tsc paths mappings are program-global: when the frontend typecheck pulls
dsh sources in via main.tsx, dsh's @/ aliases would resolve against the
frontend tsconfig. Relative imports work identically for tsc, Bun.build,
and the future innate-fe gen copy.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…it (issue #21)

- delete dsh-plugin-directory/ (unused Next.js prototype, -6k lines)
- CI: typecheck the dsh domain package; root typecheck/format scripts
  cover dsh/ (prettier run repo-wide, formatting check green)
- AGENTS.md / README.md: repo map + where-to-make-changes updated for
  dsh/ package and backend/src/dsh/ datasource
- docs/arch-design/dsh-domain-split.md: outcome layout, constraints
  (self-contained package, no workspace dep from frontend, no @/ aliases
  across packages), innate-fe registry snippet; migration doc §6-4 note
- verified: build:static exports plugins.json (2716 plugins) and preview
  serves /, /dsh, /data/plugins.json all 200

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
qdriven and others added 2 commits October 26, 2026 16:22
The CLI auto-starts Verdaccio via `npx --yes verdaccio` with a 120s
readiness timeout; on cold runners the npx download alone now exceeds
that window (two consecutive failures on PR #22). Installing the binary
up front moves the download outside the timed window. Applied to both
CI jobs and the daily Pages deploy.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant