@codemcp/workflows 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +9 -0
- package/packages/opencode-plugin/dist/index.js +11 -0
- package/packages/opencode-plugin/dist/index.js.map +1 -0
- package/packages/opencode-plugin/dist/opencode-logger.d.ts +21 -0
- package/packages/opencode-plugin/dist/opencode-logger.js +104 -0
- package/packages/opencode-plugin/dist/opencode-logger.js.map +1 -0
- package/packages/opencode-plugin/dist/plugin.d.ts +23 -0
- package/packages/opencode-plugin/dist/plugin.js +395 -0
- package/packages/opencode-plugin/dist/plugin.js.map +1 -0
- package/packages/opencode-plugin/dist/server-context.d.ts +40 -0
- package/packages/opencode-plugin/dist/server-context.js +96 -0
- package/packages/opencode-plugin/dist/server-context.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/conduct-review.d.ts +3 -0
- package/packages/opencode-plugin/dist/tool-handlers/conduct-review.js +37 -0
- package/packages/opencode-plugin/dist/tool-handlers/conduct-review.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/proceed-to-phase.d.ts +3 -0
- package/packages/opencode-plugin/dist/tool-handlers/proceed-to-phase.js +74 -0
- package/packages/opencode-plugin/dist/tool-handlers/proceed-to-phase.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/reset-development.d.ts +3 -0
- package/packages/opencode-plugin/dist/tool-handlers/reset-development.js +63 -0
- package/packages/opencode-plugin/dist/tool-handlers/reset-development.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/setup-project-docs.d.ts +3 -0
- package/packages/opencode-plugin/dist/tool-handlers/setup-project-docs.js +74 -0
- package/packages/opencode-plugin/dist/tool-handlers/setup-project-docs.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/start-development.d.ts +3 -0
- package/packages/opencode-plugin/dist/tool-handlers/start-development.js +69 -0
- package/packages/opencode-plugin/dist/tool-handlers/start-development.js.map +1 -0
- package/packages/opencode-plugin/dist/tool-handlers/tool-helper.d.ts +10 -0
- package/packages/opencode-plugin/dist/tool-handlers/tool-helper.js +7 -0
- package/packages/opencode-plugin/dist/tool-handlers/tool-helper.js.map +1 -0
- package/packages/opencode-plugin/dist/types.d.ts +193 -0
- package/packages/opencode-plugin/dist/types.js +8 -0
- package/packages/opencode-plugin/dist/types.js.map +1 -0
- package/packages/opencode-plugin/dist/utils.d.ts +14 -0
- package/packages/opencode-plugin/dist/utils.js +26 -0
- package/packages/opencode-plugin/dist/utils.js.map +1 -0
- package/packages/opencode-plugin/package.json +52 -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,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProceedToPhaseHandler, } from '@codemcp/workflows-server';
|
|
3
|
+
import { tool } from './tool-helper.js';
|
|
4
|
+
import { handleMcpError, unwrapResult } from '../server-context.js';
|
|
5
|
+
import { createLogger } from '@codemcp/workflows-core';
|
|
6
|
+
import { stripWhatsNextReferences } from '../utils.js';
|
|
7
|
+
export function createProceedToPhaseTool(getServerContext, setBufferedInstructions) {
|
|
8
|
+
return tool({
|
|
9
|
+
description: 'Move to a development phase. Args: target_phase (from plan file), reason (optional), review_state (not-required|pending|performed)',
|
|
10
|
+
args: {
|
|
11
|
+
target_phase: z.string().describe('Phase name from plan file'),
|
|
12
|
+
reason: z.string().optional().describe('Why transitioning now'),
|
|
13
|
+
review_state: z
|
|
14
|
+
.enum(['not-required', 'pending', 'performed'])
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Review state'),
|
|
17
|
+
},
|
|
18
|
+
execute: async (args) => {
|
|
19
|
+
const { target_phase, reason, review_state } = args;
|
|
20
|
+
const serverContext = await getServerContext();
|
|
21
|
+
const logger = serverContext.loggerFactory
|
|
22
|
+
? serverContext.loggerFactory('proceed_to_phase')
|
|
23
|
+
: createLogger('proceed_to_phase');
|
|
24
|
+
logger.debug('proceed_to_phase called', { to: target_phase, reason });
|
|
25
|
+
try {
|
|
26
|
+
// Delegate to ProceedToPhaseHandler
|
|
27
|
+
const handler = new ProceedToPhaseHandler();
|
|
28
|
+
const result = await handler.handle({
|
|
29
|
+
target_phase,
|
|
30
|
+
reason,
|
|
31
|
+
review_state: review_state ?? 'not-required',
|
|
32
|
+
}, serverContext);
|
|
33
|
+
// Handle errors gracefully
|
|
34
|
+
const errorMsg = handleMcpError(result);
|
|
35
|
+
if (errorMsg) {
|
|
36
|
+
return errorMsg;
|
|
37
|
+
}
|
|
38
|
+
const data = unwrapResult(result);
|
|
39
|
+
// Buffer instructions so the next chat.message hook uses them
|
|
40
|
+
// instead of re-querying WhatsNextHandler (which may read stale disk state)
|
|
41
|
+
setBufferedInstructions({
|
|
42
|
+
phase: data.phase,
|
|
43
|
+
instructions: data.instructions,
|
|
44
|
+
plan_file_path: data.plan_file_path,
|
|
45
|
+
allowed_file_patterns: data.allowed_file_patterns,
|
|
46
|
+
});
|
|
47
|
+
// Build response with instructions (strip whats_next references)
|
|
48
|
+
const lines = [];
|
|
49
|
+
lines.push(`Transitioned to: ${data.phase}`);
|
|
50
|
+
if (data.transition_reason) {
|
|
51
|
+
lines.push(`Reason: ${data.transition_reason}`);
|
|
52
|
+
}
|
|
53
|
+
if (data.instructions) {
|
|
54
|
+
lines.push('');
|
|
55
|
+
lines.push(stripWhatsNextReferences(data.instructions));
|
|
56
|
+
}
|
|
57
|
+
// File restrictions
|
|
58
|
+
const patterns = data.allowed_file_patterns;
|
|
59
|
+
if (patterns.includes('*') || patterns.includes('**/*')) {
|
|
60
|
+
lines.push('Files: All allowed');
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
lines.push(`Allowed: ${patterns.join(', ')}`);
|
|
64
|
+
}
|
|
65
|
+
return lines.join('\n');
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
69
|
+
return `Error: ${errorMessage}`;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# 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,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,GAGtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,UAAU,wBAAwB,CACtC,gBAA8C,EAC9C,uBAA0D;IAE1D,OAAO,IAAI,CAAC;QACV,WAAW,EACT,oIAAoI;QACtI,IAAI,EAAE;YACJ,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;YAC/D,YAAY,EAAE,CAAC;iBACZ,IAAI,CAAC,CAAC,cA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AC;gBAC3B,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;gBAE7C,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBAC3B,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBAClD,CAAC;gBAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;oBACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACf,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC1D,CAAC;gBAED,oBAAoB;gBACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC;gBAC5C,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBACxD,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChD,CAAC;gBAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACzD,OAAO,UAAU,YAAY,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { ResetDevelopmentHandler, } from '@codemcp/workflows-server';
|
|
4
|
+
import { FileStorage, ConversationManager, WorkflowManager, createLogger, } from '@codemcp/workflows-core';
|
|
5
|
+
import { tool } from './tool-helper.js';
|
|
6
|
+
import { handleMcpError } from '../server-context.js';
|
|
7
|
+
export function createResetDevelopmentTool(projectDir, getServerContext) {
|
|
8
|
+
return tool({
|
|
9
|
+
description: 'Reset workflow state. Args: confirm (required: true), reason (optional), delete_plan (optional: also delete plan file)',
|
|
10
|
+
args: {
|
|
11
|
+
confirm: z.boolean().describe('Must be true'),
|
|
12
|
+
reason: z.string().optional().describe('Reason for reset'),
|
|
13
|
+
delete_plan: z.boolean().optional().describe('Also delete plan file'),
|
|
14
|
+
},
|
|
15
|
+
execute: async (args) => {
|
|
16
|
+
const { confirm, reason, delete_plan } = args;
|
|
17
|
+
const serverContext = await getServerContext();
|
|
18
|
+
const logger = serverContext.loggerFactory
|
|
19
|
+
? serverContext.loggerFactory('reset_development')
|
|
20
|
+
: createLogger('reset_development');
|
|
21
|
+
logger.debug('reset_development called', { confirm, delete_plan });
|
|
22
|
+
if (!confirm) {
|
|
23
|
+
return `Reset requires confirm: true. Will delete conversation state${delete_plan ? ' and plan file' : ''}.`;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (delete_plan) {
|
|
27
|
+
// Full reset: delegate to ResetDevelopmentHandler
|
|
28
|
+
const handler = new ResetDevelopmentHandler();
|
|
29
|
+
const result = await handler.handle({ confirm, reason }, serverContext);
|
|
30
|
+
const errorMsg = handleMcpError(result);
|
|
31
|
+
if (errorMsg) {
|
|
32
|
+
return errorMsg;
|
|
33
|
+
}
|
|
34
|
+
const deleted = result.data?.resetItems?.join(', ') || 'workflow state';
|
|
35
|
+
return `Reset complete. Deleted: ${deleted}. Use \`start_workflow\` to begin.`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Partial reset: delete conversation state only, preserve plan file
|
|
39
|
+
const storageDir = path.join(projectDir, '.vibe', 'storage');
|
|
40
|
+
const fileStorage = new FileStorage(storageDir);
|
|
41
|
+
await fileStorage.initialize();
|
|
42
|
+
const conversationManager = new ConversationManager(fileStorage, new WorkflowManager(), projectDir);
|
|
43
|
+
let context;
|
|
44
|
+
try {
|
|
45
|
+
context = await conversationManager.getConversationContext();
|
|
46
|
+
}
|
|
47
|
+
catch (_err) {
|
|
48
|
+
return 'No active workflow. Use `start_workflow` to begin.';
|
|
49
|
+
}
|
|
50
|
+
if (context) {
|
|
51
|
+
await conversationManager.cleanupConversationData(context.conversationId);
|
|
52
|
+
}
|
|
53
|
+
return `Reset complete. Use \`start_workflow\` to begin.`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
58
|
+
return `Error: ${errorMessage}`;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# 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,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,0BAA0B,CACxC,UAAkB,EAClB,gBAA8C;IAE9C,OAAO,IAAI,CAAC;QACV,WAAW,EACT,wHAAwH;QAC1H,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EA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C;oBACN,oEAAoE;oBACpE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;oBAC7D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;oBAChD,MAAM,WAAW,CAAC,UAAU,EAAE,CAAC;oBAC/B,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,CACjD,WAAW,EACX,IAAI,eAAe,EAAE,EACrB,UAAU,CACX,CAAC;oBAEF,IAAI,OAAO,CAAC;oBACZ,IAAI,CAAC;wBACH,OAAO,GAAG,MAAM,mBAAmB,CAAC,sBAAsB,EAAE,CAAC;oBAC/D,CAAC;oBAAC,OAAO,IAAI,EAAE,CAAC;wBACd,OAAO,oDAAoD,CAAC;oBAC9D,CAAC;oBAED,IAAI,OAAO,EAAE,CAAC;wBACZ,MAAM,mBAAmB,CAAC,uBAAuB,CAC/C,OAAO,CAAC,cAAc,CACvB,CAAC;oBACJ,CAAC;oBAED,OAAO,kDAAkD,CAAC;gBAC5D,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACzD,OAAO,UAAU,YAAY,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SetupProjectDocsHandler, } from '@codemcp/workflows-server';
|
|
3
|
+
import { tool } from './tool-helper.js';
|
|
4
|
+
import { handleMcpError, unwrapResult } from '../server-context.js';
|
|
5
|
+
import { createLogger, TemplateManager } from '@codemcp/workflows-core';
|
|
6
|
+
export async function createSetupProjectDocsTool(projectDir, getServerContext) {
|
|
7
|
+
// Get available templates for description
|
|
8
|
+
const templateManager = new TemplateManager();
|
|
9
|
+
const availableTemplates = await templateManager.getAvailableTemplates();
|
|
10
|
+
const archOptions = availableTemplates.architecture.join(', ');
|
|
11
|
+
const reqOptions = availableTemplates.requirements.join(', ');
|
|
12
|
+
const designOptions = availableTemplates.design.join(', ');
|
|
13
|
+
return tool({
|
|
14
|
+
description: `Create project docs with templates or link existing files. Options - architecture: ${archOptions}, none, or file path; requirements: ${reqOptions}, none, or file path; design: ${designOptions}, none, or file path`,
|
|
15
|
+
args: {
|
|
16
|
+
architecture: z
|
|
17
|
+
.string()
|
|
18
|
+
.default('freestyle')
|
|
19
|
+
.describe('Template name, "none", or file path'),
|
|
20
|
+
requirements: z
|
|
21
|
+
.string()
|
|
22
|
+
.default('none')
|
|
23
|
+
.describe('Template name, "none", or file path'),
|
|
24
|
+
design: z
|
|
25
|
+
.string()
|
|
26
|
+
.default('freestyle')
|
|
27
|
+
.describe('Template name, "none", or file path'),
|
|
28
|
+
},
|
|
29
|
+
execute: async (args) => {
|
|
30
|
+
const serverContext = await getServerContext();
|
|
31
|
+
const logger = serverContext.loggerFactory
|
|
32
|
+
? serverContext.loggerFactory('setup_project_docs')
|
|
33
|
+
: createLogger('setup_project_docs');
|
|
34
|
+
logger.debug('setup_project_docs called', args);
|
|
35
|
+
try {
|
|
36
|
+
// Delegate to SetupProjectDocsHandler
|
|
37
|
+
const handler = new SetupProjectDocsHandler();
|
|
38
|
+
const result = await handler.handle({
|
|
39
|
+
architecture: args.architecture,
|
|
40
|
+
requirements: args.requirements,
|
|
41
|
+
design: args.design,
|
|
42
|
+
project_path: projectDir,
|
|
43
|
+
}, serverContext);
|
|
44
|
+
// Handle errors gracefully
|
|
45
|
+
const errorMsg = handleMcpError(result);
|
|
46
|
+
if (errorMsg) {
|
|
47
|
+
return errorMsg;
|
|
48
|
+
}
|
|
49
|
+
const data = unwrapResult(result);
|
|
50
|
+
logger.info('setup_project_docs: Completed', {
|
|
51
|
+
created: data.created,
|
|
52
|
+
linked: data.linked,
|
|
53
|
+
skipped: data.skipped,
|
|
54
|
+
});
|
|
55
|
+
// Build response
|
|
56
|
+
const lines = [];
|
|
57
|
+
lines.push(data.message);
|
|
58
|
+
if (data.paths) {
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push('Document paths:');
|
|
61
|
+
lines.push(` Architecture: ${data.paths.architecture}`);
|
|
62
|
+
lines.push(` Requirements: ${data.paths.requirements}`);
|
|
63
|
+
lines.push(` Design: ${data.paths.design}`);
|
|
64
|
+
}
|
|
65
|
+
return lines.join('\n');
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
69
|
+
return `Error: ${errorMessage}`;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=setup-project-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-project-docs.js","sourceRoot":"","sources":["../../src/tool-handlers/setup-project-docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,UAAkB,EAClB,gBAA8C;IAE9C,0CAA0C;IAC1C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,kBAAkB,GAAG,MAAM,eAAe,CAAC,qBAAqB,EAAE,CAAC;IAEzE,MAAM,WAAW,GAAG,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG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
+
import { type WhatsNextResult, type ServerContext } from '@codemcp/workflows-server';
|
|
2
|
+
import type { ToolDefinition } from '../types.js';
|
|
3
|
+
export declare function createStartDevelopmentTool(projectDir: string, getServerContext: () => Promise<ServerContext>, setBufferedInstructions: (result: WhatsNextResult) => void): ToolDefinition;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StartDevelopmentHandler, } from '@codemcp/workflows-server';
|
|
3
|
+
import { tool } from './tool-helper.js';
|
|
4
|
+
import { handleMcpError, unwrapResult } from '../server-context.js';
|
|
5
|
+
import { WorkflowManager, createLogger } from '@codemcp/workflows-core';
|
|
6
|
+
import { stripWhatsNextReferences } from '../utils.js';
|
|
7
|
+
export function createStartDevelopmentTool(projectDir, getServerContext, setBufferedInstructions) {
|
|
8
|
+
// Load available workflows for description
|
|
9
|
+
// NOTE: Using getAvailableWorkflowsForProject() to respect:
|
|
10
|
+
// 1. VIBE_WORKFLOW_DOMAINS configuration (domain filtering)
|
|
11
|
+
// 2. Project-specific workflow configuration
|
|
12
|
+
const workflowManager = new WorkflowManager();
|
|
13
|
+
const availableWorkflows = workflowManager.getAvailableWorkflowsForProject(projectDir);
|
|
14
|
+
const workflowNames = availableWorkflows.map(w => w.name);
|
|
15
|
+
// Build tool description with workflow list
|
|
16
|
+
const toolDescription = workflowNames.length > 0
|
|
17
|
+
? `Start a development workflow. Available: ${workflowNames.join(', ')}`
|
|
18
|
+
: 'Start a development workflow (no workflows available - check VIBE_WORKFLOW_DOMAINS)';
|
|
19
|
+
return tool({
|
|
20
|
+
description: toolDescription,
|
|
21
|
+
args: {
|
|
22
|
+
workflow: z.string().describe('Workflow name'),
|
|
23
|
+
require_reviews: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Require reviews before phase transitions'),
|
|
27
|
+
},
|
|
28
|
+
execute: async (args) => {
|
|
29
|
+
const serverContext = await getServerContext();
|
|
30
|
+
const logger = serverContext.loggerFactory
|
|
31
|
+
? serverContext.loggerFactory('start_development')
|
|
32
|
+
: createLogger('start_development');
|
|
33
|
+
logger.debug('start_development called', { workflow: args.workflow });
|
|
34
|
+
try {
|
|
35
|
+
// Delegate to StartDevelopmentHandler
|
|
36
|
+
const handler = new StartDevelopmentHandler();
|
|
37
|
+
const result = await handler.handle({
|
|
38
|
+
workflow: args.workflow,
|
|
39
|
+
require_reviews: args.require_reviews,
|
|
40
|
+
project_path: projectDir,
|
|
41
|
+
}, serverContext);
|
|
42
|
+
// Handle errors gracefully
|
|
43
|
+
const errorMsg = handleMcpError(result);
|
|
44
|
+
if (errorMsg) {
|
|
45
|
+
return errorMsg;
|
|
46
|
+
}
|
|
47
|
+
const data = unwrapResult(result);
|
|
48
|
+
logger.info('start_development: Successfully started workflow', {
|
|
49
|
+
workflow: args.workflow,
|
|
50
|
+
phase: data.phase,
|
|
51
|
+
});
|
|
52
|
+
// Buffer instructions for the next chat.message hook
|
|
53
|
+
setBufferedInstructions({
|
|
54
|
+
phase: data.phase,
|
|
55
|
+
instructions: data.instructions,
|
|
56
|
+
plan_file_path: data.plan_file_path,
|
|
57
|
+
allowed_file_patterns: data.allowed_file_patterns ?? ['**/*'],
|
|
58
|
+
});
|
|
59
|
+
// Return the instructions from the handler (strip whats_next references)
|
|
60
|
+
return stripWhatsNextReferences(data.instructions);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
64
|
+
return `Error: ${errorMessage}`;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=start-development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-development.js","sourceRoot":"","sources":["../../src/tool-handlers/start-development.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,GAGxB,MAAM,2BA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zD,OAAO,UAAU,YAAY,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Tool definition helper
|
|
5
|
+
*/
|
|
6
|
+
export declare function tool<Args extends z.ZodRawShape>(input: {
|
|
7
|
+
description: string;
|
|
8
|
+
args: Args;
|
|
9
|
+
execute(args: z.infer<z.ZodObject<Args>>, context: unknown): Promise<string>;
|
|
10
|
+
}): ToolDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helper.js","sourceRoot":"","sources":["../../src/tool-handlers/tool-helper.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,UAAU,IAAI,CAA6B,KAIhD;IACC,OAAO,KAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Plugin Types
|
|
3
|
+
*
|
|
4
|
+
* Minimal type definitions needed for the plugin.
|
|
5
|
+
* Based on @opencode-ai/plugin package types.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export type Part = {
|
|
9
|
+
type: 'text' | 'image' | 'file' | 'tool_use' | 'tool_result';
|
|
10
|
+
text?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type UserMessage = {
|
|
14
|
+
id: string;
|
|
15
|
+
sessionID: string;
|
|
16
|
+
role: 'user';
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
export type Message = {
|
|
20
|
+
id: string;
|
|
21
|
+
sessionID: string;
|
|
22
|
+
role: 'user' | 'assistant';
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
export type Model = {
|
|
26
|
+
providerID: string;
|
|
27
|
+
modelID: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
export type Project = {
|
|
31
|
+
id: string;
|
|
32
|
+
path: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
export type PluginInput = {
|
|
36
|
+
client: unknown;
|
|
37
|
+
project: Project;
|
|
38
|
+
directory: string;
|
|
39
|
+
worktree: string;
|
|
40
|
+
serverUrl: URL;
|
|
41
|
+
$: unknown;
|
|
42
|
+
};
|
|
43
|
+
export type ToolContext = {
|
|
44
|
+
sessionID: string;
|
|
45
|
+
messageID: string;
|
|
46
|
+
agent: string;
|
|
47
|
+
directory: string;
|
|
48
|
+
worktree: string;
|
|
49
|
+
abort: AbortSignal;
|
|
50
|
+
metadata(input: {
|
|
51
|
+
title?: string;
|
|
52
|
+
metadata?: Record<string, unknown>;
|
|
53
|
+
}): void;
|
|
54
|
+
ask(input: {
|
|
55
|
+
permission: string;
|
|
56
|
+
patterns: string[];
|
|
57
|
+
always: string[];
|
|
58
|
+
metadata: Record<string, unknown>;
|
|
59
|
+
}): Promise<void>;
|
|
60
|
+
};
|
|
61
|
+
export type ToolDefinition = {
|
|
62
|
+
description: string;
|
|
63
|
+
args: z.ZodRawShape;
|
|
64
|
+
execute(args: unknown, context: ToolContext): Promise<string>;
|
|
65
|
+
};
|
|
66
|
+
export interface Hooks {
|
|
67
|
+
event?: (input: {
|
|
68
|
+
event: unknown;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
config?: (input: unknown) => Promise<void>;
|
|
71
|
+
tool?: {
|
|
72
|
+
[key: string]: ToolDefinition;
|
|
73
|
+
};
|
|
74
|
+
auth?: unknown;
|
|
75
|
+
/**
|
|
76
|
+
* Called when a new message is received
|
|
77
|
+
*/
|
|
78
|
+
'chat.message'?: (input: {
|
|
79
|
+
sessionID: string;
|
|
80
|
+
agent?: string;
|
|
81
|
+
model?: {
|
|
82
|
+
providerID: string;
|
|
83
|
+
modelID: string;
|
|
84
|
+
};
|
|
85
|
+
messageID?: string;
|
|
86
|
+
variant?: string;
|
|
87
|
+
}, output: {
|
|
88
|
+
message: UserMessage;
|
|
89
|
+
parts: Part[];
|
|
90
|
+
}) => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Modify parameters sent to LLM
|
|
93
|
+
*/
|
|
94
|
+
'chat.params'?: (input: {
|
|
95
|
+
sessionID: string;
|
|
96
|
+
agent: string;
|
|
97
|
+
model: Model;
|
|
98
|
+
provider: unknown;
|
|
99
|
+
message: UserMessage;
|
|
100
|
+
}, output: {
|
|
101
|
+
temperature: number;
|
|
102
|
+
topP: number;
|
|
103
|
+
topK: number;
|
|
104
|
+
options: Record<string, unknown>;
|
|
105
|
+
}) => Promise<void>;
|
|
106
|
+
'chat.headers'?: (input: {
|
|
107
|
+
sessionID: string;
|
|
108
|
+
agent: string;
|
|
109
|
+
model: Model;
|
|
110
|
+
provider: unknown;
|
|
111
|
+
message: UserMessage;
|
|
112
|
+
}, output: {
|
|
113
|
+
headers: Record<string, string>;
|
|
114
|
+
}) => Promise<void>;
|
|
115
|
+
'permission.ask'?: (input: unknown, output: {
|
|
116
|
+
status: 'ask' | 'deny' | 'allow';
|
|
117
|
+
}) => Promise<void>;
|
|
118
|
+
'command.execute.before'?: (input: {
|
|
119
|
+
command: string;
|
|
120
|
+
sessionID: string;
|
|
121
|
+
arguments: string;
|
|
122
|
+
}, output: {
|
|
123
|
+
parts: Part[];
|
|
124
|
+
}) => Promise<void>;
|
|
125
|
+
'tool.execute.before'?: (input: {
|
|
126
|
+
tool: string;
|
|
127
|
+
sessionID: string;
|
|
128
|
+
callID: string;
|
|
129
|
+
}, output: {
|
|
130
|
+
args: Record<string, unknown>;
|
|
131
|
+
}) => Promise<void>;
|
|
132
|
+
'shell.env'?: (input: {
|
|
133
|
+
cwd: string;
|
|
134
|
+
sessionID?: string;
|
|
135
|
+
callID?: string;
|
|
136
|
+
}, output: {
|
|
137
|
+
env: Record<string, string>;
|
|
138
|
+
}) => Promise<void>;
|
|
139
|
+
'tool.execute.after'?: (input: {
|
|
140
|
+
tool: string;
|
|
141
|
+
sessionID: string;
|
|
142
|
+
callID: string;
|
|
143
|
+
args: unknown;
|
|
144
|
+
}, output: {
|
|
145
|
+
title: string;
|
|
146
|
+
output: string;
|
|
147
|
+
metadata: unknown;
|
|
148
|
+
}) => Promise<void>;
|
|
149
|
+
'experimental.chat.messages.transform'?: (input: Record<string, never>, output: {
|
|
150
|
+
messages: {
|
|
151
|
+
info: Message;
|
|
152
|
+
parts: Part[];
|
|
153
|
+
}[];
|
|
154
|
+
}) => Promise<void>;
|
|
155
|
+
'experimental.chat.system.transform'?: (input: {
|
|
156
|
+
sessionID?: string;
|
|
157
|
+
model: Model;
|
|
158
|
+
}, output: {
|
|
159
|
+
system: string[];
|
|
160
|
+
}) => Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Called before session compaction starts. Allows plugins to customize
|
|
163
|
+
* the compaction prompt.
|
|
164
|
+
*/
|
|
165
|
+
'experimental.session.compacting'?: (input: {
|
|
166
|
+
sessionID: string;
|
|
167
|
+
}, output: {
|
|
168
|
+
context: string[];
|
|
169
|
+
prompt?: string;
|
|
170
|
+
}) => Promise<void>;
|
|
171
|
+
'experimental.text.complete'?: (input: {
|
|
172
|
+
sessionID: string;
|
|
173
|
+
messageID: string;
|
|
174
|
+
partID: string;
|
|
175
|
+
}, output: {
|
|
176
|
+
text: string;
|
|
177
|
+
}) => Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Modify tool definitions (description and parameters) sent to LLM
|
|
180
|
+
*/
|
|
181
|
+
'tool.definition'?: (input: {
|
|
182
|
+
toolID: string;
|
|
183
|
+
}, output: {
|
|
184
|
+
description: string;
|
|
185
|
+
parameters: unknown;
|
|
186
|
+
}) => Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
export type Plugin = (input: PluginInput) => Promise<Hooks>;
|
|
189
|
+
export type PluginModule = {
|
|
190
|
+
id?: string;
|
|
191
|
+
server: Plugin;
|
|
192
|
+
tui?: never;
|
|
193
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a date as YYYY-MM-DD
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatDate(date: Date): string;
|
|
5
|
+
/**
|
|
6
|
+
* Get the current git branch for a project
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentGitBranch(projectPath: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Strip whats_next() references from instructions.
|
|
11
|
+
* The plugin auto-injects instructions via chat.message hook,
|
|
12
|
+
* so users don't need to call whats_next() manually.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stripWhatsNextReferences(text: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GitManager } from '@codemcp/workflows-core';
|
|
2
|
+
/**
|
|
3
|
+
* Format a date as YYYY-MM-DD
|
|
4
|
+
*/
|
|
5
|
+
export function formatDate(date) {
|
|
6
|
+
return date.toISOString().split('T')[0];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the current git branch for a project
|
|
10
|
+
*/
|
|
11
|
+
export function getCurrentGitBranch(projectPath) {
|
|
12
|
+
return GitManager.getCurrentBranch(projectPath);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Strip whats_next() references from instructions.
|
|
16
|
+
* The plugin auto-injects instructions via chat.message hook,
|
|
17
|
+
* so users don't need to call whats_next() manually.
|
|
18
|
+
*/
|
|
19
|
+
export function stripWhatsNextReferences(text) {
|
|
20
|
+
return text
|
|
21
|
+
.split('\n')
|
|
22
|
+
.filter(line => !line.toLowerCase().includes('whats_next'))
|
|
23
|
+
.join('\n')
|
|
24
|
+
.replace(/\n{3,}/g, '\n\n'); // Collapse multiple blank lines
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,OAAO,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SAC1D,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,gCAAgC;AACjE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codemcp/workflows-opencode",
|
|
3
|
+
"version": "6.5.0",
|
|
4
|
+
"description": "OpenCode plugin for structured development workflows",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**/*"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.build.json",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"clean:build": "rimraf ./dist",
|
|
18
|
+
"test": "vitest --run",
|
|
19
|
+
"lint": "oxlint .",
|
|
20
|
+
"lint:fix": "oxlint --fix .",
|
|
21
|
+
"format:check": "prettier --check .",
|
|
22
|
+
"format": "prettier --write ."
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@codemcp/workflows-core": "workspace:*",
|
|
26
|
+
"@codemcp/workflows-server": "workspace:*",
|
|
27
|
+
"zod": "^4.1.8"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"rimraf": "^6.0.1",
|
|
31
|
+
"vitest": "4.0.18"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@anthropic-ai/sdk": "*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@anthropic-ai/sdk": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"opencode",
|
|
43
|
+
"plugin",
|
|
44
|
+
"workflows",
|
|
45
|
+
"development"
|
|
46
|
+
],
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/mrsimpson/responsible-vibe-mcp"
|
|
51
|
+
}
|
|
52
|
+
}
|