@namewta/skills-hub 0.1.49 → 0.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/README.md +4 -1
  2. package/THIRD_PARTY_NOTICES.md +19 -7
  3. package/cli.mjs +2 -2
  4. package/install.mjs +11 -4
  5. package/package.json +1 -1
  6. package/scripts/persistence/home.md +1 -1
  7. package/skills/dev/dev-build/SKILL.md +2 -0
  8. package/skills/dev/dev-build/references/implement-request.md +7 -2
  9. package/skills/dev/dev-formal-verify/SKILL.md +2 -1
  10. package/skills/dev/dev-formal-verify/references/create-check.md +3 -1
  11. package/skills/dev/dev-formal-verify/references/example.md +1 -1
  12. package/skills/dev/dev-formal-verify/references/tool-choice.md +1 -1
  13. package/skills/dev/dev-help/references/capabilities.md +6 -6
  14. package/skills/dev/dev-help/references/guide-verification.md +7 -1
  15. package/skills/dev/dev-help/references/help-method.md +7 -1
  16. package/skills/dev/dev-issue/SKILL.md +1 -0
  17. package/skills/dev/dev-issue/references/github-operations.md +8 -0
  18. package/skills/dev/dev-plan/references/plan-template.md +1 -0
  19. package/skills/dev/dev-plan/references/vertical-slicing.md +2 -0
  20. package/skills/dev/dev-pr/references/pull-request-evidence.md +2 -0
  21. package/skills/dev/dev-review/references/host-parity.md +12 -0
  22. package/skills/dev/dev-review/references/review-baseline.md +2 -0
  23. package/skills/dev/dev-setup/references/formal-options.md +1 -1
  24. package/skills/dev/dev-statechart/SKILL.md +17 -19
  25. package/skills/dev/dev-statechart/agents/openai.yaml +3 -3
  26. package/skills/dev/dev-statechart/assets/theme.css +135 -0
  27. package/skills/dev/dev-statechart/references/lean-proof.md +47 -0
  28. package/skills/dev/dev-statechart/references/render.md +15 -83
  29. package/skills/dev/dev-statechart/references/runtime.md +21 -1
  30. package/skills/dev/dev-statechart/scripts/lean/backends/lemma-chart.mjs +285 -0
  31. package/skills/dev/dev-statechart/scripts/lean/backends/mermaid.mjs +174 -0
  32. package/skills/dev/dev-statechart/scripts/lean/backends/proof-chart.mjs +540 -0
  33. package/skills/dev/dev-statechart/scripts/lean/backends/report.mjs +242 -0
  34. package/skills/dev/dev-statechart/scripts/lean/frontends/facts.mjs +234 -0
  35. package/skills/dev/dev-statechart/scripts/lean/frontends/view.mjs +217 -0
  36. package/skills/dev/dev-statechart/scripts/lean/ir.mjs +226 -0
  37. package/skills/dev/dev-statechart/scripts/lean/passes/attribute.mjs +148 -0
  38. package/skills/dev/dev-statechart/scripts/lean/passes/blocks.mjs +32 -0
  39. package/skills/dev/dev-statechart/scripts/lean/passes/budget.mjs +167 -0
  40. package/skills/dev/dev-statechart/scripts/lean/passes/check.mjs +70 -0
  41. package/skills/dev/dev-statechart/scripts/lean/passes/contract.mjs +160 -0
  42. package/skills/dev/dev-statechart/scripts/lean/passes/fold.mjs +206 -0
  43. package/skills/dev/dev-statechart/scripts/lean/passes/inline.mjs +84 -0
  44. package/skills/dev/dev-statechart/scripts/lean/passes/mark.mjs +432 -0
  45. package/skills/dev/dev-statechart/scripts/lean/passes/reduce.mjs +73 -0
  46. package/skills/dev/dev-statechart/scripts/lean/passes/trust.mjs +111 -0
  47. package/skills/dev/dev-statechart/scripts/lean/passes/view-lemmas.mjs +155 -0
  48. package/skills/dev/dev-statechart/scripts/lean/pipeline.mjs +164 -0
  49. package/skills/dev/dev-statechart/scripts/lean/run.mjs +168 -0
  50. package/skills/dev/dev-statechart/scripts/statechart.mjs +42 -23
  51. package/skills/dev/dev-statechart/scripts/worker.mjs +33 -7
  52. package/skills/dev/dev-ui-design/SKILL.md +2 -2
  53. package/skills/dev/dev-ui-design/references/interaction-review.md +9 -0
  54. package/skills/dev/dev-verify/SKILL.md +1 -1
  55. package/skills/dev/dev-verify/references/evidence-storage.md +12 -0
  56. package/skills/dev/dev-workflow/SKILL.md +6 -6
  57. package/skills/dev/dev-workflow/references/method-handoffs.md +7 -1
  58. package/skills/dev/dev-writing/SKILL.md +2 -0
  59. package/skills/dev/dev-writing/references/library-docs.md +37 -0
  60. package/skills/home/home-doctor/references/diagnosis.md +2 -2
  61. package/skills/home/home-doctor/scripts/doctor.mjs +68 -38
  62. package/skills/home/home-project-changelog/SKILL.md +6 -6
  63. package/skills/home/home-project-changelog/assets/project-changelog.example.json +188 -0
  64. package/skills/home/home-project-changelog/assets/project-changelog.schema.json +156 -0
  65. package/skills/home/home-project-changelog/assets/worker-brief.md +1 -1
  66. package/skills/home/home-project-changelog/references/git-ranges.md +2 -2
  67. package/skills/home/home-project-changelog/references/schema.md +60 -0
  68. package/skills/home/home-project-changelog/references/tools.md +27 -22
  69. package/skills/home/home-project-changelog/references/workflow.md +12 -9
  70. package/skills/home/home-project-changelog/references/writing.md +5 -3
  71. package/skills/home/home-project-changelog/scripts/changelog.mjs +34 -37
  72. package/skills/home/home-project-changelog/scripts/contract.mjs +39 -3
  73. package/skills/home/home-project-changelog/scripts/legacy-markdown.mjs +116 -0
  74. package/skills/home/home-project-changelog/scripts/migrate.mjs +122 -0
  75. package/skills/home/home-project-changelog/scripts/revision.mjs +2 -196
  76. package/skills/home/home-project-changelog/scripts/storage.mjs +120 -125
  77. package/skills/home/home-project-changelog/scripts/summary.mjs +0 -60
  78. package/skills/home/home-route/SKILL.md +2 -2
  79. package/skills/home/home-route/references/routing.md +3 -1
  80. package/skills/home/home-route/scripts/route.mjs +79 -11
  81. package/skills/home/home-setup/SKILL.md +2 -1
  82. package/skills/home/home-setup/assets/repos.schema.json +10 -0
  83. package/skills/home/home-setup/references/registry.md +18 -1
  84. package/skills/home/home-setup/scripts/registry.mjs +67 -7
  85. package/skills/home/home-website/SKILL.md +13 -9
  86. package/skills/home/home-website/assets/website/scripts/inputs.mjs +136 -128
  87. package/skills/home/home-website/assets/website/scripts/render.mjs +3 -3
  88. package/skills/home/home-website/assets/website/scripts/site.mjs +21 -10
  89. package/skills/home/home-website/assets/website/site/public/home-assets/app.js +69 -23
  90. package/skills/home/home-website/assets/website/site/public/home-assets/site.css +74 -42
  91. package/skills/home/home-website/assets/website/site/templates/layout.mjs +2 -6
  92. package/skills/home/home-website/assets/website/site/templates/ledger.mjs +33 -24
  93. package/skills/home/home-website/assets/website/site/templates/model.mjs +28 -5
  94. package/skills/home/home-website/assets/website/site/templates/pages.mjs +48 -19
  95. package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +2 -107
  96. package/skills/home/home-website/assets/website/site.config.json +1 -1
  97. package/skills/home/home-website/references/website.md +64 -46
  98. package/skills/home/home-website/scripts/activate.mjs +105 -0
  99. package/skills/home/home-website/scripts/init.mjs +79 -11
  100. package/skills/home/home-workflow/SKILL.md +6 -4
  101. package/skills/system/system-clash-proxy-config/SKILL.md +21 -0
  102. package/skills/system/system-clash-proxy-config/agents/openai.yaml +4 -0
  103. package/skills/system/system-clash-proxy-config/assets/clash-override.js +328 -0
  104. package/skills/system/{system-proxy → system-clash-proxy-config}/references/browser-privacy.md +2 -2
  105. package/skills/system/{system-config → system-clash-proxy-config}/references/changes.md +2 -2
  106. package/skills/system/{system-proxy → system-clash-proxy-config}/references/clash-verge.md +1 -1
  107. package/skills/system/{system-proxy → system-clash-proxy-config}/references/diagnosis.md +1 -1
  108. package/skills/system/system-clash-proxy-config/references/dns-workflow.md +42 -0
  109. package/skills/system/system-clash-proxy-config/references/egress-macos.md +31 -0
  110. package/skills/system/system-clash-proxy-config/references/egress-windows.md +37 -0
  111. package/skills/system/system-clash-proxy-config/references/egress.md +12 -0
  112. package/skills/system/{system-proxy → system-clash-proxy-config}/references/flclash.md +1 -1
  113. package/skills/system/{system-proxy → system-clash-proxy-config}/references/index.md +1 -1
  114. package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/linux-cutover.md +29 -0
  115. package/skills/system/system-clash-proxy-config/references/locale-workflow.md +9 -0
  116. package/skills/system/{system-proxy → system-clash-proxy-config}/references/mihomo.md +1 -25
  117. package/skills/system/system-clash-proxy-config/references/session.md +34 -0
  118. package/skills/system/system-clash-proxy-config/references/subscription.md +29 -0
  119. package/skills/system/{system-proxy → system-clash-proxy-config}/references/troubleshooting.md +7 -7
  120. package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/verification.md +2 -0
  121. package/skills/system/system-clash-proxy-config/scripts/prepare-session.mjs +155 -0
  122. package/skills/system/system-clash-proxy-config/scripts/run-session.mjs +138 -0
  123. package/skills/system/system-inspect/SKILL.md +1 -1
  124. package/skills/system/system-inspect/references/health-audit.md +1 -1
  125. package/upstream-skills/zh-archify/SKILL.md +11 -11
  126. package/upstream-skills/zh-archify/assets/template.html +6 -3
  127. package/upstream-skills/zh-archify/bin/archify.mjs +67 -4
  128. package/upstream-skills/zh-archify/modules/code-analysis/ARCHITECTURE.md +7 -1
  129. package/upstream-skills/zh-archify/modules/code-analysis/bin/analyze-run.mjs +2 -1
  130. package/upstream-skills/zh-archify/modules/code-analysis/bin/check.mjs +29 -15
  131. package/upstream-skills/zh-archify/modules/code-analysis/bin/drift.mjs +3 -3
  132. package/upstream-skills/zh-archify/modules/code-analysis/bin/prepare.mjs +5 -6
  133. package/upstream-skills/zh-archify/modules/code-analysis/bin/serve.mjs +66 -36
  134. package/upstream-skills/zh-archify/modules/code-analysis/bin/verify-change.mjs +43 -13
  135. package/upstream-skills/zh-archify/modules/code-analysis/docs/TECH-GUIDE.md +1 -1
  136. package/upstream-skills/zh-archify/modules/code-analysis/docs/USAGE.md +37 -4
  137. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/functions.mjs +7 -5
  138. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/index.mjs +4 -1
  139. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/snapshot-host.mjs +9 -0
  140. package/upstream-skills/zh-archify/modules/code-analysis/lib/architecture-drift.mjs +28 -7
  141. package/upstream-skills/zh-archify/modules/code-analysis/lib/drift-capture.mjs +4 -3
  142. package/upstream-skills/zh-archify/modules/code-analysis/lib/git-sources.mjs +5 -3
  143. package/upstream-skills/zh-archify/modules/code-analysis/lib/output.mjs +272 -0
  144. package/upstream-skills/zh-archify/modules/code-analysis/lib/pull-request.mjs +34 -4
  145. package/upstream-skills/zh-archify/modules/code-analysis/lib/task.mjs +4 -2
  146. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-context.mjs +13 -1
  147. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-history.mjs +112 -0
  148. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification.mjs +6 -2
  149. package/upstream-skills/zh-archify/modules/code-analysis/overlay/atlas.mjs +71 -5
  150. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.css +16 -2
  151. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.js +121 -5
  152. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas3d.js +38 -1
  153. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.css +14 -1
  154. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.js +187 -27
  155. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/verification.js +1 -1
  156. package/upstream-skills/zh-archify/modules/code-analysis/overlay/i18n.mjs +9 -0
  157. package/upstream-skills/zh-archify/modules/code-analysis/overlay/inject.mjs +1 -1
  158. package/upstream-skills/zh-archify/modules/code-analysis/overlay/page.mjs +11 -6
  159. package/upstream-skills/zh-archify/modules/code-analysis/overlay/pull-request.mjs +1 -1
  160. package/upstream-skills/zh-archify/modules/code-analysis/schemas/ai-task.schema.json +1 -0
  161. package/upstream-skills/zh-archify/modules/code-analysis/test/atlas.test.mjs +88 -0
  162. package/upstream-skills/zh-archify/modules/code-analysis/test/duplicates.test.mjs +1 -1
  163. package/upstream-skills/zh-archify/modules/code-analysis/test/external-workflow.test.mjs +1 -1
  164. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.json +1 -0
  165. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.missing.json +1 -0
  166. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.json +1 -0
  167. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.valid.json +1 -0
  168. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.changed.json +1 -0
  169. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.json +1 -0
  170. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/module-cycle.task.json +1 -0
  171. package/upstream-skills/zh-archify/modules/code-analysis/test/function-source-range.test.mjs +10 -0
  172. package/upstream-skills/zh-archify/modules/code-analysis/test/output-recovery.test.mjs +626 -0
  173. package/upstream-skills/zh-archify/modules/code-analysis/test/pull-request.test.mjs +98 -2
  174. package/upstream-skills/zh-archify/modules/code-analysis/test/review.test.mjs +37 -0
  175. package/upstream-skills/zh-archify/modules/code-analysis/test/source-panel.test.mjs +2 -1
  176. package/upstream-skills/zh-archify/modules/code-analysis/test/task.test.mjs +3 -2
  177. package/upstream-skills/zh-archify/modules/code-analysis/test/verification-history.test.mjs +216 -0
  178. package/upstream-skills/zh-archify/modules/code-analysis/test/verification.test.mjs +122 -0
  179. package/upstream-skills/zh-archify/package-lock.json +2 -2
  180. package/upstream-skills/zh-archify/package.json +1 -1
  181. package/upstream-skills/zh-archify/references/authoring-contract.md +2 -0
  182. package/upstream-skills/zh-archify/references/explainer-authoring.md +1 -1
  183. package/upstream-skills/zh-archify/renderers/architecture/render-architecture.mjs +1 -0
  184. package/upstream-skills/zh-archify/renderers/class/render-class.mjs +1 -0
  185. package/upstream-skills/zh-archify/renderers/dataflow/render-dataflow.mjs +2 -1
  186. package/upstream-skills/zh-archify/renderers/erd/render-erd.mjs +1 -0
  187. package/upstream-skills/zh-archify/renderers/lifecycle/render-lifecycle.mjs +4 -2
  188. package/upstream-skills/zh-archify/renderers/sequence/render-sequence.mjs +4 -2
  189. package/upstream-skills/zh-archify/renderers/shared/cli.mjs +7 -1
  190. package/upstream-skills/zh-archify/renderers/timeline/render-timeline.mjs +1 -0
  191. package/upstream-skills/zh-archify/renderers/tree/render-tree.mjs +1 -0
  192. package/upstream-skills/zh-archify/renderers/waterfall/render-waterfall.mjs +1 -0
  193. package/upstream-skills/zh-archify/renderers/workflow/render-workflow.mjs +3 -2
  194. package/upstream-skills/zh-archify/renderers/workflow/workflow-compiler.mjs +68 -7
  195. package/upstream-skills/zh-archify/skill-release.json +1 -1
  196. package/upstream-skills/zh-modern-web-guidance/SKILL.md +4 -11
  197. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-detection.md +20 -0
  198. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-model.md +22 -0
  199. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/prompt-api.md +22 -0
  200. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/summarizer.md +20 -0
  201. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/translator.md +22 -0
  202. package/upstream-skills/zh-modern-web-guidance/guides/performance/custom-ml-model-inference.md +342 -0
  203. package/upstream-skills/zh-modern-web-guidance/guides/performance/data-parallel-computation.md +337 -0
  204. package/upstream-skills/zh-modern-web-guidance/guides/performance/improve-next-page-load-performance.md +4 -1
  205. package/upstream-skills/zh-modern-web-guidance/guides/performance/large-scene-rendering.md +350 -0
  206. package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md +9 -0
  207. package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md +9 -0
  208. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/animate-to-from-top-layer.md +9 -0
  209. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/declarative-dialog-popover-control.md +9 -0
  210. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md +9 -0
  211. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/scroll-target-on-load.md +29 -0
  212. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/sortable-table.md +1 -0
  213. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/app-menus.md +9 -0
  214. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/context-menu.md +9 -0
  215. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/copy-button.md +9 -0
  216. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/dialog.md +10 -1
  217. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/hovercard.md +9 -0
  218. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/menu.md +9 -0
  219. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/navbar.md +9 -0
  220. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-app-tours.md +9 -0
  221. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-toast-notifications.md +9 -0
  222. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/toolbar.md +9 -0
  223. package/upstream-skills/zh-modern-web-guidance/guides/user-experience/content-first-noise-reduction.md +9 -0
  224. package/upstream-skills/zh-modern-web-guidance/guides/user-experience/natural-interactions.md +9 -0
  225. package/upstream-skills/zh-modern-web-guidance/guides/webmcp/agentic-javascript-tools.md +27 -0
  226. package/skills/home/home-project-changelog/assets/project-changelog.md +0 -35
  227. package/skills/system/system-clash-tun-egress/SKILL.md +0 -22
  228. package/skills/system/system-clash-tun-egress/agents/openai.yaml +0 -4
  229. package/skills/system/system-config/SKILL.md +0 -37
  230. package/skills/system/system-config/agents/openai.yaml +0 -4
  231. package/skills/system/system-config/references/ai-cli-config.md +0 -75
  232. package/skills/system/system-config/references/ai-cli-optimization.md +0 -37
  233. package/skills/system/system-config/references/index.md +0 -12
  234. package/skills/system/system-config/references/locale-workflow.md +0 -33
  235. package/skills/system/system-config/references/locale.md +0 -50
  236. package/skills/system/system-proxy/SKILL.md +0 -40
  237. package/skills/system/system-proxy/agents/openai.yaml +0 -4
  238. package/skills/system/system-proxy/assets/protected-rules.yaml +0 -7
  239. package/skills/system/system-proxy/references/dns-workflow.md +0 -152
  240. /package/skills/system/{system-config → system-clash-proxy-config}/assets/configuration.md +0 -0
  241. /package/skills/system/{system-proxy → system-clash-proxy-config}/assets/network.md +0 -0
  242. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/acceptance.md +0 -0
  243. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-fields.md +0 -0
  244. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-misconceptions.md +0 -0
  245. /package/skills/system/{system-clash-tun-egress/references/troubleshooting.md → system-clash-proxy-config/references/egress-troubleshooting.md} +0 -0
  246. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-linux.md +0 -0
  247. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-macos.md +0 -0
  248. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-windows.md +0 -0
  249. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/network-performance.md +0 -0
  250. /package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/nodes-and-dns.md +0 -0
  251. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platform-dns.md +0 -0
  252. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platforms.md +0 -0
  253. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/tun-dns.md +0 -0
