Files
wehub-resource-sync 23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:02:19 +08:00

519 lines
16 KiB
TypeScript

/**
* RuVector Plugins Test Suite
*
* Tests for all RuVector-powered plugins.
*/
import { describe, it, expect, beforeEach } from 'vitest';
import type {
ReasoningTrajectory,
ReasoningStep,
CodeChunk,
CodeSearchResult,
LearningPattern,
AdaptationResult,
Intent,
IntentHandler,
RouteResult,
ToolUsagePattern,
ToolSequence,
OptimizationSuggestion,
HookPattern,
PatternMatch,
HookRecommendation,
} from './index.js';
// Type tests for ReasoningBank
describe('ReasoningBank Types', () => {
it('should have correct ReasoningStep structure', () => {
const step: ReasoningStep = {
thought: 'Analyzing the problem',
action: 'Search for patterns',
observation: 'Found matching patterns',
reward: 0.8,
};
expect(step.thought).toBeDefined();
expect(step.action).toBeDefined();
expect(step.observation).toBeDefined();
expect(typeof step.reward).toBe('number');
});
it('should have correct ReasoningTrajectory structure', () => {
const trajectory: ReasoningTrajectory = {
id: 'traj-001',
task: 'Debug authentication flow',
steps: [
{
thought: 'Check auth middleware',
action: 'Read auth.ts',
observation: 'Found token validation issue',
reward: 0.9,
},
],
outcome: 'success',
totalReward: 0.9,
timestamp: Date.now(),
metadata: { category: 'debugging' },
};
expect(trajectory.id).toBe('traj-001');
expect(trajectory.outcome).toBe('success');
expect(trajectory.steps.length).toBe(1);
});
it('should allow optional metadata', () => {
const trajectory: ReasoningTrajectory = {
id: 'traj-002',
task: 'Simple task',
steps: [],
outcome: 'success',
totalReward: 1.0,
timestamp: Date.now(),
};
expect(trajectory.metadata).toBeUndefined();
});
});
// Type tests for SemanticCodeSearch
describe('SemanticCodeSearch Types', () => {
it('should have correct CodeChunk structure', () => {
const chunk: CodeChunk = {
id: 'chunk-001',
content: 'function hello() { return "world"; }',
filePath: '/src/utils.ts',
startLine: 10,
endLine: 12,
language: 'typescript',
symbols: ['hello'],
};
expect(chunk.id).toBe('chunk-001');
expect(chunk.language).toBe('typescript');
expect(chunk.symbols).toContain('hello');
});
it('should have correct CodeSearchResult structure', () => {
const result: CodeSearchResult = {
chunk: {
id: 'chunk-002',
content: 'class UserService {}',
filePath: '/src/services/user.ts',
startLine: 1,
endLine: 50,
language: 'typescript',
symbols: ['UserService'],
},
score: 0.95,
highlights: ['UserService'],
};
expect(result.score).toBeGreaterThan(0);
expect(result.chunk.symbols).toContain('UserService');
});
it('should allow optional symbols and metadata', () => {
const chunk: CodeChunk = {
id: 'chunk-003',
content: '# Comment only',
filePath: '/src/config.py',
startLine: 1,
endLine: 1,
language: 'python',
};
expect(chunk.symbols).toBeUndefined();
});
});
// Type tests for SONA Learning
describe('SONALearning Types', () => {
it('should have correct LearningPattern structure', () => {
const pattern: LearningPattern = {
id: 'pattern-001',
category: 'code-review',
input: 'Review this function for bugs',
output: 'Found null pointer dereference',
embedding: new Float32Array([0.1, 0.2, 0.3]),
adapterId: 'adapter-001',
quality: 0.92,
usageCount: 15,
lastUsed: Date.now(),
};
expect(pattern.category).toBe('code-review');
expect(pattern.quality).toBeGreaterThan(0.9);
expect(pattern.embedding).toBeInstanceOf(Float32Array);
});
it('should have correct AdaptationResult structure', () => {
const result: AdaptationResult = {
patternId: 'pattern-002',
adapterId: 'adapter-002',
improvement: 0.15,
newQuality: 0.87,
latencyMs: 0.05,
};
expect(result.improvement).toBeGreaterThan(0);
expect(result.latencyMs).toBeLessThan(1);
});
});
// Type tests for Intent Router
describe('IntentRouter Types', () => {
it('should have correct Intent structure', () => {
const intent: Intent = {
id: 'intent-coding',
name: 'coding',
description: 'Code writing and implementation',
examples: [
'Write a function to sort an array',
'Implement the login feature',
'Create a new component',
],
priority: 1,
};
expect(intent.examples.length).toBeGreaterThan(0);
expect(intent.priority).toBe(1);
});
it('should have correct IntentHandler structure', () => {
const handler: IntentHandler = {
intentId: 'intent-coding',
agentType: 'coder',
tools: ['Edit', 'Write', 'Read'],
confidence: 0.95,
};
expect(handler.tools).toContain('Edit');
expect(handler.confidence).toBeGreaterThan(0.9);
});
it('should have correct RouteResult structure', () => {
const result: RouteResult = {
intent: {
id: 'intent-testing',
name: 'testing',
description: 'Testing and validation',
examples: ['Write tests', 'Run test suite'],
priority: 2,
},
handler: {
intentId: 'intent-testing',
agentType: 'tester',
tools: ['Bash', 'Read'],
confidence: 0.88,
},
confidence: 0.88,
alternatives: [],
};
expect(result.handler.agentType).toBe('tester');
});
});
// Type tests for MCP Tool Optimizer
describe('MCPToolOptimizer Types', () => {
it('should have correct ToolUsagePattern structure', () => {
const pattern: ToolUsagePattern = {
id: 'usage-001',
toolSequence: ['Read', 'Edit', 'Bash'],
context: 'fixing-bug',
successRate: 0.92,
avgDuration: 5000,
usageCount: 50,
};
expect(pattern.toolSequence).toHaveLength(3);
expect(pattern.successRate).toBeGreaterThan(0.9);
});
it('should have correct ToolSequence structure', () => {
const sequence: ToolSequence = {
tools: ['Glob', 'Grep', 'Read'],
confidence: 0.85,
reasoning: 'Search, then filter, then read details',
};
expect(sequence.tools[0]).toBe('Glob');
expect(sequence.reasoning).toBeDefined();
});
it('should have correct OptimizationSuggestion structure', () => {
const suggestion: OptimizationSuggestion = {
currentSequence: ['Read', 'Read', 'Read'],
suggestedSequence: ['Glob', 'Read'],
expectedImprovement: 0.3,
reasoning: 'Use Glob to find files first, then Read targeted files',
};
expect(suggestion.expectedImprovement).toBeGreaterThan(0);
expect(suggestion.suggestedSequence.length).toBeLessThan(
suggestion.currentSequence.length
);
});
});
// Type tests for Hook Pattern Library
describe('HookPatternLibrary Types', () => {
it('should have correct HookPattern structure', () => {
const pattern: HookPattern = {
id: 'hook-format-ts',
filePattern: '*.ts',
operation: 'save',
hookType: 'pre',
command: 'prettier --write',
successRate: 0.98,
usageCount: 200,
};
expect(pattern.hookType).toBe('pre');
expect(pattern.successRate).toBeGreaterThan(0.95);
});
it('should have correct PatternMatch structure', () => {
const match: PatternMatch = {
pattern: {
id: 'hook-lint',
filePattern: '*.js',
operation: 'commit',
hookType: 'pre',
command: 'eslint --fix',
successRate: 0.95,
usageCount: 100,
},
score: 0.92,
reasoning: 'High success rate for JavaScript linting',
};
expect(match.score).toBeGreaterThan(0.9);
expect(match.reasoning).toBeDefined();
});
it('should have correct HookRecommendation structure', () => {
const recommendation: HookRecommendation = {
filePath: '/src/app.tsx',
operation: 'save',
recommendations: [
{
pattern: {
id: 'hook-format-tsx',
filePattern: '*.tsx',
operation: 'save',
hookType: 'pre',
command: 'prettier --write',
successRate: 0.97,
usageCount: 150,
},
score: 0.95,
reasoning: 'TSX files benefit from auto-formatting',
},
],
confidence: 0.95,
};
expect(recommendation.recommendations.length).toBeGreaterThan(0);
expect(recommendation.confidence).toBeGreaterThan(0.9);
});
});
// Integration type tests
describe('Plugin Integration Types', () => {
it('should export all plugin types', async () => {
// Dynamic import to verify exports work
const exports = await import('./index.js');
expect(exports.reasoningBankPlugin).toBeDefined();
expect(exports.semanticCodeSearchPlugin).toBeDefined();
expect(exports.sonaLearningPlugin).toBeDefined();
expect(exports.intentRouterPlugin).toBeDefined();
expect(exports.mcpToolOptimizerPlugin).toBeDefined();
expect(exports.hookPatternLibraryPlugin).toBeDefined();
expect(exports.registerAllRuVectorPlugins).toBeDefined();
});
it('should export all class instances', async () => {
const exports = await import('./index.js');
expect(exports.ReasoningBank).toBeDefined();
expect(exports.SemanticCodeSearch).toBeDefined();
expect(exports.SONALearning).toBeDefined();
expect(exports.IntentRouter).toBeDefined();
expect(exports.MCPToolOptimizer).toBeDefined();
expect(exports.HookPatternLibrary).toBeDefined();
});
});
// Plugin metadata tests
describe('Plugin Metadata', () => {
it('reasoningBankPlugin should have correct metadata', async () => {
const { reasoningBankPlugin } = await import('./index.js');
const metadata = reasoningBankPlugin.metadata;
expect(metadata.id).toBe('ruvector-reasoning-bank');
expect(metadata.name).toBe('RuVector Reasoning Bank');
expect(metadata.version).toBeDefined();
expect(metadata.capabilities).toContain('vector-search');
expect(metadata.capabilities).toContain('learning');
});
it('semanticCodeSearchPlugin should have correct metadata', async () => {
const { semanticCodeSearchPlugin } = await import('./index.js');
const metadata = semanticCodeSearchPlugin.metadata;
expect(metadata.id).toBe('ruvector-semantic-code-search');
expect(metadata.name).toBe('RuVector Semantic Code Search');
expect(metadata.capabilities).toContain('code-search');
});
it('sonaLearningPlugin should have correct metadata', async () => {
const { sonaLearningPlugin } = await import('./index.js');
const metadata = sonaLearningPlugin.metadata;
expect(metadata.id).toBe('ruvector-sona-learning');
expect(metadata.name).toBe('RuVector SONA Learning');
expect(metadata.capabilities).toContain('learning');
expect(metadata.capabilities).toContain('adaptation');
});
it('intentRouterPlugin should have correct metadata', async () => {
const { intentRouterPlugin } = await import('./index.js');
const metadata = intentRouterPlugin.metadata;
expect(metadata.id).toBe('ruvector-intent-router');
expect(metadata.name).toBe('RuVector Intent Router');
expect(metadata.capabilities).toContain('routing');
});
it('mcpToolOptimizerPlugin should have correct metadata', async () => {
const { mcpToolOptimizerPlugin } = await import('./index.js');
const metadata = mcpToolOptimizerPlugin.metadata;
expect(metadata.id).toBe('ruvector-mcp-tool-optimizer');
expect(metadata.name).toBe('RuVector MCP Tool Optimizer');
expect(metadata.capabilities).toContain('optimization');
});
it('hookPatternLibraryPlugin should have correct metadata', async () => {
const { hookPatternLibraryPlugin } = await import('./index.js');
const metadata = hookPatternLibraryPlugin.metadata;
expect(metadata.id).toBe('ruvector-hook-pattern-library');
expect(metadata.name).toBe('RuVector Hook Pattern Library');
expect(metadata.capabilities).toContain('hooks');
expect(metadata.capabilities).toContain('patterns');
});
});
// MCP Tool definitions tests
describe('MCP Tool Definitions', () => {
it('reasoningBankPlugin should define expected tools', async () => {
const { reasoningBankPlugin } = await import('./index.js');
const tools = reasoningBankPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('reasoning-store');
expect(toolNames).toContain('reasoning-retrieve');
expect(toolNames).toContain('reasoning-judge');
expect(toolNames).toContain('reasoning-distill');
expect(toolNames).toContain('reasoning-stats');
});
it('semanticCodeSearchPlugin should define expected tools', async () => {
const { semanticCodeSearchPlugin } = await import('./index.js');
const tools = semanticCodeSearchPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('code-index');
expect(toolNames).toContain('code-search');
expect(toolNames).toContain('code-similar');
expect(toolNames).toContain('code-stats');
});
it('sonaLearningPlugin should define expected tools', async () => {
const { sonaLearningPlugin } = await import('./index.js');
const tools = sonaLearningPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('sona-learn');
expect(toolNames).toContain('sona-retrieve');
expect(toolNames).toContain('sona-feedback');
expect(toolNames).toContain('sona-stats');
});
it('intentRouterPlugin should define expected tools', async () => {
const { intentRouterPlugin } = await import('./index.js');
const tools = intentRouterPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('intent-route');
expect(toolNames).toContain('intent-register');
expect(toolNames).toContain('intent-stats');
});
it('mcpToolOptimizerPlugin should define expected tools', async () => {
const { mcpToolOptimizerPlugin } = await import('./index.js');
const tools = mcpToolOptimizerPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('tool-optimize');
expect(toolNames).toContain('tool-suggest-next');
expect(toolNames).toContain('tool-stats');
});
it('hookPatternLibraryPlugin should define expected tools', async () => {
const { hookPatternLibraryPlugin } = await import('./index.js');
const tools = hookPatternLibraryPlugin.tools || [];
const toolNames = tools.map((t) => t.name);
expect(toolNames).toContain('hook-recommend');
expect(toolNames).toContain('hook-record');
expect(toolNames).toContain('hook-stats');
});
});
// Hook definitions tests
describe('Hook Definitions', () => {
it('reasoningBankPlugin should define learning hooks', async () => {
const { reasoningBankPlugin } = await import('./index.js');
const hooks = reasoningBankPlugin.hooks || [];
expect(hooks.length).toBeGreaterThan(0);
const hookEvents = hooks.map((h) => h.event);
expect(hookEvents).toContain('PostTaskComplete');
});
it('intentRouterPlugin should define routing hooks', async () => {
const { intentRouterPlugin } = await import('./index.js');
const hooks = intentRouterPlugin.hooks || [];
expect(hooks.length).toBeGreaterThan(0);
const hookEvents = hooks.map((h) => h.event);
expect(hookEvents).toContain('PreTaskExecute');
});
it('mcpToolOptimizerPlugin should define optimization hooks', async () => {
const { mcpToolOptimizerPlugin } = await import('./index.js');
const hooks = mcpToolOptimizerPlugin.hooks || [];
expect(hooks.length).toBeGreaterThan(0);
const hookEvents = hooks.map((h) => h.event);
expect(hookEvents).toContain('PostToolCall');
expect(hookEvents).toContain('PostTaskComplete');
});
it('hookPatternLibraryPlugin should define file operation hooks', async () => {
const { hookPatternLibraryPlugin } = await import('./index.js');
const hooks = hookPatternLibraryPlugin.hooks || [];
expect(hooks.length).toBeGreaterThan(0);
const hookEvents = hooks.map((h) => h.event);
expect(hookEvents).toContain('PreFileWrite');
expect(hookEvents).toContain('PostFileWrite');
expect(hookEvents).toContain('PreCommand');
});
});