@codemcp/workflows 5.0.1 → 5.1.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 (77) hide show
  1. package/SKILL.md +23 -0
  2. package/package.json +6 -2
  3. package/.prettierignore +0 -2
  4. package/.turbo/turbo-build.log +0 -4
  5. package/.vibe/conversation-state.sqlite +0 -0
  6. package/src/components/beads/beads-instruction-generator.ts +0 -230
  7. package/src/components/beads/beads-plan-manager.ts +0 -333
  8. package/src/components/beads/beads-task-backend-client.ts +0 -229
  9. package/src/index.ts +0 -93
  10. package/src/notification-service.ts +0 -23
  11. package/src/plugin-system/beads-plugin.ts +0 -649
  12. package/src/plugin-system/commit-plugin.ts +0 -252
  13. package/src/plugin-system/index.ts +0 -20
  14. package/src/plugin-system/plugin-interfaces.ts +0 -153
  15. package/src/plugin-system/plugin-registry.ts +0 -190
  16. package/src/resource-handlers/conversation-state.ts +0 -55
  17. package/src/resource-handlers/development-plan.ts +0 -48
  18. package/src/resource-handlers/index.ts +0 -73
  19. package/src/resource-handlers/system-prompt.ts +0 -55
  20. package/src/resource-handlers/workflow-resource.ts +0 -132
  21. package/src/response-renderer.ts +0 -116
  22. package/src/server-config.ts +0 -760
  23. package/src/server-helpers.ts +0 -245
  24. package/src/server-implementation.ts +0 -277
  25. package/src/server.ts +0 -9
  26. package/src/tool-handlers/base-tool-handler.ts +0 -151
  27. package/src/tool-handlers/conduct-review.ts +0 -190
  28. package/src/tool-handlers/get-tool-info.ts +0 -273
  29. package/src/tool-handlers/index.ts +0 -115
  30. package/src/tool-handlers/list-workflows.ts +0 -78
  31. package/src/tool-handlers/no-idea.ts +0 -47
  32. package/src/tool-handlers/proceed-to-phase.ts +0 -296
  33. package/src/tool-handlers/reset-development.ts +0 -90
  34. package/src/tool-handlers/resume-workflow.ts +0 -378
  35. package/src/tool-handlers/setup-project-docs.ts +0 -232
  36. package/src/tool-handlers/start-development.ts +0 -746
  37. package/src/tool-handlers/whats-next.ts +0 -246
  38. package/src/types.ts +0 -135
  39. package/src/version-info.ts +0 -213
  40. package/test/e2e/beads-plugin-integration.test.ts +0 -1623
  41. package/test/e2e/commit-plugin-integration.test.ts +0 -222
  42. package/test/e2e/core-functionality.test.ts +0 -167
  43. package/test/e2e/git-branch-detection.test.ts +0 -351
  44. package/test/e2e/mcp-contract.test.ts +0 -509
  45. package/test/e2e/plan-management.test.ts +0 -334
  46. package/test/e2e/plugin-system-integration.test.ts +0 -1410
  47. package/test/e2e/state-management.test.ts +0 -387
  48. package/test/e2e/workflow-integration.test.ts +0 -498
  49. package/test/unit/beads-instruction-generator.test.ts +0 -979
  50. package/test/unit/beads-phase-task-id-integration.test.ts +0 -535
  51. package/test/unit/beads-plugin-behavioral.test.ts +0 -545
  52. package/test/unit/beads-plugin.test.ts +0 -117
  53. package/test/unit/commit-plugin.test.ts +0 -196
  54. package/test/unit/conduct-review.test.ts +0 -151
  55. package/test/unit/conversation-not-found-error.test.ts +0 -120
  56. package/test/unit/plugin-error-handling.test.ts +0 -240
  57. package/test/unit/proceed-to-phase-plugin-integration.test.ts +0 -150
  58. package/test/unit/reset-functionality.test.ts +0 -72
  59. package/test/unit/resume-workflow.test.ts +0 -193
  60. package/test/unit/server-config-plugin-registry.test.ts +0 -99
  61. package/test/unit/server-tools.test.ts +0 -310
  62. package/test/unit/setup-project-docs-handler.test.ts +0 -268
  63. package/test/unit/start-development-artifact-detection.test.ts +0 -387
  64. package/test/unit/start-development-gitignore.test.ts +0 -178
  65. package/test/unit/start-development-goal-extraction.test.ts +0 -226
  66. package/test/unit/system-prompt-resource.test.ts +0 -102
  67. package/test/unit/tool-handlers/no-idea.test.ts +0 -40
  68. package/test/utils/e2e-test-setup.ts +0 -451
  69. package/test/utils/run-server-in-dir.sh +0 -27
  70. package/test/utils/temp-files.ts +0 -320
  71. package/test/utils/test-access.ts +0 -79
  72. package/test/utils/test-helpers.ts +0 -288
  73. package/test/utils/test-setup.ts +0 -77
  74. package/tsconfig.build.json +0 -10
  75. package/tsconfig.build.tsbuildinfo +0 -1
  76. package/tsconfig.json +0 -12
  77. package/vitest.config.ts +0 -19
