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,293 @@
1
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
2
+ import { t } from '../lib/i18n.js';
3
+ import { resolveMustflowRoot } from '../lib/project-root.js';
4
+ import { explainAssetOptimization, explainCommandIntent } from '../../core/command-explanation.js';
5
+ import { readCommandContract, readMustflowConfigIfExists } from '../../core/config-loading.js';
6
+ import { explainManagedMarkdownAuthority, } from '../../core/authority-resolution.js';
7
+ import { explainRetentionPolicy } from '../../core/retention-explanation.js';
8
+ import { explainSkillRoute } from '../../core/skill-route-explanation.js';
9
+ import { explainSkillRouteAlignment, } from '../../core/skill-route-alignment.js';
10
+ import { explainPublicSurface } from '../../core/public-surface-explanation.js';
11
+ import { explainSourceAnchor } from '../../core/source-anchor-explanation.js';
12
+ import { checkMustflowProject } from '../lib/validation.js';
13
+ const EXPLAIN_SCHEMA_VERSION = '1';
14
+ export function getExplainHelp(lang = 'en') {
15
+ return renderHelp({
16
+ usage: 'mf explain <topic> [target] [options]',
17
+ summary: t(lang, 'explain.help.summary'),
18
+ options: [
19
+ { label: '--json', description: t(lang, 'cli.option.json') },
20
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
21
+ ],
22
+ examples: [
23
+ 'mf explain authority',
24
+ 'mf explain authority AGENTS.md',
25
+ 'mf explain anchor auth.session.resolve',
26
+ 'mf explain anchor auth.session.resolve --json',
27
+ 'mf explain asset-optimization',
28
+ 'mf explain asset-optimization --json',
29
+ 'mf explain command test',
30
+ 'mf explain command lint --json',
31
+ 'mf explain retention',
32
+ 'mf explain retention --json',
33
+ 'mf explain skill code-review',
34
+ 'mf explain skill mustflow.core.code-review --json',
35
+ 'mf explain skills',
36
+ 'mf explain skills --json',
37
+ 'mf explain surface README.md',
38
+ 'mf explain surface templates/default/manifest.toml --json',
39
+ 'mf explain authority .mustflow/skills/INDEX.md --json',
40
+ ],
41
+ exitCodes: [
42
+ { label: '0', description: t(lang, 'explain.help.exit.ok') },
43
+ { label: '1', description: t(lang, 'cli.common.invalidInput') },
44
+ ],
45
+ }, lang);
46
+ }
47
+ function getAuthorityExplainOutput(projectRoot, pathArg) {
48
+ return {
49
+ schema_version: EXPLAIN_SCHEMA_VERSION,
50
+ command: 'explain',
51
+ topic: 'authority',
52
+ mustflow_root: projectRoot,
53
+ decision: explainManagedMarkdownAuthority(pathArg),
54
+ };
55
+ }
56
+ function getAssetOptimizationExplainOutput(projectRoot) {
57
+ return {
58
+ schema_version: EXPLAIN_SCHEMA_VERSION,
59
+ command: 'explain',
60
+ topic: 'asset-optimization',
61
+ mustflow_root: projectRoot,
62
+ decision: explainAssetOptimization(readCommandContract(projectRoot)),
63
+ };
64
+ }
65
+ function getAnchorExplainOutput(projectRoot, anchorId) {
66
+ return {
67
+ schema_version: EXPLAIN_SCHEMA_VERSION,
68
+ command: 'explain',
69
+ topic: 'anchor',
70
+ mustflow_root: projectRoot,
71
+ decision: explainSourceAnchor(projectRoot, anchorId),
72
+ };
73
+ }
74
+ function getCommandExplainOutput(projectRoot, commandName) {
75
+ return {
76
+ schema_version: EXPLAIN_SCHEMA_VERSION,
77
+ command: 'explain',
78
+ topic: 'command',
79
+ mustflow_root: projectRoot,
80
+ decision: explainCommandIntent(readCommandContract(projectRoot), commandName),
81
+ };
82
+ }
83
+ function getRetentionExplainOutput(projectRoot) {
84
+ return {
85
+ schema_version: EXPLAIN_SCHEMA_VERSION,
86
+ command: 'explain',
87
+ topic: 'retention',
88
+ mustflow_root: projectRoot,
89
+ decision: explainRetentionPolicy(readMustflowConfigIfExists(projectRoot)),
90
+ };
91
+ }
92
+ function getSkillsExplainOutput(projectRoot) {
93
+ return {
94
+ schema_version: EXPLAIN_SCHEMA_VERSION,
95
+ command: 'explain',
96
+ topic: 'skills',
97
+ mustflow_root: projectRoot,
98
+ decision: explainSkillRouteAlignment(checkMustflowProject(projectRoot, { strict: true })),
99
+ };
100
+ }
101
+ function getSkillExplainOutput(projectRoot, skillName) {
102
+ return {
103
+ schema_version: EXPLAIN_SCHEMA_VERSION,
104
+ command: 'explain',
105
+ topic: 'skill',
106
+ mustflow_root: projectRoot,
107
+ decision: explainSkillRoute(projectRoot, skillName),
108
+ };
109
+ }
110
+ function getSurfaceExplainOutput(projectRoot, pathArg) {
111
+ return {
112
+ schema_version: EXPLAIN_SCHEMA_VERSION,
113
+ command: 'explain',
114
+ topic: 'surface',
115
+ mustflow_root: projectRoot,
116
+ decision: explainPublicSurface(pathArg),
117
+ };
118
+ }
119
+ function formatNullable(value, lang) {
120
+ if (value === null) {
121
+ return t(lang, 'value.none');
122
+ }
123
+ if (typeof value === 'boolean') {
124
+ return value ? t(lang, 'value.yes') : t(lang, 'value.no');
125
+ }
126
+ return String(value);
127
+ }
128
+ function renderExplainDecision(output, lang) {
129
+ const lines = [
130
+ t(lang, 'explain.title'),
131
+ `${t(lang, 'label.mustflowRoot')}: ${output.mustflow_root}`,
132
+ `${t(lang, 'explain.label.topic')}: ${output.topic}`,
133
+ `${t(lang, 'explain.label.decision')}: ${output.decision.decision}`,
134
+ `${t(lang, 'explain.label.reason')}: ${output.decision.reason}`,
135
+ `${t(lang, 'explain.label.effectiveAction')}: ${output.decision.effectiveAction}`,
136
+ `${t(lang, 'explain.label.countsAsMustflowVerification')}: ${output.decision.countsAsMustflowVerification ? t(lang, 'value.yes') : t(lang, 'value.no')}`,
137
+ '',
138
+ t(lang, 'explain.label.sourceFiles'),
139
+ ...output.decision.sourceFiles.map((sourceFile) => `- ${sourceFile}`),
140
+ ];
141
+ if ('expectation' in output.decision && output.decision.expectation) {
142
+ lines.push('', t(lang, 'explain.label.expectedFrontmatter'), `- mustflow_doc: ${output.decision.expectation.docId}`, `- authority: ${output.decision.expectation.authority}`, `- lifecycle: ${output.decision.expectation.lifecycle}`);
143
+ }
144
+ if ('boundary' in output.decision) {
145
+ lines.push('', t(lang, 'explain.label.authorityBoundary'), `- role: ${output.decision.boundary.role}`);
146
+ if (output.decision.boundary.canDefine.length > 0) {
147
+ lines.push(`- ${t(lang, 'explain.label.canDefine')}:`);
148
+ for (const item of output.decision.boundary.canDefine) {
149
+ lines.push(` - ${item}`);
150
+ }
151
+ }
152
+ if (output.decision.boundary.cannotDefine.length > 0) {
153
+ lines.push(`- ${t(lang, 'explain.label.cannotDefine')}:`);
154
+ for (const item of output.decision.boundary.cannotDefine) {
155
+ lines.push(` - ${item}`);
156
+ }
157
+ }
158
+ }
159
+ if ('intent' in output.decision && output.decision.intent) {
160
+ const intent = output.decision.intent;
161
+ lines.push('', t(lang, 'explain.label.commandIntent'), `- ${t(lang, 'explain.label.commandName')}: ${intent.name}`, `- status: ${intent.status ?? t(lang, 'value.none')}`, `- lifecycle: ${intent.lifecycle ?? t(lang, 'value.none')}`, `- run_policy: ${intent.runPolicy ?? t(lang, 'value.none')}`, `- stdin: ${intent.stdin ?? t(lang, 'value.none')}`, `- timeout_seconds: ${intent.timeoutSeconds ?? t(lang, 'value.none')}`, `- mode: ${intent.mode}`, `- cwd: ${intent.cwd ?? t(lang, 'value.none')}`, `- writes: ${intent.writes.join(', ') || t(lang, 'value.none')}`, `- network: ${formatNullable(intent.network, lang)}`, `- destructive: ${formatNullable(intent.destructive, lang)}`, `- success_exit_codes: ${intent.successExitCodes.join(', ') || t(lang, 'value.none')}`, `- required_after: ${intent.requiredAfter.join(', ') || t(lang, 'value.none')}`);
162
+ }
163
+ if ('retention' in output.decision) {
164
+ const retention = output.decision.retention;
165
+ lines.push('', t(lang, 'explain.label.retentionPolicy'), `- enabled: ${formatNullable(retention.enabled, lang)}`, `- raw_events.store: ${formatNullable(retention.rawEvents.store, lang)}`, `- raw_events.on_limit: ${formatNullable(retention.rawEvents.onLimit, lang)}`, `- run_receipts.store: ${retention.runReceipts.store}`, `- run_receipts.max_file_kb: ${retention.runReceipts.maxFileKb}`, `- run_receipts.max_items: ${retention.runReceipts.maxItems}`, `- run_receipts.keep_stdout_tail_bytes: ${retention.runReceipts.stdoutTailBytes}`, `- run_receipts.keep_stderr_tail_bytes: ${retention.runReceipts.stderrTailBytes}`, `- knowledge.enabled: ${formatNullable(retention.knowledge.enabled, lang)}`, `- context.max_file_kb: ${retention.context.maxFileKb}`, `- repo_map.max_file_kb: ${retention.repoMap.maxFileKb}`, `- repo_map.fail_if_larger: ${formatNullable(retention.repoMap.failIfLarger, lang)}`);
166
+ }
167
+ if ('alignment' in output.decision) {
168
+ const alignment = output.decision.alignment;
169
+ lines.push('', t(lang, 'explain.label.skillRoutes'), `- status: ${alignment.status}`, `- issue_count: ${alignment.issueCount}`, `- summary: ${alignment.summary}`, `- action: ${alignment.action ?? t(lang, 'value.none')}`);
170
+ if (alignment.issues.length > 0) {
171
+ lines.push(`- ${t(lang, 'doctor.section.issueList')}`);
172
+ for (const issue of alignment.issues) {
173
+ lines.push(` - ${issue}`);
174
+ }
175
+ }
176
+ }
177
+ if ('route' in output.decision) {
178
+ const route = output.decision.route;
179
+ lines.push('', t(lang, 'explain.label.skillRoute'));
180
+ if (!route) {
181
+ lines.push(`- ${t(lang, 'value.none')}`);
182
+ }
183
+ else {
184
+ lines.push(`- skill: ${route.skill}`, `- path: ${route.skillPath}`, `- trigger: ${route.trigger}`, `- required_input: ${route.requiredInput}`, `- edit_scope: ${route.editScope}`, `- risk: ${route.risk}`, `- verification_intents: ${route.verificationIntents.join(', ') || t(lang, 'value.none')}`, `- declared_command_intents: ${route.declaredCommandIntents.join(', ') || t(lang, 'value.none')}`, `- expected_output: ${route.expectedOutput}`);
185
+ }
186
+ }
187
+ if ('surface' in output.decision) {
188
+ const surface = output.decision.surface;
189
+ lines.push('', t(lang, 'explain.label.publicSurface'), `- kind: ${surface.kind}`, `- category: ${surface.category}`, `- is_public_surface: ${surface.isPublicSurface ? t(lang, 'value.yes') : t(lang, 'value.no')}`, `- ${t(lang, 'explain.label.validationReasons')}: ${surface.validationReasons.join(', ') || t(lang, 'value.none')}`, `- ${t(lang, 'explain.label.affectedContracts')}: ${surface.affectedContracts.join(', ') || t(lang, 'value.none')}`, `- ${t(lang, 'classify.label.updatePolicy')}: ${surface.updatePolicy}`, `- ${t(lang, 'classify.label.driftChecks')}: ${surface.driftChecks.join(', ') || t(lang, 'value.none')}`);
190
+ }
191
+ if ('anchor' in output.decision) {
192
+ const anchor = output.decision.anchor;
193
+ lines.push('', 'Source anchor');
194
+ if (!anchor) {
195
+ lines.push(`- ${t(lang, 'value.none')}`);
196
+ }
197
+ else {
198
+ lines.push(`- id: ${anchor.id}`, `- path: ${anchor.path}`, `- line_start: ${anchor.lineStart}`, `- purpose: ${anchor.purpose ?? t(lang, 'value.none')}`, `- search: ${anchor.search.join(', ') || t(lang, 'value.none')}`, `- invariant: ${anchor.invariant ?? t(lang, 'value.none')}`, `- risk: ${anchor.risk.join(', ') || t(lang, 'value.none')}`, `- navigation_only: ${anchor.navigationOnly ? t(lang, 'value.yes') : t(lang, 'value.no')}`, `- can_instruct_agent: ${anchor.canInstructAgent ? t(lang, 'value.yes') : t(lang, 'value.no')}`);
199
+ }
200
+ }
201
+ return lines.join('\n');
202
+ }
203
+ export function runExplain(args, reporter, lang = 'en') {
204
+ if (args.includes('--help') || args.includes('-h')) {
205
+ reporter.stdout(getExplainHelp(lang));
206
+ return 0;
207
+ }
208
+ const json = args.includes('--json');
209
+ const unsupported = args.filter((arg) => arg.startsWith('-') && arg !== '--json');
210
+ if (unsupported.length > 0) {
211
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf explain --help', getExplainHelp(lang), lang);
212
+ return 1;
213
+ }
214
+ const positional = args.filter((arg) => arg !== '--json');
215
+ const [topic, targetArg, ...rest] = positional;
216
+ if (topic !== 'asset-optimization' &&
217
+ topic !== 'anchor' &&
218
+ topic !== 'authority' &&
219
+ topic !== 'command' &&
220
+ topic !== 'retention' &&
221
+ topic !== 'skill' &&
222
+ topic !== 'skills' &&
223
+ topic !== 'surface') {
224
+ printUsageError(reporter, t(lang, topic ? 'explain.error.unknownTopic' : 'explain.error.missingTopic', { topic: topic ?? '' }), 'mf explain --help', getExplainHelp(lang), lang);
225
+ return 1;
226
+ }
227
+ if (topic === 'command' && !targetArg) {
228
+ printUsageError(reporter, t(lang, 'explain.error.missingCommand'), 'mf explain --help', getExplainHelp(lang), lang);
229
+ return 1;
230
+ }
231
+ if (topic === 'skill' && !targetArg) {
232
+ printUsageError(reporter, t(lang, 'explain.error.missingSkill'), 'mf explain --help', getExplainHelp(lang), lang);
233
+ return 1;
234
+ }
235
+ if (topic === 'anchor' && !targetArg) {
236
+ printUsageError(reporter, t(lang, 'explain.error.missingAnchor'), 'mf explain --help', getExplainHelp(lang), lang);
237
+ return 1;
238
+ }
239
+ if (topic === 'retention' && targetArg) {
240
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: targetArg }), 'mf explain --help', getExplainHelp(lang), lang);
241
+ return 1;
242
+ }
243
+ if (topic === 'asset-optimization' && targetArg) {
244
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: targetArg }), 'mf explain --help', getExplainHelp(lang), lang);
245
+ return 1;
246
+ }
247
+ if (topic === 'anchor' && rest.length > 0) {
248
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: rest[0] }), 'mf explain --help', getExplainHelp(lang), lang);
249
+ return 1;
250
+ }
251
+ if (topic === 'skills' && targetArg) {
252
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: targetArg }), 'mf explain --help', getExplainHelp(lang), lang);
253
+ return 1;
254
+ }
255
+ if (rest.length > 0) {
256
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: rest[0] }), 'mf explain --help', getExplainHelp(lang), lang);
257
+ return 1;
258
+ }
259
+ const projectRoot = resolveMustflowRoot();
260
+ let output;
261
+ switch (topic) {
262
+ case 'anchor':
263
+ output = getAnchorExplainOutput(projectRoot, targetArg);
264
+ break;
265
+ case 'asset-optimization':
266
+ output = getAssetOptimizationExplainOutput(projectRoot);
267
+ break;
268
+ case 'authority':
269
+ output = getAuthorityExplainOutput(projectRoot, targetArg);
270
+ break;
271
+ case 'command':
272
+ output = getCommandExplainOutput(projectRoot, targetArg);
273
+ break;
274
+ case 'retention':
275
+ output = getRetentionExplainOutput(projectRoot);
276
+ break;
277
+ case 'skill':
278
+ output = getSkillExplainOutput(projectRoot, targetArg);
279
+ break;
280
+ case 'surface':
281
+ output = getSurfaceExplainOutput(projectRoot, targetArg);
282
+ break;
283
+ case 'skills':
284
+ output = getSkillsExplainOutput(projectRoot);
285
+ break;
286
+ }
287
+ if (json) {
288
+ reporter.stdout(JSON.stringify(output, null, 2));
289
+ return 0;
290
+ }
291
+ reporter.stdout(renderExplainDecision(output, lang));
292
+ return 0;
293
+ }
@@ -0,0 +1,148 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { printUsageError, renderCliError, renderHelp } from '../lib/cli-output.js';
4
+ import { t } from '../lib/i18n.js';
5
+ import { resolveMustflowRoot } from '../lib/project-root.js';
6
+ import { readTomlFile } from '../lib/toml.js';
7
+ function isRecord(value) {
8
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
9
+ }
10
+ function readTextIfExists(projectRoot, relativePath) {
11
+ const filePath = path.join(projectRoot, ...relativePath.split('/'));
12
+ return existsSync(filePath) ? readFileSync(filePath, 'utf8') : undefined;
13
+ }
14
+ function readTomlIfExists(projectRoot, relativePath) {
15
+ const filePath = path.join(projectRoot, ...relativePath.split('/'));
16
+ if (!existsSync(filePath)) {
17
+ return undefined;
18
+ }
19
+ const parsed = readTomlFile(filePath);
20
+ return isRecord(parsed) ? parsed : undefined;
21
+ }
22
+ function renderMissing(relativePath, lang) {
23
+ return t(lang, 'help.missingFile', { path: relativePath });
24
+ }
25
+ function renderWorkflowHelp(projectRoot, lang) {
26
+ return readTextIfExists(projectRoot, '.mustflow/docs/agent-workflow.md') ?? renderMissing('.mustflow/docs/agent-workflow.md', lang);
27
+ }
28
+ function renderSkillsHelp(projectRoot, lang) {
29
+ return readTextIfExists(projectRoot, '.mustflow/skills/INDEX.md') ?? renderMissing('.mustflow/skills/INDEX.md', lang);
30
+ }
31
+ function renderCommandsHelp(projectRoot, lang) {
32
+ const commands = readTomlIfExists(projectRoot, '.mustflow/config/commands.toml');
33
+ if (!commands) {
34
+ return renderMissing('.mustflow/config/commands.toml', lang);
35
+ }
36
+ if (!isRecord(commands.intents)) {
37
+ return t(lang, 'help.commands.noIntents');
38
+ }
39
+ const lines = [t(lang, 'help.commands.title'), '', t(lang, 'help.commands.configuredIntents'), ''];
40
+ for (const [name, intent] of Object.entries(commands.intents).sort(([left], [right]) => left.localeCompare(right))) {
41
+ if (!isRecord(intent)) {
42
+ continue;
43
+ }
44
+ const status = typeof intent.status === 'string' ? intent.status : 'unknown';
45
+ const description = typeof intent.description === 'string' ? ` - ${intent.description}` : '';
46
+ lines.push(`- ${name}: ${status}${description}`);
47
+ }
48
+ return lines.join('\n');
49
+ }
50
+ function renderPreferencesHelp(projectRoot, lang) {
51
+ const preferences = readTomlIfExists(projectRoot, '.mustflow/config/preferences.toml');
52
+ if (!preferences) {
53
+ return `${t(lang, 'help.preferences.title')}\n\n${renderMissing('.mustflow/config/preferences.toml', lang)}`;
54
+ }
55
+ const lines = [t(lang, 'help.preferences.title'), '', t(lang, 'help.preferences.intro'), ''];
56
+ for (const [sectionName, section] of Object.entries(preferences)) {
57
+ if (!isRecord(section)) {
58
+ continue;
59
+ }
60
+ renderPreferenceSection(lines, sectionName, section);
61
+ }
62
+ return lines.join('\n').trimEnd();
63
+ }
64
+ function renderPreferenceSection(lines, sectionName, section) {
65
+ const nestedSections = [];
66
+ const scalarLines = [];
67
+ for (const [key, value] of Object.entries(section)) {
68
+ if (isRecord(value)) {
69
+ nestedSections.push([`${sectionName}.${key}`, value]);
70
+ continue;
71
+ }
72
+ if (Array.isArray(value)) {
73
+ scalarLines.push(`- ${key}: ${value.join(', ')}`);
74
+ continue;
75
+ }
76
+ if (typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number') {
77
+ scalarLines.push(`- ${key}: ${String(value)}`);
78
+ }
79
+ }
80
+ lines.push(`[${sectionName}]`, ...scalarLines, '');
81
+ for (const [nestedName, nestedSection] of nestedSections) {
82
+ renderPreferenceSection(lines, nestedName, nestedSection);
83
+ }
84
+ }
85
+ export function getHelpHelp(lang = 'en') {
86
+ return renderHelp({
87
+ usage: 'mf help [topic]',
88
+ summary: t(lang, 'help.help.summary'),
89
+ topics: [
90
+ {
91
+ label: 'workflow',
92
+ description: t(lang, 'help.topic.workflow'),
93
+ },
94
+ { label: 'skills', description: t(lang, 'help.topic.skills') },
95
+ {
96
+ label: 'commands',
97
+ description: t(lang, 'help.topic.commands'),
98
+ },
99
+ {
100
+ label: 'preferences',
101
+ description: t(lang, 'help.topic.preferences'),
102
+ },
103
+ ],
104
+ options: [{ label: '-h, --help', description: t(lang, 'cli.option.help') }],
105
+ examples: ['mf help workflow', 'mf help skills', 'mf help preferences'],
106
+ exitCodes: [
107
+ {
108
+ label: '0',
109
+ description: t(lang, 'help.help.exit.ok'),
110
+ },
111
+ {
112
+ label: '1',
113
+ description: t(lang, 'help.help.exit.fail'),
114
+ },
115
+ ],
116
+ }, lang);
117
+ }
118
+ export function runHelp(args, reporter, lang = 'en') {
119
+ const [topic, ...rest] = args;
120
+ if (!topic || topic === '--help' || topic === '-h') {
121
+ reporter.stdout(getHelpHelp(lang));
122
+ return 0;
123
+ }
124
+ if (rest.length > 0) {
125
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: rest[0] }), 'mf help --help', getHelpHelp(lang), lang);
126
+ return 1;
127
+ }
128
+ const projectRoot = resolveMustflowRoot();
129
+ if (topic === 'workflow') {
130
+ reporter.stdout(renderWorkflowHelp(projectRoot, lang));
131
+ return 0;
132
+ }
133
+ if (topic === 'skills') {
134
+ reporter.stdout(renderSkillsHelp(projectRoot, lang));
135
+ return 0;
136
+ }
137
+ if (topic === 'commands') {
138
+ reporter.stdout(renderCommandsHelp(projectRoot, lang));
139
+ return 0;
140
+ }
141
+ if (topic === 'preferences') {
142
+ reporter.stdout(renderPreferencesHelp(projectRoot, lang));
143
+ return 0;
144
+ }
145
+ reporter.stderr(renderCliError(t(lang, 'help.error.unknownTopic', { topic }), 'mf help --help', lang));
146
+ reporter.stdout(getHelpHelp(lang));
147
+ return 1;
148
+ }
@@ -0,0 +1,120 @@
1
+ import path from 'node:path';
2
+ import { createChangeClassificationReport } from '../../core/change-classification.js';
3
+ import { summarizeVersionImpact } from '../../core/version-impact.js';
4
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
5
+ import { isRecord } from '../lib/command-contract.js';
6
+ import { readGitChangedFiles } from '../lib/git-changes.js';
7
+ import { t } from '../lib/i18n.js';
8
+ import { resolveMustflowRoot } from '../lib/project-root.js';
9
+ import { readTomlFile } from '../lib/toml.js';
10
+ import { detectVersionSources, releaseVersioningIsEnabled, } from '../../core/version-sources.js';
11
+ const IMPACT_SCHEMA_VERSION = '1';
12
+ export function getImpactHelp(lang = 'en') {
13
+ return renderHelp({
14
+ usage: 'mf impact --changed [options] | mf impact <path...> [options]',
15
+ summary: t(lang, 'impact.help.summary'),
16
+ options: [
17
+ { label: '--changed', description: t(lang, 'impact.help.option.changed') },
18
+ { label: '--json', description: t(lang, 'cli.option.json') },
19
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
20
+ ],
21
+ examples: ['mf impact --changed', 'mf impact package.json schemas/impact-report.schema.json --json'],
22
+ exitCodes: [
23
+ { label: '0', description: t(lang, 'impact.help.exit.ok') },
24
+ { label: '1', description: t(lang, 'cli.common.invalidInput') },
25
+ ],
26
+ }, lang);
27
+ }
28
+ function parseImpactArgs(args) {
29
+ const paths = [];
30
+ let json = false;
31
+ let changed = false;
32
+ for (const arg of args) {
33
+ if (arg === '--json') {
34
+ json = true;
35
+ continue;
36
+ }
37
+ if (arg === '--changed') {
38
+ changed = true;
39
+ continue;
40
+ }
41
+ if (arg.startsWith('-')) {
42
+ return { json, changed, paths, error: arg };
43
+ }
44
+ paths.push(arg);
45
+ }
46
+ return { json, changed, paths };
47
+ }
48
+ function readPreferences(projectRoot) {
49
+ try {
50
+ const preferences = readTomlFile(path.join(projectRoot, '.mustflow', 'config', 'preferences.toml'));
51
+ return isRecord(preferences) ? preferences : undefined;
52
+ }
53
+ catch {
54
+ return undefined;
55
+ }
56
+ }
57
+ function createImpactOutput(projectRoot, parsed) {
58
+ const source = parsed.changed ? 'changed' : 'paths';
59
+ const files = parsed.changed ? readGitChangedFiles(projectRoot) : parsed.paths;
60
+ const classificationReport = createChangeClassificationReport(source, files);
61
+ const versionSources = detectVersionSources(projectRoot);
62
+ return {
63
+ schema_version: IMPACT_SCHEMA_VERSION,
64
+ command: 'impact',
65
+ mustflow_root: projectRoot,
66
+ source,
67
+ files: classificationReport.files,
68
+ versioning_enabled: releaseVersioningIsEnabled(readPreferences(projectRoot)),
69
+ version_sources: versionSources,
70
+ classification_summary: classificationReport.summary,
71
+ version_impact: summarizeVersionImpact(classificationReport, versionSources),
72
+ };
73
+ }
74
+ function renderList(values, lang) {
75
+ return values.length > 0 ? values.join(', ') : t(lang, 'value.none');
76
+ }
77
+ function renderImpactOutput(output, lang) {
78
+ const sourceLabel = output.source === 'changed' ? t(lang, 'classify.source.changed') : t(lang, 'classify.source.paths');
79
+ const lines = [
80
+ t(lang, 'impact.title'),
81
+ `${t(lang, 'label.mustflowRoot')}: ${output.mustflow_root}`,
82
+ `${t(lang, 'classify.label.source')}: ${sourceLabel}`,
83
+ `${t(lang, 'classify.label.files')}: ${output.files.length}`,
84
+ `${t(lang, 'impact.label.versioning')}: ${output.versioning_enabled ? t(lang, 'versionSources.value.enabled') : t(lang, 'versionSources.value.disabled')}`,
85
+ `${t(lang, 'impact.label.requiresVersionDecision')}: ${output.version_impact.requiresVersionDecision ? t(lang, 'value.yes') : t(lang, 'value.no')}`,
86
+ `${t(lang, 'impact.label.severity')}: ${output.version_impact.severity}`,
87
+ `${t(lang, 'impact.label.suggestedBump')}: ${output.version_impact.suggestedBump ?? t(lang, 'value.none')}`,
88
+ `${t(lang, 'impact.label.reasons')}: ${renderList(output.version_impact.reasons, lang)}`,
89
+ `${t(lang, 'impact.label.versionSources')}: ${renderList(output.version_sources.map((source) => source.path), lang)}`,
90
+ `${t(lang, 'impact.label.affectedVersionSources')}: ${renderList(output.version_impact.affectedVersionSources, lang)}`,
91
+ `${t(lang, 'impact.label.affectedSurfaces')}: ${renderList(output.version_impact.affectedSurfaces, lang)}`,
92
+ ];
93
+ return lines.join('\n');
94
+ }
95
+ export function runImpact(args, reporter, lang = 'en') {
96
+ if (args.includes('--help') || args.includes('-h')) {
97
+ reporter.stdout(getImpactHelp(lang));
98
+ return 0;
99
+ }
100
+ const parsed = parseImpactArgs(args);
101
+ if (parsed.error) {
102
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: parsed.error }), 'mf impact --help', getImpactHelp(lang), lang);
103
+ return 1;
104
+ }
105
+ if (parsed.changed && parsed.paths.length > 0) {
106
+ printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: parsed.paths[0] }), 'mf impact --help', getImpactHelp(lang), lang);
107
+ return 1;
108
+ }
109
+ if (!parsed.changed && parsed.paths.length === 0) {
110
+ printUsageError(reporter, t(lang, 'impact.error.missingInput'), 'mf impact --help', getImpactHelp(lang), lang);
111
+ return 1;
112
+ }
113
+ const output = createImpactOutput(resolveMustflowRoot(), parsed);
114
+ if (parsed.json) {
115
+ reporter.stdout(JSON.stringify(output, null, 2));
116
+ return 0;
117
+ }
118
+ reporter.stdout(renderImpactOutput(output, lang));
119
+ return 0;
120
+ }
@@ -0,0 +1,70 @@
1
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
2
+ import { t } from '../lib/i18n.js';
3
+ import { createLocalIndex } from '../lib/local-index.js';
4
+ import { resolveMustflowRoot } from '../lib/project-root.js';
5
+ export function getIndexHelp(lang = 'en') {
6
+ return renderHelp({
7
+ usage: 'mf index [options]',
8
+ summary: t(lang, 'index.help.summary'),
9
+ options: [
10
+ {
11
+ label: '--dry-run',
12
+ description: t(lang, 'index.help.option.dryRun'),
13
+ },
14
+ {
15
+ label: '--source',
16
+ description: t(lang, 'index.help.option.source'),
17
+ },
18
+ { label: '--json', description: t(lang, 'cli.option.json') },
19
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
20
+ ],
21
+ examples: ['mf index --dry-run --json', 'mf index', 'mf index --json'],
22
+ exitCodes: [
23
+ {
24
+ label: '0',
25
+ description: t(lang, 'index.help.exit.ok'),
26
+ },
27
+ { label: '1', description: t(lang, 'cli.common.invalidInput') },
28
+ ],
29
+ }, lang);
30
+ }
31
+ function renderIndexSummary(result, lang) {
32
+ const lines = [
33
+ t(lang, 'index.title'),
34
+ `${t(lang, 'label.mustflowRoot')}: ${result.mustflow_root}`,
35
+ `${t(lang, 'label.database')}: ${result.database_path}`,
36
+ `${t(lang, 'label.documents')}: ${result.document_count}`,
37
+ `${t(lang, 'label.skills')}: ${result.skill_count}`,
38
+ `skill_routes: ${result.skill_route_count}`,
39
+ `${t(lang, 'label.commandIntents')}: ${result.command_intent_count}`,
40
+ `command_effects: ${result.command_effect_count}`,
41
+ `source_anchors: ${result.source_anchor_count}`,
42
+ `${t(lang, 'label.wroteFiles')}: ${result.wrote_files ? 'yes' : 'no'}`,
43
+ ];
44
+ if (result.dry_run) {
45
+ lines.push(t(lang, 'index.dryRunNoFiles'));
46
+ }
47
+ return lines.join('\n');
48
+ }
49
+ export async function runIndex(args, reporter, lang = 'en') {
50
+ if (args.includes('--help') || args.includes('-h')) {
51
+ reporter.stdout(getIndexHelp(lang));
52
+ return 0;
53
+ }
54
+ const supported = new Set(['--dry-run', '--json', '--source']);
55
+ const unsupported = args.filter((arg) => !supported.has(arg));
56
+ if (unsupported.length > 0) {
57
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf index --help', getIndexHelp(lang), lang);
58
+ return 1;
59
+ }
60
+ const result = await createLocalIndex(resolveMustflowRoot(), {
61
+ dryRun: args.includes('--dry-run'),
62
+ includeSource: args.includes('--source'),
63
+ });
64
+ if (args.includes('--json')) {
65
+ reporter.stdout(JSON.stringify(result, null, 2));
66
+ return 0;
67
+ }
68
+ reporter.stdout(renderIndexSummary(result, lang));
69
+ return 0;
70
+ }