@burdenoff/cli-sdk 2026.525.1 → 2026.525.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/chunk-REBBLQFS.js +1551 -0
- package/dist/modules/auth/index.cjs +34 -34
- package/dist/modules/auth/index.js +1 -1
- package/dist/modules/conversations/index.cjs +125 -7
- package/dist/modules/conversations/index.js +124 -6
- package/dist/modules/export/index.cjs +63 -5
- package/dist/modules/export/index.js +63 -5
- package/dist/modules/integrations/index.cjs +92 -8
- package/dist/modules/integrations/index.js +92 -8
- package/dist/modules/sandbox/index.cjs +154 -13
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +116 -6
- package/dist/modules/scheduler/index.js +116 -6
- package/dist/modules/vibecontrols/index.cjs +871 -336
- package/dist/modules/vibecontrols/index.js +6 -2
- package/package.json +1 -1
- package/dist/chunk-MRONTCXQ.js +0 -879
|
@@ -1,44 +1,128 @@
|
|
|
1
|
-
import {a,b,g,o,f,m,h
|
|
1
|
+
import {a,b as b$1,g,o,f,m,h,n}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';var E=`
|
|
2
2
|
query GetProviders($filter: ProviderFilterInput, $pagination: IntegrationsPaginationInput) {
|
|
3
3
|
getProviders(filter: $filter, pagination: $pagination) {
|
|
4
4
|
items { id key name category authType isEnabled }
|
|
5
5
|
total hasMore
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,O=`
|
|
9
9
|
query GetProvider($id: ID!) {
|
|
10
10
|
getProvider(id: $id) {
|
|
11
11
|
id key name authType category connectionCount
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`,
|
|
14
|
+
`,N=`
|
|
15
15
|
query GetConnections($filter: ConnectionFilterInput, $pagination: IntegrationsPaginationInput) {
|
|
16
16
|
getConnections(filter: $filter, pagination: $pagination) {
|
|
17
17
|
items { id name providerId status grantedScopes }
|
|
18
18
|
total hasMore
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
21
|
+
`,A=`
|
|
22
22
|
query GetConnection($id: ID!) {
|
|
23
23
|
getConnection(id: $id) {
|
|
24
24
|
id name providerId status externalAccountEmail credentialSource
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
`,
|
|
27
|
+
`,v=`
|
|
28
28
|
mutation CreateConnection($input: CreateConnectionInput!) {
|
|
29
29
|
createConnection(input: $input) {
|
|
30
30
|
id name status providerId
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,R=`
|
|
34
34
|
mutation DeleteConnection($id: ID!, $deleteVaultSecret: Boolean) {
|
|
35
35
|
deleteConnection(id: $id, deleteVaultSecret: $deleteVaultSecret)
|
|
36
36
|
}
|
|
37
|
-
`,
|
|
37
|
+
`,w=`
|
|
38
38
|
query GetIntegrationLogs($filter: LogFilterInput, $pagination: IntegrationsPaginationInput) {
|
|
39
39
|
getIntegrationLogs(filter: $filter, pagination: $pagination) {
|
|
40
40
|
items { id action level message createdAt }
|
|
41
41
|
total hasMore
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
`,_=`
|
|
45
|
+
mutation UpdateConnection($id: ID!, $input: UpdateConnectionInput!) {
|
|
46
|
+
updateConnection(id: $id, input: $input) { id name status }
|
|
47
|
+
}
|
|
48
|
+
`,P=`
|
|
49
|
+
mutation RevokeConnection($connectionId: ID!) {
|
|
50
|
+
revokeConnection(connectionId: $connectionId) { id name status }
|
|
51
|
+
}
|
|
52
|
+
`,$=`
|
|
53
|
+
mutation TestConnection($connectionId: ID!) {
|
|
54
|
+
testConnection(connectionId: $connectionId) { success message latencyMs }
|
|
55
|
+
}
|
|
56
|
+
`,k=`
|
|
57
|
+
mutation LinkIntegrationToChannel($channelId: String!, $connectionId: ID!, $organizationId: String!) {
|
|
58
|
+
linkIntegrationToChannel(channelId: $channelId, connectionId: $connectionId, organizationId: $organizationId) {
|
|
59
|
+
id name status channelId organizationId
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`,b=`
|
|
63
|
+
mutation RefreshConnectionToken($connectionId: ID!) {
|
|
64
|
+
refreshConnectionToken(connectionId: $connectionId) { id status }
|
|
65
|
+
}
|
|
66
|
+
`,G=`
|
|
67
|
+
mutation AuthenticateWithApiKey($input: ApiKeyAuthInput!) {
|
|
68
|
+
authenticateWithApiKey(input: $input) { id name status }
|
|
69
|
+
}
|
|
70
|
+
`,S=`
|
|
71
|
+
mutation AuthenticateWithBasicAuth($input: BasicAuthInput!) {
|
|
72
|
+
authenticateWithBasicAuth(input: $input) { id name status }
|
|
73
|
+
}
|
|
74
|
+
`,D=`
|
|
75
|
+
mutation AuthenticateWithBearerToken($input: BearerTokenAuthInput!) {
|
|
76
|
+
authenticateWithBearerToken(input: $input) { id name status }
|
|
77
|
+
}
|
|
78
|
+
`,B=`
|
|
79
|
+
mutation InitiateOAuth($input: InitiateOAuthInput!) {
|
|
80
|
+
initiateOAuth(input: $input) { redirectUrl state }
|
|
81
|
+
}
|
|
82
|
+
`,q=`
|
|
83
|
+
mutation CompleteOAuth($input: CompleteOAuthInput!) {
|
|
84
|
+
completeOAuth(input: $input) { id name status }
|
|
85
|
+
}
|
|
86
|
+
`,x=`
|
|
87
|
+
query GetProviderByKey($key: String!) {
|
|
88
|
+
getProviderByKey(key: $key) { id key name authType category connectionCount isEnabled }
|
|
89
|
+
}
|
|
90
|
+
`,L=`
|
|
91
|
+
query GetProviderCatalog($pagination: IntegrationsPaginationInput) {
|
|
92
|
+
getProviderCatalog(pagination: $pagination) {
|
|
93
|
+
items { id key name category authType isEnabled }
|
|
94
|
+
total hasMore
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,U=`
|
|
98
|
+
query GetConnectionsByProvider($providerId: ID!, $pagination: IntegrationsPaginationInput) {
|
|
99
|
+
getConnectionsByProvider(providerId: $providerId, pagination: $pagination) {
|
|
100
|
+
items { id name providerId status grantedScopes }
|
|
101
|
+
total hasMore
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`,K=`
|
|
105
|
+
mutation EnableProvider($id: ID!) {
|
|
106
|
+
enableProvider(id: $id) { id key name isEnabled }
|
|
107
|
+
}
|
|
108
|
+
`,V=`
|
|
109
|
+
mutation DisableProvider($id: ID!) {
|
|
110
|
+
disableProvider(id: $id) { id key name isEnabled }
|
|
111
|
+
}
|
|
112
|
+
`,H=`
|
|
113
|
+
mutation TagConnection($input: TagConnectionInput!) {
|
|
114
|
+
tagConnection(input: $input) { id entityId tagId source }
|
|
115
|
+
}
|
|
116
|
+
`,W=`
|
|
117
|
+
mutation UntagConnection($input: UntagConnectionInput!) {
|
|
118
|
+
untagConnection(input: $input)
|
|
119
|
+
}
|
|
120
|
+
`,z=`
|
|
121
|
+
mutation ReplaceConnectionTags($input: ReplaceConnectionTagsInput!) {
|
|
122
|
+
replaceConnectionTags(input: $input) { id entityId tagId source }
|
|
123
|
+
}
|
|
124
|
+
`,M=`
|
|
125
|
+
query GetConnectionTags($input: GetConnectionTagsInput!) {
|
|
126
|
+
getConnectionTags(input: $input) { id entityId tagId source assignedAt }
|
|
127
|
+
}
|
|
128
|
+
`;function Y(I){let p=I.command("integrations").description("Integration providers, connections, and logs"),d=p.command("providers").description("Available providers");d.command("list").description("List integration providers").option("--category <c>").option("--enabled").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.category&&(n.category=t.category.toUpperCase()),t.enabled!==void 0&&(n.isEnabled=t.enabled);let e=await b$1(E,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getProviders.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:e.getProviders.items.map(r=>[o(r.id,12),r.key,r.name,r.category??"-",r.authType??"-",String(!!r.isEnabled)])});}catch(n){f(n);}}),d.command("get").description("Get a provider").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(O,{id:t});if(!e.getProvider)throw new o$1(`Provider ${t} not found`);g(n,e.getProvider);}catch(e){f(e);}});let s=p.command("connections").description("Provider connections (OAuth + credential)");s.command("list").description("List connections").option("--provider <id>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n={};t.provider&&(n.providerId=t.provider),t.status&&(n.status=t.status.toUpperCase());let e=await b$1(N,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getConnections.items,{headers:["ID","Name","Provider","Status"],rows:e.getConnections.items.map(r=>[o(r.id,12),r.name,o(r.providerId,12),m(r.status)])});}catch(n){f(n);}}),s.command("get").description("Get a connection").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(A,{id:t});if(!e.getConnection)throw new o$1(`Connection ${t} not found`);g(n,e.getConnection);}catch(e){f(e);}}),s.command("add").description("Create a connection (provider id required; credentials stored in vault)").requiredOption("--name <name>").requiredOption("--provider <id>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={name:t.name,providerId:t.provider,grantedScopes:t.scopes?t.scopes.split(","):void 0},e=await b$1(v,{input:n});h("Connection created"),g(t,e.createConnection);}catch(n){f(n);}}),s.command("delete").description("Delete a connection").argument("<id>").option("--keep-secret","Keep vault secret",false).action(async(t,n)=>{try{await b$1(R,{id:t,deleteVaultSecret:!n.keepSecret}),h("Connection deleted");}catch(e){f(e);}}),s.command("update").description("Update a connection (name / description / config JSON)").argument("<id>").option("--name <name>").option("--description <desc>").option("--config <json>","Config JSON string").option("-f, --format <format>").action(async(t,n)=>{try{let e={};if(n.name!==void 0&&(e.name=n.name),n.description!==void 0&&(e.description=n.description),n.config!==void 0&&(e.config=JSON.parse(n.config)),Object.keys(e).length===0)throw new o$1("Provide at least one of --name, --description, --config");let r=await b$1(_,{id:t,input:e});h("Connection updated"),g(n,r.updateConnection);}catch(e){f(e);}}),s.command("revoke").description("Revoke a connection (soft delete; tokens invalidated)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(P,{connectionId:t});h("Connection revoked"),g(n,e.revokeConnection);}catch(e){f(e);}}),s.command("test").description("Test a connection (health/auth probe)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1($,{connectionId:t});g(n,e.testConnection);}catch(e){f(e);}}),s.command("link").description("Link a connection to a channel for DM/notification routing").requiredOption("--channel <channelId>").requiredOption("--connection <id>").requiredOption("--organization <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(k,{channelId:t.channel,connectionId:t.connection,organizationId:t.organization});h("Linked"),g(t,n.linkIntegrationToChannel);}catch(n){f(n);}}),s.command("refresh-token").description("Force a connection token refresh (OAuth refresh_grant)").argument("<connectionId>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(b,{connectionId:t});h("Token refreshed"),g(n,e.refreshConnectionToken);}catch(e){f(e);}});let g$1=p.command("auth").description("Per-connection auth flows");g$1.command("api-key").description("Authenticate a connection with an API key").requiredOption("--connection <id>").requiredOption("--api-key <key>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(G,{input:{connectionId:t.connection,apiKey:t.apiKey}});h("Authenticated"),g(t,n.authenticateWithApiKey);}catch(n){f(n);}}),g$1.command("basic").description("Authenticate a connection with Basic Auth").requiredOption("--connection <id>").requiredOption("--username <u>").requiredOption("--password <p>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(S,{input:{connectionId:t.connection,username:t.username,password:t.password}});h("Authenticated"),g(t,n.authenticateWithBasicAuth);}catch(n){f(n);}}),g$1.command("bearer").description("Authenticate a connection with a Bearer token").requiredOption("--connection <id>").requiredOption("--token <t>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(D,{input:{connectionId:t.connection,token:t.token}});h("Authenticated"),g(t,n.authenticateWithBearerToken);}catch(n){f(n);}}),g$1.command("oauth-start").description("Initiate an OAuth flow; prints redirect URL + state").requiredOption("--connection <id>").requiredOption("--redirect-uri <uri>").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let n={connectionId:t.connection,redirectUri:t.redirectUri};t.scopes&&(n.scopes=t.scopes.split(","));let e=await b$1(B,{input:n});g(t,e.initiateOAuth);}catch(n){f(n);}}),g$1.command("oauth-complete").description("Complete an OAuth flow with the authorization code + state").requiredOption("--connection <id>").requiredOption("--code <c>").requiredOption("--redirect-uri <uri>").requiredOption("--state <s>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(q,{input:{connectionId:t.connection,code:t.code,redirectUri:t.redirectUri,state:t.state}});h("OAuth complete"),g(t,n.completeOAuth);}catch(n){f(n);}});let l=s.command("tags").description("Connection tag assignments");l.command("add").description("Tag a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").option("--source <s>").option("-f, --format <format>").action(async t=>{try{let n={entityId:t.entity,tagId:t.tag};t.source&&(n.source=t.source);let e=await b$1(H,{input:n});h("Tagged"),g(t,e.tagConnection);}catch(n){f(n);}}),l.command("remove").description("Remove a tag from a connection").requiredOption("--entity <id>").requiredOption("--tag <tagId>").action(async t=>{try{await b$1(W,{input:{entityId:t.entity,tagId:t.tag}}),h("Tag removed");}catch(n){f(n);}}),l.command("replace").description("Replace all tags on a connection").requiredOption("--entity <id>").requiredOption("--tags <ids>","Comma-separated tag IDs").option("-f, --format <format>").action(async t=>{try{let n=await b$1(z,{input:{entityId:t.entity,tagIds:t.tags.split(",")}});h("Tags replaced"),g(t,n.replaceConnectionTags);}catch(n){f(n);}}),l.command("list").description("List tags on a connection").requiredOption("--entity <id>").option("-f, --format <format>").action(async t=>{try{let n=await b$1(M,{input:{entityId:t.entity}});g(t,n.getConnectionTags);}catch(n){f(n);}}),d.command("get-by-key").description("Get a provider by key (e.g. github, slack)").argument("<key>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(x,{key:t});if(!e.getProviderByKey)throw new o$1(`Provider ${t} not found`);g(n,e.getProviderByKey);}catch(e){f(e);}}),d.command("catalog").description("Browseable provider catalog").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await b$1(L,{pagination:{limit:t.limit,offset:0}});g(t,n.getProviderCatalog.items,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:n.getProviderCatalog.items.map(e=>[o(e.id,12),e.key,e.name,e.category??"-",e.authType??"-",String(!!e.isEnabled)])});}catch(n){f(n);}}),d.command("connections").description("Connections for a given provider").argument("<providerId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await b$1(U,{providerId:t,pagination:{limit:n.limit,offset:0}});g(n,e.getConnectionsByProvider.items);}catch(e){f(e);}}),d.command("enable").description("Enable a provider").argument("<id>").action(async t=>{try{await b$1(K,{id:t}),h("Provider enabled");}catch(n){f(n);}}),d.command("disable").description("Disable a provider").argument("<id>").action(async t=>{try{await b$1(V,{id:t}),h("Provider disabled");}catch(n){f(n);}}),p.command("logs").description("Integration audit logs").option("--connection <id>").option("--level <l>","INFO|WARN|ERROR").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n$1={};t.connection&&(n$1.connectionId=t.connection),t.level&&(n$1.level=t.level.toUpperCase());let e=await b$1(w,{filter:Object.keys(n$1).length?n$1:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getIntegrationLogs.items,{headers:["When","Action","Level","Message"],rows:e.getIntegrationLogs.items.map(r=>[n(r.createdAt),r.action,r.level,r.message])});}catch(n){f(n);}});}var F={id:"integrations",version:"1.0.0",displayName:"Integrations",dependsOn:["auth","workspaces"],register(I,p){a(p),Y(I);}},et=F;export{et as default};
|
|
@@ -1,33 +1,174 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var l=class extends Error{exitCode;hint;constructor(s,d){super(s),this.name="CliUserError",this.exitCode=d?.exitCode??1,this.hint=d?.hint;}},k=class extends l{constructor(s,d){super(s,{exitCode:2,hint:d?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},A=class extends Error{cause;constructor(s,d){super(s),this.name="CliInternalError",this.cause=d;}};var Y=null;function it(o){Y=o;}function T(){if(!Y)throw new A("vibecontrols module helpers used before setHelpersContext was called");return Y}function de(){let o=T();if(!o.auth.isAuthenticated())throw new k(`Authentication required. Run \`${o.productName} auth login\`.`)}async function i(o,s){return de(),T().gql.workspace.request(o,s)}function r(o){let s=o instanceof Error?o.message:String(o);throw new l(s)}function a(o,s,d){T().output.formatAndOutput(o,s,d);}function u(o){T().output.printSuccess(o);}function rt(o){return T().output.formatStatus(o)}function st(o){return T().output.formatDate(o)}function at(o,s){return T().output.truncate(o,s)}function J(o,s){return T().output.confirm(o,s)}function ct(){return T()}var C=`
|
|
2
2
|
id name template mode status ttlSeconds
|
|
3
3
|
expiresAt stoppedAt
|
|
4
4
|
workspaceId createdAt updatedAt
|
|
5
|
-
`,
|
|
5
|
+
`,gt=`
|
|
6
6
|
query ListSandboxes($context: ContextInput!, $filter: SandboxFilterInput, $pagination: SandboxPaginationInput) {
|
|
7
7
|
listSandboxes(context: $context, filter: $filter, pagination: $pagination) {
|
|
8
|
-
items { ${
|
|
8
|
+
items { ${C} } total hasMore
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`,
|
|
11
|
+
`,mt=`
|
|
12
12
|
query GetSandbox($context: ContextInput!, $id: ID!) {
|
|
13
|
-
getSandbox(context: $context, id: $id) { ${
|
|
13
|
+
getSandbox(context: $context, id: $id) { ${C} }
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,St=`
|
|
16
16
|
mutation CreateSandbox($input: CreateSandboxInput!) {
|
|
17
|
-
createSandbox(input: $input) { ${
|
|
17
|
+
createSandbox(input: $input) { ${C} }
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
`,$t=`
|
|
20
20
|
mutation StopSandbox($context: ContextInput!, $id: ID!) {
|
|
21
|
-
stopSandbox(context: $context, id: $id) { ${
|
|
21
|
+
stopSandbox(context: $context, id: $id) { ${C} }
|
|
22
22
|
}
|
|
23
|
-
`,
|
|
23
|
+
`,Tt=`
|
|
24
24
|
mutation DeleteSandbox($context: ContextInput!, $id: ID!) {
|
|
25
25
|
deleteSandbox(context: $context, id: $id)
|
|
26
26
|
}
|
|
27
|
-
`,
|
|
27
|
+
`,Et=`
|
|
28
28
|
mutation ExtendSandboxTTL($context: ContextInput!, $id: ID!, $additionalSeconds: Int!) {
|
|
29
29
|
extendSandboxTTL(context: $context, id: $id, additionalSeconds: $additionalSeconds) {
|
|
30
|
-
${
|
|
30
|
+
${C}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`,M=`
|
|
34
|
+
id name description template isDefault ttlSeconds
|
|
35
|
+
workspaceId createdAt updatedAt
|
|
36
|
+
`,ft=`
|
|
37
|
+
query ListSandboxTemplates(
|
|
38
|
+
$context: ContextInput!
|
|
39
|
+
$template: SandboxTemplate
|
|
40
|
+
$pagination: SandboxPaginationInput
|
|
41
|
+
) {
|
|
42
|
+
listSandboxTemplates(context: $context, template: $template, pagination: $pagination) {
|
|
43
|
+
items { ${M} } total hasMore
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,xt=`
|
|
47
|
+
query GetSandboxTemplate($context: ContextInput!, $id: ID!) {
|
|
48
|
+
getSandboxTemplate(context: $context, id: $id) { ${M} }
|
|
49
|
+
}
|
|
50
|
+
`,At=`
|
|
51
|
+
mutation CreateSandboxTemplate($input: CreateSandboxTemplateInput!) {
|
|
52
|
+
createSandboxTemplate(input: $input) { ${M} }
|
|
53
|
+
}
|
|
54
|
+
`,bt=`
|
|
55
|
+
mutation UpdateSandboxTemplate($input: UpdateSandboxTemplateInput!) {
|
|
56
|
+
updateSandboxTemplate(input: $input) { ${M} }
|
|
57
|
+
}
|
|
58
|
+
`,Dt=`
|
|
59
|
+
mutation DeleteSandboxTemplate($context: ContextInput!, $id: ID!) {
|
|
60
|
+
deleteSandboxTemplate(context: $context, id: $id)
|
|
61
|
+
}
|
|
62
|
+
`,_t=`
|
|
63
|
+
query AvailableSandboxTags($query: String, $limit: Int) {
|
|
64
|
+
availableSandboxTags(query: $query, limit: $limit) {
|
|
65
|
+
id key label color
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`,Ct=`
|
|
69
|
+
query GetSandboxTags($input: GetSandboxTagsInput!) {
|
|
70
|
+
getSandboxTags(input: $input) {
|
|
71
|
+
id entityId entityType tagId source assignedAt assignedBy
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`,yt=`
|
|
75
|
+
mutation CreateSandboxTag($input: CreateSandboxTagInput!) {
|
|
76
|
+
createSandboxTag(input: $input) { id key label color }
|
|
77
|
+
}
|
|
78
|
+
`,kt=`
|
|
79
|
+
mutation TagSandbox($input: TagSandboxInput!) {
|
|
80
|
+
tagSandbox(input: $input) {
|
|
81
|
+
id entityId tagId source assignedAt
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`,Ot=`
|
|
85
|
+
mutation UntagSandbox($input: UntagSandboxInput!) {
|
|
86
|
+
untagSandbox(input: $input)
|
|
87
|
+
}
|
|
88
|
+
`,Nt=`
|
|
89
|
+
mutation ReplaceSandboxTags($input: ReplaceSandboxTagsInput!) {
|
|
90
|
+
replaceSandboxTags(input: $input) {
|
|
91
|
+
id entityId tagId source assignedAt
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`,ht=`
|
|
95
|
+
query ListAllSandboxes(
|
|
96
|
+
$context: ContextInput!
|
|
97
|
+
$filter: SandboxFilterInput
|
|
98
|
+
$pagination: SandboxPaginationInput
|
|
99
|
+
) {
|
|
100
|
+
listAllSandboxes(context: $context, filter: $filter, pagination: $pagination) {
|
|
101
|
+
items { ${C} } total hasMore
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`,vt=`
|
|
105
|
+
query ListSandboxNodes($context: ContextInput!) {
|
|
106
|
+
listSandboxNodes(context: $context) {
|
|
107
|
+
name status allocatableCpu allocatableMemory sandboxPodCount labels
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`,Rt=`
|
|
111
|
+
query GetActiveSandboxes($context: ContextInput!) {
|
|
112
|
+
getActiveSandboxes(context: $context) { ${C} }
|
|
113
|
+
}
|
|
114
|
+
`,wt=`
|
|
115
|
+
query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {
|
|
116
|
+
getRecentSandboxActivity(context: $context, limit: $limit) {
|
|
117
|
+
items { id action actorId status sandboxName sandboxId createdAt }
|
|
118
|
+
total
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`,Lt=`
|
|
122
|
+
query GetSandboxStats($context: ContextInput!) {
|
|
123
|
+
getSandboxStats(context: $context) {
|
|
124
|
+
activeSandboxes totalCreated totalDeleted runningNow provisioningNow
|
|
125
|
+
stoppedNow expiredCount failedCount totalCpuUsed totalMemoryUsed
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`,Pt=`
|
|
129
|
+
query GetSandboxLogs(
|
|
130
|
+
$context: ContextInput!
|
|
131
|
+
$id: ID!
|
|
132
|
+
$containerName: String!
|
|
133
|
+
$tailLines: Int
|
|
134
|
+
) {
|
|
135
|
+
getSandboxLogs(context: $context, id: $id, containerName: $containerName, tailLines: $tailLines)
|
|
136
|
+
}
|
|
137
|
+
`,Vt=`
|
|
138
|
+
query GetSandboxConfig($context: ContextInput!) {
|
|
139
|
+
getSandboxConfig(context: $context) {
|
|
140
|
+
id defaultTtlSeconds maxTtlSeconds allowedTemplates
|
|
141
|
+
maxConcurrentPerUser maxConcurrentPerWorkspace
|
|
142
|
+
defaultCpuRequest defaultCpuLimit defaultMemoryRequest defaultMemoryLimit
|
|
143
|
+
workspaceId updatedAt
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`,Ut=`
|
|
147
|
+
mutation UpdateSandboxConfig($input: UpdateSandboxConfigInput!) {
|
|
148
|
+
updateSandboxConfig(input: $input) {
|
|
149
|
+
id defaultTtlSeconds maxTtlSeconds allowedTemplates
|
|
150
|
+
maxConcurrentPerUser maxConcurrentPerWorkspace
|
|
151
|
+
defaultCpuRequest defaultCpuLimit defaultMemoryRequest defaultMemoryLimit
|
|
152
|
+
workspaceId updatedAt
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
`,Q=`
|
|
156
|
+
id workspaceId format status requestedBy rowCount
|
|
157
|
+
downloadUrl errorMessage expiresAt createdAt updatedAt
|
|
158
|
+
`,Gt=`
|
|
159
|
+
mutation ExportSandboxes($input: ExportSandboxesInput!) {
|
|
160
|
+
exportSandboxes(input: $input) { ${Q} }
|
|
161
|
+
}
|
|
162
|
+
`,Bt=`
|
|
163
|
+
query GetSandboxExportJob($workspaceId: ID!, $jobId: ID!, $context: ContextInput!) {
|
|
164
|
+
getSandboxExportJob(workspaceId: $workspaceId, jobId: $jobId, context: $context) {
|
|
165
|
+
${Q}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
`,qt=`
|
|
169
|
+
query ListSandboxExportJobs($workspaceId: ID!, $context: ContextInput!, $pagination: SandboxPaginationInput) {
|
|
170
|
+
listSandboxExportJobs(workspaceId: $workspaceId, context: $context, pagination: $pagination) {
|
|
171
|
+
${Q}
|
|
31
172
|
}
|
|
32
173
|
}
|
|
33
|
-
`;function b(){let t=K().auth.read();if(!t?.workspaceId)throw new s("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:t.workspaceId}}function ot(t){let n=t.command("sandbox").description("Manage sandboxes");n.command("list").description("List sandboxes").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>","Output format").action(async e=>{try{let o={};e.status&&(o.status=e.status.toUpperCase()),e.template&&(o.template=e.template.toUpperCase());let N=(await m(z,{context:b(),filter:Object.keys(o).length?o:void 0,pagination:{limit:e.limit,offset:0}})).listSandboxes.items;C(e,N,{headers:["ID","Name","Template","Mode","Status","TTL","Created"],rows:N.map(l=>[H(l.id,12),l.name,l.template,l.mode,F(l.status),l.ttlSeconds?`${l.ttlSeconds}s`:"-",M(l.createdAt)])});}catch(o){$(o);}}),n.command("get").description("Get sandbox details").argument("<id>").option("-f, --format <format>","Output format").action(async(e,o)=>{try{let i=await m(Q,{context:b(),id:e});if(!i.getSandbox)throw new s("Sandbox not found");C(o,i.getSandbox);}catch(i){$(i);}}),n.command("create").description("Create sandbox").requiredOption("--name <name>","Sandbox name").option("--template <template>","Template type","VIBECONTROLS").option("--mode <mode>","Mode (DEPLOYMENT or JOB)","DEPLOYMENT").option("--ttl <seconds>","TTL in seconds",parseInt).option("-f, --format <format>","Output format").action(async e=>{try{let o=await m(Z,{input:{name:e.name,template:e.template.toUpperCase(),mode:e.mode.toUpperCase(),ttlSeconds:e.ttl,context:b()}});k("Sandbox created"),C(e,o.createSandbox);}catch(o){$(o);}}),n.command("stop").description("Stop sandbox").argument("<id>").action(async e=>{try{await m(tt,{context:b(),id:e}),k("Sandbox stopped");}catch(o){$(o);}}),n.command("delete").description("Delete sandbox").argument("<id>").option("--force","Skip confirmation").action(async(e,o)=>{try{if(!await W("Delete this sandbox?",o.force))return;await m(et,{context:b(),id:e}),k("Sandbox deleted");}catch(i){$(i);}}),n.command("extend").description("Extend sandbox TTL").argument("<id>").option("--seconds <n>","Extend by seconds",parseInt).option("--minutes <n>","Extend by minutes",parseInt).option("-f, --format <format>","Output format").action(async(e,o)=>{try{let i;if(o.seconds?i=o.seconds:o.minutes&&(i=o.minutes*60),!i)throw new s("Either --seconds or --minutes is required");let N=await m(nt,{context:b(),id:e,additionalSeconds:i});k(`Sandbox extended by ${i}s`),C(o,N.extendSandboxTTL);}catch(i){$(i);}});}var Et={id:"sandbox",version:"1.0.0",displayName:"Sandbox",dependsOn:["auth","workspaces"],register(t,n){q(n),ot(t);}},ei=Et;module.exports=ei;
|
|
174
|
+
`;function c(){let o=ct().auth.read();if(!o?.workspaceId)throw new l("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:o.workspaceId}}function zt(o){let s=o.command("sandbox").description("Manage sandboxes");s.command("list").description("List sandboxes").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>","Output format").action(async e=>{try{let t={};e.status&&(t.status=e.status.toUpperCase()),e.template&&(t.template=e.template.toUpperCase());let g=(await i(gt,{context:c(),filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}})).listSandboxes.items;a(e,g,{headers:["ID","Name","Template","Mode","Status","TTL","Created"],rows:g.map(E=>[at(E.id,12),E.name,E.template,E.mode,rt(E.status),E.ttlSeconds?`${E.ttlSeconds}s`:"-",st(E.createdAt)])});}catch(t){r(t);}}),s.command("get").description("Get sandbox details").argument("<id>").option("-f, --format <format>","Output format").action(async(e,t)=>{try{let n=await i(mt,{context:c(),id:e});if(!n.getSandbox)throw new l("Sandbox not found");a(t,n.getSandbox);}catch(n){r(n);}}),s.command("create").description("Create sandbox").requiredOption("--name <name>","Sandbox name").option("--template <template>","Template type","VIBECONTROLS").option("--mode <mode>","Mode (DEPLOYMENT or JOB)","DEPLOYMENT").option("--ttl <seconds>","TTL in seconds",parseInt).option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(St,{input:{name:e.name,template:e.template.toUpperCase(),mode:e.mode.toUpperCase(),ttlSeconds:e.ttl,context:c()}});u("Sandbox created"),a(e,t.createSandbox);}catch(t){r(t);}}),s.command("stop").description("Stop sandbox").argument("<id>").action(async e=>{try{await i($t,{context:c(),id:e}),u("Sandbox stopped");}catch(t){r(t);}}),s.command("delete").description("Delete sandbox").argument("<id>").option("--force","Skip confirmation").action(async(e,t)=>{try{if(!await J("Delete this sandbox?",t.force))return;await i(Tt,{context:c(),id:e}),u("Sandbox deleted");}catch(n){r(n);}}),s.command("extend").description("Extend sandbox TTL").argument("<id>").option("--seconds <n>","Extend by seconds",parseInt).option("--minutes <n>","Extend by minutes",parseInt).option("-f, --format <format>","Output format").action(async(e,t)=>{try{let n;if(t.seconds?n=t.seconds:t.minutes&&(n=t.minutes*60),!n)throw new l("Either --seconds or --minutes is required");let g=await i(Et,{context:c(),id:e,additionalSeconds:n});u(`Sandbox extended by ${n}s`),a(t,g.extendSandboxTTL);}catch(n){r(n);}});let d=s.command("templates").description("Manage sandbox templates");d.command("list").description("List sandbox templates").option("--template <kind>","Filter by template kind").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(ft,{context:c(),template:e.template?.toUpperCase(),pagination:{limit:e.limit,offset:0}});a(e,t.listSandboxTemplates.items);}catch(t){r(t);}}),d.command("get").description("Get template details").argument("<id>").option("-f, --format <format>","Output format").action(async(e,t)=>{try{let n=await i(xt,{context:c(),id:e});if(!n.getSandboxTemplate)throw new l("Template not found");a(t,n.getSandboxTemplate);}catch(n){r(n);}}),d.command("create").description("Create sandbox template").requiredOption("--name <name>","Template name").requiredOption("--template <kind>","Template kind").option("--description <desc>","Description").option("--default","Mark as default").option("--ttl <seconds>","Default TTL",parseInt).option("-f, --format <format>","Output format").action(async e=>{try{let t={name:e.name,template:e.template.toUpperCase(),context:c()};e.description&&(t.description=e.description),e.default&&(t.isDefault=!0),e.ttl!==void 0&&(t.ttlSeconds=e.ttl);let n=await i(At,{input:t});u("Template created"),a(e,n.createSandboxTemplate);}catch(t){r(t);}}),d.command("update").description("Update sandbox template").argument("<id>").option("--name <name>","New name").option("--description <desc>","New description").option("--default","Mark as default").option("--ttl <seconds>","New default TTL",parseInt).option("-f, --format <format>","Output format").action(async(e,t)=>{try{let n={id:e,context:c()};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.default!==void 0&&(n.isDefault=t.default),t.ttl!==void 0&&(n.ttlSeconds=t.ttl);let g=await i(bt,{input:n});u("Template updated"),a(t,g.updateSandboxTemplate);}catch(n){r(n);}}),d.command("delete").description("Delete sandbox template").argument("<id>").option("--force","Skip confirmation").action(async(e,t)=>{try{if(!await J("Delete this template?",t.force))return;await i(Dt,{context:c(),id:e}),u("Template deleted");}catch(n){r(n);}});let y=s.command("tags").description("Manage sandbox tags");y.command("list").description("List available sandbox tags").option("--query <q>","Search query").option("--limit <n>","Page size",parseInt).option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(_t,{query:e.query,limit:e.limit});a(e,t.availableSandboxTags);}catch(t){r(t);}}),y.command("create").description("Create a new sandbox tag").requiredOption("--label <label>","Tag label").option("--color <color>","Tag color").option("-f, --format <format>","Output format").action(async e=>{try{let t={label:e.label};e.color&&(t.color=e.color);let n=await i(yt,{input:t});u("Tag created"),a(e,n.createSandboxTag);}catch(t){r(t);}}),y.command("attach").description("Attach a tag to a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tag <id>","Tag ID").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(kt,{input:{sandboxId:e.sandbox,tagId:e.tag}});u("Tag attached"),a(e,t.tagSandbox);}catch(t){r(t);}}),y.command("detach").description("Detach a tag from a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tag <id>","Tag ID").action(async e=>{try{await i(Ot,{input:{sandboxId:e.sandbox,tagId:e.tag}}),u("Tag detached");}catch(t){r(t);}}),y.command("get").description("Get tags assigned to a sandbox").requiredOption("--sandbox <id>","Sandbox ID").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(Ct,{input:{sandboxId:e.sandbox}});a(e,t.getSandboxTags);}catch(t){r(t);}}),y.command("replace").description("Replace all tags on a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tags <ids...>","Tag IDs (space separated)").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(Nt,{input:{sandboxId:e.sandbox,tagIds:e.tags}});u("Tags replaced"),a(e,t.replaceSandboxTags);}catch(t){r(t);}});let x=s.command("admin").description("Admin / observability ops");x.command("nodes").description("List sandbox nodes").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(vt,{context:c()});a(e,t.listSandboxNodes);}catch(t){r(t);}}),x.command("all").description("List all sandboxes (admin)").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>","Output format").action(async e=>{try{let t={};e.status&&(t.status=e.status.toUpperCase()),e.template&&(t.template=e.template.toUpperCase());let n=await i(ht,{context:c(),filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});a(e,n.listAllSandboxes.items);}catch(t){r(t);}}),x.command("active").description("Get active sandboxes").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(Rt,{context:c()});a(e,t.getActiveSandboxes);}catch(t){r(t);}}),x.command("activity").description("Get recent sandbox activity").option("--limit <n>","Max items",parseInt,20).option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(wt,{context:c(),limit:e.limit});a(e,t.getRecentSandboxActivity.items);}catch(t){r(t);}}),x.command("stats").description("Get sandbox stats").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(Lt,{context:c()});a(e,t.getSandboxStats);}catch(t){r(t);}}),x.command("logs").description("Get logs for a sandbox container").argument("<id>").requiredOption("--container <name>","Container name").option("--tail <n>","Tail lines",parseInt,100).action(async(e,t)=>{try{let n=await i(Pt,{context:c(),id:e,containerName:t.container,tailLines:t.tail});process.stdout.write(n.getSandboxLogs);}catch(n){r(n);}});let et=x.command("config").description("Sandbox config");et.command("get").description("Get sandbox config").option("-f, --format <format>","Output format").action(async e=>{try{let t=await i(Vt,{context:c()});a(e,t.getSandboxConfig);}catch(t){r(t);}}),et.command("set").description("Update sandbox config").option("--default-ttl <seconds>","Default TTL",parseInt).option("--max-ttl <seconds>","Max TTL",parseInt).option("--max-per-user <n>","Max concurrent per user",parseInt).option("--max-per-workspace <n>","Max concurrent per workspace",parseInt).option("-f, --format <format>","Output format").action(async e=>{try{let t={context:c()};e.defaultTtl!==void 0&&(t.defaultTtlSeconds=e.defaultTtl),e.maxTtl!==void 0&&(t.maxTtlSeconds=e.maxTtl),e.maxPerUser!==void 0&&(t.maxConcurrentPerUser=e.maxPerUser),e.maxPerWorkspace!==void 0&&(t.maxConcurrentPerWorkspace=e.maxPerWorkspace);let n=await i(Ut,{input:t});u("Config updated"),a(e,n.updateSandboxConfig);}catch(t){r(t);}});let j=s.command("export").description("Sandbox export jobs");j.command("create").description("Create a sandbox export job").requiredOption("--format <fmt>","Format (CSV or JSON)").option("--include-usage","Include usage events").option("-f, --format-out <format>","Output format").action(async e=>{try{let t=c(),n={workspaceId:t.workspaceId,format:e.format.toUpperCase(),context:t};e.includeUsage&&(n.includeUsageEvents=!0);let g=await i(Gt,{input:n});u("Export job created"),a({format:e.formatOut},g.exportSandboxes);}catch(t){r(t);}}),j.command("get").description("Get sandbox export job").argument("<jobId>").option("-f, --format <format>","Output format").action(async(e,t)=>{try{let n=c(),g=await i(Bt,{workspaceId:n.workspaceId,jobId:e,context:n});a(t,g.getSandboxExportJob);}catch(n){r(n);}}),j.command("list").description("List sandbox export jobs").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>","Output format").action(async e=>{try{let t=c(),n=await i(qt,{workspaceId:t.workspaceId,context:t,pagination:{limit:e.limit,offset:0}});a(e,n.listSandboxExportJobs);}catch(t){r(t);}});}var le={id:"sandbox",version:"1.0.0",displayName:"Sandbox",dependsOn:["auth","workspaces"],register(o,s){it(s),zt(o);}},Jr=le;module.exports=Jr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Dc,Ec,Fc,Gc,Hc,Ic}from'../../chunk-MRONTCXQ.js';import {a,b,g,o,m,n,f,h as h$1,p,r}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';function d(){let i=r().auth.read();if(!i?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:i.workspaceId}}function h(i){let o$2=i.command("sandbox").description("Manage sandboxes");o$2.command("list").description("List sandboxes").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.status&&(e.status=t.status.toUpperCase()),t.template&&(e.template=t.template.toUpperCase());let p=(await b(Dc,{context:d(),filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}})).listSandboxes.items;g(t,p,{headers:["ID","Name","Template","Mode","Status","TTL","Created"],rows:p.map(a=>[o(a.id,12),a.name,a.template,a.mode,m(a.status),a.ttlSeconds?`${a.ttlSeconds}s`:"-",n(a.createdAt)])});}catch(e){f(e);}}),o$2.command("get").description("Get sandbox details").argument("<id>").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await b(Ec,{context:d(),id:t});if(!n.getSandbox)throw new o$1("Sandbox not found");g(e,n.getSandbox);}catch(n){f(n);}}),o$2.command("create").description("Create sandbox").requiredOption("--name <name>","Sandbox name").option("--template <template>","Template type","VIBECONTROLS").option("--mode <mode>","Mode (DEPLOYMENT or JOB)","DEPLOYMENT").option("--ttl <seconds>","TTL in seconds",parseInt).option("-f, --format <format>","Output format").action(async t=>{try{let e=await b(Fc,{input:{name:t.name,template:t.template.toUpperCase(),mode:t.mode.toUpperCase(),ttlSeconds:t.ttl,context:d()}});h$1("Sandbox created"),g(t,e.createSandbox);}catch(e){f(e);}}),o$2.command("stop").description("Stop sandbox").argument("<id>").action(async t=>{try{await b(Gc,{context:d(),id:t}),h$1("Sandbox stopped");}catch(e){f(e);}}),o$2.command("delete").description("Delete sandbox").argument("<id>").option("--force","Skip confirmation").action(async(t,e)=>{try{if(!await p("Delete this sandbox?",e.force))return;await b(Hc,{context:d(),id:t}),h$1("Sandbox deleted");}catch(n){f(n);}}),o$2.command("extend").description("Extend sandbox TTL").argument("<id>").option("--seconds <n>","Extend by seconds",parseInt).option("--minutes <n>","Extend by minutes",parseInt).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n;if(e.seconds?n=e.seconds:e.minutes&&(n=e.minutes*60),!n)throw new o$1("Either --seconds or --minutes is required");let p=await b(Ic,{context:d(),id:t,additionalSeconds:n});h$1(`Sandbox extended by ${n}s`),g(e,p.extendSandboxTTL);}catch(n){f(n);}});}var I={id:"sandbox",version:"1.0.0",displayName:"Sandbox",dependsOn:["auth","workspaces"],register(i,o){a(o),h(i);}},_=I;export{_ as default};
|
|
1
|
+
import {Nc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,_c,$c,ad,Zc,bd,dd,cd,ed,fd,gd,hd,id,jd,kd,ld,md}from'../../chunk-REBBLQFS.js';import {a,b,g,o,m,n,f,h,p,r as r$1}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';function r(){let l=r$1().auth.read();if(!l?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");return {workspaceId:l.workspaceId}}function Q(l){let d=l.command("sandbox").description("Manage sandboxes");d.command("list").description("List sandboxes").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>","Output format").action(async n$1=>{try{let t={};n$1.status&&(t.status=n$1.status.toUpperCase()),n$1.template&&(t.template=n$1.template.toUpperCase());let c=(await b(Nc,{context:r(),filter:Object.keys(t).length?t:void 0,pagination:{limit:n$1.limit,offset:0}})).listSandboxes.items;g(n$1,c,{headers:["ID","Name","Template","Mode","Status","TTL","Created"],rows:c.map(m$1=>[o(m$1.id,12),m$1.name,m$1.template,m$1.mode,m(m$1.status),m$1.ttlSeconds?`${m$1.ttlSeconds}s`:"-",n(m$1.createdAt)])});}catch(t){f(t);}}),d.command("get").description("Get sandbox details").argument("<id>").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await b(Oc,{context:r(),id:n});if(!e.getSandbox)throw new o$1("Sandbox not found");g(t,e.getSandbox);}catch(e){f(e);}}),d.command("create").description("Create sandbox").requiredOption("--name <name>","Sandbox name").option("--template <template>","Template type","VIBECONTROLS").option("--mode <mode>","Mode (DEPLOYMENT or JOB)","DEPLOYMENT").option("--ttl <seconds>","TTL in seconds",parseInt).option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(Pc,{input:{name:n.name,template:n.template.toUpperCase(),mode:n.mode.toUpperCase(),ttlSeconds:n.ttl,context:r()}});h("Sandbox created"),g(n,t.createSandbox);}catch(t){f(t);}}),d.command("stop").description("Stop sandbox").argument("<id>").action(async n=>{try{await b(Qc,{context:r(),id:n}),h("Sandbox stopped");}catch(t){f(t);}}),d.command("delete").description("Delete sandbox").argument("<id>").option("--force","Skip confirmation").action(async(n,t)=>{try{if(!await p("Delete this sandbox?",t.force))return;await b(Rc,{context:r(),id:n}),h("Sandbox deleted");}catch(e){f(e);}}),d.command("extend").description("Extend sandbox TTL").argument("<id>").option("--seconds <n>","Extend by seconds",parseInt).option("--minutes <n>","Extend by minutes",parseInt).option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e;if(t.seconds?e=t.seconds:t.minutes&&(e=t.minutes*60),!e)throw new o$1("Either --seconds or --minutes is required");let c=await b(Sc,{context:r(),id:n,additionalSeconds:e});h(`Sandbox extended by ${e}s`),g(t,c.extendSandboxTTL);}catch(e){f(e);}});let f$1=d.command("templates").description("Manage sandbox templates");f$1.command("list").description("List sandbox templates").option("--template <kind>","Filter by template kind").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(Tc,{context:r(),template:n.template?.toUpperCase(),pagination:{limit:n.limit,offset:0}});g(n,t.listSandboxTemplates.items);}catch(t){f(t);}}),f$1.command("get").description("Get template details").argument("<id>").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await b(Uc,{context:r(),id:n});if(!e.getSandboxTemplate)throw new o$1("Template not found");g(t,e.getSandboxTemplate);}catch(e){f(e);}}),f$1.command("create").description("Create sandbox template").requiredOption("--name <name>","Template name").requiredOption("--template <kind>","Template kind").option("--description <desc>","Description").option("--default","Mark as default").option("--ttl <seconds>","Default TTL",parseInt).option("-f, --format <format>","Output format").action(async n=>{try{let t={name:n.name,template:n.template.toUpperCase(),context:r()};n.description&&(t.description=n.description),n.default&&(t.isDefault=!0),n.ttl!==void 0&&(t.ttlSeconds=n.ttl);let e=await b(Vc,{input:t});h("Template created"),g(n,e.createSandboxTemplate);}catch(t){f(t);}}),f$1.command("update").description("Update sandbox template").argument("<id>").option("--name <name>","New name").option("--description <desc>","New description").option("--default","Mark as default").option("--ttl <seconds>","New default TTL",parseInt).option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={id:n,context:r()};t.name&&(e.name=t.name),t.description&&(e.description=t.description),t.default!==void 0&&(e.isDefault=t.default),t.ttl!==void 0&&(e.ttlSeconds=t.ttl);let c=await b(Wc,{input:e});h("Template updated"),g(t,c.updateSandboxTemplate);}catch(e){f(e);}}),f$1.command("delete").description("Delete sandbox template").argument("<id>").option("--force","Skip confirmation").action(async(n,t)=>{try{if(!await p("Delete this template?",t.force))return;await b(Xc,{context:r(),id:n}),h("Template deleted");}catch(e){f(e);}});let u=d.command("tags").description("Manage sandbox tags");u.command("list").description("List available sandbox tags").option("--query <q>","Search query").option("--limit <n>","Page size",parseInt).option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(Yc,{query:n.query,limit:n.limit});g(n,t.availableSandboxTags);}catch(t){f(t);}}),u.command("create").description("Create a new sandbox tag").requiredOption("--label <label>","Tag label").option("--color <color>","Tag color").option("-f, --format <format>","Output format").action(async n=>{try{let t={label:n.label};n.color&&(t.color=n.color);let e=await b(_c,{input:t});h("Tag created"),g(n,e.createSandboxTag);}catch(t){f(t);}}),u.command("attach").description("Attach a tag to a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tag <id>","Tag ID").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b($c,{input:{sandboxId:n.sandbox,tagId:n.tag}});h("Tag attached"),g(n,t.tagSandbox);}catch(t){f(t);}}),u.command("detach").description("Detach a tag from a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tag <id>","Tag ID").action(async n=>{try{await b(ad,{input:{sandboxId:n.sandbox,tagId:n.tag}}),h("Tag detached");}catch(t){f(t);}}),u.command("get").description("Get tags assigned to a sandbox").requiredOption("--sandbox <id>","Sandbox ID").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(Zc,{input:{sandboxId:n.sandbox}});g(n,t.getSandboxTags);}catch(t){f(t);}}),u.command("replace").description("Replace all tags on a sandbox").requiredOption("--sandbox <id>","Sandbox ID").requiredOption("--tags <ids...>","Tag IDs (space separated)").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(bd,{input:{sandboxId:n.sandbox,tagIds:n.tags}});h("Tags replaced"),g(n,t.replaceSandboxTags);}catch(t){f(t);}});let p$1=d.command("admin").description("Admin / observability ops");p$1.command("nodes").description("List sandbox nodes").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(dd,{context:r()});g(n,t.listSandboxNodes);}catch(t){f(t);}}),p$1.command("all").description("List all sandboxes (admin)").option("--status <status>","Filter by status").option("--template <template>","Filter by template").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>","Output format").action(async n=>{try{let t={};n.status&&(t.status=n.status.toUpperCase()),n.template&&(t.template=n.template.toUpperCase());let e=await b(cd,{context:r(),filter:Object.keys(t).length?t:void 0,pagination:{limit:n.limit,offset:0}});g(n,e.listAllSandboxes.items);}catch(t){f(t);}}),p$1.command("active").description("Get active sandboxes").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(ed,{context:r()});g(n,t.getActiveSandboxes);}catch(t){f(t);}}),p$1.command("activity").description("Get recent sandbox activity").option("--limit <n>","Max items",parseInt,20).option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(fd,{context:r(),limit:n.limit});g(n,t.getRecentSandboxActivity.items);}catch(t){f(t);}}),p$1.command("stats").description("Get sandbox stats").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(gd,{context:r()});g(n,t.getSandboxStats);}catch(t){f(t);}}),p$1.command("logs").description("Get logs for a sandbox container").argument("<id>").requiredOption("--container <name>","Container name").option("--tail <n>","Tail lines",parseInt,100).action(async(n,t)=>{try{let e=await b(hd,{context:r(),id:n,containerName:t.container,tailLines:t.tail});process.stdout.write(e.getSandboxLogs);}catch(e){f(e);}});let S=p$1.command("config").description("Sandbox config");S.command("get").description("Get sandbox config").option("-f, --format <format>","Output format").action(async n=>{try{let t=await b(id,{context:r()});g(n,t.getSandboxConfig);}catch(t){f(t);}}),S.command("set").description("Update sandbox config").option("--default-ttl <seconds>","Default TTL",parseInt).option("--max-ttl <seconds>","Max TTL",parseInt).option("--max-per-user <n>","Max concurrent per user",parseInt).option("--max-per-workspace <n>","Max concurrent per workspace",parseInt).option("-f, --format <format>","Output format").action(async n=>{try{let t={context:r()};n.defaultTtl!==void 0&&(t.defaultTtlSeconds=n.defaultTtl),n.maxTtl!==void 0&&(t.maxTtlSeconds=n.maxTtl),n.maxPerUser!==void 0&&(t.maxConcurrentPerUser=n.maxPerUser),n.maxPerWorkspace!==void 0&&(t.maxConcurrentPerWorkspace=n.maxPerWorkspace);let e=await b(jd,{input:t});h("Config updated"),g(n,e.updateSandboxConfig);}catch(t){f(t);}});let x=d.command("export").description("Sandbox export jobs");x.command("create").description("Create a sandbox export job").requiredOption("--format <fmt>","Format (CSV or JSON)").option("--include-usage","Include usage events").option("-f, --format-out <format>","Output format").action(async n=>{try{let t=r(),e={workspaceId:t.workspaceId,format:n.format.toUpperCase(),context:t};n.includeUsage&&(e.includeUsageEvents=!0);let c=await b(kd,{input:e});h("Export job created"),g({format:n.formatOut},c.exportSandboxes);}catch(t){f(t);}}),x.command("get").description("Get sandbox export job").argument("<jobId>").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=r(),c=await b(ld,{workspaceId:e.workspaceId,jobId:n,context:e});g(t,c.getSandboxExportJob);}catch(e){f(e);}}),x.command("list").description("List sandbox export jobs").option("--limit <n>","Page size",n=>parseInt(n,10),50).option("-f, --format <format>","Output format").action(async n=>{try{let t=r(),e=await b(md,{workspaceId:t.workspaceId,context:t,pagination:{limit:n.limit,offset:0}});g(n,e.listSandboxExportJobs);}catch(t){f(t);}});}var nt={id:"sandbox",version:"1.0.0",displayName:"Sandbox",dependsOn:["auth","workspaces"],register(l,d){a(d),Q(l);}},ct=nt;export{ct as default};
|
|
@@ -1,32 +1,142 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var l=class extends Error{exitCode;hint;constructor(c,s){super(c),this.name="CliUserError",this.exitCode=s?.exitCode??1,this.hint=s?.hint;}},m=class extends l{constructor(c,s){super(c,{exitCode:2,hint:s?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},f=class extends Error{cause;constructor(c,s){super(c),this.name="CliInternalError",this.cause=s;}};var x=null;function v(o){x=o;}function g(){if(!x)throw new f("vibecontrols module helpers used before setHelpersContext was called");return x}function le(){let o=g();if(!o.auth.isAuthenticated())throw new m(`Authentication required. Run \`${o.productName} auth login\`.`)}async function r(o,c){return le(),g().gql.workspace.request(o,c)}function i(o){let c=o instanceof Error?o.message:String(o);throw new l(c)}function d(o,c,s){g().output.formatAndOutput(o,c,s);}function u(o){g().output.printSuccess(o);}function T(o){return g().output.formatStatus(o)}function E(o){return g().output.formatDate(o)}function w(o,c){return g().output.truncate(o,c)}function A(){return g()}var D=`
|
|
2
2
|
query ListScheduledJobs($workspaceId: ID!, $filter: JobFilterInput, $pagination: SchedulerPaginationInput) {
|
|
3
3
|
scheduledJobs(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {
|
|
4
4
|
jobs { id name status scheduleType nextExecutionAt createdAt }
|
|
5
5
|
total nextCursor
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,O=`
|
|
9
9
|
query GetScheduledJob($id: ID!) {
|
|
10
10
|
scheduledJob(id: $id) {
|
|
11
11
|
id name status scheduleType cronExpression executorType
|
|
12
12
|
nextExecutionAt lastExecutionAt
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
`,$=`
|
|
16
16
|
mutation CreateScheduledJob($workspaceId: ID!, $input: CreateScheduledJobInput!) {
|
|
17
17
|
createScheduledJob(workspaceId: $workspaceId, input: $input) {
|
|
18
18
|
id name status scheduleType
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
21
|
+
`,L=`
|
|
22
22
|
mutation DeleteScheduledJob($id: ID!) {
|
|
23
23
|
deleteScheduledJob(id: $id)
|
|
24
24
|
}
|
|
25
|
-
`,
|
|
25
|
+
`,R=`
|
|
26
26
|
query JobExecutions($jobId: ID!, $pagination: SchedulerPaginationInput) {
|
|
27
27
|
jobExecutions(jobId: $jobId, pagination: $pagination) {
|
|
28
28
|
executions { id status startedAt completedAt duration errorMessage success }
|
|
29
29
|
total nextCursor
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
`,_=`
|
|
33
|
+
mutation PauseScheduledJob($id: ID!) {
|
|
34
|
+
pauseScheduledJob(id: $id) { id name status }
|
|
35
|
+
}
|
|
36
|
+
`,J=`
|
|
37
|
+
mutation ResumeScheduledJob($id: ID!) {
|
|
38
|
+
resumeScheduledJob(id: $id) { id name status }
|
|
39
|
+
}
|
|
40
|
+
`,U=`
|
|
41
|
+
mutation ActivateSchedule($id: ID!) {
|
|
42
|
+
activateSchedule(id: $id) { id name status }
|
|
43
|
+
}
|
|
44
|
+
`,N=`
|
|
45
|
+
mutation ArchiveSchedule($id: ID!) {
|
|
46
|
+
archiveSchedule(id: $id) { id name status }
|
|
47
|
+
}
|
|
48
|
+
`,P=`
|
|
49
|
+
mutation DisableSchedule($id: ID!, $reason: String) {
|
|
50
|
+
disableSchedule(id: $id, reason: $reason) { id name status }
|
|
51
|
+
}
|
|
52
|
+
`,q=`
|
|
53
|
+
mutation CloneSchedule($sourceId: ID!, $newWorkspaceId: ID, $overrides: CreateScheduledJobInput) {
|
|
54
|
+
cloneSchedule(sourceId: $sourceId, newWorkspaceId: $newWorkspaceId, overrides: $overrides) {
|
|
55
|
+
id name status
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`,H=`
|
|
59
|
+
mutation ExecuteJobNow($id: ID!) {
|
|
60
|
+
executeJobNow(id: $id) { id scheduledJobId status }
|
|
61
|
+
}
|
|
62
|
+
`,j=`
|
|
63
|
+
query PreviewSchedule(
|
|
64
|
+
$scheduleType: ScheduleType!
|
|
65
|
+
$cronExpression: String
|
|
66
|
+
$rrule: String
|
|
67
|
+
$interval: Int
|
|
68
|
+
$intervalUnit: String
|
|
69
|
+
$count: Int
|
|
70
|
+
$startDate: DateTime
|
|
71
|
+
$endDate: DateTime
|
|
72
|
+
$timezone: String
|
|
73
|
+
) {
|
|
74
|
+
previewSchedule(
|
|
75
|
+
scheduleType: $scheduleType
|
|
76
|
+
cronExpression: $cronExpression
|
|
77
|
+
rrule: $rrule
|
|
78
|
+
interval: $interval
|
|
79
|
+
intervalUnit: $intervalUnit
|
|
80
|
+
count: $count
|
|
81
|
+
startDate: $startDate
|
|
82
|
+
endDate: $endDate
|
|
83
|
+
timezone: $timezone
|
|
84
|
+
) {
|
|
85
|
+
count startDate endDate nextExecutions
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`,W=`
|
|
89
|
+
query ScheduleTemplates(
|
|
90
|
+
$workspaceId: ID!
|
|
91
|
+
$filter: ScheduleTemplateFilterInput
|
|
92
|
+
$pagination: SchedulerPaginationInput
|
|
93
|
+
) {
|
|
94
|
+
scheduleTemplates(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {
|
|
95
|
+
templates { id name category isPublic scheduleType executorType usageCount }
|
|
96
|
+
total nextCursor
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`,M=`
|
|
100
|
+
query ScheduleTemplate($id: ID!) {
|
|
101
|
+
scheduleTemplate(id: $id) {
|
|
102
|
+
id name description category isPublic scheduleType executorType
|
|
103
|
+
scheduleConfig executorConfig usageCount
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`,G=`
|
|
107
|
+
mutation CreateScheduleTemplate($input: CreateScheduleTemplateInput!, $workspaceId: ID!) {
|
|
108
|
+
createScheduleTemplate(input: $input, workspaceId: $workspaceId) { id name scheduleType }
|
|
109
|
+
}
|
|
110
|
+
`,B=`
|
|
111
|
+
mutation UpdateScheduleTemplate($id: ID!, $input: UpdateScheduleTemplateInput!) {
|
|
112
|
+
updateScheduleTemplate(id: $id, input: $input) { id name }
|
|
113
|
+
}
|
|
114
|
+
`,F=`
|
|
115
|
+
mutation DeleteScheduleTemplate($id: ID!) { deleteScheduleTemplate(id: $id) }
|
|
116
|
+
`,V=`
|
|
117
|
+
query ScheduleVersionHistory($scheduleId: ID!) {
|
|
118
|
+
scheduleVersionHistory(scheduleId: $scheduleId) {
|
|
119
|
+
id scheduleId version changedBy changedFields changeReason createdAt
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
`,z=`
|
|
123
|
+
mutation RestoreScheduleVersion($scheduleId: ID!, $versionId: ID!) {
|
|
124
|
+
restoreScheduleVersion(scheduleId: $scheduleId, versionId: $versionId) { id name version }
|
|
125
|
+
}
|
|
126
|
+
`,K=`
|
|
127
|
+
mutation TagScheduledJob($input: TagScheduledJobInput!) {
|
|
128
|
+
tagScheduledJob(input: $input) { id entityId tagId source }
|
|
129
|
+
}
|
|
130
|
+
`,Y=`
|
|
131
|
+
mutation UntagScheduledJob($input: UntagScheduledJobInput!) {
|
|
132
|
+
untagScheduledJob(input: $input)
|
|
133
|
+
}
|
|
134
|
+
`,X=`
|
|
135
|
+
mutation ReplaceScheduledJobTags($input: ReplaceScheduledJobTagsInput!) {
|
|
136
|
+
replaceScheduledJobTags(input: $input) { id entityId tagId source }
|
|
137
|
+
}
|
|
138
|
+
`,Q=`
|
|
139
|
+
query GetScheduledJobTags($input: GetScheduledJobTagsInput!) {
|
|
140
|
+
getScheduledJobTags(input: $input) { id entityId tagId source }
|
|
141
|
+
}
|
|
142
|
+
`;function C(){let o=A().auth.read();if(!o?.workspaceId)throw new l("No workspace set. Run: vibecontrols workspace set <id>");return o.workspaceId}function Z(o){let c=o.command("scheduler").description("Scheduled jobs & executions"),s=c.command("jobs").description("Manage scheduled jobs");s.command("list").description("List scheduled jobs").option("--status <s>").option("--type <t>","CRON|INTERVAL|ONCE").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.status&&(t.status=e.status.toUpperCase()),e.type&&(t.scheduleType=e.type.toUpperCase());let n=await r(D,{workspaceId:C(),filter:Object.keys(t).length?t:void 0,pagination:{first:e.limit}});d(e,n.scheduledJobs.jobs,{headers:["ID","Name","Status","Type","NextRun","Created"],rows:n.scheduledJobs.jobs.map(a=>[w(a.id,12),a.name,T(a.status),a.scheduleType??"-",E(a.nextExecutionAt),E(a.createdAt)])});}catch(t){i(t);}}),s.command("get").description("Get a scheduled job").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(O,{id:e});if(!n.scheduledJob)throw new l(`Job ${e} not found`);d(t,n.scheduledJob);}catch(n){i(n);}}),s.command("create").description("Create a scheduled job").requiredOption("--name <name>").requiredOption("--type <t>","CRON|FIXED_INTERVAL|ONE_TIME|RRULE|WINDOWED").option("--cron <expr>","Cron expression (for CRON)").option("--interval-seconds <n>","",e=>parseInt(e,10)).option("--executor <e>","WEBHOOK|GRAPHQL|INTERNAL_API|NATS_TOPIC","WEBHOOK").option("--executor-config <json>","Executor config JSON","{}").option("-f, --format <format>").action(async e=>{try{let t={INTERVAL:"FIXED_INTERVAL",ONCE:"ONE_TIME"},n=e.type.toUpperCase(),a={name:e.name,scheduleType:t[n]??n,cronExpression:e.cron,intervalSeconds:e.intervalSeconds,executorType:(e.executor??"WEBHOOK").toUpperCase(),executorConfig:JSON.parse(e.executorConfig??"{}")},I=await r($,{workspaceId:C(),input:a});u(`Job created: ${I.createScheduledJob.name}`),d(e,I.createScheduledJob);}catch(t){i(t);}}),s.command("delete").description("Delete a scheduled job").argument("<id>").action(async e=>{try{await r(L,{id:e}),u("Job deleted");}catch(t){i(t);}});let ee=c.command("executions").description("Job execution history");s.command("pause").description("Pause a scheduled job").argument("<id>").action(async e=>{try{await r(_,{id:e}),u("Job paused");}catch(t){i(t);}}),s.command("resume").description("Resume a paused scheduled job").argument("<id>").action(async e=>{try{await r(J,{id:e}),u("Job resumed");}catch(t){i(t);}}),s.command("activate").description("Activate a draft or disabled schedule").argument("<id>").action(async e=>{try{await r(U,{id:e}),u("Schedule activated");}catch(t){i(t);}}),s.command("archive").description("Archive a scheduled job").argument("<id>").action(async e=>{try{await r(N,{id:e}),u("Schedule archived");}catch(t){i(t);}}),s.command("disable").description("Disable a schedule (with optional reason)").argument("<id>").option("--reason <r>").action(async(e,t)=>{try{await r(P,{id:e,reason:t.reason??null}),u("Schedule disabled");}catch(n){i(n);}}),s.command("clone").description("Clone a schedule (optionally to another workspace; overrides JSON)").argument("<sourceId>").option("--workspace <id>").option("--overrides <json>","Overrides JSON for CreateScheduledJobInput").option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(q,{sourceId:e,newWorkspaceId:t.workspace??null,overrides:t.overrides?JSON.parse(t.overrides):null});u(`Cloned: ${n.cloneSchedule.id}`),d(t,n.cloneSchedule);}catch(n){i(n);}}),s.command("execute-now").description("Execute a scheduled job immediately").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(H,{id:e});u("Execution dispatched"),d(t,n.executeJobNow);}catch(n){i(n);}}),s.command("preview").description("Preview upcoming execution times without creating a job").requiredOption("--type <t>","CRON|FIXED_INTERVAL|ONE_TIME|RRULE|WINDOWED").option("--cron <expr>").option("--rrule <r>").option("--interval <n>","",e=>parseInt(e,10)).option("--interval-unit <u>","SECONDS|MINUTES|HOURS|DAYS").option("--count <n>","",e=>parseInt(e,10),5).option("--start <iso>").option("--end <iso>").option("--timezone <tz>").option("-f, --format <format>").action(async e=>{try{let t=await r(j,{scheduleType:e.type.toUpperCase(),cronExpression:e.cron??null,rrule:e.rrule??null,interval:e.interval??null,intervalUnit:e.intervalUnit??null,count:e.count??null,startDate:e.start??null,endDate:e.end??null,timezone:e.timezone??null});d(e,t.previewSchedule);}catch(t){i(t);}});let y=s.command("tags").description("Scheduled-job tag assignments");y.command("add").description("Tag a scheduled job").requiredOption("--entity <id>").requiredOption("--tag <tagId>").option("--source <s>").action(async e=>{try{let t={entityId:e.entity,tagId:e.tag};e.source&&(t.source=e.source),await r(K,{input:t}),u("Tagged");}catch(t){i(t);}}),y.command("remove").description("Remove a tag from a scheduled job").requiredOption("--entity <id>").requiredOption("--tag <tagId>").action(async e=>{try{await r(Y,{input:{entityId:e.entity,tagId:e.tag}}),u("Tag removed");}catch(t){i(t);}}),y.command("replace").description("Replace all tags on a scheduled job").requiredOption("--entity <id>").requiredOption("--tags <ids>","Comma-separated tag IDs").option("-f, --format <format>").action(async e=>{try{let t=await r(X,{input:{entityId:e.entity,tagIds:e.tags.split(",")}});u("Tags replaced"),d(e,t.replaceScheduledJobTags);}catch(t){i(t);}}),y.command("list").description("List tags on a scheduled job").requiredOption("--entity <id>").option("-f, --format <format>").action(async e=>{try{let t=await r(Q,{input:{entityId:e.entity}});d(e,t.getScheduledJobTags);}catch(t){i(t);}});let h=c.command("templates").description("Schedule templates");h.command("list").description("List schedule templates in the active workspace").option("--category <c>").option("--public","Only public templates").option("-f, --format <format>").action(async e=>{try{let t={};e.category&&(t.category=e.category),e.public!==void 0&&(t.isPublic=e.public);let n=await r(W,{workspaceId:C(),filter:Object.keys(t).length?t:void 0,pagination:{first:100}});d(e,n.scheduleTemplates.templates);}catch(t){i(t);}}),h.command("get").description("Get a schedule template").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(M,{id:e});if(!n.scheduleTemplate)throw new l(`Template ${e} not found`);d(t,n.scheduleTemplate);}catch(n){i(n);}}),h.command("create").description("Create a schedule template").requiredOption("--name <name>").requiredOption("--type <t>","CRON|FIXED_INTERVAL|ONE_TIME|RRULE|WINDOWED").requiredOption("--executor <e>","WEBHOOK|INTERNAL_API|NATS_TOPIC|GRAPHQL").requiredOption("--schedule-config <json>").requiredOption("--executor-config <json>").option("--description <d>").option("--category <c>").option("--public","Make template public").option("-f, --format <format>").action(async e=>{try{let t={name:e.name,scheduleType:e.type.toUpperCase(),executorType:e.executor.toUpperCase(),scheduleConfig:JSON.parse(e.scheduleConfig),executorConfig:JSON.parse(e.executorConfig)};e.description&&(t.description=e.description),e.category&&(t.category=e.category),e.public!==void 0&&(t.isPublic=e.public);let n=await r(G,{workspaceId:C(),input:t});u("Template created"),d(e,n.createScheduleTemplate);}catch(t){i(t);}}),h.command("update").description("Update a schedule template").argument("<id>").option("--name <name>").option("--description <d>").option("--category <c>").option("--public","Toggle public").option("-f, --format <format>").action(async(e,t)=>{try{let n={};if(t.name!==void 0&&(n.name=t.name),t.description!==void 0&&(n.description=t.description),t.category!==void 0&&(n.category=t.category),t.public!==void 0&&(n.isPublic=t.public),Object.keys(n).length===0)throw new l("Provide at least one field to update");let a=await r(B,{id:e,input:n});u("Template updated"),d(t,a.updateScheduleTemplate);}catch(n){i(n);}}),h.command("delete").description("Delete a schedule template").argument("<id>").action(async e=>{try{await r(F,{id:e}),u("Template deleted");}catch(t){i(t);}});let b=c.command("versions").description("Schedule version history");b.command("list").description("List version history for a schedule").argument("<scheduleId>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(V,{scheduleId:e});d(t,n.scheduleVersionHistory,{headers:["ID","Version","ChangedBy","Reason","CreatedAt"],rows:n.scheduleVersionHistory.map(a=>[w(a.id,12),String(a.version),a.changedBy,a.changeReason??"-",E(a.createdAt)])});}catch(n){i(n);}}),b.command("restore").description("Restore a schedule to a prior version").requiredOption("--schedule <id>").requiredOption("--version <id>").option("-f, --format <format>").action(async e=>{try{let t=await r(z,{scheduleId:e.schedule,versionId:e.version});u("Version restored"),d(e,t.restoreScheduleVersion);}catch(t){i(t);}}),ee.command("list").description("List executions for a job").argument("<jobId>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async(e,t)=>{try{let n=await r(R,{jobId:e,pagination:{first:t.limit}});d(t,n.jobExecutions.executions,{headers:["ID","Status","Started","Duration","Success"],rows:n.jobExecutions.executions.map(a=>[w(a.id,12),T(a.status),E(a.startedAt),String(a.duration??"-"),String(!!a.success)])});}catch(n){i(n);}});}var fe={id:"scheduler",version:"1.0.0",displayName:"Scheduler",dependsOn:["auth","workspaces"],register(o,c){v(c),Z(o);}},It=fe;module.exports=It;
|