@burdenoff/cli-sdk 2026.529.1 → 2026.626.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.
@@ -0,0 +1 @@
1
+ import {b as b$1,o,p,q as q$1}from'./chunk-TCBALVP4.js';var r=null;function T(t){r=t;}function e(){if(!r)throw new q$1("vibecontrols module helpers used before setHelpersContext was called");return r}function c(){let t=e();if(!t.auth.isAuthenticated())throw new p(`Authentication required. Run \`${t.productName} auth login\`.`)}async function q(t,n){return c(),e().gql.workspace.request(t,n)}async function w(t,n){return e().gql.global.request(t,n)}async function b(t,n){return e().gql.workspaceAuthOnly.request(t,n)}async function A(t,n){return e().gql.global.request(t,n)}function v(){e().gql.reset();}function I(t){let n=t instanceof Error?t.message:String(t);throw new o(n)}function k(t,n,p){e().output.formatAndOutput(t,n,p);}function E(t){e().output.printSuccess(t);}function O(t){e().output.printError(t);}function S(t){e().output.printInfo(t);}function D(t){e().output.printWarning(t);}function y(t){e().output.printJson(t);}function N(t){return e().output.formatStatus(t)}function R(t){return e().output.formatDate(t)}function W(t,n){return e().output.truncate(t,n)}function F(t,n){return e().output.confirm(t,n)}function L(t,n){e().output.printTable(t,n);}function V(){return e()}function P(){return e().auth.read()}function _(t){e().auth.write(t);}function K(){e().auth.clear();}function G(){return e().config.read()}function Y(t){return e().config.get(t)}function j(t,n){e().config.set(t,n);}function H(){return e().config.path()}var J=b$1;function B(){return e().config.resolveOIDC()}function U(t){return t?t.expiresAt?Date.now()>=t.expiresAt:false:e().auth.isTokenExpired()}export{J as A,B,U as C,T as a,q as b,w as c,b as d,A as e,v as f,I as g,k as h,E as i,O as j,S as k,D as l,y as m,N as n,R as o,W as p,F as q,L as r,V as s,P as t,_ as u,K as v,G as w,Y as x,j as y,H as z};
@@ -1,6 +1,6 @@
1
- import {Lc,Mc}from'../../chunk-REBBLQFS.js';import {a,f,s,d,k,u,e,h,v,B,n,g,t,c,o as o$1,m,l,j,A}from'../../chunk-LZQBJDKZ.js';import {q,o,f as f$1,h as h$1,g as g$1,d as d$1,i,e as e$1}from'../../chunk-TCBALVP4.js';function X(s$1){let u$1=s$1.command("auth").description("Authentication commands");u$1.command("login").description("Authenticate with VibeControls").option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace ID (for app auth)").action(async i=>{try{i.clientCredentials?await Ce(i.workspaceId):await Ue();}catch(r){f(r);}}),u$1.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(s()?.accessToken)try{await d(Lc);}catch{k("Server-side logout failed, clearing local tokens");}u(),e(),h("Logged out successfully");}catch(i){f(i);}}),u$1.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let r=s(),p=v(),I=!!r?.accessToken,m=r?.accessToken?B(r):false,f=r?.expiresAt?n(new Date(r.expiresAt).toISOString()):"-",h=r?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=r?.workspaceTokenExpiresAt?n(new Date(r.workspaceTokenExpiresAt).toISOString()):"-";g(i,{authenticated:I,method:h,expired:m,expiresAt:f,workspaceId:r?.workspaceId??"-",organizationId:r?.organizationId??"-",workspaceTokenExpiresAt:e,workspaceEndpoint:p.workspaceEndpoint,globalEndpoint:p.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(I)],["Method",h],["Expired",String(m)],["Expires At",f],["Workspace ID",r?.workspaceId??"-"],["Organization ID",r?.organizationId??"-"],["Workspace Token Expires",e],["Workspace Endpoint",p.workspaceEndpoint],["Global Endpoint",p.globalEndpoint]]});}),u$1.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let r=s();if(i.workspace){if(!r?.workspaceToken)throw new o("No workspace token. Set a workspace: vibecontrols workspace set <id>");process.stdout.write(r.workspaceToken);return}if(!r?.accessToken)throw new o("Not authenticated. Run: vibecontrols auth login");process.stdout.write(r.accessToken);}),u$1.command("refresh").description("Force token refresh").action(async()=>{try{let i=s();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new o("No refresh token available. Run: vibecontrols auth login");if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let I=v(),m=await f$1(I.globalEndpoint,i.clientId,i.clientSecret);t({...i,accessToken:m.accessToken,expiresAt:Date.now()+m.expiresIn*1e3}),e(),h("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await J();return}let p=(await d(Mc,{token:i.refreshToken})).refreshToken;t({...i,accessToken:p.accessToken,refreshToken:p.refreshToken,expiresAt:Date.now()+p.expiresIn*1e3}),e(),h("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await J();}catch(i){f(i);}});}async function J(){let s$1=s();if(!s$1?.accessToken||!s$1.workspaceId||!s$1.organizationId)return;let u=v();try{let i=await g$1(u.workspaceEndpoint,s$1.accessToken,s$1.workspaceId,s$1.organizationId);t({...s$1,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),e(),h("Workspace token refreshed");}catch{k("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Ue(){let s=v(),{oidcIssuer:u,clientId:i$1}=A(),r={...s,oidcIssuer:u,clientId:i$1};j("Starting device code authentication...");let p=await d$1(r);console.log(""),console.log(` Open: ${p.verificationUri}`),console.log(` Code: ${p.userCode}`),console.log(""),await i(p.verificationUriComplete??p.verificationUri)?j("Browser opened"):k("Could not open browser \u2014 open the URL manually"),j("Waiting for authorization...");let m=await e$1(p.deviceCode,p.interval,r),f=m.accessToken,h$2=Date.now()+m.expiresIn*1e3;j("Fetching workspaces...");try{let e$1=await h$1(s.globalEndpoint,f);if(e$1.length===0){t({accessToken:f,refreshToken:m.refreshToken,expiresAt:h$2,authMethod:"device_code"}),e(),h("Authentication successful (no workspaces found)");return}let t$1=e$1[0];if(e$1.length>1){console.log(`
2
- Available workspaces:`),e$1.forEach((O,$)=>console.log(` ${$+1}. ${O.name} (${O.slug})`));let A=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),g=await new Promise(O=>{A.question(`
3
- Select workspace [1-${e$1.length}]: `,$=>{A.close(),O($.trim());});}),S=parseInt(g,10)-1;S>=0&&S<e$1.length&&(t$1=e$1[S]);}j(`Using workspace: ${t$1.name} (${t$1.id})`);let n=await g$1(s.workspaceEndpoint,f,t$1.id,t$1.organizationId);t({accessToken:f,refreshToken:m.refreshToken,expiresAt:h$2,workspaceToken:n.token,workspaceTokenExpiresAt:new Date(n.expiresAt).getTime(),workspaceId:t$1.id,organizationId:t$1.organizationId,authMethod:"device_code"}),e(),h("Authentication successful");}catch(e$1){t({accessToken:f,refreshToken:m.refreshToken,expiresAt:h$2,authMethod:"device_code"}),e(),h("Authentication successful"),k(`Workspace token not obtained: ${e$1 instanceof Error?e$1.message:String(e$1)}`),j("Set workspace manually: vibecontrols workspace set <id>");}}async function Ce(s){let u=v(),r=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),p=await new Promise(A=>{r.question("Client ID: ",g=>A(g.trim()));}),I=await new Promise(A=>{r.question("Client Secret: ",g=>{r.close(),A(g.trim());});});if(!p||!I)throw new o("Client ID and secret cannot be empty");j("Authenticating app...");let m=await f$1(u.globalEndpoint,p,I),f=m.accessToken,h$2=Date.now()+m.expiresIn*1e3,e$1,t$1,n=s,l;if(n)try{let g=(await h$1(u.globalEndpoint,f)).find(S=>S.id===n);if(g){l=g.organizationId;let S=await g$1(u.workspaceEndpoint,f,n,l);e$1=S.token,t$1=new Date(S.expiresAt).getTime(),j(`Workspace token issued for: ${g.name}`);}else k(`Workspace ${n} not found \u2014 skipping workspace token`),n=void 0;}catch(A){k(`Workspace token failed: ${A instanceof Error?A.message:String(A)}`);}t({accessToken:f,refreshToken:"",expiresAt:h$2,workspaceToken:e$1,workspaceTokenExpiresAt:t$1,workspaceId:n,organizationId:l,authMethod:"client_credentials",clientId:p,clientSecret:I}),e(),h("App authentication successful");}var Q=`
1
+ import {Lc,Mc}from'../../chunk-REBBLQFS.js';import {a,g,t,e,l,v,f,i,w,C,o,h,u,c,p,n,m,k,B}from'../../chunk-WXDQ3S5J.js';import {q,o as o$1,f as f$1,h as h$1,g as g$1,d,i as i$1,e as e$1}from'../../chunk-TCBALVP4.js';function X(s){let u$1=s.command("auth").description("Authentication commands");u$1.command("login").description("Authenticate with VibeControls").option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace ID (for app auth)").action(async i=>{try{i.clientCredentials?await Ce(i.workspaceId):await Ue();}catch(r){g(r);}}),u$1.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(t()?.accessToken)try{await e(Lc);}catch{l("Server-side logout failed, clearing local tokens");}v(),f(),i("Logged out successfully");}catch(i){g(i);}}),u$1.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let r=t(),p=w(),I=!!r?.accessToken,m=r?.accessToken?C(r):false,f=r?.expiresAt?o(new Date(r.expiresAt).toISOString()):"-",h$1=r?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=r?.workspaceTokenExpiresAt?o(new Date(r.workspaceTokenExpiresAt).toISOString()):"-";h(i,{authenticated:I,method:h$1,expired:m,expiresAt:f,workspaceId:r?.workspaceId??"-",organizationId:r?.organizationId??"-",workspaceTokenExpiresAt:e,workspaceEndpoint:p.workspaceEndpoint,globalEndpoint:p.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(I)],["Method",h$1],["Expired",String(m)],["Expires At",f],["Workspace ID",r?.workspaceId??"-"],["Organization ID",r?.organizationId??"-"],["Workspace Token Expires",e],["Workspace Endpoint",p.workspaceEndpoint],["Global Endpoint",p.globalEndpoint]]});}),u$1.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let r=t();if(i.workspace){if(!r?.workspaceToken)throw new o$1("No workspace token. Set a workspace: vibecontrols workspace set <id>");process.stdout.write(r.workspaceToken);return}if(!r?.accessToken)throw new o$1("Not authenticated. Run: vibecontrols auth login");process.stdout.write(r.accessToken);}),u$1.command("refresh").description("Force token refresh").action(async()=>{try{let i$1=t();if(!i$1?.refreshToken&&i$1?.authMethod!=="client_credentials")throw new o$1("No refresh token available. Run: vibecontrols auth login");if(i$1?.authMethod==="client_credentials"&&i$1.clientId&&i$1.clientSecret){let I=w(),m=await f$1(I.globalEndpoint,i$1.clientId,i$1.clientSecret);u({...i$1,accessToken:m.accessToken,expiresAt:Date.now()+m.expiresIn*1e3}),f(),i("App token refreshed successfully"),i$1.workspaceId&&i$1.organizationId&&await J();return}let p=(await e(Mc,{token:i$1.refreshToken})).refreshToken;u({...i$1,accessToken:p.accessToken,refreshToken:p.refreshToken,expiresAt:Date.now()+p.expiresIn*1e3}),f(),i("Token refreshed successfully"),i$1.workspaceId&&i$1.organizationId&&await J();}catch(i){g(i);}});}async function J(){let s=t();if(!s?.accessToken||!s.workspaceId||!s.organizationId)return;let u$1=w();try{let i$1=await g$1(u$1.workspaceEndpoint,s.accessToken,s.workspaceId,s.organizationId);u({...s,workspaceToken:i$1.token,workspaceTokenExpiresAt:new Date(i$1.expiresAt).getTime()}),f(),i("Workspace token refreshed");}catch{l("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Ue(){let s=w(),{oidcIssuer:u$1,clientId:i$2}=B(),r={...s,oidcIssuer:u$1,clientId:i$2};k("Starting device code authentication...");let p=await d(r);console.log(""),console.log(` Open: ${p.verificationUri}`),console.log(` Code: ${p.userCode}`),console.log(""),await i$1(p.verificationUriComplete??p.verificationUri)?k("Browser opened"):l("Could not open browser \u2014 open the URL manually"),k("Waiting for authorization...");let m=await e$1(p.deviceCode,p.interval,r),f$1=m.accessToken,h=Date.now()+m.expiresIn*1e3;k("Fetching workspaces...");try{let e=await h$1(s.globalEndpoint,f$1);if(e.length===0){u({accessToken:f$1,refreshToken:m.refreshToken,expiresAt:h,authMethod:"device_code"}),f(),i("Authentication successful (no workspaces found)");return}let t=e[0];if(e.length>1){console.log(`
2
+ Available workspaces:`),e.forEach((O,$)=>console.log(` ${$+1}. ${O.name} (${O.slug})`));let A=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),g=await new Promise(O=>{A.question(`
3
+ Select workspace [1-${e.length}]: `,$=>{A.close(),O($.trim());});}),S=parseInt(g,10)-1;S>=0&&S<e.length&&(t=e[S]);}k(`Using workspace: ${t.name} (${t.id})`);let n=await g$1(s.workspaceEndpoint,f$1,t.id,t.organizationId);u({accessToken:f$1,refreshToken:m.refreshToken,expiresAt:h,workspaceToken:n.token,workspaceTokenExpiresAt:new Date(n.expiresAt).getTime(),workspaceId:t.id,organizationId:t.organizationId,authMethod:"device_code"}),f(),i("Authentication successful");}catch(e){u({accessToken:f$1,refreshToken:m.refreshToken,expiresAt:h,authMethod:"device_code"}),f(),i("Authentication successful"),l(`Workspace token not obtained: ${e instanceof Error?e.message:String(e)}`),k("Set workspace manually: vibecontrols workspace set <id>");}}async function Ce(s){let u$1=w(),r=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),p=await new Promise(A=>{r.question("Client ID: ",g=>A(g.trim()));}),I=await new Promise(A=>{r.question("Client Secret: ",g=>{r.close(),A(g.trim());});});if(!p||!I)throw new o$1("Client ID and secret cannot be empty");k("Authenticating app...");let m=await f$1(u$1.globalEndpoint,p,I),f$2=m.accessToken,h=Date.now()+m.expiresIn*1e3,e,t,n=s,l$1;if(n)try{let g=(await h$1(u$1.globalEndpoint,f$2)).find(S=>S.id===n);if(g){l$1=g.organizationId;let S=await g$1(u$1.workspaceEndpoint,f$2,n,l$1);e=S.token,t=new Date(S.expiresAt).getTime(),k(`Workspace token issued for: ${g.name}`);}else l(`Workspace ${n} not found \u2014 skipping workspace token`),n=void 0;}catch(A){l(`Workspace token failed: ${A instanceof Error?A.message:String(A)}`);}u({accessToken:f$2,refreshToken:"",expiresAt:h,workspaceToken:e,workspaceTokenExpiresAt:t,workspaceId:n,organizationId:l$1,authMethod:"client_credentials",clientId:p,clientSecret:I}),f(),i("App authentication successful");}var Q=`
4
4
  query currentUser {
5
5
  currentUser {
6
6
  id email firstName lastName username phoneNumber name
@@ -157,4 +157,4 @@ Select workspace [1-${e$1.length}]: `,$=>{A.close(),O($.trim());});}),S=parseInt
157
157
  id email firstName lastName username role status
158
158
  }
159
159
  }
160
- `;function Te(s){let u=s.command("profile").description("Current user profile");u.command("show").description("Show current user").option("-f, --format <format>").action(async e=>{try{let t=await c(Q);g(e,t.currentUser);}catch(t){f(t);}}),u.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async e=>{try{let t={};if(e.firstName&&(t.firstName=e.firstName),e.lastName&&(t.lastName=e.lastName),e.name&&(t.name=e.name),e.username&&(t.username=e.username),e.phone&&(t.phoneNumber=e.phone),e.timezone&&(t.timezone=e.timezone),e.language&&(t.language=e.language),!Object.keys(t).length)throw new o("No updates specified");let n=await c(Z,{input:t});h("Profile updated"),g(e,n.updateCurrentUserProfile);}catch(t){f(t);}});let i=s.command("security").description("Account security overview");i.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(K,{pagination:{limit:e.limit,offset:0}});g(e,t.authAuditLogs,{headers:["When","Action","Resource","IP"],rows:t.authAuditLogs.map(n$1=>[n(n$1.createdAt),n$1.action,n$1.resource??"-",n$1.ipAddress??"-"])});}catch(t){f(t);}}),i.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(ee,{pagination:{limit:e.limit,offset:0}});g(e,t.activeSessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:t.activeSessions.map(n$1=>[o$1(n$1.id,12),m(n$1.status),n$1.ipAddress??"-",n(n$1.lastActivityAt),String(!!n$1.isCurrent)])});}catch(t){f(t);}});let r=s.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(te,{pagination:{limit:e.limit,offset:0}});g(e,t.currentUserMFAMethods,{headers:["Method","Status","Created"],rows:t.currentUserMFAMethods.map(n$1=>[n$1.method,m(n$1.status),n(n$1.createdAt)])});}catch(t){f(t);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async e=>{try{let t=await c(ne,{method:e.method.toUpperCase()});e.format?g(e,t.setupMFA):(h("MFA enrollment started"),l(t.setupMFA),j("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){f(t);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async e=>{try{await c(ie,{code:e.code}),h("MFA enabled");}catch(t){f(t);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await c(re),h("MFA disabled");}catch(e){f(e);}});let p=s.command("api-keys").description("API key management");p.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=e.app?se:oe,n$1=e.app?{appId:e.app,pagination:{limit:e.limit,offset:0}}:{pagination:{limit:e.limit,offset:0}},l=await c(t,n$1),A=l.myApiKeys??l.appApiKeys??[];g(e,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(g=>[o$1(g.id,12),g.name??"-",g.prefix??"-",g.appName??"-",Array.isArray(g.scopes)?g.scopes.join(","):"-",n(g.lastUsedAt)])});}catch(t){f(t);}}),p.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,appId:e.app,scope:e.scope?e.scope.split(","):void 0,expiresAt:e.expires},n=await c(ae,{input:t});h("API key generated. Store the secret \u2014 it is only shown once."),l(n.generateAPIKey);}catch(t){f(t);}}),p.command("revoke").description("Revoke an API key").argument("<keyId>").action(async e=>{try{await c(ce,{keyId:e}),h("API key revoked");}catch(t){f(t);}}),p.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async e=>{try{let t=await c(pe,{keyId:e});h("API key rotated"),l(t.rotateAPIKey);}catch(t){f(t);}}),s.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(K,{pagination:{limit:e.limit,offset:0}});g(e,t.authAuditLogs);}catch(t){f(t);}});let I=s.command("delegations").description("Delegation management");I.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(de,{pagination:{limit:e.limit,offset:0}});g(e,t.currentUserDelegations);}catch(t){f(t);}}),I.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async e=>{try{let t={appId:e.app,userId:e.user,scopes:e.scope?e.scope.split(","):void 0,workspaceIds:e.workspace?e.workspace.split(","):void 0,expiresAt:e.expires},n=await c(me,{input:t});h("Delegation granted"),g(e,n.grantDelegation);}catch(t){f(t);}}),I.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(e,t)=>{try{await c(ue,{id:e,reason:t.reason}),h("Delegation revoked");}catch(n){f(n);}});let m$1=s.command("apps").description("OAuth/system app management");m$1.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(le,{pagination:{limit:e.limit,offset:0}});g(e,t.currentUserApps,{headers:["ID","ClientID","Name","Type","Status"],rows:t.currentUserApps.map(n=>[o$1(n.id,12),o$1(n.clientId,24),n.name??"-",n.type??"-",m(n.status)])});}catch(t){f(t);}}),m$1.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(ge,{id:e});if(!n.app)throw new o(`App ${e} not found`);g(t,n.app);}catch(n){f(n);}}),m$1.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,description:e.description,type:(e.type??"OAUTH").toUpperCase(),actorType:(e.actorType??"APP").toUpperCase(),redirectUris:e.redirect?e.redirect.split(","):void 0,scopes:e.scopes?e.scopes.split(","):void 0},n=await c(fe,{input:t});h("App created. Client secret only shown once."),l(n.createApp);}catch(t){f(t);}}),m$1.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(e,t)=>{try{let n={};if(t.name&&(n.name=t.name),t.description!==void 0&&(n.description=t.description),t.redirect&&(n.redirectUris=t.redirect.split(",")),t.scopes&&(n.scopes=t.scopes.split(",")),t.status&&(n.status=t.status.toUpperCase()),!Object.keys(n).length)throw new o("No updates specified");let l=await c(Ae,{id:e,input:n});h("App updated"),g(t,l.updateApp);}catch(n){f(n);}}),m$1.command("deactivate").description("Deactivate an app").argument("<id>").action(async e=>{try{await c(Ie,{id:e}),h("App deactivated");}catch(t){f(t);}});let f$1=s.command("sso").description("SSO (SAML/OIDC) configuration");f$1.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async e=>{try{let t=await c(he,{tenantId:e.tenant});g(e,t.getSSOConfig);}catch(t){f(t);}}),f$1.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async e=>{try{let t={entityId:e.entity,ssoUrl:e.ssoUrl,sloUrl:e.sloUrl,certificate:e.certificate,enabled:!!e.enabled},n=await c(ye,{tenantId:e.tenant,input:t});h("SSO config saved"),g(e,n.saveSSOConfig);}catch(t){f(t);}}),f$1.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async e=>{try{await c(we,{tenantId:e.tenant}),h("SSO config deleted");}catch(t){f(t);}});let h$1=s.command("users").description("User admin (requires admin permissions)");h$1.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.email&&(t.email=e.email),e.username&&(t.username=e.username),e.role&&(t.role=e.role.toUpperCase()),e.status&&(t.status=e.status.toUpperCase()),e.search&&(t.search=e.search);let n$1=await c(ke,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});g(e,n$1.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:n$1.users.users.map(l=>[o$1(l.id,12),l.email,l.username??"-",l.role??"-",m(l.status),n(l.createdAt)])});}catch(t){f(t);}}),h$1.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(Ee,{id:e});if(!n.user)throw new o(`User ${e} not found`);g(t,n.user);}catch(n){f(n);}}),h$1.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(e,t)=>{try{let n={};if(t.firstName&&(n.firstName=t.firstName),t.lastName&&(n.lastName=t.lastName),t.username&&(n.username=t.username),t.phone&&(n.phoneNumber=t.phone),t.role&&(n.role=t.role.toUpperCase()),t.status&&(n.status=t.status.toUpperCase()),t.emailVerified!==void 0&&(n.emailVerified=t.emailVerified==="true"),!Object.keys(n).length)throw new o("No updates specified");let l=await c(Se,{id:e,input:n});h("User updated"),g(t,l.updateUser);}catch(n){f(n);}});}var Re={id:"auth",version:"1.0.0",displayName:"Authentication",register(s,u){a(u),X(s);let i=s.commands.find(r=>r.name()==="auth");if(!i)throw new q("auth command group missing after registerAuthCommands");Te(i);}},Ye=Re;export{Ye as default};
160
+ `;function Te(s){let u=s.command("profile").description("Current user profile");u.command("show").description("Show current user").option("-f, --format <format>").action(async e=>{try{let t=await c(Q);h(e,t.currentUser);}catch(t){g(t);}}),u.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async e=>{try{let t={};if(e.firstName&&(t.firstName=e.firstName),e.lastName&&(t.lastName=e.lastName),e.name&&(t.name=e.name),e.username&&(t.username=e.username),e.phone&&(t.phoneNumber=e.phone),e.timezone&&(t.timezone=e.timezone),e.language&&(t.language=e.language),!Object.keys(t).length)throw new o$1("No updates specified");let n=await c(Z,{input:t});i("Profile updated"),h(e,n.updateCurrentUserProfile);}catch(t){g(t);}});let i$1=s.command("security").description("Account security overview");i$1.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(K,{pagination:{limit:e.limit,offset:0}});h(e,t.authAuditLogs,{headers:["When","Action","Resource","IP"],rows:t.authAuditLogs.map(n=>[o(n.createdAt),n.action,n.resource??"-",n.ipAddress??"-"])});}catch(t){g(t);}}),i$1.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(ee,{pagination:{limit:e.limit,offset:0}});h(e,t.activeSessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:t.activeSessions.map(n$1=>[p(n$1.id,12),n(n$1.status),n$1.ipAddress??"-",o(n$1.lastActivityAt),String(!!n$1.isCurrent)])});}catch(t){g(t);}});let r=s.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(te,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserMFAMethods,{headers:["Method","Status","Created"],rows:t.currentUserMFAMethods.map(n$1=>[n$1.method,n(n$1.status),o(n$1.createdAt)])});}catch(t){g(t);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async e=>{try{let t=await c(ne,{method:e.method.toUpperCase()});e.format?h(e,t.setupMFA):(i("MFA enrollment started"),m(t.setupMFA),k("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){g(t);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async e=>{try{await c(ie,{code:e.code}),i("MFA enabled");}catch(t){g(t);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await c(re),i("MFA disabled");}catch(e){g(e);}});let p$1=s.command("api-keys").description("API key management");p$1.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=e.app?se:oe,n=e.app?{appId:e.app,pagination:{limit:e.limit,offset:0}}:{pagination:{limit:e.limit,offset:0}},l=await c(t,n),A=l.myApiKeys??l.appApiKeys??[];h(e,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(g=>[p(g.id,12),g.name??"-",g.prefix??"-",g.appName??"-",Array.isArray(g.scopes)?g.scopes.join(","):"-",o(g.lastUsedAt)])});}catch(t){g(t);}}),p$1.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,appId:e.app,scope:e.scope?e.scope.split(","):void 0,expiresAt:e.expires},n=await c(ae,{input:t});i("API key generated. Store the secret \u2014 it is only shown once."),m(n.generateAPIKey);}catch(t){g(t);}}),p$1.command("revoke").description("Revoke an API key").argument("<keyId>").action(async e=>{try{await c(ce,{keyId:e}),i("API key revoked");}catch(t){g(t);}}),p$1.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async e=>{try{let t=await c(pe,{keyId:e});i("API key rotated"),m(t.rotateAPIKey);}catch(t){g(t);}}),s.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(K,{pagination:{limit:e.limit,offset:0}});h(e,t.authAuditLogs);}catch(t){g(t);}});let I=s.command("delegations").description("Delegation management");I.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(de,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserDelegations);}catch(t){g(t);}}),I.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async e=>{try{let t={appId:e.app,userId:e.user,scopes:e.scope?e.scope.split(","):void 0,workspaceIds:e.workspace?e.workspace.split(","):void 0,expiresAt:e.expires},n=await c(me,{input:t});i("Delegation granted"),h(e,n.grantDelegation);}catch(t){g(t);}}),I.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(e,t)=>{try{await c(ue,{id:e,reason:t.reason}),i("Delegation revoked");}catch(n){g(n);}});let m$1=s.command("apps").description("OAuth/system app management");m$1.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(le,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserApps,{headers:["ID","ClientID","Name","Type","Status"],rows:t.currentUserApps.map(n$1=>[p(n$1.id,12),p(n$1.clientId,24),n$1.name??"-",n$1.type??"-",n(n$1.status)])});}catch(t){g(t);}}),m$1.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(ge,{id:e});if(!n.app)throw new o$1(`App ${e} not found`);h(t,n.app);}catch(n){g(n);}}),m$1.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,description:e.description,type:(e.type??"OAUTH").toUpperCase(),actorType:(e.actorType??"APP").toUpperCase(),redirectUris:e.redirect?e.redirect.split(","):void 0,scopes:e.scopes?e.scopes.split(","):void 0},n=await c(fe,{input:t});i("App created. Client secret only shown once."),m(n.createApp);}catch(t){g(t);}}),m$1.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(e,t)=>{try{let n={};if(t.name&&(n.name=t.name),t.description!==void 0&&(n.description=t.description),t.redirect&&(n.redirectUris=t.redirect.split(",")),t.scopes&&(n.scopes=t.scopes.split(",")),t.status&&(n.status=t.status.toUpperCase()),!Object.keys(n).length)throw new o$1("No updates specified");let l=await c(Ae,{id:e,input:n});i("App updated"),h(t,l.updateApp);}catch(n){g(n);}}),m$1.command("deactivate").description("Deactivate an app").argument("<id>").action(async e=>{try{await c(Ie,{id:e}),i("App deactivated");}catch(t){g(t);}});let f=s.command("sso").description("SSO (SAML/OIDC) configuration");f.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async e=>{try{let t=await c(he,{tenantId:e.tenant});h(e,t.getSSOConfig);}catch(t){g(t);}}),f.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async e=>{try{let t={entityId:e.entity,ssoUrl:e.ssoUrl,sloUrl:e.sloUrl,certificate:e.certificate,enabled:!!e.enabled},n=await c(ye,{tenantId:e.tenant,input:t});i("SSO config saved"),h(e,n.saveSSOConfig);}catch(t){g(t);}}),f.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async e=>{try{await c(we,{tenantId:e.tenant}),i("SSO config deleted");}catch(t){g(t);}});let h$1=s.command("users").description("User admin (requires admin permissions)");h$1.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.email&&(t.email=e.email),e.username&&(t.username=e.username),e.role&&(t.role=e.role.toUpperCase()),e.status&&(t.status=e.status.toUpperCase()),e.search&&(t.search=e.search);let n$1=await c(ke,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});h(e,n$1.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:n$1.users.users.map(l=>[p(l.id,12),l.email,l.username??"-",l.role??"-",n(l.status),o(l.createdAt)])});}catch(t){g(t);}}),h$1.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(Ee,{id:e});if(!n.user)throw new o$1(`User ${e} not found`);h(t,n.user);}catch(n){g(n);}}),h$1.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(e,t)=>{try{let n={};if(t.firstName&&(n.firstName=t.firstName),t.lastName&&(n.lastName=t.lastName),t.username&&(n.username=t.username),t.phone&&(n.phoneNumber=t.phone),t.role&&(n.role=t.role.toUpperCase()),t.status&&(n.status=t.status.toUpperCase()),t.emailVerified!==void 0&&(n.emailVerified=t.emailVerified==="true"),!Object.keys(n).length)throw new o$1("No updates specified");let l=await c(Se,{id:e,input:n});i("User updated"),h(t,l.updateUser);}catch(n){g(n);}});}var Re={id:"auth",version:"1.0.0",displayName:"Authentication",register(s,u){a(u),X(s);let i=s.commands.find(r=>r.name()==="auth");if(!i)throw new q("auth command group missing after registerAuthCommands");Te(i);}},Ye=Re;export{Ye as default};
@@ -1,4 +1,4 @@
1
- import {a,c,g,o,m as m$1,n,f,h as h$1,j}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var A=`
1
+ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-WXDQ3S5J.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var A=`
2
2
  query GetDefaultBillingAccount {
3
3
  getDefaultBillingAccount {
4
4
  id creditAmount currency
@@ -102,4 +102,4 @@ import {a,c,g,o,m as m$1,n,f,h as h$1,j}from'../../chunk-LZQBJDKZ.js';import {o
102
102
  id name limits currentUsageSum reusable
103
103
  }
104
104
  }
105
- `;async function m(){let d=await c(A);if(!d.getDefaultBillingAccount?.id)throw new o$1("No default billing account on file. Pass --account <id> explicitly.");return d.getDefaultBillingAccount.id}function z(d){let s=d.command("billing").description("Billing: subscriptions, invoices, credits"),l=s.command("subscriptions").description("Subscriptions");l.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(D,{billingAccountId:n$1});g(t,i.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i.getActiveSubscriptions.map(e=>[o(e.id,12),m$1(e.status),e.plan?.name??"-",String(e.seatCount??"-"),n(e.nextBillingDate)])});}catch(n){f(n);}}),l.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(h,{id:t});if(!i.getSubscription)throw new o$1(`Subscription ${t} not found`);g(n,i.getSubscription);}catch(i){f(i);}}),l.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,n)=>{try{let i={subscriptionId:t,seatCount:n.seats},e=await c(_,{input:i});h$1(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),g(n,e.updateSubscriptionSeats);}catch(i){f(i);}}),l.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,n)=>{try{let i={subscriptionId:t,reason:n.reason},e=await c(R,{input:i});h$1("Subscription canceled"),g({},e.cancelSubscription);}catch(i){f(i);}});let P=s.command("plans").description("Plans");P.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(N,{filter:Object.keys(n).length?n:void 0});g(t,i.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i.getAllPlans.map(e=>[o(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){f(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(v,{id:t});if(!i.getPlan)throw new o$1(`Plan ${t} not found`);g(n,i.getPlan);}catch(i){f(i);}}),s.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(G,{filter:Object.keys(n).length?n:void 0,limit:t.limit});g(t,i.getAllAddOns);}catch(n){f(n);}});let g$1=s.command("invoices").description("Invoices");g$1.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(O,{billingAccountId:n$1,page:t.page,pageSize:t.pageSize});g(t,i.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i.getPaginatedInvoices.invoices.map(e=>[o(e.id,12),e.invoiceNumber??"-",m$1(e.status),String(e.total??"-"),e.currency??"-",n(e.paidAt)])});}catch(n){f(n);}}),g$1.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(S,{id:t});if(!i.getInvoice)throw new o$1(`Invoice ${t} not found`);g(n,i.getInvoice);}catch(i){f(i);}}),g$1.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let n=await c(S,{id:t});if(!n.getInvoice?.pdfUrl)throw new o$1(`Invoice ${t} has no pdfUrl`);j("PDF URL:"),console.log(n.getInvoice.pdfUrl);}catch(n){f(n);}});let f$1=s.command("payment-methods").description("Payment methods");f$1.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let n=t.account??await m(),i=await c($,{billingAccountId:n});g(t,i.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i.getPaymentMethods.map(e=>[o(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){f(n);}}),f$1.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let i={billingAccountId:t.account??await m(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},e=await c(x,{input:i});h$1("Payment method added"),g(t,e.addPaymentMethod);}catch(n){f(n);}}),f$1.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await c(M,{id:t}),h$1("Payment method removed");}catch(n){f(n);}});let I=s.command("credits").description("Credits & withdrawal");I.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let n=await c(A);g(t,n.getDefaultBillingAccount);}catch(n){f(n);}}),I.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let n={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await c(L,{input:n}),h$1("Credits granted");}catch(n){f(n);}}),I.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let n={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await c(U,{input:n}),h$1("Withdrawal requested");}catch(n){f(n);}}),s.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n=await c(B,{page:t.page,pageSize:t.pageSize});g(t,n.getPendingRefunds.records);}catch(n){f(n);}}),s.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(q,{subscriptionId:t});g(n,i.getAllQuotasOfSub);}catch(i){f(i);}});}var V={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(d,s){a(s),z(d);}},J=V;export{J as default};
105
+ `;async function m(){let d=await c(A);if(!d.getDefaultBillingAccount?.id)throw new o$1("No default billing account on file. Pass --account <id> explicitly.");return d.getDefaultBillingAccount.id}function z(d){let s=d.command("billing").description("Billing: subscriptions, invoices, credits"),l=s.command("subscriptions").description("Subscriptions");l.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(D,{billingAccountId:n$1});h$1(t,i.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i.getActiveSubscriptions.map(e=>[p(e.id,12),n(e.status),e.plan?.name??"-",String(e.seatCount??"-"),o(e.nextBillingDate)])});}catch(n){g(n);}}),l.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(h,{id:t});if(!i.getSubscription)throw new o$1(`Subscription ${t} not found`);h$1(n,i.getSubscription);}catch(i){g(i);}}),l.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,n)=>{try{let i$1={subscriptionId:t,seatCount:n.seats},e=await c(_,{input:i$1});i(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),h$1(n,e.updateSubscriptionSeats);}catch(i){g(i);}}),l.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,n)=>{try{let i$1={subscriptionId:t,reason:n.reason},e=await c(R,{input:i$1});i("Subscription canceled"),h$1({},e.cancelSubscription);}catch(i){g(i);}});let P=s.command("plans").description("Plans");P.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(N,{filter:Object.keys(n).length?n:void 0});h$1(t,i.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i.getAllPlans.map(e=>[p(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){g(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(v,{id:t});if(!i.getPlan)throw new o$1(`Plan ${t} not found`);h$1(n,i.getPlan);}catch(i){g(i);}}),s.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(G,{filter:Object.keys(n).length?n:void 0,limit:t.limit});h$1(t,i.getAllAddOns);}catch(n){g(n);}});let g$1=s.command("invoices").description("Invoices");g$1.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(O,{billingAccountId:n$1,page:t.page,pageSize:t.pageSize});h$1(t,i.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i.getPaginatedInvoices.invoices.map(e=>[p(e.id,12),e.invoiceNumber??"-",n(e.status),String(e.total??"-"),e.currency??"-",o(e.paidAt)])});}catch(n){g(n);}}),g$1.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(S,{id:t});if(!i.getInvoice)throw new o$1(`Invoice ${t} not found`);h$1(n,i.getInvoice);}catch(i){g(i);}}),g$1.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let n=await c(S,{id:t});if(!n.getInvoice?.pdfUrl)throw new o$1(`Invoice ${t} has no pdfUrl`);k("PDF URL:"),console.log(n.getInvoice.pdfUrl);}catch(n){g(n);}});let f=s.command("payment-methods").description("Payment methods");f.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let n=t.account??await m(),i=await c($,{billingAccountId:n});h$1(t,i.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i.getPaymentMethods.map(e=>[p(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){g(n);}}),f.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let i$1={billingAccountId:t.account??await m(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},e=await c(x,{input:i$1});i("Payment method added"),h$1(t,e.addPaymentMethod);}catch(n){g(n);}}),f.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await c(M,{id:t}),i("Payment method removed");}catch(n){g(n);}});let I=s.command("credits").description("Credits & withdrawal");I.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let n=await c(A);h$1(t,n.getDefaultBillingAccount);}catch(n){g(n);}}),I.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let n={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await c(L,{input:n}),i("Credits granted");}catch(n){g(n);}}),I.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let n={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await c(U,{input:n}),i("Withdrawal requested");}catch(n){g(n);}}),s.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n=await c(B,{page:t.page,pageSize:t.pageSize});h$1(t,n.getPendingRefunds.records);}catch(n){g(n);}}),s.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(q,{subscriptionId:t});h$1(n,i.getAllQuotasOfSub);}catch(i){g(i);}});}var V={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(d,s){a(s),z(d);}},J=V;export{J as default};
@@ -1,4 +1,4 @@
1
- import {a,c,g,o,m,f,r,h,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var y=`
1
+ import {a,c,h,p,n,g,s,i,o as o$1}from'../../chunk-WXDQ3S5J.js';import {o}from'../../chunk-TCBALVP4.js';var y=`
2
2
  query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {
3
3
  getChannels(filter: $filter, pagination: $pagination) {
4
4
  items { id name platform adapterType status connectionHealth priority createdAt }
@@ -67,4 +67,4 @@ import {a,c,g,o,m,f,r,h,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'..
67
67
  mutation DeleteChannelConnection($id: ID!) {
68
68
  deleteConnection(id: $id)
69
69
  }
70
- `;function H(m$1){let r$1=m$1.command("channels").description("Multi-platform message channels (email/SMS/Slack/etc.)");r$1.command("list").description("List channels").option("--platform <p>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.platform&&(n.platform=t.platform.toUpperCase()),t.status&&(n.status=t.status.toUpperCase());let e=await c(y,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getChannels.items,{headers:["ID","Name","Platform","Status","Priority"],rows:e.getChannels.items.map(a=>[o(a.id,12),a.name,a.platform,m(a.status),String(a.priority??"-")])});}catch(n){f(n);}}),r$1.command("get").description("Get a channel").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(I,{id:t});if(!e.getChannel)throw new o$1(`Channel ${t} not found`);g(n,e.getChannel);}catch(e){f(e);}}),r$1.command("create").description("Create a channel").requiredOption("--name <s>").requiredOption("--platform <p>","EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK").option("--organization <id>","Organization id (defaults to current actor org)").option("--adapter <t>").option("-f, --format <format>").action(async t=>{try{let n=t.organization??r().auth.read()?.organizationId;if(!n)throw new o$1("No organization context. Pass --organization <id> or set auth.organizationId.");let e={name:t.name,platform:t.platform.toUpperCase(),organizationId:n,adapterType:t.adapter?t.adapter.toUpperCase():void 0},a=await c(N,{input:e});h("Channel created"),g(t,a.createChannel);}catch(n){f(n);}}),r$1.command("delete").description("Delete a channel").argument("<id>").action(async t=>{try{await c(A,{id:t}),h("Channel deleted");}catch(n){f(n);}}),r$1.command("send").description("Send a message via a channel").argument("<channelId>").requiredOption("--content <s>").option("--recipient <id>","External recipient id (e.g. email)").option("--subject <s>").option("-f, --format <format>").action(async(t,n)=>{try{let e={channelId:t,content:n.content,recipientId:n.recipient,subject:n.subject},a=await c(T,{input:e});a.sendMessage.success&&h(`Sent: ${a.sendMessage.messageId??"(no id)"}`),g(n,a.sendMessage);}catch(e){f(e);}}),r$1.command("deliveries").description("Recent delivery attempts for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(_,{channelId:t,limit:n.limit});g(n,e.getChannelDeliveryAttempts.items);}catch(e){f(e);}}),r$1.command("users").description("Users connected to this channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(S,{channelId:t,pagination:{limit:n.limit,offset:0}});g(n,e.listUserPlatformConnectionsByChannel.items);}catch(e){f(e);}}),r$1.command("webhooks").description("Channel webhook events").command("list").description("List webhook events for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n$1)=>{try{let e=await c(O,{channelId:t,limit:n$1.limit});g(n$1,e.getChannelWebhookEvents.items,{headers:["ID","Event","Status","When"],rows:e.getChannelWebhookEvents.items.map(a=>[o(a.id,12),a.eventType,m(a.status),n(a.createdAt)])});}catch(e){f(e);}});let l=r$1.command("connections").description("Channel connections (OAuth/API keys)");l.command("list").description("List connections for an organization").requiredOption("--organization <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await c($,{organizationId:t.organization,pagination:{limit:t.limit,offset:0}});g(t,n.getConnectionsByOrganization.items);}catch(n){f(n);}}),l.command("create").description("Create a channel connection").requiredOption("--channel <id>").requiredOption("--auth-type <t>","OAUTH|API_KEY|WEBHOOK").option("-f, --format <format>").action(async t=>{try{let n={channelId:t.channel,authType:t.authType.toUpperCase()},e=await c(L,{input:n});h("Connection created"),g(t,e.createConnection);}catch(n){f(n);}}),l.command("delete").description("Delete a connection").argument("<id>").action(async t=>{try{await c(w,{id:t}),h("Connection deleted");}catch(n){f(n);}});}var D={id:"channels",version:"1.0.0",displayName:"Channels",dependsOn:["auth"],register(m,r){a(r),H(m);}},P=D;export{P as default};
70
+ `;function H(m){let r=m.command("channels").description("Multi-platform message channels (email/SMS/Slack/etc.)");r.command("list").description("List channels").option("--platform <p>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n$1={};t.platform&&(n$1.platform=t.platform.toUpperCase()),t.status&&(n$1.status=t.status.toUpperCase());let e=await c(y,{filter:Object.keys(n$1).length?n$1:void 0,pagination:{limit:t.limit,offset:0}});h(t,e.getChannels.items,{headers:["ID","Name","Platform","Status","Priority"],rows:e.getChannels.items.map(a=>[p(a.id,12),a.name,a.platform,n(a.status),String(a.priority??"-")])});}catch(n){g(n);}}),r.command("get").description("Get a channel").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(I,{id:t});if(!e.getChannel)throw new o(`Channel ${t} not found`);h(n,e.getChannel);}catch(e){g(e);}}),r.command("create").description("Create a channel").requiredOption("--name <s>").requiredOption("--platform <p>","EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK").option("--organization <id>","Organization id (defaults to current actor org)").option("--adapter <t>").option("-f, --format <format>").action(async t=>{try{let n=t.organization??s().auth.read()?.organizationId;if(!n)throw new o("No organization context. Pass --organization <id> or set auth.organizationId.");let e={name:t.name,platform:t.platform.toUpperCase(),organizationId:n,adapterType:t.adapter?t.adapter.toUpperCase():void 0},a=await c(N,{input:e});i("Channel created"),h(t,a.createChannel);}catch(n){g(n);}}),r.command("delete").description("Delete a channel").argument("<id>").action(async t=>{try{await c(A,{id:t}),i("Channel deleted");}catch(n){g(n);}}),r.command("send").description("Send a message via a channel").argument("<channelId>").requiredOption("--content <s>").option("--recipient <id>","External recipient id (e.g. email)").option("--subject <s>").option("-f, --format <format>").action(async(t,n)=>{try{let e={channelId:t,content:n.content,recipientId:n.recipient,subject:n.subject},a=await c(T,{input:e});a.sendMessage.success&&i(`Sent: ${a.sendMessage.messageId??"(no id)"}`),h(n,a.sendMessage);}catch(e){g(e);}}),r.command("deliveries").description("Recent delivery attempts for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(_,{channelId:t,limit:n.limit});h(n,e.getChannelDeliveryAttempts.items);}catch(e){g(e);}}),r.command("users").description("Users connected to this channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(S,{channelId:t,pagination:{limit:n.limit,offset:0}});h(n,e.listUserPlatformConnectionsByChannel.items);}catch(e){g(e);}}),r.command("webhooks").description("Channel webhook events").command("list").description("List webhook events for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n$1)=>{try{let e=await c(O,{channelId:t,limit:n$1.limit});h(n$1,e.getChannelWebhookEvents.items,{headers:["ID","Event","Status","When"],rows:e.getChannelWebhookEvents.items.map(a=>[p(a.id,12),a.eventType,n(a.status),o$1(a.createdAt)])});}catch(e){g(e);}});let l=r.command("connections").description("Channel connections (OAuth/API keys)");l.command("list").description("List connections for an organization").requiredOption("--organization <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await c($,{organizationId:t.organization,pagination:{limit:t.limit,offset:0}});h(t,n.getConnectionsByOrganization.items);}catch(n){g(n);}}),l.command("create").description("Create a channel connection").requiredOption("--channel <id>").requiredOption("--auth-type <t>","OAUTH|API_KEY|WEBHOOK").option("-f, --format <format>").action(async t=>{try{let n={channelId:t.channel,authType:t.authType.toUpperCase()},e=await c(L,{input:n});i("Connection created"),h(t,e.createConnection);}catch(n){g(n);}}),l.command("delete").description("Delete a connection").argument("<id>").action(async t=>{try{await c(w,{id:t}),i("Connection deleted");}catch(n){g(n);}});}var D={id:"channels",version:"1.0.0",displayName:"Channels",dependsOn:["auth"],register(m,r){a(r),H(m);}},P=D;export{P as default};
@@ -1,4 +1,4 @@
1
- import {a,b as b$1,g,o,n,f,r,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var l=`
1
+ import {a,b as b$1,h as h$1,p,o,g,s,i}from'../../chunk-WXDQ3S5J.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var l=`
2
2
  query ListConversations($filter: ConversationFilter, $first: Int, $after: String) {
3
3
  conversations(filter: $filter, first: $first, after: $after) {
4
4
  edges { node { id title type description createdAt updatedAt unreadCount } }
@@ -152,4 +152,4 @@ import {a,b as b$1,g,o,n,f,r,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as
152
152
  conversation { id title type }
153
153
  }
154
154
  }
155
- `;function Q(d){let o$2=d.command("conversations").description("Conversation management");o$2.command("list").description("List conversations").option("--type <t>","Filter by type (DIRECT|GROUP|CHANNEL)").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>").action(async n$1=>{try{let t={};n$1.type&&(t.type=n$1.type.toUpperCase());let i=(await b$1(l,{filter:Object.keys(t).length?t:void 0,first:n$1.limit})).conversations.edges.map(p=>p.node);g(n$1,i,{headers:["ID","Title","Type","Unread","Created"],rows:i.map(p=>[o(p.id,12),p.title??"-",p.type??"-",String(p.unreadCount??0),n(p.createdAt)])});}catch(t){f(t);}}),o$2.command("get").description("Get a conversation").argument("<id>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(R,{id:n});if(!e.conversation)throw new o$1(`Conversation ${n} not found`);g(t,e.conversation);}catch(e){f(e);}}),o$2.command("create").description("Create a conversation").requiredOption("--title <s>").requiredOption("--participants <ids>","Comma-separated participant userIds (required by schema)").option("--description <s>").option("--type <t>","DIRECT|GROUP|CHANNEL","GROUP").option("-f, --format <format>").action(async n=>{try{let t=r().auth.read();if(!t?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");let e={title:n.title,description:n.description,type:(n.type??"GROUP").toUpperCase(),participantIds:n.participants.split(","),workspaceId:t.workspaceId},i=await b$1(N,{input:e});h$1("Conversation created"),g(n,i.createConversation.conversation);}catch(t){f(t);}}),o$2.command("update").description("Update a conversation").argument("<id>").option("--title <s>").option("--description <s>").option("-f, --format <format>").action(async(n,t)=>{try{let e={id:n};if(t.title&&(e.title=t.title),t.description!==void 0&&(e.description=t.description),Object.keys(e).length===1)throw new o$1("No updates specified");let i=await b$1(T,{input:e});h$1("Conversation updated"),g(t,i.updateConversation.conversation);}catch(e){f(e);}}),o$2.command("delete").description("Delete a conversation").argument("<id>").action(async n=>{try{await b$1(y,{id:n}),h$1("Conversation deleted");}catch(t){f(t);}}),o$2.command("send").description("Send a message to a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>","Reply parent").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,content:{text:t.content},type:"TEXT",parentMessageId:t.parent},i=await b$1(O,{input:e});h$1("Message sent"),g(t,i.sendMessage.message);}catch(e){f(e);}}),Z(o$2),tt(o$2),et(o$2),nt(o$2),ot(o$2),it(o$2);}function Z(d){let o$1=d.command("messages").description("Message operations");o$1.command("edit").description("Edit a message").argument("<id>").requiredOption("--content <text>").option("--reason <s>").option("-f, --format <format>").action(async(n,t)=>{try{let e={id:n,content:{text:t.content}};t.reason&&(e.reason=t.reason);let i=await b$1(S,{input:e});h$1("Message edited"),g(t,i.editMessage);}catch(e){f(e);}}),o$1.command("delete").description("Delete a message").argument("<id>").option("--hard","Hard delete (default: soft)").action(async(n,t)=>{try{await b$1($,{id:n,hard:t.hard??!1}),h$1("Message deleted");}catch(e){f(e);}}),o$1.command("forward").description("Forward a message to another conversation").argument("<messageId>").requiredOption("--to <targetConversationId>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(D,{messageId:n,targetConversationId:t.to});h$1("Message forwarded"),g(t,e.forwardMessage.message);}catch(e){f(e);}}),o$1.command("pin").description("Pin a message").argument("<messageId>").action(async n=>{try{await b$1(M,{messageId:n}),h$1("Message pinned");}catch(t){f(t);}}),o$1.command("unpin").description("Unpin a message").argument("<messageId>").action(async n=>{try{await b$1(_,{messageId:n}),h$1("Message unpinned");}catch(t){f(t);}}),o$1.command("search").description("Search messages").requiredOption("--query <s>").option("--conversation <id>","Restrict to a conversation").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>").action(async n$1=>{try{let e=(await b$1(h,{query:n$1.query,conversationId:n$1.conversation,first:n$1.limit})).searchMessages.edges.map(i=>i.node);g(n$1,e,{headers:["ID","Conversation","Author","Created"],rows:e.map(i=>[o(i.id,12),o(i.conversationId??"-",12),o(i.authorId??"-",12),n(i.createdAt)])});}catch(t){f(t);}});}function tt(d){let o=d.command("drafts").description("Draft message operations");o.command("get").description("Get the actor\u2019s draft for a conversation").argument("<conversationId>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(x,{conversationId:n});if(!e.draft){h$1("No draft saved");return}g(t,e.draft);}catch(e){f(e);}}),o.command("save").description("Save (upsert) a draft for a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,content:{text:t.content}};t.parent&&(e.parentMessageId=t.parent);let i=await b$1(w,{input:e});h$1("Draft saved"),g(t,i.saveDraft);}catch(e){f(e);}}),o.command("delete").description("Delete the actor\u2019s draft for a conversation").argument("<conversationId>").action(async n=>{try{await b$1(P,{conversationId:n}),h$1("Draft deleted");}catch(t){f(t);}});}function et(d){let o=d.command("reactions").description("Reaction operations");o.command("add").description("Add an emoji reaction to a message").argument("<messageId>").requiredOption("--emoji <e>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(U,{messageId:n,emoji:t.emoji});h$1("Reaction added"),g(t,e.addReaction);}catch(e){f(e);}}),o.command("remove").description("Remove an emoji reaction from a message").argument("<messageId>").requiredOption("--emoji <e>").action(async(n,t)=>{try{await b$1(V,{messageId:n,emoji:t.emoji}),h$1("Reaction removed");}catch(e){f(e);}});}function nt(d){let o=d.command("participants").description("Participant operations");o.command("add").description("Add a participant to a conversation").argument("<conversationId>").requiredOption("--user <userId>").option("--role <role>","ADMIN | MODERATOR | MEMBER | GUEST").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,userId:t.user};t.role&&(e.role=t.role.toUpperCase());let i=await b$1(k,{input:e});h$1("Participant added"),g(t,i.addParticipant);}catch(e){f(e);}}),o.command("remove").description("Remove a participant from a conversation").argument("<conversationId>").requiredOption("--user <userId>").option("--reason <s>").action(async(n,t)=>{try{let e={conversationId:n,userId:t.user};t.reason&&(e.reason=t.reason),await b$1(L,{input:e}),h$1("Participant removed");}catch(e){f(e);}}),o.command("role").description("Update a participant\u2019s role").argument("<conversationId>").requiredOption("--user <userId>").requiredOption("--role <role>","ADMIN | MODERATOR | MEMBER | GUEST").action(async(n,t)=>{try{await b$1(G,{input:{conversationId:n,userId:t.user,role:t.role.toUpperCase()}}),h$1("Participant role updated");}catch(e){f(e);}});}function ot(d){let o=(t,e,i,p)=>{d.command(t).description(e).argument("<id>").action(async I=>{try{await b$1(i,{id:I}),h$1(p);}catch(g){f(g);}});},n=(t,e,i,p)=>{d.command(t).description(e).argument("<conversationId>").action(async I=>{try{await b$1(i,{conversationId:I}),h$1(p);}catch(g){f(g);}});};o("archive","Archive a conversation",j,"Archived"),o("unarchive","Unarchive a conversation",b,"Unarchived"),d.command("mute").description("Mute a conversation").argument("<conversationId>").option("--until <iso>","ISO timestamp; omit for indefinite").action(async(t,e)=>{try{await b$1(F,{conversationId:t,until:e.until}),h$1("Muted");}catch(i){f(i);}}),n("unmute","Unmute a conversation",H,"Unmuted"),n("pin","Pin a conversation",K,"Pinned"),n("unpin","Unpin a conversation",J,"Unpinned"),d.command("read").description("Mark a conversation as read").argument("<conversationId>").option("--message <messageId>","Mark read up to this message (defaults to latest)").action(async(t,e)=>{try{await b$1(B,{conversationId:t,messageId:e.message}),h$1("Marked as read");}catch(i){f(i);}}),n("leave","Leave a conversation",q,"Left conversation");}function it(d){let o=d.command("invites").description("Invite link operations");o.command("create").description("Create an invite link for a conversation").argument("<conversationId>").option("--max-uses <n>","Maximum number of uses",n=>parseInt(n,10)).option("--expires-at <iso>","ISO expiry timestamp").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n};t.maxUses!==void 0&&(e.maxUses=t.maxUses),t.expiresAt&&(e.expiresAt=t.expiresAt);let i=await b$1(W,{input:e});h$1("Invite link created"),g(t,i.createInviteLink);}catch(e){f(e);}}),o.command("join").description("Join a conversation via invite code").argument("<code>").action(async n=>{try{await b$1(z,{code:n}),h$1("Joined via invite link");}catch(t){f(t);}}),o.command("validate").description("Validate an invite code").argument("<code>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(X,{code:n});g(t,e.validateInviteLink);}catch(e){f(e);}});}var at={id:"conversations",version:"1.0.0",displayName:"Conversations",dependsOn:["auth","workspaces"],register(d,o){a(o),Q(d);}},ut=at;export{ut as default};
155
+ `;function Q(d){let o$2=d.command("conversations").description("Conversation management");o$2.command("list").description("List conversations").option("--type <t>","Filter by type (DIRECT|GROUP|CHANNEL)").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>").action(async n=>{try{let t={};n.type&&(t.type=n.type.toUpperCase());let i=(await b$1(l,{filter:Object.keys(t).length?t:void 0,first:n.limit})).conversations.edges.map(p=>p.node);h$1(n,i,{headers:["ID","Title","Type","Unread","Created"],rows:i.map(p$1=>[p(p$1.id,12),p$1.title??"-",p$1.type??"-",String(p$1.unreadCount??0),o(p$1.createdAt)])});}catch(t){g(t);}}),o$2.command("get").description("Get a conversation").argument("<id>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(R,{id:n});if(!e.conversation)throw new o$1(`Conversation ${n} not found`);h$1(t,e.conversation);}catch(e){g(e);}}),o$2.command("create").description("Create a conversation").requiredOption("--title <s>").requiredOption("--participants <ids>","Comma-separated participant userIds (required by schema)").option("--description <s>").option("--type <t>","DIRECT|GROUP|CHANNEL","GROUP").option("-f, --format <format>").action(async n=>{try{let t=s().auth.read();if(!t?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");let e={title:n.title,description:n.description,type:(n.type??"GROUP").toUpperCase(),participantIds:n.participants.split(","),workspaceId:t.workspaceId},i$1=await b$1(N,{input:e});i("Conversation created"),h$1(n,i$1.createConversation.conversation);}catch(t){g(t);}}),o$2.command("update").description("Update a conversation").argument("<id>").option("--title <s>").option("--description <s>").option("-f, --format <format>").action(async(n,t)=>{try{let e={id:n};if(t.title&&(e.title=t.title),t.description!==void 0&&(e.description=t.description),Object.keys(e).length===1)throw new o$1("No updates specified");let i$1=await b$1(T,{input:e});i("Conversation updated"),h$1(t,i$1.updateConversation.conversation);}catch(e){g(e);}}),o$2.command("delete").description("Delete a conversation").argument("<id>").action(async n=>{try{await b$1(y,{id:n}),i("Conversation deleted");}catch(t){g(t);}}),o$2.command("send").description("Send a message to a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>","Reply parent").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,content:{text:t.content},type:"TEXT",parentMessageId:t.parent},i$1=await b$1(O,{input:e});i("Message sent"),h$1(t,i$1.sendMessage.message);}catch(e){g(e);}}),Z(o$2),tt(o$2),et(o$2),nt(o$2),ot(o$2),it(o$2);}function Z(d){let o$1=d.command("messages").description("Message operations");o$1.command("edit").description("Edit a message").argument("<id>").requiredOption("--content <text>").option("--reason <s>").option("-f, --format <format>").action(async(n,t)=>{try{let e={id:n,content:{text:t.content}};t.reason&&(e.reason=t.reason);let i$1=await b$1(S,{input:e});i("Message edited"),h$1(t,i$1.editMessage);}catch(e){g(e);}}),o$1.command("delete").description("Delete a message").argument("<id>").option("--hard","Hard delete (default: soft)").action(async(n,t)=>{try{await b$1($,{id:n,hard:t.hard??!1}),i("Message deleted");}catch(e){g(e);}}),o$1.command("forward").description("Forward a message to another conversation").argument("<messageId>").requiredOption("--to <targetConversationId>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(D,{messageId:n,targetConversationId:t.to});i("Message forwarded"),h$1(t,e.forwardMessage.message);}catch(e){g(e);}}),o$1.command("pin").description("Pin a message").argument("<messageId>").action(async n=>{try{await b$1(M,{messageId:n}),i("Message pinned");}catch(t){g(t);}}),o$1.command("unpin").description("Unpin a message").argument("<messageId>").action(async n=>{try{await b$1(_,{messageId:n}),i("Message unpinned");}catch(t){g(t);}}),o$1.command("search").description("Search messages").requiredOption("--query <s>").option("--conversation <id>","Restrict to a conversation").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>").action(async n=>{try{let e=(await b$1(h,{query:n.query,conversationId:n.conversation,first:n.limit})).searchMessages.edges.map(i=>i.node);h$1(n,e,{headers:["ID","Conversation","Author","Created"],rows:e.map(i=>[p(i.id,12),p(i.conversationId??"-",12),p(i.authorId??"-",12),o(i.createdAt)])});}catch(t){g(t);}});}function tt(d){let o=d.command("drafts").description("Draft message operations");o.command("get").description("Get the actor\u2019s draft for a conversation").argument("<conversationId>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(x,{conversationId:n});if(!e.draft){i("No draft saved");return}h$1(t,e.draft);}catch(e){g(e);}}),o.command("save").description("Save (upsert) a draft for a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,content:{text:t.content}};t.parent&&(e.parentMessageId=t.parent);let i$1=await b$1(w,{input:e});i("Draft saved"),h$1(t,i$1.saveDraft);}catch(e){g(e);}}),o.command("delete").description("Delete the actor\u2019s draft for a conversation").argument("<conversationId>").action(async n=>{try{await b$1(P,{conversationId:n}),i("Draft deleted");}catch(t){g(t);}});}function et(d){let o=d.command("reactions").description("Reaction operations");o.command("add").description("Add an emoji reaction to a message").argument("<messageId>").requiredOption("--emoji <e>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(U,{messageId:n,emoji:t.emoji});i("Reaction added"),h$1(t,e.addReaction);}catch(e){g(e);}}),o.command("remove").description("Remove an emoji reaction from a message").argument("<messageId>").requiredOption("--emoji <e>").action(async(n,t)=>{try{await b$1(V,{messageId:n,emoji:t.emoji}),i("Reaction removed");}catch(e){g(e);}});}function nt(d){let o=d.command("participants").description("Participant operations");o.command("add").description("Add a participant to a conversation").argument("<conversationId>").requiredOption("--user <userId>").option("--role <role>","ADMIN | MODERATOR | MEMBER | GUEST").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n,userId:t.user};t.role&&(e.role=t.role.toUpperCase());let i$1=await b$1(k,{input:e});i("Participant added"),h$1(t,i$1.addParticipant);}catch(e){g(e);}}),o.command("remove").description("Remove a participant from a conversation").argument("<conversationId>").requiredOption("--user <userId>").option("--reason <s>").action(async(n,t)=>{try{let e={conversationId:n,userId:t.user};t.reason&&(e.reason=t.reason),await b$1(L,{input:e}),i("Participant removed");}catch(e){g(e);}}),o.command("role").description("Update a participant\u2019s role").argument("<conversationId>").requiredOption("--user <userId>").requiredOption("--role <role>","ADMIN | MODERATOR | MEMBER | GUEST").action(async(n,t)=>{try{await b$1(G,{input:{conversationId:n,userId:t.user,role:t.role.toUpperCase()}}),i("Participant role updated");}catch(e){g(e);}});}function ot(d){let o=(t,e,i$1,p)=>{d.command(t).description(e).argument("<id>").action(async I=>{try{await b$1(i$1,{id:I}),i(p);}catch(g$1){g(g$1);}});},n=(t,e,i$1,p)=>{d.command(t).description(e).argument("<conversationId>").action(async I=>{try{await b$1(i$1,{conversationId:I}),i(p);}catch(g$1){g(g$1);}});};o("archive","Archive a conversation",j,"Archived"),o("unarchive","Unarchive a conversation",b,"Unarchived"),d.command("mute").description("Mute a conversation").argument("<conversationId>").option("--until <iso>","ISO timestamp; omit for indefinite").action(async(t,e)=>{try{await b$1(F,{conversationId:t,until:e.until}),i("Muted");}catch(i){g(i);}}),n("unmute","Unmute a conversation",H,"Unmuted"),n("pin","Pin a conversation",K,"Pinned"),n("unpin","Unpin a conversation",J,"Unpinned"),d.command("read").description("Mark a conversation as read").argument("<conversationId>").option("--message <messageId>","Mark read up to this message (defaults to latest)").action(async(t,e)=>{try{await b$1(B,{conversationId:t,messageId:e.message}),i("Marked as read");}catch(i){g(i);}}),n("leave","Leave a conversation",q,"Left conversation");}function it(d){let o=d.command("invites").description("Invite link operations");o.command("create").description("Create an invite link for a conversation").argument("<conversationId>").option("--max-uses <n>","Maximum number of uses",n=>parseInt(n,10)).option("--expires-at <iso>","ISO expiry timestamp").option("-f, --format <format>").action(async(n,t)=>{try{let e={conversationId:n};t.maxUses!==void 0&&(e.maxUses=t.maxUses),t.expiresAt&&(e.expiresAt=t.expiresAt);let i$1=await b$1(W,{input:e});i("Invite link created"),h$1(t,i$1.createInviteLink);}catch(e){g(e);}}),o.command("join").description("Join a conversation via invite code").argument("<code>").action(async n=>{try{await b$1(z,{code:n}),i("Joined via invite link");}catch(t){g(t);}}),o.command("validate").description("Validate an invite code").argument("<code>").option("-f, --format <format>").action(async(n,t)=>{try{let e=await b$1(X,{code:n});h$1(t,e.validateInviteLink);}catch(e){g(e);}});}var at={id:"conversations",version:"1.0.0",displayName:"Conversations",dependsOn:["auth","workspaces"],register(d,o){a(o),Q(d);}},ut=at;export{ut as default};
@@ -1,4 +1,4 @@
1
- import {a,c,g,o,m,f,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var N=`
1
+ import {a,c,h as h$1,p,n,g,i}from'../../chunk-WXDQ3S5J.js';import {o}from'../../chunk-TCBALVP4.js';var N=`
2
2
  query ListOrganizations($filter: OrganizationFilterInput, $limit: Int, $offset: Int) {
3
3
  organizations(filter: $filter, limit: $limit, offset: $offset) {
4
4
  items { id name slug status }
@@ -130,4 +130,4 @@ import {a,c,g,o,m,f,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from
130
130
  id status reviewStatus reviewNotes
131
131
  }
132
132
  }
133
- `;function Z(A){let c$1=A.command("devportal").description("Developer portal: orgs, apps, webhooks, revenue"),m$1=c$1.command("orgs").description("Publisher organizations");m$1.command("list").description("List devportal organizations").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n=(await c(N,{limit:t.limit,offset:0})).organizations.items;g(t,n,{headers:["ID","Name","Slug","Status"],rows:n.map(o$1=>[o(o$1.id,12),o$1.name,o$1.slug??"-",m(o$1.status)])});}catch(i){f(i);}}),m$1.command("get").description("Get an organization").argument("<id>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(w,{id:t});if(!n.organization)throw new o$1(`Organization ${t} not found`);g(i,n.organization);}catch(n){f(n);}}),m$1.command("create").description("Create a publisher organization").requiredOption("--name <s>").requiredOption("--slug <s>","Unique slug (required by schema)").option("--description <s>").option("--tier <t>","INDIVIDUAL|ORGANIZATION|ENTERPRISE","ORGANIZATION").option("-f, --format <format>").action(async t=>{try{let i={name:t.name,slug:t.slug,description:t.description,tier:(t.tier??"ORGANIZATION").toUpperCase()},n=await c(C,{input:i});h$1(`Organization created: ${n.createOrganization.name}`),g(t,n.createOrganization);}catch(i){f(i);}}),m$1.command("update").description("Update an organization").argument("<id>").option("--name <s>").option("--description <s>").option("-f, --format <format>").action(async(t,i)=>{try{let n={};if(i.name&&(n.name=i.name),i.description!==void 0&&(n.description=i.description),!Object.keys(n).length)throw new o$1("No updates specified");let o=await c(v,{id:t,input:n});h$1("Organization updated"),g(i,o.updateOrganization);}catch(n){f(n);}}),m$1.command("delete").description("Delete an organization").argument("<id>").action(async t=>{try{await c(P,{id:t}),h$1("Organization deleted");}catch(i){f(i);}});let p=c$1.command("apps").description("Applications");p.command("list").description("List applications").option("--organization <id>").option("--status <s>","DRAFT|REVIEW|PUBLISHED|ARCHIVED").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n=(await c(S,{organizationId:t.organization,status:t.status?.toUpperCase(),limit:t.limit})).applications.edges.map(o=>o.node);g(t,n,{headers:["ID","Name","Status","Installs","Rating"],rows:n.map(o$1=>[o(o$1.id,12),o$1.name,m(o$1.status),String(o$1.installCount??0),String(o$1.averageRating??"-")])});}catch(i){f(i);}}),p.command("get").description("Get an application").argument("<id>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(y,{id:t});if(!n.application)throw new o$1(`Application ${t} not found`);g(i,n.application);}catch(n){f(n);}}),p.command("create").description("Create an application").requiredOption("--name <s>").requiredOption("--organization <id>").option("--type <t>","API_INTEGRATION|WEB_APP|MOBILE_APP","API_INTEGRATION").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let i={name:t.name,developerOrganizationId:t.organization,appType:(t.type??"API_INTEGRATION").toUpperCase(),description:t.description},n=await c($,{input:i});h$1(`Application created: ${n.createApplication.name}`),g(t,n.createApplication);}catch(i){f(i);}}),p.command("update").description("Update an application").argument("<id>").option("--description <s>").option("--pricing <p>","FREE|PAID_ONETIME|SUBSCRIPTION").option("--docs-url <url>").option("-f, --format <format>").action(async(t,i)=>{try{let n={};if(i.description!==void 0&&(n.description=i.description),i.pricing&&(n.pricingType=i.pricing.toUpperCase()),i.docsUrl&&(n.documentationUrl=i.docsUrl),!Object.keys(n).length)throw new o$1("No updates specified");let o=await c(D,{id:t,input:n});h$1("Application updated"),g(i,o.updateApplication);}catch(n){f(n);}}),p.command("submit-review").description("Submit an application for review").argument("<id>").option("--notes <s>").action(async(t,i)=>{try{await c(h,{id:t,notes:i.notes}),h$1("Submitted for review");}catch(n){f(n);}}),p.command("publish").description("Publish an application").argument("<id>").action(async t=>{try{await c(_,{id:t}),h$1("Application published");}catch(i){f(i);}}),p.command("delete").description("Delete an application").argument("<id>").action(async t=>{try{await c(L,{id:t}),h$1("Application deleted");}catch(i){f(i);}});let f$1=p.command("versions").description("Application versions");f$1.command("list").description("List versions for an application").argument("<applicationId>").option("-f, --format <format>").action(async(t,i)=>{try{let o$1=(await c(b,{applicationId:t})).application?.versions??[];g(i,o$1,{headers:["ID","Version","Status","Latest","Stable"],rows:o$1.map(l=>[o(l.id,12),l.version,m(l.status),String(!!l.isLatest),String(!!l.isStable)])});}catch(n){f(n);}}),f$1.command("create").description("Create an application version").requiredOption("--application <id>").requiredOption("--version <v>").option("--notes <s>").option("--package <url>","Package URL").option("-f, --format <format>").action(async t=>{try{let i={version:t.version,releaseNotes:t.notes,packageUrl:t.package},n=await c(z,{applicationId:t.application,input:i});h$1(`Version created: ${n.createApplicationVersion.version}`),g(t,n.createApplicationVersion);}catch(i){f(i);}});let I=p.command("webhooks").description("Application webhooks");I.command("list").description("List webhooks for an application").argument("<applicationId>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(k,{applicationId:t});g(i,n.webhooks,{headers:["ID","Name","URL","Active","Failures"],rows:n.webhooks.map(o$1=>[o(o$1.id,12),o$1.name,o(o$1.url,40),String(!!o$1.isActive),String(o$1.failureCount??0)])});}catch(n){f(n);}}),I.command("add").description("Add a webhook to an application").requiredOption("--application <id>").requiredOption("--name <s>").requiredOption("--url <url>").requiredOption("--events <s>","Comma-separated event names").option("--max-retries <n>","",t=>parseInt(t,10),5).option("-f, --format <format>").action(async t=>{try{let i={applicationId:t.application,name:t.name,url:t.url,events:t.events.split(","),retryEnabled:!0,maxRetries:t.maxRetries},n=await c(U,{input:i});h$1("Webhook created"),g(t,n.createWebhook);}catch(i){f(i);}}),I.command("remove").description("Remove a webhook").argument("<id>").action(async t=>{try{await c(x,{id:t}),h$1("Webhook removed");}catch(i){f(i);}}),p.command("analytics").description("Application analytics for a period").requiredOption("--application <id>").option("--period <p>","LAST_7_DAYS|LAST_30_DAYS|CUSTOM","LAST_30_DAYS").option("--from <iso>").option("--to <iso>").option("-f, --format <format>").action(async t=>{try{let i=await c(G,{applicationId:t.application,period:(t.period??"LAST_30_DAYS").toUpperCase(),startDate:t.from,endDate:t.to});g(t,i.applicationAnalytics);}catch(i){f(i);}}),c$1.command("revenue").description("Revenue for an organization").requiredOption("--organization <id>").option("--period <p>","LAST_7_DAYS|LAST_30_DAYS|YTD","LAST_30_DAYS").option("-f, --format <format>").action(async t=>{try{let i=await c(V,{organizationId:t.organization,period:(t.period??"LAST_30_DAYS").toUpperCase()});g(t,i.organizationRevenue);}catch(i){f(i);}});let O=c$1.command("admin").description("Admin operations").command("reviews").description("Application review queue");O.command("list").description("List applications pending review").option("--status <s>","PENDING|APPROVED|REJECTED","PENDING").option("-f, --format <format>").action(async t=>{try{let i=await c(q,{status:(t.status??"PENDING").toUpperCase()});g(t,i.adminReviews.edges.map(n=>n.node));}catch(i){f(i);}}),O.command("approve").description("Approve an application").argument("<applicationId>").option("--notes <s>").action(async(t,i)=>{try{await c(W,{id:t,notes:i.notes}),h$1("Application approved");}catch(n){f(n);}}),O.command("reject").description("Reject an application").argument("<applicationId>").requiredOption("--notes <s>","Reason for rejection").action(async(t,i)=>{try{await c(B,{id:t,notes:i.notes}),h$1("Application rejected");}catch(n){f(n);}});}var M={id:"devportal",version:"1.0.0",displayName:"Developer Portal",dependsOn:["auth"],register(A,c){a(c),Z(A);}},it=M;export{it as default};
133
+ `;function Z(A){let c$1=A.command("devportal").description("Developer portal: orgs, apps, webhooks, revenue"),m=c$1.command("orgs").description("Publisher organizations");m.command("list").description("List devportal organizations").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n$1=(await c(N,{limit:t.limit,offset:0})).organizations.items;h$1(t,n$1,{headers:["ID","Name","Slug","Status"],rows:n$1.map(o=>[p(o.id,12),o.name,o.slug??"-",n(o.status)])});}catch(i){g(i);}}),m.command("get").description("Get an organization").argument("<id>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(w,{id:t});if(!n.organization)throw new o(`Organization ${t} not found`);h$1(i,n.organization);}catch(n){g(n);}}),m.command("create").description("Create a publisher organization").requiredOption("--name <s>").requiredOption("--slug <s>","Unique slug (required by schema)").option("--description <s>").option("--tier <t>","INDIVIDUAL|ORGANIZATION|ENTERPRISE","ORGANIZATION").option("-f, --format <format>").action(async t=>{try{let i$1={name:t.name,slug:t.slug,description:t.description,tier:(t.tier??"ORGANIZATION").toUpperCase()},n=await c(C,{input:i$1});i(`Organization created: ${n.createOrganization.name}`),h$1(t,n.createOrganization);}catch(i){g(i);}}),m.command("update").description("Update an organization").argument("<id>").option("--name <s>").option("--description <s>").option("-f, --format <format>").action(async(t,i$1)=>{try{let n={};if(i$1.name&&(n.name=i$1.name),i$1.description!==void 0&&(n.description=i$1.description),!Object.keys(n).length)throw new o("No updates specified");let o$1=await c(v,{id:t,input:n});i("Organization updated"),h$1(i$1,o$1.updateOrganization);}catch(n){g(n);}}),m.command("delete").description("Delete an organization").argument("<id>").action(async t=>{try{await c(P,{id:t}),i("Organization deleted");}catch(i){g(i);}});let p$1=c$1.command("apps").description("Applications");p$1.command("list").description("List applications").option("--organization <id>").option("--status <s>","DRAFT|REVIEW|PUBLISHED|ARCHIVED").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n$1=(await c(S,{organizationId:t.organization,status:t.status?.toUpperCase(),limit:t.limit})).applications.edges.map(o=>o.node);h$1(t,n$1,{headers:["ID","Name","Status","Installs","Rating"],rows:n$1.map(o=>[p(o.id,12),o.name,n(o.status),String(o.installCount??0),String(o.averageRating??"-")])});}catch(i){g(i);}}),p$1.command("get").description("Get an application").argument("<id>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(y,{id:t});if(!n.application)throw new o(`Application ${t} not found`);h$1(i,n.application);}catch(n){g(n);}}),p$1.command("create").description("Create an application").requiredOption("--name <s>").requiredOption("--organization <id>").option("--type <t>","API_INTEGRATION|WEB_APP|MOBILE_APP","API_INTEGRATION").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let i$1={name:t.name,developerOrganizationId:t.organization,appType:(t.type??"API_INTEGRATION").toUpperCase(),description:t.description},n=await c($,{input:i$1});i(`Application created: ${n.createApplication.name}`),h$1(t,n.createApplication);}catch(i){g(i);}}),p$1.command("update").description("Update an application").argument("<id>").option("--description <s>").option("--pricing <p>","FREE|PAID_ONETIME|SUBSCRIPTION").option("--docs-url <url>").option("-f, --format <format>").action(async(t,i$1)=>{try{let n={};if(i$1.description!==void 0&&(n.description=i$1.description),i$1.pricing&&(n.pricingType=i$1.pricing.toUpperCase()),i$1.docsUrl&&(n.documentationUrl=i$1.docsUrl),!Object.keys(n).length)throw new o("No updates specified");let o$1=await c(D,{id:t,input:n});i("Application updated"),h$1(i$1,o$1.updateApplication);}catch(n){g(n);}}),p$1.command("submit-review").description("Submit an application for review").argument("<id>").option("--notes <s>").action(async(t,i$1)=>{try{await c(h,{id:t,notes:i$1.notes}),i("Submitted for review");}catch(n){g(n);}}),p$1.command("publish").description("Publish an application").argument("<id>").action(async t=>{try{await c(_,{id:t}),i("Application published");}catch(i){g(i);}}),p$1.command("delete").description("Delete an application").argument("<id>").action(async t=>{try{await c(L,{id:t}),i("Application deleted");}catch(i){g(i);}});let f=p$1.command("versions").description("Application versions");f.command("list").description("List versions for an application").argument("<applicationId>").option("-f, --format <format>").action(async(t,i)=>{try{let o=(await c(b,{applicationId:t})).application?.versions??[];h$1(i,o,{headers:["ID","Version","Status","Latest","Stable"],rows:o.map(l=>[p(l.id,12),l.version,n(l.status),String(!!l.isLatest),String(!!l.isStable)])});}catch(n){g(n);}}),f.command("create").description("Create an application version").requiredOption("--application <id>").requiredOption("--version <v>").option("--notes <s>").option("--package <url>","Package URL").option("-f, --format <format>").action(async t=>{try{let i$1={version:t.version,releaseNotes:t.notes,packageUrl:t.package},n=await c(z,{applicationId:t.application,input:i$1});i(`Version created: ${n.createApplicationVersion.version}`),h$1(t,n.createApplicationVersion);}catch(i){g(i);}});let I=p$1.command("webhooks").description("Application webhooks");I.command("list").description("List webhooks for an application").argument("<applicationId>").option("-f, --format <format>").action(async(t,i)=>{try{let n=await c(k,{applicationId:t});h$1(i,n.webhooks,{headers:["ID","Name","URL","Active","Failures"],rows:n.webhooks.map(o=>[p(o.id,12),o.name,p(o.url,40),String(!!o.isActive),String(o.failureCount??0)])});}catch(n){g(n);}}),I.command("add").description("Add a webhook to an application").requiredOption("--application <id>").requiredOption("--name <s>").requiredOption("--url <url>").requiredOption("--events <s>","Comma-separated event names").option("--max-retries <n>","",t=>parseInt(t,10),5).option("-f, --format <format>").action(async t=>{try{let i$1={applicationId:t.application,name:t.name,url:t.url,events:t.events.split(","),retryEnabled:!0,maxRetries:t.maxRetries},n=await c(U,{input:i$1});i("Webhook created"),h$1(t,n.createWebhook);}catch(i){g(i);}}),I.command("remove").description("Remove a webhook").argument("<id>").action(async t=>{try{await c(x,{id:t}),i("Webhook removed");}catch(i){g(i);}}),p$1.command("analytics").description("Application analytics for a period").requiredOption("--application <id>").option("--period <p>","LAST_7_DAYS|LAST_30_DAYS|CUSTOM","LAST_30_DAYS").option("--from <iso>").option("--to <iso>").option("-f, --format <format>").action(async t=>{try{let i=await c(G,{applicationId:t.application,period:(t.period??"LAST_30_DAYS").toUpperCase(),startDate:t.from,endDate:t.to});h$1(t,i.applicationAnalytics);}catch(i){g(i);}}),c$1.command("revenue").description("Revenue for an organization").requiredOption("--organization <id>").option("--period <p>","LAST_7_DAYS|LAST_30_DAYS|YTD","LAST_30_DAYS").option("-f, --format <format>").action(async t=>{try{let i=await c(V,{organizationId:t.organization,period:(t.period??"LAST_30_DAYS").toUpperCase()});h$1(t,i.organizationRevenue);}catch(i){g(i);}});let O=c$1.command("admin").description("Admin operations").command("reviews").description("Application review queue");O.command("list").description("List applications pending review").option("--status <s>","PENDING|APPROVED|REJECTED","PENDING").option("-f, --format <format>").action(async t=>{try{let i=await c(q,{status:(t.status??"PENDING").toUpperCase()});h$1(t,i.adminReviews.edges.map(n=>n.node));}catch(i){g(i);}}),O.command("approve").description("Approve an application").argument("<applicationId>").option("--notes <s>").action(async(t,i$1)=>{try{await c(W,{id:t,notes:i$1.notes}),i("Application approved");}catch(n){g(n);}}),O.command("reject").description("Reject an application").argument("<applicationId>").requiredOption("--notes <s>","Reason for rejection").action(async(t,i$1)=>{try{await c(B,{id:t,notes:i$1.notes}),i("Application rejected");}catch(n){g(n);}});}var M={id:"devportal",version:"1.0.0",displayName:"Developer Portal",dependsOn:["auth"],register(A,c){a(c),Z(A);}},it=M;export{it as default};
@@ -1,4 +1,4 @@
1
- import {a,b,g,o,m,n,f,h as h$1,j,r}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';import {writeFile}from'fs/promises';var J=`
1
+ import {a,b,h as h$1,p,n,o,g,i as i$1,k,s}from'../../chunk-WXDQ3S5J.js';import {o as o$1}from'../../chunk-TCBALVP4.js';import {writeFile}from'fs/promises';var J=`
2
2
  query ListExportJobs($context: ContextInput!, $filter: ExportJobFilterInput, $pagination: ExportPaginationInput) {
3
3
  listExportJobs(context: $context, filter: $filter, pagination: $pagination) {
4
4
  edges { node {
@@ -92,4 +92,4 @@ import {a,b,g,o,m,n,f,h as h$1,j,r}from'../../chunk-LZQBJDKZ.js';import {o as o$
92
92
  downloadUrl downloadExpiresAt
93
93
  }
94
94
  }
95
- `;function i(){let l=r().auth.read();if(!l?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:l.workspaceId}}function X(l){let m$1=l.command("export").description("Workspace data export jobs"),u=m$1.command("jobs").description("Export job lifecycle");u.command("list").description("List export jobs").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.status&&(e.status=t.status.toUpperCase());let n$1=(await b(J,{context:i(),filter:Object.keys(e).length?e:void 0,pagination:{first:t.limit}})).listExportJobs.edges.map(p=>p.node);g(t,n$1,{headers:["ID","Name","Status","Progress","Started"],rows:n$1.map(p=>[o(p.id,12),p.name??"-",m(p.status),`${p.processedEntities??0}/${p.totalEntities??"-"}`,n(p.startedAt)])});}catch(e){f(e);}}),u.command("get").description("Get an export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(E,{context:i(),id:t});if(!o.getExportJob)throw new o$1(`Export job ${t} not found`);g(e,o.getExportJob);}catch(o){f(o);}}),u.command("create").description("Create an export job").requiredOption("--name <s>").requiredOption("--types <t>","Comma-separated entity types").option("--format <fmt>","JSON|CSV|ZIP","JSON").option("--include-media","Include media files",false).option("--include-metadata","Include metadata",true).option("--from <iso>","Date range start").option("--to <iso>","Date range end").option("-f, --format-output <format>").action(async t=>{try{let e={name:t.name,entityTypes:t.types.split(","),format:(t.format??"JSON").toUpperCase(),includeMedia:!!t.includeMedia,includeMetadata:t.includeMetadata!==!1,dateRangeStart:t.from,dateRangeEnd:t.to},o=await b(O,{context:i(),input:e});h$1(`Export job created: ${o.createExportJob.id}`),g({format:t.formatOutput},o.createExportJob);}catch(e){f(e);}}),u.command("cancel").description("Cancel a running export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(R,{context:i(),id:t});h$1(`Export job cancelled: ${o.cancelExportJob.id}`),g(e,o.cancelExportJob);}catch(o){f(o);}}),u.command("delete").description("Delete an export job").argument("<id>").action(async t=>{try{if(!(await b(A,{context:i(),id:t})).deleteExportJob)throw new o$1(`Failed to delete export job ${t}`);h$1(`Export job deleted: ${t}`);}catch(e){f(e);}}),u.command("retry").description("Retry a failed export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(M,{context:i(),id:t});h$1(`Export job retry queued: ${o.retryExportJob.id}`),g(e,o.retryExportJob);}catch(o){f(o);}}),m$1.command("entities").description("List entity types available for export").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let o=(await b(L,{context:i(),pagination:{first:t.limit}})).getAvailableExportEntities.edges.map(n=>n.node);g(t,o,{headers:["Type","Display","Enabled","DateRange","Media","Size"],rows:o.map(n=>[n.entityType,n.displayName,n.enabled?"yes":"no",n.supportsDateRange?"yes":"no",n.supportsMediaExport?"yes":"no",n.estimatedSize??"-"])});}catch(e){f(e);}}),m$1.command("part").description("Get an export part by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(S,{context:i(),id:t});if(!o.getExportPart)throw new o$1(`Export part ${t} not found`);g(e,o.getExportPart);}catch(o){f(o);}}),m$1.command("download").description("Download a completed export job to a local path").argument("<jobId>").requiredOption("--to <path>","Local file path to write").action(async(t,e)=>{try{let o=await b(E,{context:i(),id:t});if(!o.getExportJob)throw new o$1(`Export job ${t} not found`);let n=o.getExportJob.downloadUrl;if(!n)throw new o$1(`Job ${t} has no downloadUrl yet (status=${o.getExportJob.status??"UNKNOWN"}).`);j(`Downloading from ${n}`);let p=await fetch(n);if(!p.ok)throw new o$1(`Download failed: ${p.status} ${p.statusText}`);let f=Buffer.from(await p.arrayBuffer());await writeFile(e.to,f),h$1(`Saved ${f.length} bytes to ${e.to}`);}catch(o){f(o);}});let x=m$1.command("templates").description("Export templates");x.command("list").description("List export templates").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await b(P,{context:i(),pagination:{first:t.limit}});g(t,e.listExportTemplates.edges.map(o=>o.node));}catch(e){f(e);}}),x.command("get").description("Get an export template").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(_,{context:i(),id:t});if(!o.getExportTemplate)throw new o$1(`Template ${t} not found`);g(e,o.getExportTemplate);}catch(o){f(o);}}),x.command("create").description("Create an export template").requiredOption("--name <s>").requiredOption("--types <t>","Comma-separated entity types").option("--description <s>").option("--format <fmt>","JSON|CSV","JSON").option("--include-media","Include media files",false).option("--include-metadata","Include metadata",true).option("-f, --format-output <format>").action(async t=>{try{let e={name:t.name,entityTypes:t.types.split(","),format:(t.format??"JSON").toUpperCase(),includeMedia:!!t.includeMedia,includeMetadata:t.includeMetadata!==!1};t.description&&(e.description=t.description);let o=await b(N,{context:i(),input:e});h$1(`Template created: ${o.createExportTemplate.id}`),g({format:t.formatOutput},o.createExportTemplate);}catch(e){f(e);}}),x.command("update").description("Update an export template").argument("<id>").option("--name <s>").option("--description <s>").option("--types <t>","Comma-separated entity types").option("--format <fmt>","JSON|CSV").option("--include-media <bool>","true|false").option("--include-metadata <bool>","true|false").option("--default <bool>","Set isDefault: true|false").option("-f, --format-output <format>").action(async(t,e)=>{try{let o={};e.name&&(o.name=e.name),e.description&&(o.description=e.description),e.types&&(o.entityTypes=e.types.split(",")),e.format&&(o.format=e.format.toUpperCase()),e.includeMedia!==void 0&&(o.includeMedia=e.includeMedia==="true"),e.includeMetadata!==void 0&&(o.includeMetadata=e.includeMetadata==="true"),e.default!==void 0&&(o.isDefault=e.default==="true");let n=await b(h,{context:i(),id:t,input:o});h$1(`Template updated: ${n.updateExportTemplate.id}`),g({format:e.formatOutput},n.updateExportTemplate);}catch(o){f(o);}}),x.command("delete").description("Delete an export template").argument("<id>").action(async t=>{try{if(!(await b(D,{context:i(),id:t})).deleteExportTemplate)throw new o$1(`Failed to delete template ${t}`);h$1(`Template deleted: ${t}`);}catch(e){f(e);}});}var U={id:"export",version:"1.0.0",displayName:"Export",dependsOn:["auth","workspaces"],register(l,m){a(m),X(l);}},W=U;export{W as default};
95
+ `;function i(){let l=s().auth.read();if(!l?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:l.workspaceId}}function X(l){let m=l.command("export").description("Workspace data export jobs"),u=m.command("jobs").description("Export job lifecycle");u.command("list").description("List export jobs").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.status&&(e.status=t.status.toUpperCase());let n$1=(await b(J,{context:i(),filter:Object.keys(e).length?e:void 0,pagination:{first:t.limit}})).listExportJobs.edges.map(p=>p.node);h$1(t,n$1,{headers:["ID","Name","Status","Progress","Started"],rows:n$1.map(p$1=>[p(p$1.id,12),p$1.name??"-",n(p$1.status),`${p$1.processedEntities??0}/${p$1.totalEntities??"-"}`,o(p$1.startedAt)])});}catch(e){g(e);}}),u.command("get").description("Get an export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(E,{context:i(),id:t});if(!o.getExportJob)throw new o$1(`Export job ${t} not found`);h$1(e,o.getExportJob);}catch(o){g(o);}}),u.command("create").description("Create an export job").requiredOption("--name <s>").requiredOption("--types <t>","Comma-separated entity types").option("--format <fmt>","JSON|CSV|ZIP","JSON").option("--include-media","Include media files",false).option("--include-metadata","Include metadata",true).option("--from <iso>","Date range start").option("--to <iso>","Date range end").option("-f, --format-output <format>").action(async t=>{try{let e={name:t.name,entityTypes:t.types.split(","),format:(t.format??"JSON").toUpperCase(),includeMedia:!!t.includeMedia,includeMetadata:t.includeMetadata!==!1,dateRangeStart:t.from,dateRangeEnd:t.to},o=await b(O,{context:i(),input:e});i$1(`Export job created: ${o.createExportJob.id}`),h$1({format:t.formatOutput},o.createExportJob);}catch(e){g(e);}}),u.command("cancel").description("Cancel a running export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(R,{context:i(),id:t});i$1(`Export job cancelled: ${o.cancelExportJob.id}`),h$1(e,o.cancelExportJob);}catch(o){g(o);}}),u.command("delete").description("Delete an export job").argument("<id>").action(async t=>{try{if(!(await b(A,{context:i(),id:t})).deleteExportJob)throw new o$1(`Failed to delete export job ${t}`);i$1(`Export job deleted: ${t}`);}catch(e){g(e);}}),u.command("retry").description("Retry a failed export job").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(M,{context:i(),id:t});i$1(`Export job retry queued: ${o.retryExportJob.id}`),h$1(e,o.retryExportJob);}catch(o){g(o);}}),m.command("entities").description("List entity types available for export").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let o=(await b(L,{context:i(),pagination:{first:t.limit}})).getAvailableExportEntities.edges.map(n=>n.node);h$1(t,o,{headers:["Type","Display","Enabled","DateRange","Media","Size"],rows:o.map(n=>[n.entityType,n.displayName,n.enabled?"yes":"no",n.supportsDateRange?"yes":"no",n.supportsMediaExport?"yes":"no",n.estimatedSize??"-"])});}catch(e){g(e);}}),m.command("part").description("Get an export part by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(S,{context:i(),id:t});if(!o.getExportPart)throw new o$1(`Export part ${t} not found`);h$1(e,o.getExportPart);}catch(o){g(o);}}),m.command("download").description("Download a completed export job to a local path").argument("<jobId>").requiredOption("--to <path>","Local file path to write").action(async(t,e)=>{try{let o=await b(E,{context:i(),id:t});if(!o.getExportJob)throw new o$1(`Export job ${t} not found`);let n=o.getExportJob.downloadUrl;if(!n)throw new o$1(`Job ${t} has no downloadUrl yet (status=${o.getExportJob.status??"UNKNOWN"}).`);k(`Downloading from ${n}`);let p=await fetch(n);if(!p.ok)throw new o$1(`Download failed: ${p.status} ${p.statusText}`);let f=Buffer.from(await p.arrayBuffer());await writeFile(e.to,f),i$1(`Saved ${f.length} bytes to ${e.to}`);}catch(o){g(o);}});let x=m.command("templates").description("Export templates");x.command("list").description("List export templates").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await b(P,{context:i(),pagination:{first:t.limit}});h$1(t,e.listExportTemplates.edges.map(o=>o.node));}catch(e){g(e);}}),x.command("get").description("Get an export template").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(_,{context:i(),id:t});if(!o.getExportTemplate)throw new o$1(`Template ${t} not found`);h$1(e,o.getExportTemplate);}catch(o){g(o);}}),x.command("create").description("Create an export template").requiredOption("--name <s>").requiredOption("--types <t>","Comma-separated entity types").option("--description <s>").option("--format <fmt>","JSON|CSV","JSON").option("--include-media","Include media files",false).option("--include-metadata","Include metadata",true).option("-f, --format-output <format>").action(async t=>{try{let e={name:t.name,entityTypes:t.types.split(","),format:(t.format??"JSON").toUpperCase(),includeMedia:!!t.includeMedia,includeMetadata:t.includeMetadata!==!1};t.description&&(e.description=t.description);let o=await b(N,{context:i(),input:e});i$1(`Template created: ${o.createExportTemplate.id}`),h$1({format:t.formatOutput},o.createExportTemplate);}catch(e){g(e);}}),x.command("update").description("Update an export template").argument("<id>").option("--name <s>").option("--description <s>").option("--types <t>","Comma-separated entity types").option("--format <fmt>","JSON|CSV").option("--include-media <bool>","true|false").option("--include-metadata <bool>","true|false").option("--default <bool>","Set isDefault: true|false").option("-f, --format-output <format>").action(async(t,e)=>{try{let o={};e.name&&(o.name=e.name),e.description&&(o.description=e.description),e.types&&(o.entityTypes=e.types.split(",")),e.format&&(o.format=e.format.toUpperCase()),e.includeMedia!==void 0&&(o.includeMedia=e.includeMedia==="true"),e.includeMetadata!==void 0&&(o.includeMetadata=e.includeMetadata==="true"),e.default!==void 0&&(o.isDefault=e.default==="true");let n=await b(h,{context:i(),id:t,input:o});i$1(`Template updated: ${n.updateExportTemplate.id}`),h$1({format:e.formatOutput},n.updateExportTemplate);}catch(o){g(o);}}),x.command("delete").description("Delete an export template").argument("<id>").action(async t=>{try{if(!(await b(D,{context:i(),id:t})).deleteExportTemplate)throw new o$1(`Failed to delete template ${t}`);i$1(`Template deleted: ${t}`);}catch(e){g(e);}});}var U={id:"export",version:"1.0.0",displayName:"Export",dependsOn:["auth","workspaces"],register(l,m){a(m),X(l);}},W=U;export{W as default};
@@ -1,4 +1,4 @@
1
- import {a,b,g,j,o,f,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';import {statSync,readFileSync}from'fs';import {basename,extname}from'path';import {createHash}from'crypto';var h=`
1
+ import {a,b,h as h$1,k,p,g,i}from'../../chunk-WXDQ3S5J.js';import {o}from'../../chunk-TCBALVP4.js';import {statSync,readFileSync}from'fs';import {basename,extname}from'path';import {createHash}from'crypto';var h=`
2
2
  query BrowseFolderRoot($pagination: PaginationInput) {
3
3
  getFilesInFolder(pagination: $pagination) {
4
4
  files { id name size mimeType extension createdAt }
@@ -59,6 +59,6 @@ import {a,b,g,j,o,f,h as h$1}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from
59
59
  query GetFileDownloadUrl($id: ID!, $expiresIn: Int) {
60
60
  getFileDownloadUrl(id: $id, expiresIn: $expiresIn)
61
61
  }
62
- `;function D(c){let s=c.command("files").description("Workspace file management");s.command("browse").description("Browse a folder (defaults to root)").argument("[folderId]").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let o$1={limit:e.limit,offset:0};if(t){let i=await b(x,{folderId:t,pagination:o$1});if(e.format){g(e,{folder:i.getFolder,files:i.getFilesInFolder.files});return}i.getFolder&&j(`Folder: ${i.getFolder.name}`);for(let n of i.getFilesInFolder.files){let f=n.size?`${n.size}b`:"-";console.log(` \u{1F4C4} ${o(n.id,12)} ${n.name} ${f} ${n.mimeType??"-"}`);}console.log(`
63
- ${i.getFilesInFolder.total} files`);return}let d=await b(h,{pagination:o$1});if(e.format){g(e,{files:d.getFilesInFolder.files});return}for(let i of d.getFilesInFolder.files){let n=i.size?`${i.size}b`:"-";console.log(` \u{1F4C4} ${o(i.id,12)} ${i.name} ${n} ${i.mimeType??"-"}`);}console.log(`
64
- ${d.getFilesInFolder.total} files`);}catch(o){f(o);}}),s.command("upload").description("Upload a local file (initiates a multipart session)").argument("<path>","Local file path").option("--folder <folderId>","Target folder id").option("--visibility <v>","PRIVATE|WORKSPACE|PUBLIC","WORKSPACE").option("-f, --format <format>").action(async(t,e)=>{try{let o=statSync(t),d=basename(t),i=extname(t).slice(1)||void 0,n=readFileSync(t),f=createHash("sha256").update(n).digest("hex"),L={fileName:d,fileSize:o.size,mimeType:"application/octet-stream",extension:i,folderId:e.folder,sha256Hash:f,visibility:(e.visibility??"WORKSPACE").toUpperCase()},I=await b(E,{input:L});j("Upload session created. PUT the local bytes to the returned URL(s)."),g(e,I.initiateUpload),j(`After uploading, complete with: vibecontrols files upload-complete --session ${I.initiateUpload.session.id}`);}catch(o){f(o);}}),s.command("upload-complete").description("Complete an in-flight upload session").requiredOption("--session <id>","Session id from `files upload`").option("--folder <folderId>").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let e=await b(R,{input:{sessionId:t.session,folderId:t.folder,description:t.description}});h$1(`Upload complete: ${e.completeUpload.fileId}`),g(t,e.completeUpload.file);}catch(e){f(e);}}),s.command("get").description("Get a file by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(C,{id:t});if(!o.getFile)throw new o$1(`File ${t} not found`);g(e,o.getFile);}catch(o){f(o);}}),s.command("download").description("Get a pre-signed download URL for a file").argument("<id>").option("--expires <seconds>","URL expiry in seconds",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(A,{id:t,expiresIn:e.expires});if(e.format){g(e,{url:o.getFileDownloadUrl});return}h$1("Download URL:"),console.log(o.getFileDownloadUrl);}catch(o){f(o);}});let u=s.command("share").description("Manage file shares");u.command("create").description("Create a share link for a file").argument("<fileId>").option("--access <a>","VIEW|DOWNLOAD","DOWNLOAD").option("--expires <iso>","Expiry timestamp").option("--password <p>").option("--max-downloads <n>","",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let o={fileId:t,shareType:"PUBLIC_LINK",accessLevel:(e.access??"DOWNLOAD").toUpperCase(),expiresAt:e.expires,password:e.password,maxDownloads:e.maxDownloads},d=await b($,{input:o});h$1("Share created"),g(e,d.createShare);}catch(o){f(o);}}),u.command("revoke").description("Revoke a share by id").argument("<shareId>").action(async t=>{try{await b(O,{id:t}),h$1("Share revoked");}catch(e){f(e);}});}var B={id:"files",version:"1.0.0",displayName:"Files",dependsOn:["auth","workspaces"],register(c,s){a(s),D(c);}},V=B;export{V as default};
62
+ `;function D(c){let s=c.command("files").description("Workspace file management");s.command("browse").description("Browse a folder (defaults to root)").argument("[folderId]").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let o={limit:e.limit,offset:0};if(t){let i=await b(x,{folderId:t,pagination:o});if(e.format){h$1(e,{folder:i.getFolder,files:i.getFilesInFolder.files});return}i.getFolder&&k(`Folder: ${i.getFolder.name}`);for(let n of i.getFilesInFolder.files){let f=n.size?`${n.size}b`:"-";console.log(` \u{1F4C4} ${p(n.id,12)} ${n.name} ${f} ${n.mimeType??"-"}`);}console.log(`
63
+ ${i.getFilesInFolder.total} files`);return}let d=await b(h,{pagination:o});if(e.format){h$1(e,{files:d.getFilesInFolder.files});return}for(let i of d.getFilesInFolder.files){let n=i.size?`${i.size}b`:"-";console.log(` \u{1F4C4} ${p(i.id,12)} ${i.name} ${n} ${i.mimeType??"-"}`);}console.log(`
64
+ ${d.getFilesInFolder.total} files`);}catch(o){g(o);}}),s.command("upload").description("Upload a local file (initiates a multipart session)").argument("<path>","Local file path").option("--folder <folderId>","Target folder id").option("--visibility <v>","PRIVATE|WORKSPACE|PUBLIC","WORKSPACE").option("-f, --format <format>").action(async(t,e)=>{try{let o=statSync(t),d=basename(t),i=extname(t).slice(1)||void 0,n=readFileSync(t),f=createHash("sha256").update(n).digest("hex"),L={fileName:d,fileSize:o.size,mimeType:"application/octet-stream",extension:i,folderId:e.folder,sha256Hash:f,visibility:(e.visibility??"WORKSPACE").toUpperCase()},I=await b(E,{input:L});k("Upload session created. PUT the local bytes to the returned URL(s)."),h$1(e,I.initiateUpload),k(`After uploading, complete with: vibecontrols files upload-complete --session ${I.initiateUpload.session.id}`);}catch(o){g(o);}}),s.command("upload-complete").description("Complete an in-flight upload session").requiredOption("--session <id>","Session id from `files upload`").option("--folder <folderId>").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let e=await b(R,{input:{sessionId:t.session,folderId:t.folder,description:t.description}});i(`Upload complete: ${e.completeUpload.fileId}`),h$1(t,e.completeUpload.file);}catch(e){g(e);}}),s.command("get").description("Get a file by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o$1=await b(C,{id:t});if(!o$1.getFile)throw new o(`File ${t} not found`);h$1(e,o$1.getFile);}catch(o){g(o);}}),s.command("download").description("Get a pre-signed download URL for a file").argument("<id>").option("--expires <seconds>","URL expiry in seconds",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(A,{id:t,expiresIn:e.expires});if(e.format){h$1(e,{url:o.getFileDownloadUrl});return}i("Download URL:"),console.log(o.getFileDownloadUrl);}catch(o){g(o);}});let u=s.command("share").description("Manage file shares");u.command("create").description("Create a share link for a file").argument("<fileId>").option("--access <a>","VIEW|DOWNLOAD","DOWNLOAD").option("--expires <iso>","Expiry timestamp").option("--password <p>").option("--max-downloads <n>","",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let o={fileId:t,shareType:"PUBLIC_LINK",accessLevel:(e.access??"DOWNLOAD").toUpperCase(),expiresAt:e.expires,password:e.password,maxDownloads:e.maxDownloads},d=await b($,{input:o});i("Share created"),h$1(e,d.createShare);}catch(o){g(o);}}),u.command("revoke").description("Revoke a share by id").argument("<shareId>").action(async t=>{try{await b(O,{id:t}),i("Share revoked");}catch(e){g(e);}});}var B={id:"files",version:"1.0.0",displayName:"Files",dependsOn:["auth","workspaces"],register(c,s){a(s),D(c);}},V=B;export{V as default};
@@ -1,4 +1,4 @@
1
- import {a,b,g,o,m,f,h as h$1,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var l=`
1
+ import {a,b,h as h$1,p,n,g,i,o as o$1}from'../../chunk-WXDQ3S5J.js';import {o}from'../../chunk-TCBALVP4.js';var l=`
2
2
  query ListGroups($filter: GroupFilter, $first: Int, $after: String, $sort: GroupSort) {
3
3
  groups(filter: $filter, first: $first, after: $after, sort: $sort) {
4
4
  edges { node { id name groupType visibility status memberCount createdAt } }
@@ -64,4 +64,4 @@ import {a,b,g,o,m,f,h as h$1,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}fr
64
64
  edges { node { id name groupType visibility memberCount } }
65
65
  }
66
66
  }
67
- `;function P(u){let n$1=u.command("groups").description("Group management");n$1.command("list").description("List groups").option("--type <t>","Filter by groupType").option("--status <s>","Filter by status").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.type&&(e.groupType=t.type.toUpperCase()),t.status&&(e.status=t.status.toUpperCase());let p=(await b(l,{filter:Object.keys(e).length?e:void 0,first:t.limit})).groups.edges.map(i=>i.node);g(t,p,{headers:["ID","Name","Type","Visibility","Status","Members"],rows:p.map(i=>[o(i.id,12),i.name,i.groupType??"-",i.visibility??"-",m(i.status),String(i.memberCount??0)])});}catch(e){f(e);}}),n$1.command("get").description("Get a group by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let r=await b(E,{id:t});if(!r.group)throw new o$1(`Group ${t} not found`);g(e,r.group);}catch(r){f(r);}}),n$1.command("create").description("Create a group").requiredOption("--name <name>").option("--description <s>").option("--type <t>","AUDIENCE|BETA_PROGRAM|CHANNEL_GROUP|CUSTOM|DYNAMIC_AUDIENCE|FEATURE_FLAG_GROUP|PROJECT_GROUP|RESOURCE_COLLECTION|SECURITY_GROUP|TEAM","TEAM").option("--visibility <v>","PUBLIC|PRIVATE|HIDDEN","PRIVATE").option("--scope <s>","WORKSPACE|ORGANIZATION","WORKSPACE").option("--membership <m>","STATIC|DYNAMIC|HYBRID","STATIC").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,groupType:(t.type??"TEAM").toUpperCase(),visibility:(t.visibility??"PRIVATE").toUpperCase(),scope:(t.scope??"WORKSPACE").toUpperCase(),membershipType:(t.membership??"STATIC").toUpperCase()},r=await b(R,{input:e});h$1(`Group created: ${r.createGroup.name}`),g(t,r.createGroup);}catch(e){f(e);}}),n$1.command("update").description("Update a group").argument("<id>").option("--name <s>").option("--description <s>").option("--visibility <v>").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let r={};if(e.name&&(r.name=e.name),e.description!==void 0&&(r.description=e.description),e.visibility&&(r.visibility=e.visibility.toUpperCase()),e.status&&(r.status=e.status.toUpperCase()),!Object.keys(r).length)throw new o$1("No updates specified");let p=await b(T,{id:t,input:r});h$1("Group updated"),g(e,p.updateGroup);}catch(r){f(r);}}),n$1.command("delete").description("Delete a group (use --archive for soft delete)").argument("<id>").option("--archive","Archive instead of hard delete",false).action(async(t,e)=>{try{e.archive?(await b(U,{id:t}),h$1("Group archived")):(await b(A,{id:t}),h$1("Group deleted"));}catch(r){f(r);}});let c=n$1.command("members").description("Group membership");c.command("list").description("List members of a group").argument("<groupId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let p=(await b(C,{groupId:t,first:e.limit})).groupMembers.edges.map(i=>i.node);g(e,p,{headers:["MembershipID","Entity","Type","Role","Status","Joined"],rows:p.map(i=>[o(i.id,12),o(i.entityId,12),i.entityType??"-",i.role??"-",m(i.invitationStatus),n(i.joinedAt)])});}catch(r){f(r);}}),c.command("add").description("Add a member to a group").requiredOption("--group <id>").requiredOption("--entity <id>").option("--entity-type <t>","USER|GROUP|BOT|INTEGRATION","USER").option("--role <r>","MEMBER|OWNER|ADMIN","MEMBER").option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,entityType:(t.entityType??"USER").toUpperCase(),role:(t.role??"MEMBER").toUpperCase()},r=await b(h,{groupId:t.group,members:[e]});h$1(`Added ${r.addGroupMembers.added} member(s)`),g(t,r.addGroupMembers.memberships);}catch(e){f(e);}}),c.command("remove").description("Remove members by membership id").requiredOption("--group <id>").requiredOption("--membership <ids>","Comma-separated membership ids").action(async t=>{try{let e=t.membership.split(",").filter(Boolean);await b(O,{groupId:t.group,membershipIds:e}),h$1(`Removed ${e.length} membership(s)`);}catch(e){f(e);}}),n$1.command("hierarchy").description("Show entity-group hierarchy for a user/entity").argument("<entityId>").option("--type <t>","USER|GROUP","USER").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let r=await b(M,{entityId:t,entityType:(e.type??"USER").toUpperCase(),first:e.limit});g(e,r.entityGroups.edges.map(p=>p.node));}catch(r){f(r);}}),n$1.command("activity").description("Audit log for a group").argument("<groupId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let r=await b($,{groupId:t,first:e.limit});g(e,r.groupAuditLogs);}catch(r){f(r);}});}var v={id:"groups",version:"1.0.0",displayName:"Groups",dependsOn:["auth","workspaces"],register(u,n){a(n),P(u);}},B=v;export{B as default};
67
+ `;function P(u){let n$1=u.command("groups").description("Group management");n$1.command("list").description("List groups").option("--type <t>","Filter by groupType").option("--status <s>","Filter by status").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.type&&(e.groupType=t.type.toUpperCase()),t.status&&(e.status=t.status.toUpperCase());let p$1=(await b(l,{filter:Object.keys(e).length?e:void 0,first:t.limit})).groups.edges.map(i=>i.node);h$1(t,p$1,{headers:["ID","Name","Type","Visibility","Status","Members"],rows:p$1.map(i=>[p(i.id,12),i.name,i.groupType??"-",i.visibility??"-",n(i.status),String(i.memberCount??0)])});}catch(e){g(e);}}),n$1.command("get").description("Get a group by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let r=await b(E,{id:t});if(!r.group)throw new o(`Group ${t} not found`);h$1(e,r.group);}catch(r){g(r);}}),n$1.command("create").description("Create a group").requiredOption("--name <name>").option("--description <s>").option("--type <t>","AUDIENCE|BETA_PROGRAM|CHANNEL_GROUP|CUSTOM|DYNAMIC_AUDIENCE|FEATURE_FLAG_GROUP|PROJECT_GROUP|RESOURCE_COLLECTION|SECURITY_GROUP|TEAM","TEAM").option("--visibility <v>","PUBLIC|PRIVATE|HIDDEN","PRIVATE").option("--scope <s>","WORKSPACE|ORGANIZATION","WORKSPACE").option("--membership <m>","STATIC|DYNAMIC|HYBRID","STATIC").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,groupType:(t.type??"TEAM").toUpperCase(),visibility:(t.visibility??"PRIVATE").toUpperCase(),scope:(t.scope??"WORKSPACE").toUpperCase(),membershipType:(t.membership??"STATIC").toUpperCase()},r=await b(R,{input:e});i(`Group created: ${r.createGroup.name}`),h$1(t,r.createGroup);}catch(e){g(e);}}),n$1.command("update").description("Update a group").argument("<id>").option("--name <s>").option("--description <s>").option("--visibility <v>").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let r={};if(e.name&&(r.name=e.name),e.description!==void 0&&(r.description=e.description),e.visibility&&(r.visibility=e.visibility.toUpperCase()),e.status&&(r.status=e.status.toUpperCase()),!Object.keys(r).length)throw new o("No updates specified");let p=await b(T,{id:t,input:r});i("Group updated"),h$1(e,p.updateGroup);}catch(r){g(r);}}),n$1.command("delete").description("Delete a group (use --archive for soft delete)").argument("<id>").option("--archive","Archive instead of hard delete",false).action(async(t,e)=>{try{e.archive?(await b(U,{id:t}),i("Group archived")):(await b(A,{id:t}),i("Group deleted"));}catch(r){g(r);}});let c=n$1.command("members").description("Group membership");c.command("list").description("List members of a group").argument("<groupId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let p$1=(await b(C,{groupId:t,first:e.limit})).groupMembers.edges.map(i=>i.node);h$1(e,p$1,{headers:["MembershipID","Entity","Type","Role","Status","Joined"],rows:p$1.map(i=>[p(i.id,12),p(i.entityId,12),i.entityType??"-",i.role??"-",n(i.invitationStatus),o$1(i.joinedAt)])});}catch(r){g(r);}}),c.command("add").description("Add a member to a group").requiredOption("--group <id>").requiredOption("--entity <id>").option("--entity-type <t>","USER|GROUP|BOT|INTEGRATION","USER").option("--role <r>","MEMBER|OWNER|ADMIN","MEMBER").option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,entityType:(t.entityType??"USER").toUpperCase(),role:(t.role??"MEMBER").toUpperCase()},r=await b(h,{groupId:t.group,members:[e]});i(`Added ${r.addGroupMembers.added} member(s)`),h$1(t,r.addGroupMembers.memberships);}catch(e){g(e);}}),c.command("remove").description("Remove members by membership id").requiredOption("--group <id>").requiredOption("--membership <ids>","Comma-separated membership ids").action(async t=>{try{let e=t.membership.split(",").filter(Boolean);await b(O,{groupId:t.group,membershipIds:e}),i(`Removed ${e.length} membership(s)`);}catch(e){g(e);}}),n$1.command("hierarchy").description("Show entity-group hierarchy for a user/entity").argument("<entityId>").option("--type <t>","USER|GROUP","USER").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let r=await b(M,{entityId:t,entityType:(e.type??"USER").toUpperCase(),first:e.limit});h$1(e,r.entityGroups.edges.map(p=>p.node));}catch(r){g(r);}}),n$1.command("activity").description("Audit log for a group").argument("<groupId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,e)=>{try{let r=await b($,{groupId:t,first:e.limit});h$1(e,r.groupAuditLogs);}catch(r){g(r);}});}var v={id:"groups",version:"1.0.0",displayName:"Groups",dependsOn:["auth","workspaces"],register(u,n){a(n),P(u);}},B=v;export{B as default};
@@ -1,4 +1,4 @@
1
- import {a,b as b$1,g,o,f,m,h,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}from'../../chunk-TCBALVP4.js';var E=`
1
+ import {a,b as b$1,h,p,g,n,i,o as o$1}from'../../chunk-WXDQ3S5J.js';import {o}from'../../chunk-TCBALVP4.js';var E=`
2
2
  query GetProviders($filter: ProviderFilterInput, $pagination: IntegrationsPaginationInput) {
3
3
  getProviders(filter: $filter, pagination: $pagination) {
4
4
  items { id key name category authType isEnabled }
@@ -125,4 +125,4 @@ import {a,b as b$1,g,o,f,m,h,n}from'../../chunk-LZQBJDKZ.js';import {o as o$1}fr
125
125
  query GetConnectionTags($input: GetConnectionTagsInput!) {
126
126
  getConnectionTags(input: $input) { id entityId tagId source assignedAt }
127
127
  }
128
- `;function Y(I){let p=I.command("integrations").description("Integration providers, connections, and logs"),d=p.command("providers").description("Available providers");d.command("list").description("List integration providers").option("--category <c>").option("--enabled").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.category&&(n.category=t.category.toUpperCase()),t.enabled!==void 0&&(n.isEnabled=t.enabled);let e=await b$1(E,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getProviders.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:e.getProviders.items.map(r=>[o(r.id,12),r.key,r.name,r.category??"-",r.authType??"-",String(!!r.isEnabled)])});}catch(n){f(n);}}),d.command("get").description("Get a provider").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(O,{id:t});if(!e.getProvider)throw new o$1(`Provider ${t} not found`);g(n,e.getProvider);}catch(e){f(e);}});let s=p.command("connections").description("Provider connections (OAuth + credential)");s.command("list").description("List connections").option("--provider <id>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.provider&&(n.providerId=t.provider),t.status&&(n.status=t.status.toUpperCase());let e=await b$1(N,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getConnections.items,{headers:["ID","Name","Provider","Status"],rows:e.getConnections.items.map(r=>[o(r.id,12),r.name,o(r.providerId,12),m(r.status)])});}catch(n){f(n);}}),s.command("get").description("Get a connection").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(A,{id:t});if(!e.getConnection)throw new o$1(`Connection ${t} not found`);g(n,e.getConnection);}catch(e){f(e);}}),s.command("add").description("Create a connection (provider id required; credentials stored in vault)").requiredOption("--name <name>").requiredOption("--provider <id>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={name:t.name,providerId:t.provider,grantedScopes:t.scopes?t.scopes.split(","):void 0},e=await b$1(v,{input:n});h("Connection created"),g(t,e.createConnection);}catch(n){f(n);}}),s.command("delete").description("Delete a connection").argument("<id>").option("--keep-secret","Keep vault secret",false).action(async(t,n)=>{try{await b$1(R,{id:t,deleteVaultSecret:!n.keepSecret}),h("Connection deleted");}catch(e){f(e);}}),s.command("update").description("Update a connection (name / description / config JSON)").argument("<id>").option("--name <name>").option("--description <desc>").option("--config <json>","Config JSON string").option("-f, --format <format>").action(async(t,n)=>{try{let e={};if(n.name!==void 0&&(e.name=n.name),n.description!==void 0&&(e.description=n.description),n.config!==void 0&&(e.config=JSON.parse(n.config)),Object.keys(e).length===0)throw new o$1("Provide at least one of --name, --description, --config");let r=await b$1(_,{id:t,input:e});h("Connection updated"),g(n,r.updateConnection);}catch(e){f(e);}}),s.command("revoke").description("Revoke a connection (soft delete; tokens invalidated)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(P,{connectionId:t});h("Connection revoked"),g(n,e.revokeConnection);}catch(e){f(e);}}),s.command("test").description("Test a connection (health/auth probe)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1($,{connectionId:t});g(n,e.testConnection);}catch(e){f(e);}}),s.command("link").description("Link a connection to a channel for DM/notification routing").requiredOption("--channel <channelId>").requiredOption("--connection <id>").requiredOption("--organization <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(k,{channelId:t.channel,connectionId:t.connection,organizationId:t.organization});h("Linked"),g(t,n.linkIntegrationToChannel);}catch(n){f(n);}}),s.command("refresh-token").description("Force a connection token refresh (OAuth refresh_grant)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(b,{connectionId:t});h("Token refreshed"),g(n,e.refreshConnectionToken);}catch(e){f(e);}});let g$1=p.command("auth").description("Per-connection auth flows");g$1.command("api-key").description("Authenticate a connection with an API key").requiredOption("--connection <id>").requiredOption("--api-key <key>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(G,{input:{connectionId:t.connection,apiKey:t.apiKey}});h("Authenticated"),g(t,n.authenticateWithApiKey);}catch(n){f(n);}}),g$1.command("basic").description("Authenticate a connection with Basic Auth").requiredOption("--connection <id>").requiredOption("--username <u>").requiredOption("--password <p>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(S,{input:{connectionId:t.connection,username:t.username,password:t.password}});h("Authenticated"),g(t,n.authenticateWithBasicAuth);}catch(n){f(n);}}),g$1.command("bearer").description("Authenticate a connection with a Bearer token").requiredOption("--connection <id>").requiredOption("--token <t>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(D,{input:{connectionId:t.connection,token:t.token}});h("Authenticated"),g(t,n.authenticateWithBearerToken);}catch(n){f(n);}}),g$1.command("oauth-start").description("Initiate an OAuth flow; prints redirect URL + state").requiredOption("--connection <id>").requiredOption("--redirect-uri <uri>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={connectionId:t.connection,redirectUri:t.redirectUri};t.scopes&&(n.scopes=t.scopes.split(","));let e=await b$1(B,{input:n});g(t,e.initiateOAuth);}catch(n){f(n);}}),g$1.command("oauth-complete").description("Complete an OAuth flow with the authorization code + state").requiredOption("--connection <id>").requiredOption("--code <c>").requiredOption("--redirect-uri <uri>").requiredOption("--state <s>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(q,{input:{connectionId:t.connection,code:t.code,redirectUri:t.redirectUri,state:t.state}});h("OAuth complete"),g(t,n.completeOAuth);}catch(n){f(n);}});let l=s.command("tags").description("Connection tag assignments");l.command("add").description("Tag a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").option("--source <s>").option("-f, --format <format>").action(async t=>{try{let n={entityId:t.entity,tagId:t.tag};t.source&&(n.source=t.source);let e=await b$1(H,{input:n});h("Tagged"),g(t,e.tagConnection);}catch(n){f(n);}}),l.command("remove").description("Remove a tag from a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").action(async t=>{try{await b$1(W,{input:{entityId:t.entity,tagId:t.tag}}),h("Tag removed");}catch(n){f(n);}}),l.command("replace").description("Replace all tags on a connection").requiredOption("--entity <id>").requiredOption("--tags <ids>","Comma-separated tag IDs").option("-f, --format <format>").action(async t=>{try{let n=await b$1(z,{input:{entityId:t.entity,tagIds:t.tags.split(",")}});h("Tags replaced"),g(t,n.replaceConnectionTags);}catch(n){f(n);}}),l.command("list").description("List tags on a connection").requiredOption("--entity <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(M,{input:{entityId:t.entity}});g(t,n.getConnectionTags);}catch(n){f(n);}}),d.command("get-by-key").description("Get a provider by key (e.g. github, slack)").argument("<key>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(x,{key:t});if(!e.getProviderByKey)throw new o$1(`Provider ${t} not found`);g(n,e.getProviderByKey);}catch(e){f(e);}}),d.command("catalog").description("Browseable provider catalog").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await b$1(L,{pagination:{limit:t.limit,offset:0}});g(t,n.getProviderCatalog.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:n.getProviderCatalog.items.map(e=>[o(e.id,12),e.key,e.name,e.category??"-",e.authType??"-",String(!!e.isEnabled)])});}catch(n){f(n);}}),d.command("connections").description("Connections for a given provider").argument("<providerId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(U,{providerId:t,pagination:{limit:n.limit,offset:0}});g(n,e.getConnectionsByProvider.items);}catch(e){f(e);}}),d.command("enable").description("Enable a provider").argument("<id>").action(async t=>{try{await b$1(K,{id:t}),h("Provider enabled");}catch(n){f(n);}}),d.command("disable").description("Disable a provider").argument("<id>").action(async t=>{try{await b$1(V,{id:t}),h("Provider disabled");}catch(n){f(n);}}),p.command("logs").description("Integration audit logs").option("--connection <id>").option("--level <l>","INFO|WARN|ERROR").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n$1={};t.connection&&(n$1.connectionId=t.connection),t.level&&(n$1.level=t.level.toUpperCase());let e=await b$1(w,{filter:Object.keys(n$1).length?n$1:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getIntegrationLogs.items,{headers:["When","Action","Level","Message"],rows:e.getIntegrationLogs.items.map(r=>[n(r.createdAt),r.action,r.level,r.message])});}catch(n){f(n);}});}var F={id:"integrations",version:"1.0.0",displayName:"Integrations",dependsOn:["auth","workspaces"],register(I,p){a(p),Y(I);}},et=F;export{et as default};
128
+ `;function Y(I){let p$1=I.command("integrations").description("Integration providers, connections, and logs"),d=p$1.command("providers").description("Available providers");d.command("list").description("List integration providers").option("--category <c>").option("--enabled").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.category&&(n.category=t.category.toUpperCase()),t.enabled!==void 0&&(n.isEnabled=t.enabled);let e=await b$1(E,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});h(t,e.getProviders.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:e.getProviders.items.map(r=>[p(r.id,12),r.key,r.name,r.category??"-",r.authType??"-",String(!!r.isEnabled)])});}catch(n){g(n);}}),d.command("get").description("Get a provider").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(O,{id:t});if(!e.getProvider)throw new o(`Provider ${t} not found`);h(n,e.getProvider);}catch(e){g(e);}});let s=p$1.command("connections").description("Provider connections (OAuth + credential)");s.command("list").description("List connections").option("--provider <id>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n$1={};t.provider&&(n$1.providerId=t.provider),t.status&&(n$1.status=t.status.toUpperCase());let e=await b$1(N,{filter:Object.keys(n$1).length?n$1:void 0,pagination:{limit:t.limit,offset:0}});h(t,e.getConnections.items,{headers:["ID","Name","Provider","Status"],rows:e.getConnections.items.map(r=>[p(r.id,12),r.name,p(r.providerId,12),n(r.status)])});}catch(n){g(n);}}),s.command("get").description("Get a connection").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(A,{id:t});if(!e.getConnection)throw new o(`Connection ${t} not found`);h(n,e.getConnection);}catch(e){g(e);}}),s.command("add").description("Create a connection (provider id required; credentials stored in vault)").requiredOption("--name <name>").requiredOption("--provider <id>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={name:t.name,providerId:t.provider,grantedScopes:t.scopes?t.scopes.split(","):void 0},e=await b$1(v,{input:n});i("Connection created"),h(t,e.createConnection);}catch(n){g(n);}}),s.command("delete").description("Delete a connection").argument("<id>").option("--keep-secret","Keep vault secret",false).action(async(t,n)=>{try{await b$1(R,{id:t,deleteVaultSecret:!n.keepSecret}),i("Connection deleted");}catch(e){g(e);}}),s.command("update").description("Update a connection (name / description / config JSON)").argument("<id>").option("--name <name>").option("--description <desc>").option("--config <json>","Config JSON string").option("-f, --format <format>").action(async(t,n)=>{try{let e={};if(n.name!==void 0&&(e.name=n.name),n.description!==void 0&&(e.description=n.description),n.config!==void 0&&(e.config=JSON.parse(n.config)),Object.keys(e).length===0)throw new o("Provide at least one of --name, --description, --config");let r=await b$1(_,{id:t,input:e});i("Connection updated"),h(n,r.updateConnection);}catch(e){g(e);}}),s.command("revoke").description("Revoke a connection (soft delete; tokens invalidated)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(P,{connectionId:t});i("Connection revoked"),h(n,e.revokeConnection);}catch(e){g(e);}}),s.command("test").description("Test a connection (health/auth probe)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1($,{connectionId:t});h(n,e.testConnection);}catch(e){g(e);}}),s.command("link").description("Link a connection to a channel for DM/notification routing").requiredOption("--channel <channelId>").requiredOption("--connection <id>").requiredOption("--organization <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(k,{channelId:t.channel,connectionId:t.connection,organizationId:t.organization});i("Linked"),h(t,n.linkIntegrationToChannel);}catch(n){g(n);}}),s.command("refresh-token").description("Force a connection token refresh (OAuth refresh_grant)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(b,{connectionId:t});i("Token refreshed"),h(n,e.refreshConnectionToken);}catch(e){g(e);}});let g$1=p$1.command("auth").description("Per-connection auth flows");g$1.command("api-key").description("Authenticate a connection with an API key").requiredOption("--connection <id>").requiredOption("--api-key <key>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(G,{input:{connectionId:t.connection,apiKey:t.apiKey}});i("Authenticated"),h(t,n.authenticateWithApiKey);}catch(n){g(n);}}),g$1.command("basic").description("Authenticate a connection with Basic Auth").requiredOption("--connection <id>").requiredOption("--username <u>").requiredOption("--password <p>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(S,{input:{connectionId:t.connection,username:t.username,password:t.password}});i("Authenticated"),h(t,n.authenticateWithBasicAuth);}catch(n){g(n);}}),g$1.command("bearer").description("Authenticate a connection with a Bearer token").requiredOption("--connection <id>").requiredOption("--token <t>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(D,{input:{connectionId:t.connection,token:t.token}});i("Authenticated"),h(t,n.authenticateWithBearerToken);}catch(n){g(n);}}),g$1.command("oauth-start").description("Initiate an OAuth flow; prints redirect URL + state").requiredOption("--connection <id>").requiredOption("--redirect-uri <uri>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={connectionId:t.connection,redirectUri:t.redirectUri};t.scopes&&(n.scopes=t.scopes.split(","));let e=await b$1(B,{input:n});h(t,e.initiateOAuth);}catch(n){g(n);}}),g$1.command("oauth-complete").description("Complete an OAuth flow with the authorization code + state").requiredOption("--connection <id>").requiredOption("--code <c>").requiredOption("--redirect-uri <uri>").requiredOption("--state <s>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(q,{input:{connectionId:t.connection,code:t.code,redirectUri:t.redirectUri,state:t.state}});i("OAuth complete"),h(t,n.completeOAuth);}catch(n){g(n);}});let l=s.command("tags").description("Connection tag assignments");l.command("add").description("Tag a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").option("--source <s>").option("-f, --format <format>").action(async t=>{try{let n={entityId:t.entity,tagId:t.tag};t.source&&(n.source=t.source);let e=await b$1(H,{input:n});i("Tagged"),h(t,e.tagConnection);}catch(n){g(n);}}),l.command("remove").description("Remove a tag from a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").action(async t=>{try{await b$1(W,{input:{entityId:t.entity,tagId:t.tag}}),i("Tag removed");}catch(n){g(n);}}),l.command("replace").description("Replace all tags on a connection").requiredOption("--entity <id>").requiredOption("--tags <ids>","Comma-separated tag IDs").option("-f, --format <format>").action(async t=>{try{let n=await b$1(z,{input:{entityId:t.entity,tagIds:t.tags.split(",")}});i("Tags replaced"),h(t,n.replaceConnectionTags);}catch(n){g(n);}}),l.command("list").description("List tags on a connection").requiredOption("--entity <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(M,{input:{entityId:t.entity}});h(t,n.getConnectionTags);}catch(n){g(n);}}),d.command("get-by-key").description("Get a provider by key (e.g. github, slack)").argument("<key>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(x,{key:t});if(!e.getProviderByKey)throw new o(`Provider ${t} not found`);h(n,e.getProviderByKey);}catch(e){g(e);}}),d.command("catalog").description("Browseable provider catalog").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await b$1(L,{pagination:{limit:t.limit,offset:0}});h(t,n.getProviderCatalog.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:n.getProviderCatalog.items.map(e=>[p(e.id,12),e.key,e.name,e.category??"-",e.authType??"-",String(!!e.isEnabled)])});}catch(n){g(n);}}),d.command("connections").description("Connections for a given provider").argument("<providerId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(U,{providerId:t,pagination:{limit:n.limit,offset:0}});h(n,e.getConnectionsByProvider.items);}catch(e){g(e);}}),d.command("enable").description("Enable a provider").argument("<id>").action(async t=>{try{await b$1(K,{id:t}),i("Provider enabled");}catch(n){g(n);}}),d.command("disable").description("Disable a provider").argument("<id>").action(async t=>{try{await b$1(V,{id:t}),i("Provider disabled");}catch(n){g(n);}}),p$1.command("logs").description("Integration audit logs").option("--connection <id>").option("--level <l>","INFO|WARN|ERROR").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.connection&&(n.connectionId=t.connection),t.level&&(n.level=t.level.toUpperCase());let e=await b$1(w,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});h(t,e.getIntegrationLogs.items,{headers:["When","Action","Level","Message"],rows:e.getIntegrationLogs.items.map(r=>[o$1(r.createdAt),r.action,r.level,r.message])});}catch(n){g(n);}});}var F={id:"integrations",version:"1.0.0",displayName:"Integrations",dependsOn:["auth","workspaces"],register(I,p){a(p),Y(I);}},et=F;export{et as default};