@namewta/skills-hub 0.1.49 → 0.1.52

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 (254) 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 +7 -7
  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 +61 -0
  68. package/skills/home/home-project-changelog/references/tools.md +28 -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 +42 -38
  72. package/skills/home/home-project-changelog/scripts/contract.mjs +40 -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 +143 -128
  87. package/skills/home/home-website/assets/website/scripts/render.mjs +8 -6
  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 +81 -34
  90. package/skills/home/home-website/assets/website/site/public/home-assets/site.css +92 -70
  91. package/skills/home/home-website/assets/website/site/templates/favicon.png +0 -0
  92. package/skills/home/home-website/assets/website/site/templates/layout.mjs +13 -10
  93. package/skills/home/home-website/assets/website/site/templates/ledger.mjs +51 -46
  94. package/skills/home/home-website/assets/website/site/templates/model.mjs +58 -14
  95. package/skills/home/home-website/assets/website/site/templates/pages.mjs +28 -30
  96. package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +3 -107
  97. package/skills/home/home-website/assets/website/site.config.json +1 -1
  98. package/skills/home/home-website/references/website.md +64 -46
  99. package/skills/home/home-website/scripts/activate.mjs +106 -0
  100. package/skills/home/home-website/scripts/init.mjs +98 -11
  101. package/skills/home/home-workflow/SKILL.md +6 -4
  102. package/skills/system/system-clash-proxy-config/SKILL.md +21 -0
  103. package/skills/system/system-clash-proxy-config/agents/openai.yaml +4 -0
  104. package/skills/system/system-clash-proxy-config/assets/clash-override.js +328 -0
  105. package/skills/system/{system-proxy → system-clash-proxy-config}/references/browser-privacy.md +2 -2
  106. package/skills/system/{system-config → system-clash-proxy-config}/references/changes.md +2 -2
  107. package/skills/system/{system-proxy → system-clash-proxy-config}/references/clash-verge.md +1 -1
  108. package/skills/system/{system-proxy → system-clash-proxy-config}/references/diagnosis.md +1 -1
  109. package/skills/system/system-clash-proxy-config/references/dns-workflow.md +42 -0
  110. package/skills/system/system-clash-proxy-config/references/egress-macos.md +31 -0
  111. package/skills/system/system-clash-proxy-config/references/egress-windows.md +37 -0
  112. package/skills/system/system-clash-proxy-config/references/egress.md +12 -0
  113. package/skills/system/{system-proxy → system-clash-proxy-config}/references/flclash.md +1 -1
  114. package/skills/system/{system-proxy → system-clash-proxy-config}/references/index.md +1 -1
  115. package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/linux-cutover.md +29 -0
  116. package/skills/system/system-clash-proxy-config/references/locale-workflow.md +9 -0
  117. package/skills/system/{system-proxy → system-clash-proxy-config}/references/mihomo.md +1 -25
  118. package/skills/system/system-clash-proxy-config/references/session.md +34 -0
  119. package/skills/system/system-clash-proxy-config/references/subscription.md +29 -0
  120. package/skills/system/{system-proxy → system-clash-proxy-config}/references/troubleshooting.md +7 -7
  121. package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/verification.md +2 -0
  122. package/skills/system/system-clash-proxy-config/scripts/prepare-session.mjs +155 -0
  123. package/skills/system/system-clash-proxy-config/scripts/run-session.mjs +138 -0
  124. package/skills/system/system-inspect/SKILL.md +1 -1
  125. package/skills/system/system-inspect/references/health-audit.md +1 -1
  126. package/upstream-skills/zh-archify/SKILL.md +11 -11
  127. package/upstream-skills/zh-archify/assets/template.html +6 -3
  128. package/upstream-skills/zh-archify/bin/archify.mjs +67 -4
  129. package/upstream-skills/zh-archify/modules/code-analysis/ARCHITECTURE.md +7 -1
  130. package/upstream-skills/zh-archify/modules/code-analysis/bin/analyze-run.mjs +2 -1
  131. package/upstream-skills/zh-archify/modules/code-analysis/bin/check.mjs +29 -15
  132. package/upstream-skills/zh-archify/modules/code-analysis/bin/drift.mjs +3 -3
  133. package/upstream-skills/zh-archify/modules/code-analysis/bin/prepare.mjs +5 -6
  134. package/upstream-skills/zh-archify/modules/code-analysis/bin/serve.mjs +66 -36
  135. package/upstream-skills/zh-archify/modules/code-analysis/bin/verify-change.mjs +43 -13
  136. package/upstream-skills/zh-archify/modules/code-analysis/docs/TECH-GUIDE.md +1 -1
  137. package/upstream-skills/zh-archify/modules/code-analysis/docs/USAGE.md +37 -4
  138. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/functions.mjs +7 -5
  139. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/index.mjs +4 -1
  140. package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/snapshot-host.mjs +9 -0
  141. package/upstream-skills/zh-archify/modules/code-analysis/lib/architecture-drift.mjs +28 -7
  142. package/upstream-skills/zh-archify/modules/code-analysis/lib/drift-capture.mjs +4 -3
  143. package/upstream-skills/zh-archify/modules/code-analysis/lib/git-sources.mjs +5 -3
  144. package/upstream-skills/zh-archify/modules/code-analysis/lib/output.mjs +272 -0
  145. package/upstream-skills/zh-archify/modules/code-analysis/lib/pull-request.mjs +34 -4
  146. package/upstream-skills/zh-archify/modules/code-analysis/lib/task.mjs +4 -2
  147. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-context.mjs +13 -1
  148. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-history.mjs +112 -0
  149. package/upstream-skills/zh-archify/modules/code-analysis/lib/verification.mjs +6 -2
  150. package/upstream-skills/zh-archify/modules/code-analysis/overlay/atlas.mjs +71 -5
  151. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.css +16 -2
  152. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.js +121 -5
  153. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas3d.js +38 -1
  154. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.css +14 -1
  155. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.js +187 -27
  156. package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/verification.js +1 -1
  157. package/upstream-skills/zh-archify/modules/code-analysis/overlay/i18n.mjs +9 -0
  158. package/upstream-skills/zh-archify/modules/code-analysis/overlay/inject.mjs +1 -1
  159. package/upstream-skills/zh-archify/modules/code-analysis/overlay/page.mjs +11 -6
  160. package/upstream-skills/zh-archify/modules/code-analysis/overlay/pull-request.mjs +1 -1
  161. package/upstream-skills/zh-archify/modules/code-analysis/schemas/ai-task.schema.json +1 -0
  162. package/upstream-skills/zh-archify/modules/code-analysis/test/atlas.test.mjs +88 -0
  163. package/upstream-skills/zh-archify/modules/code-analysis/test/duplicates.test.mjs +1 -1
  164. package/upstream-skills/zh-archify/modules/code-analysis/test/external-workflow.test.mjs +1 -1
  165. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.json +1 -0
  166. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.missing.json +1 -0
  167. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.json +1 -0
  168. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.valid.json +1 -0
  169. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.changed.json +1 -0
  170. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.json +1 -0
  171. package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/module-cycle.task.json +1 -0
  172. package/upstream-skills/zh-archify/modules/code-analysis/test/function-source-range.test.mjs +10 -0
  173. package/upstream-skills/zh-archify/modules/code-analysis/test/output-recovery.test.mjs +626 -0
  174. package/upstream-skills/zh-archify/modules/code-analysis/test/pull-request.test.mjs +98 -2
  175. package/upstream-skills/zh-archify/modules/code-analysis/test/review.test.mjs +37 -0
  176. package/upstream-skills/zh-archify/modules/code-analysis/test/source-panel.test.mjs +2 -1
  177. package/upstream-skills/zh-archify/modules/code-analysis/test/task.test.mjs +3 -2
  178. package/upstream-skills/zh-archify/modules/code-analysis/test/verification-history.test.mjs +216 -0
  179. package/upstream-skills/zh-archify/modules/code-analysis/test/verification.test.mjs +122 -0
  180. package/upstream-skills/zh-archify/package-lock.json +2 -2
  181. package/upstream-skills/zh-archify/package.json +1 -1
  182. package/upstream-skills/zh-archify/references/authoring-contract.md +2 -0
  183. package/upstream-skills/zh-archify/references/explainer-authoring.md +1 -1
  184. package/upstream-skills/zh-archify/renderers/architecture/render-architecture.mjs +1 -0
  185. package/upstream-skills/zh-archify/renderers/class/render-class.mjs +1 -0
  186. package/upstream-skills/zh-archify/renderers/dataflow/render-dataflow.mjs +2 -1
  187. package/upstream-skills/zh-archify/renderers/erd/render-erd.mjs +1 -0
  188. package/upstream-skills/zh-archify/renderers/lifecycle/render-lifecycle.mjs +4 -2
  189. package/upstream-skills/zh-archify/renderers/sequence/render-sequence.mjs +4 -2
  190. package/upstream-skills/zh-archify/renderers/shared/cli.mjs +7 -1
  191. package/upstream-skills/zh-archify/renderers/timeline/render-timeline.mjs +1 -0
  192. package/upstream-skills/zh-archify/renderers/tree/render-tree.mjs +1 -0
  193. package/upstream-skills/zh-archify/renderers/waterfall/render-waterfall.mjs +1 -0
  194. package/upstream-skills/zh-archify/renderers/workflow/render-workflow.mjs +3 -2
  195. package/upstream-skills/zh-archify/renderers/workflow/workflow-compiler.mjs +68 -7
  196. package/upstream-skills/zh-archify/skill-release.json +1 -1
  197. package/upstream-skills/zh-modern-web-guidance/SKILL.md +4 -11
  198. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-detection.md +20 -0
  199. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-model.md +22 -0
  200. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/prompt-api.md +22 -0
  201. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/summarizer.md +20 -0
  202. package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/translator.md +22 -0
  203. package/upstream-skills/zh-modern-web-guidance/guides/performance/custom-ml-model-inference.md +342 -0
  204. package/upstream-skills/zh-modern-web-guidance/guides/performance/data-parallel-computation.md +337 -0
  205. package/upstream-skills/zh-modern-web-guidance/guides/performance/improve-next-page-load-performance.md +4 -1
  206. package/upstream-skills/zh-modern-web-guidance/guides/performance/large-scene-rendering.md +350 -0
  207. package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md +9 -0
  208. package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md +9 -0
  209. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/animate-to-from-top-layer.md +9 -0
  210. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/declarative-dialog-popover-control.md +9 -0
  211. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md +9 -0
  212. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/scroll-target-on-load.md +29 -0
  213. package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/sortable-table.md +1 -0
  214. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/app-menus.md +9 -0
  215. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/context-menu.md +9 -0
  216. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/copy-button.md +9 -0
  217. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/dialog.md +10 -1
  218. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/hovercard.md +9 -0
  219. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/menu.md +9 -0
  220. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/navbar.md +9 -0
  221. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-app-tours.md +9 -0
  222. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-toast-notifications.md +9 -0
  223. package/upstream-skills/zh-modern-web-guidance/guides/ui-components/toolbar.md +9 -0
  224. package/upstream-skills/zh-modern-web-guidance/guides/user-experience/content-first-noise-reduction.md +9 -0
  225. package/upstream-skills/zh-modern-web-guidance/guides/user-experience/natural-interactions.md +9 -0
  226. package/upstream-skills/zh-modern-web-guidance/guides/webmcp/agentic-javascript-tools.md +27 -0
  227. package/skills/home/home-project-changelog/assets/project-changelog.md +0 -35
  228. package/skills/system/system-clash-tun-egress/SKILL.md +0 -22
  229. package/skills/system/system-clash-tun-egress/agents/openai.yaml +0 -4
  230. package/skills/system/system-config/SKILL.md +0 -37
  231. package/skills/system/system-config/agents/openai.yaml +0 -4
  232. package/skills/system/system-config/references/ai-cli-config.md +0 -75
  233. package/skills/system/system-config/references/ai-cli-optimization.md +0 -37
  234. package/skills/system/system-config/references/index.md +0 -12
  235. package/skills/system/system-config/references/locale-workflow.md +0 -33
  236. package/skills/system/system-config/references/locale.md +0 -50
  237. package/skills/system/system-proxy/SKILL.md +0 -40
  238. package/skills/system/system-proxy/agents/openai.yaml +0 -4
  239. package/skills/system/system-proxy/assets/protected-rules.yaml +0 -7
  240. package/skills/system/system-proxy/references/dns-workflow.md +0 -152
  241. /package/skills/system/{system-config → system-clash-proxy-config}/assets/configuration.md +0 -0
  242. /package/skills/system/{system-proxy → system-clash-proxy-config}/assets/network.md +0 -0
  243. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/acceptance.md +0 -0
  244. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-fields.md +0 -0
  245. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-misconceptions.md +0 -0
  246. /package/skills/system/{system-clash-tun-egress/references/troubleshooting.md → system-clash-proxy-config/references/egress-troubleshooting.md} +0 -0
  247. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-linux.md +0 -0
  248. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-macos.md +0 -0
  249. /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-windows.md +0 -0
  250. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/network-performance.md +0 -0
  251. /package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/nodes-and-dns.md +0 -0
  252. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platform-dns.md +0 -0
  253. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platforms.md +0 -0
  254. /package/skills/system/{system-proxy → system-clash-proxy-config}/references/tun-dns.md +0 -0
