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.
- package/README.md +28 -8
- package/dist/cli/commands/adapters.js +90 -0
- package/dist/cli/commands/classify.js +3 -4
- package/dist/cli/commands/contract-lint.js +26 -6
- package/dist/cli/commands/dashboard.js +103 -4
- package/dist/cli/commands/explain-verify.js +213 -0
- package/dist/cli/commands/explain.js +48 -4
- package/dist/cli/commands/handoff.js +136 -0
- package/dist/cli/commands/run.js +302 -168
- package/dist/cli/commands/update.js +91 -61
- package/dist/cli/commands/upgrade.js +65 -0
- package/dist/cli/commands/verify.js +304 -139
- package/dist/cli/i18n/en.js +77 -4
- package/dist/cli/i18n/es.js +77 -4
- package/dist/cli/i18n/fr.js +77 -4
- package/dist/cli/i18n/hi.js +77 -4
- package/dist/cli/i18n/ko.js +77 -4
- package/dist/cli/i18n/zh.js +77 -4
- package/dist/cli/index.js +34 -42
- package/dist/cli/lib/command-registry.js +15 -0
- package/dist/cli/lib/dashboard-export.js +775 -0
- package/dist/cli/lib/dashboard-html.js +1 -1
- package/dist/cli/lib/local-index.js +33 -14
- package/dist/cli/lib/reporter.js +6 -0
- package/dist/cli/lib/run-plan.js +239 -0
- package/dist/cli/lib/templates.js +18 -3
- package/dist/cli/lib/update-diff-preview.js +163 -0
- package/dist/cli/lib/validation.js +132 -1
- package/dist/core/adapter-compatibility.js +235 -0
- package/dist/core/bounded-output.js +38 -0
- package/dist/core/change-classification.js +14 -1
- package/dist/core/change-verification.js +246 -5
- package/dist/core/check-issues.js +10 -0
- package/dist/core/command-contract-validation.js +34 -0
- package/dist/core/command-cwd.js +18 -6
- package/dist/core/command-effects.js +13 -0
- package/dist/core/command-env.js +91 -0
- package/dist/core/contract-lint.js +260 -4
- package/dist/core/contract-models.js +172 -0
- package/dist/core/dashboard-verification.js +10 -0
- package/dist/core/doc-review-triage.js +1 -0
- package/dist/core/handoff-record.js +376 -0
- package/dist/core/public-json-contracts.js +23 -0
- package/dist/core/run-performance-history.js +307 -0
- package/dist/core/run-profile.js +87 -0
- package/dist/core/run-receipt.js +217 -11
- package/dist/core/run-write-drift.js +196 -0
- package/dist/core/secret-redaction.js +39 -0
- package/dist/core/skill-route-alignment.js +90 -0
- package/dist/core/source-anchors.js +3 -5
- package/dist/core/test-selection.js +224 -0
- package/dist/core/verification-decision-graph.js +290 -0
- package/dist/core/verification-scheduler.js +96 -2
- package/package.json +3 -1
- package/schemas/README.md +15 -4
- package/schemas/adapter-compatibility-report.schema.json +184 -0
- package/schemas/change-verification-report.schema.json +286 -4
- package/schemas/commands.schema.json +55 -2
- package/schemas/contract-lint-report.schema.json +99 -0
- package/schemas/dashboard-export.schema.json +273 -0
- package/schemas/explain-report.schema.json +267 -2
- package/schemas/handoff-validation-report.schema.json +68 -0
- package/schemas/run-receipt.schema.json +183 -1
- package/templates/default/common/.mustflow/config/commands.toml +3 -1
- package/templates/default/i18n.toml +78 -234
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +7 -3
- package/templates/default/locales/en/.mustflow/skills/architecture-deepening-review/SKILL.md +154 -0
- package/templates/default/locales/en/.mustflow/skills/behavior-preserving-refactor/SKILL.md +8 -3
- package/templates/default/locales/en/.mustflow/skills/code-review/SKILL.md +9 -4
- package/templates/default/locales/en/.mustflow/skills/date-number-audit/SKILL.md +19 -4
- package/templates/default/locales/en/.mustflow/skills/diff-risk-review/SKILL.md +4 -2
- package/templates/default/locales/en/.mustflow/skills/external-skill-intake/SKILL.md +141 -0
- package/templates/default/locales/en/.mustflow/skills/release-notes-authoring/SKILL.md +143 -0
- package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +22 -8
- package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +3 -3
- package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +22 -9
- package/templates/default/locales/en/.mustflow/skills/ui-quality-gate/SKILL.md +21 -13
- package/templates/default/locales/en/.mustflow/skills/vertical-slice-tdd/SKILL.md +167 -0
- package/templates/default/manifest.toml +16 -1
- package/templates/default/locales/es/.mustflow/skills/INDEX.md +0 -75
- package/templates/default/locales/es/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
- package/templates/default/locales/es/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
- package/templates/default/locales/es/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
- package/templates/default/locales/es/.mustflow/skills/code-review/SKILL.md +0 -115
- package/templates/default/locales/es/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
- package/templates/default/locales/es/.mustflow/skills/command-pattern/SKILL.md +0 -247
- package/templates/default/locales/es/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
- package/templates/default/locales/es/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
- package/templates/default/locales/es/.mustflow/skills/database-change-safety/SKILL.md +0 -155
- package/templates/default/locales/es/.mustflow/skills/date-number-audit/SKILL.md +0 -116
- package/templates/default/locales/es/.mustflow/skills/dependency-injection/SKILL.md +0 -161
- package/templates/default/locales/es/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
- package/templates/default/locales/es/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
- package/templates/default/locales/es/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
- package/templates/default/locales/es/.mustflow/skills/docs-update/SKILL.md +0 -97
- package/templates/default/locales/es/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
- package/templates/default/locales/es/.mustflow/skills/facade-pattern/SKILL.md +0 -210
- package/templates/default/locales/es/.mustflow/skills/failure-triage/SKILL.md +0 -97
- package/templates/default/locales/es/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
- package/templates/default/locales/es/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
- package/templates/default/locales/es/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
- package/templates/default/locales/es/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
- package/templates/default/locales/es/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
- package/templates/default/locales/es/.mustflow/skills/pattern-scout/SKILL.md +0 -110
- package/templates/default/locales/es/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
- package/templates/default/locales/es/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
- package/templates/default/locales/es/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
- package/templates/default/locales/es/.mustflow/skills/readme-authoring/SKILL.md +0 -115
- package/templates/default/locales/es/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
- package/templates/default/locales/es/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
- package/templates/default/locales/es/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
- package/templates/default/locales/es/.mustflow/skills/result-option/SKILL.md +0 -186
- package/templates/default/locales/es/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
- package/templates/default/locales/es/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
- package/templates/default/locales/es/.mustflow/skills/skill-authoring/SKILL.md +0 -110
- package/templates/default/locales/es/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
- package/templates/default/locales/es/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
- package/templates/default/locales/es/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
- package/templates/default/locales/es/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
- package/templates/default/locales/es/.mustflow/skills/test-design-guard/SKILL.md +0 -162
- package/templates/default/locales/es/.mustflow/skills/test-maintenance/SKILL.md +0 -122
- package/templates/default/locales/es/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
- package/templates/default/locales/es/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
- package/templates/default/locales/fr/.mustflow/skills/INDEX.md +0 -75
- package/templates/default/locales/fr/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
- package/templates/default/locales/fr/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
- package/templates/default/locales/fr/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
- package/templates/default/locales/fr/.mustflow/skills/code-review/SKILL.md +0 -115
- package/templates/default/locales/fr/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
- package/templates/default/locales/fr/.mustflow/skills/command-pattern/SKILL.md +0 -247
- package/templates/default/locales/fr/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
- package/templates/default/locales/fr/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
- package/templates/default/locales/fr/.mustflow/skills/database-change-safety/SKILL.md +0 -155
- package/templates/default/locales/fr/.mustflow/skills/date-number-audit/SKILL.md +0 -116
- package/templates/default/locales/fr/.mustflow/skills/dependency-injection/SKILL.md +0 -161
- package/templates/default/locales/fr/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
- package/templates/default/locales/fr/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
- package/templates/default/locales/fr/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
- package/templates/default/locales/fr/.mustflow/skills/docs-update/SKILL.md +0 -97
- package/templates/default/locales/fr/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
- package/templates/default/locales/fr/.mustflow/skills/facade-pattern/SKILL.md +0 -210
- package/templates/default/locales/fr/.mustflow/skills/failure-triage/SKILL.md +0 -97
- package/templates/default/locales/fr/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
- package/templates/default/locales/fr/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
- package/templates/default/locales/fr/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
- package/templates/default/locales/fr/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
- package/templates/default/locales/fr/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
- package/templates/default/locales/fr/.mustflow/skills/pattern-scout/SKILL.md +0 -110
- package/templates/default/locales/fr/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
- package/templates/default/locales/fr/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
- package/templates/default/locales/fr/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
- package/templates/default/locales/fr/.mustflow/skills/readme-authoring/SKILL.md +0 -115
- package/templates/default/locales/fr/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
- package/templates/default/locales/fr/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
- package/templates/default/locales/fr/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
- package/templates/default/locales/fr/.mustflow/skills/result-option/SKILL.md +0 -186
- package/templates/default/locales/fr/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
- package/templates/default/locales/fr/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
- package/templates/default/locales/fr/.mustflow/skills/skill-authoring/SKILL.md +0 -110
- package/templates/default/locales/fr/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
- package/templates/default/locales/fr/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
- package/templates/default/locales/fr/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
- package/templates/default/locales/fr/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
- package/templates/default/locales/fr/.mustflow/skills/test-design-guard/SKILL.md +0 -162
- package/templates/default/locales/fr/.mustflow/skills/test-maintenance/SKILL.md +0 -122
- package/templates/default/locales/fr/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
- package/templates/default/locales/fr/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
- package/templates/default/locales/hi/.mustflow/skills/INDEX.md +0 -75
- package/templates/default/locales/hi/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
- package/templates/default/locales/hi/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
- package/templates/default/locales/hi/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
- package/templates/default/locales/hi/.mustflow/skills/code-review/SKILL.md +0 -115
- package/templates/default/locales/hi/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
- package/templates/default/locales/hi/.mustflow/skills/command-pattern/SKILL.md +0 -247
- package/templates/default/locales/hi/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
- package/templates/default/locales/hi/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
- package/templates/default/locales/hi/.mustflow/skills/database-change-safety/SKILL.md +0 -155
- package/templates/default/locales/hi/.mustflow/skills/date-number-audit/SKILL.md +0 -116
- package/templates/default/locales/hi/.mustflow/skills/dependency-injection/SKILL.md +0 -161
- package/templates/default/locales/hi/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
- package/templates/default/locales/hi/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
- package/templates/default/locales/hi/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
- package/templates/default/locales/hi/.mustflow/skills/docs-update/SKILL.md +0 -97
- package/templates/default/locales/hi/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
- package/templates/default/locales/hi/.mustflow/skills/facade-pattern/SKILL.md +0 -210
- package/templates/default/locales/hi/.mustflow/skills/failure-triage/SKILL.md +0 -97
- package/templates/default/locales/hi/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
- package/templates/default/locales/hi/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
- package/templates/default/locales/hi/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
- package/templates/default/locales/hi/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
- package/templates/default/locales/hi/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
- package/templates/default/locales/hi/.mustflow/skills/pattern-scout/SKILL.md +0 -110
- package/templates/default/locales/hi/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
- package/templates/default/locales/hi/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
- package/templates/default/locales/hi/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
- package/templates/default/locales/hi/.mustflow/skills/readme-authoring/SKILL.md +0 -115
- package/templates/default/locales/hi/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
- package/templates/default/locales/hi/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
- package/templates/default/locales/hi/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
- package/templates/default/locales/hi/.mustflow/skills/result-option/SKILL.md +0 -186
- package/templates/default/locales/hi/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
- package/templates/default/locales/hi/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
- package/templates/default/locales/hi/.mustflow/skills/skill-authoring/SKILL.md +0 -110
- package/templates/default/locales/hi/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
- package/templates/default/locales/hi/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
- package/templates/default/locales/hi/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
- package/templates/default/locales/hi/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
- package/templates/default/locales/hi/.mustflow/skills/test-design-guard/SKILL.md +0 -162
- package/templates/default/locales/hi/.mustflow/skills/test-maintenance/SKILL.md +0 -122
- package/templates/default/locales/hi/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
- package/templates/default/locales/hi/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
- package/templates/default/locales/ko/.mustflow/skills/INDEX.md +0 -80
- package/templates/default/locales/ko/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
- package/templates/default/locales/ko/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
- package/templates/default/locales/ko/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
- package/templates/default/locales/ko/.mustflow/skills/code-review/SKILL.md +0 -118
- package/templates/default/locales/ko/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
- package/templates/default/locales/ko/.mustflow/skills/command-pattern/SKILL.md +0 -247
- package/templates/default/locales/ko/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
- package/templates/default/locales/ko/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
- package/templates/default/locales/ko/.mustflow/skills/database-change-safety/SKILL.md +0 -155
- package/templates/default/locales/ko/.mustflow/skills/date-number-audit/SKILL.md +0 -116
- package/templates/default/locales/ko/.mustflow/skills/dependency-injection/SKILL.md +0 -161
- package/templates/default/locales/ko/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
- package/templates/default/locales/ko/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
- package/templates/default/locales/ko/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
- package/templates/default/locales/ko/.mustflow/skills/docs-update/SKILL.md +0 -107
- package/templates/default/locales/ko/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
- package/templates/default/locales/ko/.mustflow/skills/facade-pattern/SKILL.md +0 -210
- package/templates/default/locales/ko/.mustflow/skills/failure-triage/SKILL.md +0 -119
- package/templates/default/locales/ko/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
- package/templates/default/locales/ko/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
- package/templates/default/locales/ko/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
- package/templates/default/locales/ko/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -259
- package/templates/default/locales/ko/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
- package/templates/default/locales/ko/.mustflow/skills/pattern-scout/SKILL.md +0 -110
- package/templates/default/locales/ko/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
- package/templates/default/locales/ko/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
- package/templates/default/locales/ko/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
- package/templates/default/locales/ko/.mustflow/skills/readme-authoring/SKILL.md +0 -115
- package/templates/default/locales/ko/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
- package/templates/default/locales/ko/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
- package/templates/default/locales/ko/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
- package/templates/default/locales/ko/.mustflow/skills/result-option/SKILL.md +0 -186
- package/templates/default/locales/ko/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
- package/templates/default/locales/ko/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
- package/templates/default/locales/ko/.mustflow/skills/skill-authoring/SKILL.md +0 -110
- package/templates/default/locales/ko/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
- package/templates/default/locales/ko/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
- package/templates/default/locales/ko/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
- package/templates/default/locales/ko/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
- package/templates/default/locales/ko/.mustflow/skills/test-design-guard/SKILL.md +0 -162
- package/templates/default/locales/ko/.mustflow/skills/test-maintenance/SKILL.md +0 -130
- package/templates/default/locales/ko/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
- package/templates/default/locales/ko/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
- package/templates/default/locales/zh/.mustflow/skills/INDEX.md +0 -74
- package/templates/default/locales/zh/.mustflow/skills/adapter-boundary/SKILL.md +0 -193
- package/templates/default/locales/zh/.mustflow/skills/artifact-integrity-check/SKILL.md +0 -114
- package/templates/default/locales/zh/.mustflow/skills/behavior-preserving-refactor/SKILL.md +0 -182
- package/templates/default/locales/zh/.mustflow/skills/code-review/SKILL.md +0 -115
- package/templates/default/locales/zh/.mustflow/skills/codebase-orientation/SKILL.md +0 -115
- package/templates/default/locales/zh/.mustflow/skills/command-pattern/SKILL.md +0 -247
- package/templates/default/locales/zh/.mustflow/skills/composition-over-inheritance/SKILL.md +0 -176
- package/templates/default/locales/zh/.mustflow/skills/contract-sync-check/SKILL.md +0 -116
- package/templates/default/locales/zh/.mustflow/skills/database-change-safety/SKILL.md +0 -155
- package/templates/default/locales/zh/.mustflow/skills/date-number-audit/SKILL.md +0 -116
- package/templates/default/locales/zh/.mustflow/skills/dependency-injection/SKILL.md +0 -161
- package/templates/default/locales/zh/.mustflow/skills/dependency-reality-check/SKILL.md +0 -115
- package/templates/default/locales/zh/.mustflow/skills/diff-risk-review/SKILL.md +0 -136
- package/templates/default/locales/zh/.mustflow/skills/docs-prose-review/SKILL.md +0 -119
- package/templates/default/locales/zh/.mustflow/skills/docs-update/SKILL.md +0 -97
- package/templates/default/locales/zh/.mustflow/skills/external-prompt-injection-defense/SKILL.md +0 -116
- package/templates/default/locales/zh/.mustflow/skills/facade-pattern/SKILL.md +0 -210
- package/templates/default/locales/zh/.mustflow/skills/failure-triage/SKILL.md +0 -96
- package/templates/default/locales/zh/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +0 -118
- package/templates/default/locales/zh/.mustflow/skills/line-ending-hygiene/SKILL.md +0 -111
- package/templates/default/locales/zh/.mustflow/skills/migration-safety-check/SKILL.md +0 -117
- package/templates/default/locales/zh/.mustflow/skills/multi-agent-work-coordination/SKILL.md +0 -260
- package/templates/default/locales/zh/.mustflow/skills/null-object-pattern/SKILL.md +0 -196
- package/templates/default/locales/zh/.mustflow/skills/pattern-scout/SKILL.md +0 -110
- package/templates/default/locales/zh/.mustflow/skills/performance-budget-check/SKILL.md +0 -121
- package/templates/default/locales/zh/.mustflow/skills/project-context-authoring/SKILL.md +0 -107
- package/templates/default/locales/zh/.mustflow/skills/pure-core-imperative-shell/SKILL.md +0 -212
- package/templates/default/locales/zh/.mustflow/skills/readme-authoring/SKILL.md +0 -115
- package/templates/default/locales/zh/.mustflow/skills/repo-improvement-loop/SKILL.md +0 -150
- package/templates/default/locales/zh/.mustflow/skills/repro-first-debug/SKILL.md +0 -112
- package/templates/default/locales/zh/.mustflow/skills/requirement-regression-guard/SKILL.md +0 -152
- package/templates/default/locales/zh/.mustflow/skills/result-option/SKILL.md +0 -186
- package/templates/default/locales/zh/.mustflow/skills/security-privacy-review/SKILL.md +0 -116
- package/templates/default/locales/zh/.mustflow/skills/security-regression-tests/SKILL.md +0 -131
- package/templates/default/locales/zh/.mustflow/skills/skill-authoring/SKILL.md +0 -110
- package/templates/default/locales/zh/.mustflow/skills/source-freshness-check/SKILL.md +0 -111
- package/templates/default/locales/zh/.mustflow/skills/state-machine-pattern/SKILL.md +0 -214
- package/templates/default/locales/zh/.mustflow/skills/strategy-pattern/SKILL.md +0 -215
- package/templates/default/locales/zh/.mustflow/skills/structure-discovery-gate/SKILL.md +0 -159
- package/templates/default/locales/zh/.mustflow/skills/test-design-guard/SKILL.md +0 -162
- package/templates/default/locales/zh/.mustflow/skills/test-maintenance/SKILL.md +0 -122
- package/templates/default/locales/zh/.mustflow/skills/ui-quality-gate/SKILL.md +0 -117
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/SKILL.md +0 -127
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/assets/review-template.html +0 -286
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/resources.toml +0 -7
- package/templates/default/locales/zh/.mustflow/skills/web-asset-optimization/SKILL.md +0 -108
package/dist/cli/commands/run.js
CHANGED
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import
|
|
3
|
-
import { runCheck } from './check.js';
|
|
4
|
-
import { runClassify } from './classify.js';
|
|
5
|
-
import { runContext } from './context.js';
|
|
6
|
-
import { runDoctor } from './doctor.js';
|
|
7
|
-
import { runHelp } from './help.js';
|
|
8
|
-
import { runImpact } from './impact.js';
|
|
9
|
-
import { runLineEndings } from './line-endings.js';
|
|
10
|
-
import { runMap } from './map.js';
|
|
11
|
-
import { runStatus } from './status.js';
|
|
12
|
-
import { runUpdate } from './update.js';
|
|
13
|
-
import { runVersionSources } from './version-sources.js';
|
|
1
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { performance } from 'node:perf_hooks';
|
|
14
3
|
import { canRunMustflowBuiltinInProcess, isMustflowBinName } from '../../core/command-classification.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
4
|
+
import { createCommandEnv } from '../../core/command-env.js';
|
|
5
|
+
import { BoundedOutputBuffer } from '../../core/bounded-output.js';
|
|
17
6
|
import { printUsageError, renderCliError, renderHelp } from '../lib/cli-output.js';
|
|
18
|
-
import {
|
|
7
|
+
import { readCommandContract, readMustflowConfigIfExists } from '../../core/config-loading.js';
|
|
19
8
|
import { resolveRunReceiptRetentionPolicy } from '../../core/retention-policy.js';
|
|
20
9
|
import { t } from '../lib/i18n.js';
|
|
21
10
|
import { getPackageVersion } from '../lib/package-info.js';
|
|
22
11
|
import { resolveMustflowRoot } from '../lib/project-root.js';
|
|
12
|
+
import { createRunPlan, createRunPreview, isMustflowBuiltinIntent, renderRunPreviewText, } from '../lib/run-plan.js';
|
|
23
13
|
import { createRunReceipt, writeRunReceipt } from '../../core/run-receipt.js';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return [0];
|
|
28
|
-
}
|
|
29
|
-
return value.map(Number);
|
|
30
|
-
}
|
|
14
|
+
import { recordRunPerformanceHistory } from '../../core/run-performance-history.js';
|
|
15
|
+
import { RunProfiler } from '../../core/run-profile.js';
|
|
16
|
+
import { finishRunWriteTracking, startRunWriteTracking } from '../../core/run-write-drift.js';
|
|
31
17
|
function emitOutput(reporter, output, stream) {
|
|
32
18
|
if (!output) {
|
|
33
19
|
return;
|
|
34
20
|
}
|
|
35
|
-
const text = output.toString().trimEnd();
|
|
21
|
+
const text = (typeof output === 'object' && 'tail' in output ? output.tail : output.toString()).trimEnd();
|
|
36
22
|
if (text.length === 0) {
|
|
37
23
|
return;
|
|
38
24
|
}
|
|
@@ -64,57 +50,6 @@ function terminateProcessTree(pid) {
|
|
|
64
50
|
function getKillMethod() {
|
|
65
51
|
return process.platform === 'win32' ? 'taskkill_process_tree' : 'process_group_sigterm';
|
|
66
52
|
}
|
|
67
|
-
function getPathEnvKey(env) {
|
|
68
|
-
return Object.keys(env).find((key) => key.toLowerCase() === 'path') ?? 'PATH';
|
|
69
|
-
}
|
|
70
|
-
function sameResolvedPath(left, right) {
|
|
71
|
-
const resolvedLeft = path.resolve(left);
|
|
72
|
-
const resolvedRight = path.resolve(right);
|
|
73
|
-
return process.platform === 'win32'
|
|
74
|
-
? resolvedLeft.toLowerCase() === resolvedRight.toLowerCase()
|
|
75
|
-
: resolvedLeft === resolvedRight;
|
|
76
|
-
}
|
|
77
|
-
function createCommandEnv(projectRoot) {
|
|
78
|
-
const env = { ...process.env };
|
|
79
|
-
const pathKey = getPathEnvKey(env);
|
|
80
|
-
const localBinPath = path.join(projectRoot, 'node_modules', '.bin');
|
|
81
|
-
const currentPath = env[pathKey];
|
|
82
|
-
if (currentPath) {
|
|
83
|
-
env[pathKey] = currentPath
|
|
84
|
-
.split(path.delimiter)
|
|
85
|
-
.filter((entry) => entry.length > 0 && !sameResolvedPath(entry, localBinPath))
|
|
86
|
-
.join(path.delimiter);
|
|
87
|
-
}
|
|
88
|
-
return env;
|
|
89
|
-
}
|
|
90
|
-
function shouldUseShellForArgvExecutable(executablePath) {
|
|
91
|
-
return process.platform === 'win32' && executablePath.toLowerCase().endsWith('.cmd');
|
|
92
|
-
}
|
|
93
|
-
function isMustflowBuiltinIntent(intent) {
|
|
94
|
-
return readString(intent, 'kind') === 'mustflow_builtin';
|
|
95
|
-
}
|
|
96
|
-
function resolveCurrentCliEntrypoint() {
|
|
97
|
-
const entrypoint = process.argv[1];
|
|
98
|
-
return entrypoint ? path.resolve(entrypoint) : undefined;
|
|
99
|
-
}
|
|
100
|
-
function resolveArgvCommand(intent, commandArgv) {
|
|
101
|
-
const [command = '', ...args] = commandArgv;
|
|
102
|
-
if (isMustflowBuiltinIntent(intent) && isMustflowBinName(command)) {
|
|
103
|
-
const entrypoint = resolveCurrentCliEntrypoint();
|
|
104
|
-
if (entrypoint) {
|
|
105
|
-
return {
|
|
106
|
-
executable: process.execPath,
|
|
107
|
-
args: [entrypoint, ...args],
|
|
108
|
-
shell: false,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
executable: command,
|
|
114
|
-
args,
|
|
115
|
-
shell: shouldUseShellForArgvExecutable(command),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
53
|
function createBufferedReporter() {
|
|
119
54
|
const stdout = [];
|
|
120
55
|
const stderr = [];
|
|
@@ -152,37 +87,37 @@ async function runKnownBuiltinCommand(args, reporter, lang) {
|
|
|
152
87
|
return undefined;
|
|
153
88
|
}
|
|
154
89
|
if (command === 'check') {
|
|
155
|
-
return runCheck(commandArgs, reporter, lang);
|
|
90
|
+
return (await import('./check.js')).runCheck(commandArgs, reporter, lang);
|
|
156
91
|
}
|
|
157
92
|
if (command === 'classify') {
|
|
158
|
-
return runClassify(commandArgs, reporter, lang);
|
|
93
|
+
return (await import('./classify.js')).runClassify(commandArgs, reporter, lang);
|
|
159
94
|
}
|
|
160
95
|
if (command === 'context') {
|
|
161
|
-
return runContext(commandArgs, reporter, lang);
|
|
96
|
+
return (await import('./context.js')).runContext(commandArgs, reporter, lang);
|
|
162
97
|
}
|
|
163
98
|
if (command === 'doctor') {
|
|
164
|
-
return runDoctor(commandArgs, reporter, lang);
|
|
99
|
+
return (await import('./doctor.js')).runDoctor(commandArgs, reporter, lang);
|
|
165
100
|
}
|
|
166
101
|
if (command === 'help') {
|
|
167
|
-
return runHelp(commandArgs, reporter, lang);
|
|
102
|
+
return (await import('./help.js')).runHelp(commandArgs, reporter, lang);
|
|
168
103
|
}
|
|
169
104
|
if (command === 'impact') {
|
|
170
|
-
return runImpact(commandArgs, reporter, lang);
|
|
105
|
+
return (await import('./impact.js')).runImpact(commandArgs, reporter, lang);
|
|
171
106
|
}
|
|
172
107
|
if (command === 'line-endings') {
|
|
173
|
-
return runLineEndings(commandArgs, reporter, lang);
|
|
108
|
+
return (await import('./line-endings.js')).runLineEndings(commandArgs, reporter, lang);
|
|
174
109
|
}
|
|
175
110
|
if (command === 'map') {
|
|
176
|
-
return runMap(commandArgs, reporter, lang);
|
|
111
|
+
return (await import('./map.js')).runMap(commandArgs, reporter, lang);
|
|
177
112
|
}
|
|
178
113
|
if (command === 'status') {
|
|
179
|
-
return runStatus(commandArgs, reporter, lang);
|
|
114
|
+
return (await import('./status.js')).runStatus(commandArgs, reporter, lang);
|
|
180
115
|
}
|
|
181
116
|
if (command === 'update') {
|
|
182
|
-
return runUpdate(commandArgs, reporter, lang);
|
|
117
|
+
return (await import('./update.js')).runUpdate(commandArgs, reporter, lang);
|
|
183
118
|
}
|
|
184
119
|
if (command === 'version-sources') {
|
|
185
|
-
return runVersionSources(commandArgs, reporter, lang);
|
|
120
|
+
return (await import('./version-sources.js')).runVersionSources(commandArgs, reporter, lang);
|
|
186
121
|
}
|
|
187
122
|
return undefined;
|
|
188
123
|
}
|
|
@@ -237,6 +172,76 @@ function runArgvCommand(command, cwd, maxOutputBytes, env, timeoutSeconds) {
|
|
|
237
172
|
windowsHide: true,
|
|
238
173
|
});
|
|
239
174
|
}
|
|
175
|
+
function writeStreamChunk(reporter, stream, chunk) {
|
|
176
|
+
if (stream === 'stdout') {
|
|
177
|
+
if (reporter.writeStdout) {
|
|
178
|
+
reporter.writeStdout(chunk);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
reporter.stdout(chunk.toString().trimEnd());
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (reporter.writeStderr) {
|
|
185
|
+
reporter.writeStderr(chunk);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
reporter.stderr(chunk.toString().trimEnd());
|
|
189
|
+
}
|
|
190
|
+
function runArgvCommandStreaming(command, cwd, env, timeoutSeconds, stdoutTailBytes, stderrTailBytes, reporter) {
|
|
191
|
+
return new Promise((resolve) => {
|
|
192
|
+
const stdout = new BoundedOutputBuffer(stdoutTailBytes);
|
|
193
|
+
const stderr = new BoundedOutputBuffer(stderrTailBytes);
|
|
194
|
+
let settled = false;
|
|
195
|
+
let timedOut = false;
|
|
196
|
+
let childError;
|
|
197
|
+
let childPid;
|
|
198
|
+
let timeout;
|
|
199
|
+
const child = spawn(command?.executable ?? '', command?.args ?? [], {
|
|
200
|
+
cwd,
|
|
201
|
+
env,
|
|
202
|
+
shell: command?.shell ?? false,
|
|
203
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
204
|
+
windowsHide: true,
|
|
205
|
+
detached: process.platform !== 'win32',
|
|
206
|
+
});
|
|
207
|
+
childPid = child.pid;
|
|
208
|
+
const finish = (status, signal) => {
|
|
209
|
+
if (settled) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
settled = true;
|
|
213
|
+
if (timeout) {
|
|
214
|
+
clearTimeout(timeout);
|
|
215
|
+
}
|
|
216
|
+
resolve({
|
|
217
|
+
status,
|
|
218
|
+
signal,
|
|
219
|
+
error: timedOut ? Object.assign(new Error('Command timed out'), { code: 'ETIMEDOUT' }) : childError,
|
|
220
|
+
stdout: stdout.toSnapshot(),
|
|
221
|
+
stderr: stderr.toSnapshot(),
|
|
222
|
+
pid: childPid,
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
child.stdout?.on('data', (chunk) => {
|
|
226
|
+
stdout.append(chunk);
|
|
227
|
+
writeStreamChunk(reporter, 'stdout', chunk);
|
|
228
|
+
});
|
|
229
|
+
child.stderr?.on('data', (chunk) => {
|
|
230
|
+
stderr.append(chunk);
|
|
231
|
+
writeStreamChunk(reporter, 'stderr', chunk);
|
|
232
|
+
});
|
|
233
|
+
child.once('error', (error) => {
|
|
234
|
+
childError = error;
|
|
235
|
+
});
|
|
236
|
+
child.once('close', (status, signal) => {
|
|
237
|
+
finish(status, signal);
|
|
238
|
+
});
|
|
239
|
+
timeout = setTimeout(() => {
|
|
240
|
+
timedOut = true;
|
|
241
|
+
terminateProcessTree(childPid);
|
|
242
|
+
}, timeoutSeconds * 1000);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
240
245
|
function runShellCommand(command, cwd, maxOutputBytes, env, timeoutSeconds) {
|
|
241
246
|
return spawnSync(command ?? '', {
|
|
242
247
|
cwd,
|
|
@@ -250,6 +255,61 @@ function runShellCommand(command, cwd, maxOutputBytes, env, timeoutSeconds) {
|
|
|
250
255
|
windowsHide: true,
|
|
251
256
|
});
|
|
252
257
|
}
|
|
258
|
+
function runShellCommandStreaming(command, cwd, env, timeoutSeconds, stdoutTailBytes, stderrTailBytes, reporter) {
|
|
259
|
+
return new Promise((resolve) => {
|
|
260
|
+
const stdout = new BoundedOutputBuffer(stdoutTailBytes);
|
|
261
|
+
const stderr = new BoundedOutputBuffer(stderrTailBytes);
|
|
262
|
+
let settled = false;
|
|
263
|
+
let timedOut = false;
|
|
264
|
+
let childError;
|
|
265
|
+
let childPid;
|
|
266
|
+
let timeout;
|
|
267
|
+
const child = spawn(command ?? '', {
|
|
268
|
+
cwd,
|
|
269
|
+
env,
|
|
270
|
+
shell: true,
|
|
271
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
272
|
+
windowsHide: true,
|
|
273
|
+
detached: process.platform !== 'win32',
|
|
274
|
+
});
|
|
275
|
+
childPid = child.pid;
|
|
276
|
+
const finish = (status, signal) => {
|
|
277
|
+
if (settled) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
settled = true;
|
|
281
|
+
if (timeout) {
|
|
282
|
+
clearTimeout(timeout);
|
|
283
|
+
}
|
|
284
|
+
resolve({
|
|
285
|
+
status,
|
|
286
|
+
signal,
|
|
287
|
+
error: timedOut ? Object.assign(new Error('Command timed out'), { code: 'ETIMEDOUT' }) : childError,
|
|
288
|
+
stdout: stdout.toSnapshot(),
|
|
289
|
+
stderr: stderr.toSnapshot(),
|
|
290
|
+
pid: childPid,
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
child.stdout?.on('data', (chunk) => {
|
|
294
|
+
stdout.append(chunk);
|
|
295
|
+
writeStreamChunk(reporter, 'stdout', chunk);
|
|
296
|
+
});
|
|
297
|
+
child.stderr?.on('data', (chunk) => {
|
|
298
|
+
stderr.append(chunk);
|
|
299
|
+
writeStreamChunk(reporter, 'stderr', chunk);
|
|
300
|
+
});
|
|
301
|
+
child.once('error', (error) => {
|
|
302
|
+
childError = error;
|
|
303
|
+
});
|
|
304
|
+
child.once('close', (status, signal) => {
|
|
305
|
+
finish(status, signal);
|
|
306
|
+
});
|
|
307
|
+
timeout = setTimeout(() => {
|
|
308
|
+
timedOut = true;
|
|
309
|
+
terminateProcessTree(childPid);
|
|
310
|
+
}, timeoutSeconds * 1000);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
253
313
|
function getRunStatus(error, exitCode, successExitCodes) {
|
|
254
314
|
const errorWithCode = error;
|
|
255
315
|
if (errorWithCode?.code === 'ETIMEDOUT') {
|
|
@@ -260,15 +320,66 @@ function getRunStatus(error, exitCode, successExitCodes) {
|
|
|
260
320
|
}
|
|
261
321
|
return exitCode !== null && successExitCodes.includes(exitCode) ? 'passed' : 'failed';
|
|
262
322
|
}
|
|
323
|
+
function getRunPlanDetail(plan, lang, fallbackKey) {
|
|
324
|
+
return plan.detail ?? t(lang, fallbackKey);
|
|
325
|
+
}
|
|
326
|
+
function reportRunPlanFailure(plan, reporter, lang) {
|
|
327
|
+
let message;
|
|
328
|
+
switch (plan.reasonCode) {
|
|
329
|
+
case 'status_not_configured':
|
|
330
|
+
message = t(lang, 'run.error.statusNotConfigured', { intent: plan.intentName, status: plan.intentStatus ?? 'unknown' });
|
|
331
|
+
break;
|
|
332
|
+
case 'lifecycle_not_oneshot':
|
|
333
|
+
message = t(lang, 'run.error.lifecycleNotOneshot', { intent: plan.intentName, lifecycle: plan.lifecycle ?? 'unknown' });
|
|
334
|
+
break;
|
|
335
|
+
case 'run_policy_not_agent_allowed':
|
|
336
|
+
message = t(lang, 'run.error.runPolicy', { intent: plan.intentName });
|
|
337
|
+
break;
|
|
338
|
+
case 'stdin_not_closed':
|
|
339
|
+
message = t(lang, 'run.error.stdin', { intent: plan.intentName });
|
|
340
|
+
break;
|
|
341
|
+
case 'missing_timeout':
|
|
342
|
+
message = t(lang, 'run.error.timeout', { intent: plan.intentName });
|
|
343
|
+
break;
|
|
344
|
+
case 'missing_command_source':
|
|
345
|
+
message = t(lang, 'run.error.commandSource', { intent: plan.intentName });
|
|
346
|
+
break;
|
|
347
|
+
case 'unsafe_intent_name':
|
|
348
|
+
message = t(lang, 'run.error.unsafeIntent', {
|
|
349
|
+
intent: plan.intentName,
|
|
350
|
+
detail: getRunPlanDetail(plan, lang, 'run.error.unsafeIntentDetail'),
|
|
351
|
+
});
|
|
352
|
+
break;
|
|
353
|
+
case 'blocked_shell_background_pattern':
|
|
354
|
+
message = t(lang, 'run.error.blockedShellBackground', {
|
|
355
|
+
intent: plan.intentName,
|
|
356
|
+
detail: getRunPlanDetail(plan, lang, 'run.error.blockedShellBackgroundDetail'),
|
|
357
|
+
});
|
|
358
|
+
break;
|
|
359
|
+
case 'cwd_outside_project':
|
|
360
|
+
message = t(lang, 'run.error.cwdOutsideProject', {
|
|
361
|
+
intent: plan.intentName,
|
|
362
|
+
detail: getRunPlanDetail(plan, lang, 'run.error.cwdOutsideProjectDetail'),
|
|
363
|
+
});
|
|
364
|
+
break;
|
|
365
|
+
case 'intent_not_table':
|
|
366
|
+
default:
|
|
367
|
+
message = t(lang, 'run.error.unknownIntent', { intent: plan.intentName });
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
reporter.stderr(renderCliError(message, 'mf help commands', lang));
|
|
371
|
+
}
|
|
263
372
|
export function getRunHelp(lang = 'en') {
|
|
264
373
|
return renderHelp({
|
|
265
374
|
usage: 'mf run <intent> [options]',
|
|
266
375
|
summary: t(lang, 'run.help.summary'),
|
|
267
376
|
options: [
|
|
377
|
+
{ label: '--dry-run', description: t(lang, 'run.help.option.dryRun') },
|
|
378
|
+
{ label: '--plan-only', description: t(lang, 'run.help.option.planOnly') },
|
|
268
379
|
{ label: '--json', description: t(lang, 'run.help.option.json') },
|
|
269
380
|
{ label: '-h, --help', description: t(lang, 'cli.option.help') },
|
|
270
381
|
],
|
|
271
|
-
examples: ['mf run test', 'mf run lint --json', 'mf run mustflow_check'],
|
|
382
|
+
examples: ['mf run test', 'mf run lint --json', 'mf run mustflow_check --dry-run --json'],
|
|
272
383
|
exitCodes: [
|
|
273
384
|
{
|
|
274
385
|
label: '0',
|
|
@@ -288,18 +399,27 @@ export function getRunHelp(lang = 'en') {
|
|
|
288
399
|
* invariant: Execution requires configured status, oneshot lifecycle, agent_allowed policy, and closed stdin.
|
|
289
400
|
* risk: config, security, state
|
|
290
401
|
*/
|
|
291
|
-
export async function runRun(args, reporter, lang = 'en') {
|
|
402
|
+
export async function runRun(args, reporter, lang = 'en', options = {}) {
|
|
403
|
+
const executorStartedAtMs = performance.now();
|
|
404
|
+
const profiler = new RunProfiler();
|
|
292
405
|
if (args.includes('--help') || args.includes('-h')) {
|
|
293
406
|
reporter.stdout(getRunHelp(lang));
|
|
294
407
|
return 0;
|
|
295
408
|
}
|
|
296
|
-
const supportedOptions = new Set(['--json']);
|
|
409
|
+
const supportedOptions = new Set(['--json', '--dry-run', '--plan-only']);
|
|
297
410
|
const unsupported = args.filter((arg) => arg.startsWith('-') && !supportedOptions.has(arg));
|
|
298
411
|
if (unsupported.length > 0) {
|
|
299
412
|
printUsageError(reporter, t(lang, 'cli.error.unknownOption', { option: unsupported[0] }), 'mf run --help', getRunHelp(lang), lang);
|
|
300
413
|
return 1;
|
|
301
414
|
}
|
|
302
415
|
const json = args.includes('--json');
|
|
416
|
+
const dryRun = args.includes('--dry-run');
|
|
417
|
+
const planOnly = args.includes('--plan-only');
|
|
418
|
+
const previewMode = dryRun ? 'dry-run' : planOnly ? 'plan-only' : null;
|
|
419
|
+
if (dryRun && planOnly) {
|
|
420
|
+
printUsageError(reporter, t(lang, 'run.error.conflictingPreviewModes'), 'mf run --help', getRunHelp(lang), lang);
|
|
421
|
+
return 1;
|
|
422
|
+
}
|
|
303
423
|
const positional = args.filter((arg) => !supportedOptions.has(arg));
|
|
304
424
|
const [intentName, ...extra] = positional;
|
|
305
425
|
if (!intentName) {
|
|
@@ -310,121 +430,135 @@ export async function runRun(args, reporter, lang = 'en') {
|
|
|
310
430
|
printUsageError(reporter, t(lang, 'cli.error.unexpectedArgument', { argument: extra[0] }), 'mf run --help', getRunHelp(lang), lang);
|
|
311
431
|
return 1;
|
|
312
432
|
}
|
|
313
|
-
const projectRoot = resolveMustflowRoot();
|
|
314
|
-
const contract = readCommandContract(projectRoot);
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
433
|
+
const projectRoot = profiler.measure('root_detection', () => resolveMustflowRoot());
|
|
434
|
+
const contract = profiler.measure('command_contract', () => readCommandContract(projectRoot));
|
|
435
|
+
const plan = profiler.measure('plan_creation', () => createRunPlan(projectRoot, contract, intentName, { testTargets: options.testTargets }));
|
|
436
|
+
if (previewMode) {
|
|
437
|
+
profiler.measure('preview_render', () => {
|
|
438
|
+
if (json) {
|
|
439
|
+
reporter.stdout(JSON.stringify(createRunPreview(plan, previewMode), null, 2));
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
reporter.stdout(renderRunPreviewText(plan, previewMode));
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
profiler.writeLatest({
|
|
446
|
+
projectRoot,
|
|
447
|
+
intent: intentName,
|
|
448
|
+
status: plan.ok ? 'previewed' : 'blocked',
|
|
449
|
+
previewMode,
|
|
450
|
+
});
|
|
451
|
+
return plan.ok ? 0 : 1;
|
|
452
|
+
}
|
|
453
|
+
if (!plan.ok) {
|
|
454
|
+
reportRunPlanFailure(plan, reporter, lang);
|
|
455
|
+
profiler.writeLatest({
|
|
456
|
+
projectRoot,
|
|
457
|
+
intent: intentName,
|
|
458
|
+
status: 'blocked',
|
|
459
|
+
previewMode: null,
|
|
460
|
+
});
|
|
319
461
|
return 1;
|
|
320
462
|
}
|
|
321
|
-
const
|
|
322
|
-
const
|
|
323
|
-
const
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return 1;
|
|
338
|
-
}
|
|
339
|
-
if (eligibility.code === 'stdin_not_closed') {
|
|
340
|
-
reporter.stderr(renderCliError(t(lang, 'run.error.stdin', { intent: intentName }), 'mf help commands', lang));
|
|
341
|
-
return 1;
|
|
342
|
-
}
|
|
343
|
-
if (eligibility.code === 'missing_timeout') {
|
|
344
|
-
reporter.stderr(renderCliError(t(lang, 'run.error.timeout', { intent: intentName }), 'mf help commands', lang));
|
|
345
|
-
return 1;
|
|
346
|
-
}
|
|
347
|
-
if (eligibility.code === 'missing_command_source') {
|
|
348
|
-
reporter.stderr(renderCliError(t(lang, 'run.error.commandSource', { intent: intentName }), 'mf help commands', lang));
|
|
349
|
-
return 1;
|
|
463
|
+
const runReceiptPolicy = profiler.measure('retention_policy', () => resolveRunReceiptRetentionPolicy(readMustflowConfigIfExists(projectRoot)));
|
|
464
|
+
const env = profiler.measure('environment', () => createCommandEnv(projectRoot, { policy: plan.envPolicy, allowlist: plan.envAllowlist }));
|
|
465
|
+
const lifecycleValue = plan.lifecycle ?? 'oneshot';
|
|
466
|
+
const runPolicyValue = plan.runPolicy ?? 'agent_allowed';
|
|
467
|
+
const writeTracker = profiler.measure('write_drift_before', () => startRunWriteTracking(projectRoot, contract, intentName));
|
|
468
|
+
const stdoutTailBytes = Math.min(runReceiptPolicy.stdoutTailBytes, plan.maxOutputBytes);
|
|
469
|
+
const stderrTailBytes = Math.min(runReceiptPolicy.stderrTailBytes, plan.maxOutputBytes);
|
|
470
|
+
let streamedOutput = false;
|
|
471
|
+
const childStartedAtMs = performance.now();
|
|
472
|
+
const startedAt = new Date();
|
|
473
|
+
const result = await profiler.measureAsync('child_command', async () => {
|
|
474
|
+
if (plan.commandArgv && isMustflowBuiltinIntent(plan.intent)) {
|
|
475
|
+
const builtinResult = await runBuiltinArgvInProcess(plan.commandArgv, plan.cwd, lang);
|
|
476
|
+
if (builtinResult) {
|
|
477
|
+
return builtinResult;
|
|
478
|
+
}
|
|
350
479
|
}
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
480
|
+
if (plan.commandArgv) {
|
|
481
|
+
if (!json) {
|
|
482
|
+
streamedOutput = true;
|
|
483
|
+
return runArgvCommandStreaming(plan.argvCommand, plan.cwd, env, plan.timeoutSeconds, stdoutTailBytes, stderrTailBytes, reporter);
|
|
484
|
+
}
|
|
485
|
+
return runArgvCommand(plan.argvCommand, plan.cwd, plan.maxOutputBytes, env, plan.timeoutSeconds);
|
|
354
486
|
}
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
return
|
|
487
|
+
if (!json) {
|
|
488
|
+
streamedOutput = true;
|
|
489
|
+
return runShellCommandStreaming(plan.shellCommand, plan.cwd, env, plan.timeoutSeconds, stdoutTailBytes, stderrTailBytes, reporter);
|
|
358
490
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const maxOutputBytes = readPositiveInteger(intent, 'max_output_bytes') ?? readPositiveInteger(contract.defaults, 'max_output_bytes') ?? 1_048_576;
|
|
363
|
-
if (!timeoutSeconds) {
|
|
364
|
-
reporter.stderr(renderCliError(t(lang, 'run.error.timeout', { intent: intentName }), 'mf help commands', lang));
|
|
365
|
-
return 1;
|
|
366
|
-
}
|
|
367
|
-
const cwd = resolveSafeProjectCwd(projectRoot, readString(intent, 'cwd') ?? readString(contract.defaults, 'default_cwd'));
|
|
368
|
-
const successExitCodes = getSuccessExitCodes(intent);
|
|
369
|
-
const argv = readStringArray(intent, 'argv');
|
|
370
|
-
const commandArgv = argv && argv.length > 0 ? argv : undefined;
|
|
371
|
-
const shellCommand = intent.mode === 'shell' ? readString(intent, 'cmd') : undefined;
|
|
372
|
-
const env = createCommandEnv(projectRoot);
|
|
373
|
-
const lifecycleValue = lifecycle ?? 'oneshot';
|
|
374
|
-
const runPolicyValue = runPolicy ?? 'agent_allowed';
|
|
375
|
-
const mode = commandArgv ? 'argv' : 'shell';
|
|
376
|
-
const startedAt = new Date();
|
|
377
|
-
const argvCommand = commandArgv ? resolveArgvCommand(intent, commandArgv) : undefined;
|
|
378
|
-
const result = commandArgv && isMustflowBuiltinIntent(intent)
|
|
379
|
-
? ((await runBuiltinArgvInProcess(commandArgv, cwd, lang)) ??
|
|
380
|
-
runArgvCommand(argvCommand, cwd, maxOutputBytes, env, timeoutSeconds))
|
|
381
|
-
: commandArgv
|
|
382
|
-
? runArgvCommand(argvCommand, cwd, maxOutputBytes, env, timeoutSeconds)
|
|
383
|
-
: runShellCommand(shellCommand, cwd, maxOutputBytes, env, timeoutSeconds);
|
|
491
|
+
return runShellCommand(plan.shellCommand, plan.cwd, plan.maxOutputBytes, env, plan.timeoutSeconds);
|
|
492
|
+
});
|
|
493
|
+
const childDurationMs = performance.now() - childStartedAtMs;
|
|
384
494
|
const finishedAt = new Date();
|
|
495
|
+
const writeDrift = profiler.measure('write_drift_after', () => finishRunWriteTracking(writeTracker));
|
|
385
496
|
const exitCode = typeof result.status === 'number' ? result.status : null;
|
|
386
|
-
const runStatus = getRunStatus(result.error, exitCode, successExitCodes);
|
|
497
|
+
const runStatus = getRunStatus(result.error, exitCode, plan.successExitCodes);
|
|
387
498
|
let killMethod = null;
|
|
388
499
|
if (runStatus === 'timed_out') {
|
|
389
500
|
killMethod = getKillMethod();
|
|
390
501
|
terminateProcessTree(result.pid);
|
|
391
502
|
}
|
|
392
|
-
const receipt = createRunReceipt({
|
|
503
|
+
const receipt = profiler.measure('receipt_create', () => createRunReceipt({
|
|
393
504
|
intent: intentName,
|
|
394
505
|
status: runStatus,
|
|
395
506
|
timedOut: runStatus === 'timed_out',
|
|
396
507
|
startedAt,
|
|
397
508
|
finishedAt,
|
|
398
509
|
projectRoot,
|
|
399
|
-
cwd,
|
|
510
|
+
cwd: plan.cwd,
|
|
400
511
|
lifecycle: lifecycleValue,
|
|
401
512
|
runPolicy: runPolicyValue,
|
|
402
|
-
mode,
|
|
403
|
-
argv: commandArgv,
|
|
404
|
-
cmd: shellCommand,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
513
|
+
mode: plan.mode,
|
|
514
|
+
argv: plan.commandArgv,
|
|
515
|
+
cmd: plan.shellCommand,
|
|
516
|
+
envPolicy: plan.envPolicy,
|
|
517
|
+
envAllowlist: plan.envAllowlist,
|
|
518
|
+
timeoutSeconds: plan.timeoutSeconds,
|
|
519
|
+
maxOutputBytes: plan.maxOutputBytes,
|
|
520
|
+
successExitCodes: plan.successExitCodes,
|
|
408
521
|
exitCode,
|
|
409
522
|
signal: result.signal,
|
|
410
523
|
error: result.error?.message ?? null,
|
|
411
524
|
killMethod,
|
|
412
525
|
stdout: result.stdout,
|
|
413
526
|
stderr: result.stderr,
|
|
527
|
+
writeDrift,
|
|
528
|
+
executorOverheadMs: Math.max(0, Math.round((performance.now() - executorStartedAtMs - childDurationMs) * 1000) / 1000),
|
|
529
|
+
phaseTimings: profiler.getReceiptPhases(),
|
|
530
|
+
selectionSummary: {
|
|
531
|
+
strategy: plan.testTargets.length > 0 ? 'project_test_selection' : 'direct_intent',
|
|
532
|
+
changed_file_count: 0,
|
|
533
|
+
changed_surface_counts: {},
|
|
534
|
+
selected_target_count: Math.max(1, plan.testTargets.length),
|
|
535
|
+
fallback_used: false,
|
|
536
|
+
},
|
|
414
537
|
stdoutTailBytes: runReceiptPolicy.stdoutTailBytes,
|
|
415
538
|
stderrTailBytes: runReceiptPolicy.stderrTailBytes,
|
|
539
|
+
}));
|
|
540
|
+
if (options.writeLatestReceipt !== false) {
|
|
541
|
+
profiler.measure('receipt_write', () => writeRunReceipt(projectRoot, receipt));
|
|
542
|
+
}
|
|
543
|
+
profiler.measure('performance_history_write', () => recordRunPerformanceHistory(projectRoot, receipt));
|
|
544
|
+
profiler.writeLatest({
|
|
545
|
+
projectRoot,
|
|
546
|
+
intent: intentName,
|
|
547
|
+
status: runStatus,
|
|
548
|
+
previewMode: null,
|
|
416
549
|
});
|
|
417
|
-
writeRunReceipt(projectRoot, receipt);
|
|
418
550
|
if (json) {
|
|
419
551
|
reporter.stdout(JSON.stringify(receipt, null, 2));
|
|
420
552
|
return runStatus === 'passed' ? 0 : 1;
|
|
421
553
|
}
|
|
422
|
-
|
|
423
|
-
|
|
554
|
+
if (!streamedOutput) {
|
|
555
|
+
emitOutput(reporter, result.stdout, 'stdout');
|
|
556
|
+
emitOutput(reporter, result.stderr, 'stderr');
|
|
557
|
+
}
|
|
424
558
|
if (result.error) {
|
|
425
559
|
const errorWithCode = result.error;
|
|
426
560
|
if (errorWithCode.code === 'ETIMEDOUT') {
|
|
427
|
-
reporter.stderr(t(lang, 'run.error.timedOut', { intent: intentName, seconds: timeoutSeconds }));
|
|
561
|
+
reporter.stderr(t(lang, 'run.error.timedOut', { intent: intentName, seconds: plan.timeoutSeconds }));
|
|
428
562
|
return 1;
|
|
429
563
|
}
|
|
430
564
|
reporter.stderr(t(lang, 'run.error.startFailed', { intent: intentName, message: result.error.message }));
|