@zibby/cli 0.1.85 → 0.1.90

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/dist/bin/zibby.js CHANGED
@@ -1,3 +1,3 @@
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 m}from"commander";import{initCommand as u}from"../commands/init.js";import{runCommand as f}from"../commands/run.js";import{videoCommand as w}from"../commands/video.js";import{uploadCommand as y}from"../commands/upload.js";import{ciSetupCommand as g}from"../commands/ci-setup.js";import{setupPlaywrightMcpCommand as k,setupCiCommand as b,testWithVideoCommand as h}from"../commands/setup-scripts.js";import{readFileSync as I}from"fs";import{fileURLToPath as v}from"url";import{dirname as C,join as P}from"path";import{bootstrapAgentEnv as _}from"../utils/agent-credentials.js";const S=v(import.meta.url),j=C(S),s=JSON.parse(I(P(j,"../package.json"),"utf-8"));function c(o,e){return e.push(o),e}const p=`zibby v${s.version}`,n=process.argv.slice(2),B=n.includes("-h")||n.includes("--help"),D=n.includes("-v")||n.includes("-V")||n.includes("--version");D&&(console.log(p),process.exit(0));const l=n[0],A=n[1],E=["logs","uninstall"],x=l==="workflow"&&A==="list";!E.includes(l)&&!x&&console.log(`${p}
3
- `),_(process.cwd());const Z=n[0]==="chat",Y=["--verbose","--agent","--stream","-s"],O=n.length>0&&n.every(o=>Y.includes(o)||n[n.indexOf(o)-1]==="--agent"),z=n.length===0||Z||O;if(z&&!B){const o={},e=n.indexOf("--agent");e!==-1&&n[e+1]&&(o.agent=n[e+1]),n.includes("--verbose")&&(o.verbose=!0),(n.includes("--stream")||n.includes("-s"))&&(o.stream=!0);const{chatCommand:i}=await import("../commands/chat.js");await i(o),process.exit(0)}const t=new m;t.name("zibby").description("Zibby Test Automation - AI-powered test generation").version(s.version,"-V, --version"),t.command("init").description("Initialize a new Zibby test project (like rails new)").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("--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").action(u),t.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"),f(o,e))),t.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)}),t.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)}),t.command("video").description("Organize test videos next to test files").action(w),t.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(y),t.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)}),t.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)}),t.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)}),t.command("list").description("List your projects and API tokens").action(async()=>{const{listProjectsCommand:o}=await import("../commands/list-projects.js");await o()}),t.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(g),t.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 k({...o,viewport:e})}),t.command("setup-ci-full").description("Complete CI/CD setup from scratch").action(b),t.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(h),t.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)}),t.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 R=t.command("g").description("Generate scaffolds");R.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").action(async(o,e)=>{const{generateWorkflowCommand:i}=await import("../commands/workflows/generate.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/start.js");return i(o,e)}),t.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").action(async(o,e)=>{if(e.dedicatedIp){const{dedicatedEgressCommand:d}=await import("../commands/workflows/dedicated-egress.js");return d(e.dedicatedIp,e.project)}const{deployWorkflowCommand:i}=await import("../commands/workflows/deploy.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/trigger.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/logs.js");return i(o,e)}),t.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 a=t.command("memory").description("Test memory database \u2014 version-controlled knowledge from runs");a.command("stats").description("Show memory database statistics").action(async()=>{const{memoryStatsCommand:o}=await import("../commands/memory.js");return o()}),a.command("init").description("Initialize the memory database (Dolt)").action(async()=>{const{memoryInitCommand:o}=await import("../commands/memory.js");return o()}),a.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)}),a.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)});const r=t.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").action(async(o,e)=>{const{generateWorkflowCommand:i}=await import("../commands/workflows/generate.js");return i(o,e)}),r.command("start <workflow-name>").description("Start a local dev server for a workflow (alias of `zibby start`)").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:i}=await import("../commands/workflows/start.js");return i(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)").action(async(o,e)=>{const{deployWorkflowCommand:i}=await import("../commands/workflows/deploy.js");return i(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)",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:i}=await import("../commands/workflows/trigger.js");return i(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:i}=await import("../commands/workflows/logs.js");return i(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:i}=await import("../commands/workflow.js");return i({...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:i}=await import("../commands/workflow.js");return i(o)}if(o.localOnly){const{listLocalWorkflowsCommand:i}=await import("../commands/workflows/list.js");return i(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 W=t.command("project").description("Manage Zibby projects");W.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 J=t.command("run-queue").description("Parallel capacity \u2014 on-disk wait queue (see parallel.waitWhenAtCapacity in .zibby.config.mjs)");J.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)}),t.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)}),t.parse();
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 m}from"commander";import{initCommand as u}from"../commands/init.js";import{runCommand as w}from"../commands/run.js";import{videoCommand as f}from"../commands/video.js";import{uploadCommand as y}from"../commands/upload.js";import{ciSetupCommand as g}from"../commands/ci-setup.js";import{setupPlaywrightMcpCommand as k,setupCiCommand as b,testWithVideoCommand as h}from"../commands/setup-scripts.js";import{readFileSync as I}from"fs";import{fileURLToPath as v}from"url";import{dirname as C,join as P}from"path";import{bootstrapAgentEnv as S}from"../utils/agent-credentials.js";const _=v(import.meta.url),B=C(_),s=JSON.parse(I(P(B,"../package.json"),"utf-8"));function c(o,e){return e.push(o),e}const p=`zibby v${s.version}`,n=process.argv.slice(2),j=n.includes("-h")||n.includes("--help"),D=n.includes("-v")||n.includes("-V")||n.includes("--version");D&&(console.log(p),process.exit(0));const l=n[0],A=n[1],E=["logs","uninstall"],x=l==="workflow"&&A==="list";!E.includes(l)&&!x&&console.log(`${p}
3
+ `),S(process.cwd());const Z=n[0]==="chat",Y=["--verbose","--agent","--stream","-s"],O=n.length>0&&n.every(o=>Y.includes(o)||n[n.indexOf(o)-1]==="--agent"),z=n.length===0||Z||O;if(z&&!j){const o={},e=n.indexOf("--agent");e!==-1&&n[e+1]&&(o.agent=n[e+1]),n.includes("--verbose")&&(o.verbose=!0),(n.includes("--stream")||n.includes("-s"))&&(o.stream=!0);const{chatCommand:i}=await import("../commands/chat.js");await i(o),process.exit(0)}const t=new m;t.name("zibby").description("Zibby Test Automation - AI-powered test generation").version(s.version,"-V, --version"),t.command("init").description("Initialize a new Zibby test project (like rails new)").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("--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").action(u),t.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"),w(o,e))),t.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)}),t.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)}),t.command("video").description("Organize test videos next to test files").action(f),t.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(y),t.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)}),t.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)}),t.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)}),t.command("list").description("List your projects and API tokens").action(async()=>{const{listProjectsCommand:o}=await import("../commands/list-projects.js");await o()}),t.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(g),t.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 k({...o,viewport:e})}),t.command("setup-ci-full").description("Complete CI/CD setup from scratch").action(b),t.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(h),t.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)}),t.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 R=t.command("g").description("Generate scaffolds");R.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").action(async(o,e)=>{const{generateWorkflowCommand:i}=await import("../commands/workflows/generate.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/start.js");return i(o,e)}),t.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("--verbose","Show raw CodeBuild logs during the bundle build").action(async(o,e)=>{if(e.dedicatedIp){const{dedicatedEgressCommand:d}=await import("../commands/workflows/dedicated-egress.js");return d(e.dedicatedIp,e.project)}const{deployWorkflowCommand:i}=await import("../commands/workflows/deploy.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/trigger.js");return i(o,e)}),t.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:i}=await import("../commands/workflows/logs.js");return i(o,e)}),t.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 a=t.command("memory").description("Test memory database \u2014 version-controlled knowledge from runs");a.command("stats").description("Show memory database statistics").action(async()=>{const{memoryStatsCommand:o}=await import("../commands/memory.js");return o()}),a.command("init").description("Initialize the memory database (Dolt)").action(async()=>{const{memoryInitCommand:o}=await import("../commands/memory.js");return o()}),a.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)}),a.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)});const r=t.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").action(async(o,e)=>{const{generateWorkflowCommand:i}=await import("../commands/workflows/generate.js");return i(o,e)}),r.command("start <workflow-name>").description("Start a local dev server for a workflow (alias of `zibby start`)").option("-p, --port <port>","Port for the workflow server (default: 3848)").action(async(o,e)=>{const{startWorkflowCommand:i}=await import("../commands/workflows/start.js");return i(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("--verbose","Show raw CodeBuild logs during the bundle build").action(async(o,e)=>{const{deployWorkflowCommand:i}=await import("../commands/workflows/deploy.js");return i(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)",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:i}=await import("../commands/workflows/trigger.js");return i(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:i}=await import("../commands/workflows/logs.js");return i(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:i}=await import("../commands/workflow.js");return i({...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:i}=await import("../commands/workflow.js");return i(o)}if(o.localOnly){const{listLocalWorkflowsCommand:i}=await import("../commands/workflows/list.js");return i(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 W=t.command("project").description("Manage Zibby projects");W.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 J=t.command("run-queue").description("Parallel capacity \u2014 on-disk wait queue (see parallel.waitWhenAtCapacity in .zibby.config.mjs)");J.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)}),t.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)}),t.parse();
@@ -1 +1 @@
1
- function d(n,o){return n?.uuid||n?.workflowUuid||o?.uuid||null}function l({uuid:n,name:o,projectId:i,result:u,existingManifest:e=null,now:t=()=>new Date().toISOString()}){let r=u?.version??(e?.version??0)+1;return{uuid:n,name:o,projectId:i,version:r,deployedAt:t()}}export{l as buildDeployManifest,d as pickCloudUuid};
1
+ function l(e,r){return e?.uuid||e?.workflowUuid||r?.uuid||null}var o=4;function a({elapsedMs:e,phase:r,step:t}){let n=` \u2014 ${Math.max(0,Math.floor(e/1e3))}s`;return t?`Building bundle on Zibby Cloud... [${t.n}/${o}] ${t.label}${n}`:r?`Building bundle on Zibby Cloud... (${r.toLowerCase()})${n}`:`Building bundle on Zibby Cloud...${n}`}var d=/\[(\d+)\/\d+\]\s+(.+?)\s*\.{0,3}\s*$/;function c(e){if(!e)return null;let r=d.exec(e);if(!r)return null;let t=parseInt(r[1],10);return!Number.isInteger(t)||t<1?null:{n:t,label:r[2].trim()}}function m(){let e=!1;return function(t){if(!t)return!0;let u=t.replace(/\s+$/,"");if(e)return/^\s*"\s*$/.test(u)&&(e=!1),!0;if(!f(t))return!1;let n=u.replace(/^\[Container\]\s+\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}\.\d+\s*/,"");return n.startsWith("Running command ")&&(n.match(/"/g)||[]).length%2===1&&(e=!0),!0}}function f(e){if(!e)return!0;let t=e.trim().replace(/^\[Container\]\s+\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}\.\d+\s*/,"");return!!(/^Phase complete:/.test(t)||/^Phase context status code:/.test(t)||/^Entering phase /.test(t)||/^Running command /.test(t)||/^Phase is /.test(t)||/^Waiting for /.test(t)||/^Registering with agent$/.test(t)||/^Running on CodeBuild /.test(t)||/^Phases found in YAML:/.test(t)||/^CODEBUILD_SRC_DIR=/.test(t)||/^YAML location is /.test(t)||/^Processing environment variables$/.test(t)||/^Moving to directory /.test(t)||/^Cache is not defined /.test(t)||/^Skip cache due to:/.test(t)||/^\s*INSTALL: \d+ commands?$/.test(t)||/^\s*BUILD: \d+ commands?$/.test(t)||/^Set report auto-discover timeout/.test(t)||/^Expanding /.test(t)||/^Assembling file list$/.test(t)||/^No matching auto-discover/.test(t)||/^Report auto-discover/.test(t)||t==="")}function p({uuid:e,name:r,projectId:t,result:u,existingManifest:n=null,now:i=()=>new Date().toISOString()}){let s=u?.version??(n?.version??0)+1;return{uuid:e,name:r,projectId:t,version:s,deployedAt:i()}}export{o as BUNDLE_BUILD_TOTAL_STEPS,p as buildDeployManifest,a as formatBundleSpinnerText,f as isBundleNoiseLine,m as makeBundleLogFilter,c as parseBundleStepLine,l as pickCloudUuid};
@@ -1,33 +1,34 @@
1
- import{existsSync as k,readFileSync as W,writeFileSync as Mo}from"fs";import{join as m}from"path";import j from"chalk";import G from"ora";import Ko from"dotenv";import{select as ko}from"@inquirer/prompts";import{existsSync as To}from"fs";import{join as Po}from"path";import{pathToFileURL as Bo}from"url";async function eo(o){let e=Po(o,".zibby.config.mjs");if(!To(e))throw new Error(".zibby.config.mjs not found");try{let n=await import(Bo(e).href);return n.default||n}catch(n){throw new Error(`Failed to load .zibby.config.mjs: ${n.message}`,{cause:n})}}var A={local:{name:"Local Development",apiUrl:"http://localhost:3001",accountApiUrl:"http://localhost:3001",frontendUrl:"http://localhost:3000",description:"Local backend running on port 3001"},prod:{name:"Production",apiUrl:process.env.ZIBBY_PROD_API_URL||"https://api-prod.zibby.app",accountApiUrl:process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://account-api-prod.zibby.app",frontendUrl:process.env.ZIBBY_PROD_FRONTEND_URL||"https://studio.zibby.app",description:"Production environment"}};function B(){let o;if(process.env.ZIBBY_API_URL)o=process.env.ZIBBY_API_URL;else{let e=process.env.ZIBBY_ENV||"prod";A[e]?o=A[e].apiUrl:o=A.prod.apiUrl}try{let e=new URL(o);return e.protocol!=="http:"&&e.protocol!=="https:"?(console.error(`\u26A0\uFE0F Invalid API URL protocol: ${e.protocol} (only http/https allowed)`),A.prod.apiUrl):o}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${o}`),A.prod.apiUrl}}function no(o,e){return o?.uuid||o?.workflowUuid||e?.uuid||null}function to({uuid:o,name:e,projectId:n,result:t,existingManifest:h=null,now:a=()=>new Date().toISOString()}){let s=t?.version??(h?.version??0)+1;return{uuid:o,name:e,projectId:n,version:s,deployedAt:a()}}import{existsSync as Fo,readFileSync as Yo}from"fs";import{join as Zo}from"path";import K from"chalk";import{confirm as Jo}from"@inquirer/prompts";import l from"chalk";import J from"ora";import{spawn as Lo}from"child_process";import{existsSync as so,mkdirSync as Ao,readFileSync as Co,writeFileSync as zo}from"fs";import{homedir as ro}from"os";import{join as O}from"path";function io(){return process.env.ZIBBY_CONFIG_DIR||O(ro(),".zibby")}function lo(){return O(io(),"config.json")}var _o=O(ro(),".zibby"),re=O(_o,"config.json");function Eo(){let o=io();so(o)||Ao(o,{recursive:!0})}function S(){try{let o=lo();if(so(o)){let e=Co(o,"utf-8");return JSON.parse(e)}}catch{}return{}}function C(o){Eo(),zo(lo(),JSON.stringify(o,null,2))}function co(){return S().sessionToken||null}function ao(o){let e=S();e.sessionToken=o,C(e)}function po(){return S().user||null}function uo(o){let e=S();e.user=o,C(e)}function fo(o){let e=S();e.proxyUrl=o,C(e)}function go(o){let e=S();e.mem0ProxyUrl=o,C(e)}function yo(o){let e=S();e.projects=o,C(e)}import{existsSync as ce,mkdirSync as ae,readFileSync as pe,writeFileSync as ue,unlinkSync as fe}from"fs";import{resolve as de}from"path";import{homedir as he}from"os";function Oo(o){let e=process.platform;try{let n,t;return e==="darwin"?(n="open",t=[o]):e==="win32"?(n="cmd",t=["/c","start","",o]):(n="xdg-open",t=[o]),Lo(n,t,{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}function Do(){let o=co(),e=po();return o&&e?{loggedIn:!0,user:e,token:o}:{loggedIn:!1}}async function wo(){try{console.log(l.cyan(`
1
+ import{existsSync as b,readFileSync as G,writeFileSync as qe}from"fs";import{join as m}from"path";import k from"chalk";import V from"ora";import Xe from"dotenv";import{select as xe}from"@inquirer/prompts";import{existsSync as Ce}from"fs";import{join as Ae}from"path";import{pathToFileURL as _e}from"url";async function te(e){let t=Ae(e,".zibby.config.mjs");if(!Ce(t))throw new Error(".zibby.config.mjs not found");try{let o=await import(_e(t).href);return o.default||o}catch(o){throw new Error(`Failed to load .zibby.config.mjs: ${o.message}`,{cause:o})}}var A={local:{name:"Local Development",apiUrl:"http://localhost:3001",accountApiUrl:"http://localhost:3001",frontendUrl:"http://localhost:3000",description:"Local backend running on port 3001"},prod:{name:"Production",apiUrl:process.env.ZIBBY_PROD_API_URL||"https://api-prod.zibby.app",accountApiUrl:process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://account-api-prod.zibby.app",frontendUrl:process.env.ZIBBY_PROD_FRONTEND_URL||"https://studio.zibby.app",description:"Production environment"}};function C(){let e;if(process.env.ZIBBY_API_URL)e=process.env.ZIBBY_API_URL;else{let t=process.env.ZIBBY_ENV||"prod";A[t]?e=A[t].apiUrl:e=A.prod.apiUrl}try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?(console.error(`\u26A0\uFE0F Invalid API URL protocol: ${t.protocol} (only http/https allowed)`),A.prod.apiUrl):e}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${e}`),A.prod.apiUrl}}function ne(e,t){return e?.uuid||e?.workflowUuid||t?.uuid||null}var Ee=4;function M({elapsedMs:e,phase:t,step:o}){let u=` \u2014 ${Math.max(0,Math.floor(e/1e3))}s`;return o?`Building bundle on Zibby Cloud... [${o.n}/${Ee}] ${o.label}${u}`:t?`Building bundle on Zibby Cloud... (${t.toLowerCase()})${u}`:`Building bundle on Zibby Cloud...${u}`}var Le=/\[(\d+)\/\d+\]\s+(.+?)\s*\.{0,3}\s*$/;function re(e){if(!e)return null;let t=Le.exec(e);if(!t)return null;let o=parseInt(t[1],10);return!Number.isInteger(o)||o<1?null:{n:o,label:t[2].trim()}}function se(){let e=!1;return function(o){if(!o)return!0;let n=o.replace(/\s+$/,"");if(e)return/^\s*"\s*$/.test(n)&&(e=!1),!0;if(!ze(o))return!1;let u=n.replace(/^\[Container\]\s+\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}\.\d+\s*/,"");return u.startsWith("Running command ")&&(u.match(/"/g)||[]).length%2===1&&(e=!0),!0}}function ze(e){if(!e)return!0;let o=e.trim().replace(/^\[Container\]\s+\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}\.\d+\s*/,"");return!!(/^Phase complete:/.test(o)||/^Phase context status code:/.test(o)||/^Entering phase /.test(o)||/^Running command /.test(o)||/^Phase is /.test(o)||/^Waiting for /.test(o)||/^Registering with agent$/.test(o)||/^Running on CodeBuild /.test(o)||/^Phases found in YAML:/.test(o)||/^CODEBUILD_SRC_DIR=/.test(o)||/^YAML location is /.test(o)||/^Processing environment variables$/.test(o)||/^Moving to directory /.test(o)||/^Cache is not defined /.test(o)||/^Skip cache due to:/.test(o)||/^\s*INSTALL: \d+ commands?$/.test(o)||/^\s*BUILD: \d+ commands?$/.test(o)||/^Set report auto-discover timeout/.test(o)||/^Expanding /.test(o)||/^Assembling file list$/.test(o)||/^No matching auto-discover/.test(o)||/^Report auto-discover/.test(o)||o==="")}function ie({uuid:e,name:t,projectId:o,result:n,existingManifest:u=null,now:f=()=>new Date().toISOString()}){let r=n?.version??(u?.version??0)+1;return{uuid:e,name:t,projectId:o,version:r,deployedAt:f()}}import{existsSync as We,readFileSync as Ge}from"fs";import{join as Ve}from"path";import W from"chalk";import{confirm as He}from"@inquirer/prompts";import a from"chalk";import J from"ora";import{spawn as Ye}from"child_process";import{existsSync as le,mkdirSync as De,readFileSync as Re,writeFileSync as Oe}from"fs";import{homedir as ce}from"os";import{join as R}from"path";function ae(){return process.env.ZIBBY_CONFIG_DIR||R(ce(),".zibby")}function ue(){return R(ae(),"config.json")}var Ne=R(ce(),".zibby"),po=R(Ne,"config.json");function Fe(){let e=ae();le(e)||De(e,{recursive:!0})}function I(){try{let e=ue();if(le(e)){let t=Re(e,"utf-8");return JSON.parse(t)}}catch{}return{}}function _(e){Fe(),Oe(ue(),JSON.stringify(e,null,2))}function pe(){return I().sessionToken||null}function fe(e){let t=I();t.sessionToken=e,_(t)}function de(){return I().user||null}function ge(e){let t=I();t.user=e,_(t)}function ye(e){let t=I();t.proxyUrl=e,_(t)}function he(e){let t=I();t.mem0ProxyUrl=e,_(t)}function me(e){let t=I();t.projects=e,_(t)}import{existsSync as yo,mkdirSync as ho,readFileSync as mo,writeFileSync as wo,unlinkSync as bo}from"fs";import{resolve as jo}from"path";import{homedir as vo}from"os";function Ze(e){let t=process.platform;try{let o,n;return t==="darwin"?(o="open",n=[e]):t==="win32"?(o="cmd",n=["/c","start","",e]):(o="xdg-open",n=[e]),Ye(o,n,{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}function Me(){let e=pe(),t=de();return e&&t?{loggedIn:!0,user:t,token:e}:{loggedIn:!1}}async function be(){try{console.log(a.cyan(`
2
2
  \u{1F510} Initiating login...
3
- `));let o=Do();if(o.loggedIn){console.log(l.green("\u2705 Already logged in!")),console.log(l.gray(`User: ${o.user.email}`)),console.log(l.gray(`Name: ${o.user.name}
4
- `));let{createInterface:e}=await import("readline"),n=e({input:process.stdin,output:process.stdout});return new Promise((t,h)=>{let a=()=>{n.close(),process.stdin.isTTY&&process.stdin.setRawMode(!1)},s=()=>{console.log(l.yellow(`
3
+ `));let e=Me();if(e.loggedIn){console.log(a.green("\u2705 Already logged in!")),console.log(a.gray(`User: ${e.user.email}`)),console.log(a.gray(`Name: ${e.user.name}
4
+ `));let{createInterface:t}=await import("readline"),o=t({input:process.stdin,output:process.stdout});return new Promise((n,u)=>{let f=()=>{o.close(),process.stdin.isTTY&&process.stdin.setRawMode(!1)},r=()=>{console.log(a.yellow(`
5
5
 
6
6
  \u26A0\uFE0F Login cancelled
7
- `)),a(),process.exit(0)};process.on("SIGINT",s),n.question(l.yellow("Continue with this session? (Y/n): "),async d=>{process.removeListener("SIGINT",s),a();try{if(d.toLowerCase()==="n"||d.toLowerCase()==="no"){console.log(l.gray(`Starting new login...
8
- `));let u=await ho();t(u)}else console.log(l.green(`Using existing session.
9
- `)),t({success:!0,...o})}catch(u){h(u)}})})}return await ho()}catch(o){return console.error(l.red(`
10
- \u274C Login failed:`,o.message)),{success:!1,error:o.message}}}async function Ro(o){let e=B();try{let n=await fetch(`${e}/projects`,{headers:{Authorization:`Bearer ${o}`}});if(n.ok){let h=((await n.json()).projects||[]).map(a=>({name:a.name,projectId:a.projectId,apiToken:a.apiToken}));return yo(h),h}}catch(n){console.log(l.gray(`\u26A0\uFE0F Could not fetch projects: ${n.message}`))}return[]}async function ho(){let o=B(),e=J("Requesting login code...").start(),n=await fetch(`${o}/cli/login/initiate`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!n.ok){e.fail("Failed to request login code");let g=await n.json();throw new Error(g.error||"Failed to initiate login")}let{deviceCode:t,userCode:h,verificationUrl:a,expiresIn:s,interval:d}=await n.json();e.succeed("Login code generated"),console.log(""),console.log(l.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(l.cyan("\u2551")+l.white.bold(" Complete login in your browser ")+l.cyan("\u2551")),console.log(l.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(l.white("Opening browser to login page...")),console.log(l.gray(`Code expires in ${Math.floor(s/60)} minutes`)),console.log(""),await Oo(a)||(console.log(l.yellow("\u26A0\uFE0F Could not open browser automatically.")),console.log(l.white("Please open this URL manually: ")+l.blue(a)),console.log(""));let p=J("Waiting for authorization...").start(),f=(d||3)*1e3,i=Math.floor(s/(d||3)),b=0,D=!1,y=()=>{D=!0,p.stop(),console.log(l.yellow(`
7
+ `)),f(),process.exit(0)};process.on("SIGINT",r),o.question(a.yellow("Continue with this session? (Y/n): "),async y=>{process.removeListener("SIGINT",r),f();try{if(y.toLowerCase()==="n"||y.toLowerCase()==="no"){console.log(a.gray(`Starting new login...
8
+ `));let g=await we();n(g)}else console.log(a.green(`Using existing session.
9
+ `)),n({success:!0,...e})}catch(g){u(g)}})})}return await we()}catch(e){return console.error(a.red(`
10
+ \u274C Login failed:`,e.message)),{success:!1,error:e.message}}}async function Je(e){let t=C();try{let o=await fetch(`${t}/projects`,{headers:{Authorization:`Bearer ${e}`}});if(o.ok){let u=((await o.json()).projects||[]).map(f=>({name:f.name,projectId:f.projectId,apiToken:f.apiToken}));return me(u),u}}catch(o){console.log(a.gray(`\u26A0\uFE0F Could not fetch projects: ${o.message}`))}return[]}async function we(){let e=C(),t=J("Requesting login code...").start(),o=await fetch(`${e}/cli/login/initiate`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!o.ok){t.fail("Failed to request login code");let s=await o.json();throw new Error(s.error||"Failed to initiate login")}let{deviceCode:n,userCode:u,verificationUrl:f,expiresIn:r,interval:y}=await o.json();t.succeed("Login code generated"),console.log(""),console.log(a.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(a.cyan("\u2551")+a.white.bold(" Complete login in your browser ")+a.cyan("\u2551")),console.log(a.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(a.white("Opening browser to login page...")),console.log(a.gray(`Code expires in ${Math.floor(r/60)} minutes`)),console.log(""),await Ze(f)||(console.log(a.yellow("\u26A0\uFE0F Could not open browser automatically.")),console.log(a.white("Please open this URL manually: ")+a.blue(f)),console.log(""));let p=J("Waiting for authorization...").start(),w=(y||3)*1e3,d=Math.floor(r/(y||3)),$=0,T=!1,l=()=>{T=!0,p.stop(),console.log(a.yellow(`
11
11
 
12
12
  \u26A0\uFE0F Login cancelled
13
- `)),process.exit(0)};process.on("SIGINT",y);try{for(;b<i&&!D;){await No(f),b++;let g=await fetch(`${o}/cli/login/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:t})});if(g.status===202)continue;if(!g.ok){p.fail("Authorization failed");let I=await g.json();throw new Error(I.error||"Authorization failed")}let c=await g.json();if(c.status==="authorized"){p.succeed(l.white("Authorization successful!")),ao(c.token),uo(c.user),c.proxyUrl&&fo(c.proxyUrl),c.mem0ProxyUrl&&go(c.mem0ProxyUrl),console.log(""),console.log(l.gray(`User: ${c.user.email}`));let I=J("Fetching projects...").start(),x=await Ro(c.token);return I.succeed(`Fetched ${x.length} project${x.length!==1?"s":""}`),console.log(l.gray(`Session saved to: ~/.zibby/config.json
14
- `)),{success:!0,loggedIn:!0,user:c.user,token:c.token}}if(c.status==="denied")throw p.fail("Authorization denied"),new Error("User denied authorization")}throw p.fail("Login timeout"),new Error("Login timed out - please try again")}finally{process.removeListener("SIGINT",y)}}function No(o){return new Promise(e=>setTimeout(e,o))}function mo(){try{let o=process.env.HOME||process.env.USERPROFILE;if(!o)return null;let e=Zo(o,".zibby","config.json");return Fo(e)&&JSON.parse(Yo(e,"utf-8")).sessionToken||null}catch{return null}}function M(){console.log(`
15
- Not authenticated.`),console.log(` Run ${K.cyan("zibby login")} or set ${K.cyan("ZIBBY_API_KEY")} in your environment.
16
- `)}async function bo(o={}){let e=o.apiKey||process.env.ZIBBY_API_KEY||null,n=mo();if(n||e)return{sessionToken:n,apiKey:e};if(!process.stdin.isTTY){if(o.optional)return{sessionToken:null,apiKey:null};M(),process.exit(1)}console.log(K.yellow(`
17
- Not logged in.`));let t;try{t=await Jo({message:"Open browser to log in now?",default:!0})}catch{t=!1}if(!t){if(o.optional)return{sessionToken:null,apiKey:null};M(),process.exit(1)}if(await wo(),n=mo(),!n){if(o.optional)return{sessionToken:null,apiKey:null};M(),process.exit(1)}return{sessionToken:n,apiKey:null}}Ko.config();async function Wo({apiUrl:o,projectId:e,workflowName:n,buildId:t,authToken:h,spinner:a}){let s=Date.now(),d,u;for(;;){let p=new URL(`${o}/projects/${e}/workflows/${n}/build/${t}`);d&&p.searchParams.set("logsToken",d);let f;try{let i=await fetch(p,{headers:{Authorization:`Bearer ${h}`}});if(!i.ok)throw new Error(`HTTP ${i.status}`);f=await i.json()}catch{await new Promise(b=>setTimeout(b,2e3));continue}f.phase&&f.phase!==u&&(u=f.phase,a.text=`Building bundle on Zibby Cloud... (${u.toLowerCase()})`),f.nextLogsToken&&f.nextLogsToken!==d&&(d=f.nextLogsToken);for(let i of f.logEvents||[]){let b=String(i.m||"").trimEnd();b&&process.stdout.write(` ${b}
18
- `)}if(f.done){let i=(Date.now()-s)/1e3;return{status:f.status,elapsedSec:i,lastPhase:u}}await new Promise(i=>setTimeout(i,2e3))}}async function Go(o,e){let n=B(),t=G("Fetching projects...").start();try{let h=e||o,a=await fetch(`${n}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h}`}});a.ok||(t.fail("Failed to fetch projects"),process.exit(1));let s=await a.json();Array.isArray(s)||(s.projects&&Array.isArray(s.projects)?s=s.projects:s.data&&Array.isArray(s.data)?s=s.data:(t.fail("Unexpected response format"),process.exit(1))),(!s||s.length===0)&&(t.fail("No projects found"),process.exit(1)),t.succeed(`Found ${s.length} project${s.length===1?"":"s"}`),console.log("");let d=s.map(p=>{let f=p.projectId||p.id||p._id||"unknown";return{name:`${p.name||p.projectName||"Unnamed"} (${f})`,value:f}});return await ko({message:"Select a project to deploy to:",choices:d})}catch(h){t.fail(`Error: ${h.message}`),process.exit(1)}}async function Ze(o,e={}){let n=process.cwd(),t=".zibby/workflows";try{t=(await eo(n))?.paths?.workflows||".zibby/workflows"}catch{}if(o){let y=m(n,t,o);k(y)||(console.log(`
19
- Error: Workflow not found: ${t}/${o}/`),console.log(" Run `zibby workflow list` to see local workflows,"),console.log(` or scaffold a new one: zibby workflow new ${o}
20
- `),process.exit(1))}else{let y=m(n,t);k(y)||(console.log(`
21
- Error: No workflows found in ${t}/`),console.log(` Create one with: zibby workflow new <name>
22
- `),process.exit(1));let{readdir:g,stat:c}=await import("fs/promises"),I=await g(y),x=[];for(let $ of I){let v=m(y,$);if(!(await c(v)).isDirectory())continue;(k(m(v,"graph.mjs"))||k(m(v,"graph.js")))&&x.push($)}x.length===0&&(console.log(`
23
- Error: No workflows found in ${t}/`),console.log(` Create one with: zibby workflow new <name>
24
- `),process.exit(1)),console.log(""),o=await ko({message:"Select a workflow to deploy:",choices:x.map($=>({name:$,value:$}))})}let{sessionToken:h,apiKey:a}=await bo({apiKey:e.apiKey}),s=e.project||process.env.ZIBBY_PROJECT_ID;s||(console.log(""),s=await Go(a,h));let d=h||a,u=m(n,t,o),p=m(u,"graph.mjs"),f=m(u,"workflow.json");k(p)||(console.log(`
25
- Error: graph.mjs not found in ${t}/${o}/`),process.exit(1)),console.log(`
13
+ `)),process.exit(0)};process.on("SIGINT",l);try{for(;$<d&&!T;){await Ke(w),$++;let s=await fetch(`${e}/cli/login/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:n})});if(s.status===202)continue;if(!s.ok){p.fail("Authorization failed");let j=await s.json();throw new Error(j.error||"Authorization failed")}let c=await s.json();if(c.status==="authorized"){p.succeed(a.white("Authorization successful!")),fe(c.token),ge(c.user),c.proxyUrl&&ye(c.proxyUrl),c.mem0ProxyUrl&&he(c.mem0ProxyUrl),console.log(""),console.log(a.gray(`User: ${c.user.email}`));let j=J("Fetching projects...").start(),x=await Je(c.token);return j.succeed(`Fetched ${x.length} project${x.length!==1?"s":""}`),console.log(a.gray(`Session saved to: ~/.zibby/config.json
14
+ `)),{success:!0,loggedIn:!0,user:c.user,token:c.token}}if(c.status==="denied")throw p.fail("Authorization denied"),new Error("User denied authorization")}throw p.fail("Login timeout"),new Error("Login timed out - please try again")}finally{process.removeListener("SIGINT",l)}}function Ke(e){return new Promise(t=>setTimeout(t,e))}function ke(){try{let e=process.env.HOME||process.env.USERPROFILE;if(!e)return null;let t=Ve(e,".zibby","config.json");return We(t)&&JSON.parse(Ge(t,"utf-8")).sessionToken||null}catch{return null}}function K(){console.log(`
15
+ Not authenticated.`),console.log(` Run ${W.cyan("zibby login")} or set ${W.cyan("ZIBBY_API_KEY")} in your environment.
16
+ `)}async function je(e={}){let t=e.apiKey||process.env.ZIBBY_API_KEY||null,o=ke();if(o||t)return{sessionToken:o,apiKey:t};if(!process.stdin.isTTY){if(e.optional)return{sessionToken:null,apiKey:null};K(),process.exit(1)}console.log(W.yellow(`
17
+ Not logged in.`));let n;try{n=await He({message:"Open browser to log in now?",default:!0})}catch{n=!1}if(!n){if(e.optional)return{sessionToken:null,apiKey:null};K(),process.exit(1)}if(await be(),o=ke(),!o){if(e.optional)return{sessionToken:null,apiKey:null};K(),process.exit(1)}return{sessionToken:o,apiKey:null}}Xe.config();async function Qe({apiUrl:e,projectId:t,workflowName:o,buildId:n,authToken:u,spinner:f,verbose:r}){let y=Date.now(),g,p=null,w=null,d=se(),$=setInterval(()=>{f.text=M({elapsedMs:Date.now()-y,phase:p,step:w})},1e3);try{for(;;){let T=new URL(`${e}/projects/${t}/workflows/${o}/build/${n}`);g&&T.searchParams.set("logsToken",g);let l;try{let s=await fetch(T,{headers:{Authorization:`Bearer ${u}`}});if(!s.ok)throw new Error(`HTTP ${s.status}`);l=await s.json()}catch{await new Promise(c=>setTimeout(c,2e3));continue}l.phase&&l.phase!==p&&(p=l.phase),l.nextLogsToken&&l.nextLogsToken!==g&&(g=l.nextLogsToken);for(let s of l.logEvents||[]){let c=String(s.m||"").trimEnd();if(!c)continue;let j=re(c);if(j&&(w=j),r){process.stdout.write(` ${c}
18
+ `);continue}d(c)||j||process.stdout.write(` ${c}
19
+ `)}if(f.text=M({elapsedMs:Date.now()-y,phase:p,step:w}),l.done){let s=(Date.now()-y)/1e3;return{status:l.status,elapsedSec:s,lastPhase:p}}await new Promise(s=>setTimeout(s,2e3))}}finally{clearInterval($)}}async function eo(e,t){let o=C(),n=V("Fetching projects...").start();try{let u=t||e,f=await fetch(`${o}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`}});f.ok||(n.fail("Failed to fetch projects"),process.exit(1));let r=await f.json();Array.isArray(r)||(r.projects&&Array.isArray(r.projects)?r=r.projects:r.data&&Array.isArray(r.data)?r=r.data:(n.fail("Unexpected response format"),process.exit(1))),(!r||r.length===0)&&(n.fail("No projects found"),process.exit(1)),n.succeed(`Found ${r.length} project${r.length===1?"":"s"}`),console.log("");let y=r.map(p=>{let w=p.projectId||p.id||p._id||"unknown";return{name:`${p.name||p.projectName||"Unnamed"} (${w})`,value:w}});return await xe({message:"Select a project to deploy to:",choices:y})}catch(u){n.fail(`Error: ${u.message}`),process.exit(1)}}async function Ho(e,t={}){let o=process.cwd(),n=".zibby/workflows";try{n=(await te(o))?.paths?.workflows||".zibby/workflows"}catch{}if(e){let l=m(o,n,e);b(l)||(console.log(`
20
+ Error: Workflow not found: ${n}/${e}/`),console.log(" Run `zibby workflow list` to see local workflows,"),console.log(` or scaffold a new one: zibby workflow new ${e}
21
+ `),process.exit(1))}else{let l=m(o,n);b(l)||(console.log(`
22
+ Error: No workflows found in ${n}/`),console.log(` Create one with: zibby workflow new <name>
23
+ `),process.exit(1));let{readdir:s,stat:c}=await import("fs/promises"),j=await s(l),x=[];for(let U of j){let v=m(l,U);if(!(await c(v)).isDirectory())continue;(b(m(v,"graph.mjs"))||b(m(v,"graph.js")))&&x.push(U)}x.length===0&&(console.log(`
24
+ Error: No workflows found in ${n}/`),console.log(` Create one with: zibby workflow new <name>
25
+ `),process.exit(1)),console.log(""),e=await xe({message:"Select a workflow to deploy:",choices:x.map(U=>({name:U,value:U}))})}let{sessionToken:u,apiKey:f}=await je({apiKey:t.apiKey}),r=t.project||process.env.ZIBBY_PROJECT_ID;r||(console.log(""),r=await eo(f,u));let y=u||f,g=m(o,n,e),p=m(g,"graph.mjs"),w=m(g,"workflow.json");b(p)||(console.log(`
26
+ Error: graph.mjs not found in ${n}/${e}/`),process.exit(1)),console.log(`
26
27
  Deploying Workflow
27
- `),console.log(" ".padEnd(60,"-")),console.log(` Workflow: ${o}`),console.log(` Project: ${s}`),console.log(" ".padEnd(60,"-")),console.log("");let i=G("Validating workflow...").start(),b=W(p,"utf-8");if(b.includes("@zibby/core")||b.includes("@zibby/skills")){let y=m(u,"package.json");k(y)||(i.fail("Missing package.json"),console.log(""),console.log(j.red(" \u2717 graph.mjs imports @zibby packages but no package.json found")),console.log(""),console.log(j.yellow(" Create package.json with:")),console.log(""),console.log(j.gray(" {")),console.log(j.gray(' "type": "module",')),console.log(j.gray(' "dependencies": {')),console.log(j.gray(' "@zibby/core": "workspace:*"')),console.log(j.gray(" }")),console.log(j.gray(" }")),console.log(""),process.exit(1));let g=JSON.parse(W(y,"utf-8"));!{...g.dependencies,...g.devDependencies}["@zibby/core"]&&b.includes("@zibby/core")&&(i.fail("Missing @zibby/core dependency"),console.log(""),console.log(j.red(" \u2717 graph.mjs imports @zibby/core but it's not in package.json")),console.log(""),console.log(j.yellow(" Add to package.json dependencies:")),console.log(j.gray(' "@zibby/core": "workspace:*"')),console.log(""),process.exit(1))}i.text="Loading workflow graph...";try{let{pathToFileURL:y}=await import("url"),g=await import(y(p).href),c;if(g.default)if(typeof g.default=="function"){let r=g.default.prototype;r&&r.buildGraph?c=new g.default:c=g.default()}else i.fail("graph.mjs must export a class or factory function"),process.exit(1);else{let r=Object.values(g).find(w=>w.prototype&&w.prototype.buildGraph);r?c=new r:(i.fail("graph.mjs must export a WorkflowAgent class or factory function"),process.exit(1))}let x=c.buildGraph().serialize(),{readdir:$,readFile:v}=await import("fs/promises"),U={};i.text="Packaging workflow sources...";let V=await v(p,"utf-8");if(U["graph.mjs"]=V,k(f)){let r=await v(f,"utf-8");U["workflow.json"]=r}let R=m(u,"nodes");if(k(R)){let r=await $(R);for(let w of r)if(w.endsWith(".mjs")||w.endsWith(".js")){let P=m(R,w),Z=await v(P,"utf-8");U[`nodes/${w}`]=Z}}let H=m(u,"package.json");if(k(H)){let r=await v(H,"utf-8");U["package.json"]=r,i.text="Including package.json for dependencies..."}let q=m(u,"package-lock.json");if(k(q)){let r=await v(q,"utf-8");U["package-lock.json"]=r}i.text=`Uploading to cloud (${x.nodes.size||Object.keys(x.nodes||{}).length} nodes, ${Object.keys(U).length} files)...`;let z=B(),X=JSON.stringify({format:1,sources:U}),Q=Buffer.byteLength(X,"utf8"),_=await fetch(`${z}/projects/${s}/workflows/${o}/sources/presign`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({contentLength:Q})});if(!_.ok){let r=await _.json().catch(()=>({}));i.fail("Deploy failed (presign)"),console.log(` Error: ${r.error||r.message||_.statusText}
28
- `),process.exit(1)}let jo=await _.json(),{uploadUrl:xo,key:vo,headers:Uo}=jo,N=await fetch(xo,{method:"PUT",headers:{...Uo||{},"Content-Length":String(Q)},body:X});if(!N.ok){let r=await N.text().catch(()=>"");i.fail("Deploy failed (S3 upload)"),console.log(` S3 PUT failed: ${N.status} ${r.slice(0,200)}
29
- `),process.exit(1)}i.text="Saving workflow definition...";let E=await fetch(`${z}/projects/${s}/workflows/${o}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({graph:x,sourcesStagingKey:vo,isDefault:!1})});if(!E.ok){let r=await E.json().catch(()=>({}));i.fail("Deploy failed"),console.log(` Error: ${r.message||r.error||E.statusText}
30
- `),process.exit(1)}let F=await E.json(),L=m(u,".zibby-deploy.json"),Y=k(L)?(()=>{try{return JSON.parse(W(L,"utf-8"))}catch{return null}})():null,T=no(F,Y);if(T){let r=to({uuid:T,name:o,projectId:s,result:F,existingManifest:Y});try{Mo(L,`${JSON.stringify(r,null,2)}
31
- `,"utf-8")}catch(w){console.log(` Warning: failed to write ${L}: ${w.message}`)}}let $o=Y?"Updated":"Deployed";if(i.succeed(`${$o} ${o} (v${F.version||1})`),!(e.noWait===!0||process.env.ZIBBY_DEPLOY_NO_BUNDLE==="1")){console.log("");let r=G("Building bundle on Zibby Cloud...").start();try{let w=await fetch(`${z}/projects/${s}/workflows/${o}/build`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`}});if(w.ok){let P=await w.json(),{buildId:Z}=P,{status:oo,elapsedSec:So,lastPhase:Io}=await Wo({apiUrl:z,projectId:s,workflowName:o,buildId:Z,authToken:d,spinner:r});oo==="SUCCEEDED"?r.succeed(`Bundle ready (${So.toFixed(1)}s) \u2014 runtime npm install eliminated`):r.warn(`Bundle build ${oo} at phase ${Io||"unknown"} \u2014 workflow will fall back to runtime install`)}else{let P=await w.json().catch(()=>({}));r.warn(`Bundle build skipped: ${P.error||P.message||w.statusText}`),console.log(` Workflow will use slower runtime install path until next deploy.
32
- `)}}catch(w){r.warn(`Bundle build error: ${w.message}`)}}console.log(""),T&&console.log(` UUID: ${T}`),console.log(""),console.log(" Next steps:"),console.log(` zibby workflow start ${o} Run locally`),T&&console.log(` zibby workflow trigger ${T} Run in cloud`),console.log(" zibby workflow list View all workflows"),console.log("")}catch(y){i.fail("Deploy failed"),console.log(` Error: ${y.message}
33
- `),process.exit(1)}}export{Ze as deployWorkflowCommand};
28
+ `),console.log(" ".padEnd(60,"-")),console.log(` Workflow: ${e}`),console.log(` Project: ${r}`),console.log(" ".padEnd(60,"-")),console.log("");let d=V("Validating workflow...").start(),$=G(p,"utf-8");if($.includes("@zibby/core")||$.includes("@zibby/skills")){let l=m(g,"package.json");b(l)||(d.fail("Missing package.json"),console.log(""),console.log(k.red(" \u2717 graph.mjs imports @zibby packages but no package.json found")),console.log(""),console.log(k.yellow(" Create package.json with:")),console.log(""),console.log(k.gray(" {")),console.log(k.gray(' "type": "module",')),console.log(k.gray(' "dependencies": {')),console.log(k.gray(' "@zibby/core": "workspace:*"')),console.log(k.gray(" }")),console.log(k.gray(" }")),console.log(""),process.exit(1));let s=JSON.parse(G(l,"utf-8"));!{...s.dependencies,...s.devDependencies}["@zibby/core"]&&$.includes("@zibby/core")&&(d.fail("Missing @zibby/core dependency"),console.log(""),console.log(k.red(" \u2717 graph.mjs imports @zibby/core but it's not in package.json")),console.log(""),console.log(k.yellow(" Add to package.json dependencies:")),console.log(k.gray(' "@zibby/core": "workspace:*"')),console.log(""),process.exit(1))}d.text="Loading workflow graph...";try{let{pathToFileURL:l}=await import("url"),s=await import(l(p).href),c;if(s.default)if(typeof s.default=="function"){let i=s.default.prototype;i&&i.buildGraph?c=new s.default:c=s.default()}else d.fail("graph.mjs must export a class or factory function"),process.exit(1);else{let i=Object.values(s).find(h=>h.prototype&&h.prototype.buildGraph);i?c=new i:(d.fail("graph.mjs must export a WorkflowAgent class or factory function"),process.exit(1))}let x=c.buildGraph().serialize(),{readdir:U,readFile:v}=await import("fs/promises"),S={};d.text="Packaging workflow sources...";let H=await v(p,"utf-8");if(S["graph.mjs"]=H,b(w)){let i=await v(w,"utf-8");S["workflow.json"]=i}let O=m(g,"nodes");if(b(O)){let i=await U(O);for(let h of i)if(h.endsWith(".mjs")||h.endsWith(".js")){let B=m(O,h),Z=await v(B,"utf-8");S[`nodes/${h}`]=Z}}let q=m(g,"package.json");if(b(q)){let i=await v(q,"utf-8");S["package.json"]=i,d.text="Including package.json for dependencies..."}let X=m(g,"package-lock.json");if(b(X)){let i=await v(X,"utf-8");S["package-lock.json"]=i}d.text=`Uploading to cloud (${x.nodes.size||Object.keys(x.nodes||{}).length} nodes, ${Object.keys(S).length} files)...`;let E=C(),Q=JSON.stringify({format:1,sources:S}),ee=Buffer.byteLength(Q,"utf8"),L=await fetch(`${E}/projects/${r}/workflows/${e}/sources/presign`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({contentLength:ee})});if(!L.ok){let i=await L.json().catch(()=>({}));d.fail("Deploy failed (presign)"),console.log(` Error: ${i.error||i.message||L.statusText}
29
+ `),process.exit(1)}let ve=await L.json(),{uploadUrl:$e,key:Se,headers:Ue}=ve,N=await fetch($e,{method:"PUT",headers:{...Ue||{},"Content-Length":String(ee)},body:Q});if(!N.ok){let i=await N.text().catch(()=>"");d.fail("Deploy failed (S3 upload)"),console.log(` S3 PUT failed: ${N.status} ${i.slice(0,200)}
30
+ `),process.exit(1)}d.text="Saving workflow definition...";let z=await fetch(`${E}/projects/${r}/workflows/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({graph:x,sourcesStagingKey:Se,isDefault:!1})});if(!z.ok){let i=await z.json().catch(()=>({}));d.fail("Deploy failed"),console.log(` Error: ${i.message||i.error||z.statusText}
31
+ `),process.exit(1)}let F=await z.json(),D=m(g,".zibby-deploy.json"),Y=b(D)?(()=>{try{return JSON.parse(G(D,"utf-8"))}catch{return null}})():null,P=ne(F,Y);if(P){let i=ie({uuid:P,name:e,projectId:r,result:F,existingManifest:Y});try{qe(D,`${JSON.stringify(i,null,2)}
32
+ `,"utf-8")}catch(h){console.log(` Warning: failed to write ${D}: ${h.message}`)}}let Ie=Y?"Updated":"Deployed";if(d.succeed(`${Ie} ${e} (v${F.version||1})`),!(t.noWait===!0||process.env.ZIBBY_DEPLOY_NO_BUNDLE==="1")){console.log("");let i=V("Building bundle on Zibby Cloud...").start();try{let h=await fetch(`${E}/projects/${r}/workflows/${e}/build`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`}});if(h.ok){let B=await h.json(),{buildId:Z}=B,Te=t.verbose===!0||process.env.ZIBBY_DEPLOY_VERBOSE==="1",{status:oe,elapsedSec:Pe,lastPhase:Be}=await Qe({apiUrl:E,projectId:r,workflowName:e,buildId:Z,authToken:y,spinner:i,verbose:Te});oe==="SUCCEEDED"?i.succeed(`Bundle ready (${Pe.toFixed(1)}s) \u2014 runtime npm install eliminated`):i.warn(`Bundle build ${oe} at phase ${Be||"unknown"} \u2014 workflow will fall back to runtime install`)}else{let B=await h.json().catch(()=>({}));i.warn(`Bundle build skipped: ${B.error||B.message||h.statusText}`),console.log(` Workflow will use slower runtime install path until next deploy.
33
+ `)}}catch(h){i.warn(`Bundle build error: ${h.message}`)}}console.log(""),P&&console.log(` UUID: ${P}`),console.log(""),console.log(" Next steps:"),console.log(` zibby workflow start ${e} Run locally`),P&&console.log(` zibby workflow trigger ${P} Run in cloud`),console.log(" zibby workflow list View all workflows"),console.log("")}catch(l){d.fail("Deploy failed"),console.log(` Error: ${l.message}
34
+ `),process.exit(1)}}export{Ho as deployWorkflowCommand};
@@ -128,7 +128,7 @@ Analyze the input and return a summary with a status.\`,
128
128
  outputSchema: ExampleOutputSchema,
129
129
  };
130
130
  `}function D(o,n){return`${JSON.stringify({name:o,description:`${n} workflow`,entryClass:n,triggers:{api:!0}},null,2)}
131
- `}function Z(){return`${JSON.stringify({type:"module",dependencies:{"@zibby/core":"^0.1.47"}},null,2)}
131
+ `}function Z(){return`${JSON.stringify({type:"module",dependencies:{"@zibby/core":"^0.1.48"}},null,2)}
132
132
  `}async function Ze(o,n={}){let e;o?e=o.toLowerCase():(e=Y(),console.log(t.gray(`
133
133
  No name provided \u2014 generated: ${t.white(e)}`))),T.test(e)||(console.log(t.red(`
134
134
  Invalid workflow name: "${o}"`)),console.log(t.gray(" Must be lowercase, start with a letter, use only a-z, 0-9, hyphens")),console.log(t.gray(" Length: 2\u201364 characters")),console.log(t.gray(` Example: ticket-triage, pr-review, deploy-checker
@@ -1,46 +1,42 @@
1
- import e from"chalk";import{readFileSync as R,existsSync as C}from"fs";import{homedir as _}from"os";import{join as j}from"path";var I="https://logs.workflows.zibby.app",A="https://logs-stream.zibby.app/",S=null;async function O(s){return S||(process.env.ZIBBY_SSE_ENDPOINT?(S=process.env.ZIBBY_SSE_ENDPOINT,S):(S=A,S))}function J(s){let n=j(_(),".zibby","config.json");C(n)||(console.log(e.red(`
1
+ import e from"chalk";import{readFileSync as v,existsSync as N}from"fs";import{homedir as R}from"os";import{join as C}from"path";var x="https://logs.workflows.zibby.app",j="https://logs-stream.zibby.app/",b=null;async function _(i){return b||(process.env.ZIBBY_SSE_ENDPOINT?(b=process.env.ZIBBY_SSE_ENDPOINT,b):(b=j,b))}function A(i){let r=C(R(),".zibby","config.json");N(r)||(console.log(e.red(`
2
2
  Not authenticated`)),console.log(e.gray(` Run: zibby login
3
- `)),process.exit(1));let t;try{t=JSON.parse(R(n,"utf-8"))}catch{console.log(e.red(`
3
+ `)),process.exit(1));let n;try{n=JSON.parse(v(r,"utf-8"))}catch{console.log(e.red(`
4
4
  Config file corrupt`)),console.log(e.gray(` Run: zibby login
5
- `)),process.exit(1)}let c=t.sessionToken;c||(console.log(e.red(`
5
+ `)),process.exit(1)}let o=n.sessionToken;o||(console.log(e.red(`
6
6
  Not authenticated`)),console.log(e.gray(` Run: zibby login
7
- `)),process.exit(1));let f=s.project;return{token:c,projectId:f}}function k(s){return new Date(s).toISOString().replace("T"," ").replace("Z","")}async function P(s,n){let t=await fetch(s,{headers:{Authorization:`Bearer ${n}`}});if(!t.ok){let c=await t.text();throw new Error(`API ${t.status}: ${c}`)}return t.json()}async function z(s,n,t,c){return s||(console.log(e.red(`
7
+ `)),process.exit(1));let g=i.project;return{token:o,projectId:g}}function k(i){return new Date(i).toISOString().replace("T"," ").replace("Z","")}async function E(i,r){let n=await fetch(i,{headers:{Authorization:`Bearer ${r}`}});if(!n.ok){let o=await n.text();throw new Error(`API ${n.status}: ${o}`)}return n.json()}async function O(i,r,n,o){return i||(console.log(e.red(`
8
8
  Workflow UUID is required`)),console.log(e.gray(" Usage: zibby workflow logs <workflow-uuid>")),console.log(e.gray(` zibby workflow logs <workflow-uuid> -t
9
- `)),process.exit(1)),s}async function T({token:s,executionId:n,sseEndpoint:t,stopped:c}){let f=null;try{let l=new URL(t);l.searchParams.set("jobId",n),f&&l.searchParams.set("lastEventId",f);let g=await fetch(l.toString(),{headers:{Authorization:`Bearer ${s}`,Accept:"text/event-stream"}});if(!g.ok)throw new Error(`SSE connection failed: ${g.status} ${g.statusText}`);let r=g.body.getReader(),p=new TextDecoder,y="",w=!1;for(;!c.value;){let{done:$,value:h}=await r.read();if($)break;y+=p.decode(h,{stream:!0});let d=y.split(`
10
- `);y=d.pop()||"";for(let o of d)if(o.trim()){if(o.startsWith("id:"))f=o.slice(3).trim();else if(o.startsWith("event:")){let a=o.slice(6).trim();if(a==="log")continue;if(a==="status"){let u=d[d.indexOf(o)+1];if(u&&u.startsWith("data:"))try{let m=JSON.parse(u.slice(5).trim());if(m.status==="new_execution"){let i=m.executionId,b=`${i.slice(0,8)}...${i.slice(-4)}`,x=m.taskId?m.taskId.slice(-8):"pending";console.log(e.cyan(`
11
- \u250C\u2500 Execution: ${b} (task: ${x})`)),console.log(e.cyan(` \u2514\u2500 Streaming logs...
12
- `))}else m.status==="waiting"&&console.log(e.gray(`
13
- Waiting for next execution...`))}catch{}continue}if(a==="complete"){w=!0;continue}if(a==="error"){let u=d[d.indexOf(o)+1];if(u&&u.startsWith("data:"))try{if(JSON.parse(u.slice(5).trim()).error==="No executions found for workflow")return{notFound:!0}}catch{}return{failed:!0}}}else if(o.startsWith("data:")){let a=o.slice(5).trim();if(!a)continue;try{let u=JSON.parse(a);if(u.timestamp&&u.message){let m=e.gray(k(u.timestamp)),i=u.taskId?e.gray(`(${u.taskId.slice(-8)}) `):"";console.log(`${m} ${i}${u.message.replace(/\n$/,"")}`)}}catch{}}}}return{completed:w}}catch(l){if(l.name==="AbortError")return{aborted:!0};throw l}}async function E({token:s,jobId:n,follow:t,projectId:c}){console.log(e.gray(` Streaming logs for workflow ${e.cyan(n)}...`)),console.log(t?e.gray(` Press Ctrl+C to stop.
14
- `):"");let f=await O(s);if(!f)return console.log(e.yellow(` SSE endpoint not configured, using CloudWatch polling...
15
- `)),v({token:s,projectId:null,jobId:n,follow:t,limit:1e5});let l={value:!1},g=()=>{l.value=!0,console.log(e.gray(`
16
- Stopped streaming.
17
- `)),process.exit(0)};process.on("SIGINT",g),process.on("SIGTERM",g);try{let r=await T({token:s,executionId:n,sseEndpoint:f,stopped:l});if(r.aborted||l.value)return;if(r.notFound)if(t)for(console.log(e.yellow(" No executions found yet. Waiting for workflow to be triggered...")),console.log(e.gray(` Press Ctrl+C to stop.
18
- `));!l.value;){if(await new Promise(p=>setTimeout(p,5e3)),l.value)return;try{if(!(await T({token:s,executionId:n,sseEndpoint:f,stopped:l})).notFound)return}catch{}}else console.log(e.yellow(`
9
+ `)),process.exit(1)),i}function F(i,r){let o=((i||"")+r).split(`
10
+ `),g=o.pop()||"",a=[],u=null,s=null;for(let d=0;d<o.length;d++){let l=o[d];if(l.trim()){if(l.startsWith("id:")){u=l.slice(3).trim();continue}if(l.startsWith("event:")){let f=l.slice(6).trim();if(f==="log")continue;if(f==="status"){let c=o[d+1];if(c&&c.startsWith("data:"))try{let y=JSON.parse(c.slice(5).trim());y.status==="new_execution"?a.push({type:"newExecution",executionId:y.executionId,taskId:y.taskId}):y.status==="waiting"&&a.push({type:"waiting"})}catch{}continue}if(f==="complete"){a.push({type:"complete"});continue}if(f==="error"){let c=o[d+1];if(c&&c.startsWith("data:"))try{if(JSON.parse(c.slice(5).trim()).error==="No executions found for workflow"){s={type:"notFound"};break}}catch{}s={type:"failed"};break}continue}if(l.startsWith("data:")){let f=l.slice(5).trim();if(!f)continue;try{let c=JSON.parse(f);c.timestamp&&c.message&&a.push({type:"log",timestamp:c.timestamp,message:c.message,taskId:c.taskId})}catch{}}}}return{actions:a,remainder:g,lastEventId:u,returnSignal:s}}async function J({token:i,executionId:r,sseEndpoint:n,stopped:o}){let g=null;try{let a=new URL(n);a.searchParams.set("jobId",r),g&&a.searchParams.set("lastEventId",g);let u=await fetch(a.toString(),{headers:{Authorization:`Bearer ${i}`,Accept:"text/event-stream"}});if(!u.ok)throw new Error(`SSE connection failed: ${u.status} ${u.statusText}`);let s=u.body.getReader(),d=new TextDecoder,l="",f=!1;for(;!o.value;){let{done:c,value:y}=await s.read();if(c)break;let w=F(l,d.decode(y,{stream:!0}));l=w.remainder,w.lastEventId&&(g=w.lastEventId);for(let t of w.actions)switch(t.type){case"newExecution":{let m=`${t.executionId.slice(0,8)}...${t.executionId.slice(-4)}`,h=t.taskId?t.taskId.slice(-8):"pending";console.log(e.cyan(`
11
+ \u250C\u2500 Execution: ${m} (task: ${h})`)),console.log(e.cyan(` \u2514\u2500 Streaming logs...
12
+ `));break}case"waiting":console.log(e.gray(`
13
+ Waiting for next execution...`));break;case"complete":f=!0;break;case"log":{let m=e.gray(k(t.timestamp)),h=t.taskId?e.gray(`(${t.taskId.slice(-8)}) `):"";console.log(`${m} ${h}${t.message.replace(/\n$/,"")}`);break}}if(w.returnSignal)return w.returnSignal.type==="notFound"?{notFound:!0}:{failed:!0}}return{completed:f}}catch(a){if(a.name==="AbortError")return{aborted:!0};throw a}}function M(i,{baseMs:r=500,capMs:n=3e4,rand:o=Math.random}={}){let g=Math.min(n,r*Math.pow(2,Math.max(0,i)));return Math.floor(o()*g)}async function z({attemptStream:i,stopped:r,follow:n,logger:o,sleep:g=d=>new Promise(l=>setTimeout(l,d)),exit:a=d=>{throw new Error(`exit:${d}`)},backoff:u=M,notFoundPollMs:s=5e3}){let d=0,l=!1;for(;!r.value;){let f;try{f=await i(),d=0}catch(c){if(c.name==="AbortError"||r.value)return{reason:"aborted"};if(l||(o.error(` SSE Error: ${c.message}`),n&&o.gray(" Reconnecting..."),l=!0),!n)return a("error")??{reason:"error"};let y=u(d);d++,await g(y);continue}if(f.aborted||r.value)return{reason:"aborted"};if(f.notFound){if(n){l||(o.yellow(" No executions found yet. Waiting for workflow to be triggered..."),o.gray(" Press Ctrl+C to stop."),l=!0),await g(s);continue}return o.yellow(`
19
14
  No executions found for this workflow. Trigger the workflow first.
20
- `)),process.exit(1);if(r.failed){console.log(e.red(`
21
- Execution failed.`)),t||process.exit(1);return}if(r.completed&&process.exit(0),t&&!l.value)return console.log(e.gray(`
22
- Connection ended, reconnecting...
23
- `)),E({token:s,jobId:n,follow:t,projectId:null})}catch(r){if(r.name==="AbortError"||l.value)return;if(console.error(e.red(` SSE Error: ${r.message}`)),t&&!l.value)return console.log(e.gray(`
24
- Reconnecting...
25
- `)),E({token:s,jobId:n,follow:t,projectId:null})}}async function v({token:s,projectId:n,jobId:t,follow:c,limit:f}){let l=n?`${I}/logs/${n}/${t}`:`${I}/job/${t}`,g=null,r=0,p=new Set,y=!1,w=0,$=5,h=()=>{y=!0,console.log(e.gray(`
15
+ `),a("notFound")??{reason:"notFound"}}if(l&&(o.gray(` Reconnected.
16
+ `),l=!1),f.failed)return o.red(`
17
+ Execution failed.`),n?{reason:"failed"}:a("failed")??{reason:"failed"};if(f.completed)return a("completed")??{reason:"completed"};if(!n)return{reason:"disconnected"}}return{reason:"stopped"}}async function L({token:i,jobId:r,follow:n,projectId:o}){console.log(e.gray(` Streaming logs for workflow ${e.cyan(r)}...`)),console.log(n?e.gray(` Press Ctrl+C to stop.
18
+ `):"");let g=await _(i);if(!g)return console.log(e.yellow(` SSE endpoint not configured, using CloudWatch polling...
19
+ `)),T({token:i,projectId:null,jobId:r,follow:n,limit:1e5});let a={value:!1},u=()=>{a.value=!0,console.log(e.gray(`
20
+ Stopped streaming.
21
+ `)),process.exit(0)};process.on("SIGINT",u),process.on("SIGTERM",u),await z({attemptStream:()=>J({token:i,executionId:r,sseEndpoint:g,stopped:a}),stopped:a,follow:n,logger:{gray:s=>console.log(e.gray(s)),red:s=>console.log(e.red(s)),yellow:s=>console.log(e.yellow(s)),error:s=>console.error(e.red(s))},exit:s=>{s==="completed"&&process.exit(0),(s==="error"||s==="notFound"||s==="failed")&&process.exit(1)}})}async function T({token:i,projectId:r,jobId:n,follow:o,limit:g}){let a=r?`${x}/logs/${r}/${n}`:`${x}/job/${n}`,u=null,s=0,d=new Set,l=!1,f=0,c=5,y=()=>{l=!0,console.log(e.gray(`
26
22
  Stopped tailing.
27
- `)),process.exit(0)};for(process.on("SIGINT",h),process.on("SIGTERM",h),console.log(e.gray(` Fetching logs for workflow ${e.cyan(t)}...`)),console.log(c?e.gray(` Press Ctrl+C to stop.
28
- `):"");!y;)try{let d=new URLSearchParams({limit:String(f)});g&&d.set("nextToken",g);let o=await P(`${l}?${d}`,s);w=0,o.message&&o.lines?.length===0&&r===0&&console.log(e.gray(` ${o.message}`)),o.status==="starting"&&o.lines?.length===0&&r===0&&console.log(e.gray(" Container starting..."));for(let i of o.lines||[]){let b=`${i.timestamp}:${i.message}`;if(p.has(b))continue;p.add(b);let x=e.gray(k(i.timestamp)),N=o.taskId?e.gray(`(${o.taskId.slice(-8)}) `):"";console.log(`${x} ${N}${i.message.replace(/\n$/,"")}`)}if(r=o.lines?.length>0?0:r+1,g=o.nextForwardToken||null,o.status==="completed"||o.status==="failed"){let i=o.status==="completed"?e.green:e.red;console.log(i(`
29
- Job ${o.status}.`)),process.exit(o.status==="completed"?0:1)}if(!c){o.status&&console.log(e.gray(`
30
- Status: ${o.status}`));break}let m=o.lines?.length>0?500:r>5?5e3:2e3;await new Promise(i=>setTimeout(i,m))}catch(d){if(d.name==="AbortError")break;d.message.match(/API (400|401|403|404):/)&&(console.error(e.red(`
31
- ${d.message}
32
- `)),process.exit(1)),w++,console.error(e.red(` Error: ${d.message}`)),w>=$&&(console.error(e.red(`
33
- Too many consecutive errors (${$}). Stopping.
34
- `)),process.exit(1)),c||process.exit(1),await new Promise(a=>setTimeout(a,3e3))}}async function L({token:s,projectId:n,workflow:t,follow:c,limit:f}){let l=`${I}/all/${n}`,g=null,r=0,p=new Set,y=null,w=!1,$=0,h=5,d=()=>{w=!0,console.log(e.gray(`
23
+ `)),process.exit(0)};for(process.on("SIGINT",y),process.on("SIGTERM",y),console.log(e.gray(` Fetching logs for workflow ${e.cyan(n)}...`)),console.log(o?e.gray(` Press Ctrl+C to stop.
24
+ `):"");!l;)try{let w=new URLSearchParams({limit:String(g)});u&&w.set("nextToken",u);let t=await E(`${a}?${w}`,i);f=0,t.message&&t.lines?.length===0&&s===0&&console.log(e.gray(` ${t.message}`)),t.status==="starting"&&t.lines?.length===0&&s===0&&console.log(e.gray(" Container starting..."));for(let p of t.lines||[]){let $=`${p.timestamp}:${p.message}`;if(d.has($))continue;d.add($);let I=e.gray(k(p.timestamp)),P=t.taskId?e.gray(`(${t.taskId.slice(-8)}) `):"";console.log(`${I} ${P}${p.message.replace(/\n$/,"")}`)}if(s=t.lines?.length>0?0:s+1,u=t.nextForwardToken||null,t.status==="completed"||t.status==="failed"){let p=t.status==="completed"?e.green:e.red;console.log(p(`
25
+ Job ${t.status}.`)),process.exit(t.status==="completed"?0:1)}if(!o){t.status&&console.log(e.gray(`
26
+ Status: ${t.status}`));break}let S=t.lines?.length>0?500:s>5?5e3:2e3;await new Promise(p=>setTimeout(p,S))}catch(w){if(w.name==="AbortError")break;w.message.match(/API (400|401|403|404):/)&&(console.error(e.red(`
27
+ ${w.message}
28
+ `)),process.exit(1)),f++,console.error(e.red(` Error: ${w.message}`)),f>=c&&(console.error(e.red(`
29
+ Too many consecutive errors (${c}). Stopping.
30
+ `)),process.exit(1)),o||process.exit(1),await new Promise(m=>setTimeout(m,3e3))}}async function U({token:i,projectId:r,workflow:n,follow:o,limit:g}){let a=`${x}/all/${r}`,u=null,s=0,d=new Set,l=null,f=!1,c=0,y=5,w=()=>{f=!0,console.log(e.gray(`
35
31
  Stopped tailing.
36
- `)),process.exit(0)};for(process.on("SIGINT",d),process.on("SIGTERM",d),console.log(e.gray(`
37
- Tailing all runs for ${e.cyan(t)}...`)),console.log(c?e.gray(` Press Ctrl+C to stop.
38
- `):"");!w;)try{let o=new URLSearchParams({workflow:t,limit:String(f)});g&&o.set("nextToken",g);let a=await P(`${l}?${o}`,s);$=0,a.message&&a.lines?.length===0&&r===0&&console.log(e.gray(` ${a.message}`));for(let i of a.lines||[]){let b=`${i.timestamp}:${i.jobId}:${i.message}`;if(p.has(b))continue;p.add(b),i.jobId!==y&&(y!==null&&console.log(""),console.log(e.dim(` \u2500\u2500 ${i.jobId} \u2500\u2500`)),y=i.jobId);let x=e.gray(k(i.timestamp));console.log(`${x} ${i.message.replace(/\n$/,"")}`)}if(r=a.lines?.length>0?0:r+1,g=a.nextToken||null,!c){g&&console.log(e.gray(`
39
- ... more logs available. Run again or use --follow to stream.`)),a.jobCount&&console.log(e.gray(` ${a.jobCount} job(s) found.`));break}if(!a.hasRunning&&!g&&r>2){console.log(e.gray(`
40
- No running jobs. All caught up.`));break}let m=a.lines?.length>0?500:r>5?5e3:2e3;await new Promise(i=>setTimeout(i,m))}catch(o){if(o.name==="AbortError")break;o.message.match(/API (400|401|403|404):/)&&(console.error(e.red(`
41
- ${o.message}
42
- `)),process.exit(1)),$++,console.error(e.red(` Error: ${o.message}`)),$>=h&&(console.error(e.red(`
43
- Too many consecutive errors (${h}). Stopping.
44
- `)),process.exit(1)),c||process.exit(1),await new Promise(u=>setTimeout(u,3e3))}}async function F(s,n){let{token:t,projectId:c}=J(n),f=n.follow===!0,l=n.lines?parseInt(n.lines,10):1e5;if(n.all){let r=n.workflow;return r||(console.log(e.red(`
32
+ `)),process.exit(0)};for(process.on("SIGINT",w),process.on("SIGTERM",w),console.log(e.gray(`
33
+ Tailing all runs for ${e.cyan(n)}...`)),console.log(o?e.gray(` Press Ctrl+C to stop.
34
+ `):"");!f;)try{let t=new URLSearchParams({workflow:n,limit:String(g)});u&&t.set("nextToken",u);let m=await E(`${a}?${t}`,i);c=0,m.message&&m.lines?.length===0&&s===0&&console.log(e.gray(` ${m.message}`));for(let p of m.lines||[]){let $=`${p.timestamp}:${p.jobId}:${p.message}`;if(d.has($))continue;d.add($),p.jobId!==l&&(l!==null&&console.log(""),console.log(e.dim(` \u2500\u2500 ${p.jobId} \u2500\u2500`)),l=p.jobId);let I=e.gray(k(p.timestamp));console.log(`${I} ${p.message.replace(/\n$/,"")}`)}if(s=m.lines?.length>0?0:s+1,u=m.nextToken||null,!o){u&&console.log(e.gray(`
35
+ ... more logs available. Run again or use --follow to stream.`)),m.jobCount&&console.log(e.gray(` ${m.jobCount} job(s) found.`));break}if(!m.hasRunning&&!u&&s>2){console.log(e.gray(`
36
+ No running jobs. All caught up.`));break}let S=m.lines?.length>0?500:s>5?5e3:2e3;await new Promise(p=>setTimeout(p,S))}catch(t){if(t.name==="AbortError")break;t.message.match(/API (400|401|403|404):/)&&(console.error(e.red(`
37
+ ${t.message}
38
+ `)),process.exit(1)),c++,console.error(e.red(` Error: ${t.message}`)),c>=y&&(console.error(e.red(`
39
+ Too many consecutive errors (${y}). Stopping.
40
+ `)),process.exit(1)),o||process.exit(1),await new Promise(h=>setTimeout(h,3e3))}}async function H(i,r){let{token:n,projectId:o}=A(r),g=r.follow===!0,a=r.lines?parseInt(r.lines,10):1e5;if(r.all){let s=r.workflow;return s||(console.log(e.red(`
45
41
  --workflow is required with --all`)),console.log(e.gray(` Example: zibby workflow logs --workflow ticket-triage --all --project <id>
46
- `)),process.exit(1)),L({token:t,projectId:c,workflow:r,follow:f,limit:l})}let g=await z(s,n,t,c);return f?E({token:t,jobId:g,follow:f,projectId:c}):v({token:t,projectId:c,jobId:g,follow:!1,limit:l})}export{F as logsCommand};
42
+ `)),process.exit(1)),U({token:n,projectId:o,workflow:s,follow:g,limit:a})}let u=await O(i,r,n,o);return g?L({token:n,jobId:u,follow:g,projectId:o}):T({token:n,projectId:o,jobId:u,follow:!1,limit:a})}export{H as logsCommand,F as parseSseChunk,z as runReconnectLoop,M as sseBackoffMs};
@@ -0,0 +1,2 @@
1
+ function u({workflowType:o,jobId:e,projectId:t,agentType:r,model:a}){let n="\u2500".repeat(60),l=`${r||"default"} (model: ${a||"auto"})`;return["",n,` Workflow: ${o}`,` Job: ${e||"local"}`,` Project: ${t||"none"}`,` Agent: ${l}`,n].join(`
2
+ `)}export{u as formatRunBanner};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{mkdirSync as K,writeFileSync as q,existsSync as p}from"fs";import{join as g,dirname as X,resolve as F}from"path";import{pathToFileURL as U}from"url";import{execSync as V,spawn as L}from"node:child_process";import{SQSClient as Q,SendMessageCommand as J}from"@aws-sdk/client-sqs";var b=null;function j(){return b||(b=new Q({region:process.env.AWS_REGION||"ap-southeast-2"})),b}async function N(i,{status:e,error:n}){let{EXECUTION_ID:s,SQS_AUTH_TOKEN:a,PROGRESS_API_URL:r,PROGRESS_QUEUE_URL:o,PROJECT_API_TOKEN:f}=i;if(!s)return;let l={executionId:s,...a&&{sqsAuthToken:a},status:e,...n&&{error:n},timestamp:new Date().toISOString()},d=r?"HTTP":o?"SQS":"NONE",u=JSON.stringify(l).length;console.log(`Sending final status: ${e} via ${d} (${(u/1024).toFixed(1)}KB)`);try{if(r)await H(r,s,l,f);else if(o){let c=["completed","failed","insufficient_context","blocked"].includes(e)?"execution_completed":"progress_update";await M(o,s,l,c)}else{console.warn("No transport configured for final status \u2014 neither PROGRESS_API_URL nor PROGRESS_QUEUE_URL set");return}console.log(`Final status ${e} sent via ${d}`)}catch(c){console.error(`Failed to send final status (${e}) via ${d}:`),console.error(` Payload: ${(u/1024).toFixed(1)}KB`),console.error(` Error: ${c.message}`),c.name&&console.error(` Error type: ${c.name}`),c.code&&console.error(` Error code: ${c.code}`)}}async function H(i,e,n,s){let a=`${i}/${e}/progress`,r={"Content-Type":"application/json"};s&&(r.Authorization=`Bearer ${s}`);let o=await fetch(a,{method:"POST",headers:r,body:JSON.stringify(n)});if(!o.ok){let f=await o.text();throw new Error(`HTTP ${o.status}: ${f}`)}}async function M(i,e,n,s="progress_update"){let a=JSON.stringify(n),r=(a.length/1024).toFixed(1);a.length>256*1024&&console.error(`\u274C SQS message too large: ${r}KB (limit 256KB) for ${e} [${s}]`),await j().send(new J({QueueUrl:i,MessageBody:a,MessageGroupId:e,MessageAttributes:{executionId:{DataType:"String",StringValue:e},messageType:{DataType:"String",StringValue:s}}}))}import"@zibby/core";var P=process.env.WORKSPACE||"/workspace";async function Y(i,e){K(e,{recursive:!0});let n=Date.now();console.log("Fetching pre-built bundle (streaming curl \u2192 tar)...");let s=setInterval(()=>{let r=((Date.now()-n)/1e3).toFixed(1);console.log(` ...still extracting (${r}s elapsed)`)},3e3);try{await new Promise((r,o)=>{let f=L("curl",["-fsSL",i],{stdio:["ignore","pipe","inherit"]}),l=L("tar",["-xzf","-","-C",e],{stdio:["pipe","inherit","inherit"]});f.stdout.pipe(l.stdin);let d,u,c=()=>{if(d!==void 0&&u!==void 0){if(d!==0)return o(new Error(`curl exited ${d}`));if(u!==0)return o(new Error(`tar exited ${u}`));r()}};f.on("close",w=>{d=w,c()}),l.on("close",w=>{u=w,c()}),f.on("error",o),l.on("error",o)})}finally{clearInterval(s)}let a=((Date.now()-n)/1e3).toFixed(1);return console.log(` Bundle extracted in ${a}s`),e}async function W(){let i=process.env.WORKFLOW_SOURCES_URL;if(!i)throw new Error("WORKFLOW_SOURCES_URL env var is required");console.log("Fetching workflow sources via pre-signed URL...");let e=await fetch(i);if(!e.ok)throw new Error(`Failed to fetch sources: ${e.status} ${e.statusText}`);let n=await e.json();if(!n.sources||typeof n.sources!="object")throw new Error('Invalid sources payload \u2014 missing "sources" map');return n}function Z(i,e){let n=F(e),s=0;for(let[a,r]of Object.entries(i)){let o=F(e,a);if(!o.startsWith(`${n}/`)&&o!==n){console.error(` \u26D4 Skipping unsafe path: ${a}`);continue}K(X(o),{recursive:!0}),q(o,r,"utf-8"),s++}return s}async function ee(i,e){let n=g(i,"graph.mjs");if(!p(n))throw new Error(`graph.mjs not found at ${n}`);let s=await import(U(n).href),a=e?.entryClass,r=a&&s[a]||s.default||Object.values(s).find(o=>typeof o=="function"&&o.prototype?.buildGraph);if(!r)throw new Error("No WorkflowAgent class found in graph.mjs");return r}async function de(){if(!process.env.NODE_PATH){process.env.NODE_PATH="/opt/zibby/packages";let t=await import("module");t.default._initPaths&&t.default._initPaths()}let{WORKFLOW_JOB_ID:i,WORKFLOW_TYPE:e,PROJECT_ID:n,AGENT_TYPE:s,MODEL:a}=process.env;e||(console.error("Missing WORKFLOW_TYPE env var"),process.exit(1)),console.log(`
3
- Zibby Custom Workflow Runner`),console.log(` Job: ${i||"local"}`),console.log(` Workflow: ${e}`),console.log(` Project: ${n||"none"}`),console.log(` Agent: ${s||"default"}`),console.log(` Model: ${a||"auto"}`),console.log("\u2500".repeat(60));let r=process.env.WORKFLOW_BUNDLE_URL,o,f={},l,d;if(r){l=e,o=g(P,".zibby","workflows",l);try{await Y(r,o),console.log(" Extracted pre-built bundle (no npm install needed)");try{let t=await W();f=t.input||{},d=t.version}catch(t){console.warn(` Could not fetch input payload: ${t.message}`)}}catch(t){console.warn(` Bundle extract failed (${t.message}); falling back to source install`),o=null}}if(!o){let t=await W(),{sources:h,input:m,workflowType:O,version:y}=t;f=m||{},l=O||e,d=y,console.log(` Workflow v${d||"?"} \u2014 ${Object.keys(h).length} source files`),o=g(P,".zibby","workflows",l);let $=Z(h,o);console.log(` Wrote ${$} files to ${o}`),console.log(" Installing dependencies...");try{V("npm install --silent --no-audit --no-fund",{cwd:o,stdio:"inherit"}),console.log(" Dependencies installed")}catch(R){console.warn(` npm install failed: ${R.message}`)}}let u={},c=g(o,"workflow.json");if(p(c)){let{readFileSync:t}=await import("fs");u=JSON.parse(t(c,"utf-8"))}let w=await ee(o,u);console.log(` Loaded ${w.name}`);let{readdirSync:D}=await import("fs"),S=[],x=g(o,"node_modules","@zibby","agent-workflow"),A=g(o,"node_modules","@zibby","core","node_modules","@zibby","agent-workflow");p(x)&&S.push({kind:"hoisted",path:x}),p(A)&&S.push({kind:"nested",path:A}),console.log(` [diag] @zibby/agent-workflow copies in bundle: ${S.length}`);for(let t of S)console.log(` [diag] ${t.kind}: ${t.path}`);try{let t=g(o,"node_modules","@zibby");p(t)&&console.log(` [diag] node_modules/@zibby/ contents: [${D(t).join(", ")}]`)}catch{}let k=g(o,"node_modules","@zibby","core","dist","index.js");if(p(k)&&S.length>0)try{let t=await import(U(k).href),h=[t.AssistantStrategy,t.CursorAgentStrategy,t.ClaudeAgentStrategy,t.CodexAgentStrategy,t.GeminiAgentStrategy].filter(Boolean);for(let m of S){let O=g(m.path,"dist","index.js");if(!p(O))continue;let y=await import(U(O).href),$=y.listStrategies();for(let v of h)try{y.registerStrategy(new v)}catch(z){console.warn(` [diag] register ${v.name} into ${m.kind} failed: ${z.message}`)}let R=y.listStrategies();console.log(` [diag] ${m.kind} registry: before=[${$.join(",")||"empty"}] after=[${R.join(",")||"empty"}]`)}console.log(" Registered built-in agent strategies (cursor/claude/codex/gemini/assistant)")}catch(t){console.warn(` Failed to bridge strategies into bundle: ${t.message}`)}else console.warn(" No @zibby/core or @zibby/agent-workflow in bundle \u2014 agent strategies may be unavailable");let B=Date.now(),E=new w({workflow:l||e}),C=E.buildGraph(),G={input:f||{},cwd:P,runId:i||`run-${Date.now()}`};console.log(`
4
- Running graph (${C.nodes?.size||"?"} nodes)...
5
- `);let _;try{_=await C.run(E,G)}catch(t){console.error(`
6
- Workflow execution failed: ${t.message}`),console.error(t.stack),await T("failed",t.message),process.exit(1)}let I=((Date.now()-B)/1e3).toFixed(1);_?.success!==!1?(console.log(`
7
- Workflow "${l||e}" completed in ${I}s`),await T("completed")):(console.error(`
8
- Workflow "${l||e}" failed after ${I}s`),await T("failed",_?.error||"Workflow execution failed"),process.exit(1)),E.onComplete&&await E.onComplete(_)}async function T(i,e=null){let n={EXECUTION_ID:process.env.WORKFLOW_JOB_ID,PROGRESS_API_URL:process.env.PROGRESS_API_URL,PROGRESS_QUEUE_URL:process.env.PROGRESS_QUEUE_URL,PROJECT_API_TOKEN:process.env.PROJECT_API_TOKEN,SQS_AUTH_TOKEN:process.env.SQS_AUTH_TOKEN};if(n.EXECUTION_ID)try{await N(n,{status:i,...e&&{error:e}})}catch(s){console.error(`\u26A0\uFE0F Failed to report status: ${s.message}`)}}export{de as runWorkflowCommand};
2
+ import{mkdirSync as W,writeFileSync as Y,existsSync as w}from"fs";import{join as g,dirname as Z,resolve as B}from"path";import{pathToFileURL as A}from"url";import{execSync as ee,spawn as D}from"node:child_process";import{SQSClient as H,SendMessageCommand as M}from"@aws-sdk/client-sqs";var P=null;function q(){return P||(P=new H({region:process.env.AWS_REGION||"ap-southeast-2"})),P}async function F(i,{status:e,error:o}){let{EXECUTION_ID:n,SQS_AUTH_TOKEN:c,PROGRESS_API_URL:r,PROGRESS_QUEUE_URL:s,PROJECT_API_TOKEN:a}=i;if(!n)return;let f={executionId:n,...c&&{sqsAuthToken:c},status:e,...o&&{error:o},timestamp:new Date().toISOString()},l=r?"HTTP":s?"SQS":"NONE",u=JSON.stringify(f).length;console.log(`Sending final status: ${e} via ${l} (${(u/1024).toFixed(1)}KB)`);try{if(r)await X(r,n,f,a);else if(s){let d=["completed","failed","insufficient_context","blocked"].includes(e)?"execution_completed":"progress_update";await V(s,n,f,d)}else{console.warn("No transport configured for final status \u2014 neither PROGRESS_API_URL nor PROGRESS_QUEUE_URL set");return}console.log(`Final status ${e} sent via ${l}`)}catch(d){console.error(`Failed to send final status (${e}) via ${l}:`),console.error(` Payload: ${(u/1024).toFixed(1)}KB`),console.error(` Error: ${d.message}`),d.name&&console.error(` Error type: ${d.name}`),d.code&&console.error(` Error code: ${d.code}`)}}async function X(i,e,o,n){let c=`${i}/${e}/progress`,r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);let s=await fetch(c,{method:"POST",headers:r,body:JSON.stringify(o)});if(!s.ok){let a=await s.text();throw new Error(`HTTP ${s.status}: ${a}`)}}async function V(i,e,o,n="progress_update"){let c=JSON.stringify(o),r=(c.length/1024).toFixed(1);c.length>256*1024&&console.error(`\u274C SQS message too large: ${r}KB (limit 256KB) for ${e} [${n}]`),await q().send(new M({QueueUrl:i,MessageBody:c,MessageGroupId:e,MessageAttributes:{executionId:{DataType:"String",StringValue:e},messageType:{DataType:"String",StringValue:n}}}))}function L({workflowType:i,jobId:e,projectId:o,agentType:n,model:c}){let r="\u2500".repeat(60),s=`${n||"default"} (model: ${c||"auto"})`;return["",r,` Workflow: ${i}`,` Job: ${e||"local"}`,` Project: ${o||"none"}`,` Agent: ${s}`,r].join(`
3
+ `)}import"@zibby/core";var T=process.env.WORKSPACE||"/workspace";async function oe(i,e){W(e,{recursive:!0});let o=Date.now();console.log("[setup] Fetching bundle...");let n=setInterval(()=>{let r=((Date.now()-o)/1e3).toFixed(1);console.log(`[setup] still fetching (${r}s elapsed)`)},3e3);try{await new Promise((r,s)=>{let a=D("curl",["-fsSL",i],{stdio:["ignore","pipe","inherit"]}),f=D("tar",["-xzf","-","-C",e],{stdio:["pipe","inherit","inherit"]});a.stdout.pipe(f.stdin);let l,u,d=()=>{if(l!==void 0&&u!==void 0){if(l!==0)return s(new Error(`curl exited ${l}`));if(u!==0)return s(new Error(`tar exited ${u}`));r()}};a.on("close",S=>{l=S,d()}),f.on("close",S=>{u=S,d()}),a.on("error",s),f.on("error",s)})}finally{clearInterval(n)}let c=((Date.now()-o)/1e3).toFixed(1);return console.log(`[setup] Bundle extracted (${c}s)`),e}async function K(){let i=process.env.WORKFLOW_SOURCES_URL;if(!i)throw new Error("WORKFLOW_SOURCES_URL env var is required");let e=await fetch(i);if(!e.ok)throw new Error(`Failed to fetch sources: ${e.status} ${e.statusText}`);let o=await e.json();if(!o.sources||typeof o.sources!="object")throw new Error('Invalid sources payload \u2014 missing "sources" map');return o}function te(i,e){let o=B(e),n=0;for(let[c,r]of Object.entries(i)){let s=B(e,c);if(!s.startsWith(`${o}/`)&&s!==o){console.error(` \u26D4 Skipping unsafe path: ${c}`);continue}W(Z(s),{recursive:!0}),Y(s,r,"utf-8"),n++}return n}async function ne(i,e){let o=g(i,"graph.mjs");if(!w(o))throw new Error(`graph.mjs not found at ${o}`);let n=await import(A(o).href),c=e?.entryClass,r=c&&n[c]||n.default||Object.values(n).find(s=>typeof s=="function"&&s.prototype?.buildGraph);if(!r)throw new Error("No WorkflowAgent class found in graph.mjs");return r}async function ge(){if(!process.env.NODE_PATH){process.env.NODE_PATH="/opt/zibby/packages";let t=await import("module");t.default._initPaths&&t.default._initPaths()}let{WORKFLOW_JOB_ID:i,WORKFLOW_TYPE:e,PROJECT_ID:o,AGENT_TYPE:n,MODEL:c}=process.env;e||(console.error("Missing WORKFLOW_TYPE env var"),process.exit(1));let r=L({workflowType:e,jobId:i,projectId:o,agentType:n,model:c});console.log(r);let s=process.env.WORKFLOW_BUNDLE_URL,a,f={},l,u;if(s){l=e,a=g(T,".zibby","workflows",l);try{await oe(s,a);try{let t=await K();f=t.input||{},u=t.version}catch(t){console.warn(`[setup] Could not fetch input payload: ${t.message}`)}}catch(t){console.warn(`[setup] Bundle extract failed (${t.message}); falling back to source install`),a=null}}if(!a){let t=await K(),{sources:p,input:y,workflowType:O,version:E}=t;f=y||{},l=O||e,u=E,console.log(`[setup] Workflow v${u||"?"} (${Object.keys(p).length} files)`),a=g(T,".zibby","workflows",l);let b=te(p,a);console.log(`[setup] Wrote ${b} files`),console.log("[setup] Installing dependencies...");try{ee("npm install --silent --no-audit --no-fund",{cwd:a,stdio:"inherit"}),console.log("[setup] Dependencies installed")}catch($){console.warn(`[setup] npm install failed: ${$.message}`)}}let d={},S=g(a,"workflow.json");if(w(S)){let{readFileSync:t}=await import("fs");d=JSON.parse(t(S,"utf-8"))}let I=await ne(a,d);console.log(`[setup] Loaded ${I.name}`);let m=[],x=g(a,"node_modules","@zibby","agent-workflow"),C=g(a,"node_modules","@zibby","core","node_modules","@zibby","agent-workflow");w(x)&&m.push({kind:"hoisted",path:x}),w(C)&&m.push({kind:"nested",path:C});let R=process.env.ZIBBY_RUN_DIAG==="1";if(R){let{readdirSync:t}=await import("fs");console.log(` [diag] @zibby/agent-workflow copies in bundle: ${m.length}`);for(let p of m)console.log(` [diag] ${p.kind}: ${p.path}`);try{let p=g(a,"node_modules","@zibby");w(p)&&console.log(` [diag] node_modules/@zibby/ contents: [${t(p).join(", ")}]`)}catch{}}let k=g(a,"node_modules","@zibby","core","dist","index.js");if(w(k)&&m.length>0)try{let t=await import(A(k).href),p=[t.AssistantStrategy,t.CursorAgentStrategy,t.ClaudeAgentStrategy,t.CodexAgentStrategy,t.GeminiAgentStrategy].filter(Boolean);for(let y of m){let O=g(y.path,"dist","index.js");if(!w(O))continue;let E=await import(A(O).href),b=R?E.listStrategies():null;for(let $ of p)try{E.registerStrategy(new $)}catch(J){console.warn(` register ${$.name} into ${y.kind} failed: ${J.message}`)}R&&console.log(` [diag] ${y.kind} registry: before=[${b.join(",")||"empty"}] after=[${E.listStrategies().join(",")||"empty"}]`)}console.log("[setup] Registered 5 agent strategies (assistant, cursor, claude, codex, gemini)")}catch(t){console.warn(`[setup] Failed to bridge strategies: ${t.message}`)}else console.warn("[setup] No @zibby/core or @zibby/agent-workflow in bundle \u2014 agent strategies may be unavailable");let G=Date.now(),_=new I({workflow:l||e}),z=_.buildGraph(),Q={input:f||{},cwd:T,runId:i||`run-${Date.now()}`};console.log("");let h;try{h=await z.run(_,Q)}catch(t){console.error(`
4
+ Workflow execution failed: ${t.message}`),console.error(t.stack),await U("failed",t.message),process.exit(1)}let v=((Date.now()-G)/1e3).toFixed(1),j=h?.success!==!1,N=l||e;j?(console.log(`
5
+ [done] ${N} completed in ${v}s`),await U("completed")):(console.error(`
6
+ [done] ${N} failed after ${v}s`),await U("failed",h?.error||"Workflow execution failed"),process.exit(1)),_.onComplete&&await _.onComplete(h)}async function U(i,e=null){let o={EXECUTION_ID:process.env.WORKFLOW_JOB_ID,PROGRESS_API_URL:process.env.PROGRESS_API_URL,PROGRESS_QUEUE_URL:process.env.PROGRESS_QUEUE_URL,PROJECT_API_TOKEN:process.env.PROJECT_API_TOKEN,SQS_AUTH_TOKEN:process.env.SQS_AUTH_TOKEN};if(o.EXECUTION_ID)try{await F(o,{status:i,...e&&{error:e}})}catch(n){console.error(`\u26A0\uFE0F Failed to report status: ${n.message}`)}}export{ge as runWorkflowCommand};
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.85",
3
+ "version": "0.1.90",
4
4
  "description": "Zibby CLI - Test automation generator and runner",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "build": "node ../scripts/build.mjs --extra-dirs bin",
11
- "test": "vitest run test/auth*.test.js test/two-layer-auth.test.js test/trigger-params.test.js test/trigger-helpers.test.js test/deploy-helpers.test.js test/cli-namespace-consistency.test.js test/cli-workflow-subcommands.test.js test/run-bundle-core-import.test.js test/start-respects-config.test.js",
11
+ "test": "vitest run test/auth*.test.js test/two-layer-auth.test.js test/trigger-params.test.js test/trigger-helpers.test.js test/deploy-helpers.test.js test/cli-namespace-consistency.test.js test/cli-workflow-subcommands.test.js test/run-bundle-core-import.test.js test/start-respects-config.test.js test/sse-backoff.test.js test/sse-reconnect-loop.test.js test/run-helpers.test.js test/sse-parser.test.js",
12
12
  "test:unit": "vitest run src/",
13
13
  "test:auth": "vitest run test/auth*.test.js test/two-layer-auth.test.js",
14
14
  "lint": "eslint .",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-sqs": "^3.1038.0",
36
36
  "@zibby/agent-workflow": "^0.1.2",
37
- "@zibby/core": "^0.1.47",
37
+ "@zibby/core": "^0.1.48",
38
38
  "@zibby/memory": "^0.1.5",
39
39
  "@zibby/skills": "^0.1.11",
40
40
  "adm-zip": "^0.5.17",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.85",
3
+ "version": "0.1.90",
4
4
  "description": "Zibby CLI - Test automation generator and runner",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "build": "node ../scripts/build.mjs --extra-dirs bin",
11
- "test": "vitest run test/auth*.test.js test/two-layer-auth.test.js test/trigger-params.test.js test/trigger-helpers.test.js test/deploy-helpers.test.js test/cli-namespace-consistency.test.js test/cli-workflow-subcommands.test.js test/run-bundle-core-import.test.js test/start-respects-config.test.js",
11
+ "test": "vitest run test/auth*.test.js test/two-layer-auth.test.js test/trigger-params.test.js test/trigger-helpers.test.js test/deploy-helpers.test.js test/cli-namespace-consistency.test.js test/cli-workflow-subcommands.test.js test/run-bundle-core-import.test.js test/start-respects-config.test.js test/sse-backoff.test.js test/sse-reconnect-loop.test.js test/run-helpers.test.js test/sse-parser.test.js",
12
12
  "test:unit": "vitest run src/",
13
13
  "test:auth": "vitest run test/auth*.test.js test/two-layer-auth.test.js",
14
14
  "lint": "eslint .",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-sqs": "^3.1038.0",
36
36
  "@zibby/agent-workflow": "^0.1.2",
37
- "@zibby/core": "^0.1.47",
37
+ "@zibby/core": "^0.1.48",
38
38
  "@zibby/memory": "^0.1.5",
39
39
  "@zibby/skills": "^0.1.11",
40
40
  "adm-zip": "^0.5.17",