@zibby/cli 0.1.95 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import h from"ora";import{select as v}from"@inquirer/prompts";import{readFileSync as x,existsSync as N}from"fs";import{homedir as R}from"os";import{join as T}from"path";var u={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 g(){let o;if(process.env.ZIBBY_API_URL)o=process.env.ZIBBY_API_URL;else{let e=process.env.ZIBBY_ENV||"prod";u[e]?o=u[e].apiUrl:o=u.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)`),u.prod.apiUrl):o}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${o}`),u.prod.apiUrl}}var b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function y(o){return o?b.test(o)?{ok:!0}:{ok:!1,error:`'${o}' is not a UUID. Cloud workflows are identified by UUID only. Run \`zibby workflow list\` to find yours, or run \`zibby workflow trigger\` with no argument for interactive selection.`}:{ok:!0}}import{existsSync as j,readFileSync as _}from"fs";import{resolve as B}from"path";function I(o){return o==="true"?!0:o==="false"?!1:o==="null"?null:o!==""&&!isNaN(Number(o))?Number(o):o}function $(o){let e={};for(let r of o||[]){let i=r.indexOf("=");if(i===-1){console.warn(` Warning: ignored param "${r}" \u2014 expected key=value format`);continue}let t=r.slice(0,i).trim(),n=I(r.slice(i+1)),l=t.split("."),c=e;for(let s=0;s<l.length-1;s++)(typeof c[l[s]]!="object"||c[l[s]]===null)&&(c[l[s]]={}),c=c[l[s]];c[l[l.length-1]]=n}return e}function E(o){let e=B(o);j(e)||(console.log(`
1
+ import h from"ora";import{select as v}from"@inquirer/prompts";import{readFileSync as x,existsSync as N}from"fs";import{homedir as R}from"os";import{join as T}from"path";var u={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.dev",description:"Production environment"}};function g(){let o;if(process.env.ZIBBY_API_URL)o=process.env.ZIBBY_API_URL;else{let e=process.env.ZIBBY_ENV||"prod";u[e]?o=u[e].apiUrl:o=u.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)`),u.prod.apiUrl):o}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${o}`),u.prod.apiUrl}}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function m(o){return o?k.test(o)?{ok:!0}:{ok:!1,error:`'${o}' is not a UUID. Cloud workflows are identified by UUID only. Run \`zibby workflow list\` to find yours, or run \`zibby workflow trigger\` with no argument for interactive selection.`}:{ok:!0}}import{existsSync as j,readFileSync as _}from"fs";import{resolve as B}from"path";function I(o){return o==="true"?!0:o==="false"?!1:o==="null"?null:o!==""&&!isNaN(Number(o))?Number(o):o}function $(o){let e={};for(let r of o||[]){let c=r.indexOf("=");if(c===-1){console.warn(` Warning: ignored param "${r}" \u2014 expected key=value format`);continue}let t=r.slice(0,c).trim(),n=I(r.slice(c+1)),i=t.split("."),l=e;for(let s=0;s<i.length-1;s++)(typeof l[i[s]]!="object"||l[i[s]]===null)&&(l[i[s]]={}),l=l[i[s]];l[i[i.length-1]]=n}return e}function E(o){let e=B(o);j(e)||(console.log(`
2
2
  Error: --input-file not found: ${o}
3
3
  `),process.exit(1));try{return JSON.parse(_(e,"utf-8"))}catch(r){console.log(`
4
4
  Error: --input-file is not valid JSON: ${r.message}
@@ -6,17 +6,17 @@ import h from"ora";import{select as v}from"@inquirer/prompts";import{readFileSyn
6
6
  Error: --input is not valid JSON`),console.log(` ${r.message}
7
7
  `),process.exit(1)}return o.param?.length&&(e={...e,...$(o.param)}),e}function A(){let o=T(R(),".zibby","config.json");if(N(o))try{let r=JSON.parse(x(o,"utf-8"));if(r.sessionToken)return r.sessionToken}catch{}let e=process.env.ZIBBY_API_KEY;if(e)return e;console.log(`
8
8
  Not authenticated`),console.log(" Run: zibby login"),console.log(` OR set ZIBBY_API_KEY env var (for CI/CD)
9
- `),process.exit(1)}async function D(o){let e=g(),r=h("Fetching projects...").start();try{let i=await fetch(`${e}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});i.ok||(r.fail("Failed to fetch projects"),process.exit(1));let t=await i.json();Array.isArray(t)||(t.projects?t=t.projects:t.data&&(t=t.data)),(!t||t.length===0)&&(r.fail("No projects found"),process.exit(1)),r.succeed(`Found ${t.length} project${t.length===1?"":"s"}`),console.log("");let n=t.map(l=>({name:`${l.name||"Unnamed"} (${l.projectId||l.id})`,value:l.projectId||l.id}));return await v({message:"Select a project:",choices:n})}catch(i){r.fail(`Error: ${i.message}`),process.exit(1)}}async function P(o,e){let r=g(),i=h("Fetching deployed workflows...").start();try{let t=["analysis","implementation","run_test"],n=[];for(let c of t){let s=await fetch(`${r}/projects/${o}/workflows/${c}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(s.ok){let a=await s.json();a.graph&&n.push({name:c,version:a.version||0,isDefault:a.isDefault!==!1})}}n.length===0&&(i.fail("No deployed workflows found for this project"),process.exit(1)),i.succeed(`Found ${n.length} deployed workflow${n.length===1?"":"s"}`),console.log("");let l=n.map(c=>({name:`${c.name} (v${c.version})${c.isDefault?" [default]":""}`,value:c.name}));return await v({message:"Select a workflow to trigger:",choices:l})}catch(t){i.fail(`Error: ${t.message}`),process.exit(1)}}async function M(o,e={}){let r=y(o);r.ok||(console.log(`
9
+ `),process.exit(1)}async function D(o){let e=g(),r=h("Fetching projects...").start();try{let c=await fetch(`${e}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});c.ok||(r.fail("Failed to fetch projects"),process.exit(1));let t=await c.json();Array.isArray(t)||(t.projects?t=t.projects:t.data&&(t=t.data)),(!t||t.length===0)&&(r.fail("No projects found"),process.exit(1)),r.succeed(`Found ${t.length} project${t.length===1?"":"s"}`),console.log("");let n=t.map(i=>({name:`${i.name||"Unnamed"} (${i.projectId||i.id})`,value:i.projectId||i.id}));return await v({message:"Select a project:",choices:n})}catch(c){r.fail(`Error: ${c.message}`),process.exit(1)}}async function P(o,e){let r=g(),c=h("Fetching deployed workflows...").start();try{let t=["analysis","implementation","run_test"],n=[];for(let l of t){let s=await fetch(`${r}/projects/${o}/workflows/${l}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(s.ok){let a=await s.json();a.graph&&n.push({name:l,version:a.version||0,isDefault:a.isDefault!==!1})}}n.length===0&&(c.fail("No deployed workflows found for this project"),process.exit(1)),c.succeed(`Found ${n.length} deployed workflow${n.length===1?"":"s"}`),console.log("");let i=n.map(l=>({name:`${l.name} (v${l.version})${l.isDefault?" [default]":""}`,value:l.name}));return await v({message:"Select a workflow to trigger:",choices:i})}catch(t){c.fail(`Error: ${t.message}`),process.exit(1)}}async function M(o,e={}){let r=m(o);r.ok||(console.log(`
10
10
  Error: ${r.error}
11
- `),process.exit(1));let i=A(),t=e.project||process.env.ZIBBY_PROJECT_ID,n;if(o){let s=g();try{let a=await fetch(`${s}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}});if(a.ok){let d=(await a.json()).projects||[];for(let p of d){let m=await fetch(`${s}/projects/${p.projectId}/workflows`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}});if(m.ok){let w=(await m.json()).find(k=>k.uuid===o);if(w){t=p.projectId,n=w.workflowType||w.name,console.log(`
11
+ `),process.exit(1));let c=A(),t=e.project||process.env.ZIBBY_PROJECT_ID,n;if(o){let s=g();try{let a=await fetch(`${s}/projects`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`}});if(a.ok){let d=(await a.json()).projects||[];for(let p of d){let y=await fetch(`${s}/projects/${p.projectId}/workflows`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`}});if(y.ok){let w=(await y.json()).find(b=>b.uuid===o);if(w){t=p.projectId,n=w.workflowType||w.name,console.log(`
12
12
  \u2713 Found workflow "${n}" (UUID: ${o})
13
13
  `);break}}}(!n||n===o)&&(console.log(`
14
14
  Error: Workflow with UUID "${o}" not found`),console.log(` Check: zibby workflow list
15
15
  `),process.exit(1))}}catch(a){console.log(`
16
16
  Error looking up workflow UUID: ${a.message}
17
- `),process.exit(1)}}t||(console.log(""),t=await D(i)),n||(console.log(""),n=await P(t,i));let l=U(e);if(console.log(`
17
+ `),process.exit(1)}}t||(console.log(""),t=await D(c)),n||(console.log(""),n=await P(t,c));let i=U(e);if(console.log(`
18
18
  Triggering Workflow
19
- `),console.log(" ".padEnd(60,"-")),console.log(` Workflow: ${n}`),console.log(` Project: ${t}`),Object.keys(l).length>0){let s=JSON.stringify(l);console.log(` Input: ${s.length>60?`${s.substring(0,57)}...`:s}`)}e.idempotencyKey&&console.log(` Idempotency: ${e.idempotencyKey}`),console.log(" ".padEnd(60,"-")),console.log("");let c=h("Triggering workflow execution...").start();try{let s=g(),a={input:l};e.idempotencyKey&&(a.idempotencyKey=e.idempotencyKey);let f=await fetch(`${s}/projects/${t}/workflows/${n}/trigger`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(a)});if(!f.ok){let p=await f.json().catch(()=>({}));f.status===429&&(c.fail("Quota exceeded"),console.log(`
20
- Your workflow execution quota has been exceeded`),p.quotaInfo&&(console.log(` Used: ${p.quotaInfo.used}/${p.quotaInfo.limit} executions`),console.log(` Plan: ${p.quotaInfo.planId}`),p.quotaInfo.periodEnd&&console.log(` Resets: ${new Date(p.quotaInfo.periodEnd).toLocaleDateString()}`)),console.log(""),process.exit(1)),c.fail("Trigger failed"),console.log(` Error: ${p.message||f.statusText}
21
- `),process.exit(1)}let d=await f.json();c.succeed("Workflow triggered successfully"),console.log(""),console.log(" Job Details:"),console.log(` Job ID: ${d.jobId}`),console.log(` Status: ${d.status}`),console.log(` Version: ${d.version}`),console.log(` Triggered: ${new Date(d.triggeredAt).toLocaleString()}`),console.log(""),console.log(" Monitor execution:"),o?(console.log(` zibby workflow logs ${o}`),console.log(` zibby workflow logs ${o} -t`)):(console.log(` zibby workflow logs --workflow ${n} --project ${t}`),console.log(` zibby workflow logs --workflow ${n} --project ${t} -t`)),console.log("")}catch(s){c.fail("Trigger failed"),console.log(` Error: ${s.message}
19
+ `),console.log(" ".padEnd(60,"-")),console.log(` Workflow: ${n}`),console.log(` Project: ${t}`),Object.keys(i).length>0){let s=JSON.stringify(i);console.log(` Input: ${s.length>60?`${s.substring(0,57)}...`:s}`)}e.idempotencyKey&&console.log(` Idempotency: ${e.idempotencyKey}`),console.log(" ".padEnd(60,"-")),console.log("");let l=h("Triggering workflow execution...").start();try{let s=g(),a={input:i};e.idempotencyKey&&(a.idempotencyKey=e.idempotencyKey);let f=await fetch(`${s}/projects/${t}/workflows/${n}/trigger`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(a)});if(!f.ok){let p=await f.json().catch(()=>({}));f.status===429&&(l.fail("Quota exceeded"),console.log(`
20
+ Your workflow execution quota has been exceeded`),p.quotaInfo&&(console.log(` Used: ${p.quotaInfo.used}/${p.quotaInfo.limit} executions`),console.log(` Plan: ${p.quotaInfo.planId}`),p.quotaInfo.periodEnd&&console.log(` Resets: ${new Date(p.quotaInfo.periodEnd).toLocaleDateString()}`)),console.log(""),process.exit(1)),l.fail("Trigger failed"),console.log(` Error: ${p.message||f.statusText}
21
+ `),process.exit(1)}let d=await f.json();l.succeed("Workflow triggered successfully"),console.log(""),console.log(" Job Details:"),console.log(` Job ID: ${d.jobId}`),console.log(` Status: ${d.status}`),console.log(` Version: ${d.version}`),console.log(` Triggered: ${new Date(d.triggeredAt).toLocaleString()}`),console.log(""),console.log(" Monitor execution:"),o?(console.log(` zibby workflow logs ${o}`),console.log(` zibby workflow logs ${o} -t`)):(console.log(` zibby workflow logs --workflow ${n} --project ${t}`),console.log(` zibby workflow logs --workflow ${n} --project ${t} -t`)),console.log("")}catch(s){l.fail("Trigger failed"),console.log(` Error: ${s.message}
22
22
  `),process.exit(1)}}export{I as coerceValue,$ as parseParams,U as resolveInput,M as triggerWorkflowCommand};
@@ -1 +1 @@
1
- var n={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 l(){let o;if(process.env.ZIBBY_API_URL)o=process.env.ZIBBY_API_URL;else{let r=process.env.ZIBBY_ENV||"prod";n[r]?o=n[r].apiUrl:o=n.prod.apiUrl}try{let r=new URL(o);return r.protocol!=="http:"&&r.protocol!=="https:"?(console.error(`\u26A0\uFE0F Invalid API URL protocol: ${r.protocol} (only http/https allowed)`),n.prod.apiUrl):o}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${o}`),n.prod.apiUrl}}function i(){if(process.env.ZIBBY_ACCOUNT_API_URL)return process.env.ZIBBY_ACCOUNT_API_URL;let o=process.env.ZIBBY_ENV||"prod";return(n[o]||n.prod).accountApiUrl}function d(){let o=process.env.ZIBBY_ENV||"prod";return n[o]||n.prod}function a(){let o;if(process.env.ZIBBY_FRONTEND_URL)o=process.env.ZIBBY_FRONTEND_URL;else{let r=process.env.ZIBBY_ENV||"prod";n[r]?o=n[r].frontendUrl:o=n.prod.frontendUrl}try{let r=new URL(o);if(r.protocol!=="http:"&&r.protocol!=="https:")return console.error(`\u26A0\uFE0F Invalid frontend URL protocol: ${r.protocol} (only http/https allowed)`),n.local.frontendUrl;if(process.env.NODE_ENV==="production"||process.env.ZIBBY_ENV==="prod"){let p=["zibby.app","studio.zibby.app","studio-staging.zibby.app"],t=r.hostname;if(!p.some(e=>t===e||t.endsWith(`.${e}`))&&!t.includes("localhost")&&t!=="127.0.0.1")return console.error(`\u26A0\uFE0F Untrusted frontend URL in production: ${t}`),"https://studio.zibby.app"}return o}catch{return console.error(`\u26A0\uFE0F Invalid frontend URL: ${o}`),n.local.frontendUrl}}export{n as ENVIRONMENTS,i as getAccountApiUrl,l as getApiUrl,d as getCurrentEnvironment,a as getFrontendUrl};
1
+ var n={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.dev",description:"Production environment"}};function l(){let o;if(process.env.ZIBBY_API_URL)o=process.env.ZIBBY_API_URL;else{let r=process.env.ZIBBY_ENV||"prod";n[r]?o=n[r].apiUrl:o=n.prod.apiUrl}try{let r=new URL(o);return r.protocol!=="http:"&&r.protocol!=="https:"?(console.error(`\u26A0\uFE0F Invalid API URL protocol: ${r.protocol} (only http/https allowed)`),n.prod.apiUrl):o}catch{return console.error(`\u26A0\uFE0F Invalid API URL: ${o}`),n.prod.apiUrl}}function i(){if(process.env.ZIBBY_ACCOUNT_API_URL)return process.env.ZIBBY_ACCOUNT_API_URL;let o=process.env.ZIBBY_ENV||"prod";return(n[o]||n.prod).accountApiUrl}function d(){let o=process.env.ZIBBY_ENV||"prod";return n[o]||n.prod}function a(){let o;if(process.env.ZIBBY_FRONTEND_URL)o=process.env.ZIBBY_FRONTEND_URL;else{let r=process.env.ZIBBY_ENV||"prod";n[r]?o=n[r].frontendUrl:o=n.prod.frontendUrl}try{let r=new URL(o);if(r.protocol!=="http:"&&r.protocol!=="https:")return console.error(`\u26A0\uFE0F Invalid frontend URL protocol: ${r.protocol} (only http/https allowed)`),n.local.frontendUrl;if(process.env.NODE_ENV==="production"||process.env.ZIBBY_ENV==="prod"){let s=["zibby.dev","studio.zibby.dev","studio-staging.zibby.dev","zibby.app","studio.zibby.app","studio-staging.zibby.app"],t=r.hostname;if(!s.some(e=>t===e||t.endsWith(`.${e}`))&&!t.includes("localhost")&&t!=="127.0.0.1")return console.error(`\u26A0\uFE0F Untrusted frontend URL in production: ${t}`),"https://studio.zibby.dev"}return o}catch{return console.error(`\u26A0\uFE0F Invalid frontend URL: ${o}`),n.local.frontendUrl}}export{n as ENVIRONMENTS,i as getAccountApiUrl,l as getApiUrl,d as getCurrentEnvironment,a as getFrontendUrl};
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.95",
3
+ "version": "0.2.1",
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/deploy-bundles-user-config.test.js test/run-loads-user-config.test.js test/env-helpers.test.js test/env-cli.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",
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/deploy-bundles-user-config.test.js test/run-loads-user-config.test.js test/env-helpers.test.js test/env-cli.test.js test/chat-agents.test.js test/chat-agents-api.test.js test/chat-agents-picker.test.js test/chat-sandbox-attach.test.js test/credentials-file.test.js test/credentials-api.test.js test/credentials-loader.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 .",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "author": "Zibby",
25
25
  "license": "MIT",
26
- "homepage": "https://zibby.app",
26
+ "homepage": "https://zibby.dev",
27
27
  "repository": {
28
28
  "type": "git",
29
29
  "url": "https://github.com/ZibbyHQ/zibby-agent"
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-sqs": "^3.1038.0",
36
- "@zibby/agent-workflow": "^0.2.0",
37
- "@zibby/core": "^0.2.0",
36
+ "@zibby/agent-workflow": "^0.3.0",
37
+ "@zibby/core": "^0.3.0",
38
38
  "@zibby/memory": "^0.1.5",
39
39
  "@zibby/skills": "^0.1.11",
40
40
  "adm-zip": "^0.5.17",
@@ -19,7 +19,7 @@ Two pieces:
19
19
  ```
20
20
  "This will enable a $50/mo dedicated-egress addon on your account. Confirm?"
21
21
  ```
22
- If they don't have a Pro subscription, the enable call returns 402 — direct them to https://zibby.app/billing first.
22
+ If they don't have a Pro subscription, the enable call returns 402 — direct them to https://zibby.dev/billing first.
23
23
 
24
24
  2. **Check current state:**
25
25
  ```
@@ -0,0 +1 @@
1
+ import O from"node:fs/promises";import C from"node:path";import v from"node:os";var E=C.join(v.homedir(),".zibby","credentials.env"),_={CLAUDE_CODE_OAUTH_TOKEN:"oauth",CLAUDE_CODE_OAUTH_TOKEN_POOL:"oauth",ANTHROPIC_AUTH_TOKEN:"oauth",ANTHROPIC_API_KEY:"api",ANTHROPIC_API_KEY_POOL:"api"};function m(a){if(!a)return[];let s=[],i=new Set,f=String(a).split(/\r?\n/);for(let u of f){let e=u.trim();if(!e||e.startsWith("#"))continue;let l=e.indexOf("=");if(l<1)continue;let o=e.slice(0,l).trim(),n=e.slice(l+1).trim();if((n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1)),!n)continue;let r=_[o];if(!r)continue;let d=o.endsWith("_POOL")?n.split(",").map(t=>t.trim()).filter(Boolean):[n];for(let t of d)t.length<8||i.has(t)||(i.add(t),s.push({type:r,token:t,source_var:o}))}return s}async function A(a=E){let s;try{s=await O.readFile(a,"utf8")}catch(i){if(i.code==="ENOENT")return[];throw i}return m(s)}async function h({filepath:a,env:s=process.env}={}){let i=await A(a),f=new Set(i.map(e=>e.token)),u=[];for(let[e,l]of Object.entries(_)){let o=s[e];if(!o)continue;let n=e.endsWith("_POOL")?o.split(",").map(r=>r.trim()).filter(Boolean):[o];for(let r of n)r.length<8||f.has(r)||(f.add(r),u.push({type:l,token:r,source_var:e,source:"process.env"}))}return{file:i.map(e=>({...e,source:"file"})),env:u,all:[...i.map(e=>({...e,source:"file"})),...u]}}var p=!1,c=null;async function N(a={}){let{verbose:s=!1,force:i=!1,filepath:f}=a;if(p&&!i)return c;if(!!(process.env.CLAUDE_CODE_OAUTH_TOKEN_POOL||process.env.ANTHROPIC_API_KEY_POOL||process.env.CLAUDE_CODE_OAUTH_TOKEN||process.env.ANTHROPIC_API_KEY))return p=!0,c={oauthCount:0,apiCount:0,source:"cloud-env"},s&&console.log("[credentials-loader] env vars already set \u2014 skipping local discovery"),c;let e;try{e=await h(f?{filepath:f}:void 0)}catch(t){return s&&console.warn(`[credentials-loader] discovery failed: ${t.message}`),p=!0,c={oauthCount:0,apiCount:0,source:"none"},c}let l=e.all.filter(t=>t.type==="oauth").map(t=>t.token),o=e.all.filter(t=>t.type==="api").map(t=>t.token);l.length>0&&(process.env.CLAUDE_CODE_OAUTH_TOKEN_POOL=l.join(",")),o.length>0&&(process.env.ANTHROPIC_API_KEY_POOL=o.join(","));let n=e.file.length,r=e.env.length,d=n>0&&r>0?"local-file+shell-env":n>0?"local-file":r>0?"shell-env":"none";return p=!0,c={oauthCount:l.length,apiCount:o.length,source:d},s&&(l.length||o.length)&&console.log(`[credentials-loader] loaded ${l.length} OAuth + ${o.length} API from ${d} (~/.zibby/credentials.env)`),c}function I(){p=!1,c=null}export{I as _resetLoaderCacheForTests,N as loadCredentialsIntoEnv};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.95",
3
+ "version": "0.2.1",
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/deploy-bundles-user-config.test.js test/run-loads-user-config.test.js test/env-helpers.test.js test/env-cli.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",
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/deploy-bundles-user-config.test.js test/run-loads-user-config.test.js test/env-helpers.test.js test/env-cli.test.js test/chat-agents.test.js test/chat-agents-api.test.js test/chat-agents-picker.test.js test/chat-sandbox-attach.test.js test/credentials-file.test.js test/credentials-api.test.js test/credentials-loader.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 .",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "author": "Zibby",
25
25
  "license": "MIT",
26
- "homepage": "https://zibby.app",
26
+ "homepage": "https://zibby.dev",
27
27
  "repository": {
28
28
  "type": "git",
29
29
  "url": "https://github.com/ZibbyHQ/zibby-agent"
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-sqs": "^3.1038.0",
36
- "@zibby/agent-workflow": "^0.2.0",
37
- "@zibby/core": "^0.2.0",
36
+ "@zibby/agent-workflow": "^0.3.0",
37
+ "@zibby/core": "^0.3.0",
38
38
  "@zibby/memory": "^0.1.5",
39
39
  "@zibby/skills": "^0.1.11",
40
40
  "adm-zip": "^0.5.17",