@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.
Files changed (159) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.vibe/conversation-state.sqlite +0 -0
  3. package/LICENSE +674 -0
  4. package/dist/index.d.ts +9 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +74 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/notification-service.d.ts +14 -0
  9. package/dist/notification-service.d.ts.map +1 -0
  10. package/dist/notification-service.js +18 -0
  11. package/dist/notification-service.js.map +1 -0
  12. package/dist/resource-handlers/conversation-state.d.ts +15 -0
  13. package/dist/resource-handlers/conversation-state.d.ts.map +1 -0
  14. package/dist/resource-handlers/conversation-state.js +40 -0
  15. package/dist/resource-handlers/conversation-state.js.map +1 -0
  16. package/dist/resource-handlers/development-plan.d.ts +14 -0
  17. package/dist/resource-handlers/development-plan.d.ts.map +1 -0
  18. package/dist/resource-handlers/development-plan.js +31 -0
  19. package/dist/resource-handlers/development-plan.js.map +1 -0
  20. package/dist/resource-handlers/index.d.ts +24 -0
  21. package/dist/resource-handlers/index.d.ts.map +1 -0
  22. package/dist/resource-handlers/index.js +62 -0
  23. package/dist/resource-handlers/index.js.map +1 -0
  24. package/dist/resource-handlers/system-prompt.d.ts +15 -0
  25. package/dist/resource-handlers/system-prompt.d.ts.map +1 -0
  26. package/dist/resource-handlers/system-prompt.js +40 -0
  27. package/dist/resource-handlers/system-prompt.js.map +1 -0
  28. package/dist/resource-handlers/workflow-resource.d.ts +15 -0
  29. package/dist/resource-handlers/workflow-resource.d.ts.map +1 -0
  30. package/dist/resource-handlers/workflow-resource.js +85 -0
  31. package/dist/resource-handlers/workflow-resource.js.map +1 -0
  32. package/dist/response-renderer.d.ts +30 -0
  33. package/dist/response-renderer.d.ts.map +1 -0
  34. package/dist/response-renderer.js +94 -0
  35. package/dist/response-renderer.js.map +1 -0
  36. package/dist/server-config.d.ts +34 -0
  37. package/dist/server-config.d.ts.map +1 -0
  38. package/dist/server-config.js +486 -0
  39. package/dist/server-config.js.map +1 -0
  40. package/dist/server-helpers.d.ts +62 -0
  41. package/dist/server-helpers.d.ts.map +1 -0
  42. package/dist/server-helpers.js +156 -0
  43. package/dist/server-helpers.js.map +1 -0
  44. package/dist/server-implementation.d.ts +74 -0
  45. package/dist/server-implementation.d.ts.map +1 -0
  46. package/dist/server-implementation.js +201 -0
  47. package/dist/server-implementation.js.map +1 -0
  48. package/dist/server.d.ts +6 -0
  49. package/dist/server.d.ts.map +1 -0
  50. package/dist/server.js +5 -0
  51. package/dist/server.js.map +1 -0
  52. package/dist/tool-handlers/base-tool-handler.d.ts +50 -0
  53. package/dist/tool-handlers/base-tool-handler.d.ts.map +1 -0
  54. package/dist/tool-handlers/base-tool-handler.js +74 -0
  55. package/dist/tool-handlers/base-tool-handler.js.map +1 -0
  56. package/dist/tool-handlers/conduct-review.d.ts +49 -0
  57. package/dist/tool-handlers/conduct-review.d.ts.map +1 -0
  58. package/dist/tool-handlers/conduct-review.js +105 -0
  59. package/dist/tool-handlers/conduct-review.js.map +1 -0
  60. package/dist/tool-handlers/get-tool-info.d.ts +76 -0
  61. package/dist/tool-handlers/get-tool-info.d.ts.map +1 -0
  62. package/dist/tool-handlers/get-tool-info.js +168 -0
  63. package/dist/tool-handlers/get-tool-info.js.map +1 -0
  64. package/dist/tool-handlers/index.d.ts +42 -0
  65. package/dist/tool-handlers/index.d.ts.map +1 -0
  66. package/dist/tool-handlers/index.js +74 -0
  67. package/dist/tool-handlers/index.js.map +1 -0
  68. package/dist/tool-handlers/install-workflow.d.ts +48 -0
  69. package/dist/tool-handlers/install-workflow.d.ts.map +1 -0
  70. package/dist/tool-handlers/install-workflow.js +131 -0
  71. package/dist/tool-handlers/install-workflow.js.map +1 -0
  72. package/dist/tool-handlers/list-workflows.d.ts +47 -0
  73. package/dist/tool-handlers/list-workflows.d.ts.map +1 -0
  74. package/dist/tool-handlers/list-workflows.js +58 -0
  75. package/dist/tool-handlers/list-workflows.js.map +1 -0
  76. package/dist/tool-handlers/no-idea.d.ts +41 -0
  77. package/dist/tool-handlers/no-idea.d.ts.map +1 -0
  78. package/dist/tool-handlers/no-idea.js +29 -0
  79. package/dist/tool-handlers/no-idea.js.map +1 -0
  80. package/dist/tool-handlers/proceed-to-phase.d.ts +39 -0
  81. package/dist/tool-handlers/proceed-to-phase.d.ts.map +1 -0
  82. package/dist/tool-handlers/proceed-to-phase.js +109 -0
  83. package/dist/tool-handlers/proceed-to-phase.js.map +1 -0
  84. package/dist/tool-handlers/reset-development.d.ts +31 -0
  85. package/dist/tool-handlers/reset-development.d.ts.map +1 -0
  86. package/dist/tool-handlers/reset-development.js +48 -0
  87. package/dist/tool-handlers/reset-development.js.map +1 -0
  88. package/dist/tool-handlers/resume-workflow.d.ts +88 -0
  89. package/dist/tool-handlers/resume-workflow.d.ts.map +1 -0
  90. package/dist/tool-handlers/resume-workflow.js +213 -0
  91. package/dist/tool-handlers/resume-workflow.js.map +1 -0
  92. package/dist/tool-handlers/setup-project-docs.d.ts +36 -0
  93. package/dist/tool-handlers/setup-project-docs.d.ts.map +1 -0
  94. package/dist/tool-handlers/setup-project-docs.js +136 -0
  95. package/dist/tool-handlers/setup-project-docs.js.map +1 -0
  96. package/dist/tool-handlers/start-development.d.ts +82 -0
  97. package/dist/tool-handlers/start-development.d.ts.map +1 -0
  98. package/dist/tool-handlers/start-development.js +448 -0
  99. package/dist/tool-handlers/start-development.js.map +1 -0
  100. package/dist/tool-handlers/whats-next.d.ts +42 -0
  101. package/dist/tool-handlers/whats-next.d.ts.map +1 -0
  102. package/dist/tool-handlers/whats-next.js +118 -0
  103. package/dist/tool-handlers/whats-next.js.map +1 -0
  104. package/dist/types.d.ts +114 -0
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/types.js +5 -0
  107. package/dist/types.js.map +1 -0
  108. package/package.json +29 -0
  109. package/src/index.ts +93 -0
  110. package/src/notification-service.ts +23 -0
  111. package/src/resource-handlers/conversation-state.ts +55 -0
  112. package/src/resource-handlers/development-plan.ts +48 -0
  113. package/src/resource-handlers/index.ts +73 -0
  114. package/src/resource-handlers/system-prompt.ts +55 -0
  115. package/src/resource-handlers/workflow-resource.ts +126 -0
  116. package/src/response-renderer.ts +116 -0
  117. package/src/server-config.ts +744 -0
  118. package/src/server-helpers.ts +225 -0
  119. package/src/server-implementation.ts +277 -0
  120. package/src/server.ts +9 -0
  121. package/src/tool-handlers/base-tool-handler.ts +141 -0
  122. package/src/tool-handlers/conduct-review.ts +191 -0
  123. package/src/tool-handlers/get-tool-info.ts +274 -0
  124. package/src/tool-handlers/index.ts +117 -0
  125. package/src/tool-handlers/install-workflow.ts +185 -0
  126. package/src/tool-handlers/list-workflows.ts +94 -0
  127. package/src/tool-handlers/no-idea.ts +47 -0
  128. package/src/tool-handlers/proceed-to-phase.ts +205 -0
  129. package/src/tool-handlers/reset-development.ts +90 -0
  130. package/src/tool-handlers/resume-workflow.ts +380 -0
  131. package/src/tool-handlers/setup-project-docs.ts +226 -0
  132. package/src/tool-handlers/start-development.ts +685 -0
  133. package/src/tool-handlers/whats-next.ts +235 -0
  134. package/src/types.ts +130 -0
  135. package/test/e2e/core-functionality.test.ts +176 -0
  136. package/test/e2e/mcp-contract.test.ts +540 -0
  137. package/test/e2e/plan-management.test.ts +331 -0
  138. package/test/e2e/state-management.test.ts +392 -0
  139. package/test/e2e/workflow-integration.test.ts +506 -0
  140. package/test/unit/commit-behaviour-interface.test.ts +244 -0
  141. package/test/unit/conduct-review.test.ts +151 -0
  142. package/test/unit/reset-functionality.test.ts +72 -0
  143. package/test/unit/resume-workflow.test.ts +192 -0
  144. package/test/unit/server-tools.test.ts +311 -0
  145. package/test/unit/setup-project-docs-handler.test.ts +267 -0
  146. package/test/unit/start-development-artifact-detection.test.ts +387 -0
  147. package/test/unit/start-development-gitignore.test.ts +178 -0
  148. package/test/unit/system-prompt-resource.test.ts +101 -0
  149. package/test/unit/tool-handlers/no-idea.test.ts +40 -0
  150. package/test/utils/e2e-test-setup.ts +453 -0
  151. package/test/utils/run-server-in-dir.sh +27 -0
  152. package/test/utils/temp-files.ts +308 -0
  153. package/test/utils/test-access.ts +79 -0
  154. package/test/utils/test-helpers.ts +286 -0
  155. package/test/utils/test-setup.ts +78 -0
  156. package/tsconfig.build.json +9 -0
  157. package/tsconfig.build.tsbuildinfo +1 -0
  158. package/tsconfig.json +12 -0
  159. package/vitest.config.ts +17 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Install Workflow Tool Handler