@@ -4,6 +4,7 @@
4
4
 
5
5
  - 识别现有资料
6
6
  - 登记合同
7
+ - 项目首选名称
7
8
  - 原地接入和可恢复编辑
8
9
  - 批量刷新当前分支
9
10
  - 按需查看与显式导出地图
@@ -39,6 +40,7 @@ Home 是用户选定的工作入口仓库,可以是现有 Git 仓库。默认
39
40
  ```json
40
41
  {
41
42
  "formatVersion": 2,
43
+ "projectNames": {"project-a": "结算平台"},
42
44
  "repos": [
43
45
  {
44
46
  "id": "project-a",
@@ -66,6 +68,21 @@ Home 是用户选定的工作入口仓库,可以是现有 Git 仓库。默认
66
68
 
67
69
  不把默认 CLI、模型、派遣方式、凭据、PID 或运行状态放进登记。`AGENTS.md`、`.agents/`、`.agents/skills/` 是统一入口,不在每条登记维护宿主配置清单。
68
70
 
71
+ ## 项目首选名称
72
+
73
+ 用户说“以后叫它结算平台”时,将首选名称保存到 `repos.json` 顶层的 `projectNames`,键为稳定项目 ID。已登记仓库和已有 `website/changelogs/<id>.json` 的项目共用这份映射。已在网站配置中声明且父仓已登记的子模块,在首次生成日志前即可单独命名。
74
+
75
+ ```sh
76
+ node <本技能目录>/scripts/registry.mjs name --home . --repo project-a --name "结算平台"
77
+ node <本技能目录>/scripts/registry.mjs name --home . --input names.json
78
+ ```
79
+
80
+ 批量输入使用 `{"project-a":"结算平台","billing-api":"结算接口"}`。工具先核对整批 ID,再一次合并到登记。重传相同名称返回 `unchanged`。改名使用同一命令。用户只给出旧称时,先通过 `home-route` 确认稳定 ID,遇到重名时列出候选。
81
+
82
+ 既有网站上已经确定要沿用的显示名也可迁入这份映射。核对刷新结果后,可清理 `site.config.json` 中已被取代的 `displayName`。项目地图单列已命名但无独立登记的项目。
83
+
84
+ `repos[].aliases` 可保存一个已登记仓库的其他日常称呼。网站展示首选名称,项目网址、日志和派遣均使用稳定 ID。已有网站时运行 `node .agents/home/website/scripts/site.mjs refresh`,让卡片、月度明细和搜索索引一起更新。
85
+
69
86
  ## 原地接入和可恢复编辑
70
87
 
71
88
  1. 选定准确 Home 根和项目范围。按名称调用 `home-route`:未登记项目使用其 `--inspect` 方法,已登记项目按 ID 解析。记录实际路径、Git root、remote、worktree/HEAD/dirty 和观测位置;工具没有读取项目知识正文。
@@ -155,4 +172,4 @@ node <本技能目录>/scripts/registry.mjs map --home "<Home 根>" --write --ex
155
172
 
156
173
  ## 刷新已启用的展示站
157
174
 
158
- 登记实际新增、删除或变更后,如果真实 Home 已初始化 `.agents/home/website/`,整批保存并回读后,从 Home 根运行一次 `node .agents/home/website/scripts/site.mjs refresh`。同一请求也更新日志时,两个 owner 共同完成后由当前执行者调用一次。查询、只导出地图及无变化时结束于原步骤。展示站缺依赖或刷新失败时,报告登记已保存和网站待刷新,附同一重试命令。初始化网站和核对公开制品交给 home-website。
175
+ 登记实际新增、删除或变更后,若真实 Home 已有 `.agents/home/website/scripts/site.mjs`,整批保存并回读后,从 Home 根运行一次 `node .agents/home/website/scripts/site.mjs refresh`。只有 `website/changelogs/` 时,按独立日志模式完成登记。同一请求也更新日志时,两个 owner 共同完成后由当前执行者调用一次。查询、只导出地图及无变化时结束于原步骤。展示站缺依赖或刷新失败时,报告登记已保存和网站待刷新,附同一重试命令。初始化网站和核对公开制品交给 home-website。
@@ -29,9 +29,17 @@ function checkRemote(remote, label) {
29
29
  }
30
30
  }
31
31
 
32
+ function validateProjectNames(names) {
33
+ if (!plain(names) || Object.entries(names).some(([id, name]) =>
34
+ !/^[a-z0-9][a-z0-9-]*$/u.test(id) || !text(name) || name.trim() !== name)) {
35
+ fail('INVALID_PROJECT_NAMES', 'projectNames 需要稳定项目 ID 与无首尾空白的单行名称。');
36
+ }
37
+ }
38
+
32
39
  export function validateRegistry(value) {
33
40
  if (!plain(value) || ![1, 2].includes(value.formatVersion) || !Array.isArray(value.repos)) fail('REGISTRY_VERSION', '只读取 formatVersion: 1 或 2 与 repos 数组;未知版本不改写。');
34
- ownKeys(value, ['formatVersion', 'repos'], '登记');
41
+ ownKeys(value, ['formatVersion', 'repos', 'projectNames'], '登记');
42
+ if (value.projectNames !== undefined) validateProjectNames(value.projectNames);
35
43
  const ids = new Set();
36
44
  for (const repo of value.repos) {
37
45
  if (!plain(repo)) fail('INVALID_REPO', '每项登记必须是对象。');
@@ -115,13 +123,18 @@ export function renderMap(registry, { homeRoot, registryRevision } = {}) {
115
123
  validateRegistry(registry);
116
124
  const root = path.resolve(homeRoot || '.');
117
125
  const mapDir = path.join(root, '.agents/home');
126
+ const names = new Map(Object.entries(registry.projectNames ?? {}));
127
+ const registered = new Set(registry.repos.map(repo => repo.id));
128
+ const otherNames = [...names].filter(([id]) => !registered.has(id)).map(([id, name]) => `| ${id} | ${md(name)} |`);
129
+ const namedProjects = otherNames.length ? '\n## 其他已命名项目\n\n| 项目 ID | 首选名称 |\n| --- | --- |\n' + otherNames.join('\n') + '\n' : '';
118
130
  const rows = registry.repos.map(repo => {
119
131
  const target = linkPath(path.relative(mapDir, path.resolve(root, repo.localPath)) || '.');
120
132
  const background = repo.backgroundRef ? `[背景页](${linkPath(path.relative(mapDir, path.resolve(root, repo.backgroundRef)))})` : '未单列';
121
133
  const remoteSummary = registry.formatVersion === 1 ? repo.remote || '本地独有' : repo.remotes.map(remote => `${remote.name}${remote.name === repo.primaryRemote ? '(主)' : ''}: ${remote.urls.join('、')}${remote.pushUrls.length ? `;push: ${remote.pushUrls.join('、')}` : ''}`).join(';') || '本地独有';
122
- return `| ${repo.id} | ${md(repo.purpose)} | ${md((repo.aliases || []).join('、'))} | ${md((repo.groups || []).join('、'))} | ${repo.intent} | [${md(repo.localPath)}](${target}) | ${md(remoteSummary)} | ${background} |`;
134
+ const label = names.has(repo.id) ? `${repo.id}(${md(names.get(repo.id))})` : repo.id;
135
+ return `| ${label} | ${md(repo.purpose)} | ${md((repo.aliases || []).join('、'))} | ${md((repo.groups || []).join('、'))} | ${repo.intent} | [${md(repo.localPath)}](${target}) | ${md(remoteSummary)} | ${background} |`;
123
136
  });
124
- return `${MARKER}\n<!-- registry-revision: ${registryRevision || revision(`${JSON.stringify(registry, null, 2)}\n`)} -->\n# 项目地图\n\n本页按需从 repos.json 生成,保存登记不会自动维护此导出。相对链接以 .agents/home/ 为基准;本机路径覆盖见 local.json,实际任务先用 home-route 解析。\n\n| repo ID | 一句话用途 | 别名 | 分组 | 用途 | 默认位置 | Git remote | Home 背景 |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n${rows.join('\n')}${rows.length ? '\n' : ''}\n涉及项目内部功能、代码、永久知识或验证时,由进入该项目实际 checkout 的 Agent 读取本地 AGENTS.md、有关 .agents 资料与所需 SKILL。地图指针不代表资料已读取或获得执行授权。\n`;
137
+ return `${MARKER}\n<!-- registry-revision: ${registryRevision || revision(`${JSON.stringify(registry, null, 2)}\n`)} -->\n# 项目地图\n\n本页按需从 repos.json 生成,保存登记不会自动维护此导出。相对链接以 .agents/home/ 为基准;本机路径覆盖见 local.json,实际任务先用 home-route 解析。\n\n| repo ID | 一句话用途 | 别名 | 分组 | 用途 | 默认位置 | Git remote | Home 背景 |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n${rows.join('\n')}${rows.length ? '\n' : ''}\n涉及项目内部功能、代码、永久知识或验证时,由进入该项目实际 checkout 的 Agent 读取本地 AGENTS.md、有关 .agents 资料与所需 SKILL。地图指针不代表资料已读取或获得执行授权。\n${namedProjects}`;
125
138
  }
