@burdenoff/cli-sdk 2026.1124.1 → 2026.1202.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.
Files changed (242) hide show
  1. package/dist/chunk-BGNPGKJM.js +1 -0
  2. package/dist/{chunk-ASSY2L5R.js → chunk-E6F56R4K.js} +3 -3
  3. package/dist/chunk-N7EXKGE2.js +34 -0
  4. package/dist/core/index.cjs +9 -9
  5. package/dist/core/index.d.cts +2 -2
  6. package/dist/core/index.d.ts +2 -2
  7. package/dist/core/index.js +1 -1
  8. package/dist/index.cjs +9 -9
  9. package/dist/index.d.cts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/{module-BNVKV_pI.d.ts → module-DWSAfs3k.d.cts} +20 -19
  13. package/dist/{module-BNVKV_pI.d.cts → module-DWSAfs3k.d.ts} +20 -19
  14. package/dist/modules/adaptercloud/index.cjs +38 -38
  15. package/dist/modules/adaptercloud/index.d.cts +1 -1
  16. package/dist/modules/adaptercloud/index.d.ts +1 -1
  17. package/dist/modules/adaptercloud/index.js +2 -2
  18. package/dist/modules/artistrybase/index.cjs +50 -50
  19. package/dist/modules/artistrybase/index.d.cts +1 -1
  20. package/dist/modules/artistrybase/index.d.ts +1 -1
  21. package/dist/modules/artistrybase/index.js +2 -2
  22. package/dist/modules/assethandler/index.cjs +32 -32
  23. package/dist/modules/assethandler/index.d.cts +1 -1
  24. package/dist/modules/assethandler/index.d.ts +1 -1
  25. package/dist/modules/assethandler/index.js +2 -2
  26. package/dist/modules/atheletebridge/index.cjs +34 -34
  27. package/dist/modules/atheletebridge/index.d.cts +1 -1
  28. package/dist/modules/atheletebridge/index.d.ts +1 -1
  29. package/dist/modules/atheletebridge/index.js +2 -2
  30. package/dist/modules/auth/index.cjs +34 -34
  31. package/dist/modules/auth/index.d.cts +1 -1
  32. package/dist/modules/auth/index.d.ts +1 -1
  33. package/dist/modules/auth/index.js +4 -4
  34. package/dist/modules/billing/index.cjs +18 -18
  35. package/dist/modules/billing/index.d.cts +1 -1
  36. package/dist/modules/billing/index.d.ts +1 -1
  37. package/dist/modules/billing/index.js +2 -2
  38. package/dist/modules/brainyrich/index.cjs +45 -45
  39. package/dist/modules/brainyrich/index.d.cts +1 -1
  40. package/dist/modules/brainyrich/index.d.ts +1 -1
  41. package/dist/modules/brainyrich/index.js +2 -2
  42. package/dist/modules/buildmyiq/index.cjs +32 -32
  43. package/dist/modules/buildmyiq/index.d.cts +1 -1
  44. package/dist/modules/buildmyiq/index.d.ts +1 -1
  45. package/dist/modules/buildmyiq/index.js +2 -2
  46. package/dist/modules/channels/index.cjs +12 -12
  47. package/dist/modules/channels/index.d.cts +1 -1
  48. package/dist/modules/channels/index.d.ts +1 -1
  49. package/dist/modules/channels/index.js +2 -2
  50. package/dist/modules/collabkin/index.cjs +34 -34
  51. package/dist/modules/collabkin/index.d.cts +1 -1
  52. package/dist/modules/collabkin/index.d.ts +1 -1
  53. package/dist/modules/collabkin/index.js +2 -2
  54. package/dist/modules/comradecircle/index.cjs +41 -41
  55. package/dist/modules/comradecircle/index.d.cts +1 -1
  56. package/dist/modules/comradecircle/index.d.ts +1 -1
  57. package/dist/modules/comradecircle/index.js +2 -2
  58. package/dist/modules/conversations/index.cjs +32 -32
  59. package/dist/modules/conversations/index.d.cts +1 -1
  60. package/dist/modules/conversations/index.d.ts +1 -1
  61. package/dist/modules/conversations/index.js +2 -2
  62. package/dist/modules/coolandlovely/index.cjs +41 -41
  63. package/dist/modules/coolandlovely/index.d.cts +1 -1
  64. package/dist/modules/coolandlovely/index.d.ts +1 -1
  65. package/dist/modules/coolandlovely/index.js +2 -2
  66. package/dist/modules/cosmicintersection/index.cjs +43 -43
  67. package/dist/modules/cosmicintersection/index.d.cts +1 -1
  68. package/dist/modules/cosmicintersection/index.d.ts +1 -1
  69. package/dist/modules/cosmicintersection/index.js +2 -2
  70. package/dist/modules/crewfoundry/index.cjs +70 -70
  71. package/dist/modules/crewfoundry/index.d.cts +1 -1
  72. package/dist/modules/crewfoundry/index.d.ts +1 -1
  73. package/dist/modules/crewfoundry/index.js +2 -2
  74. package/dist/modules/devportal/index.cjs +23 -23
  75. package/dist/modules/devportal/index.d.cts +1 -1
  76. package/dist/modules/devportal/index.d.ts +1 -1
  77. package/dist/modules/devportal/index.js +2 -2
  78. package/dist/modules/ecoimpacthub/index.cjs +41 -41
  79. package/dist/modules/ecoimpacthub/index.d.cts +1 -1
  80. package/dist/modules/ecoimpacthub/index.d.ts +1 -1
  81. package/dist/modules/ecoimpacthub/index.js +2 -2
  82. package/dist/modules/eventfullymanaged/index.cjs +92 -92
  83. package/dist/modules/eventfullymanaged/index.d.cts +1 -1
  84. package/dist/modules/eventfullymanaged/index.d.ts +1 -1
  85. package/dist/modules/eventfullymanaged/index.js +2 -2
  86. package/dist/modules/export/index.cjs +14 -14
  87. package/dist/modules/export/index.d.cts +1 -1
  88. package/dist/modules/export/index.d.ts +1 -1
  89. package/dist/modules/export/index.js +2 -2
  90. package/dist/modules/files/index.cjs +11 -11
  91. package/dist/modules/files/index.d.cts +1 -1
  92. package/dist/modules/files/index.d.ts +1 -1
  93. package/dist/modules/files/index.js +2 -2
  94. package/dist/modules/fluidgrids/index.cjs +29 -29
  95. package/dist/modules/fluidgrids/index.d.cts +1 -1
  96. package/dist/modules/fluidgrids/index.d.ts +1 -1
  97. package/dist/modules/fluidgrids/index.js +3 -3
  98. package/dist/modules/ggnomad/index.cjs +21 -21
  99. package/dist/modules/ggnomad/index.d.cts +1 -1
  100. package/dist/modules/ggnomad/index.d.ts +1 -1
  101. package/dist/modules/ggnomad/index.js +2 -2
  102. package/dist/modules/govcitizenhub/index.cjs +35 -35
  103. package/dist/modules/govcitizenhub/index.d.cts +1 -1
  104. package/dist/modules/govcitizenhub/index.d.ts +1 -1
  105. package/dist/modules/govcitizenhub/index.js +2 -2
  106. package/dist/modules/groups/index.cjs +12 -12
  107. package/dist/modules/groups/index.d.cts +1 -1
  108. package/dist/modules/groups/index.d.ts +1 -1
  109. package/dist/modules/groups/index.js +2 -2
  110. package/dist/modules/headshotmarketing/index.cjs +165 -165
  111. package/dist/modules/headshotmarketing/index.d.cts +1 -1
  112. package/dist/modules/headshotmarketing/index.d.ts +1 -1
  113. package/dist/modules/headshotmarketing/index.js +2 -2
  114. package/dist/modules/health/index.d.cts +1 -1
  115. package/dist/modules/health/index.d.ts +1 -1
  116. package/dist/modules/hookmovies/index.cjs +43 -43
  117. package/dist/modules/hookmovies/index.d.cts +1 -1
  118. package/dist/modules/hookmovies/index.d.ts +1 -1
  119. package/dist/modules/hookmovies/index.js +2 -2
  120. package/dist/modules/housingvista/index.cjs +24 -24
  121. package/dist/modules/housingvista/index.d.cts +1 -1
  122. package/dist/modules/housingvista/index.d.ts +1 -1
  123. package/dist/modules/housingvista/index.js +2 -2
  124. package/dist/modules/integrations/index.cjs +27 -27
  125. package/dist/modules/integrations/index.d.cts +1 -1
  126. package/dist/modules/integrations/index.d.ts +1 -1
  127. package/dist/modules/integrations/index.js +2 -2
  128. package/dist/modules/intelwatchtower/index.cjs +37 -37
  129. package/dist/modules/intelwatchtower/index.d.cts +1 -1
  130. package/dist/modules/intelwatchtower/index.d.ts +1 -1
  131. package/dist/modules/intelwatchtower/index.js +2 -2
  132. package/dist/modules/kadaikodi/index.cjs +26 -26
  133. package/dist/modules/kadaikodi/index.d.cts +1 -1
  134. package/dist/modules/kadaikodi/index.d.ts +1 -1
  135. package/dist/modules/kadaikodi/index.js +2 -2
  136. package/dist/modules/labsofscience/index.cjs +44 -44
  137. package/dist/modules/labsofscience/index.d.cts +1 -1
  138. package/dist/modules/labsofscience/index.d.ts +1 -1
  139. package/dist/modules/labsofscience/index.js +2 -2
  140. package/dist/modules/manufacturedops/index.cjs +36 -36
  141. package/dist/modules/manufacturedops/index.d.cts +1 -1
  142. package/dist/modules/manufacturedops/index.d.ts +1 -1
  143. package/dist/modules/manufacturedops/index.js +2 -2
  144. package/dist/modules/movethewheels/index.cjs +78 -78
  145. package/dist/modules/movethewheels/index.d.cts +1 -1
  146. package/dist/modules/movethewheels/index.d.ts +1 -1
  147. package/dist/modules/movethewheels/index.js +2 -2
  148. package/dist/modules/mybodyshield/index.cjs +36 -36
  149. package/dist/modules/mybodyshield/index.d.cts +1 -1
  150. package/dist/modules/mybodyshield/index.d.ts +1 -1
  151. package/dist/modules/mybodyshield/index.js +2 -2
  152. package/dist/modules/notifications/index.cjs +5 -5
  153. package/dist/modules/notifications/index.d.cts +1 -1
  154. package/dist/modules/notifications/index.d.ts +1 -1
  155. package/dist/modules/notifications/index.js +1 -1
  156. package/dist/modules/organizations/index.cjs +5 -5
  157. package/dist/modules/organizations/index.d.cts +1 -1
  158. package/dist/modules/organizations/index.d.ts +1 -1
  159. package/dist/modules/organizations/index.js +1 -1
  160. package/dist/modules/planmagnet/index.cjs +272 -272
  161. package/dist/modules/planmagnet/index.d.cts +1 -1
  162. package/dist/modules/planmagnet/index.d.ts +1 -1
  163. package/dist/modules/planmagnet/index.js +2 -2
  164. package/dist/modules/products/index.cjs +19 -19
  165. package/dist/modules/products/index.d.cts +1 -1
  166. package/dist/modules/products/index.d.ts +1 -1
  167. package/dist/modules/products/index.js +2 -2
  168. package/dist/modules/proserviceworld/index.cjs +24 -24
  169. package/dist/modules/proserviceworld/index.d.cts +1 -1
  170. package/dist/modules/proserviceworld/index.d.ts +1 -1
  171. package/dist/modules/proserviceworld/index.js +2 -2
  172. package/dist/modules/rbac/index.cjs +8 -8
  173. package/dist/modules/rbac/index.d.cts +1 -1
  174. package/dist/modules/rbac/index.d.ts +1 -1
  175. package/dist/modules/rbac/index.js +2 -2
  176. package/dist/modules/sandbox/index.cjs +39 -39
  177. package/dist/modules/sandbox/index.d.cts +1 -1
  178. package/dist/modules/sandbox/index.d.ts +1 -1
  179. package/dist/modules/sandbox/index.js +1 -1
  180. package/dist/modules/scheduler/index.cjs +25 -25
  181. package/dist/modules/scheduler/index.d.cts +1 -1
  182. package/dist/modules/scheduler/index.d.ts +1 -1
  183. package/dist/modules/scheduler/index.js +2 -2
  184. package/dist/modules/security/index.cjs +14 -14
  185. package/dist/modules/security/index.d.cts +1 -1
  186. package/dist/modules/security/index.d.ts +1 -1
  187. package/dist/modules/security/index.js +2 -2
  188. package/dist/modules/semanticfed/index.cjs +44 -44
  189. package/dist/modules/semanticfed/index.d.cts +1 -1
  190. package/dist/modules/semanticfed/index.d.ts +1 -1
  191. package/dist/modules/semanticfed/index.js +1 -1
  192. package/dist/modules/semanticfed-sql/index.cjs +4 -4
  193. package/dist/modules/semanticfed-sql/index.d.cts +1 -1
  194. package/dist/modules/semanticfed-sql/index.d.ts +1 -1
  195. package/dist/modules/semanticfed-sql/index.js +1 -1
  196. package/dist/modules/store/index.cjs +21 -21
  197. package/dist/modules/store/index.d.cts +1 -1
  198. package/dist/modules/store/index.d.ts +1 -1
  199. package/dist/modules/store/index.js +2 -2
  200. package/dist/modules/subscriberbot/index.cjs +41 -41
  201. package/dist/modules/subscriberbot/index.d.cts +1 -1
  202. package/dist/modules/subscriberbot/index.d.ts +1 -1
  203. package/dist/modules/subscriberbot/index.js +2 -2
  204. package/dist/modules/support/index.cjs +8 -8
  205. package/dist/modules/support/index.d.cts +1 -1
  206. package/dist/modules/support/index.d.ts +1 -1
  207. package/dist/modules/support/index.js +2 -2
  208. package/dist/modules/tags/index.cjs +10 -10
  209. package/dist/modules/tags/index.d.cts +1 -1
  210. package/dist/modules/tags/index.d.ts +1 -1
  211. package/dist/modules/tags/index.js +2 -2
  212. package/dist/modules/technospam/index.cjs +44 -44
  213. package/dist/modules/technospam/index.d.cts +1 -1
  214. package/dist/modules/technospam/index.d.ts +1 -1
  215. package/dist/modules/technospam/index.js +2 -2
  216. package/dist/modules/theculturepost/index.cjs +32 -32
  217. package/dist/modules/theculturepost/index.d.cts +1 -1
  218. package/dist/modules/theculturepost/index.d.ts +1 -1
  219. package/dist/modules/theculturepost/index.js +2 -2
  220. package/dist/modules/theglobalfuel/index.cjs +30 -30
  221. package/dist/modules/theglobalfuel/index.d.cts +1 -1
  222. package/dist/modules/theglobalfuel/index.d.ts +1 -1
  223. package/dist/modules/theglobalfuel/index.js +2 -2
  224. package/dist/modules/timecampus/index.cjs +69 -69
  225. package/dist/modules/timecampus/index.d.cts +1 -1
  226. package/dist/modules/timecampus/index.d.ts +1 -1
  227. package/dist/modules/timecampus/index.js +4 -4
  228. package/dist/modules/tours/index.cjs +4 -4
  229. package/dist/modules/tours/index.d.cts +1 -1
  230. package/dist/modules/tours/index.d.ts +1 -1
  231. package/dist/modules/tours/index.js +2 -2
  232. package/dist/modules/vibecontrols/index.cjs +460 -460
  233. package/dist/modules/vibecontrols/index.d.cts +1 -1
  234. package/dist/modules/vibecontrols/index.d.ts +1 -1
  235. package/dist/modules/vibecontrols/index.js +5 -5
  236. package/dist/modules/workspaces/index.cjs +16 -16
  237. package/dist/modules/workspaces/index.d.cts +1 -1
  238. package/dist/modules/workspaces/index.d.ts +1 -1
  239. package/dist/modules/workspaces/index.js +2 -2
  240. package/package.json +6 -1
  241. package/dist/chunk-3ZVMC2AF.js +0 -1
  242. package/dist/chunk-ZT6KOG7N.js +0 -34
