agentic-qe 3.8.6 → 3.8.8
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/n8n/n8n-base-agent.md +4 -35
- package/.claude/agents/n8n/n8n-bdd-scenario-tester.md +4 -25
- package/.claude/agents/n8n/n8n-chaos-tester.md +4 -26
- package/.claude/agents/n8n/n8n-ci-orchestrator.md +4 -27
- package/.claude/agents/n8n/n8n-compliance-validator.md +4 -25
- package/.claude/agents/n8n/n8n-expression-validator.md +4 -25
- package/.claude/agents/n8n/n8n-integration-test.md +4 -27
- package/.claude/agents/n8n/n8n-monitoring-validator.md +4 -26
- package/.claude/agents/n8n/n8n-node-validator.md +4 -25
- package/.claude/agents/n8n/n8n-performance-tester.md +4 -29
- package/.claude/agents/n8n/n8n-security-auditor.md +4 -26
- package/.claude/agents/n8n/n8n-trigger-test.md +4 -27
- package/.claude/agents/n8n/n8n-unit-tester.md +4 -25
- package/.claude/agents/n8n/n8n-version-comparator.md +4 -26
- package/.claude/agents/n8n/n8n-workflow-executor.md +4 -26
- package/.claude/agents/v3/qe-accessibility-auditor.md +21 -55
- package/.claude/agents/v3/qe-bdd-generator.md +23 -58
- package/.claude/agents/v3/qe-chaos-engineer.md +21 -54
- package/.claude/agents/v3/qe-code-complexity.md +21 -54
- package/.claude/agents/v3/qe-code-intelligence.md +21 -54
- package/.claude/agents/v3/qe-contract-validator.md +21 -53
- package/.claude/agents/v3/qe-coverage-specialist.md +23 -79
- package/.claude/agents/v3/qe-defect-predictor.md +23 -76
- package/.claude/agents/v3/qe-dependency-mapper.md +21 -53
- package/.claude/agents/v3/qe-deployment-advisor.md +21 -54
- package/.claude/agents/v3/qe-devils-advocate.md +212 -238
- package/.claude/agents/v3/qe-flaky-hunter.md +21 -53
- package/.claude/agents/v3/qe-fleet-commander.md +21 -54
- package/.claude/agents/v3/qe-gap-detector.md +23 -79
- package/.claude/agents/v3/qe-graphql-tester.md +21 -54
- package/.claude/agents/v3/qe-impact-analyzer.md +21 -53
- package/.claude/agents/v3/qe-integration-architect.md +2 -2
- package/.claude/agents/v3/qe-integration-tester.md +15 -36
- package/.claude/agents/v3/qe-kg-builder.md +21 -53
- package/.claude/agents/v3/qe-learning-coordinator.md +21 -51
- package/.claude/agents/v3/qe-load-tester.md +21 -55
- package/.claude/agents/v3/qe-message-broker-tester.md +345 -385
- package/.claude/agents/v3/qe-metrics-optimizer.md +21 -54
- package/.claude/agents/v3/qe-middleware-validator.md +389 -428
- package/.claude/agents/v3/qe-mutation-tester.md +21 -54
- package/.claude/agents/v3/qe-odata-contract-tester.md +443 -489
- package/.claude/agents/v3/qe-parallel-executor.md +21 -52
- package/.claude/agents/v3/qe-pattern-learner.md +23 -70
- package/.claude/agents/v3/qe-pentest-validator.md +322 -359
- package/.claude/agents/v3/qe-performance-tester.md +21 -54
- package/.claude/agents/v3/qe-product-factors-assessor.md +339 -376
- package/.claude/agents/v3/qe-property-tester.md +21 -53
- package/.claude/agents/v3/qe-quality-criteria-recommender.md +379 -410
- package/.claude/agents/v3/qe-quality-gate.md +17 -64
- package/.claude/agents/v3/qe-queen-coordinator.md +71 -121
- package/.claude/agents/v3/qe-qx-partner.md +23 -64
- package/.claude/agents/v3/qe-regression-analyzer.md +21 -54
- package/.claude/agents/v3/qe-requirements-validator.md +23 -66
- package/.claude/agents/v3/qe-responsive-tester.md +21 -54
- package/.claude/agents/v3/qe-retry-handler.md +21 -53
- package/.claude/agents/v3/qe-risk-assessor.md +23 -58
- package/.claude/agents/v3/qe-root-cause-analyzer.md +21 -53
- package/.claude/agents/v3/qe-sap-idoc-tester.md +371 -412
- package/.claude/agents/v3/qe-sap-rfc-tester.md +323 -362
- package/.claude/agents/v3/qe-security-auditor.md +21 -54
- package/.claude/agents/v3/qe-security-scanner.md +21 -58
- package/.claude/agents/v3/qe-soap-tester.md +307 -345
- package/.claude/agents/v3/qe-sod-analyzer.md +486 -533
- package/.claude/agents/v3/qe-tdd-specialist.md +17 -42
- package/.claude/agents/v3/qe-test-architect.md +23 -58
- package/.claude/agents/v3/qe-test-idea-rewriter.md +351 -375
- package/.claude/agents/v3/qe-transfer-specialist.md +21 -55
- package/.claude/agents/v3/qe-visual-tester.md +15 -37
- package/.claude/agents/v3/subagents/qe-code-reviewer.md +21 -54
- package/.claude/agents/v3/subagents/qe-integration-reviewer.md +21 -54
- package/.claude/agents/v3/subagents/qe-performance-reviewer.md +21 -54
- package/.claude/agents/v3/subagents/qe-security-reviewer.md +21 -54
- package/.claude/agents/v3/subagents/qe-tdd-green.md +21 -53
- package/.claude/agents/v3/subagents/qe-tdd-red.md +21 -53
- package/.claude/agents/v3/subagents/qe-tdd-refactor.md +21 -53
- package/.claude/skills/.validation/schemas/skill-eval.schema.json +5 -5
- package/.claude/skills/.validation/skill-validation-mcp-integration.md +32 -81
- package/.claude/skills/agentic-quality-engineering/SKILL.md +31 -60
- package/.claude/skills/iterative-loop/SKILL.md +2 -2
- package/.claude/skills/pair-programming/SKILL.md +2 -2
- package/.claude/skills/performance-testing/SKILL.md +1 -1
- package/.claude/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +2 -2
- package/.claude/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +6 -6
- package/.claude/skills/qcsd-development-swarm/steps/01-flag-detection.md +2 -2
- package/.claude/skills/qcsd-development-swarm/steps/07-learning-persistence.md +6 -6
- package/.claude/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +6 -6
- package/.claude/skills/qcsd-production-swarm/steps/01-flag-detection.md +202 -206
- package/.claude/skills/qcsd-production-swarm/steps/07-learning-persistence.md +157 -185
- package/.claude/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +87 -91
- package/.claude/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +49 -53
- package/.claude/skills/qe-chaos-resilience/SKILL.md +2 -2
- package/.claude/skills/qe-code-intelligence/SKILL.md +2 -2
- package/.claude/skills/qe-coverage-analysis/SKILL.md +2 -2
- package/.claude/skills/qe-defect-intelligence/SKILL.md +2 -2
- package/.claude/skills/qe-iterative-loop/SKILL.md +12 -12
- package/.claude/skills/qe-learning-optimization/SKILL.md +2 -2
- package/.claude/skills/qe-quality-assessment/SKILL.md +2 -2
- package/.claude/skills/qe-requirements-validation/SKILL.md +2 -2
- package/.claude/skills/qe-test-execution/SKILL.md +2 -2
- package/.claude/skills/qe-test-generation/SKILL.md +2 -2
- package/.claude/skills/qe-visual-accessibility/SKILL.md +2 -2
- package/.claude/skills/quality-metrics/SKILL.md +1 -1
- package/.claude/skills/security-testing/SKILL.md +1 -1
- package/.claude/skills/skills-manifest.json +1 -1
- package/.claude/skills/validation-pipeline/SKILL.md +2 -2
- package/.claude/skills/verification-quality/SKILL.md +2 -2
- package/CHANGELOG.md +41 -0
- package/assets/agents/v3/qe-accessibility-auditor.md +21 -55
- package/assets/agents/v3/qe-bdd-generator.md +23 -58
- package/assets/agents/v3/qe-chaos-engineer.md +21 -54
- package/assets/agents/v3/qe-code-complexity.md +21 -54
- package/assets/agents/v3/qe-code-intelligence.md +21 -54
- package/assets/agents/v3/qe-contract-validator.md +21 -53
- package/assets/agents/v3/qe-coverage-specialist.md +23 -79
- package/assets/agents/v3/qe-defect-predictor.md +23 -76
- package/assets/agents/v3/qe-dependency-mapper.md +21 -53
- package/assets/agents/v3/qe-deployment-advisor.md +21 -54
- package/assets/agents/v3/qe-devils-advocate.md +212 -238
- package/assets/agents/v3/qe-flaky-hunter.md +21 -53
- package/assets/agents/v3/qe-fleet-commander.md +21 -54
- package/assets/agents/v3/qe-gap-detector.md +23 -79
- package/assets/agents/v3/qe-graphql-tester.md +21 -54
- package/assets/agents/v3/qe-impact-analyzer.md +21 -53
- package/assets/agents/v3/qe-integration-architect.md +2 -2
- package/assets/agents/v3/qe-integration-tester.md +15 -36
- package/assets/agents/v3/qe-kg-builder.md +21 -53
- package/assets/agents/v3/qe-learning-coordinator.md +21 -51
- package/assets/agents/v3/qe-load-tester.md +21 -55
- package/assets/agents/v3/qe-message-broker-tester.md +345 -385
- package/assets/agents/v3/qe-metrics-optimizer.md +21 -54
- package/assets/agents/v3/qe-middleware-validator.md +389 -428
- package/assets/agents/v3/qe-mutation-tester.md +21 -54
- package/assets/agents/v3/qe-odata-contract-tester.md +443 -489
- package/assets/agents/v3/qe-parallel-executor.md +21 -52
- package/assets/agents/v3/qe-pattern-learner.md +23 -70
- package/assets/agents/v3/qe-pentest-validator.md +322 -359
- package/assets/agents/v3/qe-performance-tester.md +21 -54
- package/assets/agents/v3/qe-product-factors-assessor.md +339 -376
- package/assets/agents/v3/qe-property-tester.md +21 -53
- package/assets/agents/v3/qe-quality-criteria-recommender.md +379 -410
- package/assets/agents/v3/qe-quality-gate.md +17 -64
- package/assets/agents/v3/qe-queen-coordinator.md +71 -121
- package/assets/agents/v3/qe-qx-partner.md +23 -64
- package/assets/agents/v3/qe-regression-analyzer.md +21 -54
- package/assets/agents/v3/qe-requirements-validator.md +23 -66
- package/assets/agents/v3/qe-responsive-tester.md +21 -54
- package/assets/agents/v3/qe-retry-handler.md +21 -53
- package/assets/agents/v3/qe-risk-assessor.md +23 -58
- package/assets/agents/v3/qe-root-cause-analyzer.md +21 -53
- package/assets/agents/v3/qe-sap-idoc-tester.md +371 -412
- package/assets/agents/v3/qe-sap-rfc-tester.md +323 -362
- package/assets/agents/v3/qe-security-auditor.md +21 -54
- package/assets/agents/v3/qe-security-scanner.md +21 -58
- package/assets/agents/v3/qe-soap-tester.md +307 -345
- package/assets/agents/v3/qe-sod-analyzer.md +486 -533
- package/assets/agents/v3/qe-tdd-specialist.md +17 -42
- package/assets/agents/v3/qe-test-architect.md +23 -58
- package/assets/agents/v3/qe-test-idea-rewriter.md +351 -375
- package/assets/agents/v3/qe-transfer-specialist.md +21 -55
- package/assets/agents/v3/qe-visual-tester.md +15 -37
- package/assets/agents/v3/subagents/qe-code-reviewer.md +21 -54
- package/assets/agents/v3/subagents/qe-integration-reviewer.md +21 -54
- package/assets/agents/v3/subagents/qe-performance-reviewer.md +21 -54
- package/assets/agents/v3/subagents/qe-security-reviewer.md +21 -54
- package/assets/agents/v3/subagents/qe-tdd-green.md +21 -53
- package/assets/agents/v3/subagents/qe-tdd-red.md +21 -53
- package/assets/agents/v3/subagents/qe-tdd-refactor.md +21 -53
- package/assets/governance/constitution.md +1 -1
- package/assets/governance/shards/chaos-resilience.shard.md +1 -1
- package/assets/governance/shards/code-intelligence.shard.md +1 -1
- package/assets/governance/shards/contract-testing.shard.md +1 -1
- package/assets/governance/shards/coverage-analysis.shard.md +1 -1
- package/assets/governance/shards/defect-intelligence.shard.md +1 -1
- package/assets/governance/shards/learning-optimization.shard.md +1 -1
- package/assets/governance/shards/quality-assessment.shard.md +1 -1
- package/assets/governance/shards/requirements-validation.shard.md +1 -1
- package/assets/governance/shards/security-compliance.shard.md +1 -1
- package/assets/governance/shards/test-execution.shard.md +1 -1
- package/assets/governance/shards/test-generation.shard.md +1 -1
- package/assets/governance/shards/visual-accessibility.shard.md +1 -1
- package/assets/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/assets/grammars/tree-sitter-java.wasm +0 -0
- package/assets/grammars/tree-sitter-python.wasm +0 -0
- package/assets/grammars/tree-sitter-rust.wasm +0 -0
- package/assets/grammars/tree-sitter-swift.wasm +0 -0
- package/assets/skills/.validation/schemas/skill-eval.schema.json +5 -5
- package/assets/skills/.validation/skill-validation-mcp-integration.md +32 -81
- package/assets/skills/agentic-quality-engineering/SKILL.md +31 -60
- package/assets/skills/pair-programming/SKILL.md +2 -2
- package/assets/skills/performance-testing/SKILL.md +1 -1
- package/assets/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +2 -2
- package/assets/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +6 -6
- package/assets/skills/qcsd-development-swarm/steps/01-flag-detection.md +2 -2
- package/assets/skills/qcsd-development-swarm/steps/07-learning-persistence.md +6 -6
- package/assets/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +6 -6
- package/assets/skills/qcsd-production-swarm/steps/01-flag-detection.md +202 -206
- package/assets/skills/qcsd-production-swarm/steps/07-learning-persistence.md +157 -185
- package/assets/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +87 -91
- package/assets/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +49 -53
- package/assets/skills/qe-chaos-resilience/SKILL.md +2 -2
- package/assets/skills/qe-code-intelligence/SKILL.md +2 -2
- package/assets/skills/qe-coverage-analysis/SKILL.md +2 -2
- package/assets/skills/qe-defect-intelligence/SKILL.md +2 -2
- package/assets/skills/qe-iterative-loop/SKILL.md +12 -12
- package/assets/skills/qe-learning-optimization/SKILL.md +2 -2
- package/assets/skills/qe-quality-assessment/SKILL.md +2 -2
- package/assets/skills/qe-requirements-validation/SKILL.md +2 -2
- package/assets/skills/qe-test-execution/SKILL.md +2 -2
- package/assets/skills/qe-test-generation/SKILL.md +2 -2
- package/assets/skills/qe-visual-accessibility/SKILL.md +2 -2
- package/assets/skills/quality-metrics/SKILL.md +1 -1
- package/assets/skills/security-testing/SKILL.md +1 -1
- package/assets/skills/validation-pipeline/SKILL.md +2 -2
- package/assets/skills/verification-quality/SKILL.md +2 -2
- package/dist/cli/bundle.js +5240 -4631
- package/dist/cli/command-registry.js +3 -1
- package/dist/cli/commands/init.js +2 -0
- package/dist/cli/commands/memory.d.ts +11 -0
- package/dist/cli/commands/memory.js +333 -0
- package/dist/cli/completions/index.d.ts +17 -0
- package/dist/cli/completions/index.js +49 -1
- package/dist/cli/handlers/hypergraph-handler.d.ts +27 -0
- package/dist/cli/handlers/hypergraph-handler.js +248 -0
- package/dist/cli/handlers/index.d.ts +1 -0
- package/dist/cli/handlers/index.js +1 -0
- package/dist/cli/handlers/init-handler.d.ts +1 -0
- package/dist/cli/handlers/init-handler.js +18 -6
- package/dist/cli/index.js +2 -0
- package/dist/coordination/protocols/code-intelligence-index.js +2 -11
- package/dist/domains/code-intelligence/coordinator-hypergraph.js +1 -1
- package/dist/domains/code-intelligence/coordinator.d.ts +5 -0
- package/dist/domains/code-intelligence/coordinator.js +35 -3
- package/dist/init/phases/06-code-intelligence.d.ts +8 -3
- package/dist/init/phases/06-code-intelligence.js +70 -32
- package/dist/init/phases/08-mcp.js +10 -0
- package/dist/init/phases/phase-interface.d.ts +2 -0
- package/dist/mcp/bundle.js +1507 -1506
- package/dist/mcp/handlers/hypergraph-handler.d.ts +27 -0
- package/dist/mcp/handlers/hypergraph-handler.js +140 -0
- package/dist/mcp/handlers/index.d.ts +1 -0
- package/dist/mcp/handlers/index.js +2 -0
- package/dist/mcp/server.js +19 -0
- package/dist/mcp/tool-scoping.js +5 -0
- package/dist/shared/code-index-extractor.d.ts +23 -0
- package/dist/shared/code-index-extractor.js +101 -0
- package/dist/shared/parsers/multi-language-parser.d.ts +4 -1
- package/dist/shared/parsers/multi-language-parser.js +73 -1
- package/dist/shared/parsers/tree-sitter-wasm-parser.d.ts +32 -0
- package/dist/shared/parsers/tree-sitter-wasm-parser.js +1034 -0
- package/package.json +2 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Hypergraph Command Handler
|
|
3
|
+
*
|
|
4
|
+
* Exposes hypergraph queries to users via CLI:
|
|
5
|
+
* aqe hypergraph stats - Show node/edge counts by type
|
|
6
|
+
* aqe hypergraph untested - Find functions with no test coverage
|
|
7
|
+
* aqe hypergraph impacted - Find tests impacted by changed files
|
|
8
|
+
* aqe hypergraph gaps - Find functions with low coverage
|
|
9
|
+
*/
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { join, resolve } from 'path';
|
|
12
|
+
import { existsSync } from 'fs';
|
|
13
|
+
import { findProjectRoot } from '../../kernel/unified-memory.js';
|
|
14
|
+
import { openDatabase } from '../../shared/safe-db.js';
|
|
15
|
+
import { createHypergraphEngine } from '../../integrations/ruvector/hypergraph-engine.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Hypergraph Handler
|
|
18
|
+
// ============================================================================
|
|
19
|
+
export class HypergraphHandler {
|
|
20
|
+
name = 'hypergraph';
|
|
21
|
+
description = 'Query the code knowledge hypergraph';
|
|
22
|
+
cleanupAndExit;
|
|
23
|
+
ensureInitialized;
|
|
24
|
+
constructor(cleanupAndExit, ensureInitialized) {
|
|
25
|
+
this.cleanupAndExit = cleanupAndExit;
|
|
26
|
+
this.ensureInitialized = ensureInitialized;
|
|
27
|
+
}
|
|
28
|
+
register(program, _context) {
|
|
29
|
+
const hg = program
|
|
30
|
+
.command('hypergraph')
|
|
31
|
+
.alias('hg')
|
|
32
|
+
.description(this.description);
|
|
33
|
+
hg
|
|
34
|
+
.command('stats')
|
|
35
|
+
.description('Show hypergraph statistics (node/edge counts by type)')
|
|
36
|
+
.option('--db <path>', 'Database path')
|
|
37
|
+
.action(async (options) => {
|
|
38
|
+
await this.executeStats(options);
|
|
39
|
+
});
|
|
40
|
+
hg
|
|
41
|
+
.command('untested')
|
|
42
|
+
.description('Find functions with no test coverage')
|
|
43
|
+
.option('--db <path>', 'Database path')
|
|
44
|
+
.option('--limit <number>', 'Max results', '20')
|
|
45
|
+
.action(async (options) => {
|
|
46
|
+
await this.executeUntested(options);
|
|
47
|
+
});
|
|
48
|
+
hg
|
|
49
|
+
.command('impacted <files...>')
|
|
50
|
+
.description('Find tests impacted by changed files')
|
|
51
|
+
.option('--db <path>', 'Database path')
|
|
52
|
+
.action(async (files, options) => {
|
|
53
|
+
await this.executeImpacted(files, options);
|
|
54
|
+
});
|
|
55
|
+
hg
|
|
56
|
+
.command('gaps')
|
|
57
|
+
.description('Find functions with low coverage')
|
|
58
|
+
.option('--db <path>', 'Database path')
|
|
59
|
+
.option('--max-coverage <number>', 'Coverage threshold (%)', '50')
|
|
60
|
+
.option('--limit <number>', 'Max results', '20')
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
await this.executeGaps(options);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// --------------------------------------------------------------------------
|
|
66
|
+
// Subcommands
|
|
67
|
+
// --------------------------------------------------------------------------
|
|
68
|
+
async executeStats(options) {
|
|
69
|
+
if (!await this.ensureInitialized())
|
|
70
|
+
return;
|
|
71
|
+
const { engine, close } = await this.openEngine(options.db);
|
|
72
|
+
try {
|
|
73
|
+
const stats = await engine.getStats();
|
|
74
|
+
console.log(chalk.blue('\n Hypergraph Statistics\n'));
|
|
75
|
+
console.log(chalk.white(` Total nodes: ${stats.totalNodes}`));
|
|
76
|
+
console.log(chalk.white(` Total edges: ${stats.totalEdges}`));
|
|
77
|
+
if (stats.totalNodes > 0) {
|
|
78
|
+
console.log(chalk.gray('\n Nodes by type:'));
|
|
79
|
+
for (const [type, count] of Object.entries(stats.nodesByType)) {
|
|
80
|
+
if (count > 0) {
|
|
81
|
+
console.log(chalk.gray(` ${type}: ${count}`));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
console.log(chalk.gray('\n Edges by type:'));
|
|
85
|
+
for (const [type, count] of Object.entries(stats.edgesByType)) {
|
|
86
|
+
if (count > 0) {
|
|
87
|
+
console.log(chalk.gray(` ${type}: ${count}`));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
console.log(chalk.gray(`\n Avg complexity: ${stats.avgComplexity.toFixed(1)}`));
|
|
91
|
+
console.log(chalk.gray(` Avg coverage: ${stats.avgCoverage.toFixed(1)}%`));
|
|
92
|
+
console.log(chalk.gray(` Nodes with embeddings: ${stats.nodesWithEmbeddings}`));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.log(chalk.yellow('\n Hypergraph is empty. Run "aqe init --auto" to populate it.'));
|
|
96
|
+
}
|
|
97
|
+
console.log('');
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
close();
|
|
101
|
+
}
|
|
102
|
+
await this.cleanupAndExit(0);
|
|
103
|
+
}
|
|
104
|
+
async executeUntested(options) {
|
|
105
|
+
if (!await this.ensureInitialized())
|
|
106
|
+
return;
|
|
107
|
+
const { engine, close } = await this.openEngine(options.db);
|
|
108
|
+
try {
|
|
109
|
+
const limit = parseInt(options.limit, 10) || 20;
|
|
110
|
+
const untested = await engine.findUntestedFunctions();
|
|
111
|
+
const results = untested.slice(0, limit);
|
|
112
|
+
console.log(chalk.blue(`\n Untested Functions (${untested.length} total)\n`));
|
|
113
|
+
if (results.length === 0) {
|
|
114
|
+
console.log(chalk.green(' All functions have test coverage!'));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
for (const fn of results) {
|
|
118
|
+
const complexity = fn.complexity ? chalk.yellow(` complexity=${fn.complexity}`) : '';
|
|
119
|
+
console.log(chalk.white(` ${fn.name}`) + chalk.gray(` ${fn.filePath || ''}:${fn.lineStart || '?'}`) + complexity);
|
|
120
|
+
}
|
|
121
|
+
if (untested.length > limit) {
|
|
122
|
+
console.log(chalk.gray(`\n ... and ${untested.length - limit} more (use --limit to show more)`));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
console.log('');
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
close();
|
|
129
|
+
}
|
|
130
|
+
await this.cleanupAndExit(0);
|
|
131
|
+
}
|
|
132
|
+
async executeImpacted(files, options) {
|
|
133
|
+
if (!await this.ensureInitialized())
|
|
134
|
+
return;
|
|
135
|
+
// Resolve relative paths to absolute so they match hypergraph entries
|
|
136
|
+
const absoluteFiles = files.map(f => resolve(f));
|
|
137
|
+
const { engine, close } = await this.openEngine(options.db);
|
|
138
|
+
try {
|
|
139
|
+
const tests = await engine.findImpactedTests(absoluteFiles);
|
|
140
|
+
console.log(chalk.blue(`\n Impacted Tests for ${files.length} file(s)\n`));
|
|
141
|
+
if (tests.length === 0) {
|
|
142
|
+
console.log(chalk.gray(' No impacted tests found. The hypergraph may need rebuilding.'));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
for (const test of tests) {
|
|
146
|
+
console.log(chalk.white(` ${test.name}`) + chalk.gray(` ${test.filePath || ''}`));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
console.log(chalk.gray(`\n Total: ${tests.length} test(s)\n`));
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
close();
|
|
153
|
+
}
|
|
154
|
+
await this.cleanupAndExit(0);
|
|
155
|
+
}
|
|
156
|
+
async executeGaps(options) {
|
|
157
|
+
if (!await this.ensureInitialized())
|
|
158
|
+
return;
|
|
159
|
+
const { engine, close } = await this.openEngine(options.db);
|
|
160
|
+
try {
|
|
161
|
+
const maxCoverage = parseInt(options.maxCoverage, 10) || 50;
|
|
162
|
+
const limit = parseInt(options.limit, 10) || 20;
|
|
163
|
+
const gaps = await engine.findCoverageGaps(maxCoverage);
|
|
164
|
+
const results = gaps.slice(0, limit);
|
|
165
|
+
console.log(chalk.blue(`\n Coverage Gaps (<= ${maxCoverage}%) — ${gaps.length} total\n`));
|
|
166
|
+
if (results.length === 0) {
|
|
167
|
+
console.log(chalk.green(' No coverage gaps found!'));
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
for (const fn of results) {
|
|
171
|
+
const cov = fn.coverage !== undefined ? chalk.red(` ${fn.coverage}%`) : '';
|
|
172
|
+
const complexity = fn.complexity ? chalk.yellow(` complexity=${fn.complexity}`) : '';
|
|
173
|
+
console.log(chalk.white(` ${fn.name}`) + cov + chalk.gray(` ${fn.filePath || ''}`) + complexity);
|
|
174
|
+
}
|
|
175
|
+
if (gaps.length > limit) {
|
|
176
|
+
console.log(chalk.gray(`\n ... and ${gaps.length - limit} more (use --limit to show more)`));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
console.log('');
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
close();
|
|
183
|
+
}
|
|
184
|
+
await this.cleanupAndExit(0);
|
|
185
|
+
}
|
|
186
|
+
// --------------------------------------------------------------------------
|
|
187
|
+
// Helpers
|
|
188
|
+
// --------------------------------------------------------------------------
|
|
189
|
+
async openEngine(dbPathOverride) {
|
|
190
|
+
const projectRoot = findProjectRoot();
|
|
191
|
+
const dbPath = dbPathOverride || join(projectRoot, '.agentic-qe', 'memory.db');
|
|
192
|
+
if (!existsSync(dbPath)) {
|
|
193
|
+
throw new Error(`Database not found: ${dbPath}\nRun "aqe init --auto" first.`);
|
|
194
|
+
}
|
|
195
|
+
const db = openDatabase(dbPath);
|
|
196
|
+
try {
|
|
197
|
+
const engine = await createHypergraphEngine({
|
|
198
|
+
db,
|
|
199
|
+
maxTraversalDepth: 10,
|
|
200
|
+
maxQueryResults: 1000,
|
|
201
|
+
enableVectorSearch: false,
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
engine,
|
|
205
|
+
close: () => {
|
|
206
|
+
try {
|
|
207
|
+
db.close();
|
|
208
|
+
}
|
|
209
|
+
catch { /* ignore */ }
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
// Close db if engine creation fails to prevent connection leak
|
|
215
|
+
try {
|
|
216
|
+
db.close();
|
|
217
|
+
}
|
|
218
|
+
catch { /* ignore */ }
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
getHelp() {
|
|
223
|
+
return `
|
|
224
|
+
Query the code knowledge hypergraph for untested functions,
|
|
225
|
+
impacted tests, and coverage gaps.
|
|
226
|
+
|
|
227
|
+
Usage:
|
|
228
|
+
aqe hypergraph stats Show node/edge counts by type
|
|
229
|
+
aqe hypergraph untested [--limit N] Find functions with no test coverage
|
|
230
|
+
aqe hypergraph impacted <files...> Find tests impacted by changed files
|
|
231
|
+
aqe hypergraph gaps [--max-coverage N] Find functions with low coverage
|
|
232
|
+
|
|
233
|
+
Options:
|
|
234
|
+
--db <path> Override database path (default: .agentic-qe/memory.db)
|
|
235
|
+
--limit <number> Max results (default: 20)
|
|
236
|
+
--max-coverage <n> Coverage threshold for gaps (default: 50)
|
|
237
|
+
|
|
238
|
+
Alias: aqe hg stats
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// ============================================================================
|
|
243
|
+
// Factory
|
|
244
|
+
// ============================================================================
|
|
245
|
+
export function createHypergraphHandler(cleanupAndExit, ensureInitialized) {
|
|
246
|
+
return new HypergraphHandler(cleanupAndExit, ensureInitialized);
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=hypergraph-handler.js.map
|
|
@@ -11,4 +11,5 @@ export { AgentHandler, createAgentHandler } from './agent-handler.js';
|
|
|
11
11
|
export { DomainHandler, createDomainHandler } from './domain-handler.js';
|
|
12
12
|
export { ProtocolHandler, createProtocolHandler } from './protocol-handler.js';
|
|
13
13
|
export { BrainHandler, createBrainHandler } from './brain-handler.js';
|
|
14
|
+
export { HypergraphHandler, createHypergraphHandler } from './hypergraph-handler.js';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,4 +13,5 @@ export { AgentHandler, createAgentHandler } from './agent-handler.js';
|
|
|
13
13
|
export { DomainHandler, createDomainHandler } from './domain-handler.js';
|
|
14
14
|
export { ProtocolHandler, createProtocolHandler } from './protocol-handler.js';
|
|
15
15
|
export { BrainHandler, createBrainHandler } from './brain-handler.js';
|
|
16
|
+
export { HypergraphHandler, createHypergraphHandler } from './hypergraph-handler.js';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -49,6 +49,7 @@ export class InitHandler {
|
|
|
49
49
|
.option('--with-codex', 'Include OpenAI Codex CLI MCP config and AGENTS.md')
|
|
50
50
|
.option('--with-windsurf', 'Include Windsurf MCP config and rules')
|
|
51
51
|
.option('--with-continuedev', 'Include Continue.dev MCP config and rules')
|
|
52
|
+
.option('--with-mcp', 'Include MCP server config in .mcp.json (opt-in — CLI works without MCP)')
|
|
52
53
|
.option('--with-all-platforms', 'Include all coding agent platform configurations')
|
|
53
54
|
.option('--auto-migrate', 'Automatically migrate from v2 if detected')
|
|
54
55
|
.option('--with-claude-flow', 'Force Claude Flow integration setup')
|
|
@@ -114,6 +115,7 @@ export class InitHandler {
|
|
|
114
115
|
withCodex: options.withCodex,
|
|
115
116
|
withWindsurf: options.withWindsurf,
|
|
116
117
|
withContinueDev: options.withContinuedev,
|
|
118
|
+
withMcp: options.withMcp,
|
|
117
119
|
noGovernance: options.noGovernance,
|
|
118
120
|
});
|
|
119
121
|
console.log(chalk.white(' Analyzing project...\n'));
|
|
@@ -170,9 +172,14 @@ export class InitHandler {
|
|
|
170
172
|
console.log(chalk.gray(` - Claude Flow: ${cfResult?.available ? 'Enabled' : 'Standalone mode'}`));
|
|
171
173
|
console.log(chalk.gray(` - Total time: ${result.totalDurationMs}ms\n`));
|
|
172
174
|
console.log(chalk.white('Next steps:'));
|
|
173
|
-
console.log(chalk.gray(' 1.
|
|
174
|
-
console.log(chalk.gray(' 2.
|
|
175
|
-
console.log(chalk.gray(' 3. Check status: aqe status
|
|
175
|
+
console.log(chalk.gray(' 1. Run tests: aqe test <path>'));
|
|
176
|
+
console.log(chalk.gray(' 2. Check coverage: aqe coverage <path>'));
|
|
177
|
+
console.log(chalk.gray(' 3. Check status: aqe status'));
|
|
178
|
+
if (!result.summary.mcpConfigured) {
|
|
179
|
+
console.log(chalk.gray('\n Optional — enable MCP server for richer agent integration:'));
|
|
180
|
+
console.log(chalk.gray(' aqe init --with-mcp'));
|
|
181
|
+
console.log(chalk.gray(' # or manually: claude mcp add aqe -- aqe-mcp\n'));
|
|
182
|
+
}
|
|
176
183
|
}
|
|
177
184
|
else {
|
|
178
185
|
console.log(chalk.red(' Initialization failed. Check errors above.\n'));
|
|
@@ -220,9 +227,14 @@ export class InitHandler {
|
|
|
220
227
|
}
|
|
221
228
|
console.log(chalk.gray(` - Total time: ${result.totalDurationMs}ms\n`));
|
|
222
229
|
console.log(chalk.white('Next steps:'));
|
|
223
|
-
console.log(chalk.gray(' 1.
|
|
224
|
-
console.log(chalk.gray(' 2.
|
|
225
|
-
console.log(chalk.gray(' 3. Check status: aqe status
|
|
230
|
+
console.log(chalk.gray(' 1. Run tests: aqe test <path>'));
|
|
231
|
+
console.log(chalk.gray(' 2. Check coverage: aqe coverage <path>'));
|
|
232
|
+
console.log(chalk.gray(' 3. Check status: aqe status'));
|
|
233
|
+
if (!result.summary.mcpConfigured) {
|
|
234
|
+
console.log(chalk.gray('\n Optional — enable MCP server for richer agent integration:'));
|
|
235
|
+
console.log(chalk.gray(' aqe init --with-mcp'));
|
|
236
|
+
console.log(chalk.gray(' # or manually: claude mcp add aqe -- aqe-mcp\n'));
|
|
237
|
+
}
|
|
226
238
|
}
|
|
227
239
|
else {
|
|
228
240
|
console.log(chalk.red(' Initialization failed. Check errors above.\n'));
|
package/dist/cli/index.js
CHANGED
|
@@ -816,6 +816,7 @@ import { createLLMRouterCommand } from './commands/llm-router.js';
|
|
|
816
816
|
import { createSyncCommands } from './commands/sync.js';
|
|
817
817
|
import { createHooksCommand } from './commands/hooks.js';
|
|
818
818
|
import { createLearningCommand } from './commands/learning.js';
|
|
819
|
+
import { createMemoryCommand } from './commands/memory.js';
|
|
819
820
|
import { createMcpCommand } from './commands/mcp.js';
|
|
820
821
|
import { createPlatformCommand } from './commands/platform.js';
|
|
821
822
|
import { createProveCommand } from './commands/prove.js';
|
|
@@ -826,6 +827,7 @@ program.addCommand(createLLMRouterCommand());
|
|
|
826
827
|
program.addCommand(createSyncCommands());
|
|
827
828
|
program.addCommand(createHooksCommand());
|
|
828
829
|
program.addCommand(createLearningCommand());
|
|
830
|
+
program.addCommand(createMemoryCommand(context, cleanupAndExit, ensureInitialized));
|
|
829
831
|
program.addCommand(createMcpCommand());
|
|
830
832
|
program.addCommand(createPlatformCommand());
|
|
831
833
|
program.addCommand(createProveCommand(context, cleanupAndExit, ensureInitialized));
|
|
@@ -128,17 +128,8 @@ export class CodeIntelligenceIndexProtocol {
|
|
|
128
128
|
filesIndexed: indexResult.value.filesIndexed,
|
|
129
129
|
duration: indexResult.value.duration,
|
|
130
130
|
});
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
if (codeIntelForHypergraph?.buildHypergraphFromIndex) {
|
|
134
|
-
try {
|
|
135
|
-
await codeIntelForHypergraph.buildHypergraphFromIndex(indexResult.value);
|
|
136
|
-
}
|
|
137
|
-
catch (hypergraphError) {
|
|
138
|
-
// Non-fatal: hypergraph is supplementary to the core indexing pipeline
|
|
139
|
-
console.warn('[CodeIndexProtocol] Hypergraph build failed (continuing):', hypergraphError);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
131
|
+
// Note: Hypergraph is now rebuilt automatically inside coordinator.index()
|
|
132
|
+
// (no separate buildHypergraphFromIndex call needed here)
|
|
142
133
|
// Step 2: Analyze Impact (if enabled and relevant trigger)
|
|
143
134
|
let impactAnalysis;
|
|
144
135
|
if (this.config.analyzeImpact && this.shouldAnalyzeImpact(trigger)) {
|
|
@@ -20,7 +20,7 @@ export async function initializeHypergraph(hypergraphDbPath, enableGNN) {
|
|
|
20
20
|
const path = await import('path');
|
|
21
21
|
const { findProjectRoot } = await import('../../kernel/unified-memory.js');
|
|
22
22
|
const projectRoot = findProjectRoot();
|
|
23
|
-
const dbPath = hypergraphDbPath || path.join(projectRoot, '.agentic-qe', '
|
|
23
|
+
const dbPath = hypergraphDbPath || path.join(projectRoot, '.agentic-qe', 'memory.db');
|
|
24
24
|
const dir = path.dirname(dbPath);
|
|
25
25
|
if (!fs.existsSync(dir)) {
|
|
26
26
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -318,6 +318,11 @@ export declare class CodeIntelligenceCoordinator extends BaseDomainCoordinator<C
|
|
|
318
318
|
* test discovery with the existing impact analysis.
|
|
319
319
|
*/
|
|
320
320
|
private enhanceImpactWithHypergraph;
|
|
321
|
+
/**
|
|
322
|
+
* Build a CodeIndexResult from file paths using shared lightweight regex extraction.
|
|
323
|
+
* Used to keep hypergraph in sync when index() is called.
|
|
324
|
+
*/
|
|
325
|
+
private buildCodeIndexResultFromPaths;
|
|
321
326
|
/**
|
|
322
327
|
* Verify a code pattern detection using multi-model consensus
|
|
323
328
|
* Per MM-001: High-stakes code intelligence decisions require verification
|
|
@@ -133,7 +133,7 @@ export class CodeIntelligenceCoordinator extends BaseDomainCoordinator {
|
|
|
133
133
|
const path = await import('path');
|
|
134
134
|
const { findProjectRoot } = await import('../../kernel/unified-memory.js');
|
|
135
135
|
const projectRoot = findProjectRoot();
|
|
136
|
-
const dbPath = this.config.hypergraphDbPath || path.join(projectRoot, '.agentic-qe', '
|
|
136
|
+
const dbPath = this.config.hypergraphDbPath || path.join(projectRoot, '.agentic-qe', 'memory.db');
|
|
137
137
|
// Ensure directory exists
|
|
138
138
|
const dir = path.dirname(dbPath);
|
|
139
139
|
if (!fs.existsSync(dir)) {
|
|
@@ -151,10 +151,16 @@ export class CodeIntelligenceCoordinator extends BaseDomainCoordinator {
|
|
|
151
151
|
logger.info(`Hypergraph Engine initialized at ${dbPath}`);
|
|
152
152
|
}
|
|
153
153
|
catch (error) {
|
|
154
|
-
|
|
154
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
155
|
+
logger.warn(`Hypergraph Engine initialization failed (feature degraded): ${msg}`);
|
|
155
156
|
// Don't throw - hypergraph is optional, coordinator should still work
|
|
156
157
|
this.hypergraph = undefined;
|
|
157
158
|
this.hypergraphDb = undefined;
|
|
159
|
+
// Publish degradation event so health checks can surface it
|
|
160
|
+
if (this.config.publishEvents) {
|
|
161
|
+
const event = createEvent('code-intelligence.HypergraphDegraded', 'code-intelligence', { reason: msg });
|
|
162
|
+
this.eventBus.publish(event).catch(() => { });
|
|
163
|
+
}
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
/**
|
|
@@ -289,11 +295,26 @@ export class CodeIntelligenceCoordinator extends BaseDomainCoordinator {
|
|
|
289
295
|
await this.collectProjectMetrics(projectPath);
|
|
290
296
|
}
|
|
291
297
|
}
|
|
292
|
-
this.updateWorkflowProgress(workflowId,
|
|
298
|
+
this.updateWorkflowProgress(workflowId, 70);
|
|
293
299
|
// Index content for semantic search
|
|
294
300
|
if (request.paths.length > 0) {
|
|
295
301
|
await this.indexForSemanticSearch(request.paths);
|
|
296
302
|
}
|
|
303
|
+
this.updateWorkflowProgress(workflowId, 85);
|
|
304
|
+
// V3: Rebuild hypergraph from indexed files (keeps hypergraph in sync with KG)
|
|
305
|
+
if (this.config.enableHypergraph && this.hypergraph && request.paths.length > 0) {
|
|
306
|
+
try {
|
|
307
|
+
const codeIndexResult = await this.buildCodeIndexResultFromPaths(request.paths);
|
|
308
|
+
if (codeIndexResult.files.length > 0) {
|
|
309
|
+
await this.hypergraph.buildFromIndexResult(codeIndexResult);
|
|
310
|
+
logger.info(`Hypergraph rebuilt from ${codeIndexResult.files.length} indexed files`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (hgError) {
|
|
314
|
+
// Non-fatal: hypergraph is supplementary to the core indexing pipeline
|
|
315
|
+
logger.warn(`Hypergraph rebuild skipped: ${hgError instanceof Error ? hgError.message : hgError}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
297
318
|
this.updateWorkflowProgress(workflowId, 100);
|
|
298
319
|
this.completeWorkflow(workflowId);
|
|
299
320
|
// Publish events
|
|
@@ -1005,6 +1026,17 @@ export class CodeIntelligenceCoordinator extends BaseDomainCoordinator {
|
|
|
1005
1026
|
return HypergraphHelpers.enhanceImpactWithHypergraph(this.hypergraph, request, baseAnalysis);
|
|
1006
1027
|
}
|
|
1007
1028
|
// ============================================================================
|
|
1029
|
+
// Hypergraph Helpers
|
|
1030
|
+
// ============================================================================
|
|
1031
|
+
/**
|
|
1032
|
+
* Build a CodeIndexResult from file paths using shared lightweight regex extraction.
|
|
1033
|
+
* Used to keep hypergraph in sync when index() is called.
|
|
1034
|
+
*/
|
|
1035
|
+
async buildCodeIndexResultFromPaths(paths) {
|
|
1036
|
+
const { extractCodeIndex } = await import('../../shared/code-index-extractor.js');
|
|
1037
|
+
return extractCodeIndex(paths);
|
|
1038
|
+
}
|
|
1039
|
+
// ============================================================================
|
|
1008
1040
|
// Domain-Specific Consensus Methods (MM-001)
|
|
1009
1041
|
// ============================================================================
|
|
1010
1042
|
/**
|
|
@@ -22,11 +22,11 @@ export declare class CodeIntelligencePhase extends BasePhase<CodeIntelligenceRes
|
|
|
22
22
|
readonly requiresPhases: readonly ["database"];
|
|
23
23
|
protected run(context: InitContext): Promise<CodeIntelligenceResult>;
|
|
24
24
|
/**
|
|
25
|
-
* Check if code intelligence index exists
|
|
25
|
+
* Check if code intelligence index exists (uses provided db connection)
|
|
26
26
|
*/
|
|
27
27
|
private checkCodeIntelligenceIndex;
|
|
28
28
|
/**
|
|
29
|
-
* Get count of KG entries
|
|
29
|
+
* Get count of KG entries (uses provided db connection)
|
|
30
30
|
*/
|
|
31
31
|
private getKGEntryCount;
|
|
32
32
|
/**
|
|
@@ -41,7 +41,12 @@ export declare class CodeIntelligencePhase extends BasePhase<CodeIntelligenceRes
|
|
|
41
41
|
*/
|
|
42
42
|
private runCodeIntelligenceScan;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Build hypergraph from indexed files.
|
|
45
|
+
* Uses shared extractor to populate hypergraph_nodes/hypergraph_edges in memory.db.
|
|
46
|
+
*/
|
|
47
|
+
private buildHypergraph;
|
|
48
|
+
/**
|
|
49
|
+
* Read the indexedAt timestamp from KG metadata (uses provided db connection)
|
|
45
50
|
*/
|
|
46
51
|
private getLastIndexedAt;
|
|
47
52
|
/**
|
|
@@ -54,42 +54,55 @@ export class CodeIntelligencePhase extends BasePhase {
|
|
|
54
54
|
requiresPhases = ['database'];
|
|
55
55
|
async run(context) {
|
|
56
56
|
const { projectRoot } = context;
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
57
|
+
const dbPath = join(projectRoot, '.agentic-qe', 'memory.db');
|
|
58
|
+
if (!existsSync(dbPath)) {
|
|
59
59
|
context.services.log(' Building knowledge graph...');
|
|
60
60
|
return await this.runCodeIntelligenceScan(projectRoot, context, false);
|
|
61
61
|
}
|
|
62
|
-
//
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
// Open a single DB connection for all pre-scan queries
|
|
63
|
+
const db = openDatabase(dbPath);
|
|
64
|
+
try {
|
|
65
|
+
const hasIndex = this.checkCodeIntelligenceIndex(db);
|
|
66
|
+
if (!hasIndex) {
|
|
67
|
+
db.close();
|
|
68
|
+
context.services.log(' Building knowledge graph...');
|
|
69
|
+
return await this.runCodeIntelligenceScan(projectRoot, context, false);
|
|
70
|
+
}
|
|
71
|
+
// Delta scan: check for files modified since last index
|
|
72
|
+
const lastIndexedAt = this.getLastIndexedAt(db);
|
|
73
|
+
if (!lastIndexedAt) {
|
|
74
|
+
const entryCount = this.getKGEntryCount(db);
|
|
75
|
+
db.close();
|
|
76
|
+
context.services.log(` Using existing index (${entryCount} entries)`);
|
|
77
|
+
return { status: 'existing', entries: entryCount };
|
|
78
|
+
}
|
|
79
|
+
const entryCount = this.getKGEntryCount(db);
|
|
80
|
+
db.close();
|
|
81
|
+
const changedFiles = await this.findChangedFiles(projectRoot, lastIndexedAt);
|
|
82
|
+
if (changedFiles.length === 0) {
|
|
83
|
+
context.services.log(` Index up to date (${entryCount} entries)`);
|
|
84
|
+
return { status: 'existing', entries: entryCount };
|
|
85
|
+
}
|
|
86
|
+
context.services.log(` Delta scan: ${changedFiles.length} files changed since last index...`);
|
|
87
|
+
return await this.runCodeIntelligenceScan(projectRoot, context, true, changedFiles);
|
|
68
88
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
catch (error) {
|
|
90
|
+
try {
|
|
91
|
+
db.close();
|
|
92
|
+
}
|
|
93
|
+
catch { /* ignore */ }
|
|
94
|
+
throw error;
|
|
74
95
|
}
|
|
75
|
-
context.services.log(` Delta scan: ${changedFiles.length} files changed since last index...`);
|
|
76
|
-
return await this.runCodeIntelligenceScan(projectRoot, context, true, changedFiles);
|
|
77
96
|
}
|
|
78
97
|
/**
|
|
79
|
-
* Check if code intelligence index exists
|
|
98
|
+
* Check if code intelligence index exists (uses provided db connection)
|
|
80
99
|
*/
|
|
81
|
-
|
|
82
|
-
const dbPath = join(projectRoot, '.agentic-qe', 'memory.db');
|
|
83
|
-
if (!existsSync(dbPath)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
100
|
+
checkCodeIntelligenceIndex(db) {
|
|
86
101
|
try {
|
|
87
|
-
const db = openDatabase(dbPath);
|
|
88
102
|
const result = db.prepare(`
|
|
89
103
|
SELECT COUNT(*) as count FROM kv_store
|
|
90
104
|
WHERE namespace = 'code-intelligence:kg'
|
|
91
105
|
`).get();
|
|
92
|
-
db.close();
|
|
93
106
|
return result.count > 0;
|
|
94
107
|
}
|
|
95
108
|
catch {
|
|
@@ -97,17 +110,14 @@ export class CodeIntelligencePhase extends BasePhase {
|
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
/**
|
|
100
|
-
* Get count of KG entries
|
|
113
|
+
* Get count of KG entries (uses provided db connection)
|
|
101
114
|
*/
|
|
102
|
-
|
|
103
|
-
const dbPath = join(projectRoot, '.agentic-qe', 'memory.db');
|
|
115
|
+
getKGEntryCount(db) {
|
|
104
116
|
try {
|
|
105
|
-
const db = openDatabase(dbPath);
|
|
106
117
|
const result = db.prepare(`
|
|
107
118
|
SELECT COUNT(*) as count FROM kv_store
|
|
108
119
|
WHERE namespace LIKE 'code-intelligence:kg%'
|
|
109
120
|
`).get();
|
|
110
|
-
db.close();
|
|
111
121
|
return result.count;
|
|
112
122
|
}
|
|
113
123
|
catch {
|
|
@@ -165,6 +175,9 @@ export class CodeIntelligencePhase extends BasePhase {
|
|
|
165
175
|
const entries = result.value.nodesCreated + result.value.edgesCreated;
|
|
166
176
|
const label = incremental ? 'Delta indexed' : 'Indexed';
|
|
167
177
|
context.services.log(` ${label} ${entries} entries to ${dbPath}`);
|
|
178
|
+
// Also populate the hypergraph tables (hypergraph_nodes/hypergraph_edges)
|
|
179
|
+
// so CLI/MCP hypergraph queries work immediately after init
|
|
180
|
+
await this.buildHypergraph(dbPath, filesToIndex, context);
|
|
168
181
|
return { status: 'indexed', entries };
|
|
169
182
|
}
|
|
170
183
|
return { status: 'error', entries: 0 };
|
|
@@ -175,18 +188,43 @@ export class CodeIntelligencePhase extends BasePhase {
|
|
|
175
188
|
}
|
|
176
189
|
}
|
|
177
190
|
/**
|
|
178
|
-
*
|
|
191
|
+
* Build hypergraph from indexed files.
|
|
192
|
+
* Uses shared extractor to populate hypergraph_nodes/hypergraph_edges in memory.db.
|
|
179
193
|
*/
|
|
180
|
-
async
|
|
181
|
-
const dbPath = join(projectRoot, '.agentic-qe', 'memory.db');
|
|
194
|
+
async buildHypergraph(dbPath, filesToIndex, context) {
|
|
182
195
|
try {
|
|
196
|
+
const { extractCodeIndex } = await import('../../shared/code-index-extractor.js');
|
|
197
|
+
const { createHypergraphEngine } = await import('../../integrations/ruvector/hypergraph-engine.js');
|
|
183
198
|
const db = openDatabase(dbPath);
|
|
199
|
+
const engine = await createHypergraphEngine({
|
|
200
|
+
db,
|
|
201
|
+
maxTraversalDepth: 10,
|
|
202
|
+
maxQueryResults: 1000,
|
|
203
|
+
enableVectorSearch: false,
|
|
204
|
+
});
|
|
205
|
+
const codeIndexResult = await extractCodeIndex(filesToIndex);
|
|
206
|
+
const buildResult = await engine.buildFromIndexResult(codeIndexResult);
|
|
207
|
+
db.close();
|
|
208
|
+
const total = buildResult.nodesCreated + buildResult.edgesCreated;
|
|
209
|
+
if (total > 0) {
|
|
210
|
+
context.services.log(` Hypergraph: ${buildResult.nodesCreated} nodes, ${buildResult.edgesCreated} edges`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
// Non-fatal: hypergraph is supplementary
|
|
215
|
+
context.services.warn?.(` Hypergraph build skipped: ${error}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Read the indexedAt timestamp from KG metadata (uses provided db connection)
|
|
220
|
+
*/
|
|
221
|
+
getLastIndexedAt(db) {
|
|
222
|
+
try {
|
|
184
223
|
const row = db.prepare(`
|
|
185
224
|
SELECT value FROM kv_store
|
|
186
225
|
WHERE namespace = 'code-intelligence:kg'
|
|
187
226
|
AND key = 'metadata:index'
|
|
188
227
|
`).get();
|
|
189
|
-
db.close();
|
|
190
228
|
if (!row)
|
|
191
229
|
return null;
|
|
192
230
|
const metadata = safeJsonParse(row.value);
|
|
@@ -26,6 +26,16 @@ export class MCPPhase extends BasePhase {
|
|
|
26
26
|
requiresPhases = ['configuration', 'database'];
|
|
27
27
|
async run(context) {
|
|
28
28
|
const { projectRoot } = context;
|
|
29
|
+
// MCP is opt-in: skip unless --with-mcp is passed
|
|
30
|
+
if (!context.options.withMcp) {
|
|
31
|
+
context.services.log(' MCP: skipped (opt-in — use --with-mcp to enable)');
|
|
32
|
+
context.services.log(' All QE commands available via CLI: aqe memory, aqe test, aqe coverage, etc.');
|
|
33
|
+
return {
|
|
34
|
+
configured: false,
|
|
35
|
+
mcpPath: '',
|
|
36
|
+
serverName: '',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
29
39
|
// AQE MCP server configuration
|
|
30
40
|
// AQE_PROJECT_ROOT omitted — runtime discovery via findProjectRoot() is
|
|
31
41
|
// portable across machines, devcontainers, and CI (#321)
|