mustflow 1.15.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -0
- package/README.md +422 -0
- package/dist/cli/commands/check.js +73 -0
- package/dist/cli/commands/classify.js +104 -0
- package/dist/cli/commands/context.js +95 -0
- package/dist/cli/commands/contract-lint.js +74 -0
- package/dist/cli/commands/dashboard.js +654 -0
- package/dist/cli/commands/docs.js +382 -0
- package/dist/cli/commands/doctor.js +232 -0
- package/dist/cli/commands/explain.js +293 -0
- package/dist/cli/commands/help.js +148 -0
- package/dist/cli/commands/impact.js +120 -0
- package/dist/cli/commands/index.js +70 -0
- package/dist/cli/commands/init.js +986 -0
- package/dist/cli/commands/line-endings.js +102 -0
- package/dist/cli/commands/map.js +95 -0
- package/dist/cli/commands/run.js +442 -0
- package/dist/cli/commands/search.js +166 -0
- package/dist/cli/commands/status.js +65 -0
- package/dist/cli/commands/update.js +443 -0
- package/dist/cli/commands/verify.js +448 -0
- package/dist/cli/commands/version-sources.js +79 -0
- package/dist/cli/commands/version.js +57 -0
- package/dist/cli/i18n/en.js +702 -0
- package/dist/cli/i18n/es.js +702 -0
- package/dist/cli/i18n/fr.js +702 -0
- package/dist/cli/i18n/hi.js +702 -0
- package/dist/cli/i18n/ko.js +702 -0
- package/dist/cli/i18n/zh.js +702 -0
- package/dist/cli/index.js +218 -0
- package/dist/cli/lib/agent-context.js +342 -0
- package/dist/cli/lib/browser-open.js +58 -0
- package/dist/cli/lib/cli-output.js +36 -0
- package/dist/cli/lib/command-contract.js +1 -0
- package/dist/cli/lib/command-registry.js +107 -0
- package/dist/cli/lib/dashboard-html.js +1866 -0
- package/dist/cli/lib/dashboard-locale.js +309 -0
- package/dist/cli/lib/dashboard-preferences.js +405 -0
- package/dist/cli/lib/doc-review-ledger.js +226 -0
- package/dist/cli/lib/filesystem.js +125 -0
- package/dist/cli/lib/git-changes.js +13 -0
- package/dist/cli/lib/i18n.js +55 -0
- package/dist/cli/lib/local-index.js +1014 -0
- package/dist/cli/lib/locale-tags.js +4 -0
- package/dist/cli/lib/manifest-lock.js +131 -0
- package/dist/cli/lib/npm-version-check.js +97 -0
- package/dist/cli/lib/package-info.js +13 -0
- package/dist/cli/lib/preferences-options.js +8 -0
- package/dist/cli/lib/project-root.js +23 -0
- package/dist/cli/lib/repo-map.js +635 -0
- package/dist/cli/lib/reporter.js +8 -0
- package/dist/cli/lib/run-receipt.js +1 -0
- package/dist/cli/lib/template-i18n.js +265 -0
- package/dist/cli/lib/templates.js +188 -0
- package/dist/cli/lib/toml.js +1 -0
- package/dist/cli/lib/validation.js +1639 -0
- package/dist/cli/lib/version-sources.js +1 -0
- package/dist/core/authority-resolution.js +155 -0
- package/dist/core/change-classification.js +122 -0
- package/dist/core/change-verification.js +80 -0
- package/dist/core/check-issues.js +67 -0
- package/dist/core/command-classification.js +22 -0
- package/dist/core/command-contract-rules.js +27 -0
- package/dist/core/command-contract-validation.js +197 -0
- package/dist/core/command-cwd.js +12 -0
- package/dist/core/command-effects.js +182 -0
- package/dist/core/command-explanation.js +135 -0
- package/dist/core/command-intent-eligibility.js +76 -0
- package/dist/core/config-loading.js +54 -0
- package/dist/core/contract-lint.js +110 -0
- package/dist/core/contract-models.js +53 -0
- package/dist/core/dashboard-verification.js +132 -0
- package/dist/core/doc-review-triage.js +92 -0
- package/dist/core/line-endings.js +144 -0
- package/dist/core/public-json-contracts.js +112 -0
- package/dist/core/public-surface-explanation.js +49 -0
- package/dist/core/release-version-validation.js +53 -0
- package/dist/core/retention-explanation.js +74 -0
- package/dist/core/retention-policy.js +57 -0
- package/dist/core/run-receipt.js +77 -0
- package/dist/core/skill-route-alignment.js +100 -0
- package/dist/core/skill-route-explanation.js +117 -0
- package/dist/core/source-anchor-explanation.js +33 -0
- package/dist/core/source-anchor-status.js +269 -0
- package/dist/core/source-anchor-symbols.js +181 -0
- package/dist/core/source-anchor-validation.js +158 -0
- package/dist/core/source-anchors.js +194 -0
- package/dist/core/surface-decision-model.js +18 -0
- package/dist/core/toml.js +11 -0
- package/dist/core/verification-plan.js +41 -0
- package/dist/core/verification-scheduler.js +92 -0
- package/dist/core/version-impact.js +54 -0
- package/dist/core/version-sources.js +235 -0
- package/dist/core/version-sync-policy.js +85 -0
- package/examples/README.md +13 -0
- package/examples/docs-only/README.md +72 -0
- package/examples/host-instruction-conflicts/README.md +47 -0
- package/examples/minimal-js/README.md +98 -0
- package/examples/missing-command-contracts/README.md +70 -0
- package/examples/nested-repos/README.md +62 -0
- package/package.json +80 -0
- package/schemas/README.md +32 -0
- package/schemas/change-verification-report.schema.json +319 -0
- package/schemas/classify-report.schema.json +113 -0
- package/schemas/commands.schema.json +116 -0
- package/schemas/context-report.schema.json +341 -0
- package/schemas/contract-lint-report.schema.json +61 -0
- package/schemas/docs-review-list.schema.json +72 -0
- package/schemas/doctor-report.schema.json +175 -0
- package/schemas/explain-report.schema.json +471 -0
- package/schemas/impact-report.schema.json +121 -0
- package/schemas/line-endings-report.schema.json +63 -0
- package/schemas/run-receipt.schema.json +75 -0
- package/schemas/verify-report.schema.json +67 -0
- package/schemas/version-sources-report.schema.json +42 -0
- package/templates/default/common/.mustflow/config/commands.toml +251 -0
- package/templates/default/common/.mustflow/config/mustflow.toml +424 -0
- package/templates/default/common/.mustflow/config/preferences.toml +125 -0
- package/templates/default/common/gitignore.mustflow +9 -0
- package/templates/default/i18n.toml +483 -0
- package/templates/default/locales/en/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/en/.mustflow/context/PROJECT.md +66 -0
- package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +345 -0
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/en/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/en/.mustflow/skills/artifact-integrity-check/SKILL.md +121 -0
- package/templates/default/locales/en/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/en/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/en/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/en/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/en/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/en/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/en/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/diff-risk-review/SKILL.md +143 -0
- package/templates/default/locales/en/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/en/.mustflow/skills/docs-update/SKILL.md +100 -0
- package/templates/default/locales/en/.mustflow/skills/external-prompt-injection-defense/SKILL.md +124 -0
- package/templates/default/locales/en/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/en/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/en/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/en/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/en/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/en/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/en/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/en/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/en/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/en/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/en/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/en/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/en/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/en/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +130 -0
- package/templates/default/locales/en/.mustflow/skills/security-regression-tests/SKILL.md +157 -0
- package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/en/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/en/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/en/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/en/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/en/.mustflow/skills/ui-quality-gate/SKILL.md +119 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/en/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/en/AGENTS.md +114 -0
- package/templates/default/locales/es/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/es/.mustflow/context/PROJECT.md +63 -0
- package/templates/default/locales/es/.mustflow/docs/agent-workflow.md +365 -0
- package/templates/default/locales/es/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/es/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/es/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/es/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/es/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/es/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/es/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/es/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/es/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/es/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/es/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/es/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/es/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/es/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/es/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/es/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/es/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/es/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/es/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/es/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/es/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/es/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/es/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/es/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/es/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/es/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/es/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/es/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/es/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/es/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/es/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/es/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/es/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/es/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/es/AGENTS.md +83 -0
- package/templates/default/locales/fr/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/fr/.mustflow/context/PROJECT.md +63 -0
- package/templates/default/locales/fr/.mustflow/docs/agent-workflow.md +368 -0
- package/templates/default/locales/fr/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/fr/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/fr/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/fr/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/fr/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/fr/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/fr/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/fr/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/fr/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/fr/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/fr/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/fr/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/fr/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/fr/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/fr/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/fr/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/fr/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/fr/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/fr/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/fr/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/fr/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/fr/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/fr/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/fr/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/fr/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/fr/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/fr/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/fr/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/fr/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/fr/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/fr/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/fr/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/fr/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/fr/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/fr/AGENTS.md +84 -0
- package/templates/default/locales/hi/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/hi/.mustflow/context/PROJECT.md +65 -0
- package/templates/default/locales/hi/.mustflow/docs/agent-workflow.md +359 -0
- package/templates/default/locales/hi/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/hi/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/hi/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/hi/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/hi/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/hi/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/hi/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/hi/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/hi/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/hi/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/hi/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/hi/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/hi/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/hi/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/hi/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/hi/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/hi/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/hi/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/hi/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/hi/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/hi/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/hi/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/hi/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/hi/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/hi/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/hi/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/hi/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/hi/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/hi/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/hi/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/hi/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/hi/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/hi/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/hi/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/hi/AGENTS.md +83 -0
- package/templates/default/locales/ko/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/ko/.mustflow/context/PROJECT.md +66 -0
- package/templates/default/locales/ko/.mustflow/docs/agent-workflow.md +506 -0
- package/templates/default/locales/ko/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/ko/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/ko/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/ko/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/ko/.mustflow/skills/code-review/SKILL.md +118 -0
- package/templates/default/locales/ko/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/ko/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/ko/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/ko/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/ko/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/ko/.mustflow/skills/docs-update/SKILL.md +107 -0
- package/templates/default/locales/ko/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/ko/.mustflow/skills/failure-triage/SKILL.md +119 -0
- package/templates/default/locales/ko/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/ko/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/ko/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/ko/.mustflow/skills/multi-agent-work-coordination/SKILL.md +259 -0
- package/templates/default/locales/ko/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/ko/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/ko/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/ko/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/ko/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/ko/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/ko/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/ko/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/ko/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/ko/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/ko/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/ko/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/ko/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/ko/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/ko/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/ko/.mustflow/skills/test-maintenance/SKILL.md +130 -0
- package/templates/default/locales/ko/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/ko/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/ko/AGENTS.md +85 -0
- package/templates/default/locales/zh/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/zh/.mustflow/context/PROJECT.md +64 -0
- package/templates/default/locales/zh/.mustflow/docs/agent-workflow.md +310 -0
- package/templates/default/locales/zh/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/zh/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/zh/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/zh/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/zh/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/zh/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/zh/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/zh/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/zh/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/zh/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/zh/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/zh/.mustflow/skills/failure-triage/SKILL.md +96 -0
- package/templates/default/locales/zh/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/zh/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/zh/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/zh/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/zh/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/zh/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/zh/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/zh/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/zh/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/zh/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/zh/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/zh/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/zh/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/zh/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/zh/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/zh/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/zh/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/zh/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/zh/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/zh/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/zh/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/zh/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/zh/AGENTS.md +86 -0
- package/templates/default/manifest.toml +339 -0
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { existsSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { listFilesRecursive, toPosixPath } from './filesystem.js';
|
|
6
|
+
import { readTomlFile } from './toml.js';
|
|
7
|
+
const DEFAULT_DEPTH = 3;
|
|
8
|
+
const REPO_MAP_DOC_ID = 'repo-map';
|
|
9
|
+
const REPO_MAP_LIFECYCLE = 'generated';
|
|
10
|
+
const REPO_MAP_GENERATOR = 'mustflow';
|
|
11
|
+
const REPO_MAP_RELATIVE_ROOT = '.';
|
|
12
|
+
const REPO_MAP_SOURCE_POLICY = 'anchors_only';
|
|
13
|
+
const REPO_MAP_PRIVACY_MODE = 'minimal';
|
|
14
|
+
const EXCLUDED_SEGMENTS = new Set([
|
|
15
|
+
'.astro',
|
|
16
|
+
'.cache',
|
|
17
|
+
'.git',
|
|
18
|
+
'build',
|
|
19
|
+
'cache',
|
|
20
|
+
'coverage',
|
|
21
|
+
'dist',
|
|
22
|
+
'node_modules',
|
|
23
|
+
]);
|
|
24
|
+
const EXCLUDED_PREFIXES = ['.mustflow/backups/'];
|
|
25
|
+
const GENERATED_FILES = new Set(['REPO_MAP.md']);
|
|
26
|
+
const DEFAULT_PRIORITY_PATHS = [
|
|
27
|
+
'AGENTS.md',
|
|
28
|
+
'.mustflow/docs/agent-workflow.md',
|
|
29
|
+
'.mustflow/config/mustflow.toml',
|
|
30
|
+
'.mustflow/config/commands.toml',
|
|
31
|
+
'.mustflow/config/preferences.toml',
|
|
32
|
+
'.mustflow/context/INDEX.md',
|
|
33
|
+
'.mustflow/skills/INDEX.md',
|
|
34
|
+
];
|
|
35
|
+
const ROOT_OPTIONAL_MARKDOWN_ANCHOR_FILES = [
|
|
36
|
+
'README.md',
|
|
37
|
+
'PROJECT.md',
|
|
38
|
+
'ROADMAP.md',
|
|
39
|
+
'DESIGN.md',
|
|
40
|
+
'CONTRIBUTING.md',
|
|
41
|
+
'SECURITY.md',
|
|
42
|
+
'CHANGELOG.md',
|
|
43
|
+
'CODE_OF_CONDUCT.md',
|
|
44
|
+
'SUPPORT.md',
|
|
45
|
+
'GOVERNANCE.md',
|
|
46
|
+
'MAINTAINERS.md',
|
|
47
|
+
'RELEASING.md',
|
|
48
|
+
'RELEASE.md',
|
|
49
|
+
'TESTING.md',
|
|
50
|
+
'DEPLOYMENT.md',
|
|
51
|
+
'OPERATIONS.md',
|
|
52
|
+
'RUNBOOK.md',
|
|
53
|
+
'CONFIGURATION.md',
|
|
54
|
+
'DATA_MODEL.md',
|
|
55
|
+
'SCHEMA.md',
|
|
56
|
+
'PRIVACY.md',
|
|
57
|
+
'TROUBLESHOOTING.md',
|
|
58
|
+
'ARCHITECTURE.md',
|
|
59
|
+
'API.md',
|
|
60
|
+
];
|
|
61
|
+
const MACHINE_CONTRACT_ANCHOR_FILES = [
|
|
62
|
+
'project.contract.json',
|
|
63
|
+
'project.constants.json',
|
|
64
|
+
'design-tokens.json',
|
|
65
|
+
'openapi.json',
|
|
66
|
+
'openapi.yaml',
|
|
67
|
+
'openapi.yml',
|
|
68
|
+
'asyncapi.json',
|
|
69
|
+
'asyncapi.yaml',
|
|
70
|
+
'asyncapi.yml',
|
|
71
|
+
'schema.graphql',
|
|
72
|
+
'schema.prisma',
|
|
73
|
+
];
|
|
74
|
+
const DEFAULT_NESTED_ANCHOR_FILES = [
|
|
75
|
+
'AGENTS.md',
|
|
76
|
+
'REPO_MAP.md',
|
|
77
|
+
'.gitattributes',
|
|
78
|
+
'.editorconfig',
|
|
79
|
+
'.mustflow/config/mustflow.toml',
|
|
80
|
+
'.mustflow/config/commands.toml',
|
|
81
|
+
'.mustflow/config/preferences.toml',
|
|
82
|
+
'.mustflow/context/INDEX.md',
|
|
83
|
+
'.mustflow/context/PROJECT.md',
|
|
84
|
+
'.mustflow/skills/INDEX.md',
|
|
85
|
+
...ROOT_OPTIONAL_MARKDOWN_ANCHOR_FILES,
|
|
86
|
+
...MACHINE_CONTRACT_ANCHOR_FILES,
|
|
87
|
+
'package.json',
|
|
88
|
+
'pyproject.toml',
|
|
89
|
+
'go.mod',
|
|
90
|
+
'Cargo.toml',
|
|
91
|
+
'deno.json',
|
|
92
|
+
'deno.jsonc',
|
|
93
|
+
'justfile',
|
|
94
|
+
'Justfile',
|
|
95
|
+
'Makefile',
|
|
96
|
+
'Taskfile.yml',
|
|
97
|
+
'Taskfile.yaml',
|
|
98
|
+
];
|
|
99
|
+
const MANIFEST_ANCHORS = new Set(['package.json', 'pyproject.toml', 'go.mod', 'Cargo.toml', 'deno.json', 'deno.jsonc']);
|
|
100
|
+
const COMMAND_ADAPTER_ANCHORS = new Set(['justfile', 'Justfile', 'Makefile', 'Taskfile.yml', 'Taskfile.yaml']);
|
|
101
|
+
const EDITING_POLICY_ANCHORS = new Set(['.gitattributes', '.editorconfig']);
|
|
102
|
+
const NESTED_ROOT_DOC_LABELS = new Map([
|
|
103
|
+
['README.md', 'human overview'],
|
|
104
|
+
['PROJECT.md', 'project brief'],
|
|
105
|
+
['ROADMAP.md', 'planning context'],
|
|
106
|
+
['DESIGN.md', 'visual design'],
|
|
107
|
+
['CONTRIBUTING.md', 'contribution guide'],
|
|
108
|
+
['SECURITY.md', 'security policy'],
|
|
109
|
+
['CHANGELOG.md', 'changelog'],
|
|
110
|
+
['CODE_OF_CONDUCT.md', 'code of conduct'],
|
|
111
|
+
['SUPPORT.md', 'support guide'],
|
|
112
|
+
['GOVERNANCE.md', 'governance'],
|
|
113
|
+
['MAINTAINERS.md', 'maintainers'],
|
|
114
|
+
['RELEASING.md', 'release guide'],
|
|
115
|
+
['RELEASE.md', 'release guide'],
|
|
116
|
+
['TESTING.md', 'testing guide'],
|
|
117
|
+
['DEPLOYMENT.md', 'deployment guide'],
|
|
118
|
+
['OPERATIONS.md', 'operations guide'],
|
|
119
|
+
['RUNBOOK.md', 'runbook'],
|
|
120
|
+
['CONFIGURATION.md', 'configuration guide'],
|
|
121
|
+
['DATA_MODEL.md', 'data model'],
|
|
122
|
+
['SCHEMA.md', 'schema reference'],
|
|
123
|
+
['PRIVACY.md', 'privacy policy'],
|
|
124
|
+
['TROUBLESHOOTING.md', 'troubleshooting guide'],
|
|
125
|
+
['ARCHITECTURE.md', 'architecture reference'],
|
|
126
|
+
['API.md', 'API reference'],
|
|
127
|
+
]);
|
|
128
|
+
const EXACT_ANCHOR_DESCRIPTIONS = new Map([
|
|
129
|
+
['AGENTS.md', 'Root agent operating rules. Read this before changing files.'],
|
|
130
|
+
['.gitattributes', 'Git text, binary, and line-ending policy. Check before normalizing files.'],
|
|
131
|
+
['.editorconfig', 'Editor formatting defaults such as indentation, charset, and final newline.'],
|
|
132
|
+
['README.md', 'Human-facing project overview. Use it as context, not as agent policy.'],
|
|
133
|
+
['PROJECT.md', 'Optional project-owned brief. Use below .mustflow/context/PROJECT.md when both exist.'],
|
|
134
|
+
['ROADMAP.md', 'Optional project planning, priority, milestone, and non-goal context.'],
|
|
135
|
+
['DESIGN.md', 'Optional visual identity and design-token reference for UI work.'],
|
|
136
|
+
['CONTRIBUTING.md', 'Optional contribution workflow and pull request guidance.'],
|
|
137
|
+
['SECURITY.md', 'Optional security policy, vulnerability reporting, and sensitive-change guidance.'],
|
|
138
|
+
['CHANGELOG.md', 'Optional release history and user-visible change log.'],
|
|
139
|
+
['CODE_OF_CONDUCT.md', 'Optional community participation and conduct expectations.'],
|
|
140
|
+
['SUPPORT.md', 'Optional support channels and maintenance expectations.'],
|
|
141
|
+
['GOVERNANCE.md', 'Optional governance, decision-making, and maintainer authority reference.'],
|
|
142
|
+
['MAINTAINERS.md', 'Optional maintainer list, review ownership, and escalation reference.'],
|
|
143
|
+
['RELEASING.md', 'Optional release procedure and publishing checklist.'],
|
|
144
|
+
['RELEASE.md', 'Optional release procedure and publishing checklist.'],
|
|
145
|
+
['TESTING.md', 'Optional testing strategy, required checks, and verification guidance.'],
|
|
146
|
+
['DEPLOYMENT.md', 'Optional deployment environments, release targets, and rollout guidance.'],
|
|
147
|
+
['OPERATIONS.md', 'Optional production operations and incident-response guidance.'],
|
|
148
|
+
['RUNBOOK.md', 'Optional operational runbook for recurring procedures and incidents.'],
|
|
149
|
+
['CONFIGURATION.md', 'Optional environment, feature flag, and runtime configuration guide.'],
|
|
150
|
+
['DATA_MODEL.md', 'Optional domain data model and persistence contract reference.'],
|
|
151
|
+
['SCHEMA.md', 'Optional schema reference for domain, data, or validation models.'],
|
|
152
|
+
['PRIVACY.md', 'Optional privacy, data handling, and retention guidance.'],
|
|
153
|
+
['TROUBLESHOOTING.md', 'Optional known-failure and recovery guide.'],
|
|
154
|
+
['ARCHITECTURE.md', 'Optional system structure, module boundaries, and architectural decisions.'],
|
|
155
|
+
['API.md', 'Optional API surface and integration contract reference.'],
|
|
156
|
+
['project.contract.json', 'Machine-readable project contract. Prefer domain-specific names over catch-all files.'],
|
|
157
|
+
['project.constants.json', 'Machine-readable project constants. Prefer domain-specific names over catch-all files.'],
|
|
158
|
+
['design-tokens.json', 'Machine-readable design token contract.'],
|
|
159
|
+
['openapi.json', 'Machine-readable OpenAPI contract.'],
|
|
160
|
+
['openapi.yaml', 'Machine-readable OpenAPI contract.'],
|
|
161
|
+
['openapi.yml', 'Machine-readable OpenAPI contract.'],
|
|
162
|
+
['asyncapi.json', 'Machine-readable AsyncAPI contract.'],
|
|
163
|
+
['asyncapi.yaml', 'Machine-readable AsyncAPI contract.'],
|
|
164
|
+
['asyncapi.yml', 'Machine-readable AsyncAPI contract.'],
|
|
165
|
+
['schema.graphql', 'Machine-readable GraphQL schema contract.'],
|
|
166
|
+
['schema.prisma', 'Machine-readable Prisma data schema contract.'],
|
|
167
|
+
['package.json', 'Node.js package manifest, binary entry points, and package scripts.'],
|
|
168
|
+
['pyproject.toml', 'Python project metadata and tool configuration.'],
|
|
169
|
+
['go.mod', 'Go module definition and dependency boundary.'],
|
|
170
|
+
['Cargo.toml', 'Rust package manifest and workspace configuration.'],
|
|
171
|
+
['deno.json', 'Deno configuration, tasks, and permissions.'],
|
|
172
|
+
['deno.jsonc', 'Deno configuration, tasks, and permissions.'],
|
|
173
|
+
['justfile', 'Local command recipes. Verify command intent before relying on a recipe.'],
|
|
174
|
+
['Justfile', 'Local command recipes. Verify command intent before relying on a recipe.'],
|
|
175
|
+
['Taskfile.yml', 'Task runner entry point for local automation.'],
|
|
176
|
+
['Taskfile.yaml', 'Task runner entry point for local automation.'],
|
|
177
|
+
['Makefile', 'Make-based command adapter for common local tasks.'],
|
|
178
|
+
['Dockerfile', 'Container image build definition.'],
|
|
179
|
+
['compose.yaml', 'Local service composition file.'],
|
|
180
|
+
['compose.yml', 'Local service composition file.'],
|
|
181
|
+
['docker-compose.yaml', 'Local service composition file.'],
|
|
182
|
+
['docker-compose.yml', 'Local service composition file.'],
|
|
183
|
+
['tsconfig.json', 'TypeScript compiler configuration.'],
|
|
184
|
+
['ruff.toml', 'Python lint and formatting configuration.'],
|
|
185
|
+
['.golangci.yml', 'Go lint configuration.'],
|
|
186
|
+
['.golangci.yaml', 'Go lint configuration.'],
|
|
187
|
+
['AGENT.md', 'Legacy or project-local agent note. Prefer AGENTS.md for mustflow workflows.'],
|
|
188
|
+
['.mustflow/config/mustflow.toml', 'Mustflow read order, authority, document roots, and protected paths.'],
|
|
189
|
+
['.mustflow/config/commands.toml', 'Command intent contract. Check this before running project commands.'],
|
|
190
|
+
['.mustflow/config/preferences.toml', 'Repository-level agent preferences. Treat them as defaults below user instructions and local style.'],
|
|
191
|
+
['.mustflow/context/INDEX.md', 'Task-specific project context router. Read only when context is needed.'],
|
|
192
|
+
['.mustflow/context/PROJECT.md', 'Project goals, non-goals, terms, and repository-wide promises for agents.'],
|
|
193
|
+
['.mustflow/docs/agent-workflow.md', 'Shared workflow policy for agent work.'],
|
|
194
|
+
['.mustflow/skills/INDEX.md', 'Index of available procedural skills.'],
|
|
195
|
+
]);
|
|
196
|
+
function isRecord(value) {
|
|
197
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
198
|
+
}
|
|
199
|
+
function getStringArray(value) {
|
|
200
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
201
|
+
}
|
|
202
|
+
function getBoolean(value, fallback) {
|
|
203
|
+
return typeof value === 'boolean' ? value : fallback;
|
|
204
|
+
}
|
|
205
|
+
function getPositiveInteger(value, fallback) {
|
|
206
|
+
return Number.isInteger(value) && Number(value) > 0 ? Number(value) : fallback;
|
|
207
|
+
}
|
|
208
|
+
function readMustflowConfig(projectRoot) {
|
|
209
|
+
const configPath = path.join(projectRoot, '.mustflow', 'config', 'mustflow.toml');
|
|
210
|
+
if (!existsSync(configPath)) {
|
|
211
|
+
return {};
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const parsed = readTomlFile(configPath);
|
|
215
|
+
return isRecord(parsed) ? parsed : {};
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return {};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function getRepoMapConfig(projectRoot) {
|
|
222
|
+
const parsed = readMustflowConfig(projectRoot);
|
|
223
|
+
const configuredPriorityPaths = [...getStringArray(parsed.read_order), ...getStringArray(parsed.optional_read_order)];
|
|
224
|
+
const map = isRecord(parsed.map) ? parsed.map : {};
|
|
225
|
+
const workspace = isRecord(parsed.workspace) ? parsed.workspace : {};
|
|
226
|
+
const anchorFiles = getStringArray(map.anchor_files);
|
|
227
|
+
return {
|
|
228
|
+
priorityPaths: configuredPriorityPaths.length > 0 ? configuredPriorityPaths : DEFAULT_PRIORITY_PATHS,
|
|
229
|
+
map: {
|
|
230
|
+
includeNested: getBoolean(map.include_nested, false),
|
|
231
|
+
anchorFiles: anchorFiles.length > 0 ? anchorFiles : DEFAULT_NESTED_ANCHOR_FILES,
|
|
232
|
+
},
|
|
233
|
+
workspace: {
|
|
234
|
+
enabled: getBoolean(workspace.enabled, false),
|
|
235
|
+
roots: getStringArray(workspace.roots),
|
|
236
|
+
maxDepth: getPositiveInteger(workspace.max_depth, 4),
|
|
237
|
+
maxRepositories: getPositiveInteger(workspace.max_repositories, 50),
|
|
238
|
+
followSymlinks: getBoolean(workspace.follow_symlinks, false),
|
|
239
|
+
stopAtRepositoryRoot: getBoolean(workspace.stop_at_repository_root, true),
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function getGitFiles(projectRoot) {
|
|
244
|
+
const result = spawnSync('git', ['ls-files'], {
|
|
245
|
+
cwd: projectRoot,
|
|
246
|
+
encoding: 'utf8',
|
|
247
|
+
});
|
|
248
|
+
if (result.status !== 0 || result.error) {
|
|
249
|
+
return [];
|
|
250
|
+
}
|
|
251
|
+
return result.stdout
|
|
252
|
+
.split(/\r?\n/)
|
|
253
|
+
.map((line) => line.trim())
|
|
254
|
+
.filter(Boolean);
|
|
255
|
+
}
|
|
256
|
+
function getRepositoryFiles(projectRoot) {
|
|
257
|
+
const files = new Set();
|
|
258
|
+
for (const relativePath of getGitFiles(projectRoot)) {
|
|
259
|
+
files.add(relativePath);
|
|
260
|
+
}
|
|
261
|
+
for (const relativePath of listFilesRecursive(projectRoot, { ignoredDirectoryNames: EXCLUDED_SEGMENTS })) {
|
|
262
|
+
files.add(relativePath);
|
|
263
|
+
}
|
|
264
|
+
return Array.from(files);
|
|
265
|
+
}
|
|
266
|
+
function shouldIncludePath(relativePath) {
|
|
267
|
+
if (GENERATED_FILES.has(relativePath)) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
if (EXCLUDED_PREFIXES.some((prefix) => relativePath.startsWith(prefix))) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
const segments = relativePath.split('/');
|
|
274
|
+
return segments.every((segment) => !EXCLUDED_SEGMENTS.has(segment));
|
|
275
|
+
}
|
|
276
|
+
function getDirectoryDepth(relativePath) {
|
|
277
|
+
return Math.max(relativePath.split('/').length - 1, 0);
|
|
278
|
+
}
|
|
279
|
+
function getDirectoryName(relativePath) {
|
|
280
|
+
const directory = path.posix.dirname(relativePath);
|
|
281
|
+
return directory === '.' ? '/' : `${directory}/`;
|
|
282
|
+
}
|
|
283
|
+
function getAnchorDescription(relativePath) {
|
|
284
|
+
if (EXACT_ANCHOR_DESCRIPTIONS.has(relativePath)) {
|
|
285
|
+
return EXACT_ANCHOR_DESCRIPTIONS.get(relativePath);
|
|
286
|
+
}
|
|
287
|
+
const fileName = path.posix.basename(relativePath);
|
|
288
|
+
if (fileName === 'AGENTS.md') {
|
|
289
|
+
return 'Scoped agent operating rules for this directory.';
|
|
290
|
+
}
|
|
291
|
+
if (fileName === 'README.md') {
|
|
292
|
+
return 'Directory guide for this area.';
|
|
293
|
+
}
|
|
294
|
+
if (fileName === 'package.json') {
|
|
295
|
+
return 'Node.js package manifest for this directory.';
|
|
296
|
+
}
|
|
297
|
+
if (fileName === 'SKILL.md') {
|
|
298
|
+
return 'Procedural skill document for a repeatable agent task.';
|
|
299
|
+
}
|
|
300
|
+
return EXACT_ANCHOR_DESCRIPTIONS.get(fileName);
|
|
301
|
+
}
|
|
302
|
+
function isUnderNestedRepository(relativePath, nestedRepositories) {
|
|
303
|
+
return nestedRepositories.some((repository) => relativePath.startsWith(repository.relativePath));
|
|
304
|
+
}
|
|
305
|
+
function isUnderExcludedPrefix(relativePath, excludedPrefixes) {
|
|
306
|
+
return excludedPrefixes.some((prefix) => relativePath === prefix.slice(0, -1) || relativePath.startsWith(prefix));
|
|
307
|
+
}
|
|
308
|
+
function discoverAnchors(projectRoot, depth, priorityPaths, nestedRepositories, excludedPrefixes) {
|
|
309
|
+
return getRepositoryFiles(projectRoot)
|
|
310
|
+
.filter(shouldIncludePath)
|
|
311
|
+
.filter((relativePath) => !isUnderNestedRepository(relativePath, nestedRepositories))
|
|
312
|
+
.filter((relativePath) => !isUnderExcludedPrefix(relativePath, excludedPrefixes))
|
|
313
|
+
.map((relativePath) => {
|
|
314
|
+
const description = getAnchorDescription(relativePath);
|
|
315
|
+
return description ? { relativePath, description } : undefined;
|
|
316
|
+
})
|
|
317
|
+
.filter((anchor) => Boolean(anchor))
|
|
318
|
+
.filter((anchor) => priorityPaths.has(anchor.relativePath) || getDirectoryDepth(anchor.relativePath) <= depth)
|
|
319
|
+
.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
320
|
+
}
|
|
321
|
+
function renderAnchorList(anchors) {
|
|
322
|
+
return anchors.map((anchor) => `- \`${anchor.relativePath}\`: ${anchor.description}`);
|
|
323
|
+
}
|
|
324
|
+
function renderDirectoryAnchors(anchors) {
|
|
325
|
+
if (anchors.length === 0) {
|
|
326
|
+
return ['No additional anchor files were found.'];
|
|
327
|
+
}
|
|
328
|
+
const lines = [];
|
|
329
|
+
const grouped = new Map();
|
|
330
|
+
for (const anchor of anchors) {
|
|
331
|
+
const directory = getDirectoryName(anchor.relativePath);
|
|
332
|
+
grouped.set(directory, [...(grouped.get(directory) ?? []), anchor]);
|
|
333
|
+
}
|
|
334
|
+
for (const directory of Array.from(grouped.keys()).sort((left, right) => {
|
|
335
|
+
if (left === '/') {
|
|
336
|
+
return -1;
|
|
337
|
+
}
|
|
338
|
+
if (right === '/') {
|
|
339
|
+
return 1;
|
|
340
|
+
}
|
|
341
|
+
return left.localeCompare(right);
|
|
342
|
+
})) {
|
|
343
|
+
lines.push(`### ${directory}`);
|
|
344
|
+
lines.push('');
|
|
345
|
+
lines.push(...renderAnchorList(grouped.get(directory) ?? []));
|
|
346
|
+
lines.push('');
|
|
347
|
+
}
|
|
348
|
+
return lines;
|
|
349
|
+
}
|
|
350
|
+
function hasGitMarker(directoryPath) {
|
|
351
|
+
return existsSync(path.join(directoryPath, '.git'));
|
|
352
|
+
}
|
|
353
|
+
function isDirectory(directoryPath) {
|
|
354
|
+
try {
|
|
355
|
+
return statSync(directoryPath).isDirectory();
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function isSafeWorkspaceRoot(projectRoot, workspaceRoot) {
|
|
362
|
+
const absoluteRoot = path.resolve(projectRoot, workspaceRoot);
|
|
363
|
+
const relative = path.relative(projectRoot, absoluteRoot);
|
|
364
|
+
return relative !== '' && !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
365
|
+
}
|
|
366
|
+
function getWorkspaceRootPrefixes(projectRoot, workspaceConfig) {
|
|
367
|
+
if (!workspaceConfig.enabled) {
|
|
368
|
+
return [];
|
|
369
|
+
}
|
|
370
|
+
return workspaceConfig.roots
|
|
371
|
+
.filter((workspaceRoot) => isSafeWorkspaceRoot(projectRoot, workspaceRoot))
|
|
372
|
+
.map((workspaceRoot) => `${toPosixPath(workspaceRoot).replace(/\/+$/, '')}/`);
|
|
373
|
+
}
|
|
374
|
+
function collectNestedRepository(projectRoot, repositoryPath, anchorFiles) {
|
|
375
|
+
const relativeRoot = `${toPosixPath(path.relative(projectRoot, repositoryPath))}/`;
|
|
376
|
+
const existingAnchors = new Set();
|
|
377
|
+
for (const anchorFile of anchorFiles) {
|
|
378
|
+
if (existsSync(path.join(repositoryPath, ...anchorFile.split('/')))) {
|
|
379
|
+
existingAnchors.add(anchorFile);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const resolveAnchor = (anchorFile) => existingAnchors.has(anchorFile) ? `${relativeRoot}${anchorFile}` : undefined;
|
|
383
|
+
const manifests = anchorFiles
|
|
384
|
+
.filter((anchorFile) => MANIFEST_ANCHORS.has(anchorFile) && existingAnchors.has(anchorFile))
|
|
385
|
+
.map((anchorFile) => `${relativeRoot}${anchorFile}`);
|
|
386
|
+
const commandAdapters = anchorFiles
|
|
387
|
+
.filter((anchorFile) => COMMAND_ADAPTER_ANCHORS.has(anchorFile) && existingAnchors.has(anchorFile))
|
|
388
|
+
.map((anchorFile) => `${relativeRoot}${anchorFile}`);
|
|
389
|
+
const editingPolicies = anchorFiles
|
|
390
|
+
.filter((anchorFile) => EDITING_POLICY_ANCHORS.has(anchorFile) && existingAnchors.has(anchorFile))
|
|
391
|
+
.map((anchorFile) => `${relativeRoot}${anchorFile}`);
|
|
392
|
+
const rootDocuments = anchorFiles
|
|
393
|
+
.filter((anchorFile) => ROOT_OPTIONAL_MARKDOWN_ANCHOR_FILES.includes(anchorFile) && existingAnchors.has(anchorFile))
|
|
394
|
+
.map((anchorFile) => ({
|
|
395
|
+
label: NESTED_ROOT_DOC_LABELS.get(anchorFile) ?? 'root document',
|
|
396
|
+
relativePath: `${relativeRoot}${anchorFile}`,
|
|
397
|
+
}));
|
|
398
|
+
const machineContracts = anchorFiles
|
|
399
|
+
.filter((anchorFile) => MACHINE_CONTRACT_ANCHOR_FILES.includes(anchorFile) && existingAnchors.has(anchorFile))
|
|
400
|
+
.map((anchorFile) => `${relativeRoot}${anchorFile}`);
|
|
401
|
+
const mustflowConfig = resolveAnchor('.mustflow/config/mustflow.toml');
|
|
402
|
+
const commandContract = resolveAnchor('.mustflow/config/commands.toml');
|
|
403
|
+
return {
|
|
404
|
+
relativePath: relativeRoot,
|
|
405
|
+
mustflow: Boolean(mustflowConfig || commandContract),
|
|
406
|
+
agentRules: resolveAnchor('AGENTS.md'),
|
|
407
|
+
repoMap: resolveAnchor('REPO_MAP.md'),
|
|
408
|
+
mustflowConfig,
|
|
409
|
+
commandContract,
|
|
410
|
+
contextIndex: resolveAnchor('.mustflow/context/INDEX.md'),
|
|
411
|
+
skillIndex: resolveAnchor('.mustflow/skills/INDEX.md'),
|
|
412
|
+
rootDocuments,
|
|
413
|
+
machineContracts,
|
|
414
|
+
manifests,
|
|
415
|
+
commandAdapters,
|
|
416
|
+
editingPolicies,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function discoverNestedRepositories(projectRoot, mapConfig, workspaceConfig) {
|
|
420
|
+
if (!mapConfig.includeNested || !workspaceConfig.enabled || workspaceConfig.roots.length === 0) {
|
|
421
|
+
return [];
|
|
422
|
+
}
|
|
423
|
+
const repositories = [];
|
|
424
|
+
const seenRepositoryPaths = new Set();
|
|
425
|
+
function visit(directoryPath, depth) {
|
|
426
|
+
if (repositories.length >= workspaceConfig.maxRepositories || depth > workspaceConfig.maxDepth) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (hasGitMarker(directoryPath)) {
|
|
430
|
+
const resolvedRepositoryPath = path.resolve(directoryPath);
|
|
431
|
+
if (!seenRepositoryPaths.has(resolvedRepositoryPath)) {
|
|
432
|
+
seenRepositoryPaths.add(resolvedRepositoryPath);
|
|
433
|
+
repositories.push(collectNestedRepository(projectRoot, resolvedRepositoryPath, mapConfig.anchorFiles));
|
|
434
|
+
}
|
|
435
|
+
if (workspaceConfig.stopAtRepositoryRoot) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
for (const entry of readdirSync(directoryPath, { withFileTypes: true })) {
|
|
440
|
+
if (!entry.isDirectory()) {
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
if (EXCLUDED_SEGMENTS.has(entry.name)) {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (entry.isSymbolicLink() && !workspaceConfig.followSymlinks) {
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
visit(path.join(directoryPath, entry.name), depth + 1);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
for (const workspaceRoot of workspaceConfig.roots) {
|
|
453
|
+
if (!isSafeWorkspaceRoot(projectRoot, workspaceRoot)) {
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
const absoluteWorkspaceRoot = path.resolve(projectRoot, workspaceRoot);
|
|
457
|
+
if (!isDirectory(absoluteWorkspaceRoot)) {
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
visit(absoluteWorkspaceRoot, 0);
|
|
461
|
+
}
|
|
462
|
+
return repositories.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
463
|
+
}
|
|
464
|
+
function renderNestedRepositories(nestedRepositories) {
|
|
465
|
+
if (nestedRepositories.length === 0) {
|
|
466
|
+
return [];
|
|
467
|
+
}
|
|
468
|
+
const lines = [
|
|
469
|
+
'## Nested Repositories',
|
|
470
|
+
'',
|
|
471
|
+
'These are independent repository roots discovered under configured workspace roots.',
|
|
472
|
+
'Only entrypoints are listed. Open the nested repository before working inside it.',
|
|
473
|
+
'',
|
|
474
|
+
];
|
|
475
|
+
for (const repository of nestedRepositories) {
|
|
476
|
+
lines.push(`### \`${repository.relativePath}\``);
|
|
477
|
+
lines.push('');
|
|
478
|
+
lines.push('- git repository: yes');
|
|
479
|
+
lines.push(`- mustflow: ${repository.mustflow ? 'yes' : 'no'}`);
|
|
480
|
+
if (repository.agentRules) {
|
|
481
|
+
lines.push(`- agent rules: \`${repository.agentRules}\``);
|
|
482
|
+
}
|
|
483
|
+
if (repository.repoMap) {
|
|
484
|
+
lines.push(`- repo map: \`${repository.repoMap}\``);
|
|
485
|
+
}
|
|
486
|
+
if (repository.mustflowConfig) {
|
|
487
|
+
lines.push(`- mustflow config: \`${repository.mustflowConfig}\``);
|
|
488
|
+
}
|
|
489
|
+
if (repository.commandContract) {
|
|
490
|
+
lines.push(`- command contract: \`${repository.commandContract}\``);
|
|
491
|
+
}
|
|
492
|
+
if (repository.contextIndex) {
|
|
493
|
+
lines.push(`- context index: \`${repository.contextIndex}\``);
|
|
494
|
+
}
|
|
495
|
+
if (repository.skillIndex) {
|
|
496
|
+
lines.push(`- skill index: \`${repository.skillIndex}\``);
|
|
497
|
+
}
|
|
498
|
+
if (repository.manifests.length > 0) {
|
|
499
|
+
lines.push('- manifests:');
|
|
500
|
+
lines.push(...repository.manifests.map((manifest) => ` - \`${manifest}\``));
|
|
501
|
+
}
|
|
502
|
+
if (repository.commandAdapters.length > 0) {
|
|
503
|
+
lines.push('- command adapters:');
|
|
504
|
+
lines.push(...repository.commandAdapters.map((adapter) => ` - \`${adapter}\``));
|
|
505
|
+
}
|
|
506
|
+
if (repository.editingPolicies.length > 0) {
|
|
507
|
+
lines.push('- editing policies:');
|
|
508
|
+
lines.push(...repository.editingPolicies.map((policy) => ` - \`${policy}\``));
|
|
509
|
+
}
|
|
510
|
+
for (const document of repository.rootDocuments) {
|
|
511
|
+
lines.push(`- ${document.label}: \`${document.relativePath}\``);
|
|
512
|
+
}
|
|
513
|
+
if (repository.machineContracts.length > 0) {
|
|
514
|
+
lines.push('- machine-readable contracts:');
|
|
515
|
+
lines.push(...repository.machineContracts.map((contract) => ` - \`${contract}\``));
|
|
516
|
+
}
|
|
517
|
+
lines.push('');
|
|
518
|
+
}
|
|
519
|
+
return lines;
|
|
520
|
+
}
|
|
521
|
+
function countNestedEntrypoints(repository) {
|
|
522
|
+
return [
|
|
523
|
+
repository.agentRules,
|
|
524
|
+
repository.repoMap,
|
|
525
|
+
repository.mustflowConfig,
|
|
526
|
+
repository.commandContract,
|
|
527
|
+
repository.contextIndex,
|
|
528
|
+
repository.skillIndex,
|
|
529
|
+
...repository.rootDocuments.map((document) => document.relativePath),
|
|
530
|
+
...repository.machineContracts,
|
|
531
|
+
...repository.manifests,
|
|
532
|
+
...repository.commandAdapters,
|
|
533
|
+
...repository.editingPolicies,
|
|
534
|
+
].filter(Boolean).length;
|
|
535
|
+
}
|
|
536
|
+
function getSourceFingerprint(depth, includeNested, configuredPriorityPaths, anchors, nestedRepositories) {
|
|
537
|
+
const payload = {
|
|
538
|
+
depth,
|
|
539
|
+
includeNested,
|
|
540
|
+
priorityPaths: [...configuredPriorityPaths].sort(),
|
|
541
|
+
anchors: anchors.map((anchor) => anchor.relativePath).sort(),
|
|
542
|
+
nestedRepositories: nestedRepositories
|
|
543
|
+
.map((repository) => ({
|
|
544
|
+
relativePath: repository.relativePath,
|
|
545
|
+
mustflow: repository.mustflow,
|
|
546
|
+
agentRules: repository.agentRules,
|
|
547
|
+
repoMap: repository.repoMap,
|
|
548
|
+
mustflowConfig: repository.mustflowConfig,
|
|
549
|
+
commandContract: repository.commandContract,
|
|
550
|
+
contextIndex: repository.contextIndex,
|
|
551
|
+
skillIndex: repository.skillIndex,
|
|
552
|
+
rootDocuments: repository.rootDocuments.map((document) => document.relativePath).sort(),
|
|
553
|
+
machineContracts: [...repository.machineContracts].sort(),
|
|
554
|
+
manifests: [...repository.manifests].sort(),
|
|
555
|
+
commandAdapters: [...repository.commandAdapters].sort(),
|
|
556
|
+
editingPolicies: [...repository.editingPolicies].sort(),
|
|
557
|
+
}))
|
|
558
|
+
.sort((left, right) => left.relativePath.localeCompare(right.relativePath)),
|
|
559
|
+
};
|
|
560
|
+
const digest = createHash('sha256').update(JSON.stringify(payload)).digest('hex');
|
|
561
|
+
return `sha256:${digest}`;
|
|
562
|
+
}
|
|
563
|
+
function renderRepoMapFrontmatter(anchorCount, sourceFingerprint) {
|
|
564
|
+
return [
|
|
565
|
+
'---',
|
|
566
|
+
`mustflow_doc: ${REPO_MAP_DOC_ID}`,
|
|
567
|
+
`lifecycle: ${REPO_MAP_LIFECYCLE}`,
|
|
568
|
+
`generated_by: ${REPO_MAP_GENERATOR}`,
|
|
569
|
+
`relative_root: "${REPO_MAP_RELATIVE_ROOT}"`,
|
|
570
|
+
`source_policy: ${REPO_MAP_SOURCE_POLICY}`,
|
|
571
|
+
`privacy_mode: ${REPO_MAP_PRIVACY_MODE}`,
|
|
572
|
+
`anchor_count: ${anchorCount}`,
|
|
573
|
+
`source_fingerprint: "${sourceFingerprint}"`,
|
|
574
|
+
'---',
|
|
575
|
+
'',
|
|
576
|
+
];
|
|
577
|
+
}
|
|
578
|
+
export function generateRepoMap(projectRoot, options = {}) {
|
|
579
|
+
const depth = options.depth ?? DEFAULT_DEPTH;
|
|
580
|
+
const config = getRepoMapConfig(projectRoot);
|
|
581
|
+
const configuredPriorityPaths = config.priorityPaths;
|
|
582
|
+
const priorityPathSet = new Set(configuredPriorityPaths);
|
|
583
|
+
const mapConfig = {
|
|
584
|
+
...config.map,
|
|
585
|
+
includeNested: options.includeNested ?? config.map.includeNested,
|
|
586
|
+
};
|
|
587
|
+
const nestedRepositories = discoverNestedRepositories(projectRoot, mapConfig, config.workspace);
|
|
588
|
+
const workspaceRootPrefixes = getWorkspaceRootPrefixes(projectRoot, config.workspace);
|
|
589
|
+
const anchors = discoverAnchors(projectRoot, depth, priorityPathSet, nestedRepositories, workspaceRootPrefixes);
|
|
590
|
+
const priorityAnchors = configuredPriorityPaths
|
|
591
|
+
.map((relativePath) => anchors.find((anchor) => anchor.relativePath === relativePath))
|
|
592
|
+
.filter((anchor) => Boolean(anchor));
|
|
593
|
+
const otherAnchors = anchors.filter((anchor) => !priorityPathSet.has(anchor.relativePath));
|
|
594
|
+
const anchorCount = anchors.length + nestedRepositories.reduce((total, repository) => total + countNestedEntrypoints(repository), 0);
|
|
595
|
+
const sourceFingerprint = getSourceFingerprint(depth, mapConfig.includeNested, configuredPriorityPaths, anchors, nestedRepositories);
|
|
596
|
+
return [
|
|
597
|
+
...renderRepoMapFrontmatter(anchorCount, sourceFingerprint),
|
|
598
|
+
'# REPO_MAP.md',
|
|
599
|
+
'',
|
|
600
|
+
'This file is an agent navigation map for the current mustflow root. It is not a full file listing.',
|
|
601
|
+
'Regenerate it with `mf map --write` instead of editing it by hand.',
|
|
602
|
+
'',
|
|
603
|
+
'## How To Use',
|
|
604
|
+
'',
|
|
605
|
+
'- Start with `AGENTS.md` and the mustflow files listed in Priority Anchors.',
|
|
606
|
+
'- Use Directory Anchors to find local rules, guides, package manifests, and command adapters.',
|
|
607
|
+
...(nestedRepositories.length > 0
|
|
608
|
+
? ['- Use Nested Repositories only as entrypoints into independent repositories.']
|
|
609
|
+
: []),
|
|
610
|
+
'- Use `git ls-files` or your editor when you need the complete file list.',
|
|
611
|
+
'',
|
|
612
|
+
'## Priority Anchors',
|
|
613
|
+
'',
|
|
614
|
+
...(priorityAnchors.length > 0 ? renderAnchorList(priorityAnchors) : ['No mustflow priority anchors were found.']),
|
|
615
|
+
'',
|
|
616
|
+
'## Directory Anchors',
|
|
617
|
+
'',
|
|
618
|
+
...renderDirectoryAnchors(otherAnchors),
|
|
619
|
+
...renderNestedRepositories(nestedRepositories),
|
|
620
|
+
'## Generated Files',
|
|
621
|
+
'',
|
|
622
|
+
'- `REPO_MAP.md`: This generated navigation map. Do not treat it as a complete repository tree.',
|
|
623
|
+
'',
|
|
624
|
+
'## Excluded Areas',
|
|
625
|
+
'',
|
|
626
|
+
'- `.git/`',
|
|
627
|
+
'- `node_modules/`',
|
|
628
|
+
'- `dist/`, `build/`, and `coverage/`',
|
|
629
|
+
'- cache directories such as `.cache/`, `cache/`, and `.astro/`',
|
|
630
|
+
'',
|
|
631
|
+
].join('\n');
|
|
632
|
+
}
|
|
633
|
+
export function writeRepoMap(projectRoot, content) {
|
|
634
|
+
writeFileSync(path.join(projectRoot, 'REPO_MAP.md'), content);
|
|
635
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createRunReceipt, writeRunReceipt, } from '../../core/run-receipt.js';
|