@agentuity/cli 0.0.105 → 0.0.107
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/cli.d.ts.map +1 -1
- package/dist/cli.js +93 -21
- package/dist/cli.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +130 -4
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +8 -2
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.d.ts +2 -1
- package/dist/cmd/build/vite/metadata-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.js +14 -0
- package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +8 -9
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts +2 -1
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +1 -0
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/build/vite-bundler.d.ts +2 -1
- package/dist/cmd/build/vite-bundler.d.ts.map +1 -1
- package/dist/cmd/build/vite-bundler.js +2 -1
- package/dist/cmd/build/vite-bundler.js.map +1 -1
- package/dist/cmd/cloud/db/create.d.ts.map +1 -1
- package/dist/cmd/cloud/db/create.js +11 -2
- package/dist/cmd/cloud/db/create.js.map +1 -1
- package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/db/delete.js +13 -2
- package/dist/cmd/cloud/db/delete.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +7 -42
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/env/delete.js +1 -1
- package/dist/cmd/cloud/env/delete.js.map +1 -1
- package/dist/cmd/cloud/env/import.js +4 -4
- package/dist/cmd/cloud/env/import.js.map +1 -1
- package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
- package/dist/cmd/cloud/env/pull.js +7 -9
- package/dist/cmd/cloud/env/pull.js.map +1 -1
- package/dist/cmd/cloud/env/push.js +2 -2
- package/dist/cmd/cloud/env/push.js.map +1 -1
- package/dist/cmd/cloud/env/set.js +3 -3
- package/dist/cmd/cloud/env/set.js.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +2 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/cp.js +334 -0
- package/dist/cmd/cloud/sandbox/cp.js.map +1 -0
- package/dist/cmd/cloud/sandbox/create.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/create.js +105 -0
- package/dist/cmd/cloud/sandbox/create.js.map +1 -0
- package/dist/cmd/cloud/sandbox/delete.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/delete.js +72 -0
- package/dist/cmd/cloud/sandbox/delete.js.map +1 -0
- package/dist/cmd/cloud/sandbox/exec.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/exec.js +211 -0
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/get.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/execution/get.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/get.js +96 -0
- package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/index.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/execution/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/index.js +24 -0
- package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/execution/list.js +100 -0
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/get.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/get.js +95 -0
- package/dist/cmd/cloud/sandbox/get.js.map +1 -0
- package/dist/cmd/cloud/sandbox/index.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/index.js +45 -0
- package/dist/cmd/cloud/sandbox/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/list.js +120 -0
- package/dist/cmd/cloud/sandbox/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/run.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/run.js +152 -0
- package/dist/cmd/cloud/sandbox/run.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.js +65 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/delete.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/delete.js +66 -0
- package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.js +154 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/index.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/index.js +27 -0
- package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/list.js +83 -0
- package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/tag.js +63 -0
- package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -0
- package/dist/cmd/cloud/sandbox/util.d.ts +15 -0
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/util.js +50 -0
- package/dist/cmd/cloud/sandbox/util.js.map +1 -0
- package/dist/cmd/cloud/secret/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/secret/delete.js +3 -3
- package/dist/cmd/cloud/secret/delete.js.map +1 -1
- package/dist/cmd/cloud/secret/import.js +6 -6
- package/dist/cmd/cloud/secret/import.js.map +1 -1
- package/dist/cmd/cloud/secret/index.d.ts.map +1 -1
- package/dist/cmd/cloud/secret/index.js +1 -0
- package/dist/cmd/cloud/secret/index.js.map +1 -1
- package/dist/cmd/cloud/secret/pull.d.ts.map +1 -1
- package/dist/cmd/cloud/secret/pull.js +7 -9
- package/dist/cmd/cloud/secret/pull.js.map +1 -1
- package/dist/cmd/cloud/secret/push.js +3 -3
- package/dist/cmd/cloud/secret/push.js.map +1 -1
- package/dist/cmd/cloud/secret/set.d.ts.map +1 -1
- package/dist/cmd/cloud/secret/set.js +3 -3
- package/dist/cmd/cloud/secret/set.js.map +1 -1
- package/dist/cmd/cloud/storage/create.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/create.js +13 -2
- package/dist/cmd/cloud/storage/create.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +13 -2
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/list.js +2 -13
- package/dist/cmd/cloud/stream/list.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +1 -0
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/profile/create.d.ts.map +1 -1
- package/dist/cmd/profile/create.js +1 -0
- package/dist/cmd/profile/create.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +27 -10
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts +0 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/env-util.d.ts +16 -8
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +46 -18
- package/dist/env-util.js.map +1 -1
- package/dist/tui.d.ts +20 -3
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +82 -23
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +42 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +99 -21
- package/src/cmd/build/ast.ts +163 -4
- package/src/cmd/build/entry-generator.ts +8 -2
- package/src/cmd/build/vite/metadata-generator.ts +17 -1
- package/src/cmd/build/vite/registry-generator.ts +8 -11
- package/src/cmd/build/vite/vite-builder.ts +3 -1
- package/src/cmd/build/vite-bundler.ts +4 -1
- package/src/cmd/cloud/db/create.ts +13 -2
- package/src/cmd/cloud/db/delete.ts +15 -2
- package/src/cmd/cloud/deploy.ts +7 -43
- package/src/cmd/cloud/env/delete.ts +1 -1
- package/src/cmd/cloud/env/import.ts +4 -4
- package/src/cmd/cloud/env/pull.ts +7 -16
- package/src/cmd/cloud/env/push.ts +2 -2
- package/src/cmd/cloud/env/set.ts +3 -3
- package/src/cmd/cloud/index.ts +2 -0
- package/src/cmd/cloud/sandbox/cp.ts +531 -0
- package/src/cmd/cloud/sandbox/create.ts +114 -0
- package/src/cmd/cloud/sandbox/delete.ts +80 -0
- package/src/cmd/cloud/sandbox/exec.ts +254 -0
- package/src/cmd/cloud/sandbox/execution/get.ts +106 -0
- package/src/cmd/cloud/sandbox/execution/index.ts +25 -0
- package/src/cmd/cloud/sandbox/execution/list.ts +111 -0
- package/src/cmd/cloud/sandbox/get.ts +104 -0
- package/src/cmd/cloud/sandbox/index.ts +46 -0
- package/src/cmd/cloud/sandbox/list.ts +129 -0
- package/src/cmd/cloud/sandbox/run.ts +170 -0
- package/src/cmd/cloud/sandbox/snapshot/create.ts +71 -0
- package/src/cmd/cloud/sandbox/snapshot/delete.ts +74 -0
- package/src/cmd/cloud/sandbox/snapshot/get.ts +188 -0
- package/src/cmd/cloud/sandbox/snapshot/index.ts +28 -0
- package/src/cmd/cloud/sandbox/snapshot/list.ts +90 -0
- package/src/cmd/cloud/sandbox/snapshot/tag.ts +70 -0
- package/src/cmd/cloud/sandbox/util.ts +59 -0
- package/src/cmd/cloud/secret/delete.ts +8 -3
- package/src/cmd/cloud/secret/import.ts +6 -6
- package/src/cmd/cloud/secret/index.ts +1 -0
- package/src/cmd/cloud/secret/pull.ts +7 -16
- package/src/cmd/cloud/secret/push.ts +3 -3
- package/src/cmd/cloud/secret/set.ts +8 -3
- package/src/cmd/cloud/storage/create.ts +15 -2
- package/src/cmd/cloud/storage/delete.ts +15 -2
- package/src/cmd/cloud/stream/list.ts +2 -9
- package/src/cmd/dev/index.ts +1 -0
- package/src/cmd/profile/create.ts +1 -0
- package/src/cmd/project/template-flow.ts +29 -13
- package/src/config.ts +3 -0
- package/src/env-util.ts +52 -21
- package/src/tui.ts +131 -39
- package/src/types.ts +43 -16
- package/dist/schemas/deploy.d.ts +0 -24
- package/dist/schemas/deploy.d.ts.map +0 -1
- package/dist/schemas/deploy.js +0 -26
- package/dist/schemas/deploy.js.map +0 -1
- package/src/schemas/deploy.ts +0 -28
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { getCommand } from '../../../command-prefix';
|
|
5
|
+
import { sandboxList } from '@agentuity/server';
|
|
6
|
+
import { createSandboxClient } from './util';
|
|
7
|
+
import type { SandboxStatus } from '@agentuity/core';
|
|
8
|
+
|
|
9
|
+
const SandboxInfoSchema = z.object({
|
|
10
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
|
+
status: z.string().describe('Current status'),
|
|
12
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
13
|
+
region: z.string().optional().describe('Region where sandbox is running'),
|
|
14
|
+
snapshotId: z.string().optional().describe('Snapshot ID sandbox was created from'),
|
|
15
|
+
snapshotTag: z.string().optional().describe('Snapshot tag sandbox was created from'),
|
|
16
|
+
executions: z.number().describe('Number of executions'),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const SandboxListResponseSchema = z.object({
|
|
20
|
+
sandboxes: z.array(SandboxInfoSchema).describe('List of sandboxes'),
|
|
21
|
+
total: z.number().describe('Total count'),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const listSubcommand = createCommand({
|
|
25
|
+
name: 'list',
|
|
26
|
+
aliases: ['ls'],
|
|
27
|
+
description: 'List sandboxes with optional filtering',
|
|
28
|
+
tags: ['read-only', 'slow', 'requires-auth'],
|
|
29
|
+
requires: { auth: true, region: true, org: true },
|
|
30
|
+
optional: { project: true },
|
|
31
|
+
idempotent: true,
|
|
32
|
+
pagination: {
|
|
33
|
+
supported: true,
|
|
34
|
+
defaultLimit: 50,
|
|
35
|
+
maxLimit: 100,
|
|
36
|
+
parameters: {
|
|
37
|
+
limit: 'limit',
|
|
38
|
+
offset: 'offset',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
examples: [
|
|
42
|
+
{
|
|
43
|
+
command: getCommand('cloud sandbox list'),
|
|
44
|
+
description: 'List all sandboxes',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
command: getCommand('cloud sandbox list --status running'),
|
|
48
|
+
description: 'List running sandboxes',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
command: getCommand('cloud sandbox list --project-id proj_123'),
|
|
52
|
+
description: 'List sandboxes for a specific project',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
command: getCommand('cloud sandbox list --limit 10 --offset 20'),
|
|
56
|
+
description: 'List with pagination',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
schema: {
|
|
60
|
+
options: z.object({
|
|
61
|
+
status: z
|
|
62
|
+
.enum(['creating', 'idle', 'running', 'terminated', 'failed'])
|
|
63
|
+
.optional()
|
|
64
|
+
.describe('Filter by status'),
|
|
65
|
+
projectId: z.string().optional().describe('Filter by project ID'),
|
|
66
|
+
limit: z.number().optional().describe('Maximum number of results (default: 50, max: 100)'),
|
|
67
|
+
offset: z.number().optional().describe('Pagination offset'),
|
|
68
|
+
}),
|
|
69
|
+
response: SandboxListResponseSchema,
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
async handler(ctx) {
|
|
73
|
+
const { opts, options, auth, project, region, logger, orgId } = ctx;
|
|
74
|
+
const client = createSandboxClient(logger, auth, region);
|
|
75
|
+
|
|
76
|
+
const projectId = opts.projectId || project?.projectId;
|
|
77
|
+
|
|
78
|
+
const result = await sandboxList(client, {
|
|
79
|
+
orgId,
|
|
80
|
+
projectId,
|
|
81
|
+
status: opts.status as SandboxStatus | undefined,
|
|
82
|
+
limit: opts.limit,
|
|
83
|
+
offset: opts.offset,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (!options.json) {
|
|
87
|
+
if (result.sandboxes.length === 0) {
|
|
88
|
+
tui.info('No sandboxes found');
|
|
89
|
+
} else {
|
|
90
|
+
const tableData = result.sandboxes.map((sandbox) => {
|
|
91
|
+
const snapshotDisplay = sandbox.snapshotTag
|
|
92
|
+
? `${sandbox.snapshotTag} (${sandbox.snapshotId})`
|
|
93
|
+
: sandbox.snapshotId || '-';
|
|
94
|
+
return {
|
|
95
|
+
ID: sandbox.sandboxId,
|
|
96
|
+
Status: sandbox.status,
|
|
97
|
+
'Created At': sandbox.createdAt,
|
|
98
|
+
Snapshot: snapshotDisplay,
|
|
99
|
+
Executions: sandbox.executions,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
tui.table(tableData, [
|
|
103
|
+
{ name: 'ID', alignment: 'left' },
|
|
104
|
+
{ name: 'Status', alignment: 'left' },
|
|
105
|
+
{ name: 'Created At', alignment: 'left' },
|
|
106
|
+
{ name: 'Snapshot', alignment: 'left' },
|
|
107
|
+
{ name: 'Executions', alignment: 'right' },
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
tui.info(`Total: ${result.total} ${tui.plural(result.total, 'sandbox', 'sandboxes')}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
sandboxes: result.sandboxes.map((s) => ({
|
|
116
|
+
sandboxId: s.sandboxId,
|
|
117
|
+
status: s.status,
|
|
118
|
+
createdAt: s.createdAt,
|
|
119
|
+
region: s.region,
|
|
120
|
+
snapshotId: s.snapshotId,
|
|
121
|
+
snapshotTag: s.snapshotTag,
|
|
122
|
+
executions: s.executions,
|
|
123
|
+
})),
|
|
124
|
+
total: result.total,
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export default listSubcommand;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
import { createCommand } from '../../../types';
|
|
4
|
+
import * as tui from '../../../tui';
|
|
5
|
+
import { createSandboxClient, parseFileArgs } from './util';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
import { sandboxRun } from '@agentuity/server';
|
|
8
|
+
|
|
9
|
+
const SandboxRunResponseSchema = z.object({
|
|
10
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
|
+
exitCode: z.number().describe('Exit code from the process'),
|
|
12
|
+
durationMs: z.number().describe('Duration in milliseconds'),
|
|
13
|
+
output: z.string().optional().describe('Combined stdout/stderr output'),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const runSubcommand = createCommand({
|
|
17
|
+
name: 'run',
|
|
18
|
+
description: 'Run a one-shot command in a sandbox (creates, executes, destroys)',
|
|
19
|
+
tags: ['slow', 'requires-auth'],
|
|
20
|
+
requires: { auth: true, region: true, org: true },
|
|
21
|
+
examples: [
|
|
22
|
+
{
|
|
23
|
+
command: getCommand('cloud sandbox run -- echo "hello world"'),
|
|
24
|
+
description: 'Run a simple command',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
command: getCommand('cloud sandbox run --memory 1Gi --cpu 1000m -- bun run index.ts'),
|
|
28
|
+
description: 'Run with resource limits',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
command: getCommand('cloud sandbox run --network -- curl https://api.example.com'),
|
|
32
|
+
description: 'Run with network access enabled',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
schema: {
|
|
36
|
+
args: z.object({
|
|
37
|
+
command: z.array(z.string()).describe('Command and arguments to execute'),
|
|
38
|
+
}),
|
|
39
|
+
options: z.object({
|
|
40
|
+
memory: z.string().optional().describe('Memory limit (e.g., "500Mi", "1Gi")'),
|
|
41
|
+
cpu: z.string().optional().describe('CPU limit in millicores (e.g., "500m", "1000m")'),
|
|
42
|
+
disk: z.string().optional().describe('Disk limit (e.g., "500Mi", "1Gi")'),
|
|
43
|
+
network: z.boolean().default(false).optional().describe('Enable outbound network access'),
|
|
44
|
+
timeout: z.string().optional().describe('Execution timeout (e.g., "5m", "1h")'),
|
|
45
|
+
env: z.array(z.string()).optional().describe('Environment variables (KEY=VALUE)'),
|
|
46
|
+
file: z
|
|
47
|
+
.array(z.string())
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Files to create in sandbox (sandbox-path:local-path)'),
|
|
50
|
+
timestamps: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.default(false)
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Include timestamps in output (default: true)'),
|
|
55
|
+
snapshot: z.string().optional().describe('Snapshot ID or tag to restore from'),
|
|
56
|
+
dependency: z
|
|
57
|
+
.array(z.string())
|
|
58
|
+
.optional()
|
|
59
|
+
.describe('Apt packages to install (can be specified multiple times)'),
|
|
60
|
+
}),
|
|
61
|
+
response: SandboxRunResponseSchema,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
async handler(ctx) {
|
|
65
|
+
const { args, opts, options, auth, region, logger, orgId } = ctx;
|
|
66
|
+
const client = createSandboxClient(logger, auth, region);
|
|
67
|
+
const started = Date.now();
|
|
68
|
+
|
|
69
|
+
const envMap: Record<string, string> = {};
|
|
70
|
+
if (opts.env) {
|
|
71
|
+
for (const e of opts.env) {
|
|
72
|
+
const [key, ...valueParts] = e.split('=');
|
|
73
|
+
if (key) {
|
|
74
|
+
envMap[key] = valueParts.join('=');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const files = parseFileArgs(opts.file);
|
|
80
|
+
const hasFiles = files.length > 0;
|
|
81
|
+
|
|
82
|
+
const abortController = new AbortController();
|
|
83
|
+
const handleSignal = () => {
|
|
84
|
+
abortController.abort();
|
|
85
|
+
};
|
|
86
|
+
process.on('SIGINT', handleSignal);
|
|
87
|
+
process.on('SIGTERM', handleSignal);
|
|
88
|
+
|
|
89
|
+
const outputChunks: string[] = [];
|
|
90
|
+
|
|
91
|
+
// Determine if we have stdin data (not a TTY means piped input)
|
|
92
|
+
const hasStdin = !process.stdin.isTTY;
|
|
93
|
+
|
|
94
|
+
// For JSON output, we need to capture output instead of streaming to process
|
|
95
|
+
const stdout = options.json
|
|
96
|
+
? createCaptureStream((chunk) => outputChunks.push(chunk))
|
|
97
|
+
: process.stdout;
|
|
98
|
+
const stderr = options.json
|
|
99
|
+
? createCaptureStream((chunk) => outputChunks.push(chunk))
|
|
100
|
+
: process.stderr;
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
const result = await sandboxRun(client, {
|
|
104
|
+
options: {
|
|
105
|
+
command: {
|
|
106
|
+
exec: args.command,
|
|
107
|
+
files: hasFiles ? files : undefined,
|
|
108
|
+
},
|
|
109
|
+
resources:
|
|
110
|
+
opts.memory || opts.cpu || opts.disk
|
|
111
|
+
? {
|
|
112
|
+
memory: opts.memory,
|
|
113
|
+
cpu: opts.cpu,
|
|
114
|
+
disk: opts.disk,
|
|
115
|
+
}
|
|
116
|
+
: undefined,
|
|
117
|
+
network: opts.network ? { enabled: true } : undefined,
|
|
118
|
+
timeout: opts.timeout ? { execution: opts.timeout } : undefined,
|
|
119
|
+
env: Object.keys(envMap).length > 0 ? envMap : undefined,
|
|
120
|
+
stream: opts.timestamps !== undefined ? { timestamps: opts.timestamps } : undefined,
|
|
121
|
+
snapshot: opts.snapshot,
|
|
122
|
+
dependencies: opts.dependency,
|
|
123
|
+
},
|
|
124
|
+
orgId,
|
|
125
|
+
region,
|
|
126
|
+
apiKey: auth.apiKey,
|
|
127
|
+
signal: abortController.signal,
|
|
128
|
+
stdin: hasStdin ? process.stdin : undefined,
|
|
129
|
+
stdout,
|
|
130
|
+
stderr,
|
|
131
|
+
logger,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const duration = Date.now() - started;
|
|
135
|
+
const output = outputChunks.join('');
|
|
136
|
+
|
|
137
|
+
if (!options.json) {
|
|
138
|
+
if (result.exitCode !== 0) {
|
|
139
|
+
tui.error(`failed with exit code ${result.exitCode} in ${duration}ms`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
sandboxId: result.sandboxId,
|
|
145
|
+
exitCode: result.exitCode,
|
|
146
|
+
durationMs: result.durationMs,
|
|
147
|
+
output: options.json ? output : undefined,
|
|
148
|
+
};
|
|
149
|
+
} finally {
|
|
150
|
+
process.off('SIGINT', handleSignal);
|
|
151
|
+
process.off('SIGTERM', handleSignal);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
function createCaptureStream(onChunk: (chunk: string) => void): Writable {
|
|
157
|
+
return new Writable({
|
|
158
|
+
write(
|
|
159
|
+
chunk: Buffer | string,
|
|
160
|
+
_encoding: string,
|
|
161
|
+
callback: (error?: Error | null) => void
|
|
162
|
+
): void {
|
|
163
|
+
const text = typeof chunk === 'string' ? chunk : chunk.toString('utf-8');
|
|
164
|
+
onChunk(text);
|
|
165
|
+
callback();
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export default runSubcommand;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createSandboxClient } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
import { snapshotCreate } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const SnapshotCreateResponseSchema = z.object({
|
|
9
|
+
snapshotId: z.string().describe('Snapshot ID'),
|
|
10
|
+
sandboxId: z.string().describe('Source sandbox ID'),
|
|
11
|
+
tag: z.string().optional().nullable().describe('Snapshot tag'),
|
|
12
|
+
sizeBytes: z.number().describe('Snapshot size in bytes'),
|
|
13
|
+
fileCount: z.number().describe('Number of files in snapshot'),
|
|
14
|
+
createdAt: z.string().describe('Snapshot creation timestamp'),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const createSubcommand = createCommand({
|
|
18
|
+
name: 'create',
|
|
19
|
+
description: 'Create a snapshot from a sandbox',
|
|
20
|
+
tags: ['slow', 'requires-auth'],
|
|
21
|
+
requires: { auth: true, region: true, org: true },
|
|
22
|
+
examples: [
|
|
23
|
+
{
|
|
24
|
+
command: getCommand('cloud sandbox snapshot create sbx_abc123'),
|
|
25
|
+
description: 'Create a snapshot from a sandbox',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
command: getCommand('cloud sandbox snapshot create sbx_abc123 --tag latest'),
|
|
29
|
+
description: 'Create a tagged snapshot',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
schema: {
|
|
33
|
+
args: z.object({
|
|
34
|
+
sandboxId: z.string().describe('Sandbox ID to snapshot'),
|
|
35
|
+
}),
|
|
36
|
+
options: z.object({
|
|
37
|
+
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
38
|
+
}),
|
|
39
|
+
response: SnapshotCreateResponseSchema,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
async handler(ctx) {
|
|
43
|
+
const { args, opts, options, auth, region, logger, orgId } = ctx;
|
|
44
|
+
const client = createSandboxClient(logger, auth, region);
|
|
45
|
+
|
|
46
|
+
const snapshot = await snapshotCreate(client, {
|
|
47
|
+
sandboxId: args.sandboxId,
|
|
48
|
+
tag: opts.tag,
|
|
49
|
+
orgId,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!options.json) {
|
|
53
|
+
tui.success(`created snapshot ${tui.bold(snapshot.snapshotId)}`);
|
|
54
|
+
tui.info(`Size: ${tui.formatBytes(snapshot.sizeBytes)}, Files: ${snapshot.fileCount}`);
|
|
55
|
+
if (snapshot.tag) {
|
|
56
|
+
tui.info(`Tag: ${snapshot.tag}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
snapshotId: snapshot.snapshotId,
|
|
62
|
+
sandboxId: snapshot.sandboxId,
|
|
63
|
+
tag: snapshot.tag ?? undefined,
|
|
64
|
+
sizeBytes: snapshot.sizeBytes,
|
|
65
|
+
fileCount: snapshot.fileCount,
|
|
66
|
+
createdAt: snapshot.createdAt,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export default createSubcommand;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createSandboxClient } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
import { snapshotDelete } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const SnapshotDeleteResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
snapshotId: z.string().describe('Deleted snapshot ID'),
|
|
11
|
+
message: z.string().optional().describe('Status message'),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const deleteSubcommand = createCommand({
|
|
15
|
+
name: 'delete',
|
|
16
|
+
aliases: ['del', 'rm', 'remove'],
|
|
17
|
+
description: 'Delete a snapshot',
|
|
18
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
19
|
+
requires: { auth: true, region: true, org: true },
|
|
20
|
+
idempotent: true,
|
|
21
|
+
examples: [
|
|
22
|
+
{
|
|
23
|
+
command: getCommand('cloud sandbox snapshot delete snp_abc123'),
|
|
24
|
+
description: 'Delete a snapshot',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
command: getCommand('cloud sandbox snapshot rm snp_abc123 --confirm'),
|
|
28
|
+
description: 'Delete without confirmation prompt',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
schema: {
|
|
32
|
+
args: z.object({
|
|
33
|
+
snapshotId: z.string().describe('Snapshot ID to delete'),
|
|
34
|
+
}),
|
|
35
|
+
options: z.object({
|
|
36
|
+
confirm: z.boolean().optional().default(false).describe('Skip confirmation prompt'),
|
|
37
|
+
}),
|
|
38
|
+
response: SnapshotDeleteResponseSchema,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
async handler(ctx) {
|
|
42
|
+
const { args, options, opts, auth, region, logger, orgId } = ctx;
|
|
43
|
+
|
|
44
|
+
if (!opts.confirm) {
|
|
45
|
+
const confirmed = await tui.confirm(`Delete snapshot "${args.snapshotId}"?`, false);
|
|
46
|
+
if (!confirmed) {
|
|
47
|
+
logger.info('Cancelled');
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
snapshotId: args.snapshotId,
|
|
51
|
+
message: 'Cancelled',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const client = createSandboxClient(logger, auth, region);
|
|
57
|
+
|
|
58
|
+
await snapshotDelete(client, {
|
|
59
|
+
snapshotId: args.snapshotId,
|
|
60
|
+
orgId,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (!options.json) {
|
|
64
|
+
tui.success(`deleted snapshot ${tui.bold(args.snapshotId)}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
snapshotId: args.snapshotId,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export default deleteSubcommand;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createSandboxClient } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
import { snapshotGet, sandboxList } from '@agentuity/server';
|
|
7
|
+
import type { SnapshotFileInfo } from '@agentuity/server';
|
|
8
|
+
import type { SandboxInfo } from '@agentuity/core';
|
|
9
|
+
|
|
10
|
+
const SnapshotFileSchema = z.object({
|
|
11
|
+
path: z.string(),
|
|
12
|
+
size: z.number(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const SandboxInfoSchema = z.object({
|
|
16
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
17
|
+
status: z.string().describe('Current status'),
|
|
18
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
19
|
+
executions: z.number().describe('Number of executions'),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const SnapshotGetResponseSchema = z.object({
|
|
23
|
+
snapshotId: z.string().describe('Snapshot ID'),
|
|
24
|
+
sandboxId: z.string().describe('Source sandbox ID'),
|
|
25
|
+
tag: z.string().nullable().optional().describe('Snapshot tag'),
|
|
26
|
+
sizeBytes: z.number().describe('Snapshot size in bytes'),
|
|
27
|
+
fileCount: z.number().describe('Number of files'),
|
|
28
|
+
parentSnapshotId: z.string().nullable().optional().describe('Parent snapshot ID'),
|
|
29
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
30
|
+
downloadUrl: z.string().optional().describe('Presigned download URL'),
|
|
31
|
+
files: z.array(SnapshotFileSchema).optional().describe('Files in snapshot'),
|
|
32
|
+
sandboxes: z
|
|
33
|
+
.array(SandboxInfoSchema)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Attached sandboxes (idle or running)'),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const getSubcommand = createCommand({
|
|
39
|
+
name: 'get',
|
|
40
|
+
aliases: ['info', 'show'],
|
|
41
|
+
description: 'Get snapshot details',
|
|
42
|
+
tags: ['slow', 'requires-auth'],
|
|
43
|
+
requires: { auth: true, region: true, org: true },
|
|
44
|
+
examples: [
|
|
45
|
+
{
|
|
46
|
+
command: getCommand('cloud sandbox snapshot get snp_abc123'),
|
|
47
|
+
description: 'Get details for a snapshot',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
schema: {
|
|
51
|
+
args: z.object({
|
|
52
|
+
snapshotId: z.string().describe('Snapshot ID'),
|
|
53
|
+
}),
|
|
54
|
+
response: SnapshotGetResponseSchema,
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
async handler(ctx) {
|
|
58
|
+
const { args, options, auth, region, logger, orgId } = ctx;
|
|
59
|
+
const client = createSandboxClient(logger, auth, region);
|
|
60
|
+
|
|
61
|
+
const snapshot = await snapshotGet(client, {
|
|
62
|
+
snapshotId: args.snapshotId,
|
|
63
|
+
orgId,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const sandboxesResult = await sandboxList(client, {
|
|
67
|
+
orgId,
|
|
68
|
+
snapshotId: args.snapshotId,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const activeSandboxes = sandboxesResult.sandboxes.filter(
|
|
72
|
+
(s) => s.status === 'idle' || s.status === 'running'
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (!options.json) {
|
|
76
|
+
tui.info(`Snapshot: ${tui.bold(snapshot.snapshotId)}`);
|
|
77
|
+
console.log(` ${tui.muted('Sandbox:')} ${snapshot.sandboxId}`);
|
|
78
|
+
if (snapshot.tag) {
|
|
79
|
+
console.log(` ${tui.muted('Tag:')} ${snapshot.tag}`);
|
|
80
|
+
}
|
|
81
|
+
console.log(` ${tui.muted('Size:')} ${tui.formatBytes(snapshot.sizeBytes)}`);
|
|
82
|
+
console.log(` ${tui.muted('Files:')} ${snapshot.fileCount}`);
|
|
83
|
+
console.log(` ${tui.muted('Created:')} ${snapshot.createdAt}`);
|
|
84
|
+
if (snapshot.parentSnapshotId) {
|
|
85
|
+
console.log(` ${tui.muted('Parent:')} ${snapshot.parentSnapshotId}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (snapshot.files && snapshot.files.length > 0) {
|
|
89
|
+
console.log('');
|
|
90
|
+
tui.info('Files:');
|
|
91
|
+
printFileTree(snapshot.files);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (activeSandboxes.length > 0) {
|
|
95
|
+
console.log('');
|
|
96
|
+
tui.info(`Attached Sandboxes (${activeSandboxes.length}):`);
|
|
97
|
+
printSandboxTree(activeSandboxes);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
...snapshot,
|
|
103
|
+
sandboxes: activeSandboxes.map((s) => ({
|
|
104
|
+
sandboxId: s.sandboxId,
|
|
105
|
+
status: s.status,
|
|
106
|
+
createdAt: s.createdAt,
|
|
107
|
+
executions: s.executions,
|
|
108
|
+
})),
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
interface TreeNode {
|
|
114
|
+
name: string;
|
|
115
|
+
size?: number;
|
|
116
|
+
isFile: boolean;
|
|
117
|
+
children: Map<string, TreeNode>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function buildFileTree(files: SnapshotFileInfo[]): TreeNode {
|
|
121
|
+
const root: TreeNode = { name: '', isFile: false, children: new Map() };
|
|
122
|
+
|
|
123
|
+
for (const file of files) {
|
|
124
|
+
const parts = file.path.split('/');
|
|
125
|
+
let current = root;
|
|
126
|
+
|
|
127
|
+
for (let i = 0; i < parts.length; i++) {
|
|
128
|
+
const part = parts[i];
|
|
129
|
+
if (!current.children.has(part)) {
|
|
130
|
+
current.children.set(part, {
|
|
131
|
+
name: part,
|
|
132
|
+
isFile: i === parts.length - 1,
|
|
133
|
+
children: new Map(),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
current = current.children.get(part)!;
|
|
137
|
+
|
|
138
|
+
if (i === parts.length - 1) {
|
|
139
|
+
current.size = file.size;
|
|
140
|
+
current.isFile = true;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return root;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function printFileTree(files: SnapshotFileInfo[]): void {
|
|
149
|
+
const tree = buildFileTree(files);
|
|
150
|
+
printTreeNode(tree, ' ');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function printTreeNode(node: TreeNode, prefix: string): void {
|
|
154
|
+
const entries = Array.from(node.children.entries()).sort((a, b) => {
|
|
155
|
+
const aIsDir = !a[1].isFile;
|
|
156
|
+
const bIsDir = !b[1].isFile;
|
|
157
|
+
if (aIsDir !== bIsDir) return aIsDir ? -1 : 1;
|
|
158
|
+
return a[0].localeCompare(b[0]);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
for (let i = 0; i < entries.length; i++) {
|
|
162
|
+
const [, child] = entries[i];
|
|
163
|
+
const isLast = i === entries.length - 1;
|
|
164
|
+
const connector = tui.muted(isLast ? '└── ' : '├── ');
|
|
165
|
+
const sizeStr =
|
|
166
|
+
child.isFile && child.size !== undefined ? ` (${tui.formatBytes(child.size)})` : '';
|
|
167
|
+
|
|
168
|
+
console.log(`${prefix}${connector}${child.name}${sizeStr}`);
|
|
169
|
+
|
|
170
|
+
if (child.children.size > 0) {
|
|
171
|
+
const newPrefix = prefix + (isLast ? ' ' : tui.muted('│ '));
|
|
172
|
+
printTreeNode(child, newPrefix);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function printSandboxTree(sandboxes: SandboxInfo[]): void {
|
|
178
|
+
const sorted = [...sandboxes].sort((a, b) => a.sandboxId.localeCompare(b.sandboxId));
|
|
179
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
180
|
+
const sandbox = sorted[i];
|
|
181
|
+
const isLast = i === sorted.length - 1;
|
|
182
|
+
const connector = tui.muted(isLast ? '└── ' : '├── ');
|
|
183
|
+
const statusColor = sandbox.status === 'running' ? tui.success : tui.muted;
|
|
184
|
+
console.log(` ${connector}${sandbox.sandboxId} ${statusColor(`(${sandbox.status})`)}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createCommand } from '../../../../types';
|
|
2
|
+
import { createSubcommand } from './create';
|
|
3
|
+
import { listSubcommand } from './list';
|
|
4
|
+
import { getSubcommand } from './get';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { tagSubcommand } from './tag';
|
|
7
|
+
import { getCommand } from '../../../../command-prefix';
|
|
8
|
+
|
|
9
|
+
export const snapshotCommand = createCommand({
|
|
10
|
+
name: 'snapshot',
|
|
11
|
+
aliases: ['snap'],
|
|
12
|
+
description: 'Manage sandbox snapshots',
|
|
13
|
+
tags: ['slow', 'requires-auth'],
|
|
14
|
+
examples: [
|
|
15
|
+
{
|
|
16
|
+
command: getCommand('cloud sandbox snapshot create <sandbox-id>'),
|
|
17
|
+
description: 'Create a snapshot from a sandbox',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
command: getCommand('cloud sandbox snapshot list'),
|
|
21
|
+
description: 'List all snapshots',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
subcommands: [createSubcommand, listSubcommand, getSubcommand, deleteSubcommand, tagSubcommand],
|
|
25
|
+
requires: { auth: true, region: true, org: true },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default snapshotCommand;
|