@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.
Files changed (78) hide show
  1. package/dist/index.js +150 -153
  2. package/dist/package.json +1 -8
  3. package/dist/utils/run-index-post-cli.js +1 -4
  4. package/package.json +1 -8
  5. package/dist/templates/browser-test-automation/README.md +0 -136
  6. package/dist/templates/browser-test-automation/chat.mjs +0 -36
  7. package/dist/templates/browser-test-automation/graph.mjs +0 -80
  8. package/dist/templates/browser-test-automation/nodes/cache-replay.mjs +0 -213
  9. package/dist/templates/browser-test-automation/nodes/execute-live.mjs +0 -254
  10. package/dist/templates/browser-test-automation/nodes/generate-script.mjs +0 -108
  11. package/dist/templates/browser-test-automation/nodes/index.mjs +0 -4
  12. package/dist/templates/browser-test-automation/nodes/preflight.mjs +0 -94
  13. package/dist/templates/browser-test-automation/nodes/utils.mjs +0 -297
  14. package/dist/templates/browser-test-automation/pipeline-ids.js +0 -12
  15. package/dist/templates/browser-test-automation/result-handler.mjs +0 -327
  16. package/dist/templates/browser-test-automation/run-index.mjs +0 -420
  17. package/dist/templates/browser-test-automation/run_test.json +0 -358
  18. package/dist/templates/browser-test-automation/state.js +0 -61
  19. package/dist/templates/code-analysis/README.md +0 -60
  20. package/dist/templates/code-analysis/graph.js +0 -72
  21. package/dist/templates/code-analysis/graph.mjs +0 -33
  22. package/dist/templates/code-analysis/index.js +0 -18
  23. package/dist/templates/code-analysis/nodes/analyze-ticket-node.js +0 -204
  24. package/dist/templates/code-analysis/nodes/create-pr-node.js +0 -175
  25. package/dist/templates/code-analysis/nodes/finalize-node.js +0 -118
  26. package/dist/templates/code-analysis/nodes/generate-code-node.js +0 -425
  27. package/dist/templates/code-analysis/nodes/generate-test-cases-node.js +0 -376
  28. package/dist/templates/code-analysis/nodes/services/prMetaService.js +0 -86
  29. package/dist/templates/code-analysis/nodes/setup-node.js +0 -142
  30. package/dist/templates/code-analysis/prompts/analyze-ticket.md +0 -181
  31. package/dist/templates/code-analysis/prompts/generate-code.md +0 -33
  32. package/dist/templates/code-analysis/prompts/generate-test-cases.md +0 -110
  33. package/dist/templates/code-analysis/state.js +0 -48
  34. package/dist/templates/generate-test-cases/README.md +0 -72
  35. package/dist/templates/generate-test-cases/graph.mjs +0 -46
  36. package/dist/templates/generate-test-cases/nodes/generate-test-cases-node.js +0 -381
  37. package/dist/templates/generate-test-cases/nodes/setup-node.js +0 -142
  38. package/dist/templates/generate-test-cases/state.js +0 -54
  39. package/dist/templates/global-setup.js +0 -56
  40. package/dist/templates/index.js +0 -147
  41. package/dist/templates/register-nodes.js +0 -24
  42. package/templates/browser-test-automation/README.md +0 -136
  43. package/templates/browser-test-automation/chat.mjs +0 -36
  44. package/templates/browser-test-automation/graph.mjs +0 -80
  45. package/templates/browser-test-automation/nodes/cache-replay.mjs +0 -213
  46. package/templates/browser-test-automation/nodes/execute-live.mjs +0 -254
  47. package/templates/browser-test-automation/nodes/generate-script.mjs +0 -108
  48. package/templates/browser-test-automation/nodes/index.mjs +0 -4
  49. package/templates/browser-test-automation/nodes/preflight.mjs +0 -94
  50. package/templates/browser-test-automation/nodes/utils.mjs +0 -297
  51. package/templates/browser-test-automation/pipeline-ids.js +0 -12
  52. package/templates/browser-test-automation/result-handler.mjs +0 -327
  53. package/templates/browser-test-automation/run-index.mjs +0 -420
  54. package/templates/browser-test-automation/run_test.json +0 -358
  55. package/templates/browser-test-automation/state.js +0 -61
  56. package/templates/code-analysis/README.md +0 -60
  57. package/templates/code-analysis/graph.js +0 -72
  58. package/templates/code-analysis/graph.mjs +0 -33
  59. package/templates/code-analysis/index.js +0 -18
  60. package/templates/code-analysis/nodes/analyze-ticket-node.js +0 -204
  61. package/templates/code-analysis/nodes/create-pr-node.js +0 -175
  62. package/templates/code-analysis/nodes/finalize-node.js +0 -118
  63. package/templates/code-analysis/nodes/generate-code-node.js +0 -425
  64. package/templates/code-analysis/nodes/generate-test-cases-node.js +0 -376
  65. package/templates/code-analysis/nodes/services/prMetaService.js +0 -86
  66. package/templates/code-analysis/nodes/setup-node.js +0 -142
  67. package/templates/code-analysis/prompts/analyze-ticket.md +0 -181
  68. package/templates/code-analysis/prompts/generate-code.md +0 -33
  69. package/templates/code-analysis/prompts/generate-test-cases.md +0 -110
  70. package/templates/code-analysis/state.js +0 -48
  71. package/templates/generate-test-cases/README.md +0 -72
  72. package/templates/generate-test-cases/graph.mjs +0 -46
  73. package/templates/generate-test-cases/nodes/generate-test-cases-node.js +0 -381
  74. package/templates/generate-test-cases/nodes/setup-node.js +0 -142
  75. package/templates/generate-test-cases/state.js +0 -54
  76. package/templates/global-setup.js +0 -56
  77. package/templates/index.js +0 -147
  78. package/templates/register-nodes.js +0 -24
