@zibby/cli 0.5.8 → 0.6.0

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 (82) hide show
  1. package/dist/bin/zibby.js +3 -3
  2. package/dist/commands/app-run.js +19 -0
  3. package/dist/commands/app-solo.js +19 -0
  4. package/dist/commands/app.js +22 -20
  5. package/dist/commands/init.js +100 -95
  6. package/dist/commands/workflows/generate.js +156 -151
  7. package/dist/config/soloTiers.js +1 -0
  8. package/dist/config/warmPool.js +1 -0
  9. package/dist/lib/api-client.js +17 -0
  10. package/dist/lib/find-app-link.js +2 -0
  11. package/dist/lib/framework-commands.js +1 -0
  12. package/dist/package.json +2 -2
  13. package/dist/templates/.claude/CLAUDE.md +318 -10
  14. package/dist/templates/.claude/agents/zibby-test-author.md +87 -0
  15. package/dist/templates/.claude/agents/zibby-workflow-builder.md +101 -0
  16. package/dist/templates/.claude/commands/{add-node.md → zibby-add-node.md} +1 -1
  17. package/dist/templates/.claude/commands/{add-skill.md → zibby-add-skill.md} +1 -1
  18. package/dist/templates/.claude/commands/zibby-app-destroy.md +60 -0
  19. package/dist/templates/.claude/commands/zibby-app-list.md +80 -0
  20. package/dist/templates/.claude/commands/zibby-app-logs.md +60 -0
  21. package/dist/templates/.claude/commands/zibby-app-status.md +53 -0
  22. package/dist/templates/.claude/commands/zibby-app-upgrade.md +67 -0
  23. package/dist/templates/.claude/commands/zibby-debug.md +67 -0
  24. package/dist/templates/.claude/commands/zibby-delete.md +37 -0
  25. package/dist/templates/.claude/commands/zibby-deploy-app.md +92 -0
  26. package/dist/templates/.claude/commands/zibby-deploy.md +87 -0
  27. package/dist/templates/.claude/commands/zibby-list.md +30 -0
  28. package/dist/templates/.claude/commands/zibby-login.md +68 -0
  29. package/dist/templates/.claude/commands/zibby-mcp-install.md +93 -0
  30. package/dist/templates/.claude/commands/zibby-memory-cost.md +39 -0
  31. package/dist/templates/.claude/commands/zibby-memory-pull.md +47 -0
  32. package/dist/templates/.claude/commands/zibby-memory-remote-use-hosted.md +61 -0
  33. package/dist/templates/.claude/commands/zibby-memory-stats.md +38 -0
  34. package/{templates/.claude/commands/new-workflow.md → dist/templates/.claude/commands/zibby-new-workflow.md} +1 -1
  35. package/dist/templates/.claude/commands/zibby-set-auth.md +85 -0
  36. package/dist/templates/.claude/commands/zibby-static-ip.md +70 -0
  37. package/dist/templates/.claude/commands/zibby-status.md +54 -0
  38. package/dist/templates/.claude/commands/zibby-tail.md +53 -0
  39. package/dist/templates/.claude/commands/zibby-test-debug.md +59 -0
  40. package/dist/templates/.claude/commands/zibby-test-generate.md +39 -0
  41. package/dist/templates/.claude/commands/zibby-test-run.md +49 -0
  42. package/dist/templates/.claude/commands/zibby-test-write.md +46 -0
  43. package/dist/templates/.claude/commands/zibby-trigger.md +56 -0
  44. package/{templates/.claude/commands/validate-workflow.md → dist/templates/.claude/commands/zibby-validate-workflow.md} +1 -1
  45. package/dist/templates/.cursor/rules/zibby.mdc +127 -0
  46. package/dist/templates/AGENTS.md +248 -0
  47. package/dist/utils/managed-block.js +6 -0
  48. package/package.json +2 -2
  49. package/templates/.claude/CLAUDE.md +318 -10
  50. package/templates/.claude/agents/zibby-test-author.md +87 -0
  51. package/templates/.claude/agents/zibby-workflow-builder.md +101 -0
  52. package/templates/.claude/commands/{add-node.md → zibby-add-node.md} +1 -1
  53. package/templates/.claude/commands/{add-skill.md → zibby-add-skill.md} +1 -1
  54. package/templates/.claude/commands/zibby-app-destroy.md +60 -0
  55. package/templates/.claude/commands/zibby-app-list.md +80 -0
  56. package/templates/.claude/commands/zibby-app-logs.md +60 -0
  57. package/templates/.claude/commands/zibby-app-status.md +53 -0
  58. package/templates/.claude/commands/zibby-app-upgrade.md +67 -0
  59. package/templates/.claude/commands/zibby-debug.md +67 -0
  60. package/templates/.claude/commands/zibby-delete.md +37 -0
  61. package/templates/.claude/commands/zibby-deploy-app.md +92 -0
  62. package/templates/.claude/commands/zibby-deploy.md +87 -0
  63. package/templates/.claude/commands/zibby-list.md +30 -0
  64. package/templates/.claude/commands/zibby-login.md +68 -0
  65. package/templates/.claude/commands/zibby-mcp-install.md +93 -0
  66. package/templates/.claude/commands/zibby-memory-cost.md +39 -0
  67. package/templates/.claude/commands/zibby-memory-pull.md +47 -0
  68. package/templates/.claude/commands/zibby-memory-remote-use-hosted.md +61 -0
  69. package/templates/.claude/commands/zibby-memory-stats.md +38 -0
  70. package/{dist/templates/.claude/commands/new-workflow.md → templates/.claude/commands/zibby-new-workflow.md} +1 -1
  71. package/templates/.claude/commands/zibby-set-auth.md +85 -0
  72. package/templates/.claude/commands/zibby-static-ip.md +70 -0
  73. package/templates/.claude/commands/zibby-status.md +54 -0
  74. package/templates/.claude/commands/zibby-tail.md +53 -0
  75. package/templates/.claude/commands/zibby-test-debug.md +59 -0
  76. package/templates/.claude/commands/zibby-test-generate.md +39 -0
  77. package/templates/.claude/commands/zibby-test-run.md +49 -0
  78. package/templates/.claude/commands/zibby-test-write.md +46 -0
  79. package/templates/.claude/commands/zibby-trigger.md +56 -0
  80. package/{dist/templates/.claude/commands/validate-workflow.md → templates/.claude/commands/zibby-validate-workflow.md} +1 -1
  81. package/templates/.cursor/rules/zibby.mdc +127 -0
  82. package/templates/AGENTS.md +248 -0