@@ -1,90 +1,90 @@
1
- 'use strict';require('graphql-request');var P=require('cross-fetch');require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);async function h(n,i,o,s){let t=await P__default.default(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({query:`
1
+ 'use strict';require('graphql-request');var D=require('cross-fetch');require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var D__default=/*#__PURE__*/_interopDefault(D);async function h(t,i,o,s){let e=await D__default.default(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({query:`
2
2
  mutation IssueWorkspaceToken($input: IssueWorkspaceTokenInput!) {
3
3
  issueWorkspaceToken(input: $input) {
4
4
  success token expiresAt scopes
5
5
  error { code message }
6
6
  }
7
7
  }
8
- `,variables:{input:{workspaceId:o,organizationId:s}}})});if(!t.ok){let w=await t.text().catch(()=>"Unknown error");throw new Error(`Workspace token request failed (${t.status}): ${w}`)}let r=await t.json();if(r.errors?.length)throw new Error(`Workspace token failed: ${r.errors[0]?.message??"unknown error"}`);let a=r.data?.issueWorkspaceToken;if(!a?.success||!a.token){let w=a?.error?.message??"Unknown error";throw new Error(`Workspace token failed: ${w}`)}return {token:a.token,expiresAt:a.expiresAt??"",scopes:a.scopes??[]}}async function C(n,i){let s=await P__default.default(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({query:`
8
+ `,variables:{input:{workspaceId:o,organizationId:s}}})});if(!e.ok){let w=await e.text().catch(()=>"Unknown error");throw new Error(`Workspace token request failed (${e.status}): ${w}`)}let r=await e.json();if(r.errors?.length)throw new Error(`Workspace token failed: ${r.errors[0]?.message??"unknown error"}`);let c=r.data?.issueWorkspaceToken;if(!c?.success||!c.token){let w=c?.error?.message??"Unknown error";throw new Error(`Workspace token failed: ${w}`)}return {token:c.token,expiresAt:c.expiresAt??"",scopes:c.scopes??[]}}async function C(t,i){let s=await D__default.default(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({query:`
9
9
  query MyWorkspaces($limit: Int) {
10
10
  myWorkspaces(limit: $limit) {
11
11
  items { id name slug tenantId organizationId }
12
12
  }
13
13
  }
14
- `,variables:{limit:50}})});if(!s.ok){let t=await s.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${s.status}): ${t}`)}let e=await s.json();if(e.errors?.length)throw new Error(`Failed to fetch workspaces: ${e.errors[0]?.message??"unknown error"}`);return e.data?.myWorkspaces?.items??[]}var u=class extends Error{exitCode;hint;constructor(i,o){super(i),this.name="CliUserError",this.exitCode=o?.exitCode??1,this.hint=o?.hint;}},k=class extends u{constructor(i,o){super(i,{exitCode:2,hint:o?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},m=class extends Error{cause;constructor(i,o){super(i),this.name="CliInternalError",this.cause=o;}};var A=null;function q(n){A=n;}function d(){if(!A)throw new m("vibecontrols module helpers used before setHelpersContext was called");return A}function se(){let n=d();if(!n.auth.isAuthenticated())throw new k("Authentication required.",{hint:`Run \`${n.productName} auth login\` to authenticate.`})}async function f(n,i){return se(),d().gql.workspace.request(n,i)}async function y(n,i){return d().gql.global.request(n,i)}function v(){d().gql.reset();}function c(n){let i=n instanceof Error?n.message:String(n);throw new u(i)}function l(n,i,o){d().output.formatAndOutput(n,i,o);}function g(n){d().output.printSuccess(n);}function E(n){d().output.printInfo(n);}function b(n){d().output.printWarning(n);}function O(n){return d().output.formatStatus(n)}function R(n){return d().output.formatDate(n)}function x(n,i){return d().output.truncate(n,i)}function I(){return d()}function T(){return d().auth.read()}function S(n){d().auth.write(n);}function W(){return d().config.read()}function D(n){let i=n.command("workspace").description("Workspace context");i.command("current").description("Show current workspace").option("-f, --format <format>","Output format").action(o=>{let s=T(),e=s?.workspaceId??null;if(!e){E(`No workspace set. Run: ${I().productName} workspace set <id>`);return}l(o,{workspaceId:e,organizationId:s?.organizationId??"-",hasWorkspaceToken:!!s?.workspaceToken},{headers:["Key","Value"],rows:[["Workspace ID",e],["Organization ID",s?.organizationId??"-"],["Has Workspace Token",String(!!s?.workspaceToken)]]});}),i.command("set").description("Set workspace ID and issue workspace token").argument("<id>","Workspace ID").action(async o=>{try{let s=T();if(!s?.accessToken)throw new u(`Not authenticated. Run: ${I().productName} auth login`);let e=W(),t;E("Looking up workspace details...");try{let a=(await C(e.globalEndpoint,s.accessToken)).find(w=>w.id===o);a?t=a.organizationId:(b("Workspace not in your accessible list \u2014 using stored organization id as fallback"),t=s.organizationId);}catch{b("Could not fetch workspace details \u2014 using stored organization id"),t=s.organizationId;}if(s.accessToken&&t){E("Issuing workspace token...");try{let r=await h(e.workspaceEndpoint,s.accessToken,o,t);S({...s,workspaceId:o,organizationId:t,workspaceToken:r.token,workspaceTokenExpiresAt:new Date(r.expiresAt).getTime()}),v(),g(`Workspace set to: ${o} (token issued)`);return}catch(r){b(`Workspace token failed: ${r instanceof Error?r.message:String(r)}`);}}S({...s,workspaceId:o,organizationId:t}),v(),g(`Workspace set to: ${o}`);}catch(s){c(s);}}),i.command("list").description("List available workspaces").option("-f, --format <format>","Output format").action(async o=>{try{let s=T();if(!s?.accessToken)throw new u(`Not authenticated. Run: ${I().productName} auth login`);let e=W(),t=await C(e.globalEndpoint,s.accessToken);l(o,t,{headers:["ID","Name","Slug","Organization ID"],rows:t.map(r=>[r.id,r.name,r.slug,r.organizationId])});}catch(s){c(s);}});}var _=`
14
+ `,variables:{limit:50}})});if(!s.ok){let e=await s.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${s.status}): ${e}`)}let n=await s.json();if(n.errors?.length)throw new Error(`Failed to fetch workspaces: ${n.errors[0]?.message??"unknown error"}`);return n.data?.myWorkspaces?.items??[]}var a=class extends Error{exitCode;hint;constructor(i,o){super(i),this.name="CliUserError",this.exitCode=o?.exitCode??1,this.hint=o?.hint;}},k=class extends a{constructor(i,o){super(i,{exitCode:2,hint:o?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},l=class extends Error{cause;constructor(i,o){super(i),this.name="CliInternalError",this.cause=o;}};function R(t){if(t instanceof k||t instanceof a)return t;let i=E(t)&&E(t.response)?t.response:void 0,o=i?.errors,s=Array.isArray(o)?o[0]:void 0,e=(E(s)&&E(s.extensions)?s.extensions:void 0)?.code,r=i?.status;return e==="UNAUTHENTICATED"||r===401?new k("Authentication required."):e==="FORBIDDEN"||r===403?new a("Permission denied."):e==="BAD_USER_INPUT"||e==="GRAPHQL_VALIDATION_FAILED"||r===400?new a("Invalid request. Check the command arguments."):e==="NOT_FOUND"||r===404?new a("Requested resource was not found."):e==="RATE_LIMITED"||e==="TOO_MANY_REQUESTS"||r===429?new a("Request limit reached. Try again later."):new l("The request could not be completed. Try again later.")}var x=class extends Error{response;constructor(i,o){super(i),this.name="GqlRequestError",this.response=o;}};function E(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var O=null;function L(t){O=t;}function d(){if(!O)throw new l("vibecontrols module helpers used before setHelpersContext was called");return O}function ue(){let t=d();if(!t.auth.isAuthenticated())throw new k("Authentication required.",{hint:`Run \`${t.productName} auth login\` to authenticate.`})}async function m(t,i){return ue(),d().gql.workspace.request(t,i)}async function I(t,i){return d().gql.global.request(t,i)}function S(){d().gql.reset();}function u(t){throw t instanceof k||t instanceof a||t instanceof l?t:t instanceof x||t!==null&&typeof t=="object"&&"response"in t?R(t):new l("The command could not be completed. Try again later.")}function f(t,i,o){d().output.formatAndOutput(t,i,o);}function g(t){d().output.printSuccess(t);}function b(t){d().output.printInfo(t);}function T(t){d().output.printWarning(t);}function W(t){return d().output.formatStatus(t)}function P(t){return d().output.formatDate(t)}function y(t,i){return d().output.truncate(t,i)}function A(){return d()}function v(){return d().auth.read()}function q(t){d().auth.write(t);}function $(){return d().config.read()}function M(t){let i=t.command("workspace").description("Workspace context");i.command("current").description("Show current workspace").option("-f, --format <format>","Output format").action(o=>{let s=v(),n=s?.workspaceId??null;if(!n){b(`No workspace set. Run: ${A().productName} workspace set <id>`);return}f(o,{workspaceId:n,organizationId:s?.organizationId??"-",hasWorkspaceToken:!!s?.workspaceToken},{headers:["Key","Value"],rows:[["Workspace ID",n],["Organization ID",s?.organizationId??"-"],["Has Workspace Token",String(!!s?.workspaceToken)]]});}),i.command("set").description("Set workspace ID and issue workspace token").argument("<id>","Workspace ID").action(async o=>{try{let s=v();if(!s?.accessToken)throw new a(`Not authenticated. Run: ${A().productName} auth login`);let n=$(),e;b("Looking up workspace details...");try{let c=(await C(n.globalEndpoint,s.accessToken)).find(w=>w.id===o);c?e=c.organizationId:(T("Workspace not in your accessible list \u2014 using stored organization id as fallback"),e=s.organizationId);}catch{T("Could not fetch workspace details \u2014 using stored organization id"),e=s.organizationId;}if(s.accessToken&&e){b("Issuing workspace token...");try{let r=await h(n.workspaceEndpoint,s.accessToken,o,e);q({...s,workspaceId:o,organizationId:e,workspaceToken:r.token,workspaceTokenExpiresAt:new Date(r.expiresAt).getTime()}),S(),g(`Workspace set to: ${o} (token issued)`);return}catch(r){T(`Workspace token failed: ${r instanceof Error?r.message:String(r)}`);}}q({...s,workspaceId:o,organizationId:e}),S(),g(`Workspace set to: ${o}`);}catch(s){u(s);}}),i.command("list").description("List available workspaces").option("-f, --format <format>","Output format").action(async o=>{try{let s=v();if(!s?.accessToken)throw new a(`Not authenticated. Run: ${A().productName} auth login`);let n=$(),e=await C(n.globalEndpoint,s.accessToken);f(o,e,{headers:["ID","Name","Slug","Organization ID"],rows:e.map(r=>[r.id,r.name,r.slug,r.organizationId])});}catch(s){u(s);}});}var N=`
15
15
  query GetWorkspace($id: ID!) {
16
16
  workspace(id: $id) {
17
17
  id name slug type tenantId organizationId region status memberCount createdAt updatedAt
18
18
  }
19
19
  }
20
- `,L=`
20
+ `,j=`
21
21
  mutation CreateWorkspace($input: CreateWorkspaceInput!) {
22
22
  createWorkspace(input: $input) {
23
23
  id name slug status createdAt
24
24
  }
25
25
  }
26
- `,M=`
26
+ `,G=`
27
27
  mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
28
28
  updateWorkspace(id: $id, input: $input) {
29
29
  id name slug status updatedAt
30
30
  }
31
31
  }
32
- `,j=`
32
+ `,U=`
33
33
  mutation DeleteWorkspace($id: ID!) {
34
34
  deleteWorkspace(id: $id)
35
35
  }
36
- `,N=`
36
+ `,F=`
37
37
  query ListWorkspaceMembers($workspaceId: ID!, $pagination: PaginationInput) {
38
38
  workspaceMembers(workspaceId: $workspaceId, pagination: $pagination) {
39
39
  items { id userId role status createdAt }
40
40
  total hasMore
41
41
  }
42
42
  }
43
- `,G=`
43
+ `,z=`
44
44
  mutation AddWorkspaceMember($input: AddWorkspaceMemberInput!) {
45
45
  addWorkspaceMember(input: $input) {
46
46
  id userId role status
47
47
  }
48
48
  }
49
- `,F=`
49
+ `,B=`
50
50
  mutation RemoveWorkspaceMember($id: ID!) {
51
51
  removeWorkspaceMember(id: $id)
52
52
  }
53
- `,U=`
53
+ `,V=`
54
54
  mutation UpdateWorkspaceMemberRoles($input: UpdateWorkspaceMemberRolesInput!) {
55
55
  updateWorkspaceMemberRoles(input: $input) {
56
56
  id userId role
57
57
  }
58
58
  }
59
- `,z=`
59
+ `,K=`
60
60
  query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {
61
61
  projects(filter: $filter, pagination: $pagination) {
62
62
  items { id name workspaceId status createdAt }
63
63
  total hasMore
64
64
  }
65
65
  }
66
- `,V=`
66
+ `,J=`
67
67
  query GetProject($id: ID!) {
68
68
  project(id: $id) {
69
69
  id name description workspaceId status createdAt updatedAt
70
70
  }
71
71
  }
72
- `,B=`
72
+ `,H=`
73
73
  mutation CreateProject($input: CreateProjectInput!) {
74
74
  createProject(input: $input) {
75
75
  id name workspaceId status
76
76
  }
77
77
  }
78
- `,K=`
78
+ `,Y=`
79
79
  mutation AcceptInvitation($id: ID!) {
80
80
  acceptInvitation(id: $id) {
81
81
  id status workspaceId
82
82
  }
83
83
  }
84
- `,J=`
84
+ `,Q=`
85
85
  query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
86
86
  getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
87
87
  id action userId actorType resourceType resourceId description timestamp
88
88
  }
89
89
  }
90
- `;function ce(n,i){let o;try{o=JSON.parse(i);}catch{throw new u(`${n} must be valid JSON`)}if(!o||typeof o!="object"||Array.isArray(o))throw new u(`${n} must be a JSON object`);return o}function H(n){n.command("get").description("Get a workspace by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let r=await y(_,{id:e});if(!r.workspace)throw new u(`Workspace ${e} not found`);l(t,r.workspace);}catch(r){c(r);}}),n.command("create").description("Create a workspace (global layer)").requiredOption("--name <name>").requiredOption("--slug <slug>","URL-safe workspace identifier").option("--tenant <id>","Target tenant id (defaults to the organization tenant)").option("--organization <id>","Owning organization id").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,tenantId:e.tenant,organizationId:e.organization,slug:e.slug},r=await y(L,{input:t});g(`Workspace created: ${r.createWorkspace.name}`),l(e,r.createWorkspace);}catch(t){c(t);}}),n.command("update").description("Update a workspace").argument("<id>").option("--name <s>").option("--metadata <json>","Replace the workspace metadata (JSON object)").option("-f, --format <format>").action(async(e,t)=>{try{let r={};if(t.name&&(r.name=t.name),t.metadata!==void 0&&(r.metadata=ce("--metadata",t.metadata)),!Object.keys(r).length)throw new u("No updates specified");let a=await y(M,{id:e,input:r});g("Workspace updated"),l(t,a.updateWorkspace);}catch(r){c(r);}}),n.command("delete").description("Delete a workspace (workspace layer)").argument("<id>").action(async e=>{try{await f(j,{id:e}),g("Workspace deleted");}catch(t){c(t);}});let i=n.command("members").description("Workspace member management");i.command("list").description("List members of a workspace").requiredOption("--workspace <id>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let t=await f(N,{workspaceId:e.workspace,pagination:{limit:e.limit,offset:0}});l(e,t.workspaceMembers.items,{headers:["ID","UserID","Role","Status","Joined"],rows:t.workspaceMembers.items.map(r=>[x(r.id,12),x(r.userId,12),r.role??"-",O(r.status),R(r.createdAt)])});}catch(t){c(t);}}),i.command("add").description("Add a member to a workspace").requiredOption("--workspace <id>").requiredOption("--user <userId>").option("--role <r>","MEMBER|ADMIN|OWNER","MEMBER").option("-f, --format <format>").action(async e=>{try{let t={workspaceId:e.workspace,userId:e.user,role:(e.role??"MEMBER").toUpperCase()},r=await f(G,{input:t});g("Member added"),l(e,r.addWorkspaceMember);}catch(t){c(t);}}),i.command("remove").description("Remove a member by membership id").argument("<membershipId>").action(async e=>{try{await f(F,{id:e}),g("Member removed");}catch(t){c(t);}}),i.command("role").description("Update member role").requiredOption("--workspace <id>").requiredOption("--user <userId>").requiredOption("--role <r>").action(async e=>{try{let t={workspaceId:e.workspace,userId:e.user,roles:[e.role.toUpperCase()]};await f(U,{input:t}),g("Member role updated");}catch(t){c(t);}});let o=n.command("projects").description("Workspace projects");o.command("list").description("List projects").option("--workspace <id>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let t={};e.workspace&&(t.workspaceId=e.workspace);let r=await f(z,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});l(e,r.projects.items,{headers:["ID","Name","Workspace","Status","Created"],rows:r.projects.items.map(a=>[x(a.id,12),a.name,x(a.workspaceId,12),O(a.status),R(a.createdAt)])});}catch(t){c(t);}}),o.command("get").description("Get a project").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let r=await f(V,{id:e});if(!r.project)throw new u(`Project ${e} not found`);l(t,r.project);}catch(r){c(r);}}),o.command("create").description("Create a project").requiredOption("--workspace <id>").requiredOption("--name <name>").option("--description <s>").option("-f, --format <format>").action(async e=>{try{let t={workspaceId:e.workspace,name:e.name,description:e.description},r=await f(B,{input:t});g("Project created"),l(e,r.createProject);}catch(t){c(t);}}),n.command("invite").description("Workspace invitations").command("accept").description("Accept a workspace invitation").argument("<invitationId>").action(async e=>{try{await f(K,{id:e}),g("Invitation accepted");}catch(t){c(t);}}),n.command("activity").description("Workspace activity log").requiredOption("--workspace <id>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let t=await f(J,{workspaceId:e.workspace,limit:e.limit,offset:0});l(e,t.getWorkspaceActivities);}catch(t){c(t);}});}var ue={id:"workspaces",version:"1.0.0",displayName:"Workspaces",dependsOn:["auth"],register(n,i){q(i),D(n);let o=n.commands.find(s=>s.name()==="workspace");if(!o)throw new m("workspace command group missing after registerWorkspaceCommands");H(o);}},Wt=ue;module.exports=Wt;
90
+ `;function de(t,i){let o;try{o=JSON.parse(i);}catch{throw new a(`${t} must be valid JSON`)}if(!o||typeof o!="object"||Array.isArray(o))throw new a(`${t} must be a JSON object`);return o}function X(t){t.command("get").description("Get a workspace by id").argument("<id>").option("-f, --format <format>").action(async(n,e)=>{try{let r=await I(N,{id:n});if(!r.workspace)throw new a(`Workspace ${n} not found`);f(e,r.workspace);}catch(r){u(r);}}),t.command("create").description("Create a workspace (global layer)").requiredOption("--name <name>").requiredOption("--slug <slug>","URL-safe workspace identifier").option("--tenant <id>","Target tenant id (defaults to the organization tenant)").option("--organization <id>","Owning organization id").option("-f, --format <format>").action(async n=>{try{let e={name:n.name,tenantId:n.tenant,organizationId:n.organization,slug:n.slug},r=await I(j,{input:e});g(`Workspace created: ${r.createWorkspace.name}`),f(n,r.createWorkspace);}catch(e){u(e);}}),t.command("update").description("Update a workspace").argument("<id>").option("--name <s>").option("--metadata <json>","Replace the workspace metadata (JSON object)").option("-f, --format <format>").action(async(n,e)=>{try{let r={};if(e.name&&(r.name=e.name),e.metadata!==void 0&&(r.metadata=de("--metadata",e.metadata)),!Object.keys(r).length)throw new a("No updates specified");let c=await I(G,{id:n,input:r});g("Workspace updated"),f(e,c.updateWorkspace);}catch(r){u(r);}}),t.command("delete").description("Delete a workspace (workspace layer)").argument("<id>").action(async n=>{try{await m(U,{id:n}),g("Workspace deleted");}catch(e){u(e);}});let i=t.command("members").description("Workspace member management");i.command("list").description("List members of a workspace").requiredOption("--workspace <id>").option("--limit <n>","Page size",n=>parseInt(n,10),100).option("-f, --format <format>").action(async n=>{try{let e=await m(F,{workspaceId:n.workspace,pagination:{limit:n.limit,offset:0}});f(n,e.workspaceMembers.items,{headers:["ID","UserID","Role","Status","Joined"],rows:e.workspaceMembers.items.map(r=>[y(r.id,12),y(r.userId,12),r.role??"-",W(r.status),P(r.createdAt)])});}catch(e){u(e);}}),i.command("add").description("Add a member to a workspace").requiredOption("--workspace <id>").requiredOption("--user <userId>").option("--role <r>","MEMBER|ADMIN|OWNER","MEMBER").option("-f, --format <format>").action(async n=>{try{let e={workspaceId:n.workspace,userId:n.user,role:(n.role??"MEMBER").toUpperCase()},r=await m(z,{input:e});g("Member added"),f(n,r.addWorkspaceMember);}catch(e){u(e);}}),i.command("remove").description("Remove a member by membership id").argument("<membershipId>").action(async n=>{try{await m(B,{id:n}),g("Member removed");}catch(e){u(e);}}),i.command("role").description("Update member role").requiredOption("--workspace <id>").requiredOption("--user <userId>").requiredOption("--role <r>").action(async n=>{try{let e={workspaceId:n.workspace,userId:n.user,roles:[n.role.toUpperCase()]};await m(V,{input:e}),g("Member role updated");}catch(e){u(e);}});let o=t.command("projects").description("Workspace projects");o.command("list").description("List projects").option("--workspace <id>").option("--limit <n>","Page size",n=>parseInt(n,10),100).option("-f, --format <format>").action(async n=>{try{let e={};n.workspace&&(e.workspaceId=n.workspace);let r=await m(K,{filter:Object.keys(e).length?e:void 0,pagination:{limit:n.limit,offset:0}});f(n,r.projects.items,{headers:["ID","Name","Workspace","Status","Created"],rows:r.projects.items.map(c=>[y(c.id,12),c.name,y(c.workspaceId,12),W(c.status),P(c.createdAt)])});}catch(e){u(e);}}),o.command("get").description("Get a project").argument("<id>").option("-f, --format <format>").action(async(n,e)=>{try{let r=await m(J,{id:n});if(!r.project)throw new a(`Project ${n} not found`);f(e,r.project);}catch(r){u(r);}}),o.command("create").description("Create a project").requiredOption("--workspace <id>").requiredOption("--name <name>").option("--description <s>").option("-f, --format <format>").action(async n=>{try{let e={workspaceId:n.workspace,name:n.name,description:n.description},r=await m(H,{input:e});g("Project created"),f(n,r.createProject);}catch(e){u(e);}}),t.command("invite").description("Workspace invitations").command("accept").description("Accept a workspace invitation").argument("<invitationId>").action(async n=>{try{await m(Y,{id:n}),g("Invitation accepted");}catch(e){u(e);}}),t.command("activity").description("Workspace activity log").requiredOption("--workspace <id>").option("--limit <n>","Page size",n=>parseInt(n,10),100).option("-f, --format <format>").action(async n=>{try{let e=await m(Q,{workspaceId:n.workspace,limit:n.limit,offset:0});f(n,e.getWorkspaceActivities);}catch(e){u(e);}});}var le={id:"workspaces",version:"1.0.0",displayName:"Workspaces",dependsOn:["auth"],register(t,i){L(i),M(t);let o=t.commands.find(s=>s.name()==="workspace");if(!o)throw new l("workspace command group missing after registerWorkspaceCommands");X(o);}},$t=le;module.exports=$t;
@@ -1,4 +1,4 @@
1
- import { C as CliModule } from '../../module-BNVKV_pI.cjs';
1
+ import { C as CliModule } from '../../module-DWSAfs3k.cjs';
2
2
  import 'commander';
3
3
  import 'graphql-request';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as CliModule } from '../../module-BNVKV_pI.js';
1
+ import { C as CliModule } from '../../module-DWSAfs3k.js';
2
2
  import 'commander';
3
3
  import 'graphql-request';
4
4
 
@@ -1,4 +1,4 @@
1
- import {a,v as v$1,m,u,i,y,n,w,f,k,h as h$1,c,b,r,p,q as q$2}from'../../chunk-3ZVMC2AF.js';import {s,q as q$1,h,g}from'../../chunk-ZT6KOG7N.js';function P(i$1){let c=i$1.command("workspace").description("Workspace context");c.command("current").description("Show current workspace").option("-f, --format <format>","Output format").action(a=>{let r=v$1(),t=r?.workspaceId??null;if(!t){m(`No workspace set. Run: ${u().productName} workspace set <id>`);return}i(a,{workspaceId:t,organizationId:r?.organizationId??"-",hasWorkspaceToken:!!r?.workspaceToken},{headers:["Key","Value"],rows:[["Workspace ID",t],["Organization ID",r?.organizationId??"-"],["Has Workspace Token",String(!!r?.workspaceToken)]]});}),c.command("set").description("Set workspace ID and issue workspace token").argument("<id>","Workspace ID").action(async a=>{try{let r=v$1();if(!r?.accessToken)throw new q$1(`Not authenticated. Run: ${u().productName} auth login`);let t=y(),e;m("Looking up workspace details...");try{let m=(await h(t.globalEndpoint,r.accessToken)).find(J=>J.id===a);m?e=m.organizationId:(n("Workspace not in your accessible list \u2014 using stored organization id as fallback"),e=r.organizationId);}catch{n("Could not fetch workspace details \u2014 using stored organization id"),e=r.organizationId;}if(r.accessToken&&e){m("Issuing workspace token...");try{let o=await g(t.workspaceEndpoint,r.accessToken,a,e);w({...r,workspaceId:a,organizationId:e,workspaceToken:o.token,workspaceTokenExpiresAt:new Date(o.expiresAt).getTime()}),f(),k(`Workspace set to: ${a} (token issued)`);return}catch(o){n(`Workspace token failed: ${o instanceof Error?o.message:String(o)}`);}}w({...r,workspaceId:a,organizationId:e}),f(),k(`Workspace set to: ${a}`);}catch(r){h$1(r);}}),c.command("list").description("List available workspaces").option("-f, --format <format>","Output format").action(async a=>{try{let r=v$1();if(!r?.accessToken)throw new q$1(`Not authenticated. Run: ${u().productName} auth login`);let t=y(),e=await h(t.globalEndpoint,r.accessToken);i(a,e,{headers:["ID","Name","Slug","Organization ID"],rows:e.map(o=>[o.id,o.name,o.slug,o.organizationId])});}catch(r){h$1(r);}});}var $=`
1
+ import {a,v as v$1,m,u,i,y,n,w,f,k,h as h$1,c,b,r,p,q as q$1}from'../../chunk-BGNPGKJM.js';import {l,j as j$1,h,g}from'../../chunk-N7EXKGE2.js';function P(i$1){let c=i$1.command("workspace").description("Workspace context");c.command("current").description("Show current workspace").option("-f, --format <format>","Output format").action(a=>{let r=v$1(),t=r?.workspaceId??null;if(!t){m(`No workspace set. Run: ${u().productName} workspace set <id>`);return}i(a,{workspaceId:t,organizationId:r?.organizationId??"-",hasWorkspaceToken:!!r?.workspaceToken},{headers:["Key","Value"],rows:[["Workspace ID",t],["Organization ID",r?.organizationId??"-"],["Has Workspace Token",String(!!r?.workspaceToken)]]});}),c.command("set").description("Set workspace ID and issue workspace token").argument("<id>","Workspace ID").action(async a=>{try{let r=v$1();if(!r?.accessToken)throw new j$1(`Not authenticated. Run: ${u().productName} auth login`);let t=y(),e;m("Looking up workspace details...");try{let m=(await h(t.globalEndpoint,r.accessToken)).find(J=>J.id===a);m?e=m.organizationId:(n("Workspace not in your accessible list \u2014 using stored organization id as fallback"),e=r.organizationId);}catch{n("Could not fetch workspace details \u2014 using stored organization id"),e=r.organizationId;}if(r.accessToken&&e){m("Issuing workspace token...");try{let o=await g(t.workspaceEndpoint,r.accessToken,a,e);w({...r,workspaceId:a,organizationId:e,workspaceToken:o.token,workspaceTokenExpiresAt:new Date(o.expiresAt).getTime()}),f(),k(`Workspace set to: ${a} (token issued)`);return}catch(o){n(`Workspace token failed: ${o instanceof Error?o.message:String(o)}`);}}w({...r,workspaceId:a,organizationId:e}),f(),k(`Workspace set to: ${a}`);}catch(r){h$1(r);}}),c.command("list").description("List available workspaces").option("-f, --format <format>","Output format").action(async a=>{try{let r=v$1();if(!r?.accessToken)throw new j$1(`Not authenticated. Run: ${u().productName} auth login`);let t=y(),e=await h(t.globalEndpoint,r.accessToken);i(a,e,{headers:["ID","Name","Slug","Organization ID"],rows:e.map(o=>[o.id,o.name,o.slug,o.organizationId])});}catch(r){h$1(r);}});}var $=`
2
2
  query GetWorkspace($id: ID!) {
3
3
  workspace(id: $id) {
4
4
  id name slug type tenantId organizationId region status memberCount createdAt updatedAt
@@ -74,4 +74,4 @@ import {a,v as v$1,m,u,i,y,n,w,f,k,h as h$1,c,b,r,p,q as q$2}from'../../chunk-3Z
74
74
  id action userId actorType resourceType resourceId description timestamp
75
75
  }
76
76
  }
77
- `;function G(i,c){let a;try{a=JSON.parse(c);}catch{throw new q$1(`${i} must be valid JSON`)}if(!a||typeof a!="object"||Array.isArray(a))throw new q$1(`${i} must be a JSON object`);return a}function B(i$1){i$1.command("get").description("Get a workspace by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await c($,{id:t});if(!o.workspace)throw new q$1(`Workspace ${t} not found`);i(e,o.workspace);}catch(o){h$1(o);}}),i$1.command("create").description("Create a workspace (global layer)").requiredOption("--name <name>").requiredOption("--slug <slug>","URL-safe workspace identifier").option("--tenant <id>","Target tenant id (defaults to the organization tenant)").option("--organization <id>","Owning organization id").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,tenantId:t.tenant,organizationId:t.organization,slug:t.slug},o=await c(S,{input:e});k(`Workspace created: ${o.createWorkspace.name}`),i(t,o.createWorkspace);}catch(e){h$1(e);}}),i$1.command("update").description("Update a workspace").argument("<id>").option("--name <s>").option("--metadata <json>","Replace the workspace metadata (JSON object)").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.metadata!==void 0&&(o.metadata=G("--metadata",e.metadata)),!Object.keys(o).length)throw new q$1("No updates specified");let m=await c(j,{id:t,input:o});k("Workspace updated"),i(e,m.updateWorkspace);}catch(o){h$1(o);}}),i$1.command("delete").description("Delete a workspace (workspace layer)").argument("<id>").action(async t=>{try{await b(_,{id:t}),k("Workspace deleted");}catch(e){h$1(e);}});let c$1=i$1.command("members").description("Workspace member management");c$1.command("list").description("List members of a workspace").requiredOption("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e=await b(D,{workspaceId:t.workspace,pagination:{limit:t.limit,offset:0}});i(t,e.workspaceMembers.items,{headers:["ID","UserID","Role","Status","Joined"],rows:e.workspaceMembers.items.map(o=>[r(o.id,12),r(o.userId,12),o.role??"-",p(o.status),q$2(o.createdAt)])});}catch(e){h$1(e);}}),c$1.command("add").description("Add a member to a workspace").requiredOption("--workspace <id>").requiredOption("--user <userId>").option("--role <r>","MEMBER|ADMIN|OWNER","MEMBER").option("-f, --format <format>").action(async t=>{try{let e={workspaceId:t.workspace,userId:t.user,role:(t.role??"MEMBER").toUpperCase()},o=await b(x,{input:e});k("Member added"),i(t,o.addWorkspaceMember);}catch(e){h$1(e);}}),c$1.command("remove").description("Remove a member by membership id").argument("<membershipId>").action(async t=>{try{await b(v,{id:t}),k("Member removed");}catch(e){h$1(e);}}),c$1.command("role").description("Update member role").requiredOption("--workspace <id>").requiredOption("--user <userId>").requiredOption("--role <r>").action(async t=>{try{let e={workspaceId:t.workspace,userId:t.user,roles:[t.role.toUpperCase()]};await b(z,{input:e}),k("Member role updated");}catch(e){h$1(e);}});let a=i$1.command("projects").description("Workspace projects");a.command("list").description("List projects").option("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e={};t.workspace&&(e.workspaceId=t.workspace);let o=await b(N,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});i(t,o.projects.items,{headers:["ID","Name","Workspace","Status","Created"],rows:o.projects.items.map(m=>[r(m.id,12),m.name,r(m.workspaceId,12),p(m.status),q$2(m.createdAt)])});}catch(e){h$1(e);}}),a.command("get").description("Get a project").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(K,{id:t});if(!o.project)throw new q$1(`Project ${t} not found`);i(e,o.project);}catch(o){h$1(o);}}),a.command("create").description("Create a project").requiredOption("--workspace <id>").requiredOption("--name <name>").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let e={workspaceId:t.workspace,name:t.name,description:t.description},o=await b(L,{input:e});k("Project created"),i(t,o.createProject);}catch(e){h$1(e);}}),i$1.command("invite").description("Workspace invitations").command("accept").description("Accept a workspace invitation").argument("<invitationId>").action(async t=>{try{await b(q,{id:t}),k("Invitation accepted");}catch(e){h$1(e);}}),i$1.command("activity").description("Workspace activity log").requiredOption("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e=await b(U,{workspaceId:t.workspace,limit:t.limit,offset:0});i(t,e.getWorkspaceActivities);}catch(e){h$1(e);}});}var H={id:"workspaces",version:"1.0.0",displayName:"Workspaces",dependsOn:["auth"],register(i,c){a(c),P(i);let a$1=i.commands.find(r=>r.name()==="workspace");if(!a$1)throw new s("workspace command group missing after registerWorkspaceCommands");B(a$1);}},ut=H;export{ut as default};
77
+ `;function G(i,c){let a;try{a=JSON.parse(c);}catch{throw new j$1(`${i} must be valid JSON`)}if(!a||typeof a!="object"||Array.isArray(a))throw new j$1(`${i} must be a JSON object`);return a}function B(i$1){i$1.command("get").description("Get a workspace by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await c($,{id:t});if(!o.workspace)throw new j$1(`Workspace ${t} not found`);i(e,o.workspace);}catch(o){h$1(o);}}),i$1.command("create").description("Create a workspace (global layer)").requiredOption("--name <name>").requiredOption("--slug <slug>","URL-safe workspace identifier").option("--tenant <id>","Target tenant id (defaults to the organization tenant)").option("--organization <id>","Owning organization id").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,tenantId:t.tenant,organizationId:t.organization,slug:t.slug},o=await c(S,{input:e});k(`Workspace created: ${o.createWorkspace.name}`),i(t,o.createWorkspace);}catch(e){h$1(e);}}),i$1.command("update").description("Update a workspace").argument("<id>").option("--name <s>").option("--metadata <json>","Replace the workspace metadata (JSON object)").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.metadata!==void 0&&(o.metadata=G("--metadata",e.metadata)),!Object.keys(o).length)throw new j$1("No updates specified");let m=await c(j,{id:t,input:o});k("Workspace updated"),i(e,m.updateWorkspace);}catch(o){h$1(o);}}),i$1.command("delete").description("Delete a workspace (workspace layer)").argument("<id>").action(async t=>{try{await b(_,{id:t}),k("Workspace deleted");}catch(e){h$1(e);}});let c$1=i$1.command("members").description("Workspace member management");c$1.command("list").description("List members of a workspace").requiredOption("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e=await b(D,{workspaceId:t.workspace,pagination:{limit:t.limit,offset:0}});i(t,e.workspaceMembers.items,{headers:["ID","UserID","Role","Status","Joined"],rows:e.workspaceMembers.items.map(o=>[r(o.id,12),r(o.userId,12),o.role??"-",p(o.status),q$1(o.createdAt)])});}catch(e){h$1(e);}}),c$1.command("add").description("Add a member to a workspace").requiredOption("--workspace <id>").requiredOption("--user <userId>").option("--role <r>","MEMBER|ADMIN|OWNER","MEMBER").option("-f, --format <format>").action(async t=>{try{let e={workspaceId:t.workspace,userId:t.user,role:(t.role??"MEMBER").toUpperCase()},o=await b(x,{input:e});k("Member added"),i(t,o.addWorkspaceMember);}catch(e){h$1(e);}}),c$1.command("remove").description("Remove a member by membership id").argument("<membershipId>").action(async t=>{try{await b(v,{id:t}),k("Member removed");}catch(e){h$1(e);}}),c$1.command("role").description("Update member role").requiredOption("--workspace <id>").requiredOption("--user <userId>").requiredOption("--role <r>").action(async t=>{try{let e={workspaceId:t.workspace,userId:t.user,roles:[t.role.toUpperCase()]};await b(z,{input:e}),k("Member role updated");}catch(e){h$1(e);}});let a=i$1.command("projects").description("Workspace projects");a.command("list").description("List projects").option("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e={};t.workspace&&(e.workspaceId=t.workspace);let o=await b(N,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});i(t,o.projects.items,{headers:["ID","Name","Workspace","Status","Created"],rows:o.projects.items.map(m=>[r(m.id,12),m.name,r(m.workspaceId,12),p(m.status),q$1(m.createdAt)])});}catch(e){h$1(e);}}),a.command("get").description("Get a project").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await b(K,{id:t});if(!o.project)throw new j$1(`Project ${t} not found`);i(e,o.project);}catch(o){h$1(o);}}),a.command("create").description("Create a project").requiredOption("--workspace <id>").requiredOption("--name <name>").option("--description <s>").option("-f, --format <format>").action(async t=>{try{let e={workspaceId:t.workspace,name:t.name,description:t.description},o=await b(L,{input:e});k("Project created"),i(t,o.createProject);}catch(e){h$1(e);}}),i$1.command("invite").description("Workspace invitations").command("accept").description("Accept a workspace invitation").argument("<invitationId>").action(async t=>{try{await b(q,{id:t}),k("Invitation accepted");}catch(e){h$1(e);}}),i$1.command("activity").description("Workspace activity log").requiredOption("--workspace <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let e=await b(U,{workspaceId:t.workspace,limit:t.limit,offset:0});i(t,e.getWorkspaceActivities);}catch(e){h$1(e);}});}var H={id:"workspaces",version:"1.0.0",displayName:"Workspaces",dependsOn:["auth"],register(i,c){a(c),P(i);let a$1=i.commands.find(r=>r.name()==="workspace");if(!a$1)throw new l("workspace command group missing after registerWorkspaceCommands");B(a$1);}},ut=H;export{ut as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/cli-sdk",
3
- "version": "2026.1124.1",
3
+ "version": "2026.1202.1",
4
4
  "description": "Modular CLI SDK shared across all Burdenoff product CLIs (vibecontrols, botlit, fluidgrids, bigconsole, healthybowl, devportal, workspaces). Each module exports CliModule contract; product CLIs become thin shells that pick which modules to mount.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -109,5 +109,10 @@
109
109
  "global": 90,
110
110
  "diff": 80
111
111
  }
112
+ },
113
+ "overrides": {
114
+ "cross-spawn": "7.1.2",
115
+ "glob": "14.0.6",
116
+ "minimatch": "11.0.9"
112
117
  }
113
118
  }
@@ -1 +0,0 @@
1
- import {b as b$1,q as q$1,r,s}from'./chunk-ZT6KOG7N.js';var o=null;function b(t){o=t;}function e(){if(!o)throw new s("vibecontrols module helpers used before setHelpersContext was called");return o}function p(){let t=e();if(!t.auth.isAuthenticated())throw new r("Authentication required.",{hint:`Run \`${t.productName} auth login\` to authenticate.`})}async function w(t,n){return p(),e().gql.workspace.request(t,n)}async function T(t,n){return e().gql.global.request(t,n)}async function q(t,n){return e().gql.workspaceAuthOnly.request(t,n)}async function A(t,n){return e().gql.global.request(t,n)}function k(){e().gql.reset();}function v(t){return /^(error|fail|failed|failure|timeout|cancel)/i.test(t.status)||t.exitCode!==null&&t.exitCode!==void 0&&t.exitCode!==0?true:t.webhookStatusCode!==null&&t.webhookStatusCode!==void 0&&t.webhookStatusCode>=400}function S(t){let n=t instanceof Error?t.message:String(t);throw new q$1(n)}function E(t,n,a){e().output.formatAndOutput(t,n,a);}function I(){return e().output}function O(t){e().output.printSuccess(t);}function D(t){e().output.printError(t);}function y(t){e().output.printInfo(t);}function N(t){e().output.printWarning(t);}function R(t){e().output.printJson(t);}function F(t){return e().output.formatStatus(t)}function W(t){return e().output.formatDate(t)}function L(t,n){return e().output.truncate(t,n)}function V(t,n){return e().output.confirm(t,n)}function P(t,n){e().output.printTable(t,n);}function _(){return e()}function K(){return e().auth.read()}function G(t){e().auth.write(t);}function B(){e().auth.clear();}function Y(){return e().config.read()}function j(t){return e().config.get(t)}function H(t,n){e().config.set(t,n);}function J(){return e().config.path()}var U=b$1;function $(){return e().config.resolveOIDC()}function z(t){return t?t.expiresAt?Date.now()>=t.expiresAt:false:e().auth.isTokenExpired()}export{H as A,J as B,U as C,$ as D,z as E,b as a,w as b,T as c,q as d,A as e,k as f,v as g,S as h,E as i,I as j,O as k,D as l,y as m,N as n,R as o,F as p,W as q,L as r,V as s,P as t,_ as u,K as v,G as w,B as x,Y as y,j as z};
@@ -1,34 +0,0 @@
1
- import {existsSync,readFileSync,writeFileSync,chmodSync,unlinkSync,mkdirSync}from'fs';import {join}from'path';import {homedir}from'os';import {GraphQLClient}from'graphql-request';import b from'cross-fetch';import {Command}from'commander';var z=300*1e3;function $(e){let n=join(e,"auth.json");function r(){existsSync(e)||mkdirSync(e,{recursive:true,mode:448});}function t(){try{if(!existsSync(n))return null;let c=readFileSync(n,"utf8");return JSON.parse(c)}catch{return null}}function s(c){r(),writeFileSync(n,JSON.stringify(c,null,2),{encoding:"utf8",mode:384});try{chmodSync(n,384);}catch{}}function i(){try{existsSync(n)&&unlinkSync(n);}catch{}}function o(){let c=t();return c?.expiresAt?Date.now()>=c.expiresAt:false}function a(){let c=t();return c?.expiresAt?Date.now()+z>=c.expiresAt:false}function l(){let c=t();return c?.workspaceTokenExpiresAt?Date.now()>=c.workspaceTokenExpiresAt:false}function m(){let c=t();return c?.workspaceTokenExpiresAt?Date.now()+z>=c.workspaceTokenExpiresAt:false}function x(){return t()?.accessToken?!o():false}return {read:t,write:s,clear:i,isTokenExpired:o,isTokenExpiringSoon:a,isWorkspaceTokenExpired:l,isWorkspaceTokenExpiringSoon:m,isAuthenticated:x}}var pe=["workspaceEndpoint","globalEndpoint","oidcIssuer","clientId","defaultFormat","verbose","authServiceEndpoint","productOrigin"];function P(e){let n=join(homedir(),".config",e.configDirName),r=join(n,"config.json"),t={workspaceEndpoint:e.workspaceEndpointDefault,globalEndpoint:e.globalEndpointDefault};function s(){existsSync(n)||mkdirSync(n,{recursive:true,mode:448});}function i(u){if(e.envPrefix){let g=process.env[`${e.envPrefix}_${u}`];if(g)return g}let d=process.env[u];return d&&d.length>0?d:void 0}function o(u){if(!e.envPrefix)return;let d=process.env[`${e.envPrefix}_${u}`];return d&&d.length>0?d:void 0}function a(){let u={};try{existsSync(r)&&(u=JSON.parse(readFileSync(r,"utf8")));}catch{}return {...t,...u,workspaceEndpoint:i("WORKSPACE_ENDPOINT")??u.workspaceEndpoint??t.workspaceEndpoint,globalEndpoint:i("GLOBAL_ENDPOINT")??u.globalEndpoint??t.globalEndpoint,oidcIssuer:i("OIDC_ISSUER")??u.oidcIssuer,clientId:i("CLIENT_ID")??u.clientId,productOrigin:o("ORIGIN")??u.productOrigin}}function l(u){s(),writeFileSync(r,JSON.stringify(u,null,2),{encoding:"utf8"});try{chmodSync(r,384);}catch{}}function m(u){return a()[u]}function x(u,d){let g=a();g[u]=d,l(g);}function c(){let u=a(),d=u.clientId||e.oidcClientId,g=u.oidcIssuer;if(!g){let p=u.globalEndpoint;p.includes("localhost")||p.includes("127.0.0.1")?g=p.replace(/\/graphql$/,"").replace(/\/global\/graphql$/,"/global"):g=e.oidcIssuerProd??"https://graphql.burdenoff.com/global";}return {oidcIssuer:g,clientId:d}}function f(){let u=a();if(u.productOrigin)return u.productOrigin;if(e.productOrigins)try{let d=new URL(u.workspaceEndpoint).hostname.toLowerCase();return e.productOrigins[d]}catch{return}}return {read:a,write:l,get:m,set:x,path:()=>r,dir:()=>n,resolveOIDC:c,resolveProductOrigin:f}}async function le(e){let n=`${e.oidcIssuer}/oidc/device/code`,r=new URLSearchParams({client_id:e.clientId,scope:"openid profile email offline_access"}),t=await b(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!t.ok){let i=await t.text().catch(()=>"Unknown error");throw new Error(`Device code request failed (${t.status}): ${i}`)}let s=await t.json();return {deviceCode:s.device_code,userCode:s.user_code,verificationUri:s.verification_uri,verificationUriComplete:s.verification_uri_complete??null,expiresIn:s.expires_in,interval:s.interval??5}}async function de(e,n,r){let t=`${r.oidcIssuer}/oauth/device/token`,s=n;for(;;){await new Promise(l=>setTimeout(l,s*1e3));let i=await b(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e,client_id:r.clientId}).toString()}),o=await i.json();if(i.ok&&o.access_token)return {accessToken:o.access_token,refreshToken:o.refresh_token??"",expiresIn:o.expires_in??3600};let a=o.error;switch(a){case "authorization_pending":continue;case "slow_down":s+=5;continue;case "expired_token":throw new Error("Device code has expired. Please try again.");case "access_denied":throw new Error("Authorization was denied by the user.");default:throw new Error(`Device code polling failed: ${o.error_description??a??"Unknown error"}`)}}}async function D(e,n,r,t){let i=await b(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
2
- mutation AuthenticateApp($input: AuthenticateAppInput!) {
3
- authenticateApp(input: $input) {
4
- accessToken tokenType expiresIn scopes
5
- }
6
- }
7
- `,variables:{input:{clientId:n,clientSecret:r,scopes:t}}})});if(!i.ok){let a=await i.text().catch(()=>"Unknown error");throw new Error(`App authentication failed (${i.status}): ${a}`)}let o=await i.json();if(o.errors?.length)throw new Error(`App authentication failed: ${o.errors[0]?.message??"unknown error"}`);if(!o.data?.authenticateApp?.accessToken)throw new Error("App authentication failed: no access token returned");return o.data.authenticateApp}async function L(e,n,r,t){let i=await b(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({query:`
8
- mutation IssueWorkspaceToken($input: IssueWorkspaceTokenInput!) {
9
- issueWorkspaceToken(input: $input) {
10
- success token expiresAt scopes
11
- error { code message }
12
- }
13
- }
14
- `,variables:{input:{workspaceId:r,organizationId:t}}})});if(!i.ok){let l=await i.text().catch(()=>"Unknown error");throw new Error(`Workspace token request failed (${i.status}): ${l}`)}let o=await i.json();if(o.errors?.length)throw new Error(`Workspace token failed: ${o.errors[0]?.message??"unknown error"}`);let a=o.data?.issueWorkspaceToken;if(!a?.success||!a.token){let l=a?.error?.message??"Unknown error";throw new Error(`Workspace token failed: ${l}`)}return {token:a.token,expiresAt:a.expiresAt??"",scopes:a.scopes??[]}}async function ge(e,n){let t=await b(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({query:`
15
- query MyWorkspaces($limit: Int) {
16
- myWorkspaces(limit: $limit) {
17
- items { id name slug tenantId organizationId }
18
- }
19
- }
20
- `,variables:{limit:50}})});if(!t.ok){let i=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${i}`)}let s=await t.json();if(s.errors?.length)throw new Error(`Failed to fetch workspaces: ${s.errors[0]?.message??"unknown error"}`);return s.data?.myWorkspaces?.items??[]}function fe(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function me(e){try{if(!fe(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,s;return r==="darwin"?(t="open",s=[e]):r==="win32"?(t="cmd",s=["/c","start","",e]):(t="xdg-open",s=[e]),new Promise(i=>{n(t,s,o=>{i(!o);});})}catch{return false}}var ke=3e4,we=3,he=1e3;function ye(e){return new Promise(n=>setTimeout(n,e))}function xe(e){if(e instanceof TypeError)return true;if(e&&typeof e=="object"&&"response"in e){let n=e.response;if(n&&typeof n.status=="number"&&n.status>=500)return true}return false}function B(e){if(e&&typeof e=="object"&&"response"in e){let n=e,r=n.response?.errors?.[0],t=r?.extensions?.originalError?.message;if(t)return t;if(r?.message)return r.message;let s=n.response?.status;return typeof s=="number"&&Number.isInteger(s)?`GraphQL request failed (HTTP ${s})`:"GraphQL request failed"}return e instanceof Error?e.message:String(e)}var O=class extends Error{response;constructor(n,r){super(n),this.name="GqlRequestError",this.response=r;}};function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(e){if(!I(e))return;let n={};for(let[r,t]of Object.entries(e))(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")&&(n[r]=t);return n}function J(e){let n=B(e);if(!I(e)||!I(e.response))return new Error(n);let r=e.response,t=typeof r.status=="number"?r.status:void 0,s=Array.isArray(r.errors)?r.errors.flatMap(i=>{if(!I(i)||typeof i.message!="string")return [];let o=Array.isArray(i.path)?i.path.filter(l=>typeof l=="string"||typeof l=="number"):void 0,a=Ce(i.extensions);return [{message:i.message,...o?{path:o}:{},...a?{extensions:a}:{}}]}):void 0;return new O(n,{...t!==void 0?{status:t}:{},...s?{errors:s}:{}})}function A(e){let n={};return e?.accessToken&&(n.Authorization=`Bearer ${e.accessToken}`),e?.organizationId&&(n["x-org-id"]=e.organizationId),n}function _(e,n){let r=A(e);return n&&(r.Origin=n),e?.workspaceToken&&(r["X-Workspace-Authorization"]=`Bearer ${e.workspaceToken}`),e?.organizationId&&(r["x-org-id"]=e.organizationId),r}async function v(e,n,r,t=we){let s;for(let i=0;i<t;i++)try{let o=new AbortController,a=setTimeout(()=>o.abort(),ke);try{return await e.request({document:n,variables:r,signal:o.signal})}finally{clearTimeout(a);}}catch(o){if(s=o,o&&typeof o=="object"&&"response"in o){let a=o.response;if(a&&typeof a.status=="number"&&a.status>=400&&a.status<500)break}if(xe(o)&&i<t-1){let a=he*Math.pow(2,i);await ye(a);continue}break}throw J(s)}function G(e,n){let r=null,t=null;function s(){let c=e.read(),f=n.read();return r=new GraphQLClient(c.workspaceEndpoint),r.setHeaders(_(f,e.resolveProductOrigin())),t=new GraphQLClient(c.globalEndpoint),t.setHeaders(A(f)),{workspace:r,global:t}}async function i(){let c=n.read();if(!c)return;if(c.authMethod==="client_credentials"&&c.clientId&&c.clientSecret){let g=e.read();try{let p=await D(g.globalEndpoint,c.clientId,c.clientSecret);n.write({...c,accessToken:p.accessToken,expiresAt:Date.now()+p.expiresIn*1e3}),r=null,t=null;}catch{}return}if(!c.refreshToken)return;let f=e.read(),u=new GraphQLClient(f.globalEndpoint);u.setHeaders({Authorization:`Bearer ${c.accessToken}`});let d=`
21
- mutation RefreshToken($token: String!) {
22
- refreshToken(token: $token) {
23
- accessToken
24
- refreshToken
25
- expiresIn
26
- }
27
- }
28
- `;try{let p=(await u.request(d,{token:c.refreshToken})).refreshToken;n.write({...c,accessToken:p.accessToken,refreshToken:p.refreshToken,expiresAt:Date.now()+p.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let c=n.read();if(!c?.accessToken||!c.workspaceId||!c.organizationId)return;let f=e.read();try{let u=await L(f.workspaceEndpoint,c.accessToken,c.workspaceId,c.organizationId);n.write({...c,workspaceToken:u.token,workspaceTokenExpiresAt:new Date(u.expiresAt).getTime()}),r=null;}catch{}}async function a(){n.isTokenExpiringSoon()&&await i(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(c,f,u){function d(p){let h=n.read();if(!h?.accessToken||!h.workspaceToken||h.workspaceId!==p.workspaceId||e.read().workspaceEndpoint!==p.endpoint)throw new Error("Workspace or gateway changed before the request.");return h}if(u){let p=d(u.scope);if(p.expiresAt&&Date.now()>=p.expiresAt||p.workspaceTokenExpiresAt&&Date.now()>=p.workspaceTokenExpiresAt)throw new Error("TimeCampus session expired. Sign in again before sending capture.");let h=new GraphQLClient(u.scope.endpoint,{headers:_(p,e.resolveProductOrigin()),redirect:"error"});return v(h,c,f,1)}await a();let{workspace:g}=r?{workspace:r}:s();return g.setHeaders(_(n.read(),e.resolveProductOrigin())),v(g,c,f)}},global:{async request(c,f){let{global:u}=t?{global:t}:s();return u.setHeaders(A(n.read())),v(u,c,f)}},workspaceAuthOnly:{async request(c,f){let u=e.read(),d=n.read(),g=new GraphQLClient(u.workspaceEndpoint),p=A(d),h=e.resolveProductOrigin();return h&&(p.Origin=h),g.setHeaders(p),v(g,c,f)}},reset(){r=null,t=null;}}}function j(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function Y(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return j()?"table":"json"}function N(e){console.log(JSON.stringify(e,null,2));}function Q(e,n){if(e.length===0)return;let r=e.map((i,o)=>{let a=i.length;for(let l of n){let m=l[o]??"";m.length>a&&(a=m.length);}return Math.min(a,50)}),t=r.map(i=>"-".repeat(i+2)).join("+"),s=i=>i.map((o,a)=>` ${(o??"").padEnd(r[a]??0)} `).join("|");console.log(s(e)),console.log(t);for(let i of n)console.log(s(i));}function W(e,n){let r=" ".repeat(n),t=[];for(let[s,i]of Object.entries(e))if(i==null)t.push(`${r}${s}: null`);else if(Array.isArray(i)){t.push(`${r}${s}:`);for(let o of i)typeof o=="object"&&o!==null?(t.push(`${r} -`),t.push(W(o,n+2))):t.push(`${r} - ${String(o)}`);}else typeof i=="object"?(t.push(`${r}${s}:`),t.push(W(i,n+1))):t.push(`${r}${s}: ${String(i)}`);return t.join(`
29
- `)}function K(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(W(e,0));}function be(e){process.stdout.write(e.endsWith(`
30
- `)?e:`${e}
31
- `);}function Ee(e){console.log(`\u2713 ${e}`);}function X(e){console.error(`\u2717 ${e}`);}function Te(e){console.warn(`! ${e}`);}function ve(e){console.log(`\u2139 ${e}`);}function Ie(e){if(!e)return "-";try{return new Date(e).toLocaleString()}catch{return e}}function Ae(e){if(!e)return "-";switch(e.toUpperCase()){case "ACTIVE":case "RUNNING":case "HEALTHY":return `\u2713 ${e}`;case "INACTIVE":case "STOPPED":case "PENDING":return `\u25CB ${e}`;case "ERROR":return `\u2717 ${e}`;case "ARCHIVED":return `\u2192 ${e}`;case "STARTING":return `\u25B6 ${e}`;case "TERMINATED":return `\u25A0 ${e}`;default:return e}}function Oe(e,n){return e?e.length<=n?e:e.substring(0,n-3)+"...":"-"}function Se(e,n,r){switch(Y(e)){case "json":N(n);break;case "yaml":K(n);break;case "table":r?Q(r.headers,r.rows):N(n);break}}async function Re(e,n){return n?true:j()?new Promise(r=>{process.stdout.write(`${e} [y/N] `),process.stdin.setEncoding("utf8"),process.stdin.once("data",t=>{let s=t.trim().toLowerCase();r(s==="y"||s==="yes");}),process.stdin.resume();}):(X(`${e} Use --force to skip confirmation.`),false)}var F={isInteractive:j,getFormat:Y,formatAndOutput:Se,printJson:N,printTable:Q,printYaml:K,printRaw:be,printSuccess:Ee,printError:X,printWarning:Te,printInfo:ve,formatDate:Ie,formatStatus:Ae,truncate:Oe,confirm:Re};function M(e={}){let{verbose:n=false,quiet:r=false}=e;return {debug(t,...s){n&&console.error(`[debug] ${t}`,...s);},info(t,...s){r||console.error(`[info] ${t}`,...s);},warn(t,...s){console.error(`[warn] ${t}`,...s);},error(t,...s){console.error(`[error] ${t}`,...s);}}}function qe(e){return e.includes("localhost")||e.includes("127.0.0.1")?"local":e.includes("alpha")||e.includes("staging")?"staging":"prod"}function $e(e){return !!e&&typeof e.debug=="function"&&typeof e.info=="function"}function Pe(e){let n=P(e.defaults),r=$(n.dir()),t=G(n,r),s=e.output??F,i=$e(e.logger)?e.logger:M(e.logger),o=e.env??qe(n.read().workspaceEndpoint);return {productName:e.productName,productVersion:e.productVersion,defaults:e.defaults,config:n,auth:r,gql:t,output:s,logger:i,env:o}}var C=class extends Error{exitCode;hint;constructor(n,r){super(n),this.name="CliUserError",this.exitCode=r?.exitCode??1,this.hint=r?.hint;}},T=class extends C{constructor(n,r){super(n,{exitCode:2,hint:r?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},y=class extends Error{cause;constructor(n,r){super(n),this.name="CliInternalError",this.cause=r;}};var S=class extends y{constructor(n,r){super(`Module '${n}' declares dependency on '${r}', but '${r}' is not in the module list.`),this.name="MissingDependencyError";}},R=class extends y{constructor(n){super(`Circular dependency detected among modules: ${n.join(" -> ")}`),this.name="CircularDependencyError";}};function U(e){let n=new Map;for(let o of e){if(n.has(o.id))throw new y(`Duplicate module id: '${o.id}'`);n.set(o.id,o);}for(let o of e)for(let a of o.dependsOn??[])if(!n.has(a))throw new S(o.id,a);let r=[],t=new Set,s=new Set;function i(o,a){if(!s.has(o.id)){if(t.has(o.id))throw new R([...a,o.id]);t.add(o.id);for(let l of o.dependsOn??[]){let m=n.get(l);m&&i(m,[...a,o.id]);}t.delete(o.id),s.add(o.id),r.push(o);}}for(let o of e)i(o,[]);return r}function Le(e,n,r){let t=new Command;t.name(r.name).description(r.description??"").version(r.version,"-v, --version").option("-f, --format <format>","Output format (json, table, yaml)").option("--verbose","Enable verbose logging").option("--no-color","Disable colored output"),t.hook("preAction",(o,a)=>{let l=t.opts().format;if(typeof l!="string")return;a.options.some(x=>x.attributeName()==="format")&&a.getOptionValue("format")===void 0&&a.setOptionValue("format",l);});let s=U(n);for(let o of s)o.register(t,e);r.helpExamples?.length&&t.addHelpText("after",`
32
- Examples:
33
- `+r.helpExamples.map(o=>" "+o).join(`
34
- `)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function i(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(a){_e(e,a);}}return {program:t,run:i}}function _e(e,n){if(n instanceof T&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof C&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof y&&(e.output.printError(`Internal error: ${n.message}`),n.cause&&e.logger.debug("caused by:",n.cause),process.exit(70)),n&&typeof n=="object"&&"code"in n&&"exitCode"in n){let t=n.exitCode;process.exit(typeof t=="number"?t:0);}let r=n instanceof Error?n.message:String(n);e.output.printError(r),process.exit(1);}export{$ as a,pe as b,P as c,le as d,de as e,D as f,L as g,ge as h,me as i,B as j,O as k,J as l,G as m,F as n,M as o,Pe as p,C as q,T as r,y as s,S as t,R as u,U as v,Le as w};