@@ -1,181 +0,0 @@
1
- # Analyze Ticket: {{ticketKey}}
2
-
3
- ## Ticket Information
4
-
5
- **Type:** {{ticketType}}
6
- **Priority:** {{ticketPriority}}
7
- **Summary:** {{{ticketSummary}}}
8
-
9
- **Description:**
10
- {{{ticketDescription}}}
11
-
12
- {{#if ticketLabels}}
13
- **Labels:** {{ticketLabels}}
14
- {{/if}}
15
-
16
- {{#if ticketComponents}}
17
- **Components:** {{ticketComponents}}
18
- {{/if}}
19
-
20
- {{#if additionalContext}}
21
- ## Additional Context
22
-
23
- {{{additionalContext}}}
24
-
25
- {{/if}}
26
- ---
27
-
28
- ## Repository Information
29
-
30
- Your workspace contains ONLY these top-level repository directories:
31
-
32
- {{#each repositories}}
33
- - **{{name}}** — {{language}}{{#if framework}}, {{framework}}{{/if}}{{#if packageManager}} ({{packageManager}}){{/if}}
34
- {{/each}}
35
-
36
- **IMPORTANT:** These are the ONLY repositories. Sub-directories or internal modules (e.g. Maven modules, packages within a monorepo) are NOT separate repositories. All file paths in your analysis MUST start with one of the repository names listed above (e.g. `{{repositories.[0].name}}/path/to/file`).
37
-
38
- ---
39
-
40
- ## Your Task
41
-
42
- Analyze this ticket **BY EXAMINING THE ACTUAL CODEBASE** and provide:
43
- 1. **Validation** - Determine if the ticket has enough information to implement
44
- 2. **Suggested improvements** to the ticket's summary, description, or labels
45
-
46
- ### Analysis Steps
47
-
48
- 1. **REPO RELEVANCE CHECK (MANDATORY FIRST STEP)** - Read the repo's `README.md` or `package.json` to understand what this project is. If the ticket's domain/features do not genuinely belong to this codebase, stop immediately — set `canProceed: false`, `status: 'invalid_ticket'`. Do NOT force-fit: files with similar names (e.g. `auth.js`) do not make a ticket relevant.
49
-
50
- 2. **VALIDATE THE TICKET** - Determine if we can proceed:
51
- - Does the ticket make sense? Is it clear what needs to be done?
52
- - Is there enough context to understand the requirements?
53
- - Are the requirements technically feasible based on the codebase?
54
- - Is the ticket specific enough, or is it too vague?
55
- - Are there obvious blockers (missing dependencies, architectural issues)?
56
-
57
- **If validation fails**, set:
58
- - `canProceed: false`
59
- - `status`: One of: 'insufficient_context', 'unclear_requirements', 'invalid_ticket', 'needs_clarification'
60
- - `reasoning`: Clear explanation of what's missing or unclear
61
- - `blockers`: List specific issues preventing implementation
62
-
63
- **If validation passes**, set:
64
- - `canProceed: true`
65
- - `status: 'valid'`
66
- - `reasoning`: Brief confirmation that ticket is ready
67
- - `blockers`: [] or omit
68
-
69
- 3. **Review the ticket** - Read the summary, description, and labels carefully
70
- 4. **Explore the codebase** - Examine the relevant files, functions, and components
71
- - Use file search, grep, and read tools to understand existing patterns
72
- - Identify the exact files and code that will be affected
73
- - Assess the complexity of the changes required
74
- 5. **Identify improvements** - Look for:
75
- - Typos, grammar, or incorrect terminology (use real codebase names)
76
- - Missing acceptance criteria or ambiguous requirements
77
- - Better ways to phrase the summary based on codebase terminology
78
- - Missing or incorrect labels based on actual components affected
79
-
80
- ---
81
-
82
- ## IMPORTANT: Output Format
83
-
84
- You MUST return your analysis as valid JSON in the following structure:
85
-
86
- ```json
87
- {
88
- "validation": {
89
- "canProceed": true,
90
- "status": "valid",
91
- "reasoning": "Ticket has clear requirements and matches existing codebase patterns. Implementation is straightforward.",
92
- "blockers": []
93
- },
94
- "suggestedChanges": [
95
- {
96
- "field": "summary",
97
- "original": "<the current ticket summary>",
98
- "suggested": "Your improved summary here",
99
- "reasoning": "Why this change improves clarity (reference actual codebase structure)"
100
- },
101
- {
102
- "field": "description",
103
- "original": "<the current ticket description — full text>",
104
- "suggested": "<paste the full corrected description here exactly as it should appear — same structure as original, with typos corrected, terminology updated to match the codebase, and any missing details filled in>",
105
- "reasoning": "Why this change helps developers (based on codebase)"
106
- },
107
- {
108
- "field": "labels",
109
- "original": "<the current labels or None>",
110
- "suggested": "frontend, backend, api-change",
111
- "reasoning": "These labels reflect the actual components affected (based on code)"
112
- }
113
- ],
114
- "technicalAnalysis": {
115
- "requirements": [
116
- "Key requirement 1",
117
- "Key requirement 2"
118
- ],
119
- "affectedFiles": [
120
- "repo-name/src/components/Feature.js",
121
- "repo-name/src/api/endpoint.js"
122
- ],
123
- "complexity": "simple|medium|complex",
124
- "risks": [
125
- "Potential risk 1"
126
- ]
127
- },
128
- "overallSummary": "Brief 1-2 sentence summary of findings based on codebase review",
129
- "implementationPlan": "## Summary\nBrief description of what to build.\n\n## Repositories\nChanges needed in: `repo-a`, `repo-b` (read-only reference: `repo-c`).\nThese MUST be top-level workspace directories listed in Repository Information above.\n\n## TODO\n1. In `repo-a/submodule/src/path/to/NewFile.java` — create new entity following `ExistingEntity` pattern\n2. In `repo-a/submodule/src/path/to/Controller.java` — add POST endpoint `/api/thing`\n3. In `repo-b/config/routes.json` — add route entry\n4. ...\n\nEvery path MUST start with a top-level repo name (repo-a/, repo-b/, etc.), never a sub-directory or internal module name.\n\n## Technical Details\n- Follow pattern in `repo-a/submodule/src/.../ExistingService.java` for the service layer\n- Table name: `snake_case_name` (see existing migration `V1.0.100__example.sql`)\n- Risk: watch out for X"
130
- }
131
- ```
132
-
133
- ### EXAMPLE: Validation Failed (Insufficient Context)
134
-
135
- ```json
136
- {
137
- "validation": {
138
- "canProceed": false,
139
- "status": "insufficient_context",
140
- "reasoning": "The ticket asks to 'fix the login bug' but does not specify what the bug is, how to reproduce it, or what the expected behavior should be. Cannot determine what needs to be fixed.",
141
- "blockers": [
142
- "No description of the actual bug or issue",
143
- "No reproduction steps provided",
144
- "No expected vs actual behavior specified",
145
- "Cannot identify which part of login flow is broken"
146
- ]
147
- },
148
- "suggestedChanges": [
149
- {
150
- "field": "description",
151
- "original": "Fix the login bug",
152
- "suggested": "Fix the login bug\n\n**Bug Description:** [describe the bug]\n\n**Steps to Reproduce:**\n1. Go to /login\n2. Enter valid credentials\n3. Click submit\n\n**Expected:** Should redirect to dashboard\n**Actual:** [describe what happens]\n\n**Environment:** Browser, OS",
153
- "reasoning": "Description is a single sentence with no reproduction steps or expected behavior — added template for required information."
154
- }
155
- ],
156
- "technicalAnalysis": {
157
- "requirements": [],
158
- "affectedFiles": [],
159
- "complexity": "simple",
160
- "risks": ["Cannot proceed without more information"]
161
- },
162
- "overallSummary": "Ticket is blocked due to insufficient information. Need bug description, reproduction steps, and expected behavior."
163
- }
164
- ```
165
-
166
- ### Rules for Suggested Changes:
167
-
168
- 1. **`suggested` MUST be the actual replacement text** - The `suggested` value replaces `original` directly. It must be the COMPLETE corrected text, NOT instructions or a summary of changes (e.g. "Fix typos: X → Y" is WRONG). The UI diffs `original` vs `suggested` word-by-word.
169
- 2. **For summary**: Use correct codebase terminology and fix typos. Output the full corrected summary.
170
- 3. **For description**: **Enrich, don't rewrite** - You explored the actual codebase, so use that knowledge to improve the ticket: fix typos, correct terminology to match the codebase (e.g. use the real class/component names), add missing acceptance criteria, clarify ambiguous requirements, and add useful technical context you discovered. Keep the original structure and intent — do NOT rewrite from scratch unless the description is fundamentally broken. When adding NEW technical content, use proper Markdown: wrap file paths, function/class/variable names, and inline code references in backticks (e.g. `src/Foo.java`, `toggleLike`), use fenced code blocks for multi-line snippets, but do NOT reformat existing text — only apply formatting to content YOU are adding.
171
- 4. **For labels**: Use comma-separated values that reflect actual components affected (frontend, backend, api-change, etc.)
172
- 5. **Skip fields that are already good** - Only include a field in suggestedChanges if it genuinely benefits from changes.
173
-
174
- ### CRITICAL Guidelines:
175
-
176
- - **ALWAYS read the codebase first** - Use tools to search and read files
177
- - **Base ALL suggestions on actual code** - Don't make assumptions
178
- - **Reference real files** - Include actual file paths in your analysis
179
- - **Follow existing patterns** - Respect the codebase architecture
180
-
181
- Return ONLY the JSON object, no additional text before or after.
@@ -1,33 +0,0 @@
1
- # Implement: {{ticketKey}} — {{{ticketSummary}}}
2
-
3
- ## Description
4
- {{{ticketDescription}}}
5
-
6
- {{#if acceptanceCriteria}}
7
- ## Acceptance Criteria
8
- {{{acceptanceCriteria}}}
9
-
10
- {{/if}}
11
- {{#if analysisContext}}
12
- ## Technical Plan
13
- {{{analysisContext}}}
14
-
15
- {{/if}}
16
- {{#if repositories}}
17
- ## Workspace
18
- The following repositories are cloned in your workspace:
19
- {{#each repositories}}
20
- - `{{name}}` — {{language}}{{#if framework}}, {{framework}}{{/if}}
21
- {{/each}}
22
- Make changes in whichever repositories the Technical Plan and ticket require. If the plan references files in multiple repos, modify all of them.
23
-
24
- {{/if}}
25
- ## Instructions
26
- 1. Read the codebase — understand existing patterns and conventions
27
- 2. Implement the feature — clean code, proper error handling, no unnecessary comments
28
- 3. Write tests for new functionality
29
- 4. Verify everything works
30
-
31
- {{#if isCommitting}}Changes will be committed and pushed to a feature branch.{{else}}Changes will be captured via git diff.{{/if}}
32
-
33
- Now implement the changes!
@@ -1,110 +0,0 @@
1
- You are an AI test automation engineer creating human-readable test specifications.
2
-
3
- WORKSPACE: {{workspace}}
4
-
5
- TICKET: {{ticketKey}} - {{{ticketSummary}}}
6
- {{#if ticketDescription}}
7
- Description: {{{ticketDescription}}}
8
- {{/if}}
9
-
10
- MODIFIED FILES:
11
- {{#each changedFiles}}
12
- - {{this}}
13
- {{/each}}
14
-
15
- FULL CODE DIFF:
16
- ```diff
17
- {{{codeDiff}}}
18
- ```
19
-
20
- {{#if hasTestContext}}
21
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
22
- PROVIDED TEST CONTEXT (USE THESE IN TEST CASES)
23
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
24
-
25
- {{#if testBaseUrl}}Test Base URL: {{testBaseUrl}}{{/if}}
26
- {{#if adminUsername}}Admin Username: {{adminUsername}}{{/if}}
27
- {{#if adminPassword}}Admin Password: {{adminPassword}}{{/if}}
28
- {{#if testAccountUsername}}Test Account Username: {{testAccountUsername}}{{/if}}
29
- {{#if testAccountPassword}}Test Account Password: {{testAccountPassword}}{{/if}}
30
-
31
- **IMPORTANT**: Use these exact values in your test cases. Do NOT make up URLs or credentials.
32
-
33
- {{/if}}
34
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
35
-
36
- YOUR JOB: Generate 4-8 test specifications in plain-text format that AI agents can interpret.
37
-
38
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39
- STEP 1: EXPLORE THE CODEBASE (MANDATORY - DO NOT SKIP)
40
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
41
-
42
- YOU MUST explore the codebase to understand the application structure BEFORE writing tests.
43
-
44
- REQUIRED EXPLORATION:
45
-
46
- 1. **Find and Read Routing Files**
47
- - Search the workspace for routing files: look for common names like App, routes, router, main, index files in .js/.jsx/.ts/.tsx format
48
- - Check common locations: src/, app/, client/, web/, components/, pages/ directories
49
- - Identify ALL routes and their URL patterns
50
- - Pay special attention to routes with parameters (e.g., /stores/:storeId/products, /users/:userId/orders, /items/:itemId)
51
-
52
- 2. **Understand Route Parameters**
53
- - Dynamic segments in routes (marked with :paramName or {paramName}) are PLACEHOLDERS
54
- - You MUST include navigation steps to select/create that resource first
55
- - Example: To reach /stores/:storeId/products, you must first navigate to /stores list and select a specific store
56
- - Example: To reach /orders/:orderId/details, you must first navigate to /orders list and click on a specific order
57
-
58
- 3. **Map Navigation Flow**
59
- - Understand the hierarchy: authentication → landing/home → resource lists → individual resources → sub-features
60
- - Find what links, buttons, tabs exist on each page to navigate to the next level
61
- - Read page components to understand the UI structure and navigation elements
62
-
63
- 4. **Find Authentication**
64
- - Check for login/signin routes, auth components, protected routes, authentication guards
65
- - Look for HOCs, route wrappers, or middleware that handle authentication
66
- - Understand if authentication is required and what the login flow looks like
67
-
68
- 5. **Identify Page Components**
69
- - Find the actual page/view components referenced in routes
70
- - Read their code to understand imports, props, state management, and structure
71
- - Understand what data they load, what APIs they call, and what user actions they support
72
-
73
- CRITICAL RULES:
74
- - Routes with dynamic parameters (like :id, :userId, :orderId) REQUIRE parent resource selection
75
- - You CANNOT jump directly to a URL with an ID - you must navigate through the parent list and SELECT that item
76
- - Base your test steps on ACTUAL navigation paths you discover in the codebase
77
- - If you don't explore properly, your tests will have WRONG navigation and be unusable by AI agents
78
-
79
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
80
- STEP 2: GENERATE TEST SPECIFICATIONS
81
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
82
-
83
- For each test, provide:
84
- - **title**: Test name (e.g., "Filter Orders by Status")
85
- - **application**: Application name (infer from package.json or codebase)
86
- - **url**: Base application URL (usually http://localhost:3000 or staging URL if found)
87
- - **testerRole**: Who performs this test (e.g., "Admin user", "End user", "Guest")
88
- - **feature**: Feature being tested (match the modified files)
89
- - **ticketId**: Use the ticket key provided above
90
- - **testCredentials**: Array of credentials needed (if authentication required):
91
- - field: "Email" / "Password" / "Username" / "API Key", etc.
92
- - value: Use realistic test data (e.g., "admin@example.com", "TestPass123")
93
- - **testObjective**: One clear sentence describing what this test verifies
94
- - **testSteps**: Plain English steps - MUST match actual navigation flow you discovered
95
- - **expectedResults**: Bullet points of what should happen
96
- - **priority**: Critical, High, Medium, or Low
97
- - **category**: Test category (e.g., "Smoke Test", "Regression", "Integration")
98
-
99
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
100
- FINAL REMINDERS
101
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
102
-
103
- 1. ALWAYS explore routing files FIRST
104
- 2. NEVER skip navigation steps - include full path from login to feature
105
- 3. If routes have :parameters, include parent resource selection
106
- 4. Use ACTUAL URLs and paths from the codebase
107
- 5. Write plain English steps - no technical jargon
108
- 6. Base tests on REAL navigation flow, not assumptions
109
-
110
- Now generate test specifications for the ticket above.
@@ -1,48 +0,0 @@
1
- /**
2
- * Analysis Workflow State Schema
3
- */
4
-
5
- import { z } from 'zod';
6
-
7
- export const analysisStateSchema = z.object({
8
- workspace: z.string().describe('Local workspace path'),
9
-
10
- repos: z.array(z.object({
11
- name: z.string(),
12
- url: z.string().url(),
13
- path: z.string().optional(),
14
- branch: z.string().default('main'),
15
- isPrimary: z.boolean().default(false),
16
- })).optional().describe('Repository configurations'),
17
-
18
- ticketContext: z.object({
19
- key: z.string().regex(/^[A-Z]+-\d+$/, 'Invalid ticket format (expected PROJ-123)').optional(),
20
- ticketKey: z.string().optional(),
21
- summary: z.string().min(1).describe('Ticket summary/title'),
22
- description: z.any().optional().describe('Ticket description (string or ADF object)'),
23
- acceptanceCriteria: z.string().optional(),
24
- type: z.string().optional(),
25
- priority: z.string().optional(),
26
- labels: z.array(z.string()).optional(),
27
- components: z.array(z.string()).optional(),
28
- }).describe('Jira/ticket context'),
29
-
30
- promptsDir: z.string().optional().describe('Path to prompts directory'),
31
- githubToken: z.string().optional().describe('GitHub personal access token'),
32
- model: z.string().default('auto').describe('AI model to use'),
33
- nodeConfigs: z.record(z.string(), z.any()).optional().describe('Per-node configuration overrides'),
34
- });
35
-
36
- // NOTE: legacy `EXECUTION_ID`, `PROGRESS_QUEUE_URL`, `PROGRESS_API_URL`,
37
- // `SQS_AUTH_TOKEN`, `PROJECT_API_TOKEN` fields are no longer declared in
38
- // this schema. They were used only by the legacy `analyze-graph` cli +
39
- // the analysis UI's progress reporter — never by template nodes. Zod's
40
- // safeParse here doesn't strip unknown keys (see graph.js:504), so the
41
- // legacy flow still works at runtime: analyze-graph.js injects them
42
- // into initialState, validation passes, nodes ignore them, the
43
- // progress-reporter middleware reads them off the state argument.
44
- //
45
- // Keeping them out of the schema means scaffolded user copies (via
46
- // `zibby workflow new -t code-analysis`) ship a clean state that
47
- // reflects only what the template actually needs — no false coupling
48
- // to internal infra fields.
@@ -1,72 +0,0 @@
1
- # Generate Test Cases Template
2
-
3
- Standalone slice of `code-analysis` — takes a code diff you already
4
- have and generates plain-English test specifications for it. Skips
5
- ticket-analysis and code-gen.
6
-
7
- ## When to use
8
-
9
- - You have a PR diff (or `git diff` output) and want test specs for the changes.
10
- - You don't need the LLM to generate the code itself — that already exists.
11
- - You want a smaller, faster pipeline than the full code-analysis workflow.
12
-
13
- If you want the full pipeline (analyze ticket → generate code → generate
14
- tests in one shot), use `code-analysis` instead.
15
-
16
- ## Graph
17
-
18
- ```
19
- setup ─→ generate_test_cases
20
- ```
21
-
22
- - `setup` — clone repos so the LLM can explore actual routing /
23
- components when writing test steps
24
- - `generate_test_cases` — LLM reads the diff + ticket context, emits
25
- 4–8 plain-English test specs (with priority + category)
26
-
27
- ## Required state inputs
28
-
29
- ```js
30
- {
31
- workspace: '/abs/path/to/workspace',
32
- repos: [{
33
- name: 'my-app',
34
- url: 'https://github.com/org/my-app.git',
35
- branch: 'main',
36
- isPrimary: true,
37
- }],
38
- ticketContext: {
39
- ticketKey: 'PROJ-123',
40
- summary: 'short title',
41
- description: 'long description',
42
- },
43
- codeImplementation: {
44
- diff: '...unified diff string...',
45
- changedFiles: ['src/auth/login.ts', 'src/components/LoginForm.tsx'],
46
- },
47
- githubToken: process.env.GITHUB_TOKEN,
48
- }
49
- ```
50
-
51
- The `codeImplementation` field is what makes this template standalone —
52
- in `code-analysis` it's produced by the upstream `generate_code` node;
53
- here you supply it directly.
54
-
55
- See `state.js` for the full Zod schema.
56
-
57
- ## Customizing the prompt
58
-
59
- The test-generation prompt is inlined in
60
- `nodes/generate-test-cases-node.js` (the `buildTestGenerationPrompt`
61
- function). Edit that to change the LLM's instructions — what
62
- exploration steps it follows, what test format it returns, etc.
63
-
64
- ## Cloud deployment
65
-
66
- ```bash
67
- zibby workflow deploy <your-slug>
68
- zibby workflow trigger <uuid> --input '{"workspace": "...", "codeImplementation": {...}, ...}'
69
- ```
70
-
71
- Cloud runs need network access for `git clone` (the `setup` node
72
- shells out to `git`). Default cloud egress works.
@@ -1,46 +0,0 @@
1
- /**
2
- * generate-test-cases template — standalone slice of code-analysis.
3
- *
4
- * Two-node graph:
5
- *
6
- * setup ─→ generate_test_cases
7
- *
8
- * Use case: "I have a PR diff already; generate test cases for it."
9
- * Skips ticket-analysis + code-gen — the user provides the diff
10
- * directly as `state.codeImplementation`.
11
- *
12
- * Why duplicated nodes/setup-node.js + nodes/generate-test-cases-node.js
13
- * (rather than importing from `../code-analysis/nodes/...`):
14
- * Templates have to be self-contained — when scaffolded into a user's
15
- * project at `.zibby/workflows/<slug>/`, there's no sibling
16
- * `code-analysis/` folder to import from. browser-test + code-analysis
17
- * follow the same convention. The cost is keeping the duplicates in
18
- * sync; the win is each template is independently editable.
19
- */
20
-
21
- import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
22
- import { setupNode } from './nodes/setup-node.js';
23
- import { generateTestCasesNode } from './nodes/generate-test-cases-node.js';
24
- import { generateTestCasesStateSchema } from './state.js';
25
-
26
- export class GenerateTestCasesAgent extends WorkflowAgent {
27
- buildGraph() {
28
- const graph = new WorkflowGraph();
29
- graph.setStateSchema(generateTestCasesStateSchema);
30
-
31
- graph.addNode('setup', setupNode);
32
- graph.addNode('generate_test_cases', generateTestCasesNode);
33
-
34
- graph.setEntryPoint('setup');
35
- graph.addEdge('setup', 'generate_test_cases');
36
- graph.addEdge('generate_test_cases', 'END');
37
-
38
- return graph;
39
- }
40
-
41
- async onComplete(result) {
42
- const tests = result.state?.generate_test_cases?.tests;
43
- const count = tests?.structured?.testCases?.length || 0;
44
- console.log(`[generate-test-cases] complete — ${count} test case(s) generated`);
45
- }
46
- }