@burdenoff/cli-sdk 2026.1021.2 → 2026.1031.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/auth/index.cjs +43 -21
- package/dist/modules/auth/index.js +48 -26
- package/dist/modules/channels/index.cjs +12 -13
- package/dist/modules/channels/index.js +11 -12
- package/dist/modules/conversations/index.cjs +1 -1
- package/dist/modules/conversations/index.js +4 -4
- package/dist/modules/groups/index.cjs +16 -15
- package/dist/modules/groups/index.js +15 -14
- package/dist/modules/products/index.cjs +1 -1
- package/dist/modules/products/index.js +4 -4
- package/dist/modules/rbac/index.cjs +8 -19
- package/dist/modules/rbac/index.js +6 -17
- package/dist/modules/workspaces/index.cjs +8 -8
- package/dist/modules/workspaces/index.js +12 -12
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var u=class extends Error{exitCode;hint;constructor(r,a){super(r),this.name="CliUserError",this.exitCode=a?.exitCode??1,this.hint=a?.hint;}},w=class extends u{constructor(r,a){super(r,{exitCode:2,hint:a?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},g=class extends Error{cause;constructor(r,a){super(r),this.name="CliInternalError",this.cause=a;}};var C=null;function T(n){C=n;}function p(){if(!C)throw new g("vibecontrols module helpers used before setHelpersContext was called");return C}function Y(){let n=p();if(!n.auth.isAuthenticated())throw new w("Authentication required.",{hint:`Run \`${n.productName} auth login\` to authenticate.`})}async function E(n,r){return Y(),p().gql.workspace.request(n,r)}async function v(n,r){return p().gql.global.request(n,r)}function l(n){let r=n instanceof Error?n.message:String(n);throw new u(r)}function f(n,r,a){p().output.formatAndOutput(n,r,a);}function k(n){p().output.printSuccess(n);}function R(n){return p().output.formatStatus(n)}function h(n,r){return p().output.truncate(n,r)}function A(){return p()}var S=`
|
|
2
2
|
query ListRoles($filter: RoleFilterInput, $pagination: PaginationInput, $scopeId: String!) {
|
|
3
3
|
roles(filter: $filter, pagination: $pagination, scopeId: $scopeId) {
|
|
4
4
|
id
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,
|
|
16
|
+
`,O=`
|
|
17
17
|
query GetRole($id: ID!) {
|
|
18
18
|
role(id: $id) {
|
|
19
19
|
id
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
`,
|
|
31
|
+
`,P=`
|
|
32
32
|
mutation CreateRole($input: CreateRoleInput!) {
|
|
33
33
|
createRole(input: $input) {
|
|
34
34
|
id
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
scopeId
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
`,L=`
|
|
41
41
|
mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {
|
|
42
42
|
updateRole(id: $id, input: $input) {
|
|
43
43
|
id
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
priority
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
`,$=`
|
|
50
50
|
mutation DeleteRole($id: ID!, $reassignToRoleId: ID) {
|
|
51
51
|
deleteRole(id: $id, reassignToRoleId: $reassignToRoleId)
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,D=`
|
|
54
54
|
query PolicyReferences($filter: PolicyReferenceFilterInput, $pagination: PaginationInput) {
|
|
55
55
|
policyReferences(filter: $filter, pagination: $pagination) {
|
|
56
56
|
id
|
|
@@ -63,18 +63,7 @@
|
|
|
63
63
|
priority
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
67
|
-
mutation AttachPolicyToRole($roleId: ID!, $policyId: ID!) {
|
|
68
|
-
attachPolicyToRole(roleId: $roleId, policyId: $policyId) {
|
|
69
|
-
id
|
|
70
|
-
name
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`,N=`
|
|
74
|
-
mutation DetachPolicyFromRole($roleId: ID!, $policyId: ID!) {
|
|
75
|
-
detachPolicyFromRole(roleId: $roleId, policyId: $policyId)
|
|
76
|
-
}
|
|
77
|
-
`,F=`
|
|
66
|
+
`,q=`
|
|
78
67
|
query CheckPermission($input: PermissionCheckInput!) {
|
|
79
68
|
checkPermission(input: $input) {
|
|
80
69
|
allowed
|
|
@@ -84,4 +73,4 @@
|
|
|
84
73
|
overrideType
|
|
85
74
|
}
|
|
86
75
|
}
|
|
87
|
-
`;function
|
|
76
|
+
`;function m(n,r,a){return n==="workspace"?E(r,a):v(r,a)}function x(n){let r=A().auth.read();if(n==="workspace"){if(!r?.workspaceId)throw new u("No workspace set. Run `vibecontrols workspace set <id>` or pass --scope <workspaceId>.");return r.workspaceId}if(!r?.organizationId)throw new u("No organization context. Run `auth login` to bind a tenant or pass --scope <tenantId>.");return r.organizationId}function _(n){let r=n.command("rbac").description("Role-based access control"),a=r.command("roles").description("Manage roles");a.command("list").description("List roles").option("--layer <layer>","workspace or global","workspace").option("--scope <scopeId>","Override scope id (workspace or tenant)").option("--include-system","Include system roles",false).option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>","Output format").action(async e=>{try{let t=e.layer==="global"?"global":"workspace",i=e.scope??x(t),o={};e.includeSystem&&(o.includeSystem=!0);let s=await m(t,S,{filter:Object.keys(o).length?o:void 0,pagination:{limit:e.limit,offset:0},scopeId:i});f(e,s.roles,{headers:["ID","Name","Scope","Priority","System"],rows:s.roles.map(d=>[h(d.id,12),d.name,h(d.scopeId,12),String(d.priority),String(d.isSystem)])});}catch(t){l(t);}}),a.command("get").description("Get role by id").argument("<id>").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,t)=>{try{let i=t.layer==="global"?"global":"workspace",o=await m(i,O,{id:e});if(!o.role)throw new u(`Role ${e} not found`);f(t,o.role);}catch(i){l(i);}}),a.command("create").description("Create a role").requiredOption("--name <name>","Role name").option("--description <text>").option("--parent <id>","Parent role id").option("--priority <n>","Priority",e=>parseInt(e,10)).option("--layer <layer>","workspace or global","workspace").option("--scope <scopeId>","Override scope id").option("--scope-type <type>","wspace|entity (global only)").option("-f, --format <format>").action(async e=>{try{let t=e.layer==="global"?"global":"workspace",i=e.scope??x(t),o={name:e.name,description:e.description,parentId:e.parent,priority:e.priority,scopeId:i};t==="global"&&e.scopeType&&(o.scopeType=e.scopeType);let s=await m(t,P,{input:o});k(`Role created: ${s.createRole.name}`),f(e,s.createRole);}catch(t){l(t);}}),a.command("update").description("Update a role").argument("<id>").option("--name <name>").option("--description <text>").option("--priority <n>","",e=>parseInt(e,10)).option("--parent <id>").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,t)=>{try{let i=t.layer==="global"?"global":"workspace",o={};if(t.name&&(o.name=t.name),t.description!==void 0&&(o.description=t.description),t.priority!==void 0&&(o.priority=t.priority),t.parent&&(o.parentId=t.parent),!Object.keys(o).length)throw new u("No updates specified");let s=await m(i,L,{id:e,input:o});k("Role updated"),f(t,s.updateRole);}catch(i){l(i);}}),a.command("delete").description("Delete a role").argument("<id>").option("--reassign <roleId>","Reassign actors to this role").option("--layer <layer>","workspace or global","workspace").action(async(e,t)=>{try{let i=t.layer==="global"?"global":"workspace";await m(i,$,{id:e,reassignToRoleId:t.reassign}),k("Role deleted");}catch(i){l(i);}}),r.command("policies").description("Manage policy references").command("list").description("List policy references").option("--layer <layer>","workspace or global","workspace").option("--resource-type <s>","Filter by resource type").option("--action <s>","Filter by action").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let t=e.layer==="global"?"global":"workspace",i={};e.resourceType&&(i.resourceType=e.resourceType),e.action&&(i.action=e.action);let o=await m(t,D,{filter:Object.keys(i).length?i:void 0,pagination:{limit:e.limit,offset:0}});f(e,o.policyReferences,{headers:["ID","Name","Resource","Action","Active","Priority"],rows:o.policyReferences.map(s=>[h(s.id,12),s.name,s.resourceType??"-",s.action??"-",String(s.isActive),String(s.priority??"-")])});}catch(t){l(t);}}),r.command("check").description("Check whether an actor has permission for an action on a resource").argument("<actorId>","Actor id (user/app/service/super_admin)").argument("<action>","Action like read/write/delete").argument("<resourceType>","Resource type like project/task").option("--actor-type <type>","USER|BOT|GROUP|INTEGRATION|DELEGATED_AGENT","USER").option("--resource-id <id>","Specific resource id (optional)").option("--scope <scopeId>","Scope id (workspaceId or tenantId)").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,t,i,o)=>{try{let s=o.layer==="global"?"global":"workspace",d=o.scope??x(s),N={actorId:e,actorType:(o.actorType??"USER").toUpperCase(),action:t,resourceType:i,resourceId:o.resourceId,scopeId:d},y=await m(s,q,{input:N});f(o,y.checkPermission,{headers:["Allowed","Decision","Role","Level","Override"],rows:[[R(y.checkPermission.allowed?"ACTIVE":"ERROR"),y.checkPermission.decisionPath,y.checkPermission.roleName??"-",y.checkPermission.roleLevel??"-",y.checkPermission.overrideType??"-"]]});}catch(s){l(s);}});}var Q={id:"rbac",version:"1.0.0",displayName:"RBAC",dependsOn:["auth"],register(n,r){T(r),_(n);}},ct=Q;module.exports=ct;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,h,p,g,i,n,s
|
|
1
|
+
import {a,h as h$1,p,g,i,n,s,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'../../chunk-UAFYTYK6.js';var h=`
|
|
2
2
|
query ListRoles($filter: RoleFilterInput, $pagination: PaginationInput, $scopeId: String!) {
|
|
3
3
|
roles(filter: $filter, pagination: $pagination, scopeId: $scopeId) {
|
|
4
4
|
id
|
|
@@ -13,7 +13,7 @@ import {a,h,p,g,i,n,s as s$1,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'..
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,
|
|
16
|
+
`,L=`
|
|
17
17
|
query GetRole($id: ID!) {
|
|
18
18
|
role(id: $id) {
|
|
19
19
|
id
|
|
@@ -37,7 +37,7 @@ import {a,h,p,g,i,n,s as s$1,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'..
|
|
|
37
37
|
scopeId
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
`,
|
|
40
|
+
`,P=`
|
|
41
41
|
mutation UpdateRole($id: ID!, $input: UpdateRoleInput!) {
|
|
42
42
|
updateRole(id: $id, input: $input) {
|
|
43
43
|
id
|
|
@@ -50,7 +50,7 @@ import {a,h,p,g,i,n,s as s$1,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'..
|
|
|
50
50
|
mutation DeleteRole($id: ID!, $reassignToRoleId: ID) {
|
|
51
51
|
deleteRole(id: $id, reassignToRoleId: $reassignToRoleId)
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
`,O=`
|
|
54
54
|
query PolicyReferences($filter: PolicyReferenceFilterInput, $pagination: PaginationInput) {
|
|
55
55
|
policyReferences(filter: $filter, pagination: $pagination) {
|
|
56
56
|
id
|
|
@@ -63,18 +63,7 @@ import {a,h,p,g,i,n,s as s$1,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'..
|
|
|
63
63
|
priority
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
mutation AttachPolicyToRole($roleId: ID!, $policyId: ID!) {
|
|
68
|
-
attachPolicyToRole(roleId: $roleId, policyId: $policyId) {
|
|
69
|
-
id
|
|
70
|
-
name
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`,x=`
|
|
74
|
-
mutation DetachPolicyFromRole($roleId: ID!, $policyId: ID!) {
|
|
75
|
-
detachPolicyFromRole(roleId: $roleId, policyId: $policyId)
|
|
76
|
-
}
|
|
77
|
-
`,D=`
|
|
66
|
+
`,$=`
|
|
78
67
|
query CheckPermission($input: PermissionCheckInput!) {
|
|
79
68
|
checkPermission(input: $input) {
|
|
80
69
|
allowed
|
|
@@ -84,4 +73,4 @@ import {a,h,p,g,i,n,s as s$1,b,c}from'../../chunk-SQSFZFQZ.js';import {o}from'..
|
|
|
84
73
|
overrideType
|
|
85
74
|
}
|
|
86
75
|
}
|
|
87
|
-
`;function
|
|
76
|
+
`;function d(c$1,n,a){return c$1==="workspace"?b(n,a):c(n,a)}function f(c){let n=s().auth.read();if(c==="workspace"){if(!n?.workspaceId)throw new o("No workspace set. Run `vibecontrols workspace set <id>` or pass --scope <workspaceId>.");return n.workspaceId}if(!n?.organizationId)throw new o("No organization context. Run `auth login` to bind a tenant or pass --scope <tenantId>.");return n.organizationId}function v(c){let n$1=c.command("rbac").description("Role-based access control"),a=n$1.command("roles").description("Manage roles");a.command("list").description("List roles").option("--layer <layer>","workspace or global","workspace").option("--scope <scopeId>","Override scope id (workspace or tenant)").option("--include-system","Include system roles",false).option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>","Output format").action(async e=>{try{let o=e.layer==="global"?"global":"workspace",t=e.scope??f(o),r={};e.includeSystem&&(r.includeSystem=!0);let i=await d(o,h,{filter:Object.keys(r).length?r:void 0,pagination:{limit:e.limit,offset:0},scopeId:t});h$1(e,i.roles,{headers:["ID","Name","Scope","Priority","System"],rows:i.roles.map(p$1=>[p(p$1.id,12),p$1.name,p(p$1.scopeId,12),String(p$1.priority),String(p$1.isSystem)])});}catch(o){g(o);}}),a.command("get").description("Get role by id").argument("<id>").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,o$1)=>{try{let t=o$1.layer==="global"?"global":"workspace",r=await d(t,L,{id:e});if(!r.role)throw new o(`Role ${e} not found`);h$1(o$1,r.role);}catch(t){g(t);}}),a.command("create").description("Create a role").requiredOption("--name <name>","Role name").option("--description <text>").option("--parent <id>","Parent role id").option("--priority <n>","Priority",e=>parseInt(e,10)).option("--layer <layer>","workspace or global","workspace").option("--scope <scopeId>","Override scope id").option("--scope-type <type>","wspace|entity (global only)").option("-f, --format <format>").action(async e=>{try{let o=e.layer==="global"?"global":"workspace",t=e.scope??f(o),r={name:e.name,description:e.description,parentId:e.parent,priority:e.priority,scopeId:t};o==="global"&&e.scopeType&&(r.scopeType=e.scopeType);let i$1=await d(o,C,{input:r});i(`Role created: ${i$1.createRole.name}`),h$1(e,i$1.createRole);}catch(o){g(o);}}),a.command("update").description("Update a role").argument("<id>").option("--name <name>").option("--description <text>").option("--priority <n>","",e=>parseInt(e,10)).option("--parent <id>").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,o$1)=>{try{let t=o$1.layer==="global"?"global":"workspace",r={};if(o$1.name&&(r.name=o$1.name),o$1.description!==void 0&&(r.description=o$1.description),o$1.priority!==void 0&&(r.priority=o$1.priority),o$1.parent&&(r.parentId=o$1.parent),!Object.keys(r).length)throw new o("No updates specified");let i$1=await d(t,P,{id:e,input:r});i("Role updated"),h$1(o$1,i$1.updateRole);}catch(t){g(t);}}),a.command("delete").description("Delete a role").argument("<id>").option("--reassign <roleId>","Reassign actors to this role").option("--layer <layer>","workspace or global","workspace").action(async(e,o)=>{try{let t=o.layer==="global"?"global":"workspace";await d(t,S,{id:e,reassignToRoleId:o.reassign}),i("Role deleted");}catch(t){g(t);}}),n$1.command("policies").description("Manage policy references").command("list").description("List policy references").option("--layer <layer>","workspace or global","workspace").option("--resource-type <s>","Filter by resource type").option("--action <s>","Filter by action").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let o=e.layer==="global"?"global":"workspace",t={};e.resourceType&&(t.resourceType=e.resourceType),e.action&&(t.action=e.action);let r=await d(o,O,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});h$1(e,r.policyReferences,{headers:["ID","Name","Resource","Action","Active","Priority"],rows:r.policyReferences.map(i=>[p(i.id,12),i.name,i.resourceType??"-",i.action??"-",String(i.isActive),String(i.priority??"-")])});}catch(o){g(o);}}),n$1.command("check").description("Check whether an actor has permission for an action on a resource").argument("<actorId>","Actor id (user/app/service/super_admin)").argument("<action>","Action like read/write/delete").argument("<resourceType>","Resource type like project/task").option("--actor-type <type>","USER|BOT|GROUP|INTEGRATION|DELEGATED_AGENT","USER").option("--resource-id <id>","Specific resource id (optional)").option("--scope <scopeId>","Scope id (workspaceId or tenantId)").option("--layer <layer>","workspace or global","workspace").option("-f, --format <format>").action(async(e,o,t,r)=>{try{let i=r.layer==="global"?"global":"workspace",p=r.scope??f(i),x={actorId:e,actorType:(r.actorType??"USER").toUpperCase(),action:o,resourceType:t,resourceId:r.resourceId,scopeId:p},m=await d(i,$,{input:x});h$1(r,m.checkPermission,{headers:["Allowed","Decision","Role","Level","Override"],rows:[[n(m.checkPermission.allowed?"ACTIVE":"ERROR"),m.checkPermission.decisionPath,m.checkPermission.roleName??"-",m.checkPermission.roleLevel??"-",m.checkPermission.overrideType??"-"]]});}catch(i){g(i);}});}var _={id:"rbac",version:"1.0.0",displayName:"RBAC",dependsOn:["auth"],register(c,n){a(n),v(c);}},q=_;export{q as default};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict';require('graphql-request');var W=require('cross-fetch');require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var W__default=/*#__PURE__*/_interopDefault(W);async function h(
|
|
1
|
+
'use strict';require('graphql-request');var W=require('cross-fetch');require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var W__default=/*#__PURE__*/_interopDefault(W);async function h(n,i,o,s){let t=await W__default.default(n,{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:
|
|
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 W__default.default(n,{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(!
|
|
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 D(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 I(n){d().output.printInfo(n);}function E(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 b(){return d()}function T(){return d().auth.read()}function S(n){d().auth.write(n);}function P(){return d().config.read()}function _(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){I(`No workspace set. Run: ${b().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: ${b().productName} auth login`);let e=P(),t;I("Looking up workspace details...");try{let a=(await C(e.globalEndpoint,s.accessToken)).find(w=>w.id===o);a?t=a.organizationId:(E("Workspace not in your accessible list \u2014 using stored organization id as fallback"),t=s.organizationId);}catch{E("Could not fetch workspace details \u2014 using stored organization id"),t=s.organizationId;}if(s.accessToken&&t){I("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){E(`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: ${b().productName} auth login`);let e=P(),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 q=`
|
|
15
15
|
query GetWorkspace($id: ID!) {
|
|
16
16
|
workspace(id: $id) {
|
|
17
|
-
id name slug
|
|
17
|
+
id name slug type tenantId organizationId region status memberCount createdAt updatedAt
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
`,L=`
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
`,M=`
|
|
27
27
|
mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
|
|
28
28
|
updateWorkspace(id: $id, input: $input) {
|
|
29
|
-
id name
|
|
29
|
+
id name slug status updatedAt
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
`,j=`
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
id status workspaceId
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
`,
|
|
84
|
+
`,J=`
|
|
85
85
|
query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
|
|
86
86
|
getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
|
|
87
|
-
id action
|
|
87
|
+
id action userId actorType resourceType resourceId description timestamp
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`;function
|
|
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(q,{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(F,{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(U,{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(z,{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(G,{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(K,{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(V,{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(B,{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){D(i),_(n);let o=n.commands.find(s=>s.name()==="workspace");if(!o)throw new m("workspace command group missing after registerWorkspaceCommands");H(o);}},Rt=ue;module.exports=Rt;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {a,t,k,s,h,w,l,u,f,i,g as g$1,c,b
|
|
1
|
+
import {a,t,k,s,h,w,l,u,f,i,g as g$1,c,b,p,n,o as o$1}from'../../chunk-SQSFZFQZ.js';import {q as q$1,o,h as h$1,g}from'../../chunk-UAFYTYK6.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=t(),t$1=r?.workspaceId??null;if(!t$1){k(`No workspace set. Run: ${s().productName} workspace set <id>`);return}h(a,{workspaceId:t$1,organizationId:r?.organizationId??"-",hasWorkspaceToken:!!r?.workspaceToken},{headers:["Key","Value"],rows:[["Workspace ID",t$1],["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=t();if(!r?.accessToken)throw new o(`Not authenticated. Run: ${s().productName} auth login`);let t$1=w(),e;k("Looking up workspace details...");try{let m=(await h$1(t$1.globalEndpoint,r.accessToken)).find(J=>J.id===a);m?e=m.organizationId:(l("Workspace not in your accessible list \u2014 using stored organization id as fallback"),e=r.organizationId);}catch{l("Could not fetch workspace details \u2014 using stored organization id"),e=r.organizationId;}if(r.accessToken&&e){k("Issuing workspace token...");try{let o=await g(t$1.workspaceEndpoint,r.accessToken,a,e);u({...r,workspaceId:a,organizationId:e,workspaceToken:o.token,workspaceTokenExpiresAt:new Date(o.expiresAt).getTime()}),f(),i(`Workspace set to: ${a} (token issued)`);return}catch(o){l(`Workspace token failed: ${o instanceof Error?o.message:String(o)}`);}}u({...r,workspaceId:a,organizationId:e}),f(),i(`Workspace set to: ${a}`);}catch(r){g$1(r);}}),c.command("list").description("List available workspaces").option("-f, --format <format>","Output format").action(async a=>{try{let r=t();if(!r?.accessToken)throw new o(`Not authenticated. Run: ${s().productName} auth login`);let t$1=w(),e=await h$1(t$1.globalEndpoint,r.accessToken);h(a,e,{headers:["ID","Name","Slug","Organization ID"],rows:e.map(o=>[o.id,o.name,o.slug,o.organizationId])});}catch(r){g$1(r);}});}var $=`
|
|
2
2
|
query GetWorkspace($id: ID!) {
|
|
3
3
|
workspace(id: $id) {
|
|
4
|
-
id name slug
|
|
4
|
+
id name slug type tenantId organizationId region status memberCount createdAt updatedAt
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
`,S=`
|
|
@@ -10,13 +10,13 @@ import {a,t,k,s,h,w,l,u,f,i,g as g$1,c,b as b$1,p,n,o as o$1}from'../../chunk-SQ
|
|
|
10
10
|
id name slug status createdAt
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,
|
|
13
|
+
`,j=`
|
|
14
14
|
mutation UpdateWorkspace($id: ID!, $input: UpdateWorkspaceInput!) {
|
|
15
15
|
updateWorkspace(id: $id, input: $input) {
|
|
16
|
-
id name
|
|
16
|
+
id name slug status updatedAt
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,_=`
|
|
20
20
|
mutation DeleteWorkspace($id: ID!) {
|
|
21
21
|
deleteWorkspace(id: $id)
|
|
22
22
|
}
|
|
@@ -43,35 +43,35 @@ import {a,t,k,s,h,w,l,u,f,i,g as g$1,c,b as b$1,p,n,o as o$1}from'../../chunk-SQ
|
|
|
43
43
|
id userId role
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
`,
|
|
46
|
+
`,N=`
|
|
47
47
|
query ListProjects($filter: ProjectFilterInput, $pagination: PaginationInput) {
|
|
48
48
|
projects(filter: $filter, pagination: $pagination) {
|
|
49
49
|
items { id name workspaceId status createdAt }
|
|
50
50
|
total hasMore
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,K=`
|
|
54
54
|
query GetProject($id: ID!) {
|
|
55
55
|
project(id: $id) {
|
|
56
56
|
id name description workspaceId status createdAt updatedAt
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
`,
|
|
59
|
+
`,L=`
|
|
60
60
|
mutation CreateProject($input: CreateProjectInput!) {
|
|
61
61
|
createProject(input: $input) {
|
|
62
62
|
id name workspaceId status
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
65
|
+
`,q=`
|
|
66
66
|
mutation AcceptInvitation($id: ID!) {
|
|
67
67
|
acceptInvitation(id: $id) {
|
|
68
68
|
id status workspaceId
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`,
|
|
71
|
+
`,U=`
|
|
72
72
|
query WorkspaceActivity($workspaceId: ID!, $limit: Int, $offset: Int) {
|
|
73
73
|
getWorkspaceActivities(workspaceId: $workspaceId, limit: $limit, offset: $offset) {
|
|
74
|
-
id action
|
|
74
|
+
id action userId actorType resourceType resourceId description timestamp
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
`;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$1=await c($,{id:t});if(!o$1.workspace)throw new o(`Workspace ${t} not found`);h(e,o$1.workspace);}catch(o){g$1(o);}}),i$1.command("create").description("Create a workspace (global layer)").requiredOption("--name <name>").
|
|
77
|
+
`;function G(i,c){let a;try{a=JSON.parse(c);}catch{throw new o(`${i} must be valid JSON`)}if(!a||typeof a!="object"||Array.isArray(a))throw new o(`${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$1=await c($,{id:t});if(!o$1.workspace)throw new o(`Workspace ${t} not found`);h(e,o$1.workspace);}catch(o){g$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});i(`Workspace created: ${o.createWorkspace.name}`),h(t,o.createWorkspace);}catch(e){g$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$1={};if(e.name&&(o$1.name=e.name),e.metadata!==void 0&&(o$1.metadata=G("--metadata",e.metadata)),!Object.keys(o$1).length)throw new o("No updates specified");let m=await c(j,{id:t,input:o$1});i("Workspace updated"),h(e,m.updateWorkspace);}catch(o){g$1(o);}}),i$1.command("delete").description("Delete a workspace (workspace layer)").argument("<id>").action(async t=>{try{await b(_,{id:t}),i("Workspace deleted");}catch(e){g$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}});h(t,e.workspaceMembers.items,{headers:["ID","UserID","Role","Status","Joined"],rows:e.workspaceMembers.items.map(o=>[p(o.id,12),p(o.userId,12),o.role??"-",n(o.status),o$1(o.createdAt)])});}catch(e){g$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});i("Member added"),h(t,o.addWorkspaceMember);}catch(e){g$1(e);}}),c$1.command("remove").description("Remove a member by membership id").argument("<membershipId>").action(async t=>{try{await b(v,{id:t}),i("Member removed");}catch(e){g$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}),i("Member role updated");}catch(e){g$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}});h(t,o.projects.items,{headers:["ID","Name","Workspace","Status","Created"],rows:o.projects.items.map(m=>[p(m.id,12),m.name,p(m.workspaceId,12),n(m.status),o$1(m.createdAt)])});}catch(e){g$1(e);}}),a.command("get").description("Get a project").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o$1=await b(K,{id:t});if(!o$1.project)throw new o(`Project ${t} not found`);h(e,o$1.project);}catch(o){g$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});i("Project created"),h(t,o.createProject);}catch(e){g$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}),i("Invitation accepted");}catch(e){g$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});h(t,e.getWorkspaceActivities);}catch(e){g$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 q$1("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.
|
|
3
|
+
"version": "2026.1031.2",
|
|
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",
|