mustflow 1.15.97

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 (415) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +422 -0
  3. package/dist/cli/commands/check.js +73 -0
  4. package/dist/cli/commands/classify.js +104 -0
  5. package/dist/cli/commands/context.js +95 -0
  6. package/dist/cli/commands/contract-lint.js +74 -0
  7. package/dist/cli/commands/dashboard.js +654 -0
  8. package/dist/cli/commands/docs.js +382 -0
  9. package/dist/cli/commands/doctor.js +232 -0
  10. package/dist/cli/commands/explain.js +293 -0
  11. package/dist/cli/commands/help.js +148 -0
  12. package/dist/cli/commands/impact.js +120 -0
  13. package/dist/cli/commands/index.js +70 -0
  14. package/dist/cli/commands/init.js +986 -0
  15. package/dist/cli/commands/line-endings.js +102 -0
  16. package/dist/cli/commands/map.js +95 -0
  17. package/dist/cli/commands/run.js +442 -0
  18. package/dist/cli/commands/search.js +166 -0
  19. package/dist/cli/commands/status.js +65 -0
  20. package/dist/cli/commands/update.js +443 -0
  21. package/dist/cli/commands/verify.js +448 -0
  22. package/dist/cli/commands/version-sources.js +79 -0
  23. package/dist/cli/commands/version.js +57 -0
  24. package/dist/cli/i18n/en.js +702 -0
  25. package/dist/cli/i18n/es.js +702 -0
  26. package/dist/cli/i18n/fr.js +702 -0
  27. package/dist/cli/i18n/hi.js +702 -0
  28. package/dist/cli/i18n/ko.js +702 -0
  29. package/dist/cli/i18n/zh.js +702 -0
  30. package/dist/cli/index.js +218 -0
  31. package/dist/cli/lib/agent-context.js +342 -0
  32. package/dist/cli/lib/browser-open.js +58 -0
  33. package/dist/cli/lib/cli-output.js +36 -0
  34. package/dist/cli/lib/command-contract.js +1 -0
  35. package/dist/cli/lib/command-registry.js +107 -0
  36. package/dist/cli/lib/dashboard-html.js +1866 -0
  37. package/dist/cli/lib/dashboard-locale.js +309 -0
  38. package/dist/cli/lib/dashboard-preferences.js +405 -0
  39. package/dist/cli/lib/doc-review-ledger.js +226 -0
  40. package/dist/cli/lib/filesystem.js +125 -0
  41. package/dist/cli/lib/git-changes.js +13 -0
  42. package/dist/cli/lib/i18n.js +55 -0
  43. package/dist/cli/lib/local-index.js +1014 -0
  44. package/dist/cli/lib/locale-tags.js +4 -0
  45. package/dist/cli/lib/manifest-lock.js +131 -0
  46. package/dist/cli/lib/npm-version-check.js +97 -0
  47. package/dist/cli/lib/package-info.js +13 -0
  48. package/dist/cli/lib/preferences-options.js +8 -0
  49. package/dist/cli/lib/project-root.js +23 -0
  50. package/dist/cli/lib/repo-map.js +635 -0
  51. package/dist/cli/lib/reporter.js +8 -0
  52. package/dist/cli/lib/run-receipt.js +1 -0
  53. package/dist/cli/lib/template-i18n.js +265 -0
  54. package/dist/cli/lib/templates.js +188 -0
  55. package/dist/cli/lib/toml.js +1 -0
  56. package/dist/cli/lib/validation.js +1639 -0
  57. package/dist/cli/lib/version-sources.js +1 -0
  58. package/dist/core/authority-resolution.js +155 -0
  59. package/dist/core/change-classification.js +122 -0
  60. package/dist/core/change-verification.js +80 -0
  61. package/dist/core/check-issues.js +67 -0
  62. package/dist/core/command-classification.js +22 -0
  63. package/dist/core/command-contract-rules.js +27 -0
  64. package/dist/core/command-contract-validation.js +197 -0
  65. package/dist/core/command-cwd.js +12 -0
  66. package/dist/core/command-effects.js +182 -0
  67. package/dist/core/command-explanation.js +135 -0
  68. package/dist/core/command-intent-eligibility.js +76 -0
  69. package/dist/core/config-loading.js +54 -0
  70. package/dist/core/contract-lint.js +110 -0
  71. package/dist/core/contract-models.js +53 -0
  72. package/dist/core/dashboard-verification.js +132 -0
  73. package/dist/core/doc-review-triage.js +92 -0
  74. package/dist/core/line-endings.js +144 -0
  75. package/dist/core/public-json-contracts.js +112 -0
  76. package/dist/core/public-surface-explanation.js +49 -0
  77. package/dist/core/release-version-validation.js +53 -0
  78. package/dist/core/retention-explanation.js +74 -0
  79. package/dist/core/retention-policy.js +57 -0
  80. package/dist/core/run-receipt.js +77 -0
  81. package/dist/core/skill-route-alignment.js +100 -0
  82. package/dist/core/skill-route-explanation.js +117 -0
  83. package/dist/core/source-anchor-explanation.js +33 -0
  84. package/dist/core/source-anchor-status.js +269 -0
  85. package/dist/core/source-anchor-symbols.js +181 -0
  86. package/dist/core/source-anchor-validation.js +158 -0
  87. package/dist/core/source-anchors.js +194 -0
  88. package/dist/core/surface-decision-model.js +18 -0
  89. package/dist/core/toml.js +11 -0
  90. package/dist/core/verification-plan.js +41 -0
  91. package/dist/core/verification-scheduler.js +92 -0
  92. package/dist/core/version-impact.js +54 -0
  93. package/dist/core/version-sources.js +235 -0
  94. package/dist/core/version-sync-policy.js +85 -0
  95. package/examples/README.md +13 -0
  96. package/examples/docs-only/README.md +72 -0
  97. package/examples/host-instruction-conflicts/README.md +47 -0
  98. package/examples/minimal-js/README.md +98 -0
  99. package/examples/missing-command-contracts/README.md +70 -0
  100. package/examples/nested-repos/README.md +62 -0
  101. package/package.json +80 -0
  102. package/schemas/README.md +32 -0
  103. package/schemas/change-verification-report.schema.json +319 -0
  104. package/schemas/classify-report.schema.json +113 -0
  105. package/schemas/commands.schema.json +116 -0
  106. package/schemas/context-report.schema.json +341 -0
  107. package/schemas/contract-lint-report.schema.json +61 -0
  108. package/schemas/docs-review-list.schema.json +72 -0
  109. package/schemas/doctor-report.schema.json +175 -0
  110. package/schemas/explain-report.schema.json +471 -0
  111. package/schemas/impact-report.schema.json +121 -0
  112. package/schemas/line-endings-report.schema.json +63 -0
  113. package/schemas/run-receipt.schema.json +75 -0
  114. package/schemas/verify-report.schema.json +67 -0
  115. package/schemas/version-sources-report.schema.json +42 -0
  116. package/templates/default/common/.mustflow/config/commands.toml +251 -0
  117. package/templates/default/common/.mustflow/config/mustflow.toml +424 -0
  118. package/templates/default/common/.mustflow/config/preferences.toml +125 -0
  119. package/templates/default/common/gitignore.mustflow +9 -0
  120. package/templates/default/i18n.toml +483 -0
  121. package/templates/default/locales/en/.mustflow/context/INDEX.md +39 -0
  122. package/templates/default/locales/en/.mustflow/context/PROJECT.md +66 -0
  123. package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +345 -0
  124. package/templates/default/locales/en/.mustflow/skills/INDEX.md +78 -0
  125. package/templates/default/locales/en/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  126. package/templates/default/locales/en/.mustflow/skills/artifact-integrity-check/SKILL.md +121 -0
  127. package/templates/default/locales/en/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  128. package/templates/default/locales/en/.mustflow/skills/code-review/SKILL.md +115 -0
  129. package/templates/default/locales/en/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  130. package/templates/default/locales/en/.mustflow/skills/command-pattern/SKILL.md +247 -0
  131. package/templates/default/locales/en/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  132. package/templates/default/locales/en/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  133. package/templates/default/locales/en/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  134. package/templates/default/locales/en/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  135. package/templates/default/locales/en/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  136. package/templates/default/locales/en/.mustflow/skills/diff-risk-review/SKILL.md +143 -0
  137. package/templates/default/locales/en/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  138. package/templates/default/locales/en/.mustflow/skills/docs-update/SKILL.md +100 -0
  139. package/templates/default/locales/en/.mustflow/skills/external-prompt-injection-defense/SKILL.md +124 -0
  140. package/templates/default/locales/en/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  141. package/templates/default/locales/en/.mustflow/skills/failure-triage/SKILL.md +97 -0
  142. package/templates/default/locales/en/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  143. package/templates/default/locales/en/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  144. package/templates/default/locales/en/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  145. package/templates/default/locales/en/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
  146. package/templates/default/locales/en/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  147. package/templates/default/locales/en/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  148. package/templates/default/locales/en/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  149. package/templates/default/locales/en/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  150. package/templates/default/locales/en/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  151. package/templates/default/locales/en/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  152. package/templates/default/locales/en/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  153. package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  154. package/templates/default/locales/en/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  155. package/templates/default/locales/en/.mustflow/skills/result-option/SKILL.md +186 -0
  156. package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +130 -0
  157. package/templates/default/locales/en/.mustflow/skills/security-regression-tests/SKILL.md +157 -0
  158. package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  159. package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  160. package/templates/default/locales/en/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  161. package/templates/default/locales/en/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  162. package/templates/default/locales/en/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  163. package/templates/default/locales/en/.mustflow/skills/test-maintenance/SKILL.md +122 -0
  164. package/templates/default/locales/en/.mustflow/skills/ui-quality-gate/SKILL.md +119 -0
  165. package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  166. package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  167. package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  168. package/templates/default/locales/en/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  169. package/templates/default/locales/en/AGENTS.md +114 -0
  170. package/templates/default/locales/es/.mustflow/context/INDEX.md +39 -0
  171. package/templates/default/locales/es/.mustflow/context/PROJECT.md +63 -0
  172. package/templates/default/locales/es/.mustflow/docs/agent-workflow.md +365 -0
  173. package/templates/default/locales/es/.mustflow/skills/INDEX.md +78 -0
  174. package/templates/default/locales/es/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  175. package/templates/default/locales/es/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
  176. package/templates/default/locales/es/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  177. package/templates/default/locales/es/.mustflow/skills/code-review/SKILL.md +115 -0
  178. package/templates/default/locales/es/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  179. package/templates/default/locales/es/.mustflow/skills/command-pattern/SKILL.md +247 -0
  180. package/templates/default/locales/es/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  181. package/templates/default/locales/es/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  182. package/templates/default/locales/es/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  183. package/templates/default/locales/es/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  184. package/templates/default/locales/es/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  185. package/templates/default/locales/es/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
  186. package/templates/default/locales/es/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  187. package/templates/default/locales/es/.mustflow/skills/docs-update/SKILL.md +97 -0
  188. package/templates/default/locales/es/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
  189. package/templates/default/locales/es/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  190. package/templates/default/locales/es/.mustflow/skills/failure-triage/SKILL.md +97 -0
  191. package/templates/default/locales/es/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  192. package/templates/default/locales/es/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  193. package/templates/default/locales/es/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  194. package/templates/default/locales/es/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
  195. package/templates/default/locales/es/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  196. package/templates/default/locales/es/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  197. package/templates/default/locales/es/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  198. package/templates/default/locales/es/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  199. package/templates/default/locales/es/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  200. package/templates/default/locales/es/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  201. package/templates/default/locales/es/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  202. package/templates/default/locales/es/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  203. package/templates/default/locales/es/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  204. package/templates/default/locales/es/.mustflow/skills/result-option/SKILL.md +186 -0
  205. package/templates/default/locales/es/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
  206. package/templates/default/locales/es/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
  207. package/templates/default/locales/es/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  208. package/templates/default/locales/es/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  209. package/templates/default/locales/es/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  210. package/templates/default/locales/es/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  211. package/templates/default/locales/es/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  212. package/templates/default/locales/es/.mustflow/skills/test-maintenance/SKILL.md +122 -0
  213. package/templates/default/locales/es/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
  214. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  215. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  216. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  217. package/templates/default/locales/es/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  218. package/templates/default/locales/es/AGENTS.md +83 -0
  219. package/templates/default/locales/fr/.mustflow/context/INDEX.md +39 -0
  220. package/templates/default/locales/fr/.mustflow/context/PROJECT.md +63 -0
  221. package/templates/default/locales/fr/.mustflow/docs/agent-workflow.md +368 -0
  222. package/templates/default/locales/fr/.mustflow/skills/INDEX.md +78 -0
  223. package/templates/default/locales/fr/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  224. package/templates/default/locales/fr/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
  225. package/templates/default/locales/fr/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  226. package/templates/default/locales/fr/.mustflow/skills/code-review/SKILL.md +115 -0
  227. package/templates/default/locales/fr/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  228. package/templates/default/locales/fr/.mustflow/skills/command-pattern/SKILL.md +247 -0
  229. package/templates/default/locales/fr/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  230. package/templates/default/locales/fr/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  231. package/templates/default/locales/fr/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  232. package/templates/default/locales/fr/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  233. package/templates/default/locales/fr/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  234. package/templates/default/locales/fr/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
  235. package/templates/default/locales/fr/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  236. package/templates/default/locales/fr/.mustflow/skills/docs-update/SKILL.md +97 -0
  237. package/templates/default/locales/fr/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
  238. package/templates/default/locales/fr/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  239. package/templates/default/locales/fr/.mustflow/skills/failure-triage/SKILL.md +97 -0
  240. package/templates/default/locales/fr/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  241. package/templates/default/locales/fr/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  242. package/templates/default/locales/fr/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  243. package/templates/default/locales/fr/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
  244. package/templates/default/locales/fr/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  245. package/templates/default/locales/fr/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  246. package/templates/default/locales/fr/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  247. package/templates/default/locales/fr/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  248. package/templates/default/locales/fr/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  249. package/templates/default/locales/fr/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  250. package/templates/default/locales/fr/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  251. package/templates/default/locales/fr/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  252. package/templates/default/locales/fr/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  253. package/templates/default/locales/fr/.mustflow/skills/result-option/SKILL.md +186 -0
  254. package/templates/default/locales/fr/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
  255. package/templates/default/locales/fr/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
  256. package/templates/default/locales/fr/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  257. package/templates/default/locales/fr/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  258. package/templates/default/locales/fr/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  259. package/templates/default/locales/fr/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  260. package/templates/default/locales/fr/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  261. package/templates/default/locales/fr/.mustflow/skills/test-maintenance/SKILL.md +122 -0
  262. package/templates/default/locales/fr/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
  263. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  264. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  265. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  266. package/templates/default/locales/fr/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  267. package/templates/default/locales/fr/AGENTS.md +84 -0
  268. package/templates/default/locales/hi/.mustflow/context/INDEX.md +39 -0
  269. package/templates/default/locales/hi/.mustflow/context/PROJECT.md +65 -0
  270. package/templates/default/locales/hi/.mustflow/docs/agent-workflow.md +359 -0
  271. package/templates/default/locales/hi/.mustflow/skills/INDEX.md +78 -0
  272. package/templates/default/locales/hi/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  273. package/templates/default/locales/hi/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
  274. package/templates/default/locales/hi/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  275. package/templates/default/locales/hi/.mustflow/skills/code-review/SKILL.md +115 -0
  276. package/templates/default/locales/hi/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  277. package/templates/default/locales/hi/.mustflow/skills/command-pattern/SKILL.md +247 -0
  278. package/templates/default/locales/hi/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  279. package/templates/default/locales/hi/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  280. package/templates/default/locales/hi/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  281. package/templates/default/locales/hi/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  282. package/templates/default/locales/hi/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  283. package/templates/default/locales/hi/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
  284. package/templates/default/locales/hi/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  285. package/templates/default/locales/hi/.mustflow/skills/docs-update/SKILL.md +97 -0
  286. package/templates/default/locales/hi/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
  287. package/templates/default/locales/hi/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  288. package/templates/default/locales/hi/.mustflow/skills/failure-triage/SKILL.md +97 -0
  289. package/templates/default/locales/hi/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  290. package/templates/default/locales/hi/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  291. package/templates/default/locales/hi/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  292. package/templates/default/locales/hi/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
  293. package/templates/default/locales/hi/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  294. package/templates/default/locales/hi/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  295. package/templates/default/locales/hi/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  296. package/templates/default/locales/hi/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  297. package/templates/default/locales/hi/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  298. package/templates/default/locales/hi/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  299. package/templates/default/locales/hi/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  300. package/templates/default/locales/hi/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  301. package/templates/default/locales/hi/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  302. package/templates/default/locales/hi/.mustflow/skills/result-option/SKILL.md +186 -0
  303. package/templates/default/locales/hi/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
  304. package/templates/default/locales/hi/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
  305. package/templates/default/locales/hi/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  306. package/templates/default/locales/hi/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  307. package/templates/default/locales/hi/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  308. package/templates/default/locales/hi/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  309. package/templates/default/locales/hi/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  310. package/templates/default/locales/hi/.mustflow/skills/test-maintenance/SKILL.md +122 -0
  311. package/templates/default/locales/hi/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
  312. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  313. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  314. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  315. package/templates/default/locales/hi/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  316. package/templates/default/locales/hi/AGENTS.md +83 -0
  317. package/templates/default/locales/ko/.mustflow/context/INDEX.md +39 -0
  318. package/templates/default/locales/ko/.mustflow/context/PROJECT.md +66 -0
  319. package/templates/default/locales/ko/.mustflow/docs/agent-workflow.md +506 -0
  320. package/templates/default/locales/ko/.mustflow/skills/INDEX.md +78 -0
  321. package/templates/default/locales/ko/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  322. package/templates/default/locales/ko/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
  323. package/templates/default/locales/ko/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  324. package/templates/default/locales/ko/.mustflow/skills/code-review/SKILL.md +118 -0
  325. package/templates/default/locales/ko/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  326. package/templates/default/locales/ko/.mustflow/skills/command-pattern/SKILL.md +247 -0
  327. package/templates/default/locales/ko/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  328. package/templates/default/locales/ko/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  329. package/templates/default/locales/ko/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  330. package/templates/default/locales/ko/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  331. package/templates/default/locales/ko/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  332. package/templates/default/locales/ko/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
  333. package/templates/default/locales/ko/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  334. package/templates/default/locales/ko/.mustflow/skills/docs-update/SKILL.md +107 -0
  335. package/templates/default/locales/ko/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
  336. package/templates/default/locales/ko/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  337. package/templates/default/locales/ko/.mustflow/skills/failure-triage/SKILL.md +119 -0
  338. package/templates/default/locales/ko/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  339. package/templates/default/locales/ko/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  340. package/templates/default/locales/ko/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  341. package/templates/default/locales/ko/.mustflow/skills/multi-agent-work-coordination/SKILL.md +259 -0
  342. package/templates/default/locales/ko/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  343. package/templates/default/locales/ko/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  344. package/templates/default/locales/ko/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  345. package/templates/default/locales/ko/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  346. package/templates/default/locales/ko/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  347. package/templates/default/locales/ko/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  348. package/templates/default/locales/ko/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  349. package/templates/default/locales/ko/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  350. package/templates/default/locales/ko/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  351. package/templates/default/locales/ko/.mustflow/skills/result-option/SKILL.md +186 -0
  352. package/templates/default/locales/ko/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
  353. package/templates/default/locales/ko/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
  354. package/templates/default/locales/ko/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  355. package/templates/default/locales/ko/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  356. package/templates/default/locales/ko/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  357. package/templates/default/locales/ko/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  358. package/templates/default/locales/ko/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  359. package/templates/default/locales/ko/.mustflow/skills/test-maintenance/SKILL.md +130 -0
  360. package/templates/default/locales/ko/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
  361. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  362. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  363. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  364. package/templates/default/locales/ko/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  365. package/templates/default/locales/ko/AGENTS.md +85 -0
  366. package/templates/default/locales/zh/.mustflow/context/INDEX.md +39 -0
  367. package/templates/default/locales/zh/.mustflow/context/PROJECT.md +64 -0
  368. package/templates/default/locales/zh/.mustflow/docs/agent-workflow.md +310 -0
  369. package/templates/default/locales/zh/.mustflow/skills/INDEX.md +78 -0
  370. package/templates/default/locales/zh/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
  371. package/templates/default/locales/zh/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
  372. package/templates/default/locales/zh/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
  373. package/templates/default/locales/zh/.mustflow/skills/code-review/SKILL.md +115 -0
  374. package/templates/default/locales/zh/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
  375. package/templates/default/locales/zh/.mustflow/skills/command-pattern/SKILL.md +247 -0
  376. package/templates/default/locales/zh/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
  377. package/templates/default/locales/zh/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
  378. package/templates/default/locales/zh/.mustflow/skills/date-number-audit/SKILL.md +116 -0
  379. package/templates/default/locales/zh/.mustflow/skills/dependency-injection/SKILL.md +161 -0
  380. package/templates/default/locales/zh/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
  381. package/templates/default/locales/zh/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
  382. package/templates/default/locales/zh/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
  383. package/templates/default/locales/zh/.mustflow/skills/docs-update/SKILL.md +97 -0
  384. package/templates/default/locales/zh/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
  385. package/templates/default/locales/zh/.mustflow/skills/facade-pattern/SKILL.md +210 -0
  386. package/templates/default/locales/zh/.mustflow/skills/failure-triage/SKILL.md +96 -0
  387. package/templates/default/locales/zh/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
  388. package/templates/default/locales/zh/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
  389. package/templates/default/locales/zh/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
  390. package/templates/default/locales/zh/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
  391. package/templates/default/locales/zh/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
  392. package/templates/default/locales/zh/.mustflow/skills/pattern-scout/SKILL.md +110 -0
  393. package/templates/default/locales/zh/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
  394. package/templates/default/locales/zh/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
  395. package/templates/default/locales/zh/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
  396. package/templates/default/locales/zh/.mustflow/skills/readme-authoring/SKILL.md +115 -0
  397. package/templates/default/locales/zh/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
  398. package/templates/default/locales/zh/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
  399. package/templates/default/locales/zh/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
  400. package/templates/default/locales/zh/.mustflow/skills/result-option/SKILL.md +186 -0
  401. package/templates/default/locales/zh/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
  402. package/templates/default/locales/zh/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
  403. package/templates/default/locales/zh/.mustflow/skills/skill-authoring/SKILL.md +110 -0
  404. package/templates/default/locales/zh/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
  405. package/templates/default/locales/zh/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
  406. package/templates/default/locales/zh/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
  407. package/templates/default/locales/zh/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
  408. package/templates/default/locales/zh/.mustflow/skills/test-maintenance/SKILL.md +122 -0
  409. package/templates/default/locales/zh/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
  410. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
  411. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
  412. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
  413. package/templates/default/locales/zh/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
  414. package/templates/default/locales/zh/AGENTS.md +86 -0
  415. package/templates/default/manifest.toml +339 -0