126
139
 
127
140
  export function inspectRegistry(home, { includeMap = true } = {}) {
@@ -221,19 +234,61 @@ export function saveRegistry(home, registry, { expectedRevision, expectedMapRevi
221
234
  return { status: plans.length ? 'saved' : 'unchanged', registryRevision: revision(registryText), ...(mapOnly ? { mapRevision: revision(mapText) } : {}), files: plans.map(plan => plan.filename), identityVerified: false, note: mapOnly ? '已显式导出地图;登记真源保持原样。' : '仅保存登记;Git 身份由 home-route 核实,地图按需查看或显式导出。' };
222
235
  }
223
236
 
237
+ export function setProjectNames(home, names) {
238
+ validateProjectNames(names);
239
+ const ids = Object.keys(names);
240
+ if (!ids.length) fail('INVALID_PROJECT_NAMES', '至少指定一个项目名称。');
241
+ const current = inspectRegistry(home, { includeMap: false });
242
+ const registered = new Set(current.registry.repos.map(repo => repo.id));
243
+ const unregistered = ids.filter(id => !registered.has(id));
244
+ if (unregistered.length) {
245
+ const website = path.join(current.domainRoot, 'website');
246
+ const logs = path.join(website, 'changelogs');
247
+ for (const directory of [website, logs]) {
248
+ const entry = fs.lstatSync(directory, { throwIfNoEntry: false });
249
+ if (entry && !entry.isDirectory()) fail('UNSAFE_PARENT', '项目日志须位于 Home 内的普通目录。');
250
+ }
251
+ let overrides;
252
+ for (const id of unregistered) {
253
+ const source = readText(path.join(logs, id + '.json'));
254
+ if (source !== null) {
255
+ const project = decode(source, id + '.json');
256
+ if (project?.schemaVersion !== 1 || project.repoId !== id) fail('INVALID_REPO', id + ' 的日志身份不符。');
257
+ continue;
258
+ }
259
+ overrides ??= decode(readText(path.join(website, 'site.config.json')) ?? '{}', 'site.config.json')?.overrides ?? {};
260
+ const binding = Object.hasOwn(overrides, id) && overrides[id];
261
+ const subpath = binding?.submodulePath ?? id;
262
+ if (!registered.has(binding?.submoduleOf) || overrides[binding.submoduleOf]?.submoduleOf ||
263
+ !text(subpath) || !subpath.split('/').every(part => /^[a-zA-Z0-9_-][a-zA-Z0-9._-]*$/u.test(part))) {
264
+ fail('UNKNOWN_REPO', '找不到该 ID 的仓库登记、项目日志或已声明的子模块:' + id);
265
+ }
266
+ }
267
+ }
268
+ const projectNames = { ...current.registry.projectNames, ...names };
269
+ if (ids.every(id => Object.hasOwn(current.registry.projectNames ?? {}, id) && current.registry.projectNames[id] === names[id])) {
270
+ return {status:'unchanged', names, registryRevision:current.registryRevision};
271
+ }
272
+ const content = JSON.stringify({...current.registry, projectNames}, null, 2) + '\n';
273
+ const plan = { filename:current.registryFile, before:current.registryText, after:content };
274
+ commitFiles(home, [plan], [plan]);
275
+ return {status:'saved', names, registryRevision:revision(content)};
276
+ }
277
+
224
278
  export function main(argv = process.argv.slice(2)) {
225
279
  try {
226
280
  const command = argv[0];
227
281
  if (!command || command === '--help') {
228
- console.log('用法:registry.mjs inspect --home HOME\nregistry.mjs validate --input JSON [--local LOCAL_JSON]\nregistry.mjs save --home HOME --input JSON --expect REV\nregistry.mjs map --home HOME\nregistry.mjs map --home HOME --write --expect REV --expect-map REV\ninspect/validate/map 默认只读;save 仅保存 v2 登记,map --write 显式导出 repos.md。');
282
+ console.log('用法:registry.mjs inspect --home HOME\nregistry.mjs validate --input JSON [--local LOCAL_JSON]\nregistry.mjs save --home HOME --input JSON --expect REV\nregistry.mjs name --home HOME --repo ID --name 名称(批量使用 --input 名称映射.json)\nregistry.mjs map --home HOME\nregistry.mjs map --home HOME --write --expect REV --expect-map REV\ninspect/validate/map 默认只读;save 仅保存 v2 登记,map --write 显式导出 repos.md。');
229
283
  return 0;
230
284
  }
231
- if (!['inspect', 'validate', 'save', 'map'].includes(command)) fail('USAGE', '未知子命令。');
285
+ if (!['inspect', 'validate', 'save', 'map', 'name'].includes(command)) fail('USAGE', '未知子命令。');
286
+ const allowed = command === 'name' ? ['--home', '--input', '--repo', '--name'] : ['--home', '--input', '--local', '--expect', '--expect-map'];
232
287
  const options = {};
233
288
  for (let index = 1; index < argv.length; index += 1) {
234
289
  const key = argv[index];
235
290
  if (key === '--write' && command === 'map' && options[key] === undefined) { options[key] = true; continue; }
236
- if (!['--home', '--input', '--local', '--expect', '--expect-map'].includes(key) || !argv[index + 1] || argv[index + 1].startsWith('--') || options[key] !== undefined) fail('USAGE', `未知、重复或缺值参数:${key}`);
291
+ if (!allowed.includes(key) || !argv[index + 1] || argv[index + 1].startsWith('--') || options[key] !== undefined) fail('USAGE', `未知、重复或缺值参数:${key}`);
237
292
  options[key] = argv[++index];
238
293
  }
239
294
  let result;
@@ -244,7 +299,12 @@ export function main(argv = process.argv.slice(2)) {
244
299
  result = { status: 'valid', repos: registry.repos.length, identityVerified: false };
245
300
  } else {
246
301
  if (!options['--home']) fail('USAGE', '需要显式 --home,不从 cwd 猜 Home。');
247
- if (command === 'inspect') {
302
+ if (command === 'name') {
303
+ const { '--repo': id, '--name': name, '--input': input } = options;
304
+ if (input ? id || name : !id || !name) fail('USAGE', '指定 --repo ID --name 名称,批量命名使用 --input 名称映射.json。');
305
+ const names = input ? decode(fs.readFileSync(input, 'utf8').replace(/^\uFEFF/u, ''), '名称映射') : { [id]: name };
306
+ result = setProjectNames(options['--home'], names);
307
+ } else if (command === 'inspect') {
248
308
  const { registryText, mapText, ...view } = inspectRegistry(options['--home']);
249
309
  result = view;
250
310
  } else if (command === 'map' && !options['--write']) {
@@ -1,20 +1,24 @@
1
1
  ---
2
2
  name: home-website
3
- description: 把 Home 中已登记项目的 Git changelog 生成可部署的静态展示站,按项目、月份、模块关键词和类别查看任务及提交统计。用于创建、刷新、预览或部署多项目变更展示,承接 home-project-changelog 已保存的日志。
3
+ description: 创建、刷新、预览或部署 Home 的多项目静态展示站。首次启用或显式激活时调用 home-project-changelog 补采展示范围内缺失或有增量的日志,构建后可按项目、月份、模块关键词与类别查看任务和 Git 提交。
4
4
  ---
5
5
 
6
6
  # Home 项目展示站
7
7
 
8
- 先确认实际 Home 根,读取其 `.agents/home/AGENTS.md` 和本次相关设置。按[网站操作](references/website.md)选择入口。只要求查看或定位项目时使用现有 Home 方法。
8
+ 确认实际 Home 根,读取其中的 `.agents/home/AGENTS.md` 和本次相关设置。按[网站操作](references/website.md)执行。
9
9
 
10
10
  | 要做的事 | 入口 |
11
11
  | --- | --- |
12
- | 显式启用网站或完整初始化时选用网站 | `node <本技能目录>/scripts/init.mjs --home "<实际 Home 根>"`,然后在生成的网站工程安装锁定依赖、构建并预览 |
13
- | 重新生成最新页面,或接续登记与日志批次 | 从实际 Home 根运行 `node .agents/home/website/scripts/site.mjs refresh` |
14
- | 浏览已构建的网站 | 打开 `dist/index.html` 离线浏览,或运行 `npm run preview` 并访问输出的 HTTP 地址。按构建回执核对公开项目、条目数、排除项和诊断 |
15
- | 上次构建中断或启动失败 | 按[修复本地刷新](references/website.md#修复本地刷新)核对进程、恢复已有产物并重试 |
16
- | 发布到指定目标 | 使用已验证的 `dist/`,按实际托管目标回读线上版本 |
12
+ | 首次启用、显式激活或初始化时选用网站 | 运行 `node .agents/skills/home-website/scripts/activate.mjs --home .`,按回执补采缺失日志和增量,再重跑至成功构建。可用 `--title` 为新站命名。 |
13
+ | 已有日志、项目首选名称或展示配置变更 | 在 Home 根运行 `node .agents/home/website/scripts/site.mjs refresh`。 |
14
+ | 浏览已构建的网站 | 双击 `dist/index.html`,或运行 `npm --prefix .agents/home/website run preview` 打开输出的 HTTP 地址。 |
15
+ | 上次构建中断或启动失败 | 按[修复本地刷新](references/website.md#修复本地刷新)核对进程并恢复。 |
16
+ | 发布到指定目标 | 部署已验证的 `dist/`,按托管目标回读线上版本。 |
17
17
 
18
- 首页突出公开项目、任务及 Git 提交。项目卡直接给出累计提交和任务量,详情与跨仓时间线默认显示每月的任务正文。构建时按登记、成功记录和展示设置选取公开项目,核对结构化任务与 Markdown 后导出 `dist/data/`。[公开字段与统计](references/website.md#公开字段与数据来源) · [更新已有模板](references/website.md#更新已有模板)
18
+ 激活回执为 `needs-analysis` 时,按 `review` 中的冻结区间调用 `home-project-changelog` 取证、整理并保存。所有可补采项目处理后重跑激活。同一节点复用已有日志。配置了明确项目范围时,补采和展示均采用该范围。
19
19
 
20
- 任务结束时说明构建状态、地址或制品位置、未纳入的项目和诊断。Home 更新成功但站点待刷新时分别报告,重试网站命令即可。
20
+ 站点从 `repos.json` 的 `projectNames` 读取首选名称,目录、趋势图、日志和搜索共用该名称。发布范围按稳定 ID 配置。仅有日志的项目可用 `projectIds` 显式纳入。
21
+
22
+ 每仓的 `.agents/home/website/changelogs/<repo-id>.json` 保存成功区间、任务与提交统计。编辑该文件的展示文字和补记可直接重建。网站链接提供从源文件导出的[公开 JSON](references/website.md#公开字段与数据来源)。
23
+
24
+ 交付时说明构建状态、制品位置或浏览地址,以及未纳入的项目和具体原因。
@@ -1,10 +1,11 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { createHash } from 'node:crypto';
4
- import { parseMarkdown, validDay } from '../site/templates/project-logs.mjs';
5
- import { statistics } from '../site/templates/model.mjs';
4
+ import { validDay } from '../site/templates/project-logs.mjs';
5
+ import { categories, statistics } from '../site/templates/model.mjs';
6
6
 
7
- const idPattern = /^[a-z0-9][a-z0-9-]*$/u;
7
+ const projectId = value => typeof value === 'string' && /^[a-z0-9][a-z0-9-]*$/u.test(value)
8
+ && !/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u.test(value);
8
9
  const plain = value => !!value && typeof value === 'object' && !Array.isArray(value);
9
10
  const line = value => typeof value === 'string' && value.trim() && !/[\x00-\x1f\x7f]/u.test(value);
10
11
  const decode = value => new TextDecoder('utf-8', { fatal: true }).decode(value);
@@ -45,32 +46,36 @@ function https(value) {
45
46
  }
46
47
 
47
48
  function config(value) {
48
- checkKeys(value, ['title', 'base', 'scope', 'publicGroups', 'overrides'], 'site.config.json');
49
- const {title, base, scope = 'all', publicGroups = [], overrides = {}} = value;
49
+ checkKeys(value, ['title', 'base', 'scope', 'projectIds', 'publicGroups', 'overrides'], 'site.config.json');
50
+ const {title, base, scope = 'all', projectIds, publicGroups = [], overrides = {}} = value;
50
51
  if (!line(title) || typeof base !== 'string' || !/^\/(?:[a-zA-Z0-9_-][a-zA-Z0-9._-]*\/)*$/u.test(base) || scope !== 'all') {
51
52
  throw Error('设置需要 title、以 / 包围的 base、scope 为 all。');
52
53
  }
53
54
  if (!Array.isArray(publicGroups) || !publicGroups.every(line) || !plain(overrides)) throw Error('publicGroups 或 overrides 格式错误。');
55
+ if (projectIds !== undefined && (!Array.isArray(projectIds) || !projectIds.every(projectId)
56
+ || new Set(projectIds).size !== projectIds.length)) throw Error('projectIds 需要无重复的项目 ID 数组。');
54
57
  const byId = new Map();
55
58
  for (const [id, item] of Object.entries(overrides)) {
56
- if (!idPattern.test(id)) throw Error('overrides 使用登记项目 ID。');
57
- checkKeys(item, ['hidden','showChangelog','displayName','summary','docsUrl','repoUrl'], id);
59
+ if (!projectId(id)) throw Error('overrides 使用登记项目 ID。');
60
+ checkKeys(item, ['hidden','showChangelog','displayName','summary','docsUrl','repoUrl','submoduleOf','submodulePath'], id);
58
61
  for (const key of ['hidden','showChangelog']) {
59
62
  if (Object.hasOwn(item,key) && typeof item[key] !== 'boolean') throw Error(id+' 的 '+key+' 应为布尔值。');
60
63
  }
61
64
  for (const key of ['displayName','summary']) {
62
65
  if (Object.hasOwn(item,key) && !line(item[key])) throw Error(id+' 的 '+key+' 应为单行文字。');
63
66
  }
67
+ if (item.submoduleOf !== undefined && (!projectId(item.submoduleOf) || item.submoduleOf === id)) throw Error(id+' 的父项目 ID 无效。');
68
+ if (item.submodulePath !== undefined && (!item.submoduleOf || !line(item.submodulePath) || !item.submodulePath.split('/').every(part => /^[a-zA-Z0-9_-][a-zA-Z0-9._-]*$/u.test(part)))) throw Error(id+' 的子模块相对路径无效。');
64
69
  byId.set(id, {...item, ...(item.docsUrl !== undefined ? {docsUrl:https(item.docsUrl)} : {}), ...(item.repoUrl !== undefined ? {repoUrl:https(item.repoUrl)} : {})});
65
70
  }
66
- return {title, base, publicGroups, byId};
71
+ return {title, base, projectIds:projectIds === undefined ? null : new Set(projectIds), publicGroups, byId};
67
72
  }
68
73
 
69
74
  function records(value) {
70
75
  if (!plain(value) || ![1,2].includes(value.formatVersion) || !Array.isArray(value.repos)) throw Error('repos.json 只支持 v1/v2 的 repos 数组。');
71
76
  const seen = new Set();
72
77
  for (const repo of value.repos) {
73
- if (!plain(repo) || typeof repo.id !== 'string' || !idPattern.test(repo.id) || seen.has(repo.id) || !line(repo.purpose)) {
78
+ if (!plain(repo) || !projectId(repo.id) || seen.has(repo.id) || !line(repo.purpose)) {
74
79
  throw Error('repos.json 含无效或重复的项目 ID,或缺少单行用途。');
75
80
  }
76
81
  if (repo.groups !== undefined && (!Array.isArray(repo.groups) || !repo.groups.every(line))) throw Error(repo.id+' 的登记分组格式错误。');
@@ -79,38 +84,6 @@ function records(value) {
79
84
  return value.repos;
80
85
  }
81
86
 
82
- function readState(value) {
83
- if (value === undefined) return {};
84
- if (!plain(value) || value.formatVersion !== 1 || !plain(value.projects)) throw Error('changelogs/state.json 格式错误,请用 home-project-changelog 核对。');
85
- for (const [id, project] of Object.entries(value.projects)) {
86
- if (!idPattern.test(id) || !plain(project) || !plain(project.initialization) || !Array.isArray(project.ranges)
87
- || project.lastSuccessfulRangeId !== (project.ranges.at(-1)?.rangeId ?? null)
88
- || (Object.hasOwn(project,'pending') && !plain(project.pending))
89
- || !project.ranges.length && !project.pending) {
90
- throw Error('changelogs/state.json 中 '+id+' 的记录无效,请用 home-project-changelog 核对。');
91
- }
92
- const ids = new Set();
93
- let previous = null;
94
- for (const range of project.ranges) {
95
- const dates = range?.displayDates;
96
- const commits = range?.stats?.rangeCommitCount;
97
- const head = range?.stats?.totalCommitCountAtHead;
98
- const baseline = ['baseline','rebaseline'].includes(range?.kind);
99
- if (!plain(range) || !line(range.rangeId) || ids.has(range.rangeId) || range.previousRangeId !== previous
100
- || typeof range.savedAt !== 'string' || !Number.isFinite(Date.parse(range.savedAt))
101
- || !['full-history','delta','baseline','rebaseline'].includes(range.kind)
102
- || !plain(dates) || !validDay(dates.to) || (dates.from !== null && (!validDay(dates.from) || dates.from > dates.to))
103
- || !Number.isSafeInteger(commits) || commits < 0 || (baseline && (dates.from !== null || commits !== 0))
104
- || (head != null && (!Number.isSafeInteger(head) || head < commits))) {
105
- throw Error('changelogs/state.json 中 '+id+' 的成功区间无效,请用 home-project-changelog 核对。');
106
- }
107
- ids.add(range.rangeId);
108
- previous = range.rangeId;
109
- }
110
- }
111
- return value.projects;
112
- }
113
-
114
87
  function publicText(value, privateValues) {
115
88
  let text = value
116
89
  .replace(/!?\[([^\]\n]*)\]\([^\n)]*\)/gu, '$1')
@@ -119,80 +92,95 @@ function publicText(value, privateValues) {
119
92
  return text.replace(/(?:https?:\/\/|git:\/\/|ssh:\/\/|file:\/\/|ftp:\/\/|mailto:|www\.)[^\s<>,。;、))]+/giu, '〔链接〕')
120
93
  .replace(/[\w.-]+@[\w.-]+:[^\s<>,。;、]+/gu,'〔链接〕')
121
94
  .replace(/(?:\b[A-Za-z]:[\\/]|(?:\.\.?[\\/])+|(?<![\p{L}\d/])\/(?=[\w.-]+\/)|\\\\(?=[\w.-]+\\))[^\s<>,。;、)]+/gu, '〔本地路径〕')
95
+ .replace(/\b(?:[a-f0-9]{40}|[a-f0-9]{64}|(?=[a-f0-9]*\d)(?=[a-f0-9]*[a-f])[a-f0-9]{7,39})\b/giu, '〔提交标识〕')
122
96
  .replace(/[\u0000-\u0009\u000b-\u001f\u007f]/gu, ' ');
123
97
  }
124
98
 
125
- function savedPeriods(id, parsed, dated, saved, warnings) {
126
- const blocks = parsed.periods.map((legacy,index) => ({legacy, dated:dated?.periods[index]}));
127
- const oldest = [...blocks].reverse();
128
- const bodyFor = (block, range) => range.ledger ? block.dated : block.legacy;
129
- function matches(block, range) {
130
- const period = bodyFor(block,range);
131
- const {from,to} = range.displayDates;
132
- const legacyStart = range.kind === 'full-history' && from === null;
133
- const baseline = range.kind === 'baseline' || range.kind === 'rebaseline';
134
- return period.verified && period.to === to && (legacyStart || period.from === from)
135
- && period.commits === range.stats.rangeCommitCount && period.baseline === baseline;
136
- }
137
- function ordered(ranges, periods) {
138
- const found = [];
139
- let index = 0;
140
- for (const range of ranges) {
141
- while (index < periods.length && !matches(periods[index],range)) index += 1;
142
- if (index === periods.length) throw Error(id+' 的成功区间无法核对 Markdown 日期、提交数或统计:'+range.displayDates.to+'。');
143
- found.push(periods[index++]);
99
+ const publicMarkers = ['破坏性', '安全', '弃用', '移除', '回退'];
100
+ const oid = value => typeof value === 'string' && /^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u.test(value);
101
+ const oidList = values => Array.isArray(values) && values.every(oid) && new Set(values).size === values.length;
102
+ const notesList = value => Array.isArray(value) && value.every(note => typeof note === 'string' && note.trim());
103
+ const validEntry = entry => plain(entry) && categories.includes(entry.category) && line(entry.text)
104
+ && Array.isArray(entry.markers) && entry.markers.every(marker => publicMarkers.includes(marker));
105
+
106
+ function readProject(id, saved) {
107
+ const fail = label => { throw Error(id+' 的 '+label+' 无效,请用 home-project-changelog 核对。'); };
108
+ if (!plain(saved) || saved.schemaVersion !== 1 || saved.repoId !== id || !plain(saved.initialization) || !Array.isArray(saved.ranges)
109
+ || !saved.ranges.length
110
+ || saved.lastSuccessfulRangeId !== (saved.ranges.at(-1)?.rangeId ?? null)
111
+ || saved.notes !== undefined && !notesList(saved.notes)
112
+ || saved.displayName !== undefined && !line(saved.displayName)) fail('项目 JSON');
113
+ if (Object.hasOwn(saved,'pending')) throw Error(id+' 的日志有待确认写入,请先用 home-project-changelog 恢复。');
114
+ let previous = null;
115
+ const rangeIds = new Set();
116
+ const taskIds = new Set();
117
+ for (const range of saved.ranges) {
118
+ const dates = range?.displayDates;
119
+ const count = range?.stats?.rangeCommitCount;
120
+ const head = range?.stats?.totalCommitCountAtHead;
121
+ const baseline = ['baseline','rebaseline'].includes(range?.kind);
122
+ if (!plain(range) || !line(range.rangeId) || rangeIds.has(range.rangeId) || range.previousRangeId !== previous
123
+ || typeof range.savedAt !== 'string' || !Number.isFinite(Date.parse(range.savedAt))
124
+ || !['full-history','delta','baseline','rebaseline'].includes(range.kind)
125
+ || range.coverage !== (baseline ? 'not-backfilled' : 'complete')
126
+ || !plain(dates) || !validDay(dates.to) || (dates.from !== null && (!validDay(dates.from) || dates.from > dates.to))
127
+ || !Number.isSafeInteger(count) || (baseline ? (dates.from !== null || count !== 0) : count <= 0)
128
+ || (head !== null && (!Number.isSafeInteger(head) || head < count))
129
+ || range.notes !== undefined && !notesList(range.notes)
130
+ || Object.hasOwn(range,'ledger') === Object.hasOwn(range,'legacy')) fail('成功区间');
131
+ rangeIds.add(range.rangeId);
132
+ previous = range.rangeId;
133
+
134
+ if (Object.hasOwn(range,'legacy')) {
135
+ const {legacy} = range;
136
+ if (!plain(legacy) || !Array.isArray(legacy.entries) || !legacy.entries.every(validEntry)
137
+ || baseline && legacy.entries.length
138
+ || legacy.added != null && (!Number.isSafeInteger(legacy.added) || legacy.added < 0
139
+ || legacy.added > legacy.entries.filter(entry => entry.category === '功能').length)) fail('历史补记');
140
+ continue;
141
+ }
142
+ const {ledger} = range;
143
+ if (!plain(ledger) || ledger.version !== 1 || !plain(ledger.commitMonths) || !Array.isArray(ledger.tasks)) fail('任务明细');
144
+ const months = Object.entries(ledger.commitMonths);
145
+ if (!months.every(([month,amount]) => validDay(month+'-01') && Number.isSafeInteger(amount) && amount > 0)
146
+ || months.reduce((total,[,amount]) => total + amount,0) !== count
147
+ || baseline && ledger.tasks.length) fail('任务明细');
148
+ for (const task of ledger.tasks) {
149
+ if (!validEntry(task) || typeof task.id !== 'string' || !/^task-[0-9a-f]{16}$/u.test(task.id) || taskIds.has(task.id)
150
+ || !validDay(task.date) || !Object.hasOwn(ledger.commitMonths,task.date.slice(0,7))
151
+ || task.area !== null && !line(task.area) || !oidList(task.commits) || !task.commits.includes(task.deliveredBy)
152
+ || task.relatedCommits !== undefined && !oidList(task.relatedCommits)
153
+ || task.added !== undefined && (task.category !== '功能' || typeof task.added !== 'boolean')) fail('任务明细');
154
+ taskIds.add(task.id);
144
155
  }
145
- return found;
146
- }
147
- // 两个方向分别找最早和最晚的配对。两者都相同时,已保存区间的有序配对才唯一。
148
- const forward = ordered(saved.ranges,oldest);
149
- const backward = ordered([...saved.ranges].reverse(),blocks).reverse();
150
- if (forward.some((period,index) => period !== backward[index])) throw Error(id+' 的成功区间与 Markdown 有多种配对,请先核对原文。');
151
- if (forward.length !== parsed.periods.length) warnings.push(id+' 有未匹配的日期段,保留在 Home。');
152
- if (parsed.legacy) warnings.push(id+' 含历史补记,保留在单仓页。');
153
- const paired = forward.map((block,index) => ({period:bodyFor(block,saved.ranges[index]),range:saved.ranges[index]}));
154
- for (const {period} of paired) {
155
- if (period.notes.some(note => /^### |^[-*+] /u.test(note))) warnings.push(id+' '+period.key+' 含额外正文,保留在区间说明。');
156
156
  }
157
- return paired.reverse();
157
+ return saved;
158
158
  }
159
159
 
160
- function publicPeriod(id, period, range, text) {
161
- const { ledger } = range;
162
- let items, commitMonths;
163
- if (ledger === undefined) {
164
- items = period.items.map(([category, value, markers]) => [category, text(value), markers]);
165
- } else {
166
- const fail = () => { throw Error(id+' 的任务明细与成功记录不一致,请用 home-project-changelog 修订该区间。'); };
167
- if (ledger?.version !== 1 || !plain(ledger.commitMonths) || !Array.isArray(ledger.tasks)
168
- || ledger.tasks.length !== period.items.length) fail();
169
- commitMonths = {};
170
- let total = 0;
171
- for (const [month,count] of Object.entries(ledger.commitMonths)) {
172
- if (!validDay(month+'-01') || !Number.isSafeInteger(count) || count <= 0) fail();
173
- total += count;
174
- commitMonths[month] = count;
175
- }
176
- if (total !== period.commits) fail();
177
- const ids = new Set();
178
- items = period.items.map(([category,value,markers,meta],index) => {
179
- const task = ledger.tasks[index];
180
- if (!plain(task) || typeof task.id !== 'string' || !/^task-[0-9a-f]{16}$/u.test(task.id) || ids.has(task.id)
181
- || !validDay(task.date) || !commitMonths[task.date.slice(0,7)] || task.date !== meta?.date
182
- || task.area !== meta.area || (task.area !== null && !line(task.area))
183
- || task.category !== category || task.text !== value || JSON.stringify(task.markers) !== JSON.stringify(markers)) fail();
184
- ids.add(task.id);
185
- return [category,text(value),markers,{id:task.id,date:task.date,area:task.area && text(task.area)}];
186
- });
187
- const features = ledger.tasks.filter(task => task.category === '功能');
188
- const added = features.every(task => typeof task.added === 'boolean') ? features.filter(task => task.added).length : null;
189
- if (period.added !== added) fail();
190
- }
191
- const notes = period.notes.map(text);
192
- return {...period,items,notes,note:notes.join('\n'),commitMonths};
160
+ function publicPeriods(project, text) {
161
+ const occurrences = new Map();
162
+ return project.ranges.map(range => {
163
+ const { from, to } = range.displayDates;
164
+ const pair = (from ?? 'single')+'_'+to;
165
+ const occurrence = (occurrences.get(pair) ?? 0) + 1;
166
+ occurrences.set(pair,occurrence);
167
+ const notes = (range.notes ?? []).map(text);
168
+ const entries = range.ledger?.tasks ?? range.legacy.entries;
169
+ const items = entries.map(({id,category,text:body,markers,date,area}) => range.ledger
170
+ ? [category,text(body),markers,{id,date,area:area === null ? null : text(area)}]
171
+ : [category,text(body),markers]);
172
+ const features = entries.filter(entry => entry.category === '功能');
173
+ const added = range.ledger
174
+ ? (features.every(entry => typeof entry.added === 'boolean') ? features.filter(entry => entry.added).length : null)
175
+ : (Object.hasOwn(range.legacy,'added') ? range.legacy.added : features.length ? null : 0);
176
+ return {
177
+ key:pair+'-'+occurrence,from,to,items,notes,note:notes.join('\n'),commits:range.stats.rangeCommitCount,added,
178
+ coverage:range.coverage,baseline:range.coverage === 'not-backfilled',commitMonths:range.ledger?.commitMonths,
179
+ };
180
+ }).reverse();
193
181
  }
194
182
 
195
- export function inputs(website) {
183
+ export function inputs(website, {checkOnly = false} = {}) {
196
184
  const home = path.dirname(website);
197
185
  const sources = [];
198
186
  function take(filename, required = false) {
@@ -208,44 +196,64 @@ export function inputs(website) {
208
196
  try { return JSON.parse(decode(bytes)); } catch { throw Error(name+' 无法读取为 UTF-8 JSON。'); }
209
197
  };
210
198
  const settings = config(parse(take(path.join(website,'site.config.json'),true),'site.config.json'));
211
- const registered = records(parse(take(path.join(home,'repos.json'),true),'repos.json'));
212
- const logs = path.join(home,'changelogs');
199
+ const registry = parse(take(path.join(home,'repos.json'),true),'repos.json');
200
+ const registered = records(registry);
201
+ if (registry.projectNames !== undefined && (!plain(registry.projectNames) || Object.entries(registry.projectNames)
202
+ .some(([id, name]) => !/^[a-z0-9][a-z0-9-]*$/u.test(id) || !line(name) || name.trim() !== name))) throw Error('repos.json 的 projectNames 需要稳定 ID 与单行首选名称。');
203
+ const names = new Map(Object.entries(registry.projectNames ?? {}));
204
+ const logs = path.join(website,'changelogs');
213
205
  directory(logs);
214
- const stateBytes = take(path.join(logs,'state.json'));
215
- const state = readState(stateBytes ? parse(stateBytes,'state.json') : undefined);
216
- const warnings = [], excluded = [];
206
+ const warnings = [], excluded = [], eligible = [], needsGeneration = [];
217
207
  const privateValues = [...new Set(registered.flatMap(repo => [
218
208
  repo.localPath, repo.remote, repo.backgroundRef,
219
209
  ...(Array.isArray(repo.remotes) ? repo.remotes.flatMap(remote => [...(remote?.urls ?? []), ...(remote?.pushUrls ?? [])]) : []),
220
210
  ]).filter(value => typeof value === 'string' && value.length >= 3))].sort((a,b) => b.length-a.length);
221
211
  const text = value => publicText(value, privateValues);
222
212
  const projects = [];
223
- for (const repo of registered) {
213
+ const registeredIds = new Set(registered.map(repo => repo.id));
214
+ const candidates = [...registered];
215
+ for (const [id, item] of settings.byId) {
216
+ if (!item.submoduleOf) continue;
217
+ if (!registeredIds.has(item.submoduleOf) || settings.byId.get(item.submoduleOf)?.submoduleOf) throw Error(id+' 需要已登记的顶层父项目。');
218
+ if (!registeredIds.has(id)) candidates.push({id,purpose:item.summary ?? item.submoduleOf+' 的 Git 子模块'});
219
+ }
220
+ for (const id of settings.projectIds ?? []) {
221
+ if (!registeredIds.has(id) && !settings.byId.get(id)?.submoduleOf) candidates.push({id,purpose:'',sourceOnly:true});
222
+ }
223
+ for (const repo of candidates) {
224
224
  const {id} = repo;
225
+ const parent = settings.byId.get(id)?.submoduleOf;
226
+ const parentSettings = settings.byId.get(parent);
227
+ if (parentSettings?.hidden || parentSettings?.showChangelog === false) { excluded.push({id,reason:'parent-hidden'}); continue; }
228
+ if (settings.projectIds && !settings.projectIds.has(id) && !settings.projectIds.has(parent)) { excluded.push({id,reason:'outside-scope'}); continue; }
225
229
  const override = settings.byId.get(id) ?? {};
226
- if (override.hidden) { excluded.push({id, reason:'hidden'}); continue; }
230
+ if (override.hidden) { excluded.push({id,reason:'hidden'}); continue; }
227
231
  if (override.showChangelog === false) { excluded.push({id,reason:'changelog-disabled'}); continue; }
228
- const saved = Object.hasOwn(state,id) ? state[id] : undefined;
229
- if (!saved) { excluded.push({id,reason:'no-state'}); continue; }
230
- if (saved.pending) throw Error(id+' 的日志有待确认写入,请先用 home-project-changelog 恢复。');
231
- const bytes = take(path.join(logs,id+'.md'));
232
- if (!bytes) throw Error(id+' 的日志正文缺失,请先恢复 Markdown。');
233
- let body;
234
- try { body = decode(bytes); } catch { throw Error(id+' 的日志正文需要可读的 UTF-8 Markdown。'); }
235
- const dated = saved.ranges.some(range=>range.ledger) ? parseMarkdown(body,{datedOnly:true}) : null;
236
- const parsed = saved.ranges.some(range=>!range.ledger) ? parseMarkdown(body) : dated;
237
- const periods = savedPeriods(id,parsed,dated,saved,warnings).map(({period,range}) => publicPeriod(id,period,range,text));
232
+ const filename = id+'.json';
233
+ const source = '.agents/home/website/changelogs/'+filename;
234
+ const bytes = take(path.join(logs,filename));
235
+ const saved = bytes && readProject(id,parse(bytes,filename));
236
+ const status = saved ? 'saved' : 'missing';
237
+ eligible.push({id,source,status,...(repo.sourceOnly && {sourceOnly:true}),...(parent && {parent,submodulePath:override.submodulePath ?? id})});
238
+ if (status !== 'saved') {
239
+ needsGeneration.push({id,source,reason:status});
240
+ excluded.push({id,reason:'no-changelog'});
241
+ continue;
242
+ }
243
+ if (checkOnly) continue;
244
+ const periods = publicPeriods(saved,text);
245
+ if (saved.ranges.some(range => range.legacy)) warnings.push(id+' 含缺少任务证据的历史区间,保留原统计。');
238
246
  const index = projects.length;
239
247
  projects.push({
240
- id, name:text(override.displayName ?? id), purpose:text(override.summary ?? repo.purpose),
248
+ id, parent, name:text(names.get(id) ?? override.displayName ?? saved.displayName ?? id),purpose:text(override.summary ?? repo.purpose),
241
249
  groups:(repo.groups ?? []).filter(group => settings.publicGroups.includes(group)).map(text),
242
- color:colors[index % colors.length], mark:marks[index % marks.length], repoUrl:override.repoUrl, docsUrl:override.docsUrl,
243
- periods, stats:statistics(periods), headCommits:saved.ranges.at(-1).stats.totalCommitCountAtHead ?? null,
244
- legacy:text(parsed.legacy),
250
+ color:colors[index % colors.length],mark:marks[index % marks.length],repoUrl:override.repoUrl,docsUrl:override.docsUrl,
251
+ periods,stats:statistics(periods),headCommits:saved.ranges.at(-1).stats.totalCommitCountAtHead,
252
+ legacy:(saved.notes ?? []).map(text).join('\n'),
245
253
  });
246
254
  }
247
255
  return {
248
256
  model:{title:text(settings.title),base:settings.base,projects},
249
- inputRevision:JSON.stringify(sources), hasState:Boolean(stateBytes), warnings, excluded
257
+ inputRevision:JSON.stringify(sources),eligible,needsGeneration,warnings,excluded,
250
258
  };
251
259
  }
@@ -58,7 +58,7 @@ export function render(website, run, model) {
58
58
  +'<script setup>\nimport page from "./'+name+'.content.json";\n</script>\n\n<div v-html="page.markup"></div>\n');
59
59
  urls.push(stem+'.html');
60
60
  }
61
- page('',title,'home',overview(base,projects,windows,stats));
61
+ page('',title,'home',overview(base,projects,stats));
62
62
  page('projects/','项目目录','projects',catalog(base,projects));
63
63
  page('changelog/','变更时间线','changelog',changelog(base,projects,windows,stats));
64
64
  urls.push('404.html');
@@ -74,12 +74,12 @@ export function render(website, run, model) {
74
74
  const {id,name,purpose,groups,periods,legacy} = project;
75
75
  const data = 'projects/'+id+'.json';
76
76
  const projected = publicProject(project);
77
- page(projectPath(project),name,'projects',detail(base,project,projected.stats));
77
+ page(projectPath(project),name,'projects',detail(base,project,projected.stats,projects));
78
78
  index.push({kind:'项目',name,id,title:name,text:purpose,group:groups.join(' '),url:projectPath(project)});
79
79
  page(logPath(project),name+' 变更日志','projects',repositoryLog(base,project,projected.stats));
80
80
  for (const period of periods) {
81
81
  const date = rangeLabel(period);
82
- if (!period.items.length) index.push({kind:'区间',name,id,title:periodTitle(period),text:period.note,date,url:logPath(project,period)});
82
+ if (!period.items.length || period.note) index.push({kind:'区间',name,id,title:periodTitle(period),text:period.note,date,url:logPath(project,period)});
83
83
  period.items.forEach(([category,text,markers,meta],i) => {
84
84
  index.push({kind:'变更',name,id,title:text,text:[category,meta?.area,...markers].filter(Boolean).join(' · '),
85
85
  date:meta?.date ?? date,url:logPath(project)+'#'+itemId(period,i)});