smart-spec-kit-mcp 2.0.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 (51) hide show
  1. package/README.md +262 -0
  2. package/dist/engine/sessionManager.d.ts +137 -0
  3. package/dist/engine/sessionManager.d.ts.map +1 -0
  4. package/dist/engine/sessionManager.js +128 -0
  5. package/dist/engine/sessionManager.js.map +1 -0
  6. package/dist/engine/workflowEngine.d.ts +57 -0
  7. package/dist/engine/workflowEngine.d.ts.map +1 -0
  8. package/dist/engine/workflowEngine.js +400 -0
  9. package/dist/engine/workflowEngine.js.map +1 -0
  10. package/dist/index.d.ts +14 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +122 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/prompts/agents.d.ts +61 -0
  15. package/dist/prompts/agents.d.ts.map +1 -0
  16. package/dist/prompts/agents.js +236 -0
  17. package/dist/prompts/agents.js.map +1 -0
  18. package/dist/schemas/workflowSchema.d.ts +70 -0
  19. package/dist/schemas/workflowSchema.d.ts.map +1 -0
  20. package/dist/schemas/workflowSchema.js +42 -0
  21. package/dist/schemas/workflowSchema.js.map +1 -0
  22. package/dist/tools/agentTools.d.ts +11 -0
  23. package/dist/tools/agentTools.d.ts.map +1 -0
  24. package/dist/tools/agentTools.js +119 -0
  25. package/dist/tools/agentTools.js.map +1 -0
  26. package/dist/tools/orchestrationTools.d.ts +12 -0
  27. package/dist/tools/orchestrationTools.d.ts.map +1 -0
  28. package/dist/tools/orchestrationTools.js +375 -0
  29. package/dist/tools/orchestrationTools.js.map +1 -0
  30. package/dist/tools/workflowTools.d.ts +11 -0
  31. package/dist/tools/workflowTools.d.ts.map +1 -0
  32. package/dist/tools/workflowTools.js +236 -0
  33. package/dist/tools/workflowTools.js.map +1 -0
  34. package/dist/utils/markdownGenerator.d.ts +70 -0
  35. package/dist/utils/markdownGenerator.d.ts.map +1 -0
  36. package/dist/utils/markdownGenerator.js +206 -0
  37. package/dist/utils/markdownGenerator.js.map +1 -0
  38. package/dist/utils/vsCodeConfigGenerator.d.ts +32 -0
  39. package/dist/utils/vsCodeConfigGenerator.d.ts.map +1 -0
  40. package/dist/utils/vsCodeConfigGenerator.js +88 -0
  41. package/dist/utils/vsCodeConfigGenerator.js.map +1 -0
  42. package/dist/utils/workflowLoader.d.ts +99 -0
  43. package/dist/utils/workflowLoader.d.ts.map +1 -0
  44. package/dist/utils/workflowLoader.js +281 -0
  45. package/dist/utils/workflowLoader.js.map +1 -0
  46. package/package.json +61 -0
  47. package/templates/bugfix-report.md +184 -0
  48. package/templates/functional-spec.md +191 -0
  49. package/workflows/bugfix.yaml +99 -0
  50. package/workflows/feature-full.yaml +344 -0
  51. package/workflows/feature-standard.yaml +92 -0
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Orchestration Tools
3
+ *
4
+ * MCP tools for automated workflow orchestration.
5
+ * These tools drive the workflow engine and return instructions for Copilot.
6
+ */
7
+ import { z } from "zod";
8
+ import { startWorkflow, executeStep, getSessionStatus, } from "../engine/workflowEngine.js";
9
+ import { sessionStore } from "../engine/sessionManager.js";
10
+ import { listWorkflows, listWorkflowsDetailed, loadWorkflow, initLocalConfig, getConfigInfo, } from "../utils/workflowLoader.js";
11
+ /**
12
+ * Format StepResult into MCP response with auto-prompting
13
+ */
14
+ function formatStepResponse(result) {
15
+ let response = result.userMessage + "\n\n";
16
+ response += "---\n\n";
17
+ if (result.nextAction.type === "workflow_complete") {
18
+ response += "🎉 **Workflow terminĂ©!**\n\n";
19
+ }
20
+ else if (result.nextAction.type === "error") {
21
+ response += `❌ **Erreur:** ${result.nextAction.description}\n\n`;
22
+ }
23
+ else {
24
+ response += "## đŸ€– Action Suivante\n\n";
25
+ response += `**${result.nextAction.description}**\n\n`;
26
+ if (result.nextAction.requiresApproval) {
27
+ response += "⚠ *Cette action nĂ©cessite votre approbation. Tapez 'OK' ou 'Continuer' pour procĂ©der.*\n\n";
28
+ }
29
+ if (result.nextAction.copilotInstruction) {
30
+ response += "---\n\n";
31
+ response += result.nextAction.copilotInstruction;
32
+ }
33
+ if (result.nextAction.confirmationPrompt) {
34
+ response += "\n\n" + result.nextAction.confirmationPrompt;
35
+ }
36
+ }
37
+ return response;
38
+ }
39
+ /**
40
+ * Register orchestration tools on the MCP server
41
+ */
42
+ export function registerOrchestrationTools(server) {
43
+ // Tool: start_workflow - Start automated workflow execution
44
+ server.tool("start_workflow", `Démarre l'exécution automatique d'un workflow.
45
+
46
+ Le serveur prend le contrÎle et guide Copilot à travers chaque étape.
47
+ L'utilisateur n'a qu'à valider les actions proposées.
48
+
49
+ Workflows disponibles: feature-standard, feature-full, bugfix`, {
50
+ workflow_name: z.string().describe("Nom du workflow (ex: 'feature-standard', 'bugfix')"),
51
+ context_id: z.string().describe("Identifiant du contexte - généralement l'ID du work item Azure DevOps"),
52
+ }, async ({ workflow_name, context_id }) => {
53
+ try {
54
+ // Validate workflow exists
55
+ const workflows = await listWorkflows();
56
+ if (!workflows.includes(workflow_name)) {
57
+ return {
58
+ content: [{
59
+ type: "text",
60
+ text: `❌ Workflow "${workflow_name}" non trouvĂ©.\n\nWorkflows disponibles:\n${workflows.map(w => `- ${w}`).join("\n")}`,
61
+ }],
62
+ isError: true,
63
+ };
64
+ }
65
+ // Start the workflow
66
+ const result = await startWorkflow(workflow_name, context_id);
67
+ const workflow = await loadWorkflow(workflow_name);
68
+ const header = `
69
+ # 🚀 Workflow DĂ©marrĂ©: ${workflow.displayName}
70
+
71
+ **Session ID:** \`${result.sessionId}\`
72
+ **Context:** \`${context_id}\`
73
+ **Étapes:** ${workflow.steps.length}
74
+
75
+ ---
76
+
77
+ `;
78
+ return {
79
+ content: [{
80
+ type: "text",
81
+ text: header + formatStepResponse(result),
82
+ }],
83
+ };
84
+ }
85
+ catch (error) {
86
+ return {
87
+ content: [{
88
+ type: "text",
89
+ text: `❌ Erreur au dĂ©marrage: ${error instanceof Error ? error.message : String(error)}`,
90
+ }],
91
+ isError: true,
92
+ };
93
+ }
94
+ });
95
+ // Tool: execute_step - Continue workflow execution
96
+ server.tool("execute_step", `Continue l'exécution du workflow actif.
97
+
98
+ Appeler cet outil aprÚs chaque action complétée pour passer à l'étape suivante.
99
+ Fournir le résultat de l'action précédente dans 'previous_output'.`, {
100
+ session_id: z.string().optional().describe("ID de session (optionnel si une seule session active)"),
101
+ previous_output: z.string().optional().describe("Résultat de l'action précédente (JSON ou texte)"),
102
+ }, async ({ session_id, previous_output }) => {
103
+ try {
104
+ // Get session
105
+ let sessionId = session_id;
106
+ if (!sessionId) {
107
+ const active = sessionStore.getActiveSession();
108
+ if (!active) {
109
+ return {
110
+ content: [{
111
+ type: "text",
112
+ text: "❌ Aucune session active. Utilisez `start_workflow` pour dĂ©marrer.",
113
+ }],
114
+ isError: true,
115
+ };
116
+ }
117
+ sessionId = active.sessionId;
118
+ }
119
+ // Parse previous output if JSON
120
+ let parsedOutput;
121
+ if (previous_output) {
122
+ try {
123
+ parsedOutput = JSON.parse(previous_output);
124
+ }
125
+ catch {
126
+ parsedOutput = previous_output;
127
+ }
128
+ }
129
+ // Execute next step
130
+ const result = await executeStep(sessionId, parsedOutput);
131
+ return {
132
+ content: [{
133
+ type: "text",
134
+ text: formatStepResponse(result),
135
+ }],
136
+ };
137
+ }
138
+ catch (error) {
139
+ return {
140
+ content: [{
141
+ type: "text",
142
+ text: `❌ Erreur d'exĂ©cution: ${error instanceof Error ? error.message : String(error)}`,
143
+ }],
144
+ isError: true,
145
+ };
146
+ }
147
+ });
148
+ // Tool: workflow_status - Get current workflow status
149
+ server.tool("workflow_status", "Affiche le statut de la session de workflow active ou spécifiée.", {
150
+ session_id: z.string().optional().describe("ID de session (optionnel)"),
151
+ }, async ({ session_id }) => {
152
+ try {
153
+ const { session, summary } = await getSessionStatus(session_id);
154
+ if (!session) {
155
+ return {
156
+ content: [{
157
+ type: "text",
158
+ text: summary,
159
+ }],
160
+ };
161
+ }
162
+ let response = `# 📊 Statut du Workflow\n\n${summary}\n\n`;
163
+ if (session.history.length > 0) {
164
+ response += "## Historique\n\n";
165
+ for (const entry of session.history) {
166
+ const icon = entry.status === "completed" ? "✅" : entry.status === "skipped" ? "⏭" : "❌";
167
+ response += `${icon} ${entry.stepName}\n`;
168
+ }
169
+ }
170
+ if (session.pendingAction) {
171
+ response += `\n## Action en attente\n\n${session.pendingAction.instruction}`;
172
+ }
173
+ return {
174
+ content: [{
175
+ type: "text",
176
+ text: response,
177
+ }],
178
+ };
179
+ }
180
+ catch (error) {
181
+ return {
182
+ content: [{
183
+ type: "text",
184
+ text: `❌ Erreur: ${error instanceof Error ? error.message : String(error)}`,
185
+ }],
186
+ isError: true,
187
+ };
188
+ }
189
+ });
190
+ // Tool: list_workflows - List available workflows
191
+ server.tool("list_workflows", "Liste tous les workflows disponibles avec leurs descriptions.", {}, async () => {
192
+ try {
193
+ const workflowNames = await listWorkflows();
194
+ if (workflowNames.length === 0) {
195
+ return {
196
+ content: [{
197
+ type: "text",
198
+ text: "Aucun workflow trouvé dans le dossier /workflows.",
199
+ }],
200
+ };
201
+ }
202
+ let response = "# 📋 Workflows Disponibles\n\n";
203
+ for (const name of workflowNames) {
204
+ try {
205
+ const wf = await loadWorkflow(name);
206
+ response += `## ${wf.displayName}\n`;
207
+ response += `**Commande:** \`start_workflow("${name}", "<work_item_id>")\`\n\n`;
208
+ response += `${wf.description}\n\n`;
209
+ response += `**Étapes:** ${wf.steps.length}\n`;
210
+ response += `**Template:** ${wf.template}\n\n`;
211
+ response += "---\n\n";
212
+ }
213
+ catch {
214
+ response += `## ${name}\n*Erreur de chargement*\n\n---\n\n`;
215
+ }
216
+ }
217
+ return {
218
+ content: [{
219
+ type: "text",
220
+ text: response,
221
+ }],
222
+ };
223
+ }
224
+ catch (error) {
225
+ return {
226
+ content: [{
227
+ type: "text",
228
+ text: `❌ Erreur: ${error instanceof Error ? error.message : String(error)}`,
229
+ }],
230
+ isError: true,
231
+ };
232
+ }
233
+ });
234
+ // Tool: abort_workflow - Cancel active workflow
235
+ server.tool("abort_workflow", "Annule le workflow actif et nettoie la session.", {
236
+ session_id: z.string().optional().describe("ID de session Ă  annuler (optionnel)"),
237
+ }, async ({ session_id }) => {
238
+ try {
239
+ let sessionId = session_id;
240
+ if (!sessionId) {
241
+ const active = sessionStore.getActiveSession();
242
+ if (!active) {
243
+ return {
244
+ content: [{
245
+ type: "text",
246
+ text: "Aucune session active Ă  annuler.",
247
+ }],
248
+ };
249
+ }
250
+ sessionId = active.sessionId;
251
+ }
252
+ await sessionStore.delete(sessionId);
253
+ return {
254
+ content: [{
255
+ type: "text",
256
+ text: `✅ Session \`${sessionId}\` annulĂ©e et supprimĂ©e.`,
257
+ }],
258
+ };
259
+ }
260
+ catch (error) {
261
+ return {
262
+ content: [{
263
+ type: "text",
264
+ text: `❌ Erreur: ${error instanceof Error ? error.message : String(error)}`,
265
+ }],
266
+ isError: true,
267
+ };
268
+ }
269
+ });
270
+ // Tool: init - Initialize local spec-kit configuration
271
+ server.tool("init", `Initialise la configuration Spec-Kit locale dans le projet courant.
272
+
273
+ Crée le dossier .spec-kit/ avec des exemples de workflows et templates personnalisables.
274
+ Utilisez cette commande pour adapter Spec-Kit Ă  votre stack technique.`, {}, async () => {
275
+ try {
276
+ await initLocalConfig();
277
+ const config = getConfigInfo();
278
+ const response = `# ✅ Spec-Kit initialisĂ©!
279
+
280
+ ## Configuration créée
281
+
282
+ 📁 \`.spec-kit/\`
283
+ ├── 📁 \`workflows/\` - Vos workflows personnalisĂ©s
284
+ │ └── 📄 \`custom-feature.yaml\` - Exemple de workflow
285
+ └── 📁 \`templates/\` - Vos templates personnalisĂ©s
286
+ └── 📄 \`custom-spec.md\` - Exemple de template
287
+
288
+ ## Résolution des assets
289
+
290
+ Les workflows/templates sont recherchés dans cet ordre:
291
+ 1. **Local**: \`.spec-kit/workflows/\` et \`.spec-kit/templates/\`
292
+ 2. **Package**: Workflows par défaut (feature-standard, bugfix, etc.)
293
+
294
+ ## Prochaines étapes
295
+
296
+ 1. Éditez \`.spec-kit/workflows/custom-feature.yaml\` selon votre stack
297
+ 2. Personnalisez \`.spec-kit/templates/custom-spec.md\`
298
+ 3. Lancez: \`start_workflow workflow_name="custom-feature" context_id="TEST"\`
299
+
300
+ ## Chemins de recherche actuels
301
+
302
+ - **Projet**: \`${config.projectRoot}\`
303
+ - **Package**: \`${config.packageRoot}\`
304
+ `;
305
+ return {
306
+ content: [{
307
+ type: "text",
308
+ text: response,
309
+ }],
310
+ };
311
+ }
312
+ catch (error) {
313
+ return {
314
+ content: [{
315
+ type: "text",
316
+ text: `❌ Erreur: ${error instanceof Error ? error.message : String(error)}`,
317
+ }],
318
+ isError: true,
319
+ };
320
+ }
321
+ });
322
+ // Tool: config - Show current configuration
323
+ server.tool("config", "Affiche la configuration actuelle de Spec-Kit et les chemins de recherche.", {}, async () => {
324
+ try {
325
+ const config = getConfigInfo();
326
+ const workflows = await listWorkflowsDetailed();
327
+ let workflowList = "";
328
+ for (const w of workflows) {
329
+ const icon = w.source === "local" ? "📍" : "📩";
330
+ workflowList += `- ${icon} \`${w.name}\` (${w.source})\n`;
331
+ }
332
+ const response = `# ⚙ Configuration Spec-Kit
333
+
334
+ ## Chemins
335
+
336
+ | Type | Chemin |
337
+ |------|--------|
338
+ | Projet courant | \`${config.projectRoot}\` |
339
+ | Package Spec-Kit | \`${config.packageRoot}\` |
340
+
341
+ ## Recherche des workflows
342
+
343
+ ${config.searchPaths.workflows.map((p, i) => `${i + 1}. \`${p}\``).join("\n")}
344
+
345
+ ## Recherche des templates
346
+
347
+ ${config.searchPaths.templates.map((p, i) => `${i + 1}. \`${p}\``).join("\n")}
348
+
349
+ ## Workflows disponibles
350
+
351
+ ${workflowList || "Aucun workflow trouvé"}
352
+
353
+ ## Légende
354
+ - 📍 Local (override)
355
+ - 📩 Package (dĂ©faut)
356
+ `;
357
+ return {
358
+ content: [{
359
+ type: "text",
360
+ text: response,
361
+ }],
362
+ };
363
+ }
364
+ catch (error) {
365
+ return {
366
+ content: [{
367
+ type: "text",
368
+ text: `❌ Erreur: ${error instanceof Error ? error.message : String(error)}`,
369
+ }],
370
+ isError: true,
371
+ };
372
+ }
373
+ });
374
+ }
375
+ //# sourceMappingURL=orchestrationTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrationTools.js","sourceRoot":"","sources":["../../src/tools/orchestrationTools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,aAAa,GACd,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAA+C;IACzE,IAAI,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;IAE3C,QAAQ,IAAI,SAAS,CAAC;IAEtB,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACnD,QAAQ,IAAI,8BAA8B,CAAC;IAC7C,CAAC;SAAM,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9C,QAAQ,IAAI,iBAAiB,MAAM,CAAC,UAAU,CAAC,WAAW,MAAM,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,QAAQ,IAAI,2BAA2B,CAAC;QACxC,QAAQ,IAAI,KAAK,MAAM,CAAC,UAAU,CAAC,WAAW,QAAQ,CAAC;QAEvD,IAAI,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;YACvC,QAAQ,IAAI,6FAA6F,CAAC;QAC5G,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC;YACzC,QAAQ,IAAI,SAAS,CAAC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CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;EAI3E,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;EAI3E,YAAY,IAAI,uBAAuB;;;;;CAKxC,CAAC;YAEM,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,QAAQ;qBACf,CAAC;aACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,aAAa,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC5E,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Workflow Tools
3
+ *
4
+ * MCP tools for managing and executing workflows
5
+ */
6
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
+ /**
8
+ * Register workflow-related tools on the MCP server
9
+ */
10
+ export declare function registerWorkflowTools(server: McpServer): void;
11
+ //# sourceMappingURL=workflowTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowTools.d.ts","sourceRoot":"","sources":["../../src/tools/workflowTools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAwIzE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAgJ7D"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Workflow Tools
3
+ *
4
+ * MCP tools for managing and executing workflows
5
+ */
6
+ import { z } from "zod";
7
+ import { listWorkflows, loadWorkflow, loadWorkflowWithTemplate, getNextStep, } from "../utils/workflowLoader.js";
8
+ /**
9
+ * Format a workflow step as instructions for Copilot
10
+ */
11
+ function formatStepInstructions(workflow, stepIndex, contextId, template) {
12
+ const step = workflow.steps[stepIndex];
13
+ if (!step) {
14
+ return `✅ Workflow "${workflow.displayName}" completed for context: ${contextId}`;
15
+ }
16
+ const totalSteps = workflow.steps.length;
17
+ const progress = `[Step ${stepIndex + 1}/${totalSteps}]`;
18
+ let instructions = `
19
+ ## 🔄 Workflow: ${workflow.displayName}
20
+ ### ${progress} ${step.name}
21
+
22
+ **Context ID:** \`${contextId}\`
23
+ **Agent:** ${step.agent ?? workflow.defaultAgent}
24
+
25
+ ---
26
+
27
+ ### 📋 Instructions
28
+
29
+ ${step.description}
30
+
31
+ `;
32
+ // Add action-specific guidance
33
+ switch (step.action) {
34
+ case "fetch_ado":
35
+ instructions += `
36
+ ### 🔧 Action Required: Fetch from Azure DevOps
37
+
38
+ Use the **Azure DevOps MCP server** to retrieve the work item:
39
+
40
+ \`\`\`
41
+ Call: azure-devops → get_work_item
42
+ Parameters: { "id": "${contextId}" }
43
+ \`\`\`
44
+
45
+ After fetching, proceed with the next step.
46
+ `;
47
+ break;
48
+ case "generate_content":
49
+ instructions += `
50
+ ### 🔧 Action Required: Generate Content
51
+
52
+ Use the fetched data to generate the specification content.
53
+ ${template ? "\n**Template structure to follow:**\n\n```markdown\n" + template.slice(0, 500) + "\n...\n```\n" : ""}
54
+
55
+ Fill in the sections based on the Azure DevOps work item data.
56
+ Mark sections requiring human input with \`[TO FILL]\`.
57
+ `;
58
+ break;
59
+ case "review":
60
+ instructions += `
61
+ ### 🔧 Action Required: Review
62
+
63
+ Review the generated content for:
64
+ - Completeness
65
+ - Technical accuracy
66
+ - Alignment with requirements
67
+
68
+ Suggest improvements if needed.
69
+ `;
70
+ break;
71
+ case "create_file":
72
+ instructions += `
73
+ ### 🔧 Action Required: Create File
74
+
75
+ Create the specification file with the generated content.
76
+ Suggested filename: \`specs/${contextId}-spec.md\`
77
+ `;
78
+ break;
79
+ case "call_agent":
80
+ instructions += `
81
+ ### 🔧 Action Required: Call Agent
82
+
83
+ Invoke the **${step.agent ?? workflow.defaultAgent}** agent for specialized processing.
84
+ `;
85
+ break;
86
+ }
87
+ // Add inputs if defined
88
+ if (step.inputs && Object.keys(step.inputs).length > 0) {
89
+ instructions += `
90
+ ### đŸ“„ Inputs
91
+ ${Object.entries(step.inputs).map(([k, v]) => `- **${k}:** ${v}`).join("\n")}
92
+ `;
93
+ }
94
+ // Add expected outputs if defined
95
+ if (step.outputs && step.outputs.length > 0) {
96
+ instructions += `
97
+ ### đŸ“€ Expected Outputs
98
+ ${step.outputs.map((o) => `- ${o}`).join("\n")}
99
+ `;
100
+ }
101
+ // Navigation hint
102
+ const nextStep = getNextStep(workflow, step.id);
103
+ if (nextStep) {
104
+ instructions += `
105
+ ---
106
+ ⏭ **Next Step:** ${nextStep.name}
107
+ When ready, call \`advance_workflow\` with step_id: \`${nextStep.id}\`
108
+ `;
109
+ }
110
+ else {
111
+ instructions += `
112
+ ---
113
+ ✅ **This is the final step.** Complete the action to finish the workflow.
114
+ `;
115
+ }
116
+ return instructions;
117
+ }
118
+ /**
119
+ * Register workflow-related tools on the MCP server
120
+ */
121
+ export function registerWorkflowTools(server) {
122
+ // Tool: list_workflows - List all available workflows
123
+ server.tool("list_workflows", "List all available workflow definitions. Use this to discover what workflows can be started.", {}, async () => {
124
+ const workflows = await listWorkflows();
125
+ if (workflows.length === 0) {
126
+ return {
127
+ content: [{
128
+ type: "text",
129
+ text: "No workflows found. Create YAML files in the /workflows directory.",
130
+ }],
131
+ };
132
+ }
133
+ // Load details for each workflow
134
+ const details = await Promise.all(workflows.map(async (name) => {
135
+ try {
136
+ const wf = await loadWorkflow(name);
137
+ return {
138
+ name,
139
+ displayName: wf.displayName,
140
+ description: wf.description,
141
+ steps: wf.steps.length,
142
+ template: wf.template,
143
+ };
144
+ }
145
+ catch {
146
+ return { name, error: "Failed to load" };
147
+ }
148
+ }));
149
+ return {
150
+ content: [{
151
+ type: "text",
152
+ text: JSON.stringify({ workflows: details }, null, 2),
153
+ }],
154
+ };
155
+ });
156
+ // Tool: start_workflow - Start a workflow execution
157
+ server.tool("start_workflow", "Start a new workflow execution. Returns structured instructions for the first step.", {
158
+ workflow_name: z.string().describe("Name of the workflow to start (e.g., 'feature-standard')"),
159
+ context_id: z.string().describe("Context identifier, typically the Azure DevOps Work Item ID"),
160
+ }, async ({ workflow_name, context_id }) => {
161
+ try {
162
+ const { workflow, template } = await loadWorkflowWithTemplate(workflow_name);
163
+ const instructions = formatStepInstructions(workflow, 0, context_id, template);
164
+ return {
165
+ content: [{
166
+ type: "text",
167
+ text: instructions,
168
+ }],
169
+ };
170
+ }
171
+ catch (error) {
172
+ return {
173
+ content: [{
174
+ type: "text",
175
+ text: `❌ Error starting workflow: ${error instanceof Error ? error.message : String(error)}`,
176
+ }],
177
+ isError: true,
178
+ };
179
+ }
180
+ });
181
+ // Tool: advance_workflow - Move to the next step
182
+ server.tool("advance_workflow", "Advance to a specific step in the workflow. Use after completing the current step.", {
183
+ workflow_name: z.string().describe("Name of the active workflow"),
184
+ context_id: z.string().describe("Context identifier (Work Item ID)"),
185
+ step_id: z.string().describe("ID of the step to advance to"),
186
+ }, async ({ workflow_name, context_id, step_id }) => {
187
+ try {
188
+ const { workflow, template } = await loadWorkflowWithTemplate(workflow_name);
189
+ const stepIndex = workflow.steps.findIndex((s) => s.id === step_id);
190
+ if (stepIndex === -1) {
191
+ const validIds = workflow.steps.map((s) => s.id).join(", ");
192
+ throw new Error(`Step "${step_id}" not found. Valid step IDs: ${validIds}`);
193
+ }
194
+ const instructions = formatStepInstructions(workflow, stepIndex, context_id, template);
195
+ return {
196
+ content: [{
197
+ type: "text",
198
+ text: instructions,
199
+ }],
200
+ };
201
+ }
202
+ catch (error) {
203
+ return {
204
+ content: [{
205
+ type: "text",
206
+ text: `❌ Error advancing workflow: ${error instanceof Error ? error.message : String(error)}`,
207
+ }],
208
+ isError: true,
209
+ };
210
+ }
211
+ });
212
+ // Tool: get_template - Get a raw template content
213
+ server.tool("get_template", "Retrieve the raw content of a specification template.", {
214
+ workflow_name: z.string().describe("Name of the workflow to get template for"),
215
+ }, async ({ workflow_name }) => {
216
+ try {
217
+ const { workflow, template } = await loadWorkflowWithTemplate(workflow_name);
218
+ return {
219
+ content: [{
220
+ type: "text",
221
+ text: `# Template: ${workflow.template}\n\n${template}`,
222
+ }],
223
+ };
224
+ }
225
+ catch (error) {
226
+ return {
227
+ content: [{
228
+ type: "text",
229
+ text: `❌ Error loading template: ${error instanceof Error ? error.message : String(error)}`,
230
+ }],
231
+ isError: true,
232
+ };
233
+ }
234
+ });
235
+ }
236
+ //# sourceMappingURL=workflowTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowTools.js","sourceRoot":"","sources":["../../src/tools/workflowTools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,WAAW,GAEZ,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,SAAS,sBAAsB,CAC7B,QAAkB,EAClB,SAAiB,EACjB,SAAiB,EACjB,QAAiB;IAEjB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,eAAe,QAAQ,CAAC,WAAW,4BAA4B,SAAS,EAAE,CAAC;IACpF,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,QAAQ,GAAG,SAAS,SAA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