mcp-adr-analysis-server 2.0.9 → 2.0.10
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/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +434 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +71 -1
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/tools/human-override-tool.d.ts +42 -0
- package/dist/src/tools/human-override-tool.d.ts.map +1 -0
- package/dist/src/tools/human-override-tool.js +431 -0
- package/dist/src/tools/human-override-tool.js.map +1 -0
- package/dist/src/tools/smart-git-push-tool.d.ts +5 -1
- package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool.js +70 -25
- package/dist/src/tools/smart-git-push-tool.js.map +1 -1
- package/dist/src/tools/smart-score-tool.d.ts +138 -0
- package/dist/src/tools/smart-score-tool.d.ts.map +1 -0
- package/dist/src/tools/smart-score-tool.js +602 -0
- package/dist/src/tools/smart-score-tool.js.map +1 -0
- package/dist/src/tools/todo-management-tool.d.ts +184 -6
- package/dist/src/tools/todo-management-tool.d.ts.map +1 -1
- package/dist/src/tools/todo-management-tool.js +819 -42
- package/dist/src/tools/todo-management-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +164 -0
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -0
- package/dist/src/tools/tool-chain-orchestrator.js +738 -0
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +150 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +520 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts +481 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -0
- package/dist/src/types/knowledge-graph-schemas.js +59 -0
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -0
- package/dist/src/utils/json-safe.d.ts +38 -0
- package/dist/src/utils/json-safe.d.ts.map +1 -0
- package/dist/src/utils/json-safe.js +86 -0
- package/dist/src/utils/json-safe.js.map +1 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts +28 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -0
- package/dist/src/utils/knowledge-graph-manager.js +192 -0
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -0
- package/dist/src/utils/mcp-response-validator.d.ts +30 -0
- package/dist/src/utils/mcp-response-validator.d.ts.map +1 -0
- package/dist/src/utils/mcp-response-validator.js +197 -0
- package/dist/src/utils/mcp-response-validator.js.map +1 -0
- package/dist/src/utils/project-health-scoring.d.ts +177 -0
- package/dist/src/utils/project-health-scoring.d.ts.map +1 -0
- package/dist/src/utils/project-health-scoring.js +370 -0
- package/dist/src/utils/project-health-scoring.js.map +1 -0
- package/dist/src/utils/release-readiness-detector.d.ts +2 -0
- package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
- package/dist/src/utils/release-readiness-detector.js +2 -0
- package/dist/src/utils/release-readiness-detector.js.map +1 -1
- package/dist/src/utils/todo-file-watcher.d.ts +26 -0
- package/dist/src/utils/todo-file-watcher.d.ts.map +1 -0
- package/dist/src/utils/todo-file-watcher.js +163 -0
- package/dist/src/utils/todo-file-watcher.js.map +1 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class McpAdrAnalysisServer {
|
|
|
14
14
|
private maskingConfig;
|
|
15
15
|
private config;
|
|
16
16
|
private logger;
|
|
17
|
+
private kgManager;
|
|
17
18
|
constructor();
|
|
18
19
|
/**
|
|
19
20
|
* Validate configuration and project setup
|
|
@@ -113,6 +114,10 @@ export declare class McpAdrAnalysisServer {
|
|
|
113
114
|
/**
|
|
114
115
|
* Apply content masking to MCP response
|
|
115
116
|
*/
|
|
117
|
+
/**
|
|
118
|
+
* Track tool execution in knowledge graph
|
|
119
|
+
*/
|
|
120
|
+
private trackToolExecution;
|
|
116
121
|
private applyOutputMasking;
|
|
117
122
|
/**
|
|
118
123
|
* Read MCP resource with prompt-driven caching
|
|
@@ -131,5 +136,8 @@ export declare class McpAdrAnalysisServer {
|
|
|
131
136
|
private manageTodo;
|
|
132
137
|
private generateDeploymentGuidance;
|
|
133
138
|
private smartGitPush;
|
|
139
|
+
private troubleshootGuidedWorkflow;
|
|
140
|
+
private smartScore;
|
|
141
|
+
private humanOverride;
|
|
134
142
|
}
|
|
135
143
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AA2EH;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,SAAS,CAAwB;;IAyBzC;;OAEG;YACW,qBAAqB;IAUnC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAKlC;;OAEG;IACH,OAAO,CAAC,aAAa;IA0zDrB;;OAEG;YACW,sBAAsB;YAgGtB,mBAAmB;YAqMnB,sBAAsB;YAmQtB,uBAAuB;YAsUvB,uBAAuB;YA0PvB,mBAAmB;YA6RnB,eAAe;YAoZf,kBAAkB;IAyFhC;;OAEG;YACW,+BAA+B;IA0K7C;;OAEG;IACH,OAAO,CAAC,cAAc;IAgCtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAkDtB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAyClC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAmFvC;;OAEG;YACW,sBAAsB;YAKtB,sBAAsB;YAKtB,uBAAuB;YAKvB,wBAAwB;YAKxB,sBAAsB;YAKtB,WAAW;YAkJX,sBAAsB;IAuHpC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAyDnC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyF3B;;OAEG;YACW,WAAW;YAKX,uBAAuB;YAKvB,oBAAoB;IAKlC;;OAEG;YACW,mBAAmB;YAKnB,sBAAsB;YAKtB,yBAAyB;IAKvC;;OAEG;YACW,aAAa;YAKb,aAAa;YAKb,aAAa;IAK3B;;OAEG;YACW,kBAAkB;IAKhC;;OAEG;YACW,yBAAyB;IAKvC;;OAEG;YACW,yBAAyB;IAKvC;;OAEG;IACH;;OAEG;YACW,kBAAkB;YAkFlB,kBAAkB;IAWhC;;OAEG;YACW,YAAY;IAmF1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAc5B;;OAEG;YACW,QAAQ;YAiCR,SAAS;YAqCT,aAAa;YAsCb,UAAU;YAYV,0BAA0B;YAY1B,YAAY;YAYZ,0BAA0B;YAY1B,UAAU;YAYV,aAAa;CAW5B"}
|
package/dist/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { McpAdrError } from './types/index.js';
|
|
|
16
16
|
import { CONVERSATION_CONTEXT_SCHEMA } from './types/conversation-context.js';
|
|
17
17
|
import { maskMcpResponse, createMaskingConfig } from './utils/output-masking.js';
|
|
18
18
|
import { loadConfig, validateProjectPath, createLogger, printConfigSummary } from './utils/config.js';
|
|
19
|
+
import { KnowledgeGraphManager } from './utils/knowledge-graph-manager.js';
|
|
19
20
|
/**
|
|
20
21
|
* Get version from package.json
|
|
21
22
|
*/
|
|
@@ -74,10 +75,12 @@ export class McpAdrAnalysisServer {
|
|
|
74
75
|
maskingConfig;
|
|
75
76
|
config;
|
|
76
77
|
logger;
|
|
78
|
+
kgManager;
|
|
77
79
|
constructor() {
|
|
78
80
|
// Load and validate configuration
|
|
79
81
|
this.config = loadConfig();
|
|
80
82
|
this.logger = createLogger(this.config);
|
|
83
|
+
this.kgManager = new KnowledgeGraphManager();
|
|
81
84
|
// Print configuration summary
|
|
82
85
|
printConfigSummary(this.config);
|
|
83
86
|
// Note: Validation will be done during startup
|
|
@@ -275,6 +278,16 @@ export class McpAdrAnalysisServer {
|
|
|
275
278
|
enum: ['adrs', 'patterns', 'both'],
|
|
276
279
|
description: 'Source for architectural rules (only used if includeRules is true)',
|
|
277
280
|
default: 'both'
|
|
281
|
+
},
|
|
282
|
+
todoPath: {
|
|
283
|
+
type: 'string',
|
|
284
|
+
description: 'Path to TODO.md file (relative to project root)',
|
|
285
|
+
default: 'TODO.md'
|
|
286
|
+
},
|
|
287
|
+
preserveExisting: {
|
|
288
|
+
type: 'boolean',
|
|
289
|
+
description: 'Preserve existing TODO.md content by merging instead of overwriting',
|
|
290
|
+
default: true
|
|
278
291
|
}
|
|
279
292
|
}
|
|
280
293
|
}
|
|
@@ -1029,7 +1042,8 @@ export class McpAdrAnalysisServer {
|
|
|
1029
1042
|
},
|
|
1030
1043
|
todoPath: {
|
|
1031
1044
|
type: 'string',
|
|
1032
|
-
description: 'Path to
|
|
1045
|
+
description: 'Path to TODO.md file for task identification',
|
|
1046
|
+
default: 'TODO.md'
|
|
1033
1047
|
},
|
|
1034
1048
|
cicdLogs: {
|
|
1035
1049
|
type: 'string',
|
|
@@ -1241,12 +1255,12 @@ export class McpAdrAnalysisServer {
|
|
|
1241
1255
|
properties: {
|
|
1242
1256
|
operation: {
|
|
1243
1257
|
type: 'string',
|
|
1244
|
-
enum: ['update_status', 'add_tasks', 'merge_adr_updates', 'sync_progress', 'analyze_progress'],
|
|
1258
|
+
enum: ['update_status', 'add_tasks', 'merge_adr_updates', 'sync_progress', 'analyze_progress', 'delete_task', 'edit_task', 'move_task', 'manage_section', 'search_tasks'],
|
|
1245
1259
|
description: 'Operation to perform on TODO.md'
|
|
1246
1260
|
},
|
|
1247
1261
|
todoPath: {
|
|
1248
1262
|
type: 'string',
|
|
1249
|
-
default: '
|
|
1263
|
+
default: 'TODO.md',
|
|
1250
1264
|
description: 'Path to TODO.md file'
|
|
1251
1265
|
},
|
|
1252
1266
|
updates: {
|
|
@@ -1445,6 +1459,266 @@ export class McpAdrAnalysisServer {
|
|
|
1445
1459
|
}
|
|
1446
1460
|
}
|
|
1447
1461
|
}
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
name: 'troubleshoot_guided_workflow',
|
|
1465
|
+
description: 'Structured failure analysis and test plan generation - provide JSON failure info to get specific test commands',
|
|
1466
|
+
inputSchema: {
|
|
1467
|
+
type: 'object',
|
|
1468
|
+
properties: {
|
|
1469
|
+
operation: {
|
|
1470
|
+
type: 'string',
|
|
1471
|
+
enum: ['analyze_failure', 'generate_test_plan', 'full_workflow'],
|
|
1472
|
+
description: 'Type of troubleshooting operation'
|
|
1473
|
+
},
|
|
1474
|
+
failure: {
|
|
1475
|
+
type: 'object',
|
|
1476
|
+
properties: {
|
|
1477
|
+
failureType: {
|
|
1478
|
+
type: 'string',
|
|
1479
|
+
enum: ['test_failure', 'deployment_failure', 'build_failure', 'runtime_error', 'performance_issue', 'security_issue', 'other'],
|
|
1480
|
+
description: 'Type of failure'
|
|
1481
|
+
},
|
|
1482
|
+
failureDetails: {
|
|
1483
|
+
type: 'object',
|
|
1484
|
+
properties: {
|
|
1485
|
+
command: {
|
|
1486
|
+
type: 'string',
|
|
1487
|
+
description: 'Command that failed (optional)'
|
|
1488
|
+
},
|
|
1489
|
+
exitCode: {
|
|
1490
|
+
type: 'number',
|
|
1491
|
+
description: 'Exit code of failed process (optional)'
|
|
1492
|
+
},
|
|
1493
|
+
errorMessage: {
|
|
1494
|
+
type: 'string',
|
|
1495
|
+
description: 'Primary error message'
|
|
1496
|
+
},
|
|
1497
|
+
stackTrace: {
|
|
1498
|
+
type: 'string',
|
|
1499
|
+
description: 'Stack trace if available (optional)'
|
|
1500
|
+
},
|
|
1501
|
+
logOutput: {
|
|
1502
|
+
type: 'string',
|
|
1503
|
+
description: 'Relevant log output (optional)'
|
|
1504
|
+
},
|
|
1505
|
+
environment: {
|
|
1506
|
+
type: 'string',
|
|
1507
|
+
description: 'Environment where failure occurred (optional)'
|
|
1508
|
+
},
|
|
1509
|
+
timestamp: {
|
|
1510
|
+
type: 'string',
|
|
1511
|
+
description: 'When the failure occurred (optional)'
|
|
1512
|
+
},
|
|
1513
|
+
affectedFiles: {
|
|
1514
|
+
type: 'array',
|
|
1515
|
+
items: { type: 'string' },
|
|
1516
|
+
description: 'Files involved in the failure (optional)'
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
required: ['errorMessage'],
|
|
1520
|
+
description: 'Detailed failure information'
|
|
1521
|
+
},
|
|
1522
|
+
context: {
|
|
1523
|
+
type: 'object',
|
|
1524
|
+
properties: {
|
|
1525
|
+
recentChanges: {
|
|
1526
|
+
type: 'string',
|
|
1527
|
+
description: 'Recent changes that might be related (optional)'
|
|
1528
|
+
},
|
|
1529
|
+
reproducible: {
|
|
1530
|
+
type: 'boolean',
|
|
1531
|
+
description: 'Whether the failure is reproducible (optional)'
|
|
1532
|
+
},
|
|
1533
|
+
frequency: {
|
|
1534
|
+
type: 'string',
|
|
1535
|
+
description: 'How often this failure occurs (optional)'
|
|
1536
|
+
},
|
|
1537
|
+
impact: {
|
|
1538
|
+
type: 'string',
|
|
1539
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
1540
|
+
description: 'Impact level of the failure (optional)'
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
description: 'Additional context about the failure (optional)'
|
|
1544
|
+
}
|
|
1545
|
+
},
|
|
1546
|
+
required: ['failureType', 'failureDetails'],
|
|
1547
|
+
description: 'Structured failure information (required for analyze_failure and generate_test_plan)'
|
|
1548
|
+
},
|
|
1549
|
+
projectPath: {
|
|
1550
|
+
type: 'string',
|
|
1551
|
+
description: 'Path to project directory (optional)'
|
|
1552
|
+
},
|
|
1553
|
+
adrDirectory: {
|
|
1554
|
+
type: 'string',
|
|
1555
|
+
description: 'ADR directory path',
|
|
1556
|
+
default: 'docs/adrs'
|
|
1557
|
+
},
|
|
1558
|
+
todoPath: {
|
|
1559
|
+
type: 'string',
|
|
1560
|
+
description: 'Path to TODO.md file',
|
|
1561
|
+
default: 'TODO.md'
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
required: ['operation']
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
name: 'smart_score',
|
|
1569
|
+
description: 'Central coordination for project health scoring system - recalculate, sync, diagnose, optimize, and reset scores across all MCP tools',
|
|
1570
|
+
inputSchema: {
|
|
1571
|
+
type: 'object',
|
|
1572
|
+
properties: {
|
|
1573
|
+
operation: {
|
|
1574
|
+
type: 'string',
|
|
1575
|
+
enum: ['recalculate_scores', 'sync_scores', 'diagnose_scores', 'optimize_weights', 'reset_scores'],
|
|
1576
|
+
description: 'Smart scoring operation to perform'
|
|
1577
|
+
},
|
|
1578
|
+
projectPath: {
|
|
1579
|
+
type: 'string',
|
|
1580
|
+
description: 'Path to project directory'
|
|
1581
|
+
},
|
|
1582
|
+
components: {
|
|
1583
|
+
type: 'array',
|
|
1584
|
+
items: {
|
|
1585
|
+
type: 'string',
|
|
1586
|
+
enum: ['task_completion', 'deployment_readiness', 'architecture_compliance', 'security_posture', 'code_quality', 'all']
|
|
1587
|
+
},
|
|
1588
|
+
default: ['all'],
|
|
1589
|
+
description: 'Score components to recalculate (for recalculate_scores operation)'
|
|
1590
|
+
},
|
|
1591
|
+
forceUpdate: {
|
|
1592
|
+
type: 'boolean',
|
|
1593
|
+
default: false,
|
|
1594
|
+
description: 'Force update even if data is fresh'
|
|
1595
|
+
},
|
|
1596
|
+
updateSources: {
|
|
1597
|
+
type: 'boolean',
|
|
1598
|
+
default: true,
|
|
1599
|
+
description: 'Trigger source tool updates before recalculating'
|
|
1600
|
+
},
|
|
1601
|
+
todoPath: {
|
|
1602
|
+
type: 'string',
|
|
1603
|
+
default: 'TODO.md',
|
|
1604
|
+
description: 'Path to TODO.md file (for sync_scores operation)'
|
|
1605
|
+
},
|
|
1606
|
+
triggerTools: {
|
|
1607
|
+
type: 'array',
|
|
1608
|
+
items: {
|
|
1609
|
+
type: 'string',
|
|
1610
|
+
enum: ['manage_todo', 'smart_git_push', 'compare_adr_progress', 'analyze_content_security', 'validate_rules']
|
|
1611
|
+
},
|
|
1612
|
+
description: 'Tools to trigger for fresh data (for sync_scores operation)'
|
|
1613
|
+
},
|
|
1614
|
+
rebalanceWeights: {
|
|
1615
|
+
type: 'boolean',
|
|
1616
|
+
default: false,
|
|
1617
|
+
description: 'Recalculate optimal scoring weights (for sync_scores operation)'
|
|
1618
|
+
},
|
|
1619
|
+
includeHistory: {
|
|
1620
|
+
type: 'boolean',
|
|
1621
|
+
default: true,
|
|
1622
|
+
description: 'Include score history analysis (for diagnose_scores operation)'
|
|
1623
|
+
},
|
|
1624
|
+
checkDataFreshness: {
|
|
1625
|
+
type: 'boolean',
|
|
1626
|
+
default: true,
|
|
1627
|
+
description: 'Validate data freshness across tools (for diagnose_scores operation)'
|
|
1628
|
+
},
|
|
1629
|
+
suggestImprovements: {
|
|
1630
|
+
type: 'boolean',
|
|
1631
|
+
default: true,
|
|
1632
|
+
description: 'Provide score improvement suggestions (for diagnose_scores operation)'
|
|
1633
|
+
},
|
|
1634
|
+
analysisMode: {
|
|
1635
|
+
type: 'string',
|
|
1636
|
+
enum: ['current_state', 'historical_data', 'project_type'],
|
|
1637
|
+
default: 'current_state',
|
|
1638
|
+
description: 'Method for weight optimization (for optimize_weights operation)'
|
|
1639
|
+
},
|
|
1640
|
+
customWeights: {
|
|
1641
|
+
type: 'object',
|
|
1642
|
+
properties: {
|
|
1643
|
+
taskCompletion: { type: 'number', minimum: 0, maximum: 1 },
|
|
1644
|
+
deploymentReadiness: { type: 'number', minimum: 0, maximum: 1 },
|
|
1645
|
+
architectureCompliance: { type: 'number', minimum: 0, maximum: 1 },
|
|
1646
|
+
securityPosture: { type: 'number', minimum: 0, maximum: 1 },
|
|
1647
|
+
codeQuality: { type: 'number', minimum: 0, maximum: 1 }
|
|
1648
|
+
},
|
|
1649
|
+
description: 'Custom weight overrides (for optimize_weights operation)'
|
|
1650
|
+
},
|
|
1651
|
+
previewOnly: {
|
|
1652
|
+
type: 'boolean',
|
|
1653
|
+
default: false,
|
|
1654
|
+
description: 'Preview changes without applying (for optimize_weights operation)'
|
|
1655
|
+
},
|
|
1656
|
+
component: {
|
|
1657
|
+
type: 'string',
|
|
1658
|
+
enum: ['task_completion', 'deployment_readiness', 'architecture_compliance', 'security_posture', 'code_quality', 'all'],
|
|
1659
|
+
default: 'all',
|
|
1660
|
+
description: 'Score component to reset (for reset_scores operation)'
|
|
1661
|
+
},
|
|
1662
|
+
preserveHistory: {
|
|
1663
|
+
type: 'boolean',
|
|
1664
|
+
default: true,
|
|
1665
|
+
description: 'Preserve score history in backup (for reset_scores operation)'
|
|
1666
|
+
},
|
|
1667
|
+
recalculateAfterReset: {
|
|
1668
|
+
type: 'boolean',
|
|
1669
|
+
default: true,
|
|
1670
|
+
description: 'Immediately recalculate after reset (for reset_scores operation)'
|
|
1671
|
+
}
|
|
1672
|
+
},
|
|
1673
|
+
required: ['operation', 'projectPath']
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: 'human_override',
|
|
1678
|
+
description: 'Human override to force AI-powered tool planning when LLMs get confused or stuck - cuts through confusion with direct task execution',
|
|
1679
|
+
inputSchema: {
|
|
1680
|
+
type: 'object',
|
|
1681
|
+
properties: {
|
|
1682
|
+
taskDescription: {
|
|
1683
|
+
type: 'string',
|
|
1684
|
+
description: 'What the human wants accomplished (in plain English)'
|
|
1685
|
+
},
|
|
1686
|
+
projectPath: {
|
|
1687
|
+
type: 'string',
|
|
1688
|
+
description: 'Path to project directory'
|
|
1689
|
+
},
|
|
1690
|
+
adrDirectory: {
|
|
1691
|
+
type: 'string',
|
|
1692
|
+
default: 'docs/adrs',
|
|
1693
|
+
description: 'ADR directory path'
|
|
1694
|
+
},
|
|
1695
|
+
todoPath: {
|
|
1696
|
+
type: 'string',
|
|
1697
|
+
default: 'TODO.md',
|
|
1698
|
+
description: 'Path to TODO.md file'
|
|
1699
|
+
},
|
|
1700
|
+
priority: {
|
|
1701
|
+
type: 'string',
|
|
1702
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
1703
|
+
default: 'high',
|
|
1704
|
+
description: 'Task priority level'
|
|
1705
|
+
},
|
|
1706
|
+
forceExecution: {
|
|
1707
|
+
type: 'boolean',
|
|
1708
|
+
default: true,
|
|
1709
|
+
description: 'Force immediate execution planning'
|
|
1710
|
+
},
|
|
1711
|
+
deadline: {
|
|
1712
|
+
type: 'string',
|
|
1713
|
+
description: 'When this must be completed (optional)'
|
|
1714
|
+
},
|
|
1715
|
+
additionalContext: {
|
|
1716
|
+
type: 'string',
|
|
1717
|
+
description: 'Any additional context or constraints (optional)'
|
|
1718
|
+
}
|
|
1719
|
+
},
|
|
1720
|
+
required: ['taskDescription', 'projectPath']
|
|
1721
|
+
}
|
|
1448
1722
|
}
|
|
1449
1723
|
]
|
|
1450
1724
|
};
|
|
@@ -1554,13 +1828,26 @@ export class McpAdrAnalysisServer {
|
|
|
1554
1828
|
case 'smart_git_push':
|
|
1555
1829
|
response = await this.smartGitPush(args);
|
|
1556
1830
|
break;
|
|
1831
|
+
case 'troubleshoot_guided_workflow':
|
|
1832
|
+
response = await this.troubleshootGuidedWorkflow(args);
|
|
1833
|
+
break;
|
|
1834
|
+
case 'smart_score':
|
|
1835
|
+
response = await this.smartScore(args);
|
|
1836
|
+
break;
|
|
1837
|
+
case 'human_override':
|
|
1838
|
+
response = await this.humanOverride(args);
|
|
1839
|
+
break;
|
|
1557
1840
|
default:
|
|
1558
1841
|
throw new McpAdrError(`Unknown tool: ${name}`, 'UNKNOWN_TOOL');
|
|
1559
1842
|
}
|
|
1560
1843
|
// Apply content masking to response
|
|
1844
|
+
// Track tool execution in knowledge graph
|
|
1845
|
+
await this.trackToolExecution(name, args, response, true);
|
|
1561
1846
|
return await this.applyOutputMasking(response);
|
|
1562
1847
|
}
|
|
1563
1848
|
catch (error) {
|
|
1849
|
+
// Track failed execution
|
|
1850
|
+
await this.trackToolExecution(name, args, {}, false, error instanceof Error ? error.message : String(error));
|
|
1564
1851
|
if (error instanceof McpAdrError) {
|
|
1565
1852
|
throw error;
|
|
1566
1853
|
}
|
|
@@ -2960,17 +3247,72 @@ The enhanced process maintains full traceability from PRD requirements to genera
|
|
|
2960
3247
|
}
|
|
2961
3248
|
}
|
|
2962
3249
|
async generateAdrTodo(args) {
|
|
2963
|
-
const { scope = 'all', phase = 'both', linkAdrs = true, includeRules = true, ruleSource = 'both' } = args;
|
|
3250
|
+
const { scope = 'all', phase = 'both', linkAdrs = true, includeRules = true, ruleSource = 'both', todoPath = 'todo.md', preserveExisting = true } = args;
|
|
2964
3251
|
const { getAdrDirectoryPath } = await import('./utils/config.js');
|
|
2965
3252
|
const path = await import('path');
|
|
3253
|
+
const fs = await import('fs/promises');
|
|
2966
3254
|
// Use absolute ADR path relative to project
|
|
2967
3255
|
const absoluteAdrPath = args.adrDirectory ?
|
|
2968
3256
|
path.resolve(this.config.projectPath, args.adrDirectory) :
|
|
2969
3257
|
getAdrDirectoryPath(this.config);
|
|
2970
3258
|
// Keep relative path for display purposes
|
|
2971
3259
|
const adrDirectory = args.adrDirectory || this.config.adrDirectory;
|
|
3260
|
+
// Resolve absolute TODO path
|
|
3261
|
+
const absoluteTodoPath = path.resolve(this.config.projectPath, todoPath);
|
|
2972
3262
|
this.logger.info(`Generating TDD-focused todo for ADRs in: ${absoluteAdrPath} (phase: ${phase})`);
|
|
2973
3263
|
try {
|
|
3264
|
+
// Check if TODO.md already exists
|
|
3265
|
+
let existingTodoExists = false;
|
|
3266
|
+
try {
|
|
3267
|
+
await fs.access(absoluteTodoPath);
|
|
3268
|
+
existingTodoExists = true;
|
|
3269
|
+
this.logger.info(`Existing TODO.md found at: ${absoluteTodoPath}`);
|
|
3270
|
+
}
|
|
3271
|
+
catch (error) {
|
|
3272
|
+
if (error.code !== 'ENOENT') {
|
|
3273
|
+
this.logger.error(`Error accessing existing TODO.md: ${error.message}`);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
// If preserving existing content and file exists, use manageTodo merge instead
|
|
3277
|
+
if (preserveExisting && existingTodoExists) {
|
|
3278
|
+
this.logger.info('Preserving existing TODO.md content, using merge approach');
|
|
3279
|
+
// Use manageTodo to merge ADR updates with existing content
|
|
3280
|
+
const { manageTodo } = await import('./tools/todo-management-tool.js');
|
|
3281
|
+
const mergeResult = await manageTodo({
|
|
3282
|
+
operation: 'merge_adr_updates',
|
|
3283
|
+
todoPath: absoluteTodoPath,
|
|
3284
|
+
adrDirectory: absoluteAdrPath,
|
|
3285
|
+
preserveCompleted: true,
|
|
3286
|
+
preserveCustom: true
|
|
3287
|
+
}, this.config.projectPath);
|
|
3288
|
+
return {
|
|
3289
|
+
content: [{
|
|
3290
|
+
type: 'text',
|
|
3291
|
+
text: `# TODO.md Merge Completed
|
|
3292
|
+
|
|
3293
|
+
## Existing File Preserved
|
|
3294
|
+
- **Location**: ${absoluteTodoPath}
|
|
3295
|
+
- **Action**: Merged ADR updates with existing content
|
|
3296
|
+
- **Preservation**: Custom tasks and completed items preserved
|
|
3297
|
+
|
|
3298
|
+
## Analysis Information
|
|
3299
|
+
- **ADR Directory**: ${adrDirectory}
|
|
3300
|
+
- **Scope**: ${scope}
|
|
3301
|
+
- **TDD Phase**: ${phase}
|
|
3302
|
+
- **ADR Linking**: ${linkAdrs ? 'Enabled' : 'Disabled'}
|
|
3303
|
+
- **Rules Integration**: ${includeRules ? `Enabled (${ruleSource})` : 'Disabled'}
|
|
3304
|
+
|
|
3305
|
+
${mergeResult.content[0].text}
|
|
3306
|
+
|
|
3307
|
+
## Next Steps
|
|
3308
|
+
1. Review merged TODO.md content
|
|
3309
|
+
2. Update task statuses as needed using \`manage_todo\`
|
|
3310
|
+
3. Use \`compare_adr_progress\` to validate implementation status
|
|
3311
|
+
|
|
3312
|
+
*To force regeneration, set \`preserveExisting: false\` in the request*`
|
|
3313
|
+
}]
|
|
3314
|
+
};
|
|
3315
|
+
}
|
|
2974
3316
|
const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
|
|
2975
3317
|
const { scanProjectStructure } = await import('./utils/actual-file-operations.js');
|
|
2976
3318
|
// Use actual ADR discovery
|
|
@@ -4146,6 +4488,66 @@ Please provide:
|
|
|
4146
4488
|
/**
|
|
4147
4489
|
* Apply content masking to MCP response
|
|
4148
4490
|
*/
|
|
4491
|
+
/**
|
|
4492
|
+
* Track tool execution in knowledge graph
|
|
4493
|
+
*/
|
|
4494
|
+
async trackToolExecution(toolName, parameters, result, success, error) {
|
|
4495
|
+
try {
|
|
4496
|
+
// Extract intentId from metadata if available
|
|
4497
|
+
let intentId;
|
|
4498
|
+
if (result?.metadata?.intentId) {
|
|
4499
|
+
intentId = result.metadata.intentId;
|
|
4500
|
+
}
|
|
4501
|
+
else {
|
|
4502
|
+
// Check for active intents that might be related to this tool execution
|
|
4503
|
+
const activeIntents = await this.kgManager.getActiveIntents();
|
|
4504
|
+
if (activeIntents.length > 0) {
|
|
4505
|
+
// Use the most recent active intent
|
|
4506
|
+
const latestIntent = activeIntents[activeIntents.length - 1];
|
|
4507
|
+
if (latestIntent) {
|
|
4508
|
+
intentId = latestIntent.intentId;
|
|
4509
|
+
}
|
|
4510
|
+
}
|
|
4511
|
+
}
|
|
4512
|
+
// If no intent found, create a standalone execution record
|
|
4513
|
+
if (!intentId) {
|
|
4514
|
+
intentId = await this.kgManager.createIntent(`Standalone tool execution: ${toolName}`, [`Execute ${toolName}`, 'Complete tool operation'], 'medium');
|
|
4515
|
+
}
|
|
4516
|
+
// Determine tasks created/modified from tool operation
|
|
4517
|
+
const todoTasksCreated = [];
|
|
4518
|
+
const todoTasksModified = [];
|
|
4519
|
+
// Extract task information from result metadata
|
|
4520
|
+
if (result?.metadata) {
|
|
4521
|
+
if (result.metadata.tasksCreated) {
|
|
4522
|
+
todoTasksCreated.push(...result.metadata.tasksCreated);
|
|
4523
|
+
}
|
|
4524
|
+
if (result.metadata.tasksModified) {
|
|
4525
|
+
todoTasksModified.push(...result.metadata.tasksModified);
|
|
4526
|
+
}
|
|
4527
|
+
if (result.metadata.taskIds) {
|
|
4528
|
+
todoTasksModified.push(...result.metadata.taskIds);
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
// Store execution in knowledge graph
|
|
4532
|
+
await this.kgManager.addToolExecution(intentId, toolName, parameters, result, success, todoTasksCreated, todoTasksModified, error);
|
|
4533
|
+
// If execution completed successfully, update intent status
|
|
4534
|
+
if (success && !error) {
|
|
4535
|
+
// Check if this might be the final tool in a chain
|
|
4536
|
+
const intent = await this.kgManager.getIntentById(intentId);
|
|
4537
|
+
if (intent && intent.currentStatus === 'executing') {
|
|
4538
|
+
// Simple heuristic: if tool is a "completion" type tool, mark intent as completed
|
|
4539
|
+
const completionTools = ['smart_git_push', 'generate_deployment_guidance', 'smart_score'];
|
|
4540
|
+
if (completionTools.includes(toolName)) {
|
|
4541
|
+
await this.kgManager.updateIntentStatus(intentId, 'completed');
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
catch (trackingError) {
|
|
4547
|
+
// Don't let tracking errors break tool execution
|
|
4548
|
+
console.error('[WARN] Knowledge graph tracking failed:', trackingError);
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4149
4551
|
async applyOutputMasking(response) {
|
|
4150
4552
|
try {
|
|
4151
4553
|
return await maskMcpResponse(response, this.maskingConfig);
|
|
@@ -4332,7 +4734,7 @@ Please provide:
|
|
|
4332
4734
|
async manageTodo(args) {
|
|
4333
4735
|
try {
|
|
4334
4736
|
const { manageTodo } = await import('./tools/todo-management-tool.js');
|
|
4335
|
-
return await manageTodo(args);
|
|
4737
|
+
return await manageTodo(args, this.config.projectPath);
|
|
4336
4738
|
}
|
|
4337
4739
|
catch (error) {
|
|
4338
4740
|
throw new McpAdrError(`TODO management failed: ${error instanceof Error ? error.message : String(error)}`, 'TODO_MANAGEMENT_ERROR');
|
|
@@ -4356,6 +4758,33 @@ Please provide:
|
|
|
4356
4758
|
throw new McpAdrError(`Smart git push failed: ${error instanceof Error ? error.message : String(error)}`, 'SMART_GIT_PUSH_ERROR');
|
|
4357
4759
|
}
|
|
4358
4760
|
}
|
|
4761
|
+
async troubleshootGuidedWorkflow(args) {
|
|
4762
|
+
try {
|
|
4763
|
+
const { troubleshootGuidedWorkflow } = await import('./tools/troubleshoot-guided-workflow-tool.js');
|
|
4764
|
+
return await troubleshootGuidedWorkflow(args);
|
|
4765
|
+
}
|
|
4766
|
+
catch (error) {
|
|
4767
|
+
throw new McpAdrError(`Troubleshoot guided workflow failed: ${error instanceof Error ? error.message : String(error)}`, 'TROUBLESHOOT_GUIDED_WORKFLOW_ERROR');
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
async smartScore(args) {
|
|
4771
|
+
try {
|
|
4772
|
+
const { smartScore } = await import('./tools/smart-score-tool.js');
|
|
4773
|
+
return await smartScore(args);
|
|
4774
|
+
}
|
|
4775
|
+
catch (error) {
|
|
4776
|
+
throw new McpAdrError(`Smart score analysis failed: ${error instanceof Error ? error.message : String(error)}`, 'SMART_SCORE_ERROR');
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
async humanOverride(args) {
|
|
4780
|
+
try {
|
|
4781
|
+
const { humanOverride } = await import('./tools/human-override-tool.js');
|
|
4782
|
+
return await humanOverride(args);
|
|
4783
|
+
}
|
|
4784
|
+
catch (error) {
|
|
4785
|
+
throw new McpAdrError(`Human override failed: ${error instanceof Error ? error.message : String(error)}`, 'HUMAN_OVERRIDE_ERROR');
|
|
4786
|
+
}
|
|
4787
|
+
}
|
|
4359
4788
|
}
|
|
4360
4789
|
/**
|
|
4361
4790
|
* Main execution
|