mindforge-cc 1.0.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/.agent/CLAUDE.md +462 -0
- package/.agent/forge/help.md +7 -0
- package/.agent/forge/init-project.md +32 -0
- package/.agent/forge/plan-phase.md +30 -0
- package/.agent/mindforge/approve.md +18 -0
- package/.agent/mindforge/audit.md +30 -0
- package/.agent/mindforge/benchmark.md +33 -0
- package/.agent/mindforge/complete-milestone.md +18 -0
- package/.agent/mindforge/debug.md +126 -0
- package/.agent/mindforge/discuss-phase.md +138 -0
- package/.agent/mindforge/execute-phase.md +165 -0
- package/.agent/mindforge/health.md +21 -0
- package/.agent/mindforge/help.md +23 -0
- package/.agent/mindforge/init-org.md +131 -0
- package/.agent/mindforge/init-project.md +155 -0
- package/.agent/mindforge/install-skill.md +15 -0
- package/.agent/mindforge/map-codebase.md +298 -0
- package/.agent/mindforge/metrics.md +22 -0
- package/.agent/mindforge/migrate.md +40 -0
- package/.agent/mindforge/milestone.md +12 -0
- package/.agent/mindforge/next.md +105 -0
- package/.agent/mindforge/plan-phase.md +125 -0
- package/.agent/mindforge/plugins.md +40 -0
- package/.agent/mindforge/pr-review.md +41 -0
- package/.agent/mindforge/profile-team.md +23 -0
- package/.agent/mindforge/publish-skill.md +19 -0
- package/.agent/mindforge/quick.md +135 -0
- package/.agent/mindforge/release.md +10 -0
- package/.agent/mindforge/retrospective.md +26 -0
- package/.agent/mindforge/review.md +157 -0
- package/.agent/mindforge/security-scan.md +233 -0
- package/.agent/mindforge/ship.md +100 -0
- package/.agent/mindforge/skills.md +141 -0
- package/.agent/mindforge/status.md +104 -0
- package/.agent/mindforge/sync-confluence.md +11 -0
- package/.agent/mindforge/sync-jira.md +12 -0
- package/.agent/mindforge/tokens.md +8 -0
- package/.agent/mindforge/update.md +42 -0
- package/.agent/mindforge/verify-phase.md +62 -0
- package/.agent/mindforge/workspace.md +29 -0
- package/.claude/CLAUDE.md +462 -0
- package/.claude/commands/forge/help.md +7 -0
- package/.claude/commands/forge/init-project.md +32 -0
- package/.claude/commands/forge/plan-phase.md +30 -0
- package/.claude/commands/mindforge/approve.md +18 -0
- package/.claude/commands/mindforge/audit.md +30 -0
- package/.claude/commands/mindforge/benchmark.md +33 -0
- package/.claude/commands/mindforge/complete-milestone.md +18 -0
- package/.claude/commands/mindforge/debug.md +126 -0
- package/.claude/commands/mindforge/discuss-phase.md +138 -0
- package/.claude/commands/mindforge/execute-phase.md +165 -0
- package/.claude/commands/mindforge/health.md +21 -0
- package/.claude/commands/mindforge/help.md +23 -0
- package/.claude/commands/mindforge/init-org.md +131 -0
- package/.claude/commands/mindforge/init-project.md +155 -0
- package/.claude/commands/mindforge/install-skill.md +15 -0
- package/.claude/commands/mindforge/map-codebase.md +298 -0
- package/.claude/commands/mindforge/metrics.md +22 -0
- package/.claude/commands/mindforge/migrate.md +40 -0
- package/.claude/commands/mindforge/milestone.md +12 -0
- package/.claude/commands/mindforge/next.md +105 -0
- package/.claude/commands/mindforge/plan-phase.md +125 -0
- package/.claude/commands/mindforge/plugins.md +40 -0
- package/.claude/commands/mindforge/pr-review.md +41 -0
- package/.claude/commands/mindforge/profile-team.md +23 -0
- package/.claude/commands/mindforge/publish-skill.md +19 -0
- package/.claude/commands/mindforge/quick.md +135 -0
- package/.claude/commands/mindforge/release.md +10 -0
- package/.claude/commands/mindforge/retrospective.md +26 -0
- package/.claude/commands/mindforge/review.md +157 -0
- package/.claude/commands/mindforge/security-scan.md +233 -0
- package/.claude/commands/mindforge/ship.md +100 -0
- package/.claude/commands/mindforge/skills.md +141 -0
- package/.claude/commands/mindforge/status.md +104 -0
- package/.claude/commands/mindforge/sync-confluence.md +11 -0
- package/.claude/commands/mindforge/sync-jira.md +12 -0
- package/.claude/commands/mindforge/tokens.md +8 -0
- package/.claude/commands/mindforge/update.md +42 -0
- package/.claude/commands/mindforge/verify-phase.md +62 -0
- package/.claude/commands/mindforge/workspace.md +29 -0
- package/.forge/org/CONVENTIONS.md +0 -0
- package/.forge/org/ORG.md +0 -0
- package/.forge/org/SECURITY.md +0 -0
- package/.forge/org/TOOLS.md +0 -0
- package/.forge/personas/analyst.md +0 -0
- package/.forge/personas/architect.md +0 -0
- package/.forge/personas/debug-specialist.md +0 -0
- package/.forge/personas/developer.md +26 -0
- package/.forge/personas/qa-engineer.md +0 -0
- package/.forge/personas/release-manager.md +0 -0
- package/.forge/personas/security-reviewer.md +33 -0
- package/.forge/personas/tech-writer.md +0 -0
- package/.forge/skills/api-design/SKILL.md +0 -0
- package/.forge/skills/code-quality/SKILL.md +0 -0
- package/.forge/skills/documentation/SKILL.md +0 -0
- package/.forge/skills/security-review/SKILL.md +23 -0
- package/.forge/skills/testing-standards/SKILL.md +27 -0
- package/.github/workflows/mindforge-ci.yml +224 -0
- package/.gitlab-ci-mindforge.yml +18 -0
- package/.mindforge/MINDFORGE-SCHEMA.json +165 -0
- package/.mindforge/audit/AUDIT-SCHEMA.md +451 -0
- package/.mindforge/ci/ci-config-schema.md +21 -0
- package/.mindforge/ci/ci-mode.md +179 -0
- package/.mindforge/ci/github-actions-adapter.md +224 -0
- package/.mindforge/ci/gitlab-ci-adapter.md +31 -0
- package/.mindforge/ci/jenkins-adapter.md +44 -0
- package/.mindforge/distribution/registry-client.md +166 -0
- package/.mindforge/distribution/registry-schema.md +96 -0
- package/.mindforge/distribution/skill-publisher.md +44 -0
- package/.mindforge/distribution/skill-validator.md +74 -0
- package/.mindforge/engine/compaction-protocol.md +182 -0
- package/.mindforge/engine/context-injector.md +128 -0
- package/.mindforge/engine/dependency-parser.md +113 -0
- package/.mindforge/engine/skills/conflict-resolver.md +69 -0
- package/.mindforge/engine/skills/loader.md +184 -0
- package/.mindforge/engine/skills/registry.md +98 -0
- package/.mindforge/engine/skills/versioning.md +75 -0
- package/.mindforge/engine/verification-pipeline.md +111 -0
- package/.mindforge/engine/wave-executor.md +235 -0
- package/.mindforge/governance/GOVERNANCE-CONFIG.md +17 -0
- package/.mindforge/governance/approval-workflow.md +37 -0
- package/.mindforge/governance/change-classifier.md +63 -0
- package/.mindforge/governance/compliance-gates.md +31 -0
- package/.mindforge/integrations/confluence.md +27 -0
- package/.mindforge/integrations/connection-manager.md +163 -0
- package/.mindforge/integrations/github.md +25 -0
- package/.mindforge/integrations/gitlab.md +13 -0
- package/.mindforge/integrations/jira.md +102 -0
- package/.mindforge/integrations/slack.md +41 -0
- package/.mindforge/intelligence/antipattern-detector.md +75 -0
- package/.mindforge/intelligence/difficulty-scorer.md +55 -0
- package/.mindforge/intelligence/health-engine.md +208 -0
- package/.mindforge/intelligence/skill-gap-analyser.md +40 -0
- package/.mindforge/intelligence/smart-compaction.md +71 -0
- package/.mindforge/metrics/METRICS-SCHEMA.md +42 -0
- package/.mindforge/metrics/quality-tracker.md +32 -0
- package/.mindforge/monorepo/cross-package-planner.md +114 -0
- package/.mindforge/monorepo/dependency-graph-builder.md +32 -0
- package/.mindforge/monorepo/workspace-detector.md +129 -0
- package/.mindforge/org/CONVENTIONS.md +62 -0
- package/.mindforge/org/ORG.md +51 -0
- package/.mindforge/org/SECURITY.md +50 -0
- package/.mindforge/org/TOOLS.md +53 -0
- package/.mindforge/org/integrations/INTEGRATIONS-CONFIG.md +58 -0
- package/.mindforge/org/skills/MANIFEST.md +38 -0
- package/.mindforge/personas/analyst.md +52 -0
- package/.mindforge/personas/architect.md +75 -0
- package/.mindforge/personas/debug-specialist.md +52 -0
- package/.mindforge/personas/developer.md +85 -0
- package/.mindforge/personas/overrides/README.md +85 -0
- package/.mindforge/personas/qa-engineer.md +61 -0
- package/.mindforge/personas/release-manager.md +76 -0
- package/.mindforge/personas/security-reviewer.md +91 -0
- package/.mindforge/personas/tech-writer.md +51 -0
- package/.mindforge/plugins/PLUGINS-MANIFEST.md +23 -0
- package/.mindforge/plugins/plugin-loader.md +93 -0
- package/.mindforge/plugins/plugin-registry.md +44 -0
- package/.mindforge/plugins/plugin-schema.md +68 -0
- package/.mindforge/pr-review/ai-reviewer.md +266 -0
- package/.mindforge/pr-review/finding-formatter.md +46 -0
- package/.mindforge/pr-review/review-prompt-templates.md +44 -0
- package/.mindforge/production/compatibility-layer.md +39 -0
- package/.mindforge/production/migration-engine.md +52 -0
- package/.mindforge/production/production-checklist.md +165 -0
- package/.mindforge/production/token-optimiser.md +68 -0
- package/.mindforge/skills/accessibility/SKILL.md +106 -0
- package/.mindforge/skills/api-design/SKILL.md +98 -0
- package/.mindforge/skills/code-quality/SKILL.md +88 -0
- package/.mindforge/skills/data-privacy/SKILL.md +126 -0
- package/.mindforge/skills/database-patterns/SKILL.md +192 -0
- package/.mindforge/skills/documentation/SKILL.md +91 -0
- package/.mindforge/skills/incident-response/SKILL.md +180 -0
- package/.mindforge/skills/performance/SKILL.md +120 -0
- package/.mindforge/skills/security-review/SKILL.md +83 -0
- package/.mindforge/skills/testing-standards/SKILL.md +97 -0
- package/.mindforge/team/TEAM-PROFILE.md +42 -0
- package/.mindforge/team/multi-handoff.md +23 -0
- package/.mindforge/team/profiles/README.md +13 -0
- package/.mindforge/team/session-merger.md +18 -0
- package/.planning/ARCHITECTURE.md +0 -0
- package/.planning/AUDIT.jsonl +0 -0
- package/.planning/HANDOFF.json +28 -0
- package/.planning/PROJECT.md +33 -0
- package/.planning/RELEASE-CHECKLIST.md +68 -0
- package/.planning/REQUIREMENTS.md +0 -0
- package/.planning/ROADMAP.md +0 -0
- package/.planning/STATE.md +31 -0
- package/.planning/approvals/.gitkeep +1 -0
- package/.planning/archive/.gitkeep +1 -0
- package/.planning/audit-archive/.gitkeep +1 -0
- package/.planning/decisions/.gitkeep +0 -0
- package/.planning/decisions/ADR-001-handoff-tracking.md +41 -0
- package/.planning/decisions/ADR-002-markdown-commands.md +46 -0
- package/.planning/decisions/ADR-003-skills-trigger-model.md +37 -0
- package/.planning/decisions/ADR-004-wave-parallelism-model.md +45 -0
- package/.planning/decisions/ADR-005-append-only-audit-log.md +51 -0
- package/.planning/decisions/ADR-006-tiered-skills-system.md +22 -0
- package/.planning/decisions/ADR-007-trigger-keyword-model.md +22 -0
- package/.planning/decisions/ADR-008-just-in-time-skill-loading.md +29 -0
- package/.planning/decisions/ADR-009-enterprise-integration-retry-policy.md +8 -0
- package/.planning/decisions/ADR-010-governance-tier-escalation.md +8 -0
- package/.planning/decisions/ADR-011-multi-developer-handoff-contract.md +8 -0
- package/.planning/decisions/ADR-012-intelligence-feedback-loops.md +19 -0
- package/.planning/decisions/ADR-013-mindforge-md-constitution.md +16 -0
- package/.planning/decisions/ADR-014-metrics-as-signals-not-evaluation.md +15 -0
- package/.planning/decisions/ADR-015-npm-based-skill-registry.md +26 -0
- package/.planning/decisions/ADR-016-ci-exit-code-0-on-timeout.md +27 -0
- package/.planning/decisions/ADR-017-sdk-localhost-only.md +28 -0
- package/.planning/decisions/ADR-018-installer-self-install-detection.md +15 -0
- package/.planning/decisions/ADR-019-self-update-scope-preservation.md +14 -0
- package/.planning/decisions/ADR-020-v1.0.0-stable-interface-contract.md +23 -0
- package/.planning/jira-sync.json +9 -0
- package/.planning/milestones/.gitkeep +1 -0
- package/.planning/phases/day1/REVIEW-DAY1.md +50 -0
- package/.planning/phases/day1/SECURITY-REVIEW-DAY1.md +15 -0
- package/.planning/phases/day2/REVIEW-DAY2.md +521 -0
- package/.planning/phases/day3/REVIEW-DAY3.md +234 -0
- package/.planning/slack-threads.json +6 -0
- package/CHANGELOG.md +175 -0
- package/LICENSE +21 -0
- package/MINDFORGE.md +76 -0
- package/README.md +182 -0
- package/RELEASENOTES.md +41 -0
- package/SECURITY.md +4 -0
- package/bin/install.js +120 -0
- package/bin/installer-core.js +292 -0
- package/bin/migrations/0.1.0-to-0.5.0.js +37 -0
- package/bin/migrations/0.5.0-to-0.6.0.js +17 -0
- package/bin/migrations/0.6.0-to-1.0.0.js +100 -0
- package/bin/migrations/migrate.js +151 -0
- package/bin/migrations/schema-versions.js +64 -0
- package/bin/updater/changelog-fetcher.js +62 -0
- package/bin/updater/self-update.js +169 -0
- package/bin/updater/version-comparator.js +68 -0
- package/bin/validate-config.js +92 -0
- package/bin/wizard/config-generator.js +112 -0
- package/bin/wizard/environment-detector.js +76 -0
- package/bin/wizard/setup-wizard.js +237 -0
- package/docs/Context/Master-Context.md +701 -0
- package/docs/architecture/README.md +35 -0
- package/docs/architecture/decision-records-index.md +26 -0
- package/docs/ci-cd-integration.md +30 -0
- package/docs/ci-quickstart.md +78 -0
- package/docs/commands-reference.md +11 -0
- package/docs/contributing/CONTRIBUTING.md +38 -0
- package/docs/contributing/plugin-authoring.md +50 -0
- package/docs/contributing/skill-authoring.md +41 -0
- package/docs/enterprise-setup.md +25 -0
- package/docs/faq.md +38 -0
- package/docs/getting-started.md +36 -0
- package/docs/governance-guide.md +23 -0
- package/docs/mindforge-md-reference.md +53 -0
- package/docs/monorepo-guide.md +26 -0
- package/docs/persona-customisation.md +56 -0
- package/docs/quick-verify.md +33 -0
- package/docs/reference/audit-events.md +53 -0
- package/docs/reference/commands.md +82 -0
- package/docs/reference/config-reference.md +64 -0
- package/docs/reference/sdk-api.md +48 -0
- package/docs/reference/skills-api.md +57 -0
- package/docs/release-checklist-guide.md +37 -0
- package/docs/requirements.md +29 -0
- package/docs/sdk-reference.md +27 -0
- package/docs/security/SECURITY.md +42 -0
- package/docs/security/penetration-test-results.md +31 -0
- package/docs/security/threat-model.md +142 -0
- package/docs/skills-authoring-guide.md +119 -0
- package/docs/skills-publishing-guide.md +21 -0
- package/docs/team-setup-guide.md +21 -0
- package/docs/troubleshooting.md +119 -0
- package/docs/tutorial.md +195 -0
- package/docs/upgrade.md +44 -0
- package/docs/user-guide.md +131 -0
- package/docs/usp-features.md +214 -0
- package/eslint.config.mjs +31 -0
- package/examples/starter-project/.planning/AUDIT.jsonl +1 -0
- package/examples/starter-project/.planning/HANDOFF.json +23 -0
- package/examples/starter-project/.planning/PROJECT.md +27 -0
- package/examples/starter-project/.planning/STATE.md +10 -0
- package/examples/starter-project/MINDFORGE.md +40 -0
- package/examples/starter-project/README.md +14 -0
- package/implementation-roadmap/day-1-imp/DAY1-HARDEN.md +823 -0
- package/implementation-roadmap/day-1-imp/DAY1-IMPLEMENT.md +2459 -0
- package/implementation-roadmap/day-1-imp/DAY1-REVIEW.md +288 -0
- package/implementation-roadmap/day-2-imp/DAY2-HARDEN.md +954 -0
- package/implementation-roadmap/day-2-imp/DAY2-IMPLEMENT.md +2347 -0
- package/implementation-roadmap/day-2-imp/DAY2-REVIEW.md +422 -0
- package/implementation-roadmap/day-3-imp/DAY3-HARDEN.md +870 -0
- package/implementation-roadmap/day-3-imp/DAY3-IMPLEMENT.md +2798 -0
- package/implementation-roadmap/day-3-imp/DAY3-REVIEW.md +484 -0
- package/implementation-roadmap/day-4-imp/DAY4-HARDEN.md +1087 -0
- package/implementation-roadmap/day-4-imp/DAY4-IMPLEMENT.md +2874 -0
- package/implementation-roadmap/day-4-imp/DAY4-REVIEW.md +386 -0
- package/implementation-roadmap/day-5-imp/DAY5-HARDEN.md +1078 -0
- package/implementation-roadmap/day-5-imp/DAY5-IMPLEMENT.md +3151 -0
- package/implementation-roadmap/day-5-imp/DAY5-REVIEW.md +345 -0
- package/implementation-roadmap/day-6-imp/DAY6-COMPLETE.md +3919 -0
- package/implementation-roadmap/day-7-imp-prod/DAY7-PRODUCTION-FINAL.md +4513 -0
- package/package.json +31 -0
- package/sdk/README.md +69 -0
- package/sdk/eslint.config.mjs +34 -0
- package/sdk/package-lock.json +1507 -0
- package/sdk/package.json +30 -0
- package/sdk/src/client.ts +133 -0
- package/sdk/src/commands.ts +63 -0
- package/sdk/src/events.ts +166 -0
- package/sdk/src/index.ts +22 -0
- package/sdk/src/types.ts +87 -0
- package/sdk/tsconfig.json +13 -0
- package/tests/audit.test.js +206 -0
- package/tests/ci-mode.test.js +162 -0
- package/tests/compaction.test.js +161 -0
- package/tests/distribution.test.js +205 -0
- package/tests/e2e.test.js +618 -0
- package/tests/governance.test.js +130 -0
- package/tests/install.test.js +209 -0
- package/tests/integrations.test.js +128 -0
- package/tests/intelligence.test.js +117 -0
- package/tests/metrics.test.js +96 -0
- package/tests/migration.test.js +309 -0
- package/tests/production.test.js +416 -0
- package/tests/sdk.test.js +200 -0
- package/tests/skills-platform.test.js +403 -0
- package/tests/wave-engine.test.js +338 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# MindForge Intelligence — Health Engine
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Run a comprehensive health check across installation, context, skills, personas,
|
|
5
|
+
state, integrations, and security. Detect drift and provide safe auto-repair.
|
|
6
|
+
|
|
7
|
+
## Categories
|
|
8
|
+
1. Installation integrity
|
|
9
|
+
2. Context file health
|
|
10
|
+
3. Skills registry health
|
|
11
|
+
4. Persona system health
|
|
12
|
+
5. State consistency
|
|
13
|
+
6. Integration connectivity
|
|
14
|
+
7. Security configuration
|
|
15
|
+
|
|
16
|
+
## Category 1 — Installation integrity
|
|
17
|
+
|
|
18
|
+
### Required files checklist
|
|
19
|
+
```bash
|
|
20
|
+
REQUIRED_FILES=(
|
|
21
|
+
".claude/CLAUDE.md"
|
|
22
|
+
".agent/CLAUDE.md"
|
|
23
|
+
|
|
24
|
+
".claude/commands/mindforge/help.md"
|
|
25
|
+
".claude/commands/mindforge/init-project.md"
|
|
26
|
+
".claude/commands/mindforge/plan-phase.md"
|
|
27
|
+
".claude/commands/mindforge/execute-phase.md"
|
|
28
|
+
".claude/commands/mindforge/verify-phase.md"
|
|
29
|
+
".claude/commands/mindforge/ship.md"
|
|
30
|
+
".claude/commands/mindforge/next.md"
|
|
31
|
+
".claude/commands/mindforge/quick.md"
|
|
32
|
+
".claude/commands/mindforge/status.md"
|
|
33
|
+
".claude/commands/mindforge/debug.md"
|
|
34
|
+
".claude/commands/mindforge/skills.md"
|
|
35
|
+
".claude/commands/mindforge/review.md"
|
|
36
|
+
".claude/commands/mindforge/security-scan.md"
|
|
37
|
+
".claude/commands/mindforge/map-codebase.md"
|
|
38
|
+
".claude/commands/mindforge/discuss-phase.md"
|
|
39
|
+
".claude/commands/mindforge/audit.md"
|
|
40
|
+
".claude/commands/mindforge/milestone.md"
|
|
41
|
+
".claude/commands/mindforge/complete-milestone.md"
|
|
42
|
+
".claude/commands/mindforge/approve.md"
|
|
43
|
+
".claude/commands/mindforge/sync-jira.md"
|
|
44
|
+
".claude/commands/mindforge/sync-confluence.md"
|
|
45
|
+
".claude/commands/mindforge/health.md"
|
|
46
|
+
".claude/commands/mindforge/retrospective.md"
|
|
47
|
+
".claude/commands/mindforge/profile-team.md"
|
|
48
|
+
".claude/commands/mindforge/metrics.md"
|
|
49
|
+
|
|
50
|
+
".mindforge/engine/wave-executor.md"
|
|
51
|
+
".mindforge/engine/dependency-parser.md"
|
|
52
|
+
".mindforge/engine/context-injector.md"
|
|
53
|
+
".mindforge/engine/compaction-protocol.md"
|
|
54
|
+
".mindforge/engine/verification-pipeline.md"
|
|
55
|
+
".mindforge/engine/skills/registry.md"
|
|
56
|
+
".mindforge/engine/skills/loader.md"
|
|
57
|
+
".mindforge/engine/skills/versioning.md"
|
|
58
|
+
".mindforge/engine/skills/conflict-resolver.md"
|
|
59
|
+
|
|
60
|
+
".mindforge/skills/security-review/SKILL.md"
|
|
61
|
+
".mindforge/skills/code-quality/SKILL.md"
|
|
62
|
+
".mindforge/skills/api-design/SKILL.md"
|
|
63
|
+
".mindforge/skills/testing-standards/SKILL.md"
|
|
64
|
+
".mindforge/skills/documentation/SKILL.md"
|
|
65
|
+
".mindforge/skills/performance/SKILL.md"
|
|
66
|
+
".mindforge/skills/accessibility/SKILL.md"
|
|
67
|
+
".mindforge/skills/data-privacy/SKILL.md"
|
|
68
|
+
".mindforge/skills/incident-response/SKILL.md"
|
|
69
|
+
".mindforge/skills/database-patterns/SKILL.md"
|
|
70
|
+
|
|
71
|
+
".mindforge/personas/analyst.md"
|
|
72
|
+
".mindforge/personas/architect.md"
|
|
73
|
+
".mindforge/personas/developer.md"
|
|
74
|
+
".mindforge/personas/qa-engineer.md"
|
|
75
|
+
".mindforge/personas/security-reviewer.md"
|
|
76
|
+
".mindforge/personas/tech-writer.md"
|
|
77
|
+
".mindforge/personas/debug-specialist.md"
|
|
78
|
+
".mindforge/personas/release-manager.md"
|
|
79
|
+
|
|
80
|
+
".mindforge/intelligence/health-engine.md"
|
|
81
|
+
".mindforge/intelligence/difficulty-scorer.md"
|
|
82
|
+
".mindforge/intelligence/antipattern-detector.md"
|
|
83
|
+
".mindforge/intelligence/skill-gap-analyser.md"
|
|
84
|
+
".mindforge/intelligence/smart-compaction.md"
|
|
85
|
+
|
|
86
|
+
".mindforge/governance/change-classifier.md"
|
|
87
|
+
".mindforge/governance/approval-workflow.md"
|
|
88
|
+
".mindforge/governance/compliance-gates.md"
|
|
89
|
+
|
|
90
|
+
".mindforge/org/ORG.md"
|
|
91
|
+
".mindforge/org/CONVENTIONS.md"
|
|
92
|
+
".mindforge/org/SECURITY.md"
|
|
93
|
+
".mindforge/org/TOOLS.md"
|
|
94
|
+
".mindforge/org/skills/MANIFEST.md"
|
|
95
|
+
".mindforge/org/integrations/INTEGRATIONS-CONFIG.md"
|
|
96
|
+
|
|
97
|
+
".planning/HANDOFF.json"
|
|
98
|
+
".planning/STATE.md"
|
|
99
|
+
".planning/AUDIT.jsonl"
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`MINDFORGE.md` is optional and is not in required files.
|
|
104
|
+
If `MINDFORGE.md` exists, validate:
|
|
105
|
+
- no unknown skills (must exist in `.mindforge/org/skills/MANIFEST.md`)
|
|
106
|
+
- no invalid model names (fallback to `inherit` + warning)
|
|
107
|
+
- no attempted overrides of governance primitives
|
|
108
|
+
|
|
109
|
+
### Version check
|
|
110
|
+
- Validate `package.json` semver is `>= 0.5.0`.
|
|
111
|
+
|
|
112
|
+
### CLAUDE parity
|
|
113
|
+
- `.claude/CLAUDE.md` and `.agent/CLAUDE.md` must be identical.
|
|
114
|
+
- All commands under `.claude/commands/mindforge/` must exist in `.agent/mindforge/`.
|
|
115
|
+
|
|
116
|
+
## Category 2 — Context file health
|
|
117
|
+
- `PROJECT.md` has tech stack, v1 scope, success criteria, and no placeholders.
|
|
118
|
+
- `REQUIREMENTS.md` has FR entries with acceptance criteria and scope tags.
|
|
119
|
+
- `STATE.md` has recent `Last updated` timestamp and coherent status.
|
|
120
|
+
- `HANDOFF.json` is valid JSON with required fields and no secrets.
|
|
121
|
+
- `ARCHITECTURE.md` exists with stack and decision references.
|
|
122
|
+
|
|
123
|
+
## Category 3 — Skills registry health
|
|
124
|
+
- `MANIFEST.md` exists; all 10 core skills listed with valid semver.
|
|
125
|
+
- Every manifest skill path exists.
|
|
126
|
+
- Every `SKILL.md` includes frontmatter: `name`, `version`, `status`, `triggers`.
|
|
127
|
+
- Trigger conflict check runs and reports count.
|
|
128
|
+
|
|
129
|
+
## Category 4 — Persona system health
|
|
130
|
+
- Each persona has Identity, Pre-task checklist, Escalation, DoD.
|
|
131
|
+
- Persona files are non-stub (>500 bytes).
|
|
132
|
+
- Override files contain no prompt-injection markers.
|
|
133
|
+
|
|
134
|
+
## Category 5 — State consistency
|
|
135
|
+
- For every phase in ROADMAP: directory + required artifacts match phase status.
|
|
136
|
+
- Explicit check: if `STATE.md` marks phase complete and summaries exist but `VERIFICATION.md` is missing, flag as error.
|
|
137
|
+
- `AUDIT.jsonl` lines parse as JSONL and timestamps are chronological.
|
|
138
|
+
- Commit hygiene:
|
|
139
|
+
- conventional commit format in recent history
|
|
140
|
+
- on `main`, only flag commits whose subject starts with `wip` (case-insensitive)
|
|
141
|
+
|
|
142
|
+
## Category 6 — Integration connectivity
|
|
143
|
+
For configured integrations, run lightweight auth checks and report:
|
|
144
|
+
- `available`
|
|
145
|
+
- `invalid_credentials`
|
|
146
|
+
- `unreachable`
|
|
147
|
+
- `unconfigured` (informational only)
|
|
148
|
+
|
|
149
|
+
## Category 7 — Security configuration
|
|
150
|
+
- `.gitignore` covers env files and keys.
|
|
151
|
+
- Secret scan covers:
|
|
152
|
+
- `.planning/`
|
|
153
|
+
- `.mindforge/`
|
|
154
|
+
- root-level `MINDFORGE.md`, `.env.example`, `*.config.js`
|
|
155
|
+
- `SECURITY.md` has no placeholders.
|
|
156
|
+
- Governance approval files are not stale beyond SLA.
|
|
157
|
+
|
|
158
|
+
## Auto-repair protocol
|
|
159
|
+
|
|
160
|
+
### Auto-repairable
|
|
161
|
+
- sync `.agent/CLAUDE.md` from `.claude/CLAUDE.md`
|
|
162
|
+
- mirror missing command files from `.claude` to `.agent`
|
|
163
|
+
- add missing `Last updated` in `STATE.md`
|
|
164
|
+
- create `.planning/approvals/` if missing
|
|
165
|
+
- mark expired approvals and audit them
|
|
166
|
+
- trigger AUDIT archive protocol when threshold exceeded
|
|
167
|
+
|
|
168
|
+
### AUDIT.jsonl corruption handling (updated)
|
|
169
|
+
**Never delete lines from `AUDIT.jsonl`.**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
python3 - <<'PY'
|
|
173
|
+
import json
|
|
174
|
+
from pathlib import Path
|
|
175
|
+
|
|
176
|
+
audit = Path('.planning/AUDIT.jsonl')
|
|
177
|
+
if not audit.exists():
|
|
178
|
+
raise SystemExit(0)
|
|
179
|
+
|
|
180
|
+
invalid = []
|
|
181
|
+
for i, raw in enumerate(audit.read_text().splitlines(), 1):
|
|
182
|
+
s = raw.strip()
|
|
183
|
+
if not s:
|
|
184
|
+
continue
|
|
185
|
+
try:
|
|
186
|
+
json.loads(s)
|
|
187
|
+
except Exception:
|
|
188
|
+
invalid.append({"line": i, "raw": s})
|
|
189
|
+
|
|
190
|
+
if invalid:
|
|
191
|
+
qf = Path('.planning/AUDIT.jsonl.quarantine')
|
|
192
|
+
with qf.open('a', encoding='utf-8') as f:
|
|
193
|
+
for row in invalid:
|
|
194
|
+
f.write(json.dumps(row) + "\n")
|
|
195
|
+
print(f"Quarantined {len(invalid)} invalid lines to {qf}")
|
|
196
|
+
PY
|
|
197
|
+
|
|
198
|
+
echo "{\"event\":\"audit_quarantine\",\"quarantine_file\":\".planning/AUDIT.jsonl.quarantine\"}" >> .planning/AUDIT.jsonl
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Non-auto-repairable
|
|
202
|
+
- missing core skill files
|
|
203
|
+
- invalid credentials
|
|
204
|
+
- secrets found in `HANDOFF.json`
|
|
205
|
+
- prompt-injection patterns in persona overrides
|
|
206
|
+
|
|
207
|
+
## Health report format
|
|
208
|
+
Provide summary by category with errors, warnings, info, and exact next fixes.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# MindForge Intelligence — Skill Gap Analyser
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Identify required/recommended skills for a phase, compare with installed
|
|
5
|
+
skills, and report gaps before planning.
|
|
6
|
+
|
|
7
|
+
## Run points
|
|
8
|
+
1. `/mindforge:plan-phase` start
|
|
9
|
+
2. `/mindforge:discuss-phase`
|
|
10
|
+
3. `/mindforge:health`
|
|
11
|
+
|
|
12
|
+
## Analysis flow
|
|
13
|
+
1. Extract work signals from roadmap/context/requirements/architecture.
|
|
14
|
+
2. Map work categories to required/recommended skills.
|
|
15
|
+
3. Validate skills in manifest + filesystem + status.
|
|
16
|
+
4. Report missing/deprecated required skills and mitigation options.
|
|
17
|
+
|
|
18
|
+
## Category -> skill mapping
|
|
19
|
+
- UI/UX -> accessibility (required), performance (recommended)
|
|
20
|
+
- Database changes -> database-patterns (required), data-privacy (if PII)
|
|
21
|
+
- API endpoints -> api-design (required), security-review (if auth)
|
|
22
|
+
- Auth/payments/PII -> security-review (required), data-privacy (required for PII)
|
|
23
|
+
- Performance work -> performance (required)
|
|
24
|
+
- New feature -> testing-standards (required), documentation (recommended)
|
|
25
|
+
|
|
26
|
+
## Gap definition
|
|
27
|
+
A required skill is a gap if:
|
|
28
|
+
- not present in MANIFEST
|
|
29
|
+
- manifest path missing
|
|
30
|
+
- marked deprecated with no replacement
|
|
31
|
+
|
|
32
|
+
## Output
|
|
33
|
+
Produce `Skill Gap Analysis` section with:
|
|
34
|
+
- required skills table
|
|
35
|
+
- recommended skills table
|
|
36
|
+
- explicit gap count and options
|
|
37
|
+
|
|
38
|
+
## Health mode
|
|
39
|
+
In `/mindforge:health`, include org-level recommendation list using recent
|
|
40
|
+
phase patterns and missing capability frequencies.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# MindForge Intelligence — Smart Context Compaction
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Replace truncation with structured extraction so future sessions preserve reasoning,
|
|
5
|
+
constraints, and in-progress state.
|
|
6
|
+
|
|
7
|
+
## Triggering and level selection
|
|
8
|
+
Day 2 threshold (`70%`) remains valid and now invokes Day 5 Level 1.
|
|
9
|
+
Level selection uses both context usage and session depth.
|
|
10
|
+
|
|
11
|
+
- Light session (`<5` tasks): use Level 1 even when context is high.
|
|
12
|
+
- Moderate session (`5-10` tasks): use Level 2 at `80%+`.
|
|
13
|
+
- Deep session (`10+` tasks): use Level 2 at `75%+`.
|
|
14
|
+
- Level 3 at `90%+` or urgent near-limit state.
|
|
15
|
+
|
|
16
|
+
## Levels
|
|
17
|
+
### Level 1 — Lightweight
|
|
18
|
+
Quick checkpoint: update `STATE.md` and `HANDOFF.json` with next task.
|
|
19
|
+
|
|
20
|
+
### Level 2 — Structured extraction
|
|
21
|
+
Capture:
|
|
22
|
+
- decisions made
|
|
23
|
+
- discoveries
|
|
24
|
+
- implicit knowledge
|
|
25
|
+
- quality signals
|
|
26
|
+
- precise in-progress state
|
|
27
|
+
|
|
28
|
+
### Level 3 — Emergency extraction
|
|
29
|
+
Capture minimum viable continuation context before hard limit.
|
|
30
|
+
|
|
31
|
+
## Level 2 extraction protocol
|
|
32
|
+
### Block A — Decisions made
|
|
33
|
+
For each decision: what, why, alternatives ruled out, impact area, ADR need.
|
|
34
|
+
|
|
35
|
+
### Block B — Discoveries
|
|
36
|
+
For each finding: fact, location, significance, assumption impact.
|
|
37
|
+
|
|
38
|
+
### Block C — Current task state
|
|
39
|
+
Record plan id, completed steps, remaining steps, current file, and inconsistency state.
|
|
40
|
+
|
|
41
|
+
### Block D — Implicit knowledge
|
|
42
|
+
Capture quirks, environment facts, and workarounds.
|
|
43
|
+
|
|
44
|
+
A knowledge item qualifies as a **quirk** if either:
|
|
45
|
+
1. It contradicts documentation or expected tool behavior.
|
|
46
|
+
2. A new agent reading only plans/personas would not infer it.
|
|
47
|
+
|
|
48
|
+
### Block E — Quality signals
|
|
49
|
+
Capture failed assumptions, friction patterns, quality gate root causes, and next-plan suggestions.
|
|
50
|
+
|
|
51
|
+
## Level 2 HANDOFF schema additions
|
|
52
|
+
- `decisions_made[]`
|
|
53
|
+
- `discoveries[]`
|
|
54
|
+
- `implicit_knowledge[]`
|
|
55
|
+
- `quality_signals[]`
|
|
56
|
+
- `in_progress.current_state`
|
|
57
|
+
|
|
58
|
+
## Session restart protocol
|
|
59
|
+
When loading Level 2 handoff:
|
|
60
|
+
1. Print compact summary counts.
|
|
61
|
+
2. Preload `implicit_knowledge` before plan execution.
|
|
62
|
+
3. If `in_progress.current_state` is inconsistent, block execution and ask to resolve first.
|
|
63
|
+
4. If user asks to inspect first, print first 50 lines of the inconsistent file inline.
|
|
64
|
+
|
|
65
|
+
## Compaction quality metric
|
|
66
|
+
Write one entry to `.mindforge/metrics/compaction-quality.jsonl`:
|
|
67
|
+
- `decisions_captured`
|
|
68
|
+
- `discoveries_captured`
|
|
69
|
+
- `implicit_knowledge_items`
|
|
70
|
+
- `quality_signals_captured`
|
|
71
|
+
- `next_session_continuation_success` (auto-inferred from next session, nullable initially)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# MindForge Metrics — Schema Reference
|
|
2
|
+
|
|
3
|
+
## Files
|
|
4
|
+
- `session-quality.jsonl`
|
|
5
|
+
- `phase-metrics.jsonl`
|
|
6
|
+
- `skill-usage.jsonl`
|
|
7
|
+
- `compaction-quality.jsonl`
|
|
8
|
+
|
|
9
|
+
All files are append-only JSONL.
|
|
10
|
+
|
|
11
|
+
## session-quality.jsonl fields
|
|
12
|
+
- session_id, date, phase, developer_id
|
|
13
|
+
- tasks_attempted, tasks_completed, tasks_failed
|
|
14
|
+
- verify_pass_rate, quality_gates_failed
|
|
15
|
+
- security_findings, context_compactions
|
|
16
|
+
- skills_loaded_count, antipatterns_detected
|
|
17
|
+
- session_quality_score, session_quality_score_raw
|
|
18
|
+
|
|
19
|
+
Score formula:
|
|
20
|
+
- base 100
|
|
21
|
+
- minus task/gate/security/antipattern penalties
|
|
22
|
+
- bonus for zero gate failures and zero security findings
|
|
23
|
+
- keep both raw and clamped (`0-100`) score for trend analysis
|
|
24
|
+
|
|
25
|
+
## phase-metrics.jsonl fields
|
|
26
|
+
- phase lifecycle and delivery coverage
|
|
27
|
+
- difficulty score
|
|
28
|
+
- security and UAT outcomes
|
|
29
|
+
- phase_quality_score
|
|
30
|
+
|
|
31
|
+
## skill-usage.jsonl fields
|
|
32
|
+
- date, phase, plan
|
|
33
|
+
- skill_name, skill_version
|
|
34
|
+
- trigger_type (`text_match|file_path_match|file_name_match`)
|
|
35
|
+
- trigger_keyword
|
|
36
|
+
- task_outcome, verify_passed_first_try
|
|
37
|
+
|
|
38
|
+
## compaction-quality.jsonl fields
|
|
39
|
+
- date, compaction_level, context_pct_at_compaction
|
|
40
|
+
- decisions_captured, discoveries_captured
|
|
41
|
+
- implicit_knowledge_items, quality_signals_captured
|
|
42
|
+
- next_session_continuation_success (auto-inferred where possible)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MindForge Metrics — Quality Tracker
|
|
2
|
+
|
|
3
|
+
## Trend windows
|
|
4
|
+
- short: last 5 sessions
|
|
5
|
+
- medium: last 20 sessions
|
|
6
|
+
- long: all sessions
|
|
7
|
+
|
|
8
|
+
## Key targets
|
|
9
|
+
- Verify pass rate > 85% (warning < 75%)
|
|
10
|
+
- Task failure rate < 10% (warning > 20%)
|
|
11
|
+
- Compactions < 1 per 8 tasks (warning > 2 per session)
|
|
12
|
+
|
|
13
|
+
## Early warnings
|
|
14
|
+
- quality score drop >= 10 points over 3 sessions
|
|
15
|
+
- any CRITICAL security finding after clean streak
|
|
16
|
+
- compaction overhead > 2/session
|
|
17
|
+
- stale skills not triggered in 10 sessions
|
|
18
|
+
|
|
19
|
+
## Quality metrics -> agent behaviour adjustment
|
|
20
|
+
Automatic adjustments at session start:
|
|
21
|
+
|
|
22
|
+
- If verify pass rate < 75% over last 3 sessions:
|
|
23
|
+
tighten verify-step determinism checks before execution.
|
|
24
|
+
- If last-session task failure rate > 20%:
|
|
25
|
+
halve estimated scope and suggest splitting.
|
|
26
|
+
- If compaction frequency > 2/session:
|
|
27
|
+
proactively summarize every 4 tasks.
|
|
28
|
+
- If security findings trend worsens over 3 phases:
|
|
29
|
+
force-load `security-review` for all tasks in current phase.
|
|
30
|
+
|
|
31
|
+
Always report adjustment to user:
|
|
32
|
+
`Quality signal detected: [signal]. Adjusting behaviour: [adjustment].`
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# MindForge — Cross-Package Planner
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
When a phase spans multiple packages in a monorepo, coordinate execution
|
|
5
|
+
so that shared dependencies are built and tested before packages that
|
|
6
|
+
depend on them.
|
|
7
|
+
|
|
8
|
+
## Execution order algorithm
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Given: a set of packages involved in the current phase
|
|
12
|
+
and their inter-package dependencies
|
|
13
|
+
|
|
14
|
+
Algorithm: topological sort of package dependency graph
|
|
15
|
+
|
|
16
|
+
Input: WORKSPACE-MANIFEST.json dependency_order
|
|
17
|
+
Output: ordered list of packages to process
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
Phase touches: @myapp/api, @myapp/shared, @myapp/web
|
|
21
|
+
Dependencies: api→shared, web→shared, web→api
|
|
22
|
+
Topological order: shared → api → web
|
|
23
|
+
|
|
24
|
+
Execution:
|
|
25
|
+
Wave 1: process @myapp/shared (no dependencies on other changed packages)
|
|
26
|
+
Wave 2: process @myapp/api (depends on Wave 1: shared)
|
|
27
|
+
Wave 3: process @myapp/web (depends on Wave 2: api + Wave 1: shared)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Per-package PLAN file routing
|
|
31
|
+
|
|
32
|
+
When PLAN files are created for a monorepo phase, each plan specifies its target package:
|
|
33
|
+
|
|
34
|
+
```xml
|
|
35
|
+
<task type="auto">
|
|
36
|
+
<n>Add auth middleware to API</n>
|
|
37
|
+
<package>@myapp/api</package>
|
|
38
|
+
<working-dir>apps/api</working-dir>
|
|
39
|
+
<files>
|
|
40
|
+
apps/api/src/middleware/auth.ts
|
|
41
|
+
apps/api/src/middleware/auth.test.ts
|
|
42
|
+
</files>
|
|
43
|
+
<action>...</action>
|
|
44
|
+
<verify>cd apps/api && npm test -- --testPathPattern=auth.middleware</verify>
|
|
45
|
+
<done>Auth middleware tests passing in apps/api</done>
|
|
46
|
+
</task>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Cross-package test execution
|
|
50
|
+
|
|
51
|
+
After all packages in the phase are processed:
|
|
52
|
+
```bash
|
|
53
|
+
# Run tests across all affected packages
|
|
54
|
+
AFFECTED_PACKAGES=$(cat .planning/WORKSPACE-MANIFEST.json | \
|
|
55
|
+
node -e "const m=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')); \
|
|
56
|
+
console.log(m.packages.map(p=>p.path).join(' '))")
|
|
57
|
+
|
|
58
|
+
for PKG_PATH in ${AFFECTED_PACKAGES}; do
|
|
59
|
+
echo "Testing ${PKG_PATH}..."
|
|
60
|
+
cd "${PKG_PATH}" && npm test && cd -
|
|
61
|
+
done
|
|
62
|
+
|
|
63
|
+
# Run integration tests from root (if configured)
|
|
64
|
+
[ -f "package.json" ] && npm run test:integration 2>/dev/null || true
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Affected package detection (revised)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# CORRECTED: Match against declared package paths, not assume 2-level depth
|
|
71
|
+
detect_affected_packages() {
|
|
72
|
+
local MANIFEST=".planning/WORKSPACE-MANIFEST.json"
|
|
73
|
+
|
|
74
|
+
if [ ! -f "${MANIFEST}" ]; then
|
|
75
|
+
echo "Run /mindforge:workspace detect first"
|
|
76
|
+
return 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Get list of changed files
|
|
80
|
+
CHANGED_FILES=$(git diff --name-only HEAD~1 2>/dev/null || git diff --cached --name-only)
|
|
81
|
+
|
|
82
|
+
# For each package in manifest, check if any changed file is within that package
|
|
83
|
+
node -e "
|
|
84
|
+
const fs = require('fs');
|
|
85
|
+
const manifest = JSON.parse(fs.readFileSync('${MANIFEST}', 'utf8'));
|
|
86
|
+
const changedFiles = \`${CHANGED_FILES}\`.split('\n').filter(Boolean);
|
|
87
|
+
|
|
88
|
+
const affected = new Set();
|
|
89
|
+
manifest.packages.forEach(pkg => {
|
|
90
|
+
// Check if any changed file is within this package's path
|
|
91
|
+
const pkgPath = pkg.path.replace(/\/$/, ''); // remove trailing slash
|
|
92
|
+
changedFiles.forEach(file => {
|
|
93
|
+
if (file.startsWith(pkgPath + '/') || file === pkgPath) {
|
|
94
|
+
affected.add(pkg.name);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Also add packages that depend on affected packages
|
|
100
|
+
manifest.packages.forEach(pkg => {
|
|
101
|
+
if (pkg.dependencies && pkg.dependencies.some(dep => affected.has(dep))) {
|
|
102
|
+
affected.add(pkg.name);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
console.log([...affected].join('\n'));
|
|
107
|
+
"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This correctly handles:
|
|
112
|
+
- Packages at any nesting depth (`libs/shared/utils/` → 3 levels deep)
|
|
113
|
+
- Packages whose path is a prefix of another (avoid false matches)
|
|
114
|
+
- Transitive dependencies (packages that depend on changed packages)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MindForge — Dependency Graph Builder
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Build a dependency graph of packages in a monorepo to support topological
|
|
5
|
+
ordering and affected package detection.
|
|
6
|
+
|
|
7
|
+
## Input
|
|
8
|
+
- `.planning/WORKSPACE-MANIFEST.json`
|
|
9
|
+
- Each package's `package.json` dependencies
|
|
10
|
+
|
|
11
|
+
## Output
|
|
12
|
+
A directed graph where nodes are packages and edges represent internal
|
|
13
|
+
package dependencies.
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
```
|
|
17
|
+
@myapp/shared → @myapp/api
|
|
18
|
+
@myapp/shared → @myapp/web
|
|
19
|
+
@myapp/api → @myapp/web
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Steps
|
|
23
|
+
|
|
24
|
+
1. Load `WORKSPACE-MANIFEST.json`.
|
|
25
|
+
2. For each package, read `dependencies` and `devDependencies`.
|
|
26
|
+
3. Filter dependencies to only those that match workspace package names.
|
|
27
|
+
4. Build adjacency list and compute topological order.
|
|
28
|
+
5. Write to `.planning/WORKSPACE-MANIFEST.json` as `dependency_order`.
|
|
29
|
+
|
|
30
|
+
## Failure modes
|
|
31
|
+
- Cycles detected: stop, report cycle path, require manual resolution.
|
|
32
|
+
- Missing package metadata: warn and skip.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# MindForge — Monorepo Workspace Detector
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Detect and understand monorepo structures (npm workspaces, pnpm workspaces,
|
|
5
|
+
Nx, Turborepo, Lerna) so MindForge can plan and execute phases across
|
|
6
|
+
multiple packages correctly.
|
|
7
|
+
|
|
8
|
+
## Supported monorepo types
|
|
9
|
+
|
|
10
|
+
| Type | Detection file | Package locations |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| npm workspaces | `package.json` with `"workspaces":` | Defined in workspaces array |
|
|
13
|
+
| pnpm workspaces | `pnpm-workspace.yaml` | Defined in packages array |
|
|
14
|
+
| Nx | `nx.json` | `apps/` and `libs/` |
|
|
15
|
+
| Turborepo | `turbo.json` | `apps/` and `packages/` |
|
|
16
|
+
| Lerna | `lerna.json` | Defined in packages array |
|
|
17
|
+
| Yarn workspaces | `package.json` with `"workspaces":` | Same as npm |
|
|
18
|
+
|
|
19
|
+
## Detection protocol
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
detect_workspace_type() {
|
|
23
|
+
local ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
24
|
+
|
|
25
|
+
# Check in priority order
|
|
26
|
+
if [ -f "${ROOT}/nx.json" ]; then
|
|
27
|
+
echo "nx"
|
|
28
|
+
elif [ -f "${ROOT}/turbo.json" ]; then
|
|
29
|
+
echo "turborepo"
|
|
30
|
+
elif [ -f "${ROOT}/lerna.json" ]; then
|
|
31
|
+
echo "lerna"
|
|
32
|
+
elif [ -f "${ROOT}/pnpm-workspace.yaml" ]; then
|
|
33
|
+
echo "pnpm"
|
|
34
|
+
elif node -e "
|
|
35
|
+
const p = require('./package.json');
|
|
36
|
+
process.exit(p.workspaces ? 0 : 1)
|
|
37
|
+
" 2>/dev/null; then
|
|
38
|
+
echo "npm-workspaces"
|
|
39
|
+
else
|
|
40
|
+
echo "none"
|
|
41
|
+
fi
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
list_packages() {
|
|
45
|
+
local TYPE="$1"
|
|
46
|
+
case "${TYPE}" in
|
|
47
|
+
nx)
|
|
48
|
+
find apps/ libs/ -name "package.json" -not -path "*/node_modules/*" \
|
|
49
|
+
-exec dirname {} \; 2>/dev/null | sort
|
|
50
|
+
;;
|
|
51
|
+
turborepo)
|
|
52
|
+
find apps/ packages/ -name "package.json" -not -path "*/node_modules/*" \
|
|
53
|
+
-exec dirname {} \; 2>/dev/null | sort
|
|
54
|
+
;;
|
|
55
|
+
pnpm)
|
|
56
|
+
cat pnpm-workspace.yaml | grep "^ -" | sed "s/ - '//;s/'$//"
|
|
57
|
+
;;
|
|
58
|
+
npm-workspaces|lerna)
|
|
59
|
+
node -e "
|
|
60
|
+
const p = require('./package.json');
|
|
61
|
+
const ws = p.workspaces || require('./lerna.json').packages || [];
|
|
62
|
+
ws.forEach(w => console.log(w.replace(/\/\*$/, '')));
|
|
63
|
+
" 2>/dev/null
|
|
64
|
+
;;
|
|
65
|
+
esac
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Package metadata extraction
|
|
70
|
+
|
|
71
|
+
For each detected package, extract:
|
|
72
|
+
```javascript
|
|
73
|
+
{
|
|
74
|
+
"name": "package name from package.json",
|
|
75
|
+
"path": "relative path from monorepo root",
|
|
76
|
+
"type": "app | lib | shared | api | web | cli",
|
|
77
|
+
"dependencies": ["list of internal package dependencies"],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "build command",
|
|
80
|
+
"test": "test command",
|
|
81
|
+
"lint": "lint command"
|
|
82
|
+
},
|
|
83
|
+
"mindforge": {
|
|
84
|
+
"phase-scope": "global | package-specific",
|
|
85
|
+
"test-command": "override test command if needed",
|
|
86
|
+
"affected-by": ["list of packages that affect this one"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Workspace manifest
|
|
92
|
+
|
|
93
|
+
Write to `.planning/WORKSPACE-MANIFEST.json`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"schema_version": "1.0.0",
|
|
98
|
+
"workspace_type": "turborepo",
|
|
99
|
+
"root": "/path/to/project",
|
|
100
|
+
"packages": [
|
|
101
|
+
{
|
|
102
|
+
"name": "@myapp/api",
|
|
103
|
+
"path": "apps/api",
|
|
104
|
+
"type": "api",
|
|
105
|
+
"dependencies": ["@myapp/shared"],
|
|
106
|
+
"test_command": "npm test",
|
|
107
|
+
"build_command": "npm run build"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "@myapp/web",
|
|
111
|
+
"path": "apps/web",
|
|
112
|
+
"type": "web",
|
|
113
|
+
"dependencies": ["@myapp/shared", "@myapp/ui"],
|
|
114
|
+
"test_command": "npm test",
|
|
115
|
+
"build_command": "npm run build"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "@myapp/shared",
|
|
119
|
+
"path": "packages/shared",
|
|
120
|
+
"type": "lib",
|
|
121
|
+
"dependencies": [],
|
|
122
|
+
"test_command": "npm test",
|
|
123
|
+
"build_command": "npm run build"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"dependency_order": ["@myapp/shared", "@myapp/api", "@myapp/web"],
|
|
127
|
+
"affected_packages": {}
|
|
128
|
+
}
|
|
129
|
+
```
|