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,448 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { runRun } from './run.js';
4
+ import { createChangeVerificationReport, } from '../../core/change-verification.js';
5
+ import { createVerificationPlan } from '../../core/verification-plan.js';
6
+ import { readCommandContract } from '../../core/config-loading.js';
7
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
8
+ import { t } from '../lib/i18n.js';
9
+ import { resolveMustflowRoot } from '../lib/project-root.js';
10
+ const VERIFY_SCHEMA_VERSION = '1';
11
+ function createBufferedOutput() {
12
+ const stdout = [];
13
+ const stderr = [];
14
+ return {
15
+ reporter: {
16
+ stdout(message) {
17
+ stdout.push(`${message}\n`);
18
+ },
19
+ stderr(message) {
20
+ stderr.push(`${message}\n`);
21
+ },
22
+ },
23
+ stdout() {
24
+ return stdout.join('');
25
+ },
26
+ stderr() {
27
+ return stderr.join('');
28
+ },
29
+ };
30
+ }
31
+ export function getVerifyHelp(lang = 'en') {
32
+ return renderHelp({
33
+ usage: 'mf verify --reason <event> [options] | mf verify --from-plan <path> [options]',
34
+ summary: t(lang, 'verify.help.summary'),
35
+ options: [
36
+ { label: '--reason <event>', description: t(lang, 'verify.help.option.reason') },
37
+ { label: '--from-plan <path>', description: t(lang, 'verify.help.option.fromPlan') },
38
+ { label: '--plan-only', description: t(lang, 'verify.help.option.planOnly') },
39
+ { label: '--json', description: t(lang, 'cli.option.json') },
40
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
41
+ ],
42
+ examples: [
43
+ 'mf verify --reason code_change',
44
+ 'mf verify --reason docs_change --json',
45
+ 'mf verify --reason docs_change --plan-only --json',
46
+ 'mf verify --from-plan verify-plan.json --json',
47
+ 'mf verify --reason mustflow_docs_change',
48
+ ],
49
+ exitCodes: [
50
+ { label: '0', description: t(lang, 'verify.help.exit.ok') },
51
+ { label: '1', description: t(lang, 'verify.help.exit.fail') },
52
+ ],
53
+ }, lang);
54
+ }
55
+ function parseVerifyArgs(args) {
56
+ let reason;
57
+ let fromPlan;
58
+ let json = false;
59
+ let planOnly = false;
60
+ for (let index = 0; index < args.length; index += 1) {
61
+ const arg = args[index];
62
+ if (arg === '--json') {
63
+ json = true;
64
+ continue;
65
+ }
66
+ if (arg === '--plan-only') {
67
+ planOnly = true;
68
+ continue;
69
+ }
70
+ if (arg === '--reason') {
71
+ const value = args[index + 1];
72
+ if (!value || value.startsWith('-')) {
73
+ return { json, planOnly, reason, error: 'missing_reason_value' };
74
+ }
75
+ reason = value;
76
+ index += 1;
77
+ continue;
78
+ }
79
+ if (arg === '--from-plan') {
80
+ const value = args[index + 1];
81
+ if (!value || value.startsWith('-')) {
82
+ return { json, planOnly, reason, fromPlan, error: 'missing_from_plan_value' };
83
+ }
84
+ fromPlan = value;
85
+ index += 1;
86
+ continue;
87
+ }
88
+ if (arg.startsWith('--reason=')) {
89
+ const value = arg.slice('--reason='.length);
90
+ if (value.length === 0) {
91
+ return { json, planOnly, reason, error: 'missing_reason_value' };
92
+ }
93
+ reason = value;
94
+ continue;
95
+ }
96
+ if (arg.startsWith('--from-plan=')) {
97
+ const value = arg.slice('--from-plan='.length);
98
+ if (value.length === 0) {
99
+ return { json, planOnly, reason, fromPlan, error: 'missing_from_plan_value' };
100
+ }
101
+ fromPlan = value;
102
+ continue;
103
+ }
104
+ if (arg.startsWith('-')) {
105
+ return { json, planOnly, reason, error: arg };
106
+ }
107
+ return { json, planOnly, reason, error: `unexpected:${arg}` };
108
+ }
109
+ return { json, planOnly, reason, fromPlan };
110
+ }
111
+ function uniqueStrings(values) {
112
+ return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))];
113
+ }
114
+ function readStringArray(value) {
115
+ if (!Array.isArray(value)) {
116
+ return [];
117
+ }
118
+ return value.filter((item) => typeof item === 'string');
119
+ }
120
+ function readNumber(value) {
121
+ return Number.isInteger(value) && Number(value) >= 0 ? Number(value) : null;
122
+ }
123
+ function readUpdatePolicies(value) {
124
+ return readStringArray(value).filter((item) => item === 'update' || item === 'update_or_mark_stale' || item === 'not_applicable');
125
+ }
126
+ function readChangeSource(value) {
127
+ return value === 'changed' || value === 'paths' ? value : 'paths';
128
+ }
129
+ function emptyClassificationSummary(validationReasons) {
130
+ return {
131
+ fileCount: 0,
132
+ publicSurfaceCount: 0,
133
+ changeKinds: [],
134
+ validationReasons,
135
+ updatePolicies: [],
136
+ driftChecks: [],
137
+ affectedContracts: [],
138
+ };
139
+ }
140
+ function readClassificationSummary(value, fallbackReasons) {
141
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
142
+ return emptyClassificationSummary(fallbackReasons);
143
+ }
144
+ const record = value;
145
+ const validationReasons = uniqueStrings([...fallbackReasons, ...readStringArray(record.validationReasons)]);
146
+ return {
147
+ fileCount: readNumber(record.fileCount) ?? 0,
148
+ publicSurfaceCount: readNumber(record.publicSurfaceCount) ?? 0,
149
+ changeKinds: readStringArray(record.changeKinds),
150
+ validationReasons,
151
+ updatePolicies: readUpdatePolicies(record.updatePolicies),
152
+ driftChecks: readStringArray(record.driftChecks),
153
+ affectedContracts: readStringArray(record.affectedContracts),
154
+ };
155
+ }
156
+ function readClassifications(value) {
157
+ if (!Array.isArray(value)) {
158
+ return [];
159
+ }
160
+ return value.filter((item) => {
161
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
162
+ return false;
163
+ }
164
+ const record = item;
165
+ const surface = record.surface;
166
+ const surfaceRecord = surface;
167
+ return (typeof record.path === 'string' &&
168
+ Array.isArray(record.changeKinds) &&
169
+ readStringArray(record.changeKinds).length === record.changeKinds.length &&
170
+ surface !== null &&
171
+ typeof surface === 'object' &&
172
+ !Array.isArray(surface) &&
173
+ typeof surfaceRecord.kind === 'string' &&
174
+ typeof surfaceRecord.category === 'string' &&
175
+ typeof surfaceRecord.isPublicSurface === 'boolean' &&
176
+ Array.isArray(surfaceRecord.validationReasons) &&
177
+ readStringArray(surfaceRecord.validationReasons).length === surfaceRecord.validationReasons.length &&
178
+ Array.isArray(surfaceRecord.affectedContracts) &&
179
+ readStringArray(surfaceRecord.affectedContracts).length === surfaceRecord.affectedContracts.length &&
180
+ readUpdatePolicies([surfaceRecord.updatePolicy]).length === 1 &&
181
+ Array.isArray(surfaceRecord.driftChecks) &&
182
+ readStringArray(surfaceRecord.driftChecks).length === surfaceRecord.driftChecks.length);
183
+ });
184
+ }
185
+ function createSyntheticClassificationReport(reasons, source = 'paths', files = []) {
186
+ return {
187
+ source,
188
+ files,
189
+ classifications: [],
190
+ summary: emptyClassificationSummary(reasons),
191
+ };
192
+ }
193
+ function readClassificationReport(plan, fallbackReasons) {
194
+ if (!plan || typeof plan !== 'object' || Array.isArray(plan)) {
195
+ return createSyntheticClassificationReport(fallbackReasons);
196
+ }
197
+ const record = plan;
198
+ const summary = readClassificationSummary(record.classification_summary ?? record.summary, fallbackReasons);
199
+ const files = readStringArray(record.files);
200
+ const classifications = readClassifications(record.classifications);
201
+ return {
202
+ source: readChangeSource(record.source),
203
+ files,
204
+ classifications,
205
+ summary,
206
+ };
207
+ }
208
+ function readPlanReasons(plan) {
209
+ if (!plan || typeof plan !== 'object' || Array.isArray(plan)) {
210
+ return [];
211
+ }
212
+ const record = plan;
213
+ const summary = record.summary;
214
+ const classificationSummary = record.classification_summary;
215
+ const verification = record.verification;
216
+ const reasons = [
217
+ typeof record.reason === 'string' ? record.reason : '',
218
+ ...readStringArray(record.reasons),
219
+ ...readStringArray(record.validationReasons),
220
+ ...(summary && typeof summary === 'object' && !Array.isArray(summary)
221
+ ? readStringArray(summary.validationReasons)
222
+ : []),
223
+ ...(classificationSummary && typeof classificationSummary === 'object' && !Array.isArray(classificationSummary)
224
+ ? readStringArray(classificationSummary.validationReasons)
225
+ : []),
226
+ ...(verification && typeof verification === 'object' && !Array.isArray(verification)
227
+ ? readStringArray(verification.reasons)
228
+ : []),
229
+ ];
230
+ return uniqueStrings(reasons);
231
+ }
232
+ function resolvePlanPath(projectRoot, inputPath) {
233
+ const resolved = path.resolve(projectRoot, inputPath);
234
+ const relative = path.relative(projectRoot, resolved);
235
+ if (relative.startsWith('..') || path.isAbsolute(relative)) {
236
+ throw new Error('plan_path_outside_root');
237
+ }
238
+ return resolved;
239
+ }
240
+ function readInputFromPlan(projectRoot, inputPath) {
241
+ let parsed;
242
+ const planPath = resolvePlanPath(projectRoot, inputPath);
243
+ try {
244
+ parsed = JSON.parse(readFileSync(planPath, 'utf8'));
245
+ }
246
+ catch {
247
+ throw new Error('invalid_plan_file');
248
+ }
249
+ const reasons = readPlanReasons(parsed);
250
+ if (reasons.length === 0) {
251
+ throw new Error('missing_plan_reasons');
252
+ }
253
+ return {
254
+ reasons,
255
+ classificationReport: readClassificationReport(parsed, reasons),
256
+ };
257
+ }
258
+ function planErrorMessageKey(code) {
259
+ switch (code) {
260
+ case 'plan_path_outside_root':
261
+ return 'verify.error.plan_path_outside_root';
262
+ case 'missing_plan_reasons':
263
+ return 'verify.error.missing_plan_reasons';
264
+ default:
265
+ return 'verify.error.invalid_plan_file';
266
+ }
267
+ }
268
+ function skippedResult(candidate) {
269
+ return {
270
+ intent: candidate.intent || null,
271
+ status: 'skipped',
272
+ skipped: true,
273
+ reason: candidate.reason,
274
+ detail: candidate.detail,
275
+ exit_code: null,
276
+ receipt: null,
277
+ };
278
+ }
279
+ function runVerificationIntent(intent, lang) {
280
+ const output = createBufferedOutput();
281
+ const exitCode = runRun([intent, '--json'], output.reporter, lang);
282
+ const rawStdout = output.stdout().trim();
283
+ let receipt = null;
284
+ let status = exitCode === 0 ? 'passed' : 'failed';
285
+ try {
286
+ const parsed = JSON.parse(rawStdout);
287
+ receipt = parsed;
288
+ const receiptStatus = parsed.status;
289
+ if (receiptStatus === 'passed' ||
290
+ receiptStatus === 'failed' ||
291
+ receiptStatus === 'timed_out' ||
292
+ receiptStatus === 'start_failed') {
293
+ status = receiptStatus;
294
+ }
295
+ }
296
+ catch {
297
+ status = 'failed';
298
+ }
299
+ return {
300
+ intent,
301
+ status,
302
+ skipped: false,
303
+ reason: exitCode === 0 ? null : 'run_failed',
304
+ detail: output.stderr().trim() || null,
305
+ exit_code: exitCode,
306
+ receipt,
307
+ };
308
+ }
309
+ function summarizeResults(results) {
310
+ const ran = results.filter((result) => !result.skipped).length;
311
+ const passed = results.filter((result) => result.status === 'passed').length;
312
+ const skipped = results.filter((result) => result.skipped).length;
313
+ const failed = results.filter((result) => !result.skipped &&
314
+ (result.status === 'failed' || result.status === 'timed_out' || result.status === 'start_failed')).length;
315
+ return {
316
+ matched: results.filter((result) => result.intent !== null).length,
317
+ ran,
318
+ passed,
319
+ failed,
320
+ skipped,
321
+ };
322
+ }
323
+ function getVerificationStatus(summary) {
324
+ if (summary.failed > 0) {
325
+ return 'failed';
326
+ }
327
+ if (summary.ran === 0) {
328
+ return 'blocked';
329
+ }
330
+ if (summary.skipped > 0) {
331
+ return 'partial';
332
+ }
333
+ return 'passed';
334
+ }
335
+ function createVerifyOutput(reasons, planSource, projectRoot, lang) {
336
+ const contract = readCommandContract(projectRoot);
337
+ const candidatesByIntent = new Map();
338
+ const unmatchedCandidates = [];
339
+ for (const reason of reasons) {
340
+ const plan = createVerificationPlan(contract, reason);
341
+ for (const candidate of plan.candidates) {
342
+ if (!candidate.intent) {
343
+ unmatchedCandidates.push(candidate);
344
+ continue;
345
+ }
346
+ if (!candidatesByIntent.has(candidate.intent)) {
347
+ candidatesByIntent.set(candidate.intent, candidate);
348
+ }
349
+ }
350
+ }
351
+ const candidates = [...candidatesByIntent.values(), ...unmatchedCandidates].sort((left, right) => left.intent.localeCompare(right.intent));
352
+ const results = candidates.map((candidate) => candidate.status === 'runnable' ? runVerificationIntent(candidate.intent, lang) : skippedResult(candidate));
353
+ const summary = summarizeResults(results);
354
+ return {
355
+ schema_version: VERIFY_SCHEMA_VERSION,
356
+ command: 'verify',
357
+ mustflow_root: projectRoot,
358
+ reason: reasons.join(', '),
359
+ reasons,
360
+ plan_source: planSource,
361
+ status: getVerificationStatus(summary),
362
+ summary,
363
+ results,
364
+ };
365
+ }
366
+ function createPlanOnlyOutput(input, projectRoot) {
367
+ const contract = readCommandContract(projectRoot);
368
+ return createChangeVerificationReport(input.classificationReport, contract, projectRoot);
369
+ }
370
+ function renderVerifyOutput(output, lang) {
371
+ const lines = [
372
+ t(lang, 'verify.title'),
373
+ `${t(lang, 'label.mustflowRoot')}: ${output.mustflow_root}`,
374
+ `${t(lang, 'verify.label.reason')}: ${output.reason}`,
375
+ `${t(lang, 'verify.label.planSource')}: ${output.plan_source ?? t(lang, 'value.none')}`,
376
+ `${t(lang, 'verify.label.status')}: ${output.status}`,
377
+ `matched: ${output.summary.matched}`,
378
+ `ran: ${output.summary.ran}`,
379
+ `passed: ${output.summary.passed}`,
380
+ `failed: ${output.summary.failed}`,
381
+ `skipped: ${output.summary.skipped}`,
382
+ '',
383
+ t(lang, 'verify.label.results'),
384
+ ];
385
+ for (const result of output.results) {
386
+ const intent = result.intent ?? t(lang, 'value.none');
387
+ const reason = result.reason ? ` (${result.reason})` : '';
388
+ lines.push(`- ${intent}: ${result.status}${reason}`);
389
+ }
390
+ return lines.join('\n');
391
+ }
392
+ export function runVerify(args, reporter, lang = 'en') {
393
+ if (args.includes('--help') || args.includes('-h')) {
394
+ reporter.stdout(getVerifyHelp(lang));
395
+ return 0;
396
+ }
397
+ const parsed = parseVerifyArgs(args);
398
+ if (parsed.error) {
399
+ const message = parsed.error === 'missing_reason_value'
400
+ ? t(lang, 'cli.error.missingValue', { option: '--reason' })
401
+ : parsed.error === 'missing_from_plan_value'
402
+ ? t(lang, 'cli.error.missingValue', { option: '--from-plan' })
403
+ : parsed.error.startsWith('unexpected:')
404
+ ? t(lang, 'cli.error.unexpectedArgument', { argument: parsed.error.slice('unexpected:'.length) })
405
+ : t(lang, 'cli.error.unknownOption', { option: parsed.error });
406
+ printUsageError(reporter, message, 'mf verify --help', getVerifyHelp(lang), lang);
407
+ return 1;
408
+ }
409
+ if (parsed.reason && parsed.fromPlan) {
410
+ printUsageError(reporter, t(lang, 'verify.error.conflictingInputs'), 'mf verify --help', getVerifyHelp(lang), lang);
411
+ return 1;
412
+ }
413
+ if (!parsed.reason && !parsed.fromPlan) {
414
+ printUsageError(reporter, t(lang, 'verify.error.missingReason'), 'mf verify --help', getVerifyHelp(lang), lang);
415
+ return 1;
416
+ }
417
+ if (parsed.planOnly && !parsed.json) {
418
+ printUsageError(reporter, t(lang, 'verify.error.planOnlyJson'), 'mf verify --help', getVerifyHelp(lang), lang);
419
+ return 1;
420
+ }
421
+ const projectRoot = resolveMustflowRoot();
422
+ let input;
423
+ try {
424
+ input = parsed.fromPlan
425
+ ? readInputFromPlan(projectRoot, parsed.fromPlan)
426
+ : {
427
+ reasons: [parsed.reason],
428
+ classificationReport: createSyntheticClassificationReport([parsed.reason]),
429
+ };
430
+ }
431
+ catch (error) {
432
+ const code = error instanceof Error ? error.message : 'invalid_plan_file';
433
+ printUsageError(reporter, t(lang, planErrorMessageKey(code)), 'mf verify --help', getVerifyHelp(lang), lang);
434
+ return 1;
435
+ }
436
+ if (parsed.planOnly) {
437
+ reporter.stdout(JSON.stringify(createPlanOnlyOutput(input, projectRoot), null, 2));
438
+ return 0;
439
+ }
440
+ const output = createVerifyOutput(input.reasons, parsed.fromPlan ?? null, projectRoot, lang);
441
+ if (parsed.json) {
442
+ reporter.stdout(JSON.stringify(output, null, 2));
443
+ }
444
+ else {
445
+ reporter.stdout(renderVerifyOutput(output, lang));
446
+ }
447
+ return output.status === 'passed' ? 0 : 1;
448
+ }
@@ -0,0 +1,79 @@
1
+ import path from 'node:path';
2
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
3
+ import { isRecord } from '../lib/command-contract.js';
4
+ import { t } from '../lib/i18n.js';
5
+ import { resolveMustflowRoot } from '../lib/project-root.js';
6
+ import { readTomlFile } from '../lib/toml.js';
7
+ import { detectVersionSources, releaseVersioningIsEnabled, } from '../../core/version-sources.js';
8
+ const VERSION_SOURCES_SCHEMA_VERSION = '1';
9
+ export function getVersionSourcesHelp(lang = 'en') {
10
+ return renderHelp({
11
+ usage: 'mf version-sources [options]',
12
+ summary: t(lang, 'versionSources.help.summary'),
13
+ options: [
14
+ { label: '--json', description: t(lang, 'cli.option.json') },
15
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
16
+ ],
17
+ examples: ['mf version-sources', 'mf version-sources --json'],
18
+ exitCodes: [
19
+ { label: '0', description: t(lang, 'versionSources.help.exit.ok') },
20
+ { label: '1', description: t(lang, 'cli.common.invalidInput') },
21
+ ],
22
+ }, lang);
23
+ }
24
+ function readPreferences(projectRoot) {
25
+ try {
26
+ const preferences = readTomlFile(path.join(projectRoot, '.mustflow', 'config', 'preferences.toml'));
27
+ return isRecord(preferences) ? preferences : undefined;
28
+ }
29
+ catch {
30
+ return undefined;
31
+ }
32
+ }
33
+ function getVersionSourcesOutput(projectRoot) {
34
+ const preferences = readPreferences(projectRoot);
35
+ return {
36
+ schema_version: VERSION_SOURCES_SCHEMA_VERSION,
37
+ command: 'version-sources',
38
+ mustflow_root: projectRoot,
39
+ versioning_enabled: releaseVersioningIsEnabled(preferences),
40
+ sources: detectVersionSources(projectRoot),
41
+ };
42
+ }
43
+ function renderVersionSources(output, lang) {
44
+ const lines = [
45
+ t(lang, 'versionSources.title'),
46
+ `${t(lang, 'label.mustflowRoot')}: ${output.mustflow_root}`,
47
+ `${t(lang, 'versionSources.label.versioning')}: ${output.versioning_enabled ? t(lang, 'versionSources.value.enabled') : t(lang, 'versionSources.value.disabled')}`,
48
+ '',
49
+ t(lang, 'versionSources.label.sources'),
50
+ ];
51
+ if (output.sources.length === 0) {
52
+ lines.push(`- ${t(lang, 'versionSources.noSources')}`);
53
+ return lines.join('\n');
54
+ }
55
+ for (const source of output.sources) {
56
+ const metadata = [source.kind, source.declared ? 'declared' : undefined, source.authority].filter(Boolean).join(', ');
57
+ lines.push(`- ${source.path} (${metadata})`);
58
+ }
59
+ return lines.join('\n');
60
+ }
61
+ export function runVersionSources(args, reporter, lang = 'en') {
62
+ if (args.includes('--help') || args.includes('-h')) {
63
+ reporter.stdout(getVersionSourcesHelp(lang));
64
+ return 0;
65
+ }
66
+ const supported = new Set(['--json']);
67
+ const unsupported = args.filter((arg) => !supported.has(arg));
68
+ if (unsupported.length > 0) {
69
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf version-sources --help', getVersionSourcesHelp(lang), lang);
70
+ return 1;
71
+ }
72
+ const output = getVersionSourcesOutput(resolveMustflowRoot());
73
+ if (args.includes('--json')) {
74
+ reporter.stdout(JSON.stringify(output, null, 2));
75
+ return 0;
76
+ }
77
+ reporter.stdout(renderVersionSources(output, lang));
78
+ return 0;
79
+ }
@@ -0,0 +1,57 @@
1
+ import { printUsageError, renderCliError, renderHelp } from '../lib/cli-output.js';
2
+ import { t } from '../lib/i18n.js';
3
+ import { checkNpmLatestVersion } from '../lib/npm-version-check.js';
4
+ import { readPackageMetadata } from '../lib/package-info.js';
5
+ export function getVersionHelp(lang = 'en') {
6
+ return renderHelp({
7
+ usage: 'mf version [options]',
8
+ summary: t(lang, 'version.help.summary'),
9
+ options: [
10
+ { label: '--check', description: t(lang, 'version.help.option.check') },
11
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
12
+ ],
13
+ examples: ['mf version', 'mf version --check'],
14
+ exitCodes: [
15
+ { label: '0', description: t(lang, 'version.help.exit.ok') },
16
+ { label: '1', description: t(lang, 'cli.common.invalidInput') },
17
+ ],
18
+ }, lang);
19
+ }
20
+ function renderVersionCheck(check, lang) {
21
+ const lines = [
22
+ `${check.packageName} ${check.currentVersion}`,
23
+ check.updateAvailable
24
+ ? t(lang, 'version.check.latestAvailable', { version: check.latestVersion })
25
+ : t(lang, 'version.check.upToDate', { version: check.latestVersion }),
26
+ ];
27
+ if (check.updateAvailable) {
28
+ lines.push('', t(lang, 'version.check.updateCommand'), check.updateCommand);
29
+ }
30
+ return lines.join('\n');
31
+ }
32
+ export async function runVersion(args, reporter, lang = 'en') {
33
+ if (args.includes('--help') || args.includes('-h')) {
34
+ reporter.stdout(getVersionHelp(lang));
35
+ return 0;
36
+ }
37
+ const supported = new Set(['--check']);
38
+ const unsupported = args.filter((arg) => !supported.has(arg));
39
+ if (unsupported.length > 0) {
40
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf version --help', getVersionHelp(lang), lang);
41
+ return 1;
42
+ }
43
+ const metadata = readPackageMetadata();
44
+ if (!args.includes('--check')) {
45
+ reporter.stdout(metadata.version);
46
+ return 0;
47
+ }
48
+ try {
49
+ reporter.stdout(renderVersionCheck(await checkNpmLatestVersion(metadata), lang));
50
+ return 0;
51
+ }
52
+ catch (error) {
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ reporter.stderr(renderCliError(t(lang, 'version.error.checkFailed', { message }), 'mf version --help', lang));
55
+ return 1;
56
+ }
57
+ }