@codemcp/workflows 6.4.0 → 6.5.1
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/package.json +2 -2
- package/packages/cli/dist/{chunk-D2Q6Y3QQ.js → chunk-4AZGS2GG.js} +321 -388
- package/packages/cli/dist/{cli-DXJJF56V.js → cli-ZCCFBQTP.js} +3 -3
- package/packages/cli/dist/{dist-W7PPKVFG.js → dist-I6VSREAJ.js} +11 -5
- package/packages/cli/dist/{dist-W7VMGB3G.js → dist-MW7THWM3.js} +875 -1136
- package/packages/cli/dist/index.js +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/resources/workflows/bugfix.yaml +14 -0
- package/packages/cli/resources/workflows/epcc.yaml +12 -0
- package/packages/cli/resources/workflows/greenfield.yaml +16 -0
- package/packages/cli/resources/workflows/minor.yaml +8 -0
- package/packages/cli/resources/workflows/tdd.yaml +10 -0
- package/packages/cli/resources/workflows/waterfall.yaml +16 -0
- package/packages/core/dist/beads-integration.d.ts +3 -5
- package/packages/core/dist/beads-integration.js +29 -35
- package/packages/core/dist/beads-integration.js.map +1 -1
- package/packages/core/dist/beads-state-manager.d.ts +3 -1
- package/packages/core/dist/beads-state-manager.js +17 -15
- package/packages/core/dist/beads-state-manager.js.map +1 -1
- package/packages/core/dist/file-detection-manager.js +15 -22
- package/packages/core/dist/file-detection-manager.js.map +1 -1
- package/packages/core/dist/index.d.ts +1 -0
- package/packages/core/dist/index.js +1 -0
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/instruction-generator.d.ts +3 -7
- package/packages/core/dist/instruction-generator.js +17 -25
- package/packages/core/dist/instruction-generator.js.map +1 -1
- package/packages/core/dist/interfaces/instruction-generator.interface.d.ts +13 -4
- package/packages/core/dist/interfaces/plan-manager.interface.d.ts +9 -0
- package/packages/core/dist/logger.d.ts +49 -20
- package/packages/core/dist/logger.js +65 -141
- package/packages/core/dist/logger.js.map +1 -1
- package/packages/core/dist/plan-manager.d.ts +6 -4
- package/packages/core/dist/plan-manager.js +19 -15
- package/packages/core/dist/plan-manager.js.map +1 -1
- package/packages/core/dist/project-docs-manager.d.ts +3 -1
- package/packages/core/dist/project-docs-manager.js +11 -9
- package/packages/core/dist/project-docs-manager.js.map +1 -1
- package/packages/core/dist/state-machine-loader.d.ts +16 -0
- package/packages/core/dist/state-machine-loader.js +29 -0
- package/packages/core/dist/state-machine-loader.js.map +1 -1
- package/packages/core/dist/state-machine-types.d.ts +8 -0
- package/packages/core/dist/string-utils.d.ts +8 -0
- package/packages/core/dist/string-utils.js +14 -0
- package/packages/core/dist/string-utils.js.map +1 -0
- package/packages/core/dist/task-backend.d.ts +6 -3
- package/packages/core/dist/task-backend.js +10 -8
- package/packages/core/dist/task-backend.js.map +1 -1
- package/packages/core/dist/transition-engine.d.ts +3 -6
- package/packages/core/dist/transition-engine.js +31 -76
- package/packages/core/dist/transition-engine.js.map +1 -1
- package/packages/core/dist/workflow-manager.d.ts +2 -0
- package/packages/core/dist/workflow-manager.js +14 -2
- package/packages/core/dist/workflow-manager.js.map +1 -1
- package/packages/core/package.json +1 -1
- package/packages/core/resources/workflows/bugfix.yaml +14 -0
- package/packages/core/resources/workflows/epcc.yaml +12 -0
- package/packages/core/resources/workflows/greenfield.yaml +16 -0
- package/packages/core/resources/workflows/minor.yaml +8 -0
- package/packages/core/resources/workflows/tdd.yaml +10 -0
- package/packages/core/resources/workflows/waterfall.yaml +16 -0
- package/packages/docs/.vitepress/dist/workflows/bugfix.yaml +14 -0
- package/packages/docs/.vitepress/dist/workflows/epcc.yaml +12 -0
- package/packages/docs/.vitepress/dist/workflows/greenfield.yaml +16 -0
- package/packages/docs/.vitepress/dist/workflows/minor.yaml +8 -0
- package/packages/docs/.vitepress/dist/workflows/tdd.yaml +10 -0
- package/packages/docs/.vitepress/dist/workflows/waterfall.yaml +16 -0
- package/packages/docs/package.json +1 -1
- package/packages/mcp-server/dist/index.d.ts +1027 -0
- package/packages/mcp-server/dist/index.js +879 -1140
- package/packages/mcp-server/package.json +1 -1
- package/packages/mcp-server/resources/workflows/bugfix.yaml +14 -0
- package/packages/mcp-server/resources/workflows/epcc.yaml +12 -0
- package/packages/mcp-server/resources/workflows/greenfield.yaml +16 -0
- package/packages/mcp-server/resources/workflows/minor.yaml +8 -0
- package/packages/mcp-server/resources/workflows/tdd.yaml +10 -0
- package/packages/mcp-server/resources/workflows/waterfall.yaml +16 -0
- package/packages/opencode-plugin/dist/index.d.ts +220 -0
- package/packages/opencode-plugin/dist/index.js +28616 -0
- package/packages/opencode-plugin/package.json +55 -0
- package/packages/opencode-plugin/resources/agents/architect.yaml +61 -0
- package/packages/opencode-plugin/resources/agents/business-analyst.yaml +60 -0
- package/packages/opencode-plugin/resources/agents/developer.yaml +61 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/arc42-template-EN.md +1077 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/images/01_2_iso-25010-topics-EN.drawio-2023.png +0 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/images/01_2_iso-25010-topics-EN.drawio.png +0 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/images/05_building_blocks-EN.png +0 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/images/08-concepts-EN.drawio.png +0 -0
- package/packages/opencode-plugin/resources/templates/architecture/arc42/images/arc42-logo.png +0 -0
- package/packages/opencode-plugin/resources/templates/architecture/c4.md +224 -0
- package/packages/opencode-plugin/resources/templates/architecture/freestyle.md +53 -0
- package/packages/opencode-plugin/resources/templates/architecture/game.md +250 -0
- package/packages/opencode-plugin/resources/templates/architecture/none.md +17 -0
- package/packages/opencode-plugin/resources/templates/design/comprehensive.md +207 -0
- package/packages/opencode-plugin/resources/templates/design/freestyle.md +37 -0
- package/packages/opencode-plugin/resources/templates/design/game.md +66 -0
- package/packages/opencode-plugin/resources/templates/design/none.md +17 -0
- package/packages/opencode-plugin/resources/templates/requirements/ears.md +90 -0
- package/packages/opencode-plugin/resources/templates/requirements/freestyle.md +42 -0
- package/packages/opencode-plugin/resources/templates/requirements/game.md +162 -0
- package/packages/opencode-plugin/resources/templates/requirements/none.md +17 -0
- package/packages/opencode-plugin/resources/templates/skills/POWER.md +23 -0
- package/packages/opencode-plugin/resources/templates/skills/SKILL.md +19 -0
- package/packages/opencode-plugin/resources/workflows/adr.yaml +157 -0
- package/packages/opencode-plugin/resources/workflows/big-bang-conversion.yaml +592 -0
- package/packages/opencode-plugin/resources/workflows/boundary-testing.yaml +376 -0
- package/packages/opencode-plugin/resources/workflows/bugfix.yaml +178 -0
- package/packages/opencode-plugin/resources/workflows/business-analysis.yaml +597 -0
- package/packages/opencode-plugin/resources/workflows/c4-analysis.yaml +471 -0
- package/packages/opencode-plugin/resources/workflows/epcc.yaml +195 -0
- package/packages/opencode-plugin/resources/workflows/game-beginner.yaml +434 -0
- package/packages/opencode-plugin/resources/workflows/greenfield.yaml +217 -0
- package/packages/opencode-plugin/resources/workflows/minor.yaml +146 -0
- package/packages/opencode-plugin/resources/workflows/posts.yaml +193 -0
- package/packages/opencode-plugin/resources/workflows/sdd-bugfix-crowd.yaml +608 -0
- package/packages/opencode-plugin/resources/workflows/sdd-bugfix.yaml +381 -0
- package/packages/opencode-plugin/resources/workflows/sdd-feature-crowd.yaml +713 -0
- package/packages/opencode-plugin/resources/workflows/sdd-feature.yaml +471 -0
- package/packages/opencode-plugin/resources/workflows/sdd-greenfield-crowd.yaml +336 -0
- package/packages/opencode-plugin/resources/workflows/sdd-greenfield.yaml +463 -0
- package/packages/opencode-plugin/resources/workflows/skilled-bugfix.yaml +174 -0
- package/packages/opencode-plugin/resources/workflows/skilled-epcc.yaml +171 -0
- package/packages/opencode-plugin/resources/workflows/skilled-greenfield.yaml +207 -0
- package/packages/opencode-plugin/resources/workflows/slides.yaml +237 -0
- package/packages/opencode-plugin/resources/workflows/tdd.yaml +170 -0
- package/packages/opencode-plugin/resources/workflows/waterfall.yaml +225 -0
- package/packages/opencode-tui-plugin/package.json +46 -0
- package/packages/visualizer/package.json +1 -1
- package/resources/workflows/bugfix.yaml +14 -0
- package/resources/workflows/epcc.yaml +12 -0
- package/resources/workflows/greenfield.yaml +16 -0
- package/resources/workflows/minor.yaml +8 -0
- package/resources/workflows/tdd.yaml +10 -0
- package/resources/workflows/waterfall.yaml +16 -0
|
@@ -0,0 +1,1027 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as _codemcp_workflows_core from '@codemcp/workflows-core';
|
|
3
|
+
import { YamlState, TaskBackendConfig, ConversationManager, TransitionEngine, IPlanManager, IInstructionGenerator, WorkflowManager, InteractionLogger, LoggerFactory, IPersistence, ILogger, ConversationContext as ConversationContext$1, YamlStateMachine } from '@codemcp/workflows-core';
|
|
4
|
+
import * as _modelcontextprotocol_sdk_server_mcp_js from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Plugin system interfaces for extending the workflows server
|
|
10
|
+
*
|
|
11
|
+
* Core Principle: Plugins receive only read-only context data and cannot
|
|
12
|
+
* directly manipulate core server components. They extend behavior through
|
|
13
|
+
* semantic lifecycle hooks only.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Plugin interface - all plugins must implement this
|
|
18
|
+
*/
|
|
19
|
+
interface IPlugin {
|
|
20
|
+
/** Unique plugin name */
|
|
21
|
+
getName(): string;
|
|
22
|
+
/** Execution sequence (lower numbers execute first) */
|
|
23
|
+
getSequence(): number;
|
|
24
|
+
/** Whether plugin is enabled (typically based on environment) */
|
|
25
|
+
isEnabled(): boolean;
|
|
26
|
+
/** Lifecycle hooks this plugin provides */
|
|
27
|
+
getHooks(): PluginHooks;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Lifecycle hooks that plugins can implement
|
|
31
|
+
* All hooks receive standardized PluginHookContext as first parameter
|
|
32
|
+
*/
|
|
33
|
+
interface PluginHooks {
|
|
34
|
+
/** Called before development workflow starts */
|
|
35
|
+
beforeStartDevelopment?: (context: PluginHookContext, args: StartDevelopmentArgs$1) => Promise<void>;
|
|
36
|
+
/** Called after development workflow has started */
|
|
37
|
+
afterStartDevelopment?: (context: PluginHookContext, args: StartDevelopmentArgs$1, result: StartDevelopmentResult$1) => Promise<void>;
|
|
38
|
+
/** Called after plan file is created - can modify content */
|
|
39
|
+
afterPlanFileCreated?: (context: PluginHookContext, planFilePath: string, content: string) => Promise<string>;
|
|
40
|
+
/** Called before phase transition (can block by throwing) */
|
|
41
|
+
beforePhaseTransition?: (context: PluginHookContext, currentPhase: string, targetPhase: string) => Promise<void>;
|
|
42
|
+
/** Called after instructions are generated - can modify them */
|
|
43
|
+
afterInstructionsGenerated?: (context: PluginHookContext, instructions: GeneratedInstructions) => Promise<GeneratedInstructions>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Standardized context provided to all plugin hooks
|
|
47
|
+
* Contains ONLY read-only data - no server components
|
|
48
|
+
*/
|
|
49
|
+
interface PluginHookContext {
|
|
50
|
+
/** Current conversation ID */
|
|
51
|
+
conversationId: string;
|
|
52
|
+
/** Path to the plan file */
|
|
53
|
+
planFilePath: string;
|
|
54
|
+
/** Current development phase */
|
|
55
|
+
currentPhase: string;
|
|
56
|
+
/** Active workflow name */
|
|
57
|
+
workflow: string;
|
|
58
|
+
/** Project directory path */
|
|
59
|
+
projectPath: string;
|
|
60
|
+
/** Git branch name */
|
|
61
|
+
gitBranch: string;
|
|
62
|
+
/** Whether the plan file exists at the time of instruction generation */
|
|
63
|
+
planFileExists: boolean;
|
|
64
|
+
/** Target phase (only available in phase transitions) */
|
|
65
|
+
targetPhase?: string;
|
|
66
|
+
/** Workflow state machine definition (read-only) - available in afterStartDevelopment */
|
|
67
|
+
stateMachine?: {
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly description: string;
|
|
70
|
+
readonly initial_state: string;
|
|
71
|
+
readonly states: Record<string, YamlState>;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Plugin registry interface for managing and executing plugins
|
|
76
|
+
*/
|
|
77
|
+
interface IPluginRegistry {
|
|
78
|
+
/** Register a plugin */
|
|
79
|
+
registerPlugin(plugin: IPlugin): void;
|
|
80
|
+
/** Get all enabled plugins sorted by sequence */
|
|
81
|
+
getEnabledPlugins(): IPlugin[];
|
|
82
|
+
/** Execute a specific hook on all plugins that implement it */
|
|
83
|
+
executeHook<T extends keyof PluginHooks>(hookName: T, ...args: Parameters<NonNullable<PluginHooks[T]>>): Promise<unknown>;
|
|
84
|
+
/** Check if any plugin has a specific hook */
|
|
85
|
+
hasHook(hookName: keyof PluginHooks): boolean;
|
|
86
|
+
/** Get names of all registered plugins */
|
|
87
|
+
getPluginNames(): string[];
|
|
88
|
+
/** Clear all plugins (mainly for testing) */
|
|
89
|
+
clear(): void;
|
|
90
|
+
}
|
|
91
|
+
interface StartDevelopmentArgs$1 {
|
|
92
|
+
workflow: string;
|
|
93
|
+
require_reviews?: boolean;
|
|
94
|
+
project_path?: string;
|
|
95
|
+
}
|
|
96
|
+
interface StartDevelopmentResult$1 {
|
|
97
|
+
conversationId: string;
|
|
98
|
+
planFilePath: string;
|
|
99
|
+
phase: string;
|
|
100
|
+
workflow: string;
|
|
101
|
+
}
|
|
102
|
+
interface GeneratedInstructions {
|
|
103
|
+
instructions: string;
|
|
104
|
+
planFilePath: string;
|
|
105
|
+
phase: string;
|
|
106
|
+
/** Source of the instruction generation */
|
|
107
|
+
instructionSource?: 'whats_next' | 'proceed_to_phase' | 'start_development';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Core types and interfaces for the refactored server architecture
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Server context shared across all handlers
|
|
116
|
+
* Contains all the core dependencies needed by tool and resource handlers
|
|
117
|
+
*/
|
|
118
|
+
interface ServerContext {
|
|
119
|
+
conversationManager: ConversationManager;
|
|
120
|
+
transitionEngine: TransitionEngine;
|
|
121
|
+
planManager: IPlanManager;
|
|
122
|
+
instructionGenerator: IInstructionGenerator;
|
|
123
|
+
workflowManager: WorkflowManager;
|
|
124
|
+
interactionLogger?: InteractionLogger;
|
|
125
|
+
projectPath: string;
|
|
126
|
+
pluginRegistry?: IPluginRegistry;
|
|
127
|
+
/** Logger factory for creating component loggers - if not provided, handlers use global createLogger */
|
|
128
|
+
loggerFactory?: LoggerFactory;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Standard result format for all handler operations
|
|
132
|
+
* Separates business logic results from MCP protocol concerns
|
|
133
|
+
*/
|
|
134
|
+
interface HandlerResult<T = unknown> {
|
|
135
|
+
success: boolean;
|
|
136
|
+
data?: T;
|
|
137
|
+
error?: string;
|
|
138
|
+
metadata?: Record<string, unknown>;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Resource content structure
|
|
142
|
+
*/
|
|
143
|
+
interface ResourceContent {
|
|
144
|
+
uri: string;
|
|
145
|
+
text: string;
|
|
146
|
+
mimeType: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* MCP Tool Response format (compatible with MCP SDK)
|
|
150
|
+
*/
|
|
151
|
+
interface McpToolResponse {
|
|
152
|
+
[x: string]: unknown;
|
|
153
|
+
content: Array<{
|
|
154
|
+
type: 'text';
|
|
155
|
+
text: string;
|
|
156
|
+
}>;
|
|
157
|
+
isError?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* MCP Resource Response format (compatible with MCP SDK)
|
|
161
|
+
*/
|
|
162
|
+
interface McpResourceResponse {
|
|
163
|
+
[x: string]: unknown;
|
|
164
|
+
contents: Array<{
|
|
165
|
+
uri: string;
|
|
166
|
+
text: string;
|
|
167
|
+
mimeType: string;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Tool handler interface
|
|
172
|
+
* All tool handlers must implement this interface
|
|
173
|
+
*/
|
|
174
|
+
interface ToolHandler<TArgs = unknown, TResult = unknown> {
|
|
175
|
+
handle(args: TArgs, context: ServerContext): Promise<HandlerResult<TResult>>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Resource handler interface
|
|
179
|
+
* All resource handlers must implement this interface
|
|
180
|
+
*/
|
|
181
|
+
interface ResourceHandler {
|
|
182
|
+
handle(uri: URL, context: ServerContext): Promise<HandlerResult<ResourceContent>>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Response renderer interface
|
|
186
|
+
* Handles translation between domain results and MCP protocol responses
|
|
187
|
+
*/
|
|
188
|
+
interface ResponseRenderer {
|
|
189
|
+
renderToolResponse<T>(result: HandlerResult<T>): McpToolResponse;
|
|
190
|
+
renderResourceResponse(result: HandlerResult<ResourceContent>): McpResourceResponse;
|
|
191
|
+
renderError(error: Error | string): McpToolResponse;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Tool registry interface
|
|
195
|
+
* Manages registration and lookup of tool handlers
|
|
196
|
+
*/
|
|
197
|
+
interface ToolRegistry {
|
|
198
|
+
register<T extends ToolHandler>(name: string, handler: T): void;
|
|
199
|
+
get(name: string): ToolHandler | undefined;
|
|
200
|
+
list(): string[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Resource registry interface
|
|
204
|
+
* Manages registration and lookup of resource handlers
|
|
205
|
+
*/
|
|
206
|
+
interface ResourceRegistry {
|
|
207
|
+
register(pattern: string, handler: ResourceHandler): void;
|
|
208
|
+
resolve(uri: string): ResourceHandler | undefined;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Server configuration options
|
|
212
|
+
*/
|
|
213
|
+
interface ServerConfig {
|
|
214
|
+
/** Project path to operate on (defaults to process.cwd()) */
|
|
215
|
+
projectPath?: string;
|
|
216
|
+
/** Database path override */
|
|
217
|
+
databasePath?: string;
|
|
218
|
+
/** Enable interaction logging */
|
|
219
|
+
enableLogging?: boolean;
|
|
220
|
+
/** Task backend configuration override (for testing) */
|
|
221
|
+
taskBackend?: TaskBackendConfig;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Server Configuration
|
|
226
|
+
*
|
|
227
|
+
* Handles server configuration, component initialization, and MCP server setup.
|
|
228
|
+
* Centralizes the configuration logic that was previously scattered in the main server class.
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Server component container
|
|
233
|
+
* Holds all the initialized server components
|
|
234
|
+
*/
|
|
235
|
+
interface ServerComponents {
|
|
236
|
+
mcpServer: McpServer;
|
|
237
|
+
database: IPersistence;
|
|
238
|
+
context: ServerContext;
|
|
239
|
+
toolRegistry: ToolRegistry;
|
|
240
|
+
resourceRegistry: ResourceRegistry;
|
|
241
|
+
responseRenderer: ResponseRenderer;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Base Tool Handler
|
|
246
|
+
*
|
|
247
|
+
* Provides common functionality for all tool handlers including
|
|
248
|
+
* error handling, logging, and conversation state management.
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Abstract base class for tool handlers
|
|
253
|
+
* Provides common functionality and enforces consistent patterns
|
|
254
|
+
*/
|
|
255
|
+
declare abstract class BaseToolHandler<TArgs = unknown, TResult = unknown> implements ToolHandler<TArgs, TResult> {
|
|
256
|
+
protected logger: ILogger;
|
|
257
|
+
constructor();
|
|
258
|
+
/**
|
|
259
|
+
* Main handler method - implements consistent error handling and logging
|
|
260
|
+
*/
|
|
261
|
+
handle(args: TArgs, context: ServerContext): Promise<HandlerResult<TResult>>;
|
|
262
|
+
/**
|
|
263
|
+
* Abstract method that subclasses must implement
|
|
264
|
+
* Contains the actual business logic for the tool
|
|
265
|
+
*/
|
|
266
|
+
protected abstract executeHandler(args: TArgs, context: ServerContext): Promise<TResult>;
|
|
267
|
+
/**
|
|
268
|
+
* Helper method to get conversation context with proper error handling
|
|
269
|
+
*/
|
|
270
|
+
protected getConversationContext(context: ServerContext): Promise<ConversationContext$1>;
|
|
271
|
+
/**
|
|
272
|
+
* Helper method to ensure state machine is loaded for a project
|
|
273
|
+
*/
|
|
274
|
+
protected ensureStateMachineForProject(context: ServerContext, projectPath: string, workflowName?: string): void;
|
|
275
|
+
/**
|
|
276
|
+
* Helper method to log interactions if logger is available
|
|
277
|
+
*/
|
|
278
|
+
protected logInteraction(context: ServerContext, conversationId: string, toolName: string, args: unknown, response: unknown, phase: string): Promise<void>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Base class for tool handlers that require an existing conversation
|
|
282
|
+
* Automatically handles the conversation-not-found case
|
|
283
|
+
*/
|
|
284
|
+
declare abstract class ConversationRequiredToolHandler<TArgs = unknown, TResult = unknown> extends BaseToolHandler<TArgs, TResult> {
|
|
285
|
+
protected executeHandler(args: TArgs, context: ServerContext): Promise<TResult>;
|
|
286
|
+
/**
|
|
287
|
+
* Abstract method for handlers that need conversation context
|
|
288
|
+
*/
|
|
289
|
+
protected abstract executeWithConversation(args: TArgs, context: ServerContext, conversationContext: ConversationContext$1): Promise<TResult>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* WhatsNext Tool Handler
|
|
294
|
+
*
|
|
295
|
+
* Handles the whats_next tool which analyzes conversation context and
|
|
296
|
+
* determines the next development phase with specific instructions for the LLM.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Arguments for the whats_next tool
|
|
301
|
+
*/
|
|
302
|
+
interface WhatsNextArgs {
|
|
303
|
+
context?: string;
|
|
304
|
+
user_input?: string;
|
|
305
|
+
conversation_summary?: string;
|
|
306
|
+
recent_messages?: Array<{
|
|
307
|
+
role: 'user' | 'assistant';
|
|
308
|
+
content: string;
|
|
309
|
+
}>;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Response from the whats_next tool
|
|
313
|
+
*/
|
|
314
|
+
interface WhatsNextResult {
|
|
315
|
+
phase: string;
|
|
316
|
+
instructions: string;
|
|
317
|
+
plan_file_path: string;
|
|
318
|
+
/**
|
|
319
|
+
* Glob patterns for files allowed to be edited in this phase.
|
|
320
|
+
* Defaults to ['**\/*'] (all files) if not restricted.
|
|
321
|
+
*/
|
|
322
|
+
allowed_file_patterns: string[];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* WhatsNext tool handler implementation
|
|
326
|
+
*/
|
|
327
|
+
declare class WhatsNextHandler extends ConversationRequiredToolHandler<WhatsNextArgs, WhatsNextResult> {
|
|
328
|
+
protected executeHandler(args: WhatsNextArgs, context: ServerContext): Promise<WhatsNextResult>;
|
|
329
|
+
protected executeWithConversation(args: WhatsNextArgs, context: ServerContext, conversationContext: ConversationContext$1): Promise<WhatsNextResult>;
|
|
330
|
+
/**
|
|
331
|
+
* Determines whether conversation state should be updated for a phase transition
|
|
332
|
+
*/
|
|
333
|
+
private shouldUpdateConversationState;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* ProceedToPhase Tool Handler
|
|
338
|
+
*
|
|
339
|
+
* Handles explicit transitions to specific development phases when the current
|
|
340
|
+
* phase is complete or when a direct phase change is needed.
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Arguments for the proceed_to_phase tool
|
|
345
|
+
*/
|
|
346
|
+
interface ProceedToPhaseArgs {
|
|
347
|
+
target_phase: string;
|
|
348
|
+
reason?: string;
|
|
349
|
+
review_state: 'not-required' | 'pending' | 'performed';
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Response from the proceed_to_phase tool
|
|
353
|
+
*/
|
|
354
|
+
interface ProceedToPhaseResult {
|
|
355
|
+
phase: string;
|
|
356
|
+
instructions: string;
|
|
357
|
+
plan_file_path: string;
|
|
358
|
+
transition_reason: string;
|
|
359
|
+
/**
|
|
360
|
+
* Glob patterns for files allowed to be edited in this phase.
|
|
361
|
+
* Defaults to ['**\/*'] (all files) if not restricted.
|
|
362
|
+
*/
|
|
363
|
+
allowed_file_patterns: string[];
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* ProceedToPhase tool handler implementation
|
|
367
|
+
*/
|
|
368
|
+
declare class ProceedToPhaseHandler extends ConversationRequiredToolHandler<ProceedToPhaseArgs, ProceedToPhaseResult> {
|
|
369
|
+
protected executeWithConversation(args: ProceedToPhaseArgs, context: ServerContext, conversationContext: ConversationContext$1): Promise<ProceedToPhaseResult>;
|
|
370
|
+
/**
|
|
371
|
+
* Validate review state for transitions that require reviews
|
|
372
|
+
*/
|
|
373
|
+
private validateReviewState;
|
|
374
|
+
/**
|
|
375
|
+
* Validate that the agent's role allows this phase transition (for crowd workflows)
|
|
376
|
+
*/
|
|
377
|
+
private validateAgentRole;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* ConductReview Tool Handler
|
|
382
|
+
*
|
|
383
|
+
* Handles review requests before phase transitions. Adapts to MCP environment
|
|
384
|
+
* capabilities - returns automated review results if sampling available,
|
|
385
|
+
* otherwise returns instructions for LLM to conduct guided review.
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Arguments for the conduct_review tool
|
|
390
|
+
*/
|
|
391
|
+
interface ConductReviewArgs {
|
|
392
|
+
target_phase: string;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Response from the conduct_review tool
|
|
396
|
+
*/
|
|
397
|
+
interface ConductReviewResult {
|
|
398
|
+
instructions: string;
|
|
399
|
+
perspectives: Array<{
|
|
400
|
+
name: string;
|
|
401
|
+
prompt: string;
|
|
402
|
+
}>;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* ConductReview tool handler implementation
|
|
406
|
+
*/
|
|
407
|
+
declare class ConductReviewHandler extends ConversationRequiredToolHandler<ConductReviewArgs, ConductReviewResult> {
|
|
408
|
+
protected executeWithConversation(args: ConductReviewArgs, context: ServerContext, conversationContext: ConversationContext$1): Promise<ConductReviewResult>;
|
|
409
|
+
/**
|
|
410
|
+
* Get transition configuration from workflow
|
|
411
|
+
*/
|
|
412
|
+
private getTransitionConfig;
|
|
413
|
+
/**
|
|
414
|
+
* Check if MCP environment supports sampling capabilities
|
|
415
|
+
*/
|
|
416
|
+
private checkSamplingCapability;
|
|
417
|
+
/**
|
|
418
|
+
* Conduct automated review using LLM tools (when sampling is available)
|
|
419
|
+
*/
|
|
420
|
+
private conductAutomatedReview;
|
|
421
|
+
/**
|
|
422
|
+
* Generate instructions for LLM to conduct guided review
|
|
423
|
+
*/
|
|
424
|
+
private generateReviewInstructions;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* StartDevelopment Tool Handler
|
|
429
|
+
*
|
|
430
|
+
* Handles initialization of development workflow and transition to the initial
|
|
431
|
+
* development phase. Allows users to choose from predefined workflows or use a custom workflow.
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Arguments for the start_development tool
|
|
436
|
+
*/
|
|
437
|
+
interface StartDevelopmentArgs {
|
|
438
|
+
workflow: string;
|
|
439
|
+
require_reviews?: boolean;
|
|
440
|
+
project_path?: string;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Response from the start_development tool
|
|
444
|
+
*/
|
|
445
|
+
interface StartDevelopmentResult {
|
|
446
|
+
phase: string;
|
|
447
|
+
instructions: string;
|
|
448
|
+
plan_file_path: string;
|
|
449
|
+
workflowDocumentationUrl?: string;
|
|
450
|
+
/**
|
|
451
|
+
* Glob patterns for files allowed to be edited in this phase.
|
|
452
|
+
* Defaults to ['**\/*'] (all files) if not restricted.
|
|
453
|
+
*/
|
|
454
|
+
allowed_file_patterns: string[];
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* StartDevelopment tool handler implementation
|
|
458
|
+
*/
|
|
459
|
+
declare class StartDevelopmentHandler extends BaseToolHandler<StartDevelopmentArgs, StartDevelopmentResult> {
|
|
460
|
+
private projectDocsManager;
|
|
461
|
+
private getProjectDocsManager;
|
|
462
|
+
protected executeHandler(args: StartDevelopmentArgs, context: ServerContext): Promise<StartDevelopmentResult>;
|
|
463
|
+
/**
|
|
464
|
+
* Check if project documentation artifacts exist and provide setup guidance if needed
|
|
465
|
+
* Dynamically analyzes the selected workflow to determine which documents are referenced
|
|
466
|
+
* Blocks workflow start if the workflow requires documentation
|
|
467
|
+
*/
|
|
468
|
+
private checkProjectArtifacts;
|
|
469
|
+
/**
|
|
470
|
+
* Analyze workflow content to detect document variable references
|
|
471
|
+
*/
|
|
472
|
+
private analyzeWorkflowDocumentReferences;
|
|
473
|
+
/**
|
|
474
|
+
* Determine which referenced documents are missing
|
|
475
|
+
*/
|
|
476
|
+
private getMissingReferencedDocuments;
|
|
477
|
+
/**
|
|
478
|
+
* Generate guidance for setting up missing project artifacts
|
|
479
|
+
*/
|
|
480
|
+
private generateArtifactSetupGuidance;
|
|
481
|
+
/**
|
|
482
|
+
* Generate workflow documentation URL for predefined workflows
|
|
483
|
+
* Returns undefined for custom workflows
|
|
484
|
+
*/
|
|
485
|
+
private generateWorkflowDocumentationUrl;
|
|
486
|
+
/**
|
|
487
|
+
* Get the current git branch for a project
|
|
488
|
+
* Uses the same logic as ConversationManager but locally accessible
|
|
489
|
+
*/
|
|
490
|
+
private getCurrentGitBranch;
|
|
491
|
+
/**
|
|
492
|
+
* Generate a suggested branch name for feature development
|
|
493
|
+
*/
|
|
494
|
+
private generateBranchSuggestion;
|
|
495
|
+
/**
|
|
496
|
+
* Ensure .gitignore exists in .vibe folder to exclude SQLite files
|
|
497
|
+
* This function is idempotent and self-contained within the .vibe directory
|
|
498
|
+
*/
|
|
499
|
+
private ensureGitignoreEntry;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* ResumeWorkflow Tool Handler
|
|
504
|
+
*
|
|
505
|
+
* Handles resuming development workflow after conversation compression.
|
|
506
|
+
* Returns comprehensive project context, current state, system prompt instructions,
|
|
507
|
+
* and next steps to seamlessly continue development.
|
|
508
|
+
*/
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Arguments for the resume_workflow tool
|
|
512
|
+
*/
|
|
513
|
+
interface ResumeWorkflowArgs {
|
|
514
|
+
include_system_prompt?: boolean;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Plan file analysis result
|
|
518
|
+
*/
|
|
519
|
+
interface PlanAnalysis {
|
|
520
|
+
sections: string[];
|
|
521
|
+
tasks_completed: number;
|
|
522
|
+
tasks_total: number;
|
|
523
|
+
key_decisions: string[];
|
|
524
|
+
recent_updates: string[];
|
|
525
|
+
active_tasks?: string[];
|
|
526
|
+
completed_tasks?: string[];
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Conversation context for resume workflow
|
|
530
|
+
*/
|
|
531
|
+
interface ConversationContext {
|
|
532
|
+
conversationId: string;
|
|
533
|
+
currentPhase: string;
|
|
534
|
+
projectPath: string;
|
|
535
|
+
workflowName: string;
|
|
536
|
+
gitBranch: string;
|
|
537
|
+
planFilePath: string;
|
|
538
|
+
current_phase?: string;
|
|
539
|
+
workflow_name?: string;
|
|
540
|
+
project_context?: string;
|
|
541
|
+
recent_activity?: string[];
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Response from the resume_workflow tool
|
|
545
|
+
*/
|
|
546
|
+
interface ResumeWorkflowResult {
|
|
547
|
+
workflow_status: {
|
|
548
|
+
current_phase: string;
|
|
549
|
+
project_path: string;
|
|
550
|
+
git_branch: string;
|
|
551
|
+
state_machine: YamlStateMachine;
|
|
552
|
+
};
|
|
553
|
+
plan_status: {
|
|
554
|
+
exists: boolean;
|
|
555
|
+
path: string;
|
|
556
|
+
analysis?: PlanAnalysis | null;
|
|
557
|
+
};
|
|
558
|
+
system_prompt?: string | null;
|
|
559
|
+
recommendations: {
|
|
560
|
+
immediate_actions: string[];
|
|
561
|
+
phase_guidance: string;
|
|
562
|
+
potential_issues: string[];
|
|
563
|
+
};
|
|
564
|
+
generated_at: string;
|
|
565
|
+
tool_version: string;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* ResumeWorkflow tool handler implementation
|
|
569
|
+
*/
|
|
570
|
+
declare class ResumeWorkflowHandler extends ConversationRequiredToolHandler<ResumeWorkflowArgs, ResumeWorkflowResult> {
|
|
571
|
+
protected executeWithConversation(args: ResumeWorkflowArgs, context: ServerContext, conversationContext: ConversationContext): Promise<ResumeWorkflowResult>;
|
|
572
|
+
/**
|
|
573
|
+
* Analyze plan file content to extract key information
|
|
574
|
+
*/
|
|
575
|
+
private analyzePlanFile;
|
|
576
|
+
/**
|
|
577
|
+
* Get state machine information
|
|
578
|
+
*/
|
|
579
|
+
private getStateMachineInfo;
|
|
580
|
+
/**
|
|
581
|
+
* Generate recommendations for next steps based on state machine transitions
|
|
582
|
+
*/
|
|
583
|
+
private generateRecommendations;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* ResetDevelopment Tool Handler
|
|
588
|
+
*
|
|
589
|
+
* Handles resetting conversation state and development progress.
|
|
590
|
+
* This permanently deletes conversation state and plan file, while
|
|
591
|
+
* soft-deleting interaction logs for audit trail.
|
|
592
|
+
*/
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Arguments for the reset_development tool
|
|
596
|
+
*/
|
|
597
|
+
interface ResetDevelopmentArgs {
|
|
598
|
+
confirm: boolean;
|
|
599
|
+
reason?: string;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Response from the reset_development tool
|
|
603
|
+
*/
|
|
604
|
+
interface ResetDevelopmentResult {
|
|
605
|
+
success: boolean;
|
|
606
|
+
resetItems: string[];
|
|
607
|
+
message: string;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* ResetDevelopment tool handler implementation
|
|
611
|
+
*/
|
|
612
|
+
declare class ResetDevelopmentHandler extends BaseToolHandler<ResetDevelopmentArgs, ResetDevelopmentResult> {
|
|
613
|
+
protected executeHandler(args: ResetDevelopmentArgs, context: ServerContext): Promise<ResetDevelopmentResult>;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* List Workflows Tool Handler
|
|
618
|
+
*
|
|
619
|
+
* Provides an overview of all available workflows with their descriptions
|
|
620
|
+
* and resource URIs for detailed information.
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Schema for list_workflows tool arguments
|
|
625
|
+
*/
|
|
626
|
+
declare const ListWorkflowsArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
627
|
+
type ListWorkflowsArgs = z.infer<typeof ListWorkflowsArgsSchema>;
|
|
628
|
+
/**
|
|
629
|
+
* Response format for workflow information
|
|
630
|
+
*/
|
|
631
|
+
interface WorkflowOverview {
|
|
632
|
+
name: string;
|
|
633
|
+
displayName: string;
|
|
634
|
+
description: string;
|
|
635
|
+
resourceUri: string;
|
|
636
|
+
}
|
|
637
|
+
interface ListWorkflowsResponse {
|
|
638
|
+
workflows: WorkflowOverview[];
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Tool handler for listing available workflows
|
|
642
|
+
*/
|
|
643
|
+
declare class ListWorkflowsHandler extends BaseToolHandler<ListWorkflowsArgs, ListWorkflowsResponse> {
|
|
644
|
+
protected readonly argsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
645
|
+
executeHandler(_args: ListWorkflowsArgs, context: ServerContext): Promise<ListWorkflowsResponse>;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Get Tool Info Handler
|
|
650
|
+
*
|
|
651
|
+
* Provides comprehensive information about the workflows development
|
|
652
|
+
* workflow tools for better tool discoverability and AI integration.
|
|
653
|
+
*/
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Schema for get_tool_info tool arguments
|
|
657
|
+
*/
|
|
658
|
+
declare const GetToolInfoArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
659
|
+
type GetToolInfoArgs = z.infer<typeof GetToolInfoArgsSchema>;
|
|
660
|
+
/**
|
|
661
|
+
* Tool information structure
|
|
662
|
+
*/
|
|
663
|
+
interface ToolInfo {
|
|
664
|
+
name: string;
|
|
665
|
+
description: string;
|
|
666
|
+
parameters: string[];
|
|
667
|
+
schema?: {
|
|
668
|
+
required: string[];
|
|
669
|
+
optional: string[];
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Workflow information structure
|
|
674
|
+
*/
|
|
675
|
+
interface WorkflowInfo {
|
|
676
|
+
name: string;
|
|
677
|
+
displayName: string;
|
|
678
|
+
description: string;
|
|
679
|
+
phases?: string[];
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Complete tool information response
|
|
683
|
+
*/
|
|
684
|
+
interface GetToolInfoResponse {
|
|
685
|
+
tool_name: string;
|
|
686
|
+
version: string;
|
|
687
|
+
purpose: string;
|
|
688
|
+
description: string;
|
|
689
|
+
available_tools: ToolInfo[];
|
|
690
|
+
available_workflows: WorkflowInfo[];
|
|
691
|
+
core_concepts: {
|
|
692
|
+
phase_management: string;
|
|
693
|
+
plan_file_tracking: string;
|
|
694
|
+
conversation_context: string;
|
|
695
|
+
workflow_guidance: string;
|
|
696
|
+
};
|
|
697
|
+
usage_guidelines: {
|
|
698
|
+
required_pattern: string;
|
|
699
|
+
phase_transitions: string;
|
|
700
|
+
context_requirements: string;
|
|
701
|
+
plan_file_management: string;
|
|
702
|
+
};
|
|
703
|
+
workflow_states?: {
|
|
704
|
+
current_phase?: string;
|
|
705
|
+
plan_file_path?: string;
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Tool handler for providing comprehensive tool information
|
|
710
|
+
*/
|
|
711
|
+
declare class GetToolInfoHandler extends BaseToolHandler<GetToolInfoArgs, GetToolInfoResponse> {
|
|
712
|
+
protected readonly argsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
713
|
+
executeHandler(_args: GetToolInfoArgs, context: ServerContext): Promise<GetToolInfoResponse>;
|
|
714
|
+
/**
|
|
715
|
+
* Extract phase names from a workflow configuration
|
|
716
|
+
*/
|
|
717
|
+
private extractWorkflowPhases;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Setup Project Docs Handler
|
|
722
|
+
*
|
|
723
|
+
* Creates project documentation artifacts (architecture.md, requirements.md, design.md)
|
|
724
|
+
* using configurable templates OR by linking existing files via symlinks.
|
|
725
|
+
* Supports different template formats for each document type and file path linking.
|
|
726
|
+
*/
|
|
727
|
+
|
|
728
|
+
interface SetupProjectDocsArgs {
|
|
729
|
+
architecture: string;
|
|
730
|
+
requirements: string;
|
|
731
|
+
design: string;
|
|
732
|
+
project_path?: string;
|
|
733
|
+
}
|
|
734
|
+
interface SetupProjectDocsResult {
|
|
735
|
+
success: boolean;
|
|
736
|
+
created: string[];
|
|
737
|
+
linked: string[];
|
|
738
|
+
skipped: string[];
|
|
739
|
+
paths: {
|
|
740
|
+
architecture: string;
|
|
741
|
+
requirements: string;
|
|
742
|
+
design: string;
|
|
743
|
+
};
|
|
744
|
+
message: string;
|
|
745
|
+
}
|
|
746
|
+
declare class SetupProjectDocsHandler extends BaseToolHandler<SetupProjectDocsArgs, SetupProjectDocsResult> {
|
|
747
|
+
private projectDocsManager;
|
|
748
|
+
private getProjectDocsManager;
|
|
749
|
+
protected executeHandler(args: SetupProjectDocsArgs, context: ServerContext): Promise<SetupProjectDocsResult>;
|
|
750
|
+
/**
|
|
751
|
+
* Validate and process arguments to determine templates vs file paths
|
|
752
|
+
*/
|
|
753
|
+
private validateAndProcessArgs;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* No Idea Tool Handler
|
|
758
|
+
*
|
|
759
|
+
* Provides instructions for LLMs to acknowledge knowledge gaps
|
|
760
|
+
* instead of hallucinating responses.
|
|
761
|
+
*/
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Schema for no_idea tool arguments
|
|
765
|
+
*/
|
|
766
|
+
declare const NoIdeaArgsSchema: z.ZodObject<{
|
|
767
|
+
context: z.ZodOptional<z.ZodString>;
|
|
768
|
+
}, "strip", z.ZodTypeAny, {
|
|
769
|
+
context?: string | undefined;
|
|
770
|
+
}, {
|
|
771
|
+
context?: string | undefined;
|
|
772
|
+
}>;
|
|
773
|
+
type NoIdeaArgs = z.infer<typeof NoIdeaArgsSchema>;
|
|
774
|
+
/**
|
|
775
|
+
* Response format for no_idea tool
|
|
776
|
+
*/
|
|
777
|
+
interface NoIdeaResponse {
|
|
778
|
+
instructions: string;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Tool handler for acknowledging knowledge gaps
|
|
782
|
+
*/
|
|
783
|
+
declare class NoIdeaHandler extends BaseToolHandler<NoIdeaArgs, NoIdeaResponse> {
|
|
784
|
+
protected readonly argsSchema: z.ZodObject<{
|
|
785
|
+
context: z.ZodOptional<z.ZodString>;
|
|
786
|
+
}, "strip", z.ZodTypeAny, {
|
|
787
|
+
context?: string | undefined;
|
|
788
|
+
}, {
|
|
789
|
+
context?: string | undefined;
|
|
790
|
+
}>;
|
|
791
|
+
executeHandler(args: NoIdeaArgs, _context: ServerContext): Promise<NoIdeaResponse>;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Tool Handler Registry
|
|
796
|
+
*
|
|
797
|
+
* Central registry for all tool handlers. Provides registration and lookup
|
|
798
|
+
* functionality for tool handlers used by the MCP server.
|
|
799
|
+
*/
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Default implementation of ToolRegistry
|
|
803
|
+
*/
|
|
804
|
+
declare class DefaultToolRegistry implements ToolRegistry {
|
|
805
|
+
private handlers;
|
|
806
|
+
register<T extends ToolHandler>(name: string, handler: T): void;
|
|
807
|
+
get(name: string): ToolHandler | undefined;
|
|
808
|
+
list(): string[];
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Create and configure the default tool registry with all standard handlers
|
|
812
|
+
*/
|
|
813
|
+
declare function createToolRegistry(): ToolRegistry;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Factory function to create a server with real components
|
|
817
|
+
*/
|
|
818
|
+
declare function createResponsibleVibeMCPServer(config?: ServerConfig): Promise<ResponsibleVibeMCPServer>;
|
|
819
|
+
/**
|
|
820
|
+
* Main server class that orchestrates all components
|
|
821
|
+
* Can be used both as a standalone process and in-process for testing
|
|
822
|
+
*/
|
|
823
|
+
declare class ResponsibleVibeMCPServer {
|
|
824
|
+
private config;
|
|
825
|
+
private serverComponents;
|
|
826
|
+
private components;
|
|
827
|
+
constructor(config: ServerConfig, serverComponents: ServerComponents);
|
|
828
|
+
/**
|
|
829
|
+
* Initialize the server and all its components
|
|
830
|
+
*/
|
|
831
|
+
initialize(): Promise<void>;
|
|
832
|
+
/**
|
|
833
|
+
* Get the underlying MCP server instance
|
|
834
|
+
* This allows for both transport-based and direct testing
|
|
835
|
+
*/
|
|
836
|
+
getMcpServer(): _modelcontextprotocol_sdk_server_mcp_js.McpServer;
|
|
837
|
+
/**
|
|
838
|
+
* Get project path
|
|
839
|
+
*/
|
|
840
|
+
getProjectPath(): string;
|
|
841
|
+
/**
|
|
842
|
+
* Get conversation manager (for testing)
|
|
843
|
+
*/
|
|
844
|
+
getConversationManager(): _codemcp_workflows_core.ConversationManager;
|
|
845
|
+
/**
|
|
846
|
+
* Get plan manager (for testing)
|
|
847
|
+
*/
|
|
848
|
+
getPlanManager(): _codemcp_workflows_core.IPlanManager;
|
|
849
|
+
/**
|
|
850
|
+
* Direct access to tool handlers for testing
|
|
851
|
+
*/
|
|
852
|
+
handleWhatsNext(args: unknown): Promise<unknown>;
|
|
853
|
+
/**
|
|
854
|
+
* Direct access to tool handlers for testing
|
|
855
|
+
*/
|
|
856
|
+
handleProceedToPhase(args: ProceedToPhaseArgs): Promise<ProceedToPhaseResult>;
|
|
857
|
+
/**
|
|
858
|
+
* Direct access to tool handlers for testing
|
|
859
|
+
*/
|
|
860
|
+
handleStartDevelopment(args: StartDevelopmentArgs): Promise<StartDevelopmentResult>;
|
|
861
|
+
/**
|
|
862
|
+
* Direct access to tool handlers for testing
|
|
863
|
+
*/
|
|
864
|
+
handleResumeWorkflow(args: ResumeWorkflowArgs): Promise<ResumeWorkflowResult>;
|
|
865
|
+
/**
|
|
866
|
+
* Direct access to tool handlers for testing
|
|
867
|
+
*/
|
|
868
|
+
handleResetDevelopment(args: ResetDevelopmentArgs): Promise<ResetDevelopmentResult>;
|
|
869
|
+
/**
|
|
870
|
+
* Cleanup server resources
|
|
871
|
+
*/
|
|
872
|
+
cleanup(): Promise<void>;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Core PluginRegistry implementation for managing plugins and executing lifecycle hooks
|
|
877
|
+
*/
|
|
878
|
+
|
|
879
|
+
declare class PluginRegistry implements IPluginRegistry {
|
|
880
|
+
private plugins;
|
|
881
|
+
/**
|
|
882
|
+
* Register a plugin.
|
|
883
|
+
*
|
|
884
|
+
* Note: Plugins are always registered regardless of isEnabled() state.
|
|
885
|
+
* The isEnabled() check happens at hook execution time in getEnabledPlugins().
|
|
886
|
+
* This allows plugins to activate/deactivate dynamically based on conditions
|
|
887
|
+
* that may change after registration (e.g., backend availability).
|
|
888
|
+
*/
|
|
889
|
+
registerPlugin(plugin: IPlugin): void;
|
|
890
|
+
/**
|
|
891
|
+
* Get all enabled plugins sorted by execution sequence
|
|
892
|
+
*/
|
|
893
|
+
getEnabledPlugins(): IPlugin[];
|
|
894
|
+
/**
|
|
895
|
+
* Execute a specific hook on all plugins that implement it
|
|
896
|
+
* Plugins are executed in sequence order
|
|
897
|
+
*
|
|
898
|
+
* Error Handling Strategy:
|
|
899
|
+
* - Validation hooks (beforePhaseTransition): Always re-throw to block invalid transitions
|
|
900
|
+
* - Critical startup hooks: Re-throw to fail fast and show critical errors
|
|
901
|
+
* - Non-critical hooks: Log error and continue execution to enable graceful degradation
|
|
902
|
+
* - Multiple plugins: If one plugin fails on non-critical hook, continue with next plugin
|
|
903
|
+
*/
|
|
904
|
+
executeHook<T extends keyof PluginHooks>(hookName: T, ...args: Parameters<NonNullable<PluginHooks[T]>>): Promise<unknown>;
|
|
905
|
+
/**
|
|
906
|
+
* Type-safe hook execution dispatcher
|
|
907
|
+
* Handles the differences in hook signatures without type coercion
|
|
908
|
+
*/
|
|
909
|
+
private executeTypedHook;
|
|
910
|
+
/**
|
|
911
|
+
* Check if any enabled plugin implements a specific hook
|
|
912
|
+
*/
|
|
913
|
+
hasHook(hookName: keyof PluginHooks): boolean;
|
|
914
|
+
/**
|
|
915
|
+
* Get names of all registered plugins (for debugging)
|
|
916
|
+
*/
|
|
917
|
+
getPluginNames(): string[];
|
|
918
|
+
/**
|
|
919
|
+
* Clear all plugins (mainly for testing)
|
|
920
|
+
*/
|
|
921
|
+
clear(): void;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Beads Plugin Implementation
|
|
926
|
+
*
|
|
927
|
+
* Plugin that integrates beads task management system with the workflows server.
|
|
928
|
+
* Encapsulates ALL beads-specific functionality to maintain zero core application
|
|
929
|
+
* coupling as specified in plugin architecture design.
|
|
930
|
+
*
|
|
931
|
+
* Core Principle: This plugin must be completely self-contained and the core
|
|
932
|
+
* application must have ZERO knowledge of beads functionality.
|
|
933
|
+
*/
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* BeadsPlugin class implementing the IPlugin interface
|
|
937
|
+
*
|
|
938
|
+
* Activation: When beads backend is detected (either via TASK_BACKEND=beads env var
|
|
939
|
+
* or auto-detection when bd CLI is available)
|
|
940
|
+
* Priority: Sequence 100 (middle priority)
|
|
941
|
+
* Encapsulation: All beads functionality contained within this plugin
|
|
942
|
+
*/
|
|
943
|
+
declare class BeadsPlugin implements IPlugin {
|
|
944
|
+
private projectPath;
|
|
945
|
+
private beadsStateManager;
|
|
946
|
+
private beadsTaskBackendClient;
|
|
947
|
+
private planManager;
|
|
948
|
+
private logger;
|
|
949
|
+
private loggerFactory?;
|
|
950
|
+
constructor(options: {
|
|
951
|
+
projectPath: string;
|
|
952
|
+
loggerFactory?: LoggerFactory;
|
|
953
|
+
});
|
|
954
|
+
getName(): string;
|
|
955
|
+
getSequence(): number;
|
|
956
|
+
isEnabled(): boolean;
|
|
957
|
+
getHooks(): PluginHooks;
|
|
958
|
+
/**
|
|
959
|
+
* Handle beforePhaseTransition hook
|
|
960
|
+
* Replaces validateBeadsTaskCompletion() method from proceed-to-phase.ts
|
|
961
|
+
*/
|
|
962
|
+
private handleBeforePhaseTransition;
|
|
963
|
+
/**
|
|
964
|
+
* Handle afterStartDevelopment hook
|
|
965
|
+
* Replaces setupBeadsIntegration() method from start-development.ts
|
|
966
|
+
* Implements graceful degradation: continues app operation even if beads operations fail
|
|
967
|
+
*/
|
|
968
|
+
private handleAfterStartDevelopment;
|
|
969
|
+
/**
|
|
970
|
+
* Handle afterPlanFileCreated hook
|
|
971
|
+
* Enhances the plan file with beads-specific templates and placeholders
|
|
972
|
+
*
|
|
973
|
+
* This hook is called after a plan file is created. For beads integration,
|
|
974
|
+
* it ensures the plan file has TBD placeholders for phase task IDs that
|
|
975
|
+
* will be filled in later by afterStartDevelopment.
|
|
976
|
+
*
|
|
977
|
+
* Note: Task IDs themselves are created in afterStartDevelopment, not here.
|
|
978
|
+
* This hook ensures the plan has the proper structure to receive them.
|
|
979
|
+
*/
|
|
980
|
+
private handleAfterPlanFileCreated;
|
|
981
|
+
/**
|
|
982
|
+
* Handle afterInstructionsGenerated hook
|
|
983
|
+
* Enriches instructions with beads-specific task management guidance
|
|
984
|
+
*/
|
|
985
|
+
private handleAfterInstructionsGenerated;
|
|
986
|
+
/**
|
|
987
|
+
* Generate beads-specific task management guidance
|
|
988
|
+
*/
|
|
989
|
+
private generateBeadsGuidance;
|
|
990
|
+
/**
|
|
991
|
+
* Extract phase task ID from plan file
|
|
992
|
+
*/
|
|
993
|
+
private extractPhaseTaskIdFromPlanFile;
|
|
994
|
+
/**
|
|
995
|
+
* Capitalize phase name for display
|
|
996
|
+
*/
|
|
997
|
+
private capitalizePhase;
|
|
998
|
+
/**
|
|
999
|
+
* Validate beads task completion before phase transition
|
|
1000
|
+
* Implements graceful error handling: logs errors but continues on non-validation failures
|
|
1001
|
+
*/
|
|
1002
|
+
private validateBeadsTaskCompletion;
|
|
1003
|
+
/**
|
|
1004
|
+
* Extract Goal section content from plan file
|
|
1005
|
+
* Returns the goal content if it exists and is meaningful, otherwise undefined
|
|
1006
|
+
*/
|
|
1007
|
+
private extractGoalFromPlan;
|
|
1008
|
+
/**
|
|
1009
|
+
* Update plan file to include beads phase task IDs in comments
|
|
1010
|
+
* Implements graceful degradation: logs errors but continues app operation if update fails
|
|
1011
|
+
*/
|
|
1012
|
+
private updatePlanFileWithPhaseTaskIds;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Vibe Feature MCP Server Entry Point
|
|
1017
|
+
*
|
|
1018
|
+
* Starts the MCP server with stdio transport for process-based usage.
|
|
1019
|
+
* The core server logic is in server.ts for better testability.
|
|
1020
|
+
*/
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Main entry point for the MCP server process
|
|
1024
|
+
*/
|
|
1025
|
+
declare function main(): Promise<void>;
|
|
1026
|
+
|
|
1027
|
+
export { BaseToolHandler, BeadsPlugin, type ConductReviewArgs, ConductReviewHandler, type ConductReviewResult, ConversationRequiredToolHandler, DefaultToolRegistry, type GetToolInfoArgs, GetToolInfoHandler, type GetToolInfoResponse, type HandlerResult, ListWorkflowsHandler, type NoIdeaArgs, NoIdeaHandler, type NoIdeaResponse, PluginRegistry, type ProceedToPhaseArgs, ProceedToPhaseHandler, type ProceedToPhaseResult, type ResetDevelopmentArgs, ResetDevelopmentHandler, type ResetDevelopmentResult, ResponsibleVibeMCPServer, type ResumeWorkflowArgs, ResumeWorkflowHandler, type ResumeWorkflowResult, type ServerContext, type SetupProjectDocsArgs, SetupProjectDocsHandler, type SetupProjectDocsResult, type StartDevelopmentArgs, StartDevelopmentHandler, type StartDevelopmentResult, type WhatsNextArgs, WhatsNextHandler, type WhatsNextResult, createResponsibleVibeMCPServer, createToolRegistry, main as startMcpServer };
|