@zibby/core 0.3.6 → 0.3.8

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 (42) hide show
  1. package/dist/index.js +34 -32
  2. package/dist/package.json +2 -1
  3. package/dist/register-built-in-strategies.js +25 -23
  4. package/dist/strategies/claude-strategy.js +3 -1
  5. package/dist/strategies/index.js +25 -23
  6. package/dist/templates/browser-test-automation/graph.mjs +20 -6
  7. package/dist/templates/browser-test-automation/nodes/generate-script.mjs +14 -3
  8. package/dist/templates/browser-test-automation/nodes/preflight.mjs +50 -15
  9. package/dist/templates/browser-test-automation/state.js +61 -0
  10. package/dist/templates/code-analysis/README.md +60 -0
  11. package/dist/templates/code-analysis/graph.mjs +33 -0
  12. package/dist/templates/code-analysis/nodes/analyze-ticket-node.js +1 -1
  13. package/dist/templates/code-analysis/nodes/create-pr-node.js +1 -1
  14. package/dist/templates/code-analysis/nodes/generate-code-node.js +1 -1
  15. package/dist/templates/code-analysis/nodes/generate-test-cases-node.js +1 -1
  16. package/dist/templates/code-analysis/nodes/services/prMetaService.js +1 -1
  17. package/dist/templates/code-analysis/state.js +14 -6
  18. package/dist/templates/generate-test-cases/README.md +72 -0
  19. package/dist/templates/generate-test-cases/graph.mjs +46 -0
  20. package/dist/templates/generate-test-cases/nodes/generate-test-cases-node.js +381 -0
  21. package/dist/templates/generate-test-cases/nodes/setup-node.js +142 -0
  22. package/dist/templates/generate-test-cases/state.js +54 -0
  23. package/dist/templates/index.js +53 -0
  24. package/package.json +2 -1
  25. package/templates/browser-test-automation/graph.mjs +20 -6
  26. package/templates/browser-test-automation/nodes/generate-script.mjs +14 -3
  27. package/templates/browser-test-automation/nodes/preflight.mjs +50 -15
  28. package/templates/browser-test-automation/state.js +61 -0
  29. package/templates/code-analysis/README.md +60 -0
  30. package/templates/code-analysis/graph.mjs +33 -0
  31. package/templates/code-analysis/nodes/analyze-ticket-node.js +1 -1
  32. package/templates/code-analysis/nodes/create-pr-node.js +1 -1
  33. package/templates/code-analysis/nodes/generate-code-node.js +1 -1
  34. package/templates/code-analysis/nodes/generate-test-cases-node.js +1 -1
  35. package/templates/code-analysis/nodes/services/prMetaService.js +1 -1
  36. package/templates/code-analysis/state.js +14 -6
  37. package/templates/generate-test-cases/README.md +72 -0
  38. package/templates/generate-test-cases/graph.mjs +46 -0
  39. package/templates/generate-test-cases/nodes/generate-test-cases-node.js +381 -0
  40. package/templates/generate-test-cases/nodes/setup-node.js +142 -0
  41. package/templates/generate-test-cases/state.js +54 -0
  42. package/templates/index.js +53 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * State schema for the generate-test-cases standalone template.
