@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
@@ -3,6 +3,7 @@
3
3
  // lost or misattributed here is drawn wrong without any other check noticing.
4
4
  import assert from 'node:assert/strict';
5
5
  import fs from 'node:fs';
6
+ import os from 'node:os';
6
7
  import { test } from 'node:test';
7
8
  import { buildGraph, evaluateGraph, extractFacts, loadConfig } from '../lib/analysis.mjs';
8
9
  import { buildAtlas, moduleLabels } from '../overlay/atlas.mjs';
@@ -20,6 +21,51 @@ function analyze(t) {
20
21
  return { facts, graph, findings, atlas: buildAtlas({ graph, facts, findings }) };
21
22
  }
22
23
 
24
+ test('atlas: only function expressions named by a binding may restore', (t) => {
25
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-atlas-binding-'));
26
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
27
+ fs.writeFileSync(path.join(dir, 'bindings.ts'), 'const onSave = function /* comment */ () { return 1; };\nconst wrapped = (function () { return 4; });\nconst checked = (function () { return 5; }) satisfies () => number;\nconst asserted = (function () { return 6; }) as () => number;\nconst cast = <() => number>function () { return 7; };\nconst onCancel = function handler() { return 2; };\n{ const scoped = function () { return 3; }; }\n');
28
+ const config = loadConfig();
29
+ const { facts } = extractFacts(dir, { language: 'ts', config });
30
+ const graph = buildGraph(facts, config);
31
+ const atlas = buildAtlas({ graph, facts });
32
+ assert.equal(atlas.functions.find(fn => fn[1] === 'onSave')?.[9], true);
33
+ assert.equal(atlas.functions.find(fn => fn[1] === 'wrapped')?.[9], true, 'parenthesized bindings stay eligible');
34
+ assert.equal(atlas.functions.find(fn => fn[1] === 'checked')?.[9], true, 'satisfies bindings stay eligible');
35
+ assert.equal(atlas.functions.find(fn => fn[1] === 'asserted')?.[9], true, 'as assertions stay eligible');
36
+ assert.equal(atlas.functions.find(fn => fn[1] === 'cast')?.[9], true, 'angle-bracket assertions stay eligible');
37
+ assert.equal(atlas.functions.find(fn => fn[1] === 'handler')?.[9], false);
38
+ assert.equal(atlas.functions.find(fn => fn[1] === 'scoped')?.[9], false, 'scope is not captured as part of the binding identity');
39
+ facts.files.find(file => file.path === 'bindings.ts').sourceText = facts.files[0].sourceText.replace('return 1', 'return 9');
40
+ const mismatch = buildAtlas({ graph, facts });
41
+ assert.equal(mismatch.functions.find(fn => fn[1] === 'onSave')?.[9], false, 'a mismatched captured digest cannot establish a binding');
42
+ });
43
+
44
+ test('atlas: Java initializer and nested names are not stable identities', (t) => {
45
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-atlas-java-'));
46
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
47
+ fs.writeFileSync(path.join(dir, 'Demo.java'), 'class Demo { static { Runnable r = new Runnable() { public void run() {} }; } { int x = 1; } }\n');
48
+ const config = loadConfig(); config.include = ['**/*.java'];
49
+ const { facts } = extractFacts(dir, { language: 'java', config });
50
+ const atlas = buildAtlas({ graph: buildGraph(facts, config), facts });
51
+ for (const kind of ['<static initializer>', '<instance initializer>', '<locals>']) {
52
+ const matches = atlas.functions.filter(fn => kind === '<locals>' ? fn[1].includes(kind) : fn[1].endsWith(kind));
53
+ assert.ok(matches.length, `the real Java fixture contains ${kind}`);
54
+ assert.ok(matches.every(fn => fn[9] === false), `${kind} is order-dependent`);
55
+ }
56
+ });
57
+
58
+ test('atlas: function identity includes the full Python definition when present', (t) => {
59
+ const { facts, graph, findings } = analyze(t);
60
+ const fn = facts.functions.find(item => graph.fileModules[item.file]);
61
+ assert.ok(fn);
62
+ fn.sourceRange = { ...fn.sourceRange, sha256: 'metrics-only' };
63
+ fn.definition = { kind: 'FunctionDef', sourceRange: { ...fn.sourceRange, sha256: 'definition-with-decorators' } };
64
+ const atlas = buildAtlas({ graph, facts, findings });
65
+ const entry = atlas.functions.find(item => atlas.files[item[0]][0] === fn.file && item[1] === (fn.qualname || fn.name));
66
+ assert.equal(entry[8], 'definition-with-decorators');
67
+ });
68
+
23
69
  test('atlas: every in-tree dependency between analyzed files is drawn once, between the right files', (t) => {
24
70
  const { facts, graph, atlas } = analyze(t);
25
71
  const paths = atlas.files.map((f) => f[0]);
@@ -94,6 +140,22 @@ test('atlas: module labels are the shortest path tails that stay unique', () =>
94
140
  );
95
141
  });