@@ -0,0 +1,60 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-app-destroy — permanently remove a Zibby Managed App
3
+
4
+ You are helping the user destroy a hosted app. **This is irreversible.** Always confirm with the user before running.
5
+
6
+ Canonical docs: **https://docs.zibby.app/apps/lifecycle**
7
+
8
+ ## What destroy does
9
+
10
+ `zibby app destroy <instanceId>`:
11
+
12
+ 1. Stops the ECS task (drains in-flight requests for ~30s, then SIGKILL).
13
+ 2. **Deletes the EFS volume** attached to the instance — this is where the app stored its database, config, uploads, anything stateful. **This data is gone.** No backup, no recovery.
14
+ 3. Releases the public URL (cookie-pinned routes invalidate immediately).
15
+ 4. Removes the instance row from DynamoDB. The instanceId is invalid after this.
16
+ 5. Tears down the per-instance Caddy auth sidecar (if any) and the task definition.
17
+
18
+ Billing stops at the destroy timestamp.
19
+
20
+ ## Steps
21
+
22
+ 1. **Identify the instanceId.** If user gave a friendly name:
23
+ ```
24
+ Bash(zibby app list)
25
+ ```
26
+ Verify with the user that the row you're about to destroy is the right one. Show them `name`, `appType`, `url`, `createdAt`.
27
+
28
+ 2. **Spell out the data loss explicitly.** Examples:
29
+ - For an n8n instance: "destroying will delete your workflows, credentials, execution history, and SQLite DB."
30
+ - For wordpress: "destroying will delete the site files, uploads, and MySQL data."
31
+ - For grafana: "destroying will delete your dashboards, data sources config, and SQLite DB."
32
+ - For a goal-mode install: "destroying will delete whatever the agent installed AND the EFS volume holding its state."
33
+
34
+ 3. **Get explicit confirmation.** Don't proceed on a "yeah" — make them name the app:
35
+ > "Type the instance's friendly name to confirm destroy: `<name>`"
36
+
37
+ 4. **Run destroy:**
38
+ ```
39
+ Bash(zibby app destroy <instanceId> --yes)
40
+ ```
41
+ The `--yes` flag skips the CLI's own interactive confirm. Only pass it AFTER you've confirmed with the user yourself.
42
+
43
+ 5. **Verify.** After 30-60s:
44
+ ```
45
+ Bash(zibby app status <instanceId>)
46
+ ```
47
+ Should return 404 (instance gone). If it's stuck in `destroying`, that's a backend cleanup race — let it sit another 60s.
48
+
49
+ ## When NOT to destroy
50
+
51
+ - **Just want to stop billing for the night** → there's no "pause" today (every running app is billed by the minute). Destroy is the only way to stop billing, and it's destructive. Tell the user.
52
+ - **Want to upgrade** → use `/zibby-app-upgrade` instead. Upgrade preserves EFS data.
53
+ - **Want to change auth** → use `/zibby-set-auth` instead.
54
+ - **Want to retry a failed bootstrap** → for goal-mode failures, destroy + redeploy with a different goal is reasonable. For catalog failures, file a bug (catalog should self-heal).
55
+
56
+ ## Common pitfalls
57
+
58
+ - **Race with in-flight requests.** Destroy SIGTERMs the task first; long-running webhooks can be cut off mid-response. Tell the user to drain their callers if they care.
59
+ - **`destroyed` status briefly returns 200 with `status: destroying`** before flipping to 404. Don't panic.
60
+ - **Multi-service instances destroy together** — there's no "destroy just the worker service". The whole instance goes.
@@ -0,0 +1,80 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-app-list — list your running Zibby Managed Apps + browse the catalog
3
+
4
+ You are helping the user see what hosted apps they have deployed (and optionally, what they could deploy).
5
+
6
+ Canonical docs: **https://docs.zibby.app/apps/listing**
7
+
8
+ ## Two surfaces
9
+
10
+ | Surface | Command | Purpose |
11
+ |---|---|---|
12
+ | **Deployed instances** | `zibby app list` | What's running NOW under the user's projects |
13
+ | **Catalog browse** | `zibby app templates` | What's available to deploy (read-only) |
14
+
15
+ ## List deployed instances
16
+
17
+ ```
18
+ Bash(zibby app list) # all instances across all projects
19
+ Bash(zibby app list --project <projectId>) # filter to one project
20
+ Bash(zibby app list --quiet) # JSON output for scripting
21
+ ```
22
+
23
+ Output rows (default human format):
24
+ - `instanceId` — the `app-<short-hex>` ID to use in every other `/zibby-app-*` command
25
+ - `name` — friendly name (from `--name` at deploy time, or auto-generated)
26
+ - `appType` — catalog id (`n8n`, `grafana`, …) OR `goal` for free-form deploys
27
+ - `status` — `running | pending | failed | stopped | upgrading | destroying`
28
+ - `url` — public `https://*.apps.zibby.app` URL
29
+ - `project` — the project the instance lives under
30
+ - `createdAt` — when deployed
31
+
32
+ ## Browse the catalog
33
+
34
+ ```
35
+ Bash(zibby app templates)
36
+ Bash(zibby app templates --quiet) # JSON
37
+ ```
38
+
39
+ Output rows:
40
+ - `id` — what you pass to `zibby app deploy <id>`
41
+ - `name` — human-friendly title
42
+ - `description` — one-line summary
43
+ - `category` — `automation | observability | dev-tools | wikis | …`
44
+ - `architecture` — `arm64 | x86_64 | both`
45
+
46
+ ## Steps
47
+
48
+ 1. **What is the user asking?**
49
+ - "What do I have running?" → `zibby app list`
50
+ - "What can I deploy?" → `zibby app templates`
51
+ - "Show me my n8n" → list, then filter by `appType=n8n` mentally
52
+
53
+ 2. **Pick the right scope.**
54
+ - If they have multiple projects and only want one project's apps, `--project <id>`. Use `/zibby-status` to get current project context.
55
+ - If they want JSON for piping into jq, pass `--quiet`.
56
+
57
+ 3. **Run the command:**
58
+ ```
59
+ Bash(zibby app list)
60
+ ```
61
+
62
+ 4. **Summarize for the user.** Don't just dump every row. Group by status, highlight any `failed` or stuck-`pending` rows that need attention, then list the `running` ones.
63
+
64
+ 5. **Lead them to the next action.**
65
+ - Multiple instances + user wants to interact with one → ask which `instanceId`.
66
+ - User wants to clean up → suggest `/zibby-app-destroy` per row, or batch them.
67
+ - User wants to add another → suggest `/zibby-deploy-app`.
68
+
69
+ ## When the list is empty
70
+
71
+ The user hasn't deployed any apps yet. Don't show an empty table — say so plainly:
72
+ > "You don't have any Managed Apps deployed yet. Run `/zibby-deploy-app` to add one."
73
+
74
+ Optionally show `zibby app templates` so they can see what's available.
75
+
76
+ ## Catalog gotchas
77
+
78
+ - The catalog is **frozen at CLI build time** for offline use. For the live source-of-truth list, run with `--remote` (when implemented) or check https://zibby.dev/apps.
79
+ - Some catalog entries have `architecture: arm64` only — they won't deploy to `--arch x86_64` and vice versa. The CLI 400s if mismatched; surface the error message.
80
+ - Catalog entries marked `goal-mode-only` exist for templates that can't be cleanly catalog'd (n8n historically was here; now it's catalog-promoted). Read the `description` field.
@@ -0,0 +1,60 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-app-logs — tail or fetch logs from a Zibby Managed App
3
+
4
+ You are helping the user see what an app is doing — container stdout/stderr, agent-ops supervisor turns, and (for multi-service entries) per-service streams.
5
+
6
+ Canonical docs: **https://docs.zibby.app/apps/logs**
7
+
8
+ ## Two modes
9
+
10
+ | Mode | Flag | What it does |
11
+ |---|---|---|
12
+ | **Snapshot** | (no `-t`) | Fetch last N lines and exit. Good for "what happened?". |
13
+ | **Tail** | `-t` | Live-follow new lines until Ctrl-C. Good for boot-watching. |
14
+
15
+ ```
16
+ Bash(zibby app logs <instanceId>) # snapshot, default 200 lines
17
+ Bash(zibby app logs <instanceId> --lines 1000) # bigger snapshot, max 5000
18
+ Bash(zibby app logs <instanceId> -t) # live tail
19
+ ```
20
+
21
+ For `-t`, ALWAYS run it in the background. A live tail blocks indefinitely:
22
+ ```
23
+ Bash({ command: "zibby app logs <instanceId> -t", run_in_background: true })
24
+ ```
25
+
26
+ ## Multi-service: --service
27
+
28
+ Some catalog entries (e.g. `wordpress + mysql`, `gas-town` with worker + scheduler) run multiple containers in one task. By default the log stream is the **app's primary service** (whatever the catalog manifest declared as `mainService`). To tail another:
29
+
30
+ ```
31
+ Bash(zibby app logs <instanceId> --service mysql)
32
+ Bash(zibby app logs <instanceId> --service agent-ops) # the supervisor itself
33
+ ```
34
+
35
+ If you don't know what services exist, `Bash(zibby app status <instanceId>)` lists them under `services[]`.
36
+
37
+ ## What you see for each app type
38
+
39
+ - **Catalog deploys** → stdout/stderr of the app's container. E.g. n8n prints `Editor is now accessible via: http://localhost:5678/`.
40
+ - **Goal-mode deploys** → the `agent-ops` supervisor's turns. Each turn shows the prompt, the tool call(s), and the response. This is the install/repair trail.
41
+ - **`--service agent-ops`** (on any app) → the supervised loop's heartbeat: scheduled checks, periodic goal verification, repair attempts.
42
+
43
+ ## Steps
44
+
45
+ 1. **Identify the instanceId** — `Bash(zibby app list)` if user only has the friendly name.
46
+ 2. **Decide snapshot vs tail.** If they're asking "what happened?" → snapshot. If "I just deployed, watch it come up" → tail.
47
+ 3. **Decide which service.** For single-service catalog apps, default. For multi-service or "show me the supervisor", pass `--service`.
48
+ 4. **Run the command.** For tail, background it; for snapshot, foreground is fine.
49
+ 5. **Surface the meaningful part to the user.** Don't dump 200 lines — find the error / the success marker / the agent-ops decision, paraphrase it.
50
+
51
+ ## Watch for
52
+
53
+ - **`--service` value typos** → 400 with the list of valid service names. Read that list back to the user.
54
+ - **No log stream yet** → if the task hasn't started, there's nothing to tail. Status will say `pending`. Wait 30s and retry.
55
+ - **Goal-mode tail looks frozen** → agent turns can each take 30-90s. If you've been quiet for 2 min, the task is likely stuck mid-tool-call. Check `/zibby-app-status` for `lastSupervisorRun` timestamp.
56
+ - **Lines flag clamping** — `--lines` is clamped to 1..5000. Don't bother passing 100000; you'll get 5000.
57
+
58
+ ## Stop tailing
59
+
60
+ Kill the backgrounded Bash task. The CLI exits cleanly. The app keeps running.
@@ -0,0 +1,53 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-app-status — show a Zibby Managed App's current state
3
+
4
+ You are helping the user check the live status of one of their hosted apps.
5
+
6
+ Canonical docs: **https://docs.zibby.app/apps/lifecycle**
7
+
8
+ ## What status returns
9
+
10
+ `zibby app status <instanceId>` hits the AppsFleet REST API and prints:
11
+
12
+ - **status** — `pending | running | failed | stopped | upgrading | destroying`
13
+ - **url** — public `https://*.apps.zibby.app` URL (always assigned, may 502 until task is running)
14
+ - **architecture** — `arm64` or `x86_64`
15
+ - **provider / model** — for goal-mode deploys, which agent drove the bootstrap
16
+ - **lastSupervisorRun** — timestamp of the most recent agent-ops health check (goal-mode + supervised installs)
17
+ - **authType** — `basic | token | none` if a Caddy auth sidecar is enabled
18
+ - **task health** — last 3 task transitions (start / restart / oom)
19
+
20
+ ## Steps
21
+
22
+ 1. **Get the instanceId.** If user gave a friendly name (not an id starting with `app-`), look it up:
23
+ ```
24
+ Bash(zibby app list)
25
+ ```
26
+ Find the matching `name` and grab the `instanceId`.
27
+
28
+ 2. **Run status:**
29
+ ```
30
+ Bash(zibby app status <instanceId>)
31
+ ```
32
+
33
+ 3. **Interpret the result for the user.** Don't just dump the JSON — read it:
34
+ - `running` + URL responds → "It's healthy. Open <url>."
35
+ - `pending` for <5 min → "Still booting, ~3 min cold start is normal."
36
+ - `pending` for >10 min → likely stuck. Suggest `/zibby-app-logs` to see why.
37
+ - `failed` → fetch the failure reason field, summarize. Suggest `/zibby-app-logs` for the supervisor's last turn.
38
+ - `stopped` → the app was destroyed or scaled to 0. Suggest `/zibby-app-restart` to bring it back.
39
+
40
+ ## When to escalate to logs
41
+
42
+ If status alone doesn't explain the symptom (sticky pending, failed without reason), pivot to `/zibby-app-logs` — that surfaces the agent-ops supervisor trail + container stderr.
43
+
44
+ ## Multiple services on one instance
45
+
46
+ Some catalog entries (e.g. `wordpress + mysql`) are multi-service. The top-level status reflects the **whole** instance. Per-service status lives in the response body under `services[]` — surface that if there is more than one. To tail one specific service, see `/zibby-app-logs` `--service` flag.
47
+
48
+ ## Quiet output for scripting
49
+
50
+ `--quiet` flips the command to JSON-only output (no human formatting). Use this when you want to grep / parse:
51
+ ```
52
+ Bash(zibby app status <instanceId> --quiet | jq -r .status)
53
+ ```
@@ -0,0 +1,67 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-app-upgrade — upgrade a Zibby Managed App's agent-ops base image
3
+
4
+ You are helping the user roll an instance to a newer `agent-ops` base image. This bumps the supervisor, not the user-facing app inside.
5
+
6
+ Canonical docs: **https://docs.zibby.app/apps/upgrading**
7
+
8
+ ## What upgrade does
9
+
10
+ `zibby app upgrade <instanceId> [--version vX.Y.Z]`:
11
+
12
+ 1. Switches the ECS task definition to a new `ghcr.io/zibbyhq/agent-ops:<version>` image (or `:latest` if no version is passed).
13
+ 2. Rolling task replacement — same EFS, same URL, ~60s of overlap.
14
+ 3. **EFS data is preserved.** Disk state survives.
15
+ 4. **Caddy auth sidecar config is preserved.** Basic-auth / bearer-token settings carry over.
16
+
17
+ This is **only an upgrade of the agent-ops supervisor**, not of the application running inside. For example, upgrading an `n8n` instance won't pull a newer `n8nio/n8n` image — that's an in-app concern (n8n's own upgrader, or destroy + redeploy).
18
+
19
+ For goal-mode instances, an upgrade gives the supervisor newer tool definitions, bug fixes, model defaults, etc.
20
+
21
+ ## Steps
22
+
23
+ 1. **Identify the instanceId.** `Bash(zibby app list)` if needed.
24
+
25
+ 2. **Check current version:**
26
+ ```
27
+ Bash(zibby app status <instanceId>)
28
+ ```
29
+ Look at `agentOpsVersion` (or the equivalent — it's in the JSON). Compare to the latest tag at https://github.com/ZibbyHQ/agent-ops/releases.
30
+
31
+ 3. **Decide the target.**
32
+ - If user said "upgrade" without specifying → use `--version` of the latest stable tag (don't blindly use `:latest` floating tag; pin it).
33
+ - If user gave a specific version → pass `--version vX.Y.Z`.
34
+
35
+ 4. **Confirm with the user.** Show: current version, target version, what changes (link to the GitHub release notes if you have them).
36
+
37
+ 5. **Run upgrade:**
38
+ ```
39
+ Bash(zibby app upgrade <instanceId> --version vX.Y.Z --yes)
40
+ ```
41
+ `--yes` skips the CLI's interactive confirm. Only pass after explicit user confirmation.
42
+
43
+ 6. **Watch the roll:**
44
+ ```
45
+ Bash({ command: "zibby app logs <instanceId> -t", run_in_background: true })
46
+ ```
47
+ New task should come up within 60s. App should be responsive again on the same URL.
48
+
49
+ 7. **Verify post-upgrade:**
50
+ ```
51
+ Bash(zibby app status <instanceId>)
52
+ ```
53
+ `agentOpsVersion` should reflect the new tag.
54
+
55
+ ## When upgrade is the right tool
56
+
57
+ - "Use the latest agent-ops" → yes.
58
+ - "Pin to a specific version because vN+1 had a regression" → yes, pass `--version vN`.
59
+ - "I want to upgrade n8n itself" → no, that's inside the app. Use n8n's own upgrade flow inside the app, or destroy + redeploy.
60
+ - "Apply security patches to the host OS" → no, the host is managed by AWS Fargate; no user-side OS to patch.
61
+
62
+ ## Common pitfalls
63
+
64
+ - **Floating `:latest` is allowed but discouraged.** Pin a version so a future agent-ops release can't surprise-break the install.
65
+ - **Downgrades work but might break.** If the older version doesn't know about a feature the current task uses (e.g. multi-service config), the task will fail to start. ECS retries → eventually rolls back. Watch logs.
66
+ - **Mid-upgrade restart loops.** If the new image fails to boot, ECS will retry until it succeeds OR you manually run `/zibby-app-upgrade` again to a known-good version. Don't leave it in a crash-loop overnight.
67
+ - **EFS schema migration.** If a version bump changes the on-disk schema (rare, called out in release notes), the upgrade can't safely roll back. Read release notes for breaking changes before upgrading prod instances.
@@ -0,0 +1,67 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-debug — diagnose a failing or stuck Zibby workflow
3
+
4
+ You are helping the user debug a workflow that didn't behave as expected.
5
+
6
+ Canonical docs: **https://docs.zibby.app/workflows/debugging**
7
+
8
+ ## Diagnostic recipe
9
+
10
+ Apply in order. Stop at the first thing that explains the symptom.
11
+
12
+ ### 1. Did the deploy succeed?
13
+
14
+ ```
15
+ zibby workflow list
16
+ ```
17
+ Find the workflow. If `bundleStatus` isn't `ready`, the deploy didn't finish. Re-run `zibby workflow deploy <name> --verbose` and read the CodeBuild output.
18
+
19
+ ### 2. Did the trigger reach ECS?
20
+
21
+ ```
22
+ zibby workflow trigger <uuid>
23
+ ```
24
+ Look at the response — it should include a `Job ID` immediately. If you get an HTTP error, it's an auth or quota problem (CodeBuild concurrency, ECS task limit, etc.). Surface to the user.
25
+
26
+ ### 3. Did the agent task START?
27
+
28
+ ```
29
+ zibby workflow logs <uuid> -t
30
+ ```
31
+ Within 30s of the trigger you should see `[setup] Fetching bundle...` then `zibby v<version>`. If silence past 30s:
32
+ - Maybe ECS couldn't pull the image — check CloudWatch alarm `zibby-sse-fanout-no-task-prod`
33
+ - Maybe the task started but its log stream is delayed — wait another 30s
34
+ - Maybe the workflow row hasn't been written yet (rare — would only affect the very first second)
35
+
36
+ ### 4. Did the workflow execute the wrong path?
37
+
38
+ If the tail shows nodes running but in unexpected order, your `graph.mjs` edges are wrong. Common causes:
39
+ - Edge from `START` is missing — first node never runs
40
+ - Cycle in the graph — runtime errors with "cycle detected"
41
+ - Node id in `nodes/` array doesn't match the file's exported `id`
42
+
43
+ ### 5. Did a node fail?
44
+
45
+ The tail will show `Error: Node '<name>' failed: <reason>`. Common reasons:
46
+ - Agent (LLM) returned malformed output that didn't match the node's `outputSchema`
47
+ - Node code threw an uncaught exception
48
+ - Shell command in the sandbox returned non-zero
49
+
50
+ For agent errors, look for `│ Prompt sent to LLM:` and `│ Response:` blocks in the tail. The model's reply is right there.
51
+
52
+ ### 6. Did the task die without finishing?
53
+
54
+ Look for `[fanout] hard timeout` in the SSE fan-out logs (sse-fanout container) — means the task ran past the cap. Or the status in DDB stays `running` indefinitely (zombie row). Re-trigger.
55
+
56
+ ### 7. Are you seeing logs from a stale execution?
57
+
58
+ `-t` on a workflow UUID auto-attaches to the **latest** existing execution at connect time, plus new ones triggered while it's open. If you're tailing an old failed run, drain it (Ctrl+C, re-run after triggering fresh).
59
+
60
+ ## Quick reference: what each piece does
61
+
62
+ - **Trigger** → writes a row to `zibby-prod-executions` (DDB) + spawns an ECS task
63
+ - **Task** → pulls bundle from S3, runs `node graph.mjs`, writes logs to CloudWatch, updates DDB status as it progresses
64
+ - **SSE fan-out** → polls CloudWatch, fans events out to subscribers (`-t` clients)
65
+ - **Status** → moves through `starting → running → completed/failed/error`
66
+
67
+ If `status` in DDB is wrong (e.g. stuck `running` after the task is gone), it's an upstream zombie — separate from any workflow logic issue.
@@ -0,0 +1,37 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-delete — delete a deployed Zibby workflow
3
+
4
+ You are helping the user remove a workflow from Zibby Cloud.
5
+
6
+ **This is destructive.** It removes the workflow record, its bundle in S3, and its routing — but does NOT delete in-flight executions or their CloudWatch logs (those age out per their retention policy). New triggers against the deleted UUID will fail.
7
+
8
+ Canonical docs: **https://docs.zibby.app/workflows/lifecycle**
9
+
10
+ ## Steps
11
+
12
+ 1. **Get the UUID.** If user gave a name, look it up:
13
+ ```
14
+ Bash(zibby workflow list)
15
+ ```
16
+ Find the matching `name` and grab its `uuid`.
17
+
18
+ 2. **Confirm with the user.** Always confirm before deleting — show them the workflow's name, project, last-triggered timestamp. Don't proceed silently.
19
+ ```
20
+ "Delete workflow 'pr-summarizer' (uuid abc-123, last run 2 days ago)? This cannot be undone."
21
+ ```
22
+
23
+ 3. **Run the delete:**
24
+ ```
25
+ Bash(zibby workflow delete <uuid>)
26
+ ```
27
+
28
+ 4. **Clean up local files** if the user wants. The local `.zibby/workflows/<name>/` folder isn't auto-deleted — ask before removing:
29
+ ```
30
+ rm -rf .zibby/workflows/<name>
31
+ ```
32
+
33
+ ## When NOT to delete
34
+
35
+ - If the user might want to re-deploy later — keep the local folder, just stop triggering it.
36
+ - If there are running executions — the deploy is gone but those will keep running until they exit. Tell the user to wait or `Ctrl+C`-equivalent (kill the ECS task) if urgent.
37
+ - For a "hide from list" feeling without losing history — there's no soft-delete; it's all-or-nothing.
@@ -0,0 +1,92 @@
1
+ <!-- zibby-template-version: 1 -->
2
+ # /zibby-deploy-app — deploy a hosted app (n8n / grafana / custom goal-mode)
3
+
4
+ You are helping the user deploy a **Zibby Managed App** — a long-running hosted SaaS instance (n8n, Grafana, Outline, whatever) that runs on Zibby's Fargate fleet with an `agent-ops` sidecar.
5
+
6
+ There are two deploy paths. Pick **one** with the user before running anything.
7
+
8
+ | Path | When to use | Command shape |
9
+ |---|---|---|
10
+ | **Catalog** | The user wants a known-good off-the-shelf app | `zibby app deploy <appType>` |
11
+ | **Goal-mode** | The user describes a custom install in natural language | `zibby app deploy --goal "<text>"` |
12
+
13
+ Canonical docs: **https://docs.zibby.app/apps/deploying**
14
+
15
+ ## Decision tree
16
+
17
+ 1. **Ask the user what they want to deploy.** Examples:
18
+ - "I want n8n" → catalog (`n8n` is in the catalog)
19
+ - "I want Outline wiki" → catalog if present, else goal-mode
20
+ - "Install Rails 7 + Postgres from this git repo" → goal-mode
21
+ - "Set up a SonarQube on this VPS" → goal-mode
22
+
23
+ 2. **If catalog**, list available templates first so the user picks an exact id:
24
+ ```
25
+ Bash(zibby app templates)
26
+ ```
27
+ Pick the row's `id` column (e.g. `n8n`, `grafana`, `gas-town`). Use that as the positional arg.
28
+
29
+ 3. **If goal-mode**, get one concise English sentence describing the desired end-state — e.g. `"a running n8n instance with the latest stable image, exposing port 5678"`. Goal-mode is the **LLM bootstrap path**: `agent-ops` reads the goal and runs an autonomous install loop inside the app's Fargate task.
30
+
31
+ ## Pre-flight (both paths)
32
+
33
+ Always confirm with the user:
34
+
35
+ - **Project** — the deploy lives under a project. If they have multiple, run `Bash(zibby list)` to show options. The CLI will prompt interactively if `--project` isn't passed.
36
+ - **Friendly name** — `--name "<text>"` (optional). Defaults to `<appType>-<short-id>`. Useful when running multiple instances of the same template.
37
+ - **Auth on the public URL** — every app gets a `https://*.apps.zibby.app` URL. Anyone with the URL can hit it unless you put auth in front. Ask: "Should this be public, or behind basic-auth / a bearer token?" See `/zibby-set-auth` for the deeper walkthrough. Pass `--auth-type basic|token|none` at deploy time to set it from the start.
38
+
39
+ ## Catalog deploy
40
+
41
+ ```
42
+ Bash(zibby app deploy <appType> --project <id> [--name "..."] [--auth-type basic --auth-user admin --auth-password $(openssl rand -hex 16)])
43
+ ```
44
+
45
+ The catalog path is **deterministic** — no LLM runs to figure out the install; the backend uses a baked task definition. Cold start is ~2-3 minutes (image pull + first boot).
46
+
47
+ ## Goal-mode deploy
48
+
49
+ ```
50
+ Bash(zibby app deploy --goal "<text>" --project <id> \
51
+ [--provider claude|codex] [--model <id>] [--anthropic-token sk-ant-...] \
52
+ [--max-turns 80] [--timeout-min 45] \
53
+ [--auth-type basic --auth-user admin --auth-password $(openssl rand -hex 16)])
54
+ ```
55
+
56
+ Key flags:
57
+
58
+ - `--provider` — `claude` (default) or `codex`. Picks which agent drives the install.
59
+ - `--model` — explicit model id (e.g. `claude-sonnet-4-6`). Defaults to a known-cheap model.
60
+ - `--anthropic-token` — per-deploy Claude credential override. Format: `sk-ant-oat01-...` (OAuth) or `sk-ant-api03-...` (API key). **Sensitive — never echo back.** Defaults to the workspace-stored token configured in Settings.
61
+ - `--max-turns` — caps the agent's tool-call budget. Range 1..200. Heavy installs (n8n, OpenHands, anything that npm-installs hundreds of packages) blow past the 25 default — bump to 60-100.
62
+ - `--timeout-min` — caps the bootstrap task's wall-clock. Range 1..120. Heavy installs need 30-45 min.
63
+
64
+ Cold start for goal-mode is **5-30 minutes** depending on what's being installed. Don't be surprised by long-running bootstrap.
65
+
66
+ ## After the deploy call
67
+
68
+ The CLI prints `{ instanceId, url, projectId, status }`. Save the `instanceId` — every other `/zibby-app-*` command takes it.
69
+
70
+ 1. **Tail the supervised loop** while it boots so you (and the user) can see what's happening:
71
+ ```
72
+ Bash({ command: "zibby app logs <instanceId> -t", run_in_background: true })
73
+ ```
74
+ Goal-mode prints each agent turn. Catalog prints the app's stdout.
75
+ 2. **Check status periodically** until `status` reaches `running`:
76
+ ```
77
+ Bash(zibby app status <instanceId>)
78
+ ```
79
+ 3. **Tell the user the URL** (from the deploy output). If they set `--auth-type basic`, also print the credentials (and tell them to save them — auth is rotateable but the initial password isn't recoverable).
80
+
81
+ ## Common failure modes
82
+
83
+ - **402 from billing** → workspace doesn't have an active Apps subscription. Direct to https://zibby.dev/billing.
84
+ - **`--anthropic-token must start with sk-ant-oat01- or sk-ant-api03-`** → user pasted a Claude Code interactive session token; those are IP-bound and don't work in cloud. Tell them to run `claude setup-token` for a long-lived OAuth token, or use an Anthropic API key.
85
+ - **Goal-mode times out at `--timeout-min`** → install was too heavy. Suggest re-running with `--timeout-min 60 --max-turns 120` and a more specific goal.
86
+ - **Status sticks at `pending`** → ECS image pull is slow. Wait another 90s. If still pending, run `/zibby-app-status` and surface the failure reason from the response body.
87
+
88
+ ## Goal-mode safety
89
+
90
+ Goal-mode runs `agent-ops` autonomously inside the app's task. It can `shell` to anything inside the task's filesystem + egress proxy. It CANNOT touch other apps, other accounts, or your local machine — it's sandboxed. But you ARE responsible for what gets installed; license terms of any software the agent picks apply to the user, not Zibby.
91
+
92
+ Ask before goal-mode if the user's request is ambiguous about cost or licensing ("install a database on a real server" → "open-source or commercial? Postgres/MySQL/SQLite?").
@@ -0,0 +1,87 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-deploy — deploy a Zibby workflow to the cloud
3
+
4
+ You are helping the user deploy a workflow they've been building locally.
5
+
6
+ ## What `zibby workflow deploy` does
7
+
8
+ 1. Bundles the workflow's source (graph.mjs + nodes/ + package.json) into a tarball
9
+ 2. Uploads it to S3 via a presigned URL
10
+ 3. Triggers AWS CodeBuild to install deps + bake the bundle
11
+ 4. Updates DynamoDB so future triggers run the new bundle
12
+
13
+ A successful deploy is required before `zibby workflow trigger <uuid>` works against the cloud.
14
+
15
+ Canonical docs: **https://docs.zibby.app/workflows/deploying**
16
+
17
+ ## Steps for this command
18
+
19
+ 1. **Identify the workflow.** If the user passes a name, use it. Otherwise list everything under `paths.workflows` (from `.zibby.config.mjs`) and ask.
20
+
21
+ 2. **Pre-flight checks.** Read the workflow folder and confirm:
22
+ - `graph.mjs` exists and exports a graph
23
+ - `nodes/` has at least one node
24
+ - `workflow.json` is valid (must have `name`, `entryClass`, `triggers`)
25
+ - `package.json` declares all imports used in nodes (run a quick grep to spot missing deps)
26
+
27
+ 3. **Run the deploy:**
28
+ ```
29
+ zibby workflow deploy <workflow-name>
30
+ ```
31
+ This is interactive if `--project` isn't passed. The user picks a project, the CLI handles auth via the saved session token.
32
+
33
+ 4. **Watch the build.** The CLI streams CodeBuild output. If it succeeds, it prints the workflow's UUID. If it fails, the build logs show why — usually a missing dep in `package.json` or a syntax error in a node.
34
+
35
+ 5. **Verify post-deploy:**
36
+ ```
37
+ zibby workflow trigger <uuid> --input '{}'
38
+ zibby workflow logs <uuid> -t
39
+ ```
40
+ Tail logs until the workflow reaches `completed` (or `failed` — diagnose from logs).
41
+
42
+ ## Common failure modes
43
+
44
+ - **Build fails with module-not-found** → node imports a package not in `package.json`. Add it and redeploy.
45
+ - **Build succeeds but trigger fails immediately** → `entryClass` in `workflow.json` doesn't match a class exported by `graph.mjs`.
46
+ - **Workflow runs but a node fails** → tail the live logs and read the error. Most are in the agent's prompt/output handling.
47
+
48
+ ## Optional flags worth knowing
49
+
50
+ `zibby workflow deploy` accepts:
51
+ - `--project <id>` — skip the interactive project picker
52
+ - `--api-key <key>` — use a PAT instead of the session token (for CI)
53
+ - `--env <path>` — sync a `.env` file into per-workflow env vars after deploy. Repeatable; later files override.
54
+ - `--verbose` — print raw CodeBuild output during the build (helpful for debugging build failures)
55
+
56
+ ### Seeding per-workflow env on first deploy
57
+
58
+ If the workflow needs its own `ANTHROPIC_API_KEY`, `DATABASE_URL`, etc., put them in a `.env` and pass `--env`:
59
+
60
+ ```
61
+ zibby workflow deploy <name> --env .env
62
+ zibby workflow deploy <name> --env .env --env .env.prod # later files win
63
+ ```
64
+
65
+ After deploy, manage them surgically with `zibby workflow env set/unset/list/push <uuid>`. See `/zibby-list` to recover the UUID; full guide at https://docs.zibby.app/cloud/env-vars.
66
+
67
+ ## Static outbound IP (dedicated egress)
68
+
69
+ If the user's workflow needs to call APIs that require IP allowlisting (corporate GitHub, GitLab Enterprise, paranoid SaaS firewalls), the workflow needs the **dedicated egress IP** addon. The flag lives on the legacy alias `zibby deploy` (NOT `zibby workflow deploy`):
70
+
71
+ | Flag | What it does |
72
+ |------|-------------|
73
+ | `zibby deploy <name> --dedicated-ip status` | Show current addon state for the account (active / inactive / billing) |
74
+ | `zibby deploy <name> --dedicated-ip enable` | Enable the addon on the account (Pro subscription required, ~$50/mo). One-time per account. |
75
+ | `zibby deploy <name> --dedicated-ip use` | Mark THIS workflow as using the static egress IP (per-workflow opt-in, after `enable`) |
76
+ | `zibby deploy <name> --dedicated-ip unuse` | Stop routing this workflow through the static IP |
77
+ | `zibby deploy <name> --dedicated-ip disable` | Disable the addon for the whole account |
78
+
79
+ Typical first-time flow when the user says "I need a static outbound IP":
80
+ 1. `zibby deploy <name> --dedicated-ip status` — check whether they have it
81
+ 2. If inactive → `zibby deploy <name> --dedicated-ip enable` — enables the account-wide addon (interactive billing prompt; prerequisite Pro subscription)
82
+ 3. `zibby deploy <name> --dedicated-ip use` — opts this specific workflow in
83
+ 4. Regular `zibby workflow deploy <name>` from now on uses the static IP
84
+
85
+ After `--dedicated-ip use`, every node in this workflow gets its outbound HTTP routed through the egress proxy, and `process.env.HTTP_PROXY` / `HTTPS_PROXY` are set in the sandbox automatically. Their static IPs are visible to customers via `https://docs.zibby.app/workflows/egress`.
86
+
87
+ **Don't** run `--dedicated-ip enable` without confirming with the user — it has billing impact ($50/mo addon). Always confirm. See `/zibby-static-ip` for the deeper walkthrough.
@@ -0,0 +1,30 @@
1
+ <!-- zibby-template-version: 4 -->
2
+ # /zibby-list — list workflows (local + cloud) with their UUIDs and statuses
3
+
4
+ You are helping the user see what workflows exist — locally scaffolded and remotely deployed.
5
+
6
+ Canonical docs: **https://docs.zibby.app/cli-reference#workflow-list**
7
+
8
+ ## Steps
9
+
10
+ 1. **Run the list command:**
11
+ ```
12
+ Bash(zibby workflow list)
13
+ ```
14
+ This shows both local (in `.zibby/workflows/`) and remote (deployed to Zibby Cloud) workflows. Each row has: name, UUID, project, last triggered.
15
+
16
+ 2. **Filter on demand.** If the user wants only local or only remote:
17
+ ```
18
+ zibby workflow list --local-only
19
+ zibby workflow list --remote-only --project <id>
20
+ ```
21
+
22
+ ## When you'd use this
23
+
24
+ - User asks "what workflows do I have?" → run it, show the result.
25
+ - You need a UUID to pass into `/zibby-trigger`, `/zibby-tail`, `/zibby-delete` and the user only knows the name → run it, look up the UUID.
26
+ - After a deploy to confirm the bundle landed.
27
+
28
+ ## Output expectations
29
+
30
+ The output is human-readable text (not JSON). If you need to extract a specific UUID programmatically, parse the line for the workflow name. If the user has many workflows, ask which one they want — don't grep blind.