@codemcp/workflows 3.1.21
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/.turbo/turbo-build.log +4 -0
- package/.vibe/conversation-state.sqlite +0 -0
- package/LICENSE +674 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/notification-service.d.ts +14 -0
- package/dist/notification-service.d.ts.map +1 -0
- package/dist/notification-service.js +18 -0
- package/dist/notification-service.js.map +1 -0
- package/dist/resource-handlers/conversation-state.d.ts +15 -0
- package/dist/resource-handlers/conversation-state.d.ts.map +1 -0
- package/dist/resource-handlers/conversation-state.js +40 -0
- package/dist/resource-handlers/conversation-state.js.map +1 -0
- package/dist/resource-handlers/development-plan.d.ts +14 -0
- package/dist/resource-handlers/development-plan.d.ts.map +1 -0
- package/dist/resource-handlers/development-plan.js +31 -0
- package/dist/resource-handlers/development-plan.js.map +1 -0
- package/dist/resource-handlers/index.d.ts +24 -0
- package/dist/resource-handlers/index.d.ts.map +1 -0
- package/dist/resource-handlers/index.js +62 -0
- package/dist/resource-handlers/index.js.map +1 -0
- package/dist/resource-handlers/system-prompt.d.ts +15 -0
- package/dist/resource-handlers/system-prompt.d.ts.map +1 -0
- package/dist/resource-handlers/system-prompt.js +40 -0
- package/dist/resource-handlers/system-prompt.js.map +1 -0
- package/dist/resource-handlers/workflow-resource.d.ts +15 -0
- package/dist/resource-handlers/workflow-resource.d.ts.map +1 -0
- package/dist/resource-handlers/workflow-resource.js +85 -0
- package/dist/resource-handlers/workflow-resource.js.map +1 -0
- package/dist/response-renderer.d.ts +30 -0
- package/dist/response-renderer.d.ts.map +1 -0
- package/dist/response-renderer.js +94 -0
- package/dist/response-renderer.js.map +1 -0
- package/dist/server-config.d.ts +34 -0
- package/dist/server-config.d.ts.map +1 -0
- package/dist/server-config.js +486 -0
- package/dist/server-config.js.map +1 -0
- package/dist/server-helpers.d.ts +62 -0
- package/dist/server-helpers.d.ts.map +1 -0
- package/dist/server-helpers.js +156 -0
- package/dist/server-helpers.js.map +1 -0
- package/dist/server-implementation.d.ts +74 -0
- package/dist/server-implementation.d.ts.map +1 -0
- package/dist/server-implementation.js +201 -0
- package/dist/server-implementation.js.map +1 -0
- package/dist/server.d.ts +6 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -0
- package/dist/tool-handlers/base-tool-handler.d.ts +50 -0
- package/dist/tool-handlers/base-tool-handler.d.ts.map +1 -0
- package/dist/tool-handlers/base-tool-handler.js +74 -0
- package/dist/tool-handlers/base-tool-handler.js.map +1 -0
- package/dist/tool-handlers/conduct-review.d.ts +49 -0
- package/dist/tool-handlers/conduct-review.d.ts.map +1 -0
- package/dist/tool-handlers/conduct-review.js +105 -0
- package/dist/tool-handlers/conduct-review.js.map +1 -0
- package/dist/tool-handlers/get-tool-info.d.ts +76 -0
- package/dist/tool-handlers/get-tool-info.d.ts.map +1 -0
- package/dist/tool-handlers/get-tool-info.js +168 -0
- package/dist/tool-handlers/get-tool-info.js.map +1 -0
- package/dist/tool-handlers/index.d.ts +42 -0
- package/dist/tool-handlers/index.d.ts.map +1 -0
- package/dist/tool-handlers/index.js +74 -0
- package/dist/tool-handlers/index.js.map +1 -0
- package/dist/tool-handlers/install-workflow.d.ts +48 -0
- package/dist/tool-handlers/install-workflow.d.ts.map +1 -0
- package/dist/tool-handlers/install-workflow.js +131 -0
- package/dist/tool-handlers/install-workflow.js.map +1 -0
- package/dist/tool-handlers/list-workflows.d.ts +47 -0
- package/dist/tool-handlers/list-workflows.d.ts.map +1 -0
- package/dist/tool-handlers/list-workflows.js +58 -0
- package/dist/tool-handlers/list-workflows.js.map +1 -0
- package/dist/tool-handlers/no-idea.d.ts +41 -0
- package/dist/tool-handlers/no-idea.d.ts.map +1 -0
- package/dist/tool-handlers/no-idea.js +29 -0
- package/dist/tool-handlers/no-idea.js.map +1 -0
- package/dist/tool-handlers/proceed-to-phase.d.ts +39 -0
- package/dist/tool-handlers/proceed-to-phase.d.ts.map +1 -0
- package/dist/tool-handlers/proceed-to-phase.js +109 -0
- package/dist/tool-handlers/proceed-to-phase.js.map +1 -0
- package/dist/tool-handlers/reset-development.d.ts +31 -0
- package/dist/tool-handlers/reset-development.d.ts.map +1 -0
- package/dist/tool-handlers/reset-development.js +48 -0
- package/dist/tool-handlers/reset-development.js.map +1 -0
- package/dist/tool-handlers/resume-workflow.d.ts +88 -0
- package/dist/tool-handlers/resume-workflow.d.ts.map +1 -0
- package/dist/tool-handlers/resume-workflow.js +213 -0
- package/dist/tool-handlers/resume-workflow.js.map +1 -0
- package/dist/tool-handlers/setup-project-docs.d.ts +36 -0
- package/dist/tool-handlers/setup-project-docs.d.ts.map +1 -0
- package/dist/tool-handlers/setup-project-docs.js +136 -0
- package/dist/tool-handlers/setup-project-docs.js.map +1 -0
- package/dist/tool-handlers/start-development.d.ts +82 -0
- package/dist/tool-handlers/start-development.d.ts.map +1 -0
- package/dist/tool-handlers/start-development.js +448 -0
- package/dist/tool-handlers/start-development.js.map +1 -0
- package/dist/tool-handlers/whats-next.d.ts +42 -0
- package/dist/tool-handlers/whats-next.d.ts.map +1 -0
- package/dist/tool-handlers/whats-next.js +118 -0
- package/dist/tool-handlers/whats-next.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +29 -0
- package/src/index.ts +93 -0
- package/src/notification-service.ts +23 -0
- package/src/resource-handlers/conversation-state.ts +55 -0
- package/src/resource-handlers/development-plan.ts +48 -0
- package/src/resource-handlers/index.ts +73 -0
- package/src/resource-handlers/system-prompt.ts +55 -0
- package/src/resource-handlers/workflow-resource.ts +126 -0
- package/src/response-renderer.ts +116 -0
- package/src/server-config.ts +744 -0
- package/src/server-helpers.ts +225 -0
- package/src/server-implementation.ts +277 -0
- package/src/server.ts +9 -0
- package/src/tool-handlers/base-tool-handler.ts +141 -0
- package/src/tool-handlers/conduct-review.ts +191 -0
- package/src/tool-handlers/get-tool-info.ts +274 -0
- package/src/tool-handlers/index.ts +117 -0
- package/src/tool-handlers/install-workflow.ts +185 -0
- package/src/tool-handlers/list-workflows.ts +94 -0
- package/src/tool-handlers/no-idea.ts +47 -0
- package/src/tool-handlers/proceed-to-phase.ts +205 -0
- package/src/tool-handlers/reset-development.ts +90 -0
- package/src/tool-handlers/resume-workflow.ts +380 -0
- package/src/tool-handlers/setup-project-docs.ts +226 -0
- package/src/tool-handlers/start-development.ts +685 -0
- package/src/tool-handlers/whats-next.ts +235 -0
- package/src/types.ts +130 -0
- package/test/e2e/core-functionality.test.ts +176 -0
- package/test/e2e/mcp-contract.test.ts +540 -0
- package/test/e2e/plan-management.test.ts +331 -0
- package/test/e2e/state-management.test.ts +392 -0
- package/test/e2e/workflow-integration.test.ts +506 -0
- package/test/unit/commit-behaviour-interface.test.ts +244 -0
- package/test/unit/conduct-review.test.ts +151 -0
- package/test/unit/reset-functionality.test.ts +72 -0
- package/test/unit/resume-workflow.test.ts +192 -0
- package/test/unit/server-tools.test.ts +311 -0
- package/test/unit/setup-project-docs-handler.test.ts +267 -0
- package/test/unit/start-development-artifact-detection.test.ts +387 -0
- package/test/unit/start-development-gitignore.test.ts +178 -0
- package/test/unit/system-prompt-resource.test.ts +101 -0
- package/test/unit/tool-handlers/no-idea.test.ts +40 -0
- package/test/utils/e2e-test-setup.ts +453 -0
- package/test/utils/run-server-in-dir.sh +27 -0
- package/test/utils/temp-files.ts +308 -0
- package/test/utils/test-access.ts +79 -0
- package/test/utils/test-helpers.ts +286 -0
- package/test/utils/test-setup.ts +78 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +17 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResumeWorkflow Tool Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles resuming development workflow after conversation compression.
|
|
5
|
+
* Returns comprehensive project context, current state, system prompt instructions,
|
|
6
|
+
* and next steps to seamlessly continue development.
|
|
7
|
+
*/
|
|
8
|
+
import { ConversationRequiredToolHandler } from './base-tool-handler.js';
|
|
9
|
+
import type { YamlStateMachine } from '@codemcp/workflows-core';
|
|
10
|
+
import { ServerContext } from '../types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Arguments for the resume_workflow tool
|
|
13
|
+
*/
|
|
14
|
+
export interface ResumeWorkflowArgs {
|
|
15
|
+
include_system_prompt?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Plan file analysis result
|
|
19
|
+
*/
|
|
20
|
+
interface PlanAnalysis {
|
|
21
|
+
sections: string[];
|
|
22
|
+
tasks_completed: number;
|
|
23
|
+
tasks_total: number;
|
|
24
|
+
key_decisions: string[];
|
|
25
|
+
recent_updates: string[];
|
|
26
|
+
active_tasks?: string[];
|
|
27
|
+
completed_tasks?: string[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Conversation context for resume workflow
|
|
31
|
+
*/
|
|
32
|
+
interface ConversationContext {
|
|
33
|
+
conversationId: string;
|
|
34
|
+
currentPhase: string;
|
|
35
|
+
projectPath: string;
|
|
36
|
+
workflowName: string;
|
|
37
|
+
gitBranch: string;
|
|
38
|
+
planFilePath: string;
|
|
39
|
+
current_phase?: string;
|
|
40
|
+
workflow_name?: string;
|
|
41
|
+
project_context?: string;
|
|
42
|
+
recent_activity?: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Response from the resume_workflow tool
|
|
46
|
+
*/
|
|
47
|
+
export interface ResumeWorkflowResult {
|
|
48
|
+
workflow_status: {
|
|
49
|
+
conversation_id: string;
|
|
50
|
+
current_phase: string;
|
|
51
|
+
project_path: string;
|
|
52
|
+
git_branch: string;
|
|
53
|
+
state_machine: YamlStateMachine;
|
|
54
|
+
};
|
|
55
|
+
plan_status: {
|
|
56
|
+
exists: boolean;
|
|
57
|
+
path: string;
|
|
58
|
+
analysis?: PlanAnalysis | null;
|
|
59
|
+
};
|
|
60
|
+
system_prompt?: string | null;
|
|
61
|
+
recommendations: {
|
|
62
|
+
immediate_actions: string[];
|
|
63
|
+
phase_guidance: string;
|
|
64
|
+
potential_issues: string[];
|
|
65
|
+
};
|
|
66
|
+
generated_at: string;
|
|
67
|
+
tool_version: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* ResumeWorkflow tool handler implementation
|
|
71
|
+
*/
|
|
72
|
+
export declare class ResumeWorkflowHandler extends ConversationRequiredToolHandler<ResumeWorkflowArgs, ResumeWorkflowResult> {
|
|
73
|
+
protected executeWithConversation(args: ResumeWorkflowArgs, context: ServerContext, conversationContext: ConversationContext): Promise<ResumeWorkflowResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Analyze plan file content to extract key information
|
|
76
|
+
*/
|
|
77
|
+
private analyzePlanFile;
|
|
78
|
+
/**
|
|
79
|
+
* Get state machine information
|
|
80
|
+
*/
|
|
81
|
+
private getStateMachineInfo;
|
|
82
|
+
/**
|
|
83
|
+
* Generate recommendations for next steps based on state machine transitions
|
|
84
|
+
*/
|
|
85
|
+
private generateRecommendations;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=resume-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-workflow.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/resume-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACj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C;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,+BAA+B,CACxE,kBAAkB,EAClB,oBAAoB,CACrB;cACiB,uBAAuB,CACrC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,aAAa,EACtB,mBAAmB,EAAE,mBAAmB,GACvC,OAAO,CAAC,oBAAoB,CAAC;IA8EhC;;OAEG;IACH,OAAO,CAAC,eAAe;IAiDvB;;OAEG;YACW,mBAAmB;IAuCjC;;OAEG;IACH,OAAO,CAAC,uBAAuB;CA6GhC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResumeWorkflow Tool Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles resuming development workflow after conversation compression.
|
|
5
|
+
* Returns comprehensive project context, current state, system prompt instructions,
|
|
6
|
+
* and next steps to seamlessly continue development.
|
|
7
|
+
*/
|
|
8
|
+
import { ConversationRequiredToolHandler } from './base-tool-handler.js';
|
|
9
|
+
import { generateSystemPrompt } from '@codemcp/workflows-core';
|
|
10
|
+
/**
|
|
11
|
+
* ResumeWorkflow tool handler implementation
|
|
12
|
+
*/
|
|
13
|
+
export class ResumeWorkflowHandler extends ConversationRequiredToolHandler {
|
|
14
|
+
async executeWithConversation(args, context, conversationContext) {
|
|
15
|
+
const includeSystemPrompt = args.include_system_prompt !== false; // Default to true
|
|
16
|
+
this.logger.debug('Processing resume_workflow request', {
|
|
17
|
+
conversationId: conversationContext.conversationId,
|
|
18
|
+
includeSystemPrompt,
|
|
19
|
+
});
|
|
20
|
+
// Get plan file information
|
|
21
|
+
const planInfo = await context.planManager.getPlanFileInfo(conversationContext.planFilePath);
|
|
22
|
+
// Analyze plan file content for key information
|
|
23
|
+
const planAnalysis = planInfo.exists && planInfo.content
|
|
24
|
+
? this.analyzePlanFile(planInfo.content)
|
|
25
|
+
: null;
|
|
26
|
+
// Get current state machine information
|
|
27
|
+
const stateMachineInfo = await this.getStateMachineInfo(context, conversationContext.projectPath, conversationContext.workflowName);
|
|
28
|
+
const stateMachine = context.transitionEngine.getStateMachine(conversationContext.projectPath, conversationContext.workflowName);
|
|
29
|
+
// Generate system prompt if requested
|
|
30
|
+
const systemPrompt = includeSystemPrompt
|
|
31
|
+
? generateSystemPrompt(stateMachine)
|
|
32
|
+
: null;
|
|
33
|
+
// Build comprehensive response
|
|
34
|
+
const response = {
|
|
35
|
+
// Core workflow resumption info
|
|
36
|
+
workflow_status: {
|
|
37
|
+
conversation_id: conversationContext.conversationId,
|
|
38
|
+
current_phase: conversationContext.currentPhase,
|
|
39
|
+
project_path: conversationContext.projectPath,
|
|
40
|
+
git_branch: conversationContext.gitBranch,
|
|
41
|
+
state_machine: stateMachineInfo,
|
|
42
|
+
},
|
|
43
|
+
// Plan file analysis
|
|
44
|
+
plan_status: {
|
|
45
|
+
exists: planInfo.exists,
|
|
46
|
+
path: conversationContext.planFilePath,
|
|
47
|
+
analysis: planAnalysis,
|
|
48
|
+
},
|
|
49
|
+
// System prompt (if requested)
|
|
50
|
+
system_prompt: systemPrompt,
|
|
51
|
+
// Next steps and recommendations
|
|
52
|
+
recommendations: this.generateRecommendations(conversationContext, planAnalysis, context),
|
|
53
|
+
// Metadata
|
|
54
|
+
generated_at: new Date().toISOString(),
|
|
55
|
+
tool_version: '1.0.0',
|
|
56
|
+
};
|
|
57
|
+
this.logger.debug('resume_workflow response generated', {
|
|
58
|
+
conversationId: conversationContext.conversationId,
|
|
59
|
+
phase: conversationContext.currentPhase,
|
|
60
|
+
planExists: planInfo.exists,
|
|
61
|
+
includeSystemPrompt,
|
|
62
|
+
});
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Analyze plan file content to extract key information
|
|
67
|
+
*/
|
|
68
|
+
analyzePlanFile(content) {
|
|
69
|
+
const analysis = {
|
|
70
|
+
active_tasks: [],
|
|
71
|
+
completed_tasks: [],
|
|
72
|
+
recent_decisions: [],
|
|
73
|
+
next_steps: [],
|
|
74
|
+
};
|
|
75
|
+
const lines = content.split('\n');
|
|
76
|
+
let inTaskSection = false;
|
|
77
|
+
let currentSection = '';
|
|
78
|
+
for (const line of lines) {
|
|
79
|
+
const trimmed = line.trim();
|
|
80
|
+
// Detect sections
|
|
81
|
+
if (trimmed.startsWith('##')) {
|
|
82
|
+
currentSection = trimmed.toLowerCase();
|
|
83
|
+
inTaskSection =
|
|
84
|
+
currentSection.includes('task') || currentSection.includes('todo');
|
|
85
|
+
}
|
|
86
|
+
// Extract tasks
|
|
87
|
+
if (inTaskSection) {
|
|
88
|
+
if (trimmed.startsWith('- [x]')) {
|
|
89
|
+
analysis.completed_tasks.push(trimmed.substring(5).trim());
|
|
90
|
+
}
|
|
91
|
+
else if (trimmed.startsWith('- [ ]')) {
|
|
92
|
+
analysis.active_tasks.push(trimmed.substring(5).trim());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Extract decisions (look for decision log sections)
|
|
96
|
+
if (currentSection.includes('decision') && trimmed.startsWith('- ')) {
|
|
97
|
+
analysis.recent_decisions.push(trimmed.substring(2).trim());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
sections: [currentSection],
|
|
102
|
+
tasks_completed: analysis.completed_tasks.length,
|
|
103
|
+
tasks_total: analysis.active_tasks.length + analysis.completed_tasks.length,
|
|
104
|
+
key_decisions: analysis.recent_decisions,
|
|
105
|
+
recent_updates: analysis.next_steps,
|
|
106
|
+
active_tasks: analysis.active_tasks,
|
|
107
|
+
completed_tasks: analysis.completed_tasks,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get state machine information
|
|
112
|
+
*/
|
|
113
|
+
async getStateMachineInfo(context, projectPath, workflowName) {
|
|
114
|
+
try {
|
|
115
|
+
// Get the actual state machine for this project
|
|
116
|
+
const stateMachine = context.transitionEngine.getStateMachine(projectPath, workflowName);
|
|
117
|
+
return {
|
|
118
|
+
name: stateMachine.name,
|
|
119
|
+
description: stateMachine.description,
|
|
120
|
+
initial_state: stateMachine.initial_state,
|
|
121
|
+
phases: Object.keys(stateMachine.states),
|
|
122
|
+
phase_descriptions: Object.fromEntries(Object.entries(stateMachine.states).map(([phase, definition]) => [
|
|
123
|
+
phase,
|
|
124
|
+
definition.description,
|
|
125
|
+
])),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
const err = error;
|
|
130
|
+
this.logger.warn('Could not determine state machine info', {
|
|
131
|
+
error: err.message,
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
name: 'unknown',
|
|
135
|
+
description: 'Could not load workflow',
|
|
136
|
+
initial_state: 'unknown',
|
|
137
|
+
phases: [],
|
|
138
|
+
phase_descriptions: {},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Generate recommendations for next steps based on state machine transitions
|
|
144
|
+
*/
|
|
145
|
+
generateRecommendations(conversationContext, planAnalysis, context) {
|
|
146
|
+
const recommendations = {
|
|
147
|
+
immediate_actions: [],
|
|
148
|
+
phase_guidance: '',
|
|
149
|
+
potential_issues: [],
|
|
150
|
+
};
|
|
151
|
+
try {
|
|
152
|
+
// Get the state machine for this project
|
|
153
|
+
const stateMachine = context.transitionEngine.getStateMachine(conversationContext.projectPath, conversationContext.workflowName);
|
|
154
|
+
const currentPhase = conversationContext.currentPhase;
|
|
155
|
+
const phaseDefinition = stateMachine.states[currentPhase];
|
|
156
|
+
if (phaseDefinition) {
|
|
157
|
+
// Set phase guidance from state machine description
|
|
158
|
+
recommendations.phase_guidance = `Current phase: ${phaseDefinition.description}`;
|
|
159
|
+
// Generate transition-based recommendations
|
|
160
|
+
if (phaseDefinition.transitions &&
|
|
161
|
+
phaseDefinition.transitions.length > 0) {
|
|
162
|
+
recommendations.immediate_actions.push('From here, you can transition to:');
|
|
163
|
+
for (const transition of phaseDefinition.transitions) {
|
|
164
|
+
const targetPhase = stateMachine.states[transition.to];
|
|
165
|
+
const targetDescription = targetPhase
|
|
166
|
+
? targetPhase.description
|
|
167
|
+
: transition.to;
|
|
168
|
+
recommendations.immediate_actions.push(`• ${transition.to}: ${targetDescription}`);
|
|
169
|
+
}
|
|
170
|
+
// Add instruction on how to transition
|
|
171
|
+
recommendations.immediate_actions.push('Use proceed_to_phase() tool when ready to transition');
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
recommendations.immediate_actions.push('Continue working in current phase');
|
|
175
|
+
}
|
|
176
|
+
// Add current phase specific guidance
|
|
177
|
+
recommendations.immediate_actions.push(`Focus on: ${phaseDefinition.description}`);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
// Fallback if phase not found in state machine
|
|
181
|
+
recommendations.phase_guidance = `Current phase: ${currentPhase}`;
|
|
182
|
+
recommendations.immediate_actions.push('Continue working in current phase');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
const err = error;
|
|
187
|
+
this.logger.warn('Could not generate state machine recommendations', {
|
|
188
|
+
error: err.message,
|
|
189
|
+
});
|
|
190
|
+
// Basic fallback
|
|
191
|
+
recommendations.phase_guidance = `Current phase: ${conversationContext.currentPhase}`;
|
|
192
|
+
recommendations.immediate_actions.push('Continue working in current phase');
|
|
193
|
+
}
|
|
194
|
+
// Plan-based recommendations
|
|
195
|
+
if (planAnalysis) {
|
|
196
|
+
if (planAnalysis.active_tasks && planAnalysis.active_tasks.length > 0) {
|
|
197
|
+
recommendations.immediate_actions.push(`Continue working on active tasks: ${planAnalysis.active_tasks.slice(0, 2).join(', ')}`);
|
|
198
|
+
}
|
|
199
|
+
if ((!planAnalysis.active_tasks ||
|
|
200
|
+
planAnalysis.active_tasks.length === 0) &&
|
|
201
|
+
planAnalysis.completed_tasks &&
|
|
202
|
+
planAnalysis.completed_tasks.length > 0) {
|
|
203
|
+
recommendations.potential_issues.push('No active tasks found - may be ready to transition to next phase');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Always recommend calling whats_next
|
|
207
|
+
if (!recommendations.immediate_actions.some(action => action.includes('whats_next'))) {
|
|
208
|
+
recommendations.immediate_actions.unshift('Call whats_next() to get current phase-specific guidance');
|
|
209
|
+
}
|
|
210
|
+
return recommendations;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=resume-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-workflow.js","sourceRoot":"","sources":["../../src/tool-handlers/resume-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA2E/D;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,+BAG1C;IACW,KAAK,CAAC,uBAAuB,CACrC,IAAwB,EACxB,OAAsB,EACtB,mBAAwC;QAExC,MAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,KAAK,KAAK,CAAC,CAAC,kBAAkB;QAEpF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE;YACtD,cAAc,EAAE,mBAAmB,CAAC,cAAc;YAClD,mBAAmB;SACpB,CAAC,CAAC;QAEH,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,eAAe,CACxD,mBAAmB,CAAC,YAAY,CACjC,CAAC;QAEF,gDAAgD;QAChD,MAAM,YAAY,GAChB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,OAAO;YACjC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC;YACxC,CAAC,CAAC,IAAI,CAAC;QAEX,wCAAwC;QACxC,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CACrD,OAAO,EACP,mBAAmB,CAAC,WAAW,EA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C,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC;gBACzC,YAAY,CAAC,eAAe;gBAC5B,YAAY,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EACvC,CAAC;gBACD,eAAe,CAAC,gBAAgB,CAAC,IAAI,CACnC,kEAAkE,CACnE,CAAC;YACJ,CAAC;QACH,CAAC;QAED,sCAAsC;QACtC,IACE,CAAC,eAAe,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAC/C,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAC9B,EACD,CAAC;YACD,eAAe,CAAC,iBAAiB,CAAC,OAAO,CACvC,0DAA0D,CAC3D,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Project Docs Handler
|
|
3
|
+
*
|
|
4
|
+
* Creates project documentation artifacts (architecture.md, requirements.md, design.md)
|
|
5
|
+
* using configurable templates OR by linking existing files via symlinks.
|
|
6
|
+
* Supports different template formats for each document type and file path linking.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseToolHandler } from './base-tool-handler.js';
|
|
9
|
+
import { ServerContext } from '../types.js';
|
|
10
|
+
export interface SetupProjectDocsArgs {
|
|
11
|
+
architecture: string;
|
|
12
|
+
requirements: string;
|
|
13
|
+
design: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SetupProjectDocsResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
created: string[];
|
|
18
|
+
linked: string[];
|
|
19
|
+
skipped: string[];
|
|
20
|
+
paths: {
|
|
21
|
+
architecture: string;
|
|
22
|
+
requirements: string;
|
|
23
|
+
design: string;
|
|
24
|
+
};
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class SetupProjectDocsHandler extends BaseToolHandler<SetupProjectDocsArgs, SetupProjectDocsResult> {
|
|
28
|
+
private projectDocsManager;
|
|
29
|
+
constructor();
|
|
30
|
+
protected executeHandler(args: SetupProjectDocsArgs, context: ServerContext): Promise<SetupProjectDocsResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Validate and process arguments to determine templates vs file paths
|
|
33
|
+
*/
|
|
34
|
+
private validateAndProcessArgs;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=setup-project-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-project-docs.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/setup-project-docs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,uBAAwB,SAAQ,eAAe,CAC1D,oBAAoB,EACpB,sBAAsB,CACvB;IACC,OAAO,CAAC,kBAAkB,CAAqB;;cAO/B,cAAc,CAC5B,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,sBAAsB,CAAC;IA2FlC;;OAEG;YACW,sBAAsB;CAoFrC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Project Docs Handler
|
|
3
|
+
*
|
|
4
|
+
* Creates project documentation artifacts (architecture.md, requirements.md, design.md)
|
|
5
|
+
* using configurable templates OR by linking existing files via symlinks.
|
|
6
|
+
* Supports different template formats for each document type and file path linking.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseToolHandler } from './base-tool-handler.js';
|
|
9
|
+
import { ProjectDocsManager } from '@codemcp/workflows-core';
|
|
10
|
+
import { PathValidationUtils } from '@codemcp/workflows-core';
|
|
11
|
+
export class SetupProjectDocsHandler extends BaseToolHandler {
|
|
12
|
+
projectDocsManager;
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.projectDocsManager = new ProjectDocsManager();
|
|
16
|
+
}
|
|
17
|
+
async executeHandler(args, context) {
|
|
18
|
+
const projectPath = context.projectPath || process.cwd();
|
|
19
|
+
this.logger.info('Setting up project docs with enhanced file linking support', { args, projectPath });
|
|
20
|
+
try {
|
|
21
|
+
// Get available templates for validation
|
|
22
|
+
const availableTemplates = await this.projectDocsManager.templateManager.getAvailableTemplates();
|
|
23
|
+
// Validate and process each parameter
|
|
24
|
+
const processedArgs = await this.validateAndProcessArgs(args, availableTemplates, projectPath);
|
|
25
|
+
if (!processedArgs.success) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
created: [],
|
|
29
|
+
linked: [],
|
|
30
|
+
skipped: [],
|
|
31
|
+
paths: this.projectDocsManager.getDocumentPaths(projectPath),
|
|
32
|
+
message: processedArgs.error || 'Unknown error during validation',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Create/link project documents
|
|
36
|
+
if (!processedArgs.templateOptions || !processedArgs.filePaths) {
|
|
37
|
+
throw new Error('Invalid processed args: missing templateOptions or filePaths');
|
|
38
|
+
}
|
|
39
|
+
const result = await this.projectDocsManager.createOrLinkProjectDocs(projectPath, processedArgs.templateOptions, processedArgs.filePaths);
|
|
40
|
+
// Get document paths for response
|
|
41
|
+
const paths = this.projectDocsManager.getDocumentPaths(projectPath);
|
|
42
|
+
// Create success message
|
|
43
|
+
let message = 'Project documentation setup completed.';
|
|
44
|
+
if (result.created.length > 0) {
|
|
45
|
+
message += ` Created: ${result.created.join(', ')}.`;
|
|
46
|
+
}
|
|
47
|
+
if (result.linked.length > 0) {
|
|
48
|
+
message += ` Linked: ${result.linked.join(', ')}.`;
|
|
49
|
+
}
|
|
50
|
+
if (result.skipped.length > 0) {
|
|
51
|
+
message += ` Skipped existing: ${result.skipped.join(', ')}.`;
|
|
52
|
+
}
|
|
53
|
+
this.logger.info('Project docs setup completed', {
|
|
54
|
+
created: result.created,
|
|
55
|
+
linked: result.linked,
|
|
56
|
+
skipped: result.skipped,
|
|
57
|
+
paths,
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
created: result.created,
|
|
62
|
+
linked: result.linked,
|
|
63
|
+
skipped: result.skipped,
|
|
64
|
+
paths,
|
|
65
|
+
message,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.logger.error('Failed to setup project docs', error, {
|
|
70
|
+
args,
|
|
71
|
+
projectPath,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
created: [],
|
|
76
|
+
linked: [],
|
|
77
|
+
skipped: [],
|
|
78
|
+
paths: this.projectDocsManager.getDocumentPaths(projectPath),
|
|
79
|
+
message: `Failed to setup project docs: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate and process arguments to determine templates vs file paths
|
|
85
|
+
*/
|
|
86
|
+
async validateAndProcessArgs(args, availableTemplates, projectPath) {
|
|
87
|
+
const templateOptions = {};
|
|
88
|
+
const filePaths = {};
|
|
89
|
+
const errors = [];
|
|
90
|
+
// Validate architecture parameter
|
|
91
|
+
const archValidation = await PathValidationUtils.validateParameter(args.architecture, availableTemplates.architecture, projectPath);
|
|
92
|
+
if (archValidation.isTemplate) {
|
|
93
|
+
templateOptions.architecture = args.architecture;
|
|
94
|
+
}
|
|
95
|
+
else if (archValidation.isFilePath && archValidation.resolvedPath) {
|
|
96
|
+
filePaths.architecture = archValidation.resolvedPath;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
errors.push(`Architecture: ${archValidation.error}`);
|
|
100
|
+
}
|
|
101
|
+
// Validate requirements parameter
|
|
102
|
+
const reqValidation = await PathValidationUtils.validateParameter(args.requirements, availableTemplates.requirements, projectPath);
|
|
103
|
+
if (reqValidation.isTemplate) {
|
|
104
|
+
templateOptions.requirements = args.requirements;
|
|
105
|
+
}
|
|
106
|
+
else if (reqValidation.isFilePath && reqValidation.resolvedPath) {
|
|
107
|
+
filePaths.requirements = reqValidation.resolvedPath;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
errors.push(`Requirements: ${reqValidation.error}`);
|
|
111
|
+
}
|
|
112
|
+
// Validate design parameter
|
|
113
|
+
const designValidation = await PathValidationUtils.validateParameter(args.design, availableTemplates.design, projectPath);
|
|
114
|
+
if (designValidation.isTemplate) {
|
|
115
|
+
templateOptions.design = args.design;
|
|
116
|
+
}
|
|
117
|
+
else if (designValidation.isFilePath && designValidation.resolvedPath) {
|
|
118
|
+
filePaths.design = designValidation.resolvedPath;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
errors.push(`Design: ${designValidation.error}`);
|
|
122
|
+
}
|
|
123
|
+
if (errors.length > 0) {
|
|
124
|
+
return {
|
|
125
|
+
success: false,
|
|
126
|
+
error: `Parameter validation failed:\n${errors.join('\n')}`,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
success: true,
|
|
131
|
+
templateOptions,
|
|
132
|
+
filePaths,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=setup-project-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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|
|
1
|
+
/**
|
|
2
|
+
* StartDevelopment Tool Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles initialization of development workflow and transition to the initial
|
|
5
|
+
* development phase. Allows users to choose from predefined workflows or use a custom workflow.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseToolHandler } from './base-tool-handler.js';
|
|
8
|
+
import type { YamlStateMachine } from '@codemcp/workflows-core';
|
|
9
|
+
import { ServerContext } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Arguments for the start_development tool
|
|
12
|
+
*/
|
|
13
|
+
export interface StartDevelopmentArgs {
|
|
14
|
+
workflow: string;
|
|
15
|
+
commit_behaviour?: 'step' | 'phase' | 'end' | 'none';
|
|
16
|
+
require_reviews?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Response from the start_development tool
|
|
20
|
+
*/
|
|
21
|
+
export interface StartDevelopmentResult {
|
|
22
|
+
phase: string;
|
|
23
|
+
instructions: string;
|
|
24
|
+
plan_file_path: string;
|
|
25
|
+
conversation_id: string;
|
|
26
|
+
workflow: YamlStateMachine;
|
|
27
|
+
workflowDocumentationUrl?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* StartDevelopment tool handler implementation
|
|
31
|
+
*/
|
|
32
|
+
export declare class StartDevelopmentHandler extends BaseToolHandler<StartDevelopmentArgs, StartDevelopmentResult> {
|
|
33
|
+
private projectDocsManager;
|
|
34
|
+
constructor();
|
|
35
|
+
protected executeHandler(args: StartDevelopmentArgs, context: ServerContext): Promise<StartDevelopmentResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Check if project documentation artifacts exist and provide setup guidance if needed
|
|
38
|
+
* Dynamically analyzes the selected workflow to determine which documents are referenced
|
|
39
|
+
* Blocks workflow start if the workflow requires documentation
|
|
40
|
+
*/
|
|
41
|
+
private checkProjectArtifacts;
|
|
42
|
+
/**
|
|
43
|
+
* Analyze workflow content to detect document variable references
|
|
44
|
+
*/
|
|
45
|
+
private analyzeWorkflowDocumentReferences;
|
|
46
|
+
/**
|
|
47
|
+
* Determine which referenced documents are missing
|
|
48
|
+
*/
|
|
49
|
+
private getMissingReferencedDocuments;
|
|
50
|
+
/**
|
|
51
|
+
* Generate guidance for setting up missing project artifacts
|
|
52
|
+
*/
|
|
53
|
+
private generateArtifactSetupGuidance;
|
|
54
|
+
/**
|
|
55
|
+
* Generate template options text dynamically
|
|
56
|
+
*/
|
|
57
|
+
private generateTemplateOptionsText;
|
|
58
|
+
/**
|
|
59
|
+
* Get description for a template based on its name and type
|
|
60
|
+
*/
|
|
61
|
+
private getTemplateDescription;
|
|
62
|
+
/**
|
|
63
|
+
* Generate workflow documentation URL for predefined workflows
|
|
64
|
+
* Returns undefined for custom workflows
|
|
65
|
+
*/
|
|
66
|
+
private generateWorkflowDocumentationUrl;
|
|
67
|
+
/**
|
|
68
|
+
* Get the current git branch for a project
|
|
69
|
+
* Uses the same logic as ConversationManager but locally accessible
|
|
70
|
+
*/
|
|
71
|
+
private getCurrentGitBranch;
|
|
72
|
+
/**
|
|
73
|
+
* Generate a suggested branch name for feature development
|
|
74
|
+
*/
|
|
75
|
+
private generateBranchSuggestion;
|
|
76
|
+
/**
|
|
77
|
+
* Ensure .gitignore exists in .vibe folder to exclude SQLite files
|
|
78
|
+
* This function is idempotent and self-contained within the .vibe directory
|
|
79
|
+
*/
|
|
80
|
+
private ensureGitignoreEntry;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=start-development.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-development.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/start-development.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAOzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAA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