@jakkrichm/create-nexus-devflow 2.0.27 → 2.2.0

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.
Files changed (104) hide show
  1. package/README.md +29 -7
  2. package/dist/bin/create-nexus-devflow.d.ts +5 -1
  3. package/dist/bin/create-nexus-devflow.js +247 -4
  4. package/dist/bin/create-nexus-devflow.js.map +1 -1
  5. package/dist/lib/branch-context.d.ts +39 -0
  6. package/dist/lib/branch-context.js +196 -0
  7. package/dist/lib/branch-context.js.map +1 -0
  8. package/dist/lib/code-graph.d.ts +30 -0
  9. package/dist/lib/code-graph.js +209 -0
  10. package/dist/lib/code-graph.js.map +1 -0
  11. package/dist/lib/context-slicer.d.ts +31 -0
  12. package/dist/lib/context-slicer.js +234 -0
  13. package/dist/lib/context-slicer.js.map +1 -0
  14. package/dist/lib/current-work.js +4 -2
  15. package/dist/lib/current-work.js.map +1 -1
  16. package/dist/lib/dashboard-page.d.ts +1 -1
  17. package/dist/lib/dashboard-page.js +140 -56
  18. package/dist/lib/dashboard-page.js.map +1 -1
  19. package/dist/lib/dashboard-snapshot.d.ts +13 -0
  20. package/dist/lib/dashboard-snapshot.js +24 -6
  21. package/dist/lib/dashboard-snapshot.js.map +1 -1
  22. package/dist/lib/dashboard.js +38 -0
  23. package/dist/lib/dashboard.js.map +1 -1
  24. package/dist/lib/drift-reconciler.d.ts +38 -0
  25. package/dist/lib/drift-reconciler.js +155 -0
  26. package/dist/lib/drift-reconciler.js.map +1 -0
  27. package/dist/lib/gatekeeper.d.ts +1 -0
  28. package/dist/lib/gatekeeper.js +30 -1
  29. package/dist/lib/gatekeeper.js.map +1 -1
  30. package/dist/lib/git-hooks.js +41 -16
  31. package/dist/lib/git-hooks.js.map +1 -1
  32. package/dist/lib/ide-extension.d.ts +38 -0
  33. package/dist/lib/ide-extension.js +61 -0
  34. package/dist/lib/ide-extension.js.map +1 -0
  35. package/dist/lib/mcp.d.ts +36 -0
  36. package/dist/lib/mcp.js +653 -0
  37. package/dist/lib/mcp.js.map +1 -0
  38. package/dist/lib/project-metadata.d.ts +1 -1
  39. package/dist/lib/project-metadata.js +3 -2
  40. package/dist/lib/project-metadata.js.map +1 -1
  41. package/dist/lib/status.d.ts +1 -1
  42. package/dist/lib/status.js +4 -4
  43. package/dist/lib/status.js.map +1 -1
  44. package/dist/lib/swarm-orchestrator.d.ts +31 -0
  45. package/dist/lib/swarm-orchestrator.js +134 -0
  46. package/dist/lib/swarm-orchestrator.js.map +1 -0
  47. package/dist/lib/update.js +7 -3
  48. package/dist/lib/update.js.map +1 -1
  49. package/dist/lib/webview-studio.d.ts +8 -0
  50. package/dist/lib/webview-studio.js +463 -0
  51. package/dist/lib/webview-studio.js.map +1 -0
  52. package/dist/lib/workflow-state.js +24 -8
  53. package/dist/lib/workflow-state.js.map +1 -1
  54. package/package.json +1 -1
  55. package/template/.agents/skills/adopt/SKILL.md +58 -5
  56. package/template/.agents/skills/doctor/SKILL.md +23 -16
  57. package/template/.agents/skills/implement/SKILL.md +2 -2
  58. package/template/.agents/skills/onboard/SKILL.md +18 -17
  59. package/template/.agents/skills/rollback/SKILL.md +1 -1
  60. package/template/.claude/skills/00-explore/SKILL.md +2 -2
  61. package/template/.claude/skills/10-define/SKILL.md +2 -2
  62. package/template/.claude/skills/20-spec/SKILL.md +1 -2
  63. package/template/.claude/skills/30-plan/SKILL.md +1 -2
  64. package/template/.claude/skills/40-execute/SKILL.md +2 -2
  65. package/template/.claude/skills/50-verify/SKILL.md +2 -2
  66. package/template/.claude/skills/60-report/SKILL.md +2 -2
  67. package/template/.claude/skills/70-deliver/SKILL.md +2 -2
  68. package/template/.claude/skills/adopt/SKILL.md +191 -75
  69. package/template/.claude/skills/audit/SKILL.md +267 -133
  70. package/template/.claude/skills/autopilot/SKILL.md +226 -167
  71. package/template/.claude/skills/brainstorm/SKILL.md +62 -0
  72. package/template/.claude/skills/brief/SKILL.md +93 -92
  73. package/template/.claude/skills/check/SKILL.md +96 -76
  74. package/template/.claude/skills/ci/SKILL.md +140 -61
  75. package/template/.claude/skills/complete/SKILL.md +156 -101
  76. package/template/.claude/skills/convert-any-to-md/SKILL.md +2 -2
  77. package/template/.claude/skills/convert-any-to-md/references/setup.md +29 -0
  78. package/template/.claude/skills/convert-any-to-md/scripts/convert_any_to_md.py +487 -0
  79. package/template/.claude/skills/convert-any-to-md/scripts/requirements.txt +3 -0
  80. package/template/.claude/skills/debug/SKILL.md +124 -49
  81. package/template/.claude/skills/devflow/SKILL.md +9 -3
  82. package/template/.claude/skills/discovery/SKILL.md +150 -129
  83. package/template/.claude/skills/doctor/SKILL.md +195 -72
  84. package/template/.claude/skills/feature/SKILL.md +195 -151
  85. package/template/.claude/skills/fix/SKILL.md +41 -90
  86. package/template/.claude/skills/idea/SKILL.md +2 -2
  87. package/template/.claude/skills/implement/SKILL.md +189 -46
  88. package/template/.claude/skills/onboard/SKILL.md +216 -85
  89. package/template/.claude/skills/overview/SKILL.md +44 -29
  90. package/template/.claude/skills/prototype/SKILL.md +82 -27
  91. package/template/.claude/skills/release/SKILL.md +119 -130
  92. package/template/.claude/skills/report-html/SKILL.md +2 -2
  93. package/template/.claude/skills/rollback/SKILL.md +123 -77
  94. package/template/.claude/skills/status/SKILL.md +109 -0
  95. package/template/.claude/skills/test/SKILL.md +2 -2
  96. package/template/.claude/skills/tests/SKILL.md +126 -0
  97. package/template/.claude/skills/try/SKILL.md +77 -65
  98. package/template/AGENTS.md +2 -1
  99. package/template/devflow/build-plan.md +50 -20
  100. package/template/devflow/history/features/README.md +5 -0
  101. package/template/devflow/history/fixes/README.md +5 -0
  102. package/template/devflow/history/rollbacks/README.md +5 -0
  103. package/template/devflow/project-plan.md +70 -18
  104. package/template/devflow/reference/studio.html +504 -0
