mustflow 1.18.16 → 1.31.0

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 (314) hide show
  1. package/README.md +28 -8
  2. package/dist/cli/commands/adapters.js +90 -0
  3. package/dist/cli/commands/classify.js +3 -4
  4. package/dist/cli/commands/contract-lint.js +26 -6
  5. package/dist/cli/commands/dashboard.js +103 -4
  6. package/dist/cli/commands/explain-verify.js +213 -0
  7. package/dist/cli/commands/explain.js +48 -4
  8. package/dist/cli/commands/handoff.js +136 -0
  9. package/dist/cli/commands/run.js +302 -168
  10. package/dist/cli/commands/update.js +91 -61
  11. package/dist/cli/commands/upgrade.js +65 -0
  12. package/dist/cli/commands/verify.js +304 -139
  13. package/dist/cli/i18n/en.js +77 -4
  14. package/dist/cli/i18n/es.js +77 -4
  15. package/dist/cli/i18n/fr.js +77 -4
  16. package/dist/cli/i18n/hi.js +77 -4
  17. package/dist/cli/i18n/ko.js +77 -4
  18. package/dist/cli/i18n/zh.js +77 -4
  19. package/dist/cli/index.js +34 -42
  20. package/dist/cli/lib/command-registry.js +15 -0
  21. package/dist/cli/lib/dashboard-export.js +775 -0
  22. package/dist/cli/lib/dashboard-html.js +1 -1
  23. package/dist/cli/lib/local-index.js +33 -14
  24. package/dist/cli/lib/reporter.js +6 -0
  25. package/dist/cli/lib/run-plan.js +239 -0
  26. package/dist/cli/lib/templates.js +18 -3
  27. package/dist/cli/lib/update-diff-preview.js +163 -0
  28. package/dist/cli/lib/validation.js +132 -1
  29. package/dist/core/adapter-compatibility.js +235 -0
  30. package/dist/core/bounded-output.js +38 -0
  31. package/dist/core/change-classification.js +14 -1
  32. package/dist/core/change-verification.js +246 -5
  33. package/dist/core/check-issues.js +10 -0
  34. package/dist/core/command-contract-validation.js +34 -0
  35. package/dist/core/command-cwd.js +18 -6
  36. package/dist/core/command-effects.js +13 -0
  37. package/dist/core/command-env.js +91 -0
  38. package/dist/core/contract-lint.js +260 -4
  39. package/dist/core/contract-models.js +172 -0
  40. package/dist/core/dashboard-verification.js +10 -0
  41. package/dist/core/doc-review-triage.js +1 -0
  42. package/dist/core/handoff-record.js +376 -0
  43. package/dist/core/public-json-contracts.js +23 -0
  44. package/dist/core/run-performance-history.js +307 -0
  45. package/dist/core/run-profile.js +87 -0
  46. package/dist/core/run-receipt.js +217 -11
  47. package/dist/core/run-write-drift.js +196 -0
  48. package/dist/core/secret-redaction.js +39 -0
  49. package/dist/core/skill-route-alignment.js +90 -0
  50. package/dist/core/source-anchors.js +3 -5
  51. package/dist/core/test-selection.js +224 -0
  52. package/dist/core/verification-decision-graph.js +290 -0
  53. package/dist/core/verification-scheduler.js +96 -2
  54. package/package.json +3 -1
  55. package/schemas/README.md +15 -4
  56. package/schemas/adapter-compatibility-report.schema.json +184 -0
  57. package/schemas/change-verification-report.schema.json +286 -4
  58. package/schemas/commands.schema.json +55 -2
  59. package/schemas/contract-lint-report.schema.json +99 -0
  60. package/schemas/dashboard-export.schema.json +273 -0
  61. package/schemas/explain-report.schema.json +267 -2
  62. package/schemas/handoff-validation-report.schema.json +68 -0
  63. package/schemas/run-receipt.schema.json +183 -1
  64. package/templates/default/common/.mustflow/config/commands.toml +3 -1
  65. package/templates/default/i18n.toml +78 -234
  66. package/templates/default/locales/en/.mustflow/skills/INDEX.md +7 -3
  67. package/templates/default/locales/en/.mustflow/skills/architecture-deepening-review/SKILL.md +154 -0
  68. package/templates/default/locales/en/.mustflow/skills/behavior-preserving-refactor/SKILL.md +8 -3
  69. package/templates/default/locales/en/.mustflow/skills/code-review/SKILL.md +9 -4
  70. package/templates/default/locales/en/.mustflow/skills/date-number-audit/SKILL.md +19 -4
  71. package/templates/default/locales/en/.mustflow/skills/diff-risk-review/SKILL.md +4 -2
  72. package/templates/default/locales/en/.mustflow/skills/external-skill-intake/SKILL.md +141 -0
  73. package/templates/default/locales/en/.mustflow/skills/release-notes-authoring/SKILL.md +143 -0
  74. package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +22 -8
  75. package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +3 -3
  76. package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +22 -9
  77. package/templates/default/locales/en/.mustflow/skills/ui-quality-gate/SKILL.md +21 -13
  78. package/templates/default/locales/en/.mustflow/skills/vertical-slice-tdd/SKILL.md +167 -0
  79. package/templates/default/manifest.toml +16 -1
  80. package/templates/default/locales/es/.mustflow/skills/INDEX.md +0 -75
  81. package/templates/default/locales/es/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
  82. package/templates/default/locales/es/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
  83. package/templates/default/locales/es/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
  84. package/templates/default/locales/es/.mustflow/skills/code-review/SKILL.md +0 -115
  85. package/templates/default/locales/es/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
  86. package/templates/default/locales/es/.mustflow/skills/command-pattern/SKILL.md +0 -247
  87. package/templates/default/locales/es/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
  88. package/templates/default/locales/es/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
  89. package/templates/default/locales/es/.mustflow/skills/database-change-safety/SKILL.md +0 -155
  90. package/templates/default/locales/es/.mustflow/skills/date-number-audit/SKILL.md +0 -116
  91. package/templates/default/locales/es/.mustflow/skills/dependency-injection/SKILL.md +0 -161
  92. package/templates/default/locales/es/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
  93. package/templates/default/locales/es/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
  94. package/templates/default/locales/es/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
  95. package/templates/default/locales/es/.mustflow/skills/docs-update/SKILL.md +0 -97
  96. package/templates/default/locales/es/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
  97. package/templates/default/locales/es/.mustflow/skills/facade-pattern/SKILL.md +0 -210
  98. package/templates/default/locales/es/.mustflow/skills/failure-triage/SKILL.md +0 -97
  99. package/templates/default/locales/es/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
  100. package/templates/default/locales/es/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
  101. package/templates/default/locales/es/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
  102. package/templates/default/locales/es/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
  103. package/templates/default/locales/es/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
  104. package/templates/default/locales/es/.mustflow/skills/pattern-scout/SKILL.md +0 -110
  105. package/templates/default/locales/es/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
  106. package/templates/default/locales/es/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
  107. package/templates/default/locales/es/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
  108. package/templates/default/locales/es/.mustflow/skills/readme-authoring/SKILL.md +0 -115
  109. package/templates/default/locales/es/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
  110. package/templates/default/locales/es/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
  111. package/templates/default/locales/es/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
  112. package/templates/default/locales/es/.mustflow/skills/result-option/SKILL.md +0 -186
  113. package/templates/default/locales/es/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
  114. package/templates/default/locales/es/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
  115. package/templates/default/locales/es/.mustflow/skills/skill-authoring/SKILL.md +0 -110
  116. package/templates/default/locales/es/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
  117. package/templates/default/locales/es/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
  118. package/templates/default/locales/es/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
  119. package/templates/default/locales/es/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
  120. package/templates/default/locales/es/.mustflow/skills/test-design-guard/SKILL.md +0 -162
  121. package/templates/default/locales/es/.mustflow/skills/test-maintenance/SKILL.md +0 -122
  122. package/templates/default/locales/es/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
  123. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
  124. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
  125. package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
  126. package/templates/default/locales/es/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
  127. package/templates/default/locales/fr/.mustflow/skills/INDEX.md +0 -75
  128. package/templates/default/locales/fr/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
  129. package/templates/default/locales/fr/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
  130. package/templates/default/locales/fr/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
  131. package/templates/default/locales/fr/.mustflow/skills/code-review/SKILL.md +0 -115
  132. package/templates/default/locales/fr/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
  133. package/templates/default/locales/fr/.mustflow/skills/command-pattern/SKILL.md +0 -247
  134. package/templates/default/locales/fr/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
  135. package/templates/default/locales/fr/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
  136. package/templates/default/locales/fr/.mustflow/skills/database-change-safety/SKILL.md +0 -155
  137. package/templates/default/locales/fr/.mustflow/skills/date-number-audit/SKILL.md +0 -116
  138. package/templates/default/locales/fr/.mustflow/skills/dependency-injection/SKILL.md +0 -161
  139. package/templates/default/locales/fr/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
  140. package/templates/default/locales/fr/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
  141. package/templates/default/locales/fr/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
  142. package/templates/default/locales/fr/.mustflow/skills/docs-update/SKILL.md +0 -97
  143. package/templates/default/locales/fr/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
  144. package/templates/default/locales/fr/.mustflow/skills/facade-pattern/SKILL.md +0 -210
  145. package/templates/default/locales/fr/.mustflow/skills/failure-triage/SKILL.md +0 -97
  146. package/templates/default/locales/fr/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
  147. package/templates/default/locales/fr/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
  148. package/templates/default/locales/fr/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
  149. package/templates/default/locales/fr/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
  150. package/templates/default/locales/fr/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
  151. package/templates/default/locales/fr/.mustflow/skills/pattern-scout/SKILL.md +0 -110
  152. package/templates/default/locales/fr/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
  153. package/templates/default/locales/fr/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
  154. package/templates/default/locales/fr/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
  155. package/templates/default/locales/fr/.mustflow/skills/readme-authoring/SKILL.md +0 -115
  156. package/templates/default/locales/fr/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
  157. package/templates/default/locales/fr/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
  158. package/templates/default/locales/fr/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
  159. package/templates/default/locales/fr/.mustflow/skills/result-option/SKILL.md +0 -186
  160. package/templates/default/locales/fr/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
  161. package/templates/default/locales/fr/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
  162. package/templates/default/locales/fr/.mustflow/skills/skill-authoring/SKILL.md +0 -110
  163. package/templates/default/locales/fr/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
  164. package/templates/default/locales/fr/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
  165. package/templates/default/locales/fr/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
  166. package/templates/default/locales/fr/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
  167. package/templates/default/locales/fr/.mustflow/skills/test-design-guard/SKILL.md +0 -162
  168. package/templates/default/locales/fr/.mustflow/skills/test-maintenance/SKILL.md +0 -122
  169. package/templates/default/locales/fr/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
  170. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
  171. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
  172. package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
  173. package/templates/default/locales/fr/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
  174. package/templates/default/locales/hi/.mustflow/skills/INDEX.md +0 -75
  175. package/templates/default/locales/hi/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
  176. package/templates/default/locales/hi/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
  177. package/templates/default/locales/hi/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
  178. package/templates/default/locales/hi/.mustflow/skills/code-review/SKILL.md +0 -115
  179. package/templates/default/locales/hi/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
  180. package/templates/default/locales/hi/.mustflow/skills/command-pattern/SKILL.md +0 -247
  181. package/templates/default/locales/hi/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
  182. package/templates/default/locales/hi/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
  183. package/templates/default/locales/hi/.mustflow/skills/database-change-safety/SKILL.md +0 -155
  184. package/templates/default/locales/hi/.mustflow/skills/date-number-audit/SKILL.md +0 -116
  185. package/templates/default/locales/hi/.mustflow/skills/dependency-injection/SKILL.md +0 -161
  186. package/templates/default/locales/hi/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
  187. package/templates/default/locales/hi/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
  188. package/templates/default/locales/hi/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
  189. package/templates/default/locales/hi/.mustflow/skills/docs-update/SKILL.md +0 -97
  190. package/templates/default/locales/hi/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
  191. package/templates/default/locales/hi/.mustflow/skills/facade-pattern/SKILL.md +0 -210
  192. package/templates/default/locales/hi/.mustflow/skills/failure-triage/SKILL.md +0 -97
  193. package/templates/default/locales/hi/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
  194. package/templates/default/locales/hi/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
  195. package/templates/default/locales/hi/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
  196. package/templates/default/locales/hi/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
  197. package/templates/default/locales/hi/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
  198. package/templates/default/locales/hi/.mustflow/skills/pattern-scout/SKILL.md +0 -110
  199. package/templates/default/locales/hi/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
  200. package/templates/default/locales/hi/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
  201. package/templates/default/locales/hi/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
  202. package/templates/default/locales/hi/.mustflow/skills/readme-authoring/SKILL.md +0 -115
  203. package/templates/default/locales/hi/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
  204. package/templates/default/locales/hi/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
  205. package/templates/default/locales/hi/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
  206. package/templates/default/locales/hi/.mustflow/skills/result-option/SKILL.md +0 -186
  207. package/templates/default/locales/hi/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
  208. package/templates/default/locales/hi/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
  209. package/templates/default/locales/hi/.mustflow/skills/skill-authoring/SKILL.md +0 -110
  210. package/templates/default/locales/hi/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
  211. package/templates/default/locales/hi/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
  212. package/templates/default/locales/hi/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
  213. package/templates/default/locales/hi/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
  214. package/templates/default/locales/hi/.mustflow/skills/test-design-guard/SKILL.md +0 -162
  215. package/templates/default/locales/hi/.mustflow/skills/test-maintenance/SKILL.md +0 -122
  216. package/templates/default/locales/hi/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
  217. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
  218. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
  219. package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
  220. package/templates/default/locales/hi/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
  221. package/templates/default/locales/ko/.mustflow/skills/INDEX.md +0 -80
  222. package/templates/default/locales/ko/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
  223. package/templates/default/locales/ko/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
  224. package/templates/default/locales/ko/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
  225. package/templates/default/locales/ko/.mustflow/skills/code-review/SKILL.md +0 -118
  226. package/templates/default/locales/ko/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
  227. package/templates/default/locales/ko/.mustflow/skills/command-pattern/SKILL.md +0 -247
  228. package/templates/default/locales/ko/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
  229. package/templates/default/locales/ko/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
  230. package/templates/default/locales/ko/.mustflow/skills/database-change-safety/SKILL.md +0 -155
  231. package/templates/default/locales/ko/.mustflow/skills/date-number-audit/SKILL.md +0 -116
  232. package/templates/default/locales/ko/.mustflow/skills/dependency-injection/SKILL.md +0 -161
  233. package/templates/default/locales/ko/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
  234. package/templates/default/locales/ko/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
  235. package/templates/default/locales/ko/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
  236. package/templates/default/locales/ko/.mustflow/skills/docs-update/SKILL.md +0 -107
  237. package/templates/default/locales/ko/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
  238. package/templates/default/locales/ko/.mustflow/skills/facade-pattern/SKILL.md +0 -210
  239. package/templates/default/locales/ko/.mustflow/skills/failure-triage/SKILL.md +0 -119
  240. package/templates/default/locales/ko/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
  241. package/templates/default/locales/ko/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
  242. package/templates/default/locales/ko/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
  243. package/templates/default/locales/ko/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -259
  244. package/templates/default/locales/ko/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
  245. package/templates/default/locales/ko/.mustflow/skills/pattern-scout/SKILL.md +0 -110
  246. package/templates/default/locales/ko/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
  247. package/templates/default/locales/ko/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
  248. package/templates/default/locales/ko/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
  249. package/templates/default/locales/ko/.mustflow/skills/readme-authoring/SKILL.md +0 -115
  250. package/templates/default/locales/ko/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
  251. package/templates/default/locales/ko/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
  252. package/templates/default/locales/ko/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
  253. package/templates/default/locales/ko/.mustflow/skills/result-option/SKILL.md +0 -186
  254. package/templates/default/locales/ko/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
  255. package/templates/default/locales/ko/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
  256. package/templates/default/locales/ko/.mustflow/skills/skill-authoring/SKILL.md +0 -110
  257. package/templates/default/locales/ko/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
  258. package/templates/default/locales/ko/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
  259. package/templates/default/locales/ko/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
  260. package/templates/default/locales/ko/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
  261. package/templates/default/locales/ko/.mustflow/skills/test-design-guard/SKILL.md +0 -162
  262. package/templates/default/locales/ko/.mustflow/skills/test-maintenance/SKILL.md +0 -130
  263. package/templates/default/locales/ko/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
  264. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
  265. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
  266. package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
  267. package/templates/default/locales/ko/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
  268. package/templates/default/locales/zh/.mustflow/skills/INDEX.md +0 -74
  269. package/templates/default/locales/zh/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
  270. package/templates/default/locales/zh/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
  271. package/templates/default/locales/zh/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
  272. package/templates/default/locales/zh/.mustflow/skills/code-review/SKILL.md +0 -115
  273. package/templates/default/locales/zh/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
  274. package/templates/default/locales/zh/.mustflow/skills/command-pattern/SKILL.md +0 -247
  275. package/templates/default/locales/zh/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
  276. package/templates/default/locales/zh/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
  277. package/templates/default/locales/zh/.mustflow/skills/database-change-safety/SKILL.md +0 -155
  278. package/templates/default/locales/zh/.mustflow/skills/date-number-audit/SKILL.md +0 -116
  279. package/templates/default/locales/zh/.mustflow/skills/dependency-injection/SKILL.md +0 -161
  280. package/templates/default/locales/zh/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
  281. package/templates/default/locales/zh/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
  282. package/templates/default/locales/zh/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
  283. package/templates/default/locales/zh/.mustflow/skills/docs-update/SKILL.md +0 -97
  284. package/templates/default/locales/zh/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
  285. package/templates/default/locales/zh/.mustflow/skills/facade-pattern/SKILL.md +0 -210
  286. package/templates/default/locales/zh/.mustflow/skills/failure-triage/SKILL.md +0 -96
  287. package/templates/default/locales/zh/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
  288. package/templates/default/locales/zh/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
  289. package/templates/default/locales/zh/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
  290. package/templates/default/locales/zh/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
  291. package/templates/default/locales/zh/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
  292. package/templates/default/locales/zh/.mustflow/skills/pattern-scout/SKILL.md +0 -110
  293. package/templates/default/locales/zh/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
  294. package/templates/default/locales/zh/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
  295. package/templates/default/locales/zh/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
  296. package/templates/default/locales/zh/.mustflow/skills/readme-authoring/SKILL.md +0 -115
  297. package/templates/default/locales/zh/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
  298. package/templates/default/locales/zh/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
  299. package/templates/default/locales/zh/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
  300. package/templates/default/locales/zh/.mustflow/skills/result-option/SKILL.md +0 -186
  301. package/templates/default/locales/zh/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
  302. package/templates/default/locales/zh/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
  303. package/templates/default/locales/zh/.mustflow/skills/skill-authoring/SKILL.md +0 -110
  304. package/templates/default/locales/zh/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
  305. package/templates/default/locales/zh/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
  306. package/templates/default/locales/zh/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
  307. package/templates/default/locales/zh/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
  308. package/templates/default/locales/zh/.mustflow/skills/test-design-guard/SKILL.md +0 -162
  309. package/templates/default/locales/zh/.mustflow/skills/test-maintenance/SKILL.md +0 -122
  310. package/templates/default/locales/zh/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
  311. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
  312. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
  313. package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
  314. package/templates/default/locales/zh/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
