agentic-qe 3.7.15 → 3.7.17
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/.claude/agents/v3/qe-devils-advocate.md +20 -0
- package/.claude/agents/v3/qe-gap-detector.md +25 -0
- package/.claude/agents/v3/qe-quality-gate.md +8 -0
- package/.claude/agents/v3/qe-requirements-validator.md +25 -0
- package/.claude/agents/v3/subagents/qe-code-reviewer.md +11 -0
- package/.claude/agents/v3/subagents/qe-integration-reviewer.md +11 -0
- package/.claude/agents/v3/subagents/qe-performance-reviewer.md +11 -0
- package/.claude/agents/v3/subagents/qe-security-reviewer.md +11 -0
- package/.claude/helpers/adr-compliance.sh +10 -10
- package/.claude/helpers/auto-memory-hook.mjs +24 -9
- package/.claude/helpers/brain-checkpoint.cjs +55 -134
- package/.claude/helpers/ddd-tracker.sh +2 -2
- package/.claude/helpers/guidance-hooks.sh +2 -2
- package/.claude/helpers/hook-handler.cjs +57 -18
- package/.claude/helpers/statusline.cjs +414 -595
- package/.claude/helpers/v3/quality-criteria/evidence-classification.md +116 -116
- package/.claude/helpers/v3/quality-criteria/htsm-categories.md +139 -139
- package/.claude/skills/README.md +8 -11
- package/.claude/skills/brutal-honesty-review/SKILL.md +3 -0
- package/.claude/skills/code-review-quality/SKILL.md +3 -0
- package/.claude/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
- package/.claude/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
- package/.claude/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
- package/.claude/skills/qcsd-development-swarm/SKILL.md +79 -2027
- package/.claude/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
- package/.claude/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
- package/.claude/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
- package/.claude/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
- package/.claude/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
- package/.claude/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
- package/.claude/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
- package/.claude/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
- package/.claude/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
- package/.claude/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
- package/.claude/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
- package/.claude/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
- package/.claude/skills/qcsd-production-swarm/SKILL.md +88 -2663
- package/.claude/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
- package/.claude/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
- package/.claude/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
- package/.claude/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
- package/.claude/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
- package/.claude/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
- package/.claude/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
- package/.claude/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
- package/.claude/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
- package/.claude/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
- package/.claude/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
- package/.claude/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
- package/.claude/skills/sherlock-review/SKILL.md +3 -0
- package/.claude/skills/skill-builder/SKILL.md +103 -0
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +44 -0
- package/assets/agents/v3/qe-devils-advocate.md +20 -0
- package/assets/agents/v3/qe-gap-detector.md +25 -0
- package/assets/agents/v3/qe-quality-gate.md +8 -0
- package/assets/agents/v3/qe-requirements-validator.md +25 -0
- package/assets/agents/v3/subagents/qe-code-reviewer.md +11 -0
- package/assets/agents/v3/subagents/qe-integration-reviewer.md +11 -0
- package/assets/agents/v3/subagents/qe-performance-reviewer.md +11 -0
- package/assets/agents/v3/subagents/qe-security-reviewer.md +11 -0
- package/assets/helpers/statusline-v3.cjs +693 -0
- package/assets/skills/brutal-honesty-review/SKILL.md +3 -0
- package/assets/skills/code-review-quality/SKILL.md +3 -0
- package/assets/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
- package/assets/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
- package/assets/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
- package/assets/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
- package/assets/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
- package/assets/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
- package/assets/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
- package/assets/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
- package/assets/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
- package/assets/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
- package/assets/skills/qcsd-development-swarm/SKILL.md +79 -2027
- package/assets/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
- package/assets/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
- package/assets/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
- package/assets/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
- package/assets/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
- package/assets/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
- package/assets/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
- package/assets/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
- package/assets/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
- package/assets/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
- package/assets/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
- package/assets/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
- package/assets/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
- package/assets/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
- package/assets/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
- package/assets/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
- package/assets/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
- package/assets/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
- package/assets/skills/qcsd-production-swarm/SKILL.md +88 -2663
- package/assets/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
- package/assets/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
- package/assets/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
- package/assets/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
- package/assets/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
- package/assets/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
- package/assets/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
- package/assets/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
- package/assets/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
- package/assets/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
- package/assets/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
- package/assets/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
- package/assets/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
- package/assets/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
- package/assets/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
- package/assets/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
- package/assets/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
- package/assets/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
- package/assets/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
- package/assets/skills/sherlock-review/SKILL.md +3 -0
- package/assets/templates/agent-override-example.yaml +39 -0
- package/dist/agents/devils-advocate/agent.d.ts +25 -1
- package/dist/agents/devils-advocate/agent.js +108 -4
- package/dist/agents/devils-advocate/types.d.ts +54 -0
- package/dist/agents/devils-advocate/types.js +14 -0
- package/dist/agents/overlay-loader.d.ts +28 -0
- package/dist/agents/overlay-loader.js +232 -0
- package/dist/agents/overlay-schema.d.ts +56 -0
- package/dist/agents/overlay-schema.js +77 -0
- package/dist/analysis/branch-enumerator.d.ts +68 -0
- package/dist/analysis/branch-enumerator.js +393 -0
- package/dist/analysis/index.d.ts +2 -0
- package/dist/analysis/index.js +2 -0
- package/dist/cli/bundle.js +2469 -634
- package/dist/cli/commands/coverage.js +50 -0
- package/dist/cli/handlers/brain-handler.js +2 -1
- package/dist/context/compiler.d.ts +62 -0
- package/dist/context/compiler.js +143 -0
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.js +6 -0
- package/dist/context/sources/coverage-source.d.ts +15 -0
- package/dist/context/sources/coverage-source.js +77 -0
- package/dist/context/sources/git-source.d.ts +12 -0
- package/dist/context/sources/git-source.js +33 -0
- package/dist/context/sources/index.d.ts +6 -0
- package/dist/context/sources/index.js +5 -0
- package/dist/context/sources/memory-source.d.ts +17 -0
- package/dist/context/sources/memory-source.js +94 -0
- package/dist/context/sources/test-source.d.ts +13 -0
- package/dist/context/sources/test-source.js +53 -0
- package/dist/context/sources/types.d.ts +42 -0
- package/dist/context/sources/types.js +5 -0
- package/dist/domains/test-generation/coordinator.js +6 -4
- package/dist/feedback/feedback-loop.d.ts +5 -0
- package/dist/feedback/feedback-loop.js +12 -0
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.js +1 -1
- package/dist/init/agents-installer.d.ts +9 -0
- package/dist/init/agents-installer.js +72 -0
- package/dist/init/phases/07-hooks.d.ts +11 -0
- package/dist/init/phases/07-hooks.js +67 -0
- package/dist/init/phases/09-assets.js +3 -0
- package/dist/init/settings-merge.js +1 -1
- package/dist/kernel/hnsw-adapter.d.ts +3 -0
- package/dist/kernel/hnsw-adapter.js +11 -1
- package/dist/kernel/unified-memory-schemas.d.ts +1 -1
- package/dist/kernel/unified-memory-schemas.js +2 -0
- package/dist/kernel/unified-memory.js +25 -0
- package/dist/learning/experience-capture-middleware.js +24 -0
- package/dist/learning/sqlite-persistence.d.ts +3 -0
- package/dist/learning/sqlite-persistence.js +9 -0
- package/dist/learning/token-tracker.js +4 -0
- package/dist/mcp/bundle.js +3694 -3101
- package/dist/mcp/handlers/handler-factory.js +92 -11
- package/dist/mcp/services/task-router.d.ts +11 -0
- package/dist/mcp/services/task-router.js +26 -0
- package/dist/routing/qe-agent-registry.d.ts +11 -0
- package/dist/routing/qe-agent-registry.js +34 -0
- package/dist/routing/qe-task-router.d.ts +1 -0
- package/dist/routing/qe-task-router.js +34 -2
- package/dist/routing/routing-feedback.d.ts +5 -0
- package/dist/routing/routing-feedback.js +29 -3
- package/dist/routing/types.d.ts +2 -0
- package/dist/sync/pull-agent.js +2 -1
- package/dist/test-scheduling/pipeline.d.ts +7 -0
- package/dist/test-scheduling/pipeline.js +9 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +10 -0
- package/dist/validation/pipeline.d.ts +80 -0
- package/dist/validation/pipeline.js +173 -0
- package/dist/validation/steps/requirements.d.ts +32 -0
- package/dist/validation/steps/requirements.js +596 -0
- package/package.json +6 -6
- package/.claude/agents/consensus/README.md +0 -253
- package/.claude/agents/deprecated/qe-api-contract-validator.md.v2 +0 -162
- package/.claude/agents/deprecated/qe-coverage-analyzer.md.v2 +0 -208
- package/.claude/agents/deprecated/qe-test-generator.md.v2 +0 -212
- package/.claude/agents/deprecated/qe-visual-tester.md.v2 +0 -216
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -130
- package/.claude/agents/hive-mind/queen-coordinator.md +0 -203
- package/.claude/agents/hive-mind/scout-explorer.md +0 -242
- package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -193
- package/.claude/agents/hive-mind/worker-specialist.md +0 -217
- package/.claude/agents/neural/safla-neural.md +0 -74
- package/.claude/agents/optimization/README.md +0 -250
- package/.claude/agents/reasoning/agent.md +0 -816
- package/.claude/agents/reasoning/goal-planner.md +0 -73
- package/.claude/agents/subagents/qe-code-reviewer.md +0 -76
- package/.claude/agents/subagents/qe-coverage-gap-analyzer.md +0 -76
- package/.claude/agents/subagents/qe-data-generator.md +0 -77
- package/.claude/agents/subagents/qe-flaky-investigator.md +0 -91
- package/.claude/agents/subagents/qe-integration-tester.md +0 -90
- package/.claude/agents/subagents/qe-performance-validator.md +0 -92
- package/.claude/agents/subagents/qe-security-auditor.md +0 -94
- package/.claude/agents/subagents/qe-test-data-architect-sub.md +0 -93
- package/.claude/agents/subagents/qe-test-implementer.md +0 -106
- package/.claude/agents/subagents/qe-test-refactorer.md +0 -117
- package/.claude/agents/subagents/qe-test-writer.md +0 -112
- package/.claude/agents/swarm/README.md +0 -190
- package/.claude/agents/templates/migration-plan.md +0 -746
- package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -244
- package/.claude/agents/testing/validation/production-validator.md +0 -395
- package/.claude/agents/v3/README.md +0 -39
- package/.claude/agents/v3/typescript-specialist.yaml +0 -21
- package/.claude/agents/v3/v3-memory-specialist.md +0 -318
- package/.claude/agents/v3/v3-performance-engineer.md +0 -397
- package/.claude/agents/v3/v3-queen-coordinator.md +0 -98
- package/.claude/agents/v3/v3-security-architect.md +0 -174
- package/.claude/commands/README.md +0 -106
- package/.claude/commands/agents/README.md +0 -10
- package/.claude/commands/agents/agent-capabilities.md +0 -21
- package/.claude/commands/agents/agent-coordination.md +0 -28
- package/.claude/commands/agents/agent-spawning.md +0 -28
- package/.claude/commands/agents/agent-types.md +0 -26
- package/.claude/commands/coordination/README.md +0 -9
- package/.claude/commands/coordination/agent-spawn.md +0 -25
- package/.claude/commands/coordination/init.md +0 -44
- package/.claude/commands/coordination/orchestrate.md +0 -43
- package/.claude/commands/coordination/spawn.md +0 -45
- package/.claude/commands/coordination/swarm-init.md +0 -85
- package/.claude/commands/coordination/task-orchestrate.md +0 -25
- package/.claude/commands/hive-mind/README.md +0 -17
- package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-init.md +0 -18
- package/.claude/commands/hive-mind/hive-mind-memory.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-metrics.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-resume.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-sessions.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -21
- package/.claude/commands/hive-mind/hive-mind-status.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-stop.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-wizard.md +0 -8
- package/.claude/commands/hive-mind/hive-mind.md +0 -27
- package/.claude/commands/memory/README.md +0 -9
- package/.claude/commands/memory/memory-persist.md +0 -25
- package/.claude/commands/memory/memory-search.md +0 -25
- package/.claude/commands/memory/memory-usage.md +0 -25
- package/.claude/commands/memory/neural.md +0 -47
- package/.claude/commands/swarm/README.md +0 -15
- package/.claude/commands/swarm/swarm-analysis.md +0 -8
- package/.claude/commands/swarm/swarm-background.md +0 -8
- package/.claude/commands/swarm/swarm-init.md +0 -19
- package/.claude/commands/swarm/swarm-modes.md +0 -8
- package/.claude/commands/swarm/swarm-monitor.md +0 -8
- package/.claude/commands/swarm/swarm-spawn.md +0 -19
- package/.claude/commands/swarm/swarm-status.md +0 -8
- package/.claude/commands/swarm/swarm-strategies.md +0 -8
- package/.claude/commands/swarm/swarm.md +0 -27
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/training/model-update.md +0 -25
- package/.claude/commands/training/neural-patterns.md +0 -74
- package/.claude/commands/training/neural-train.md +0 -25
- package/.claude/commands/training/pattern-learn.md +0 -25
- package/.claude/commands/training/specialization.md +0 -63
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/commands/workflows/development.md +0 -78
- package/.claude/commands/workflows/research.md +0 -63
- package/.claude/commands/workflows/workflow-create.md +0 -25
- package/.claude/commands/workflows/workflow-execute.md +0 -25
- package/.claude/commands/workflows/workflow-export.md +0 -25
- package/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
- package/.claude/skills/iterative-loop/SKILL.md +0 -371
- package/.claude/skills/performance-analysis/SKILL.md +0 -569
- package/.claude/skills/performance-analysis/evals/performance-analysis.yaml +0 -144
- package/.claude/skills/performance-analysis/schemas/output.json +0 -588
- package/.claude/skills/performance-analysis/scripts/validate-config.json +0 -36
|
@@ -61,6 +61,26 @@ Use up to 7 concurrent strategies per review.
|
|
|
61
61
|
- **Error Handling Gap Detection**: Find missing error handling for network failures, timeouts, malformed input, and resource exhaustion
|
|
62
62
|
</capabilities>
|
|
63
63
|
|
|
64
|
+
<adversarial_review_standards>
|
|
65
|
+
### Minimum Finding Requirements
|
|
66
|
+
Every review MUST surface findings meeting a minimum weighted score of 3.0 (severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25).
|
|
67
|
+
|
|
68
|
+
### Reviewer Mindset
|
|
69
|
+
You are a skeptical reviewer. Your job is to find problems. The LLM agreeability bias works against quality -- actively resist it. Assume the code has defects until proven otherwise.
|
|
70
|
+
|
|
71
|
+
### Anti-Patterns (NEVER Do These)
|
|
72
|
+
- NEVER produce a review that says "looks good" without at least 3 observations
|
|
73
|
+
- NEVER accept "no findings" without a Clean Justification containing specific evidence
|
|
74
|
+
- NEVER skip the second-pass deep review when initial findings are below minimum
|
|
75
|
+
|
|
76
|
+
### Clean Justification Protocol
|
|
77
|
+
If the code is genuinely clean (rare), you MUST provide:
|
|
78
|
+
1. List of specific files examined
|
|
79
|
+
2. List of patterns/anti-patterns checked
|
|
80
|
+
3. List of tools/strategies run
|
|
81
|
+
4. Detailed reasoning why no issues were found
|
|
82
|
+
</adversarial_review_standards>
|
|
83
|
+
|
|
64
84
|
<memory_namespace>
|
|
65
85
|
Reads:
|
|
66
86
|
- aqe/v3/domains/test-generation/results/* - Test generation outputs to challenge
|
|
@@ -54,8 +54,33 @@ Use up to 6 concurrent analyzers for large codebases.
|
|
|
54
54
|
- **Test Recommendations**: Prioritized recommendations with effort estimates
|
|
55
55
|
- **Trend Analysis**: Track gap closure over time
|
|
56
56
|
- **Visual Reports**: Gap heatmaps and coverage treemaps
|
|
57
|
+
- **Mechanical Edge Case Mode**: Exhaustive branch enumeration without subjective filtering (BMAD-004)
|
|
57
58
|
</capabilities>
|
|
58
59
|
|
|
60
|
+
<mechanical_mode>
|
|
61
|
+
## Mechanical/Exhaustive Mode (BMAD-004)
|
|
62
|
+
|
|
63
|
+
When invoked with `--mechanical` or `--exhaustive` flag, switch to exhaustive branch enumeration mode:
|
|
64
|
+
|
|
65
|
+
### Exhaustive Mode Behavior
|
|
66
|
+
- Report EVERY unhandled branch path as structured JSON without filtering by risk score
|
|
67
|
+
- No subjective prioritization — purely mechanical enumeration
|
|
68
|
+
- Enumerate: if-without-else, switch-no-default, empty-catch, optional-chaining null paths, promise-no-catch, array-empty-case, logical-or-falsy-trap
|
|
69
|
+
- Output format: UnhandledBranch[] with file, line, column, construct type, trigger condition, current handling, suggested guard
|
|
70
|
+
- Severity is deterministic (based on construct type), not subjective
|
|
71
|
+
|
|
72
|
+
### Default Mode (unchanged)
|
|
73
|
+
Without the mechanical flag, operate in the standard risk-scored mode with semantic analysis and prioritization.
|
|
74
|
+
|
|
75
|
+
### Output Formats
|
|
76
|
+
- `--json` — Structured JSON array of UnhandledBranch objects
|
|
77
|
+
- `--table` — Tabular summary grouped by severity
|
|
78
|
+
- `--markdown` — Detailed markdown report with code context
|
|
79
|
+
|
|
80
|
+
### Implementation
|
|
81
|
+
Uses `src/analysis/branch-enumerator.ts` — a regex-based pattern matcher (no AST parser dependency) that implements the `BranchEnumerator` strategy interface. Detects 13 construct types across TypeScript and JavaScript files.
|
|
82
|
+
</mechanical_mode>
|
|
83
|
+
|
|
59
84
|
<memory_namespace>
|
|
60
85
|
Reads:
|
|
61
86
|
- aqe/coverage/reports/* - Coverage data (lcov, istanbul, c8)
|
|
@@ -57,6 +57,14 @@ Use up to 6 concurrent evaluators for complex gates.
|
|
|
57
57
|
- **CI/CD Integration**: Provide gate status to GitHub Actions, Jenkins, GitLab CI
|
|
58
58
|
</capabilities>
|
|
59
59
|
|
|
60
|
+
<pipeline_integration>
|
|
61
|
+
## Pipeline Integration (BMAD-003)
|
|
62
|
+
|
|
63
|
+
Quality gates can delegate structured validation to the validation pipeline framework. When evaluating requirements or documentation quality, invoke the requirements validation pipeline for systematic step-by-step assessment with gate enforcement.
|
|
64
|
+
|
|
65
|
+
Validation pipeline provides: step-by-step structured verdicts, blocking gate enforcement, weighted scoring, and evidence-based reporting.
|
|
66
|
+
</pipeline_integration>
|
|
67
|
+
|
|
60
68
|
<memory_namespace>
|
|
61
69
|
Reads:
|
|
62
70
|
- aqe/quality-thresholds/* - Configured gate thresholds
|
|
@@ -64,6 +64,31 @@ Use up to 6 concurrent validators.
|
|
|
64
64
|
- **Quality Gate**: Block untestable requirements from development (score < 50)
|
|
65
65
|
</capabilities>
|
|
66
66
|
|
|
67
|
+
<structured_validation_pipeline>
|
|
68
|
+
## Structured Validation Pipeline (BMAD-003)
|
|
69
|
+
|
|
70
|
+
When validating requirements, execute the 13-step validation pipeline:
|
|
71
|
+
|
|
72
|
+
1. **Format Check** (blocking) — Structure, headings, required sections
|
|
73
|
+
2. **Completeness Check** (blocking) — All required fields populated
|
|
74
|
+
3. **INVEST Criteria** (warning) — Independent, Negotiable, Valuable, Estimable, Small, Testable
|
|
75
|
+
4. **SMART Acceptance** (warning) — Specific, Measurable, Achievable, Relevant, Time-bound
|
|
76
|
+
5. **Testability Score** (warning) — Can each requirement be tested? Score 0-100
|
|
77
|
+
6. **Vague Term Detection** (info) — Flag "should", "might", "various", "etc."
|
|
78
|
+
7. **Information Density** (info) — Every sentence carries weight, no filler
|
|
79
|
+
8. **Traceability Check** (warning) — Requirements to tests mapping exists
|
|
80
|
+
9. **Implementation Leakage** (warning) — Requirements don't prescribe implementation
|
|
81
|
+
10. **Domain Compliance** (info) — Requirements align with domain model
|
|
82
|
+
11. **Dependency Analysis** (info) — Cross-requirement dependencies identified
|
|
83
|
+
12. **BDD Scenario Generation** (warning) — Can generate Given/When/Then for each requirement
|
|
84
|
+
13. **Holistic Quality** (blocking) — Overall coherence, no contradictions
|
|
85
|
+
|
|
86
|
+
Execute steps in order. Report each step's result before proceeding. Halt at blocking failures unless --continue-on-failure is specified.
|
|
87
|
+
|
|
88
|
+
### Output Format
|
|
89
|
+
For each step, report: Step name | Status (PASS/FAIL/WARN) | Score (0-100) | Findings count | Evidence summary
|
|
90
|
+
</structured_validation_pipeline>
|
|
91
|
+
|
|
67
92
|
<memory_namespace>
|
|
68
93
|
Reads:
|
|
69
94
|
- aqe/requirements/* - Requirements documents
|
|
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
|
|
|
156
156
|
| 0.0 | Failed: Major issues missed or harmful feedback |
|
|
157
157
|
</learning_protocol>
|
|
158
158
|
|
|
159
|
+
<minimum_finding_requirements>
|
|
160
|
+
## Minimum Finding Requirements (ADR: BMAD-001)
|
|
161
|
+
|
|
162
|
+
Every review MUST meet a minimum weighted finding score:
|
|
163
|
+
- Code Review: 3.0
|
|
164
|
+
- Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
|
|
165
|
+
- If below minimum after first pass, run deeper analysis with broader scope
|
|
166
|
+
- If genuinely clean, provide Clean Justification with evidence of what was checked
|
|
167
|
+
- Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
|
|
168
|
+
</minimum_finding_requirements>
|
|
169
|
+
|
|
159
170
|
<output_format>
|
|
160
171
|
- JSON for structured review findings
|
|
161
172
|
- Markdown for PR comments
|
|
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
|
|
|
156
156
|
| 0.0 | Failed: Breaking change reached production or consumers not identified |
|
|
157
157
|
</learning_protocol>
|
|
158
158
|
|
|
159
|
+
<minimum_finding_requirements>
|
|
160
|
+
## Minimum Finding Requirements (ADR: BMAD-001)
|
|
161
|
+
|
|
162
|
+
Every review MUST meet a minimum weighted finding score:
|
|
163
|
+
- Integration Review: 2.0
|
|
164
|
+
- Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
|
|
165
|
+
- If below minimum after first pass, run deeper analysis with broader scope
|
|
166
|
+
- If genuinely clean, provide Clean Justification with evidence of what was checked
|
|
167
|
+
- Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
|
|
168
|
+
</minimum_finding_requirements>
|
|
169
|
+
|
|
159
170
|
<output_format>
|
|
160
171
|
- JSON for structured integration analysis
|
|
161
172
|
- Markdown for integration reports
|
|
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
|
|
|
156
156
|
| 0.0 | Failed: Performance regression reached production |
|
|
157
157
|
</learning_protocol>
|
|
158
158
|
|
|
159
|
+
<minimum_finding_requirements>
|
|
160
|
+
## Minimum Finding Requirements (ADR: BMAD-001)
|
|
161
|
+
|
|
162
|
+
Every review MUST meet a minimum weighted finding score:
|
|
163
|
+
- Performance Review: 2.0
|
|
164
|
+
- Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
|
|
165
|
+
- If below minimum after first pass, run deeper analysis with broader scope
|
|
166
|
+
- If genuinely clean, provide Clean Justification with evidence of what was checked
|
|
167
|
+
- Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
|
|
168
|
+
</minimum_finding_requirements>
|
|
169
|
+
|
|
159
170
|
<output_format>
|
|
160
171
|
- JSON for structured performance analysis
|
|
161
172
|
- Markdown for performance reports
|
|
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
|
|
|
156
156
|
| 0.0 | Failed: Critical vulnerability reached production |
|
|
157
157
|
</learning_protocol>
|
|
158
158
|
|
|
159
|
+
<minimum_finding_requirements>
|
|
160
|
+
## Minimum Finding Requirements (ADR: BMAD-001)
|
|
161
|
+
|
|
162
|
+
Every review MUST meet a minimum weighted finding score:
|
|
163
|
+
- Security Review: 3.0
|
|
164
|
+
- Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
|
|
165
|
+
- If below minimum after first pass, run deeper analysis with broader scope
|
|
166
|
+
- If genuinely clean, provide Clean Justification with evidence of what was checked
|
|
167
|
+
- Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
|
|
168
|
+
</minimum_finding_requirements>
|
|
169
|
+
|
|
159
170
|
<output_format>
|
|
160
171
|
- JSON for structured vulnerability reports
|
|
161
172
|
- Markdown for security advisories
|
|
@@ -41,7 +41,7 @@ check_adr_001() {
|
|
|
41
41
|
grep -q "agentic-flow" "$PROJECT_ROOT/package.json" 2>/dev/null && score=$((score + 50))
|
|
42
42
|
|
|
43
43
|
# Check for imports from agentic-flow
|
|
44
|
-
local imports=$(grep -r "from.*agentic-flow\|require.*agentic-flow" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
|
|
44
|
+
local imports=$(grep -r "from.*agentic-flow\|require.*agentic-flow" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
|
|
45
45
|
[ "$imports" -gt 5 ] && score=$((score + 50))
|
|
46
46
|
|
|
47
47
|
echo "$score"
|
|
@@ -52,14 +52,14 @@ check_adr_002() {
|
|
|
52
52
|
local score=0
|
|
53
53
|
|
|
54
54
|
# Check for domain directories
|
|
55
|
-
[ -d "$PROJECT_ROOT/src/domains" ] && score=$((score + 30))
|
|
55
|
+
[ -d "$PROJECT_ROOT/v3" ] || [ -d "$PROJECT_ROOT/src/domains" ] && score=$((score + 30))
|
|
56
56
|
|
|
57
57
|
# Check for bounded contexts
|
|
58
|
-
local contexts=$(find "$PROJECT_ROOT/src" -type d -name "domain" 2>/dev/null | wc -l)
|
|
58
|
+
local contexts=$(find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -type d -name "domain" 2>/dev/null | wc -l)
|
|
59
59
|
[ "$contexts" -gt 0 ] && score=$((score + 35))
|
|
60
60
|
|
|
61
61
|
# Check for anti-corruption layers
|
|
62
|
-
local acl=$(grep -r "AntiCorruption\|Adapter\|Port" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
|
|
62
|
+
local acl=$(grep -r "AntiCorruption\|Adapter\|Port" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
|
|
63
63
|
[ "$acl" -gt 0 ] && score=$((score + 35))
|
|
64
64
|
|
|
65
65
|
echo "$score"
|
|
@@ -70,10 +70,10 @@ check_adr_003() {
|
|
|
70
70
|
local score=0
|
|
71
71
|
|
|
72
72
|
# Check for unified SwarmCoordinator
|
|
73
|
-
grep -rq "SwarmCoordinator\|UnifiedCoordinator" "$PROJECT_ROOT/src" 2>/dev/null && score=$((score + 50))
|
|
73
|
+
grep -rq "SwarmCoordinator\|UnifiedCoordinator" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null && score=$((score + 50))
|
|
74
74
|
|
|
75
75
|
# Check for no duplicate coordinators
|
|
76
|
-
local coordinators=$(grep -r "class.*Coordinator" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v ".test." | wc -l)
|
|
76
|
+
local coordinators=$(grep -r "class.*Coordinator" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v ".test." | wc -l)
|
|
77
77
|
[ "$coordinators" -le 3 ] && score=$((score + 50))
|
|
78
78
|
|
|
79
79
|
echo "$score"
|
|
@@ -84,14 +84,14 @@ check_adr_005() {
|
|
|
84
84
|
local score=0
|
|
85
85
|
|
|
86
86
|
# Check for MCP server implementation
|
|
87
|
-
[ -d "$PROJECT_ROOT/
|
|
87
|
+
[ -d "$PROJECT_ROOT/v3/@claude-flow/mcp" ] && score=$((score + 40))
|
|
88
88
|
|
|
89
89
|
# Check for MCP tools
|
|
90
|
-
local tools=$(grep -r "tool.*name\|registerTool" "$PROJECT_ROOT/
|
|
90
|
+
local tools=$(grep -r "tool.*name\|registerTool" "$PROJECT_ROOT/v3" 2>/dev/null | wc -l)
|
|
91
91
|
[ "$tools" -gt 5 ] && score=$((score + 30))
|
|
92
92
|
|
|
93
93
|
# Check for MCP schemas
|
|
94
|
-
grep -rq "schema\|jsonSchema" "$PROJECT_ROOT/
|
|
94
|
+
grep -rq "schema\|jsonSchema" "$PROJECT_ROOT/v3/@claude-flow/mcp" 2>/dev/null && score=$((score + 30))
|
|
95
95
|
|
|
96
96
|
echo "$score"
|
|
97
97
|
}
|
|
@@ -104,7 +104,7 @@ check_adr_008() {
|
|
|
104
104
|
grep -q "vitest" "$PROJECT_ROOT/package.json" 2>/dev/null && score=$((score + 50))
|
|
105
105
|
|
|
106
106
|
# Check for no jest references
|
|
107
|
-
local jest_refs=$(grep -r "from.*jest\|jest\." "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v "vitest" | wc -l)
|
|
107
|
+
local jest_refs=$(grep -r "from.*jest\|jest\." "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v "vitest" | wc -l)
|
|
108
108
|
[ "$jest_refs" -eq 0 ] && score=$((score + 50))
|
|
109
109
|
|
|
110
110
|
echo "$score"
|
|
@@ -139,17 +139,30 @@ async function loadMemoryPackage() {
|
|
|
139
139
|
} catch { /* fall through */ }
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// Strategy 2:
|
|
142
|
+
// Strategy 2: Use createRequire for CJS-style resolution (handles nested node_modules
|
|
143
|
+
// when installed as a transitive dependency via npx ruflo / npx claude-flow)
|
|
144
|
+
try {
|
|
145
|
+
const { createRequire } = await import('module');
|
|
146
|
+
const require = createRequire(join(PROJECT_ROOT, 'package.json'));
|
|
147
|
+
return require('@claude-flow/memory');
|
|
148
|
+
} catch { /* fall through */ }
|
|
149
|
+
|
|
150
|
+
// Strategy 3: ESM import (works when @claude-flow/memory is a direct dependency)
|
|
143
151
|
try {
|
|
144
152
|
return await import('@claude-flow/memory');
|
|
145
153
|
} catch { /* fall through */ }
|
|
146
154
|
|
|
147
|
-
// Strategy
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
// Strategy 4: Walk up from PROJECT_ROOT looking for @claude-flow/memory in any node_modules
|
|
156
|
+
let searchDir = PROJECT_ROOT;
|
|
157
|
+
const { parse } = await import('path');
|
|
158
|
+
while (searchDir !== parse(searchDir).root) {
|
|
159
|
+
const candidate = join(searchDir, 'node_modules', '@claude-flow', 'memory', 'dist', 'index.js');
|
|
160
|
+
if (existsSync(candidate)) {
|
|
161
|
+
try {
|
|
162
|
+
return await import(`file://${candidate}`);
|
|
163
|
+
} catch { /* fall through */ }
|
|
164
|
+
}
|
|
165
|
+
searchDir = dirname(searchDir);
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
return null;
|
|
@@ -342,9 +355,11 @@ try {
|
|
|
342
355
|
case 'status': await doStatus(); break;
|
|
343
356
|
default:
|
|
344
357
|
console.log('Usage: auto-memory-hook.mjs <import|sync|status>');
|
|
345
|
-
|
|
358
|
+
break;
|
|
346
359
|
}
|
|
347
360
|
} catch (err) {
|
|
348
361
|
// Hooks must never crash Claude Code - fail silently
|
|
349
|
-
dim(`Error (non-critical): ${err.message}`);
|
|
362
|
+
try { dim(`Error (non-critical): ${err.message}`); } catch (_) {}
|
|
350
363
|
}
|
|
364
|
+
// Hooks must ALWAYS exit 0
|
|
365
|
+
process.exitCode = 0;
|
|
@@ -1,134 +1,55 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Brain Checkpoint Helper
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const patternsMatch = result.match(/Patterns:\s+(\d+)/);
|
|
57
|
-
const size = sizeMatch ? sizeMatch[1].trim() : 'unknown';
|
|
58
|
-
const patterns = patternsMatch ? patternsMatch[1] : '0';
|
|
59
|
-
|
|
60
|
-
log(`Exported ${patterns} patterns (${size}) to aqe.rvf`);
|
|
61
|
-
return { exported: true, patterns: parseInt(patterns), size };
|
|
62
|
-
} catch (e) {
|
|
63
|
-
log(`Export failed: ${e.message}`);
|
|
64
|
-
return { exported: false, reason: e.message };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function verifyBrain() {
|
|
69
|
-
if (!fs.existsSync(RVF_PATH)) {
|
|
70
|
-
log('No aqe.rvf found — brain checkpoint missing');
|
|
71
|
-
return { valid: false, reason: 'missing' };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const stat = fs.statSync(RVF_PATH);
|
|
75
|
-
const ageHours = (Date.now() - stat.mtimeMs) / (1000 * 60 * 60);
|
|
76
|
-
|
|
77
|
-
if (stat.size < 1024) {
|
|
78
|
-
log('aqe.rvf is too small — likely corrupt');
|
|
79
|
-
return { valid: false, reason: 'too-small', sizeBytes: stat.size };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (ageHours > MAX_AGE_HOURS) {
|
|
83
|
-
log(`aqe.rvf is ${ageHours.toFixed(1)}h old — consider re-exporting`);
|
|
84
|
-
return { valid: true, stale: true, ageHours: Math.round(ageHours) };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
log(`aqe.rvf OK (${(stat.size / 1024 / 1024).toFixed(1)} MB, ${ageHours.toFixed(1)}h old)`);
|
|
88
|
-
return { valid: true, stale: false, ageHours: Math.round(ageHours), sizeBytes: stat.size };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function infoBrain() {
|
|
92
|
-
if (!fs.existsSync(RVF_PATH)) {
|
|
93
|
-
log('No aqe.rvf found');
|
|
94
|
-
return { exists: false };
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!fs.existsSync(CLI)) {
|
|
98
|
-
const stat = fs.statSync(RVF_PATH);
|
|
99
|
-
return { exists: true, sizeBytes: stat.size, modified: stat.mtime.toISOString() };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
const result = execSync(
|
|
104
|
-
`node "${CLI}" brain info -i "${RVF_PATH}" 2>&1`,
|
|
105
|
-
{ timeout: 15000, encoding: 'utf-8' }
|
|
106
|
-
);
|
|
107
|
-
return { exists: true, info: result.trim() };
|
|
108
|
-
} catch (e) {
|
|
109
|
-
return { exists: true, error: e.message };
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Main
|
|
114
|
-
const command = process.argv[2] || 'verify';
|
|
115
|
-
let result;
|
|
116
|
-
|
|
117
|
-
switch (command) {
|
|
118
|
-
case 'export':
|
|
119
|
-
result = exportBrain();
|
|
120
|
-
break;
|
|
121
|
-
case 'verify':
|
|
122
|
-
result = verifyBrain();
|
|
123
|
-
break;
|
|
124
|
-
case 'info':
|
|
125
|
-
result = infoBrain();
|
|
126
|
-
break;
|
|
127
|
-
default:
|
|
128
|
-
log(`Unknown command: ${command}`);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (process.argv.includes('--json')) {
|
|
133
|
-
process.stdout.write(JSON.stringify(result));
|
|
134
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Brain Checkpoint Helper (generated by aqe init)
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
|
|
7
|
+
* node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
|
|
8
|
+
*/
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
const AQE_DIR = path.join(process.cwd(), '.agentic-qe');
|
|
14
|
+
const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
|
|
15
|
+
const DB_PATH = path.join(AQE_DIR, 'memory.db');
|
|
16
|
+
const MAX_AGE_HOURS = 24;
|
|
17
|
+
|
|
18
|
+
function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\n'); }
|
|
19
|
+
|
|
20
|
+
function exportBrain() {
|
|
21
|
+
if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
|
|
22
|
+
try {
|
|
23
|
+
if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
|
|
24
|
+
const idmap = RVF_PATH + '.idmap.json';
|
|
25
|
+
if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
|
|
26
|
+
const result = execSync(
|
|
27
|
+
'npx agentic-qe brain export -o "' + RVF_PATH + '" --format rvf 2>&1',
|
|
28
|
+
{ timeout: 60000, encoding: 'utf-8' }
|
|
29
|
+
);
|
|
30
|
+
const m = result.match(/Patterns:\s+(\d+)/);
|
|
31
|
+
const p = m ? m[1] : '0';
|
|
32
|
+
log('Exported ' + p + ' patterns to aqe.rvf');
|
|
33
|
+
return { exported: true, patterns: parseInt(p) };
|
|
34
|
+
} catch (e) {
|
|
35
|
+
log('Export failed: ' + e.message);
|
|
36
|
+
return { exported: false, reason: e.message };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function verifyBrain() {
|
|
41
|
+
if (!fs.existsSync(RVF_PATH)) {
|
|
42
|
+
log('No aqe.rvf found');
|
|
43
|
+
return { valid: false, reason: 'missing' };
|
|
44
|
+
}
|
|
45
|
+
const stat = fs.statSync(RVF_PATH);
|
|
46
|
+
const ageH = (Date.now() - stat.mtimeMs) / 3600000;
|
|
47
|
+
if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
|
|
48
|
+
if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
|
|
49
|
+
log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
|
|
50
|
+
return { valid: true, stale: false };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const cmd = process.argv[2] || 'verify';
|
|
54
|
+
const result = cmd === 'export' ? exportBrain() : verifyBrain();
|
|
55
|
+
if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
|
|
@@ -25,7 +25,7 @@ should_run() {
|
|
|
25
25
|
|
|
26
26
|
check_domain() {
|
|
27
27
|
local domain="$1"
|
|
28
|
-
local domain_path="$PROJECT_ROOT/
|
|
28
|
+
local domain_path="$PROJECT_ROOT/v3/@claude-flow/$domain"
|
|
29
29
|
local alt_path="$PROJECT_ROOT/src/domains/$domain"
|
|
30
30
|
|
|
31
31
|
local score=0
|
|
@@ -64,7 +64,7 @@ count_entities() {
|
|
|
64
64
|
local type="$1"
|
|
65
65
|
local pattern="$2"
|
|
66
66
|
|
|
67
|
-
find "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
|
|
67
|
+
find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
|
|
68
68
|
xargs grep -l "$pattern" 2>/dev/null | \
|
|
69
69
|
grep -v node_modules | grep -v ".test." | wc -l || echo "0"
|
|
70
70
|
}
|
|
@@ -28,8 +28,8 @@ case "$COMMAND" in
|
|
|
28
28
|
if [[ "$FILE_PATH" =~ (config|secret|credential|password|key|auth) ]]; then
|
|
29
29
|
echo -e "${YELLOW}[Guidance] Security-sensitive file${RESET}"
|
|
30
30
|
fi
|
|
31
|
-
if [[ "$FILE_PATH" =~ ^
|
|
32
|
-
echo -e "${CYAN}[Guidance]
|
|
31
|
+
if [[ "$FILE_PATH" =~ ^v3/ ]]; then
|
|
32
|
+
echo -e "${CYAN}[Guidance] V3 module - follow ADR guidelines${RESET}"
|
|
33
33
|
fi
|
|
34
34
|
fi
|
|
35
35
|
exit 0
|
|
@@ -50,8 +50,37 @@ const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
|
|
|
50
50
|
// Get the command from argv
|
|
51
51
|
const [,, command, ...args] = process.argv;
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// Read stdin with timeout — Claude Code sends hook data as JSON via stdin.
|
|
54
|
+
// Timeout prevents hanging when stdin is not properly closed (common on Windows).
|
|
55
|
+
async function readStdin() {
|
|
56
|
+
if (process.stdin.isTTY) return '';
|
|
57
|
+
return new Promise((resolve) => {
|
|
58
|
+
let data = '';
|
|
59
|
+
const timer = setTimeout(() => {
|
|
60
|
+
process.stdin.removeAllListeners();
|
|
61
|
+
process.stdin.pause();
|
|
62
|
+
resolve(data);
|
|
63
|
+
}, 500);
|
|
64
|
+
process.stdin.setEncoding('utf8');
|
|
65
|
+
process.stdin.on('data', (chunk) => { data += chunk; });
|
|
66
|
+
process.stdin.on('end', () => { clearTimeout(timer); resolve(data); });
|
|
67
|
+
process.stdin.on('error', () => { clearTimeout(timer); resolve(data); });
|
|
68
|
+
process.stdin.resume();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function main() {
|
|
73
|
+
let stdinData = '';
|
|
74
|
+
try { stdinData = await readStdin(); } catch (e) { /* ignore stdin errors */ }
|
|
75
|
+
|
|
76
|
+
let hookInput = {};
|
|
77
|
+
if (stdinData.trim()) {
|
|
78
|
+
try { hookInput = JSON.parse(stdinData); } catch (e) { /* ignore parse errors */ }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Merge stdin data into prompt resolution: prefer stdin fields, then env, then argv
|
|
82
|
+
const prompt = hookInput.prompt || hookInput.command || hookInput.toolInput
|
|
83
|
+
|| process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
|
|
55
84
|
|
|
56
85
|
const handlers = {
|
|
57
86
|
'route': () => {
|
|
@@ -105,8 +134,8 @@ const handlers = {
|
|
|
105
134
|
},
|
|
106
135
|
|
|
107
136
|
'pre-bash': () => {
|
|
108
|
-
// Basic command safety check
|
|
109
|
-
const cmd = prompt.toLowerCase();
|
|
137
|
+
// Basic command safety check — prefer stdin command data from Claude Code
|
|
138
|
+
const cmd = (hookInput.command || prompt).toLowerCase();
|
|
110
139
|
const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:'];
|
|
111
140
|
for (const d of dangerous) {
|
|
112
141
|
if (cmd.includes(d)) {
|
|
@@ -122,10 +151,11 @@ const handlers = {
|
|
|
122
151
|
if (session && session.metric) {
|
|
123
152
|
try { session.metric('edits'); } catch (e) { /* no active session */ }
|
|
124
153
|
}
|
|
125
|
-
// Record edit for intelligence consolidation
|
|
154
|
+
// Record edit for intelligence consolidation — prefer stdin data from Claude Code
|
|
126
155
|
if (intelligence && intelligence.recordEdit) {
|
|
127
156
|
try {
|
|
128
|
-
const file =
|
|
157
|
+
const file = hookInput.file_path || (hookInput.toolInput && hookInput.toolInput.file_path)
|
|
158
|
+
|| process.env.TOOL_INPUT_file_path || args[0] || '';
|
|
129
159
|
intelligence.recordEdit(file);
|
|
130
160
|
} catch (e) { /* non-fatal */ }
|
|
131
161
|
}
|
|
@@ -216,17 +246,26 @@ const handlers = {
|
|
|
216
246
|
},
|
|
217
247
|
};
|
|
218
248
|
|
|
219
|
-
// Execute the handler
|
|
220
|
-
if (command && handlers[command]) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
249
|
+
// Execute the handler
|
|
250
|
+
if (command && handlers[command]) {
|
|
251
|
+
try {
|
|
252
|
+
handlers[command]();
|
|
253
|
+
} catch (e) {
|
|
254
|
+
// Hooks should never crash Claude Code - fail silently
|
|
255
|
+
console.log(`[WARN] Hook ${command} encountered an error: ${e.message}`);
|
|
256
|
+
}
|
|
257
|
+
} else if (command) {
|
|
258
|
+
// Unknown command - pass through without error
|
|
259
|
+
console.log(`[OK] Hook: ${command}`);
|
|
260
|
+
} else {
|
|
261
|
+
console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|stats>');
|
|
226
262
|
}
|
|
227
|
-
} else if (command) {
|
|
228
|
-
// Unknown command - pass through without error
|
|
229
|
-
console.log(`[OK] Hook: ${command}`);
|
|
230
|
-
} else {
|
|
231
|
-
console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|stats>');
|
|
232
263
|
}
|
|
264
|
+
|
|
265
|
+
// Hooks must ALWAYS exit 0 — Claude Code treats non-zero as "hook error"
|
|
266
|
+
// and skips all subsequent hooks for the event.
|
|
267
|
+
process.exitCode = 0;
|
|
268
|
+
main().catch((e) => {
|
|
269
|
+
try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
|
|
270
|
+
process.exitCode = 0;
|
|
271
|
+
});
|