@@ -0,0 +1,653 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import readline from "node:readline";
4
+ import { readProjectStatus } from "./status.js";
5
+ import { resolveActiveContextPaths } from "./branch-context.js";
6
+ import { addIdea } from "./ideas.js";
7
+ import { addFinding, resolveFinding } from "./findings.js";
8
+ import { evaluateGate, formatGateReport } from "./gatekeeper.js";
9
+ import { sliceContextForStage } from "./context-slicer.js";
10
+ import { detectGitDrift, reconcileState } from "./drift-reconciler.js";
11
+ import { renderStudioHtml } from "./webview-studio.js";
12
+ import { buildCodeGraph, calculateBlastRadius } from "./code-graph.js";
13
+ import { generateSwarmPlan } from "./swarm-orchestrator.js";
14
+ const PROTOCOL_VERSION = "2024-11-05";
15
+ const SERVER_NAME = "nexus-devflow-mcp";
16
+ const SERVER_VERSION = "2.0.27";
17
+ export const DEVFLOW_MCP_TOOLS = [
18
+ {
19
+ name: "devflow_get_status",
20
+ description: "Get current project status, active living spec, next recommended action, git state, and quality blockers.",
21
+ inputSchema: {
22
+ type: "object",
23
+ properties: {}
24
+ }
25
+ },
26
+ {
27
+ name: "devflow_add_idea",
28
+ description: "Add a new idea to the centralized Idea Inbox (devflow/ideas.md) with automated feasibility and value assessment.",
29
+ inputSchema: {
30
+ type: "object",
31
+ properties: {
32
+ text: {
33
+ type: "string",
34
+ description: "Full description of the idea to capture"
35
+ },
36
+ title: {
37
+ type: "string",
38
+ description: "Optional short title for the idea"
39
+ }
40
+ },
41
+ required: ["text"]
42
+ }
43
+ },
44
+ {
45
+ name: "devflow_record_finding",
46
+ description: "Record a quality defect, security vulnerability, regression risk, or architectural debt finding to findings.md.",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ title: {
51
+ type: "string",
52
+ description: "Finding title / short description"
53
+ },
54
+ severity: {
55
+ type: "string",
56
+ enum: ["P0", "P1", "P2", "P3"],
57
+ description: "Finding severity level: P0 (Critical Blocker), P1 (High Blocker), P2 (Medium), P3 (Low / Polish)"
58
+ },
59
+ status: {
60
+ type: "string",
61
+ enum: ["open", "unverified"],
62
+ description: "Initial status (default: open)"
63
+ },
64
+ id: {
65
+ type: "string",
66
+ description: "Optional custom ID (e.g. SEC-001)"
67
+ },
68
+ location: {
69
+ type: "string",
70
+ description: "Optional file path and line location"
71
+ }
72
+ },
73
+ required: ["title"]
74
+ }
75
+ },
76
+ {
77
+ name: "devflow_resolve_finding",
78
+ description: "Update the status of an existing finding in findings.md (e.g. mark fixed, closed, accepted, or invalid).",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ id: {
83
+ type: "string",
84
+ description: "Finding ID to update (e.g. F-001 or SEC-001)"
85
+ },
86
+ status: {
87
+ type: "string",
88
+ enum: ["open", "fixed", "closed", "accepted", "invalid"],
89
+ description: "New status to set"
90
+ }
91
+ },
92
+ required: ["id", "status"]
93
+ }
94
+ },
95
+ {
96
+ name: "devflow_evaluate_gate",
97
+ description: "Run DevFlow Quality Gatekeeper evaluation (checks for unchecked tasks, blocking findings, and verification state).",
98
+ inputSchema: {
99
+ type: "object",
100
+ properties: {
101
+ strict: {
102
+ type: "boolean",
103
+ description: "When true, strictly blocks unverified living specs that need /check"
104
+ }
105
+ }
106
+ }
107
+ },
108
+ {
109
+ name: "devflow_get_context",
110
+ description: "Retrieve content of a DevFlow context document (overview, stage, standards, findings, ideas, or active spec).",
111
+ inputSchema: {
112
+ type: "object",
113
+ properties: {
114
+ document: {
115
+ type: "string",
116
+ enum: [
117
+ "overview",
118
+ "stage",
119
+ "standards",
120
+ "findings",
121
+ "ideas",
122
+ "feature",
123
+ "build-plan",
124
+ "project-plan"
125
+ ],
126
+ description: "Name of the DevFlow context document to read"
127
+ }
128
+ },
129
+ required: ["document"]
130
+ }
131
+ },
132
+ {
133
+ name: "devflow_get_sliced_context",
134
+ description: "Retrieve a JIT Stage-Aware sliced context for AI coding (reduces tokens by 60-70% by extracting only relevant rules, tasks, and constraints for the current stage).",
135
+ inputSchema: {
136
+ type: "object",
137
+ properties: {
138
+ stage: {
139
+ type: "string",
140
+ enum: ["implement", "check", "explore", "feature", "status"],
141
+ description: "Target DevFlow workflow stage"
142
+ },
143
+ maxTokens: {
144
+ type: "number",
145
+ description: "Optional maximum token budget limit"
146
+ }
147
+ },
148
+ required: ["stage"]
149
+ }
150
+ },
151
+ {
152
+ name: "devflow_detect_drift",
153
+ description: "Detect git drift between actual repository modified files and the Living Spec (identifies undocumented files and phantom files).",
154
+ inputSchema: {
155
+ type: "object",
156
+ properties: {}
157
+ }
158
+ },
159
+ {
160
+ name: "devflow_reconcile_state",
161
+ description: "Automatically reconcile and heal workspace drift (syncs undocumented files into living spec and heals stage alignment).",
162
+ inputSchema: {
163
+ type: "object",
164
+ properties: {
165
+ autoAddUndocumented: {
166
+ type: "boolean",
167
+ description: "When true, automatically adds undocumented files into current-feature.md (default: true)"
168
+ },
169
+ healStage: {
170
+ type: "boolean",
171
+ description: "When true, heals current-stage.md to match active branch (default: true)"
172
+ }
173
+ }
174
+ }
175
+ },
176
+ {
177
+ name: "devflow_get_studio_html",
178
+ description: "Retrieve a self-contained, interactive HTML/CSS/JS Webview Studio for embedding inside IDE panels (VS Code, Cursor, Antigravity) or browsers.",
179
+ inputSchema: {
180
+ type: "object",
181
+ properties: {
182
+ theme: {
183
+ type: "string",
184
+ enum: ["auto", "dark", "light"],
185
+ description: "Theme mode (default: auto)"
186
+ }
187
+ }
188
+ }
189
+ },
190
+ {
191
+ name: "devflow_swarm_plan",
192
+ description: "Generate a multi-agent specialized swarm execution plan (Coder, QA, Security, Architect) with task allocations and context requirements.",
193
+ inputSchema: {
194
+ type: "object",
195
+ properties: {}
196
+ }
197
+ },
198
+ {
199
+ name: "devflow_query_code_graph",
200
+ description: "Query the codebase semantic dependency graph to analyze imports, exports, and calculate the Blast Radius of file changes.",
201
+ inputSchema: {
202
+ type: "object",
203
+ properties: {
204
+ file: {
205
+ type: "string",
206
+ description: "Optional target file path to calculate Blast Radius and impacted dependents"
207
+ }
208
+ }
209
+ }
210
+ }
211
+ ];
212
+ export async function handleToolCall(projectRoot, name, args = {}) {
213
+ try {
214
+ switch (name) {
215
+ case "devflow_get_status": {
216
+ const status = await readProjectStatus(projectRoot);
217
+ return {
218
+ content: [
219
+ {
220
+ type: "text",
221
+ text: JSON.stringify(status, null, 2)
222
+ }
223
+ ]
224
+ };
225
+ }
226
+ case "devflow_add_idea": {
227
+ const text = typeof args.text === "string" ? args.text.trim() : "";
228
+ if (!text) {
229
+ return {
230
+ content: [{ type: "text", text: "Error: 'text' parameter is required for devflow_add_idea" }],
231
+ isError: true
232
+ };
233
+ }
234
+ const title = typeof args.title === "string" ? args.title.trim() : undefined;
235
+ const created = await addIdea(projectRoot, { text, title });
236
+ return {
237
+ content: [
238
+ {
239
+ type: "text",
240
+ text: `Idea added successfully:\n- ID: ${created.id}\n- Title: ${created.title}\n- Value: ${created.value}\n- Feasibility: ${created.feasibility}`
241
+ }
242
+ ]
243
+ };
244
+ }
245
+ case "devflow_record_finding": {
246
+ const title = typeof args.title === "string" ? args.title.trim() : "";
247
+ if (!title) {
248
+ return {
249
+ content: [{ type: "text", text: "Error: 'title' parameter is required for devflow_record_finding" }],
250
+ isError: true
251
+ };
252
+ }
253
+ const severity = typeof args.severity === "string" ? args.severity.toUpperCase() : undefined;
254
+ const status = typeof args.status === "string" ? args.status.toLowerCase() : undefined;
255
+ const id = typeof args.id === "string" ? args.id.trim() : undefined;
256
+ const location = typeof args.location === "string" ? args.location.trim() : undefined;
257
+ const result = await addFinding(projectRoot, title, {
258
+ id,
259
+ severity,
260
+ status,
261
+ location
262
+ });
263
+ if (!result.success || !result.finding) {
264
+ return {
265
+ content: [{ type: "text", text: `Failed to record finding: ${result.message}` }],
266
+ isError: true
267
+ };
268
+ }
269
+ return {
270
+ content: [
271
+ {
272
+ type: "text",
273
+ text: `Finding recorded successfully:\n- ID: ${result.finding.id}\n- Severity: [${result.finding.severity}]\n- Status: ${result.finding.status}\n- Title: ${result.finding.title}`
274
+ }
275
+ ]
276
+ };
277
+ }
278
+ case "devflow_resolve_finding": {
279
+ const id = typeof args.id === "string" ? args.id.trim() : "";
280
+ const status = typeof args.status === "string" ? args.status.toLowerCase() : undefined;
281
+ if (!id || !status) {
282
+ return {
283
+ content: [{ type: "text", text: "Error: 'id' and 'status' parameters are required for devflow_resolve_finding" }],
284
+ isError: true
285
+ };
286
+ }
287
+ const result = await resolveFinding(projectRoot, id, status);
288
+ if (!result.success || !result.finding) {
289
+ return {
290
+ content: [{ type: "text", text: result.message }],
291
+ isError: true
292
+ };
293
+ }
294
+ return {
295
+ content: [
296
+ {
297
+ type: "text",
298
+ text: `Finding ${result.finding.id} updated to status: ${result.finding.status}`
299
+ }
300
+ ]
301
+ };
302
+ }
303
+ case "devflow_evaluate_gate": {
304
+ const strict = args.strict === true;
305
+ const report = await evaluateGate(projectRoot, { strict });
306
+ const humanText = formatGateReport(report);
307
+ return {
308
+ content: [
309
+ {
310
+ type: "text",
311
+ text: `${humanText}\n\nJSON Report:\n${JSON.stringify(report, null, 2)}`
312
+ }
313
+ ],
314
+ isError: !report.passed
315
+ };
316
+ }
317
+ case "devflow_get_context": {
318
+ const doc = typeof args.document === "string" ? args.document.toLowerCase() : "";
319
+ const contextPaths = await resolveActiveContextPaths(projectRoot);
320
+ let fullPath;
321
+ switch (doc) {
322
+ case "overview":
323
+ fullPath = path.join(projectRoot, "devflow", "context", "project-overview.md");
324
+ break;
325
+ case "stage":
326
+ fullPath = contextPaths.stagePath;
327
+ break;
328
+ case "standards":
329
+ fullPath = path.join(projectRoot, "devflow", "context", "coding-standards.md");
330
+ break;
331
+ case "findings":
332
+ fullPath = contextPaths.findingsPath;
333
+ break;
334
+ case "ideas":
335
+ fullPath = path.join(projectRoot, "devflow", "ideas.md");
336
+ break;
337
+ case "feature":
338
+ fullPath = contextPaths.featureSpecPath;
339
+ break;
340
+ case "build-plan":
341
+ fullPath = path.join(projectRoot, "devflow", "build-plan.md");
342
+ break;
343
+ case "project-plan":
344
+ fullPath = path.join(projectRoot, "devflow", "project-plan.md");
345
+ break;
346
+ default:
347
+ return {
348
+ content: [{ type: "text", text: `Error: Unknown document type '${doc}'` }],
349
+ isError: true
350
+ };
351
+ }
352
+ try {
353
+ const content = await fs.readFile(fullPath, "utf8");
354
+ return {
355
+ content: [{ type: "text", text: content }]
356
+ };
357
+ }
358
+ catch {
359
+ return {
360
+ content: [{ type: "text", text: `Document '${doc}' not found or empty at ${fullPath}.` }],
361
+ isError: false
362
+ };
363
+ }
364
+ }
365
+ case "devflow_get_sliced_context": {
366
+ const stage = (typeof args.stage === "string" ? args.stage.toLowerCase() : "status");
367
+ const maxTokens = typeof args.maxTokens === "number" ? args.maxTokens : undefined;
368
+ const slice = await sliceContextForStage(projectRoot, stage, { maxTokens });
369
+ return {
370
+ content: [
371
+ {
372
+ type: "text",
373
+ text: `[JIT Context Slice - Stage: ${slice.stage}] (Tokens: ~${slice.estimatedTokens}, Saved: ${slice.reductionPercentage}%)\n\n${slice.content}`
374
+ }
375
+ ]
376
+ };
377
+ }
378
+ case "devflow_detect_drift": {
379
+ const drift = await detectGitDrift(projectRoot);
380
+ return {
381
+ content: [
382
+ {
383
+ type: "text",
384
+ text: JSON.stringify(drift, null, 2)
385
+ }
386
+ ]
387
+ };
388
+ }
389
+ case "devflow_reconcile_state": {
390
+ const autoAdd = args.autoAddUndocumented !== false;
391
+ const heal = args.healStage !== false;
392
+ const result = await reconcileState(projectRoot, {
393
+ autoAddUndocumented: autoAdd,
394
+ healStage: heal
395
+ });
396
+ return {
397
+ content: [
398
+ {
399
+ type: "text",
400
+ text: JSON.stringify(result, null, 2)
401
+ }
402
+ ]
403
+ };
404
+ }
405
+ case "devflow_get_studio_html": {
406
+ const theme = (typeof args.theme === "string" ? args.theme : "auto");
407
+ const html = await renderStudioHtml(projectRoot, { theme });
408
+ return {
409
+ content: [
410
+ {
411
+ type: "text",
412
+ text: html
413
+ }
414
+ ]
415
+ };
416
+ }
417
+ case "devflow_swarm_plan": {
418
+ const plan = await generateSwarmPlan(projectRoot);
419
+ return {
420
+ content: [
421
+ {
422
+ type: "text",
423
+ text: JSON.stringify(plan, null, 2)
424
+ }
425
+ ]
426
+ };
427
+ }
428
+ case "devflow_query_code_graph": {
429
+ const graph = await buildCodeGraph(projectRoot);
430
+ if (typeof args.file === "string" && args.file.trim().length > 0) {
431
+ const blast = calculateBlastRadius(graph, args.file.trim());
432
+ return {
433
+ content: [
434
+ {
435
+ type: "text",
436
+ text: JSON.stringify(blast, null, 2)
437
+ }
438
+ ]
439
+ };
440
+ }
441
+ return {
442
+ content: [
443
+ {
444
+ type: "text",
445
+ text: JSON.stringify({
446
+ totalFiles: graph.totalFiles,
447
+ totalEdges: graph.totalEdges,
448
+ files: Object.keys(graph.nodes)
449
+ }, null, 2)
450
+ }
451
+ ]
452
+ };
453
+ }
454
+ default:
455
+ return {
456
+ content: [{ type: "text", text: `Error: Unknown tool name '${name}'` }],
457
+ isError: true
458
+ };
459
+ }
460
+ }
461
+ catch (error) {
462
+ return {
463
+ content: [
464
+ {
465
+ type: "text",
466
+ text: `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`
467
+ }
468
+ ],
469
+ isError: true
470
+ };
471
+ }
472
+ }
473
+ export async function processMcpMessage(projectRoot, rawMessage) {
474
+ const trimmed = rawMessage.trim();
475
+ if (!trimmed)
476
+ return null;
477
+ let request;
478
+ try {
479
+ request = JSON.parse(trimmed);
480
+ }
481
+ catch {
482
+ return {
483
+ jsonrpc: "2.0",
484
+ id: null,
485
+ error: {
486
+ code: -32700,
487
+ message: "Parse error: Invalid JSON"
488
+ }
489
+ };
490
+ }
491
+ const { id = null, method, params = {} } = request;
492
+ switch (method) {
493
+ case "initialize": {
494
+ return {
495
+ jsonrpc: "2.0",
496
+ id,
497
+ result: {
498
+ protocolVersion: PROTOCOL_VERSION,
499
+ capabilities: {
500
+ tools: {},
501
+ resources: {}
502
+ },
503
+ serverInfo: {
504
+ name: SERVER_NAME,
505
+ version: SERVER_VERSION
506
+ }
507
+ }
508
+ };
509
+ }
510
+ case "notifications/initialized":
511
+ case "initialized": {
512
+ return null;
513
+ }
514
+ case "ping": {
515
+ return {
516
+ jsonrpc: "2.0",
517
+ id,
518
+ result: {}
519
+ };
520
+ }
521
+ case "tools/list": {
522
+ return {
523
+ jsonrpc: "2.0",
524
+ id,
525
+ result: {
526
+ tools: DEVFLOW_MCP_TOOLS
527
+ }
528
+ };
529
+ }
530
+ case "tools/call": {
531
+ const toolName = typeof params.name === "string" ? params.name : "";
532
+ const toolArgs = typeof params.arguments === "object" && params.arguments !== null
533
+ ? params.arguments
534
+ : {};
535
+ const result = await handleToolCall(projectRoot, toolName, toolArgs);
536
+ return {
537
+ jsonrpc: "2.0",
538
+ id,
539
+ result
540
+ };
541
+ }
542
+ case "resources/list": {
543
+ return {
544
+ jsonrpc: "2.0",
545
+ id,
546
+ result: {
547
+ resources: [
548
+ {
549
+ uri: "devflow://overview",
550
+ name: "Project Overview",
551
+ mimeType: "text/markdown",
552
+ description: "Living project overview and architecture source of truth"
553
+ },
554
+ {
555
+ uri: "devflow://current-stage",
556
+ name: "Current Stage",
557
+ mimeType: "text/markdown",
558
+ description: "Active delivery run and stage root switch"
559
+ },
560
+ {
561
+ uri: "devflow://findings",
562
+ name: "Findings Ledger",
563
+ mimeType: "text/markdown",
564
+ description: "Recorded quality and security findings"
565
+ },
566
+ {
567
+ uri: "devflow://ideas",
568
+ name: "Ideas Inbox",
569
+ mimeType: "text/markdown",
570
+ description: "Idea backlog with feasibility and value assessment"
571
+ }
572
+ ]
573
+ }
574
+ };
575
+ }
576
+ case "resources/read": {
577
+ const uri = typeof params.uri === "string" ? params.uri : "";
578
+ let targetFile = "";
579
+ if (uri === "devflow://overview")
580
+ targetFile = path.join("devflow", "context", "project-overview.md");
581
+ else if (uri === "devflow://current-stage")
582
+ targetFile = path.join("devflow", "context", "current-stage.md");
583
+ else if (uri === "devflow://findings")
584
+ targetFile = path.join("devflow", "context", "findings.md");
585
+ else if (uri === "devflow://ideas")
586
+ targetFile = path.join("devflow", "ideas.md");
587
+ if (!targetFile) {
588
+ return {
589
+ jsonrpc: "2.0",
590
+ id,
591
+ error: {
592
+ code: -32602,
593
+ message: `Invalid resource URI: ${uri}`
594
+ }
595
+ };
596
+ }
597
+ try {
598
+ const text = await fs.readFile(path.join(projectRoot, targetFile), "utf8");
599
+ return {
600
+ jsonrpc: "2.0",
601
+ id,
602
+ result: {
603
+ contents: [
604
+ {
605
+ uri,
606
+ mimeType: "text/markdown",
607
+ text
608
+ }
609
+ ]
610
+ }
611
+ };
612
+ }
613
+ catch {
614
+ return {
615
+ jsonrpc: "2.0",
616
+ id,
617
+ result: {
618
+ contents: [
619
+ {
620
+ uri,
621
+ mimeType: "text/markdown",
622
+ text: ""
623
+ }
624
+ ]
625
+ }
626
+ };
627
+ }
628
+ }
629
+ default: {
630
+ return {
631
+ jsonrpc: "2.0",
632
+ id,
633
+ error: {
634
+ code: -32601,
635
+ message: `Method not found: ${method}`
636
+ }
637
+ };
638
+ }
639
+ }
640
+ }
641
+ export function startMcpServer(projectRoot, inStream = process.stdin, outStream = process.stdout) {
642
+ const rl = readline.createInterface({
643
+ input: inStream,
644
+ terminal: false
645
+ });
646
+ rl.on("line", async (line) => {
647
+ const response = await processMcpMessage(projectRoot, line);
648
+ if (response) {
649
+ outStream.write(JSON.stringify(response) + "\n");
650
+ }
651
+ });
652
+ }
653
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../lib/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,cAAc,EAA4C,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,oBAAoB,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