@agentuity/cli 1.0.1 → 1.0.3
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/AGENTS.md +40 -24
- package/bin/cli.ts +47 -22
- package/dist/agent-detection.d.ts +23 -38
- package/dist/agent-detection.d.ts.map +1 -1
- package/dist/agent-detection.js +412 -153
- package/dist/agent-detection.js.map +1 -1
- package/dist/ai-help.d.ts +23 -0
- package/dist/ai-help.d.ts.map +1 -0
- package/dist/ai-help.js +328 -0
- package/dist/ai-help.js.map +1 -0
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +10 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +176 -16
- package/dist/auth.js.map +1 -1
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +5 -0
- package/dist/banner.js.map +1 -1
- package/dist/cache/agent-intro.d.ts +13 -0
- package/dist/cache/agent-intro.d.ts.map +1 -0
- package/dist/cache/agent-intro.js +54 -0
- package/dist/cache/agent-intro.js.map +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +1 -0
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/resource-region.d.ts +3 -2
- package/dist/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js +13 -4
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/catalyst.d.ts +7 -0
- package/dist/catalyst.d.ts.map +1 -0
- package/dist/catalyst.js +15 -0
- package/dist/catalyst.js.map +1 -0
- package/dist/cli.d.ts +12 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +290 -67
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/detect.d.ts +3 -0
- package/dist/cmd/ai/detect.d.ts.map +1 -0
- package/dist/cmd/ai/detect.js +49 -0
- package/dist/cmd/ai/detect.js.map +1 -0
- package/dist/cmd/ai/index.d.ts.map +1 -1
- package/dist/cmd/ai/index.js +18 -1
- package/dist/cmd/ai/index.js.map +1 -1
- package/dist/cmd/ai/intro.d.ts +7 -0
- package/dist/cmd/ai/intro.d.ts.map +1 -0
- package/dist/cmd/ai/intro.js +141 -0
- package/dist/cmd/ai/intro.js.map +1 -0
- package/dist/cmd/ai/opencode/run.d.ts.map +1 -1
- package/dist/cmd/ai/opencode/run.js +5 -0
- package/dist/cmd/ai/opencode/run.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +79 -0
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.js +2 -0
- package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
- package/dist/cmd/build/vite/docs-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/docs-generator.js +15 -1
- package/dist/cmd/build/vite/docs-generator.js.map +1 -1
- package/dist/cmd/build/vite/env-types-generator.d.ts +26 -0
- package/dist/cmd/build/vite/env-types-generator.d.ts.map +1 -0
- package/dist/cmd/build/vite/env-types-generator.js +110 -0
- package/dist/cmd/build/vite/env-types-generator.js.map +1 -0
- package/dist/cmd/build/vite/index.d.ts +2 -0
- package/dist/cmd/build/vite/index.d.ts.map +1 -1
- package/dist/cmd/build/vite/index.js +12 -1
- package/dist/cmd/build/vite/index.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts +2 -0
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +10 -1
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/cloud/db/create.js.map +1 -1
- 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 +27 -12
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/deploy-fork.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy-fork.js +2 -0
- package/dist/cmd/cloud/deploy-fork.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +17 -0
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/env/import.js.map +1 -1
- package/dist/cmd/cloud/env/list.js.map +1 -1
- package/dist/cmd/cloud/env/push.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +3 -3
- package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
- package/dist/cmd/cloud/machine/list.js +3 -3
- package/dist/cmd/cloud/machine/list.js.map +1 -1
- package/dist/cmd/cloud/region/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +7 -4
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -1
- package/dist/cmd/cloud/region-lookup.js +59 -14
- package/dist/cmd/cloud/region-lookup.js.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.js +7 -5
- package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +2 -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 +8 -7
- 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 +7 -5
- 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 +7 -5
- 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 +7 -5
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +12 -7
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +40 -63
- 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 +7 -5
- 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 +7 -5
- 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 +7 -5
- 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 +7 -5
- package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +1 -1
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.js +7 -5
- package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +2 -2
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +14 -13
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/cloud/ssh.d.ts.map +1 -1
- package/dist/cmd/cloud/ssh.js +3 -3
- package/dist/cmd/cloud/ssh.js.map +1 -1
- package/dist/cmd/cloud/storage/create.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/get.js +5 -11
- 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 +6 -6
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/stream/create.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/create.js +7 -4
- package/dist/cmd/cloud/stream/create.js.map +1 -1
- package/dist/cmd/cloud/stream/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/delete.js +25 -4
- package/dist/cmd/cloud/stream/delete.js.map +1 -1
- package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/get.js +91 -62
- package/dist/cmd/cloud/stream/get.js.map +1 -1
- package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/list.js +66 -38
- package/dist/cmd/cloud/stream/list.js.map +1 -1
- package/dist/cmd/cloud/stream/util.d.ts +20 -0
- package/dist/cmd/cloud/stream/util.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/util.js +27 -3
- package/dist/cmd/cloud/stream/util.js.map +1 -1
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +3 -3
- package/dist/cmd/cloud/vector/util.js.map +1 -1
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/git/account/add.js.map +1 -1
- package/dist/cmd/git/list.js.map +1 -1
- package/dist/cmd/project/add/database.d.ts +2 -0
- package/dist/cmd/project/add/database.d.ts.map +1 -0
- package/dist/cmd/project/add/database.js +123 -0
- package/dist/cmd/project/add/database.js.map +1 -0
- package/dist/cmd/project/add/domain.d.ts +2 -0
- package/dist/cmd/project/add/domain.d.ts.map +1 -0
- package/dist/cmd/project/add/domain.js +152 -0
- package/dist/cmd/project/add/domain.js.map +1 -0
- package/dist/cmd/project/add/index.d.ts +2 -0
- package/dist/cmd/project/add/index.d.ts.map +1 -0
- package/dist/cmd/project/add/index.js +35 -0
- package/dist/cmd/project/add/index.js.map +1 -0
- package/dist/cmd/project/add/storage.d.ts +2 -0
- package/dist/cmd/project/add/storage.d.ts.map +1 -0
- package/dist/cmd/project/add/storage.js +123 -0
- package/dist/cmd/project/add/storage.js.map +1 -0
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/index.d.ts.map +1 -1
- package/dist/cmd/project/index.js +7 -0
- package/dist/cmd/project/index.js.map +1 -1
- package/dist/cmd/project/reconcile.d.ts.map +1 -1
- package/dist/cmd/project/reconcile.js +32 -0
- package/dist/cmd/project/reconcile.js.map +1 -1
- package/dist/cmd/support/report.js.map +1 -1
- package/dist/cmd/support/system.js +2 -2
- package/dist/cmd/support/system.js.map +1 -1
- package/dist/config.d.ts +6 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -7
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +5 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/repl.js +2 -1
- package/dist/repl.js.map +1 -1
- package/dist/tui/box.d.ts +3 -1
- package/dist/tui/box.d.ts.map +1 -1
- package/dist/tui/box.js +22 -7
- package/dist/tui/box.js.map +1 -1
- package/dist/tui/colors.d.ts +0 -3
- package/dist/tui/colors.d.ts.map +1 -1
- package/dist/tui/colors.js +76 -23
- package/dist/tui/colors.js.map +1 -1
- package/dist/tui/prompt.d.ts +2 -0
- package/dist/tui/prompt.d.ts.map +1 -1
- package/dist/tui/prompt.js +44 -3
- package/dist/tui/prompt.js.map +1 -1
- package/dist/tui/symbols.d.ts +0 -4
- package/dist/tui/symbols.d.ts.map +1 -1
- package/dist/tui/symbols.js +5 -0
- package/dist/tui/symbols.js.map +1 -1
- package/dist/tui.d.ts +8 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +54 -9
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +37 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +5 -0
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/agent-detection.ts +457 -160
- package/src/ai-help.ts +393 -0
- package/src/api.ts +1 -1
- package/src/auth.ts +226 -17
- package/src/banner.ts +5 -0
- package/src/cache/agent-intro.ts +62 -0
- package/src/cache/index.ts +2 -0
- package/src/cache/resource-region.ts +28 -7
- package/src/catalyst.ts +16 -0
- package/src/cli.ts +375 -93
- package/src/cmd/ai/detect.ts +54 -0
- package/src/cmd/ai/index.ts +18 -1
- package/src/cmd/ai/intro.ts +154 -0
- package/src/cmd/ai/opencode/run.ts +5 -0
- package/src/cmd/build/ast.ts +97 -0
- package/src/cmd/build/vite/bun-dev-server.ts +2 -0
- package/src/cmd/build/vite/docs-generator.ts +15 -1
- package/src/cmd/build/vite/env-types-generator.ts +145 -0
- package/src/cmd/build/vite/index.ts +15 -0
- package/src/cmd/build/vite/public-asset-path-plugin.ts +8 -2
- package/src/cmd/build/vite/vite-builder.ts +31 -11
- package/src/cmd/cloud/db/create.ts +16 -16
- package/src/cmd/cloud/db/delete.ts +19 -19
- package/src/cmd/cloud/db/get.ts +32 -17
- package/src/cmd/cloud/deploy-fork.ts +2 -0
- package/src/cmd/cloud/deploy.ts +17 -0
- package/src/cmd/cloud/env/import.ts +6 -6
- package/src/cmd/cloud/env/list.ts +11 -11
- package/src/cmd/cloud/env/push.ts +6 -6
- package/src/cmd/cloud/keyvalue/util.ts +3 -3
- package/src/cmd/cloud/machine/list.ts +3 -3
- package/src/cmd/cloud/region/index.ts +3 -3
- package/src/cmd/cloud/region-lookup.ts +82 -22
- package/src/cmd/cloud/sandbox/cp.ts +9 -4
- package/src/cmd/cloud/sandbox/create.ts +2 -2
- package/src/cmd/cloud/sandbox/delete.ts +10 -7
- package/src/cmd/cloud/sandbox/download.ts +8 -5
- package/src/cmd/cloud/sandbox/env.ts +8 -5
- package/src/cmd/cloud/sandbox/exec.ts +10 -5
- package/src/cmd/cloud/sandbox/get.ts +13 -7
- package/src/cmd/cloud/sandbox/list.ts +47 -73
- package/src/cmd/cloud/sandbox/ls.ts +9 -5
- package/src/cmd/cloud/sandbox/mkdir.ts +9 -5
- package/src/cmd/cloud/sandbox/rm.ts +9 -5
- package/src/cmd/cloud/sandbox/rmdir.ts +9 -5
- package/src/cmd/cloud/sandbox/run.ts +1 -1
- package/src/cmd/cloud/sandbox/snapshot/build.ts +31 -31
- package/src/cmd/cloud/sandbox/snapshot/get.ts +17 -17
- package/src/cmd/cloud/sandbox/upload.ts +8 -5
- package/src/cmd/cloud/sandbox/util.ts +15 -14
- package/src/cmd/cloud/ssh.ts +2 -4
- package/src/cmd/cloud/storage/create.ts +16 -16
- package/src/cmd/cloud/storage/delete.ts +19 -19
- package/src/cmd/cloud/storage/get.ts +5 -16
- package/src/cmd/cloud/storage/list.ts +12 -6
- package/src/cmd/cloud/stream/create.ts +8 -4
- package/src/cmd/cloud/stream/delete.ts +28 -4
- package/src/cmd/cloud/stream/get.ts +102 -64
- package/src/cmd/cloud/stream/list.ts +76 -44
- package/src/cmd/cloud/stream/util.ts +39 -3
- package/src/cmd/cloud/vector/util.ts +3 -3
- package/src/cmd/dev/index.ts +4 -4
- package/src/cmd/git/account/add.ts +5 -5
- package/src/cmd/git/list.ts +7 -7
- package/src/cmd/project/add/database.ts +145 -0
- package/src/cmd/project/add/domain.ts +181 -0
- package/src/cmd/project/add/index.ts +35 -0
- package/src/cmd/project/add/storage.ts +147 -0
- package/src/cmd/project/auth/init.ts +6 -6
- package/src/cmd/project/index.ts +7 -0
- package/src/cmd/project/reconcile.ts +40 -0
- package/src/cmd/support/report.ts +5 -5
- package/src/cmd/support/system.ts +2 -2
- package/src/config.ts +40 -12
- package/src/errors.ts +7 -0
- package/src/index.ts +11 -0
- package/src/repl.ts +4 -1
- package/src/tui/box.ts +24 -9
- package/src/tui/colors.ts +83 -26
- package/src/tui/prompt.ts +55 -3
- package/src/tui/symbols.ts +6 -0
- package/src/tui.ts +55 -9
- package/src/types.ts +46 -2
- package/src/version-check.ts +6 -0
|
@@ -63,6 +63,8 @@ export interface ViteBuildOptions {
|
|
|
63
63
|
deploymentOptions?: DeployOptions;
|
|
64
64
|
/** Optional collector for structured error reporting */
|
|
65
65
|
collector?: BuildReportCollector;
|
|
66
|
+
/** Optional config profile name (e.g., 'staging', 'test') for .env.{profile} files */
|
|
67
|
+
profile?: string;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/**
|
|
@@ -70,7 +72,15 @@ export interface ViteBuildOptions {
|
|
|
70
72
|
* Uses inline Vite config (customizable via agentuity.config.ts)
|
|
71
73
|
*/
|
|
72
74
|
export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
|
|
73
|
-
const {
|
|
75
|
+
const {
|
|
76
|
+
rootDir,
|
|
77
|
+
mode,
|
|
78
|
+
dev = false,
|
|
79
|
+
projectId = '',
|
|
80
|
+
deploymentId = '',
|
|
81
|
+
logger,
|
|
82
|
+
profile,
|
|
83
|
+
} = options;
|
|
74
84
|
|
|
75
85
|
logger.debug(`Running Vite build for mode: ${mode}`);
|
|
76
86
|
|
|
@@ -93,6 +103,16 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
|
|
|
93
103
|
const { generateLifecycleTypes } = await import('./lifecycle-generator');
|
|
94
104
|
await generateLifecycleTypes(rootDir, srcDir, logger);
|
|
95
105
|
|
|
106
|
+
// Generate environment types from local .env files
|
|
107
|
+
const { generateEnvTypes } = await import('./env-types-generator');
|
|
108
|
+
await generateEnvTypes({
|
|
109
|
+
rootDir,
|
|
110
|
+
srcDir,
|
|
111
|
+
logger,
|
|
112
|
+
isProduction: !dev,
|
|
113
|
+
profile,
|
|
114
|
+
});
|
|
115
|
+
|
|
96
116
|
// Load workbench config for entry file generation
|
|
97
117
|
const { loadAgentuityConfig, getWorkbenchConfig } = await import('./config-loader');
|
|
98
118
|
const config = await loadAgentuityConfig(rootDir, logger);
|
|
@@ -203,17 +223,17 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
|
|
|
203
223
|
? JSON.stringify(workbenchRoute)
|
|
204
224
|
: 'undefined',
|
|
205
225
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
226
|
+
build: {
|
|
227
|
+
outDir: clientOutDir,
|
|
228
|
+
rollupOptions: {
|
|
229
|
+
input: htmlPath,
|
|
230
|
+
},
|
|
231
|
+
manifest: true,
|
|
232
|
+
emptyOutDir: true,
|
|
233
|
+
// Copy public files to output for CDN upload (production builds only)
|
|
234
|
+
// In dev mode, Vite serves them directly from src/web/public/
|
|
235
|
+
copyPublicDir: !dev,
|
|
210
236
|
},
|
|
211
|
-
manifest: true,
|
|
212
|
-
emptyOutDir: true,
|
|
213
|
-
// Copy public files to output for CDN upload (production builds only)
|
|
214
|
-
// In dev mode, Vite serves them directly from src/web/public/
|
|
215
|
-
copyPublicDir: !dev,
|
|
216
|
-
},
|
|
217
237
|
logLevel: 'warn',
|
|
218
238
|
};
|
|
219
239
|
} else if (mode === 'workbench') {
|
|
@@ -74,24 +74,24 @@ export const createSubcommand = defineSubcommand({
|
|
|
74
74
|
]);
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const resource = created[0];
|
|
78
|
+
if (resource) {
|
|
79
|
+
// Write environment variables to .env if running inside a project
|
|
80
|
+
if (ctx.projectDir && resource.env && Object.keys(resource.env).length > 0) {
|
|
81
|
+
await addResourceEnvVars(ctx.projectDir, resource.env);
|
|
82
|
+
if (!options.json) {
|
|
83
|
+
tui.info('Environment variables written to .env');
|
|
84
|
+
}
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
if (!options.json) {
|
|
88
|
+
tui.success(`Created database: ${tui.bold(resource.name)}`);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
success: true,
|
|
92
|
+
name: resource.name,
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
95
|
tui.fatal('Failed to create database');
|
|
96
96
|
}
|
|
97
97
|
} catch (ex) {
|
|
@@ -178,27 +178,27 @@ export const deleteSubcommand = createSubcommand({
|
|
|
178
178
|
},
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
181
|
+
const resource = deleted[0];
|
|
182
|
+
if (resource) {
|
|
183
|
+
// Clear cache entry for deleted database
|
|
184
|
+
await deleteResourceRegion('db', profileName, resource.name);
|
|
185
|
+
|
|
186
|
+
// Remove env vars from .env if running inside a project
|
|
187
|
+
if (ctx.projectDir && resource.env_keys.length > 0) {
|
|
188
|
+
await removeResourceEnvVars(ctx.projectDir, resource.env_keys);
|
|
189
|
+
if (!options.json) {
|
|
190
|
+
tui.info(`Removed ${resource.env_keys.join(', ')} from .env`);
|
|
191
|
+
}
|
|
191
192
|
}
|
|
192
|
-
}
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
194
|
+
if (!options.json) {
|
|
195
|
+
tui.success(`Deleted database: ${tui.bold(resource.name)}`);
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
success: true,
|
|
199
|
+
name: resource.name,
|
|
200
|
+
};
|
|
201
|
+
} else {
|
|
202
202
|
tui.error('Failed to delete database');
|
|
203
203
|
return { success: false, name: dbName };
|
|
204
204
|
}
|
package/src/cmd/cloud/db/get.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as tui from '../../../tui';
|
|
|
5
5
|
import { getGlobalCatalystAPIClient, getCatalystAPIClient } from '../../../config';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { ErrorCode } from '../../../errors';
|
|
8
|
-
import {
|
|
8
|
+
import { setResourceInfo } from '../../../cache';
|
|
9
9
|
|
|
10
10
|
const DBGetResponseSchema = z
|
|
11
11
|
.object({
|
|
@@ -27,7 +27,6 @@ export const getSubcommand = createSubcommand({
|
|
|
27
27
|
description: 'Show details about a specific database',
|
|
28
28
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
29
29
|
requires: { auth: true },
|
|
30
|
-
optional: { org: true },
|
|
31
30
|
idempotent: true,
|
|
32
31
|
examples: [
|
|
33
32
|
{ command: `${getCommand('cloud db get')} my-database`, description: 'Get database details' },
|
|
@@ -52,6 +51,22 @@ export const getSubcommand = createSubcommand({
|
|
|
52
51
|
description: 'Get table schemas as JSON',
|
|
53
52
|
},
|
|
54
53
|
],
|
|
54
|
+
resourceRules: [
|
|
55
|
+
{
|
|
56
|
+
resource: 'org',
|
|
57
|
+
required: false,
|
|
58
|
+
flag: 'org-id',
|
|
59
|
+
envVar: 'AGENTUITY_CLOUD_ORG_ID',
|
|
60
|
+
canUseCache: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
resource: 'region',
|
|
64
|
+
required: false,
|
|
65
|
+
flag: 'region',
|
|
66
|
+
envVar: 'AGENTUITY_REGION',
|
|
67
|
+
operationType: 'read',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
55
70
|
schema: {
|
|
56
71
|
args: z.object({
|
|
57
72
|
name: z.string().describe('Database name'),
|
|
@@ -76,30 +91,20 @@ export const getSubcommand = createSubcommand({
|
|
|
76
91
|
const profileName = config?.name ?? 'production';
|
|
77
92
|
const globalClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
78
93
|
|
|
79
|
-
//
|
|
80
|
-
const cachedInfo = await getResourceInfo('db', profileName, args.name);
|
|
81
|
-
const orgId = ctx.orgId ?? cachedInfo?.orgId;
|
|
82
|
-
|
|
83
|
-
if (!orgId) {
|
|
84
|
-
tui.fatal(
|
|
85
|
-
`Organization not found for database '${args.name}'. Run 'agentuity cloud db list' first or specify --org-id.`,
|
|
86
|
-
ErrorCode.INVALID_ARGUMENT
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
94
|
+
// Search across all orgs the user has access to
|
|
90
95
|
const resources = await tui.spinner({
|
|
91
96
|
message: `Fetching database ${args.name}`,
|
|
92
97
|
clearOnSuccess: true,
|
|
93
98
|
callback: async () => {
|
|
94
|
-
return listOrgResources(globalClient, { type: 'db'
|
|
99
|
+
return listOrgResources(globalClient, { type: 'db' });
|
|
95
100
|
},
|
|
96
101
|
});
|
|
97
102
|
|
|
98
103
|
const db = resources.db.find((d) => d.name === args.name);
|
|
99
104
|
|
|
100
105
|
// Cache the database info for future lookups
|
|
101
|
-
if (db?.cloud_region) {
|
|
102
|
-
await setResourceInfo('db', profileName, db.name, db.cloud_region,
|
|
106
|
+
if (db?.cloud_region && db.org_id) {
|
|
107
|
+
await setResourceInfo('db', profileName, db.name, db.cloud_region, db.org_id);
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
if (!db) {
|
|
@@ -111,13 +116,23 @@ export const getSubcommand = createSubcommand({
|
|
|
111
116
|
if (opts.showTables) {
|
|
112
117
|
const region = db.cloud_region;
|
|
113
118
|
const regionalClient = getCatalystAPIClient(logger, auth, region);
|
|
119
|
+
|
|
120
|
+
// Validate org_id is present - dbTables requires orgId for authorization
|
|
121
|
+
// Some internal databases may not have org_id set, which would fail the API call
|
|
122
|
+
if (!db.org_id) {
|
|
123
|
+
tui.fatal(
|
|
124
|
+
`Database '${args.name}' is missing organization information and cannot be queried for tables`,
|
|
125
|
+
ErrorCode.RESOURCE_NOT_FOUND
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
114
129
|
const tables = await tui.spinner({
|
|
115
130
|
message: `Fetching table schemas for ${args.name}`,
|
|
116
131
|
clearOnSuccess: true,
|
|
117
132
|
callback: async () => {
|
|
118
133
|
return dbTables(regionalClient, {
|
|
119
134
|
database: args.name,
|
|
120
|
-
orgId,
|
|
135
|
+
orgId: db.org_id,
|
|
121
136
|
region,
|
|
122
137
|
});
|
|
123
138
|
},
|
|
@@ -17,6 +17,7 @@ import { existsSync, readFileSync, unlinkSync } from 'node:fs';
|
|
|
17
17
|
import type { APIClient } from '../../api';
|
|
18
18
|
import { getUserAgent } from '../../api';
|
|
19
19
|
import { isUnicode } from '../../tui/symbols';
|
|
20
|
+
import { getAgentEnv } from '../../agent-detection';
|
|
20
21
|
import { projectDeploymentFail, type ClientDiagnostics, type Deployment } from '@agentuity/server';
|
|
21
22
|
import type { Logger } from '@agentuity/core';
|
|
22
23
|
|
|
@@ -174,6 +175,7 @@ export async function runForkedDeploy(options: ForkDeployOptions): Promise<ForkD
|
|
|
174
175
|
cwd: projectDir,
|
|
175
176
|
env: {
|
|
176
177
|
...process.env,
|
|
178
|
+
...getAgentEnv(),
|
|
177
179
|
AGENTUITY_FORK_PARENT: '1',
|
|
178
180
|
AGENTUITY_DEPLOYMENT: deploymentEnvValue,
|
|
179
181
|
// Force color and unicode output since child stdout/stderr are piped (not TTY)
|
package/src/cmd/cloud/deploy.ts
CHANGED
|
@@ -106,6 +106,23 @@ export const deploySubcommand = createSubcommand({
|
|
|
106
106
|
idempotent: false,
|
|
107
107
|
requires: { auth: true, project: true, apiClient: true },
|
|
108
108
|
prerequisites: ['auth login'],
|
|
109
|
+
resourceRules: [
|
|
110
|
+
{
|
|
111
|
+
resource: 'project',
|
|
112
|
+
required: true,
|
|
113
|
+
flag: 'project-id',
|
|
114
|
+
envVar: 'AGENTUITY_CLOUD_PROJECT_ID',
|
|
115
|
+
impliedFrom: 'agentuity.json',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
resource: 'region',
|
|
119
|
+
required: true,
|
|
120
|
+
flag: 'region',
|
|
121
|
+
envVar: 'AGENTUITY_REGION',
|
|
122
|
+
configPref: 'region',
|
|
123
|
+
operationType: 'mutate',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
109
126
|
schema: {
|
|
110
127
|
options: z.intersection(
|
|
111
128
|
DeployOptionsSchema,
|
|
@@ -113,14 +113,14 @@ export const importSubcommand = createSubcommand({
|
|
|
113
113
|
tui.warning(
|
|
114
114
|
`Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
|
|
115
115
|
);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
for (const key of publicSecretKeys) {
|
|
117
|
+
delete secrets[key];
|
|
118
|
+
const value = filteredVars[key];
|
|
119
|
+
if (value !== undefined) {
|
|
120
|
+
env[key] = value;
|
|
121
|
+
}
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
}
|
|
124
124
|
|
|
125
125
|
const envCount = Object.keys(env).length;
|
|
126
126
|
const secretCount = Object.keys(secrets).length;
|
|
@@ -168,17 +168,17 @@ export const listSubcommand = createSubcommand({
|
|
|
168
168
|
const sortedKeys = Object.keys(result).sort();
|
|
169
169
|
const shouldMask = opts?.mask !== false;
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
for (const key of sortedKeys) {
|
|
172
|
+
const entry = result[key];
|
|
173
|
+
if (!entry) continue;
|
|
174
|
+
const { value, secret, scope } = entry;
|
|
175
|
+
const displayValue = shouldMask && secret ? tui.maskSecret(value) : value;
|
|
176
|
+
const typeIndicator = secret ? ' [secret]' : '';
|
|
177
|
+
const scopeIndicator = !useOrgScope ? ` [${scope}]` : '';
|
|
178
|
+
console.log(
|
|
179
|
+
`${tui.bold(key)}=${displayValue}${tui.muted(typeIndicator + scopeIndicator)}`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
@@ -80,14 +80,14 @@ export const pushSubcommand = createSubcommand({
|
|
|
80
80
|
tui.warning(
|
|
81
81
|
`Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
|
|
82
82
|
);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
for (const key of publicSecretKeys) {
|
|
84
|
+
delete secrets[key];
|
|
85
|
+
const value = filteredEnv[key];
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
env[key] = value;
|
|
88
|
+
}
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
91
|
|
|
92
92
|
if (useOrgScope) {
|
|
93
93
|
// Organization scope
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyValueStorageService, type Logger } from '@agentuity/core';
|
|
2
|
-
import { createServerFetchAdapter
|
|
2
|
+
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
3
|
import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
|
|
4
|
+
import { getCatalystUrl } from '../../../catalyst';
|
|
4
5
|
import * as tui from '../../../tui';
|
|
5
6
|
|
|
6
7
|
export function createStorageAdapter(ctx: {
|
|
@@ -31,7 +32,6 @@ export function createStorageAdapter(ctx: {
|
|
|
31
32
|
ctx.logger
|
|
32
33
|
);
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
-
const baseUrl = urls.catalyst;
|
|
35
|
+
const baseUrl = getCatalystUrl(ctx.region);
|
|
36
36
|
return new KeyValueStorageService(baseUrl, adapter);
|
|
37
37
|
}
|
|
@@ -32,15 +32,15 @@ export const listSubcommand = createSubcommand({
|
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
aliases: ['ls'],
|
|
35
|
-
requires: { auth: true
|
|
35
|
+
requires: { auth: true },
|
|
36
36
|
idempotent: true,
|
|
37
37
|
schema: {
|
|
38
38
|
response: MachineListResponseSchema,
|
|
39
39
|
},
|
|
40
40
|
async handler(ctx) {
|
|
41
|
-
const { options, logger, auth, config
|
|
41
|
+
const { options, logger, auth, config } = ctx;
|
|
42
42
|
|
|
43
|
-
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name
|
|
43
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
const machines = await machineList(catalystClient);
|
|
@@ -45,9 +45,9 @@ const selectCommand = createSubcommand({
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (regions.length === 1 && regions[0]) {
|
|
49
|
+
selectedRegion = regions[0].region;
|
|
50
|
+
} else {
|
|
51
51
|
const response = await tui.createPrompt().select<string>({
|
|
52
52
|
message: 'Select a default region',
|
|
53
53
|
options: regions.map((r) => ({
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { StreamStorageService, type Logger } from '@agentuity/core';
|
|
2
|
+
import {
|
|
3
|
+
projectGet,
|
|
4
|
+
sandboxResolve,
|
|
5
|
+
deploymentGet,
|
|
6
|
+
type APIClient,
|
|
7
|
+
createServerFetchAdapter,
|
|
8
|
+
getServiceUrls,
|
|
9
|
+
} from '@agentuity/server';
|
|
10
|
+
import { getResourceInfo, setResourceInfo } from '../../cache';
|
|
11
|
+
import { getDefaultRegion } from '../../config';
|
|
5
12
|
import type { AuthData, Config } from '../../types';
|
|
6
13
|
import * as tui from '../../tui';
|
|
7
14
|
import { ErrorCode } from '../../errors';
|
|
8
15
|
|
|
9
|
-
export type IdentifierType = 'project' | 'deployment' | 'sandbox';
|
|
16
|
+
export type IdentifierType = 'project' | 'deployment' | 'sandbox' | 'stream';
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* Determine the type of identifier based on its prefix
|
|
@@ -21,18 +28,24 @@ export function getIdentifierType(identifier: string): IdentifierType {
|
|
|
21
28
|
if (identifier.startsWith('sbx_')) {
|
|
22
29
|
return 'sandbox';
|
|
23
30
|
}
|
|
31
|
+
if (identifier.startsWith('stream_')) {
|
|
32
|
+
return 'stream';
|
|
33
|
+
}
|
|
24
34
|
// Default to project for unknown prefixes
|
|
25
35
|
return 'project';
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
/**
|
|
29
|
-
* Look up the region for a project, deployment, or
|
|
39
|
+
* Look up the region for a project, deployment, sandbox, or stream identifier.
|
|
30
40
|
* Uses cache-first strategy with API fallback.
|
|
41
|
+
*
|
|
42
|
+
* @param apiClient - Required for project/deployment lookups, optional for sandbox/stream
|
|
43
|
+
* (they create their own clients internally)
|
|
31
44
|
*/
|
|
32
45
|
export async function getIdentifierRegion(
|
|
33
46
|
logger: Logger,
|
|
34
47
|
auth: AuthData,
|
|
35
|
-
apiClient: APIClient,
|
|
48
|
+
apiClient: APIClient | undefined,
|
|
36
49
|
profileName = 'production',
|
|
37
50
|
identifier: string,
|
|
38
51
|
orgId?: string,
|
|
@@ -41,10 +54,10 @@ export async function getIdentifierRegion(
|
|
|
41
54
|
const identifierType = getIdentifierType(identifier);
|
|
42
55
|
|
|
43
56
|
// For project, deployment, and sandbox, check cache first
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
logger.trace(`[region-lookup] Found cached region for ${identifier}: ${
|
|
47
|
-
return
|
|
57
|
+
const cachedInfo = await getResourceInfo(identifierType, profileName, identifier);
|
|
58
|
+
if (cachedInfo?.region) {
|
|
59
|
+
logger.trace(`[region-lookup] Found cached region for ${identifier}: ${cachedInfo.region}`);
|
|
60
|
+
return cachedInfo.region;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
logger.trace(`[region-lookup] Cache miss for ${identifier}, fetching from API`);
|
|
@@ -52,22 +65,69 @@ export async function getIdentifierRegion(
|
|
|
52
65
|
let region: string | null = null;
|
|
53
66
|
|
|
54
67
|
if (identifierType === 'project') {
|
|
68
|
+
if (!apiClient) {
|
|
69
|
+
tui.fatal(
|
|
70
|
+
`API client required for project region lookup. This is an internal error.`,
|
|
71
|
+
ErrorCode.INVALID_ARGUMENT
|
|
72
|
+
);
|
|
73
|
+
}
|
|
55
74
|
const project = await projectGet(apiClient, { id: identifier, mask: true, keys: false });
|
|
56
75
|
region = project.cloudRegion ?? null;
|
|
57
76
|
} else if (identifierType === 'deployment') {
|
|
77
|
+
if (!apiClient) {
|
|
78
|
+
tui.fatal(
|
|
79
|
+
`API client required for deployment region lookup. This is an internal error.`,
|
|
80
|
+
ErrorCode.INVALID_ARGUMENT
|
|
81
|
+
);
|
|
82
|
+
}
|
|
58
83
|
const deployment = await deploymentGet(apiClient, identifier);
|
|
59
84
|
region = deployment.cloudRegion ?? null;
|
|
85
|
+
} else if (identifierType === 'sandbox') {
|
|
86
|
+
// sandbox - use CLI API to resolve across all orgs the user has access to
|
|
87
|
+
if (!apiClient) {
|
|
88
|
+
tui.fatal(
|
|
89
|
+
`API client required for sandbox region lookup. This is an internal error.`,
|
|
90
|
+
ErrorCode.INVALID_ARGUMENT
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
const sandbox = await sandboxResolve(apiClient, identifier);
|
|
94
|
+
region = sandbox.region ?? null;
|
|
95
|
+
// Cache the orgId along with the region for future lookups
|
|
96
|
+
if (sandbox.orgId) {
|
|
97
|
+
orgId = sandbox.orgId;
|
|
98
|
+
}
|
|
60
99
|
} else {
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
100
|
+
// stream - use the streams service to look up stream info
|
|
101
|
+
// Any regional streams service can look up any stream and return its info
|
|
102
|
+
// The service authenticates based on user's org membership, no explicit orgId needed
|
|
103
|
+
const defaultRegion = await getDefaultRegion(profileName, config);
|
|
104
|
+
const baseUrl = getServiceUrls(defaultRegion).stream;
|
|
105
|
+
|
|
106
|
+
// Include orgId if available, but don't require it
|
|
107
|
+
const resolvedOrgId =
|
|
108
|
+
orgId ?? process.env.AGENTUITY_CLOUD_ORG_ID ?? config?.preferences?.orgId;
|
|
109
|
+
|
|
110
|
+
const adapter = createServerFetchAdapter(
|
|
111
|
+
{
|
|
112
|
+
headers: {
|
|
113
|
+
Authorization: `Bearer ${auth.apiKey}`,
|
|
114
|
+
},
|
|
115
|
+
queryParams: resolvedOrgId ? { orgId: resolvedOrgId } : undefined,
|
|
116
|
+
},
|
|
117
|
+
logger
|
|
68
118
|
);
|
|
69
|
-
|
|
70
|
-
|
|
119
|
+
|
|
120
|
+
const streamService = new StreamStorageService(baseUrl, adapter);
|
|
121
|
+
const streamInfo = await streamService.get(identifier);
|
|
122
|
+
|
|
123
|
+
// Extract region from the stream URL (e.g., https://streams-use.agentuity.cloud/...)
|
|
124
|
+
const urlMatch = streamInfo.url.match(/https:\/\/streams-([^.]+)\.agentuity\.cloud/);
|
|
125
|
+
if (urlMatch?.[1]) {
|
|
126
|
+
region = urlMatch[1];
|
|
127
|
+
} else if (streamInfo.url.includes('streams.agentuity.io')) {
|
|
128
|
+
// Local environment
|
|
129
|
+
region = 'local';
|
|
130
|
+
}
|
|
71
131
|
}
|
|
72
132
|
|
|
73
133
|
if (!region) {
|
|
@@ -86,7 +146,7 @@ export async function getIdentifierRegion(
|
|
|
86
146
|
}
|
|
87
147
|
|
|
88
148
|
// Cache the result
|
|
89
|
-
await
|
|
149
|
+
await setResourceInfo(identifierType, profileName, identifier, region, orgId);
|
|
90
150
|
logger.trace(`[region-lookup] Cached region for ${identifier}: ${region}`);
|
|
91
151
|
|
|
92
152
|
return region;
|
|
@@ -100,5 +160,5 @@ export async function cacheProjectRegion(
|
|
|
100
160
|
projectId: string,
|
|
101
161
|
region: string
|
|
102
162
|
): Promise<void> {
|
|
103
|
-
await
|
|
163
|
+
await setResourceInfo('project', profileName, projectId, region);
|
|
104
164
|
}
|
|
@@ -3,13 +3,14 @@ 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 {
|
|
6
|
+
import { createSandboxClient } from './util';
|
|
7
7
|
import { getCommand } from '../../../command-prefix';
|
|
8
8
|
import {
|
|
9
9
|
sandboxWriteFiles,
|
|
10
10
|
sandboxReadFile,
|
|
11
11
|
sandboxExecute,
|
|
12
12
|
executionGet,
|
|
13
|
+
sandboxResolve,
|
|
13
14
|
type APIClient,
|
|
14
15
|
} from '@agentuity/server';
|
|
15
16
|
import type { Logger, FileToWrite } from '@agentuity/core';
|
|
@@ -47,7 +48,7 @@ export const cpSubcommand = createCommand({
|
|
|
47
48
|
aliases: ['copy'],
|
|
48
49
|
description: 'Copy files or directories to or from a sandbox',
|
|
49
50
|
tags: ['slow', 'requires-auth'],
|
|
50
|
-
requires: { auth: true,
|
|
51
|
+
requires: { auth: true, apiClient: true },
|
|
51
52
|
examples: [
|
|
52
53
|
{
|
|
53
54
|
command: getCommand('cloud sandbox cp ./local-file.txt snbx_abc123:/path/to/file.txt'),
|
|
@@ -84,7 +85,7 @@ export const cpSubcommand = createCommand({
|
|
|
84
85
|
},
|
|
85
86
|
|
|
86
87
|
async handler(ctx) {
|
|
87
|
-
const { args, opts, options, auth, logger,
|
|
88
|
+
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
88
89
|
|
|
89
90
|
const source = parsePath(args.source);
|
|
90
91
|
const destination = parsePath(args.destination);
|
|
@@ -102,7 +103,11 @@ export const cpSubcommand = createCommand({
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const sandboxId = source.sandboxId ?? destination.sandboxId!;
|
|
105
|
-
|
|
106
|
+
|
|
107
|
+
// Resolve sandbox to get region and orgId using CLI API
|
|
108
|
+
const sandboxInfo = await sandboxResolve(apiClient, sandboxId);
|
|
109
|
+
const { region, orgId } = sandboxInfo;
|
|
110
|
+
|
|
106
111
|
const client = createSandboxClient(logger, auth, region);
|
|
107
112
|
const recursive = opts.recursive ?? false;
|
|
108
113
|
|
|
@@ -147,7 +147,7 @@ export const createSubcommand = createCommand({
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
const files = parseFileArgs(opts.file);
|
|
150
|
+
const files = await parseFileArgs(opts.file);
|
|
151
151
|
const hasFiles = files.length > 0;
|
|
152
152
|
|
|
153
153
|
let metadata: Record<string, unknown> | undefined;
|
|
@@ -185,7 +185,7 @@ export const createSubcommand = createCommand({
|
|
|
185
185
|
: undefined,
|
|
186
186
|
timeout: opts.idleTimeout ? { idle: opts.idleTimeout } : undefined,
|
|
187
187
|
env: Object.keys(envMap).length > 0 ? envMap : undefined,
|
|
188
|
-
|
|
188
|
+
files: hasFiles ? files : undefined,
|
|
189
189
|
snapshot: opts.snapshot,
|
|
190
190
|
dependencies: opts.dependency,
|
|
191
191
|
metadata,
|