3
+ *
4
+ * Installs workflows to .vibe/workflows/ directory from various sources
5
+ */
6
+ import { z } from 'zod';
7
+ import { BaseToolHandler } from './base-tool-handler.js';
8
+ import { ServerContext } from '../types.js';
9
+ /**
10
+ * Schema for install_workflow tool arguments
11
+ */
12
+ declare const InstallWorkflowArgsSchema: z.ZodObject<{
13
+ source: z.ZodString;
14
+ name: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ source: string;
17
+ name?: string | undefined;
18
+ }, {
19
+ source: string;
20
+ name?: string | undefined;
21
+ }>;
22
+ type InstallWorkflowArgs = z.infer<typeof InstallWorkflowArgsSchema>;
23
+ interface InstallWorkflowResponse {
24
+ success: boolean;
25
+ message: string;
26
+ installedPath?: string;
27
+ }
28
+ /**
29
+ * Tool handler for installing workflows
30
+ */
31
+ export declare class InstallWorkflowHandler extends BaseToolHandler<InstallWorkflowArgs, InstallWorkflowResponse> {
32
+ protected readonly argsSchema: z.ZodObject<{
33
+ source: z.ZodString;
34
+ name: z.ZodOptional<z.ZodString>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ source: string;
37
+ name?: string | undefined;
38
+ }, {
39
+ source: string;
40
+ name?: string | undefined;
41
+ }>;
42
+ executeHandler(args: InstallWorkflowArgs, context: ServerContext): Promise<InstallWorkflowResponse>;
43
+ private installFromUrl;
44
+ private installFromPredefined;
45
+ private findWorkflowsDirectory;
46
+ }
47
+ export {};
48
+ //# sourceMappingURL=install-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-workflow.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/install-workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAKzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C;;GAEG;AACH,QAAA,MAAM,yBAAyB;;;;;;;;;EAU7B,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAErE,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe,CACzD,mBAAmB,EACnB,uBAAuB,CACxB;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU;;;;;;;;;OAA6B;IAEpD,cAAc,CAClB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,uBAAuB,CAAC;YAwCrB,cAAc;YAad,qBAAqB;IAgEnC,OAAO,CAAC,sBAAsB;CAgB/B"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Install Workflow Tool Handler
3
+ *
4
+ * Installs workflows to .vibe/workflows/ directory from various sources
5
+ */
6
+ import { z } from 'zod';
7
+ import { BaseToolHandler } from './base-tool-handler.js';
8
+ import { createLogger } from '@codemcp/workflows-core';
9
+ import { notificationService } from '../notification-service.js';
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ const logger = createLogger('InstallWorkflowHandler');
13
+ /**
14
+ * Schema for install_workflow tool arguments
15
+ */
16
+ const InstallWorkflowArgsSchema = z.object({
17
+ source: z
18
+ .string()
19
+ .describe('Source workflow name (from unloaded workflows) or URL to workflow file'),
20
+ name: z
21
+ .string()
22
+ .optional()
23
+ .describe('Custom name for installed workflow (defaults to source name)'),
24
+ });
25
+ /**
26
+ * Tool handler for installing workflows
27
+ */
28
+ export class InstallWorkflowHandler extends BaseToolHandler {
29
+ argsSchema = InstallWorkflowArgsSchema;
30
+ async executeHandler(args, context) {
31
+ logger.info('Installing workflow', {
32
+ source: args.source,
33
+ name: args.name,
34
+ projectPath: context.projectPath,
35
+ });
36
+ try {
37
+ // Create .vibe/workflows directory if it doesn't exist
38
+ const workflowsDir = path.join(context.projectPath, '.vibe', 'workflows');
39
+ fs.mkdirSync(workflowsDir, { recursive: true });
40
+ // Determine if source is a workflow name or URL
41
+ const isUrl = args.source.startsWith('http://') || args.source.startsWith('https://');
42
+ if (isUrl) {
43
+ return await this.installFromUrl(args.source, args.name, workflowsDir);
44
+ }
45
+ else {
46
+ return await this.installFromPredefined(args.source, args.name, workflowsDir, context);
47
+ }
48
+ }
49
+ catch (error) {
50
+ const errorMessage = `Failed to install workflow: ${error instanceof Error ? error.message : 'Unknown error'}`;
51
+ logger.error('Workflow installation failed', error, {
52
+ source: args.source,
53
+ name: args.name,
54
+ });
55
+ return {
56
+ success: false,
57
+ message: errorMessage,
58
+ };
59
+ }
60
+ }
61
+ async installFromUrl(_url, _customName, _workflowsDir) {
62
+ // For now, return not implemented for URLs
63
+ return {
64
+ success: false,
65
+ message: 'URL-based workflow installation not yet implemented. Use predefined workflow names.',
66
+ };
67
+ }
68
+ async installFromPredefined(workflowName, customName, workflowsDir, context) {
69
+ // Get all available workflows (including unloaded ones)
70
+ const allWorkflows = context.workflowManager.getAllAvailableWorkflows();
71
+ const sourceWorkflow = allWorkflows.find(w => w.name === workflowName);
72
+ if (!sourceWorkflow) {
73
+ return {
74
+ success: false,
75
+ message: `Workflow '${workflowName}' not found. Use list_workflows({include_unloaded: true}) to see available workflows.`,
76
+ };
77
+ }
78
+ // Find the source workflow file
79
+ const workflowsSourceDir = this.findWorkflowsDirectory();
80
+ const sourceFile = path.join(workflowsSourceDir, `${workflowName}.yaml`);
81
+ if (!fs.existsSync(sourceFile)) {
82
+ return {
83
+ success: false,
84
+ message: `Source workflow file not found: ${sourceFile}`,
85
+ };
86
+ }
87
+ // Determine target filename
88
+ const targetName = customName || workflowName;
89
+ const targetFile = path.join(workflowsDir, `${targetName}.yaml`);
90
+ // Check if target already exists
91
+ if (fs.existsSync(targetFile)) {
92
+ return {
93
+ success: false,
94
+ message: `Workflow '${targetName}' already exists in .vibe/workflows/. Remove it first or use a different name.`,
95
+ };
96
+ }
97
+ // Copy the workflow file
98
+ fs.copyFileSync(sourceFile, targetFile);
99
+ // Reload project workflows to make the installed workflow immediately available
100
+ context.workflowManager.loadProjectWorkflows(context.projectPath);
101
+ logger.info('Workflow installed successfully', {
102
+ source: workflowName,
103
+ target: targetName,
104
+ path: targetFile,
105
+ });
106
+ // Notify MCP client that tool list has changed. There is no specific
107
+ // notification for parameter description changes, so we reuse tool list change.
108
+ // most MCP hosts will however not support this properly, thus we'll instruct the user to restart the server.
109
+ await notificationService.notifyToolListChanged();
110
+ return {
111
+ success: true,
112
+ message: `Workflow '${workflowName}' installed as '${targetName}' in .vibe/workflows/ . You may need to restart your agent to use it.`,
113
+ installedPath: targetFile,
114
+ };
115
+ }
116
+ findWorkflowsDirectory() {
117
+ // Same logic as WorkflowManager
118
+ const possiblePaths = [
119
+ path.join(process.cwd(), 'resources', 'workflows'),
120
+ path.join(process.cwd(), 'dist', '..', 'resources', 'workflows'),
121
+ path.join(process.cwd(), 'src', '..', 'resources', 'workflows'),
122
+ ];
123
+ for (const workflowsPath of possiblePaths) {
124
+ if (fs.existsSync(workflowsPath)) {
125
+ return workflowsPath;
126
+ }
127
+ }
128
+ throw new Error('Workflows directory not found');
129
+ }
130
+ }
131
+ //# sourceMappingURL=install-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-workflow.js","sourceRoot":"","sources":["../../src/tool-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Y,mBAAmB,UAAU,uEAAuE;YACtI,aAAa,EAAE,UAAU;SAC1B,CAAC;IACJ,CAAC;IAEO,sBAAsB;QAC5B,gCAAgC;QAChC,MAAM,aAAa,GAAG;YACpB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC;YAClD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC;YAChE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC;SAChE,CAAC;QAEF,KAAK,MAAM,aAAa,IAAI,aAAa,EAAE,CAAC;YAC1C,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBACjC,OAAO,aAAa,CAAC;YACvB,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,47 @@
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
+ import { z } from 'zod';
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ import { ServerContext } from '../types.js';
10
+ /**
11
+ * Schema for list_workflows tool arguments
12
+ */
13
+ declare const ListWorkflowsArgsSchema: z.ZodObject<{
14
+ include_unloaded: z.ZodOptional<z.ZodBoolean>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ include_unloaded?: boolean | undefined;
17
+ }, {
18
+ include_unloaded?: boolean | undefined;
19
+ }>;
20
+ type ListWorkflowsArgs = z.infer<typeof ListWorkflowsArgsSchema>;
21
+ /**
22
+ * Response format for workflow information
23
+ */
24
+ interface WorkflowOverview {
25
+ name: string;
26
+ displayName: string;
27
+ description: string;
28
+ resourceUri: string;
29
+ }
30
+ interface ListWorkflowsResponse {
31
+ workflows: WorkflowOverview[];
32
+ }
33
+ /**
34
+ * Tool handler for listing available workflows
35
+ */
36
+ export declare class ListWorkflowsHandler extends BaseToolHandler<ListWorkflowsArgs, ListWorkflowsResponse> {
37
+ protected readonly argsSchema: z.ZodObject<{
38
+ include_unloaded: z.ZodOptional<z.ZodBoolean>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ include_unloaded?: boolean | undefined;
41
+ }, {
42
+ include_unloaded?: boolean | undefined;
43
+ }>;
44
+ executeHandler(args: ListWorkflowsArgs, context: ServerContext): Promise<ListWorkflowsResponse>;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=list-workflows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-workflows.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/list-workflows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C;;GAEG;AACH,QAAA,MAAM,uBAAuB;;;;;;EAO3B,CAAC;AAEH,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEjE;;GAEG;AACH,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,qBAAqB;IAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,eAAe,CACvD,iBAAiB,EACjB,qBAAqB,CACtB;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU;;;;;;OAA2B;IAElD,cAAc,CAClB,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,qBAAqB,CAAC;CAuClC"}
@@ -0,0 +1,58 @@
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
+ import { z } from 'zod';
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ import { createLogger } from '@codemcp/workflows-core';
10
+ const logger = createLogger('ListWorkflowsHandler');
11
+ /**
12
+ * Schema for list_workflows tool arguments
13
+ */
14
+ const ListWorkflowsArgsSchema = z.object({
15
+ include_unloaded: z
16
+ .boolean()
17
+ .optional()
18
+ .describe('Include workflows not loaded due to domain filtering. Default: false'),
19
+ });
20
+ /**
21
+ * Tool handler for listing available workflows
22
+ */
23
+ export class ListWorkflowsHandler extends BaseToolHandler {
24
+ argsSchema = ListWorkflowsArgsSchema;
25
+ async executeHandler(args, context) {
26
+ logger.info('Listing available workflows', {
27
+ projectPath: context.projectPath,
28
+ includeUnloaded: args.include_unloaded,
29
+ });
30
+ let availableWorkflows;
31
+ if (args.include_unloaded) {
32
+ // Get all workflows regardless of domain filtering
33
+ availableWorkflows = context.workflowManager.getAllAvailableWorkflows();
34
+ }
35
+ else {
36
+ // Get only loaded workflows (respects current domain filtering)
37
+ availableWorkflows =
38
+ context.workflowManager.getAvailableWorkflowsForProject(context.projectPath);
39
+ }
40
+ // Transform to response format with resource URIs
41
+ const workflows = availableWorkflows.map(workflow => ({
42
+ name: workflow.name,
43
+ displayName: workflow.displayName,
44
+ description: workflow.description,
45
+ resourceUri: `workflow://${workflow.name}`,
46
+ }));
47
+ const response = {
48
+ workflows,
49
+ };
50
+ logger.info('Successfully listed workflows', {
51
+ count: workflows.length,
52
+ includeUnloaded: args.include_unloaded,
53
+ workflows: workflows.map(w => w.name),
54
+ });
55
+ return response;
56
+ }
57
+ }
58
+ //# sourceMappingURL=list-workflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-workflows.js","source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WAAW,EAAE,cAAc,QAAQ,CAAC,IAAI,EAAE;SAC3C,CAAC,CAAC,CAAC;QAEJ,MAAM,QAAQ,GAA0B;YACtC,SAAS;SACV,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE;YAC3C,KAAK,EAAE,SAAS,CAAC,MAAM;YACvB,eAAe,EAAE,IAAI,CAAC,gBAAgB;YACtC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACtC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * No Idea Tool Handler
3
+ *
4
+ * Provides instructions for LLMs to acknowledge knowledge gaps
5
+ * instead of hallucinating responses.
6
+ */
7
+ import { z } from 'zod';
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ import { ServerContext } from '../types.js';
10
+ /**
11
+ * Schema for no_idea tool arguments
12
+ */
13
+ declare const NoIdeaArgsSchema: z.ZodObject<{
14
+ context: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ context?: string | undefined;
17
+ }, {
18
+ context?: string | undefined;
19
+ }>;
20
+ export type NoIdeaArgs = z.infer<typeof NoIdeaArgsSchema>;
21
+ /**
22
+ * Response format for no_idea tool
23
+ */
24
+ export interface NoIdeaResponse {
25
+ instructions: string;
26
+ }
27
+ /**
28
+ * Tool handler for acknowledging knowledge gaps
29
+ */
30
+ export declare class NoIdeaHandler extends BaseToolHandler<NoIdeaArgs, NoIdeaResponse> {
31
+ protected readonly argsSchema: z.ZodObject<{
32
+ context: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ context?: string | undefined;
35
+ }, {
36
+ context?: string | undefined;
37
+ }>;
38
+ executeHandler(args: NoIdeaArgs, _context: ServerContext): Promise<NoIdeaResponse>;
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=no-idea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-idea.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/no-idea.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;;;;EAKpB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,UAAU,EAAE,cAAc,CAAC;IAC5E,SAAS,CAAC,QAAQ,CAAC,UAAU;;;;;;OAAoB;IAE3C,cAAc,CAClB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,cAAc,CAAC;CAO3B"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * No Idea Tool Handler
3
+ *
4
+ * Provides instructions for LLMs to acknowledge knowledge gaps
5
+ * instead of hallucinating responses.
6
+ */
7
+ import { z } from 'zod';
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ /**
10
+ * Schema for no_idea tool arguments
11
+ */
12
+ const NoIdeaArgsSchema = z.object({
13
+ context: z
14
+ .string()
15
+ .optional()
16
+ .describe('Optional context about what you have no knowledge of'),
17
+ });
18
+ /**
19
+ * Tool handler for acknowledging knowledge gaps
20
+ */
21
+ export class NoIdeaHandler extends BaseToolHandler {
22
+ argsSchema = NoIdeaArgsSchema;
23
+ async executeHandler(args, _context) {
24
+ const context = args.context?.trim() || 'this topic';
25
+ 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.`;
26
+ return { instructions };
27
+ }
28
+ }
29
+ //# sourceMappingURL=no-idea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-idea.js","sourceRoot":"","sources":["../../src/tool-handlers/no-idea.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,sDAAsD,CAAC;CACpE,CAAC,CAAC;AAWH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,eAA2C;IACzD,UAAU,GAAG,gBAAgB,CAAC;IAEjD,KAAK,CAAC,cAAc,CAClB,IAAgB,EAChB,QAAuB;QAEvB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,YAAY,CAAC;QAErD,MAAM,YAAY,GAAG,sCAAsC,OAAO,mFAAmF,CAAC;QAEtJ,OAAO,EAAE,YAAY,EAAE,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * ProceedToPhase Tool Handler
3
+ *
4
+ * Handles explicit transitions to specific development phases when the current
5
+ * phase is complete or when a direct phase change is needed.
6
+ */
7
+ import { ConversationRequiredToolHandler } from './base-tool-handler.js';
8
+ import type { ConversationContext } from '@codemcp/workflows-core';
9
+ import { ServerContext } from '../types.js';
10
+ /**
11
+ * Arguments for the proceed_to_phase tool
12
+ */
13
+ export interface ProceedToPhaseArgs {
14
+ target_phase: string;
15
+ reason?: string;
16
+ review_state: 'not-required' | 'pending' | 'performed';
17
+ }
18
+ /**
19
+ * Response from the proceed_to_phase tool
20
+ */
21
+ export interface ProceedToPhaseResult {
22
+ phase: string;
23
+ instructions: string;
24
+ plan_file_path: string;
25
+ transition_reason: string;
26
+ is_modeled_transition: boolean;
27
+ conversation_id: string;
28
+ }
29
+ /**
30
+ * ProceedToPhase tool handler implementation
31
+ */
32
+ export declare class ProceedToPhaseHandler extends ConversationRequiredToolHandler<ProceedToPhaseArgs, ProceedToPhaseResult> {
33
+ protected executeWithConversation(args: ProceedToPhaseArgs, context: ServerContext, conversationContext: ConversationContext): Promise<ProceedToPhaseResult>;
34
+ /**
35
+ * Validate review state for transitions that require reviews
36
+ */
37
+ private validateReviewState;
38
+ }
39
+ //# sourceMappingURL=proceed-to-phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proceed-to-phase.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/proceed-to-phase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,cAAc,GAAG,SAAS,GAAG,WAAW,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;CACzB;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;IA+GhC;;OAEG;YACW,mBAAmB;CA8ClC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * ProceedToPhase Tool Handler
3
+ *
4
+ * Handles explicit transitions to specific development phases when the current
5
+ * phase is complete or when a direct phase change is needed.
6
+ */
7
+ import { ConversationRequiredToolHandler } from './base-tool-handler.js';
8
+ import { validateRequiredArgs } from '../server-helpers.js';
9
+ /**
10
+ * ProceedToPhase tool handler implementation
11
+ */
12
+ export class ProceedToPhaseHandler extends ConversationRequiredToolHandler {
13
+ async executeWithConversation(args, context, conversationContext) {
14
+ // Validate required arguments
15
+ validateRequiredArgs(args, ['target_phase', 'review_state']);
16
+ const { target_phase, reason = '', review_state } = args;
17
+ const conversationId = conversationContext.conversationId;
18
+ const currentPhase = conversationContext.currentPhase;
19
+ this.logger.debug('Processing proceed_to_phase request', {
20
+ conversationId,
21
+ currentPhase,
22
+ targetPhase: target_phase,
23
+ reason,
24
+ reviewState: review_state,
25
+ });
26
+ // Validate review state if reviews are required
27
+ if (conversationContext.requireReviewsBeforePhaseTransition) {
28
+ await this.validateReviewState(review_state, currentPhase, target_phase, conversationContext.workflowName, context);
29
+ }
30
+ // Ensure state machine is loaded for this project
31
+ this.ensureStateMachineForProject(context, conversationContext.projectPath);
32
+ // Perform explicit transition
33
+ const transitionResult = context.transitionEngine.handleExplicitTransition(currentPhase, target_phase, conversationContext.projectPath, reason, conversationContext.workflowName);
34
+ // Update conversation state
35
+ await context.conversationManager.updateConversationState(conversationId, {
36
+ currentPhase: transitionResult.newPhase,
37
+ });
38
+ this.logger.info('Explicit phase transition completed', {
39
+ from: currentPhase,
40
+ to: transitionResult.newPhase,
41
+ reason: transitionResult.transitionReason,
42
+ });
43
+ // Ensure plan file exists
44
+ await context.planManager.ensurePlanFile(conversationContext.planFilePath, conversationContext.projectPath, conversationContext.gitBranch);
45
+ // Check if plan file exists
46
+ const planInfo = await context.planManager.getPlanFileInfo(conversationContext.planFilePath);
47
+ // Generate enhanced instructions
48
+ const instructions = await context.instructionGenerator.generateInstructions(transitionResult.instructions, {
49
+ phase: transitionResult.newPhase,
50
+ conversationContext: {
51
+ ...conversationContext,
52
+ currentPhase: transitionResult.newPhase,
53
+ },
54
+ transitionReason: transitionResult.transitionReason,
55
+ isModeled: transitionResult.isModeled,
56
+ planFileExists: planInfo.exists,
57
+ });
58
+ // Add commit instructions if configured
59
+ let finalInstructions = instructions.instructions;
60
+ if (conversationContext.gitCommitConfig?.enabled &&
61
+ conversationContext.gitCommitConfig.commitOnPhase) {
62
+ const commitMessage = `Phase transition: ${currentPhase} → ${target_phase}`;
63
+ finalInstructions += `\n\n**Git Commit Required**: Create a commit for this phase transition using:\n\`\`\`bash\ngit add . && git commit -m "${commitMessage}"\n\`\`\``;
64
+ }
65
+ // Prepare response
66
+ const response = {
67
+ phase: transitionResult.newPhase,
68
+ instructions: finalInstructions,
69
+ plan_file_path: conversationContext.planFilePath,
70
+ transition_reason: transitionResult.transitionReason,
71
+ is_modeled_transition: transitionResult.isModeled,
72
+ conversation_id: conversationContext.conversationId,
73
+ };
74
+ // Log interaction
75
+ await this.logInteraction(context, conversationId, 'proceed_to_phase', args, response, transitionResult.newPhase);
76
+ return response;
77
+ }
78
+ /**
79
+ * Validate review state for transitions that require reviews
80
+ */
81
+ async validateReviewState(reviewState, currentPhase, targetPhase, workflowName, context) {
82
+ // Get transition configuration from workflow
83
+ const stateMachine = context.workflowManager.loadWorkflowForProject(context.projectPath, workflowName);
84
+ const currentState = stateMachine.states[currentPhase];
85
+ if (!currentState) {
86
+ throw new Error(`Invalid current phase: ${currentPhase}`);
87
+ }
88
+ const transition = currentState.transitions.find(t => t.to === targetPhase);
89
+ if (!transition) {
90
+ throw new Error(`No transition found from ${currentPhase} to ${targetPhase}`);
91
+ }
92
+ const hasReviewPerspectives = transition.review_perspectives &&
93
+ transition.review_perspectives.length > 0;
94
+ if (hasReviewPerspectives) {
95
+ // This transition has review perspectives defined
96
+ if (reviewState === 'pending') {
97
+ throw new Error(`Review is required before proceeding to ${targetPhase}. Please use the conduct_review tool first.`);
98
+ }
99
+ if (reviewState === 'not-required') {
100
+ throw new Error(`This transition requires review, but review_state is 'not-required'. Use 'pending' or 'performed'.`);
101
+ }
102
+ }
103
+ else {
104
+ // No review perspectives defined - transition proceeds normally
105
+ // Note: No error thrown when hasReviewPerspectives is false, as per user feedback
106
+ }
107
+ }
108
+ }
109
+ //# sourceMappingURL=proceed-to-phase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proceed-to-phase.js","sourceRoot":"","sources":["../../src/tool-handlers/proceed-to-phase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAyB5D;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,+BAG1C;IACW,KAAK,CAAC,uBAAuB,CACrC,IAAwB,EACxB,OAAsB,EACtB,mBAAwC;QAExC,8BAA8B;QAC9B,oBAAoB,CAAC,IAAI,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;QAE7D,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QACzD,MAAM,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC1D,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;QAEtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE;YACvD,cAAc;YACd,YAAY;YACZ,WAAW,EAAE,YAAY;YACzB,MAAM;YACN,WAAW,EAAE,YAAY;SAC1B,CAAC,CAAC;QAEH,gDAAgD;QAChD,IAAI,mBAAmB,CAAC,mCAAmC,EAAE,CAAC;YAC5D,MAAM,IAAI,CAAC,mBAAmB,CAC5B,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,mBAAmB,CAAC,YAA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C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;QAC5E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,4BAA4B,YAAY,OAAO,WAAW,EAAE,CAC7D,CAAC;QACJ,CAAC;QAED,MAAM,qBAAqB,GACzB,UAAU,CAAC,mBAAmB;YAC9B,UAAU,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;QAE5C,IAAI,qBAAqB,EAAE,CAAC;YAC1B,kDAAkD;YAClD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CACb,2CAA2C,WAAW,6CAA6C,CACpG,CAAC;YACJ,CAAC;YACD,IAAI,WAAW,KAAK,cAAc,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,gEAAgE;YAChE,kFAAkF;QACpF,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ResetDevelopment Tool Handler
3
+ *
4
+ * Handles resetting conversation state and development progress.
5
+ * This permanently deletes conversation state and plan file, while
6
+ * soft-deleting interaction logs for audit trail.
7
+ */
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ import { ServerContext } from '../types.js';
10
+ /**
11
+ * Arguments for the reset_development tool
12
+ */
13
+ export interface ResetDevelopmentArgs {
14
+ confirm: boolean;
15
+ reason?: string;
16
+ }
17
+ /**
18
+ * Response from the reset_development tool
19
+ */
20
+ export interface ResetDevelopmentResult {
21
+ success: boolean;
22
+ resetItems: string[];
23
+ message: string;
24
+ }
25
+ /**
26
+ * ResetDevelopment tool handler implementation
27
+ */
28
+ export declare class ResetDevelopmentHandler extends BaseToolHandler<ResetDevelopmentArgs, ResetDevelopmentResult> {
29
+ protected executeHandler(args: ResetDevelopmentArgs, context: ServerContext): Promise<ResetDevelopmentResult>;
30
+ }
31
+ //# sourceMappingURL=reset-development.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-development.d.ts","sourceRoot":"","sources":["../../src/tool-handlers/reset-development.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,eAAe,CAC1D,oBAAoB,EACpB,sBAAsB,CACvB;cACiB,cAAc,CAC5B,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,sBAAsB,CAAC;CAkDnC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ResetDevelopment Tool Handler
3
+ *
4
+ * Handles resetting conversation state and development progress.
5
+ * This permanently deletes conversation state and plan file, while
6
+ * soft-deleting interaction logs for audit trail.
7
+ */
8
+ import { BaseToolHandler } from './base-tool-handler.js';
9
+ import { validateRequiredArgs } from '../server-helpers.js';
10
+ /**
11
+ * ResetDevelopment tool handler implementation
12
+ */
13
+ export class ResetDevelopmentHandler extends BaseToolHandler {
14
+ async executeHandler(args, context) {
15
+ // Validate required arguments
16
+ validateRequiredArgs(args, ['confirm']);
17
+ const { confirm, reason } = args;
18
+ this.logger.debug('Processing reset_development request', {
19
+ confirm,
20
+ hasReason: !!reason,
21
+ });
22
+ // Validate parameters
23
+ if (typeof confirm !== 'boolean') {
24
+ throw new Error('confirm parameter must be a boolean');
25
+ }
26
+ if (!confirm) {
27
+ throw new Error('Reset operation requires explicit confirmation. Set confirm parameter to true.');
28
+ }
29
+ // Ensure state machine is loaded for current project
30
+ this.ensureStateMachineForProject(context, context.projectPath);
31
+ // Perform the reset
32
+ const resetResult = await context.conversationManager.resetConversation(confirm, reason);
33
+ // Transform to match our interface
34
+ const result = {
35
+ success: resetResult.success,
36
+ resetItems: resetResult.resetItems,
37
+ message: resetResult.message,
38
+ };
39
+ // Add conversationId for backward compatibility with tests
40
+ result.conversationId = resetResult.conversationId;
41
+ this.logger.info('Reset development completed successfully', {
42
+ resetItems: result.resetItems,
43
+ reason,
44
+ });
45
+ return result;
46
+ }
47
+ }
48
+ //# sourceMappingURL=reset-development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-development.js","sourceRoot":"","sources":["../../src/tool-handlers/reset-development.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAoB5D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAG5C;IACW,KAAK,CAAC,cAAc,CAC5B,IAA0B,EAC1B,OAAsB;QAEtB,8BAA8B;QAC9B,oBAAoB,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QAExC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE;YACxD,OAAO;YACP,SAAS,EAAE,CAAC,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,sBAAsB;QACtB,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAA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