@@ -1,190 +0,0 @@
1
- /**
2
- * ConductReview Tool Handler
3
- *
4
- * Handles review requests before phase transitions. Adapts to MCP environment
5
- * capabilities - returns automated review results if sampling available,
6
- * otherwise returns instructions for LLM to conduct guided review.
7
- */
8
-
9
- import { ConversationRequiredToolHandler } from './base-tool-handler.js';
10
- import { validateRequiredArgs } from '../server-helpers.js';
11
- import type { ConversationContext } from '@codemcp/workflows-core';
12
- import type { YamlTransition } from '@codemcp/workflows-core';
13
- import { ServerContext } from '../types.js';
14
-
15
- /**
16
- * Arguments for the conduct_review tool
17
- */
18
- export interface ConductReviewArgs {
19
- target_phase: string;
20
- }
21
-
22
- /**
23
- * Response from the conduct_review tool
24
- */
25
- export interface ConductReviewResult {
26
- instructions: string;
27
- perspectives: Array<{
28
- name: string;
29
- prompt: string;
30
- }>;
31
- }
32
-
33
- /**
34
- * ConductReview tool handler implementation
35
- */
36
- export class ConductReviewHandler extends ConversationRequiredToolHandler<
37
- ConductReviewArgs,
38
- ConductReviewResult
39
- > {
40
- protected async executeWithConversation(
41
- args: ConductReviewArgs,
42
- context: ServerContext,
43
- conversationContext: ConversationContext
44
- ): Promise<ConductReviewResult> {
45
- // Validate required arguments
46
- validateRequiredArgs(args, ['target_phase']);
47
-
48
- const { target_phase } = args;
49
- const currentPhase = conversationContext.currentPhase;
50
- const conversationId = conversationContext.conversationId;
51
-
52
- this.logger.debug('Processing conduct_review request', {
53
- conversationId,
54
- currentPhase,
55
- targetPhase: target_phase,
56
- });
57
-
58
- // Ensure state machine is loaded for this project
59
- this.ensureStateMachineForProject(context, conversationContext.projectPath);
60
-
61
- // Get transition configuration from workflow
62
- const transition = this.getTransitionConfig(
63
- currentPhase,
64
- target_phase,
65
- conversationContext.workflowName,
66
- context
67
- );
68
-
69
- if (
70
- !transition.review_perspectives ||
71
- transition.review_perspectives.length === 0
72
- ) {
73
- throw new Error(
74
- `No review perspectives defined for transition from ${currentPhase} to ${target_phase}`
75
- );
76
- }
77
-
78
- // Check if MCP environment supports sampling (LLM interaction tools)
79
- const hasSamplingCapability = await this.checkSamplingCapability(context);
80
-
81
- if (hasSamplingCapability) {
82
- // Conduct automated review using available LLM tools
83
- return await this.conductAutomatedReview(
84
- transition.review_perspectives,
85
- conversationContext
86
- );
87
- } else {
88
- // Generate instructions for LLM to conduct review
89
- return await this.generateReviewInstructions(
90
- transition.review_perspectives,
91
- currentPhase,
92
- target_phase
93
- );
94
- }
95
- }
96
-
97
- /**
98
- * Get transition configuration from workflow
99
- */
100
- private getTransitionConfig(
101
- currentPhase: string,
102
- targetPhase: string,
103
- workflowName: string,
104
- context: ServerContext
105
- ) {
106
- const stateMachine = context.workflowManager.loadWorkflowForProject(
107
- context.projectPath,
108
- workflowName
109
- );
110
- const currentState = stateMachine.states[currentPhase];
111
-
112
- if (!currentState) {
113
- throw new Error(`Invalid current phase: ${currentPhase}`);
114
- }
115
-
116
- const transition = currentState.transitions.find(
117
- (t: YamlTransition) => t.to === targetPhase
118
- );
119
- if (!transition) {
120
- throw new Error(
121
- `No transition found from ${currentPhase} to ${targetPhase}`
122
- );
123
- }
124
-
125
- return transition;
126
- }
127
-
128
- /**
129
- * Check if MCP environment supports sampling capabilities
130
- */
131
- private async checkSamplingCapability(
132
- _context: ServerContext
133
- ): Promise<boolean> {
134
- // For now, assume non-sampling (most common case)
135
- // In the future, this could check for specific LLM interaction tools
136
- return false;
137
- }
138
-
139
- /**
140
- * Conduct automated review using LLM tools (when sampling is available)
141
- */
142
- private async conductAutomatedReview(
143
- perspectives: Array<{ perspective: string; prompt: string }>,
144
- conversationContext: ConversationContext
145
- ): Promise<ConductReviewResult> {
146
- // Falls back to guided instructions until automated review is implemented
147
- return this.generateReviewInstructions(
148
- perspectives,
149
- conversationContext.currentPhase,
150
- 'target'
151
- );
152
- }
153
-
154
- /**
155
- * Generate instructions for LLM to conduct guided review
156
- */
157
- private async generateReviewInstructions(
158
- perspectives: Array<{ perspective: string; prompt: string }>,
159
- currentPhase: string,
160
- targetPhase: string
161
- ): Promise<ConductReviewResult> {
162
- const instructions = `Conduct a review of the ${currentPhase} phase before proceeding to ${targetPhase}.
163
-
164
- First, identify the artifacts and decisions from the ${currentPhase} phase by:
165
- 1. Reviewing the plan file to see completed tasks and key decisions
166
- 2. Using git status/diff to see what files were changed (if in a git repository)
167
- 3. Analyzing recent conversation history for important decisions
168
-
169
- Then, for each perspective below, analyze these artifacts and provide feedback:
170
-
171
- ${perspectives
172
- .map(
173
- (p, i) => `**${i + 1}. ${p.perspective.toUpperCase()} PERSPECTIVE:**
174
- ${p.prompt}
175
-
176
- `
177
- )
178
- .join('')}
179
-
180
- After completing all perspective reviews, summarize your findings and ask the user if they're ready to proceed to the ${targetPhase} phase.`;
181
-
182
- return {
183
- instructions,
184
- perspectives: perspectives.map(p => ({
185
- name: p.perspective,
186
- prompt: p.prompt,
187
- })),
188
- };
189
- }
190
- }
@@ -1,273 +0,0 @@
1
- /**
2
- * Get Tool Info Handler
3
- *
4
- * Provides comprehensive information about the responsible-vibe-mcp development
5
- * workflow tools for better tool discoverability and AI integration.
6
- */
7
-
8
- import { z } from 'zod';
9
- import { BaseToolHandler } from './base-tool-handler.js';
10
- import { createLogger } from '@codemcp/workflows-core';
11
- import { ServerContext } from '../types.js';
12
- import { getFormattedVersion } from '../version-info.js';
13
-
14
- const logger = createLogger('GetToolInfoHandler');
15
-
16
- /**
17
- * Schema for get_tool_info tool arguments
18
- */
19
- const GetToolInfoArgsSchema = z.object({
20
- // No input parameters needed
21
- });
22
-
23
- type GetToolInfoArgs = z.infer<typeof GetToolInfoArgsSchema>;
24
-
25
- /**
26
- * Tool information structure
27
- */
28
- interface ToolInfo {
29
- name: string;
30
- description: string;
31
- parameters: string[];
32
- schema?: {
33
- required: string[];
34
- optional: string[];
35
- };
36
- }
37
-
38
- /**
39
- * Workflow information structure
40
- */
41
- interface WorkflowInfo {
42
- name: string;
43
- displayName: string;
44
- description: string;
45
- phases?: string[];
46
- }
47
-
48
- /**
49
- * Complete tool information response
50
- */
51
- interface GetToolInfoResponse {
52
- tool_name: string;
53
- version: string;
54
- purpose: string;
55
- description: string;
56
-
57
- available_tools: ToolInfo[];
58
- available_workflows: WorkflowInfo[];
59
-
60
- core_concepts: {
61
- phase_management: string;
62
- plan_file_tracking: string;
63
- conversation_context: string;
64
- workflow_guidance: string;
65
- };
66
-
67
- usage_guidelines: {
68
- required_pattern: string;
69
- phase_transitions: string;
70
- context_requirements: string;
71
- plan_file_management: string;
72
- };
73
-
74
- workflow_states?: {
75
- current_phase?: string;
76
- plan_file_path?: string;
77
- };
78
- }
79
-
80
- /**
81
- * Tool handler for providing comprehensive tool information
82
- */
83
- export class GetToolInfoHandler extends BaseToolHandler<
84
- GetToolInfoArgs,
85
- GetToolInfoResponse
86
- > {
87
- protected readonly argsSchema = GetToolInfoArgsSchema;
88
-
89
- async executeHandler(
90
- _args: GetToolInfoArgs,
91
- context: ServerContext
92
- ): Promise<GetToolInfoResponse> {
93
- logger.info('Generating comprehensive tool information', {
94
- projectPath: context.projectPath,
95
- });
96
-
97
- // Get available workflows
98
- const availableWorkflows =
99
- context.workflowManager.getAvailableWorkflowsForProject(
100
- context.projectPath
101
- );
102
-
103
- // Transform workflows to response format
104
- const workflows: WorkflowInfo[] = availableWorkflows.map(workflow => ({
105
- name: workflow.name,
106
- displayName: workflow.displayName,
107
- description: workflow.description,
108
- phases: this.extractWorkflowPhases(workflow),
109
- }));
110
-
111
- // Define available tools with their information
112
- const tools: ToolInfo[] = [
113
- {
114
- name: 'start_development',
115
- description:
116
- 'Initialize new development project with structured workflow',
117
- parameters: ['workflow', 'commit_behaviour'],
118
- schema: {
119
- required: ['commit_behaviour'],
120
- optional: ['workflow'],
121
- },
122
- },
123
- {
124
- name: 'whats_next',
125
- description:
126
- 'Get phase-specific instructions and guidance for current development state',
127
- parameters: [
128
- 'context',
129
- 'user_input',
130
- 'conversation_summary',
131
- 'recent_messages',
132
- ],
133
- schema: {
134
- required: ['context', 'user_input'],
135
- optional: ['conversation_summary', 'recent_messages'],
136
- },
137
- },
138
- {
139
- name: 'proceed_to_phase',
140
- description:
141
- 'Transition to the next development phase when current phase is complete',
142
- parameters: ['target_phase', 'reason'],
143
- schema: {
144
- required: ['target_phase'],
145
- optional: ['reason'],
146
- },
147
- },
148
- {
149
- name: 'resume_workflow',
150
- description:
151
- 'Continue development after a break or conversation restart',
152
- parameters: ['include_system_prompt'],
153
- schema: {
154
- required: [],
155
- optional: ['include_system_prompt'],
156
- },
157
- },
158
- {
159
- name: 'reset_development',
160
- description:
161
- 'Start over with a clean slate by deleting all development progress',
162
- parameters: ['confirm', 'reason'],
163
- schema: {
164
- required: ['confirm'],
165
- optional: ['reason'],
166
- },
167
- },
168
- {
169
- name: 'list_workflows',
170
- description:
171
- 'Get an overview of available workflows (respecting domain filtering)',
172
- parameters: [],
173
- schema: {
174
- required: [],
175
- optional: [],
176
- },
177
- },
178
- {
179
- name: 'get_tool_info',
180
- description:
181
- 'Get comprehensive information about all available tools and workflows',
182
- parameters: [],
183
- schema: {
184
- required: [],
185
- optional: [],
186
- },
187
- },
188
- ];
189
-
190
- // Try to get current workflow state if available
191
- let workflowState: GetToolInfoResponse['workflow_states'] = undefined;
192
- try {
193
- const conversationContext =
194
- await context.conversationManager.getConversationContext();
195
- workflowState = {
196
- current_phase: conversationContext.currentPhase,
197
- plan_file_path: conversationContext.planFilePath,
198
- };
199
- } catch (error) {
200
- // No active conversation - this is fine
201
- logger.debug('No active conversation found for workflow state', {
202
- error,
203
- });
204
- }
205
-
206
- // Build the complete response
207
- const response: GetToolInfoResponse = {
208
- tool_name: 'Responsible Vibe MCP - Development Workflow Management',
209
- version: getFormattedVersion(),
210
- purpose:
211
- 'Structured development workflows with guided phase transitions and conversation state management',
212
- description:
213
- 'A Model Context Protocol server that acts as an intelligent conversation state manager and development guide for LLMs, providing structured workflows for various development tasks including bug fixes, features, architecture documentation, and more.',
214
-
215
- available_tools: tools,
216
- available_workflows: workflows,
217
-
218
- core_concepts: {
219
- phase_management:
220
- 'Structured progression through development phases with entrance criteria and transition conditions',
221
- plan_file_tracking:
222
- 'Maintains development state and progress in .vibe/development-plan-*.md files with task tracking',
223
- conversation_context:
224
- 'Stateless operation requiring context in each whats_next() call for proper guidance',
225
- workflow_guidance:
226
- 'Provides phase-specific instructions and recommendations based on current development state',
227
- },
228
-
229
- usage_guidelines: {
230
- required_pattern:
231
- 'Always call whats_next() after user interactions to get context-appropriate guidance',
232
- phase_transitions:
233
- 'Only proceed to next phase when entrance criteria are met and current phase tasks are complete',
234
- context_requirements:
235
- 'Provide conversation history and context in whats_next() calls for optimal guidance',
236
- plan_file_management:
237
- 'Update plan file with completed tasks [x] and add new tasks as they are identified',
238
- },
239
- };
240
-
241
- // Add workflow state if available
242
- if (workflowState) {
243
- response.workflow_states = workflowState;
244
- }
245
-
246
- logger.info('Successfully generated tool information', {
247
- toolCount: tools.length,
248
- workflowCount: workflows.length,
249
- hasWorkflowState: !!workflowState,
250
- });
251
-
252
- return response;
253
- }
254
-
255
- /**
256
- * Extract phase names from a workflow configuration
257
- */
258
- private extractWorkflowPhases(workflowInfo: unknown): string[] | undefined {
259
- if (
260
- workflowInfo &&
261
- typeof workflowInfo === 'object' &&
262
- 'states' in workflowInfo &&
263
- workflowInfo.states &&
264
- typeof workflowInfo.states === 'object'
265
- ) {
266
- return Object.keys(workflowInfo.states);
267
- }
268
- return undefined;
269
- }
270
- }
271
-
272
- // Export type for external use
273
- export type { GetToolInfoArgs, GetToolInfoResponse };
@@ -1,115 +0,0 @@
1
- /**
2
- * Tool Handler Registry
3
- *
4
- * Central registry for all tool handlers. Provides registration and lookup
5
- * functionality for tool handlers used by the MCP server.
6
- */
7
-
8
- import { createLogger } from '@codemcp/workflows-core';
9
- import { WhatsNextHandler } from './whats-next.js';
10
- import { ProceedToPhaseHandler } from './proceed-to-phase.js';
11
- import { ConductReviewHandler } from './conduct-review.js';
12
- import { StartDevelopmentHandler } from './start-development.js';
13
- import { ResumeWorkflowHandler } from './resume-workflow.js';
14
- import { ResetDevelopmentHandler } from './reset-development.js';
15
-
16
- import { ListWorkflowsHandler } from './list-workflows.js';
17
- import { GetToolInfoHandler } from './get-tool-info.js';
18
- import { SetupProjectDocsHandler } from './setup-project-docs.js';
19
- import { NoIdeaHandler } from './no-idea.js';
20
- import { ToolHandler, ToolRegistry } from '../types.js';
21
-
22
- const logger = createLogger('ToolRegistry');
23
-
24
- /**
25
- * Default implementation of ToolRegistry
26
- */
27
- export class DefaultToolRegistry implements ToolRegistry {
28
- private handlers = new Map<string, ToolHandler>();
29
-
30
- register<T extends ToolHandler>(name: string, handler: T): void {
31
- logger.debug('Registering tool handler', {
32
- name,
33
- handlerType: handler.constructor.name,
34
- });
35
- this.handlers.set(name, handler);
36
- }
37
-
38
- get(name: string): ToolHandler | undefined {
39
- return this.handlers.get(name);
40
- }
41
-
42
- list(): string[] {
43
- return Array.from(this.handlers.keys());
44
- }
45
- }
46
-
47
- /**
48
- * Create and configure the default tool registry with all standard handlers
49
- */
50
- export function createToolRegistry(): ToolRegistry {
51
- const registry = new DefaultToolRegistry();
52
-
53
- // Register all standard tool handlers
54
- registry.register('whats_next', new WhatsNextHandler());
55
- registry.register('proceed_to_phase', new ProceedToPhaseHandler());
56
- registry.register('conduct_review', new ConductReviewHandler());
57
- registry.register('start_development', new StartDevelopmentHandler());
58
- registry.register('resume_workflow', new ResumeWorkflowHandler());
59
- registry.register('reset_development', new ResetDevelopmentHandler());
60
- registry.register('list_workflows', new ListWorkflowsHandler());
61
- registry.register('get_tool_info', new GetToolInfoHandler());
62
- registry.register('setup_project_docs', new SetupProjectDocsHandler());
63
- registry.register('no_idea', new NoIdeaHandler());
64
-
65
- logger.info('Tool registry created with handlers', {
66
- handlers: registry.list(),
67
- });
68
-
69
- return registry;
70
- }
71
-
72
- // Export all handler types for external use
73
- export { WhatsNextHandler } from './whats-next.js';
74
- export { ProceedToPhaseHandler } from './proceed-to-phase.js';
75
- export { ConductReviewHandler } from './conduct-review.js';
76
- export { StartDevelopmentHandler } from './start-development.js';
77
- export { ResumeWorkflowHandler } from './resume-workflow.js';
78
- export { ResetDevelopmentHandler } from './reset-development.js';
79
- export { ListWorkflowsHandler } from './list-workflows.js';
80
- export { GetToolInfoHandler } from './get-tool-info.js';
81
- export { SetupProjectDocsHandler } from './setup-project-docs.js';
82
- export { NoIdeaHandler } from './no-idea.js';
83
- export {
84
- BaseToolHandler,
85
- ConversationRequiredToolHandler,
86
- } from './base-tool-handler.js';
87
-
88
- // Export argument and result types
89
- export type { WhatsNextArgs, WhatsNextResult } from './whats-next.js';
90
- export type {
91
- ProceedToPhaseArgs,
92
- ProceedToPhaseResult,
93
- } from './proceed-to-phase.js';
94
- export type {
95
- ConductReviewArgs,
96
- ConductReviewResult,
97
- } from './conduct-review.js';
98
- export type {
99
- StartDevelopmentArgs,
100
- StartDevelopmentResult,
101
- } from './start-development.js';
102
- export type {
103
- ResumeWorkflowArgs,
104
- ResumeWorkflowResult,
105
- } from './resume-workflow.js';
106
- export type {
107
- ResetDevelopmentArgs,
108
- ResetDevelopmentResult,
109
- } from './reset-development.js';
110
- export type { GetToolInfoArgs, GetToolInfoResponse } from './get-tool-info.js';
111
- export type {
112
- SetupProjectDocsArgs,
113
- SetupProjectDocsResult,
114
- } from './setup-project-docs.js';
115
- export type { NoIdeaArgs, NoIdeaResponse } from './no-idea.js';
@@ -1,78 +0,0 @@
1
- /**
2
- * List Workflows Tool Handler
3
- *
4
- * Provides an overview of all available workflows with their descriptions
5
- * and resource URIs for detailed information.
6
- */
7
-
8
- import { z } from 'zod';
9
- import { BaseToolHandler } from './base-tool-handler.js';
10
- import { createLogger } from '@codemcp/workflows-core';
11
- import { ServerContext } from '../types.js';
12
-
13
- const logger = createLogger('ListWorkflowsHandler');
14
-
15
- /**
16
- * Schema for list_workflows tool arguments
17
- */
18
- const ListWorkflowsArgsSchema = z.object({});
19
-
20
- type ListWorkflowsArgs = z.infer<typeof ListWorkflowsArgsSchema>;
21
-
22
- /**
23
- * Response format for workflow information
24
- */
25
- interface WorkflowOverview {
26
- name: string;
27
- displayName: string;
28
- description: string;
29
- resourceUri: string;
30
- }
31
-
32
- interface ListWorkflowsResponse {
33
- workflows: WorkflowOverview[];
34
- }
35
-
36
- /**
37
- * Tool handler for listing available workflows
38
- */
39
- export class ListWorkflowsHandler extends BaseToolHandler<
40
- ListWorkflowsArgs,
41
- ListWorkflowsResponse
42
- > {
43
- protected readonly argsSchema = ListWorkflowsArgsSchema;
44
-
45
- async executeHandler(
46
- _args: ListWorkflowsArgs,
47
- context: ServerContext
48
- ): Promise<ListWorkflowsResponse> {
49
- logger.info('Listing available workflows', {
50
- projectPath: context.projectPath,
51
- });
52
-
53
- // Get only loaded workflows (respects current domain filtering)
54
- const availableWorkflows =
55
- context.workflowManager.getAvailableWorkflowsForProject(
56
- context.projectPath
57
- );
58
-
59
- // Transform to response format with resource URIs
60
- const workflows: WorkflowOverview[] = availableWorkflows.map(workflow => ({
61
- name: workflow.name,
62
- displayName: workflow.displayName,
63
- description: workflow.description,
64
- resourceUri: `workflow://${workflow.name}`,
65
- }));
66
-
67
- const response: ListWorkflowsResponse = {
68
- workflows,
69
- };
70
-
71
- logger.info('Successfully listed workflows', {
72
- count: workflows.length,
73
- workflows: workflows.map(w => w.name),
74
- });
75
-
76
- return response;
77
- }
78
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * No Idea Tool Handler
3
- *
4
- * Provides instructions for LLMs to acknowledge knowledge gaps
5
- * instead of hallucinating responses.
6
- */
7
-
8
- import { z } from 'zod';
9
- import { BaseToolHandler } from './base-tool-handler.js';
10
- import { ServerContext } from '../types.js';
11
-
12
- /**
13
- * Schema for no_idea tool arguments
14
- */
15
- const NoIdeaArgsSchema = z.object({
16
- context: z
17
- .string()
18
- .optional()
19
- .describe('Optional context about what you have no knowledge of'),
20
- });
21
-
22
- export type NoIdeaArgs = z.infer<typeof NoIdeaArgsSchema>;
23
-
24
- /**
25
- * Response format for no_idea tool
26
- */
27
- export interface NoIdeaResponse {
28
- instructions: string;
29
- }
30
-
31
- /**
32
- * Tool handler for acknowledging knowledge gaps
33
- */
34
- export class NoIdeaHandler extends BaseToolHandler<NoIdeaArgs, NoIdeaResponse> {
35
- protected readonly argsSchema = NoIdeaArgsSchema;
36
-
37
- async executeHandler(
38
- args: NoIdeaArgs,
39
- _context: ServerContext
40
- ): Promise<NoIdeaResponse> {
41
- const context = args.context?.trim() || 'this topic';
42
-
43
- const instructions = `You have no clue how to respond to ${context}. Admit it. Ask the user clarifying questions which might help you get new ideas.`;
44
-
45
- return { instructions };
46
- }
47
- }