mcp-adr-analysis-server 2.0.9 → 2.0.11
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/README.md +1 -1
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +573 -348
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.d.ts.map +1 -1
- package/dist/src/prompts/adr-suggestion-prompts.js +2 -0
- package/dist/src/prompts/adr-suggestion-prompts.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/adr-suggestion-tool.d.ts +16 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +55 -2
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/smart-git-push-tool.d.ts +21 -1
- package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool.js +181 -28
- package/dist/src/tools/smart-git-push-tool.js.map +1 -1
- package/dist/src/tools/smart-score-tool.d.ts +173 -0
- package/dist/src/tools/smart-score-tool.d.ts.map +1 -0
- package/dist/src/tools/smart-score-tool.js +681 -0
- package/dist/src/tools/smart-score-tool.js.map +1 -0
- package/dist/src/tools/todo-management-tool-v2.d.ts +329 -0
- package/dist/src/tools/todo-management-tool-v2.d.ts.map +1 -0
- package/dist/src/tools/todo-management-tool-v2.js +644 -0
- package/dist/src/tools/todo-management-tool-v2.js.map +1 -0
- package/dist/src/tools/tool-chain-orchestrator.d.ts +126 -0
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -0
- package/dist/src/tools/tool-chain-orchestrator.js +550 -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/conversation-context.d.ts +6 -0
- package/dist/src/types/conversation-context.d.ts.map +1 -1
- package/dist/src/types/conversation-context.js +9 -1
- package/dist/src/types/conversation-context.js.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.d.ts +773 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -0
- package/dist/src/types/knowledge-graph-schemas.js +87 -0
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -0
- package/dist/src/types/todo-json-schemas.d.ts +663 -0
- package/dist/src/types/todo-json-schemas.d.ts.map +1 -0
- package/dist/src/types/todo-json-schemas.js +113 -0
- package/dist/src/types/todo-json-schemas.js.map +1 -0
- package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -1
- package/dist/src/utils/chain-of-thought-template.js.map +1 -1
- 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 +65 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -0
- package/dist/src/utils/knowledge-graph-manager.js +358 -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/dist/src/utils/todo-json-manager.d.ts +71 -0
- package/dist/src/utils/todo-json-manager.d.ts.map +1 -0
- package/dist/src/utils/todo-json-manager.js +394 -0
- package/dist/src/utils/todo-json-manager.js.map +1 -0
- package/dist/src/utils/todo-markdown-converter.d.ts +16 -0
- package/dist/src/utils/todo-markdown-converter.d.ts.map +1 -0
- package/dist/src/utils/todo-markdown-converter.js +362 -0
- package/dist/src/utils/todo-markdown-converter.js.map +1 -0
- package/dist/src/utils/todo-migration.d.ts +47 -0
- package/dist/src/utils/todo-migration.d.ts.map +1 -0
- package/dist/src/utils/todo-migration.js +261 -0
- package/dist/src/utils/todo-migration.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/tools/todo-management-tool.d.ts +0 -166
- package/dist/src/tools/todo-management-tool.d.ts.map +0 -1
- package/dist/src/tools/todo-management-tool.js +0 -472
- package/dist/src/tools/todo-management-tool.js.map +0 -1
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
|
|
@@ -195,7 +198,8 @@ export class McpAdrAnalysisServer {
|
|
|
195
198
|
type: 'boolean',
|
|
196
199
|
description: 'Include compliance checks in the analysis',
|
|
197
200
|
default: true
|
|
198
|
-
}
|
|
201
|
+
},
|
|
202
|
+
conversationContext: CONVERSATION_CONTEXT_SCHEMA
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
},
|
|
@@ -233,14 +237,15 @@ export class McpAdrAnalysisServer {
|
|
|
233
237
|
enum: ['web-application', 'mobile-app', 'microservices', 'data-platform', 'api-service', 'general'],
|
|
234
238
|
description: 'Type of PRD for optimized knowledge generation',
|
|
235
239
|
default: 'general'
|
|
236
|
-
}
|
|
240
|
+
},
|
|
241
|
+
conversationContext: CONVERSATION_CONTEXT_SCHEMA
|
|
237
242
|
},
|
|
238
243
|
required: ['prdPath']
|
|
239
244
|
}
|
|
240
245
|
},
|
|
241
246
|
{
|
|
242
247
|
name: 'generate_adr_todo',
|
|
243
|
-
description: 'Generate TDD-focused todo.md from existing ADRs with
|
|
248
|
+
description: 'Generate TDD-focused todo.md from existing ADRs with JSON-first approach: creates structured JSON TODO and syncs to markdown',
|
|
244
249
|
inputSchema: {
|
|
245
250
|
type: 'object',
|
|
246
251
|
properties: {
|
|
@@ -262,7 +267,7 @@ export class McpAdrAnalysisServer {
|
|
|
262
267
|
},
|
|
263
268
|
linkAdrs: {
|
|
264
269
|
type: 'boolean',
|
|
265
|
-
description: '
|
|
270
|
+
description: 'Auto-detect and link ADR dependencies in task creation',
|
|
266
271
|
default: true
|
|
267
272
|
},
|
|
268
273
|
includeRules: {
|
|
@@ -275,7 +280,32 @@ export class McpAdrAnalysisServer {
|
|
|
275
280
|
enum: ['adrs', 'patterns', 'both'],
|
|
276
281
|
description: 'Source for architectural rules (only used if includeRules is true)',
|
|
277
282
|
default: 'both'
|
|
278
|
-
}
|
|
283
|
+
},
|
|
284
|
+
todoPath: {
|
|
285
|
+
type: 'string',
|
|
286
|
+
description: 'Path to TODO.md file (relative to project root)',
|
|
287
|
+
default: 'TODO.md'
|
|
288
|
+
},
|
|
289
|
+
preserveExisting: {
|
|
290
|
+
type: 'boolean',
|
|
291
|
+
description: 'Preserve existing TODO.md content by merging instead of overwriting',
|
|
292
|
+
default: true
|
|
293
|
+
},
|
|
294
|
+
forceSyncToMarkdown: {
|
|
295
|
+
type: 'boolean',
|
|
296
|
+
description: 'Force sync JSON to markdown even if markdown is newer',
|
|
297
|
+
default: false
|
|
298
|
+
},
|
|
299
|
+
intentId: {
|
|
300
|
+
type: 'string',
|
|
301
|
+
description: 'Link generated tasks to specific knowledge graph intent'
|
|
302
|
+
},
|
|
303
|
+
createJsonBackup: {
|
|
304
|
+
type: 'boolean',
|
|
305
|
+
description: 'Create backup of existing JSON TODO data before import',
|
|
306
|
+
default: true
|
|
307
|
+
},
|
|
308
|
+
conversationContext: CONVERSATION_CONTEXT_SCHEMA
|
|
279
309
|
}
|
|
280
310
|
}
|
|
281
311
|
},
|
|
@@ -1029,7 +1059,8 @@ export class McpAdrAnalysisServer {
|
|
|
1029
1059
|
},
|
|
1030
1060
|
todoPath: {
|
|
1031
1061
|
type: 'string',
|
|
1032
|
-
description: 'Path to
|
|
1062
|
+
description: 'Path to TODO.md file for task identification',
|
|
1063
|
+
default: 'TODO.md'
|
|
1033
1064
|
},
|
|
1034
1065
|
cicdLogs: {
|
|
1035
1066
|
type: 'string',
|
|
@@ -1234,86 +1265,178 @@ export class McpAdrAnalysisServer {
|
|
|
1234
1265
|
}
|
|
1235
1266
|
},
|
|
1236
1267
|
{
|
|
1237
|
-
name: '
|
|
1238
|
-
description: '
|
|
1268
|
+
name: 'manage_todo_json',
|
|
1269
|
+
description: 'JSON-first TODO management with consistent LLM interactions, automatic scoring sync, and knowledge graph integration',
|
|
1239
1270
|
inputSchema: {
|
|
1240
1271
|
type: 'object',
|
|
1241
1272
|
properties: {
|
|
1242
1273
|
operation: {
|
|
1243
1274
|
type: 'string',
|
|
1244
|
-
enum: ['
|
|
1245
|
-
description: 'Operation to perform on TODO
|
|
1275
|
+
enum: ['create_task', 'update_task', 'bulk_update', 'get_tasks', 'get_analytics', 'import_adr_tasks', 'sync_knowledge_graph', 'sync_to_markdown', 'import_from_markdown'],
|
|
1276
|
+
description: 'Operation to perform on TODO JSON backend'
|
|
1246
1277
|
},
|
|
1247
|
-
|
|
1278
|
+
projectPath: {
|
|
1248
1279
|
type: 'string',
|
|
1249
|
-
|
|
1250
|
-
description: 'Path to TODO.md file'
|
|
1280
|
+
description: 'Project root path (uses configured PROJECT_PATH if not provided)'
|
|
1251
1281
|
},
|
|
1252
|
-
|
|
1282
|
+
taskId: {
|
|
1283
|
+
type: 'string',
|
|
1284
|
+
description: 'Task ID for update operations'
|
|
1285
|
+
},
|
|
1286
|
+
title: {
|
|
1287
|
+
type: 'string',
|
|
1288
|
+
description: 'Task title for create operations'
|
|
1289
|
+
},
|
|
1290
|
+
description: {
|
|
1291
|
+
type: 'string',
|
|
1292
|
+
description: 'Task description'
|
|
1293
|
+
},
|
|
1294
|
+
priority: {
|
|
1295
|
+
type: 'string',
|
|
1296
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
1297
|
+
default: 'medium',
|
|
1298
|
+
description: 'Task priority level'
|
|
1299
|
+
},
|
|
1300
|
+
assignee: {
|
|
1301
|
+
type: 'string',
|
|
1302
|
+
description: 'Task assignee'
|
|
1303
|
+
},
|
|
1304
|
+
dueDate: {
|
|
1305
|
+
type: 'string',
|
|
1306
|
+
description: 'Due date (ISO string format)'
|
|
1307
|
+
},
|
|
1308
|
+
category: {
|
|
1309
|
+
type: 'string',
|
|
1310
|
+
description: 'Task category'
|
|
1311
|
+
},
|
|
1312
|
+
tags: {
|
|
1253
1313
|
type: 'array',
|
|
1254
|
-
items: {
|
|
1255
|
-
|
|
1256
|
-
properties: {
|
|
1257
|
-
taskId: { type: 'string' },
|
|
1258
|
-
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'blocked', 'cancelled'] },
|
|
1259
|
-
notes: { type: 'string' },
|
|
1260
|
-
assignee: { type: 'string' }
|
|
1261
|
-
},
|
|
1262
|
-
required: ['taskId', 'status']
|
|
1263
|
-
},
|
|
1264
|
-
description: 'Status updates to apply (for update_status operation)'
|
|
1314
|
+
items: { type: 'string' },
|
|
1315
|
+
description: 'Task tags'
|
|
1265
1316
|
},
|
|
1266
|
-
|
|
1317
|
+
dependencies: {
|
|
1267
1318
|
type: 'array',
|
|
1268
|
-
items: {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1319
|
+
items: { type: 'string' },
|
|
1320
|
+
description: 'Task dependencies (task IDs)'
|
|
1321
|
+
},
|
|
1322
|
+
intentId: {
|
|
1323
|
+
type: 'string',
|
|
1324
|
+
description: 'Link to knowledge graph intent'
|
|
1325
|
+
},
|
|
1326
|
+
linkedAdrs: {
|
|
1327
|
+
type: 'array',
|
|
1328
|
+
items: { type: 'string' },
|
|
1329
|
+
description: 'Related ADR files'
|
|
1330
|
+
},
|
|
1331
|
+
autoComplete: {
|
|
1332
|
+
type: 'boolean',
|
|
1333
|
+
default: false,
|
|
1334
|
+
description: 'Auto-complete when criteria are met'
|
|
1335
|
+
},
|
|
1336
|
+
completionCriteria: {
|
|
1337
|
+
type: 'string',
|
|
1338
|
+
description: 'Auto-completion rules'
|
|
1339
|
+
},
|
|
1340
|
+
updates: {
|
|
1341
|
+
type: 'object',
|
|
1342
|
+
properties: {
|
|
1343
|
+
title: { type: 'string' },
|
|
1344
|
+
description: { type: 'string' },
|
|
1345
|
+
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'blocked', 'cancelled'] },
|
|
1346
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
|
|
1347
|
+
assignee: { type: 'string' },
|
|
1348
|
+
dueDate: { type: 'string' },
|
|
1349
|
+
progressPercentage: { type: 'number', minimum: 0, maximum: 100 },
|
|
1350
|
+
notes: { type: 'string' },
|
|
1351
|
+
tags: { type: 'array', items: { type: 'string' } }
|
|
1352
|
+
},
|
|
1353
|
+
description: 'Fields to update for update operations'
|
|
1354
|
+
},
|
|
1355
|
+
reason: {
|
|
1356
|
+
type: 'string',
|
|
1357
|
+
description: 'Reason for update (for changelog)'
|
|
1358
|
+
},
|
|
1359
|
+
filters: {
|
|
1360
|
+
type: 'object',
|
|
1361
|
+
properties: {
|
|
1362
|
+
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'blocked', 'cancelled'] },
|
|
1363
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
|
|
1364
|
+
assignee: { type: 'string' },
|
|
1365
|
+
category: { type: 'string' },
|
|
1366
|
+
hasDeadline: { type: 'boolean' },
|
|
1367
|
+
overdue: { type: 'boolean' },
|
|
1368
|
+
tags: { type: 'array', items: { type: 'string' } }
|
|
1280
1369
|
},
|
|
1281
|
-
description: '
|
|
1370
|
+
description: 'Filter criteria for get_tasks operation'
|
|
1371
|
+
},
|
|
1372
|
+
sortBy: {
|
|
1373
|
+
type: 'string',
|
|
1374
|
+
enum: ['priority', 'dueDate', 'createdAt', 'updatedAt'],
|
|
1375
|
+
default: 'priority',
|
|
1376
|
+
description: 'Sort field for get_tasks operation'
|
|
1377
|
+
},
|
|
1378
|
+
sortOrder: {
|
|
1379
|
+
type: 'string',
|
|
1380
|
+
enum: ['asc', 'desc'],
|
|
1381
|
+
default: 'desc',
|
|
1382
|
+
description: 'Sort order for get_tasks operation'
|
|
1282
1383
|
},
|
|
1283
|
-
|
|
1384
|
+
limit: {
|
|
1385
|
+
type: 'number',
|
|
1386
|
+
description: 'Maximum number of tasks to return'
|
|
1387
|
+
},
|
|
1388
|
+
timeframe: {
|
|
1284
1389
|
type: 'string',
|
|
1285
|
-
|
|
1390
|
+
enum: ['day', 'week', 'month', 'all'],
|
|
1391
|
+
default: 'week',
|
|
1392
|
+
description: 'Analysis timeframe for analytics'
|
|
1393
|
+
},
|
|
1394
|
+
includeVelocity: {
|
|
1395
|
+
type: 'boolean',
|
|
1396
|
+
default: true,
|
|
1397
|
+
description: 'Include velocity metrics in analytics'
|
|
1398
|
+
},
|
|
1399
|
+
includeScoring: {
|
|
1400
|
+
type: 'boolean',
|
|
1401
|
+
default: true,
|
|
1402
|
+
description: 'Include scoring metrics in analytics'
|
|
1286
1403
|
},
|
|
1287
1404
|
adrDirectory: {
|
|
1288
1405
|
type: 'string',
|
|
1289
1406
|
default: 'docs/adrs',
|
|
1290
|
-
description: 'ADR directory path
|
|
1407
|
+
description: 'ADR directory path for imports'
|
|
1291
1408
|
},
|
|
1292
|
-
|
|
1409
|
+
preserveExisting: {
|
|
1293
1410
|
type: 'boolean',
|
|
1294
1411
|
default: true,
|
|
1295
|
-
description: 'Keep
|
|
1412
|
+
description: 'Keep existing tasks during imports'
|
|
1296
1413
|
},
|
|
1297
|
-
|
|
1414
|
+
autoLinkDependencies: {
|
|
1298
1415
|
type: 'boolean',
|
|
1299
1416
|
default: true,
|
|
1300
|
-
description: '
|
|
1417
|
+
description: 'Auto-detect task dependencies'
|
|
1418
|
+
},
|
|
1419
|
+
direction: {
|
|
1420
|
+
type: 'string',
|
|
1421
|
+
enum: ['to_kg', 'from_kg', 'bidirectional'],
|
|
1422
|
+
default: 'bidirectional',
|
|
1423
|
+
description: 'Knowledge graph sync direction'
|
|
1301
1424
|
},
|
|
1302
|
-
|
|
1425
|
+
force: {
|
|
1303
1426
|
type: 'boolean',
|
|
1304
1427
|
default: false,
|
|
1305
|
-
description: '
|
|
1428
|
+
description: 'Force operation even if conflicts exist'
|
|
1306
1429
|
},
|
|
1307
|
-
|
|
1430
|
+
mergeStrategy: {
|
|
1308
1431
|
type: 'string',
|
|
1309
|
-
enum: ['
|
|
1310
|
-
default: '
|
|
1311
|
-
description: '
|
|
1432
|
+
enum: ['overwrite', 'merge', 'preserve_json'],
|
|
1433
|
+
default: 'merge',
|
|
1434
|
+
description: 'Merge strategy for imports'
|
|
1312
1435
|
},
|
|
1313
|
-
|
|
1436
|
+
backupExisting: {
|
|
1314
1437
|
type: 'boolean',
|
|
1315
1438
|
default: true,
|
|
1316
|
-
description: '
|
|
1439
|
+
description: 'Create backup before destructive operations'
|
|
1317
1440
|
}
|
|
1318
1441
|
},
|
|
1319
1442
|
required: ['operation']
|
|
@@ -1445,6 +1568,224 @@ export class McpAdrAnalysisServer {
|
|
|
1445
1568
|
}
|
|
1446
1569
|
}
|
|
1447
1570
|
}
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
name: 'troubleshoot_guided_workflow',
|
|
1574
|
+
description: 'Structured failure analysis and test plan generation - provide JSON failure info to get specific test commands',
|
|
1575
|
+
inputSchema: {
|
|
1576
|
+
type: 'object',
|
|
1577
|
+
properties: {
|
|
1578
|
+
operation: {
|
|
1579
|
+
type: 'string',
|
|
1580
|
+
enum: ['analyze_failure', 'generate_test_plan', 'full_workflow'],
|
|
1581
|
+
description: 'Type of troubleshooting operation'
|
|
1582
|
+
},
|
|
1583
|
+
failure: {
|
|
1584
|
+
type: 'object',
|
|
1585
|
+
properties: {
|
|
1586
|
+
failureType: {
|
|
1587
|
+
type: 'string',
|
|
1588
|
+
enum: ['test_failure', 'deployment_failure', 'build_failure', 'runtime_error', 'performance_issue', 'security_issue', 'other'],
|
|
1589
|
+
description: 'Type of failure'
|
|
1590
|
+
},
|
|
1591
|
+
failureDetails: {
|
|
1592
|
+
type: 'object',
|
|
1593
|
+
properties: {
|
|
1594
|
+
command: {
|
|
1595
|
+
type: 'string',
|
|
1596
|
+
description: 'Command that failed (optional)'
|
|
1597
|
+
},
|
|
1598
|
+
exitCode: {
|
|
1599
|
+
type: 'number',
|
|
1600
|
+
description: 'Exit code of failed process (optional)'
|
|
1601
|
+
},
|
|
1602
|
+
errorMessage: {
|
|
1603
|
+
type: 'string',
|
|
1604
|
+
description: 'Primary error message'
|
|
1605
|
+
},
|
|
1606
|
+
stackTrace: {
|
|
1607
|
+
type: 'string',
|
|
1608
|
+
description: 'Stack trace if available (optional)'
|
|
1609
|
+
},
|
|
1610
|
+
logOutput: {
|
|
1611
|
+
type: 'string',
|
|
1612
|
+
description: 'Relevant log output (optional)'
|
|
1613
|
+
},
|
|
1614
|
+
environment: {
|
|
1615
|
+
type: 'string',
|
|
1616
|
+
description: 'Environment where failure occurred (optional)'
|
|
1617
|
+
},
|
|
1618
|
+
timestamp: {
|
|
1619
|
+
type: 'string',
|
|
1620
|
+
description: 'When the failure occurred (optional)'
|
|
1621
|
+
},
|
|
1622
|
+
affectedFiles: {
|
|
1623
|
+
type: 'array',
|
|
1624
|
+
items: { type: 'string' },
|
|
1625
|
+
description: 'Files involved in the failure (optional)'
|
|
1626
|
+
}
|
|
1627
|
+
},
|
|
1628
|
+
required: ['errorMessage'],
|
|
1629
|
+
description: 'Detailed failure information'
|
|
1630
|
+
},
|
|
1631
|
+
context: {
|
|
1632
|
+
type: 'object',
|
|
1633
|
+
properties: {
|
|
1634
|
+
recentChanges: {
|
|
1635
|
+
type: 'string',
|
|
1636
|
+
description: 'Recent changes that might be related (optional)'
|
|
1637
|
+
},
|
|
1638
|
+
reproducible: {
|
|
1639
|
+
type: 'boolean',
|
|
1640
|
+
description: 'Whether the failure is reproducible (optional)'
|
|
1641
|
+
},
|
|
1642
|
+
frequency: {
|
|
1643
|
+
type: 'string',
|
|
1644
|
+
description: 'How often this failure occurs (optional)'
|
|
1645
|
+
},
|
|
1646
|
+
impact: {
|
|
1647
|
+
type: 'string',
|
|
1648
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
1649
|
+
description: 'Impact level of the failure (optional)'
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
description: 'Additional context about the failure (optional)'
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
required: ['failureType', 'failureDetails'],
|
|
1656
|
+
description: 'Structured failure information (required for analyze_failure and generate_test_plan)'
|
|
1657
|
+
},
|
|
1658
|
+
projectPath: {
|
|
1659
|
+
type: 'string',
|
|
1660
|
+
description: 'Path to project directory (optional)'
|
|
1661
|
+
},
|
|
1662
|
+
adrDirectory: {
|
|
1663
|
+
type: 'string',
|
|
1664
|
+
description: 'ADR directory path',
|
|
1665
|
+
default: 'docs/adrs'
|
|
1666
|
+
},
|
|
1667
|
+
todoPath: {
|
|
1668
|
+
type: 'string',
|
|
1669
|
+
description: 'Path to TODO.md file',
|
|
1670
|
+
default: 'TODO.md'
|
|
1671
|
+
},
|
|
1672
|
+
conversationContext: CONVERSATION_CONTEXT_SCHEMA
|
|
1673
|
+
},
|
|
1674
|
+
required: ['operation']
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
name: 'smart_score',
|
|
1679
|
+
description: 'Central coordination for project health scoring system - recalculate, sync, diagnose, optimize, and reset scores across all MCP tools',
|
|
1680
|
+
inputSchema: {
|
|
1681
|
+
type: 'object',
|
|
1682
|
+
properties: {
|
|
1683
|
+
operation: {
|
|
1684
|
+
type: 'string',
|
|
1685
|
+
enum: ['recalculate_scores', 'sync_scores', 'diagnose_scores', 'optimize_weights', 'reset_scores', 'get_score_trends', 'get_intent_scores'],
|
|
1686
|
+
description: 'Smart scoring operation to perform'
|
|
1687
|
+
},
|
|
1688
|
+
projectPath: {
|
|
1689
|
+
type: 'string',
|
|
1690
|
+
description: 'Path to project directory'
|
|
1691
|
+
},
|
|
1692
|
+
components: {
|
|
1693
|
+
type: 'array',
|
|
1694
|
+
items: {
|
|
1695
|
+
type: 'string',
|
|
1696
|
+
enum: ['task_completion', 'deployment_readiness', 'architecture_compliance', 'security_posture', 'code_quality', 'all']
|
|
1697
|
+
},
|
|
1698
|
+
default: ['all'],
|
|
1699
|
+
description: 'Score components to recalculate (for recalculate_scores operation)'
|
|
1700
|
+
},
|
|
1701
|
+
forceUpdate: {
|
|
1702
|
+
type: 'boolean',
|
|
1703
|
+
default: false,
|
|
1704
|
+
description: 'Force update even if data is fresh'
|
|
1705
|
+
},
|
|
1706
|
+
updateSources: {
|
|
1707
|
+
type: 'boolean',
|
|
1708
|
+
default: true,
|
|
1709
|
+
description: 'Trigger source tool updates before recalculating'
|
|
1710
|
+
},
|
|
1711
|
+
todoPath: {
|
|
1712
|
+
type: 'string',
|
|
1713
|
+
default: 'TODO.md',
|
|
1714
|
+
description: 'Path to TODO.md file (for sync_scores operation)'
|
|
1715
|
+
},
|
|
1716
|
+
triggerTools: {
|
|
1717
|
+
type: 'array',
|
|
1718
|
+
items: {
|
|
1719
|
+
type: 'string',
|
|
1720
|
+
enum: ['manage_todo_json', 'smart_git_push', 'compare_adr_progress', 'analyze_content_security', 'validate_rules']
|
|
1721
|
+
},
|
|
1722
|
+
description: 'Tools to trigger for fresh data (for sync_scores operation)'
|
|
1723
|
+
},
|
|
1724
|
+
rebalanceWeights: {
|
|
1725
|
+
type: 'boolean',
|
|
1726
|
+
default: false,
|
|
1727
|
+
description: 'Recalculate optimal scoring weights (for sync_scores operation)'
|
|
1728
|
+
},
|
|
1729
|
+
includeHistory: {
|
|
1730
|
+
type: 'boolean',
|
|
1731
|
+
default: true,
|
|
1732
|
+
description: 'Include score history analysis (for diagnose_scores operation)'
|
|
1733
|
+
},
|
|
1734
|
+
checkDataFreshness: {
|
|
1735
|
+
type: 'boolean',
|
|
1736
|
+
default: true,
|
|
1737
|
+
description: 'Validate data freshness across tools (for diagnose_scores operation)'
|
|
1738
|
+
},
|
|
1739
|
+
suggestImprovements: {
|
|
1740
|
+
type: 'boolean',
|
|
1741
|
+
default: true,
|
|
1742
|
+
description: 'Provide score improvement suggestions (for diagnose_scores operation)'
|
|
1743
|
+
},
|
|
1744
|
+
analysisMode: {
|
|
1745
|
+
type: 'string',
|
|
1746
|
+
enum: ['current_state', 'historical_data', 'project_type'],
|
|
1747
|
+
default: 'current_state',
|
|
1748
|
+
description: 'Method for weight optimization (for optimize_weights operation)'
|
|
1749
|
+
},
|
|
1750
|
+
customWeights: {
|
|
1751
|
+
type: 'object',
|
|
1752
|
+
properties: {
|
|
1753
|
+
taskCompletion: { type: 'number', minimum: 0, maximum: 1 },
|
|
1754
|
+
deploymentReadiness: { type: 'number', minimum: 0, maximum: 1 },
|
|
1755
|
+
architectureCompliance: { type: 'number', minimum: 0, maximum: 1 },
|
|
1756
|
+
securityPosture: { type: 'number', minimum: 0, maximum: 1 },
|
|
1757
|
+
codeQuality: { type: 'number', minimum: 0, maximum: 1 }
|
|
1758
|
+
},
|
|
1759
|
+
description: 'Custom weight overrides (for optimize_weights operation)'
|
|
1760
|
+
},
|
|
1761
|
+
previewOnly: {
|
|
1762
|
+
type: 'boolean',
|
|
1763
|
+
default: false,
|
|
1764
|
+
description: 'Preview changes without applying (for optimize_weights operation)'
|
|
1765
|
+
},
|
|
1766
|
+
component: {
|
|
1767
|
+
type: 'string',
|
|
1768
|
+
enum: ['task_completion', 'deployment_readiness', 'architecture_compliance', 'security_posture', 'code_quality', 'all'],
|
|
1769
|
+
default: 'all',
|
|
1770
|
+
description: 'Score component to reset (for reset_scores operation)'
|
|
1771
|
+
},
|
|
1772
|
+
preserveHistory: {
|
|
1773
|
+
type: 'boolean',
|
|
1774
|
+
default: true,
|
|
1775
|
+
description: 'Preserve score history in backup (for reset_scores operation)'
|
|
1776
|
+
},
|
|
1777
|
+
recalculateAfterReset: {
|
|
1778
|
+
type: 'boolean',
|
|
1779
|
+
default: true,
|
|
1780
|
+
description: 'Immediately recalculate after reset (for reset_scores operation)'
|
|
1781
|
+
},
|
|
1782
|
+
intentId: {
|
|
1783
|
+
type: 'string',
|
|
1784
|
+
description: 'Intent ID to get score trends for (for get_intent_scores operation)'
|
|
1785
|
+
}
|
|
1786
|
+
},
|
|
1787
|
+
required: ['operation', 'projectPath']
|
|
1788
|
+
}
|
|
1448
1789
|
}
|
|
1449
1790
|
]
|
|
1450
1791
|
};
|
|
@@ -1545,8 +1886,8 @@ export class McpAdrAnalysisServer {
|
|
|
1545
1886
|
case 'list_directory':
|
|
1546
1887
|
response = await this.listDirectory(args);
|
|
1547
1888
|
break;
|
|
1548
|
-
case '
|
|
1549
|
-
response = await this.
|
|
1889
|
+
case 'manage_todo_json':
|
|
1890
|
+
response = await this.manageTodoJson(args);
|
|
1550
1891
|
break;
|
|
1551
1892
|
case 'generate_deployment_guidance':
|
|
1552
1893
|
response = await this.generateDeploymentGuidance(args);
|
|
@@ -1554,13 +1895,23 @@ export class McpAdrAnalysisServer {
|
|
|
1554
1895
|
case 'smart_git_push':
|
|
1555
1896
|
response = await this.smartGitPush(args);
|
|
1556
1897
|
break;
|
|
1898
|
+
case 'troubleshoot_guided_workflow':
|
|
1899
|
+
response = await this.troubleshootGuidedWorkflow(args);
|
|
1900
|
+
break;
|
|
1901
|
+
case 'smart_score':
|
|
1902
|
+
response = await this.smartScore(args);
|
|
1903
|
+
break;
|
|
1557
1904
|
default:
|
|
1558
1905
|
throw new McpAdrError(`Unknown tool: ${name}`, 'UNKNOWN_TOOL');
|
|
1559
1906
|
}
|
|
1560
1907
|
// Apply content masking to response
|
|
1908
|
+
// Track tool execution in knowledge graph
|
|
1909
|
+
await this.trackToolExecution(name, args, response, true);
|
|
1561
1910
|
return await this.applyOutputMasking(response);
|
|
1562
1911
|
}
|
|
1563
1912
|
catch (error) {
|
|
1913
|
+
// Track failed execution
|
|
1914
|
+
await this.trackToolExecution(name, args, {}, false, error instanceof Error ? error.message : String(error));
|
|
1564
1915
|
if (error instanceof McpAdrError) {
|
|
1565
1916
|
throw error;
|
|
1566
1917
|
}
|
|
@@ -2960,7 +3311,7 @@ The enhanced process maintains full traceability from PRD requirements to genera
|
|
|
2960
3311
|
}
|
|
2961
3312
|
}
|
|
2962
3313
|
async generateAdrTodo(args) {
|
|
2963
|
-
const { scope = 'all', phase = 'both', linkAdrs = true, includeRules = true, ruleSource = 'both' } = args;
|
|
3314
|
+
const { scope = 'all', phase = 'both', linkAdrs = true, includeRules = true, ruleSource = 'both', preserveExisting = true, forceSyncToMarkdown = false, intentId, createJsonBackup = true } = args;
|
|
2964
3315
|
const { getAdrDirectoryPath } = await import('./utils/config.js');
|
|
2965
3316
|
const path = await import('path');
|
|
2966
3317
|
// Use absolute ADR path relative to project
|
|
@@ -2969,307 +3320,93 @@ The enhanced process maintains full traceability from PRD requirements to genera
|
|
|
2969
3320
|
getAdrDirectoryPath(this.config);
|
|
2970
3321
|
// Keep relative path for display purposes
|
|
2971
3322
|
const adrDirectory = args.adrDirectory || this.config.adrDirectory;
|
|
2972
|
-
this.logger.info(`Generating
|
|
3323
|
+
this.logger.info(`Generating JSON-first TODO for ADRs in: ${absoluteAdrPath} (phase: ${phase})`);
|
|
2973
3324
|
try {
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
discoveryResult.adrs.forEach(adr => {
|
|
2980
|
-
adrContent += `### ${adr.title}\n`;
|
|
2981
|
-
adrContent += `- **File**: ${adr.filename}\n`;
|
|
2982
|
-
adrContent += `- **Status**: ${adr.status}\n`;
|
|
2983
|
-
adrContent += `- **Context**: ${adr.context}\n`;
|
|
2984
|
-
adrContent += `- **Decision**: ${adr.decision}\n`;
|
|
2985
|
-
adrContent += `- **Consequences**: ${adr.consequences}\n\n`;
|
|
2986
|
-
});
|
|
2987
|
-
// For ADR linking, also discover all project structure
|
|
2988
|
-
let projectStructurePrompt = '';
|
|
2989
|
-
if (linkAdrs) {
|
|
2990
|
-
const projectStructure = await scanProjectStructure(this.config.projectPath, {
|
|
2991
|
-
readContent: false,
|
|
2992
|
-
includeHidden: false
|
|
2993
|
-
});
|
|
2994
|
-
const codeFiles = [
|
|
2995
|
-
...projectStructure.buildFiles.filter(f => f.filename.match(/\.(ts|js|py|java|cs|go|rb|php|swift|kt|rs|cpp|c|h)$/)),
|
|
2996
|
-
...projectStructure.configFiles.filter(f => f.filename.match(/\.(ts|js)$/))
|
|
2997
|
-
];
|
|
2998
|
-
projectStructurePrompt = `
|
|
2999
|
-
## Project Structure (for ADR linking)
|
|
3000
|
-
Found ${codeFiles.length} code files:
|
|
3001
|
-
${codeFiles.map(f => `- ${f.relativePath} (${f.type})`).join('\n')}
|
|
3002
|
-
`;
|
|
3003
|
-
}
|
|
3004
|
-
// For rules integration, extract architectural rules from ADRs
|
|
3005
|
-
let rulesPrompt = '';
|
|
3006
|
-
if (includeRules) {
|
|
3325
|
+
// Always use JSON-first TODO system
|
|
3326
|
+
this.logger.info('Using JSON-first TODO system for ADR task generation');
|
|
3327
|
+
const { manageTodoV2 } = await import('./tools/todo-management-tool-v2.js');
|
|
3328
|
+
// Optional: Create backup if requested and JSON exists
|
|
3329
|
+
if (createJsonBackup) {
|
|
3007
3330
|
try {
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
adrDirectory: adrDirectory,
|
|
3331
|
+
await manageTodoV2({
|
|
3332
|
+
operation: 'import_from_markdown',
|
|
3011
3333
|
projectPath: this.config.projectPath,
|
|
3012
|
-
|
|
3334
|
+
mergeStrategy: 'preserve_json',
|
|
3335
|
+
backupExisting: true
|
|
3013
3336
|
});
|
|
3014
|
-
|
|
3015
|
-
rulesPrompt = `
|
|
3016
|
-
## Architectural Rules (for compliance validation)
|
|
3017
|
-
The following architectural rules have been extracted from ADRs and should be validated in tests:
|
|
3018
|
-
|
|
3019
|
-
${Array.isArray(rulesResult.content) ? rulesResult.content.map((c) => c.text || c).join('\n') : rulesResult.content}
|
|
3020
|
-
`;
|
|
3021
|
-
}
|
|
3337
|
+
this.logger.info('Created backup of existing JSON TODO data');
|
|
3022
3338
|
}
|
|
3023
3339
|
catch (error) {
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
## Architectural Rules (failed to extract)
|
|
3027
|
-
Note: Could not extract architectural rules automatically. Manual rule validation may be needed.
|
|
3028
|
-
`;
|
|
3340
|
+
// Continue if backup fails - might be first time setup
|
|
3341
|
+
this.logger.debug('No existing JSON data to backup');
|
|
3029
3342
|
}
|
|
3030
3343
|
}
|
|
3031
|
-
//
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
## Step 2: TDD Todo Generation Analysis
|
|
3041
|
-
|
|
3042
|
-
Once you have discovered and read the ADR files, please analyze them and generate a comprehensive TDD-focused todo.md file.
|
|
3043
|
-
|
|
3044
|
-
## TDD Phase: ${phase}
|
|
3045
|
-
${phase === 'test' ? '**Focus on Phase 1: Mock Test Generation Only**' : ''}
|
|
3046
|
-
${phase === 'production' ? '**Focus on Phase 2: Production Code Implementation (assumes tests exist)**' : ''}
|
|
3047
|
-
${phase === 'both' ? '**Generate both Phase 1 (Tests) and Phase 2 (Production) tasks**' : ''}
|
|
3048
|
-
|
|
3049
|
-
## Requirements
|
|
3050
|
-
|
|
3051
|
-
1. **Extract Tasks**: Identify all implementation tasks from ADRs
|
|
3052
|
-
2. **TDD Approach**: For each task, create:
|
|
3053
|
-
- Phase 1: Mock test specifications
|
|
3054
|
-
- Phase 2: Production implementation tasks
|
|
3055
|
-
3. **ADR Linking**: ${linkAdrs ? 'Link related ADRs to create comprehensive system tests' : 'Focus on individual ADR tasks'}
|
|
3056
|
-
4. **Rules Integration**: ${includeRules ? `Include architectural rules validation in tests (source: ${ruleSource})` : 'Skip architectural rules validation'}
|
|
3057
|
-
5. **Categorize**: Group tasks by ADR and testing phase
|
|
3058
|
-
6. **Status Detection**: Determine task completion status
|
|
3059
|
-
7. **Progress Tracking**: Calculate overall progress for both test and implementation phases
|
|
3060
|
-
8. **Scope Filter**: ${scope === 'all' ? 'Include all tasks' : `Focus on ${scope} tasks only`}
|
|
3061
|
-
|
|
3062
|
-
## TDD Todo.md Format
|
|
3063
|
-
|
|
3064
|
-
\`\`\`markdown
|
|
3065
|
-
# TDD-Focused ADR Implementation Progress
|
|
3066
|
-
|
|
3067
|
-
**Last Updated**: [Date]
|
|
3068
|
-
**Overall Progress**: [X]% Complete
|
|
3069
|
-
**Test Coverage**: [X]% Complete
|
|
3070
|
-
**Implementation Coverage**: [X]% Complete
|
|
3071
|
-
|
|
3072
|
-
## Summary
|
|
3073
|
-
- Total ADRs: [count]
|
|
3074
|
-
- Total Tasks: [count] (Tests: [count], Implementation: [count])
|
|
3075
|
-
- Completed: [count]
|
|
3076
|
-
- In Progress: [count]
|
|
3077
|
-
- Pending: [count]
|
|
3078
|
-
|
|
3079
|
-
## System Architecture Overview (from linked ADRs)
|
|
3080
|
-
[Brief summary of how all ADRs connect to form the complete system]
|
|
3081
|
-
|
|
3082
|
-
## Phase 1: Test Generation Tasks
|
|
3083
|
-
|
|
3084
|
-
### ADR-001: [Title]
|
|
3085
|
-
#### Test Specifications
|
|
3086
|
-
- [ ] TEST: Unit test for [component/function]
|
|
3087
|
-
- Mock: [what to mock]
|
|
3088
|
-
- Expected: [expected behavior]
|
|
3089
|
-
- Coverage: [what this tests]
|
|
3090
|
-
- [ ] TEST: Integration test for [feature]
|
|
3091
|
-
- Setup: [test environment]
|
|
3092
|
-
- Scenario: [test scenario]
|
|
3093
|
-
- Assertions: [what to verify]
|
|
3094
|
-
${includeRules ? `- [ ] RULE: Architectural rule validation test for [rule name]
|
|
3095
|
-
- Validation: [what rule to check]
|
|
3096
|
-
- Pattern: [validation pattern/regex]
|
|
3097
|
-
- Expected: [compliant behavior]` : ''}
|
|
3098
|
-
|
|
3099
|
-
### ADR-002: [Title]
|
|
3100
|
-
#### Test Specifications
|
|
3101
|
-
- [ ] TEST: [test description]
|
|
3102
|
-
${includeRules ? '- [ ] RULE: [rule validation test]' : ''}
|
|
3103
|
-
...
|
|
3104
|
-
|
|
3105
|
-
## Phase 2: Production Implementation Tasks
|
|
3106
|
-
|
|
3107
|
-
### ADR-001: [Title]
|
|
3108
|
-
#### Implementation Tasks (after tests pass)
|
|
3109
|
-
- [ ] IMPL: Implement [component/function]
|
|
3110
|
-
- Precondition: Unit test for [component] exists
|
|
3111
|
-
- Definition: [what to implement]
|
|
3112
|
-
- Acceptance: All related tests pass
|
|
3113
|
-
${includeRules ? ` - Compliance: Must pass architectural rule validation` : ''}
|
|
3114
|
-
- [ ] IMPL: [implementation task]
|
|
3115
|
-
|
|
3116
|
-
### ADR-002: [Title]
|
|
3117
|
-
#### Implementation Tasks
|
|
3118
|
-
- [ ] IMPL: [implementation description]
|
|
3119
|
-
${includeRules ? ' - Compliance: [specific rule requirements]' : ''}
|
|
3120
|
-
...
|
|
3121
|
-
|
|
3122
|
-
## ADR Dependencies and Links
|
|
3123
|
-
- ADR-001 → ADR-002: [relationship description]
|
|
3124
|
-
- ADR-002 → ADR-003: [relationship description]
|
|
3125
|
-
|
|
3126
|
-
## Test-First Development Workflow
|
|
3127
|
-
1. Complete all Phase 1 tests for a component
|
|
3128
|
-
${includeRules ? '2. Complete architectural rule validation tests' : ''}
|
|
3129
|
-
${includeRules ? '3' : '2'}. Run tests (they should fail)
|
|
3130
|
-
${includeRules ? '4' : '3'}. Implement Phase 2 production code
|
|
3131
|
-
${includeRules ? '5' : '4'}. Run tests (they should pass)
|
|
3132
|
-
${includeRules ? '6. Validate architectural rule compliance' : ''}
|
|
3133
|
-
${includeRules ? '7' : '5'}. Refactor if needed while maintaining rule compliance
|
|
3134
|
-
\`\`\`
|
|
3135
|
-
|
|
3136
|
-
Please provide:
|
|
3137
|
-
1. Comprehensive task extraction from all ADRs
|
|
3138
|
-
2. Test specifications for each implementation task
|
|
3139
|
-
${includeRules ? '3. Architectural rule validation tests and compliance checks' : ''}
|
|
3140
|
-
${includeRules ? '4' : '3'}. Clear separation of test and implementation phases
|
|
3141
|
-
${includeRules ? '5' : '4'}. ADR relationship mapping for system-wide test coverage
|
|
3142
|
-
${includeRules ? '6' : '5'}. TDD workflow recommendations with rule compliance integration
|
|
3143
|
-
`;
|
|
3144
|
-
// Execute the todo generation with AI if enabled, otherwise return prompt
|
|
3145
|
-
const { executePromptWithFallback, formatMCPResponse } = await import('./utils/prompt-execution.js');
|
|
3146
|
-
const executionResult = await executePromptWithFallback(todoPrompt, 'Generate TDD-focused todo.md file from ADR analysis with test-first approach and system-wide coverage', {
|
|
3147
|
-
temperature: 0.1,
|
|
3148
|
-
maxTokens: 8000,
|
|
3149
|
-
systemPrompt: `You are an expert in Test-Driven Development (TDD) and architectural implementation.
|
|
3150
|
-
Analyze the provided ADRs to extract actionable tasks following a strict TDD approach.
|
|
3151
|
-
|
|
3152
|
-
Key responsibilities:
|
|
3153
|
-
1. For each implementation task, FIRST define the test specifications
|
|
3154
|
-
2. Create mock test descriptions that verify the expected behavior
|
|
3155
|
-
3. Link related ADRs to ensure comprehensive system test coverage
|
|
3156
|
-
4. Separate test generation (Phase 1) from production code (Phase 2)
|
|
3157
|
-
5. Ensure every production task has corresponding test coverage
|
|
3158
|
-
6. Map ADR dependencies to identify integration test requirements
|
|
3159
|
-
${includeRules ? '7. Include architectural rule validation in test specifications' : ''}
|
|
3160
|
-
${includeRules ? '8. Create compliance checks for extracted architectural rules' : ''}
|
|
3161
|
-
${includeRules ? '9. Ensure implementation tasks include rule compliance verification' : ''}
|
|
3162
|
-
|
|
3163
|
-
Follow the TDD red-green-refactor cycle:
|
|
3164
|
-
- Red: Write failing tests first (Phase 1)${includeRules ? ' including rule validation tests' : ''}
|
|
3165
|
-
- Green: Implement minimal code to pass tests (Phase 2)
|
|
3166
|
-
- Refactor: Improve code while keeping tests green${includeRules ? ' and maintaining rule compliance' : ''}
|
|
3167
|
-
|
|
3168
|
-
${includeRules ? 'The architectural rules provide constraints and patterns that must be validated in tests and followed in implementation.' : ''}
|
|
3169
|
-
|
|
3170
|
-
The todo.md should serve as the glue connecting all ADRs into a cohesive, testable${includeRules ? ', rule-compliant' : ''} system.`,
|
|
3171
|
-
responseFormat: 'text'
|
|
3344
|
+
// Import ADR tasks into JSON system with enhanced parameters
|
|
3345
|
+
const importResult = await manageTodoV2({
|
|
3346
|
+
operation: 'import_adr_tasks',
|
|
3347
|
+
projectPath: this.config.projectPath,
|
|
3348
|
+
adrDirectory: absoluteAdrPath,
|
|
3349
|
+
preserveExisting,
|
|
3350
|
+
autoLinkDependencies: linkAdrs,
|
|
3351
|
+
...(intentId && { intentId })
|
|
3172
3352
|
});
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3353
|
+
// Sync JSON data to markdown with force option
|
|
3354
|
+
await manageTodoV2({
|
|
3355
|
+
operation: 'sync_to_markdown',
|
|
3356
|
+
projectPath: this.config.projectPath,
|
|
3357
|
+
force: forceSyncToMarkdown
|
|
3358
|
+
});
|
|
3359
|
+
return {
|
|
3360
|
+
content: [{
|
|
3361
|
+
type: 'text',
|
|
3362
|
+
text: `# ✅ JSON-First TODO Generated from ADRs
|
|
3363
|
+
|
|
3364
|
+
## 🏗️ JSON-First TODO System Active
|
|
3365
|
+
✅ **todo-data.json** - JSON-first TODO backend created/updated
|
|
3366
|
+
✅ **TODO.md** - Markdown frontend ${forceSyncToMarkdown ? 'synchronized' : 'available for sync'}
|
|
3178
3367
|
|
|
3179
|
-
##
|
|
3368
|
+
## Configuration Applied
|
|
3180
3369
|
- **ADR Directory**: ${adrDirectory}
|
|
3181
3370
|
- **Scope**: ${scope}
|
|
3182
3371
|
- **TDD Phase**: ${phase}
|
|
3183
|
-
- **ADR Linking**: ${linkAdrs ? 'Enabled' : 'Disabled'}
|
|
3372
|
+
- **ADR Dependency Linking**: ${linkAdrs ? 'Enabled' : 'Disabled'}
|
|
3184
3373
|
- **Rules Integration**: ${includeRules ? `Enabled (${ruleSource})` : 'Disabled'}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
${
|
|
3189
|
-
|
|
3190
|
-
##
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
- **
|
|
3214
|
-
- **
|
|
3215
|
-
- **
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
{
|
|
3222
|
-
"tool": "generate_adr_todo",
|
|
3223
|
-
"args": {
|
|
3224
|
-
"adrDirectory": "${adrDirectory}",
|
|
3225
|
-
"phase": "test",
|
|
3226
|
-
"linkAdrs": true,
|
|
3227
|
-
"includeRules": true,
|
|
3228
|
-
"ruleSource": "both"
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
\`\`\`
|
|
3232
|
-
|
|
3233
|
-
### Generate Production Phase Only:
|
|
3234
|
-
\`\`\`json
|
|
3235
|
-
{
|
|
3236
|
-
"tool": "generate_adr_todo",
|
|
3237
|
-
"args": {
|
|
3238
|
-
"adrDirectory": "${adrDirectory}",
|
|
3239
|
-
"phase": "production",
|
|
3240
|
-
"scope": "pending",
|
|
3241
|
-
"includeRules": true
|
|
3242
|
-
}
|
|
3243
|
-
}
|
|
3244
|
-
\`\`\`
|
|
3245
|
-
|
|
3246
|
-
### Update Full TDD Todo with Rules:
|
|
3247
|
-
\`\`\`json
|
|
3248
|
-
{
|
|
3249
|
-
"tool": "generate_adr_todo",
|
|
3250
|
-
"args": {
|
|
3251
|
-
"adrDirectory": "${adrDirectory}",
|
|
3252
|
-
"phase": "both",
|
|
3253
|
-
"linkAdrs": true,
|
|
3254
|
-
"includeRules": true,
|
|
3255
|
-
"ruleSource": "both"
|
|
3256
|
-
}
|
|
3257
|
-
}
|
|
3258
|
-
\`\`\`
|
|
3259
|
-
`,
|
|
3260
|
-
});
|
|
3261
|
-
}
|
|
3262
|
-
else {
|
|
3263
|
-
// Fallback to prompt-only mode
|
|
3264
|
-
return {
|
|
3265
|
-
content: [
|
|
3266
|
-
{
|
|
3267
|
-
type: 'text',
|
|
3268
|
-
text: `TDD-focused ADR todo generation for: ${adrDirectory}\n\nPhase: ${phase}\nADR Linking: ${linkAdrs ? 'Enabled' : 'Disabled'}\nRules Integration: ${includeRules ? `Enabled (${ruleSource})` : 'Disabled'}\nScope: ${scope}\n\nPlease generate a TDD-focused todo.md using the following prompt:\n\n${todoPrompt}`
|
|
3269
|
-
}
|
|
3270
|
-
]
|
|
3271
|
-
};
|
|
3272
|
-
}
|
|
3374
|
+
- **Preserve Existing**: ${preserveExisting}
|
|
3375
|
+
- **Force Markdown Sync**: ${forceSyncToMarkdown ? 'Enabled' : 'Disabled'}
|
|
3376
|
+
- **Intent Linking**: ${intentId ? `Linked to ${intentId}` : 'None'}
|
|
3377
|
+
- **JSON Backup**: ${createJsonBackup ? 'Created' : 'Skipped'}
|
|
3378
|
+
|
|
3379
|
+
## JSON-First Architecture Benefits
|
|
3380
|
+
✅ **Structured Data**: JSON backend ensures consistent LLM interactions
|
|
3381
|
+
✅ **Automatic Sync**: JSON-to-markdown conversion maintains TODO.md compatibility
|
|
3382
|
+
✅ **Enhanced Metadata**: Full task lifecycle with dependencies, assignees, priorities
|
|
3383
|
+
✅ **Complete Integration**: Native support for scoring, git automation, and knowledge graph
|
|
3384
|
+
✅ **Backup Protection**: Automatic data preservation during updates
|
|
3385
|
+
✅ **No Manual Setup**: All cache files auto-generated, tests can immediately validate
|
|
3386
|
+
|
|
3387
|
+
${importResult.content[0].text}
|
|
3388
|
+
|
|
3389
|
+
## Available Operations (use manage_todo_v2 tool)
|
|
3390
|
+
1. **View Tasks**: \`get_tasks\` operation with filtering and sorting
|
|
3391
|
+
2. **Update Status**: \`update_task\` operation with status, progress, notes
|
|
3392
|
+
3. **Bulk Updates**: \`bulk_update\` operation for multiple tasks
|
|
3393
|
+
4. **Analytics**: \`get_analytics\` operation for progress metrics
|
|
3394
|
+
5. **Sync Control**: \`sync_to_markdown\` and \`sync_knowledge_graph\` operations
|
|
3395
|
+
|
|
3396
|
+
## Validation & Progress Tracking
|
|
3397
|
+
- **Progress Check**: Use \`compare_adr_progress\` to validate implementation vs ADRs
|
|
3398
|
+
- **Git Integration**: Use \`smart_git_push\` for automatic task status updates
|
|
3399
|
+
- **Scoring**: Integrated with smart scoring for release readiness assessment
|
|
3400
|
+
|
|
3401
|
+
## TDD Workflow Integration
|
|
3402
|
+
- **Phase 1**: Mock test generation tasks created
|
|
3403
|
+
- **Phase 2**: Production implementation tasks linked to tests
|
|
3404
|
+
- **Dependencies**: ADR relationships mapped to task dependencies
|
|
3405
|
+
- **Validation**: Architectural rules integrated into task criteria
|
|
3406
|
+
|
|
3407
|
+
*All TODO data is now managed in JSON format with automatic markdown sync*`
|
|
3408
|
+
}]
|
|
3409
|
+
};
|
|
3273
3410
|
}
|
|
3274
3411
|
catch (error) {
|
|
3275
3412
|
throw new McpAdrError(`Failed to generate ADR todo: ${error instanceof Error ? error.message : String(error)}`, 'GENERATION_ERROR');
|
|
@@ -4146,6 +4283,71 @@ Please provide:
|
|
|
4146
4283
|
/**
|
|
4147
4284
|
* Apply content masking to MCP response
|
|
4148
4285
|
*/
|
|
4286
|
+
/**
|
|
4287
|
+
* Track tool execution in knowledge graph
|
|
4288
|
+
*/
|
|
4289
|
+
async trackToolExecution(toolName, parameters, result, success, error) {
|
|
4290
|
+
try {
|
|
4291
|
+
// Extract intentId from metadata if available
|
|
4292
|
+
let intentId;
|
|
4293
|
+
if (result?.metadata?.intentId) {
|
|
4294
|
+
intentId = result.metadata.intentId;
|
|
4295
|
+
}
|
|
4296
|
+
else {
|
|
4297
|
+
// Check for active intents that might be related to this tool execution
|
|
4298
|
+
const activeIntents = await this.kgManager.getActiveIntents();
|
|
4299
|
+
if (activeIntents.length > 0) {
|
|
4300
|
+
// Use the most recent active intent
|
|
4301
|
+
const latestIntent = activeIntents[activeIntents.length - 1];
|
|
4302
|
+
if (latestIntent) {
|
|
4303
|
+
intentId = latestIntent.intentId;
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
// If no intent found, create a standalone execution record
|
|
4308
|
+
if (!intentId) {
|
|
4309
|
+
// Extract human request from conversation context if available
|
|
4310
|
+
let humanRequest = `Standalone tool execution: ${toolName}`;
|
|
4311
|
+
if (parameters?.conversationContext?.humanRequest) {
|
|
4312
|
+
humanRequest = parameters.conversationContext.humanRequest;
|
|
4313
|
+
}
|
|
4314
|
+
intentId = await this.kgManager.createIntent(humanRequest, [`Execute ${toolName}`, 'Complete tool operation'], 'medium');
|
|
4315
|
+
}
|
|
4316
|
+
// Determine tasks created/modified from tool operation
|
|
4317
|
+
const todoTasksCreated = [];
|
|
4318
|
+
const todoTasksModified = [];
|
|
4319
|
+
// Extract task information from result metadata
|
|
4320
|
+
if (result?.metadata) {
|
|
4321
|
+
if (result.metadata.tasksCreated) {
|
|
4322
|
+
todoTasksCreated.push(...result.metadata.tasksCreated);
|
|
4323
|
+
}
|
|
4324
|
+
if (result.metadata.tasksModified) {
|
|
4325
|
+
todoTasksModified.push(...result.metadata.tasksModified);
|
|
4326
|
+
}
|
|
4327
|
+
if (result.metadata.taskIds) {
|
|
4328
|
+
todoTasksModified.push(...result.metadata.taskIds);
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
// Store execution in knowledge graph
|
|
4332
|
+
await this.kgManager.addToolExecution(intentId, toolName, parameters, result, success, todoTasksCreated, todoTasksModified, error);
|
|
4333
|
+
// If execution completed successfully, update intent status
|
|
4334
|
+
if (success && !error) {
|
|
4335
|
+
// Check if this might be the final tool in a chain
|
|
4336
|
+
const intent = await this.kgManager.getIntentById(intentId);
|
|
4337
|
+
if (intent && intent.currentStatus === 'executing') {
|
|
4338
|
+
// Simple heuristic: if tool is a "completion" type tool, mark intent as completed
|
|
4339
|
+
const completionTools = ['smart_git_push', 'generate_deployment_guidance', 'smart_score'];
|
|
4340
|
+
if (completionTools.includes(toolName)) {
|
|
4341
|
+
await this.kgManager.updateIntentStatus(intentId, 'completed');
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
catch (trackingError) {
|
|
4347
|
+
// Don't let tracking errors break tool execution
|
|
4348
|
+
console.error('[WARN] Knowledge graph tracking failed:', trackingError);
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4149
4351
|
async applyOutputMasking(response) {
|
|
4150
4352
|
try {
|
|
4151
4353
|
return await maskMcpResponse(response, this.maskingConfig);
|
|
@@ -4329,13 +4531,18 @@ Please provide:
|
|
|
4329
4531
|
throw new McpAdrError(`Failed to list directory: ${error instanceof Error ? error.message : String(error)}`, 'DIRECTORY_LIST_ERROR');
|
|
4330
4532
|
}
|
|
4331
4533
|
}
|
|
4332
|
-
async
|
|
4534
|
+
async manageTodoJson(args) {
|
|
4333
4535
|
try {
|
|
4334
|
-
const {
|
|
4335
|
-
|
|
4536
|
+
const { manageTodoV2 } = await import('./tools/todo-management-tool-v2.js');
|
|
4537
|
+
// Add projectPath to args if not provided
|
|
4538
|
+
const argsWithPath = {
|
|
4539
|
+
...args,
|
|
4540
|
+
projectPath: args.projectPath || this.config.projectPath
|
|
4541
|
+
};
|
|
4542
|
+
return await manageTodoV2(argsWithPath);
|
|
4336
4543
|
}
|
|
4337
4544
|
catch (error) {
|
|
4338
|
-
throw new McpAdrError(`TODO management failed: ${error instanceof Error ? error.message : String(error)}`, '
|
|
4545
|
+
throw new McpAdrError(`JSON TODO management failed: ${error instanceof Error ? error.message : String(error)}`, 'TODO_JSON_MANAGEMENT_ERROR');
|
|
4339
4546
|
}
|
|
4340
4547
|
}
|
|
4341
4548
|
async generateDeploymentGuidance(args) {
|
|
@@ -4356,6 +4563,24 @@ Please provide:
|
|
|
4356
4563
|
throw new McpAdrError(`Smart git push failed: ${error instanceof Error ? error.message : String(error)}`, 'SMART_GIT_PUSH_ERROR');
|
|
4357
4564
|
}
|
|
4358
4565
|
}
|
|
4566
|
+
async troubleshootGuidedWorkflow(args) {
|
|
4567
|
+
try {
|
|
4568
|
+
const { troubleshootGuidedWorkflow } = await import('./tools/troubleshoot-guided-workflow-tool.js');
|
|
4569
|
+
return await troubleshootGuidedWorkflow(args);
|
|
4570
|
+
}
|
|
4571
|
+
catch (error) {
|
|
4572
|
+
throw new McpAdrError(`Troubleshoot guided workflow failed: ${error instanceof Error ? error.message : String(error)}`, 'TROUBLESHOOT_GUIDED_WORKFLOW_ERROR');
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
async smartScore(args) {
|
|
4576
|
+
try {
|
|
4577
|
+
const { smartScore } = await import('./tools/smart-score-tool.js');
|
|
4578
|
+
return await smartScore(args);
|
|
4579
|
+
}
|
|
4580
|
+
catch (error) {
|
|
4581
|
+
throw new McpAdrError(`Smart score analysis failed: ${error instanceof Error ? error.message : String(error)}`, 'SMART_SCORE_ERROR');
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4359
4584
|
}
|
|
4360
4585
|
/**
|
|
4361
4586
|
* Main execution
|