@zibby/cli 0.3.0 → 0.4.1
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.
- package/README.md +117 -16
- package/dist/bin/zibby.js +3 -3
- package/dist/commands/init.js +184 -93
- package/dist/commands/memory.js +41 -23
- package/dist/commands/template.js +4 -4
- package/dist/commands/uninstall.js +15 -14
- package/dist/commands/workflows/agent-helpers.js +7 -7
- package/dist/commands/workflows/cloud-creds-check.js +2 -0
- package/dist/commands/workflows/deploy.js +47 -46
- package/dist/commands/workflows/generate.js +60 -37
- package/dist/commands/workflows/run-local.js +10 -10
- package/dist/commands/workflows/run.js +5 -5
- package/dist/commands/workflows/start.js +6 -6
- package/dist/package.json +4 -4
- package/dist/templates/zibby-workflow-claude/agents-md-block.md +65 -5
- package/dist/templates/zibby-workflow-claude/claude/agents/zibby-test-author.md +16 -1
- package/dist/templates/zibby-workflow-claude/claude/agents/zibby-workflow-builder.md +22 -2
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-add-node.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-debug.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-delete.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-deploy.md +24 -14
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-list.md +2 -2
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-memory-cost.md +39 -0
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-memory-pull.md +47 -0
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-memory-remote-use-hosted.md +61 -0
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-memory-stats.md +38 -0
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-static-ip.md +8 -6
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-tail.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-test-debug.md +2 -2
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-test-generate.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-test-run.md +3 -2
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-test-write.md +1 -1
- package/dist/templates/zibby-workflow-claude/claude/commands/zibby-trigger.md +10 -6
- package/dist/templates/zibby-workflow-claude/cursor/rules/zibby-workflows.mdc +76 -13
- package/dist/templates/zibby-workflow-claude/manifest.json +5 -1
- package/dist/utils/apply-memory-sync-config.js +1 -0
- package/dist/utils/hosted-memory-sync.js +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,7 +15,45 @@ zibby --version
|
|
|
15
15
|
npx @zibby/cli workflow new my-pipeline
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Requires Node.js ≥ 18.
|
|
18
|
+
Requires Node.js ≥ 18. For UI-test memory features (selector cache, team sync), also install [Dolt](https://www.dolthub.com/) (`brew install dolt`).
|
|
19
|
+
|
|
20
|
+
## All commands — cheat sheet
|
|
21
|
+
|
|
22
|
+
| Group | Command | What it does |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| **Setup** | `zibby init` | Bootstrap a project (config + credentials only — pass `-t` for a workflow) |
|
|
25
|
+
| | `zibby init -t <template>` | Same, plus scaffold a workflow template into `.zibby/` |
|
|
26
|
+
| | `zibby login` | Interactive browser login (saves to `~/.zibby/config.json`) |
|
|
27
|
+
| | `zibby uninstall` | Remove zibby from this project + globally + Studio + caches |
|
|
28
|
+
| **Templates** | `zibby template list` | Show available workflow templates |
|
|
29
|
+
| | `zibby template add <name>` | Copy template into `.zibby/` (overwrites — doubles as update) |
|
|
30
|
+
| **Workflows** | `zibby workflow new <name>` | Scaffold a new workflow under `.zibby/workflows/<name>/` |
|
|
31
|
+
| | `zibby workflow start <name>` | Run locally with hot reload (add `-w` for watch mode) |
|
|
32
|
+
| | `zibby workflow run <name>` | One-shot local run (no server) |
|
|
33
|
+
| | `zibby workflow list` | Show local + deployed workflows |
|
|
34
|
+
| | `zibby workflow deploy <name>` | Build bundle + upload to cloud |
|
|
35
|
+
| | `zibby workflow trigger <uuid>` | Trigger a deployed workflow remotely |
|
|
36
|
+
| | `zibby workflow logs <uuid>` | Fetch logs once (add `-t` to tail live) |
|
|
37
|
+
| | `zibby workflow download <uuid>` | Pull cloud workflow source locally |
|
|
38
|
+
| | `zibby workflow delete <uuid>` | Destroy cloud workflow |
|
|
39
|
+
| | `zibby workflow env list/set/unset/push <uuid>` | Manage per-workflow encrypted env vars |
|
|
40
|
+
| **Test** | `zibby test <spec.txt>` | Run an AI-driven browser test (requires `browser-test-automation` template) |
|
|
41
|
+
| **Chat** | `zibby chat` | Interactive chat agent with cloud sandbox |
|
|
42
|
+
| **Memory (UI agent learning DB)** | `zibby memory init` | Initialize the Dolt-backed memory DB (`.zibby/memory/`) |
|
|
43
|
+
| | `zibby memory stats` | Show counts: runs, selectors, pages, insights |
|
|
44
|
+
| | `zibby memory cost` | Show real LLM token usage from past runs (input/output/cache) |
|
|
45
|
+
| | `zibby memory compact` | Prune old data + run Dolt GC |
|
|
46
|
+
| | `zibby memory reset --force` | Wipe the memory DB |
|
|
47
|
+
| | `zibby memory remote add <url>` | Configure a shared remote (BYO) — `aws://`, `gs://`, `https://`, `file:///` |
|
|
48
|
+
| | `zibby memory remote use --hosted` | Switch to Zibby-managed S3 (signed-in users only) |
|
|
49
|
+
| | `zibby memory remote info` | Show configured remote |
|
|
50
|
+
| | `zibby memory remote remove [name]` | Drop the remote (memory becomes local-only) |
|
|
51
|
+
| | `zibby memory pull` | Pull team's latest learnings (auto-runs on test start) |
|
|
52
|
+
| | `zibby memory push` | Push local learnings (auto-runs on test pass) |
|
|
53
|
+
| **Project** | `zibby project list` | Show projects you have access to |
|
|
54
|
+
| **Studio** | `zibby studio` | Open Zibby Studio desktop app (manages projects + integrations via web UI) |
|
|
55
|
+
| **Egress** | `zibby deploy --dedicated-ip enable/status/use/disable` | Manage dedicated egress addon |
|
|
56
|
+
| **Credentials** | `zibby creds list/sync/remove` | Manage agent API/OAuth credentials in `~/.zibby/config.json` |
|
|
19
57
|
|
|
20
58
|
## Authentication
|
|
21
59
|
|
|
@@ -50,21 +88,87 @@ zibby workflow delete <uuid> # destroy cloud workflow
|
|
|
50
88
|
## Quick start (60 seconds)
|
|
51
89
|
|
|
52
90
|
```bash
|
|
53
|
-
# 1.
|
|
54
|
-
|
|
91
|
+
# 1. Bootstrap a project — bare init, no workflow scaffolding
|
|
92
|
+
zibby init # config + credentials only
|
|
93
|
+
# Or, init AND scaffold a workflow:
|
|
94
|
+
zibby init -t browser-test-automation # for `zibby test`
|
|
95
|
+
# (See `zibby template list` for available templates.)
|
|
96
|
+
|
|
97
|
+
# 2. (For workflows) scaffold a custom one
|
|
98
|
+
zibby workflow new my-pipeline
|
|
55
99
|
cd .zibby/workflows/my-pipeline
|
|
56
100
|
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
|
|
101
|
+
# 3. Edit graph.mjs — add nodes, set agents
|
|
102
|
+
# 4. Run locally
|
|
103
|
+
zibby workflow start my-pipeline
|
|
104
|
+
|
|
105
|
+
# 5. Deploy + trigger remotely
|
|
106
|
+
zibby login
|
|
107
|
+
zibby workflow deploy my-pipeline
|
|
108
|
+
zibby workflow trigger <returned-uuid>
|
|
109
|
+
zibby workflow logs <returned-uuid> -t
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Templates
|
|
113
|
+
|
|
114
|
+
`zibby init` is bare by default — it sets up `.zibby.config.mjs`, credentials, and a local memory DB, but doesn't scaffold any workflow. Templates are opt-in.
|
|
60
115
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
npx @zibby/cli workflow logs <returned-uuid> -t
|
|
116
|
+
```bash
|
|
117
|
+
zibby template list # see available templates
|
|
118
|
+
zibby template add browser-test-automation # add later
|
|
119
|
+
zibby init -t browser-test-automation # or do both at once
|
|
66
120
|
```
|
|
67
121
|
|
|
122
|
+
Currently shipping:
|
|
123
|
+
- `browser-test-automation` — full `zibby test` workflow (preflight → live execution → script generation)
|
|
124
|
+
|
|
125
|
+
`template add` overwrites existing files — re-run after `npm update @zibby/core` to refresh.
|
|
126
|
+
|
|
127
|
+
## Memory & team sync
|
|
128
|
+
|
|
129
|
+
UI agent memory: a local-first Dolt DB that learns selectors, page models, and navigation flows from every test run. Used today by `zibby test`; designed to power any agent that drives a UI.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
zibby memory init # create .zibby/memory/.dolt
|
|
133
|
+
zibby memory stats # see what's been learned
|
|
134
|
+
zibby memory cost # real LLM token spend per spec / per domain
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Team sync — three modes
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Mode A: local-only (default)
|
|
141
|
+
# No setup. Memory grows on your machine, never syncs.
|
|
142
|
+
|
|
143
|
+
# Mode B: BYO remote (your S3/GCS/DoltHub)
|
|
144
|
+
zibby memory remote add aws://[my-bucket]team/proj/main
|
|
145
|
+
zibby memory remote add gs://my-bucket/zibby
|
|
146
|
+
zibby memory remote add https://doltremoteapi.dolthub.com/team/repo
|
|
147
|
+
zibby memory remote add file:///shared/zibby-memory # NFS / iCloud / Dropbox
|
|
148
|
+
|
|
149
|
+
# Mode C: Zibby-hosted (signed-in users only — we manage the bucket)
|
|
150
|
+
zibby login
|
|
151
|
+
zibby memory remote use --hosted
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Once configured, every test run auto-pulls the team's latest learnings before, and auto-pushes after on success. No manual sync needed.
|
|
155
|
+
|
|
156
|
+
### Declarative team setup via `.zibby.config.mjs`
|
|
157
|
+
|
|
158
|
+
Commit the remote URL so teammates cloning the repo auto-configure on `zibby init`:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
// .zibby.config.mjs
|
|
162
|
+
export default {
|
|
163
|
+
// ...
|
|
164
|
+
memorySync: {
|
|
165
|
+
remote: 'hosted', // or 'aws://...' or null
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
When set, `zibby init` automatically wires up the remote on first run (asks the user to `zibby login` if `'hosted'` is configured but they haven't signed in yet — never blocks init).
|
|
171
|
+
|
|
68
172
|
## CI/CD trigger
|
|
69
173
|
|
|
70
174
|
Every deployed workflow exposes an HTTP API:
|
|
@@ -91,13 +195,10 @@ GitHub Actions:
|
|
|
91
195
|
|
|
92
196
|
```bash
|
|
93
197
|
zibby project list # show projects you have access to
|
|
94
|
-
zibby project use <id> # set active project for subsequent commands
|
|
95
|
-
|
|
96
|
-
zibby integrations list # show connected integrations
|
|
97
|
-
zibby integrations connect github # OAuth flow for GitHub
|
|
98
|
-
zibby integrations connect gitlab # token flow for self-hosted GitLab
|
|
99
198
|
```
|
|
100
199
|
|
|
200
|
+
Active project selection and integrations (GitHub / GitLab / Slack / Jira / etc.) are managed via [Zibby Studio](https://zibby.dev/studio) — the desktop app handles OAuth flows + per-project active state. Most CLI commands accept `--project <id>` for one-off overrides.
|
|
201
|
+
|
|
101
202
|
## Dedicated egress (static IP addon)
|
|
102
203
|
|
|
103
204
|
For customers behind corporate firewalls. See [docs.zibby.app/cloud/dedicated-egress](https://docs.zibby.app/cloud/dedicated-egress).
|
package/dist/bin/zibby.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
process.stdout.on("error",o=>{o.code}),process.stderr.on("error",o=>{o.code}),process.env.DOTENV_CONFIG_QUIET="true";import"@zibby/skills";import{Command as
|
|
3
|
-
`),
|
|
2
|
+
process.stdout.on("error",o=>{o.code}),process.stderr.on("error",o=>{o.code}),process.env.DOTENV_CONFIG_QUIET="true";import"@zibby/skills";import{Command as g}from"commander";import{initCommand as k}from"../commands/init.js";import{runCommand as h}from"../commands/run.js";import{videoCommand as b}from"../commands/video.js";import{uploadCommand as v}from"../commands/upload.js";import{ciSetupCommand as C}from"../commands/ci-setup.js";import{setupPlaywrightMcpCommand as I,setupCiCommand as P,testWithVideoCommand as S}from"../commands/setup-scripts.js";import{readFileSync as A}from"fs";import{fileURLToPath as j}from"url";import{dirname as B,join as x}from"path";import{bootstrapAgentEnv as _}from"../utils/agent-credentials.js";const D=j(import.meta.url),E=B(D),u=JSON.parse(A(x(E,"../package.json"),"utf-8"));function c(o,e){return e.push(o),e}const f=`zibby v${u.version}`,i=process.argv.slice(2),z=i.includes("-h")||i.includes("--help"),R=i.includes("-v")||i.includes("-V")||i.includes("--version");R&&(console.log(f),process.exit(0));const w=i[0],Z=i[1],O=["logs","uninstall"],Y=w==="workflow"&&Z==="list";!O.includes(w)&&!Y&&console.log(`${f}
|
|
3
|
+
`),_(process.cwd());const L=i[0]==="chat",M=["--verbose","--agent","--stream","-s"],U=i.length>0&&i.every(o=>M.includes(o)||i[i.indexOf(o)-1]==="--agent"),J=i.length===0||L||U;if(J&&!z){const o={},e=i.indexOf("--agent");e!==-1&&i[e+1]&&(o.agent=i[e+1]),i.includes("--verbose")&&(o.verbose=!0),(i.includes("--stream")||i.includes("-s"))&&(o.stream=!0);const{chatCommand:t}=await import("../commands/chat.js");await t(o),process.exit(0)}const n=new g;n.name("zibby").description("Zibby \u2014 the cloud pipeline for Claude Code, Cursor, Codex, and Gemini. Compose them into structured workflows with schema-enforced handoff.").version(u.version,"-V, --version"),n.configureHelp({visibleCommands:()=>[]}),n.addHelpText("after",`
|
|
4
4
|
Workflow (the platform):
|
|
5
5
|
workflow new <name> Scaffold a new workflow at .zibby/workflows/<name>/
|
|
6
6
|
workflow run <name> Run a workflow locally (one-shot, mirrors trigger flags)
|
|
@@ -45,4 +45,4 @@ Examples:
|
|
|
45
45
|
|
|
46
46
|
Docs: https://docs.zibby.app
|
|
47
47
|
GitHub: https://github.com/ZibbyHQ/zibby-agent
|
|
48
|
-
`),n.command("init").description("Initialize a new Zibby project (config + credentials + workflow template)").argument("[project-name]","Project name (optional, uses current directory if not provided)").option("--agent <type>","Agent to use (claude, cursor, codex, gemini)").option("--memory-backend <backend>","Memory backend to configure (dolt, mem0)","dolt").option("-t, --template <name>","Workflow template to scaffold (see `zibby template list`)","browser-test-automation").option("--skip-install","Skip npm install").option("--skip-memory","Skip test memory setup during initialization").option("-f, --force","Force reinitialize (overwrite existing config)").option("--headed","Run MCP browser in headed mode (visible browser)").option("--headless","Run MCP browser in headless mode (hidden browser)").option("--api-key <key>","Zibby API key for cloud sync").option("--cloud-sync","Enable cloud sync and install Zibby MCP").option("--agent-key <key>","Agent API key (non-interactive). For Claude this is the per-token API key").option("--agent-oauth-token <token>","Claude OAuth subscription token (non-interactive). Saves to ~/.zibby/config.json").action(g),n.command("test").description("Run a test specification").argument("[spec-path]","Path to test spec file or inline test description in quotes").option("--sources <ids>","Comma-separated test case IDs to fetch from cloud").option("--execution <id>","Execution ID containing the test cases (required with --sources)").option("--agent <type>","Agent to use (claude, cursor, codex, gemini) - overrides config").option("--workflow <name>","Workflow to use (e.g., QuickSmokeWorkflow, quick-smoke)").option("--headless","Run browser in headless mode").option("--node <name>","Run only a specific node (e.g., execute_live, generate_script)").option("--session <id>",'Use existing session (e.g., 1768974629717 or "last") - requires --node').option("--session-path <dir>","Use this session folder (absolute or relative to cwd); Studio pins artifacts here").option("--project <id>","Project ID (optional, auto-detected from ZIBBY_API_KEY)").option("--collection <id-or-name>","Collection ID or name (creates new if name doesn't exist)").option("--folder <path>","Folder path within collection (optional, requires --collection)").option("--sync","Force upload to cloud (overrides cloudSync: false)").option("--no-sync","Skip upload to cloud (overrides cloudSync: true)").option("--config <path>","Path to config file",".zibby.config.mjs").option("--auto-approve","Auto-approve MCP tools (for CI/CD)").option("-o, --open","Open test results in browser after completion").option("--verbose","Show info level logs").option("--debug","Show debug level logs (most verbose)").option("-m, --mem","Enable test memory (Dolt-backed knowledge from previous runs)").action((o,e)=>(e.debug?process.env.ZIBBY_DEBUG="true":e.verbose&&(process.env.ZIBBY_VERBOSE="true"),k(o,e))),n.command("implement").description("Implement a Jira ticket using AI agent (runs in ECS container)").action(async(...o)=>{const{implementCommand:e}=await import("../commands/implement.js");return e(...o)}),n.command("analyze").description("Analyze a Jira ticket against the codebase (runs in ECS container)").option("--workflow <path>","Path to a local workflow JSON file (e.g., .zibby/workflow-analysis.json)").action(async(...o)=>{const{analyzeCommand:e}=await import("../commands/analyze-graph.js");return e(...o)}),n.command("video").description("Organize test videos next to test files").action(b),n.command("upload <spec-path>").description("Upload existing test artifacts to Zibby Cloud").option("--project <id>","Project ID (REQUIRED - use flag or ZIBBY_PROJECT_ID env)").option("--collection <id-or-name>","Collection ID or name (creates new if name doesn't exist)").option("--folder <path>","Folder path within collection (optional)").option("--agent <type>","Agent used (for metadata)").action(h),n.command("login").description("Log in to Zibby (opens browser for authentication)").action(async()=>{const{loginCli:o}=await import("../auth/cli-login.js");await o(),process.exit(0)}),n.command("logout").description("Log out from Zibby (clears saved session)").action(async()=>{const{logoutCli:o}=await import("../auth/cli-login.js");o(),process.exit(0)}),n.command("status").description("Show current authentication status and token details").option("--json","Output in JSON format (for scripts)").action(async o=>{const{showLoginStatus:e}=await import("../auth/cli-login.js");await e(o),process.exit(0)}),n.command("list").description("List your projects and API tokens").action(async()=>{const{listProjectsCommand:o}=await import("../commands/list-projects.js");await o()}),n.command("ci-setup").description("Setup Cursor Agent for CI/CD (patch and configure)").option("--get-keys","Get MCP approval keys").option("--save","Save approval keys to project").action(v),n.command("setup-playwright").description("Setup official Playwright MCP (from cursor-agent-package)").option("--headed","Configure MCP in headed mode (visible browser)").option("--viewport-width <width>","Viewport width (default: 1280)","1280").option("--viewport-height <height>","Viewport height (default: 720)","720").action(o=>{const e={width:parseInt(o.viewportWidth,10)||1280,height:parseInt(o.viewportHeight,10)||720};return I({...o,viewport:e})}),n.command("setup-ci-full").description("Complete CI/CD setup from scratch").action(C),n.command("test-video").description("Run Playwright tests with video recording").argument("[test-file]","Test file to run (default: tests/)").option("--headed","Run in headed mode (visible browser)").action(P),n.command("generate").description("Generate test specs from a ticket + codebase (local analysis using real AI agent)").option("-t, --ticket <key>","Jira ticket key (fetches automatically)").option("-i, --input <file>","Input file with ticket description/requirements").option("-d, --description <text>","Inline ticket description").option("--repo <path>","Path to the codebase (default: current directory)").option("--agent <type>","Agent to use (codex, claude, cursor, gemini)").option("--model <model>","Model override").option("-o, --output <dir>","Output directory for spec files (default: test-specs)").action(async o=>{const{generateCommand:e}=await import("../commands/generate.js");return e(o)}),n.command("studio").description("Launch Zibby Studio desktop (installs from CDN if needed). Uses this folder as the Zibby project.").option("-p, --port <port>","Port for the Studio API bridge (default: 3847)").option("--no-open","Start the API only; do not launch desktop app").option("--update","Force re-download of the latest Studio binary").action(async o=>{const{studioCommand:e}=await import("../commands/studio.js");return e(o)});const p=n.command("creds").description("Manage credentials Zibby has stored for your workspace (KMS-encrypted)");p.command("list").description("List credentials stored for your workspace (masked)").action(async()=>{const{listCmd:o}=await import("../commands/creds.js");await o(),process.exit(0)}),p.command("sync").description("Re-read ~/.zibby/credentials.env and upload any new tokens").action(async()=>{const{syncCmd:o}=await import("../commands/creds.js");await o(),process.exit(0)}),p.command("remove <type> <index>").description("Remove a stored credential. e.g. zibby creds remove oauth 0").action(async(o,e)=>{const{removeCmd:t}=await import("../commands/creds.js");await t(o,e),process.exit(0)});const U=n.command("g").description("Generate scaffolds");U.command("workflow [name]").description("Scaffold a new custom workflow in .zibby/workflows/<name>/ (auto-generates name if omitted)").option("--skip-install","Skip running `npm install` in the new workflow folder").option("--agent <agent>","Set up agent helpers without prompting: claude | cursor | codex | all | none").option("--force-agents","Overwrite user-edited agent helper files (use with --agent)").action(async(o,e)=>{const{generateWorkflowCommand:t}=await import("../commands/workflows/generate.js");return t(o,e)}),n.command("start <workflow-name>").description("Start a local dev server for a custom workflow").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:t}=await import("../commands/workflows/start.js");return t(o,e)}),n.command("run <workflow-name>").description("Run a workflow locally \u2014 one-shot (alias of `zibby workflow run`)").option("-p, --param <key=value>","Input param (repeatable)",s,[]).option("--input <json>","Input as JSON string").option("--input-file <path>","Input as JSON file").action(async(o,e)=>{const{runLocalWorkflowCommand:t}=await import("../commands/workflows/run-local.js");return t(o,e)}),n.command("deploy [workflow-name]").description("Deploy a custom workflow to Zibby Cloud (interactive selection if workflow-name not provided)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--dedicated-ip <action>","Manage dedicated egress IP addon: enable | status | disable | use | unuse").option("--env <path>","Path to a .env file to sync into per-workflow env vars after deploy (repeatable)",s,[]).option("--verbose","Show raw CodeBuild logs during the bundle build").action(async(o,e)=>{if(e.dedicatedIp){const{dedicatedEgressCommand:a}=await import("../commands/workflows/dedicated-egress.js");return a(e.dedicatedIp,e.project)}const{deployWorkflowCommand:t}=await import("../commands/workflows/deploy.js");return t(o,e)}),n.command("trigger [uuid]").description("Trigger a deployed workflow by UUID (interactive selection if not provided). Get UUIDs from `zibby workflow list`.").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",s,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON/YAML file \u2014 lowest precedence").option("--idempotency-key <key>","Idempotency key to prevent duplicate executions").action(async(o,e)=>{const{triggerWorkflowCommand:t}=await import("../commands/workflows/trigger.js");return t(o,e)}),n.command("logs [jobId]").description("Fetch and display logs from a workflow execution (use -t to stream in real-time)").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--workflow <name>","Workflow name (fetches the latest run)").option("--all","Show interleaved logs from all runs (requires --workflow)").option("-t, --follow","Stream logs in real-time (like Heroku logs -t)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--lines <n>","Max log lines per fetch (default: 500)").action(async(o,e)=>{const{logsCommand:t}=await import("../commands/workflows/logs.js");return t(o,e)}),n.command("run-workflow").description("Run a deployed workflow from S3 sources (used by ECS containers)").action(async()=>{const{runWorkflowCommand:o}=await import("../commands/workflows/run.js");return o()});const f=n.command("template").description("Manage workflow templates in this project");f.command("list").description("List available workflow templates").action(async()=>{const{templateListCommand:o}=await import("../commands/template.js");return o()}),f.command("add").argument("<name>","Template name (see `zibby template list`)").description("Copy a workflow template into this project's .zibby/ (overwrites existing files = doubles as update)").option("--skip-memory","Strip SKILLS.MEMORY from copied execute-live.mjs (browser-test only)").action(async(o,e)=>{const{templateAddCommand:t}=await import("../commands/template.js");return t(o,{enableMemory:!e.skipMemory})});const c=n.command("memory").description("Test memory database \u2014 version-controlled knowledge from runs");c.command("stats").description("Show memory database statistics").action(async()=>{const{memoryStatsCommand:o}=await import("../commands/memory.js");return o()}),c.command("init").description("Initialize the memory database (Dolt)").action(async()=>{const{memoryInitCommand:o}=await import("../commands/memory.js");return o()}),c.command("compact").description("Prune old data and run Dolt GC to reclaim storage").option("--max-runs <n>","Keep last N runs per spec (default: 50)",parseInt).option("--max-age <days>","Remove data older than N days (default: 90)",parseInt).action(async o=>{const{memoryCompactCommand:e}=await import("../commands/memory.js");return e(o)}),c.command("reset").description("Wipe the memory database").option("-f, --force","Confirm reset").action(async o=>{const{memoryResetCommand:e}=await import("../commands/memory.js");return e(o)}),c.command("cost").description("Show real LLM token usage from past runs (input/output/cache)").action(async()=>{const{memoryCostCommand:o}=await import("../commands/memory.js");return o()});const W=n.command("agents").description("Manage Claude/Cursor/Codex helper files for working with Zibby workflows");W.command("add [agent]").description("Add agent helpers (claude | cursor | codex | all). Prompts if no agent given.").option("--force","Overwrite user-edited helper files").action(async(o,e)=>{const{runAgentHelpers:t,addAgent:a}=await import("../commands/workflows/agent-helpers.js");if(o){const d=["claude","cursor","codex","all","none"];d.includes(o)||(console.error(`Unknown agent "${o}". Valid: ${d.join(", ")}`),process.exit(1)),o==="none"?await t({forcedAgents:["none"],force:e.force===!0}):o==="all"?await t({forcedAgents:["claude","cursor","codex"],force:e.force===!0}):await a(o,{force:e.force===!0})}else await t({forcedAgents:void 0,force:e.force===!0,forcePrompt:!0})});const r=n.command("workflow").description("Manage workflow graphs \u2014 new, start, deploy, trigger, logs, list, download, delete");r.command("new [name]").description("Scaffold a new custom workflow (alias of `zibby g workflow`)").option("--skip-install","Skip running `npm install` in the new workflow folder").option("--agent <agent>","Set up agent helpers without prompting: claude | cursor | codex | all | none").option("--force-agents","Overwrite user-edited agent helper files (use with --agent)").action(async(o,e)=>{const{generateWorkflowCommand:t}=await import("../commands/workflows/generate.js");return t(o,e)}),r.command("run <workflow-name>").description("Run a workflow locally \u2014 one-shot, same input flags as `workflow trigger`").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",s,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON file \u2014 lowest precedence").action(async(o,e)=>{const{runLocalWorkflowCommand:t}=await import("../commands/workflows/run-local.js");return t(o,e)}),r.command("start <workflow-name>").description("Start a long-lived local dev server (Studio integration). Prefer `workflow run` for one-shots.").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:t}=await import("../commands/workflows/start.js");return t(o,e)}),r.command("deploy [workflow-name]").description("Deploy a workflow to Zibby Cloud (alias of `zibby deploy`)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--env <path>","Path to a .env file to sync into per-workflow env vars after deploy (repeatable)",s,[]).option("--verbose","Show raw CodeBuild logs during the bundle build").action(async(o,e)=>{const{deployWorkflowCommand:t}=await import("../commands/workflows/deploy.js");return t(o,e)}),r.command("trigger [uuid]").description("Trigger a deployed workflow by UUID (alias of `zibby trigger`)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",s,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON/YAML file \u2014 lowest precedence").option("--idempotency-key <key>","Idempotency key to prevent duplicate executions").action(async(o,e)=>{const{triggerWorkflowCommand:t}=await import("../commands/workflows/trigger.js");return t(o,e)}),r.command("logs [jobId]").description("Tail logs from a workflow execution (alias of `zibby logs`)").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--workflow <name>","Workflow name (fetches the latest run)").option("--all","Show interleaved logs from all runs (requires --workflow)").option("-t, --follow","Stream logs in real-time (like Heroku logs -t)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--lines <n>","Max log lines per fetch (default: 500)").action(async(o,e)=>{const{logsCommand:t}=await import("../commands/workflows/logs.js");return t(o,e)}),r.command("download [uuid]").description("Download a workflow from Zibby Cloud to .zibby/workflows/<name>/. Pass a UUID (from `zibby workflow list`) for custom workflows, or use --type for built-ins.").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--type <type>","Built-in workflow type: analysis, implementation, run_test (alternative to positional <uuid>)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--output <dir>","Output directory base (default: .zibby/workflows)").option("--include-default","Download the built-in default graph if no custom one exists").action(async(o,e)=>{const{workflowDownloadCommand:t}=await import("../commands/workflow.js");return t({...e,uuid:o})}),r.command("list").description("List all workflows (local + remote if credentials available)").option("--local-only","Show only local workflows").option("--remote-only","Show only remote workflows (requires --project)").option("--project <id>","Project ID (optional, uses ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async o=>{if(o.remoteOnly){const{workflowListCommand:t}=await import("../commands/workflow.js");return t(o)}if(o.localOnly){const{listLocalWorkflowsCommand:t}=await import("../commands/workflows/list.js");return t(o)}const{listAllWorkflowsCommand:e}=await import("../commands/workflows/list.js");return e(o)}),r.command("delete <uuid>").description("Delete a deployed workflow by UUID").action(async o=>{const{deleteWorkflowCommand:e}=await import("../commands/workflows/delete.js");return e(o,{})});const l=r.command("env").description("Manage per-workflow encrypted env vars (set ANTHROPIC_API_KEY, DATABASE_URL, etc. per workflow)");l.command("list <uuid>").description("List env var key names for a workflow (values never returned)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e)=>{const{listEnvCommand:t}=await import("../commands/workflows/env.js");return t(o,e)}),l.command("set <uuid> <kv>").description("Set or update one env var: zibby workflow env set <uuid> KEY=value").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e,t)=>{const{setEnvCommand:a}=await import("../commands/workflows/env.js");return a(o,e,t)}),l.command("unset <uuid> <key>").description("Remove one env var from a workflow").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e,t)=>{const{unsetEnvCommand:a}=await import("../commands/workflows/env.js");return a(o,e,t)}),l.command("push <uuid>").description("Bulk-replace env from one or more .env files (later files override). Removes any keys not in the new map.").option("--file <path>","Path to a .env file (repeatable, e.g. --file .env --file .env.prod)",s,[]).option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e)=>{const{pushEnvCommand:t}=await import("../commands/workflows/env.js");return t(o,e)});const T=n.command("project").description("Manage Zibby projects");T.command("list").description("List all projects").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async o=>{const{projectListCommand:e}=await import("../commands/project.js");return e(o)});const K=n.command("run-queue").description("Parallel capacity \u2014 on-disk wait queue (see parallel.waitWhenAtCapacity in .zibby.config.mjs)");K.command("list").description("List CLI processes waiting for a run slot").option("--config <path>","Path to config file",".zibby.config.mjs").action(async o=>{const{runCapacityQueueListCommand:e}=await import("../commands/run-capacity-queue-cli.js");await e(o),process.exit(0)}),n.command("uninstall").description("Remove all Zibby data: global CLI, ~/.zibby, Cursor MCP config, Studio, and current project").option("--dry-run","Show what would be deleted without deleting").option("--deep","Also remove npx cache dirs containing zibby").action(async o=>{const{uninstallCommand:e}=await import("../commands/uninstall.js");await e(o),process.exit(0)}),n.parse();
|
|
48
|
+
`),n.command("init").description("Initialize a Zibby project (config + credentials only \u2014 pass -t <name> to also scaffold a workflow template)").argument("[project-name]","Project name (optional, uses current directory if not provided)").option("--agent <type>","Agent to use (claude, cursor, codex, gemini)").option("--memory-backend <backend>","Memory backend to configure (dolt, mem0)","dolt").option("-t, --template <name>","Workflow template to scaffold into .zibby/ (see `zibby template list`). Default: none \u2014 init only sets up config and credentials.").option("--skip-install","Skip npm install").option("--skip-memory","Skip test memory setup during initialization").option("-f, --force","Force reinitialize (overwrite existing config)").option("--headed","Run MCP browser in headed mode (visible browser)").option("--headless","Run MCP browser in headless mode (hidden browser)").option("--api-key <key>","Zibby API key for cloud sync").option("--cloud-sync","Enable cloud sync and install Zibby MCP").option("--agent-key <key>","Agent API key (non-interactive). For Claude this is the per-token API key").option("--agent-oauth-token <token>","Claude OAuth subscription token (non-interactive). Saves to ~/.zibby/config.json").action(k),n.command("test").description("Run a test specification").argument("[spec-path]","Path to test spec file or inline test description in quotes").option("--sources <ids>","Comma-separated test case IDs to fetch from cloud").option("--execution <id>","Execution ID containing the test cases (required with --sources)").option("--agent <type>","Agent to use (claude, cursor, codex, gemini) - overrides config").option("--workflow <name>","Workflow to use (e.g., QuickSmokeWorkflow, quick-smoke)").option("--headless","Run browser in headless mode").option("--node <name>","Run only a specific node (e.g., execute_live, generate_script)").option("--session <id>",'Use existing session (e.g., 1768974629717 or "last") - requires --node').option("--session-path <dir>","Use this session folder (absolute or relative to cwd); Studio pins artifacts here").option("--project <id>","Project ID (optional, auto-detected from ZIBBY_API_KEY)").option("--collection <id-or-name>","Collection ID or name (creates new if name doesn't exist)").option("--folder <path>","Folder path within collection (optional, requires --collection)").option("--sync","Force upload to cloud (overrides cloudSync: false)").option("--no-sync","Skip upload to cloud (overrides cloudSync: true)").option("--config <path>","Path to config file",".zibby.config.mjs").option("--auto-approve","Auto-approve MCP tools (for CI/CD)").option("-o, --open","Open test results in browser after completion").option("--verbose","Show info level logs").option("--debug","Show debug level logs (most verbose)").option("-m, --mem","Enable test memory (Dolt-backed knowledge from previous runs)").action((o,e)=>(e.debug?process.env.ZIBBY_DEBUG="true":e.verbose&&(process.env.ZIBBY_VERBOSE="true"),h(o,e))),n.command("implement").description("Implement a Jira ticket using AI agent (runs in ECS container)").action(async(...o)=>{const{implementCommand:e}=await import("../commands/implement.js");return e(...o)}),n.command("analyze").description("Analyze a Jira ticket against the codebase (runs in ECS container)").option("--workflow <path>","Path to a local workflow JSON file (e.g., .zibby/workflow-analysis.json)").action(async(...o)=>{const{analyzeCommand:e}=await import("../commands/analyze-graph.js");return e(...o)}),n.command("video").description("Organize test videos next to test files").action(b),n.command("upload <spec-path>").description("Upload existing test artifacts to Zibby Cloud").option("--project <id>","Project ID (REQUIRED - use flag or ZIBBY_PROJECT_ID env)").option("--collection <id-or-name>","Collection ID or name (creates new if name doesn't exist)").option("--folder <path>","Folder path within collection (optional)").option("--agent <type>","Agent used (for metadata)").action(v),n.command("login").description("Log in to Zibby (opens browser for authentication)").action(async()=>{const{loginCli:o}=await import("../auth/cli-login.js");await o(),process.exit(0)}),n.command("logout").description("Log out from Zibby (clears saved session)").action(async()=>{const{logoutCli:o}=await import("../auth/cli-login.js");o(),process.exit(0)}),n.command("status").description("Show current authentication status and token details").option("--json","Output in JSON format (for scripts)").action(async o=>{const{showLoginStatus:e}=await import("../auth/cli-login.js");await e(o),process.exit(0)}),n.command("list").description("List your projects and API tokens").action(async()=>{const{listProjectsCommand:o}=await import("../commands/list-projects.js");await o()}),n.command("ci-setup").description("Setup Cursor Agent for CI/CD (patch and configure)").option("--get-keys","Get MCP approval keys").option("--save","Save approval keys to project").action(C),n.command("setup-playwright").description("Setup official Playwright MCP (from cursor-agent-package)").option("--headed","Configure MCP in headed mode (visible browser)").option("--viewport-width <width>","Viewport width (default: 1280)","1280").option("--viewport-height <height>","Viewport height (default: 720)","720").action(o=>{const e={width:parseInt(o.viewportWidth,10)||1280,height:parseInt(o.viewportHeight,10)||720};return I({...o,viewport:e})}),n.command("setup-ci-full").description("Complete CI/CD setup from scratch").action(P),n.command("test-video").description("Run Playwright tests with video recording").argument("[test-file]","Test file to run (default: tests/)").option("--headed","Run in headed mode (visible browser)").action(S),n.command("generate").description("Generate test specs from a ticket + codebase (local analysis using real AI agent)").option("-t, --ticket <key>","Jira ticket key (fetches automatically)").option("-i, --input <file>","Input file with ticket description/requirements").option("-d, --description <text>","Inline ticket description").option("--repo <path>","Path to the codebase (default: current directory)").option("--agent <type>","Agent to use (codex, claude, cursor, gemini)").option("--model <model>","Model override").option("-o, --output <dir>","Output directory for spec files (default: test-specs)").action(async o=>{const{generateCommand:e}=await import("../commands/generate.js");return e(o)}),n.command("studio").description("Launch Zibby Studio desktop (installs from CDN if needed). Uses this folder as the Zibby project.").option("-p, --port <port>","Port for the Studio API bridge (default: 3847)").option("--no-open","Start the API only; do not launch desktop app").option("--update","Force re-download of the latest Studio binary").action(async o=>{const{studioCommand:e}=await import("../commands/studio.js");return e(o)});const d=n.command("creds").description("Manage credentials Zibby has stored for your workspace (KMS-encrypted)");d.command("list").description("List credentials stored for your workspace (masked)").action(async()=>{const{listCmd:o}=await import("../commands/creds.js");await o(),process.exit(0)}),d.command("sync").description("Re-read ~/.zibby/credentials.env and upload any new tokens").action(async()=>{const{syncCmd:o}=await import("../commands/creds.js");await o(),process.exit(0)}),d.command("remove <type> <index>").description("Remove a stored credential. e.g. zibby creds remove oauth 0").action(async(o,e)=>{const{removeCmd:t}=await import("../commands/creds.js");await t(o,e),process.exit(0)});const W=n.command("g").description("Generate scaffolds");W.command("workflow [name]").description("Scaffold a new custom workflow in .zibby/workflows/<name>/ (auto-generates name if omitted)").option("--skip-install","Skip running `npm install` in the new workflow folder").option("--agent-helpers [list]",'Install agent helpers (Claude Code / Cursor slash commands). List = comma-separated, e.g. "claude" or "claude,cursor". Bare flag defaults to claude.').option("--no-agent-helpers","Skip agent helpers even if .zibby.config.mjs says install").option("--agent <agent>","(legacy) Set up agent helpers: claude | cursor | codex | all | none. Prefer --agent-helpers.").option("--force-agents","Overwrite user-edited agent helper files (use with --agent-helpers)").action(async(o,e)=>{const{generateWorkflowCommand:t}=await import("../commands/workflows/generate.js");return t(o,e)}),n.command("start <workflow-name>").description("Start a local dev server for a custom workflow").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:t}=await import("../commands/workflows/start.js");return t(o,e)}),n.command("run <workflow-name>").description("Run a workflow locally \u2014 one-shot (alias of `zibby workflow run`)").option("-p, --param <key=value>","Input param (repeatable)",c,[]).option("--input <json>","Input as JSON string").option("--input-file <path>","Input as JSON file").action(async(o,e)=>{const{runLocalWorkflowCommand:t}=await import("../commands/workflows/run-local.js");return t(o,e)}),n.command("deploy [workflow-name]").description("Deploy a custom workflow to Zibby Cloud (interactive selection if workflow-name not provided)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--dedicated-ip <action>","Manage dedicated egress IP addon: enable | status | disable | use | unuse").option("--env <path>","Path to a .env file to sync into per-workflow env vars after deploy (repeatable)",c,[]).option("--verbose","Show raw CodeBuild logs during the bundle build").option("--no-creds-check","Skip the project secrets sanity check (CI/CD when the secret is provisioned out-of-band)").action(async(o,e)=>{if(e.dedicatedIp){const{dedicatedEgressCommand:s}=await import("../commands/workflows/dedicated-egress.js");return s(e.dedicatedIp,e.project)}const{deployWorkflowCommand:t}=await import("../commands/workflows/deploy.js");return t(o,e)}),n.command("trigger [uuid]").description("Trigger a deployed workflow by UUID (interactive selection if not provided). Get UUIDs from `zibby workflow list`.").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",c,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON/YAML file \u2014 lowest precedence").option("--idempotency-key <key>","Idempotency key to prevent duplicate executions").action(async(o,e)=>{const{triggerWorkflowCommand:t}=await import("../commands/workflows/trigger.js");return t(o,e)}),n.command("logs [jobId]").description("Fetch and display logs from a workflow execution (use -t to stream in real-time)").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--workflow <name>","Workflow name (fetches the latest run)").option("--all","Show interleaved logs from all runs (requires --workflow)").option("-t, --follow","Stream logs in real-time (like Heroku logs -t)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--lines <n>","Max log lines per fetch (default: 500)").action(async(o,e)=>{const{logsCommand:t}=await import("../commands/workflows/logs.js");return t(o,e)}),n.command("run-workflow").description("Run a deployed workflow from S3 sources (used by ECS containers)").action(async()=>{const{runWorkflowCommand:o}=await import("../commands/workflows/run.js");return o()});const y=n.command("template").description("Manage workflow templates in this project");y.command("list").description("List available workflow templates").action(async()=>{const{templateListCommand:o}=await import("../commands/template.js");return o()}),y.command("add").argument("<name>","Template name (see `zibby template list`)").description("Copy a workflow template into this project's .zibby/ (overwrites existing files = doubles as update)").option("--skip-memory","Strip SKILLS.MEMORY from copied execute-live.mjs (browser-test only)").action(async(o,e)=>{const{templateAddCommand:t}=await import("../commands/template.js");return t(o,{enableMemory:!e.skipMemory})});const r=n.command("memory").description("Test memory database \u2014 version-controlled knowledge from runs");r.command("stats").description("Show memory database statistics").action(async()=>{const{memoryStatsCommand:o}=await import("../commands/memory.js");return o()}),r.command("init").description("Initialize the memory database (Dolt)").action(async()=>{const{memoryInitCommand:o}=await import("../commands/memory.js");return o()}),r.command("compact").description("Prune old data and run Dolt GC to reclaim storage").option("--max-runs <n>","Keep last N runs per spec (default: 50)",parseInt).option("--max-age <days>","Remove data older than N days (default: 90)",parseInt).action(async o=>{const{memoryCompactCommand:e}=await import("../commands/memory.js");return e(o)}),r.command("reset").description("Wipe the memory database").option("-f, --force","Confirm reset").action(async o=>{const{memoryResetCommand:e}=await import("../commands/memory.js");return e(o)}),r.command("cost").description("Show real LLM token usage from past runs (input/output/cache)").action(async()=>{const{memoryCostCommand:o}=await import("../commands/memory.js");return o()});const l=r.command("remote").description("Configure a remote so the team shares cross-spec memory");l.command("add").argument("<url>","Remote URL: aws://, gs://, https://, file:///").option("--name <name>","Remote name (default: origin)","origin").description("Point the local memory DB at a shared remote (S3/GCS/DoltHub/filesystem)").action(async(o,e)=>{const{memoryRemoteAddCommand:t}=await import("../commands/memory.js");return t(o,e)}),l.command("use").description("Switch to a managed remote backend. Currently: --hosted (Zibby-managed S3, signed-in users only).").option("--hosted","Use Zibby-managed S3 (allocates a tenant-scoped prefix per-project)").option("--project-id <id>","Override the projectId from .zibby.config.mjs").action(async o=>{o.hosted||(console.log("Pass --hosted. (Other backends will be added later.)"),process.exit(1));const{memoryRemoteUseHostedCommand:e}=await import("../commands/memory.js");return e(o)}),l.command("info").description("Show the configured memory remote (if any)").action(async()=>{const{memoryRemoteInfoCommand:o}=await import("../commands/memory.js");return o()}),l.command("remove").argument("[name]","Remote name (default: origin)").description("Remove a configured memory remote (memory becomes local-only)").action(async o=>{const{memoryRemoteRemoveCommand:e}=await import("../commands/memory.js");return e(o)}),r.command("pull").description("Pull latest team memory from the configured remote").action(async()=>{const{memoryPullCommand:o}=await import("../commands/memory.js");return o()}),r.command("push").description("Push local memory to the configured remote (auto-runs after passing tests)").action(async()=>{const{memoryPushCommand:o}=await import("../commands/memory.js");return o()});const T=n.command("agents").description("Manage Claude/Cursor/Codex helper files for working with Zibby workflows");T.command("add [agent]").description("Add agent helpers (claude | cursor | codex | all). Prompts if no agent given.").option("--force","Overwrite user-edited helper files").action(async(o,e)=>{const{runAgentHelpers:t,addAgent:s}=await import("../commands/workflows/agent-helpers.js");if(o){const m=["claude","cursor","codex","all","none"];m.includes(o)||(console.error(`Unknown agent "${o}". Valid: ${m.join(", ")}`),process.exit(1)),o==="none"?await t({forcedAgents:["none"],force:e.force===!0}):o==="all"?await t({forcedAgents:["claude","cursor","codex"],force:e.force===!0}):await s(o,{force:e.force===!0})}else await t({forcedAgents:void 0,force:e.force===!0,forcePrompt:!0})});const a=n.command("workflow").description("Manage workflow graphs \u2014 new, start, deploy, trigger, logs, list, download, delete");a.command("new [name]").description("Scaffold a new custom workflow (alias of `zibby g workflow`)").option("--skip-install","Skip running `npm install` in the new workflow folder").option("--agent-helpers [list]",'Install agent helpers (Claude Code / Cursor slash commands). List = comma-separated, e.g. "claude" or "claude,cursor". Bare flag defaults to claude.').option("--no-agent-helpers","Skip agent helpers even if .zibby.config.mjs says install").option("--agent <agent>","(legacy) Set up agent helpers: claude | cursor | codex | all | none. Prefer --agent-helpers.").option("--force-agents","Overwrite user-edited agent helper files (use with --agent-helpers)").action(async(o,e)=>{const{generateWorkflowCommand:t}=await import("../commands/workflows/generate.js");return t(o,e)}),a.command("run <workflow-name>").description("Run a workflow locally \u2014 one-shot, same input flags as `workflow trigger`").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",c,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON file \u2014 lowest precedence").action(async(o,e)=>{const{runLocalWorkflowCommand:t}=await import("../commands/workflows/run-local.js");return t(o,e)}),a.command("start <workflow-name>").description("Start a long-lived local dev server (Studio integration). Prefer `workflow run` for one-shots.").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:t}=await import("../commands/workflows/start.js");return t(o,e)}),a.command("deploy [workflow-name]").description("Deploy a workflow to Zibby Cloud (alias of `zibby deploy`)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--env <path>","Path to a .env file to sync into per-workflow env vars after deploy (repeatable)",c,[]).option("--verbose","Show raw CodeBuild logs during the bundle build").option("--no-creds-check","Skip the project secrets sanity check (CI/CD when the secret is provisioned out-of-band)").action(async(o,e)=>{const{deployWorkflowCommand:t}=await import("../commands/workflows/deploy.js");return t(o,e)}),a.command("trigger [uuid]").description("Trigger a deployed workflow by UUID (alias of `zibby trigger`)").option("--project <id>","Project ID (interactive prompt if not provided, or ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("-p, --param <key=value>","Input param (repeatable, e.g. -p url=https://x.com -p count=5)",c,[]).option("--input <json>",`Input as JSON string \u2014 overridden by --param (e.g. '{"key":"value"}')`).option("--input-file <path>","Input as JSON/YAML file \u2014 lowest precedence").option("--idempotency-key <key>","Idempotency key to prevent duplicate executions").action(async(o,e)=>{const{triggerWorkflowCommand:t}=await import("../commands/workflows/trigger.js");return t(o,e)}),a.command("logs [jobId]").description("Tail logs from a workflow execution (alias of `zibby logs`)").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--workflow <name>","Workflow name (fetches the latest run)").option("--all","Show interleaved logs from all runs (requires --workflow)").option("-t, --follow","Stream logs in real-time (like Heroku logs -t)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--lines <n>","Max log lines per fetch (default: 500)").action(async(o,e)=>{const{logsCommand:t}=await import("../commands/workflows/logs.js");return t(o,e)}),a.command("download [uuid]").description("Download a workflow from Zibby Cloud to .zibby/workflows/<name>/. Pass a UUID (from `zibby workflow list`) for custom workflows, or use --type for built-ins.").option("--project <id>","Project ID (or ZIBBY_PROJECT_ID env)").option("--type <type>","Built-in workflow type: analysis, implementation, run_test (alternative to positional <uuid>)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").option("--output <dir>","Output directory base (default: .zibby/workflows)").option("--include-default","Download the built-in default graph if no custom one exists").action(async(o,e)=>{const{workflowDownloadCommand:t}=await import("../commands/workflow.js");return t({...e,uuid:o})}),a.command("list").description("List all workflows (local + remote if credentials available)").option("--local-only","Show only local workflows").option("--remote-only","Show only remote workflows (requires --project)").option("--project <id>","Project ID (optional, uses ZIBBY_PROJECT_ID env)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async o=>{if(o.remoteOnly){const{workflowListCommand:t}=await import("../commands/workflow.js");return t(o)}if(o.localOnly){const{listLocalWorkflowsCommand:t}=await import("../commands/workflows/list.js");return t(o)}const{listAllWorkflowsCommand:e}=await import("../commands/workflows/list.js");return e(o)}),a.command("delete <uuid>").description("Delete a deployed workflow by UUID").action(async o=>{const{deleteWorkflowCommand:e}=await import("../commands/workflows/delete.js");return e(o,{})});const p=a.command("env").description("Manage per-workflow encrypted env vars (set ANTHROPIC_API_KEY, DATABASE_URL, etc. per workflow)");p.command("list <uuid>").description("List env var key names for a workflow (values never returned)").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e)=>{const{listEnvCommand:t}=await import("../commands/workflows/env.js");return t(o,e)}),p.command("set <uuid> <kv>").description("Set or update one env var: zibby workflow env set <uuid> KEY=value").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e,t)=>{const{setEnvCommand:s}=await import("../commands/workflows/env.js");return s(o,e,t)}),p.command("unset <uuid> <key>").description("Remove one env var from a workflow").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e,t)=>{const{unsetEnvCommand:s}=await import("../commands/workflows/env.js");return s(o,e,t)}),p.command("push <uuid>").description("Bulk-replace env from one or more .env files (later files override). Removes any keys not in the new map.").option("--file <path>","Path to a .env file (repeatable, e.g. --file .env --file .env.prod)",c,[]).option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async(o,e)=>{const{pushEnvCommand:t}=await import("../commands/workflows/env.js");return t(o,e)});const K=n.command("project").description("Manage Zibby projects");K.command("list").description("List all projects").option("--api-key <key>","API key (or ZIBBY_API_KEY env)").action(async o=>{const{projectListCommand:e}=await import("../commands/project.js");return e(o)});const N=n.command("run-queue").description("Parallel capacity \u2014 on-disk wait queue (see parallel.waitWhenAtCapacity in .zibby.config.mjs)");N.command("list").description("List CLI processes waiting for a run slot").option("--config <path>","Path to config file",".zibby.config.mjs").action(async o=>{const{runCapacityQueueListCommand:e}=await import("../commands/run-capacity-queue-cli.js");await e(o),process.exit(0)}),n.command("uninstall").description("Remove all Zibby data: global CLI, ~/.zibby, Cursor MCP config, Studio, and current project").option("--dry-run","Show what would be deleted without deleting").option("--deep","Also remove npx cache dirs containing zibby").action(async o=>{const{uninstallCommand:e}=await import("../commands/uninstall.js");await e(o),process.exit(0)}),n.parse();
|