@@ -4,7 +4,7 @@ import { isRecord } from './command-contract.js';
4
4
  import { validateCommandContractConfig, validateCommandContractStrictDefaults, } from '../../core/command-contract-validation.js';
5
5
  import { ALLOWED_RETENTION_ON_LIMIT, ALLOWED_RETENTION_STORES, DEFAULT_RETENTION_LIMITS, readNestedRetentionTable, readRetentionTable, resolveRetentionLimits, } from '../../core/retention-policy.js';
6
6
  import { formatManagedMarkdownLabel, getManagedMarkdownExpectation, } from '../../core/authority-resolution.js';
7
- import { SKILL_INDEX_ROUTE_COLUMN_COUNT, SKILL_INDEX_ROUTE_COLUMNS, SKILL_INDEX_SKILL_PATH_COLUMN_INDEX, findSkillIndexRoutePathColumn, parseSkillIndexRoutes, readBacktickValues, } from '../../core/skill-route-alignment.js';
7
+ import { SKILL_INDEX_ROUTE_COLUMN_COUNT, SKILL_INDEX_ROUTE_COLUMNS, SKILL_INDEX_SKILL_PATH_COLUMN_INDEX, findSkillRouteConflictWarnings, findSkillIndexRoutePathColumn, parseSkillIndexRoutes, readBacktickValues, } from '../../core/skill-route-alignment.js';
8
8
  import { validateTemplateVersionSync } from '../../core/release-version-validation.js';
