@zibby/skills 0.1.8 → 0.1.10

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,358 @@
1
+ ---
2
+ sidebar_position: 5
3
+ title: Custom Workflows
4
+ ---
5
+
6
+ # Custom Workflows
7
+
8
+ Build, test, and deploy your own AI workflows using Zibby's graph-based framework. Custom workflows let you define multi-step AI pipelines that run locally or in Zibby Cloud, triggered via API or subdomain URL.
9
+
10
+ ## Quick Start
11
+
12
+ ```bash
13
+ # 1. Scaffold a new workflow
14
+ zibby g workflow ticket-triage
15
+
16
+ # 2. Test locally
17
+ zibby start ticket-triage
18
+
19
+ # 3. Deploy to cloud
20
+ zibby deploy ticket-triage --project <project-id>
21
+
22
+ # 4. Trigger via API
23
+ curl -X POST https://ticket-triage-6af9.workflows.zibby.app \
24
+ -H "Authorization: Bearer $ZIBBY_API_KEY" \
25
+ -H "Content-Type: application/json" \
26
+ -d '{"input": {"ticket": "BUG-123"}}'
27
+
28
+ # 5. Tail logs
29
+ zibby logs --workflow ticket-triage --project <project-id>
30
+ ```
31
+
32
+ ## Scaffolding
33
+
34
+ ```bash
35
+ zibby g workflow <name>
36
+ ```
37
+
38
+ If you omit the name, Zibby generates a random one (like Heroku app names).
39
+
40
+ This creates:
41
+
42
+ ```
43
+ .zibby/workflows/<name>/
44
+ ├── graph.mjs # Workflow class (entry point)
45
+ ├── nodes/
46
+ │ ├── index.mjs # Barrel export
47
+ │ └── example.mjs # Starter node with prompt + schema
48
+ └── workflow.json # Manifest (metadata, triggers)
49
+ ```
50
+
51
+ ### Workflow Structure
52
+
53
+ **`graph.mjs`** — Defines the workflow class that extends `WorkflowAgent`:
54
+
55
+ ```javascript
56
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
57
+ import { exampleNode } from './nodes/index.mjs';
58
+
59
+ export class TicketTriageWorkflow extends WorkflowAgent {
60
+ buildGraph() {
61
+ const graph = new WorkflowGraph();
62
+
63
+ graph.addNode('example', exampleNode);
64
+ graph.setEntryPoint('example');
65
+ graph.addEdge('example', 'END');
66
+
67
+ return graph;
68
+ }
69
+
70
+ async onComplete(result) {
71
+ console.log(`Workflow complete — success: ${result.success !== false}`);
72
+ }
73
+ }
74
+ ```
75
+
76
+ **`nodes/example.mjs`** — Each node has a prompt function and a Zod output schema:
77
+
78
+ ```javascript
79
+ import { z } from '@zibby/core';
80
+
81
+ const ExampleOutputSchema = z.object({
82
+ summary: z.string().describe('A short summary of the result'),
83
+ status: z.enum(['ok', 'warn', 'error']).describe('Overall status'),
84
+ });
85
+
86
+ export const exampleNode = {
87
+ name: 'example',
88
+ prompt: (state) => `You are a helpful workflow node.
89
+
90
+ Input:
91
+ ${JSON.stringify(state.input || {}, null, 2)}
92
+
93
+ Analyze the input and return a summary with a status.`,
94
+ outputSchema: ExampleOutputSchema,
95
+ };
96
+ ```
97
+
98
+ **`workflow.json`** — Manifest with metadata:
99
+
100
+ ```json
101
+ {
102
+ "name": "ticket-triage",
103
+ "triggers": { "api": true }
104
+ }
105
+ ```
106
+
107
+ ## Adding Nodes
108
+
109
+ Create a new file in `nodes/` and wire it into the graph:
110
+
111
+ ```javascript
112
+ // nodes/classify.mjs
113
+ import { z } from '@zibby/core';
114
+
115
+ const ClassifySchema = z.object({
116
+ priority: z.enum(['critical', 'high', 'medium', 'low']),
117
+ category: z.string(),
118
+ assignTo: z.string().optional(),
119
+ });
120
+
121
+ export const classifyNode = {
122
+ name: 'classify',
123
+ prompt: (state) => `Given this ticket summary:
124
+ ${state.example.summary}
125
+
126
+ Classify the priority, category, and suggested assignee.`,
127
+ outputSchema: ClassifySchema,
128
+ };
129
+ ```
130
+
131
+ Then add it to `graph.mjs`:
132
+
133
+ ```javascript
134
+ import { classifyNode } from './nodes/classify.mjs';
135
+
136
+ // In buildGraph():
137
+ graph.addNode('classify', classifyNode);
138
+ graph.addEdge('example', 'classify'); // instead of example → END
139
+ graph.addEdge('classify', 'END');
140
+ ```
141
+
142
+ ### Conditional Edges
143
+
144
+ Route to different nodes based on output:
145
+
146
+ ```javascript
147
+ graph.addConditionalEdges('classify', (state) => {
148
+ return state.classify.priority === 'critical' ? 'escalate' : 'notify';
149
+ });
150
+ ```
151
+
152
+ ## Local Development
153
+
154
+ ### Start a dev server
155
+
156
+ ```bash
157
+ zibby start ticket-triage
158
+ zibby start ticket-triage --port 3850
159
+ ```
160
+
161
+ This starts a local HTTP server that loads your workflow and exposes a trigger endpoint:
162
+
163
+ ```bash
164
+ curl -X POST http://localhost:3848/trigger \
165
+ -H "Content-Type: application/json" \
166
+ -d '{"input": {"ticket": "BUG-456"}}'
167
+ ```
168
+
169
+ The dev server uses your local `.zibby.config.mjs` for agent configuration (model, API keys, etc.) — the same config used by `zibby test`.
170
+
171
+ ## Deploying to Cloud
172
+
173
+ ### Prerequisites
174
+
175
+ 1. **Authenticated**: Run `zibby login` (or set `ZIBBY_API_KEY`)
176
+ 2. **Project**: Have a project ID (run `zibby list` to see yours)
177
+
178
+ ### Deploy
179
+
180
+ ```bash
181
+ zibby deploy ticket-triage --project <project-id>
182
+ ```
183
+
184
+ This:
185
+ 1. Loads and serializes the workflow graph
186
+ 2. Bundles all source files (`.mjs`, `.js`, `.json`)
187
+ 3. Uploads to Zibby Cloud
188
+ 4. Registers a unique subdomain
189
+
190
+ Output:
191
+
192
+ ```
193
+ Workflow "ticket-triage" deployed to version 1
194
+
195
+ Trigger URL (API):
196
+ POST https://api-prod.zibby.app/projects/<id>/workflows/ticket-triage/trigger
197
+
198
+ Trigger URL (subdomain):
199
+ POST https://ticket-triage-6af9.workflows.zibby.app
200
+
201
+ Tail logs:
202
+ zibby logs <jobId> --project <id>
203
+ ```
204
+
205
+ ### Subdomain URLs
206
+
207
+ Each deployed workflow gets a globally unique subdomain:
208
+
209
+ ```
210
+ https://<workflow-name>-<hash>.workflows.zibby.app
211
+ ```
212
+
213
+ The hash is a short (4-char) deterministic suffix derived from your project ID, ensuring uniqueness across all projects.
214
+
215
+ ### Authentication
216
+
217
+ Both trigger URLs require authentication via the `Authorization` header:
218
+
219
+ - **JWT token** — from `zibby login` session
220
+ - **Personal Access Token (PAT)** — from your project settings (`zby_xxx`)
221
+
222
+ ```bash
223
+ curl -X POST https://ticket-triage-6af9.workflows.zibby.app \
224
+ -H "Authorization: Bearer zby_your_api_key" \
225
+ -H "Content-Type: application/json" \
226
+ -d '{"input": {"ticket": "BUG-789"}}'
227
+ ```
228
+
229
+ ### How Cloud Execution Works
230
+
231
+ When triggered, the workflow runs in an isolated ECS Fargate container:
232
+
233
+ 1. Lambda receives the trigger request
234
+ 2. Workflow sources are loaded from DynamoDB and uploaded to S3
235
+ 3. A Fargate task is launched with the workflow code
236
+ 4. The container downloads sources, rebuilds the graph, and executes it
237
+ 5. Agent configuration (model, API keys) comes from your project settings
238
+
239
+ Each run is fully isolated — no shared state between runs.
240
+
241
+ ## Cloning Repositories
242
+
243
+ Custom workflows can clone your project's configured repositories using the `cloneRepo()` helper:
244
+
245
+ ```javascript
246
+ import { cloneRepo } from '@zibby/core';
247
+
248
+ // In a node's preProcess function
249
+ const repoPaths = await cloneRepo();
250
+ // Returns: { 'myorg/backend': '/workspace/repos/myorg-backend', ... }
251
+ ```
252
+
253
+ This gives your workflow access to your actual codebase for analysis, testing, or deployment tasks.
254
+
255
+ **[See the full Cloning Repositories guide →](./cloning-repositories.md)**
256
+
257
+ ## Tailing Logs
258
+
259
+ ### Tail a specific job
260
+
261
+ The trigger API returns a `jobId`. Use it to tail logs:
262
+
263
+ ```bash
264
+ zibby logs <jobId> --project <project-id>
265
+ ```
266
+
267
+ ### Tail the latest run
268
+
269
+ ```bash
270
+ zibby logs --workflow ticket-triage --project <project-id>
271
+ ```
272
+
273
+ This lists recent runs and automatically tails the latest one.
274
+
275
+ ### All runs (interleaved)
276
+
277
+ ```bash
278
+ zibby logs --workflow ticket-triage --all --project <project-id>
279
+ ```
280
+
281
+ Shows logs from all past runs of the workflow, sorted chronologically with job ID separators:
282
+
283
+ ```
284
+ ── wfj-1713157331-a3 ──
285
+ 2026-04-15 14:02:11 🚀 Starting ticket-triage workflow...
286
+ 2026-04-15 14:02:18 ✅ Workflow complete
287
+
288
+ ── wfj-1713157522-b7 ──
289
+ 2026-04-15 14:05:22 🚀 Starting ticket-triage workflow...
290
+ 2026-04-15 14:05:30 Running node: example
291
+ ```
292
+
293
+ ### Options
294
+
295
+ | Flag | Description |
296
+ |---|---|
297
+ | `--project <id>` | Project ID (or `ZIBBY_PROJECT_ID` env) |
298
+ | `--workflow <name>` | Workflow name (tails latest run) |
299
+ | `--all` | Interleaved logs from all runs (requires `--workflow`) |
300
+ | `--no-follow` | Fetch logs once, don't stream |
301
+ | `--lines <n>` | Max lines per fetch (default: 200) |
302
+
303
+ ## Agent Configuration
304
+
305
+ ### Local
306
+
307
+ Local execution uses your `.zibby.config.mjs`:
308
+
309
+ ```javascript
310
+ export default {
311
+ agent: {
312
+ cursor: { model: 'auto' },
313
+ // claude: { model: 'sonnet-4.6' },
314
+ },
315
+ };
316
+ ```
317
+
318
+ API keys come from environment variables (`CURSOR_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`).
319
+
320
+ ### Cloud
321
+
322
+ Cloud execution uses your **project settings** (configured in the Zibby dashboard):
323
+
324
+ - **AI Agent** — which agent to use (Cursor, Claude, Codex, Gemini)
325
+ - **Model** — model override
326
+ - **API Key** — stored encrypted, injected into the container at runtime
327
+
328
+ No config files are needed in the cloud — everything is read from project settings.
329
+
330
+ ## Self-Hosting
331
+
332
+ You can run workflows on your own infrastructure without Zibby Cloud. Your server just needs:
333
+
334
+ 1. `@zibby/core` and `@zibby/cli` npm packages
335
+ 2. Environment variables for agent configuration:
336
+
337
+ ```bash
338
+ AGENT_TYPE=cursor # or claude, codex, gemini
339
+ MODEL=auto
340
+ CURSOR_API_KEY=sk-xxx # or ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY
341
+ ```
342
+
343
+ Then trigger the workflow programmatically:
344
+
345
+ ```javascript
346
+ import { WorkflowGraph } from '@zibby/core';
347
+ import { TicketTriageWorkflow } from './.zibby/workflows/ticket-triage/graph.mjs';
348
+
349
+ const agent = new TicketTriageWorkflow();
350
+ const graph = agent.buildGraph();
351
+ const result = await graph.run(agent, { input: { ticket: 'BUG-123' } });
352
+ ```
353
+
354
+ Or use the CLI:
355
+
356
+ ```bash
357
+ zibby start ticket-triage --port 8080
358
+ ```
@@ -0,0 +1,108 @@
1
+ ---
2
+ sidebar_position: 2
3
+ title: Getting Started
4
+ ---
5
+
6
+ # Getting Started
7
+
8
+ Get up and running with Zibby in under 5 minutes.
9
+
10
+ ## Prerequisites
11
+
12
+ - Node.js 18 or later
13
+ - [Cursor](https://cursor.com) IDE installed (for `--agent cursor`), **or** an Anthropic API key (for `--agent claude`), **or** OpenAI API key + Codex CLI (for `--agent codex`)
14
+
15
+ ## Option A: Zero Setup (npx)
16
+
17
+ No install needed — run directly:
18
+
19
+ ```bash
20
+ echo "Go to example.com and verify the page title says Example Domain" > test.txt
21
+ npx @zibby/cli run test.txt --agent cursor
22
+ ```
23
+
24
+ ## Option B: Global Install
25
+
26
+ ```bash
27
+ npm install -g @zibby/cli
28
+ ```
29
+
30
+ ### 1. Create a test spec
31
+
32
+ Create a plain-text file with your test instructions:
33
+
34
+ ```text title="test-specs/login.txt"
35
+ 1. Navigate to https://myapp.com/login
36
+ 2. Enter email: test@example.com
37
+ 3. Enter password: TestPass123
38
+ 4. Click the Sign In button
39
+ 5. Verify the dashboard page loads
40
+ 6. Verify the user's name appears in the header
41
+ ```
42
+
43
+ ### 2. Run it
44
+
45
+ ```bash
46
+ zibby test test-specs/login.txt --agent cursor
47
+ ```
48
+
49
+ You'll see:
50
+ - A browser window open
51
+ - The AI agent navigate and interact with your app
52
+ - A generated Playwright script saved to `tests/`
53
+
54
+ ### 3. Run the generated test
55
+
56
+ ```bash
57
+ npx playwright test tests/login.spec.js
58
+ ```
59
+
60
+ ## Customizing Your Setup (Optional)
61
+
62
+ If you want to customize the workflow, config, or nodes:
63
+
64
+ ```bash
65
+ zibby init --agent cursor
66
+ ```
67
+
68
+ This scaffolds:
69
+
70
+ ```
71
+ .zibby.config.js # Project configuration (ESM)
72
+ .zibby/
73
+ ├── graph.js # Workflow definition (customizable)
74
+ ├── nodes/ # Node implementations
75
+ │ ├── execute-live.js
76
+ │ ├── generate-script.js
77
+ │ └── preflight.js
78
+ └── result-handler.js # Post-execution hooks
79
+ ```
80
+
81
+ Without `zibby init`, the CLI uses the built-in default workflow automatically.
82
+
83
+ ## Environment Variables
84
+
85
+ | Variable | When needed |
86
+ |---|---|
87
+ | `CURSOR_API_KEY` | CI/CD with `--agent cursor` (locally uses Cursor IDE credentials) |
88
+ | `ANTHROPIC_API_KEY` | Using `--agent claude` |
89
+ | `OPENAI_API_KEY` | Using `--agent codex` |
90
+ | `ZIBBY_API_KEY` | Cloud sync (`--sync` flag) |
91
+
92
+ For local development, add these to a `.env` file in your project root.
93
+
94
+ ## Cloud Sync (Optional)
95
+
96
+ To upload results to the [Zibby dashboard](https://zibby.app):
97
+
98
+ 1. Create an account at [zibby.app](https://zibby.app)
99
+ 2. Get your API key from **Project Settings**
100
+ 3. Add to `.env`: `ZIBBY_API_KEY=zby_your_key_here`
101
+ 4. Login: `zibby login`
102
+ 5. Run with sync: `zibby test test-specs/login.txt --sync`
103
+
104
+ ## Next Steps
105
+
106
+ - [Installation](/installation) — detailed setup and configuration
107
+ - [Running Tests](/running-tests) — all run modes and options
108
+ - [CLI Reference](/cli-reference) — every command and flag
@@ -0,0 +1,127 @@
1
+ ---
2
+ sidebar_position: 3
3
+ title: Installation
4
+ ---
5
+
6
+ # Installation
7
+
8
+ ## Install the CLI
9
+
10
+ ```bash
11
+ npm install -g @zibby/cli
12
+ ```
13
+
14
+ Verify:
15
+
16
+ ```bash
17
+ zibby --version
18
+ ```
19
+
20
+ Or use without installing:
21
+
22
+ ```bash
23
+ npx @zibby/cli run test.txt --agent cursor
24
+ ```
25
+
26
+ ## Project Setup (Optional)
27
+
28
+ `zibby test` works without any project setup — it uses a built-in workflow. To customize:
29
+
30
+ ```bash
31
+ cd your-project
32
+ zibby init --agent cursor
33
+ ```
34
+
35
+ **Options:**
36
+
37
+ | Flag | Description |
38
+ |---|---|
39
+ | `--agent <type>` | `cursor` or `claude` |
40
+ | `--cloud-sync` | Enable cloud sync and configure API |
41
+ | `--headless` | Run browser in headless mode |
42
+ | `--headed` | Run browser in headed mode (visible) |
43
+ | `--skip-install` | Skip `npm install` |
44
+ | `-f, --force` | Overwrite existing config |
45
+
46
+ This creates:
47
+
48
+ ```
49
+ .zibby.config.js # Project configuration
50
+ .zibby/
51
+ ├── graph.js # Workflow graph (entry point → nodes → END)
52
+ ├── nodes/
53
+ │ ├── preflight.js # Extract title + assertions from spec
54
+ │ ├── execute-live.js # AI drives browser
55
+ │ └── generate-script.js # Generate Playwright script
56
+ └── result-handler.js # Save artifacts after execution
57
+ ```
58
+
59
+ ## Configuration
60
+
61
+ `.zibby.config.js` in your project root (ESM format):
62
+
63
+ ```javascript
64
+ export default {
65
+ agent: {
66
+ cursor: {
67
+ model: 'auto',
68
+ },
69
+ // OR:
70
+ // claude: {
71
+ // model: 'auto',
72
+ // maxTokens: 4096,
73
+ // },
74
+ },
75
+
76
+ paths: {
77
+ specs: 'test-specs',
78
+ generated: 'tests',
79
+ output: '.zibby/output',
80
+ },
81
+
82
+ video: 'on',
83
+ viewport: { width: 1280, height: 720 },
84
+ playwrightArtifacts: true,
85
+ cloudSync: false,
86
+ };
87
+ ```
88
+
89
+ ## Environment Setup
90
+
91
+ Copy the generated `.env.example` to `.env` and add your keys:
92
+
93
+ ```bash
94
+ cp .env.example .env
95
+ ```
96
+
97
+ Then edit `.env` with your values:
98
+
99
+ ```bash
100
+ # For Cursor agent in CI/CD
101
+ CURSOR_API_KEY=your-cursor-api-key
102
+
103
+ # For Claude agent
104
+ ANTHROPIC_API_KEY=sk-ant-...
105
+
106
+ # For cloud sync (optional)
107
+ ZIBBY_API_KEY=zby_your_api_key_here
108
+ ```
109
+
110
+ ## Playwright Setup
111
+
112
+ Zibby uses Playwright for browser automation. If you don't have it:
113
+
114
+ ```bash
115
+ zibby setup-playwright
116
+ ```
117
+
118
+ This configures the Playwright MCP server for Zibby.
119
+
120
+ ## Verify Setup
121
+
122
+ ```bash
123
+ echo "Go to example.com and verify the page title" > test.txt
124
+ zibby test test.txt --agent cursor
125
+ ```
126
+
127
+ You should see a browser open, the AI navigate to example.com, and a Playwright script generated in `tests/`.
@@ -0,0 +1,73 @@
1
+ ---
2
+ sidebar_position: 1
3
+ title: GitHub Integration
4
+ ---
5
+
6
+ # GitHub Integration
7
+
8
+ Connect your GitHub repositories so Zibby can analyze your codebase and create pull requests from AI-generated code.
9
+
10
+ ## How It Works
11
+
12
+ Zibby uses a **GitHub App** to access your repositories. The app requests read access to your code and write access to create pull requests.
13
+
14
+ When you run an analysis, Zibby:
15
+
16
+ 1. Clones the repository into a secure container
17
+ 2. Analyzes the codebase alongside the Jira ticket
18
+ 3. Generates code changes as a diff
19
+ 4. Optionally creates a pull request with the suggested changes
20
+
21
+ ## Connect GitHub
22
+
23
+ 1. Go to your project's **Settings** page in the Zibby dashboard
24
+ 2. Under **Integrations**, click **Connect GitHub**
25
+ 3. You'll be redirected to GitHub to install the Zibby App
26
+ 4. Select the repositories you want to grant access to
27
+ 5. Click **Install & Authorize**
28
+ 6. You'll be redirected back to Zibby
29
+
30
+ ## Permissions
31
+
32
+ The Zibby GitHub App requests:
33
+
34
+ | Permission | Level | Purpose |
35
+ |---|---|---|
36
+ | Repository contents | Read | Clone and analyze your code |
37
+ | Pull requests | Write | Create PRs from generated code |
38
+ | Metadata | Read | List repositories |
39
+
40
+ ## Select Repositories
41
+
42
+ After connecting, go to **Settings > Repositories** to select which repos are available for analysis. You can choose:
43
+
44
+ - **Primary repository** — the main codebase for analysis
45
+ - **Additional repositories** — supporting repos that provide context
46
+
47
+ ## Creating Pull Requests
48
+
49
+ After an analysis generates code changes:
50
+
51
+ 1. Go to the **Analysis** page for the ticket
52
+ 2. Review the code diff in the **Code Changes** tab
53
+ 3. Click **Create Pull Request**
54
+ 4. Zibby creates a PR on your repository with the suggested changes
55
+ 5. Review and merge through your normal GitHub workflow
56
+
57
+ ## Token Management
58
+
59
+ Zibby uses GitHub App installation tokens that automatically refresh. You don't need to manage tokens manually. If you need to reconnect:
60
+
61
+ 1. Go to **Settings > Integrations**
62
+ 2. Click **Disconnect** next to GitHub
63
+ 3. Click **Connect GitHub** to re-authorize
64
+
65
+ ## Troubleshooting
66
+
67
+ **"Repository not found" during analysis**
68
+
69
+ Make sure the repository is selected in your project settings and the GitHub App has access to it.
70
+
71
+ **"Permission denied" when creating PR**
72
+
73
+ Verify the GitHub App installation has write access to pull requests for the target repository.