@agentuity/cli 0.1.8 → 0.1.10
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/README.md +2 -2
- package/bin/cli.ts +8 -0
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +2 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/resource-region.d.ts +46 -0
- package/dist/cache/resource-region.d.ts.map +1 -0
- package/dist/cache/resource-region.js +115 -0
- package/dist/cache/resource-region.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +44 -18
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/capabilities/show.d.ts.map +1 -1
- package/dist/cmd/ai/capabilities/show.js +12 -15
- package/dist/cmd/ai/capabilities/show.js.map +1 -1
- package/dist/cmd/ai/prompt/llm.js +5 -5
- package/dist/cmd/ai/prompt/llm.js.map +1 -1
- package/dist/cmd/ai/skills/generator.d.ts.map +1 -1
- package/dist/cmd/ai/skills/generator.js +9 -1
- package/dist/cmd/ai/skills/generator.js.map +1 -1
- package/dist/cmd/auth/logout.d.ts.map +1 -1
- package/dist/cmd/auth/logout.js +5 -2
- package/dist/cmd/auth/logout.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +87 -1
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.js +1 -1
- package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +8 -3
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.js +5 -3
- package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
- package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/db/delete.js +69 -11
- package/dist/cmd/cloud/db/delete.js.map +1 -1
- package/dist/cmd/cloud/db/get.d.ts.map +1 -1
- package/dist/cmd/cloud/db/get.js +23 -7
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/db/list.d.ts.map +1 -1
- package/dist/cmd/cloud/db/list.js +15 -7
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/db/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/db/logs.js +24 -4
- package/dist/cmd/cloud/db/logs.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +50 -1
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/env/delete.js +30 -13
- package/dist/cmd/cloud/env/delete.js.map +1 -1
- package/dist/cmd/cloud/env/get.d.ts.map +1 -1
- package/dist/cmd/cloud/env/get.js +27 -30
- package/dist/cmd/cloud/env/get.js.map +1 -1
- package/dist/cmd/cloud/env/import.d.ts.map +1 -1
- package/dist/cmd/cloud/env/import.js +41 -48
- package/dist/cmd/cloud/env/import.js.map +1 -1
- package/dist/cmd/cloud/env/index.d.ts.map +1 -1
- package/dist/cmd/cloud/env/index.js +6 -2
- package/dist/cmd/cloud/env/index.js.map +1 -1
- package/dist/cmd/cloud/env/list.d.ts.map +1 -1
- package/dist/cmd/cloud/env/list.js +51 -28
- package/dist/cmd/cloud/env/list.js.map +1 -1
- package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
- package/dist/cmd/cloud/env/pull.js +3 -3
- package/dist/cmd/cloud/env/pull.js.map +1 -1
- package/dist/cmd/cloud/env/push.d.ts.map +1 -1
- package/dist/cmd/cloud/env/push.js +31 -11
- package/dist/cmd/cloud/env/push.js.map +1 -1
- package/dist/cmd/cloud/env/set.d.ts.map +1 -1
- package/dist/cmd/cloud/env/set.js +41 -26
- 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 +0 -2
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +18 -0
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -0
- package/dist/cmd/cloud/region-lookup.js +64 -0
- package/dist/cmd/cloud/region-lookup.js.map +1 -0
- package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.js +5 -3
- package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +54 -2
- package/dist/cmd/cloud/sandbox/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.js +5 -3
- package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/download.js +4 -3
- package/dist/cmd/cloud/sandbox/download.js.map +1 -1
- package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/env.js +4 -3
- package/dist/cmd/cloud/sandbox/env.js.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.js +4 -3
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.js +4 -4
- package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/index.js +1 -1
- package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.js +4 -3
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +26 -4
- 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 +3 -1
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +16 -9
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/ls.js +4 -3
- package/dist/cmd/cloud/sandbox/ls.js.map +1 -1
- package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/mkdir.js +4 -3
- package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/rm.js +4 -3
- package/dist/cmd/cloud/sandbox/rm.js.map +1 -1
- package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/rmdir.js +4 -3
- package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +51 -2
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/index.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/runtime/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/index.js +19 -0
- package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/runtime/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/list.js +68 -0
- package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/create.js +41 -8
- package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +5 -5
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/index.js +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.js +8 -4
- package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.js +14 -4
- package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.js +4 -3
- package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +13 -0
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +40 -1
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/download.js +6 -2
- package/dist/cmd/cloud/scp/download.js.map +1 -1
- package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/upload.js +6 -2
- package/dist/cmd/cloud/scp/upload.js.map +1 -1
- package/dist/cmd/cloud/session/get.js +4 -4
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/cloud/session/list.js +4 -4
- package/dist/cmd/cloud/session/list.js.map +1 -1
- package/dist/cmd/cloud/ssh.d.ts.map +1 -1
- package/dist/cmd/cloud/ssh.js +7 -2
- package/dist/cmd/cloud/ssh.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +46 -10
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/download.js +19 -6
- package/dist/cmd/cloud/storage/download.js.map +1 -1
- package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/get.js +19 -6
- package/dist/cmd/cloud/storage/get.js.map +1 -1
- package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/list.js +17 -7
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/upload.js +19 -6
- package/dist/cmd/cloud/storage/upload.js.map +1 -1
- package/dist/cmd/cloud/thread/delete.js +4 -4
- package/dist/cmd/cloud/thread/delete.js.map +1 -1
- package/dist/cmd/cloud/thread/get.js +4 -4
- package/dist/cmd/cloud/thread/get.js.map +1 -1
- package/dist/cmd/cloud/thread/list.js +4 -4
- package/dist/cmd/cloud/thread/list.js.map +1 -1
- package/dist/cmd/project/auth/init.d.ts.map +1 -1
- package/dist/cmd/project/auth/init.js +6 -3
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/auth/shared.d.ts +6 -2
- package/dist/cmd/project/auth/shared.d.ts.map +1 -1
- package/dist/cmd/project/auth/shared.js +40 -12
- package/dist/cmd/project/auth/shared.js.map +1 -1
- package/dist/config.d.ts +37 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +61 -8
- package/dist/config.js.map +1 -1
- package/dist/env-util.d.ts +25 -2
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +44 -4
- package/dist/env-util.js.map +1 -1
- package/dist/utils/apt-validator.d.ts +20 -0
- package/dist/utils/apt-validator.d.ts.map +1 -0
- package/dist/utils/apt-validator.js +157 -0
- package/dist/utils/apt-validator.js.map +1 -0
- package/package.json +6 -6
- package/src/cache/index.ts +11 -0
- package/src/cache/resource-region.ts +183 -0
- package/src/cli.ts +51 -17
- package/src/cmd/ai/capabilities/show.ts +12 -15
- package/src/cmd/ai/prompt/llm.ts +5 -5
- package/src/cmd/ai/skills/generator.ts +9 -1
- package/src/cmd/auth/logout.ts +5 -2
- package/src/cmd/build/ast.ts +160 -1
- package/src/cmd/build/vite/metadata-generator.ts +1 -1
- package/src/cmd/build/vite/vite-asset-server-config.ts +7 -3
- package/src/cmd/build/vite/vite-asset-server.ts +6 -3
- package/src/cmd/cloud/db/delete.ts +83 -11
- package/src/cmd/cloud/db/get.ts +29 -7
- package/src/cmd/cloud/db/list.ts +16 -7
- package/src/cmd/cloud/db/logs.ts +33 -4
- package/src/cmd/cloud/deploy.ts +63 -0
- package/src/cmd/cloud/env/delete.ts +36 -12
- package/src/cmd/cloud/env/get.ts +28 -27
- package/src/cmd/cloud/env/import.ts +43 -56
- package/src/cmd/cloud/env/index.ts +6 -2
- package/src/cmd/cloud/env/list.ts +57 -30
- package/src/cmd/cloud/env/pull.ts +9 -3
- package/src/cmd/cloud/env/push.ts +44 -11
- package/src/cmd/cloud/env/set.ts +49 -30
- package/src/cmd/cloud/index.ts +0 -2
- package/src/cmd/cloud/region-lookup.ts +89 -0
- package/src/cmd/cloud/sandbox/cp.ts +5 -3
- package/src/cmd/cloud/sandbox/create.ts +61 -2
- package/src/cmd/cloud/sandbox/delete.ts +6 -3
- package/src/cmd/cloud/sandbox/download.ts +4 -3
- package/src/cmd/cloud/sandbox/env.ts +4 -3
- package/src/cmd/cloud/sandbox/exec.ts +4 -3
- package/src/cmd/cloud/sandbox/execution/get.ts +4 -4
- package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
- package/src/cmd/cloud/sandbox/execution/list.ts +4 -3
- package/src/cmd/cloud/sandbox/get.ts +27 -4
- package/src/cmd/cloud/sandbox/index.ts +3 -1
- package/src/cmd/cloud/sandbox/list.ts +16 -9
- package/src/cmd/cloud/sandbox/ls.ts +4 -3
- package/src/cmd/cloud/sandbox/mkdir.ts +4 -3
- package/src/cmd/cloud/sandbox/rm.ts +4 -3
- package/src/cmd/cloud/sandbox/rmdir.ts +4 -3
- package/src/cmd/cloud/sandbox/run.ts +58 -2
- package/src/cmd/cloud/sandbox/runtime/index.ts +20 -0
- package/src/cmd/cloud/sandbox/runtime/list.ts +75 -0
- package/src/cmd/cloud/sandbox/snapshot/create.ts +53 -8
- package/src/cmd/cloud/sandbox/snapshot/delete.ts +4 -4
- package/src/cmd/cloud/sandbox/snapshot/get.ts +5 -5
- package/src/cmd/cloud/sandbox/snapshot/index.ts +1 -1
- package/src/cmd/cloud/sandbox/snapshot/list.ts +8 -4
- package/src/cmd/cloud/sandbox/snapshot/tag.ts +20 -4
- package/src/cmd/cloud/sandbox/upload.ts +4 -3
- package/src/cmd/cloud/sandbox/util.ts +60 -1
- package/src/cmd/cloud/scp/download.ts +14 -2
- package/src/cmd/cloud/scp/upload.ts +14 -2
- package/src/cmd/cloud/session/get.ts +4 -4
- package/src/cmd/cloud/session/list.ts +4 -4
- package/src/cmd/cloud/ssh.ts +15 -2
- package/src/cmd/cloud/storage/delete.ts +61 -10
- package/src/cmd/cloud/storage/download.ts +31 -6
- package/src/cmd/cloud/storage/get.ts +31 -6
- package/src/cmd/cloud/storage/list.ts +18 -7
- package/src/cmd/cloud/storage/upload.ts +31 -6
- package/src/cmd/cloud/thread/delete.ts +4 -4
- package/src/cmd/cloud/thread/get.ts +4 -4
- package/src/cmd/cloud/thread/list.ts +4 -4
- package/src/cmd/project/auth/init.ts +7 -3
- package/src/cmd/project/auth/shared.ts +52 -13
- package/src/config.ts +74 -8
- package/src/env-util.ts +50 -5
- package/src/utils/apt-validator.ts +215 -0
- package/dist/cmd/cloud/secret/delete.d.ts +0 -2
- package/dist/cmd/cloud/secret/delete.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/delete.js +0 -53
- package/dist/cmd/cloud/secret/delete.js.map +0 -1
- package/dist/cmd/cloud/secret/get.d.ts +0 -2
- package/dist/cmd/cloud/secret/get.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/get.js +0 -73
- package/dist/cmd/cloud/secret/get.js.map +0 -1
- package/dist/cmd/cloud/secret/import.d.ts +0 -2
- package/dist/cmd/cloud/secret/import.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/import.js +0 -91
- package/dist/cmd/cloud/secret/import.js.map +0 -1
- package/dist/cmd/cloud/secret/index.d.ts +0 -3
- package/dist/cmd/cloud/secret/index.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/index.js +0 -33
- package/dist/cmd/cloud/secret/index.js.map +0 -1
- package/dist/cmd/cloud/secret/list.d.ts +0 -2
- package/dist/cmd/cloud/secret/list.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/list.js +0 -65
- package/dist/cmd/cloud/secret/list.js.map +0 -1
- package/dist/cmd/cloud/secret/pull.d.ts +0 -2
- package/dist/cmd/cloud/secret/pull.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/pull.js +0 -82
- package/dist/cmd/cloud/secret/pull.js.map +0 -1
- package/dist/cmd/cloud/secret/push.d.ts +0 -2
- package/dist/cmd/cloud/secret/push.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/push.js +0 -61
- package/dist/cmd/cloud/secret/push.js.map +0 -1
- package/dist/cmd/cloud/secret/set.d.ts +0 -2
- package/dist/cmd/cloud/secret/set.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/set.js +0 -63
- package/dist/cmd/cloud/secret/set.js.map +0 -1
- package/src/cmd/cloud/secret/delete.ts +0 -65
- package/src/cmd/cloud/secret/get.ts +0 -77
- package/src/cmd/cloud/secret/import.ts +0 -110
- package/src/cmd/cloud/secret/index.ts +0 -33
- package/src/cmd/cloud/secret/list.ts +0 -70
- package/src/cmd/cloud/secret/pull.ts +0 -92
- package/src/cmd/cloud/secret/push.ts +0 -69
- package/src/cmd/cloud/secret/set.ts +0 -76
|
@@ -2,18 +2,26 @@ import { z } from 'zod';
|
|
|
2
2
|
import { createSubcommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectEnvUpdate } from '@agentuity/server';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
findExistingEnvFile,
|
|
7
|
+
readEnvFile,
|
|
8
|
+
filterAgentuitySdkKeys,
|
|
9
|
+
splitEnvAndSecrets,
|
|
10
|
+
validateNoPublicSecrets,
|
|
11
|
+
} from '../../../env-util';
|
|
6
12
|
import { getCommand } from '../../../command-prefix';
|
|
7
13
|
|
|
8
14
|
const EnvPushResponseSchema = z.object({
|
|
9
15
|
success: z.boolean().describe('Whether push succeeded'),
|
|
10
16
|
pushed: z.number().describe('Number of items pushed'),
|
|
17
|
+
envCount: z.number().describe('Number of env vars pushed'),
|
|
18
|
+
secretCount: z.number().describe('Number of secrets pushed'),
|
|
11
19
|
source: z.string().describe('Source file path'),
|
|
12
20
|
});
|
|
13
21
|
|
|
14
22
|
export const pushSubcommand = createSubcommand({
|
|
15
23
|
name: 'push',
|
|
16
|
-
description: 'Push environment variables from local .env file to cloud',
|
|
24
|
+
description: 'Push environment variables and secrets from local .env file to cloud',
|
|
17
25
|
tags: [
|
|
18
26
|
'mutating',
|
|
19
27
|
'updates-resource',
|
|
@@ -23,7 +31,7 @@ export const pushSubcommand = createSubcommand({
|
|
|
23
31
|
'requires-project',
|
|
24
32
|
],
|
|
25
33
|
idempotent: true,
|
|
26
|
-
examples: [{ command: getCommand('env push'), description: '
|
|
34
|
+
examples: [{ command: getCommand('env push'), description: 'Push all variables to cloud' }],
|
|
27
35
|
requires: { auth: true, project: true, apiClient: true },
|
|
28
36
|
prerequisites: ['env set'],
|
|
29
37
|
schema: {
|
|
@@ -33,36 +41,61 @@ export const pushSubcommand = createSubcommand({
|
|
|
33
41
|
async handler(ctx) {
|
|
34
42
|
const { apiClient, project, projectDir } = ctx;
|
|
35
43
|
|
|
36
|
-
// Read local env file
|
|
44
|
+
// Read local env file
|
|
37
45
|
const envFilePath = await findExistingEnvFile(projectDir);
|
|
38
46
|
const localEnv = await readEnvFile(envFilePath);
|
|
39
47
|
|
|
40
|
-
// Filter out AGENTUITY_ prefixed keys
|
|
48
|
+
// Filter out reserved AGENTUITY_ prefixed keys
|
|
41
49
|
const filteredEnv = filterAgentuitySdkKeys(localEnv);
|
|
42
50
|
|
|
43
51
|
if (Object.keys(filteredEnv).length === 0) {
|
|
44
|
-
tui.warning('No
|
|
52
|
+
tui.warning('No variables to push');
|
|
45
53
|
return {
|
|
46
54
|
success: false,
|
|
47
55
|
pushed: 0,
|
|
56
|
+
envCount: 0,
|
|
57
|
+
secretCount: 0,
|
|
48
58
|
source: envFilePath,
|
|
49
59
|
};
|
|
50
60
|
}
|
|
51
61
|
|
|
62
|
+
// Split into env and secrets based on key naming conventions
|
|
63
|
+
const { env, secrets } = splitEnvAndSecrets(filteredEnv);
|
|
64
|
+
|
|
65
|
+
// Check for any public vars that would have been treated as secrets
|
|
66
|
+
const publicSecretKeys = validateNoPublicSecrets(secrets);
|
|
67
|
+
if (publicSecretKeys.length > 0) {
|
|
68
|
+
tui.warning(
|
|
69
|
+
`Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
|
|
70
|
+
);
|
|
71
|
+
for (const key of publicSecretKeys) {
|
|
72
|
+
delete secrets[key];
|
|
73
|
+
env[key] = filteredEnv[key];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
52
77
|
// Push to cloud
|
|
53
|
-
await tui.spinner('Pushing
|
|
78
|
+
await tui.spinner('Pushing variables to cloud', () => {
|
|
54
79
|
return projectEnvUpdate(apiClient, {
|
|
55
80
|
id: project.projectId,
|
|
56
|
-
env
|
|
81
|
+
env,
|
|
82
|
+
secrets,
|
|
57
83
|
});
|
|
58
84
|
});
|
|
59
85
|
|
|
60
|
-
const
|
|
61
|
-
|
|
86
|
+
const envCount = Object.keys(env).length;
|
|
87
|
+
const secretCount = Object.keys(secrets).length;
|
|
88
|
+
const totalCount = envCount + secretCount;
|
|
89
|
+
|
|
90
|
+
tui.success(
|
|
91
|
+
`Pushed ${totalCount} variable${totalCount !== 1 ? 's' : ''} to cloud (${envCount} env, ${secretCount} secret${secretCount !== 1 ? 's' : ''})`
|
|
92
|
+
);
|
|
62
93
|
|
|
63
94
|
return {
|
|
64
95
|
success: true,
|
|
65
|
-
pushed:
|
|
96
|
+
pushed: totalCount,
|
|
97
|
+
envCount,
|
|
98
|
+
secretCount,
|
|
66
99
|
source: envFilePath,
|
|
67
100
|
};
|
|
68
101
|
},
|
package/src/cmd/cloud/env/set.ts
CHANGED
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
writeEnvFile,
|
|
9
9
|
filterAgentuitySdkKeys,
|
|
10
10
|
looksLikeSecret,
|
|
11
|
+
isReservedAgentuityKey,
|
|
12
|
+
isPublicVarKey,
|
|
13
|
+
PUBLIC_VAR_PREFIXES,
|
|
11
14
|
} from '../../../env-util';
|
|
12
15
|
import { getCommand } from '../../../command-prefix';
|
|
13
16
|
|
|
@@ -15,64 +18,77 @@ const EnvSetResponseSchema = z.object({
|
|
|
15
18
|
success: z.boolean().describe('Whether the operation succeeded'),
|
|
16
19
|
key: z.string().describe('Environment variable key'),
|
|
17
20
|
path: z.string().describe('Local file path where env var was saved'),
|
|
21
|
+
secret: z.boolean().describe('Whether the value was stored as a secret'),
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
export const setSubcommand = createSubcommand({
|
|
21
25
|
name: 'set',
|
|
22
|
-
description: 'Set an environment variable',
|
|
26
|
+
description: 'Set an environment variable or secret',
|
|
23
27
|
tags: ['mutating', 'updates-resource', 'slow', 'requires-auth', 'requires-project'],
|
|
24
28
|
idempotent: true,
|
|
25
29
|
requires: { auth: true, project: true, apiClient: true },
|
|
26
30
|
examples: [
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
{
|
|
32
|
+
command: getCommand('env set NODE_ENV production'),
|
|
33
|
+
description: 'Set environment variable',
|
|
34
|
+
},
|
|
35
|
+
{ command: getCommand('env set PORT 3000'), description: 'Set port number' },
|
|
36
|
+
{
|
|
37
|
+
command: getCommand('env set API_KEY "sk_..." --secret'),
|
|
38
|
+
description: 'Set a secret value',
|
|
39
|
+
},
|
|
30
40
|
],
|
|
31
41
|
schema: {
|
|
32
42
|
args: z.object({
|
|
33
43
|
key: z.string().describe('the environment variable key'),
|
|
34
44
|
value: z.string().describe('the environment variable value'),
|
|
35
45
|
}),
|
|
46
|
+
options: z.object({
|
|
47
|
+
secret: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.default(false)
|
|
50
|
+
.describe('store as a secret (encrypted and masked in UI)'),
|
|
51
|
+
}),
|
|
36
52
|
response: EnvSetResponseSchema,
|
|
37
53
|
},
|
|
38
54
|
|
|
39
55
|
async handler(ctx) {
|
|
40
|
-
const { args, apiClient, project, projectDir } = ctx;
|
|
56
|
+
const { args, opts, apiClient, project, projectDir } = ctx;
|
|
57
|
+
let isSecret = opts?.secret ?? false;
|
|
58
|
+
const isPublic = isPublicVarKey(args.key);
|
|
41
59
|
|
|
42
|
-
// Validate key doesn't start with AGENTUITY_
|
|
43
|
-
if (args.key
|
|
60
|
+
// Validate key doesn't start with reserved AGENTUITY_ prefix (except AGENTUITY_PUBLIC_)
|
|
61
|
+
if (isReservedAgentuityKey(args.key)) {
|
|
44
62
|
tui.fatal('Cannot set AGENTUITY_ prefixed variables. These are reserved for system use.');
|
|
45
63
|
}
|
|
46
64
|
|
|
47
|
-
//
|
|
48
|
-
if (
|
|
65
|
+
// Validate public vars cannot be secrets
|
|
66
|
+
if (isSecret && isPublic) {
|
|
67
|
+
tui.fatal(
|
|
68
|
+
`Cannot set public variables as secrets. Keys with prefixes (${PUBLIC_VAR_PREFIXES.join(', ')}) are exposed to the frontend.`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Auto-detect if this looks like a secret and offer to store as secret
|
|
73
|
+
// Skip auto-detect for public vars since they can never be secrets
|
|
74
|
+
if (!isSecret && !isPublic && looksLikeSecret(args.key, args.value)) {
|
|
49
75
|
tui.warning(`The variable '${args.key}' looks like it should be a secret.`);
|
|
50
|
-
tui.info(`Secrets should be stored using: ${getCommand('secret set <key> <value>')}`);
|
|
51
|
-
tui.info('This keeps them more secure and properly masked in the cloud.');
|
|
52
76
|
|
|
53
|
-
const
|
|
54
|
-
'Do you still want to store this as a regular environment variable?',
|
|
55
|
-
false
|
|
56
|
-
);
|
|
77
|
+
const storeAsSecret = await tui.confirm('Store as a secret instead?', true);
|
|
57
78
|
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
`Cancelled. Use "${getCommand('secret set')}" to store this as a secret instead.`
|
|
61
|
-
);
|
|
62
|
-
return {
|
|
63
|
-
success: false,
|
|
64
|
-
key: args.key,
|
|
65
|
-
path: '',
|
|
66
|
-
};
|
|
79
|
+
if (storeAsSecret) {
|
|
80
|
+
isSecret = true;
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
// Set in cloud
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
const updatePayload = isSecret
|
|
86
|
+
? { id: project.projectId, secrets: { [args.key]: args.value } }
|
|
87
|
+
: { id: project.projectId, env: { [args.key]: args.value } };
|
|
88
|
+
|
|
89
|
+
const label = isSecret ? 'secret' : 'environment variable';
|
|
90
|
+
await tui.spinner(`Setting ${label} in cloud`, () => {
|
|
91
|
+
return projectEnvUpdate(apiClient, updatePayload);
|
|
76
92
|
});
|
|
77
93
|
|
|
78
94
|
// Update local .env file
|
|
@@ -84,12 +100,15 @@ export const setSubcommand = createSubcommand({
|
|
|
84
100
|
const filteredEnv = filterAgentuitySdkKeys(currentEnv);
|
|
85
101
|
await writeEnvFile(envFilePath, filteredEnv);
|
|
86
102
|
|
|
87
|
-
tui.success(
|
|
103
|
+
tui.success(
|
|
104
|
+
`${isSecret ? 'Secret' : 'Environment variable'} '${args.key}' set successfully (cloud + ${envFilePath})`
|
|
105
|
+
);
|
|
88
106
|
|
|
89
107
|
return {
|
|
90
108
|
success: true,
|
|
91
109
|
key: args.key,
|
|
92
110
|
path: envFilePath,
|
|
111
|
+
secret: isSecret,
|
|
93
112
|
};
|
|
94
113
|
},
|
|
95
114
|
});
|
package/src/cmd/cloud/index.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { deploymentCommand } from './deployment';
|
|
|
11
11
|
import keyvalueCommand from './keyvalue';
|
|
12
12
|
import { agentCommand } from './agent';
|
|
13
13
|
import envCommand from './env';
|
|
14
|
-
import secretCommand from './secret';
|
|
15
14
|
import apikeyCommand from './apikey';
|
|
16
15
|
import streamCommand from './stream';
|
|
17
16
|
import vectorCommand from './vector';
|
|
@@ -34,7 +33,6 @@ export const command = createCommand({
|
|
|
34
33
|
vectorCommand,
|
|
35
34
|
sandboxCommand,
|
|
36
35
|
envCommand,
|
|
37
|
-
secretCommand,
|
|
38
36
|
deploySubcommand,
|
|
39
37
|
dbCommand,
|
|
40
38
|
redisCommand,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Logger } from '@agentuity/core';
|
|
2
|
+
import { projectGet, sandboxGet, deploymentGet, type APIClient } from '@agentuity/server';
|
|
3
|
+
import { getResourceRegion, setResourceRegion } from '../../cache';
|
|
4
|
+
import { getGlobalCatalystAPIClient } from '../../config';
|
|
5
|
+
import type { AuthData } from '../../types';
|
|
6
|
+
import * as tui from '../../tui';
|
|
7
|
+
import { ErrorCode } from '../../errors';
|
|
8
|
+
|
|
9
|
+
export type IdentifierType = 'project' | 'deployment' | 'sandbox';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Determine the type of identifier based on its prefix
|
|
13
|
+
*/
|
|
14
|
+
export function getIdentifierType(identifier: string): IdentifierType {
|
|
15
|
+
if (identifier.startsWith('proj_')) {
|
|
16
|
+
return 'project';
|
|
17
|
+
}
|
|
18
|
+
if (identifier.startsWith('deploy_')) {
|
|
19
|
+
return 'deployment';
|
|
20
|
+
}
|
|
21
|
+
if (identifier.startsWith('sbx_')) {
|
|
22
|
+
return 'sandbox';
|
|
23
|
+
}
|
|
24
|
+
// Default to project for unknown prefixes
|
|
25
|
+
return 'project';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Look up the region for a project, deployment, or sandbox identifier.
|
|
30
|
+
* Uses cache-first strategy with API fallback.
|
|
31
|
+
*/
|
|
32
|
+
export async function getIdentifierRegion(
|
|
33
|
+
logger: Logger,
|
|
34
|
+
auth: AuthData,
|
|
35
|
+
apiClient: APIClient,
|
|
36
|
+
profileName = 'production',
|
|
37
|
+
identifier: string,
|
|
38
|
+
orgId?: string
|
|
39
|
+
): Promise<string> {
|
|
40
|
+
const identifierType = getIdentifierType(identifier);
|
|
41
|
+
|
|
42
|
+
// For project, deployment, and sandbox, check cache first
|
|
43
|
+
const cachedRegion = await getResourceRegion(identifierType, profileName, identifier);
|
|
44
|
+
if (cachedRegion) {
|
|
45
|
+
logger.trace(`[region-lookup] Found cached region for ${identifier}: ${cachedRegion}`);
|
|
46
|
+
return cachedRegion;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
logger.trace(`[region-lookup] Cache miss for ${identifier}, fetching from API`);
|
|
50
|
+
|
|
51
|
+
let region: string | null = null;
|
|
52
|
+
|
|
53
|
+
if (identifierType === 'project') {
|
|
54
|
+
const project = await projectGet(apiClient, { id: identifier, mask: true, keys: false });
|
|
55
|
+
region = project.cloudRegion ?? null;
|
|
56
|
+
} else if (identifierType === 'deployment') {
|
|
57
|
+
const deployment = await deploymentGet(apiClient, identifier);
|
|
58
|
+
region = deployment.cloudRegion ?? null;
|
|
59
|
+
} else {
|
|
60
|
+
// sandbox
|
|
61
|
+
const globalClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
62
|
+
const sandbox = await sandboxGet(globalClient, { sandboxId: identifier, orgId });
|
|
63
|
+
region = sandbox.region ?? null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!region) {
|
|
67
|
+
tui.fatal(
|
|
68
|
+
`Could not determine region for ${identifierType} '${identifier}'. Use --region flag to specify.`,
|
|
69
|
+
ErrorCode.RESOURCE_NOT_FOUND
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Cache the result
|
|
74
|
+
await setResourceRegion(identifierType, profileName, identifier, region);
|
|
75
|
+
logger.trace(`[region-lookup] Cached region for ${identifier}: ${region}`);
|
|
76
|
+
|
|
77
|
+
return region;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Cache the region for a project after creation
|
|
82
|
+
*/
|
|
83
|
+
export async function cacheProjectRegion(
|
|
84
|
+
profileName = 'production',
|
|
85
|
+
projectId: string,
|
|
86
|
+
region: string
|
|
87
|
+
): Promise<void> {
|
|
88
|
+
await setResourceRegion('project', profileName, projectId, region);
|
|
89
|
+
}
|
|
@@ -3,7 +3,7 @@ import { readFileSync, writeFileSync, mkdirSync, statSync, readdirSync } from 'n
|
|
|
3
3
|
import { dirname, resolve, basename, join, relative } from 'node:path';
|
|
4
4
|
import { createCommand } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
|
-
import { createSandboxClient } from './util';
|
|
6
|
+
import { getSandboxRegion, createSandboxClient } from './util';
|
|
7
7
|
import { getCommand } from '../../../command-prefix';
|
|
8
8
|
import {
|
|
9
9
|
sandboxWriteFiles,
|
|
@@ -47,7 +47,7 @@ export const cpSubcommand = createCommand({
|
|
|
47
47
|
aliases: ['copy'],
|
|
48
48
|
description: 'Copy files or directories to or from a sandbox',
|
|
49
49
|
tags: ['slow', 'requires-auth'],
|
|
50
|
-
requires: { auth: true,
|
|
50
|
+
requires: { auth: true, org: true },
|
|
51
51
|
examples: [
|
|
52
52
|
{
|
|
53
53
|
command: getCommand('cloud sandbox cp ./local-file.txt snbx_abc123:/path/to/file.txt'),
|
|
@@ -84,7 +84,7 @@ export const cpSubcommand = createCommand({
|
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
async handler(ctx) {
|
|
87
|
-
const { args, opts, options, auth,
|
|
87
|
+
const { args, opts, options, auth, logger, orgId, config } = ctx;
|
|
88
88
|
|
|
89
89
|
const source = parsePath(args.source);
|
|
90
90
|
const destination = parsePath(args.destination);
|
|
@@ -101,6 +101,8 @@ export const cpSubcommand = createCommand({
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
const sandboxId = source.sandboxId ?? destination.sandboxId!;
|
|
105
|
+
const region = await getSandboxRegion(logger, auth, config?.name, sandboxId, orgId);
|
|
104
106
|
const client = createSandboxClient(logger, auth, region);
|
|
105
107
|
const recursive = opts.recursive ?? false;
|
|
106
108
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import { createSandboxClient, parseFileArgs } from './util';
|
|
4
|
+
import { createSandboxClient, parseFileArgs, cacheSandboxRegion } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { sandboxCreate } from '@agentuity/server';
|
|
7
7
|
import { StructuredError } from '@agentuity/core';
|
|
8
|
+
import { validateAptDependencies } from '../../../utils/apt-validator';
|
|
9
|
+
import { ErrorCode } from '../../../errors';
|
|
8
10
|
|
|
9
11
|
const InvalidMetadataError = StructuredError(
|
|
10
12
|
'InvalidMetadataError',
|
|
@@ -28,6 +30,10 @@ export const createSubcommand = createCommand({
|
|
|
28
30
|
command: getCommand('cloud sandbox create'),
|
|
29
31
|
description: 'Create a sandbox with default settings',
|
|
30
32
|
},
|
|
33
|
+
{
|
|
34
|
+
command: getCommand('cloud sandbox create --runtime python:3.14'),
|
|
35
|
+
description: 'Create a sandbox with Python runtime',
|
|
36
|
+
},
|
|
31
37
|
{
|
|
32
38
|
command: getCommand('cloud sandbox create --memory 1Gi --cpu 1000m'),
|
|
33
39
|
description: 'Create a sandbox with resource limits',
|
|
@@ -43,6 +49,10 @@ export const createSubcommand = createCommand({
|
|
|
43
49
|
],
|
|
44
50
|
schema: {
|
|
45
51
|
options: z.object({
|
|
52
|
+
runtime: z.string().optional().describe('Runtime name (e.g., "bun:1", "python:3.14")'),
|
|
53
|
+
runtimeId: z.string().optional().describe('Runtime ID (e.g., "srt_xxx")'),
|
|
54
|
+
name: z.string().optional().describe('Sandbox name'),
|
|
55
|
+
description: z.string().optional().describe('Sandbox description'),
|
|
46
56
|
memory: z.string().optional().describe('Memory limit (e.g., "500Mi", "1Gi")'),
|
|
47
57
|
cpu: z.string().optional().describe('CPU limit in millicores (e.g., "500m", "1000m")'),
|
|
48
58
|
disk: z.string().optional().describe('Disk limit (e.g., "500Mi", "1Gi")'),
|
|
@@ -67,10 +77,52 @@ export const createSubcommand = createCommand({
|
|
|
67
77
|
},
|
|
68
78
|
|
|
69
79
|
async handler(ctx) {
|
|
70
|
-
const { opts, options, auth, region, logger, orgId } = ctx;
|
|
80
|
+
const { opts, options, auth, region, config, logger, orgId } = ctx;
|
|
71
81
|
const client = createSandboxClient(logger, auth, region);
|
|
72
82
|
const started = Date.now();
|
|
73
83
|
|
|
84
|
+
// Validate apt dependencies before creating sandbox
|
|
85
|
+
if (opts.dependency && opts.dependency.length > 0) {
|
|
86
|
+
const aptValidation = await tui.spinner({
|
|
87
|
+
message: 'Validating apt dependencies...',
|
|
88
|
+
type: 'simple',
|
|
89
|
+
callback: async () => {
|
|
90
|
+
return await validateAptDependencies(opts.dependency!, region, config, logger);
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (aptValidation.invalid.length > 0) {
|
|
95
|
+
if (options.json) {
|
|
96
|
+
return {
|
|
97
|
+
sandboxId: '',
|
|
98
|
+
status: 'failed',
|
|
99
|
+
errors: aptValidation.invalid.map((pkg) => ({
|
|
100
|
+
type: 'invalid-apt-dependency',
|
|
101
|
+
package: pkg.package,
|
|
102
|
+
error: pkg.error,
|
|
103
|
+
searchUrl: pkg.searchUrl,
|
|
104
|
+
availableVersions: pkg.availableVersions,
|
|
105
|
+
})),
|
|
106
|
+
} as never;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
tui.error('Invalid apt dependencies:');
|
|
110
|
+
tui.newline();
|
|
111
|
+
for (const pkg of aptValidation.invalid) {
|
|
112
|
+
tui.bullet(`${tui.bold(pkg.package)}: ${pkg.error}`);
|
|
113
|
+
if (pkg.availableVersions && pkg.availableVersions.length > 0) {
|
|
114
|
+
tui.muted(` Available versions: ${pkg.availableVersions.join(', ')}`);
|
|
115
|
+
}
|
|
116
|
+
tui.muted(` Search: ${tui.link(pkg.searchUrl)}`);
|
|
117
|
+
}
|
|
118
|
+
tui.newline();
|
|
119
|
+
tui.fatal(
|
|
120
|
+
'Fix the apt dependencies and try again. Search for valid packages at: https://packages.debian.org/stable/',
|
|
121
|
+
ErrorCode.CONFIG_INVALID
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
74
126
|
const envMap: Record<string, string> = {};
|
|
75
127
|
if (opts.env) {
|
|
76
128
|
for (const e of opts.env) {
|
|
@@ -100,6 +152,10 @@ export const createSubcommand = createCommand({
|
|
|
100
152
|
|
|
101
153
|
const result = await sandboxCreate(client, {
|
|
102
154
|
options: {
|
|
155
|
+
runtime: opts.runtime,
|
|
156
|
+
runtimeId: opts.runtimeId,
|
|
157
|
+
name: opts.name,
|
|
158
|
+
description: opts.description,
|
|
103
159
|
resources:
|
|
104
160
|
opts.memory || opts.cpu || opts.disk
|
|
105
161
|
? {
|
|
@@ -119,6 +175,9 @@ export const createSubcommand = createCommand({
|
|
|
119
175
|
orgId,
|
|
120
176
|
});
|
|
121
177
|
|
|
178
|
+
// Cache the region for future lookups
|
|
179
|
+
await cacheSandboxRegion(config?.name, result.sandboxId, region);
|
|
180
|
+
|
|
122
181
|
if (!options.json) {
|
|
123
182
|
const duration = Date.now() - started;
|
|
124
183
|
tui.success(`created sandbox ${tui.bold(result.sandboxId)} in ${duration}ms`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import { createSandboxClient } from './util';
|
|
4
|
+
import { getSandboxRegion, createSandboxClient, clearSandboxRegionCache } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { sandboxDestroy } from '@agentuity/server';
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ export const deleteSubcommand = createCommand({
|
|
|
17
17
|
aliases: ['del', 'remove', 'destroy'],
|
|
18
18
|
description: 'Delete a sandbox',
|
|
19
19
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
20
|
-
requires: { auth: true,
|
|
20
|
+
requires: { auth: true, org: true },
|
|
21
21
|
idempotent: true,
|
|
22
22
|
examples: [
|
|
23
23
|
{
|
|
@@ -40,7 +40,7 @@ export const deleteSubcommand = createCommand({
|
|
|
40
40
|
},
|
|
41
41
|
|
|
42
42
|
async handler(ctx) {
|
|
43
|
-
const { args, options, opts, auth,
|
|
43
|
+
const { args, options, opts, auth, config, logger, orgId } = ctx;
|
|
44
44
|
|
|
45
45
|
if (!opts.confirm) {
|
|
46
46
|
const confirmed = await tui.confirm(`Delete sandbox "${args.sandboxId}"?`, false);
|
|
@@ -56,11 +56,14 @@ export const deleteSubcommand = createCommand({
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const started = Date.now();
|
|
59
|
+
const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
|
|
59
60
|
const client = createSandboxClient(logger, auth, region);
|
|
60
61
|
|
|
61
62
|
await sandboxDestroy(client, { sandboxId: args.sandboxId, orgId });
|
|
62
63
|
const durationMs = Date.now() - started;
|
|
63
64
|
|
|
65
|
+
await clearSandboxRegionCache(config?.name, args.sandboxId);
|
|
66
|
+
|
|
64
67
|
if (!options.json) {
|
|
65
68
|
tui.success(`deleted sandbox ${tui.bold(args.sandboxId)} in ${durationMs}ms`);
|
|
66
69
|
}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { writeFileSync } from 'node:fs';
|
|
3
3
|
import { createCommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import { createSandboxClient } from './util';
|
|
5
|
+
import { createSandboxClient, getSandboxRegion } from './util';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { sandboxDownloadArchive } from '@agentuity/server';
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export const downloadSubcommand = createCommand({
|
|
|
11
11
|
aliases: ['dl'],
|
|
12
12
|
description: 'Download files from a sandbox as a compressed archive',
|
|
13
13
|
tags: ['slow', 'requires-auth'],
|
|
14
|
-
requires: { auth: true,
|
|
14
|
+
requires: { auth: true, org: true },
|
|
15
15
|
examples: [
|
|
16
16
|
{
|
|
17
17
|
command: getCommand('cloud sandbox download sbx_abc123 ./backup.tar.gz'),
|
|
@@ -47,8 +47,9 @@ export const downloadSubcommand = createCommand({
|
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
async handler(ctx) {
|
|
50
|
-
const { args, opts, options, auth,
|
|
50
|
+
const { args, opts, options, auth, logger, orgId, config } = ctx;
|
|
51
51
|
|
|
52
|
+
const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
|
|
52
53
|
const client = createSandboxClient(logger, auth, region);
|
|
53
54
|
const format = opts.format || 'tar.gz';
|
|
54
55
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import { createSandboxClient } from './util';
|
|
4
|
+
import { getSandboxRegion, createSandboxClient } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { sandboxSetEnv } from '@agentuity/server';
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ export const envSubcommand = createCommand({
|
|
|
9
9
|
name: 'env',
|
|
10
10
|
description: 'Set or delete environment variables on a sandbox',
|
|
11
11
|
tags: ['slow', 'requires-auth'],
|
|
12
|
-
requires: { auth: true,
|
|
12
|
+
requires: { auth: true, org: true },
|
|
13
13
|
examples: [
|
|
14
14
|
{
|
|
15
15
|
command: getCommand('cloud sandbox env sbx_abc123 MY_VAR=value'),
|
|
@@ -42,8 +42,9 @@ export const envSubcommand = createCommand({
|
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
async handler(ctx) {
|
|
45
|
-
const { args, opts, options, auth,
|
|
45
|
+
const { args, opts, options, auth, config, logger, orgId } = ctx;
|
|
46
46
|
|
|
47
|
+
const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
|
|
47
48
|
const client = createSandboxClient(logger, auth, region);
|
|
48
49
|
|
|
49
50
|
const envMap: Record<string, string | null> = {};
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
import { createCommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import { createSandboxClient } from './util';
|
|
5
|
+
import { getSandboxRegion, createSandboxClient } from './util';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { sandboxExecute, executionGet, writeAndDrain } from '@agentuity/server';
|
|
8
8
|
import type { Logger } from '@agentuity/core';
|
|
@@ -23,7 +23,7 @@ export const execSubcommand = createCommand({
|
|
|
23
23
|
aliases: ['execute'],
|
|
24
24
|
description: 'Execute a command in a running sandbox',
|
|
25
25
|
tags: ['slow', 'requires-auth'],
|
|
26
|
-
requires: { auth: true,
|
|
26
|
+
requires: { auth: true, org: true },
|
|
27
27
|
examples: [
|
|
28
28
|
{
|
|
29
29
|
command: getCommand('cloud sandbox exec abc123 -- echo "hello"'),
|
|
@@ -51,7 +51,8 @@ export const execSubcommand = createCommand({
|
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
async handler(ctx) {
|
|
54
|
-
const { args, opts, options, auth,
|
|
54
|
+
const { args, opts, options, auth, config, logger, orgId } = ctx;
|
|
55
|
+
const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
|
|
55
56
|
const client = createSandboxClient(logger, auth, region);
|
|
56
57
|
const started = Date.now();
|
|
57
58
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
5
4
|
import { getCommand } from '../../../../command-prefix';
|
|
6
5
|
import { executionGet } from '@agentuity/server';
|
|
6
|
+
import { getGlobalCatalystAPIClient } from '../../../../config';
|
|
7
7
|
|
|
8
8
|
const ExecutionGetResponseSchema = z.object({
|
|
9
9
|
executionId: z.string().describe('Execution ID'),
|
|
@@ -24,7 +24,7 @@ export const getSubcommand = createCommand({
|
|
|
24
24
|
aliases: ['info', 'show'],
|
|
25
25
|
description: 'Get information about a specific execution',
|
|
26
26
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
27
|
-
requires: { auth: true,
|
|
27
|
+
requires: { auth: true, org: true },
|
|
28
28
|
idempotent: true,
|
|
29
29
|
examples: [
|
|
30
30
|
{
|
|
@@ -40,8 +40,8 @@ export const getSubcommand = createCommand({
|
|
|
40
40
|
},
|
|
41
41
|
|
|
42
42
|
async handler(ctx) {
|
|
43
|
-
const { args, options, auth,
|
|
44
|
-
const client =
|
|
43
|
+
const { args, options, auth, logger, orgId, config } = ctx;
|
|
44
|
+
const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
45
45
|
|
|
46
46
|
const result = await executionGet(client, { executionId: args.executionId, orgId });
|
|
47
47
|
|