feat: Add impact analysis for component dependency tracking

- New tables: components, component_dependencies, component_files,
  verification_checks, change_impacts, impact_analysis_runs
- 8 new MCP tools: component_register, component_list,
  component_add_dependency, component_add_file, component_add_check,
  impact_analysis, impact_learn, component_graph
- Seed data: 17 components, 9 dependencies, 12 file patterns, 5 checks
- Historical impacts from session 397 issues recorded

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-11 07:20:00 +02:00
parent 5015b1416f
commit 4fb557c624
6 changed files with 2517 additions and 0 deletions

View File

@@ -435,4 +435,115 @@ export const toolDefinitions = [
properties: {},
},
},
// Impact Analysis Tools
{
name: 'component_register',
description: 'Register a system component for impact analysis tracking',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Unique component ID (e.g., propertymap-scraper, gridbot-conductor)' },
name: { type: 'string', description: 'Human-readable name' },
type: { type: 'string', enum: ['service', 'script', 'config', 'database', 'api', 'ui', 'library'], description: 'Component type' },
path: { type: 'string', description: 'File system path or Docker container name' },
repo: { type: 'string', description: 'Git repository (e.g., christian/propertymap)' },
description: { type: 'string', description: 'What this component does' },
health_check: { type: 'string', description: 'Command or URL to check health' },
},
required: ['id', 'name', 'type'],
},
},
{
name: 'component_list',
description: 'List registered components, optionally filtered by type',
inputSchema: {
type: 'object',
properties: {
type: { type: 'string', enum: ['service', 'script', 'config', 'database', 'api', 'ui', 'library'], description: 'Filter by component type' },
},
},
},
{
name: 'component_add_dependency',
description: 'Add a dependency between two components',
inputSchema: {
type: 'object',
properties: {
component_id: { type: 'string', description: 'Source component ID' },
depends_on: { type: 'string', description: 'Target component ID (what source depends on)' },
dependency_type: { type: 'string', enum: ['hard', 'soft', 'config', 'data'], description: 'Type of dependency' },
description: { type: 'string', description: 'Description of the dependency' },
},
required: ['component_id', 'depends_on', 'dependency_type'],
},
},
{
name: 'component_add_file',
description: 'Map a file pattern to a component (for git diff analysis)',
inputSchema: {
type: 'object',
properties: {
component_id: { type: 'string', description: 'Component ID' },
file_pattern: { type: 'string', description: 'File pattern (e.g., src/services/*.py, docker-compose.yml)' },
},
required: ['component_id', 'file_pattern'],
},
},
{
name: 'component_add_check',
description: 'Add a verification check to a component',
inputSchema: {
type: 'object',
properties: {
component_id: { type: 'string', description: 'Component ID' },
name: { type: 'string', description: 'Check name (e.g., health-endpoint, container-running)' },
check_type: { type: 'string', enum: ['command', 'http', 'tcp', 'file'], description: 'Type of check' },
check_command: { type: 'string', description: 'Command/URL to execute' },
expected_result: { type: 'string', description: 'Expected output or status' },
timeout_seconds: { type: 'number', description: 'Timeout in seconds (default: 30)' },
},
required: ['component_id', 'name', 'check_type', 'check_command'],
},
},
{
name: 'impact_analysis',
description: 'Analyze which components are affected by file changes',
inputSchema: {
type: 'object',
properties: {
changed_files: {
type: 'array',
items: { type: 'string' },
description: 'List of changed file paths',
},
},
required: ['changed_files'],
},
},
{
name: 'impact_learn',
description: 'Record a learned impact relationship (when we discover a missed dependency)',
inputSchema: {
type: 'object',
properties: {
changed_component: { type: 'string', description: 'Component that was changed' },
affected_component: { type: 'string', description: 'Component that was unexpectedly affected' },
impact_description: { type: 'string', description: 'What went wrong' },
error_id: { type: 'string', description: 'Related error ID from error memory' },
task_id: { type: 'string', description: 'Related task ID' },
},
required: ['changed_component', 'affected_component', 'impact_description'],
},
},
{
name: 'component_graph',
description: 'Get component dependency graph (for visualization)',
inputSchema: {
type: 'object',
properties: {
component_id: { type: 'string', description: 'Center component (optional, shows all if omitted)' },
},
},
},
];