3
+ *
4
+ * Same shape as code-analysis (workspace + repos + ticketContext) PLUS
5
+ * a `codeImplementation` field — the diff this template generates tests
6
+ * for. In code-analysis that field is produced by the upstream
7
+ * generate_code node; here, the user provides it directly.
8
+ */
9
+
10
+ import { z } from 'zod';
11
+
12
+ export const generateTestCasesStateSchema = z.object({
13
+ workspace: z.string().describe('Local workspace path'),
14
+
15
+ repos: z.array(z.object({
16
+ name: z.string(),
17
+ url: z.string().url(),
18
+ path: z.string().optional(),
19
+ branch: z.string().default('main'),
20
+ isPrimary: z.boolean().default(false),
21
+ })).optional().describe('Repository configurations (cloned by setup node so the LLM can explore routing/components)'),
22
+
23
+ ticketContext: z.object({
24
+ key: z.string().regex(/^[A-Z]+-\d+$/, 'Invalid ticket format (expected PROJ-123)').optional(),
25
+ ticketKey: z.string().optional(),
26
+ summary: z.string().min(1).describe('Ticket summary/title'),
27
+ description: z.any().optional().describe('Ticket description (string or ADF object)'),
28
+ acceptanceCriteria: z.string().optional(),
29
+ type: z.string().optional(),
30
+ priority: z.string().optional(),
31
+ labels: z.array(z.string()).optional(),
32
+ components: z.array(z.string()).optional(),
33
+ }).describe('Jira/ticket context — informs test priorities + naming'),
34
+
35
+ // The new direct-input field that distinguishes this standalone template
36
+ // from code-analysis. In code-analysis this comes from generate_code's
37
+ // output; here the user supplies it (e.g. from `git diff` of a PR they
38
+ // want tests for).
39
+ codeImplementation: z.object({
40
+ diff: z.string().describe('Unified-diff string of the changes'),
41
+ changedFiles: z.array(z.string()).describe('List of file paths touched'),
42
+ }).describe('Code changes to generate tests for'),
43
+
44
+ githubToken: z.string().optional().describe('GitHub PAT (needed only if repos[].url requires auth)'),
45
+ model: z.string().default('auto').describe('AI model to use'),
46
+ nodeConfigs: z.record(z.string(), z.any()).optional().describe('Per-node configuration overrides (e.g. extractContext for test credentials)'),
47
+ });
48
+
49
+ // Clean isolation: this schema declares ONLY what the template's nodes
50
+ // actually need. No EXECUTION_ID / PROGRESS_QUEUE_URL / SQS_AUTH_TOKEN
51
+ // / PROJECT_API_TOKEN — those were legacy analysis-UI plumbing fields
52
+ // and the new templates run via the standard `workflow run` /
53
+ // `workflow trigger` cloud pipeline, which has its own progress
54
+ // reporting outside the state object.
@@ -12,6 +12,18 @@ export const TEMPLATES = {
12
12
  description: 'Complete browser test automation workflow with title generation, live execution, and script generation',
13
13
  path: join(__dirname, 'browser-test-automation'),
14
14
  default: true,
15
+ // Suggested slug for `zibby workflow new <slug> -t <name>`. Used in
16
+ // the `template list` scaffold hint so the printed command is
17
+ // copy-paste-ready instead of `your-workflow-name`. Users can still
18
+ // pick anything they want at scaffold time.
19
+ defaultSlug: 'browser-tests',
20
+ // Runtime deps the scaffolded copy needs in addition to @zibby/core.
21
+ // graph.mjs now imports state.js which `import { z } from 'zod'`s
22
+ // directly, so the user's package.json must declare zod or the
23
+ // scaffolded workflow fails on first import.
24
+ deps: {
25
+ zod: '^3.23.0',
26
+ },
15
27
  features: [
16
28
  'Preflight analysis: extract title + assertion checklist from spec',
17
29
  'Execute test live with AI + browser (Claude or Cursor)',
@@ -19,6 +31,47 @@ export const TEMPLATES = {
19
31
  'Real-time streaming output',
20
32
  'Video recording of browser sessions'
21
33
  ]
34
+ },
35
+ 'code-analysis': {
36
+ name: 'code-analysis',
37
+ displayName: 'Code Analysis (Ticket → Code + Tests)',
38
+ description: 'Multi-node workflow that analyzes a Jira ticket against a code repo, generates code changes, and emits test cases',
39
+ path: join(__dirname, 'code-analysis'),
40
+ defaultSlug: 'ticket-analyzer',
41
+ // Runtime deps the scaffolded copy needs in addition to @zibby/core.
42
+ // Merged into the generated package.json so `npm install` works
43
+ // without manual edits. Browser-test doesn't declare any because
44
+ // its nodes only depend on @zibby/core.
45
+ deps: {
46
+ axios: '^1.6.0',
47
+ handlebars: '^4.7.8',
48
+ zod: '^3.23.0',
49
+ },
50
+ features: [
51
+ 'Clone repos + snapshot git baseline',
52
+ 'LLM analysis of ticket against codebase (canProceed gate)',
53
+ 'Conditional routing: skip code-gen if ticket is invalid',
54
+ 'Generate scoped code changes',
55
+ 'Generate test cases covering the changes',
56
+ 'Customizable prompts in prompts/*.md'
57
+ ]
58
+ },
59
+ 'generate-test-cases': {
60
+ name: 'generate-test-cases',
61
+ displayName: 'Generate Test Cases (Diff → Test Specs)',
62
+ description: 'Standalone slice — takes an existing code diff and generates plain-English test specifications for it. Skips ticket-analysis and code-gen.',
63
+ path: join(__dirname, 'generate-test-cases'),
64
+ defaultSlug: 'tests-from-diff',
65
+ deps: {
66
+ zod: '^3.23.0',
67
+ },
68
+ features: [
69
+ 'Two-node graph: setup → generate_test_cases',
70
+ 'Takes a PR diff directly as state input (no upstream code-gen needed)',
71
+ 'LLM explores codebase routing/components for accurate test steps',
72
+ 'Emits 4-8 prioritized test specs (Critical/High/Medium/Low)',
73
+ 'Plain-English test steps — runnable by AI agents'
74
+ ]
22
75
  }
23
76
  };
24
77