@zibby/cli 0.4.16 → 0.4.17

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 (38) hide show
  1. package/dist/bin/zibby.js +2 -2
  2. package/dist/commands/init.js +64 -64
  3. package/dist/commands/workflows/generate.js +108 -108
  4. package/dist/commands/workflows/schedule.js +10 -0
  5. package/dist/package.json +4 -2
  6. package/dist/templates/.claude/CLAUDE.md +425 -0
  7. package/dist/templates/.claude/commands/add-node.md +63 -0
  8. package/dist/templates/.claude/commands/add-skill.md +83 -0
  9. package/dist/templates/.claude/commands/new-workflow.md +61 -0
  10. package/dist/templates/.claude/commands/validate-workflow.md +67 -0
  11. package/package.json +4 -2
  12. package/templates/.claude/CLAUDE.md +425 -0
  13. package/templates/.claude/commands/add-node.md +63 -0
  14. package/templates/.claude/commands/add-skill.md +83 -0
  15. package/templates/.claude/commands/new-workflow.md +61 -0
  16. package/templates/.claude/commands/validate-workflow.md +67 -0
  17. package/templates/zibby-workflow-claude/agents-md-block.md +173 -0
  18. package/templates/zibby-workflow-claude/claude/agents/zibby-test-author.md +87 -0
  19. package/templates/zibby-workflow-claude/claude/agents/zibby-workflow-builder.md +101 -0
  20. package/templates/zibby-workflow-claude/claude/commands/zibby-add-node.md +75 -0
  21. package/templates/zibby-workflow-claude/claude/commands/zibby-debug.md +67 -0
  22. package/templates/zibby-workflow-claude/claude/commands/zibby-delete.md +37 -0
  23. package/templates/zibby-workflow-claude/claude/commands/zibby-deploy.md +87 -0
  24. package/templates/zibby-workflow-claude/claude/commands/zibby-list.md +30 -0
  25. package/templates/zibby-workflow-claude/claude/commands/zibby-memory-cost.md +39 -0
  26. package/templates/zibby-workflow-claude/claude/commands/zibby-memory-pull.md +47 -0
  27. package/templates/zibby-workflow-claude/claude/commands/zibby-memory-remote-use-hosted.md +61 -0
  28. package/templates/zibby-workflow-claude/claude/commands/zibby-memory-stats.md +38 -0
  29. package/templates/zibby-workflow-claude/claude/commands/zibby-static-ip.md +70 -0
  30. package/templates/zibby-workflow-claude/claude/commands/zibby-tail.md +53 -0
  31. package/templates/zibby-workflow-claude/claude/commands/zibby-test-debug.md +59 -0
  32. package/templates/zibby-workflow-claude/claude/commands/zibby-test-generate.md +39 -0
  33. package/templates/zibby-workflow-claude/claude/commands/zibby-test-run.md +49 -0
  34. package/templates/zibby-workflow-claude/claude/commands/zibby-test-write.md +46 -0
  35. package/templates/zibby-workflow-claude/claude/commands/zibby-trigger.md +56 -0
  36. package/templates/zibby-workflow-claude/claude/settings.json +10 -0
  37. package/templates/zibby-workflow-claude/cursor/rules/zibby-workflows.mdc +119 -0
  38. package/templates/zibby-workflow-claude/manifest.json +47 -0