9
9
  import { validateSourceAnchorsInProject } from '../../core/source-anchor-validation.js';
10
10
  import { listFilesRecursive, toPosixPath } from './filesystem.js';
@@ -13,6 +13,7 @@ import { inspectManifestLock } from './manifest-lock.js';
13
13
  import { COMMIT_MESSAGE_STYLES, TEST_AUTHORING_POLICIES } from './preferences-options.js';
14
14
  import { generateRepoMap } from './repo-map.js';
15
15
  import { readTomlFile } from './toml.js';
16
+ import { getContractModelDefinitions, validateCandidateContractModelConfig, } from '../../core/contract-models.js';
16
17
  import { VERSIONING_CONFIG_PATH, VERSION_SOURCE_AUTHORITIES, VERSION_SOURCE_KINDS, detectVersionSourcePaths, readDeclaredVersionSources, releaseVersioningIsEnabled, } from '../../core/version-sources.js';
17
18
  export { describeCheckIssues, getCheckIssueId, } from '../../core/check-issues.js';
18
19
  const REQUIRED_SKILL_SECTION_IDS = [
@@ -29,6 +30,7 @@ const REQUIRED_SKILL_SECTION_IDS = [
29
30
  'output-format',
30
31
  ];
31
32
  const SKILL_SECTION_MARKER_PATTERN = /^<!--\s*mustflow-section:\s*([a-z][a-z0-9-]*)\s*-->\s*\r?\n##\s+.+$/gimu;
33
+ const TEST_SELECTION_CONFIG_PATH = '.mustflow/config/test-selection.toml';
32
34
  const REQUIRED_FILES = [
33
35
  'AGENTS.md',
34
36
  '.mustflow/config/mustflow.toml',
@@ -98,6 +100,22 @@ const FORBIDDEN_VERIFICATION_SELECTION_AUTHORITY_FIELDS = [
98
100
  'destructive',
99
101
  ];
100
102
  const ALLOWED_VERIFICATION_SELECTION_STRATEGIES = new Set(['risk_based', 'targeted', 'full']);
103
+ const ALLOWED_TEST_SELECTION_RISKS = new Set(['low', 'medium', 'high', 'release_sensitive', 'security_sensitive']);
104
+ const FORBIDDEN_TEST_SELECTION_COMMAND_AUTHORITY_FIELDS = [
105
+ 'argv',
106
+ 'cmd',
107
+ 'command',
108
+ 'commands',
109
+ 'command_intents',
110
+ 'destructive',
111
+ 'intents',
112
+ 'lifecycle',
113
+ 'network',
114
+ 'required_after',
115
+ 'run_policy',
116
+ 'status',
117
+ 'writes',
118
+ ];
101
119
  const TEST_AUTHORING_BOOLEAN_FIELDS = ['prefer_existing_tests', 'require_new_test_rationale'];
102
120
  const ALLOWED_TEST_AUTHORING_POLICIES = new Set(TEST_AUTHORING_POLICIES);
103
121
  const ALLOWED_TESTING_POLICIES = new Set(['behavior_contract']);
@@ -1078,6 +1096,9 @@ function validateSkillIndexRoutes(projectRoot, commandsToml, skillFiles, issues)
1078
1096
  const routedSkillPaths = new Set();
1079
1097
  const expectedSkillPaths = new Set(skillFiles.map((relativePath) => `.mustflow/skills/${relativePath}`));
1080
1098
  const seenSkillPaths = new Set();
1099
+ for (const warning of findSkillRouteConflictWarnings(skillRoutes)) {
1100
+ pushStrictWarning(issues, `${SKILL_INDEX_PATH} ${warning}`);
1101
+ }
1081
1102
  for (const route of skillRoutes) {
1082
1103
  if (!route.skillPath.startsWith('.mustflow/skills/') || !route.skillPath.endsWith('/SKILL.md')) {
1083
1104
  pushStrictIssue(issues, `${SKILL_INDEX_PATH} route "${route.skillPath}" must point to .mustflow/skills/<name>/SKILL.md`);
@@ -1222,6 +1243,114 @@ function validateStrictVerificationSelectionAuthority(preferencesToml, issues) {
1222
1243
  }
1223
1244
  }
1224
1245
  }
1246
+ function validateNoTestSelectionCommandAuthorityFields(label, table, issues) {
1247
+ for (const field of FORBIDDEN_TEST_SELECTION_COMMAND_AUTHORITY_FIELDS) {
1248
+ if (hasOwn(table, field)) {
1249
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label}.${field} cannot define command authority; use .mustflow/config/commands.toml`);
1250
+ }
1251
+ }
1252
+ }
1253
+ function validateTestSelectionIntentReference(value, label, commandsToml, issues) {
1254
+ if (typeof value !== 'string' || value.trim().length === 0) {
1255
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} must be a command intent name`);
1256
+ return;
1257
+ }
1258
+ if (!isDeclaredCommandIntent(commandsToml, value)) {
1259
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} references unknown command intent "${value}"`);
1260
+ return;
1261
+ }
1262
+ if (!isConfiguredCommandIntent(commandsToml, value)) {
1263
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} references command intent "${value}" that is not configured`);
1264
+ }
1265
+ }
1266
+ function validateTestSelectionRule(rule, index, commandsToml, issues) {
1267
+ const label = `rules[${index}]`;
1268
+ if (!isRecord(rule)) {
1269
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} must be a TOML table`);
1270
+ return;
1271
+ }
1272
+ validateNoTestSelectionCommandAuthorityFields(label, rule, issues);
1273
+ validateRequiredStringField(rule, 'id', `${TEST_SELECTION_CONFIG_PATH} ${label}.id`, issues);
1274
+ validateRequiredStringField(rule, 'reason', `${TEST_SELECTION_CONFIG_PATH} ${label}.reason`, issues);
1275
+ validateRequiredStringField(rule, 'risk', `${TEST_SELECTION_CONFIG_PATH} ${label}.risk`, issues);
1276
+ validateAllowedStringField(rule, 'risk', `${TEST_SELECTION_CONFIG_PATH} ${label}.risk`, ALLOWED_TEST_SELECTION_RISKS, issues);
1277
+ const match = validateNestedTable(rule, 'match', `${TEST_SELECTION_CONFIG_PATH} ${label}.match`, issues);
1278
+ if (!hasOwn(rule, 'match')) {
1279
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} must define match`);
1280
+ }
1281
+ if (match) {
1282
+ validateNoTestSelectionCommandAuthorityFields(`${label}.match`, match, issues);
1283
+ validatePathArrayField(match, 'paths', `${TEST_SELECTION_CONFIG_PATH} ${label}.match.paths`, issues);
1284
+ validateStringArrayField(match, 'surfaces', `${TEST_SELECTION_CONFIG_PATH} ${label}.match.surfaces`, issues);
1285
+ if (!hasOwn(match, 'paths')) {
1286
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label}.match must define paths`);
1287
+ }
1288
+ if (!hasOwn(match, 'surfaces')) {
1289
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label}.match must define surfaces`);
1290
+ }
1291
+ }
1292
+ const select = validateNestedTable(rule, 'select', `${TEST_SELECTION_CONFIG_PATH} ${label}.select`, issues);
1293
+ if (!hasOwn(rule, 'select')) {
1294
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} ${label} must define select`);
1295
+ }
1296
+ if (select) {
1297
+ validateNoTestSelectionCommandAuthorityFields(`${label}.select`, select, issues);
1298
+ validateTestSelectionIntentReference(select.intent, `${label}.select.intent`, commandsToml, issues);
1299
+ validateTestSelectionIntentReference(select.fallback_intent, `${label}.select.fallback_intent`, commandsToml, issues);
1300
+ validatePathArrayField(select, 'test_targets', `${TEST_SELECTION_CONFIG_PATH} ${label}.select.test_targets`, issues);
1301
+ }
1302
+ }
1303
+ function validateStrictTestSelectionConfig(projectRoot, commandsToml, issues) {
1304
+ const configPath = path.join(projectRoot, ...TEST_SELECTION_CONFIG_PATH.split('/'));
1305
+ if (!existsSync(configPath)) {
1306
+ return;
1307
+ }
1308
+ let parsed;
1309
+ try {
1310
+ parsed = readTomlFile(configPath);
1311
+ }
1312
+ catch (error) {
1313
+ const message = error instanceof Error ? error.message : String(error);
1314
+ pushStrictIssue(issues, `Invalid TOML in ${TEST_SELECTION_CONFIG_PATH}: ${message}`);
1315
+ return;
1316
+ }
1317
+ if (!isRecord(parsed)) {
1318
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} must contain a TOML table`);
1319
+ return;
1320
+ }
1321
+ validateNoTestSelectionCommandAuthorityFields('root', parsed, issues);
1322
+ validateRequiredStringField(parsed, 'schema_version', `${TEST_SELECTION_CONFIG_PATH}.schema_version`, issues);
1323
+ if (parsed.schema_version !== '1') {
1324
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH}.schema_version must be "1"`);
1325
+ }
1326
+ if (!Array.isArray(parsed.rules) || parsed.rules.length === 0) {
1327
+ pushStrictIssue(issues, `${TEST_SELECTION_CONFIG_PATH} must define [[rules]]`);
1328
+ return;
1329
+ }
1330
+ for (const [index, rule] of parsed.rules.entries()) {
1331
+ validateTestSelectionRule(rule, index, commandsToml, issues);
1332
+ }
1333
+ }
1334
+ function validateStrictCandidateContractModelConfigs(projectRoot, issues) {
1335
+ for (const model of getContractModelDefinitions()) {
1336
+ const configPath = path.join(projectRoot, ...model.filePath.split('/'));
1337
+ if (!existsSync(configPath)) {
1338
+ continue;
1339
+ }
1340
+ let parsed;
1341
+ try {
1342
+ parsed = readTomlFile(configPath);
1343
+ }
1344
+ catch (error) {
1345
+ const message = error instanceof Error ? error.message : String(error);
1346
+ pushStrictIssue(issues, `Invalid TOML in ${model.filePath}: ${message}`);
1347
+ continue;
1348
+ }
1349
+ for (const issue of validateCandidateContractModelConfig(model, parsed)) {
1350
+ pushStrictIssue(issues, issue.message);
1351
+ }
1352
+ }
1353
+ }
1225
1354
  function validateStrictReleaseVersioningAuthority(preferencesToml, issues) {
1226
1355
  if (!preferencesToml || !isRecord(preferencesToml.release)) {
1227
1356
  return;
@@ -1597,6 +1726,8 @@ function validateStrict(projectRoot, parsed, issues) {
1597
1726
  validateStrictCommandDefaults(projectRoot, parsed.commandsToml, issues);
1598
1727
  validateStrictReleaseVersioningAuthority(parsed.preferencesToml, issues);
1599
1728
  validateStrictVerificationSelectionAuthority(parsed.preferencesToml, issues);
1729
+ validateStrictCandidateContractModelConfigs(projectRoot, issues);
1730
+ validateStrictTestSelectionConfig(projectRoot, parsed.commandsToml, issues);
1600
1731
  validateStrictVersionSources(projectRoot, parsed.preferencesToml, parsed.versioningToml, issues);
1601
1732
  validateStrictTemplateVersionSync(projectRoot, parsed.preferencesToml, issues);
1602
1733
  validateStrictManagedMarkdownIdentities(projectRoot, issues);
@@ -0,0 +1,235 @@
1
+ import { existsSync, lstatSync, readFileSync, readdirSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ const ADAPTER_SCHEMA_VERSION = '1';
4
+ const MAX_HOST_INSTRUCTION_BYTES = 256 * 1024;
5
+ const MAX_CURSOR_RULE_FILES = 100;
6
+ const HOST_INSTRUCTION_FILES = [
7
+ { host: 'claude_code', path: 'CLAUDE.md' },
8
+ { host: 'gemini_cli', path: 'GEMINI.md' },
9
+ { host: 'github_copilot', path: '.github/copilot-instructions.md' },
10
+ ];
11
+ const ADAPTER_SURFACE_DEFINITIONS = [
12
+ { host: 'claude_code', path: 'CLAUDE.md', kind: 'host_instruction_file' },
13
+ { host: 'gemini_cli', path: 'GEMINI.md', kind: 'host_instruction_file' },
14
+ { host: 'github_copilot', path: '.github/copilot-instructions.md', kind: 'host_instruction_file' },
15
+ { host: 'cursor', path: '.cursor/rules/', kind: 'host_instruction_file' },
16
+ { host: 'generic', path: '.vscode/settings.json', kind: 'editor_settings' },
17
+ { host: 'generic', path: '.github/workflows/', kind: 'ci_configuration' },
18
+ { host: 'generic', path: 'Makefile', kind: 'command_adapter' },
19
+ { host: 'generic', path: 'justfile', kind: 'command_adapter' },
20
+ { host: 'generic', path: 'Justfile', kind: 'command_adapter' },
21
+ { host: 'generic', path: 'Taskfile.yml', kind: 'command_adapter' },
22
+ { host: 'generic', path: 'package.json#scripts', kind: 'package_manager_scripts' },
23
+ ];
24
+ const HOST_AGENT_CONFLICT_PATTERNS = [
25
+ /\bignore\s+AGENTS\.md\b/iu,
26
+ /\bdo\s+not\s+(?:read|follow|use)\s+AGENTS\.md\b/iu,
27
+ /\boverride\s+AGENTS\.md\b/iu,
28
+ /\binstead\s+of\s+AGENTS\.md\b/iu,
29
+ /\bAGENTS\.md\s+(?:does\s+not|doesn't)\s+apply\b/iu,
30
+ ];
31
+ const DIRECT_COMMAND_PATTERNS = [
32
+ /\b(?:npm|pnpm|bun|yarn)\s+(?:run\s+)?(?:test|build|lint|check)\b/iu,
33
+ /\bdeno\s+task\b/iu,
34
+ /\bcargo\s+(?:test|build|check|clippy)\b/iu,
35
+ /\bgo\s+test\b/iu,
36
+ /\bmake\s+[A-Za-z0-9_-]+\b/iu,
37
+ /\bjust\s+[A-Za-z0-9_-]+\b/iu,
38
+ ];
39
+ function toPosixPath(value) {
40
+ return value.split(path.sep).join('/');
41
+ }
42
+ function resolveProjectPath(projectRoot, relativePath) {
43
+ return path.join(projectRoot, ...relativePath.split('/'));
44
+ }
45
+ function fileExists(projectRoot, relativePath) {
46
+ return existsSync(resolveProjectPath(projectRoot, relativePath));
47
+ }
48
+ function packageScriptsExist(projectRoot) {
49
+ const packageJsonPath = resolveProjectPath(projectRoot, 'package.json');
50
+ if (!existsSync(packageJsonPath)) {
51
+ return false;
52
+ }
53
+ try {
54
+ const parsed = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
55
+ return !!parsed.scripts && typeof parsed.scripts === 'object';
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
61
+ function surfaceExists(projectRoot, surfacePath) {
62
+ if (surfacePath === 'package.json#scripts') {
63
+ return packageScriptsExist(projectRoot);
64
+ }
65
+ const relativePath = surfacePath.endsWith('/') ? surfacePath.slice(0, -1) : surfacePath;
66
+ return fileExists(projectRoot, relativePath);
67
+ }
68
+ function makeHostFile(definition, status) {
69
+ return {
70
+ host: definition.host,
71
+ path: definition.path,
72
+ status,
73
+ instruction_role: 'host_instruction',
74
+ authority: 'host_specific',
75
+ mustflow_authority: 'advisory',
76
+ lifecycle: 'user_editable',
77
+ generated_by_mustflow: false,
78
+ binding_to_host: status === 'present',
79
+ mustflow_command_authority: false,
80
+ };
81
+ }
82
+ function makeFinding(severity, code, pathValue, message, requiredChange) {
83
+ return {
84
+ severity,
85
+ code,
86
+ path: pathValue,
87
+ message,
88
+ required_change: requiredChange,
89
+ };
90
+ }
91
+ function readHostInstruction(projectRoot, relativePath) {
92
+ const fullPath = resolveProjectPath(projectRoot, relativePath);
93
+ if (!existsSync(fullPath)) {
94
+ return { status: 'absent', text: null };
95
+ }
96
+ try {
97
+ const stat = lstatSync(fullPath);
98
+ if (stat.isSymbolicLink()) {
99
+ return {
100
+ status: 'symlink_not_read',
101
+ text: null,
102
+ finding: makeFinding('warning', 'host_instruction_symlink_not_read', relativePath, 'Host instruction path is a symbolic link, so mustflow did not read its target.', false),
103
+ };
104
+ }
105
+ if (!stat.isFile()) {
106
+ return {
107
+ status: 'unreadable',
108
+ text: null,
109
+ finding: makeFinding('warning', 'host_instruction_not_regular_file', relativePath, 'Host instruction path exists but is not a regular file.', false),
110
+ };
111
+ }
112
+ if (stat.size > MAX_HOST_INSTRUCTION_BYTES) {
113
+ return {
114
+ status: 'too_large_not_read',
115
+ text: null,
116
+ finding: makeFinding('warning', 'host_instruction_too_large_not_read', relativePath, 'Host instruction file is larger than the read limit, so mustflow reported metadata only.', false),
117
+ };
118
+ }
119
+ return { status: 'present', text: readFileSync(fullPath, 'utf8') };
120
+ }
121
+ catch {
122
+ return {
123
+ status: 'unreadable',
124
+ text: null,
125
+ finding: makeFinding('warning', 'host_instruction_unreadable', relativePath, 'Host instruction file could not be read.', false),
126
+ };
127
+ }
128
+ }
129
+ function collectCursorRuleDefinitions(projectRoot) {
130
+ const cursorRulesPath = resolveProjectPath(projectRoot, '.cursor/rules');
131
+ if (!existsSync(cursorRulesPath)) {
132
+ return [];
133
+ }
134
+ try {
135
+ const stat = lstatSync(cursorRulesPath);
136
+ if (!stat.isDirectory() || stat.isSymbolicLink()) {
137
+ return [{ host: 'cursor', path: '.cursor/rules/' }];
138
+ }
139
+ return readdirSync(cursorRulesPath, { withFileTypes: true })
140
+ .filter((entry) => entry.isFile() && (entry.name.endsWith('.md') || entry.name.endsWith('.mdc')))
141
+ .map((entry) => ({ host: 'cursor', path: `.cursor/rules/${entry.name}` }))
142
+ .sort((left, right) => left.path.localeCompare(right.path))
143
+ .slice(0, MAX_CURSOR_RULE_FILES);
144
+ }
145
+ catch {
146
+ return [{ host: 'cursor', path: '.cursor/rules/' }];
147
+ }
148
+ }
149
+ function inspectHostInstruction(definition, text) {
150
+ if (!text) {
151
+ return [];
152
+ }
153
+ const findings = [
154
+ makeFinding('info', 'host_instruction_present', definition.path, 'Host-specific instruction file is present. It may guide that host, but it is not mustflow command authority.', false),
155
+ ];
156
+ if (HOST_AGENT_CONFLICT_PATTERNS.some((pattern) => pattern.test(text))) {
157
+ findings.push(makeFinding('warning', 'host_instruction_conflicts_with_agents', definition.path, 'Host instruction appears to tell agents to ignore or override AGENTS.md. Resolve the instruction conflict before relying on the host adapter.', true));
158
+ }
159
+ if (DIRECT_COMMAND_PATTERNS.some((pattern) => pattern.test(text))) {
160
+ findings.push(makeFinding('warning', 'host_instruction_direct_command_hint', definition.path, 'Host instruction mentions direct tool commands. Agents must still use configured mustflow command intents for project verification.', false));
161
+ }
162
+ return findings;
163
+ }
164
+ function buildAdapterSurfaces(projectRoot) {
165
+ return ADAPTER_SURFACE_DEFINITIONS.map((definition) => ({
166
+ host: definition.host,
167
+ path: definition.path,
168
+ kind: definition.kind,
169
+ present: surfaceExists(projectRoot, definition.path),
170
+ generated_by_mustflow: false,
171
+ generation_policy: 'explicit_user_request_only',
172
+ mustflow_command_authority: false,
173
+ }));
174
+ }
175
+ export function inspectAdapterCompatibility(projectRoot) {
176
+ const hostDefinitions = [...HOST_INSTRUCTION_FILES, ...collectCursorRuleDefinitions(projectRoot)];
177
+ const hostFiles = [];
178
+ const findings = [
179
+ makeFinding('info', 'command_authority_boundary', '.mustflow/config/commands.toml', 'Project command authority remains .mustflow/config/commands.toml; host-specific files cannot authorize command execution.', false),
180
+ makeFinding('info', 'adapter_generation_not_default', null, 'mustflow does not generate host adapters, editor settings, CI files, Makefile, justfile, Taskfile.yml, or package-manager scripts by default.', false),
181
+ makeFinding('info', 'runtime_policy_not_repo_visible', null, 'Host approval and sandbox policies are runtime settings, so this report can only inspect repository-visible compatibility hints.', false),
182
+ ];
183
+ for (const definition of hostDefinitions) {
184
+ const read = readHostInstruction(projectRoot, definition.path);
185
+ hostFiles.push(makeHostFile(definition, read.status));
186
+ if (read.finding) {
187
+ findings.push(read.finding);
188
+ }
189
+ findings.push(...inspectHostInstruction(definition, read.text));
190
+ }
191
+ const adapterSurfaces = buildAdapterSurfaces(projectRoot);
192
+ const compatibilityNotes = findings.filter((finding) => !finding.required_change);
193
+ const requiredChanges = findings.filter((finding) => finding.required_change);
194
+ const doesNotGenerate = ADAPTER_SURFACE_DEFINITIONS.map((definition) => definition.path);
195
+ return {
196
+ schema_version: ADAPTER_SCHEMA_VERSION,
197
+ command: 'adapters_status',
198
+ ok: true,
199
+ mustflow_root: projectRoot,
200
+ agents_file: {
201
+ path: 'AGENTS.md',
202
+ present: fileExists(projectRoot, 'AGENTS.md'),
203
+ authority: 'binding',
204
+ lifecycle: 'user_editable',
205
+ generated_by_mustflow: fileExists(projectRoot, '.mustflow/config/manifest.lock.toml'),
206
+ },
207
+ summary: {
208
+ host_instruction_files: hostFiles.filter((file) => file.status === 'present').length,
209
+ adapter_surfaces_present: adapterSurfaces.filter((surface) => surface.present).length,
210
+ compatibility_notes: compatibilityNotes.length,
211
+ conflicts: requiredChanges.filter((finding) => finding.code === 'host_instruction_conflicts_with_agents').length,
212
+ required_changes: requiredChanges.length,
213
+ },
214
+ host_files: hostFiles,
215
+ adapter_surfaces: adapterSurfaces,
216
+ findings,
217
+ compatibility_notes: compatibilityNotes,
218
+ required_changes: requiredChanges,
219
+ runtime_policy: {
220
+ approval_policy: 'not_repo_visible',
221
+ sandbox_policy: 'not_repo_visible',
222
+ stricter_than_mustflow: 'unknown',
223
+ note: 'Repository files cannot prove host runtime approval or sandbox strictness.',
224
+ },
225
+ boundaries: {
226
+ command_authority: '.mustflow/config/commands.toml',
227
+ host_files_are_command_authority: false,
228
+ adapter_generation: 'explicit_user_request_only',
229
+ does_not_generate: doesNotGenerate,
230
+ },
231
+ };
232
+ }
233
+ export function formatAdapterPath(relativePath) {
234
+ return toPosixPath(relativePath);
235
+ }
@@ -0,0 +1,38 @@
1
+ export class BoundedOutputBuffer {
2
+ #maxTailBytes;
3
+ #chunks = [];
4
+ #tailBytes = 0;
5
+ #bytes = 0;
6
+ constructor(maxTailBytes) {
7
+ this.#maxTailBytes = Math.max(0, maxTailBytes);
8
+ }
9
+ append(chunk) {
10
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, 'utf8');
11
+ this.#bytes += buffer.byteLength;
12
+ if (this.#maxTailBytes === 0 || buffer.byteLength === 0) {
13
+ return;
14
+ }
15
+ this.#chunks.push(buffer);
16
+ this.#tailBytes += buffer.byteLength;
17
+ while (this.#tailBytes > this.#maxTailBytes && this.#chunks.length > 0) {
18
+ const first = this.#chunks[0];
19
+ const overflow = this.#tailBytes - this.#maxTailBytes;
20
+ if (!first) {
21
+ break;
22
+ }
23
+ if (first.byteLength <= overflow) {
24
+ this.#chunks.shift();
25
+ this.#tailBytes -= first.byteLength;
26
+ continue;
27
+ }
28
+ this.#chunks[0] = first.subarray(overflow);
29
+ this.#tailBytes -= overflow;
30
+ }
31
+ }
32
+ toSnapshot() {
33
+ return {
34
+ bytes: this.#bytes,
35
+ tail: Buffer.concat(this.#chunks, this.#tailBytes).toString('utf8'),
36
+ };
37
+ }
38
+ }
@@ -1,3 +1,8 @@
1
+ export const PUBLIC_SURFACE_UPDATE_POLICIES = [
2
+ 'update',
3
+ 'update_or_mark_stale',
4
+ 'not_applicable',
5
+ ];
1
6
  function surface(kind, category, isPublicSurface, validationReasons, affectedContracts, updatePolicy, driftChecks) {
2
7
  return {
3
8
  kind,
@@ -9,7 +14,8 @@ function surface(kind, category, isPublicSurface, validationReasons, affectedCon
9
14
  driftChecks,
10
15
  };
11
16
  }
12
- const UNKNOWN_SURFACE = surface('unclassified_path', 'unknown', false, [], [], 'not_applicable', []);
17
+ const UNKNOWN_CHANGE_REASON = 'unknown_change';
18
+ const UNKNOWN_SURFACE = surface('unclassified_path', 'unknown', false, [UNKNOWN_CHANGE_REASON], ['unclassified repository path'], 'not_applicable', ['classification rule coverage']);
13
19
  function rule(id, match, changeKinds, surfaceContract) {
14
20
  return {
15
21
  id,
@@ -28,6 +34,7 @@ const CHANGE_CLASSIFICATION_RULES = [
28
34
  rule('installed_template_translation', /^templates\/[^/]+\/locales\/[^/]+\//u, ['installed_template', 'translation'], surface('installed_template_translation', 'installed-template', true, ['i18n_change', 'template_version_change'], ['installed template files', 'localized workflow documents', 'template i18n metadata'], 'update_or_mark_stale', ['template i18n metadata', 'localized frontmatter', 'source revision'])),
29
35
  rule('installed_template', /^templates\/[^/]+\//u, ['installed_template'], surface('installed_template', 'installed-template', true, ['template_version_change', 'packaging_change'], ['installed template files', 'package contents', 'template manifest'], 'update', ['template manifest', 'package inventory', 'localized copies'])),
30
36
  rule('workflow_root', /^(AGENTS\.md|\.mustflow\/(?:docs|context|skills|config)\/)/u, ['workflow'], surface('workflow_root', 'workflow', true, ['mustflow_docs_change', 'mustflow_config_change'], ['agent workflow contract', 'command contract', 'installed workflow files'], 'update', ['strict workflow validation', 'installed template parity', 'skill route alignment'])),
37
+ rule('host_instruction', /^(CLAUDE\.md|GEMINI\.md|\.github\/copilot-instructions\.md|\.cursor\/rules\/[^/]+\.(?:md|mdc))$/u, ['workflow', 'host_instruction'], surface('host_instruction', 'workflow', true, ['mustflow_docs_change'], ['host instruction compatibility', 'agent workflow contract', 'command contract boundary'], 'update_or_mark_stale', ['host instruction conflicts', 'command contract boundary'])),
31
38
  rule('example', /^examples\//u, ['example'], surface('example', 'example', true, ['docs_change', 'public_api_change'], ['generated examples', 'human-readable examples'], 'update', ['example commands', 'linked docs', 'public behavior claims'])),
32
39
  rule('schema_contract', /^schemas\//u, ['schema'], surface('schema_contract', 'contract', true, ['public_api_change', 'release_risk'], ['JSON schema', 'machine-readable output contract'], 'update', ['schema tests', 'documented JSON fields', 'package inventory'])),
33
40
  rule('package_metadata', /^package\.json$/u, ['package_metadata'], surface('package_metadata', 'release', true, ['package_metadata_change', 'release_risk'], ['npm package metadata', 'published package contents'], 'update', ['package metadata tests', 'version source discovery', 'published file inventory'])),
@@ -73,6 +80,12 @@ export function listChangeClassificationRuleDescriptors() {
73
80
  surface: classificationRule.surface,
74
81
  }));
75
82
  }
83
+ export function listChangeClassificationValidationReasons() {
84
+ return uniqueSorted([
85
+ ...CHANGE_CLASSIFICATION_RULES.flatMap((classificationRule) => classificationRule.surface.validationReasons),
86
+ ...UNKNOWN_SURFACE.validationReasons,
87
+ ]);
88
+ }
76
89
  export function createChangeClassificationReport(source, relativePaths) {
77
90
  const files = uniqueSorted(relativePaths.map(normalizeStatusPath).filter((filePath) => filePath.length > 0));
78
91
  const classifications = files.map(classifyChangePath);