agentic-qe 3.7.16 → 3.7.18
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 -145
- 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 +29 -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 +2415 -624
- package/dist/cli/commands/coverage.js +50 -0
- 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/init/agents-installer.d.ts +9 -0
- package/dist/init/agents-installer.js +79 -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 +18 -10
- package/dist/init/settings-merge.js +1 -1
- package/dist/mcp/bundle.js +4411 -3979
- 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/types.d.ts +2 -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
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agentic QE v3 Statusline Generator (Node.js)
|
|
4
|
+
* Combines best of claude-flow and AQE v3 approaches
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Fast Node.js execution
|
|
8
|
+
* - Accurate sqlite3 queries for patterns/experiences
|
|
9
|
+
* - Claude Code stdin JSON for context awareness
|
|
10
|
+
* - Real-time process detection for running agents
|
|
11
|
+
* - CVE caching for performance
|
|
12
|
+
* - JSON output mode for automation
|
|
13
|
+
*
|
|
14
|
+
* Usage: node statusline-v3.cjs [--json] [--compact] [--no-color]
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const { execSync, spawnSync } = require('child_process');
|
|
20
|
+
|
|
21
|
+
// Use better-sqlite3 for reliable database access (no CLI dependency)
|
|
22
|
+
let Database;
|
|
23
|
+
try {
|
|
24
|
+
Database = require('better-sqlite3');
|
|
25
|
+
// Verify native bindings actually work (require succeeds but constructor
|
|
26
|
+
// may throw if .node binary isn't compiled for this platform)
|
|
27
|
+
const testDb = new Database(':memory:');
|
|
28
|
+
testDb.pragma('busy_timeout = 5000');
|
|
29
|
+
testDb.close();
|
|
30
|
+
} catch {
|
|
31
|
+
Database = null; // Fallback to CLI if better-sqlite3 not available
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════
|
|
35
|
+
// Configuration
|
|
36
|
+
// ═══════════════════════════════════════════════════════════════
|
|
37
|
+
|
|
38
|
+
const CONFIG = {
|
|
39
|
+
// Targets
|
|
40
|
+
domainsTotal: 13,
|
|
41
|
+
v3QeTarget: 60,
|
|
42
|
+
coverageTarget: 90,
|
|
43
|
+
learningTarget: 15,
|
|
44
|
+
flashAttentionTarget: '2.49x-7.47x',
|
|
45
|
+
intelligenceTargetExp: 1000, // 1000 experiences = 100%
|
|
46
|
+
|
|
47
|
+
// Paths - ROOT database is the consolidated source (MCP writes here)
|
|
48
|
+
// Priority: root > v3 (v3 db is stale, kept only for backup)
|
|
49
|
+
memoryDbPaths: [
|
|
50
|
+
'.agentic-qe/memory.db', // PRIMARY: Project root memory database
|
|
51
|
+
],
|
|
52
|
+
cveCache: '.agentic-qe/.cve-cache',
|
|
53
|
+
cveCacheAge: 3600, // 1 hour
|
|
54
|
+
learningConfigPaths: [
|
|
55
|
+
'.agentic-qe/data/learning-config.json', // Root data dir
|
|
56
|
+
'.agentic-qe/learning-config.json', // Root fallback
|
|
57
|
+
],
|
|
58
|
+
coverageFile: 'coverage/coverage-summary.json',
|
|
59
|
+
|
|
60
|
+
// Domain list
|
|
61
|
+
domains: [
|
|
62
|
+
'test-generation', 'test-execution', 'coverage-analysis',
|
|
63
|
+
'quality-assessment', 'defect-intelligence', 'requirements-validation',
|
|
64
|
+
'code-intelligence', 'security-compliance', 'contract-testing',
|
|
65
|
+
'visual-accessibility', 'chaos-resilience', 'learning-optimization',
|
|
66
|
+
'enterprise-integration'
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// ═══════════════════════════════════════════════════════════════
|
|
71
|
+
// ANSI Colors
|
|
72
|
+
// ═══════════════════════════════════════════════════════════════
|
|
73
|
+
|
|
74
|
+
const useColor = !process.argv.includes('--no-color');
|
|
75
|
+
|
|
76
|
+
const c = useColor ? {
|
|
77
|
+
reset: '\x1b[0m',
|
|
78
|
+
bold: '\x1b[1m',
|
|
79
|
+
dim: '\x1b[2m',
|
|
80
|
+
red: '\x1b[0;31m',
|
|
81
|
+
green: '\x1b[0;32m',
|
|
82
|
+
yellow: '\x1b[0;33m',
|
|
83
|
+
blue: '\x1b[0;34m',
|
|
84
|
+
purple: '\x1b[0;35m',
|
|
85
|
+
cyan: '\x1b[0;36m',
|
|
86
|
+
white: '\x1b[0;37m',
|
|
87
|
+
brightRed: '\x1b[1;31m',
|
|
88
|
+
brightGreen: '\x1b[1;32m',
|
|
89
|
+
brightYellow: '\x1b[1;33m',
|
|
90
|
+
brightBlue: '\x1b[1;34m',
|
|
91
|
+
brightPurple: '\x1b[1;35m',
|
|
92
|
+
brightCyan: '\x1b[1;36m',
|
|
93
|
+
brightWhite: '\x1b[1;37m',
|
|
94
|
+
} : Object.fromEntries(Object.keys({
|
|
95
|
+
reset: '', bold: '', dim: '', red: '', green: '', yellow: '',
|
|
96
|
+
blue: '', purple: '', cyan: '', white: '', brightRed: '', brightGreen: '',
|
|
97
|
+
brightYellow: '', brightBlue: '', brightPurple: '', brightCyan: '', brightWhite: ''
|
|
98
|
+
}).map(k => [k, '']));
|
|
99
|
+
|
|
100
|
+
// ═══════════════════════════════════════════════════════════════
|
|
101
|
+
// Utility Functions
|
|
102
|
+
// ═══════════════════════════════════════════════════════════════
|
|
103
|
+
|
|
104
|
+
function execQuiet(cmd, defaultValue = '') {
|
|
105
|
+
try {
|
|
106
|
+
return execSync(cmd, { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
107
|
+
} catch {
|
|
108
|
+
return defaultValue;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function fileExists(filePath) {
|
|
113
|
+
try {
|
|
114
|
+
return fs.existsSync(filePath);
|
|
115
|
+
} catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function readJsonFile(filePath, defaultValue = {}) {
|
|
121
|
+
try {
|
|
122
|
+
if (fileExists(filePath)) {
|
|
123
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
// Ignore
|
|
127
|
+
}
|
|
128
|
+
return defaultValue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Database connection cache for performance
|
|
132
|
+
let dbCache = new Map();
|
|
133
|
+
|
|
134
|
+
function getDb(dbPath) {
|
|
135
|
+
if (!dbCache.has(dbPath)) {
|
|
136
|
+
if (Database && fileExists(dbPath)) {
|
|
137
|
+
try {
|
|
138
|
+
const db = new Database(dbPath, { readonly: true, fileMustExist: true });
|
|
139
|
+
db.pragma('busy_timeout = 5000');
|
|
140
|
+
dbCache.set(dbPath, db);
|
|
141
|
+
} catch {
|
|
142
|
+
dbCache.set(dbPath, null);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
dbCache.set(dbPath, null);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return dbCache.get(dbPath);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function sqlite3Query(dbPath, query, defaultValue = '0') {
|
|
152
|
+
if (!fileExists(dbPath)) return defaultValue;
|
|
153
|
+
|
|
154
|
+
// Prefer better-sqlite3 (Node.js native, no CLI dependency)
|
|
155
|
+
if (Database) {
|
|
156
|
+
try {
|
|
157
|
+
const db = getDb(dbPath);
|
|
158
|
+
if (db) {
|
|
159
|
+
const row = db.prepare(query).get();
|
|
160
|
+
if (row) {
|
|
161
|
+
// Return the first column value
|
|
162
|
+
const values = Object.values(row);
|
|
163
|
+
return values.length > 0 ? String(values[0]) : defaultValue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return defaultValue;
|
|
167
|
+
} catch {
|
|
168
|
+
return defaultValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Fallback to CLI if better-sqlite3 not available
|
|
173
|
+
try {
|
|
174
|
+
const result = execSync(`sqlite3 "${dbPath}" "${query}" 2>/dev/null`, {
|
|
175
|
+
encoding: 'utf-8',
|
|
176
|
+
timeout: 3000
|
|
177
|
+
}).trim();
|
|
178
|
+
return result || defaultValue;
|
|
179
|
+
} catch {
|
|
180
|
+
return defaultValue;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function padLeft(str, len) {
|
|
185
|
+
return String(str).padStart(len, ' ');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ═══════════════════════════════════════════════════════════════
|
|
189
|
+
// Data Collection Functions
|
|
190
|
+
// ═══════════════════════════════════════════════════════════════
|
|
191
|
+
|
|
192
|
+
function getClaudeCodeInput() {
|
|
193
|
+
// Try to read Claude Code JSON from stdin (non-blocking)
|
|
194
|
+
try {
|
|
195
|
+
if (!process.stdin.isTTY) {
|
|
196
|
+
const fd = fs.openSync('/dev/stdin', 'r');
|
|
197
|
+
const buffer = Buffer.alloc(65536);
|
|
198
|
+
const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, null);
|
|
199
|
+
fs.closeSync(fd);
|
|
200
|
+
if (bytesRead > 0) {
|
|
201
|
+
return JSON.parse(buffer.toString('utf-8', 0, bytesRead));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} catch {
|
|
205
|
+
// Ignore - stdin not available or not JSON
|
|
206
|
+
}
|
|
207
|
+
return {};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function getUserInfo(claudeInput) {
|
|
211
|
+
let name = execQuiet('gh api user --jq ".login" 2>/dev/null') ||
|
|
212
|
+
execQuiet('git config user.name 2>/dev/null') ||
|
|
213
|
+
'developer';
|
|
214
|
+
|
|
215
|
+
let gitBranch = execQuiet('git branch --show-current 2>/dev/null');
|
|
216
|
+
|
|
217
|
+
let modelName = '';
|
|
218
|
+
if (claudeInput.model?.display_name) {
|
|
219
|
+
modelName = claudeInput.model.display_name;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return { name, gitBranch, modelName };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function getDomainProgress(projectDir) {
|
|
226
|
+
let completed = 0;
|
|
227
|
+
let inProgress = 0;
|
|
228
|
+
|
|
229
|
+
for (const domain of CONFIG.domains) {
|
|
230
|
+
const domainDir = path.join(projectDir, 'src/domains', domain);
|
|
231
|
+
if (fileExists(domainDir)) {
|
|
232
|
+
try {
|
|
233
|
+
const files = fs.readdirSync(domainDir).filter(f => f.endsWith('.ts'));
|
|
234
|
+
if (files.length >= 3) {
|
|
235
|
+
completed++;
|
|
236
|
+
} else if (files.length >= 1) {
|
|
237
|
+
inProgress++;
|
|
238
|
+
}
|
|
239
|
+
} catch {
|
|
240
|
+
// Ignore
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return { completed, inProgress, total: CONFIG.domainsTotal };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function getTestCounts(projectDir) {
|
|
249
|
+
let unit = 0;
|
|
250
|
+
let integration = 0;
|
|
251
|
+
|
|
252
|
+
const unitDir = path.join(projectDir, 'tests/unit');
|
|
253
|
+
const intDir = path.join(projectDir, 'tests/integration');
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
if (fileExists(unitDir)) {
|
|
257
|
+
unit = parseInt(execQuiet(`find "${unitDir}" -name "*.test.ts" 2>/dev/null | wc -l`)) || 0;
|
|
258
|
+
}
|
|
259
|
+
if (fileExists(intDir)) {
|
|
260
|
+
integration = parseInt(execQuiet(`find "${intDir}" -name "*.test.ts" 2>/dev/null | wc -l`)) || 0;
|
|
261
|
+
}
|
|
262
|
+
} catch {
|
|
263
|
+
// Ignore
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return { unit, integration };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function getLearningMetrics(projectDir) {
|
|
270
|
+
// Find the consolidated V3 database
|
|
271
|
+
let dbPath = null;
|
|
272
|
+
|
|
273
|
+
for (const relPath of CONFIG.memoryDbPaths) {
|
|
274
|
+
const candidate = path.join(projectDir, relPath);
|
|
275
|
+
if (fileExists(candidate)) {
|
|
276
|
+
dbPath = candidate;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (!dbPath) {
|
|
282
|
+
return {
|
|
283
|
+
patterns: 0, synthesized: 0, totalPatterns: 0, experiences: 0,
|
|
284
|
+
transfers: 0, successRate: 0, intelligencePct: 0, mode: 'off',
|
|
285
|
+
dbSource: 'none'
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Consolidated V3 DB has BOTH old schema tables (migrated) and new V3 tables
|
|
290
|
+
// Read from ALL relevant tables for complete metrics
|
|
291
|
+
|
|
292
|
+
// Legacy patterns (migrated from root DB)
|
|
293
|
+
const legacyPatterns = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM patterns')) || 0;
|
|
294
|
+
// V3 SONA patterns (new V3 neural patterns)
|
|
295
|
+
const sonaPatterns = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM sona_patterns')) || 0;
|
|
296
|
+
// Synthesized patterns (dream-generated)
|
|
297
|
+
const synthesized = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM synthesized_patterns')) || 0;
|
|
298
|
+
// QE patterns (v3 pattern store)
|
|
299
|
+
const qePatterns = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM qe_patterns')) || 0;
|
|
300
|
+
// KV store patterns (MCP-stored patterns)
|
|
301
|
+
const kvPatterns = parseInt(sqlite3Query(dbPath, "SELECT COUNT(*) FROM kv_store WHERE key LIKE '%pattern%'")) || 0;
|
|
302
|
+
|
|
303
|
+
// Total patterns = legacy + SONA + QE + KV patterns (deduplicated estimate)
|
|
304
|
+
const patterns = legacyPatterns + sonaPatterns + qePatterns + Math.floor(kvPatterns / 10);
|
|
305
|
+
|
|
306
|
+
// Learning experiences (migrated from root DB)
|
|
307
|
+
const legacyExperiences = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM learning_experiences')) || 0;
|
|
308
|
+
// V3 trajectories (new V3 trajectory tracking)
|
|
309
|
+
const trajectories = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM qe_trajectories')) || 0;
|
|
310
|
+
// Captured experiences (task execution captures)
|
|
311
|
+
// Use SUM(consolidation_count) for monotonically non-decreasing counter:
|
|
312
|
+
// - New experience → +1
|
|
313
|
+
// - Merge A into B → A excluded (consolidated_into set), B's count += A's count → net 0
|
|
314
|
+
// - Archive → row stays, still counted → net 0
|
|
315
|
+
// Falls back to COUNT(*) if consolidation columns not yet added
|
|
316
|
+
let capturedExp = 0;
|
|
317
|
+
const consolidatedQuery = sqlite3Query(dbPath,
|
|
318
|
+
"SELECT COALESCE(SUM(consolidation_count), COUNT(*)) FROM captured_experiences WHERE consolidated_into IS NULL OR consolidated_into = 'archived'", '__FAIL__');
|
|
319
|
+
if (consolidatedQuery !== '__FAIL__') {
|
|
320
|
+
capturedExp = parseInt(consolidatedQuery) || 0;
|
|
321
|
+
} else {
|
|
322
|
+
capturedExp = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM captured_experiences')) || 0;
|
|
323
|
+
}
|
|
324
|
+
// Memory entries with learning data (MCP-stored experiences)
|
|
325
|
+
const memoryLearning = parseInt(sqlite3Query(dbPath, "SELECT COUNT(*) FROM memory_entries WHERE key LIKE 'learning%' OR key LIKE 'phase2/learning%'")) || 0;
|
|
326
|
+
// QE pattern usage (hook-recorded outcomes from aqe hooks post-task/post-edit)
|
|
327
|
+
const patternUsage = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM qe_pattern_usage')) || 0;
|
|
328
|
+
|
|
329
|
+
// Total experiences = all sources
|
|
330
|
+
const experiences = legacyExperiences + trajectories + capturedExp + memoryLearning + patternUsage;
|
|
331
|
+
|
|
332
|
+
// Transfer learning count
|
|
333
|
+
const transfers = parseInt(sqlite3Query(dbPath, 'SELECT COUNT(*) FROM transfer_registry')) || 0;
|
|
334
|
+
|
|
335
|
+
// Success rate from legacy patterns
|
|
336
|
+
const successRate = parseFloat(sqlite3Query(dbPath,
|
|
337
|
+
'SELECT ROUND(AVG(success_rate)*100) FROM patterns WHERE success_rate > 0', '0')) || 0;
|
|
338
|
+
|
|
339
|
+
// Intelligence % based on total learning data (target: 1000 = 100%)
|
|
340
|
+
const totalLearningData = patterns + synthesized + experiences;
|
|
341
|
+
const intelligencePct = Math.min(100, Math.floor((totalLearningData / CONFIG.intelligenceTargetExp) * 100));
|
|
342
|
+
|
|
343
|
+
// Get learning mode from config (check multiple paths)
|
|
344
|
+
let mode = 'off';
|
|
345
|
+
for (const relPath of CONFIG.learningConfigPaths) {
|
|
346
|
+
const configPath = path.join(projectDir, relPath);
|
|
347
|
+
const config = readJsonFile(configPath);
|
|
348
|
+
if (config.enabled && config.scheduler?.mode) {
|
|
349
|
+
mode = config.scheduler.mode;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Determine dbSource from which path was found
|
|
355
|
+
const dbSource = 'root';
|
|
356
|
+
|
|
357
|
+
return {
|
|
358
|
+
patterns,
|
|
359
|
+
synthesized,
|
|
360
|
+
totalPatterns: patterns + synthesized,
|
|
361
|
+
experiences,
|
|
362
|
+
transfers,
|
|
363
|
+
successRate,
|
|
364
|
+
intelligencePct,
|
|
365
|
+
mode,
|
|
366
|
+
dbSource, // 'root' = consolidated primary, 'v3' = legacy
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function getCveStatus(projectDir) {
|
|
371
|
+
const cachePath = path.join(projectDir, CONFIG.cveCache);
|
|
372
|
+
let total = 0;
|
|
373
|
+
let fixed = 0;
|
|
374
|
+
|
|
375
|
+
// Check cache first
|
|
376
|
+
if (fileExists(cachePath)) {
|
|
377
|
+
try {
|
|
378
|
+
const stat = fs.statSync(cachePath);
|
|
379
|
+
const age = (Date.now() - stat.mtimeMs) / 1000;
|
|
380
|
+
if (age < CONFIG.cveCacheAge) {
|
|
381
|
+
const cache = readJsonFile(cachePath);
|
|
382
|
+
total = cache.total || 0;
|
|
383
|
+
fixed = cache.fixed || 0;
|
|
384
|
+
return { total, fixed, unfixed: total - fixed, cached: true };
|
|
385
|
+
}
|
|
386
|
+
} catch {
|
|
387
|
+
// Cache invalid
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Fetch fresh CVE data (with timeout)
|
|
392
|
+
try {
|
|
393
|
+
const output = execQuiet('timeout 2 npx @claude-flow/cli@latest security cve --list 2>/dev/null');
|
|
394
|
+
if (output) {
|
|
395
|
+
total = (output.match(/CVE-/g) || []).length;
|
|
396
|
+
fixed = (output.match(/Fixed/g) || []).length;
|
|
397
|
+
|
|
398
|
+
// Update cache
|
|
399
|
+
try {
|
|
400
|
+
fs.mkdirSync(path.dirname(cachePath), { recursive: true });
|
|
401
|
+
fs.writeFileSync(cachePath, JSON.stringify({ total, fixed, updated: new Date().toISOString() }));
|
|
402
|
+
} catch {
|
|
403
|
+
// Ignore cache write errors
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
} catch {
|
|
407
|
+
// Ignore
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return { total, fixed, unfixed: total - fixed, cached: false };
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function getAgentCounts(projectDir, claudeInput) {
|
|
414
|
+
// V3-QE agent definitions (from files)
|
|
415
|
+
// Note: Agents were renamed from v3-qe-*.md to qe-*.md pattern
|
|
416
|
+
let v3QeAgents = 0;
|
|
417
|
+
const agentsDir = path.join(projectDir, '.claude/agents/v3');
|
|
418
|
+
if (fileExists(agentsDir)) {
|
|
419
|
+
try {
|
|
420
|
+
v3QeAgents = parseInt(execQuiet(`find "${agentsDir}" -name "qe-*.md" 2>/dev/null | wc -l`)) || 0;
|
|
421
|
+
} catch {
|
|
422
|
+
// Ignore
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Running sub-agents (from processes)
|
|
427
|
+
let runningAgents = 0;
|
|
428
|
+
try {
|
|
429
|
+
// Check for claude-flow or agentic agents
|
|
430
|
+
const ps = execQuiet('ps aux 2>/dev/null | grep -E "(claude-flow.*agent|agentic.*agent)" | grep -v grep | wc -l');
|
|
431
|
+
runningAgents = Math.max(0, parseInt(ps) || 0);
|
|
432
|
+
} catch {
|
|
433
|
+
// Ignore
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Also check Claude Code JSON for sub-agents
|
|
437
|
+
if (claudeInput.agents?.active_count) {
|
|
438
|
+
runningAgents = Math.max(runningAgents, claudeInput.agents.active_count);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
return { v3QeAgents, runningAgents };
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function getContextUsage(claudeInput) {
|
|
445
|
+
let pct = 0;
|
|
446
|
+
|
|
447
|
+
if (claudeInput.context_window) {
|
|
448
|
+
const cw = claudeInput.context_window;
|
|
449
|
+
const windowSize = cw.context_window_size || 0;
|
|
450
|
+
if (windowSize > 0) {
|
|
451
|
+
const usage = cw.current_usage || {};
|
|
452
|
+
const current = (usage.input_tokens || 0) +
|
|
453
|
+
(usage.cache_creation_input_tokens || 0) +
|
|
454
|
+
(usage.cache_read_input_tokens || 0);
|
|
455
|
+
pct = Math.floor((current / windowSize) * 100);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
return pct;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function getArchitectureMetrics(projectDir) {
|
|
463
|
+
// ADR count - deduplicated across embedded and standalone files
|
|
464
|
+
let adrCount = 0;
|
|
465
|
+
const adrDir = path.join(projectDir, 'implementation/adrs');
|
|
466
|
+
const adrFile = path.join(adrDir, 'v3-adrs.md');
|
|
467
|
+
const uniqueAdrNums = new Set();
|
|
468
|
+
|
|
469
|
+
if (fileExists(adrDir)) {
|
|
470
|
+
// Embedded ADRs - extract ADR numbers (normalize by parsing as int)
|
|
471
|
+
if (fileExists(adrFile)) {
|
|
472
|
+
const content = fs.readFileSync(adrFile, 'utf-8');
|
|
473
|
+
const matches = content.match(/^## ADR-(\d+)/gm) || [];
|
|
474
|
+
matches.forEach(m => {
|
|
475
|
+
const num = m.match(/\d+/)?.[0];
|
|
476
|
+
if (num) uniqueAdrNums.add(parseInt(num, 10)); // Normalize: "036" -> 36
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
// Standalone ADR files - extract ADR numbers (normalize by parsing as int)
|
|
480
|
+
try {
|
|
481
|
+
const standaloneFiles = execQuiet(`find "${adrDir}" -maxdepth 1 -name "ADR-0*.md" -exec basename {} \\; 2>/dev/null`);
|
|
482
|
+
if (standaloneFiles) {
|
|
483
|
+
standaloneFiles.split('\n').forEach(f => {
|
|
484
|
+
const num = f.match(/ADR-0*(\d+)/)?.[1];
|
|
485
|
+
if (num) uniqueAdrNums.add(parseInt(num, 10)); // Normalize: "36" -> 36
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
} catch {
|
|
489
|
+
// Ignore
|
|
490
|
+
}
|
|
491
|
+
adrCount = uniqueAdrNums.size;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Hooks count
|
|
495
|
+
let hooksCount = 0;
|
|
496
|
+
const hooksDir = path.join(projectDir, '.claude/hooks');
|
|
497
|
+
if (fileExists(hooksDir)) {
|
|
498
|
+
try {
|
|
499
|
+
hooksCount = parseInt(execQuiet(`find "${hooksDir}" \\( -name "*.sh" -o -name "*.json" \\) 2>/dev/null | wc -l`)) || 0;
|
|
500
|
+
} catch {
|
|
501
|
+
// Ignore
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// AgentDB size - check both V3 and root databases
|
|
506
|
+
let agentDbSize = '';
|
|
507
|
+
for (const relPath of CONFIG.memoryDbPaths) {
|
|
508
|
+
const dbPath = path.join(projectDir, relPath);
|
|
509
|
+
if (fileExists(dbPath)) {
|
|
510
|
+
try {
|
|
511
|
+
const stats = fs.statSync(dbPath);
|
|
512
|
+
const sizeKB = Math.floor(stats.size / 1024);
|
|
513
|
+
agentDbSize = sizeKB > 1024 ? `${Math.floor(sizeKB / 1024)}M` : `${sizeKB}K`;
|
|
514
|
+
break; // Use first found database
|
|
515
|
+
} catch {
|
|
516
|
+
// Ignore
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
return { adrCount, hooksCount, agentDbSize };
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function getCoverage(projectDir) {
|
|
525
|
+
const coveragePath = path.join(projectDir, CONFIG.coverageFile);
|
|
526
|
+
if (fileExists(coveragePath)) {
|
|
527
|
+
const coverage = readJsonFile(coveragePath);
|
|
528
|
+
return Math.round(coverage.total?.lines?.pct || 0);
|
|
529
|
+
}
|
|
530
|
+
return -1; // No coverage data
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// ═══════════════════════════════════════════════════════════════
|
|
534
|
+
// Output Generators
|
|
535
|
+
// ═══════════════════════════════════════════════════════════════
|
|
536
|
+
|
|
537
|
+
function generateDomainBar(completed, inProgress, total) {
|
|
538
|
+
const completedDot = `${c.brightGreen}●${c.reset}`;
|
|
539
|
+
const progressDot = `${c.yellow}◐${c.reset}`;
|
|
540
|
+
const pendingDot = `${c.dim}○${c.reset}`;
|
|
541
|
+
|
|
542
|
+
let bar = '[';
|
|
543
|
+
for (let i = 0; i < completed; i++) bar += completedDot;
|
|
544
|
+
for (let i = 0; i < inProgress; i++) bar += progressDot;
|
|
545
|
+
for (let i = 0; i < (total - completed - inProgress); i++) bar += pendingDot;
|
|
546
|
+
bar += ']';
|
|
547
|
+
|
|
548
|
+
return bar;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function colorByThreshold(value, thresholds, colors) {
|
|
552
|
+
for (let i = 0; i < thresholds.length; i++) {
|
|
553
|
+
if (value >= thresholds[i]) return colors[i];
|
|
554
|
+
}
|
|
555
|
+
return colors[colors.length - 1];
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function generateStatusline(data) {
|
|
559
|
+
const lines = [];
|
|
560
|
+
|
|
561
|
+
// Header Line
|
|
562
|
+
let header = `${c.bold}${c.brightPurple}▊ Agentic QE v3 ${c.reset}`;
|
|
563
|
+
header += `${c.brightCyan}${data.user.name}${c.reset}`;
|
|
564
|
+
if (data.user.gitBranch) {
|
|
565
|
+
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${data.user.gitBranch}${c.reset}`;
|
|
566
|
+
}
|
|
567
|
+
if (data.user.modelName) {
|
|
568
|
+
header += ` ${c.dim}│${c.reset} ${c.purple}${data.user.modelName}${c.reset}`;
|
|
569
|
+
}
|
|
570
|
+
lines.push(header);
|
|
571
|
+
|
|
572
|
+
// Separator
|
|
573
|
+
lines.push(`${c.dim}─────────────────────────────────────────────────────────────────${c.reset}`);
|
|
574
|
+
|
|
575
|
+
// Line 1: DDD Domains + Flash Attention
|
|
576
|
+
const domainBar = generateDomainBar(data.domains.completed, data.domains.inProgress, data.domains.total);
|
|
577
|
+
let line1 = `${c.brightCyan}🏗️ DDD Domains${c.reset} ${domainBar} ${c.brightGreen}${data.domains.completed}${c.reset}`;
|
|
578
|
+
if (data.domains.inProgress > 0) {
|
|
579
|
+
line1 += `+${c.yellow}${data.domains.inProgress}${c.reset}`;
|
|
580
|
+
}
|
|
581
|
+
line1 += `/${c.brightWhite}${data.domains.total}${c.reset}`;
|
|
582
|
+
line1 += ` ${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}${CONFIG.flashAttentionTarget}${c.reset}`;
|
|
583
|
+
lines.push(line1);
|
|
584
|
+
|
|
585
|
+
// Line 2: Agent Fleet + Security + Intelligence + Context
|
|
586
|
+
const agentIndicator = data.agents.v3QeAgents > 0 ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
|
|
587
|
+
const agentColor = colorByThreshold(data.agents.v3QeAgents, [20, 5, 0], [c.brightGreen, c.yellow, c.dim]);
|
|
588
|
+
|
|
589
|
+
const cveIcon = data.cve.unfixed > 0 ? '🔴' : data.cve.total > 0 ? '🟢' : '⚪';
|
|
590
|
+
const cveColor = data.cve.unfixed > 0 ? c.brightRed : c.brightGreen;
|
|
591
|
+
|
|
592
|
+
const intelColor = colorByThreshold(data.learning.intelligencePct, [50, 25, 1], [c.brightGreen, c.brightYellow, c.yellow]);
|
|
593
|
+
const ctxColor = colorByThreshold(100 - data.context.pct, [50, 25, 0], [c.brightGreen, c.brightYellow, c.brightRed]);
|
|
594
|
+
|
|
595
|
+
let line2 = `${c.brightYellow}🤖 V3-QE Fleet${c.reset} ${agentIndicator}[${agentColor}${padLeft(data.agents.v3QeAgents, 2)}${c.reset}/${c.brightWhite}${CONFIG.v3QeTarget}${c.reset}]`;
|
|
596
|
+
line2 += ` ${c.brightPurple}👥${c.reset}${c.white}${data.agents.runningAgents}${c.reset}`;
|
|
597
|
+
line2 += ` ${cveColor}${cveIcon} CVE ${data.cve.fixed}/${data.cve.total}${c.reset}`;
|
|
598
|
+
line2 += ` ${intelColor}🧠 ${padLeft(data.learning.intelligencePct, 3)}%${c.reset}`;
|
|
599
|
+
line2 += ` ${ctxColor}📂 ${padLeft(data.context.pct, 3)}%${c.reset}`;
|
|
600
|
+
lines.push(line2);
|
|
601
|
+
|
|
602
|
+
// Line 3: Learning Status
|
|
603
|
+
const modeIndicator = data.learning.mode === 'continuous' ? `${c.brightGreen}●` :
|
|
604
|
+
data.learning.mode === 'scheduled' ? `${c.yellow}◐` : `${c.dim}○`;
|
|
605
|
+
const transferIndicator = data.learning.transfers > 10 ? `${c.brightGreen}●` :
|
|
606
|
+
data.learning.transfers > 0 ? `${c.yellow}◐` : `${c.dim}○`;
|
|
607
|
+
const dbSourceIndicator = data.learning.dbSource === 'v3' ? `${c.brightCyan}v3` :
|
|
608
|
+
data.learning.dbSource === 'root' ? `${c.yellow}root` : `${c.dim}none`;
|
|
609
|
+
|
|
610
|
+
let line3 = `${c.brightPurple}🎓 Learning${c.reset} ${c.cyan}Patterns${c.reset} ${c.white}${padLeft(data.learning.totalPatterns, 4)}${c.reset}`;
|
|
611
|
+
line3 += ` ${c.dim}│${c.reset} ${c.cyan}Exp${c.reset} ${c.white}${padLeft(data.learning.experiences, 4)}${c.reset}`;
|
|
612
|
+
line3 += ` ${c.dim}│${c.reset} ${c.cyan}Mode${c.reset} ${modeIndicator}${data.learning.mode}${c.reset}`;
|
|
613
|
+
line3 += ` ${c.dim}│${c.reset} ${c.cyan}Transfer${c.reset} ${transferIndicator}${data.learning.transfers}${c.reset}`;
|
|
614
|
+
line3 += ` ${c.dim}│${c.reset} ${c.cyan}DB${c.reset} ${dbSourceIndicator}${c.reset}`;
|
|
615
|
+
lines.push(line3);
|
|
616
|
+
|
|
617
|
+
// Line 4: Architecture Status
|
|
618
|
+
const adrStatus = data.arch.adrCount >= 20 ? `${c.brightGreen}●${data.arch.adrCount}` :
|
|
619
|
+
data.arch.adrCount >= 10 ? `${c.yellow}◐${data.arch.adrCount}` : `${c.dim}○${data.arch.adrCount}`;
|
|
620
|
+
const hooksStatus = data.arch.hooksCount >= 2 ? `${c.brightGreen}●${data.arch.hooksCount}` :
|
|
621
|
+
data.arch.hooksCount >= 1 ? `${c.yellow}◐${data.arch.hooksCount}` : `${c.dim}○`;
|
|
622
|
+
const dbStatus = data.arch.agentDbSize ? `${c.brightGreen}●${data.arch.agentDbSize}` : `${c.dim}○`;
|
|
623
|
+
|
|
624
|
+
let line4 = `${c.brightPurple}🔧 Architecture${c.reset} ${c.cyan}ADR${c.reset} ${adrStatus}${c.reset}`;
|
|
625
|
+
line4 += ` ${c.dim}│${c.reset} ${c.cyan}Hooks${c.reset} ${hooksStatus}${c.reset}`;
|
|
626
|
+
line4 += ` ${c.dim}│${c.reset} ${c.cyan}AgentDB${c.reset} ${dbStatus}${c.reset}`;
|
|
627
|
+
|
|
628
|
+
if (data.tests.unit > 0 || data.tests.integration > 0) {
|
|
629
|
+
line4 += ` ${c.dim}│${c.reset} ${c.cyan}Tests${c.reset} ${c.brightGreen}U${c.white}${data.tests.unit}${c.reset}/${c.brightCyan}I${c.white}${data.tests.integration}${c.reset}`;
|
|
630
|
+
}
|
|
631
|
+
lines.push(line4);
|
|
632
|
+
|
|
633
|
+
// Footer
|
|
634
|
+
lines.push(`${c.dim}─────────────────────────────────────────────────────────────────${c.reset}`);
|
|
635
|
+
|
|
636
|
+
return lines.join('\n');
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function generateJSON(data) {
|
|
640
|
+
return {
|
|
641
|
+
user: data.user,
|
|
642
|
+
domains: data.domains,
|
|
643
|
+
agents: data.agents,
|
|
644
|
+
learning: {
|
|
645
|
+
...data.learning,
|
|
646
|
+
dbSource: data.learning.dbSource,
|
|
647
|
+
},
|
|
648
|
+
security: data.cve,
|
|
649
|
+
context: data.context,
|
|
650
|
+
architecture: data.arch,
|
|
651
|
+
tests: data.tests,
|
|
652
|
+
coverage: data.coverage,
|
|
653
|
+
performance: {
|
|
654
|
+
flashAttentionTarget: CONFIG.flashAttentionTarget,
|
|
655
|
+
searchImprovement: '150x-12,500x',
|
|
656
|
+
memoryReduction: '50-75%',
|
|
657
|
+
},
|
|
658
|
+
timestamp: new Date().toISOString(),
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// ═══════════════════════════════════════════════════════════════
|
|
663
|
+
// Main
|
|
664
|
+
// ═══════════════════════════════════════════════════════════════
|
|
665
|
+
|
|
666
|
+
function main() {
|
|
667
|
+
const projectDir = process.cwd();
|
|
668
|
+
const claudeInput = getClaudeCodeInput();
|
|
669
|
+
|
|
670
|
+
// Collect all data
|
|
671
|
+
const data = {
|
|
672
|
+
user: getUserInfo(claudeInput),
|
|
673
|
+
domains: getDomainProgress(projectDir),
|
|
674
|
+
tests: getTestCounts(projectDir),
|
|
675
|
+
learning: getLearningMetrics(projectDir),
|
|
676
|
+
cve: getCveStatus(projectDir),
|
|
677
|
+
agents: getAgentCounts(projectDir, claudeInput),
|
|
678
|
+
context: { pct: getContextUsage(claudeInput) },
|
|
679
|
+
arch: getArchitectureMetrics(projectDir),
|
|
680
|
+
coverage: getCoverage(projectDir),
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
// Output
|
|
684
|
+
if (process.argv.includes('--json')) {
|
|
685
|
+
console.log(JSON.stringify(generateJSON(data), null, 2));
|
|
686
|
+
} else if (process.argv.includes('--compact')) {
|
|
687
|
+
console.log(JSON.stringify(generateJSON(data)));
|
|
688
|
+
} else {
|
|
689
|
+
console.log(generateStatusline(data));
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
main();
|
|
@@ -39,6 +39,9 @@ When brutal honesty is needed:
|
|
|
39
39
|
- Level 3 (Brutal): "This is negligent. You're exposing user data because..."
|
|
40
40
|
|
|
41
41
|
**DO NOT USE FOR:** Junior devs' first PRs, demoralized teams, public forums, low psychological safety
|
|
42
|
+
|
|
43
|
+
## Minimum Findings Enforcement
|
|
44
|
+
All brutal honesty reviews enforce a minimum of 3 weighted findings (CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5). If the initial review finds fewer, escalate to deeper analysis. Brutally honest reviewers should ALWAYS find something -- if you can't, explain exactly why with evidence.
|
|
42
45
|
</default_to_action>
|
|
43
46
|
|
|
44
47
|
## Quick Reference Card
|