@agentuity/cli 1.0.23 → 1.0.24
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/cmd/cloud/db/index.d.ts.map +1 -1
- package/dist/cmd/cloud/db/index.js +2 -0
- package/dist/cmd/cloud/db/index.js.map +1 -1
- package/dist/cmd/cloud/db/stats.d.ts +3 -0
- package/dist/cmd/cloud/db/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/db/stats.js +66 -0
- package/dist/cmd/cloud/db/stats.js.map +1 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -1
- package/dist/cmd/cloud/email/create.js +14 -6
- package/dist/cmd/cloud/email/create.js.map +1 -1
- package/dist/cmd/cloud/email/delete.js +1 -1
- package/dist/cmd/cloud/email/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/delete.js +1 -1
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/list.js +1 -1
- package/dist/cmd/cloud/email/destination/list.js.map +1 -1
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -1
- package/dist/cmd/cloud/email/destination/url.js +5 -4
- package/dist/cmd/cloud/email/destination/url.js.map +1 -1
- package/dist/cmd/cloud/email/get.js +1 -1
- package/dist/cmd/cloud/email/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.js +2 -3
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.js +1 -3
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.js +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/index.d.ts.map +1 -1
- package/dist/cmd/cloud/email/index.js +2 -0
- package/dist/cmd/cloud/email/index.js.map +1 -1
- package/dist/cmd/cloud/email/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/list.js +9 -2
- package/dist/cmd/cloud/email/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/get.js +4 -4
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/list.js +3 -3
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/send.d.ts.map +1 -1
- package/dist/cmd/cloud/email/send.js +8 -10
- package/dist/cmd/cloud/email/send.js.map +1 -1
- package/dist/cmd/cloud/email/stats.d.ts +3 -0
- package/dist/cmd/cloud/email/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/email/stats.js +65 -0
- package/dist/cmd/cloud/email/stats.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +4 -7
- package/dist/cmd/cloud/email/util.d.ts.map +1 -1
- package/dist/cmd/cloud/email/util.js +8 -23
- package/dist/cmd/cloud/email/util.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/queue/get.js +4 -4
- package/dist/cmd/cloud/queue/get.js.map +1 -1
- package/dist/cmd/cloud/queue/receive.d.ts.map +1 -1
- package/dist/cmd/cloud/queue/receive.js +11 -7
- package/dist/cmd/cloud/queue/receive.js.map +1 -1
- package/dist/cmd/cloud/queue/stats.js +3 -3
- package/dist/cmd/cloud/queue/stats.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js +71 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js +78 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts +2 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js +33 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js +72 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js +61 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js.map +1 -0
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +5 -3
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/index.js +4 -0
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +9 -9
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +3 -3
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/stats.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/stats.js +72 -0
- package/dist/cmd/cloud/sandbox/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/create.js +3 -4
- package/dist/cmd/cloud/schedule/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delete.js +2 -3
- package/dist/cmd/cloud/schedule/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.js +3 -4
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.js +2 -3
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.js +7 -4
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.js +2 -3
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/get.js +15 -13
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.js +13 -9
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/get.js +15 -11
- package/dist/cmd/cloud/schedule/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/index.js +2 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -1
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/list.js +2 -3
- package/dist/cmd/cloud/schedule/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/stats.d.ts +3 -0
- package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/stats.js +64 -0
- package/dist/cmd/cloud/schedule/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +5 -5
- package/dist/cmd/cloud/schedule/update.js.map +1 -1
- package/dist/cmd/cloud/schedule/util.d.ts +4 -5
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/util.js +6 -6
- package/dist/cmd/cloud/schedule/util.js.map +1 -1
- package/dist/cmd/cloud/services/index.d.ts +3 -0
- package/dist/cmd/cloud/services/index.d.ts.map +1 -0
- package/dist/cmd/cloud/services/index.js +10 -0
- package/dist/cmd/cloud/services/index.js.map +1 -0
- package/dist/cmd/cloud/services/stats.d.ts +3 -0
- package/dist/cmd/cloud/services/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/services/stats.js +153 -0
- package/dist/cmd/cloud/services/stats.js.map +1 -0
- package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/index.js +2 -1
- package/dist/cmd/cloud/stream/index.js.map +1 -1
- package/dist/cmd/cloud/stream/stats.d.ts +3 -0
- package/dist/cmd/cloud/stream/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/stream/stats.js +64 -0
- package/dist/cmd/cloud/stream/stats.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -1
- package/dist/cmd/cloud/task/create.js +0 -1
- package/dist/cmd/cloud/task/create.js.map +1 -1
- package/dist/cmd/cloud/task/get.d.ts.map +1 -1
- package/dist/cmd/cloud/task/get.js +4 -3
- package/dist/cmd/cloud/task/get.js.map +1 -1
- package/dist/cmd/cloud/task/index.d.ts.map +1 -1
- package/dist/cmd/cloud/task/index.js +2 -1
- package/dist/cmd/cloud/task/index.js.map +1 -1
- package/dist/cmd/cloud/task/list.d.ts.map +1 -1
- package/dist/cmd/cloud/task/list.js +1 -2
- package/dist/cmd/cloud/task/list.js.map +1 -1
- package/dist/cmd/cloud/task/stats.d.ts +3 -0
- package/dist/cmd/cloud/task/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/task/stats.js +66 -0
- package/dist/cmd/cloud/task/stats.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -1
- package/dist/cmd/cloud/task/update.js +0 -1
- package/dist/cmd/cloud/task/update.js.map +1 -1
- package/dist/cmd/cloud/task/util.d.ts +4 -7
- package/dist/cmd/cloud/task/util.d.ts.map +1 -1
- package/dist/cmd/cloud/task/util.js +6 -10
- package/dist/cmd/cloud/task/util.js.map +1 -1
- package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/get.js +17 -12
- package/dist/cmd/cloud/vector/get.js.map +1 -1
- package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/stats.js +10 -7
- package/dist/cmd/cloud/vector/stats.js.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.js +9 -3
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.js +20 -9
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -1
- package/dist/cmd/cloud/webhook/get.js +2 -2
- package/dist/cmd/cloud/webhook/get.js.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.js +19 -3
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -1
- package/dist/tui.d.ts +4 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +8 -0
- package/dist/tui.js.map +1 -1
- package/package.json +6 -6
- package/src/cmd/cloud/db/index.ts +2 -0
- package/src/cmd/cloud/db/stats.ts +80 -0
- package/src/cmd/cloud/email/create.ts +16 -6
- package/src/cmd/cloud/email/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/list.ts +1 -1
- package/src/cmd/cloud/email/destination/url.ts +5 -4
- package/src/cmd/cloud/email/get.ts +1 -1
- package/src/cmd/cloud/email/inbound/get.ts +2 -3
- package/src/cmd/cloud/email/inbound/list.ts +1 -3
- package/src/cmd/cloud/email/inbound/schemas.ts +3 -1
- package/src/cmd/cloud/email/index.ts +2 -0
- package/src/cmd/cloud/email/list.ts +9 -2
- package/src/cmd/cloud/email/outbound/get.ts +4 -4
- package/src/cmd/cloud/email/outbound/list.ts +3 -3
- package/src/cmd/cloud/email/outbound/schemas.ts +2 -2
- package/src/cmd/cloud/email/send.ts +8 -10
- package/src/cmd/cloud/email/stats.ts +77 -0
- package/src/cmd/cloud/email/util.ts +10 -29
- package/src/cmd/cloud/index.ts +2 -0
- package/src/cmd/cloud/queue/get.ts +4 -4
- package/src/cmd/cloud/queue/receive.ts +15 -7
- package/src/cmd/cloud/queue/stats.ts +3 -3
- package/src/cmd/cloud/sandbox/checkpoint/create.ts +85 -0
- package/src/cmd/cloud/sandbox/checkpoint/delete.ts +93 -0
- package/src/cmd/cloud/sandbox/checkpoint/index.ts +33 -0
- package/src/cmd/cloud/sandbox/checkpoint/list.ts +83 -0
- package/src/cmd/cloud/sandbox/checkpoint/restore.ts +72 -0
- package/src/cmd/cloud/sandbox/get.ts +6 -3
- package/src/cmd/cloud/sandbox/index.ts +4 -0
- package/src/cmd/cloud/sandbox/snapshot/build.ts +9 -9
- package/src/cmd/cloud/sandbox/snapshot/get.ts +3 -3
- package/src/cmd/cloud/sandbox/stats.ts +86 -0
- package/src/cmd/cloud/schedule/create.ts +3 -4
- package/src/cmd/cloud/schedule/delete.ts +2 -3
- package/src/cmd/cloud/schedule/delivery/get.ts +3 -4
- package/src/cmd/cloud/schedule/delivery/list.ts +2 -3
- package/src/cmd/cloud/schedule/destination/create.ts +8 -4
- package/src/cmd/cloud/schedule/destination/delete.ts +2 -3
- package/src/cmd/cloud/schedule/destination/get.ts +17 -17
- package/src/cmd/cloud/schedule/destination/list.ts +15 -10
- package/src/cmd/cloud/schedule/get.ts +17 -12
- package/src/cmd/cloud/schedule/index.ts +2 -0
- package/src/cmd/cloud/schedule/list.ts +2 -3
- package/src/cmd/cloud/schedule/stats.ts +74 -0
- package/src/cmd/cloud/schedule/update.ts +5 -5
- package/src/cmd/cloud/schedule/util.ts +13 -18
- package/src/cmd/cloud/services/index.ts +11 -0
- package/src/cmd/cloud/services/stats.ts +225 -0
- package/src/cmd/cloud/stream/index.ts +2 -1
- package/src/cmd/cloud/stream/stats.ts +74 -0
- package/src/cmd/cloud/task/create.ts +0 -1
- package/src/cmd/cloud/task/get.ts +5 -4
- package/src/cmd/cloud/task/index.ts +2 -1
- package/src/cmd/cloud/task/list.ts +1 -2
- package/src/cmd/cloud/task/stats.ts +74 -0
- package/src/cmd/cloud/task/update.ts +0 -1
- package/src/cmd/cloud/task/util.ts +12 -24
- package/src/cmd/cloud/vector/get.ts +16 -11
- package/src/cmd/cloud/vector/stats.ts +10 -8
- package/src/cmd/cloud/webhook/deliveries.ts +16 -3
- package/src/cmd/cloud/webhook/destinations.ts +22 -9
- package/src/cmd/cloud/webhook/get.ts +2 -2
- package/src/cmd/cloud/webhook/receipts.ts +16 -3
- package/src/tui.ts +9 -0
|
@@ -0,0 +1,72 @@
|
|
|
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 { sandboxResolve, diskCheckpointRestore } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const CheckpointRestoreResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
|
+
checkpointId: z.string().describe('Restored checkpoint ID'),
|
|
12
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const restoreSubcommand = createCommand({
|
|
16
|
+
name: 'restore',
|
|
17
|
+
description: 'Restore a sandbox to a disk checkpoint',
|
|
18
|
+
tags: ['slow', 'requires-auth'],
|
|
19
|
+
requires: { auth: true, apiClient: true },
|
|
20
|
+
idempotent: false,
|
|
21
|
+
examples: [
|
|
22
|
+
{
|
|
23
|
+
command: getCommand('cloud sandbox checkpoint restore sbx_abc123 ckpt_def456'),
|
|
24
|
+
description: 'Restore a sandbox to a checkpoint by ID',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
command: getCommand('cloud sandbox checkpoint restore sbx_abc123 my-checkpoint'),
|
|
28
|
+
description: 'Restore a sandbox to a checkpoint by name',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
schema: {
|
|
32
|
+
args: z.object({
|
|
33
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
34
|
+
checkpointId: z.string().describe('Checkpoint ID or name'),
|
|
35
|
+
}),
|
|
36
|
+
options: z.object({}),
|
|
37
|
+
response: CheckpointRestoreResponseSchema,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
async handler(ctx) {
|
|
41
|
+
const { args, options, auth, logger, apiClient } = ctx;
|
|
42
|
+
|
|
43
|
+
const started = Date.now();
|
|
44
|
+
|
|
45
|
+
// Resolve sandbox to get region and orgId using CLI API
|
|
46
|
+
const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
|
|
47
|
+
|
|
48
|
+
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
49
|
+
|
|
50
|
+
await diskCheckpointRestore(client, {
|
|
51
|
+
sandboxId: args.sandboxId,
|
|
52
|
+
checkpointId: args.checkpointId,
|
|
53
|
+
orgId: sandboxInfo.orgId,
|
|
54
|
+
});
|
|
55
|
+
const durationMs = Date.now() - started;
|
|
56
|
+
|
|
57
|
+
if (!options.json) {
|
|
58
|
+
tui.success(
|
|
59
|
+
`restored sandbox ${tui.bold(args.sandboxId)} to checkpoint ${tui.bold(args.checkpointId)} in ${durationMs}ms`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
sandboxId: args.sandboxId,
|
|
66
|
+
checkpointId: args.checkpointId,
|
|
67
|
+
durationMs,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export default restoreSubcommand;
|
|
@@ -147,14 +147,17 @@ export const getSubcommand = createCommand({
|
|
|
147
147
|
if (resourceParts.length > 0) {
|
|
148
148
|
tableData['Resources'] = resourceParts.join(', ');
|
|
149
149
|
}
|
|
150
|
-
if (result.metadata && Object.keys(result.metadata).length > 0) {
|
|
151
|
-
tableData['Metadata'] = JSON.stringify(result.metadata);
|
|
152
|
-
}
|
|
153
150
|
if (result.url) {
|
|
154
151
|
tableData['URL'] = tui.link(result.url);
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
155
|
+
|
|
156
|
+
if (result.metadata && Object.keys(result.metadata).length > 0) {
|
|
157
|
+
tui.newline();
|
|
158
|
+
tui.header('Metadata');
|
|
159
|
+
tui.json(result.metadata);
|
|
160
|
+
}
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
return {
|
|
@@ -18,6 +18,8 @@ import { uploadSubcommand } from './upload';
|
|
|
18
18
|
import { envSubcommand } from './env';
|
|
19
19
|
import { pauseSubcommand } from './pause';
|
|
20
20
|
import { resumeSubcommand } from './resume';
|
|
21
|
+
import { checkpointCommand } from './checkpoint';
|
|
22
|
+
import { statsSubcommand } from './stats';
|
|
21
23
|
import { getCommand } from '../../../command-prefix';
|
|
22
24
|
|
|
23
25
|
export const command = createCommand({
|
|
@@ -59,6 +61,8 @@ export const command = createCommand({
|
|
|
59
61
|
envSubcommand,
|
|
60
62
|
pauseSubcommand,
|
|
61
63
|
resumeSubcommand,
|
|
64
|
+
checkpointCommand,
|
|
65
|
+
statsSubcommand,
|
|
62
66
|
],
|
|
63
67
|
requires: { auth: true, org: true },
|
|
64
68
|
});
|
|
@@ -676,7 +676,7 @@ export const buildSubcommand = createCommand({
|
|
|
676
676
|
|
|
677
677
|
if (buildConfig.dependencies && buildConfig.dependencies.length > 0) {
|
|
678
678
|
console.log('');
|
|
679
|
-
tui.
|
|
679
|
+
tui.header('Dependencies');
|
|
680
680
|
for (const dep of buildConfig.dependencies) {
|
|
681
681
|
console.log(` ${tui.muted('•')} ${dep}`);
|
|
682
682
|
}
|
|
@@ -684,7 +684,7 @@ export const buildSubcommand = createCommand({
|
|
|
684
684
|
|
|
685
685
|
if (buildConfig.packages && buildConfig.packages.length > 0) {
|
|
686
686
|
console.log('');
|
|
687
|
-
tui.
|
|
687
|
+
tui.header('Packages (npm/bun)');
|
|
688
688
|
for (const pkg of buildConfig.packages) {
|
|
689
689
|
console.log(` ${tui.muted('•')} ${pkg}`);
|
|
690
690
|
}
|
|
@@ -692,7 +692,7 @@ export const buildSubcommand = createCommand({
|
|
|
692
692
|
|
|
693
693
|
if (finalEnv && Object.keys(finalEnv).length > 0) {
|
|
694
694
|
console.log('');
|
|
695
|
-
tui.
|
|
695
|
+
tui.header('Environment');
|
|
696
696
|
for (const [envKey, envValue] of Object.entries(finalEnv)) {
|
|
697
697
|
console.log(` ${tui.muted('•')} ${envKey}=${tui.maskSecret(envValue)}`);
|
|
698
698
|
}
|
|
@@ -700,7 +700,7 @@ export const buildSubcommand = createCommand({
|
|
|
700
700
|
|
|
701
701
|
if (fileList.length > 0) {
|
|
702
702
|
console.log('');
|
|
703
|
-
tui.
|
|
703
|
+
tui.header('Files');
|
|
704
704
|
printFileTree(fileList);
|
|
705
705
|
}
|
|
706
706
|
}
|
|
@@ -980,7 +980,7 @@ export const buildSubcommand = createCommand({
|
|
|
980
980
|
|
|
981
981
|
if (buildConfig.dependencies && buildConfig.dependencies.length > 0) {
|
|
982
982
|
console.log('');
|
|
983
|
-
tui.
|
|
983
|
+
tui.header('Dependencies');
|
|
984
984
|
for (const dep of buildConfig.dependencies) {
|
|
985
985
|
console.log(` ${tui.muted('•')} ${dep}`);
|
|
986
986
|
}
|
|
@@ -988,7 +988,7 @@ export const buildSubcommand = createCommand({
|
|
|
988
988
|
|
|
989
989
|
if (buildConfig.packages && buildConfig.packages.length > 0) {
|
|
990
990
|
console.log('');
|
|
991
|
-
tui.
|
|
991
|
+
tui.header('Packages (npm/bun)');
|
|
992
992
|
for (const pkg of buildConfig.packages) {
|
|
993
993
|
console.log(` ${tui.muted('•')} ${pkg}`);
|
|
994
994
|
}
|
|
@@ -996,7 +996,7 @@ export const buildSubcommand = createCommand({
|
|
|
996
996
|
|
|
997
997
|
if (finalEnv && Object.keys(finalEnv).length > 0) {
|
|
998
998
|
console.log('');
|
|
999
|
-
tui.
|
|
999
|
+
tui.header('Environment');
|
|
1000
1000
|
for (const [envKey, envValue] of Object.entries(finalEnv)) {
|
|
1001
1001
|
console.log(` ${tui.muted('•')} ${envKey}=${tui.maskSecret(envValue)}`);
|
|
1002
1002
|
}
|
|
@@ -1004,7 +1004,7 @@ export const buildSubcommand = createCommand({
|
|
|
1004
1004
|
|
|
1005
1005
|
if (finalMetadata && Object.keys(finalMetadata).length > 0) {
|
|
1006
1006
|
console.log('');
|
|
1007
|
-
tui.
|
|
1007
|
+
tui.header('Metadata');
|
|
1008
1008
|
for (const key of Object.keys(finalMetadata)) {
|
|
1009
1009
|
console.log(` ${tui.muted('•')} ${key}=${finalMetadata[key]}`);
|
|
1010
1010
|
}
|
|
@@ -1012,7 +1012,7 @@ export const buildSubcommand = createCommand({
|
|
|
1012
1012
|
|
|
1013
1013
|
if (snapshot.files && snapshot.files.length > 0) {
|
|
1014
1014
|
console.log('');
|
|
1015
|
-
tui.
|
|
1015
|
+
tui.header('Files');
|
|
1016
1016
|
printFileTree(snapshot.files);
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
@@ -138,7 +138,7 @@ export const getSubcommand = createCommand({
|
|
|
138
138
|
Object.keys(snapshot.userMetadata).length > 0
|
|
139
139
|
) {
|
|
140
140
|
console.log('');
|
|
141
|
-
tui.
|
|
141
|
+
tui.header('Metadata');
|
|
142
142
|
for (const [key, value] of Object.entries(snapshot.userMetadata)) {
|
|
143
143
|
console.log(` ${tui.muted('•')} ${key}=${value}`);
|
|
144
144
|
}
|
|
@@ -146,13 +146,13 @@ export const getSubcommand = createCommand({
|
|
|
146
146
|
|
|
147
147
|
if (snapshot.files && snapshot.files.length > 0) {
|
|
148
148
|
console.log('');
|
|
149
|
-
tui.
|
|
149
|
+
tui.header('Files');
|
|
150
150
|
printFileTree(snapshot.files);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
if (activeSandboxes.length > 0) {
|
|
154
154
|
console.log('');
|
|
155
|
-
tui.
|
|
155
|
+
tui.header(`Attached Sandboxes (${activeSandboxes.length}):`);
|
|
156
156
|
printSandboxTree(activeSandboxes);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { getServiceStats, type ServiceStatsData } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
function formatNumber(n: number): string {
|
|
9
|
+
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
|
10
|
+
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`;
|
|
11
|
+
return String(n);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function formatLatency(ms: number): string {
|
|
15
|
+
if (ms >= 1000) return `${(ms / 1000).toFixed(1)}s`;
|
|
16
|
+
return `${Math.round(ms)}ms`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function displayStats(data: ServiceStatsData): void {
|
|
20
|
+
const svc = data.services.sandbox;
|
|
21
|
+
if (!svc) {
|
|
22
|
+
tui.info('No sandbox data found.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
tui.header('Sandbox Statistics');
|
|
26
|
+
tui.newline();
|
|
27
|
+
console.log(
|
|
28
|
+
` ${tui.muted('Active:')} ${formatNumber(svc.totalActive)} (${svc.running} running, ${svc.idle} idle, ${svc.creating} creating)`
|
|
29
|
+
);
|
|
30
|
+
console.log(
|
|
31
|
+
` ${tui.muted('Executions:')} ${formatNumber(svc.totalExecutions)}`
|
|
32
|
+
);
|
|
33
|
+
console.log(` ${tui.muted('CPU Time:')} ${formatLatency(svc.totalCpuTimeMs)}`);
|
|
34
|
+
console.log(
|
|
35
|
+
` ${tui.muted('Memory:')} ${tui.formatBytes(svc.totalMemoryByteSec)}`
|
|
36
|
+
);
|
|
37
|
+
console.log(
|
|
38
|
+
` ${tui.muted('Network Out:')} ${tui.formatBytes(svc.totalNetworkEgressBytes)}`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const statsSubcommand = createCommand({
|
|
43
|
+
name: 'stats',
|
|
44
|
+
description: 'View sandbox statistics',
|
|
45
|
+
tags: ['read-only', 'requires-auth'],
|
|
46
|
+
requires: { auth: true, org: true },
|
|
47
|
+
examples: [
|
|
48
|
+
{
|
|
49
|
+
command: getCommand('cloud sandbox stats'),
|
|
50
|
+
description: 'View sandbox statistics',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
schema: {
|
|
54
|
+
options: z.object({
|
|
55
|
+
start: z.string().optional().describe('Start time (ISO 8601)'),
|
|
56
|
+
end: z.string().optional().describe('End time (ISO 8601)'),
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
idempotent: true,
|
|
60
|
+
|
|
61
|
+
async handler(ctx) {
|
|
62
|
+
const { opts, options } = ctx;
|
|
63
|
+
const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
64
|
+
const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
|
|
65
|
+
|
|
66
|
+
if (!orgId) {
|
|
67
|
+
ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const data = await getServiceStats(client, orgId, {
|
|
72
|
+
service: 'sandbox',
|
|
73
|
+
start: opts.start,
|
|
74
|
+
end: opts.end,
|
|
75
|
+
orgIdHeader: orgId,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!options.json) {
|
|
79
|
+
displayStats(data);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return data;
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export default statsSubcommand;
|
|
@@ -32,8 +32,7 @@ export const createSubcommand = createCommand({
|
|
|
32
32
|
name: 'create',
|
|
33
33
|
description: 'Create a schedule',
|
|
34
34
|
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
35
|
-
requires: { auth: true
|
|
36
|
-
optional: { project: true },
|
|
35
|
+
requires: { auth: true },
|
|
37
36
|
examples: [
|
|
38
37
|
{
|
|
39
38
|
command: getCommand("cloud schedule create --name nightly --expression '0 0 * * *'"),
|
|
@@ -51,7 +50,7 @@ export const createSubcommand = createCommand({
|
|
|
51
50
|
|
|
52
51
|
async handler(ctx) {
|
|
53
52
|
const { opts, options } = ctx;
|
|
54
|
-
const schedule = createScheduleAdapter(ctx);
|
|
53
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
55
54
|
const result = await schedule.create({
|
|
56
55
|
name: opts.name,
|
|
57
56
|
expression: opts.expression,
|
|
@@ -66,7 +65,7 @@ export const createSubcommand = createCommand({
|
|
|
66
65
|
Name: result.schedule.name,
|
|
67
66
|
ID: result.schedule.id,
|
|
68
67
|
Expression: result.schedule.expression,
|
|
69
|
-
Description: result.schedule.description
|
|
68
|
+
Description: result.schedule.description || '-',
|
|
70
69
|
'Next Due': result.schedule.due_date,
|
|
71
70
|
Created: new Date(result.schedule.created_at).toLocaleString(),
|
|
72
71
|
},
|
|
@@ -14,8 +14,7 @@ export const deleteSubcommand = createCommand({
|
|
|
14
14
|
aliases: ['rm'],
|
|
15
15
|
description: 'Delete a schedule',
|
|
16
16
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
17
|
-
requires: { auth: true
|
|
18
|
-
optional: { project: true },
|
|
17
|
+
requires: { auth: true },
|
|
19
18
|
idempotent: true,
|
|
20
19
|
examples: [
|
|
21
20
|
{ command: getCommand('cloud schedule delete sched_abc123'), description: 'Delete a schedule' },
|
|
@@ -29,7 +28,7 @@ export const deleteSubcommand = createCommand({
|
|
|
29
28
|
|
|
30
29
|
async handler(ctx) {
|
|
31
30
|
const { args, options } = ctx;
|
|
32
|
-
const schedule = createScheduleAdapter(ctx);
|
|
31
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
33
32
|
await schedule.delete(args.schedule_id);
|
|
34
33
|
|
|
35
34
|
if (!options.json) {
|
|
@@ -21,8 +21,7 @@ export const getSubcommand = createCommand({
|
|
|
21
21
|
name: 'get',
|
|
22
22
|
description: 'Get delivery details',
|
|
23
23
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
24
|
-
requires: { auth: true
|
|
25
|
-
optional: { project: true },
|
|
24
|
+
requires: { auth: true },
|
|
26
25
|
idempotent: true,
|
|
27
26
|
examples: [
|
|
28
27
|
{
|
|
@@ -52,7 +51,7 @@ export const getSubcommand = createCommand({
|
|
|
52
51
|
|
|
53
52
|
async handler(ctx) {
|
|
54
53
|
const { args, opts, options } = ctx;
|
|
55
|
-
const schedule = createScheduleAdapter(ctx);
|
|
54
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
56
55
|
const delivery = await schedule.getDelivery(args.schedule_id, args.delivery_id, {
|
|
57
56
|
limit: opts.limit,
|
|
58
57
|
offset: opts.offset,
|
|
@@ -73,7 +72,7 @@ export const getSubcommand = createCommand({
|
|
|
73
72
|
|
|
74
73
|
if (delivery.response) {
|
|
75
74
|
tui.newline();
|
|
76
|
-
tui.
|
|
75
|
+
tui.header('Response');
|
|
77
76
|
tui.json(delivery.response);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
@@ -24,8 +24,7 @@ export const listSubcommand = createCommand({
|
|
|
24
24
|
aliases: ['ls'],
|
|
25
25
|
description: 'List deliveries for a schedule',
|
|
26
26
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
27
|
-
requires: { auth: true
|
|
28
|
-
optional: { project: true },
|
|
27
|
+
requires: { auth: true },
|
|
29
28
|
idempotent: true,
|
|
30
29
|
examples: [
|
|
31
30
|
{
|
|
@@ -46,7 +45,7 @@ export const listSubcommand = createCommand({
|
|
|
46
45
|
|
|
47
46
|
async handler(ctx) {
|
|
48
47
|
const { args, opts, options } = ctx;
|
|
49
|
-
const schedule = createScheduleAdapter(ctx);
|
|
48
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
50
49
|
const result = await schedule.listDeliveries(args.schedule_id, {
|
|
51
50
|
limit: opts.limit,
|
|
52
51
|
offset: opts.offset,
|
|
@@ -20,8 +20,7 @@ export const createSubcommand = createCommand({
|
|
|
20
20
|
name: 'create',
|
|
21
21
|
description: 'Create destination for a schedule',
|
|
22
22
|
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
23
|
-
requires: { auth: true
|
|
24
|
-
optional: { project: true },
|
|
23
|
+
requires: { auth: true },
|
|
25
24
|
examples: [
|
|
26
25
|
{
|
|
27
26
|
command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
|
|
@@ -48,7 +47,7 @@ export const createSubcommand = createCommand({
|
|
|
48
47
|
|
|
49
48
|
async handler(ctx) {
|
|
50
49
|
const { args, opts, options } = ctx;
|
|
51
|
-
const schedule = createScheduleAdapter(ctx);
|
|
50
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
52
51
|
|
|
53
52
|
if (args.type === 'sandbox' && !args.target.startsWith('sbx_')) {
|
|
54
53
|
tui.fatal('Sandbox target must start with "sbx_"');
|
|
@@ -95,12 +94,17 @@ export const createSubcommand = createCommand({
|
|
|
95
94
|
{
|
|
96
95
|
ID: result.destination.id,
|
|
97
96
|
Type: result.destination.type,
|
|
98
|
-
Config: JSON.stringify(result.destination.config),
|
|
99
97
|
},
|
|
100
98
|
],
|
|
101
99
|
undefined,
|
|
102
100
|
{ layout: 'vertical' }
|
|
103
101
|
);
|
|
102
|
+
|
|
103
|
+
if (result.destination.config && Object.keys(result.destination.config).length > 0) {
|
|
104
|
+
tui.newline();
|
|
105
|
+
tui.header('Config');
|
|
106
|
+
tui.json(result.destination.config);
|
|
107
|
+
}
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
return result;
|
|
@@ -14,8 +14,7 @@ export const deleteSubcommand = createCommand({
|
|
|
14
14
|
aliases: ['rm'],
|
|
15
15
|
description: 'Delete a destination',
|
|
16
16
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
17
|
-
requires: { auth: true
|
|
18
|
-
optional: { project: true },
|
|
17
|
+
requires: { auth: true },
|
|
19
18
|
idempotent: true,
|
|
20
19
|
examples: [
|
|
21
20
|
{
|
|
@@ -32,7 +31,7 @@ export const deleteSubcommand = createCommand({
|
|
|
32
31
|
|
|
33
32
|
async handler(ctx) {
|
|
34
33
|
const { args, options } = ctx;
|
|
35
|
-
const schedule = createScheduleAdapter(ctx);
|
|
34
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
36
35
|
await schedule.deleteDestination(args.destination_id);
|
|
37
36
|
|
|
38
37
|
if (!options.json) {
|
|
@@ -20,8 +20,7 @@ export const getSubcommand = createCommand({
|
|
|
20
20
|
name: 'get',
|
|
21
21
|
description: 'Get destination details',
|
|
22
22
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
23
|
-
requires: { auth: true
|
|
24
|
-
optional: { project: true },
|
|
23
|
+
requires: { auth: true },
|
|
25
24
|
idempotent: true,
|
|
26
25
|
examples: [
|
|
27
26
|
{
|
|
@@ -39,24 +38,25 @@ export const getSubcommand = createCommand({
|
|
|
39
38
|
|
|
40
39
|
async handler(ctx) {
|
|
41
40
|
const { args, options } = ctx;
|
|
42
|
-
const schedule = createScheduleAdapter(ctx);
|
|
41
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
43
42
|
const destination = await schedule.getDestination(args.schedule_id, args.destination_id);
|
|
44
43
|
|
|
45
44
|
if (!options.json) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
const details: Record<string, unknown> = {
|
|
46
|
+
ID: destination.id,
|
|
47
|
+
'Schedule ID': destination.schedule_id,
|
|
48
|
+
Type: destination.type,
|
|
49
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
50
|
+
Updated: new Date(destination.updated_at).toLocaleString(),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
tui.table([details], undefined, { layout: 'vertical' });
|
|
54
|
+
|
|
55
|
+
if (destination.config && Object.keys(destination.config).length > 0) {
|
|
56
|
+
tui.newline();
|
|
57
|
+
tui.header('Config');
|
|
58
|
+
tui.json(destination.config);
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return { destination };
|
|
@@ -23,8 +23,7 @@ export const listSubcommand = createCommand({
|
|
|
23
23
|
aliases: ['ls'],
|
|
24
24
|
description: 'List destinations for a schedule',
|
|
25
25
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
26
|
-
requires: { auth: true
|
|
27
|
-
optional: { project: true },
|
|
26
|
+
requires: { auth: true },
|
|
28
27
|
idempotent: true,
|
|
29
28
|
examples: [
|
|
30
29
|
{
|
|
@@ -41,7 +40,7 @@ export const listSubcommand = createCommand({
|
|
|
41
40
|
|
|
42
41
|
async handler(ctx) {
|
|
43
42
|
const { args, options } = ctx;
|
|
44
|
-
const schedule = createScheduleAdapter(ctx);
|
|
43
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
45
44
|
const result = await schedule.get(args.schedule_id);
|
|
46
45
|
|
|
47
46
|
if (!options.json) {
|
|
@@ -54,13 +53,19 @@ export const listSubcommand = createCommand({
|
|
|
54
53
|
type: 'url' | 'sandbox';
|
|
55
54
|
config: Record<string, unknown>;
|
|
56
55
|
created_at: string;
|
|
57
|
-
}) =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
}) => {
|
|
57
|
+
const configDisplay =
|
|
58
|
+
destination.type === 'url' && destination.config?.url
|
|
59
|
+
? String(destination.config.url)
|
|
60
|
+
: JSON.stringify(destination.config);
|
|
61
|
+
return {
|
|
62
|
+
ID: destination.id,
|
|
63
|
+
Type: destination.type,
|
|
64
|
+
URL: configDisplay,
|
|
65
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
['ID', 'Type', 'URL', 'Created']
|
|
64
69
|
);
|
|
65
70
|
}
|
|
66
71
|
}
|
|
@@ -32,8 +32,7 @@ export const getSubcommand = createCommand({
|
|
|
32
32
|
name: 'get',
|
|
33
33
|
description: 'Get schedule details',
|
|
34
34
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
35
|
-
requires: { auth: true
|
|
36
|
-
optional: { project: true },
|
|
35
|
+
requires: { auth: true },
|
|
37
36
|
idempotent: true,
|
|
38
37
|
examples: [
|
|
39
38
|
{ command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
|
|
@@ -47,7 +46,7 @@ export const getSubcommand = createCommand({
|
|
|
47
46
|
|
|
48
47
|
async handler(ctx) {
|
|
49
48
|
const { args, options } = ctx;
|
|
50
|
-
const schedule = createScheduleAdapter(ctx);
|
|
49
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
51
50
|
const result = await schedule.get(args.schedule_id);
|
|
52
51
|
|
|
53
52
|
if (!options.json) {
|
|
@@ -55,7 +54,7 @@ export const getSubcommand = createCommand({
|
|
|
55
54
|
Name: result.schedule.name,
|
|
56
55
|
ID: result.schedule.id,
|
|
57
56
|
Expression: result.schedule.expression,
|
|
58
|
-
Description: result.schedule.description
|
|
57
|
+
Description: result.schedule.description || '-',
|
|
59
58
|
'Next Due': result.schedule.due_date,
|
|
60
59
|
Created: new Date(result.schedule.created_at).toLocaleString(),
|
|
61
60
|
Updated: new Date(result.schedule.updated_at).toLocaleString(),
|
|
@@ -64,7 +63,7 @@ export const getSubcommand = createCommand({
|
|
|
64
63
|
tui.table([details], undefined, { layout: 'vertical', padStart: ' ' });
|
|
65
64
|
|
|
66
65
|
tui.newline();
|
|
67
|
-
tui.
|
|
66
|
+
tui.header('Destinations');
|
|
68
67
|
if (result.destinations.length === 0) {
|
|
69
68
|
tui.info('No destinations configured');
|
|
70
69
|
} else {
|
|
@@ -74,13 +73,19 @@ export const getSubcommand = createCommand({
|
|
|
74
73
|
type: 'url' | 'sandbox';
|
|
75
74
|
config: Record<string, unknown>;
|
|
76
75
|
created_at: string;
|
|
77
|
-
}) =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
}) => {
|
|
77
|
+
const configDisplay =
|
|
78
|
+
destination.type === 'url' && destination.config?.url
|
|
79
|
+
? String(destination.config.url)
|
|
80
|
+
: JSON.stringify(destination.config);
|
|
81
|
+
return {
|
|
82
|
+
ID: destination.id,
|
|
83
|
+
Type: destination.type,
|
|
84
|
+
URL: configDisplay,
|
|
85
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
86
|
+
};
|
|
87
|
+
}),
|
|
88
|
+
['ID', 'Type', 'URL', 'Created']
|
|
84
89
|
);
|
|
85
90
|
}
|
|
86
91
|
}
|
|
@@ -6,6 +6,7 @@ import { deleteSubcommand } from './delete';
|
|
|
6
6
|
import { updateSubcommand } from './update';
|
|
7
7
|
import destinationSubcommand from './destination';
|
|
8
8
|
import deliverySubcommand from './delivery';
|
|
9
|
+
import { statsSubcommand } from './stats';
|
|
9
10
|
import { getCommand } from '../../../command-prefix';
|
|
10
11
|
|
|
11
12
|
export const command = createCommand({
|
|
@@ -22,6 +23,7 @@ export const command = createCommand({
|
|
|
22
23
|
updateSubcommand,
|
|
23
24
|
destinationSubcommand,
|
|
24
25
|
deliverySubcommand,
|
|
26
|
+
statsSubcommand,
|
|
25
27
|
],
|
|
26
28
|
examples: [
|
|
27
29
|
{ command: getCommand('cloud schedule list'), description: 'List schedules' },
|
|
@@ -25,8 +25,7 @@ export const listSubcommand = createCommand({
|
|
|
25
25
|
aliases: ['ls'],
|
|
26
26
|
description: 'List schedules',
|
|
27
27
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
28
|
-
requires: { auth: true
|
|
29
|
-
optional: { project: true },
|
|
28
|
+
requires: { auth: true },
|
|
30
29
|
idempotent: true,
|
|
31
30
|
examples: [
|
|
32
31
|
{ command: getCommand('cloud schedule list'), description: 'List schedules' },
|
|
@@ -42,7 +41,7 @@ export const listSubcommand = createCommand({
|
|
|
42
41
|
|
|
43
42
|
async handler(ctx) {
|
|
44
43
|
const { opts, options } = ctx;
|
|
45
|
-
const schedule = createScheduleAdapter(ctx);
|
|
44
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
46
45
|
const result = await schedule.list({ limit: opts.limit, offset: opts.offset });
|
|
47
46
|
|
|
48
47
|
if (!options.json) {
|