96
142
 
143
+ test('atlas: separate root-file modules keep their names', () => {
144
+ const facts = {
145
+ files: [{ path: 'atlas.js', loc: 12 }, { path: 'overlay.js', loc: 16 }],
146
+ functions: [],
147
+ imports: [],
148
+ };
149
+ const graph = {
150
+ modules: [
151
+ { id: 'atlas', label: 'atlas.js', path: '', fanIn: 0, fanOut: 0 },
152
+ { id: 'overlay', label: 'overlay.js', path: '', fanIn: 0, fanOut: 0 },
153
+ ],
154
+ fileModules: { 'atlas.js': 'atlas', 'overlay.js': 'overlay' },
155
+ };
156
+ assert.deepEqual(buildAtlas({ facts, graph }).modules.map(module => module.label), ['atlas.js', 'overlay.js']);
157
+ });
158
+
97
159
  test('atlas: the overlay embeds the atlas before the Classic script only when raw facts are given', (t) => {
98
160
  const { facts, graph, findings } = analyze(t);
99
161
  const html = '<html><body><div class="toolbar"></div><svg><g data-node-id="app"></g></svg></body></html>';
@@ -139,3 +201,29 @@ test('atlas: an internal-imports finding draws its cited imports and marks its m
139
201
  assert.deepEqual(entry.entries.map((i) => paths[i]), [entryFile], 'entry files outside the atlas are dropped');
140
202
  assert.match(entry.title, /^Internal imports · /);
141
203
  });
204
+
205
+ test('atlas: same-named methods link each finding to its own declaration range', t => {
206
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-atlas-same-name-'));
207
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
208
+ const body = 'if(a) a++; '.repeat(20) + 'return a;';
209
+ fs.writeFileSync(path.join(dir, 'service.ts'), `export class Service {\n static dispatch(a,b,c,d,e,f,g,h,i,j) { ${body} }\n dispatch(a,b,c,d,e,f,g,h,i,j) { ${body} }\n}\n`);
210
+ const config = loadConfig();
211
+ const { facts } = extractFacts(dir, { language: 'ts', config });
212
+ const graph = buildGraph(facts, config);
213
+ const findings = evaluateGraph(graph, config, facts).diagnostics.filter(f => f.code === 'complexity/function');
214
+ const same = findings.filter(f => f.subject.function === 'Service.dispatch');
215
+ assert.equal(same.length, 2, JSON.stringify({functions:facts.functions.map(fn=>fn.qualname), findings:findings.map(f=>f.subject)}));
216
+ const atlas = buildAtlas({ graph, facts, findings });
217
+ for (const finding of same) {
218
+ const entry = atlas.findings.find(item => item.id === finding.id);
219
+ assert.notEqual(entry.fn, undefined, `missing function link for ${finding.id}`);
220
+ const fn = atlas.functions[entry.fn];
221
+ assert.equal(fn[2], finding.subject.line, `declaration line for ${finding.id}`);
222
+ assert.equal(atlas.findings[fn[6]].id, finding.id, 'function links back to its finding');
223
+ }
224
+ const ambiguousFacts = { ...facts, functions: facts.functions.map(fn => ({ ...fn, line: 2, endLine: 2 })) };
225
+ const ambiguousFindings = same.map(f => ({ ...f, subject: { ...f.subject, line: 2, endLine: 2 } }));
226
+ const ambiguous = buildAtlas({ graph, facts: ambiguousFacts, findings: ambiguousFindings });
227
+ assert.ok(ambiguous.findings.every(entry => entry.fn === undefined), 'indistinguishable declarations stay unlinked');
228
+ assert.ok(ambiguous.functions.every(fn => fn[6] === -1), 'ambiguous functions do not select a finding');
229
+ });
@@ -302,7 +302,7 @@ test('duplicates: service worker failure preserves the last successful analysis'
302
302
  assert.equal(failed.status, 500);
303
303
  assert.equal((await failed.json()).diagnostics[0].code, 'duplicates/tool-unavailable');
304
304
  for (const [name, bytes] of saved) assert.deepEqual(fs.readFileSync(path.join(analysis, name)), bytes, name);
305
- assert.equal(fs.readdirSync(out).some(name => name.startsWith('analysis.next-')), false);
305
+ assert.equal(fs.existsSync(path.join(out, '.archify-analysis.lock')), false, 'the failed run releases its staging directory');
306
306
  fs.writeFileSync(config, '{}');
307
307
  const retried = await fetch(view.url + '/analyze', { method: 'POST', headers });
308
308
  assert.equal(retried.status, 200, 'pending state clears after the worker failure');
@@ -343,7 +343,7 @@ test('external workflow: serve keeps the last complete analysis and tasks after
343
343
  assert.equal((await failed.json()).diagnostics[0].code, expected);
344
344
  assert.equal(fs.readFileSync(findingsFile, 'utf8'), saved);
345
345
  assert.equal(fs.readFileSync(path.join(out, 'analysis/repo.analysis.html'), 'utf8'), html);
346
- assert.equal(fs.readdirSync(out).some((name) => name.startsWith('analysis.next-')), false);
346
+ assert.equal(fs.existsSync(path.join(out, '.archify-analysis.lock')), false, 'the failed run releases its staging directory');
347
347
  const response = await fetch(`${view.url}/task`, { method: 'POST', headers, body: JSON.stringify({ ids: [ruff.id] }) });
348
348
  assert.equal(response.status, 200);
349
349
  assert.equal((await response.json()).task.findings[0].external.ruleId, 'F401');
@@ -26,6 +26,7 @@
26
26
  "adapter": "pyright-parser@1.1.414/python-3.14",
27
27
  "sourceKind": "working-tree",
28
28
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
29
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
29
30
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
30
31
  "analyzer": {
31
32
  "name": "@archify/code-analysis",
@@ -26,6 +26,7 @@
26
26
  "adapter": "pyright-parser@1.1.414/python-3.14",
27
27
  "sourceKind": "working-tree",
28
28
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
29
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
29
30
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
30
31
  "analyzer": {
31
32
  "name": "@archify/code-analysis",
@@ -28,6 +28,7 @@
28
28
  "adapter": "pyright-parser@1.1.414/python-3.14",
29
29
  "sourceKind": "working-tree",
30
30
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
31
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
31
32
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
32
33
  "analyzer": {
33
34
  "name": "@archify/code-analysis",
@@ -28,6 +28,7 @@
28
28
  "adapter": "pyright-parser@1.1.414/python-3.14",
29
29
  "sourceKind": "working-tree",
30
30
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
31
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
31
32
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
32
33
  "analyzer": {
33
34
  "name": "@archify/code-analysis",
@@ -25,6 +25,7 @@
25
25
  "adapter": "pyright-parser@1.1.414/python-3.14",
26
26
  "sourceKind": "working-tree",
27
27
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
28
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
28
29
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
29
30
  "analyzer": {
30
31
  "name": "@archify/code-analysis",
@@ -25,6 +25,7 @@
25
25
  "adapter": "pyright-parser@1.1.414/python-3.14",
26
26
  "sourceKind": "working-tree",
27
27
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
28
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
28
29
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
29
30
  "analyzer": {
30
31
  "name": "@archify/code-analysis",
@@ -28,6 +28,7 @@
28
28
  "adapter": "pyright-parser@1.1.414/python-3.14",
29
29
  "sourceKind": "working-tree",
30
30
  "snapshotId": "f1c9bfd491749465032c6b9299dd131d39314bfd3bf4c6874ec3f06bfa494ad2",
31
+ "analysisSha256": "6486ddc927ef963749e21d4826d52388331051ff0d30a4726f286e4503f0ca32",
31
32
  "configDigest": "599882652663586cb0e066002b72326f877ae1c90d9e48907e424e422a98f502",
32
33
  "analyzer": {
33
34
  "name": "@archify/code-analysis",
@@ -64,6 +64,16 @@ test('JS/TS ranges use UTF-16 columns and retain CRLF bytes in the decoded sourc
64
64
  });
65
65
  });
66
66
 
67
+ test('JS/TS property assignments retain their receiver in the qualified name', () => {
68
+ const file = 'bindings.ts';
69
+ const text = 'first.run = () => 1;\nsecond.run = () => 1;\n';
70
+ const records = measureFunctions(sourceFile(file, text), file);
71
+ assert.deepEqual(records.map(fn => [fn.name, fn.qualname]), [
72
+ ['run', 'first.run'], ['run', 'second.run'],
73
+ ]);
74
+ assert.equal(records[0].sourceRange.sha256, records[1].sourceRange.sha256);
75
+ });
76
+
67
77
  test('same names stay separate, bodiless overloads are omitted, and dynamic calls have no target', () => {
68
78
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-function-range-'));
69
79
  const text = [