@zibby/skills 0.1.8 → 0.1.9

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.
@@ -0,0 +1,110 @@
1
+ ---
2
+ sidebar_position: 4
3
+ title: "@zibby/mcp-browser"
4
+ ---
5
+
6
+ # @zibby/mcp-browser
7
+
8
+ Wrapper around [`@playwright/mcp`](https://github.com/anthropics/playwright-mcp) with stable ID injection, event recording, and session-aware video capture.
9
+
10
+ ```bash
11
+ npm install @zibby/mcp-browser
12
+ ```
13
+
14
+ > Installed automatically as a dependency of `@zibby/core`.
15
+
16
+ ## Why a Wrapper?
17
+
18
+ The official `@playwright/mcp` provides standard browser automation tools. `@zibby/mcp-browser` adds:
19
+
20
+ | Feature | Description |
21
+ |---|---|
22
+ | **Stable IDs** | Injects deterministic `data-zibby-id` attributes into the DOM, so selectors survive page re-renders |
23
+ | **Event Recording** | Captures every MCP tool call (navigate, click, type) with timestamps for the action timeline |
24
+ | **Session Awareness** | Reads `ZIBBY_SESSION_INFO` to know which session and node is active — saves videos and events to the right directory |
25
+ | **Video Capture** | Records browser sessions as video with configurable resolution |
26
+
27
+ ## Usage
28
+
29
+ ### As an MCP Server (standalone)
30
+
31
+ ```bash
32
+ npx mcp-browser-zibby --save-video=1280x720 --viewport-size=1280x720 --output-dir=./output
33
+ ```
34
+
35
+ ### Via the Browser Skill (recommended)
36
+
37
+ The browser skill in `@zibby/skills` resolves to `@zibby/mcp-browser` automatically:
38
+
39
+ ```javascript
40
+ import { SKILLS } from '@zibby/core';
41
+
42
+ export const myNode = {
43
+ name: 'my_node',
44
+ skills: [SKILLS.BROWSER],
45
+ // The framework starts @zibby/mcp-browser as an MCP server
46
+ // and wires it to whichever agent is active
47
+ };
48
+ ```
49
+
50
+ ### Programmatic
51
+
52
+ ```javascript
53
+ import { startServer } from '@zibby/mcp-browser';
54
+
55
+ const server = await startServer({
56
+ saveVideo: '1280x720',
57
+ viewportSize: '1280x720',
58
+ outputDir: './test-results',
59
+ });
60
+ ```
61
+
62
+ ## Stable IDs
63
+
64
+ Standard CSS selectors break when the DOM changes between renders. Stable IDs solve this by injecting deterministic attributes based on element role, position, and content:
65
+
66
+ ```html
67
+ <!-- Before stable ID injection -->
68
+ <button class="btn-primary sc-fEOsli">Submit</button>
69
+
70
+ <!-- After stable ID injection -->
71
+ <button class="btn-primary sc-fEOsli" data-zibby-id="form-submit-button">Submit</button>
72
+ ```
73
+
74
+ The stable ID algorithm considers:
75
+ - Element tag and ARIA role
76
+ - Accessible name and label
77
+ - Position relative to landmarks
78
+ - Content hash for disambiguation
79
+
80
+ This gives the AI and generated Playwright scripts more reliable selectors.
81
+
82
+ ## Event Recording
83
+
84
+ Every MCP tool call is recorded as a structured event:
85
+
86
+ ```json
87
+ {
88
+ "timestamp": 1710784523000,
89
+ "node": "execute_live",
90
+ "tool": "browser_click",
91
+ "arguments": { "element": "Submit button", "ref": "s1e45" },
92
+ "result": "Clicked",
93
+ "duration": 234
94
+ }
95
+ ```
96
+
97
+ Events are saved to `{sessionPath}/{nodeName}/events.json` and used by:
98
+ - The **action timeline** in the Zibby dashboard
99
+ - The **generate_script** node to produce accurate Playwright scripts
100
+ - The **memory** system to record selector usage
101
+
102
+ ## CLI Options
103
+
104
+ | Flag | Default | Description |
105
+ |---|---|---|
106
+ | `--save-video=WxH` | — | Record video at specified resolution |
107
+ | `--viewport-size=WxH` | `1280x720` | Browser viewport size |
108
+ | `--output-dir=PATH` | `test-results/` | Where to save video and event files |
109
+ | `--headed` | `false` | Show the browser window |
110
+ | `--headless` | `true` | Run without a visible window |
@@ -0,0 +1,223 @@
1
+ ---
2
+ sidebar_position: 3
3
+ title: "@zibby/memory"
4
+ ---
5
+
6
+ # @zibby/memory
7
+
8
+ Version-controlled test memory database powered by [Dolt](https://www.dolthub.com/). Learns from every test run — selectors that worked, pages that were visited, patterns that failed, workarounds that helped.
9
+
10
+ ```bash
11
+ npm install @zibby/memory
12
+ ```
13
+
14
+ ## Why Memory?
15
+
16
+ Without memory, every test run starts from scratch. The AI has no idea which selectors are stable, which pages have changed, or what workarounds were discovered in previous runs.
17
+
18
+ With `@zibby/memory`:
19
+ - **Selectors** — the AI knows which CSS/XPath selectors are reliable and which are flaky
20
+ - **Page models** — the AI has a map of page elements, roles, and structure before it even navigates
21
+ - **Navigation patterns** — the AI knows which URL transitions are valid
22
+ - **Test history** — the AI sees pass/fail trends and avoids repeating past failures
23
+ - **Insights** — the AI reads and writes tips (timing quirks, workarounds, selector alternatives)
24
+
25
+ ## Setup
26
+
27
+ ### 1. Install Dolt
28
+
29
+ Dolt is a version-controlled SQL database (Git for data):
30
+
31
+ ```bash
32
+ # macOS
33
+ brew install dolt
34
+
35
+ # Linux
36
+ sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | bash'
37
+ ```
38
+
39
+ ### 2. Initialize Memory Database
40
+
41
+ ```bash
42
+ zibby init --mem
43
+ ```
44
+
45
+ This creates a Dolt database at `.zibby/memory/` with the schema for test runs, selectors, page models, navigation, and insights.
46
+
47
+ ### 3. Enable Memory in Your Workflow
48
+
49
+ Add `SKILLS.MEMORY` to any node that should have memory access:
50
+
51
+ ```javascript
52
+ import { SKILLS } from '@zibby/core';
53
+
54
+ export const executeLiveNode = {
55
+ name: 'execute_live',
56
+ skills: [SKILLS.BROWSER, SKILLS.MEMORY],
57
+ // ...
58
+ };
59
+ ```
60
+
61
+ The built-in `execute_live` node already has memory enabled by default.
62
+
63
+ ## How It Works
64
+
65
+ ### During a Test Run
66
+
67
+ 1. **Before execution** — the memory middleware loads relevant history:
68
+ - Previous runs for this spec (pass/fail, timing)
69
+ - Known selectors for the target pages
70
+ - Saved insights and tips
71
+
72
+ 2. **During execution** — the AI can call memory tools:
73
+ - `memory_get_selectors` to find stable selectors
74
+ - `memory_get_page_model` to understand page structure
75
+ - `memory_save_insight` to record a finding
76
+
77
+ 3. **After execution** — the result handler persists new data:
78
+ - Test result (pass/fail, duration)
79
+ - Selectors used and their success/failure
80
+ - Page model updates
81
+ - Navigation transitions discovered
82
+
83
+ ### Version Control
84
+
85
+ Every persist operation creates a Dolt commit. You can:
86
+
87
+ ```bash
88
+ # View memory history
89
+ cd .zibby/memory
90
+ dolt log
91
+
92
+ # Diff between runs
93
+ dolt diff HEAD~1 HEAD
94
+
95
+ # Branch for experiments
96
+ dolt branch experiment
97
+ dolt checkout experiment
98
+ ```
99
+
100
+ ## Database Schema
101
+
102
+ ### `test_runs`
103
+
104
+ | Column | Type | Description |
105
+ |---|---|---|
106
+ | `session_id` | VARCHAR | Unique session identifier |
107
+ | `spec_path` | VARCHAR | Path to the test spec file |
108
+ | `passed` | BOOLEAN | Whether the test passed |
109
+ | `duration_ms` | INT | Total execution time |
110
+ | `agent_type` | VARCHAR | Which agent ran the test |
111
+ | `created_at` | DATETIME | Timestamp |
112
+
113
+ ### `selectors`
114
+
115
+ | Column | Type | Description |
116
+ |---|---|---|
117
+ | `page_url` | VARCHAR | URL where this selector was used |
118
+ | `selector` | VARCHAR | The CSS/XPath selector string |
119
+ | `stable_id` | VARCHAR | Zibby stable ID (if available) |
120
+ | `success_count` | INT | Times this selector worked |
121
+ | `fail_count` | INT | Times this selector failed |
122
+ | `last_used` | DATETIME | Last usage timestamp |
123
+
124
+ ### `page_model`
125
+
126
+ | Column | Type | Description |
127
+ |---|---|---|
128
+ | `url` | VARCHAR | Page URL |
129
+ | `element_role` | VARCHAR | ARIA role |
130
+ | `element_name` | VARCHAR | Accessible name |
131
+ | `selector` | VARCHAR | Best known selector |
132
+ | `updated_at` | DATETIME | Last update |
133
+
134
+ ### `navigation`
135
+
136
+ | Column | Type | Description |
137
+ |---|---|---|
138
+ | `from_url` | VARCHAR | Source page URL |
139
+ | `to_url` | VARCHAR | Destination page URL |
140
+ | `trigger` | VARCHAR | What caused the navigation (click, submit, etc.) |
141
+ | `count` | INT | Times this transition was observed |
142
+
143
+ ### `insights`
144
+
145
+ | Column | Type | Description |
146
+ |---|---|---|
147
+ | `category` | ENUM | `selector_tip`, `timing`, `navigation`, `workaround`, `flaky`, `general` |
148
+ | `content` | TEXT | The insight text |
149
+ | `spec_path` | VARCHAR | Related spec |
150
+ | `session_id` | VARCHAR | Session that created it |
151
+ | `created_at` | DATETIME | Timestamp |
152
+
153
+ ## MCP Tools
154
+
155
+ The memory MCP server exposes five tools:
156
+
157
+ ```
158
+ memory_get_test_history — Query recent test runs (filter by spec path)
159
+ memory_get_selectors — Query selectors with stability metrics (filter by page URL)
160
+ memory_get_page_model — Query page elements and roles (filter by URL)
161
+ memory_get_navigation — Query page-to-page transitions (filter by source URL)
162
+ memory_save_insight — Save a useful observation for future runs
163
+ ```
164
+
165
+ ### Example: AI Querying Memory
166
+
167
+ During execution, the AI might call:
168
+
169
+ ```json
170
+ {
171
+ "tool": "memory_get_selectors",
172
+ "input": { "pageUrl": "myapp.com/login", "limit": 10 }
173
+ }
174
+ ```
175
+
176
+ And receive:
177
+
178
+ ```json
179
+ [
180
+ { "selector": "[data-testid='email']", "success_count": 12, "fail_count": 0 },
181
+ { "selector": "#login-email", "success_count": 8, "fail_count": 3 },
182
+ { "selector": "input[name='email']", "success_count": 5, "fail_count": 1 }
183
+ ]
184
+ ```
185
+
186
+ The AI then prefers `[data-testid='email']` because it has the highest success rate.
187
+
188
+ ## Middleware Integration
189
+
190
+ Memory provides automatic middleware that injects history into the node context:
191
+
192
+ ```javascript
193
+ import { createMemoryMiddleware } from '@zibby/memory';
194
+
195
+ const middleware = createMemoryMiddleware();
196
+
197
+ const graph = new WorkflowGraph({ middleware: [middleware] });
198
+ ```
199
+
200
+ The memory skill registers this middleware automatically when `SKILLS.MEMORY` is declared on a node.
201
+
202
+ ## CLI Commands
203
+
204
+ ```bash
205
+ # Initialize memory database
206
+ zibby init --mem
207
+
208
+ # View memory stats
209
+ zibby memory status
210
+
211
+ # Sync memory (push to Dolt remote)
212
+ zibby memory sync
213
+ ```
214
+
215
+ ## Exports
216
+
217
+ ```javascript
218
+ import {
219
+ createMemoryMiddleware,
220
+ memoryEndRun,
221
+ memorySyncPush,
222
+ } from '@zibby/memory';
223
+ ```
@@ -0,0 +1,216 @@
1
+ ---
2
+ sidebar_position: 2
3
+ title: "@zibby/skills"
4
+ ---
5
+
6
+ # @zibby/skills
7
+
8
+ Built-in skill definitions for Zibby's test automation framework.
9
+
10
+ ```bash
11
+ npm install @zibby/skills
12
+ ```
13
+
14
+ > Installed automatically as a dependency of `@zibby/cli`.
15
+
16
+ ## What Are Skills?
17
+
18
+ A **skill** is a declarative description of an MCP (Model Context Protocol) server and the tools it exposes. Skills are the bridge between your workflow nodes and external capabilities like browser automation, Jira, GitHub, Slack, and test memory.
19
+
20
+ Skills are **agent-agnostic** — the same skill definition works across Cursor, Claude, and Codex. The framework resolves the skill into the right MCP configuration for whichever agent is active.
21
+
22
+ ## Built-in Skills
23
+
24
+ | Skill ID | MCP Server | Tools Provided |
25
+ |---|---|---|
26
+ | `browser` | `@zibby/mcp-browser` / `@playwright/mcp` | Browser navigation, clicking, typing, snapshots, video |
27
+ | `memory` | `@zibby/mcp-memory` | Test history, selector stability, page model, save insights |
28
+ | `jira` | `@zibby/mcp-jira` | Read/write Jira tickets |
29
+ | `github` | GitHub MCP server | Repository access, PR creation |
30
+ | `slack` | Slack MCP server | Send notifications, post results |
31
+
32
+ ## Using Skills in Nodes
33
+
34
+ Declare skills in a node definition:
35
+
36
+ ```javascript
37
+ import { SKILLS } from '@zibby/core';
38
+
39
+ export const executeLiveNode = {
40
+ name: 'execute_live',
41
+ skills: [SKILLS.BROWSER, SKILLS.MEMORY],
42
+ prompt: (state) => `Execute the test: ${state.testSpec}`,
43
+ outputSchema: ExecutionSchema,
44
+ };
45
+ ```
46
+
47
+ When the workflow runs:
48
+ 1. The framework reads the node's `skills` array
49
+ 2. For each skill, calls `skill.resolve()` to get the MCP server config
50
+ 3. Injects the resolved MCP server into the agent's environment
51
+ 4. Appends the skill's `promptFragment` to the prompt (if defined)
52
+ 5. Runs skill middleware (if defined)
53
+
54
+ ## Skill Anatomy
55
+
56
+ Every skill has this shape:
57
+
58
+ ```javascript
59
+ {
60
+ id: 'browser', // Unique identifier
61
+ type: 'mcp', // 'mcp' or 'function'
62
+ serverName: 'playwright', // MCP server name
63
+ allowedTools: ['mcp__playwright__*'], // Tool patterns for Claude SDK
64
+ cursorKey: 'playwright-official', // Key in ~/.cursor/mcp.json
65
+ sessionEnvKey: 'ZIBBY_SESSION_INFO', // Env var with session path
66
+ envKeys: [], // Required env vars
67
+ description: 'Playwright Browser MCP',
68
+
69
+ // Prompt text appended to every node that uses this skill
70
+ promptFragment: 'Execute using browser tools...',
71
+
72
+ // Returns MCP server config { command, args, env }
73
+ resolve({ sessionPath, workspace }) {
74
+ return {
75
+ command: 'node',
76
+ args: ['/path/to/mcp-server.js', '--output-dir', sessionPath],
77
+ };
78
+ },
79
+
80
+ // Optional: middleware factory (called once per graph run)
81
+ async middleware() {
82
+ return async (nodeName, next, stateValues, state) => {
83
+ // Pre-node logic (e.g., load test history)
84
+ const result = await next();
85
+ // Post-node logic (e.g., persist insights)
86
+ return result;
87
+ };
88
+ },
89
+
90
+ // Tool schemas for compile-time validation
91
+ tools: [
92
+ { name: 'tool_name', description: '...', input_schema: { ... } }
93
+ ],
94
+ }
95
+ ```
96
+
97
+ ## Creating Custom Skills
98
+
99
+ ### MCP Skill (wraps an external MCP server)
100
+
101
+ ```javascript
102
+ import { skill } from '@zibby/skills';
103
+
104
+ export const linear = skill('linear', {
105
+ description: 'Linear issue tracker',
106
+ serverName: 'linear',
107
+ allowedTools: ['mcp__linear__*'],
108
+ envKeys: ['LINEAR_API_KEY'],
109
+ resolve() {
110
+ if (!process.env.LINEAR_API_KEY) return null;
111
+ return {
112
+ command: 'npx',
113
+ args: ['-y', '@anthropic/linear-mcp-server'],
114
+ env: { LINEAR_API_KEY: process.env.LINEAR_API_KEY },
115
+ };
116
+ },
117
+ });
118
+ ```
119
+
120
+ Use it in a node:
121
+
122
+ ```javascript
123
+ graph.addNode('create_issue', {
124
+ name: 'create_issue',
125
+ skills: ['linear'],
126
+ prompt: (state) => `Create a Linear issue for: ${state.bugReport}`,
127
+ outputSchema: IssueSchema,
128
+ });
129
+ ```
130
+
131
+ ### Function Skill (single tool, auto-bridged to MCP)
132
+
133
+ For simple tools that don't need a full MCP server:
134
+
135
+ ```javascript
136
+ import { skill } from '@zibby/skills';
137
+
138
+ export const calculator = skill('calculator', {
139
+ description: 'Perform arithmetic calculations',
140
+ input: {
141
+ expression: 'string',
142
+ },
143
+ handler: async ({ expression }) => {
144
+ const result = eval(expression); // simplified example
145
+ return { result: String(result) };
146
+ },
147
+ });
148
+ ```
149
+
150
+ The framework automatically spawns a lightweight MCP bridge server for function skills at runtime.
151
+
152
+ ### Skill with Middleware
153
+
154
+ Middleware runs before and after every node that uses the skill:
155
+
156
+ ```javascript
157
+ import { skill } from '@zibby/skills';
158
+
159
+ export const audit = skill('audit', {
160
+ description: 'Audit logging',
161
+ resolve() { return null; }, // No MCP server needed
162
+ async middleware() {
163
+ return async (nodeName, next, stateValues, state) => {
164
+ console.log(`[audit] Node ${nodeName} starting`);
165
+ const startTime = Date.now();
166
+ const result = await next();
167
+ console.log(`[audit] Node ${nodeName} completed in ${Date.now() - startTime}ms`);
168
+ return result;
169
+ };
170
+ },
171
+ });
172
+ ```
173
+
174
+ ## Browser Skill Details
175
+
176
+ The browser skill resolves to `@zibby/mcp-browser` if installed, otherwise falls back to `@playwright/mcp`:
177
+
178
+ ```javascript
179
+ // Resolution priority:
180
+ // 1. MCP_BROWSER_PATH env var
181
+ // 2. @zibby/mcp-browser (enhanced: stable IDs, event recording)
182
+ // 3. @playwright/mcp (community fallback)
183
+ ```
184
+
185
+ Default configuration:
186
+ - Video resolution: 1280x720
187
+ - Viewport: 1280x720
188
+ - Output directory: session path or `test-results/`
189
+
190
+ ## Memory Skill Details
191
+
192
+ The memory skill provides five tools:
193
+
194
+ | Tool | Description |
195
+ |---|---|
196
+ | `memory_get_test_history` | Query recent test runs with pass/fail results |
197
+ | `memory_get_selectors` | Query known selectors with stability metrics |
198
+ | `memory_get_page_model` | Query page structure — elements, roles, selectors |
199
+ | `memory_get_navigation` | Query known page-to-page transitions |
200
+ | `memory_save_insight` | Save observations for future runs (selector tips, timing, workarounds) |
201
+
202
+ The memory skill also includes middleware that automatically loads relevant test history before node execution.
203
+
204
+ ## Exports
205
+
206
+ ```javascript
207
+ import { SKILLS } from '@zibby/skills';
208
+ // SKILLS.BROWSER, SKILLS.JIRA, SKILLS.GITHUB, SKILLS.SLACK, SKILLS.MEMORY
209
+
210
+ import { browserSkill, jiraSkill, githubSkill, slackSkill, memorySkill } from '@zibby/skills';
211
+
212
+ import { skill, functionSkill } from '@zibby/skills';
213
+
214
+ // Re-exported from @zibby/core
215
+ import { registerSkill, getSkill, hasSkill, getAllSkills, listSkillIds } from '@zibby/skills';
216
+ ```
@@ -0,0 +1,114 @@
1
+ ---
2
+ sidebar_position: 7
3
+ title: Reviewing Results
4
+ ---
5
+
6
+ # Reviewing Results
7
+
8
+ After running tests with `--sync`, all results are available in the Zibby dashboard for review.
9
+
10
+ ## Test Runs
11
+
12
+ Go to your project's **Test Runs** page to see all executions.
13
+
14
+ Each run shows:
15
+ - Run name and timestamp
16
+ - Pass/fail status
17
+ - Video thumbnail (hover to preview)
18
+ - Source (local spec or cloud test case)
19
+
20
+ ## Video Replay
21
+
22
+ Click on a test run to open the full replay view:
23
+
24
+ ### Video Player
25
+
26
+ - Full video recording of the browser session
27
+ - Playback controls (play, pause, seek)
28
+ - Speed control (0.5x, 1x, 1.5x, 2x)
29
+ - Cinematic mode for full-screen viewing
30
+
31
+ ### Action Timeline
32
+
33
+ A timeline below the video shows every action the AI performed:
34
+
35
+ - **Navigate** — page navigations
36
+ - **Click** — button and link clicks
37
+ - **Type** — keyboard input
38
+ - **Assert** — verification checks
39
+ - **Screenshot** — captured screenshots
40
+
41
+ Click any action to jump to that point in the video.
42
+
43
+ ### Events Sidebar
44
+
45
+ A detailed list of all events with:
46
+ - Timestamps
47
+ - Action descriptions
48
+ - Element selectors
49
+ - AI-generated captions explaining each action
50
+
51
+ ## Generated Scripts
52
+
53
+ The **Scripts** tab shows the auto-generated Playwright test script:
54
+
55
+ ```javascript
56
+ const { test, expect } = require('@playwright/test');
57
+
58
+ test('User Login Flow', async ({ page }) => {
59
+ await page.goto('https://example.com/login');
60
+ await page.fill('[data-testid="email"]', 'test@example.com');
61
+ await page.fill('[data-testid="password"]', 'TestPass123');
62
+ await page.click('[data-testid="submit"]');
63
+ await expect(page).toHaveURL('/dashboard');
64
+ });
65
+ ```
66
+
67
+ Click **Copy** to copy the script to your clipboard and add it to your test suite.
68
+
69
+ ## Test Case Details
70
+
71
+ The **Test Case** tab displays the original test specification that was executed, with syntax highlighting.
72
+
73
+ ## Analysis Results
74
+
75
+ For ticket analyses, the analysis page provides:
76
+
77
+ ### Code Diff Viewer
78
+
79
+ - Side-by-side diff of all code changes
80
+ - File tree navigation
81
+ - **Create Pull Request** button to push changes to GitHub
82
+
83
+ ### Test Cases
84
+
85
+ - Structured test cases with steps, data, and expected outcomes
86
+ - Editable — refine test cases before running them
87
+ - Auto-saves changes
88
+
89
+ ### Pipeline View
90
+
91
+ Live status of each analysis step:
92
+
93
+ | Step | Description |
94
+ |---|---|
95
+ | Setup | Repository cloned and initialized |
96
+ | Analyze Ticket | AI reads and understands the ticket |
97
+ | Generate Code | Code changes produced |
98
+ | Generate Test Cases | Test cases written |
99
+ | Finalize | Report compiled and uploaded |
100
+
101
+ Each step shows logs that can be expanded for debugging.
102
+
103
+ ## Collections
104
+
105
+ Organize runs into collections for grouping related tests:
106
+
107
+ - View collections in the **Collections** sidebar
108
+ - Each collection can have subfolders
109
+ - Drag runs between collections
110
+ - Filter and search within collections
111
+
112
+ ## Sharing Results
113
+
114
+ Share a test run with your team by copying the URL from the browser. Anyone with access to the project can view the results.