@zibby/workflow-templates 0.9.5 → 0.10.2

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.
@@ -10,43 +10,41 @@
10
10
  */
11
11
 
12
12
  import { z, SKILLS } from '@zibby/core';
13
- import { formatAssertionChecklist } from './utils.mjs';
14
13
 
15
14
  export const executeLiveNode = {
16
15
  name: 'execute_live',
17
16
  skills: [SKILLS.BROWSER, SKILLS.MEMORY],
18
17
  timeout: 600000,
19
18
 
20
- prompt: (state) => {
21
- const ctx = state.context;
22
- const contextInfo = ctx ? `
23
- Domain Knowledge & Environment:
24
- ${ctx.global || ''}
25
- ${ctx.pathBased ? `Test-Specific Info:\n${ctx.pathBased}\n` : ''}
26
- ${ctx.env ? `Environment Config:\n${JSON.stringify(ctx.env, null, 2)}\n` : ''}
27
- ---
28
- ` : '';
29
-
30
- const assertionChecklist = formatAssertionChecklist(state.preflight?.assertions);
31
-
32
- return `⚠️ CRITICAL: At the END, output ONLY the JSON object. NO explanations after the JSON.
19
+ // Declarative Handlebars prompt (editable in the UI). Dynamic bits:
20
+ // {{testSpec}}, {{#if context}}…{{/if}}, and the assertion checklist via
21
+ // {{#each preflight.assertions}} + the {{inc}} helper.
22
+ prompt: `⚠️ CRITICAL: At the END, output ONLY the JSON object. NO explanations after the JSON.
33
23
 
34
24
  🎯 YOUR GOAL: Execute the test steps and collect evidence for script generation.
35
25
  You don't need perfect verification - just capture the key actions and results.
36
26
  The next node will generate the actual test script from your execution.
37
27
 
38
- ${contextInfo}
39
- ${state.testSpec}
40
- ${assertionChecklist ? `
28
+ {{#if context}}
29
+ Domain Knowledge & Environment:
30
+ {{context.global}}
31
+ {{#if context.pathBased}}Test-Specific Info:
32
+ {{context.pathBased}}
33
+ {{/if}}{{#if context.env}}Environment Config:
34
+ {{json context.env}}
35
+ {{/if}}---
36
+ {{/if}}
37
+ {{testSpec}}
38
+ {{#if preflight.assertions.length}}
41
39
  ═══════════════════════════════════════════════════
42
40
  🎯 ASSERTION CHECKLIST (MANDATORY - from test spec)
43
41
  You MUST include ALL of these in your 'assertions' array.
44
42
  Report each as passed: true or passed: false with evidence.
45
43
  DO NOT skip any. DO NOT add extras.
46
44
 
47
- ${assertionChecklist}
48
- ═══════════════════════════════════════════════════
49
- ` : ''}
45
+ {{#each preflight.assertions}}{{inc @index}}. {{this.description}} → expected: {{this.expected}}
46
+ {{/each}}═══════════════════════════════════════════════════
47
+ {{/if}}
50
48
  ⚠️ CRITICAL RULES (STRICT ENFORCEMENT):
51
49
  1. DO NOT get stuck in read loops - if a snapshot is large, move on
52
50
  2. DO NOT over-analyze - just execute the steps
@@ -169,9 +167,8 @@ IMPORTANT for 'evidenceScreenshots' (array) - OPTIONAL:
169
167
  - If you take screenshots, use descriptive filenames
170
168
  - Filename pattern: "{step-number}-{action-or-state}.png"
171
169
  - Keep it minimal - test execution is more important than documentation
172
- `;
173
- },
174
-
170
+ `,
171
+
175
172
  outputSchema: z.object({
176
173
  success: z.boolean()
177
174
  .describe('Whether the test execution completed successfully'),
@@ -13,7 +13,7 @@
13
13
  * - generate_script: must implement each assertion in the test
14
14
  */
15
15
 
16
- import { z, invokeAgent } from '@zibby/core';
16
+ import { z } from '@zibby/core';
17
17
  import { writeFileSync } from 'fs';
18
18
  import { join } from 'path';
19
19
 
@@ -38,23 +38,26 @@ function isMissingSpec(spec) {
38
38
  return s === '' || s.toLowerCase() === 'undefined';
39
39
  }
40
40
 
41
- const PROMPT = (testSpec) => `Analyze this test specification and extract:
41
+ export const preflightNode = {
42
+ name: 'preflight',
43
+ outputSchema: PreflightOutputSchema,
44
+
45
+ // String (Handlebars) prompt — EDITABLE in the UI + overridable per-deploy via
46
+ // nodeConfigOverrides. {{testSpec}} is filled when execute() calls
47
+ // context.invokeAgent({ testSpec }).
48
+ prompt: `Analyze this test specification and extract:
42
49
  1. A concise test title (5-10 words, action-oriented). If you find a ticket ID (e.g., PROJ-123, ACME-456), prefix the title with it.
43
50
  2. Every expected result as a verifiable assertion. Each assertion must be something the browser can check after execution.
44
51
 
45
52
  Test Spec:
46
- ${testSpec}
53
+ {{testSpec}}
47
54
 
48
55
  IMPORTANT: You MUST create ONE assertion for EACH expected result in the spec. Do NOT skip any.
49
56
 
50
57
  Return ONLY this JSON:
51
- { "title": "TICKET-ID: Short action title", "assertions": [ { "description": "...", "expected": "..." }, ... ] }`;
52
-
53
- export const preflightNode = {
54
- name: 'preflight',
55
- outputSchema: PreflightOutputSchema,
58
+ { "title": "TICKET-ID: Short action title", "assertions": [ { "description": "...", "expected": "..." }, ... ] }`,
56
59
 
57
- async execute(state) {
60
+ async execute(context) {
58
61
  // Early exit BEFORE the LLM call when there's no spec to analyze.
59
62
  // Without this guard the node fires the LLM, gets back
60
63
  // `{title: "No test specification provided", assertions: []}`, and
@@ -62,7 +65,7 @@ export const preflightNode = {
62
65
  // still paid for one preflight LLM call we didn't need to make.
63
66
  // Returning empty assertions here triggers the same skip-to-END
64
67
  // path in graph.mjs's preflight conditional edge.
65
- if (isMissingSpec(state.testSpec)) {
68
+ if (isMissingSpec(context.testSpec)) {
66
69
  console.log('⚠️ No test spec provided — skipping browser run.');
67
70
  console.log(' Pass a spec via: zibby test "<inline spec>" or zibby test path/to/spec.txt');
68
71
  return {
@@ -71,11 +74,10 @@ export const preflightNode = {
71
74
  };
72
75
  }
73
76
 
74
- const result = await invokeAgent(PROMPT(state.testSpec), {
75
- state,
76
- model: state.model || 'auto',
77
- schema: PreflightOutputSchema,
78
- });
77
+ const result = await context.invokeAgent(
78
+ { testSpec: context.testSpec },
79
+ { schema: PreflightOutputSchema, model: context.model || 'auto' },
80
+ );
79
81
  return result?.structured || result;
80
82
  },
81
83
 
package/index.js CHANGED
@@ -737,68 +737,6 @@ export const TEMPLATES = {
737
737
  ],
738
738
  },
739
739
  },
740
-
741
- // ── github-comment-response: in-thread reply companion to github-code-review ─
742
- // The CodeRabbit-style conversational back-and-forth: a HUMAN replies to the
743
- // review bot's comment in a PR thread, and this agent replies IN THAT SAME
744
- // THREAD (concede if they're right, clarify with code evidence if not) — NOT a
745
- // fresh full review. Resolved by github-webhook.js as the reply agent
746
- // (link.commentResponseSlug || GITHUB_COMMENT_RESPONSE_SLUG || link.agentSlug).
747
- // A COMPANION to github-code-review — tagged `child-workflow` so it's dropped
748
- // from the browse facet row (same convention as notify-slack / ticket-triage).
749
- // requiredIntegrations (GitHub) is DERIVED from graph.mjs at sync time, like
750
- // every other template — not declared here.
751
- 'github-comment-response': {
752
- name: 'github-comment-response',
753
- displayName: 'GitHub Comment Response',
754
- description: 'Replies conversationally, in-thread, to a human\'s reply on a GitHub PR review comment — the CodeRabbit-style back-and-forth. Reads the thread (bot comment + human reply + anchored diff) and posts a focused reply to the SAME thread, not a fresh review. The conversational companion to GitHub Code Review. GitHub required.',
755
- path: join(__dirname, 'github-comment-response'),
756
- defaultSlug: 'github-comment-response',
757
- deps: { zod: '^3.23.0', '@zibby/skills': '^0.1.33' },
758
- features: [
759
- 'Single-node graph: respond (github) — reads the review-comment thread + replies in-thread',
760
- 'Replies in the SAME thread (github_reply_review_thread) — not a fresh full review',
761
- 'Top-level/summary comments answered via github_reply_issue_comment',
762
- 'Concedes when the human is right; clarifies with code evidence when not',
763
- 'Webhook-triggered on a reply to a bot thread: { owner, repo, prNumber, commentId, threadType, triggeringComment }',
764
- 'Graceful degradation: posts an honest acknowledge-and-clarify reply if the thread read fails',
765
- ],
766
- // COMPANION agent — intentionally NO `marketplace` field so the sync
767
- // (backend/scripts/marketplace-sync-from-templates.mjs) NEVER publishes it
768
- // to the public browse grid. Registry entry kept so `zibby template add
769
- // github-comment-response` resolves it for CLI direct-deploy alongside
770
- // github-code-review. Resolved at runtime by gitlab/github-webhook.js as the
771
- // reply agent (link.commentResponseSlug || *_COMMENT_RESPONSE_SLUG || agentSlug).
772
- },
773
-
774
- // ── gitlab-comment-response: in-thread reply companion to gitlab-code-review ─
775
- // The GitLab analog of github-comment-response. A HUMAN replies to the review
776
- // bot's note in an MR discussion, and this agent replies IN THAT SAME
777
- // DISCUSSION — NOT a fresh review. Resolved by gitlab-webhook.js as the reply
778
- // agent (link.commentResponseSlug || GITLAB_COMMENT_RESPONSE_SLUG ||
779
- // link.agentSlug). A COMPANION to gitlab-code-review — tagged `child-workflow`
780
- // so it's dropped from the browse facet row. requiredIntegrations (GitLab) is
781
- // DERIVED from graph.mjs at sync time, like every other template.
782
- 'gitlab-comment-response': {
783
- name: 'gitlab-comment-response',
784
- displayName: 'GitLab Comment Response',
785
- description: 'Replies conversationally, in-thread, to a human\'s reply on a GitLab MR review note — the CodeRabbit-style back-and-forth. Reads the discussion (bot note + human reply + anchored diff) and posts a focused reply to the SAME discussion, not a fresh review. The conversational companion to GitLab Code Review. GitLab required.',
786
- path: join(__dirname, 'gitlab-comment-response'),
787
- defaultSlug: 'gitlab-comment-response',
788
- deps: { zod: '^3.23.0', '@zibby/skills': '^0.1.33' },
789
- features: [
790
- 'Single-node graph: respond (gitlab) — reads the MR discussion + replies in-thread',
791
- 'Replies in the SAME discussion (gitlab_reply_discussion) — not a fresh full review',
792
- 'General/non-threaded MR comments answered via gitlab_post_mr_note',
793
- 'Concedes when the human is right; clarifies with code evidence when not',
794
- 'Webhook-triggered on a reply to a bot discussion: { projectId, mrIid, discussionId, threadType, triggeringComment }',
795
- 'Works against gitlab.com and self-hosted instances; graceful degradation on discussion-read failure',
796
- ],
797
- // COMPANION agent — intentionally NO `marketplace` field (see the
798
- // github-comment-response note above): never synced to the public grid,
799
- // but kept in the registry so `zibby template add gitlab-comment-response`
800
- // resolves it for CLI direct-deploy alongside gitlab-code-review.
801
- },
802
740
  };
803
741
 
804
742
  export class TemplateFactory {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/workflow-templates",
3
- "version": "0.9.5",
3
+ "version": "0.10.2",
4
4
  "description": "Built-in workflow templates for Zibby — browser-test-automation, code-analysis, generate-test-cases, notify-slack, notify-lark, notify-notion, sentry-triage.",
5
5
  "type": "module",
6
6
  "main": "index.js",