@zibby/skills 0.1.11 → 0.1.12

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.
@@ -1,256 +1,72 @@
1
1
  ---
2
- sidebar_position: 1
3
- title: "@zibby/core"
2
+ sidebar_position: 2
3
+ title: '@zibby/core'
4
4
  ---
5
5
 
6
6
  # @zibby/core
7
7
 
8
- Core test automation engine with multi-agent and multi-MCP support.
8
+ [![npm](https://img.shields.io/npm/v/@zibby/core.svg)](https://www.npmjs.com/package/@zibby/core)
9
+
10
+ The batteries — five built-in agent strategies, the runtime, and a re-export of the `@zibby/agent-workflow` engine. This is what `zibby workflow new` scaffolds workflows against.
9
11
 
10
12
  ```bash
11
13
  npm install @zibby/core
12
14
  ```
13
15
 
14
- > Most users don't install this directly — `@zibby/cli` depends on it automatically.
15
-
16
- ## What's Inside
16
+ ## What's in it
17
17
 
18
- `@zibby/core` is the runtime heart of Zibby. It provides:
18
+ ### Built-in agent strategies
19
19
 
20
- | Module | Purpose |
20
+ | Strategy | Backed by |
21
21
  |---|---|
22
- | **Workflow Framework** | `WorkflowGraph`, `Node`, `WorkflowState`, graph compiler |
23
- | **Agent Strategies** | `CursorAgentStrategy`, `ClaudeAgentStrategy`, `CodexAgentStrategy` |
24
- | **Skill Registry** | `registerSkill`, `getSkill`, `listSkillIds` |
25
- | **Graph Compiler** | `compileGraph`, `validateGraphConfig` — JSON → executable graph |
26
- | **Tool Resolver** | Maps node skill declarations to concrete MCP tool permissions |
27
- | **Code Generator** | `generateWorkflowCode` — serializes graphs to code |
28
- | **Templates** | Built-in workflow templates (browser-test-automation, code-analysis) |
29
- | **Enrichment Pipeline** | DOM enrichers, accessibility enrichers, page-state enrichers |
30
- | **Runtime** | Stable-ID runtime, verification strategies, Playwright integration |
31
- | **Sync** | Cloud upload/download for test results |
32
-
33
- ## Exports
34
-
35
- ```javascript
36
- // Framework
37
- import {
38
- WorkflowGraph,
39
- Node,
40
- ConditionalNode,
41
- WorkflowState,
42
- OutputParser,
43
- compileGraph,
44
- validateGraphConfig,
45
- extractSteps,
46
- } from '@zibby/core';
22
+ | `CursorAgentStrategy` | `cursor-agent` CLI |
23
+ | `ClaudeAgentStrategy` | `@anthropic-ai/claude-agent-sdk` |
24
+ | `CodexAgentStrategy` | `@openai/codex` CLI |
25
+ | `GeminiAgentStrategy` | `@google/gemini-cli` |
26
+ | `AssistantStrategy` | OpenAI Assistants API |
47
27
 
48
- // Agent strategies
49
- import {
50
- invokeAgent,
51
- getAgentStrategy,
52
- CursorAgentStrategy,
53
- ClaudeAgentStrategy,
54
- AgentStrategy,
55
- } from '@zibby/core';
56
-
57
- // Skill registry
58
- import {
59
- registerSkill,
60
- getSkill,
61
- hasSkill,
62
- getAllSkills,
63
- listSkillIds,
64
- } from '@zibby/core';
65
-
66
- // Zod (re-exported for convenience)
67
- import { z } from '@zibby/core';
28
+ Importing `@zibby/core` registers all five into the `@zibby/agent-workflow` strategy registry automatically. So:
68
29
 
69
- // Skills enum
70
- import { SKILLS } from '@zibby/core';
71
- ```
72
-
73
- ## WorkflowGraph
74
-
75
- The central class. Create a graph, add nodes and edges, then run it.
76
-
77
- ```javascript
30
+ ```js
78
31
  import { WorkflowGraph } from '@zibby/core';
79
- import { z } from '@zibby/core';
80
-
81
- const graph = new WorkflowGraph({
82
- stateSchema: z.object({ // Optional: validates initial state
83
- testSpec: z.string(),
84
- cwd: z.string().optional(),
85
- }),
86
- middleware: [], // Optional: wrap every node execution
87
- });
88
-
89
- graph.addNode('step_a', myNode);
90
- graph.addEdge('step_a', 'step_b');
91
- graph.setEntryPoint('step_a');
92
-
93
- const result = await graph.run(agent, { testSpec: '...' });
94
- ```
95
-
96
- **Key methods:**
97
-
98
- | Method | Description |
99
- |---|---|
100
- | `addNode(name, config, options?)` | Add an executable node |
101
- | `addConditionalNode(name, config)` | Add a node that routes based on state |
102
- | `addEdge(from, to)` | Linear connection between nodes |
103
- | `addConditionalEdges(from, routeFn)` | Branch based on state — `routeFn(state) => 'next_node'` |
104
- | `setEntryPoint(name)` | Declare which node runs first |
105
- | `setStateSchema(zodSchema)` | Validate initial state before execution |
106
- | `use(middlewareFn)` | Add graph-level middleware |
107
- | `serialize()` | Export graph as JSON (for dashboard visual editor) |
108
- | `run(agent, initialState)` | Execute the graph |
109
-
110
- ## Node Definition
111
-
112
- A node is a plain object with `name`, `prompt`, and `outputSchema`:
113
-
114
- ```javascript
115
- import { z } from '@zibby/core';
116
-
117
- export const myNode = {
118
- name: 'my_node',
119
-
120
- // Prompt: function receiving state, returns string
121
- prompt: (state) => `Analyze: ${state.testSpec}`,
122
32
 
123
- // Output schema: Zod object validated at runtime
124
- outputSchema: z.object({
125
- title: z.string().describe('Short title'),
126
- confidence: z.number().min(0).max(1),
127
- }),
128
-
129
- // Optional: skills needed (MCP tools)
130
- skills: ['browser', 'memory'],
131
-
132
- // Optional: timeout in ms (default 300000)
133
- timeout: 600000,
134
-
135
- // Optional: retry count
136
- retries: 1,
137
-
138
- // Optional: post-processing hook
139
- onComplete: async (state, result) => {
140
- // Transform result before it goes into state
141
- return { ...result, processedAt: Date.now() };
142
- },
143
- };
144
- ```
145
-
146
- For nodes that don't call an LLM (pure data transforms), use a custom `execute` function:
147
-
148
- ```javascript
149
- export const transformNode = {
150
- name: 'transform',
151
- _isCustomCode: true,
152
- outputSchema: z.object({ cleaned: z.string() }),
153
- execute: async (context) => {
154
- const raw = context.state.get('raw_data');
155
- return { cleaned: raw.trim().toLowerCase() };
156
- },
157
- };
33
+ const graph = new WorkflowGraph()
34
+ .addNode('plan', { prompt, outputSchema, agent: 'cursor' }) // already registered
35
+ .setEntryPoint('plan');
158
36
  ```
159
37
 
160
- ## Agent Strategy Framework
38
+ ### Re-exports from agent-workflow
161
39
 
162
- All agents implement the same `AgentStrategy` base class:
40
+ So you can do `import { WorkflowGraph, z, AgentStrategy } from '@zibby/core'` without separately importing the engine:
163
41
 
164
- ```javascript
165
- import { AgentStrategy } from '@zibby/core';
42
+ - `WorkflowGraph`, `WorkflowAgent`, `Node`, `WorkflowState`
43
+ - `AgentStrategy`, `registerStrategy`, `getAgentStrategy`, `invokeAgent`
44
+ - `registerSkill`, `getSkill`, `getAllSkills`
45
+ - `compileGraph`, `validateGraphConfig`
46
+ - `timeline`, session helpers, constants
166
47
 
167
- class MyCustomAgent extends AgentStrategy {
168
- constructor() {
169
- super('my-agent', 'My Custom Agent', 50);
170
- }
48
+ ### z (Zod)
171
49
 
172
- canHandle(context) {
173
- return !!process.env.MY_AGENT_KEY;
174
- }
175
-
176
- async invoke(prompt, options) {
177
- // options.schema — Zod schema for structured output
178
- // options.workspace — working directory
179
- // options.skills — skill IDs to resolve
180
- // options.model — model name or 'auto'
181
- // options.timeout — execution timeout
182
- const response = await myApiCall(prompt, options);
183
- if (options.schema) {
184
- return { raw: response, structured: options.schema.parse(JSON.parse(response)) };
185
- }
186
- return response;
187
- }
188
- }
189
- ```
190
-
191
- Select and invoke an agent:
192
-
193
- ```javascript
194
- import { invokeAgent, getAgentStrategy } from '@zibby/core';
195
-
196
- // Auto-select based on config
197
- const result = await invokeAgent(prompt, { state: { agentType: 'cursor' } }, {
198
- model: 'auto',
199
- workspace: process.cwd(),
200
- schema: MyZodSchema,
201
- skills: ['browser'],
202
- });
203
- ```
50
+ Re-exports `zod/v3` so you don't need a separate Zod dep:
204
51
 
205
- ## Graph Compiler
206
-
207
- Compile a JSON graph definition (from the Zibby dashboard visual editor) into an executable `WorkflowGraph`:
208
-
209
- ```javascript
210
- import { compileGraph, validateGraphConfig } from '@zibby/core';
211
-
212
- const graphJson = {
213
- nodes: [
214
- { id: 'preflight', type: 'preflight', data: { nodeType: 'preflight' } },
215
- { id: 'execute_live', type: 'execute_live', data: { nodeType: 'execute_live' } },
216
- ],
217
- edges: [
218
- { source: 'preflight', target: 'execute_live' },
219
- { source: 'execute_live', target: 'END' },
220
- ],
221
- nodeConfigs: {
222
- preflight: { prompt: 'Analyze: {{testSpec}}' },
223
- },
224
- };
225
-
226
- // Validate
227
- const { valid, errors } = validateGraphConfig(graphJson);
228
-
229
- // Compile
230
- const graph = compileGraph(graphJson, { stateSchema: MySchema });
52
+ ```js
53
+ import { z } from '@zibby/core';
231
54
 
232
- // Run
233
- await graph.run(agent, initialState);
55
+ const Plan = z.object({ tasks: z.array(z.string()) });
234
56
  ```
235
57
 
236
- ## Built-in Templates
58
+ ### Cloud-runtime helpers
237
59
 
238
- ### Browser Test Automation
60
+ Functions used by the cloud executor and Studio integration — `ZibbyRuntime`, `StableIdRuntime`, `resolveIntegrationToken`, `cloneRepo`, `patchCursorAgentForCI`, `runPlaywrightTestTool`. Most users don't import these directly.
239
61
 
240
- ```
241
- preflight → execute_live → generate_script → END
242
- ```
243
-
244
- | Node | Skills | Output |
245
- |---|---|---|
246
- | `preflight` | — | `{ title, assertions[] }` |
247
- | `execute_live` | browser, memory | `{ success, steps[], actions[], assertions[] }` |
248
- | `generate_script` | — | `{ testCode, filename }` |
62
+ ## When to depend on this vs. agent-workflow
249
63
 
250
- ### Code Analysis
64
+ | Goal | Pick |
65
+ |---|---|
66
+ | Build a workflow with built-in agents (cursor/claude/codex/gemini/assistant) | `@zibby/core` |
67
+ | Embed the engine in your own app with custom agents only | `@zibby/agent-workflow` |
68
+ | Use the CLI | `@zibby/cli` (transitively pulls both) |
251
69
 
252
- ```
253
- setup → analyze_ticket → generate_code → generate_test_cases → finalize → END
254
- ```
70
+ ## Source
255
71
 
256
- Used by the cloud pipeline for Jira ticket analysis and code generation.
72
+ - npm: [`@zibby/core`](https://www.npmjs.com/package/@zibby/core)
@@ -0,0 +1,62 @@
1
+ ---
2
+ sidebar_position: 1
3
+ title: Recipes overview
4
+ ---
5
+
6
+ # Built-in workflow recipes
7
+
8
+ Zibby ships with a few **vertical slice workflows** — production-ready pipelines you can run today, demonstrating what the platform does. Each recipe is a real Zibby workflow under the hood, eating its own dog food.
9
+
10
+ ```
11
+ ┌─────────────────────┐
12
+ ┌──────────────────►│ zibby workflow new │ ◄── Build your own
13
+ │ │ zibby workflow ... │
14
+ │ └─────────────────────┘
15
+ │ ▲
16
+ │ │ uses the same primitives
17
+ │ │
18
+ │ ┌─────────────────────┐
19
+ │ Recipes built ──►│ zibby test │ ◄── Browser testing
20
+ │ on top of the │ zibby analyze │ ◄── Code analysis
21
+ │ same platform │ zibby video │ ◄── Test playback
22
+ │ │ zibby generate │ ◄── Spec generation
23
+ │ └─────────────────────┘
24
+ ```
25
+
26
+ You don't have to use the recipes. You can build whatever pipeline you want with `zibby workflow new`. The recipes just save you from writing the obvious starter graphs for common cases.
27
+
28
+ ## Available recipes
29
+
30
+ | Recipe | What it does | Best for |
31
+ |---|---|---|
32
+ | [`zibby test`](./test) | Drives a browser via Cursor or Claude, runs assertions, generates a Playwright script + verification video | E2E test generation from plain-English specs |
33
+ | `zibby analyze` | Reads a Jira/Linear ticket, walks the codebase, produces an implementation plan | Pre-implementation planning, ticket triage |
34
+ | `zibby generate` | Generates test specs from a ticket + codebase | Backfilling test coverage on legacy projects |
35
+ | `zibby video` | Re-records or organizes verification videos for an existing test | Producing demos, regenerating after code changes |
36
+
37
+ ## Why recipes matter
38
+
39
+ Three reasons we ship vertical workflows alongside the platform:
40
+
41
+ 1. **Proof of concept** — every recipe IS a Zibby workflow. If `zibby test` works, the platform works. You can see the actual graph definition and adapt it.
42
+ 2. **Faster onboarding** — you don't need to design a full graph on day one. Run a recipe, see the output, then build your own.
43
+ 3. **Demonstrates multi-vendor** — the test recipe runs across Cursor / Claude / Codex / Gemini. Pick the agent that gives you the best results for your use case; the recipe doesn't care.
44
+
45
+ ## Building your own recipe
46
+
47
+ If you have a workflow you'd want shipped as a built-in:
48
+
49
+ ```bash
50
+ zibby workflow new my-recipe # scaffold
51
+ # ... build it out ...
52
+ zibby workflow run my-recipe # test locally
53
+ zibby workflow deploy my-recipe # ship to your cloud account
54
+ ```
55
+
56
+ If it's broadly useful, we may pull it into the official recipes set. Open an issue or PR.
57
+
58
+ ## Next
59
+
60
+ - **[`zibby test` recipe](./test)** — the most-used recipe, walked through end-to-end
61
+ - **[Build your own workflow](../get-started/your-first-workflow)** — scaffold and customize
62
+ - **[Concepts: graph](../concepts/graph)** — the primitives every recipe is built on
@@ -0,0 +1,154 @@
1
+ ---
2
+ sidebar_position: 2
3
+ title: Browser test recipe (zibby test)
4
+ ---
5
+
6
+ # `zibby test` — browser test recipe
7
+
8
+ The browser-test recipe takes a plain-English spec, drives a real browser via a coding agent (Cursor / Claude / Codex / Gemini), runs the assertions, and produces a Playwright script + verification video.
9
+
10
+ It's a worked example of what the Zibby platform does — every step is a regular workflow node with Zod-validated handoff. You can read the source, fork it, or build your own variation.
11
+
12
+ ## Quick start
13
+
14
+ ```bash
15
+ # Inline spec
16
+ zibby test "Go to https://example.com and verify the title is 'Example Domain'"
17
+
18
+ # Spec file
19
+ zibby test test-specs/login.txt
20
+
21
+ # With a specific agent
22
+ zibby test test-specs/checkout.txt --agent claude
23
+ ```
24
+
25
+ ## What it produces
26
+
27
+ ```
28
+ .zibby/output/sessions/<session-id>/
29
+ ├── execute_live/
30
+ │ ├── result.json ← Zod-validated assertions + agent reasoning
31
+ │ └── browser-trace/ ← Playwright trace files
32
+ ├── generate_script/
33
+ │ ├── result.json ← parsed script + metadata
34
+ │ └── generated.spec.js ← reusable Playwright test
35
+ └── video/
36
+ └── recording.webm ← visual verification
37
+ ```
38
+
39
+ Open the session in [Zibby Studio](https://zibby.app/studio) to scrub through the run, swap the prompt, re-execute any node.
40
+
41
+ ## The graph (this is just a Zibby workflow)
42
+
43
+ Under the hood, `zibby test` is a 3-node graph:
44
+
45
+ ```
46
+ ┌──────────────┐ ┌──────────────────┐ ┌─────────────────┐
47
+ │ preflight │ → │ execute_live │ → │ generate_script │
48
+ │ │ │ │ │ │
49
+ │ extract │ │ agent drives │ │ produce │
50
+ │ assertions │ │ browser via MCP, │ │ Playwright │
51
+ │ from spec │ │ records video │ │ test file │
52
+ └──────────────┘ └──────────────────┘ └─────────────────┘
53
+ │ │ │
54
+ Zod out Zod out Zod out
55
+ (Assertions) (BrowserResult) (PlaywrightScript)
56
+ ```
57
+
58
+ Each node is a real `WorkflowGraph` node. The agent in `execute_live` does its own tool loop (browser navigation, click, assertion checking) — Zibby just defines the contract.
59
+
60
+ ## Customizing
61
+
62
+ **Use a different agent per run:**
63
+ ```bash
64
+ zibby test test-specs/checkout.txt --agent claude # Claude Code
65
+ zibby test test-specs/checkout.txt --agent cursor # Cursor (default)
66
+ zibby test test-specs/checkout.txt --agent codex # OpenAI Codex
67
+ ```
68
+
69
+ **Run only one node** (e.g. just regenerate the script from an existing run):
70
+ ```bash
71
+ zibby test --session 1768974629717 --node generate_script
72
+ ```
73
+
74
+ **Headless vs headed:**
75
+ ```bash
76
+ zibby test test-specs/login.txt # headed (default — see the browser)
77
+ zibby test test-specs/login.txt --headless # headless mode (for CI)
78
+ ```
79
+
80
+ ## Forking the recipe
81
+
82
+ If the built-in recipe doesn't fit your case, scaffold a custom workflow and copy the structure:
83
+
84
+ ```bash
85
+ zibby workflow new my-test-pipeline
86
+ ```
87
+
88
+ Then in `graph.mjs`, define your own nodes:
89
+
90
+ ```js
91
+ import { WorkflowGraph, z } from '@zibby/agent-workflow';
92
+
93
+ const AssertionsSchema = z.object({
94
+ assertions: z.array(z.string()),
95
+ baseUrl: z.string().url(),
96
+ });
97
+
98
+ const BrowserResultSchema = z.object({
99
+ passed: z.boolean(),
100
+ details: z.array(z.object({ assertion: z.string(), passed: z.boolean() })),
101
+ videoPath: z.string().optional(),
102
+ });
103
+
104
+ const graph = new WorkflowGraph();
105
+
106
+ graph.addNode('preflight', {
107
+ agent: 'claude',
108
+ prompt: ({ spec }) => `Extract assertions and base URL from: ${spec}`,
109
+ outputSchema: AssertionsSchema,
110
+ });
111
+
112
+ graph.addNode('execute_live', {
113
+ agent: 'cursor',
114
+ skills: ['browser'],
115
+ prompt: ({ preflight }) => `Navigate to ${preflight.baseUrl} and verify: ${preflight.assertions.join('; ')}`,
116
+ outputSchema: BrowserResultSchema,
117
+ });
118
+
119
+ graph.addEdge('preflight', 'execute_live');
120
+ graph.setEntryPoint('preflight');
121
+
122
+ export default graph;
123
+ ```
124
+
125
+ That's the platform. The recipe is just a starter.
126
+
127
+ ## CI/CD
128
+
129
+ ```yaml
130
+ - name: Run Zibby test
131
+ env:
132
+ ZIBBY_USER_TOKEN: ${{ secrets.ZIBBY_USER_TOKEN }}
133
+ run: |
134
+ npx @zibby/cli test test-specs/checkout.txt --headless
135
+ ```
136
+
137
+ For workflows triggered remotely (rather than per-CI-run), use [`workflow trigger`](../cloud/triggering) on a deployed graph.
138
+
139
+ ## Why this is different from Playwright codegen / a basic LLM script
140
+
141
+ | | Playwright codegen | LLM-only script | Zibby test recipe |
142
+ |---|---|---|---|
143
+ | Plain-English input | ❌ | ✅ | ✅ |
144
+ | Real browser execution | ✅ | ❌ (just generates code) | ✅ |
145
+ | Coding-agent driven | ❌ | partial | ✅ Cursor / Claude / Codex |
146
+ | Multi-step verification | ❌ | ❌ | ✅ Zod-validated nodes |
147
+ | Replayable + debuggable | ❌ | ❌ | ✅ Studio |
148
+ | Vendor-neutral | N/A | locked to one LLM | swap agent per run |
149
+
150
+ ## See also
151
+
152
+ - [Recipes overview](./index)
153
+ - [Concepts: graph](../concepts/graph) — the primitives this recipe uses
154
+ - [Cloud triggering](../cloud/triggering) — fire workflows from CI/CD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/skills",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Built-in skill definitions for Zibby test automation framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "node": ">=18.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@zibby/agent-workflow": "^0.1.2"
49
+ "@zibby/agent-workflow": "^0.3.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@zibby/core": ">=0.1.44"