@@ -0,0 +1,49 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-test-run — execute a Zibby test spec
3
+
4
+ You are helping the user run an existing test spec through Zibby. A spec is a `.txt` file describing what to test in plain language; Zibby's runner turns it into a Playwright execution and produces a video + JSON results.
5
+
6
+ Canonical docs: **https://docs.zibby.app/tests/running**
7
+
8
+ ## Steps
9
+
10
+ 1. **Identify the spec.** Most projects keep specs under `test-specs/` (configurable in `.zibby.config.mjs` `paths.specs`). If user named one, use it. Otherwise list what's there and ask:
11
+ ```
12
+ ls test-specs/
13
+ ```
14
+
15
+ 2. **Run it.** From the project root:
16
+ ```
17
+ Bash(zibby test test-specs/<name>.txt)
18
+ ```
19
+ For a quick inline test without writing a spec file:
20
+ ```
21
+ Bash(zibby test "go to example.com and check that the title contains Example")
22
+ ```
23
+
24
+ 3. **Output to expect.** Zibby streams the run live — agent thinking, browser actions, assertion results, final pass/fail. Generated `.spec.js` lands in `tests/<name>.spec.js` (configurable via `paths.generated`). Video + traces under `test-results/`.
25
+
26
+ 4. **If running headless / CI:**
27
+ ```
28
+ Bash(zibby test test-specs/<name>.txt --headless)
29
+ ```
30
+
31
+ 5. **If running a specific node only** (advanced — re-execute one phase of a prior session):
32
+ ```
33
+ Bash(zibby test --node execute_live --session last)
34
+ ```
35
+
36
+ ## Useful flags
37
+
38
+ - `--agent claude|cursor|codex|gemini` — override the configured agent for this run
39
+ - `--workflow QuickSmokeWorkflow` — use a non-default workflow for the run
40
+ - `--verbose` / `--debug` — escalate log levels
41
+ - `-m, --mem` — enable test memory (Dolt-backed knowledge from prior runs)
42
+ - `--sync` / `--no-sync` — force / skip cloud upload regardless of config
43
+ - `--sources <ids> --execution <id>` — run cloud-stored test cases from a specific execution (comma-separated IDs)
44
+
45
+ ## Common failure modes
46
+
47
+ - **"No spec found"** — path is relative to project root, not cwd. Check `paths.specs` in `.zibby.config.mjs`.
48
+ - **"Browser crashed"** — usually the playwright browser cache is stale. Drop `--headless` once (default is headed) so you can see what's happening, then re-add `--headless` once it's healthy.
49
+ - **MCP errors during `execute_live`** — the agent's MCP tool config may need refreshing. See `/zibby-test-debug`.
@@ -0,0 +1,46 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-test-write — author a new Zibby test spec
3
+
4
+ You are helping the user write a new test spec. Specs are plain-language `.txt` files in `test-specs/` (configurable via `.zibby.config.mjs` `paths.specs`). Zibby's runner converts them to Playwright at execution time.
5
+
6
+ Canonical docs: **https://docs.zibby.app/tests/specs**
7
+
8
+ ## Spec format (informal but conventional)
9
+
10
+ A spec is mostly imperative English with one action per line. Common shape:
11
+
12
+ ```
13
+ Title: <one-line summary>
14
+
15
+ Setup:
16
+ - Open <url>
17
+ - Log in as <user>
18
+
19
+ Steps:
20
+ - Click <element>
21
+ - Type <value> into <field>
22
+ - Wait for <state>
23
+
24
+ Verify:
25
+ - <assertion>
26
+ - <assertion>
27
+ ```
28
+
29
+ Zibby tolerates loose phrasing — what matters is being unambiguous about WHICH element and WHAT value. Use stable selectors (visible text, ARIA labels) over CSS class names.
30
+
31
+ ## Steps for this command
32
+
33
+ 1. **Ask the user what they want to test.** What's the user flow? What are they verifying? What URL?
34
+ 2. **Find a similar existing spec to mirror.** `ls test-specs/` and read 1-2 to match the project's conventions.
35
+ 3. **Write the spec to `test-specs/<kebab-case-name>.txt`** using `Write` tool.
36
+ 4. **Offer to run it immediately** with `/zibby-test-run` (or just `Bash(zibby test test-specs/<name>.txt)`).
37
+
38
+ ## Naming conventions
39
+
40
+ - kebab-case: `login-with-sso.txt`, `cart-checkout-happy-path.txt`
41
+ - Group by feature: `users-create.txt`, `users-edit.txt`, `users-delete.txt`
42
+ - Avoid ambiguous names like `test1.txt`
43
+
44
+ ## When the spec is complex
45
+
46
+ For multi-page flows or many assertions, split into multiple specs and run them as a collection. Don't pile everything into one spec — Playwright errors are easier to localize when each spec is one user goal.
@@ -0,0 +1,56 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-trigger — run a deployed Zibby workflow
3
+
4
+ You are helping the user trigger a deployed workflow execution.
5
+
6
+ A trigger creates a new ECS Fargate task that loads the workflow's bundle, runs the graph, and writes status + logs as it goes.
7
+
8
+ Canonical docs: **https://docs.zibby.app/cloud/triggering**
9
+
10
+ ## Steps
11
+
12
+ 1. **Get the workflow UUID.** The user should provide it; if not, run `zibby workflow list` to discover it. UUIDs are stable across deploys (the same workflow always has the same UUID; only the bundle version changes).
13
+
14
+ 2. **Construct the input.** Workflows take a JSON input that nodes can read via `ctx.input`. Ask the user what input the workflow expects (or read `workflow.json`'s `inputSchema` if present).
15
+
16
+ 3. **Run the trigger.** Three ways to pass input — they merge with this **precedence (highest → lowest)**:
17
+ 1. `-p key=value` (repeatable) — wins over everything; great for shell-friendly tweaks on top of a base payload
18
+ 2. `--input '<json>'` — full JSON payload as a string
19
+ 3. `--input-file path.json` — full JSON/YAML payload from a file (lowest precedence; `-p` and `--input` override individual keys)
20
+
21
+ ```
22
+ zibby workflow trigger <uuid> --input '{"key":"value"}'
23
+ zibby workflow trigger <uuid> -p ticket=ENG-1234 -p priority=high
24
+ zibby workflow trigger <uuid> --input-file payload.json -p priority=urgent # mix
25
+ ```
26
+
27
+ Same flag surface as `zibby workflow run` (local) — flip the verb and the same call shape goes from local to remote.
28
+
29
+ 4. **Tail the logs immediately:**
30
+ ```
31
+ zibby workflow logs <uuid> -t
32
+ ```
33
+ This streams live output. The tail auto-attaches to all currently-running executions of the workflow (docker-compose-style), so back-to-back triggers interleave naturally.
34
+
35
+ 5. **Watch for completion.** Workflow runs typically end with one of:
36
+ - `✓ Workflow completed` — success, status `completed`
37
+ - `Error: Node 'X' failed` — a node threw; status `failed`
38
+ - silent timeout — task killed by ECS; status stays `running` then becomes a zombie. Trigger again.
39
+
40
+ ## Idempotency
41
+
42
+ Use `--idempotency-key <key>` to prevent duplicate runs from a retry-prone caller:
43
+ ```
44
+ zibby workflow trigger <uuid> --input '{}' --idempotency-key job-2026-05-04-001
45
+ ```
46
+ Same key + same input within ~24h = same execution returned (no new run).
47
+
48
+ ## Multiple inputs / batch
49
+
50
+ There's no built-in batch trigger — script it from your shell:
51
+ ```
52
+ for ticket in ENG-1 ENG-2 ENG-3; do
53
+ zibby workflow trigger <uuid> -p ticket=$ticket
54
+ done
55
+ zibby workflow logs <uuid> -t # tail will show all 3 interleaved
56
+ ```
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(zibby:*)",
5
+ "Bash(./.zibby/bin/zibby:*)",
6
+ "Bash(npm install:*)",
7
+ "Bash(node:*)"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,119 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ ---
3
+ description: Help the user build, test, and deploy Zibby agent workflows + browser tests
4
+ globs:
5
+ - "**/.zibby/workflows/**"
6
+ - ".zibby.config.mjs"
7
+ - "**/workflow.json"
8
+ - "**/graph.mjs"
9
+ - "test-specs/**"
10
+ - ".zibby/memory/**"
11
+ alwaysApply: false
12
+ ---
13
+
14
+ # Zibby — workflows + tests
15
+
16
+ This project uses **Zibby**. Two surfaces share `.zibby.config.mjs` at the project root.
17
+
18
+ ## Workflows
19
+
20
+ A graph of AI-agent-driven steps that runs inside an ECS Fargate sandbox.
21
+
22
+ ```
23
+ <workflowsBasePath>/<workflow-name>/
24
+ ├── workflow.json # name, entryClass, triggers, schemas (manifest)
25
+ ├── graph.mjs # exports the graph (nodes + edges)
26
+ ├── nodes/ # one .mjs file per node, plus index.mjs barrel
27
+ └── package.json # deps bundled at deploy time
28
+ ```
29
+
30
+ Each node exports `{ id, description, async run(ctx) }`. `ctx` provides `input`, `agent({prompt, schema})`, `shell(cmd)`, `log(...)`.
31
+
32
+ ### Common dev loop
33
+
34
+ ```
35
+ zibby workflow new <name> # scaffold
36
+ zibby workflow run <name> # one-shot local run (preferred for the dev loop)
37
+ zibby workflow deploy <name> # build + push to cloud
38
+ zibby workflow trigger <uuid> # invoke the cloud workflow
39
+ zibby workflow logs <uuid> -t # tail live logs (docker-compose-style for concurrent runs)
40
+ zibby workflow list # local + cloud
41
+ zibby workflow download <uuid> # pull cloud source back to .zibby/workflows/
42
+ zibby workflow delete <uuid> # remove a deployed workflow
43
+ ```
44
+
45
+ `run` (one-shot) vs `start` (long-lived dev server, port 3848 — Studio integration). For plain CLI iteration always use `run`.
46
+
47
+ `run` and `trigger` accept the same input flags: `-p key=value` (highest precedence, repeatable), `--input '<json>'`, `--input-file path.json` (lowest precedence).
48
+
49
+ ### Adding a new node
50
+
51
+ 1. Create `<workflow>/nodes/<name>.mjs` (mirror existing `example.mjs` pattern)
52
+ 2. Register in `<workflow>/nodes/index.mjs`
53
+ 3. Wire into `<workflow>/graph.mjs` (add to `nodes` array and connect via edges)
54
+ 4. `zibby workflow run <name>` to test locally; `zibby workflow deploy` to push
55
+
56
+ ### Per-workflow env vars
57
+
58
+ Each deployed workflow has its own encrypted env-var bag (KMS-backed); workflow env wins over project secrets on conflict.
59
+
60
+ ```
61
+ zibby workflow env list <uuid> # show key names (values never returned)
62
+ zibby workflow env set <uuid> ANTHROPIC_API_KEY=sk-… # add or rotate one
63
+ zibby workflow env unset <uuid> OLD_KEY # remove one
64
+ zibby workflow env push <uuid> --file .env [--file .env.prod] # bulk replace
65
+ ```
66
+
67
+ Fast path on first deploy: `zibby workflow deploy my-pipeline --env .env` deploys, then auto-pushes the .env into the new UUID.
68
+
69
+ ## Tests (`zibby test`)
70
+
71
+ Plain-language `.txt` specs at `test-specs/`. The runner drives a real browser via MCP, generates Playwright, produces a video.
72
+
73
+ ```
74
+ zibby test test-specs/<name>.txt # run a spec
75
+ zibby test "go to example.com and ..." # inline, no file
76
+ zibby test <spec> --agent claude # override agent (claude|cursor|codex|gemini)
77
+ zibby test --sources <ids> --execution <id> # cloud test cases
78
+ ```
79
+
80
+ When debugging, `test-results/<spec>/video.webm` usually tells you what went wrong faster than logs.
81
+
82
+ ### Test memory (`.zibby/memory/.dolt/`)
83
+
84
+ Local-first Dolt SQL DB that learns selectors, page model, navigation, history from every run. Keyed **per-domain** (cross-spec). Auto-pulls before runs, auto-pushes after passing runs.
85
+
86
+ When `zibby test` runs and `.dolt/` exists, the agent gets 5 MCP tools auto-exposed:
87
+ - `memory_get_test_history` — recent runs (filter by spec-path substring)
88
+ - `memory_get_selectors` — known selectors per page with stability metrics
89
+ - `memory_get_page_model` — page elements, roles, accessible names
90
+ - `memory_get_navigation` — page-to-page transitions
91
+ - `memory_save_insight` — save observations (`selector_tip | timing | navigation | workaround | flaky | general`)
92
+
93
+ **After completing a test, the agent MUST call `memory_save_insight` at least once** — record reliable selectors, timing quirks, workarounds.
94
+
95
+ Local CLI: `zibby memory stats | cost | compact | reset`.
96
+
97
+ Team sync (BYO or hosted):
98
+ ```
99
+ zibby memory remote add aws://my-bucket/team/proj/main # BYO (S3 / GCS / DoltHub / file:///)
100
+ zibby memory remote use --hosted # OR: Zibby-managed S3 (signed-in only)
101
+ ```
102
+ Set `memorySync.remote` in `.zibby.config.mjs` (`'hosted'` or `'aws://...'`) so teammates running `zibby init` plug into the same memory automatically.
103
+
104
+ ## Reference
105
+
106
+ Canonical, evolving docs: **https://docs.zibby.app/workflows**
107
+
108
+ Topics:
109
+ - Node SDK (ctx.agent / ctx.shell / ctx.log): https://docs.zibby.app/workflows/sdk
110
+ - Deploying & bundling: https://docs.zibby.app/workflows/deploying
111
+ - Triggering & inputs: https://docs.zibby.app/workflows/triggers
112
+ - Per-workflow env vars: https://docs.zibby.app/cloud/env-vars
113
+ - Live log streaming: https://docs.zibby.app/workflows/logs
114
+ - Egress proxy / static IPs: https://docs.zibby.app/workflows/egress
115
+ - Security & secrets: https://docs.zibby.app/workflows/security
116
+ - Test memory: https://docs.zibby.app/tests/memory
117
+ - Tests — running: https://docs.zibby.app/tests/running
118
+
119
+ Prefer the docs URL for anything you're unsure about — they're updated more frequently than these rules.
@@ -0,0 +1,47 @@
1
+ {
2
+ "templateVersion": 4,
3
+ "description": "Canonical agent helpers for Zibby workflows. Each shipped file carries '<!-- zibby-template-version: N -->' for idempotent upgrades. Bumped on breaking content changes.",
4
+ "agents": {
5
+ "claude": {
6
+ "files": [
7
+ ".claude/commands/zibby-add-node.md",
8
+ ".claude/commands/zibby-deploy.md",
9
+ ".claude/commands/zibby-trigger.md",
10
+ ".claude/commands/zibby-tail.md",
11
+ ".claude/commands/zibby-debug.md",
12
+ ".claude/commands/zibby-delete.md",
13
+ ".claude/commands/zibby-list.md",
14
+ ".claude/commands/zibby-static-ip.md",
15
+ ".claude/commands/zibby-test-run.md",
16
+ ".claude/commands/zibby-test-write.md",
17
+ ".claude/commands/zibby-test-generate.md",
18
+ ".claude/commands/zibby-test-debug.md",
19
+ ".claude/commands/zibby-memory-stats.md",
20
+ ".claude/commands/zibby-memory-cost.md",
21
+ ".claude/commands/zibby-memory-pull.md",
22
+ ".claude/commands/zibby-memory-remote-use-hosted.md",
23
+ ".claude/agents/zibby-workflow-builder.md",
24
+ ".claude/agents/zibby-test-author.md"
25
+ ],
26
+ "writeOnceFiles": [
27
+ ".claude/settings.json"
28
+ ],
29
+ "rootBlock": {
30
+ "target": "CLAUDE.md",
31
+ "source": "agents-md-block.md"
32
+ }
33
+ },
34
+ "cursor": {
35
+ "files": [
36
+ ".cursor/rules/zibby-workflows.mdc"
37
+ ]
38
+ },
39
+ "codex": {
40
+ "files": [],
41
+ "rootBlock": {
42
+ "target": "AGENTS.md",
43
+ "source": "agents-md-block.md"
44
+ }
45
+ }
46
+ }
47
+ }