@@ -1,5 +1,16 @@
1
1
  export const categories = ['功能', '修复', '重构', '优化', '维护'];
2
2
 
3
+ export function categoryCounts(types) {
4
+ const counts = Object.fromEntries(categories.map(category => [category, 0]));
5
+ for (const type of types) if (Object.hasOwn(counts, type)) counts[type]++;
6
+ return counts;
7
+ }
8
+
9
+ function addCommits(first, second) {
10
+ if (first == null || second == null || !Number.isSafeInteger(first + second)) return null;
11
+ return first + second;
12
+ }
13
+
3
14
  export function timeline(projects) {
4
15
  return projects.flatMap(project => project.periods.map((period, order) => ({project, period, order})))
5
16
  .sort((a, b) => b.period.to.localeCompare(a.period.to) || a.project.id.localeCompare(b.project.id, 'en') || a.order - b.order);
@@ -23,6 +34,8 @@ export function statistics(periods) {
23
34
  return {
24
35
  changes,
25
36
  commits: sum(period => period.commits),
37
+ linesAdded: sum(period => period.linesAdded),
38
+ linesDeleted: sum(period => period.linesDeleted),
26
39
  byCategory: changes === null ? null : Object.fromEntries(categories.map(category => [
27
40
  category, sum(period => period.items.filter(([type]) => type === category).length),
28
41
  ])),
@@ -31,23 +44,42 @@ export function statistics(periods) {
31
44
  }
32
45
 
33
46
  export function observationWindows(projects) {
34
- const byEnd = new Map();
47
+ const batches = new Map();
35
48
  for (const {project, period} of timeline(projects)) {
36
- if (!byEnd.has(period.to)) byEnd.set(period.to, new Map());
37
- const groups = byEnd.get(period.to);
49
+ const key = period.collectionAt ?? period.to;
50
+ if (!batches.has(key)) {
51
+ const to = period.collectionAt ? executionDate(period.collectionAt, period.timezone).slice(0, 10) : period.to;
52
+ batches.set(key, {key, to, at:period.collectionAt, timezone:period.timezone, byProject:new Map()});
53
+ }
54
+ const groups = batches.get(key).byProject;
38
55
  if (!groups.has(project.id)) groups.set(project.id, {project, periods:[]});
39
56
  groups.get(project.id).periods.push(period);
40
57
  }
41
- const ends = [...byEnd.keys()];
42
- return ends.map((to, index) => {
43
- const previous = ends[index + 1];
44
- const from = previous ? new Date(Date.parse(previous) + 86_400_000).toISOString().slice(0, 10) : null;
45
- const groups = [...byEnd.get(to).values()];
58
+ const ordered = [...batches.values()].sort((a,b) => b.to.localeCompare(a.to) || b.key.localeCompare(a.key));
59
+ return ordered.map(({byProject, ...batch}, index) => {
60
+ const previous = ordered[index + 1];
61
+ const groups = [...byProject.values()];
46
62
  const periods = groups.flatMap(group => group.periods);
47
- return {from, to, groups, rangeCount:periods.length, stats:statistics(periods)};
63
+ const from = previous?.to ?? periods.map(period => period.from).filter(Boolean).sort()[0] ?? null;
64
+ return {...batch, from, fromAt:previous?.at, fromTimezone:previous?.timezone, groups, rangeCount:periods.length, stats:statistics(periods)};
48
65
  });
49
66
  }
50
67
 
68
+ function executionDate(value, timezone = 'UTC') {
69
+ const parts = new Intl.DateTimeFormat('sv-SE', {
70
+ timeZone:timezone, dateStyle:'short', timeStyle:'medium',
71
+ }).formatToParts(new Date(value));
72
+ return parts.map(part => part.value).join('');
73
+ }
74
+
75
+ export function windowLabel(window) {
76
+ const {from,to,at,fromAt,timezone,fromTimezone} = window;
77
+ const sameDay = from === to;
78
+ const end = sameDay && at ? executionDate(at,timezone) : to;
79
+ const start = sameDay && fromAt ? executionDate(fromAt,fromTimezone) : from;
80
+ return start && start !== end ? start + ' 至 ' + end : '截至 ' + end;
81
+ }
82
+
51
83
  export function periodTitle(period) {
52
84
  return period.items[0]?.[1] ?? (period.baseline ? '建立日志记录基线' : '完成本次区间核对');
53
85
  }
@@ -77,8 +109,14 @@ export function activityMonths(projects) {
77
109
  for (const project of projects) {
78
110
  for (const period of periodsByEnd(project)) {
79
111
  if (period.commitMonths) {
80
- for (const [month, count] of Object.entries(period.commitMonths)) groupAt(month,project).commits += count;
81
- } else groupAt('undated',project).commits += period.commits;
112
+ for (const [month, count] of Object.entries(period.commitMonths)) {
113
+ const group = groupAt(month, project);
114
+ group.commits = addCommits(group.commits, count);
115
+ }
116
+ } else {
117
+ const group = groupAt('undated', project);
118
+ group.commits = addCommits(group.commits, period.commits);
119
+ }
82
120
  period.items.forEach((item, index) => {
83
121
  const month = period.commitMonths ? item[3].date.slice(0,7) : 'undated';
84
122
  groupAt(month,project).rows.push({period,index});
@@ -96,9 +134,15 @@ export function activityMonths(projects) {
96
134
  for (const group of groups) {
97
135
  const rowDate = ({period,index}) => period.items[index]?.[3]?.date ?? period.to;
98
136
  group.rows.sort((a,b) => rowDate(b).localeCompare(rowDate(a)));
99
- changes += group.rows.filter(row => row.index >= 0).length;
100
- commits += group.commits;
137
+ const types = group.rows.filter(row => row.index >= 0).map(({period,index}) => period.items[index][0]);
138
+ group.changes = types.length;
139
+ group.byCategory = categoryCounts(types);
140
+ changes += group.changes;
141
+ commits = addCommits(commits, group.commits);
101
142
  }
102
- return {key,groups,commits,changes};
143
+ const byCategory = Object.fromEntries(categories.map(category => [
144
+ category, groups.reduce((total, group) => total + group.byCategory[category], 0),
145
+ ]));
146
+ return {key,groups,commits,changes,byCategory};
103
147
  });
104
148
  }
@@ -1,31 +1,21 @@
1
- import { activityMonths, categories, distinctRangeLabel, itemId, periodTitle, statistics, timeline } from './model.mjs';
2
- import { arrow, availableGroups, categoryBreakdown, crumbs, escapeHtml as esc, external, formatCount, logPath, mark, projectCard, projectChip, projectMetrics, projectPath, statStrip, statSummary, symbol } from './layout.mjs';
3
- import { impactLabels, monthlyLedger, monthLabel } from './ledger.mjs';
1
+ import { categories, distinctRangeLabel, itemId, periodTitle, statistics, timeline, windowLabel } from './model.mjs';
2
+ import { arrow, availableGroups, crumbs, escapeHtml as esc, external, formatCount, logPath, mark, projectCard, projectChip, projectPath, statStrip, statSummary, symbol } from './layout.mjs';
3
+ import { rangeLedger } from './ledger.mjs';
4
4
 
5
- function activitySummary(root, projects) {
6
- const months = activityMonths(projects).filter(({key}) => key !== 'undated').slice(0, 4);
7
- if (!months.length) return projects.some(project => project.periods.length || project.legacy)
8
- ? `<div class="activity-figure"><p>已有记录保留在变更明细中。</p><a class="text-link" href="${root}changelog/#month-undated">查看变更明细 ${arrow}</a></div>`
9
- : '';
10
- const maximum = Math.max(1,...months.map(month => month.changes));
11
- return `<figure class="activity-figure"><figcaption class="chart-label">近期项目活动</figcaption>
12
- <table class="activity-table"><thead><tr><th scope="col">月份</th><th scope="col">任务</th><th scope="col">Git 提交</th></tr></thead>
13
- <tbody>${months.map(({key, changes, commits}) => `<tr><th scope="row"><a href="${root}changelog/#month-${key}">${monthLabel(key)}</a></th><td><span class="activity-value"><i aria-hidden="true" style="--share:${(100*changes/maximum).toFixed(1)}%"></i>${formatCount(changes)}</span></td><td>${formatCount(commits)}</td></tr>`).join('')}</tbody></table>
14
- <a class="text-link" href="${root}changelog/">查看全部月份 ${arrow}</a></figure>`;
15
- }
5
+ const dataPath = (root, project) => esc(`${root}data/projects/${project.id}.json`);
16
6
 
17
7
  function sectionHeading(title, url, label) {
18
8
  return `<div class="section-heading"><h2>${title}</h2><a class="text-link" href="${url}">${label} ${arrow}</a></div>`;
19
9
  }
20
10
 
21
- export function overview(root, projects, windows, stats) {
11
+ export function overview(root, projects, stats) {
22
12
  const asOf = timeline(projects)[0]?.period.to;
23
- const activity = activitySummary(root, projects);
24
- return `<section class="overview-hero${activity ? '' : ' hero-no-activity'}" aria-labelledby="hero-title"><div class="hero-copy">
13
+ return `<section class="overview-hero" aria-labelledby="hero-title"><div class="hero-copy">
25
14
  ${asOf ? `<div class="hero-date"><i></i>记录截至 <time datetime="${asOf}">${asOf.replaceAll('-', '.')}</time></div>` : ''}
26
15
  <h1 id="hero-title">项目进展总览</h1>
27
- <dl class="hero-stats"><div><dt>公开项目</dt><dd>${formatCount(projects.length)}</dd></div><div><dt>记录区间提交</dt><dd>${formatCount(stats.commits)}</dd></div><div><dt>已记录任务</dt><dd>${formatCount(stats.changes)}</dd></div></dl>
28
- </div>${activity}</section>
16
+ <p>${formatCount(projects.length)} 个公开项目 · <a class="hero-link" href="${root}changelog/">浏览变更区间 ${arrow}</a></p>
17
+ </div></section>
18
+ ${statSummary('home-statistics','全站累计',stats)}
29
19
  <section class="home-catalog" aria-label="项目进展">
30
20
  ${sectionHeading('项目进展', root + 'projects/', '查找项目')}
31
21
  <div class="project-grid home-grid">${projects.length ? projects.map(project => projectCard(root, project)).join('') : '<p>暂无公开项目</p>'}</div>
@@ -33,7 +23,7 @@ export function overview(root, projects, windows, stats) {
33
23
  }
34
24
 
35
25
  export function catalog(root, projects) {
36
- return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length} 个公开项目。打开项目可按月份查看任务和提交。</p></header>
26
+ return `${crumbs(root,[['项目目录']])}<header class="page-head"><h1>项目目录</h1><p>共 ${projects.length} 个公开项目。打开项目可按采集区间查看任务和提交。</p></header>
37
27
  <section aria-label="项目筛选"><div class="filter-bar enhanced-only"><div class="filter-pills" aria-label="选择项目分组">${['全部',...availableGroups(projects)].map((g,i) => `<button type="button" data-group-filter="${i ? esc(g) : ''}" aria-pressed="${i === 0}">${esc(g)}</button>`).join('')}</div>
38
28
  <label class="field search-field">${symbol('search')}<input id="catalog-query" type="search" aria-label="筛选项目" placeholder="名称、ID 或简介" autocomplete="off"></label></div>
39
29
  <p id="catalog-count" class="list-count" aria-live="polite">显示 ${projects.length} 个项目</p><div id="project-grid" class="project-grid catalog-grid">${projects.map(project => projectCard(root,project)).join('')}</div>
@@ -45,30 +35,38 @@ function resourceButtons(project) {
45
35
  `<a class="secondary-button" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${label} ${external}</a>`).join('');
46
36
  }
47
37
 
48
- export function detail(root, project, stats) {
38
+ export function detail(root, project, stats, projects = []) {
39
+ const relatives = projects.filter(other => other.parent === project.id || other.id === project.parent);
40
+ const related = relatives.map(other => `<a class="secondary-button" href="${esc(root + projectPath(other))}">${other.id === project.parent ? '父项目' : '子模块'} · ${esc(other.name)}</a>`).join('');
41
+ const windows = project.periods.map((period,index) => {
42
+ const previous = project.periods[index+1];
43
+ const {key, from, to, collectionAt:at, timezone} = period;
44
+ const label = at && from === to
45
+ ? windowLabel({from,to,at,timezone,fromAt:previous?.collectionAt,fromTimezone:previous?.timezone})
46
+ : distinctRangeLabel(project,period);
47
+ return {key, label, groups:[{project, periods:[period]}], stats:statistics([period])};
48
+ });
49
49
  return `${crumbs(root,[['项目目录','projects/'],[project.name]])}<header class="detail-head tone-${project.color}"><div class="detail-intro">${mark(project)}<div>${project.groups.length ? `<span class="detail-group">${esc(project.groups.join(' · '))}</span>` : ''}<h1>${esc(project.name)}</h1>${project.id !== project.name ? `<span class="repo-id">${esc(project.id)}</span>` : ''}</div></div>
50
- <p>${esc(project.purpose)}</p>${projectMetrics(project, 'detail-stats', stats)}${categoryBreakdown(stats)}
51
- <div class="button-row"><a class="secondary-button" href="${root}${logPath(project)}">项目日志原文 ${arrow}</a>${resourceButtons(project)}</div></header>
52
- ${monthlyLedger(root, [project], {showProject:false})}`;
50
+ <p>${esc(project.purpose)}</p>${statStrip(stats, '记录区间提交', {headCommits:project.headCommits})}
51
+ <div class="button-row"><a class="secondary-button" href="${dataPath(root, project)}">项目日志 JSON ${arrow}</a><a class="secondary-button" href="${root}${logPath(project)}">按区间浏览日志 ${arrow}</a>${resourceButtons(project)}${related}</div></header>
52
+ ${rangeLedger(root, [project], windows, {showProject:false})}`;
53
53
  }
54
54
 
55
55
  function logPeriod(project, period) {
56
56
  const groups = categories.map(category => {
57
- const entries = period.items.map(([type, text, markers, meta], index) => {
57
+ const entries = period.items.map(([type, text], index) => {
58
58
  if (type !== category) return '';
59
- const date = meta?.date ? `<time datetime="${esc(meta.date)}">${esc(meta.date)}</time>` : '';
60
- const area = meta?.area ? `<span>${esc(meta.area)}</span>` : '';
61
- return `<li class="log-entry" id="${esc(itemId(period, index))}">${impactLabels(markers)}${esc(text)}${date || area ? `<div class="entry-context">${date}${area}</div>` : ''}</li>`;
59
+ return `<li class="log-entry" id="${esc(itemId(period, index))}">${esc(text)}</li>`;
62
60
  }).join('');
63
61
  return entries ? `<section class="category-block"><h3>${category}</h3><ul>${entries}</ul></section>` : '';
64
62
  }).join('');
65
- return `<article id="range-${period.key}" class="log-period tone-${project.color}"><div class="period-heading">${projectChip(project)}<span>${period.baseline ? '基线' : 'Git 区间'}</span></div><h2>${esc(distinctRangeLabel(project,period))}</h2><p class="period-title">${esc(periodTitle(period))}</p>
63
+ return `<article id="range-${period.key}" class="log-period tone-${project.color}"><div class="period-heading">${projectChip(project)}<span>${period.baseline ? '基线 · 未回填历史任务' : 'Git 区间'}</span></div><h2>${esc(distinctRangeLabel(project,period))}</h2>
66
64
  ${period.note ? `<p class="period-note">${esc(period.note)}</p>` : ''}${statStrip(statistics([period]),'本次提交')}
67
65
  ${groups}</article>`;
68
66
  }
69
67
 
70
68
  export function repositoryLog(root, project, stats) {
71
- return `${crumbs(root,[['项目目录','projects/'],[project.name,projectPath(project)],['变更日志']])}<header class="page-head"><span class="detail-group">${project.id}</span><h1>${esc(project.name)} 变更日志</h1><p>${project.periods.length} 个记录区间,按项目日志原序展示。</p></header>
69
+ return `${crumbs(root,[['项目目录','projects/'],[project.name,projectPath(project)],['变更日志']])}<header class="page-head"><span class="detail-group">${esc(project.id)}</span><h1>${esc(project.name)} 变更日志</h1><p>${project.periods.length} 个记录区间,按项目日志原序展示。</p><div class="button-row"><a class="secondary-button" href="${dataPath(root, project)}">查看日志 JSON</a><a class="secondary-button" href="${dataPath(root, project)}" download>下载 JSON</a></div></header>
72
70
  ${statSummary('project-statistics','本项目统计',stats,`汇总本项目 ${project.periods.length} 个公开区间。`)}
73
71
  <div class="log-layout"><nav class="log-index" aria-label="本仓区间"><h2>本仓区间</h2>${project.periods.map(p=>`<a href="#range-${p.key}"><time>${p.to}</time><span>${esc(periodTitle(p))}</span></a>`).join('')}${project.legacy ? '<a href="#legacy">历史补记</a>' : ''}</nav>
74
72
  <div class="log-content">${project.periods.map(p=>logPeriod(project,p)).join('')}${project.legacy ? `<article id="legacy" class="log-period"><h2>历史补记</h2><p class="legacy-text">${esc(project.legacy)}</p><small>历史原文保留在此页。</small></article>` : ''}</div></div>`;
@@ -1,115 +1,10 @@
1
- import { categories, itemId, statistics } from './model.mjs';
1
+ import { itemId, statistics } from './model.mjs';
2
2
 
3
- const tags = ['破坏性', '安全', '弃用', '移除', '回退'];
4
- const columns = ['变更总数', ...categories, '本次提交'];
5
- const dateTitle = /^## (\d{4}-\d{2}-\d{2})(?: 至 (\d{4}-\d{2}-\d{2}))?$/u;
6
- const splitCells = line => line.trim().slice(1,-1).split('|').map(word => word.trim());
7
3
  export function validDay(day) {
8
4
  if (typeof day !== 'string' || !/^\d{4}-\d{2}-\d{2}$/u.test(day)) return false;
9
5
  const ms = Date.parse(day + 'T00:00:00Z');
10
6
  return Number.isFinite(ms) && new Date(ms).toISOString().slice(0,10) === day;
11
7
  }
12
- function tableAt(lines, i) {
13
- if (!lines[i]?.startsWith('|') || !lines[i+1]?.startsWith('|') || !lines[i+2]?.startsWith('|')) return null;
14
- const headers = splitCells(lines[i]), values = splitCells(lines[i+2]);
15
- const expected = headers.includes('新增') ? [...columns, '新增'] : columns;
16
- const separators = splitCells(lines[i+1]);
17
- if (headers.length !== expected.length || headers.length !== values.length || !expected.every(key=>headers.includes(key))) return null;
18
- if (separators.length !== headers.length || !separators.every(cell=>/^:?-{3,}:?$/u.test(cell))) return null;
19
- if (!values.every(val=>/^(?:\d+|\d{1,3}(?:,\d{3})+)$/u.test(val) && Number.isSafeInteger(Number(val.replaceAll(',',''))))) return null;
20
- return Object.fromEntries(headers.map((key,index)=>[key,Number(values[index].replaceAll(',',''))]));
21
- }
22
- function entry(category, body) {
23
- const markers = [];
24
- const dated = /^(\d{4}-\d{2}-\d{2}) · (.+?) · (.+)$/u.exec(body);
25
- const unescape = value => value.replace(/\\([\[\]])/gu,'$1');
26
- const meta = dated && validDay(dated[1]) ? {date:dated[1],area:dated[2] === '—' ? null : unescape(dated[2])} : null;
27
- let text = meta ? dated[3] : body;
28
- while (true) {
29
- const match = /^\*\*\[([^\]]+)\]\*\*\s+/u.exec(text);
30
- if (!match || !tags.includes(match[1])) break;
31
- markers.push(match[1]);
32
- text = text.slice(match[0].length);
33
- }
34
- return meta ? [category,unescape(text),markers,meta] : [category,unescape(text),markers];
35
- }
36
- function parsePeriod(title, lines, datedOnly) {
37
- let group = '', totals = null, originalTable = '', fence = '';
38
- const items = [], notes = [];
39
- for (let i=0; i<lines.length; i++) {
40
- const line = lines[i].trim();
41
- if (!line) continue;
42
- const delimiter = /^\s*(\x60{3,}|~{3,})/u.exec(line);
43
- if (delimiter || fence) {
44
- if (delimiter && !fence) fence=delimiter[1];
45
- else if (delimiter && delimiter[1][0]===fence[0] && delimiter[1].length>=fence.length) fence='';
46
- notes.push(line);
47
- continue;
48
- }
49
- const table = tableAt(lines,i);
50
- if (table) { totals=table; originalTable=lines.slice(i,i+3).join('\n'); i+=2; group=''; continue; }
51
- if (line.startsWith('### ')) {
52
- group = line.slice(4);
53
- if (!categories.includes(group)) notes.push(line);
54
- } else if (categories.includes(group) && line.startsWith('- ')) {
55
- const task = entry(group,line.slice(2));
56
- if (datedOnly && !task[3]) notes.push(line);
57
- else items.push(task);
58
- } else notes.push(line);
59
- }
60
- const from = title[2] ? title[1] : null, to = title[2] ?? title[1];
61
- const countsOK = totals && totals['变更总数'] === items.length &&
62
- (totals['新增'] === undefined || totals['新增'] <= totals['功能']) &&
63
- categories.every(category=>totals[category] === items.filter(([name])=>name===category).length);
64
- if (originalTable && !countsOK) notes.push('原文统计待核对\n'+originalTable);
65
- return {
66
- from, to, items, notes, note:notes.join('\n'), commits:totals?.['本次提交'] ?? null,
67
- added:countsOK ? totals['新增'] ?? (totals['功能'] === 0 ? 0 : null) : null,
68
- verified:Boolean(countsOK), baseline:!items.length && totals?.['本次提交'] === 0 && notes.some(note=>/基线|之前的变更未回填/u.test(note)),
69
- };
70
- }
71
-
72
- export function parseMarkdown(body, {datedOnly = false} = {}) {
73
- const ranges = [], legacy = [];
74
- let header = null, block = [], fence = '', comment = false;
75
- function flush() {
76
- if (header) ranges.push(parsePeriod(header,block,datedOnly));
77
- else legacy.push(...block);
78
- block = [];
79
- }
80
- const visibleBody = body.replace(/^\uFEFF/u,'').replace(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/u,'');
81
- for (let line of visibleBody.split(/\r?\n/u)) {
82
- if (!fence && (comment || /^ {0,3}<!--/u.test(line))) {
83
- const end = line.indexOf('-->');
84
- comment = end < 0;
85
- if (comment) continue;
86
- line = line.slice(end + 3);
87
- if (!line.trim()) continue;
88
- }
89
- const fenceStart = /^\s*(\x60{3,}|~{3,})/u.exec(line);
90
- if (fenceStart) {
91
- if (!fence) fence = fenceStart[1];
92
- else if (fenceStart[1][0] === fence[0] && fenceStart[1].length >= fence.length) fence = '';
93
- block.push(line);
94
- continue;
95
- }
96
- if (!fence && line.startsWith('## ')) {
97
- flush();
98
- const match = dateTitle.exec(line.trim());
99
- header = match && validDay(match[1]) && (!match[2] || validDay(match[2]) && match[2]>=match[1]) ? match : null;
100
- if (!header) block.push(line);
101
- } else if (header || block.length || !line.startsWith('# ')) block.push(line);
102
- }
103
- flush();
104
- const occurrences = new Map();
105
- for (const period of [...ranges].reverse()) {
106
- const pair = (period.from ?? 'single') + '_' + period.to;
107
- const number = (occurrences.get(pair) ?? 0) + 1;
108
- occurrences.set(pair,number);
109
- period.key = pair+'-'+number;
110
- }
111
- return {periods:ranges,legacy:legacy.join('\n').trim()};
112
- }
113
8
 
114
9
  export function publicProject(project) {
115
10
  return {
@@ -117,7 +12,8 @@ export function publicProject(project) {
117
12
  groups:project.groups, ...(project.docsUrl ? {docsUrl:project.docsUrl} : {}), ...(project.repoUrl ? {repoUrl:project.repoUrl} : {}),
118
13
  stats:statistics(project.periods),
119
14
  ranges:project.periods.map(period=>({
120
- key:period.key,from:period.from,to:period.to,baseline:!!period.baseline,
15
+ key:period.key,from:period.from,to:period.to,baseline:period.baseline,coverage:period.coverage,
16
+ collectionAt:period.collectionAt ?? null,
121
17
  stats:statistics([period]),
122
18
  notes:period.notes ?? (period.note ? [period.note] : []),
123
19
  commitMonths:period.commitMonths ?? null,
@@ -1,5 +1,5 @@
1
1
  {
2
- "title": "Home Atlas",
2
+ "title": "HomeRepo",
3
3
  "base": "/",
4
4
  "scope": "all",
5
5
  "overrides": {}
@@ -1,82 +1,100 @@
1
1
  # Home 网站的初始化、刷新与发布
2
2
 
3
- ## 打开已构建的网站
4
-
5
- 双击 `.agents/home/website/dist/index.html` 即可离线浏览。浏览器允许本地脚本时,项目导航、筛选、搜索和主题切换都可使用。移动或分享制品时,保留整个 `dist/` 目录。
3
+ ## 启用或激活网站
6
4
 
7
- 验证托管路径或 HTTP 404 时,从 Home 根运行:
5
+ 在已登记项目的 Home 根运行。命令可从其他目录执行,此时用 `--home` 传入实际 Home 根。
8
6
 
9
- ~~~powershell
10
- npm --prefix .agents/home/website run preview
7
+ ~~~sh
8
+ node .agents/skills/home-website/scripts/activate.mjs --home . --title "项目进展"
11
9
  ~~~
12
10
 
13
- 在浏览器打开终端输出的地址。默认是 `http://127.0.0.1:4173/`,配置了 `base` 的站点会显示对应的路径。终端保持运行,按 `Ctrl+C` 结束预览。
11
+ `--title` 为新站命名,省略时使用 `HomeRepo`。未改过的 v0.1.49 默认配置升级时采用同一命名规则。用户改过的配置沿用当前标题和其他设置。已有 `website/changelogs/` 时可直接初始化,日志随工程保留。
14
12
 
15
- 端口被占用时,运行 `node .agents/home/website/scripts/site.mjs preview --port 4174` 改用 4174。
13
+ 1. 有指定项目范围时,先在 `.agents/home/website/site.config.json` 设置 `projectIds`。首次需先生成配置时,可运行 `node .agents/skills/home-website/scripts/init.mjs --home . --title "项目进展"`,再编辑配置并激活。
14
+ 2. 激活补齐网站模板,并迁移展示范围内可从旧日志恢复且缺少新 JSON 的项目。它核对有仓库登记或子模块关系的项目 checkout 和 Git 节点,为缺失或有增量的项目生成冻结区间。
15
+ 3. 回执为 `needs-analysis` 时,读取 `review`。激活 `home-project-changelog`,对每个可核实的 snapshot 调用 `evidence`,按日志方法核对提交和实际改动,整理候选并用 `apply` 保存。独立处理可完成的项目,保留不可路由或无法取证的具体原因。提交标题用来定位改动,任务需要 Git 证据。
16
+ 4. 重跑激活。缺少站点依赖时,激活在网站工程目录执行 `npm ci`,随后刷新。以 `built` 或 `unchanged` 回执核对公开项目、条目、统计与排除项。若配置范围仍有缺项,按实际回执报告。
16
17
 
17
- ## 初始化与构建
18
+ 已有日志和依赖时,网站工程可独立构建。`node .agents/home/website/scripts/site.mjs sources` 可只读检查 `eligible`、`needsGeneration` 和 `excluded`。`needsGeneration` 只列尚无项目文件的项目。已存在但损坏或无成功区间的文件,由日志技能核对原件。
18
19
 
19
- 在确认的 Home 根运行以下命令。单装网站技能即可,工程生成后也可以独立构建。记录中的 `repos.json` 由 home-setup 提供。
20
+ ## 打开已构建的网站
21
+
22
+ 双击 `.agents/home/website/dist/index.html` 可离线浏览。浏览器允许本地脚本时可以筛选、搜索和切换主题。移动或分享制品时保留整个 `dist/`。
23
+
24
+ 验证托管路径和 HTTP 404 时,从 Home 根运行:
20
25
 
21
26
  ~~~sh
22
- node .agents/skills/home-website/scripts/init.mjs --home .
23
- npm --prefix .agents/home/website ci
24
- npm --prefix .agents/home/website run build
27
+ npm --prefix .agents/home/website run preview
25
28
  ~~~
26
29
 
27
- 构建回执包含 `built` 或 `unchanged`、站点前缀、公开项目数、条目数、统计和输入诊断。重新初始化只补缺并报告与模板不同的文件,保留本地内容。
30
+ 打开终端给出的地址。默认是 `http://127.0.0.1:4173/`,配置了 `base` 的站点带部署前缀。按 `Ctrl+C` 结束预览。端口被占用时运行 `node .agents/home/website/scripts/site.mjs preview --port 4174`。
28
31
 
29
- ## 更新已有模板
32
+ ## 公开字段与数据来源
30
33
 
31
- 更新已安装的 `home-website` 技能后,从实际 Home 根在临时目录生成一份新模板。将原网站的脚本和站点源文件备份,再比较两个版本。以下为 PowerShell 示例。
34
+ 网站配置位于 `.agents/home/website/site.config.json`。
32
35
 
33
- ~~~powershell
34
- $atlasSite = (Resolve-Path .agents/home/website).Path
35
- $atlasScratch = Join-Path ([IO.Path]::GetTempPath()) ('home-atlas-' + [guid]::NewGuid())
36
- New-Item -ItemType Directory -Path $atlasScratch | Out-Null
37
- node .agents/skills/home-website/scripts/init.mjs --home $atlasScratch
38
- $atlasNew = Join-Path $atlasScratch '.agents/home/website'
39
- $atlasBackup = Join-Path $atlasScratch 'backup'
40
- New-Item -ItemType Directory -Path $atlasBackup | Out-Null
41
- Copy-Item -LiteralPath "$atlasSite/scripts","$atlasSite/site" -Destination $atlasBackup -Recurse
42
- git diff --no-index -- "$atlasSite/scripts" "$atlasNew/scripts"
43
- git diff --no-index -- "$atlasSite/site" "$atlasNew/site"
44
- ~~~
36
+ | 键 | 作用 |
37
+ | --- | --- |
38
+ | `title` | 站点标题 |
39
+ | `base` | `/` 或部署前缀,例如 `/portfolio/` |
40
+ | `scope` | 固定为 `all`,可省略 |
41
+ | `projectIds` | 可选的稳定 ID 数组,限制展示和补采范围,也可点名仅有日志的项目。省略时检查登记项目和显式关联的子模块。 |
42
+ | `publicGroups` | 允许公开的登记分组名称。省略时无公开分组。 |
43
+ | `overrides` | 按稳定 ID 设置备用显示名 `displayName`、简介 `summary`、公开 HTTPS 地址 `docsUrl` 或 `repoUrl`。可用 `hidden: true` 或 `showChangelog: false` 排除项目。 |
45
44
 
46
- `git diff --no-index` 返回 1 表示找到差异。逐文件应用模板变更,原样使用模板的文件可直接从新版本复制,改过的文件合并差异。`site.config.json` 和 Home 的登记、日志及状态沿用手头版本。此版使用原有依赖锁定,缺依赖时在实际网站目录运行 `npm ci`。执行 `node .agents/home/website/scripts/site.mjs refresh` 并核对排除项、统计与原文链接。需要撤回时,用备份恢复刚合入的文件并重新刷新,上一份成功制品也留在 `.cache/previous-dist/`。
45
+ 展示名依次取 `repos.json` 顶层的 `projectNames[id]`、站点备用 `displayName`、日志中的 `displayName` 和稳定 ID。修改首选名称由 `home-setup` 负责,然后执行 `site.mjs refresh`。读者可按首选名称或 ID 搜索。其他登记别名只用于 Home 的项目查询。
47
46
 
48
- ## 公开字段与数据来源
47
+ 目录、详情、日志、搜索和统计使用同一集合。展示项目须在配置范围内、未被排除且有成功的 JSON 源。零项基线仍是成功区间。已发布且仍在当前范围的项目若缺文件,刷新保留上一版制品并报告需恢复的项目。
49
48
 
50
- 修改网站工程中的 `site.config.json`。`title` 是网站标题,`base` 为 `/` 或以斜线结尾的部署前缀,例如 `/portfolio/`。`scope` 为 `all`。`publicGroups` 缺省为空。`overrides` 以登记项目 ID 为键,可设置 `displayName`、`summary`、`docsUrl`、`repoUrl`、`hidden` 或 `showChangelog`。
49
+ - 正式日志在 `.agents/home/website/changelogs/<repo-id>.json`。修改 `ledger.tasks` 的公开任务文字、历史 `legacy.entries` 或项目与区间 `notes` 后刷新,页面、搜索和公开 JSON 同步读取该文件。补采区间与修订任务证据由 `home-project-changelog` 负责。
50
+ - `dist/data/catalog.json` 提供 `schemaVersion: 2`、全站统计、项目记录区间的提交数、最新已记录 HEAD 的累计提交数 `headCommits`,以及 `months` 和 `windows`。
51
+ - 项目页的“项目日志 JSON”链接到 `dist/data/projects/<repo-id>.json`。公开区间提供日期、覆盖状态、统计、说明、`commitMonths` 及 `entries`。任务条目提供显示键、类别、模块、日期、正文和标记。历史条目的模块和日期可以是 `null`。源文件中的私有提交 OID、取证对象、无公开配置的 URL 和本机路径留在 Home。
51
52
 
52
- - 公开集合取当前登记、`changelogs/state.json` 中成功保存的记录和展示配置。已保存且匹配正文的零项基线有公开区间。排除无状态、仅 Markdown、撤登、`hidden: true` 或 `showChangelog: false` 的项目。目录、详情、日志、搜索、JSON 和统计使用同一集合。
53
- - 分组仅公开与 `publicGroups` 同名的登记值。源码与文档入口取站主明确提供的 HTTPS 地址。本机路径、内部引用和原始状态留在 Home。
54
- - 先按日期、区间提交数和类别数量匹配 `changelogs/<id>.md` 的成功段。新日志再逐项核对区间 `ledger.tasks` 的日期、模块、类别、标记和正文。正式数据只从成功记录和相符的 Markdown 构建。成功段有 pending、正文缺失或任务不一致时,刷新报错并保留上次制品。历史补记保留在原文页。
55
- - `dist/data/catalog.json` 提供 `schemaVersion: 2`、全站统计、各项目的任务量、区间提交数和 `headCommits`,以及按任务与提交月份聚合的 `months` 和按采集截止日聚合的 `windows`。月份未知的旧记录使用 `month: null`。
56
- - `dist/data/projects/<id>.json` 提供 `headCommits`、项目统计及 `ranges[]`。每段有日期、`stats` 和 `commitMonths`。公开 `entries[]` 含 `key/category/area/date/text/markers`,旧条目的日期与模块可为 `null`。新任务的键在排序后保持稳定。更改模块、类别或正文会改变键。项目私有提交 OID、证据和游标只保存在 Home。
53
+ ### 展示 Git 子模块
54
+
55
+ 在 `site.config.json` 的 `overrides` 中为子模块设置 `submoduleOf`(已登记父项目的 ID)。检出路径默认使用子模块 ID,目录不同时设置 `submodulePath`。例如 `"backend": {"submoduleOf":"platform","submodulePath":"modules/backend"}`。选择父项目会纳入显式配置的子模块;每个仓只计一次。父子详情页互相链接。离线刷新读取各自的 JSON,激活时按父仓 HEAD 的 Git 登记和已初始化的检出核对来源。独立存档要公开时将稳定 ID 加入 `projectIds`。没有 checkout 绑定的存档由激活回执 `storedOnly` 列出,直接使用已保存的日志。仅为存档设置名称不会将其加入网站。
57
56
 
58
57
  ## 时间线与统计
59
58
 
60
- 首页可直接看到公开项目数、已记录的独立任务和区间 Git 提交数。项目卡片在进入详情前就显示已记录任务和仓库累计提交。累计取最新成功节点的可达历史数,未能核实时显示未知;从某个起点开始记录时,累计提交可以大于区间提交数。
59
+ 首页和跨项目页突出记录区间的 Git 提交、新增代码行、删除代码行和任务总量,五类任务单独列出。项目卡片显示仓库累计提交和任务数。仓库累计来自最新已记录 HEAD 的可达历史。
61
60
 
62
- 跨项目页与项目详情按任务完成提交的月份倒序列出全部明细。每月 Git 提交按该月实际提交计数,包含没有单列任务的提交。一个提交完成多个任务时,任务数可以大于提交数。项目、月份、类别和关键词可组合筛选,关键词也能匹配模块。筛选显示命中任务数,月度提交保留所示项目在该月的完整提交量。
61
+ 跨项目明细按实际采集批次合并同一次运行的各仓日志。每次激活为当次写入的日志区间共用 `collectionAt`,同一天多次采集可按时间区分。旧日志按已保存的截止日归组。相邻执行之间以此前截止时间为起点,首次从可核实的最早起点展示。无增量的检查复用原记录。项目详情使用该仓保存的区间,可展开任务并进入对应原文。
63
62
 
64
- 旧日志缺少逐条日期时,页面单列“日期未记录”并链接到可核实的原区间。全站原有观测窗口仍可从公开 JSON 读取。首窗截至最早的截止日,后续窗口从上一次截止日的次日开始。窗口统计和任务月统计分别服务于采集回顾与实际变更查询。
63
+ 区间及项目明细依次显示任务数、新增代码行、删除代码行、功能、修复、重构、优化、维护。跨项目页与项目详情的 Git 提交数集中在顶部汇总。筛选按关键词、项目、区间和类别组合,任务数与分类数随匹配结果更新,代码行取可见项目区间的完整统计。新增和删除代码行取各成功区间首尾的 Git 文本差异,包含配置和文档。缺统计时使用 `null`,页面显示“未核实”。任务中的新增功能数沿用 `added`,独立于代码行统计。
65
64
 
66
- 功能可含新增和预期行为变更。新日志用功能任务的 `added` 标志计算精确新增数;旧日志继续支持统计表尾部的 `新增` 列,取 0 至该段功能条数。范围含未单列新增的功能时,公开 JSON 中的 `added` 为 `null`。
65
+ 公开目录 `windows` 包含区间键、执行时间和统计。已有 `months` 和分仓 `commitMonths` 可供数据读者使用。
67
66
 
68
67
  ## 更新和安全切换
69
68
 
70
- 完成一批登记或 Git 日志保存后,从真实 Home 根调用 `node .agents/home/website/scripts/site.mjs refresh`。修订成功区间、补记、网站展示设置或模板后也用该命令。只读查询、同节点无变化和仅清除 pending 回执没有新的展示内容。正常批次更新时独立报告各仓保存结果和网站结果。
69
+ 编辑 JSON、展示配置、模板,或完成一批登记和日志写入后,从 Home 根运行 `node .agents/home/website/scripts/site.mjs refresh`。刷新使用已保存数据,缺少新登记项目的日志时在回执列出。需要补采时执行[激活](#启用或激活网站)。分别报告各仓保存结果和网站结果。
70
+
71
+ 刷新在网站目录串行运行。候选制品在 `.cache/`,核对页面、链接、索引和公开数据后替换 `dist/`。上一份完整制品保留于 `.cache/previous-dist/`。可用 `refresh --force` 强制重建。刷新只使用 Home 登记、成功日志和站点工程。
72
+
73
+ ## 更新已有模板
74
+
75
+ 初始化或激活时,程序逐个比对本机文件与已识别的发布模板。完整匹配的文件可自动升级。回执用 `updated` 列出自动升级的路径,用 `conflicts` 列出已有修改的文件。需要为有修改的站点脚本或页面合并更新时,在临时 Home 生成一份可比较的模板。下面以 PowerShell 为例。
76
+
77
+ ~~~powershell
78
+ $website = (Resolve-Path .agents/home/website).Path
79
+ $templateHome = Join-Path ([IO.Path]::GetTempPath()) ('home-website-' + [guid]::NewGuid())
80
+ New-Item -ItemType Directory -Path $templateHome | Out-Null
81
+ node .agents/skills/home-website/scripts/init.mjs --home $templateHome
82
+ $templateSite = Join-Path $templateHome '.agents/home/website'
83
+ $templateBackup = Join-Path $templateHome 'backup'
84
+ New-Item -ItemType Directory -Path $templateBackup | Out-Null
85
+ Copy-Item -LiteralPath "$website/scripts","$website/site" -Destination $templateBackup -Recurse
86
+ git diff --no-index -- "$website/scripts" "$templateSite/scripts"
87
+ git diff --no-index -- "$website/site" "$templateSite/site"
88
+ ~~~
71
89
 
72
- 刷新按网站目录串行。构建候选在 `.cache/`,核对页面、链接和索引后才替换 `dist/`。上一个完整产物保留于 `.cache/previous-dist/`。重新构建可加 `--force`。构建输入仅使用 Home 登记、日志和站点工程,安装完成后无需子仓可用。
90
+ `git diff --no-index` 返回 1 表示有差异。逐文件应用模板改动,合并用户编辑,沿用原工程的标题、展示设置和正式日志。应用后重新激活并检查统计与公开日志链接。需要撤回模板改动时,恢复备份并再次刷新。
73
91
 
74
92
  ## 修复本地刷新
75
93
 
76
- 1. 缺少依赖时在网站工程运行 `npm ci`。`repos.json` 缺失先核对是否指向正确的 Home。日志 pending、损坏或正文缺失先交 home-project-changelog。
77
- 2. 中断后核对 `.refresh.lock/owner.json` 中的主机与 PID。原进程确认结束后运行 `node .agents/home/website/scripts/site.mjs recover`,再从最新输入刷新。恢复会在需要时将上一版完整产物放回 `dist/`。
78
- 3. 若构建或发布前预览出现需隐去的文字,回到登记、源 Markdown 或 `site.config.json` 修订并刷新。构建回执可检查本轮项目增删及日志解析诊断。
94
+ 1. 缺依赖时在网站工程运行 `npm ci`。缺 `repos.json` 时核对 Home 根。项目日志 JSON 损坏或丢失时,由 `home-project-changelog` 核对或恢复。
95
+ 2. 刷新中断时核对 `.refresh.lock/owner.json` 中的主机和 PID。确认原进程结束后运行 `node .agents/home/website/scripts/site.mjs recover`,再刷新。恢复会在需要时把上一份完整制品放回 `dist/`。
96
+ 3. 公开预览发现需隐去的文字时,编辑产生该文字的登记、项目 JSON 或展示设置,再刷新并核对该项及其搜索结果。
79
97
 
80
98
  ## 交付静态产物
81
99
 
82
- 在部署前按目标设置 `base` 并重建。将 `dist/` 作为静态制品,供 GitHub Pages、Nginx 或其他静态主机读取。目标必须能提供目录下的 `index.html` 和真实 404。配置后用匿名访问核对站点首页、跨仓时间线、两个不同仓的深链接和未知路由。保留成功部署版本和上一版本的制品作为回退依据。
100
+ 按部署目标设置 `base` 后重建。将整个 `dist/` 交给支持目录下 `index.html` 和真实 404 的静态主机。部署后匿名访问首页、跨仓时间线、两个项目的深链接、公开 JSON 和未知路由。保留成功部署版本与上一版本的制品供回退。