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,382 @@
1
+ import { unlinkSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { printUsageError, renderCliError, renderHelp } from '../lib/cli-output.js';
4
+ import { DOC_REVIEW_LEDGER_RELATIVE_PATH, DOC_REVIEW_STATUSES, REVIEWER_KINDS, addDocReviewEntry, commentDocReviewEntry, isReviewerKind, listDocReviewEntries, markDocReviewEntry, } from '../lib/doc-review-ledger.js';
5
+ import { ensureInside, readUtf8FileInsideWithoutSymlinks } from '../lib/filesystem.js';
6
+ import { t } from '../lib/i18n.js';
7
+ import { resolveMustflowRoot } from '../lib/project-root.js';
8
+ const LIST_FLAGS = new Set(['--json', '--all']);
9
+ const LIST_VALUE_OPTIONS = new Set(['--status']);
10
+ const ADD_VALUE_OPTIONS = new Set(['--reason', '--origin', '--actor-kind', '--actor-id', '--comment', '--comment-file']);
11
+ const COMMENT_VALUE_OPTIONS = new Set(['--comment', '--comment-file', '--actor-kind', '--actor-id']);
12
+ const REVIEW_VALUE_OPTIONS = new Set([
13
+ '--reviewer-kind',
14
+ '--reviewer-id',
15
+ '--reviewer-label',
16
+ '--reviewer-provider',
17
+ '--reviewer-model',
18
+ '--command-intent',
19
+ '--summary',
20
+ ]);
21
+ export function getDocsHelp(lang = 'en') {
22
+ return renderHelp({
23
+ usage: 'mf docs review <list|add|comment|approve|needs-human|ignore> [options]',
24
+ summary: t(lang, 'docs.help.summary'),
25
+ options: [
26
+ { label: '--json', description: t(lang, 'cli.option.json') },
27
+ { label: '--all', description: t(lang, 'docs.help.option.all') },
28
+ { label: '--status <status>', description: t(lang, 'docs.help.option.status') },
29
+ { label: '--reason <text>', description: t(lang, 'docs.help.option.reason') },
30
+ { label: '--origin <value>', description: t(lang, 'docs.help.option.origin') },
31
+ { label: '--actor-kind <kind>', description: t(lang, 'docs.help.option.actorKind') },
32
+ { label: '--actor-id <id>', description: t(lang, 'docs.help.option.actorId') },
33
+ { label: '--comment <text>', description: t(lang, 'docs.help.option.comment') },
34
+ { label: '--comment-file <path>', description: t(lang, 'docs.help.option.commentFile') },
35
+ { label: '--reviewer-kind <kind>', description: t(lang, 'docs.help.option.reviewerKind') },
36
+ { label: '--reviewer-id <id>', description: t(lang, 'docs.help.option.reviewerId') },
37
+ { label: '--summary <text>', description: t(lang, 'docs.help.option.summary') },
38
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
39
+ ],
40
+ examples: [
41
+ 'mf docs review list',
42
+ 'mf docs review add docs/guide.md --reason llm_modified --actor-kind llm --actor-id codex',
43
+ 'mf docs review comment docs/guide.md --comment-file review-note.md --actor-kind human --actor-id cherr',
44
+ 'mf docs review approve docs/guide.md --reviewer-kind llm --reviewer-id opencode --summary "Rewritten for natural tone."',
45
+ ],
46
+ exitCodes: [
47
+ { label: '0', description: t(lang, 'docs.help.exit.ok') },
48
+ { label: '1', description: t(lang, 'docs.help.exit.fail') },
49
+ ],
50
+ }, lang);
51
+ }
52
+ function parseOptions(args, valueOptions, flags) {
53
+ const values = new Map();
54
+ const parsedFlags = new Set();
55
+ const positionals = [];
56
+ for (let index = 0; index < args.length; index += 1) {
57
+ const arg = args[index];
58
+ if (flags.has(arg)) {
59
+ parsedFlags.add(arg);
60
+ continue;
61
+ }
62
+ const equalsIndex = arg.indexOf('=');
63
+ const optionName = equalsIndex > -1 ? arg.slice(0, equalsIndex) : arg;
64
+ if (valueOptions.has(optionName)) {
65
+ const inlineValue = equalsIndex > -1 ? arg.slice(equalsIndex + 1) : undefined;
66
+ const nextValue = inlineValue ?? args[index + 1];
67
+ if (!nextValue || (!inlineValue && nextValue.startsWith('-'))) {
68
+ return { values, flags: parsedFlags, positionals, error: { option: optionName, missingValue: true } };
69
+ }
70
+ values.set(optionName, nextValue);
71
+ if (inlineValue === undefined) {
72
+ index += 1;
73
+ }
74
+ continue;
75
+ }
76
+ if (arg.startsWith('-')) {
77
+ return { values, flags: parsedFlags, positionals, error: { option: arg } };
78
+ }
79
+ positionals.push(arg);
80
+ }
81
+ return { values, flags: parsedFlags, positionals };
82
+ }
83
+ function parseStatus(value) {
84
+ if (value === undefined) {
85
+ return undefined;
86
+ }
87
+ return DOC_REVIEW_STATUSES.includes(value) ? value : undefined;
88
+ }
89
+ function parseReviewerKind(value) {
90
+ if (value === undefined) {
91
+ return undefined;
92
+ }
93
+ return isReviewerKind(value) ? value : undefined;
94
+ }
95
+ function readCommentFile(projectRoot, commentFile) {
96
+ const commentFilePath = path.resolve(projectRoot, commentFile);
97
+ ensureInside(projectRoot, commentFilePath);
98
+ return {
99
+ comment: readUtf8FileInsideWithoutSymlinks(projectRoot, commentFilePath).trimEnd(),
100
+ absolutePath: commentFilePath,
101
+ };
102
+ }
103
+ function readReviewComment(projectRoot, parsed, lang) {
104
+ const inlineComment = parsed.values.get('--comment');
105
+ const commentFile = parsed.values.get('--comment-file');
106
+ if (inlineComment && commentFile) {
107
+ return { error: t(lang, 'docs.error.commentSourceConflict') };
108
+ }
109
+ if (!inlineComment && !commentFile) {
110
+ return {};
111
+ }
112
+ let comment;
113
+ let importedCommentFilePath;
114
+ try {
115
+ if (commentFile) {
116
+ const imported = readCommentFile(projectRoot, commentFile);
117
+ comment = imported.comment;
118
+ importedCommentFilePath = imported.absolutePath;
119
+ }
120
+ else {
121
+ comment = inlineComment;
122
+ }
123
+ }
124
+ catch (error) {
125
+ return { error: error instanceof Error ? error.message : String(error) };
126
+ }
127
+ if (!comment || comment.trim().length === 0) {
128
+ return { error: t(lang, 'docs.error.emptyComment') };
129
+ }
130
+ return { comment, importedCommentFilePath };
131
+ }
132
+ function ensureCommentFileIsNotDocument(projectRoot, documentPath, commentFilePath, lang) {
133
+ if (!commentFilePath) {
134
+ return undefined;
135
+ }
136
+ const documentAbsolutePath = path.resolve(projectRoot, documentPath);
137
+ ensureInside(projectRoot, documentAbsolutePath);
138
+ const normalizedDocumentPath = path.normalize(documentAbsolutePath);
139
+ const normalizedCommentFilePath = path.normalize(commentFilePath);
140
+ const isSamePath = process.platform === 'win32'
141
+ ? normalizedDocumentPath.toLowerCase() === normalizedCommentFilePath.toLowerCase()
142
+ : normalizedDocumentPath === normalizedCommentFilePath;
143
+ return isSamePath ? t(lang, 'docs.error.commentFileIsDocument') : undefined;
144
+ }
145
+ function removeImportedCommentFile(importedCommentFilePath) {
146
+ if (importedCommentFilePath) {
147
+ unlinkSync(importedCommentFilePath);
148
+ }
149
+ }
150
+ function renderEntries(entries, lang) {
151
+ const lines = [t(lang, 'docs.review.title'), `${t(lang, 'label.documents')}: ${entries.length}`];
152
+ if (entries.length === 0) {
153
+ lines.push(t(lang, 'docs.review.empty'));
154
+ return lines.join('\n');
155
+ }
156
+ for (const entry of entries) {
157
+ const blocking = entry.release_blocking ? ' release-blocking' : '';
158
+ lines.push(`- ${entry.path} [${entry.status} ${entry.review_priority}${blocking}] ${entry.reason}`);
159
+ if (entry.review_comment) {
160
+ const firstLine = entry.review_comment.split(/\r?\n/).find((line) => line.trim().length > 0);
161
+ lines.push(` ${t(lang, 'label.comment')}: ${firstLine ?? entry.review_comment}`);
162
+ }
163
+ }
164
+ return lines.join('\n');
165
+ }
166
+ function renderEntryAction(action, path, lang) {
167
+ return `${t(lang, 'docs.review.wrote')}: ${DOC_REVIEW_LEDGER_RELATIVE_PATH}\n${action}: ${path}`;
168
+ }
169
+ function getMarkedAction(status, lang) {
170
+ if (status === 'approved') {
171
+ return t(lang, 'docs.review.marked.approved');
172
+ }
173
+ if (status === 'needs_human') {
174
+ return t(lang, 'docs.review.marked.needs_human');
175
+ }
176
+ return t(lang, 'docs.review.marked.ignored');
177
+ }
178
+ function usageError(reporter, message, lang) {
179
+ printUsageError(reporter, message, 'mf docs --help', getDocsHelp(lang), lang);
180
+ return 1;
181
+ }
182
+ function runReviewList(args, reporter, lang) {
183
+ const parsed = parseOptions(args, LIST_VALUE_OPTIONS, LIST_FLAGS);
184
+ if (parsed.error) {
185
+ const message = parsed.error.missingValue
186
+ ? t(lang, 'cli.error.missingValue', { option: parsed.error.option })
187
+ : t(lang, 'cli.error.unknownOption', { option: parsed.error.option });
188
+ return usageError(reporter, message, lang);
189
+ }
190
+ if (parsed.positionals.length > 0) {
191
+ return usageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: parsed.positionals[0] }), lang);
192
+ }
193
+ const status = parseStatus(parsed.values.get('--status'));
194
+ if (parsed.values.has('--status') && !status) {
195
+ return usageError(reporter, t(lang, 'docs.error.invalidStatus', { statuses: DOC_REVIEW_STATUSES.join(', ') }), lang);
196
+ }
197
+ const entries = listDocReviewEntries(resolveMustflowRoot(), {
198
+ includeAll: parsed.flags.has('--all'),
199
+ status,
200
+ });
201
+ if (parsed.flags.has('--json')) {
202
+ reporter.stdout(JSON.stringify({
203
+ schema_version: '1',
204
+ command: 'docs review list',
205
+ ledger_path: DOC_REVIEW_LEDGER_RELATIVE_PATH,
206
+ count: entries.length,
207
+ documents: entries,
208
+ }, null, 2));
209
+ return 0;
210
+ }
211
+ reporter.stdout(renderEntries(entries, lang));
212
+ return 0;
213
+ }
214
+ /**
215
+ * mf:anchor cli.docs.review-add
216
+ * purpose: Add LLM-modified or generated documentation to the review queue with optional comments.
217
+ * search: docs review add, review ledger, actor kind, comment file, documentation queue
218
+ * invariant: Imported comment files are removed only after the review entry is recorded.
219
+ * risk: state, data_consistency
220
+ */
221
+ function runReviewAdd(args, reporter, lang) {
222
+ const parsed = parseOptions(args, ADD_VALUE_OPTIONS, new Set());
223
+ if (parsed.error) {
224
+ const message = parsed.error.missingValue
225
+ ? t(lang, 'cli.error.missingValue', { option: parsed.error.option })
226
+ : t(lang, 'cli.error.unknownOption', { option: parsed.error.option });
227
+ return usageError(reporter, message, lang);
228
+ }
229
+ const [documentPath, unexpected] = parsed.positionals;
230
+ if (!documentPath) {
231
+ return usageError(reporter, t(lang, 'docs.error.missingPath'), lang);
232
+ }
233
+ if (unexpected) {
234
+ return usageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: unexpected }), lang);
235
+ }
236
+ const actorKind = parseReviewerKind(parsed.values.get('--actor-kind'));
237
+ if (parsed.values.has('--actor-kind') && !actorKind) {
238
+ return usageError(reporter, t(lang, 'docs.error.invalidReviewerKind', { kinds: REVIEWER_KINDS.join(', ') }), lang);
239
+ }
240
+ const projectRoot = resolveMustflowRoot();
241
+ const commentResult = readReviewComment(projectRoot, parsed, lang);
242
+ if (commentResult.error) {
243
+ return usageError(reporter, commentResult.error, lang);
244
+ }
245
+ const commentFileError = ensureCommentFileIsNotDocument(projectRoot, documentPath, commentResult.importedCommentFilePath, lang);
246
+ if (commentFileError) {
247
+ return usageError(reporter, commentFileError, lang);
248
+ }
249
+ const entry = addDocReviewEntry(projectRoot, {
250
+ path: documentPath,
251
+ reason: parsed.values.get('--reason'),
252
+ origin: parsed.values.get('--origin'),
253
+ comment: commentResult.comment,
254
+ actorKind,
255
+ actorId: parsed.values.get('--actor-id'),
256
+ });
257
+ removeImportedCommentFile(commentResult.importedCommentFilePath);
258
+ reporter.stdout(renderEntryAction(t(lang, 'docs.review.added'), entry.path, lang));
259
+ return 0;
260
+ }
261
+ function runReviewComment(args, reporter, lang) {
262
+ const parsed = parseOptions(args, COMMENT_VALUE_OPTIONS, new Set());
263
+ if (parsed.error) {
264
+ const message = parsed.error.missingValue
265
+ ? t(lang, 'cli.error.missingValue', { option: parsed.error.option })
266
+ : t(lang, 'cli.error.unknownOption', { option: parsed.error.option });
267
+ return usageError(reporter, message, lang);
268
+ }
269
+ const [documentPath, unexpected] = parsed.positionals;
270
+ if (!documentPath) {
271
+ return usageError(reporter, t(lang, 'docs.error.missingPath'), lang);
272
+ }
273
+ if (unexpected) {
274
+ return usageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: unexpected }), lang);
275
+ }
276
+ const actorKind = parseReviewerKind(parsed.values.get('--actor-kind'));
277
+ if (parsed.values.has('--actor-kind') && !actorKind) {
278
+ return usageError(reporter, t(lang, 'docs.error.invalidReviewerKind', { kinds: REVIEWER_KINDS.join(', ') }), lang);
279
+ }
280
+ const projectRoot = resolveMustflowRoot();
281
+ const commentResult = readReviewComment(projectRoot, parsed, lang);
282
+ if (commentResult.error) {
283
+ return usageError(reporter, commentResult.error, lang);
284
+ }
285
+ const commentFileError = ensureCommentFileIsNotDocument(projectRoot, documentPath, commentResult.importedCommentFilePath, lang);
286
+ if (commentFileError) {
287
+ return usageError(reporter, commentFileError, lang);
288
+ }
289
+ if (!commentResult.comment) {
290
+ return usageError(reporter, t(lang, 'docs.error.missingComment'), lang);
291
+ }
292
+ try {
293
+ const entry = commentDocReviewEntry(projectRoot, {
294
+ path: documentPath,
295
+ comment: commentResult.comment,
296
+ actorKind,
297
+ actorId: parsed.values.get('--actor-id'),
298
+ });
299
+ removeImportedCommentFile(commentResult.importedCommentFilePath);
300
+ reporter.stdout(renderEntryAction(t(lang, 'docs.review.commented'), entry.path, lang));
301
+ return 0;
302
+ }
303
+ catch (error) {
304
+ const message = error instanceof Error ? error.message : String(error);
305
+ reporter.stderr(renderCliError(message, 'mf docs --help', lang));
306
+ return 1;
307
+ }
308
+ }
309
+ function runReviewMark(args, status, reporter, lang) {
310
+ const parsed = parseOptions(args, REVIEW_VALUE_OPTIONS, new Set());
311
+ if (parsed.error) {
312
+ const message = parsed.error.missingValue
313
+ ? t(lang, 'cli.error.missingValue', { option: parsed.error.option })
314
+ : t(lang, 'cli.error.unknownOption', { option: parsed.error.option });
315
+ return usageError(reporter, message, lang);
316
+ }
317
+ const [documentPath, unexpected] = parsed.positionals;
318
+ if (!documentPath) {
319
+ return usageError(reporter, t(lang, 'docs.error.missingPath'), lang);
320
+ }
321
+ if (unexpected) {
322
+ return usageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: unexpected }), lang);
323
+ }
324
+ const reviewerKind = parseReviewerKind(parsed.values.get('--reviewer-kind'));
325
+ if (!reviewerKind) {
326
+ const key = parsed.values.has('--reviewer-kind') ? 'docs.error.invalidReviewerKind' : 'docs.error.missingReviewerKind';
327
+ return usageError(reporter, t(lang, key, { kinds: REVIEWER_KINDS.join(', ') }), lang);
328
+ }
329
+ const reviewerId = parsed.values.get('--reviewer-id');
330
+ if (!reviewerId) {
331
+ return usageError(reporter, t(lang, 'docs.error.missingReviewerId'), lang);
332
+ }
333
+ try {
334
+ const entry = markDocReviewEntry(resolveMustflowRoot(), {
335
+ path: documentPath,
336
+ status,
337
+ reviewerKind,
338
+ reviewerId,
339
+ reviewerLabel: parsed.values.get('--reviewer-label'),
340
+ reviewerProvider: parsed.values.get('--reviewer-provider'),
341
+ reviewerModel: parsed.values.get('--reviewer-model'),
342
+ reviewerCommandIntent: parsed.values.get('--command-intent'),
343
+ summary: parsed.values.get('--summary'),
344
+ });
345
+ reporter.stdout(renderEntryAction(getMarkedAction(status, lang), entry.path, lang));
346
+ return 0;
347
+ }
348
+ catch (error) {
349
+ const message = error instanceof Error ? error.message : String(error);
350
+ reporter.stderr(renderCliError(message, 'mf docs --help', lang));
351
+ return 1;
352
+ }
353
+ }
354
+ export function runDocs(args, reporter, lang = 'en') {
355
+ if (args.includes('--help') || args.includes('-h')) {
356
+ reporter.stdout(getDocsHelp(lang));
357
+ return 0;
358
+ }
359
+ const [topic, action, ...rest] = args;
360
+ if (topic !== 'review') {
361
+ return usageError(reporter, topic ? t(lang, 'docs.error.unknownTopic', { topic }) : t(lang, 'docs.error.missingTopic'), lang);
362
+ }
363
+ if (!action || action === 'list') {
364
+ return runReviewList(rest, reporter, lang);
365
+ }
366
+ if (action === 'add' || action === 'record') {
367
+ return runReviewAdd(rest, reporter, lang);
368
+ }
369
+ if (action === 'comment') {
370
+ return runReviewComment(rest, reporter, lang);
371
+ }
372
+ if (action === 'approve' || action === 'mark-approved') {
373
+ return runReviewMark(rest, 'approved', reporter, lang);
374
+ }
375
+ if (action === 'needs-human' || action === 'mark-needs-human') {
376
+ return runReviewMark(rest, 'needs_human', reporter, lang);
377
+ }
378
+ if (action === 'ignore' || action === 'mark-ignored') {
379
+ return runReviewMark(rest, 'ignored', reporter, lang);
380
+ }
381
+ return usageError(reporter, t(lang, 'docs.error.unknownAction', { action }), lang);
382
+ }
@@ -0,0 +1,232 @@
1
+ import { existsSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { printUsageError, renderHelp } from '../lib/cli-output.js';
4
+ import { getAgentContext, } from '../lib/agent-context.js';
5
+ import { t } from '../lib/i18n.js';
6
+ import { getLocalIndexDatabasePath } from '../lib/local-index.js';
7
+ import { resolveMustflowRoot } from '../lib/project-root.js';
8
+ import { checkMustflowProject } from '../lib/validation.js';
9
+ import { summarizeSkillRouteAlignment } from '../../core/skill-route-alignment.js';
10
+ const DOCTOR_SCHEMA_VERSION = '1';
11
+ export function getDoctorHelp(lang = 'en') {
12
+ return renderHelp({
13
+ usage: 'mf doctor [options]',
14
+ summary: t(lang, 'doctor.help.summary'),
15
+ options: [
16
+ {
17
+ label: '--json',
18
+ description: t(lang, 'doctor.help.option.json'),
19
+ },
20
+ {
21
+ label: '--strict',
22
+ description: t(lang, 'doctor.help.option.strict'),
23
+ },
24
+ { label: '-h, --help', description: t(lang, 'cli.option.help') },
25
+ ],
26
+ examples: ['mf doctor', 'mf doctor --json', 'mf doctor --strict --json'],
27
+ exitCodes: [
28
+ {
29
+ label: '0',
30
+ description: t(lang, 'doctor.help.exit.ok'),
31
+ },
32
+ {
33
+ label: '1',
34
+ description: t(lang, 'doctor.help.exit.fail'),
35
+ },
36
+ ],
37
+ }, lang);
38
+ }
39
+ function pluralize(count, singular, plural) {
40
+ return count === 1 ? singular : plural;
41
+ }
42
+ function createDiagnostics(output) {
43
+ const diagnostics = [];
44
+ const checkCommand = output.strict ? 'mf check --strict' : 'mf check';
45
+ const repoMapExists = existsSync(path.join(output.mustflow_root, 'REPO_MAP.md'));
46
+ const localIndexExists = existsSync(getLocalIndexDatabasePath(output.mustflow_root));
47
+ const runnableIntentCount = output.context.runnable_intents.length;
48
+ const skillRouteAlignment = summarizeSkillRouteAlignment(output.check.issues);
49
+ diagnostics.push({
50
+ id: 'install',
51
+ status: output.installed ? 'ok' : 'fail',
52
+ summary: output.installed ? 'installed' : 'not installed',
53
+ action: output.installed ? null : 'mf init --dry-run',
54
+ });
55
+ diagnostics.push({
56
+ id: 'validation',
57
+ status: output.check.ok ? 'ok' : 'fail',
58
+ summary: `${output.check.issue_count} ${pluralize(output.check.issue_count, 'issue', 'issues')}`,
59
+ action: output.check.ok ? null : checkCommand,
60
+ });
61
+ diagnostics.push({
62
+ id: 'skill_routes',
63
+ status: output.strict ? skillRouteAlignment.status : 'info',
64
+ summary: output.strict ? skillRouteAlignment.summary : 'not evaluated; run strict doctor',
65
+ action: output.strict ? skillRouteAlignment.action : 'mf doctor --strict --json',
66
+ });
67
+ diagnostics.push({
68
+ id: 'commands',
69
+ status: output.context.command_contract_exists ? (runnableIntentCount > 0 ? 'ok' : 'warn') : 'fail',
70
+ summary: output.context.command_contract_exists
71
+ ? `present, ${runnableIntentCount} runnable ${pluralize(runnableIntentCount, 'intent', 'intents')}`
72
+ : 'missing',
73
+ action: output.context.command_contract_exists ? 'mf help commands' : 'mf init --dry-run',
74
+ });
75
+ diagnostics.push({
76
+ id: 'read_order',
77
+ status: output.context.missing_read_order.length === 0 ? 'ok' : 'fail',
78
+ summary: output.context.missing_read_order.length === 0
79
+ ? 'all required files present'
80
+ : `${output.context.missing_read_order.length} missing required ${pluralize(output.context.missing_read_order.length, 'path', 'paths')}`,
81
+ action: output.context.missing_read_order.length === 0 ? 'mf context --json' : checkCommand,
82
+ });
83
+ if (output.context.missing_optional_read_order.length > 0) {
84
+ diagnostics.push({
85
+ id: 'optional_read_order',
86
+ status: 'info',
87
+ summary: `${output.context.missing_optional_read_order.length} missing optional ${pluralize(output.context.missing_optional_read_order.length, 'path', 'paths')}`,
88
+ action: 'mf context --json',
89
+ });
90
+ }
91
+ diagnostics.push({
92
+ id: 'repo_map',
93
+ status: repoMapExists ? 'ok' : 'info',
94
+ summary: repoMapExists ? 'present' : 'not generated',
95
+ action: repoMapExists ? 'mf map --stdout' : 'mf map --write',
96
+ });
97
+ diagnostics.push({
98
+ id: 'local_index',
99
+ status: localIndexExists ? 'ok' : 'info',
100
+ summary: localIndexExists ? 'present' : 'not generated',
101
+ action: localIndexExists ? 'mf search <query>' : 'mf index',
102
+ });
103
+ diagnostics.push({
104
+ id: 'latest_run',
105
+ status: output.context.latest_run_exists ? 'ok' : 'info',
106
+ summary: output.context.latest_run_exists ? 'run receipt present' : 'no run receipt yet',
107
+ action: output.context.latest_run_exists ? null : 'mf run <intent>',
108
+ });
109
+ return diagnostics;
110
+ }
111
+ function getNextSteps(output) {
112
+ if (!output.installed) {
113
+ return ['mf init --dry-run', 'mf init --yes'];
114
+ }
115
+ if (!output.check.ok) {
116
+ const checkCommand = output.strict ? 'mf check --strict' : 'mf check';
117
+ return [checkCommand, 'mf status --json', 'mf update --dry-run'];
118
+ }
119
+ const nextSteps = ['mf help workflow', 'mf help commands', 'mf context --json', 'mf check --strict'];
120
+ for (const diagnostic of output.diagnostics) {
121
+ if (diagnostic.action && diagnostic.status !== 'ok' && !nextSteps.includes(diagnostic.action)) {
122
+ nextSteps.push(diagnostic.action);
123
+ }
124
+ }
125
+ return nextSteps;
126
+ }
127
+ function createDoctorOutput(strict) {
128
+ const mustflowRoot = resolveMustflowRoot();
129
+ const context = getAgentContext(mustflowRoot);
130
+ const issues = checkMustflowProject(mustflowRoot, { strict });
131
+ const check = {
132
+ ok: issues.length === 0,
133
+ issue_count: issues.length,
134
+ issues,
135
+ };
136
+ const baseOutput = {
137
+ schema_version: DOCTOR_SCHEMA_VERSION,
138
+ command: 'doctor',
139
+ mustflow_root: mustflowRoot,
140
+ installed: context.installed,
141
+ strict,
142
+ ok: context.installed && check.ok,
143
+ check,
144
+ context: {
145
+ manifest_lock: context.manifest_lock,
146
+ template: context.template,
147
+ command_contract_exists: context.command_contract.exists,
148
+ runnable_intents: context.command_contract.runnable_intents,
149
+ missing_read_order: context.read_order.filter((entry) => !entry.exists).map((entry) => entry.path),
150
+ missing_optional_read_order: context.optional_read_order.filter((entry) => !entry.exists).map((entry) => entry.path),
151
+ latest_run_exists: context.latest_run.exists,
152
+ },
153
+ effective_policy: context.effective_policy,
154
+ state_policy: context.state_policy,
155
+ blocked_actions: context.blocked_actions,
156
+ };
157
+ const diagnostics = createDiagnostics(baseOutput);
158
+ return {
159
+ ...baseOutput,
160
+ diagnostics,
161
+ next_steps: getNextSteps({ ...baseOutput, diagnostics }),
162
+ };
163
+ }
164
+ function getDiagnosticLabel(id, lang) {
165
+ switch (id) {
166
+ case 'install':
167
+ return t(lang, 'doctor.diagnostic.install');
168
+ case 'validation':
169
+ return t(lang, 'doctor.diagnostic.validation');
170
+ case 'skill_routes':
171
+ return t(lang, 'doctor.diagnostic.skillRoutes');
172
+ case 'commands':
173
+ return t(lang, 'doctor.diagnostic.commands');
174
+ case 'read_order':
175
+ return t(lang, 'doctor.diagnostic.readOrder');
176
+ case 'optional_read_order':
177
+ return t(lang, 'doctor.diagnostic.optionalReadOrder');
178
+ case 'repo_map':
179
+ return t(lang, 'doctor.diagnostic.repoMap');
180
+ case 'local_index':
181
+ return t(lang, 'doctor.diagnostic.localIndex');
182
+ case 'latest_run':
183
+ return t(lang, 'doctor.diagnostic.latestRun');
184
+ }
185
+ }
186
+ function renderDoctorOutput(output, lang) {
187
+ const lines = [];
188
+ lines.push(t(lang, 'doctor.title'));
189
+ lines.push(`${t(lang, 'label.mustflowRoot')}: ${output.mustflow_root}`);
190
+ lines.push(`${t(lang, 'label.installed')}: ${output.installed ? 'yes' : 'no'}`);
191
+ lines.push(`${t(lang, 'doctor.label.strict')}: ${output.strict ? 'yes' : 'no'}`);
192
+ lines.push(`${t(lang, 'doctor.label.check')}: ${output.check.ok ? 'passed' : 'failed'}`);
193
+ lines.push(`${t(lang, 'doctor.label.issues')}: ${output.check.issue_count}`);
194
+ lines.push(`${t(lang, 'label.commandContract')}: ${output.context.command_contract_exists ? 'present' : 'missing'}`);
195
+ lines.push(`${t(lang, 'label.runnableIntents')}: ${output.context.runnable_intents.length}`);
196
+ lines.push('', t(lang, 'doctor.section.health'));
197
+ for (const diagnostic of output.diagnostics) {
198
+ const action = diagnostic.action && diagnostic.status !== 'ok' ? ` (${t(lang, 'doctor.actionLabel')}: ${diagnostic.action})` : '';
199
+ lines.push(`- [${diagnostic.status}] ${getDiagnosticLabel(diagnostic.id, lang)}: ${diagnostic.summary}${action}`);
200
+ }
201
+ if (output.check.issues.length > 0) {
202
+ lines.push('', t(lang, 'doctor.section.issueList'));
203
+ for (const issue of output.check.issues) {
204
+ lines.push(`- ${issue}`);
205
+ }
206
+ }
207
+ lines.push('', t(lang, 'doctor.section.suggestedCommands'));
208
+ for (const step of output.next_steps) {
209
+ lines.push(`- ${step}`);
210
+ }
211
+ lines.push('', t(lang, 'update.plan.noFilesWritten'));
212
+ return lines.join('\n');
213
+ }
214
+ export function runDoctor(args, reporter, lang = 'en') {
215
+ if (args.includes('--help') || args.includes('-h')) {
216
+ reporter.stdout(getDoctorHelp(lang));
217
+ return 0;
218
+ }
219
+ const supported = new Set(['--json', '--strict']);
220
+ const unsupported = args.filter((arg) => !supported.has(arg));
221
+ if (unsupported.length > 0) {
222
+ printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf doctor --help', getDoctorHelp(lang), lang);
223
+ return 1;
224
+ }
225
+ const output = createDoctorOutput(args.includes('--strict'));
226
+ if (args.includes('--json')) {
227
+ reporter.stdout(JSON.stringify(output, null, 2));
228
+ return output.ok ? 0 : 1;
229
+ }
230
+ reporter.stdout(renderDoctorOutput(output, lang));
231
+ return output.ok ? 0 : 1;
232
+ }