@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
|
@@ -26,6 +26,10 @@ metadata:
|
|
|
26
26
|
states:
|
|
27
27
|
reproduce:
|
|
28
28
|
description: 'Reproduce and understand the bug'
|
|
29
|
+
allowed_file_patterns:
|
|
30
|
+
- '**/*.md'
|
|
31
|
+
- '**/*.txt'
|
|
32
|
+
- '**/*.adoc'
|
|
29
33
|
default_instructions: |
|
|
30
34
|
Gather specific information to reliably reproduce the reported bug:
|
|
31
35
|
- What are the exact OS, browser/runtime versions, and hardware specs?
|
|
@@ -42,6 +46,10 @@ states:
|
|
|
42
46
|
|
|
43
47
|
analyze:
|
|
44
48
|
description: 'Analyze the bug and identify root cause'
|
|
49
|
+
allowed_file_patterns:
|
|
50
|
+
- '**/*.md'
|
|
51
|
+
- '**/*.txt'
|
|
52
|
+
- '**/*.adoc'
|
|
45
53
|
default_instructions: Examine the code paths involved in the bug, identify the root cause, and understand why the issue occurs. Use debugging tools, add logging, and trace through the problematic code. Document your analysis and create tasks as needed.
|
|
46
54
|
transitions:
|
|
47
55
|
- trigger: 'need_more_reproduction'
|
|
@@ -66,6 +74,8 @@ states:
|
|
|
66
74
|
|
|
67
75
|
fix:
|
|
68
76
|
description: 'Implement the bug fix'
|
|
77
|
+
allowed_file_patterns:
|
|
78
|
+
- '**/*'
|
|
69
79
|
default_instructions: |
|
|
70
80
|
Implement the solution based on your analysis:
|
|
71
81
|
|
|
@@ -100,6 +110,8 @@ states:
|
|
|
100
110
|
|
|
101
111
|
verify:
|
|
102
112
|
description: 'Verify the fix and ensure no regressions'
|
|
113
|
+
allowed_file_patterns:
|
|
114
|
+
- '**/*'
|
|
103
115
|
default_instructions: Test the fix thoroughly to ensure the original bug is resolved and no new issues were introduced. Run existing tests, create new ones if needed, and verify the solution is robust.
|
|
104
116
|
transitions:
|
|
105
117
|
- trigger: 'fix_needs_adjustment'
|
|
@@ -123,6 +135,8 @@ states:
|
|
|
123
135
|
|
|
124
136
|
finalize:
|
|
125
137
|
description: 'Code cleanup and documentation finalization'
|
|
138
|
+
allowed_file_patterns:
|
|
139
|
+
- '**/*'
|
|
126
140
|
default_instructions: |
|
|
127
141
|
Ensure code quality and documentation accuracy through systematic cleanup and review.
|
|
128
142
|
|
|
@@ -26,6 +26,10 @@ metadata:
|
|
|
26
26
|
states:
|
|
27
27
|
explore:
|
|
28
28
|
description: 'Research and exploration phase - understanding the problem space'
|
|
29
|
+
allowed_file_patterns:
|
|
30
|
+
- '**/*.md'
|
|
31
|
+
- '**/*.txt'
|
|
32
|
+
- '**/*.adoc'
|
|
29
33
|
default_instructions: |
|
|
30
34
|
Research the codebase to understand existing patterns and gather context about the problem space.
|
|
31
35
|
|
|
@@ -43,6 +47,10 @@ states:
|
|
|
43
47
|
|
|
44
48
|
plan:
|
|
45
49
|
description: 'Planning phase - creating a detailed implementation strategy'
|
|
50
|
+
allowed_file_patterns:
|
|
51
|
+
- '**/*.md'
|
|
52
|
+
- '**/*.txt'
|
|
53
|
+
- '**/*.adoc'
|
|
46
54
|
default_instructions: |
|
|
47
55
|
Create a detailed implementation strategy based on your exploration:
|
|
48
56
|
|
|
@@ -83,6 +91,8 @@ states:
|
|
|
83
91
|
|
|
84
92
|
code:
|
|
85
93
|
description: 'Implementation phase - writing and building the solution'
|
|
94
|
+
allowed_file_patterns:
|
|
95
|
+
- '**/*'
|
|
86
96
|
default_instructions: |
|
|
87
97
|
Follow your plan to build the solution:
|
|
88
98
|
|
|
@@ -124,6 +134,8 @@ states:
|
|
|
124
134
|
|
|
125
135
|
commit:
|
|
126
136
|
description: 'Code cleanup and documentation finalization'
|
|
137
|
+
allowed_file_patterns:
|
|
138
|
+
- '**/*'
|
|
127
139
|
default_instructions: >
|
|
128
140
|
Ensure code quality and documentation accuracy through systematic cleanup and review.
|
|
129
141
|
|
|
@@ -27,6 +27,10 @@ metadata:
|
|
|
27
27
|
states:
|
|
28
28
|
ideation:
|
|
29
29
|
description: 'Deep requirements discovery and PRD creation phase'
|
|
30
|
+
allowed_file_patterns:
|
|
31
|
+
- '**/*.md'
|
|
32
|
+
- '**/*.txt'
|
|
33
|
+
- '**/*.adoc'
|
|
30
34
|
default_instructions: |
|
|
31
35
|
Understand WHAT the system should do, WHO will use it, WHY it's needed, and WHAT'S in/out of scope by exploring:
|
|
32
36
|
- Are there existing solutions? What gaps do they have?
|
|
@@ -47,6 +51,10 @@ states:
|
|
|
47
51
|
|
|
48
52
|
architecture:
|
|
49
53
|
description: 'Tech stack selection and architecture design phase'
|
|
54
|
+
allowed_file_patterns:
|
|
55
|
+
- '**/*.md'
|
|
56
|
+
- '**/*.txt'
|
|
57
|
+
- '**/*.adoc'
|
|
50
58
|
default_instructions: |
|
|
51
59
|
Design the technical solution based on requirements from `$REQUIREMENTS_DOC`.
|
|
52
60
|
|
|
@@ -82,6 +90,10 @@ states:
|
|
|
82
90
|
|
|
83
91
|
plan:
|
|
84
92
|
description: 'Implementation planning phase based on established architecture'
|
|
93
|
+
allowed_file_patterns:
|
|
94
|
+
- '**/*.md'
|
|
95
|
+
- '**/*.txt'
|
|
96
|
+
- '**/*.adoc'
|
|
85
97
|
default_instructions: |
|
|
86
98
|
Create a detailed implementation strategy based on your completed architecture in `$ARCHITECTURE_DOC` and requirements from `$REQUIREMENTS_DOC`.
|
|
87
99
|
|
|
@@ -118,6 +130,8 @@ states:
|
|
|
118
130
|
|
|
119
131
|
code:
|
|
120
132
|
description: 'Implementation phase following the established plan and architecture'
|
|
133
|
+
allowed_file_patterns:
|
|
134
|
+
- '**/*'
|
|
121
135
|
default_instructions: |
|
|
122
136
|
Build the solution following your plan and detailed design from `$DESIGN_DOC` using the architecture from `$ARCHITECTURE_DOC`.
|
|
123
137
|
|
|
@@ -151,6 +165,8 @@ states:
|
|
|
151
165
|
|
|
152
166
|
finalize:
|
|
153
167
|
description: 'Code cleanup and documentation finalization'
|
|
168
|
+
allowed_file_patterns:
|
|
169
|
+
- '**/*'
|
|
154
170
|
default_instructions: |
|
|
155
171
|
This phase ensures code quality and documentation accuracy through systematic cleanup and review.
|
|
156
172
|
|
|
@@ -26,6 +26,10 @@ metadata:
|
|
|
26
26
|
states:
|
|
27
27
|
explore:
|
|
28
28
|
description: 'Analysis and design phase - understanding and planning without implementation'
|
|
29
|
+
allowed_file_patterns:
|
|
30
|
+
- '**/*.md'
|
|
31
|
+
- '**/*.txt'
|
|
32
|
+
- '**/*.adoc'
|
|
29
33
|
default_instructions: >
|
|
30
34
|
Understand the problem, analyze existing patterns, and design your approach.
|
|
31
35
|
Consider the scope and impact of the change.
|
|
@@ -49,6 +53,8 @@ states:
|
|
|
49
53
|
|
|
50
54
|
implement:
|
|
51
55
|
description: 'Combined implementation phase - code, test, and commit'
|
|
56
|
+
allowed_file_patterns:
|
|
57
|
+
- '**/*'
|
|
52
58
|
default_instructions: >
|
|
53
59
|
Write clean, focused code for the minor enhancement, test your changes, and prepare for commit.
|
|
54
60
|
|
|
@@ -85,6 +91,8 @@ states:
|
|
|
85
91
|
|
|
86
92
|
finalize:
|
|
87
93
|
description: 'Code cleanup and documentation finalization'
|
|
94
|
+
allowed_file_patterns:
|
|
95
|
+
- '**/*'
|
|
88
96
|
default_instructions: >
|
|
89
97
|
Ensure code quality and documentation accuracy through systematic cleanup and review.
|
|
90
98
|
|
|
@@ -26,6 +26,10 @@ metadata:
|
|
|
26
26
|
states:
|
|
27
27
|
explore:
|
|
28
28
|
description: 'Research and exploration phase - understanding the problem space and codebase'
|
|
29
|
+
allowed_file_patterns:
|
|
30
|
+
- '**/*.md'
|
|
31
|
+
- '**/*.txt'
|
|
32
|
+
- '**/*.adoc'
|
|
29
33
|
default_instructions: |
|
|
30
34
|
**STEP 1:** Gather context about what needs to be developed. Focus on the WHY and WHAT, not the HOW.
|
|
31
35
|
|
|
@@ -46,6 +50,8 @@ states:
|
|
|
46
50
|
|
|
47
51
|
red:
|
|
48
52
|
description: 'RED phase - Write a failing test that defines the expected behavior'
|
|
53
|
+
allowed_file_patterns:
|
|
54
|
+
- '**/*'
|
|
49
55
|
default_instructions: |
|
|
50
56
|
Write a failing test that defines the expected behavior for the feature.
|
|
51
57
|
|
|
@@ -81,6 +87,8 @@ states:
|
|
|
81
87
|
|
|
82
88
|
green:
|
|
83
89
|
description: 'GREEN phase - Write only the necessary code to make the test pass'
|
|
90
|
+
allowed_file_patterns:
|
|
91
|
+
- '**/*'
|
|
84
92
|
default_instructions: |
|
|
85
93
|
Implement the necessary code to make the failing test pass with proper functionality.
|
|
86
94
|
|
|
@@ -120,6 +128,8 @@ states:
|
|
|
120
128
|
|
|
121
129
|
refactor:
|
|
122
130
|
description: 'REFACTOR phase - Improve code quality while keeping tests green (cleanup phase)'
|
|
131
|
+
allowed_file_patterns:
|
|
132
|
+
- '**/*'
|
|
123
133
|
default_instructions: |
|
|
124
134
|
Improve code quality while keeping all tests green. This is the cleanup phase where you enhance readability and maintainability.
|
|
125
135
|
|
|
@@ -27,6 +27,10 @@ metadata:
|
|
|
27
27
|
states:
|
|
28
28
|
requirements:
|
|
29
29
|
description: 'Gathering and analyzing requirements'
|
|
30
|
+
allowed_file_patterns:
|
|
31
|
+
- '**/*.md'
|
|
32
|
+
- '**/*.txt'
|
|
33
|
+
- '**/*.adoc'
|
|
30
34
|
default_instructions: |
|
|
31
35
|
Familiarize yourself with the code base and understand project goals, scope, constraints, and success criteria.
|
|
32
36
|
|
|
@@ -49,6 +53,10 @@ states:
|
|
|
49
53
|
|
|
50
54
|
design:
|
|
51
55
|
description: 'Technical design and architecture planning'
|
|
56
|
+
allowed_file_patterns:
|
|
57
|
+
- '**/*.md'
|
|
58
|
+
- '**/*.txt'
|
|
59
|
+
- '**/*.adoc'
|
|
52
60
|
default_instructions: |
|
|
53
61
|
Review requirements from `$REQUIREMENTS_DOC` and design the technical solution.
|
|
54
62
|
|
|
@@ -72,6 +80,8 @@ states:
|
|
|
72
80
|
|
|
73
81
|
implementation:
|
|
74
82
|
description: 'Building the solution according to design'
|
|
83
|
+
allowed_file_patterns:
|
|
84
|
+
- '**/*'
|
|
75
85
|
default_instructions: |
|
|
76
86
|
Follow the architecture from `$ARCHITECTURE_DOC` and detailed design from `$DESIGN_DOC` to build the solution.
|
|
77
87
|
|
|
@@ -102,6 +112,8 @@ states:
|
|
|
102
112
|
|
|
103
113
|
qa:
|
|
104
114
|
description: 'Quality assurance and code review'
|
|
115
|
+
allowed_file_patterns:
|
|
116
|
+
- '**/*'
|
|
105
117
|
default_instructions: |
|
|
106
118
|
Perform systematic quality checks and code review:
|
|
107
119
|
|
|
@@ -132,6 +144,8 @@ states:
|
|
|
132
144
|
|
|
133
145
|
testing:
|
|
134
146
|
description: 'Comprehensive testing and validation'
|
|
147
|
+
allowed_file_patterns:
|
|
148
|
+
- '**/*'
|
|
135
149
|
default_instructions: |
|
|
136
150
|
Create and execute comprehensive test plans to validate feature completeness.
|
|
137
151
|
|
|
@@ -160,6 +174,8 @@ states:
|
|
|
160
174
|
|
|
161
175
|
finalize:
|
|
162
176
|
description: 'Code cleanup and documentation finalization'
|
|
177
|
+
allowed_file_patterns:
|
|
178
|
+
- '**/*'
|
|
163
179
|
default_instructions: |
|
|
164
180
|
Complete the feature by cleaning up code and updating documentation.
|
|
165
181
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Workflows Plugin
|
|
3
|
+
*
|
|
4
|
+
* Structured development workflows for OpenCode.
|
|
5
|
+
* Replaces the MCP server with native OpenCode integration.
|
|
6
|
+
*/
|
|
7
|
+
export { WorkflowsPlugin } from './plugin.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export { default } from './plugin.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Workflows Plugin
|
|
3
|
+
*
|
|
4
|
+
* Structured development workflows for OpenCode.
|
|
5
|
+
* Replaces the MCP server with native OpenCode integration.
|
|
6
|
+
*/
|
|
7
|
+
export { WorkflowsPlugin } from './plugin.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
// Default export for opencode plugin loader
|
|
10
|
+
export { default } from './plugin.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,cAAc,YAAY,CAAC;AAE3B,4CAA4C;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type LoggerFactory } from '@codemcp/workflows-core';
|
|
2
|
+
import type { PluginInput } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Logger interface for structured logging
|
|
5
|
+
*/
|
|
6
|
+
export interface Logger {
|
|
7
|
+
debug: (message: string, extra?: Record<string, unknown>) => void;
|
|
8
|
+
info: (message: string, extra?: Record<string, unknown>) => void;
|
|
9
|
+
warn: (message: string, extra?: Record<string, unknown>) => void;
|
|
10
|
+
error: (message: string, extra?: Record<string, unknown>) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a logger factory that creates loggers which send output to OpenCode SDK.
|
|
14
|
+
* This factory can be passed to ServerContext so handlers use OpenCode logging.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createOpenCodeLoggerFactory(client: PluginInput['client']): LoggerFactory;
|
|
17
|
+
/**
|
|
18
|
+
* Create a logger backed by core's createLogger + a LogSink that delegates
|
|
19
|
+
* log output to the OpenCode SDK client.app.log() API.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createOpenCodeLogger(client: PluginInput['client']): Logger;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createLogger as coreCreateLogger, registerLogSink, } from '@codemcp/workflows-core';
|
|
2
|
+
/**
|
|
3
|
+
* Create a logger factory that creates loggers which send output to OpenCode SDK.
|
|
4
|
+
* This factory can be passed to ServerContext so handlers use OpenCode logging.
|
|
5
|
+
*/
|
|
6
|
+
export function createOpenCodeLoggerFactory(client) {
|
|
7
|
+
const openCodeClient = client;
|
|
8
|
+
return (component) => {
|
|
9
|
+
return {
|
|
10
|
+
debug: (message, context) => {
|
|
11
|
+
openCodeClient.app
|
|
12
|
+
.log({
|
|
13
|
+
body: {
|
|
14
|
+
service: component,
|
|
15
|
+
level: 'debug',
|
|
16
|
+
message,
|
|
17
|
+
extra: context,
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.catch(() => { });
|
|
21
|
+
},
|
|
22
|
+
info: (message, context) => {
|
|
23
|
+
openCodeClient.app
|
|
24
|
+
.log({
|
|
25
|
+
body: {
|
|
26
|
+
service: component,
|
|
27
|
+
level: 'info',
|
|
28
|
+
message,
|
|
29
|
+
extra: context,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.catch(() => { });
|
|
33
|
+
},
|
|
34
|
+
warn: (message, context) => {
|
|
35
|
+
openCodeClient.app
|
|
36
|
+
.log({
|
|
37
|
+
body: {
|
|
38
|
+
service: component,
|
|
39
|
+
level: 'warn',
|
|
40
|
+
message,
|
|
41
|
+
extra: context,
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
.catch(() => { });
|
|
45
|
+
},
|
|
46
|
+
error: (message, error, context) => {
|
|
47
|
+
const errorContext = error
|
|
48
|
+
? { ...context, error: error.message, stack: error.stack }
|
|
49
|
+
: context;
|
|
50
|
+
openCodeClient.app
|
|
51
|
+
.log({
|
|
52
|
+
body: {
|
|
53
|
+
service: component,
|
|
54
|
+
level: 'error',
|
|
55
|
+
message,
|
|
56
|
+
extra: errorContext,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.catch(() => { });
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a logger backed by core's createLogger + a LogSink that delegates
|
|
66
|
+
* log output to the OpenCode SDK client.app.log() API.
|
|
67
|
+
*/
|
|
68
|
+
export function createOpenCodeLogger(client) {
|
|
69
|
+
const openCodeClient = client;
|
|
70
|
+
const service = 'plugin.workflows';
|
|
71
|
+
// Register a LogSink that forwards core log events to the OpenCode SDK.
|
|
72
|
+
// The core LogSink interface uses 'warning' for warn-level; we map that
|
|
73
|
+
// back to 'warn' for the OpenCode SDK which expects the shorter form.
|
|
74
|
+
const sink = {
|
|
75
|
+
log: (level, _logger, message, context) => {
|
|
76
|
+
const sdkLevel = level === 'warning' ? 'warn' : level;
|
|
77
|
+
try {
|
|
78
|
+
return openCodeClient.app.log({
|
|
79
|
+
body: {
|
|
80
|
+
service,
|
|
81
|
+
level: sdkLevel,
|
|
82
|
+
message,
|
|
83
|
+
extra: context,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return Promise.resolve();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
registerLogSink(sink);
|
|
93
|
+
// Return a Logger that delegates to the core logger.
|
|
94
|
+
// The core error() method has signature (message, error?, context?) so we
|
|
95
|
+
// wrap it to match our simpler (message, extra?) interface.
|
|
96
|
+
const coreLogger = coreCreateLogger('plugin.workflows');
|
|
97
|
+
return {
|
|
98
|
+
debug: (message, extra) => coreLogger.debug(message, extra),
|
|
99
|
+
info: (message, extra) => coreLogger.info(message, extra),
|
|
100
|
+
warn: (message, extra) => coreLogger.warn(message, extra),
|
|
101
|
+
error: (message, extra) => coreLogger.error(message, undefined, extra),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=opencode-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-logger.js","sourceRoot":"","sources":["../src/opencode-logger.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Workflows Plugin
|
|
3
|
+
*
|
|
4
|
+
* Integrates workflows-core state management with OpenCode hooks to provide
|
|
5
|
+
* phase-aware development guidance and file edit restrictions.
|
|
6
|
+
*
|
|
7
|
+
* Hooks implemented:
|
|
8
|
+
* 1. chat.message - Add synthetic part with phase instructions after each user message
|
|
9
|
+
* 2. tool.execute.before - Block editing of certain files based on phase
|
|
10
|
+
* 3. experimental.session.compacting - Inject workflow state into compaction context
|
|
11
|
+
*
|
|
12
|
+
* Logs are sent via OpenCode SDK's client.app.log() API
|
|
13
|
+
*/
|
|
14
|
+
import type { Plugin } from './types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Main plugin export
|
|
17
|
+
*/
|
|
18
|
+
export declare const WorkflowsPlugin: Plugin;
|
|
19
|
+
declare const _default: {
|
|
20
|
+
id: string;
|
|
21
|
+
server: Plugin;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|