@agentuity/cli 0.0.48 → 0.0.50
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/bin/cli.ts +26 -5
- package/dist/banner.d.ts +1 -1
- package/dist/banner.d.ts.map +1 -1
- package/dist/cli-logger.d.ts +27 -0
- package/dist/cli-logger.d.ts.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cmd/agents/index.d.ts +2 -0
- package/dist/cmd/agents/index.d.ts.map +1 -0
- package/dist/cmd/auth/index.d.ts.map +1 -1
- package/dist/cmd/auth/login.d.ts.map +1 -1
- package/dist/cmd/auth/logout.d.ts.map +1 -1
- package/dist/cmd/auth/signup.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/add.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/delete.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/index.d.ts +1 -2
- package/dist/cmd/auth/ssh/index.d.ts.map +1 -1
- package/dist/cmd/auth/ssh/list.d.ts.map +1 -1
- package/dist/cmd/auth/whoami.d.ts.map +1 -1
- package/dist/cmd/bundle/ast.d.ts +3 -1
- package/dist/cmd/bundle/ast.d.ts.map +1 -1
- package/dist/cmd/bundle/index.d.ts.map +1 -1
- package/dist/cmd/bundle/plugin.d.ts.map +1 -1
- package/dist/cmd/capabilities/index.d.ts +4 -0
- package/dist/cmd/capabilities/index.d.ts.map +1 -0
- package/dist/cmd/capabilities/show.d.ts +20 -0
- package/dist/cmd/capabilities/show.d.ts.map +1 -0
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/index.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/list.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/remove.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/rollback.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/undeploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/utils.d.ts +4 -2
- package/dist/cmd/cloud/deployment/utils.d.ts.map +1 -1
- package/dist/cmd/cloud/domain.d.ts.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/resource/add.d.ts.map +1 -1
- package/dist/cmd/cloud/resource/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/resource/index.d.ts +1 -2
- package/dist/cmd/cloud/resource/index.d.ts.map +1 -1
- package/dist/cmd/cloud/resource/list.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/index.d.ts +1 -2
- package/dist/cmd/cloud/scp/index.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts +2 -0
- package/dist/cmd/cloud/session/get.d.ts.map +1 -0
- package/dist/cmd/cloud/session/index.d.ts +2 -0
- package/dist/cmd/cloud/session/index.d.ts.map +1 -0
- package/dist/cmd/cloud/session/list.d.ts +2 -0
- package/dist/cmd/cloud/session/list.d.ts.map +1 -0
- package/dist/cmd/cloud/session/logs.d.ts +2 -0
- package/dist/cmd/cloud/session/logs.d.ts.map +1 -0
- package/dist/cmd/cloud/ssh.d.ts.map +1 -1
- package/dist/cmd/dev/agents.d.ts +2 -0
- package/dist/cmd/dev/agents.d.ts.map +1 -0
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/sync.d.ts +12 -0
- package/dist/cmd/dev/sync.d.ts.map +1 -0
- package/dist/cmd/env/delete.d.ts.map +1 -1
- package/dist/cmd/env/get.d.ts.map +1 -1
- package/dist/cmd/env/import.d.ts.map +1 -1
- package/dist/cmd/env/index.d.ts.map +1 -1
- package/dist/cmd/env/list.d.ts.map +1 -1
- package/dist/cmd/env/pull.d.ts.map +1 -1
- package/dist/cmd/env/push.d.ts.map +1 -1
- package/dist/cmd/env/set.d.ts.map +1 -1
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/kv/create-namespace.d.ts +3 -0
- package/dist/cmd/kv/create-namespace.d.ts.map +1 -0
- package/dist/cmd/kv/delete-namespace.d.ts +3 -0
- package/dist/cmd/kv/delete-namespace.d.ts.map +1 -0
- package/dist/cmd/kv/delete.d.ts +3 -0
- package/dist/cmd/kv/delete.d.ts.map +1 -0
- package/dist/cmd/kv/get.d.ts +3 -0
- package/dist/cmd/kv/get.d.ts.map +1 -0
- package/dist/cmd/kv/index.d.ts +2 -0
- package/dist/cmd/kv/index.d.ts.map +1 -0
- package/dist/cmd/kv/keys.d.ts +3 -0
- package/dist/cmd/kv/keys.d.ts.map +1 -0
- package/dist/cmd/kv/list-namespaces.d.ts +3 -0
- package/dist/cmd/kv/list-namespaces.d.ts.map +1 -0
- package/dist/cmd/kv/repl.d.ts +3 -0
- package/dist/cmd/kv/repl.d.ts.map +1 -0
- package/dist/cmd/kv/search.d.ts +3 -0
- package/dist/cmd/kv/search.d.ts.map +1 -0
- package/dist/cmd/kv/set.d.ts +3 -0
- package/dist/cmd/kv/set.d.ts.map +1 -0
- package/dist/cmd/kv/stats.d.ts +3 -0
- package/dist/cmd/kv/stats.d.ts.map +1 -0
- package/dist/cmd/kv/util.d.ts +8 -0
- package/dist/cmd/kv/util.d.ts.map +1 -0
- package/dist/cmd/objectstore/delete-bucket.d.ts +3 -0
- package/dist/cmd/objectstore/delete-bucket.d.ts.map +1 -0
- package/dist/cmd/objectstore/delete.d.ts +3 -0
- package/dist/cmd/objectstore/delete.d.ts.map +1 -0
- package/dist/cmd/objectstore/get.d.ts +3 -0
- package/dist/cmd/objectstore/get.d.ts.map +1 -0
- package/dist/cmd/objectstore/index.d.ts +2 -0
- package/dist/cmd/objectstore/index.d.ts.map +1 -0
- package/dist/cmd/objectstore/list-buckets.d.ts +3 -0
- package/dist/cmd/objectstore/list-buckets.d.ts.map +1 -0
- package/dist/cmd/objectstore/list-keys.d.ts +3 -0
- package/dist/cmd/objectstore/list-keys.d.ts.map +1 -0
- package/dist/cmd/objectstore/put.d.ts +3 -0
- package/dist/cmd/objectstore/put.d.ts.map +1 -0
- package/dist/cmd/objectstore/repl.d.ts +3 -0
- package/dist/cmd/objectstore/repl.d.ts.map +1 -0
- package/dist/cmd/objectstore/url.d.ts +3 -0
- package/dist/cmd/objectstore/url.d.ts.map +1 -0
- package/dist/cmd/objectstore/util.d.ts +8 -0
- package/dist/cmd/objectstore/util.d.ts.map +1 -0
- package/dist/cmd/profile/create.d.ts.map +1 -1
- package/dist/cmd/profile/delete.d.ts.map +1 -1
- package/dist/cmd/profile/index.d.ts.map +1 -1
- package/dist/cmd/profile/list.d.ts +1 -2
- package/dist/cmd/profile/list.d.ts.map +1 -1
- package/dist/cmd/profile/show.d.ts.map +1 -1
- package/dist/cmd/profile/use.d.ts.map +1 -1
- package/dist/cmd/project/create.d.ts.map +1 -1
- package/dist/cmd/project/delete.d.ts.map +1 -1
- package/dist/cmd/project/index.d.ts.map +1 -1
- package/dist/cmd/project/list.d.ts.map +1 -1
- package/dist/cmd/project/show.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/prompt/index.d.ts +4 -0
- package/dist/cmd/prompt/index.d.ts.map +1 -0
- package/dist/cmd/prompt/llm.d.ts +3 -0
- package/dist/cmd/prompt/llm.d.ts.map +1 -0
- package/dist/cmd/repl/index.d.ts +3 -0
- package/dist/cmd/repl/index.d.ts.map +1 -0
- package/dist/cmd/schema/index.d.ts +4 -0
- package/dist/cmd/schema/index.d.ts.map +1 -0
- package/dist/cmd/schema/show.d.ts +3 -0
- package/dist/cmd/schema/show.d.ts.map +1 -0
- package/dist/cmd/secret/delete.d.ts.map +1 -1
- package/dist/cmd/secret/get.d.ts.map +1 -1
- package/dist/cmd/secret/import.d.ts.map +1 -1
- package/dist/cmd/secret/index.d.ts.map +1 -1
- package/dist/cmd/secret/list.d.ts.map +1 -1
- package/dist/cmd/secret/pull.d.ts.map +1 -1
- package/dist/cmd/secret/push.d.ts.map +1 -1
- package/dist/cmd/secret/set.d.ts.map +1 -1
- package/dist/cmd/version/index.d.ts.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/errors.d.ts +83 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/explain.d.ts +47 -0
- package/dist/explain.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/output.d.ts +136 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/repl.d.ts +120 -0
- package/dist/repl.d.ts.map +1 -0
- package/dist/schema-generator.d.ts +67 -0
- package/dist/schema-generator.d.ts.map +1 -0
- package/dist/tui.d.ts +35 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/types.d.ts +77 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/package.json +12 -4
- package/src/banner.ts +7 -7
- package/src/cli-logger.ts +80 -0
- package/src/cli.ts +192 -58
- package/src/cmd/agents/index.ts +147 -0
- package/src/cmd/auth/index.ts +1 -0
- package/src/cmd/auth/login.ts +7 -2
- package/src/cmd/auth/logout.ts +4 -0
- package/src/cmd/auth/signup.ts +7 -2
- package/src/cmd/auth/ssh/add.ts +20 -3
- package/src/cmd/auth/ssh/delete.ts +57 -4
- package/src/cmd/auth/ssh/index.ts +4 -3
- package/src/cmd/auth/ssh/list.ts +38 -27
- package/src/cmd/auth/whoami.ts +32 -21
- package/src/cmd/bundle/ast.test.ts +2 -2
- package/src/cmd/bundle/ast.ts +112 -22
- package/src/cmd/bundle/index.ts +20 -0
- package/src/cmd/bundle/plugin.ts +60 -14
- package/src/cmd/capabilities/index.ts +12 -0
- package/src/cmd/capabilities/show.ts +256 -0
- package/src/cmd/cloud/deploy.ts +54 -0
- package/src/cmd/cloud/deployment/index.ts +1 -0
- package/src/cmd/cloud/deployment/list.ts +66 -25
- package/src/cmd/cloud/deployment/remove.ts +26 -2
- package/src/cmd/cloud/deployment/rollback.ts +35 -4
- package/src/cmd/cloud/deployment/show.ts +37 -2
- package/src/cmd/cloud/deployment/undeploy.ts +12 -1
- package/src/cmd/cloud/deployment/utils.ts +5 -2
- package/src/cmd/cloud/domain.ts +3 -2
- package/src/cmd/cloud/index.ts +10 -1
- package/src/cmd/cloud/resource/add.ts +19 -0
- package/src/cmd/cloud/resource/delete.ts +24 -3
- package/src/cmd/cloud/resource/index.ts +4 -3
- package/src/cmd/cloud/resource/list.ts +36 -10
- package/src/cmd/cloud/scp/download.ts +27 -1
- package/src/cmd/cloud/scp/index.ts +4 -3
- package/src/cmd/cloud/scp/upload.ts +27 -1
- package/src/cmd/cloud/session/get.ts +164 -0
- package/src/cmd/cloud/session/index.ts +11 -0
- package/src/cmd/cloud/session/list.ts +145 -0
- package/src/cmd/cloud/session/logs.ts +68 -0
- package/src/cmd/cloud/ssh.ts +12 -0
- package/src/cmd/dev/agents.ts +122 -0
- package/src/cmd/dev/index.ts +106 -8
- package/src/cmd/dev/sync.ts +414 -0
- package/src/cmd/dev/templates.ts +1 -1
- package/src/cmd/env/delete.ts +17 -0
- package/src/cmd/env/get.ts +17 -1
- package/src/cmd/env/import.ts +47 -3
- package/src/cmd/env/index.ts +1 -0
- package/src/cmd/env/list.ts +13 -1
- package/src/cmd/env/pull.ts +20 -0
- package/src/cmd/env/push.ts +33 -1
- package/src/cmd/env/set.ts +25 -1
- package/src/cmd/index.ts +9 -2
- package/src/cmd/kv/create-namespace.ts +45 -0
- package/src/cmd/kv/delete-namespace.ts +73 -0
- package/src/cmd/kv/delete.ts +51 -0
- package/src/cmd/kv/get.ts +65 -0
- package/src/cmd/kv/index.ts +31 -0
- package/src/cmd/kv/keys.ts +57 -0
- package/src/cmd/kv/list-namespaces.ts +43 -0
- package/src/cmd/kv/repl.ts +284 -0
- package/src/cmd/kv/search.ts +80 -0
- package/src/cmd/kv/set.ts +63 -0
- package/src/cmd/kv/stats.ts +96 -0
- package/src/cmd/kv/util.ts +32 -0
- package/src/cmd/objectstore/delete-bucket.ts +72 -0
- package/src/cmd/objectstore/delete.ts +59 -0
- package/src/cmd/objectstore/get.ts +64 -0
- package/src/cmd/objectstore/index.ts +27 -0
- package/src/cmd/objectstore/list-buckets.ts +45 -0
- package/src/cmd/objectstore/list-keys.ts +60 -0
- package/src/cmd/objectstore/put.ts +62 -0
- package/src/cmd/objectstore/repl.ts +235 -0
- package/src/cmd/objectstore/url.ts +59 -0
- package/src/cmd/objectstore/util.ts +28 -0
- package/src/cmd/profile/create.ts +28 -2
- package/src/cmd/profile/delete.ts +17 -2
- package/src/cmd/profile/index.ts +1 -0
- package/src/cmd/profile/list.ts +7 -3
- package/src/cmd/profile/show.ts +20 -5
- package/src/cmd/profile/use.ts +8 -0
- package/src/cmd/project/create.ts +31 -0
- package/src/cmd/project/delete.ts +24 -2
- package/src/cmd/project/index.ts +1 -0
- package/src/cmd/project/list.ts +24 -10
- package/src/cmd/project/show.ts +28 -9
- package/src/cmd/project/template-flow.ts +10 -6
- package/src/cmd/prompt/index.ts +12 -0
- package/src/cmd/prompt/llm.ts +368 -0
- package/src/cmd/repl/index.ts +477 -0
- package/src/cmd/schema/index.ts +12 -0
- package/src/cmd/schema/show.ts +27 -0
- package/src/cmd/secret/delete.ts +17 -0
- package/src/cmd/secret/get.ts +20 -1
- package/src/cmd/secret/import.ts +45 -2
- package/src/cmd/secret/index.ts +1 -0
- package/src/cmd/secret/list.ts +10 -1
- package/src/cmd/secret/pull.ts +20 -0
- package/src/cmd/secret/push.ts +33 -1
- package/src/cmd/secret/set.ts +20 -0
- package/src/cmd/version/index.ts +15 -2
- package/src/config.ts +17 -4
- package/src/errors.ts +222 -0
- package/src/explain.ts +126 -0
- package/src/index.ts +51 -0
- package/src/json.ts +28 -0
- package/src/output.ts +307 -0
- package/src/repl.ts +1507 -0
- package/src/schema-generator.ts +389 -0
- package/src/tui.ts +178 -13
- package/src/types.ts +75 -22
- package/src/utils/format.ts +17 -0
|
@@ -3,13 +3,28 @@ import { createSubcommand } from '../../../types';
|
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectDeploymentDelete } from '@agentuity/server';
|
|
5
5
|
import { resolveProjectId } from './utils';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
const DeploymentRemoveResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the removal succeeded'),
|
|
10
|
+
projectId: z.string().describe('Project ID'),
|
|
11
|
+
deploymentId: z.string().describe('Deployment ID that was removed'),
|
|
12
|
+
});
|
|
6
13
|
|
|
7
14
|
export const removeSubcommand = createSubcommand({
|
|
8
15
|
name: 'remove',
|
|
9
16
|
description: 'Remove a specific deployment',
|
|
17
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
18
|
+
examples: [
|
|
19
|
+
`${getCommand('cloud deployment remove')} dep_abc123xyz # Remove with confirmation`,
|
|
20
|
+
`${getCommand('cloud deployment remove')} dep_abc123xyz --force # Remove without confirmation`,
|
|
21
|
+
`${getCommand('cloud deployment remove')} deployment-2024-11-20 --project-id=proj_abc123xyz`,
|
|
22
|
+
],
|
|
10
23
|
aliases: ['rm', 'delete'],
|
|
24
|
+
idempotent: false,
|
|
11
25
|
requires: { auth: true, apiClient: true },
|
|
12
26
|
optional: { project: true },
|
|
27
|
+
prerequisites: ['cloud deploy'],
|
|
13
28
|
schema: {
|
|
14
29
|
args: z.object({
|
|
15
30
|
deployment_id: z.string().describe('Deployment ID'),
|
|
@@ -18,22 +33,31 @@ export const removeSubcommand = createSubcommand({
|
|
|
18
33
|
'project-id': z.string().optional().describe('Project ID'),
|
|
19
34
|
force: z.boolean().default(false).describe('Force removal without confirmation'),
|
|
20
35
|
}),
|
|
36
|
+
response: DeploymentRemoveResponseSchema,
|
|
21
37
|
},
|
|
22
38
|
async handler(ctx) {
|
|
23
39
|
const projectId = resolveProjectId(ctx, { projectId: ctx.opts['project-id'] });
|
|
24
40
|
const { apiClient, args, opts } = ctx;
|
|
25
41
|
|
|
26
42
|
if (!opts.force) {
|
|
27
|
-
const confirmed = await tui.confirm(
|
|
43
|
+
const confirmed = await tui.confirm(
|
|
44
|
+
`Are you sure you want to remove deployment ${args.deployment_id}?`
|
|
45
|
+
);
|
|
28
46
|
if (!confirmed) {
|
|
29
47
|
tui.info('Operation cancelled');
|
|
30
|
-
return;
|
|
48
|
+
return { success: false, projectId, deploymentId: args.deployment_id };
|
|
31
49
|
}
|
|
32
50
|
}
|
|
33
51
|
|
|
34
52
|
try {
|
|
35
53
|
await projectDeploymentDelete(apiClient, projectId, args.deployment_id);
|
|
36
54
|
tui.success(`Deployment ${args.deployment_id} removed successfully.`);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
projectId,
|
|
59
|
+
deploymentId: args.deployment_id,
|
|
60
|
+
};
|
|
37
61
|
} catch (ex) {
|
|
38
62
|
tui.fatal(`Failed to remove deployment: ${ex instanceof Error ? ex.message : String(ex)}`);
|
|
39
63
|
}
|
|
@@ -3,16 +3,39 @@ import { createSubcommand } from '../../../types';
|
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectDeploymentRollback, projectDeploymentList } from '@agentuity/server';
|
|
5
5
|
import { resolveProjectId } from './utils';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
const DeploymentRollbackResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the rollback succeeded'),
|
|
10
|
+
projectId: z.string().describe('Project ID'),
|
|
11
|
+
targetDeploymentId: z.string().describe('Deployment ID that was rolled back to'),
|
|
12
|
+
});
|
|
6
13
|
|
|
7
14
|
export const rollbackSubcommand = createSubcommand({
|
|
8
15
|
name: 'rollback',
|
|
9
16
|
description: 'Rollback the latest to the previous deployment',
|
|
17
|
+
tags: [
|
|
18
|
+
'destructive',
|
|
19
|
+
'deletes-resource',
|
|
20
|
+
'updates-resource',
|
|
21
|
+
'slow',
|
|
22
|
+
'api-intensive',
|
|
23
|
+
'requires-auth',
|
|
24
|
+
'requires-deployment',
|
|
25
|
+
],
|
|
26
|
+
examples: [
|
|
27
|
+
`${getCommand('cloud deployment rollback')} # Rollback to previous deployment`,
|
|
28
|
+
`${getCommand('cloud deployment rollback')} --project-id=proj_abc123xyz`,
|
|
29
|
+
],
|
|
30
|
+
idempotent: false,
|
|
10
31
|
requires: { auth: true, apiClient: true },
|
|
11
32
|
optional: { project: true },
|
|
33
|
+
prerequisites: ['cloud deploy'],
|
|
12
34
|
schema: {
|
|
13
35
|
options: z.object({
|
|
14
36
|
'project-id': z.string().optional().describe('Project ID'),
|
|
15
37
|
}),
|
|
38
|
+
response: DeploymentRollbackResponseSchema,
|
|
16
39
|
},
|
|
17
40
|
async handler(ctx) {
|
|
18
41
|
const projectId = resolveProjectId(ctx, { projectId: ctx.opts['project-id'] });
|
|
@@ -23,17 +46,19 @@ export const rollbackSubcommand = createSubcommand({
|
|
|
23
46
|
const deployments = await projectDeploymentList(apiClient, projectId, 5);
|
|
24
47
|
|
|
25
48
|
// Find currently active
|
|
26
|
-
const activeIndex = deployments.findIndex(d => d.active);
|
|
49
|
+
const activeIndex = deployments.findIndex((d) => d.active);
|
|
27
50
|
|
|
28
51
|
let targetDeploymentId: string | undefined;
|
|
29
52
|
|
|
30
53
|
if (activeIndex === -1) {
|
|
31
54
|
// No active deployment.
|
|
32
|
-
const candidate = deployments.find(d => d.state === 'completed');
|
|
55
|
+
const candidate = deployments.find((d) => d.state === 'completed');
|
|
33
56
|
targetDeploymentId = candidate?.id;
|
|
34
57
|
} else {
|
|
35
58
|
// Has active deployment. Find the next completed one.
|
|
36
|
-
const candidate = deployments
|
|
59
|
+
const candidate = deployments
|
|
60
|
+
.slice(activeIndex + 1)
|
|
61
|
+
.find((d) => d.state === 'completed');
|
|
37
62
|
targetDeploymentId = candidate?.id;
|
|
38
63
|
}
|
|
39
64
|
|
|
@@ -44,11 +69,17 @@ export const rollbackSubcommand = createSubcommand({
|
|
|
44
69
|
const confirmed = await tui.confirm(`Rollback to deployment ${targetDeploymentId}?`);
|
|
45
70
|
if (!confirmed) {
|
|
46
71
|
tui.info('Operation cancelled');
|
|
47
|
-
return;
|
|
72
|
+
return { success: false, projectId, targetDeploymentId };
|
|
48
73
|
}
|
|
49
74
|
|
|
50
75
|
await projectDeploymentRollback(apiClient, projectId, targetDeploymentId!);
|
|
51
76
|
tui.success(`Rolled back to deployment ${targetDeploymentId}.`);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
projectId,
|
|
81
|
+
targetDeploymentId,
|
|
82
|
+
};
|
|
52
83
|
} catch (ex) {
|
|
53
84
|
tui.fatal(`Failed to rollback: ${ex instanceof Error ? ex.message : String(ex)}`);
|
|
54
85
|
}
|
|
@@ -3,13 +3,33 @@ import { createSubcommand } from '../../../types';
|
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectDeploymentGet } from '@agentuity/server';
|
|
5
5
|
import { resolveProjectId } from './utils';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
const DeploymentShowResponseSchema = z.object({
|
|
9
|
+
id: z.string().describe('Deployment ID'),
|
|
10
|
+
state: z.string().optional().describe('Deployment state'),
|
|
11
|
+
active: z.boolean().describe('Whether deployment is active'),
|
|
12
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
13
|
+
updatedAt: z.string().optional().describe('Last update timestamp'),
|
|
14
|
+
message: z.string().optional().describe('Deployment message'),
|
|
15
|
+
tags: z.array(z.string()).describe('Deployment tags'),
|
|
16
|
+
customDomains: z.array(z.string()).optional().describe('Custom domains'),
|
|
17
|
+
cloudRegion: z.string().optional().describe('Cloud region'),
|
|
18
|
+
metadata: z.any().optional().describe('Deployment metadata'),
|
|
19
|
+
});
|
|
6
20
|
|
|
7
21
|
export const showSubcommand = createSubcommand({
|
|
8
22
|
name: 'show',
|
|
9
23
|
description: 'Show details about a specific deployment',
|
|
24
|
+
tags: ['read-only', 'fast', 'requires-auth', 'requires-deployment'],
|
|
25
|
+
examples: [
|
|
26
|
+
`${getCommand('cloud deployment show')} dep_abc123xyz`,
|
|
27
|
+
`${getCommand('cloud deployment show')} deployment-2024-11-20 --project-id=proj_abc123xyz`,
|
|
28
|
+
],
|
|
10
29
|
aliases: ['get'],
|
|
11
30
|
requires: { auth: true, apiClient: true },
|
|
12
31
|
optional: { project: true },
|
|
32
|
+
prerequisites: ['cloud deploy'],
|
|
13
33
|
schema: {
|
|
14
34
|
args: z.object({
|
|
15
35
|
deployment_id: z.string().describe('Deployment ID'),
|
|
@@ -17,7 +37,9 @@ export const showSubcommand = createSubcommand({
|
|
|
17
37
|
options: z.object({
|
|
18
38
|
'project-id': z.string().optional().describe('Project ID'),
|
|
19
39
|
}),
|
|
40
|
+
response: DeploymentShowResponseSchema,
|
|
20
41
|
},
|
|
42
|
+
idempotent: true,
|
|
21
43
|
async handler(ctx) {
|
|
22
44
|
const projectId = resolveProjectId(ctx, { projectId: ctx.opts['project-id'] });
|
|
23
45
|
const { apiClient, args } = ctx;
|
|
@@ -49,10 +71,10 @@ export const showSubcommand = createSubcommand({
|
|
|
49
71
|
}
|
|
50
72
|
|
|
51
73
|
// Metadata
|
|
52
|
-
|
|
74
|
+
const origin = deployment.metadata?.origin;
|
|
75
|
+
if (origin?.commit) {
|
|
53
76
|
tui.newline();
|
|
54
77
|
tui.info('Origin Information');
|
|
55
|
-
const origin = deployment.metadata.origin;
|
|
56
78
|
if (origin.trigger) console.log(` Trigger: ${origin.trigger}`);
|
|
57
79
|
if (origin.provider) console.log(` Provider: ${origin.provider}`);
|
|
58
80
|
if (origin.event) console.log(` Event: ${origin.event}`);
|
|
@@ -65,6 +87,19 @@ export const showSubcommand = createSubcommand({
|
|
|
65
87
|
console.log(` Author: ${origin.commit.author.name}`);
|
|
66
88
|
}
|
|
67
89
|
}
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
id: deployment.id,
|
|
93
|
+
state: deployment.state,
|
|
94
|
+
active: deployment.active,
|
|
95
|
+
createdAt: deployment.createdAt,
|
|
96
|
+
updatedAt: deployment.updatedAt,
|
|
97
|
+
message: deployment.message,
|
|
98
|
+
tags: deployment.tags,
|
|
99
|
+
customDomains: deployment.customDomains,
|
|
100
|
+
cloudRegion: deployment.cloudRegion,
|
|
101
|
+
metadata: deployment.metadata,
|
|
102
|
+
};
|
|
68
103
|
} catch (ex) {
|
|
69
104
|
tui.fatal(`Failed to show deployment: ${ex instanceof Error ? ex.message : String(ex)}`);
|
|
70
105
|
}
|
|
@@ -3,12 +3,21 @@ import { createSubcommand } from '../../../types';
|
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectDeploymentUndeploy } from '@agentuity/server';
|
|
5
5
|
import { resolveProjectId } from './utils';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
7
|
|
|
7
8
|
export const undeploySubcommand = createSubcommand({
|
|
8
9
|
name: 'undeploy',
|
|
9
10
|
description: 'Undeploy the latest deployment',
|
|
11
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
12
|
+
examples: [
|
|
13
|
+
`${getCommand('cloud deployment undeploy')} # Undeploy with confirmation`,
|
|
14
|
+
`${getCommand('cloud deployment undeploy')} --force # Undeploy without confirmation`,
|
|
15
|
+
`${getCommand('cloud deployment undeploy')} --project-id=proj_abc123xyz`,
|
|
16
|
+
],
|
|
17
|
+
idempotent: false,
|
|
10
18
|
requires: { auth: true, apiClient: true },
|
|
11
19
|
optional: { project: true },
|
|
20
|
+
prerequisites: ['cloud deploy'],
|
|
12
21
|
schema: {
|
|
13
22
|
options: z.object({
|
|
14
23
|
'project-id': z.string().optional().describe('Project ID'),
|
|
@@ -20,7 +29,9 @@ export const undeploySubcommand = createSubcommand({
|
|
|
20
29
|
const { apiClient, opts } = ctx;
|
|
21
30
|
|
|
22
31
|
if (!opts.force) {
|
|
23
|
-
const confirmed = await tui.confirm(
|
|
32
|
+
const confirmed = await tui.confirm(
|
|
33
|
+
'Are you sure you want to undeploy? This will stop the active deployment.'
|
|
34
|
+
);
|
|
24
35
|
if (!confirmed) {
|
|
25
36
|
tui.info('Operation cancelled');
|
|
26
37
|
return;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProjectConfig } from '../../../types';
|
|
2
2
|
|
|
3
|
-
export function resolveProjectId(
|
|
3
|
+
export function resolveProjectId(
|
|
4
|
+
ctx: { project?: ProjectConfig },
|
|
5
|
+
options: { projectId?: string }
|
|
6
|
+
): string {
|
|
4
7
|
if (options.projectId) {
|
|
5
8
|
return options.projectId;
|
|
6
9
|
}
|
package/src/cmd/cloud/domain.ts
CHANGED
|
@@ -23,8 +23,9 @@ export async function checkCustomDomainForDNS(
|
|
|
23
23
|
): Promise<DNSResult[]> {
|
|
24
24
|
const suffix = config?.overrides?.api_url?.includes('agentuity.io')
|
|
25
25
|
? 'agentuity.io'
|
|
26
|
-
: 'agentuity.
|
|
27
|
-
|
|
26
|
+
: 'agentuity.cloud';
|
|
27
|
+
// FIXME: update to add the region into this
|
|
28
|
+
const id = Bun.hash.xxHash64(projectId).toString(16);
|
|
28
29
|
const proxy = `p${id}.${suffix}`;
|
|
29
30
|
|
|
30
31
|
return Promise.all(
|
package/src/cmd/cloud/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createCommand } from '../../types';
|
|
2
2
|
import { deploySubcommand } from './deploy';
|
|
3
3
|
import { resourceSubcommand } from './resource';
|
|
4
|
+
import { sessionCommand } from './session';
|
|
4
5
|
import { sshSubcommand } from './ssh';
|
|
5
6
|
import { scpSubcommand } from './scp';
|
|
6
7
|
import { deploymentCommand } from './deployment';
|
|
@@ -8,5 +9,13 @@ import { deploymentCommand } from './deployment';
|
|
|
8
9
|
export const command = createCommand({
|
|
9
10
|
name: 'cloud',
|
|
10
11
|
description: 'Cloud related commands',
|
|
11
|
-
|
|
12
|
+
tags: ['slow', 'requires-auth'],
|
|
13
|
+
subcommands: [
|
|
14
|
+
deploySubcommand,
|
|
15
|
+
resourceSubcommand,
|
|
16
|
+
sessionCommand,
|
|
17
|
+
sshSubcommand,
|
|
18
|
+
scpSubcommand,
|
|
19
|
+
deploymentCommand,
|
|
20
|
+
],
|
|
12
21
|
});
|
|
@@ -4,16 +4,30 @@ import enquirer from 'enquirer';
|
|
|
4
4
|
import { createSubcommand } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
6
|
import { getCatalystAPIClient } from '../../../config';
|
|
7
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
8
|
|
|
8
9
|
export const addSubcommand = createSubcommand({
|
|
9
10
|
name: 'add',
|
|
10
11
|
aliases: ['create'],
|
|
11
12
|
description: 'Add a cloud resource for an organization',
|
|
13
|
+
tags: ['mutating', 'creates-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
14
|
+
idempotent: false,
|
|
12
15
|
requires: { auth: true, org: true, region: true },
|
|
16
|
+
examples: [
|
|
17
|
+
getCommand('cloud resource add'),
|
|
18
|
+
getCommand('cloud resource add --type database'),
|
|
19
|
+
getCommand('cloud resource add --type storage'),
|
|
20
|
+
getCommand('cloud resource create --type database'),
|
|
21
|
+
],
|
|
13
22
|
schema: {
|
|
14
23
|
options: z.object({
|
|
15
24
|
type: z.enum(['database', 'storage']).optional().describe('Resource type'),
|
|
16
25
|
}),
|
|
26
|
+
response: z.object({
|
|
27
|
+
success: z.boolean().describe('Whether creation succeeded'),
|
|
28
|
+
type: z.string().describe('Resource type (database or storage)'),
|
|
29
|
+
name: z.string().describe('Created resource name'),
|
|
30
|
+
}),
|
|
17
31
|
},
|
|
18
32
|
|
|
19
33
|
async handler(ctx) {
|
|
@@ -49,6 +63,11 @@ export const addSubcommand = createSubcommand({
|
|
|
49
63
|
|
|
50
64
|
if (created.length > 0) {
|
|
51
65
|
tui.success(`Created ${resourceType}: ${tui.bold(created[0].name)}`);
|
|
66
|
+
return {
|
|
67
|
+
success: true,
|
|
68
|
+
type: resourceType,
|
|
69
|
+
name: created[0].name,
|
|
70
|
+
};
|
|
52
71
|
} else {
|
|
53
72
|
tui.fatal('Failed to create resource');
|
|
54
73
|
}
|
|
@@ -4,18 +4,33 @@ import enquirer from 'enquirer';
|
|
|
4
4
|
import { createSubcommand } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
6
|
import { getCatalystAPIClient } from '../../../config';
|
|
7
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
8
|
|
|
8
9
|
export const deleteSubcommand = createSubcommand({
|
|
9
10
|
name: 'delete',
|
|
10
11
|
description: 'Delete cloud resource(s) for an organization',
|
|
12
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
11
13
|
aliases: ['rm', 'del', 'remove'],
|
|
14
|
+
idempotent: false,
|
|
12
15
|
requires: { auth: true, org: true, region: true },
|
|
16
|
+
examples: [
|
|
17
|
+
getCommand('cloud resource delete'),
|
|
18
|
+
getCommand('cloud resource delete --type db --name my-database'),
|
|
19
|
+
getCommand('cloud resource delete --type s3 --name uploads'),
|
|
20
|
+
getCommand('--explain cloud resource delete --type db --name old-db'),
|
|
21
|
+
getCommand('--dry-run cloud resource rm --type s3 --name temp-bucket'),
|
|
22
|
+
],
|
|
13
23
|
schema: {
|
|
14
24
|
options: z.object({
|
|
15
25
|
type: z.enum(['db', 's3']).optional().describe('Resource type (db or s3)'),
|
|
16
26
|
name: z.string().optional().describe('Resource name to delete'),
|
|
17
27
|
confirm: z.boolean().optional().describe('Skip confirmation prompts'),
|
|
18
28
|
}),
|
|
29
|
+
response: z.object({
|
|
30
|
+
success: z.boolean().describe('Whether deletion succeeded'),
|
|
31
|
+
count: z.number().describe('Number of resources deleted'),
|
|
32
|
+
resources: z.array(z.string()).describe('Deleted resource names'),
|
|
33
|
+
}),
|
|
19
34
|
},
|
|
20
35
|
|
|
21
36
|
async handler(ctx) {
|
|
@@ -41,7 +56,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
41
56
|
|
|
42
57
|
if (resources.db.length === 0 && resources.s3.length === 0) {
|
|
43
58
|
tui.info('No resources found to delete');
|
|
44
|
-
return;
|
|
59
|
+
return { success: false, count: 0, resources: [] };
|
|
45
60
|
}
|
|
46
61
|
|
|
47
62
|
// Build choices for multi-select and resource map
|
|
@@ -81,7 +96,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
81
96
|
|
|
82
97
|
if (resourcesToDelete.length === 0) {
|
|
83
98
|
tui.info('No resources selected for deletion');
|
|
84
|
-
return;
|
|
99
|
+
return { success: false, count: 0, resources: [] };
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
// Confirm deletion
|
|
@@ -98,7 +113,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
98
113
|
|
|
99
114
|
if (!confirm.confirm) {
|
|
100
115
|
tui.info('Deletion cancelled');
|
|
101
|
-
return;
|
|
116
|
+
return { success: false, count: 0, resources: [] };
|
|
102
117
|
}
|
|
103
118
|
}
|
|
104
119
|
|
|
@@ -116,5 +131,11 @@ export const deleteSubcommand = createSubcommand({
|
|
|
116
131
|
} else {
|
|
117
132
|
tui.error('Failed to delete resources');
|
|
118
133
|
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
success: deleted.length > 0,
|
|
137
|
+
count: deleted.length,
|
|
138
|
+
resources: deleted,
|
|
139
|
+
};
|
|
119
140
|
},
|
|
120
141
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
2
|
import { listSubcommand } from './list';
|
|
3
3
|
import { addSubcommand } from './add';
|
|
4
4
|
import { deleteSubcommand } from './delete';
|
|
5
5
|
|
|
6
|
-
export const resourceSubcommand
|
|
6
|
+
export const resourceSubcommand = createCommand({
|
|
7
7
|
name: 'resource',
|
|
8
8
|
aliases: ['resources'],
|
|
9
9
|
description: 'Manage cloud resources',
|
|
10
|
+
tags: ['fast', 'requires-auth', 'requires-deployment'],
|
|
10
11
|
subcommands: [listSubcommand, addSubcommand, deleteSubcommand],
|
|
11
|
-
};
|
|
12
|
+
});
|
|
@@ -3,24 +3,48 @@ import { listResources } from '@agentuity/server';
|
|
|
3
3
|
import { createSubcommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
5
|
import { getCatalystAPIClient } from '../../../config';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
const ResourceListResponseSchema = z.object({
|
|
9
|
+
db: z
|
|
10
|
+
.array(
|
|
11
|
+
z.object({
|
|
12
|
+
name: z.string().describe('Database name'),
|
|
13
|
+
url: z.string().optional().describe('Database connection URL'),
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
.describe('List of database resources'),
|
|
17
|
+
s3: z
|
|
18
|
+
.array(
|
|
19
|
+
z.object({
|
|
20
|
+
bucket_name: z.string().describe('Storage bucket name'),
|
|
21
|
+
access_key: z.string().optional().describe('S3 access key'),
|
|
22
|
+
secret_key: z.string().optional().describe('S3 secret key'),
|
|
23
|
+
region: z.string().optional().describe('S3 region'),
|
|
24
|
+
endpoint: z.string().optional().describe('S3 endpoint URL'),
|
|
25
|
+
})
|
|
26
|
+
)
|
|
27
|
+
.describe('List of storage resources'),
|
|
28
|
+
});
|
|
6
29
|
|
|
7
30
|
export const listSubcommand = createSubcommand({
|
|
8
31
|
name: 'list',
|
|
9
32
|
description: 'List cloud resources for an organization',
|
|
33
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
10
34
|
aliases: ['ls'],
|
|
11
35
|
requires: { auth: true, org: true, region: true },
|
|
36
|
+
idempotent: true,
|
|
37
|
+
examples: [
|
|
38
|
+
getCommand('cloud resource list'),
|
|
39
|
+
getCommand('--json cloud resource list'),
|
|
40
|
+
getCommand('cloud resource ls'),
|
|
41
|
+
],
|
|
12
42
|
schema: {
|
|
13
|
-
|
|
14
|
-
format: z
|
|
15
|
-
.enum(['text', 'json'])
|
|
16
|
-
.optional()
|
|
17
|
-
.default('text')
|
|
18
|
-
.describe('Output format (text or json)'),
|
|
19
|
-
}),
|
|
43
|
+
response: ResourceListResponseSchema,
|
|
20
44
|
},
|
|
21
45
|
|
|
22
46
|
async handler(ctx) {
|
|
23
|
-
const { logger,
|
|
47
|
+
const { logger, options, orgId, region, config, auth } = ctx;
|
|
24
48
|
|
|
25
49
|
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
26
50
|
|
|
@@ -33,13 +57,13 @@ export const listSubcommand = createSubcommand({
|
|
|
33
57
|
});
|
|
34
58
|
|
|
35
59
|
// Output based on format
|
|
36
|
-
if (
|
|
60
|
+
if (options.json) {
|
|
37
61
|
console.log(JSON.stringify(resources, null, 2));
|
|
38
62
|
} else {
|
|
39
63
|
// Text table format
|
|
40
64
|
if (resources.db.length === 0 && resources.s3.length === 0) {
|
|
41
65
|
tui.info('No resources found');
|
|
42
|
-
return;
|
|
66
|
+
return { db: [], s3: [] };
|
|
43
67
|
}
|
|
44
68
|
|
|
45
69
|
if (resources.db.length > 0) {
|
|
@@ -65,5 +89,7 @@ export const listSubcommand = createSubcommand({
|
|
|
65
89
|
}
|
|
66
90
|
}
|
|
67
91
|
}
|
|
92
|
+
|
|
93
|
+
return resources;
|
|
68
94
|
},
|
|
69
95
|
});
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { createSubcommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { getIONHost } from '../../../config';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
5
6
|
|
|
6
7
|
const args = z.object({
|
|
7
8
|
source: z.string().describe('the source file'),
|
|
@@ -16,9 +17,27 @@ export const downloadCommand = createSubcommand({
|
|
|
16
17
|
name: 'download',
|
|
17
18
|
aliases: ['get'],
|
|
18
19
|
description: 'Download a file using security copy',
|
|
20
|
+
tags: ['read-only', 'slow', 'requires-auth', 'requires-deployment'],
|
|
21
|
+
idempotent: true,
|
|
22
|
+
examples: [
|
|
23
|
+
`${getCommand('cloud scp download')} /var/log/app.log # Download to current directory`,
|
|
24
|
+
`${getCommand('cloud scp download')} /var/log/app.log ./logs/ # Download to specific path`,
|
|
25
|
+
`${getCommand('cloud scp download')} /app/config.json --identifier=proj_abc123xyz`,
|
|
26
|
+
`${getCommand('cloud scp download')} ~/logs/*.log ./logs/ # Download multiple files`,
|
|
27
|
+
],
|
|
19
28
|
requires: { apiClient: true, auth: true },
|
|
20
29
|
optional: { project: true },
|
|
21
|
-
|
|
30
|
+
prerequisites: ['cloud deploy'],
|
|
31
|
+
schema: {
|
|
32
|
+
args,
|
|
33
|
+
options,
|
|
34
|
+
response: z.object({
|
|
35
|
+
success: z.boolean().describe('Whether download succeeded'),
|
|
36
|
+
source: z.string().describe('Remote source path'),
|
|
37
|
+
destination: z.string().describe('Local destination path'),
|
|
38
|
+
identifier: z.string().describe('Project or deployment identifier'),
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
22
41
|
|
|
23
42
|
async handler(ctx) {
|
|
24
43
|
const { apiClient, args, opts, project, projectDir, config } = ctx;
|
|
@@ -49,6 +68,13 @@ export const downloadCommand = createSubcommand({
|
|
|
49
68
|
);
|
|
50
69
|
process.exit(spawn.exitCode ?? 1);
|
|
51
70
|
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
source: args.source,
|
|
75
|
+
destination,
|
|
76
|
+
identifier,
|
|
77
|
+
};
|
|
52
78
|
} catch (error) {
|
|
53
79
|
tui.error(
|
|
54
80
|
`SCP download error: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
2
|
import { downloadCommand } from './download';
|
|
3
3
|
import { uploadCommand } from './upload';
|
|
4
4
|
|
|
5
|
-
export const scpSubcommand
|
|
5
|
+
export const scpSubcommand = createCommand({
|
|
6
6
|
name: 'scp',
|
|
7
7
|
description: 'Secure Copy commands',
|
|
8
|
+
tags: ['slow', 'requires-auth', 'requires-deployment'],
|
|
8
9
|
subcommands: [downloadCommand, uploadCommand],
|
|
9
|
-
};
|
|
10
|
+
});
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { createSubcommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { getIONHost } from '../../../config';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
5
6
|
|
|
6
7
|
const args = z.object({
|
|
7
8
|
source: z.string().describe('the source file'),
|
|
@@ -19,9 +20,27 @@ export const uploadCommand = createSubcommand({
|
|
|
19
20
|
name: 'upload',
|
|
20
21
|
aliases: ['cp', 'put'],
|
|
21
22
|
description: 'Upload a file using security copy',
|
|
23
|
+
tags: ['mutating', 'updates-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
24
|
+
idempotent: false,
|
|
25
|
+
examples: [
|
|
26
|
+
`${getCommand('cloud scp upload')} ./config.json # Upload to remote home directory`,
|
|
27
|
+
`${getCommand('cloud scp upload')} ./config.json /app/config.json # Upload to specific path`,
|
|
28
|
+
`${getCommand('cloud scp upload')} ./config.json --identifier=proj_abc123xyz`,
|
|
29
|
+
`${getCommand('cloud scp upload')} ./logs/*.log ~/logs/ # Upload multiple files`,
|
|
30
|
+
],
|
|
22
31
|
requires: { apiClient: true, auth: true },
|
|
23
|
-
schema: {
|
|
32
|
+
schema: {
|
|
33
|
+
args,
|
|
34
|
+
options,
|
|
35
|
+
response: z.object({
|
|
36
|
+
success: z.boolean().describe('Whether upload succeeded'),
|
|
37
|
+
source: z.string().describe('Local source path'),
|
|
38
|
+
destination: z.string().describe('Remote destination path'),
|
|
39
|
+
identifier: z.string().describe('Project or deployment identifier'),
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
24
42
|
optional: { project: true },
|
|
43
|
+
prerequisites: ['cloud deploy'],
|
|
25
44
|
|
|
26
45
|
async handler(ctx) {
|
|
27
46
|
const { apiClient, args, opts, project, projectDir, config } = ctx;
|
|
@@ -52,6 +71,13 @@ export const uploadCommand = createSubcommand({
|
|
|
52
71
|
);
|
|
53
72
|
process.exit(spawn.exitCode ?? 1);
|
|
54
73
|
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
source: args.source,
|
|
78
|
+
destination,
|
|
79
|
+
identifier,
|
|
80
|
+
};
|
|
55
81
|
} catch (error) {
|
|
56
82
|
tui.error(`SCP upload error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
57
83
|
process.exit(1);
|