@zibby/core 0.4.6 → 0.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/dist/index.js +150 -153
- package/dist/package.json +1 -8
- package/dist/utils/run-index-post-cli.js +1 -4
- package/package.json +1 -8
- package/dist/templates/browser-test-automation/README.md +0 -136
- package/dist/templates/browser-test-automation/chat.mjs +0 -36
- package/dist/templates/browser-test-automation/graph.mjs +0 -80
- package/dist/templates/browser-test-automation/nodes/cache-replay.mjs +0 -213
- package/dist/templates/browser-test-automation/nodes/execute-live.mjs +0 -254
- package/dist/templates/browser-test-automation/nodes/generate-script.mjs +0 -108
- package/dist/templates/browser-test-automation/nodes/index.mjs +0 -4
- package/dist/templates/browser-test-automation/nodes/preflight.mjs +0 -94
- package/dist/templates/browser-test-automation/nodes/utils.mjs +0 -297
- package/dist/templates/browser-test-automation/pipeline-ids.js +0 -12
- package/dist/templates/browser-test-automation/result-handler.mjs +0 -327
- package/dist/templates/browser-test-automation/run-index.mjs +0 -420
- package/dist/templates/browser-test-automation/run_test.json +0 -358
- package/dist/templates/browser-test-automation/state.js +0 -61
- package/dist/templates/code-analysis/README.md +0 -60
- package/dist/templates/code-analysis/graph.js +0 -72
- package/dist/templates/code-analysis/graph.mjs +0 -33
- package/dist/templates/code-analysis/index.js +0 -18
- package/dist/templates/code-analysis/nodes/analyze-ticket-node.js +0 -204
- package/dist/templates/code-analysis/nodes/create-pr-node.js +0 -175
- package/dist/templates/code-analysis/nodes/finalize-node.js +0 -118
- package/dist/templates/code-analysis/nodes/generate-code-node.js +0 -425
- package/dist/templates/code-analysis/nodes/generate-test-cases-node.js +0 -376
- package/dist/templates/code-analysis/nodes/services/prMetaService.js +0 -86
- package/dist/templates/code-analysis/nodes/setup-node.js +0 -142
- package/dist/templates/code-analysis/prompts/analyze-ticket.md +0 -181
- package/dist/templates/code-analysis/prompts/generate-code.md +0 -33
- package/dist/templates/code-analysis/prompts/generate-test-cases.md +0 -110
- package/dist/templates/code-analysis/state.js +0 -48
- package/dist/templates/generate-test-cases/README.md +0 -72
- package/dist/templates/generate-test-cases/graph.mjs +0 -46
- package/dist/templates/generate-test-cases/nodes/generate-test-cases-node.js +0 -381
- package/dist/templates/generate-test-cases/nodes/setup-node.js +0 -142
- package/dist/templates/generate-test-cases/state.js +0 -54
- package/dist/templates/global-setup.js +0 -56
- package/dist/templates/index.js +0 -147
- package/dist/templates/register-nodes.js +0 -24
- package/templates/browser-test-automation/README.md +0 -136
- package/templates/browser-test-automation/chat.mjs +0 -36
- package/templates/browser-test-automation/graph.mjs +0 -80
- package/templates/browser-test-automation/nodes/cache-replay.mjs +0 -213
- package/templates/browser-test-automation/nodes/execute-live.mjs +0 -254
- package/templates/browser-test-automation/nodes/generate-script.mjs +0 -108
- package/templates/browser-test-automation/nodes/index.mjs +0 -4
- package/templates/browser-test-automation/nodes/preflight.mjs +0 -94
- package/templates/browser-test-automation/nodes/utils.mjs +0 -297
- package/templates/browser-test-automation/pipeline-ids.js +0 -12
- package/templates/browser-test-automation/result-handler.mjs +0 -327
- package/templates/browser-test-automation/run-index.mjs +0 -420
- package/templates/browser-test-automation/run_test.json +0 -358
- package/templates/browser-test-automation/state.js +0 -61
- package/templates/code-analysis/README.md +0 -60
- package/templates/code-analysis/graph.js +0 -72
- package/templates/code-analysis/graph.mjs +0 -33
- package/templates/code-analysis/index.js +0 -18
- package/templates/code-analysis/nodes/analyze-ticket-node.js +0 -204
- package/templates/code-analysis/nodes/create-pr-node.js +0 -175
- package/templates/code-analysis/nodes/finalize-node.js +0 -118
- package/templates/code-analysis/nodes/generate-code-node.js +0 -425
- package/templates/code-analysis/nodes/generate-test-cases-node.js +0 -376
- package/templates/code-analysis/nodes/services/prMetaService.js +0 -86
- package/templates/code-analysis/nodes/setup-node.js +0 -142
- package/templates/code-analysis/prompts/analyze-ticket.md +0 -181
- package/templates/code-analysis/prompts/generate-code.md +0 -33
- package/templates/code-analysis/prompts/generate-test-cases.md +0 -110
- package/templates/code-analysis/state.js +0 -48
- package/templates/generate-test-cases/README.md +0 -72
- package/templates/generate-test-cases/graph.mjs +0 -46
- package/templates/generate-test-cases/nodes/generate-test-cases-node.js +0 -381
- package/templates/generate-test-cases/nodes/setup-node.js +0 -142
- package/templates/generate-test-cases/state.js +0 -54
- package/templates/global-setup.js +0 -56
- package/templates/index.js +0 -147
- package/templates/register-nodes.js +0 -24
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nodes": [
|
|
3
|
-
{
|
|
4
|
-
"id": "preflight",
|
|
5
|
-
"type": "preflight",
|
|
6
|
-
"data": {
|
|
7
|
-
"nodeType": "preflight",
|
|
8
|
-
"label": "preflight"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"id": "execute_live",
|
|
13
|
-
"type": "execute_live",
|
|
14
|
-
"data": {
|
|
15
|
-
"nodeType": "execute_live",
|
|
16
|
-
"label": "execute_live"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"id": "generate_script",
|
|
21
|
-
"type": "generate_script",
|
|
22
|
-
"data": {
|
|
23
|
-
"nodeType": "generate_script",
|
|
24
|
-
"label": "generate_script"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"edges": [
|
|
29
|
-
{
|
|
30
|
-
"source": "preflight",
|
|
31
|
-
"target": "execute_live"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"source": "generate_script",
|
|
35
|
-
"target": "END"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"nodeConfigs": {
|
|
39
|
-
"preflight": {
|
|
40
|
-
"outputSchema": {
|
|
41
|
-
"jsonSchema": {
|
|
42
|
-
"type": "object",
|
|
43
|
-
"properties": {
|
|
44
|
-
"title": {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"description": "Concise test title (5-10 words, action-oriented). Prefix with ticket ID if found."
|
|
47
|
-
},
|
|
48
|
-
"assertions": {
|
|
49
|
-
"type": "array",
|
|
50
|
-
"items": {
|
|
51
|
-
"type": "object",
|
|
52
|
-
"properties": {
|
|
53
|
-
"description": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"description": "What to verify (e.g., \"User is redirected to dashboard\")"
|
|
56
|
-
},
|
|
57
|
-
"expected": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"description": "What the expected outcome looks like (e.g., \"URL contains /dashboard\")"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"required": [
|
|
63
|
-
"description",
|
|
64
|
-
"expected"
|
|
65
|
-
],
|
|
66
|
-
"additionalProperties": false
|
|
67
|
-
},
|
|
68
|
-
"description": "Every expected result from the spec as a verifiable assertion"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"required": [
|
|
72
|
-
"title",
|
|
73
|
-
"assertions"
|
|
74
|
-
],
|
|
75
|
-
"additionalProperties": false
|
|
76
|
-
},
|
|
77
|
-
"variables": [
|
|
78
|
-
{
|
|
79
|
-
"path": "title",
|
|
80
|
-
"type": "string",
|
|
81
|
-
"label": "Concise test title (5-10 words, action-oriented). Prefix with ticket ID if found.",
|
|
82
|
-
"optional": false
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"path": "assertions",
|
|
86
|
-
"type": "array",
|
|
87
|
-
"label": "Every expected result from the spec as a verifiable assertion",
|
|
88
|
-
"optional": false
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"path": "assertions[].description",
|
|
92
|
-
"type": "string",
|
|
93
|
-
"label": "What to verify (e.g., \"User is redirected to dashboard\")",
|
|
94
|
-
"optional": false
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"path": "assertions[].expected",
|
|
98
|
-
"type": "string",
|
|
99
|
-
"label": "What the expected outcome looks like (e.g., \"URL contains /dashboard\")",
|
|
100
|
-
"optional": false
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"execute_live": {
|
|
106
|
-
"outputSchema": {
|
|
107
|
-
"jsonSchema": {
|
|
108
|
-
"type": "object",
|
|
109
|
-
"properties": {
|
|
110
|
-
"success": {
|
|
111
|
-
"type": "boolean",
|
|
112
|
-
"description": "Whether the test execution completed successfully"
|
|
113
|
-
},
|
|
114
|
-
"steps": {
|
|
115
|
-
"type": "array",
|
|
116
|
-
"items": {
|
|
117
|
-
"type": "string"
|
|
118
|
-
},
|
|
119
|
-
"description": "Array of test steps executed"
|
|
120
|
-
},
|
|
121
|
-
"finalUrl": {
|
|
122
|
-
"type": "string",
|
|
123
|
-
"description": "Final URL after test execution"
|
|
124
|
-
},
|
|
125
|
-
"actions": {
|
|
126
|
-
"type": "array",
|
|
127
|
-
"description": "Detailed array of actions performed with descriptions and reasoning"
|
|
128
|
-
},
|
|
129
|
-
"assertions": {
|
|
130
|
-
"type": "array",
|
|
131
|
-
"items": {
|
|
132
|
-
"type": "object",
|
|
133
|
-
"properties": {
|
|
134
|
-
"description": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"description": "What was verified"
|
|
137
|
-
},
|
|
138
|
-
"passed": {
|
|
139
|
-
"type": "boolean",
|
|
140
|
-
"description": "Whether the assertion passed"
|
|
141
|
-
},
|
|
142
|
-
"verifiedAfterAction": {
|
|
143
|
-
"type": "number",
|
|
144
|
-
"description": "Index of the action after which this was verified (0-based, matches actions array index) - REQUIRED"
|
|
145
|
-
},
|
|
146
|
-
"evidence": {
|
|
147
|
-
"type": "string",
|
|
148
|
-
"description": "Brief evidence of what was observed"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"required": [
|
|
152
|
-
"description",
|
|
153
|
-
"passed",
|
|
154
|
-
"verifiedAfterAction"
|
|
155
|
-
],
|
|
156
|
-
"additionalProperties": false
|
|
157
|
-
},
|
|
158
|
-
"description": "Array of assertions made during test"
|
|
159
|
-
},
|
|
160
|
-
"waits": {
|
|
161
|
-
"type": "array",
|
|
162
|
-
"description": "Array of waits needed for proper test execution"
|
|
163
|
-
},
|
|
164
|
-
"evidenceScreenshots": {
|
|
165
|
-
"type": "array",
|
|
166
|
-
"items": {
|
|
167
|
-
"type": "object",
|
|
168
|
-
"properties": {
|
|
169
|
-
"filename": {
|
|
170
|
-
"type": "string",
|
|
171
|
-
"description": "Descriptive filename pattern: {step-number}-{action-or-state}.png"
|
|
172
|
-
},
|
|
173
|
-
"description": {
|
|
174
|
-
"type": "string",
|
|
175
|
-
"description": "What the screenshot shows and why it is evidence"
|
|
176
|
-
},
|
|
177
|
-
"verdict": {
|
|
178
|
-
"type": "string",
|
|
179
|
-
"enum": [
|
|
180
|
-
"pass",
|
|
181
|
-
"fail",
|
|
182
|
-
"info"
|
|
183
|
-
],
|
|
184
|
-
"description": "Test verdict: pass/fail for validation points, info for checkpoints"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"required": [
|
|
188
|
-
"filename",
|
|
189
|
-
"description",
|
|
190
|
-
"verdict"
|
|
191
|
-
],
|
|
192
|
-
"additionalProperties": false
|
|
193
|
-
},
|
|
194
|
-
"description": "Array of screenshots taken at key validation points throughout the test"
|
|
195
|
-
},
|
|
196
|
-
"browserClosed": {
|
|
197
|
-
"type": "boolean",
|
|
198
|
-
"description": "Whether the browser was properly closed (should always be true)"
|
|
199
|
-
},
|
|
200
|
-
"notes": {
|
|
201
|
-
"type": "string",
|
|
202
|
-
"description": "Additional notes or observations. REQUIRED when success=false to explain why test failed or could not execute"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
"required": [
|
|
206
|
-
"success",
|
|
207
|
-
"steps",
|
|
208
|
-
"browserClosed"
|
|
209
|
-
],
|
|
210
|
-
"additionalProperties": false
|
|
211
|
-
},
|
|
212
|
-
"variables": [
|
|
213
|
-
{
|
|
214
|
-
"path": "success",
|
|
215
|
-
"type": "boolean",
|
|
216
|
-
"label": "Whether the test execution completed successfully",
|
|
217
|
-
"optional": false
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"path": "steps",
|
|
221
|
-
"type": "array",
|
|
222
|
-
"label": "Array of test steps executed",
|
|
223
|
-
"optional": false
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"path": "finalUrl",
|
|
227
|
-
"type": "string",
|
|
228
|
-
"label": "Final URL after test execution",
|
|
229
|
-
"optional": true
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"path": "actions",
|
|
233
|
-
"type": "array",
|
|
234
|
-
"label": "Detailed array of actions performed with descriptions and reasoning",
|
|
235
|
-
"optional": true
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"path": "assertions",
|
|
239
|
-
"type": "array",
|
|
240
|
-
"label": "Array of assertions made during test",
|
|
241
|
-
"optional": true
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"path": "assertions[].description",
|
|
245
|
-
"type": "string",
|
|
246
|
-
"label": "What was verified",
|
|
247
|
-
"optional": false
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"path": "assertions[].passed",
|
|
251
|
-
"type": "boolean",
|
|
252
|
-
"label": "Whether the assertion passed",
|
|
253
|
-
"optional": false
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"path": "assertions[].verifiedAfterAction",
|
|
257
|
-
"type": "number",
|
|
258
|
-
"label": "Index of the action after which this was verified (0-based, matches actions array index) - REQUIRED",
|
|
259
|
-
"optional": false
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"path": "assertions[].evidence",
|
|
263
|
-
"type": "string",
|
|
264
|
-
"label": "Brief evidence of what was observed",
|
|
265
|
-
"optional": true
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
"path": "waits",
|
|
269
|
-
"type": "array",
|
|
270
|
-
"label": "Array of waits needed for proper test execution",
|
|
271
|
-
"optional": true
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"path": "evidenceScreenshots",
|
|
275
|
-
"type": "array",
|
|
276
|
-
"label": "Array of screenshots taken at key validation points throughout the test",
|
|
277
|
-
"optional": true
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"path": "evidenceScreenshots[].filename",
|
|
281
|
-
"type": "string",
|
|
282
|
-
"label": "Descriptive filename pattern: {step-number}-{action-or-state}.png",
|
|
283
|
-
"optional": false
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"path": "evidenceScreenshots[].description",
|
|
287
|
-
"type": "string",
|
|
288
|
-
"label": "What the screenshot shows and why it is evidence",
|
|
289
|
-
"optional": false
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"path": "evidenceScreenshots[].verdict",
|
|
293
|
-
"type": "string",
|
|
294
|
-
"label": "Test verdict: pass/fail for validation points, info for checkpoints",
|
|
295
|
-
"optional": false
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"path": "browserClosed",
|
|
299
|
-
"type": "boolean",
|
|
300
|
-
"label": "Whether the browser was properly closed (should always be true)",
|
|
301
|
-
"optional": false
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"path": "notes",
|
|
305
|
-
"type": "string",
|
|
306
|
-
"label": "Additional notes or observations. REQUIRED when success=false to explain why test failed or could not execute",
|
|
307
|
-
"optional": true
|
|
308
|
-
}
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
"generate_script": {
|
|
313
|
-
"outputSchema": {
|
|
314
|
-
"jsonSchema": {
|
|
315
|
-
"type": "object",
|
|
316
|
-
"properties": {
|
|
317
|
-
"success": {
|
|
318
|
-
"type": "boolean"
|
|
319
|
-
},
|
|
320
|
-
"scriptPath": {
|
|
321
|
-
"type": "string"
|
|
322
|
-
},
|
|
323
|
-
"method": {
|
|
324
|
-
"type": "string"
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
"required": [
|
|
328
|
-
"success",
|
|
329
|
-
"scriptPath",
|
|
330
|
-
"method"
|
|
331
|
-
],
|
|
332
|
-
"additionalProperties": false
|
|
333
|
-
},
|
|
334
|
-
"variables": [
|
|
335
|
-
{
|
|
336
|
-
"path": "success",
|
|
337
|
-
"type": "boolean",
|
|
338
|
-
"label": "Success",
|
|
339
|
-
"optional": false
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"path": "scriptPath",
|
|
343
|
-
"type": "string",
|
|
344
|
-
"label": "Script Path",
|
|
345
|
-
"optional": false
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"path": "method",
|
|
349
|
-
"type": "string",
|
|
350
|
-
"label": "Method",
|
|
351
|
-
"optional": false
|
|
352
|
-
}
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
"stateSchema": null
|
|
358
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser Test Automation — Workflow State Schema
|
|
3
|
-
*
|
|
4
|
-
* Declares the input shape that nodes in this template actually read off
|
|
5
|
-
* `state`. Wired into the graph via `graph.setStateSchema(...)` in
|
|
6
|
-
* graph.mjs so that:
|
|
7
|
-
*
|
|
8
|
-
* - `zibby workflow run <slug> -p testSpec=...` validates inputs
|
|
9
|
-
* against this schema before nodes ever execute.
|
|
10
|
-
* - The post-scaffold `Pass inputs:` cheatsheet reads top-level fields
|
|
11
|
-
* from this schema so the printed examples match what the template
|
|
12
|
-
* actually consumes (testSpec, model) instead of generic placeholders.
|
|
13
|
-
*
|
|
14
|
-
* Field provenance:
|
|
15
|
-
* - testSpec, model — USER input (passed via -p / --input).
|
|
16
|
-
* - cwd, sessionPath, — FRAMEWORK-injected by the workflow runner
|
|
17
|
-
* outputPath, context (NOT user input). Declared optional so a
|
|
18
|
-
* user-only payload validates cleanly.
|
|
19
|
-
* - preflight, execute_live — DOWNSTREAM node outputs (set by earlier
|
|
20
|
-
* nodes during graph execution). Same: kept
|
|
21
|
-
* optional so initial inputs validate.
|
|
22
|
-
*
|
|
23
|
-
* `zod` is imported directly from the `zod` package (not re-exported via
|
|
24
|
-
* @zibby/core) — same convention as code-analysis/state.js. The
|
|
25
|
-
* scaffolded user copy gets `zod` via the template's dep merge in
|
|
26
|
-
* templates/index.js.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import { z } from 'zod';
|
|
30
|
-
|
|
31
|
-
export const browserTestAutomationStateSchema = z.object({
|
|
32
|
-
// ---- USER INPUT (what `-p` / `--input` populates) ----
|
|
33
|
-
testSpec: z.string().describe(
|
|
34
|
-
'Plain-English description of the browser test to analyze + execute (REQUIRED).',
|
|
35
|
-
),
|
|
36
|
-
model: z.string().default('auto').describe(
|
|
37
|
-
'Agent model override (e.g. "auto", "opus-4.6"). Defaults to "auto".',
|
|
38
|
-
),
|
|
39
|
-
|
|
40
|
-
// ---- FRAMEWORK-INJECTED (set by the workflow runner, not the user) ----
|
|
41
|
-
cwd: z.string().optional().describe(
|
|
42
|
-
'Working directory the workflow runs in. Injected by the runner.',
|
|
43
|
-
),
|
|
44
|
-
sessionPath: z.string().optional().describe(
|
|
45
|
-
'Per-run session directory under .zibby/output/. Injected by the runner.',
|
|
46
|
-
),
|
|
47
|
-
outputPath: z.string().optional().describe(
|
|
48
|
-
'Target path for the generated Playwright test file. Injected by the runner.',
|
|
49
|
-
),
|
|
50
|
-
context: z.any().optional().describe(
|
|
51
|
-
'Run context bag (project config, env, …). Injected by the runner.',
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
// ---- DOWNSTREAM NODE OUTPUTS (populated mid-graph, not by the user) ----
|
|
55
|
-
preflight: z.any().optional().describe(
|
|
56
|
-
'Output of the preflight node (assertion checklist + title). Set during the run.',
|
|
57
|
-
),
|
|
58
|
-
execute_live: z.any().optional().describe(
|
|
59
|
-
'Output of the execute_live node (recorded actions + steps). Set during the run.',
|
|
60
|
-
),
|
|
61
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Code Analysis Template
|
|
2
|
-
|
|
3
|
-
Multi-node workflow that analyzes a Jira ticket against a code repository
|
|
4
|
-
and emits structured analysis + generated code + test cases.
|
|
5
|
-
|
|
6
|
-
## Nodes
|
|
7
|
-
|
|
8
|
-
- `setup` — clone repos into the workspace, snapshot baseline commit
|
|
9
|
-
- `analyze_ticket` — LLM reads ticket + code, produces a validated
|
|
10
|
-
analysis (canProceed flag + reasoning)
|
|
11
|
-
- `validation_check` — conditional decision: route to `generate_code`
|
|
12
|
-
if `canProceed`, else `finalize`
|
|
13
|
-
- `generate_code` — LLM generates code changes scoped to the ticket
|
|
14
|
-
- `generate_test_cases` — LLM generates test cases covering the changes
|
|
15
|
-
- `finalize` — write outputs, mark complete
|
|
16
|
-
|
|
17
|
-
## Required state inputs
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
{
|
|
21
|
-
workspace: '/abs/path/to/workspace', // local clone target
|
|
22
|
-
repos: [{
|
|
23
|
-
name: 'my-app',
|
|
24
|
-
url: 'https://github.com/org/my-app.git',
|
|
25
|
-
branch: 'main',
|
|
26
|
-
isPrimary: true,
|
|
27
|
-
}],
|
|
28
|
-
ticketContext: {
|
|
29
|
-
ticketKey: 'PROJ-123',
|
|
30
|
-
summary: 'short title',
|
|
31
|
-
description: 'long description',
|
|
32
|
-
acceptanceCriteria: 'optional',
|
|
33
|
-
},
|
|
34
|
-
githubToken: process.env.GITHUB_TOKEN,
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
See `state.js` for the full Zod schema.
|
|
39
|
-
|
|
40
|
-
## Customizing prompts
|
|
41
|
-
|
|
42
|
-
The three LLM nodes load their prompts from `prompts/`:
|
|
43
|
-
|
|
44
|
-
- `prompts/analyze-ticket.md`
|
|
45
|
-
- `prompts/generate-code.md`
|
|
46
|
-
- `prompts/generate-test-cases.md`
|
|
47
|
-
|
|
48
|
-
Edit those files in your scaffolded copy to change agent behavior — no
|
|
49
|
-
code changes needed. The graph reloads them at module-init time.
|
|
50
|
-
|
|
51
|
-
## Cloud deployment
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
zibby workflow deploy <your-slug>
|
|
55
|
-
zibby workflow trigger <uuid> --input '{"workspace": "...", ...}'
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Cloud runs need network access for `git clone` (the `setup` node shells
|
|
59
|
-
out to `git`). Default cloud egress works; pin to a specific IP via the
|
|
60
|
-
dedicated-egress addon if you have firewalled git hosts.
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { setupNode } from './nodes/setup-node.js';
|
|
5
|
-
import { analyzeTicketNode } from './nodes/analyze-ticket-node.js';
|
|
6
|
-
import { generateCodeNode } from './nodes/generate-code-node.js';
|
|
7
|
-
import { generateTestCasesNode } from './nodes/generate-test-cases-node.js';
|
|
8
|
-
import { finalizeNode } from './nodes/finalize-node.js';
|
|
9
|
-
import { analysisStateSchema } from './state.js';
|
|
10
|
-
|
|
11
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const promptsDir = join(__dirname, 'prompts');
|
|
13
|
-
|
|
14
|
-
// Helper to load prompt if file exists
|
|
15
|
-
function loadPrompt(filename) {
|
|
16
|
-
const path = join(promptsDir, filename);
|
|
17
|
-
if (existsSync(path)) {
|
|
18
|
-
return readFileSync(path, 'utf-8');
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Load prompt templates at graph definition time
|
|
24
|
-
const analyzeTicketPrompt = loadPrompt('analyze-ticket.md');
|
|
25
|
-
const generateCodePrompt = loadPrompt('generate-code.md');
|
|
26
|
-
const generateTestCasesPrompt = loadPrompt('generate-test-cases.md');
|
|
27
|
-
|
|
28
|
-
export function buildAnalysisGraph(graph) {
|
|
29
|
-
graph.setStateSchema(analysisStateSchema);
|
|
30
|
-
|
|
31
|
-
graph
|
|
32
|
-
.addNode('setup', setupNode)
|
|
33
|
-
.addNode('analyze_ticket', analyzeTicketNode, {
|
|
34
|
-
prompt: analyzeTicketPrompt
|
|
35
|
-
})
|
|
36
|
-
.addConditionalNode('validation_check', {
|
|
37
|
-
condition: (state) => {
|
|
38
|
-
const validation = state.analyze_ticket?.validation;
|
|
39
|
-
if (!validation?.canProceed) {
|
|
40
|
-
return 'finalize';
|
|
41
|
-
}
|
|
42
|
-
return 'generate_code';
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
.addNode('generate_code', generateCodeNode, {
|
|
46
|
-
prompt: generateCodePrompt
|
|
47
|
-
})
|
|
48
|
-
.addNode('generate_test_cases', generateTestCasesNode, {
|
|
49
|
-
prompt: generateTestCasesPrompt
|
|
50
|
-
})
|
|
51
|
-
.addNode('finalize', finalizeNode)
|
|
52
|
-
.setNodeType('validation_check', 'decision')
|
|
53
|
-
.setEntryPoint('setup')
|
|
54
|
-
.addEdge('setup', 'analyze_ticket')
|
|
55
|
-
.addEdge('analyze_ticket', 'validation_check')
|
|
56
|
-
.addConditionalEdges('validation_check', (state) => {
|
|
57
|
-
const validation = state.analyze_ticket?.validation || state.analyze_ticket_output?.validation;
|
|
58
|
-
if (validation?.canProceed) {
|
|
59
|
-
return 'generate_code';
|
|
60
|
-
}
|
|
61
|
-
return 'finalize';
|
|
62
|
-
}, {
|
|
63
|
-
labels: {
|
|
64
|
-
generate_code: 'if valid',
|
|
65
|
-
finalize: 'if invalid'
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
.addEdge('generate_code', 'generate_test_cases')
|
|
69
|
-
.addEdge('generate_test_cases', 'finalize');
|
|
70
|
-
|
|
71
|
-
return graph;
|
|
72
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* code-analysis template — scaffoldable WorkflowAgent wrapper.
|
|
3
|
-
*
|
|
4
|
-
* Why this file exists alongside graph.js:
|
|
5
|
-
* - graph.js exports `buildAnalysisGraph(graph)` — a builder
|
|
6
|
-
* function the existing `zibby analyze-graph` cli + backend
|
|
7
|
-
* analysis handlers consume directly. Its shape can't change
|
|
8
|
-
* without breaking those callers.
|
|
9
|
-
* - To make code-analysis scaffoldable via
|
|
10
|
-
* `zibby workflow new <slug> -t code-analysis` and runnable via
|
|
11
|
-
* `zibby workflow run <slug>` / `zibby workflow deploy <slug>`,
|
|
12
|
-
* the template needs to expose a WorkflowAgent class — same
|
|
13
|
-
* contract as browser-test-automation.
|
|
14
|
-
*
|
|
15
|
-
* This .mjs is the entry the user-facing scaffold uses; graph.js
|
|
16
|
-
* stays put for internal callers.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
|
|
20
|
-
import { buildAnalysisGraph } from './graph.js';
|
|
21
|
-
|
|
22
|
-
export class CodeAnalysisAgent extends WorkflowAgent {
|
|
23
|
-
buildGraph() {
|
|
24
|
-
const graph = new WorkflowGraph();
|
|
25
|
-
buildAnalysisGraph(graph);
|
|
26
|
-
return graph;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async onComplete(result) {
|
|
30
|
-
const ok = result.success !== false;
|
|
31
|
-
console.log(`[code-analysis] complete — success: ${ok}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code Analysis Module
|
|
3
|
-
* Nodes for analyzing Jira tickets and generating code changes
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// State Schema
|
|
7
|
-
export { analysisStateSchema } from './state.js';
|
|
8
|
-
|
|
9
|
-
// Nodes
|
|
10
|
-
export { setupNode } from './nodes/setup-node.js';
|
|
11
|
-
export { analyzeTicketNode } from './nodes/analyze-ticket-node.js';
|
|
12
|
-
export { generateCodeNode, implementCodeNode } from './nodes/generate-code-node.js';
|
|
13
|
-
export { generateTestCasesNode } from './nodes/generate-test-cases-node.js';
|
|
14
|
-
export { createPRNode } from './nodes/create-pr-node.js';
|
|
15
|
-
export { finalizeNode } from './nodes/finalize-node.js';
|
|
16
|
-
|
|
17
|
-
// Graph Builder
|
|
18
|
-
export { buildAnalysisGraph } from './graph.js';
|