@@ -0,0 +1,194 @@
1
+ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ export const SOURCE_ANCHOR_EXTENSIONS = new Set(['.cjs', '.go', '.js', '.jsx', '.mjs', '.py', '.rs', '.ts', '.tsx']);
4
+ export const SOURCE_ANCHOR_DEFAULT_EXCLUDED_PATH_PARTS = new Set([
5
+ '.git',
6
+ '.mustflow',
7
+ 'build',
8
+ 'coverage',
9
+ 'dist',
10
+ 'node_modules',
11
+ 'third_party',
12
+ 'vendor',
13
+ ]);
14
+ export const SOURCE_ANCHOR_GENERATED_PATH_PARTS = new Set([
15
+ '__generated__',
16
+ 'build',
17
+ 'dist',
18
+ 'generated',
19
+ 'third_party',
20
+ 'vendor',
21
+ ]);
22
+ export const SOURCE_ANCHOR_ALLOWED_FIELDS = new Set(['purpose', 'search', 'invariant', 'risk']);
23
+ export const SOURCE_ANCHOR_ALLOWED_RISKS = new Set([
24
+ 'authn',
25
+ 'authz',
26
+ 'authorization',
27
+ 'cache',
28
+ 'config',
29
+ 'data_consistency',
30
+ 'data_loss',
31
+ 'dependency',
32
+ 'external_request',
33
+ 'file_upload',
34
+ 'injection',
35
+ 'migration',
36
+ 'payment',
37
+ 'pii',
38
+ 'privacy',
39
+ 'retention',
40
+ 'secrets',
41
+ 'security',
42
+ 'ssrf',
43
+ 'state',
44
+ 'xss',
45
+ ]);
46
+ export const SOURCE_ANCHOR_ID_PATTERN = /^[a-z0-9][a-z0-9.-]{0,95}$/u;
47
+ function toPosixPath(value) {
48
+ return value.split(path.sep).join('/');
49
+ }
50
+ function listFilesRecursive(root, ignoredDirectoryNames, current = root) {
51
+ if (!existsSync(current)) {
52
+ return [];
53
+ }
54
+ const files = [];
55
+ for (const entry of readdirSync(current)) {
56
+ const entryPath = path.join(current, entry);
57
+ const stat = statSync(entryPath);
58
+ if (stat.isDirectory()) {
59
+ if (ignoredDirectoryNames.has(entry)) {
60
+ continue;
61
+ }
62
+ files.push(...listFilesRecursive(root, ignoredDirectoryNames, entryPath));
63
+ continue;
64
+ }
65
+ if (stat.isFile()) {
66
+ files.push(path.relative(root, entryPath));
67
+ }
68
+ }
69
+ return files.sort((left, right) => left.localeCompare(right));
70
+ }
71
+ export function listSourceAnchorFiles(root, options = {}) {
72
+ const ignoredDirectoryNames = options.ignoredDirectoryNames ?? SOURCE_ANCHOR_DEFAULT_EXCLUDED_PATH_PARTS;
73
+ return listFilesRecursive(root, ignoredDirectoryNames)
74
+ .map((relativePath) => toPosixPath(relativePath))
75
+ .filter((relativePath) => SOURCE_ANCHOR_EXTENSIONS.has(path.posix.extname(relativePath)));
76
+ }
77
+ export function stripSourceAnchorCommentPrefix(line) {
78
+ return line
79
+ .trim()
80
+ .replace(/^\/\*\*?/u, '')
81
+ .replace(/\*\/$/u, '')
82
+ .replace(/^\/\//u, '')
83
+ .replace(/^#/u, '')
84
+ .replace(/^\*/u, '')
85
+ .trim();
86
+ }
87
+ function readSourceAnchorField(line) {
88
+ const separator = line.indexOf(':');
89
+ if (separator === -1) {
90
+ return null;
91
+ }
92
+ const key = line.slice(0, separator).trim().toLowerCase();
93
+ const value = line.slice(separator + 1).trim();
94
+ if (key.length === 0 || value.length === 0) {
95
+ return null;
96
+ }
97
+ return { key, value };
98
+ }
99
+ export function splitSourceAnchorList(value) {
100
+ if (!value) {
101
+ return [];
102
+ }
103
+ return value
104
+ .split(/[,;]/u)
105
+ .map((item) => item.trim())
106
+ .filter((item) => item.length > 0);
107
+ }
108
+ export function sourceAnchorPathIsGeneratedOrVendor(relativePath) {
109
+ const normalized = toPosixPath(relativePath);
110
+ const parts = normalized.split('/');
111
+ if (normalized.endsWith('.min.js') || normalized.endsWith('.min.css')) {
112
+ return true;
113
+ }
114
+ return parts.some((part) => SOURCE_ANCHOR_GENERATED_PATH_PARTS.has(part));
115
+ }
116
+ export function parseSourceAnchorsInContent(relativePath, content) {
117
+ const lines = content.split(/\r?\n/);
118
+ const anchors = [];
119
+ for (let index = 0; index < lines.length; index += 1) {
120
+ const normalized = stripSourceAnchorCommentPrefix(lines[index] ?? '');
121
+ if (!normalized.startsWith('mf:anchor')) {
122
+ continue;
123
+ }
124
+ const anchorMatch = normalized.match(/^mf:anchor(?:\s+(.+))?$/u);
125
+ const rawId = anchorMatch?.[1]?.trim() ?? '';
126
+ const fields = new Map();
127
+ const unsupportedFields = [];
128
+ const rawLines = [normalized];
129
+ for (let fieldIndex = index + 1; fieldIndex < lines.length; fieldIndex += 1) {
130
+ const fieldLine = stripSourceAnchorCommentPrefix(lines[fieldIndex] ?? '');
131
+ if (fieldLine.length === 0) {
132
+ continue;
133
+ }
134
+ if (fieldLine.startsWith('@') || /^[A-Za-z_$][\w$]*\s/u.test(fieldLine)) {
135
+ break;
136
+ }
137
+ const field = readSourceAnchorField(fieldLine);
138
+ if (!field) {
139
+ break;
140
+ }
141
+ rawLines.push(fieldLine);
142
+ if (!SOURCE_ANCHOR_ALLOWED_FIELDS.has(field.key)) {
143
+ unsupportedFields.push(field.key);
144
+ continue;
145
+ }
146
+ fields.set(field.key, field.value);
147
+ }
148
+ anchors.push({
149
+ id: SOURCE_ANCHOR_ID_PATTERN.test(rawId) ? rawId : '',
150
+ rawId,
151
+ idValid: SOURCE_ANCHOR_ID_PATTERN.test(rawId),
152
+ path: relativePath,
153
+ lineStart: index + 1,
154
+ fields,
155
+ unsupportedFields,
156
+ rawText: rawLines.join('\n'),
157
+ });
158
+ }
159
+ return anchors;
160
+ }
161
+ /**
162
+ * mf:anchor core.source-anchors.collect
163
+ * purpose: Collect structured inline source anchors without treating source text as workflow authority.
164
+ * search: source anchor parser, navigation metadata, purpose search invariant risk
165
+ * invariant: Collected anchors always report navigationOnly true and canInstructAgent false.
166
+ * risk: config, security
167
+ */
168
+ export function collectSourceAnchorSummaries(projectRoot) {
169
+ const anchors = [];
170
+ for (const relativePath of listSourceAnchorFiles(projectRoot)) {
171
+ const filePath = path.join(projectRoot, ...relativePath.split('/'));
172
+ if (!existsSync(filePath) || !statSync(filePath).isFile()) {
173
+ continue;
174
+ }
175
+ const content = readFileSync(filePath, 'utf8');
176
+ for (const anchor of parseSourceAnchorsInContent(relativePath, content)) {
177
+ if (!anchor.idValid) {
178
+ continue;
179
+ }
180
+ anchors.push({
181
+ id: anchor.rawId,
182
+ path: relativePath,
183
+ lineStart: anchor.lineStart,
184
+ purpose: anchor.fields.get('purpose') ?? null,
185
+ search: splitSourceAnchorList(anchor.fields.get('search')),
186
+ invariant: anchor.fields.get('invariant') ?? null,
187
+ risk: splitSourceAnchorList(anchor.fields.get('risk')),
188
+ navigationOnly: true,
189
+ canInstructAgent: false,
190
+ });
191
+ }
192
+ }
193
+ return anchors.sort((left, right) => left.id.localeCompare(right.id) || left.path.localeCompare(right.path));
194
+ }
@@ -0,0 +1,18 @@
1
+ export const CHANGE_CLASSIFICATION_SURFACE_AUTHORITY = {
2
+ canInstructAgent: false,
3
+ canGrantCommandPermission: false,
4
+ canSelectVerification: true,
5
+ };
6
+ export const DOCUMENT_REVIEW_SURFACE_AUTHORITY = {
7
+ canInstructAgent: false,
8
+ canGrantCommandPermission: false,
9
+ canSelectVerification: false,
10
+ };
11
+ export const SOURCE_ANCHOR_SURFACE_AUTHORITY = {
12
+ canInstructAgent: false,
13
+ canGrantCommandPermission: false,
14
+ canSelectVerification: false,
15
+ };
16
+ export function createPathTarget(path, lineStart) {
17
+ return lineStart === undefined ? { kind: 'path', path } : { kind: 'path', path, lineStart };
18
+ }
@@ -0,0 +1,11 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { parse, stringify } from 'smol-toml';
3
+ export function parseTomlText(value) {
4
+ return parse(value);
5
+ }
6
+ export function readTomlFile(filePath) {
7
+ return parseTomlText(readFileSync(filePath, 'utf8'));
8
+ }
9
+ export function stringifyToml(value) {
10
+ return `${stringify(value).trimEnd()}\n`;
11
+ }
@@ -0,0 +1,41 @@
1
+ import { isRecord, readStringArray, } from './config-loading.js';
2
+ import { evaluateCommandIntentEligibility, } from './command-intent-eligibility.js';
3
+ function hasRequiredAfter(intent, reason) {
4
+ return (readStringArray(intent, 'required_after') ?? []).includes(reason);
5
+ }
6
+ export function classifyVerificationCandidate(intentName, rawIntent) {
7
+ const eligibility = evaluateCommandIntentEligibility(intentName, rawIntent);
8
+ if (!eligibility.ok) {
9
+ return {
10
+ intent: intentName,
11
+ status: 'skipped',
12
+ reason: eligibility.code,
13
+ detail: eligibility.detail,
14
+ };
15
+ }
16
+ return {
17
+ intent: intentName,
18
+ status: 'runnable',
19
+ reason: null,
20
+ detail: null,
21
+ };
22
+ }
23
+ export function createVerificationPlan(contract, reason) {
24
+ const candidates = Object.entries(contract.intents)
25
+ .filter(([, intent]) => isRecord(intent) && hasRequiredAfter(intent, reason))
26
+ .map(([intentName, intent]) => classifyVerificationCandidate(intentName, intent))
27
+ .sort((left, right) => left.intent.localeCompare(right.intent));
28
+ return {
29
+ reason,
30
+ candidates: candidates.length > 0
31
+ ? candidates
32
+ : [
33
+ {
34
+ intent: '',
35
+ status: 'skipped',
36
+ reason: 'no_matching_intents',
37
+ detail: `No command intents declare required_after = "${reason}".`,
38
+ },
39
+ ],
40
+ };
41
+ }
@@ -0,0 +1,92 @@
1
+ import { commandEffectsConflict, normalizeCommandEffects, } from './command-effects.js';
2
+ function uniqueSorted(values) {
3
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
4
+ }
5
+ function toScheduleEffect(effect) {
6
+ return {
7
+ intent: effect.intent,
8
+ source: effect.source,
9
+ access: effect.access,
10
+ mode: effect.mode,
11
+ path: effect.path,
12
+ lock: effect.lock,
13
+ concurrency: effect.concurrency,
14
+ };
15
+ }
16
+ function entriesConflict(left, right) {
17
+ const conflicts = [];
18
+ for (const leftEffect of left.effects) {
19
+ for (const rightEffect of right.effects) {
20
+ if (!commandEffectsConflict(leftEffect, rightEffect)) {
21
+ continue;
22
+ }
23
+ conflicts.push({
24
+ intent: left.intent,
25
+ conflictsWith: right.intent,
26
+ lock: leftEffect.lock,
27
+ detail: `${left.intent} and ${right.intent} both touch ${leftEffect.lock}; run them serially.`,
28
+ });
29
+ }
30
+ }
31
+ return conflicts;
32
+ }
33
+ function addEntryToBatches(batches, batchEntries, entry) {
34
+ for (let batchIndex = 0; batchIndex < batchEntries.length; batchIndex += 1) {
35
+ const existingEntries = batchEntries[batchIndex] ?? [];
36
+ const hasConflict = existingEntries.some((existing) => entriesConflict(entry, existing).length > 0);
37
+ if (hasConflict) {
38
+ continue;
39
+ }
40
+ existingEntries.push(entry);
41
+ batchEntries[batchIndex] = existingEntries;
42
+ batches[batchIndex] = {
43
+ index: batchIndex + 1,
44
+ intents: uniqueSorted(existingEntries.map((item) => item.intent)),
45
+ locks: uniqueSorted(existingEntries.flatMap((item) => item.locks)),
46
+ };
47
+ return;
48
+ }
49
+ const index = batches.length + 1;
50
+ batchEntries.push([entry]);
51
+ batches.push({
52
+ index,
53
+ intents: [entry.intent],
54
+ locks: entry.locks,
55
+ });
56
+ }
57
+ export function createVerificationSchedule(projectRoot, commandContract, candidates) {
58
+ const runnableIntents = uniqueSorted(candidates
59
+ .filter((candidate) => candidate.status === 'runnable' && candidate.intent.length > 0)
60
+ .map((candidate) => candidate.intent));
61
+ const baseEntries = runnableIntents.map((intent) => {
62
+ const effects = normalizeCommandEffects(projectRoot, commandContract, intent).map(toScheduleEffect);
63
+ return {
64
+ intent,
65
+ status: 'runnable',
66
+ effects,
67
+ locks: uniqueSorted(effects.map((effect) => effect.lock)),
68
+ conflicts: [],
69
+ };
70
+ });
71
+ const entries = baseEntries.map((entry) => ({
72
+ ...entry,
73
+ conflicts: baseEntries
74
+ .filter((other) => other.intent !== entry.intent)
75
+ .flatMap((other) => entriesConflict(entry, other))
76
+ .sort((left, right) => left.conflictsWith.localeCompare(right.conflictsWith) || left.lock.localeCompare(right.lock)),
77
+ }));
78
+ const batches = [];
79
+ const batchEntries = [];
80
+ for (const entry of entries) {
81
+ addEntryToBatches(batches, batchEntries, entry);
82
+ }
83
+ return {
84
+ runner: 'serial_mf_run_receipts',
85
+ batches,
86
+ entries,
87
+ notes: [
88
+ 'Batches explain resource compatibility for planning only.',
89
+ 'mf run still writes the latest receipt to a single path, so execute copied commands serially.',
90
+ ],
91
+ };
92
+ }
@@ -0,0 +1,54 @@
1
+ const METADATA_REASONS = new Set([
2
+ 'package_metadata_change',
3
+ 'template_version_change',
4
+ 'packaging_change',
5
+ ]);
6
+ const CONTRACT_REASONS = new Set([
7
+ 'public_api_change',
8
+ ]);
9
+ const RELEASE_SENSITIVE_REASONS = new Set([
10
+ ...METADATA_REASONS,
11
+ ...CONTRACT_REASONS,
12
+ 'release_risk',
13
+ ]);
14
+ function uniqueSorted(values) {
15
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
16
+ }
17
+ export function summarizeVersionImpact(classificationReport, versionSources) {
18
+ const changedFiles = new Set(classificationReport.files);
19
+ const affectedVersionSources = versionSources
20
+ .filter((source) => changedFiles.has(source.path))
21
+ .map((source) => source.path);
22
+ const validationReasons = new Set(classificationReport.summary.validationReasons);
23
+ const reasons = [];
24
+ const hasMetadataImpact = affectedVersionSources.length > 0 || [...validationReasons].some((reason) => METADATA_REASONS.has(reason));
25
+ const hasContractImpact = [...validationReasons].some((reason) => CONTRACT_REASONS.has(reason));
26
+ if (affectedVersionSources.length > 0) {
27
+ reasons.push('version_source_changed');
28
+ }
29
+ if (validationReasons.has('package_metadata_change')) {
30
+ reasons.push('package_metadata_changed');
31
+ }
32
+ if (validationReasons.has('template_version_change')) {
33
+ reasons.push('template_surface_changed');
34
+ }
35
+ if (validationReasons.has('public_api_change')) {
36
+ reasons.push('public_contract_changed');
37
+ }
38
+ if ([...validationReasons].some((reason) => RELEASE_SENSITIVE_REASONS.has(reason))) {
39
+ reasons.push('release_sensitive_surface_changed');
40
+ }
41
+ const affectedSurfaces = uniqueSorted(classificationReport.classifications
42
+ .filter((classification) => classification.surface.isPublicSurface)
43
+ .map((classification) => classification.surface.kind));
44
+ const severity = hasContractImpact ? 'contract' : hasMetadataImpact ? 'metadata' : 'none';
45
+ const requiresVersionDecision = reasons.length > 0;
46
+ return {
47
+ requiresVersionDecision,
48
+ severity,
49
+ suggestedBump: severity === 'contract' ? 'minor' : severity === 'metadata' ? 'patch' : null,
50
+ reasons: uniqueSorted(reasons),
51
+ affectedVersionSources: uniqueSorted(affectedVersionSources),
52
+ affectedSurfaces,
53
+ };
54
+ }
@@ -0,0 +1,235 @@
1
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { isRecord } from './config-loading.js';
4
+ import { readTomlFile } from './toml.js';
5
+ const RELEASE_VERSIONING_ACTIVE_FIELDS = [
6
+ 'impact_check',
7
+ 'suggest_bump',
8
+ 'auto_bump',
9
+ 'sync_template_version',
10
+ 'sync_docs_examples',
11
+ 'sync_tests',
12
+ ];
13
+ export const VERSIONING_CONFIG_PATH = '.mustflow/config/versioning.toml';
14
+ export const VERSION_SOURCE_KINDS = ['template_lock', 'template_manifest', 'package_manifest'];
15
+ export const VERSION_SOURCE_AUTHORITIES = ['source', 'derived'];
16
+ const VERSION_SOURCE_CANDIDATE_FILES = [
17
+ {
18
+ relativePath: '.mustflow/config/manifest.lock.toml',
19
+ kind: 'template_lock',
20
+ pattern: /^\s*version\s*=\s*["'][^"']+["']/mu,
21
+ },
22
+ {
23
+ relativePath: 'templates/default/manifest.toml',
24
+ kind: 'template_manifest',
25
+ pattern: /^\s*version\s*=\s*["'][^"']+["']/mu,
26
+ },
27
+ { relativePath: 'package.json', kind: 'package_manifest', mode: 'json' },
28
+ { relativePath: 'pyproject.toml', kind: 'package_manifest', pattern: /^\s*version\s*=\s*["'][^"']+["']/mu },
29
+ { relativePath: 'Cargo.toml', kind: 'package_manifest', pattern: /^\s*version\s*=\s*["'][^"']+["']/mu },
30
+ { relativePath: 'deno.json', kind: 'package_manifest', mode: 'json' },
31
+ { relativePath: 'deno.jsonc', kind: 'package_manifest', pattern: /"version"\s*:\s*"[^"]+"/u },
32
+ { relativePath: 'jsr.json', kind: 'package_manifest', mode: 'json' },
33
+ { relativePath: 'jsr.jsonc', kind: 'package_manifest', pattern: /"version"\s*:\s*"[^"]+"/u },
34
+ { relativePath: 'composer.json', kind: 'package_manifest', mode: 'json' },
35
+ { relativePath: 'pom.xml', kind: 'package_manifest', pattern: /<version>[^<]+<\/version>/u },
36
+ { relativePath: 'build.gradle', kind: 'package_manifest', pattern: /^\s*version\s*=/mu },
37
+ { relativePath: 'build.gradle.kts', kind: 'package_manifest', pattern: /^\s*version\s*=/mu },
38
+ { relativePath: 'pubspec.yaml', kind: 'package_manifest', pattern: /^\s*version\s*:\s*\S+/mu },
39
+ { relativePath: 'Chart.yaml', kind: 'package_manifest', pattern: /^\s*version\s*:\s*\S+/mu },
40
+ ];
41
+ const GO_RELEASE_TAG_PATTERN = /^v\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/u;
42
+ const VERSION_SOURCE_ROOT_FILE_PATTERNS = [
43
+ {
44
+ suffix: '.csproj',
45
+ kind: 'package_manifest',
46
+ pattern: /<(?:Version|PackageVersion)>[^<]+<\/(?:Version|PackageVersion)>/u,
47
+ },
48
+ {
49
+ suffix: '.fsproj',
50
+ kind: 'package_manifest',
51
+ pattern: /<(?:Version|PackageVersion)>[^<]+<\/(?:Version|PackageVersion)>/u,
52
+ },
53
+ {
54
+ suffix: '.vbproj',
55
+ kind: 'package_manifest',
56
+ pattern: /<(?:Version|PackageVersion)>[^<]+<\/(?:Version|PackageVersion)>/u,
57
+ },
58
+ { suffix: '.gemspec', kind: 'package_manifest', pattern: /\.version\s*=/u },
59
+ ];
60
+ function isSafeRelativePath(value) {
61
+ if (typeof value !== 'string' || value.trim().length === 0) {
62
+ return false;
63
+ }
64
+ const normalized = value.replace(/\\/g, '/');
65
+ const segments = normalized.split('/').filter(Boolean);
66
+ if (path.posix.isAbsolute(normalized) || path.win32.isAbsolute(value)) {
67
+ return false;
68
+ }
69
+ return segments.length > 0 && segments.every((segment) => segment !== '.' && segment !== '..');
70
+ }
71
+ function toPosixPath(value) {
72
+ return value.split(path.sep).join('/');
73
+ }
74
+ function isVersionSourceKind(value) {
75
+ return typeof value === 'string' && VERSION_SOURCE_KINDS.includes(value);
76
+ }
77
+ function isVersionSourceAuthority(value) {
78
+ return typeof value === 'string' && VERSION_SOURCE_AUTHORITIES.includes(value);
79
+ }
80
+ function hasJsonVersion(filePath) {
81
+ try {
82
+ const parsed = JSON.parse(readFileSync(filePath, 'utf8'));
83
+ return isRecord(parsed) && typeof parsed.version === 'string' && parsed.version.trim().length > 0;
84
+ }
85
+ catch {
86
+ return false;
87
+ }
88
+ }
89
+ function hasVersionPattern(filePath, pattern) {
90
+ try {
91
+ return pattern.test(readFileSync(filePath, 'utf8'));
92
+ }
93
+ catch {
94
+ return false;
95
+ }
96
+ }
97
+ function hasVersionSourceCandidate(projectRoot, candidate) {
98
+ const filePath = path.join(projectRoot, candidate.relativePath);
99
+ if (!existsSync(filePath)) {
100
+ return false;
101
+ }
102
+ if ('mode' in candidate && candidate.mode === 'json') {
103
+ return hasJsonVersion(filePath);
104
+ }
105
+ return 'pattern' in candidate && hasVersionPattern(filePath, candidate.pattern);
106
+ }
107
+ function resolveGitDirectory(projectRoot) {
108
+ const gitPath = path.join(projectRoot, '.git');
109
+ if (!existsSync(gitPath)) {
110
+ return undefined;
111
+ }
112
+ try {
113
+ if (statSync(gitPath).isDirectory()) {
114
+ return gitPath;
115
+ }
116
+ const match = /^gitdir:\s*(.+)$/imu.exec(readFileSync(gitPath, 'utf8'));
117
+ if (!match) {
118
+ return undefined;
119
+ }
120
+ const gitDirectory = match[1].trim();
121
+ return path.resolve(projectRoot, gitDirectory);
122
+ }
123
+ catch {
124
+ return undefined;
125
+ }
126
+ }
127
+ function hasSemverReleaseTag(projectRoot) {
128
+ const gitDirectory = resolveGitDirectory(projectRoot);
129
+ if (!gitDirectory) {
130
+ return false;
131
+ }
132
+ const tagRoot = path.join(gitDirectory, 'refs', 'tags');
133
+ try {
134
+ for (const entry of readdirSync(tagRoot, { withFileTypes: true })) {
135
+ if (entry.isFile() && GO_RELEASE_TAG_PATTERN.test(entry.name)) {
136
+ return true;
137
+ }
138
+ }
139
+ }
140
+ catch {
141
+ // Packed tags are checked below.
142
+ }
143
+ try {
144
+ const packedRefs = readFileSync(path.join(gitDirectory, 'packed-refs'), 'utf8');
145
+ return packedRefs
146
+ .split(/\r?\n/u)
147
+ .some((line) => GO_RELEASE_TAG_PATTERN.test(line.replace(/^.*\srefs\/tags\//u, '').trim()));
148
+ }
149
+ catch {
150
+ return false;
151
+ }
152
+ }
153
+ function hasGoModuleVersionSource(projectRoot) {
154
+ return existsSync(path.join(projectRoot, 'go.mod')) && hasSemverReleaseTag(projectRoot);
155
+ }
156
+ export function readDeclaredVersionSources(projectRoot) {
157
+ try {
158
+ const versioningConfig = readTomlFile(path.join(projectRoot, VERSIONING_CONFIG_PATH));
159
+ if (!isRecord(versioningConfig) || !Array.isArray(versioningConfig.sources)) {
160
+ return [];
161
+ }
162
+ return versioningConfig.sources.flatMap((source) => {
163
+ if (!isRecord(source) || !isSafeRelativePath(source.path) || !isVersionSourceKind(source.kind)) {
164
+ return [];
165
+ }
166
+ const versionSource = {
167
+ path: toPosixPath(source.path),
168
+ kind: source.kind,
169
+ declared: true,
170
+ };
171
+ return isVersionSourceAuthority(source.authority)
172
+ ? [{ ...versionSource, authority: source.authority }]
173
+ : [versionSource];
174
+ });
175
+ }
176
+ catch {
177
+ return [];
178
+ }
179
+ }
180
+ /**
181
+ * mf:anchor core.version.sources.detect
182
+ * purpose: Detect repository version sources before suggesting or applying version changes.
183
+ * search: version source, package metadata, template version, release tag, auto bump
184
+ * invariant: Declared version sources are preferred before fallback candidate detection.
185
+ * risk: config, data_consistency
186
+ */
187
+ export function detectVersionSources(projectRoot) {
188
+ const sources = readDeclaredVersionSources(projectRoot);
189
+ sources.push(...VERSION_SOURCE_CANDIDATE_FILES.filter((candidate) => hasVersionSourceCandidate(projectRoot, candidate)).map((candidate) => ({
190
+ path: toPosixPath(candidate.relativePath),
191
+ kind: candidate.kind,
192
+ })));
193
+ if (hasGoModuleVersionSource(projectRoot)) {
194
+ sources.push({ path: 'go.mod', kind: 'package_manifest' });
195
+ }
196
+ try {
197
+ for (const entry of readdirSync(projectRoot, { withFileTypes: true })) {
198
+ if (!entry.isFile()) {
199
+ continue;
200
+ }
201
+ const match = VERSION_SOURCE_ROOT_FILE_PATTERNS.find((candidate) => entry.name.endsWith(candidate.suffix));
202
+ if (match && hasVersionPattern(path.join(projectRoot, entry.name), match.pattern)) {
203
+ sources.push({ path: toPosixPath(entry.name), kind: match.kind });
204
+ }
205
+ }
206
+ }
207
+ catch {
208
+ return uniqueVersionSources(sources);
209
+ }
210
+ return uniqueVersionSources(sources);
211
+ }
212
+ function uniqueVersionSources(sources) {
213
+ const byKey = new Map();
214
+ for (const source of sources) {
215
+ const key = `${source.kind}:${source.path}`;
216
+ const existing = byKey.get(key);
217
+ if (!existing || source.declared === true) {
218
+ byKey.set(key, source);
219
+ }
220
+ }
221
+ return [...byKey.values()].sort((left, right) => left.path.localeCompare(right.path));
222
+ }
223
+ export function detectVersionSourcePaths(projectRoot) {
224
+ return detectVersionSources(projectRoot).map((source) => source.path);
225
+ }
226
+ export function releaseVersioningIsEnabled(preferencesToml) {
227
+ if (!preferencesToml || !isRecord(preferencesToml.release)) {
228
+ return false;
229
+ }
230
+ const { versioning } = preferencesToml.release;
231
+ if (!isRecord(versioning)) {
232
+ return false;
233
+ }
234
+ return RELEASE_VERSIONING_ACTIVE_FIELDS.some((field) => versioning[field] === true);
235
+ }