@agentuity/cli 0.0.59 → 0.0.60

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.
Files changed (125) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +14 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cmd/ai/capabilities/show.d.ts.map +1 -1
  5. package/dist/cmd/ai/capabilities/show.js +11 -4
  6. package/dist/cmd/ai/capabilities/show.js.map +1 -1
  7. package/dist/cmd/cloud/db/create.d.ts +2 -0
  8. package/dist/cmd/cloud/db/create.d.ts.map +1 -0
  9. package/dist/cmd/cloud/db/create.js +68 -0
  10. package/dist/cmd/cloud/db/create.js.map +1 -0
  11. package/dist/cmd/cloud/db/delete.d.ts.map +1 -0
  12. package/dist/cmd/cloud/db/delete.js +106 -0
  13. package/dist/cmd/cloud/db/delete.js.map +1 -0
  14. package/dist/cmd/cloud/db/get.d.ts +2 -0
  15. package/dist/cmd/cloud/db/get.d.ts.map +1 -0
  16. package/dist/cmd/cloud/db/get.js +66 -0
  17. package/dist/cmd/cloud/db/get.js.map +1 -0
  18. package/dist/cmd/cloud/db/index.d.ts +2 -0
  19. package/dist/cmd/cloud/db/index.d.ts.map +1 -0
  20. package/dist/cmd/cloud/db/index.js +14 -0
  21. package/dist/cmd/cloud/db/index.js.map +1 -0
  22. package/dist/cmd/cloud/db/list.d.ts.map +1 -0
  23. package/dist/cmd/cloud/db/list.js +75 -0
  24. package/dist/cmd/cloud/db/list.js.map +1 -0
  25. package/dist/cmd/cloud/db/sql.d.ts +2 -0
  26. package/dist/cmd/cloud/db/sql.d.ts.map +1 -0
  27. package/dist/cmd/cloud/db/sql.js +102 -0
  28. package/dist/cmd/cloud/db/sql.js.map +1 -0
  29. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  30. package/dist/cmd/cloud/env/get.js +2 -3
  31. package/dist/cmd/cloud/env/get.js.map +1 -1
  32. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  33. package/dist/cmd/cloud/env/list.js +1 -2
  34. package/dist/cmd/cloud/env/list.js.map +1 -1
  35. package/dist/cmd/cloud/index.d.ts.map +1 -1
  36. package/dist/cmd/cloud/index.js +4 -2
  37. package/dist/cmd/cloud/index.js.map +1 -1
  38. package/dist/cmd/cloud/secret/get.d.ts.map +1 -1
  39. package/dist/cmd/cloud/secret/get.js +2 -3
  40. package/dist/cmd/cloud/secret/get.js.map +1 -1
  41. package/dist/cmd/cloud/secret/list.d.ts.map +1 -1
  42. package/dist/cmd/cloud/secret/list.js +1 -2
  43. package/dist/cmd/cloud/secret/list.js.map +1 -1
  44. package/dist/cmd/cloud/storage/create.d.ts +2 -0
  45. package/dist/cmd/cloud/storage/create.d.ts.map +1 -0
  46. package/dist/cmd/cloud/storage/create.js +61 -0
  47. package/dist/cmd/cloud/storage/create.js.map +1 -0
  48. package/dist/cmd/cloud/storage/delete.d.ts +2 -0
  49. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -0
  50. package/dist/cmd/cloud/storage/delete.js +167 -0
  51. package/dist/cmd/cloud/storage/delete.js.map +1 -0
  52. package/dist/cmd/cloud/storage/download.d.ts +2 -0
  53. package/dist/cmd/cloud/storage/download.d.ts.map +1 -0
  54. package/dist/cmd/cloud/storage/download.js +131 -0
  55. package/dist/cmd/cloud/storage/download.js.map +1 -0
  56. package/dist/cmd/cloud/storage/get.d.ts +2 -0
  57. package/dist/cmd/cloud/storage/get.d.ts.map +1 -0
  58. package/dist/cmd/cloud/storage/get.js +86 -0
  59. package/dist/cmd/cloud/storage/get.js.map +1 -0
  60. package/dist/cmd/cloud/storage/index.d.ts +2 -0
  61. package/dist/cmd/cloud/storage/index.d.ts.map +1 -0
  62. package/dist/cmd/cloud/storage/index.js +22 -0
  63. package/dist/cmd/cloud/storage/index.js.map +1 -0
  64. package/dist/cmd/cloud/storage/list.d.ts +2 -0
  65. package/dist/cmd/cloud/storage/list.d.ts.map +1 -0
  66. package/dist/cmd/cloud/storage/list.js +170 -0
  67. package/dist/cmd/cloud/storage/list.js.map +1 -0
  68. package/dist/cmd/cloud/storage/upload.d.ts +2 -0
  69. package/dist/cmd/cloud/storage/upload.d.ts.map +1 -0
  70. package/dist/cmd/cloud/storage/upload.js +133 -0
  71. package/dist/cmd/cloud/storage/upload.js.map +1 -0
  72. package/dist/cmd/cloud/storage/utils.d.ts +18 -0
  73. package/dist/cmd/cloud/storage/utils.d.ts.map +1 -0
  74. package/dist/cmd/cloud/storage/utils.js +21 -0
  75. package/dist/cmd/cloud/storage/utils.js.map +1 -0
  76. package/dist/tui.d.ts +2 -1
  77. package/dist/tui.d.ts.map +1 -1
  78. package/dist/tui.js +3 -0
  79. package/dist/tui.js.map +1 -1
  80. package/dist/version.js +1 -1
  81. package/dist/version.js.map +1 -1
  82. package/package.json +3 -3
  83. package/src/cli.ts +15 -1
  84. package/src/cmd/ai/capabilities/show.ts +11 -4
  85. package/src/cmd/cloud/db/create.ts +72 -0
  86. package/src/cmd/cloud/db/delete.ts +118 -0
  87. package/src/cmd/cloud/db/get.ts +75 -0
  88. package/src/cmd/cloud/db/index.ts +14 -0
  89. package/src/cmd/cloud/db/list.ts +83 -0
  90. package/src/cmd/cloud/db/sql.ts +125 -0
  91. package/src/cmd/cloud/env/get.ts +2 -3
  92. package/src/cmd/cloud/env/list.ts +1 -2
  93. package/src/cmd/cloud/index.ts +5 -2
  94. package/src/cmd/cloud/secret/get.ts +2 -3
  95. package/src/cmd/cloud/secret/list.ts +1 -2
  96. package/src/cmd/cloud/storage/create.ts +65 -0
  97. package/src/cmd/cloud/storage/delete.ts +195 -0
  98. package/src/cmd/cloud/storage/download.ts +154 -0
  99. package/src/cmd/cloud/storage/get.ts +97 -0
  100. package/src/cmd/cloud/storage/index.ts +22 -0
  101. package/src/cmd/cloud/storage/list.ts +197 -0
  102. package/src/cmd/cloud/storage/upload.ts +150 -0
  103. package/src/cmd/cloud/storage/utils.ts +26 -0
  104. package/src/tui.ts +4 -0
  105. package/src/version.ts +1 -1
  106. package/dist/cmd/cloud/resource/add.d.ts +0 -2
  107. package/dist/cmd/cloud/resource/add.d.ts.map +0 -1
  108. package/dist/cmd/cloud/resource/add.js +0 -70
  109. package/dist/cmd/cloud/resource/add.js.map +0 -1
  110. package/dist/cmd/cloud/resource/delete.d.ts.map +0 -1
  111. package/dist/cmd/cloud/resource/delete.js +0 -126
  112. package/dist/cmd/cloud/resource/delete.js.map +0 -1
  113. package/dist/cmd/cloud/resource/index.d.ts +0 -2
  114. package/dist/cmd/cloud/resource/index.d.ts.map +0 -1
  115. package/dist/cmd/cloud/resource/index.js +0 -12
  116. package/dist/cmd/cloud/resource/index.js.map +0 -1
  117. package/dist/cmd/cloud/resource/list.d.ts.map +0 -1
  118. package/dist/cmd/cloud/resource/list.js +0 -100
  119. package/dist/cmd/cloud/resource/list.js.map +0 -1
  120. package/src/cmd/cloud/resource/add.ts +0 -75
  121. package/src/cmd/cloud/resource/delete.ts +0 -141
  122. package/src/cmd/cloud/resource/index.ts +0 -12
  123. package/src/cmd/cloud/resource/list.ts +0 -105
  124. /package/dist/cmd/cloud/{resource → db}/delete.d.ts +0 -0
  125. /package/dist/cmd/cloud/{resource → db}/list.d.ts +0 -0
@@ -0,0 +1,150 @@
1
+ import { z } from 'zod';
2
+ import { basename } from 'path';
3
+ import { listResources } from '@agentuity/server';
4
+ import { createSubcommand } from '../../../types';
5
+ import * as tui from '../../../tui';
6
+ import { getCatalystAPIClient } from '../../../config';
7
+ import { getCommand } from '../../../command-prefix';
8
+ import { ErrorCode } from '../../../errors';
9
+ import { createS3Client } from './utils';
10
+
11
+ export const uploadSubcommand = createSubcommand({
12
+ name: 'upload',
13
+ aliases: ['put'],
14
+ description: 'Upload a file to storage bucket',
15
+ tags: ['write', 'requires-auth'],
16
+ requires: { auth: true, org: true, region: true },
17
+ idempotent: false,
18
+ examples: [
19
+ `${getCommand('cloud storage upload')} my-bucket file.txt`,
20
+ `${getCommand('cloud storage put')} my-bucket file.txt --content-type text/plain`,
21
+ `cat file.txt | ${getCommand('cloud storage upload')} my-bucket -`,
22
+ ],
23
+ schema: {
24
+ args: z.object({
25
+ name: z.string().describe('Bucket name'),
26
+ filename: z.string().describe('File path to upload or "-" for STDIN'),
27
+ }),
28
+ options: z.object({
29
+ contentType: z
30
+ .string()
31
+ .optional()
32
+ .describe('Content type (auto-detected if not provided)'),
33
+ }),
34
+ response: z.object({
35
+ success: z.boolean().describe('Whether upload succeeded'),
36
+ bucket: z.string().describe('Bucket name'),
37
+ filename: z.string().describe('Uploaded filename'),
38
+ size: z.number().describe('File size in bytes'),
39
+ }),
40
+ },
41
+
42
+ async handler(ctx) {
43
+ const { logger, args, opts, options, orgId, region, config, auth } = ctx;
44
+
45
+ const catalystClient = getCatalystAPIClient(config, logger, auth);
46
+
47
+ // Fetch bucket credentials
48
+ const resources = await tui.spinner({
49
+ message: `Fetching credentials for ${args.name}`,
50
+ clearOnSuccess: true,
51
+ callback: async () => {
52
+ return listResources(catalystClient, orgId, region);
53
+ },
54
+ });
55
+
56
+ const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
57
+
58
+ if (!bucket) {
59
+ tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
60
+ }
61
+
62
+ if (!bucket.access_key || !bucket.secret_key || !bucket.endpoint) {
63
+ tui.fatal(
64
+ `Storage bucket '${args.name}' is missing credentials`,
65
+ ErrorCode.CONFIG_INVALID
66
+ );
67
+ }
68
+
69
+ // Read file content
70
+ let fileContent: Buffer;
71
+ let actualFilename: string;
72
+
73
+ if (args.filename === '-') {
74
+ // Read from STDIN
75
+ const chunks: Buffer[] = [];
76
+ for await (const chunk of Bun.stdin.stream()) {
77
+ chunks.push(Buffer.from(chunk));
78
+ }
79
+ fileContent = Buffer.concat(chunks);
80
+ actualFilename = 'stdin';
81
+ } else {
82
+ // Read from file
83
+ const file = Bun.file(args.filename);
84
+ if (!(await file.exists())) {
85
+ tui.fatal(`File not found: ${args.filename}`, ErrorCode.FILE_NOT_FOUND);
86
+ }
87
+ fileContent = Buffer.from(await file.arrayBuffer());
88
+ actualFilename = basename(args.filename);
89
+ }
90
+
91
+ // Auto-detect content type
92
+ let contentType = opts.contentType;
93
+ if (!contentType && args.filename !== '-') {
94
+ const filename = basename(args.filename);
95
+ const dotIndex = filename.lastIndexOf('.');
96
+ const ext = dotIndex > 0 ? filename.substring(dotIndex + 1).toLowerCase() : undefined;
97
+ const mimeTypes: Record<string, string> = {
98
+ txt: 'text/plain',
99
+ html: 'text/html',
100
+ css: 'text/css',
101
+ yaml: 'application/x-yaml',
102
+ yml: 'application/x-yaml',
103
+ js: 'application/javascript',
104
+ json: 'application/json',
105
+ xml: 'application/xml',
106
+ pdf: 'application/pdf',
107
+ zip: 'application/zip',
108
+ jpg: 'image/jpeg',
109
+ jpeg: 'image/jpeg',
110
+ png: 'image/png',
111
+ gif: 'image/gif',
112
+ svg: 'image/svg+xml',
113
+ mp4: 'video/mp4',
114
+ mp3: 'audio/mpeg',
115
+ };
116
+ contentType = ext ? mimeTypes[ext] : 'application/octet-stream';
117
+ }
118
+
119
+ // Upload using Bun.s3
120
+ const s3Client = createS3Client({
121
+ endpoint: bucket.endpoint,
122
+ access_key: bucket.access_key,
123
+ secret_key: bucket.secret_key,
124
+ region: bucket.region,
125
+ });
126
+
127
+ await tui.spinner({
128
+ message: `Uploading ${actualFilename} to ${args.name}`,
129
+ clearOnSuccess: true,
130
+ callback: async () => {
131
+ await s3Client.write(actualFilename, fileContent, {
132
+ type: contentType,
133
+ });
134
+ },
135
+ });
136
+
137
+ if (!options.json) {
138
+ tui.success(
139
+ `Uploaded ${tui.bold(actualFilename)} to ${tui.bold(args.name)} (${fileContent.length} bytes)`
140
+ );
141
+ }
142
+
143
+ return {
144
+ success: true,
145
+ bucket: args.name,
146
+ filename: actualFilename,
147
+ size: fileContent.length,
148
+ };
149
+ },
150
+ });
@@ -0,0 +1,26 @@
1
+ import { S3Client } from 'bun';
2
+
3
+ /**
4
+ * Creates an S3Client configured for Agentuity storage buckets
5
+ *
6
+ * Agentuity provides bucket-specific endpoints in virtual-hosted-style format.
7
+ * The endpoint is already bucket-specific (e.g., bucket-name.agentuity.run),
8
+ * so we use virtualHostedStyle: true WITHOUT passing a bucket parameter.
9
+ *
10
+ * @param bucket - Bucket configuration with endpoint, credentials, and region
11
+ * @returns Configured S3Client instance
12
+ */
13
+ export function createS3Client(bucket: {
14
+ endpoint: string;
15
+ access_key: string;
16
+ secret_key: string;
17
+ region?: string | null;
18
+ }): S3Client {
19
+ return new S3Client({
20
+ endpoint: bucket.endpoint.startsWith('http') ? bucket.endpoint : `https://${bucket.endpoint}`,
21
+ accessKeyId: bucket.access_key,
22
+ secretAccessKey: bucket.secret_key,
23
+ region: bucket.region || 'auto',
24
+ virtualHostedStyle: true,
25
+ });
26
+ }
package/src/tui.ts CHANGED
@@ -13,6 +13,10 @@ import type { ColorScheme } from './terminal';
13
13
  import type { Profile } from './types';
14
14
  import { type APIClient as APIClientType } from './api';
15
15
  import { getExitCode } from './errors';
16
+ import { maskSecret } from './env-util';
17
+
18
+ // Re-export maskSecret for convenience
19
+ export { maskSecret };
16
20
 
17
21
  // Icons
18
22
  const ICONS = {
package/src/version.ts CHANGED
@@ -16,7 +16,7 @@ export function getPackage(): typeof pkg {
16
16
  }
17
17
 
18
18
  export function getVersion(): string {
19
- return getPackage().version || 'dev';
19
+ return process.env.AGENTUITY_CLI_VERSION || getPackage().version || 'dev';
20
20
  }
21
21
 
22
22
  export function getPackageName(): string {
@@ -1,2 +0,0 @@
1
- export declare const addSubcommand: import("../../..").SubcommandDefinition;
2
- //# sourceMappingURL=add.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/add.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,yCAkExB,CAAC"}
@@ -1,70 +0,0 @@
1
- import { z } from 'zod';
2
- import { createResources } from '@agentuity/server';
3
- import enquirer from 'enquirer';
4
- import { createSubcommand } from '../../../types';
5
- import * as tui from '../../../tui';
6
- import { getCatalystAPIClient } from '../../../config';
7
- import { getCommand } from '../../../command-prefix';
8
- export const addSubcommand = createSubcommand({
9
- name: 'add',
10
- aliases: ['create'],
11
- description: 'Add a cloud resource for an organization',
12
- tags: ['mutating', 'creates-resource', 'slow', 'requires-auth', 'requires-deployment'],
13
- idempotent: false,
14
- requires: { auth: true, org: true, region: true },
15
- examples: [
16
- getCommand('cloud resource add'),
17
- getCommand('cloud resource add --type database'),
18
- getCommand('cloud resource add --type storage'),
19
- getCommand('cloud resource create --type database'),
20
- ],
21
- schema: {
22
- options: z.object({
23
- type: z.enum(['database', 'storage']).optional().describe('Resource type'),
24
- }),
25
- response: z.object({
26
- success: z.boolean().describe('Whether creation succeeded'),
27
- type: z.string().describe('Resource type (database or storage)'),
28
- name: z.string().describe('Created resource name'),
29
- }),
30
- },
31
- async handler(ctx) {
32
- const { logger, opts, orgId, region, config, auth } = ctx;
33
- // Determine resource type
34
- let resourceType = opts.type;
35
- if (!resourceType) {
36
- const response = await enquirer.prompt({
37
- type: 'select',
38
- name: 'type',
39
- message: 'Select resource type:',
40
- choices: [
41
- { name: 'database', message: 'Database (PostgreSQL)' },
42
- { name: 'storage', message: 'Storage (S3)' },
43
- ],
44
- });
45
- resourceType = response.type;
46
- }
47
- // Map user-friendly type to API type
48
- const apiType = resourceType === 'database' ? 'db' : 's3';
49
- const catalystClient = getCatalystAPIClient(config, logger, auth);
50
- const created = await tui.spinner({
51
- message: `Creating ${resourceType} in ${region}`,
52
- clearOnSuccess: true,
53
- callback: async () => {
54
- return createResources(catalystClient, orgId, region, [{ type: apiType }]);
55
- },
56
- });
57
- if (created.length > 0) {
58
- tui.success(`Created ${resourceType}: ${tui.bold(created[0].name)}`);
59
- return {
60
- success: true,
61
- type: resourceType,
62
- name: created[0].name,
63
- };
64
- }
65
- else {
66
- tui.fatal('Failed to create resource');
67
- }
68
- },
69
- });
70
- //# sourceMapp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,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAC7E,CAAC;SACD,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,GAAG,CAAC,OAAO,CAAC,WAAW,YAAY,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACrE,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;aACrB,CAAC;QACH,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;CACD,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/delete.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,yCAoI3B,CAAC"}
@@ -1,126 +0,0 @@
1
- import { z } from 'zod';
2
- import { listResources, deleteResources } from '@agentuity/server';
3
- import enquirer from 'enquirer';
4
- import { createSubcommand } from '../../../types';
5
- import * as tui from '../../../tui';
6
- import { getCatalystAPIClient } from '../../../config';
7
- import { getCommand } from '../../../command-prefix';
8
- export const deleteSubcommand = createSubcommand({
9
- name: 'delete',
10
- description: 'Delete cloud resource(s) for an organization',
11
- tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
12
- aliases: ['rm', 'del', 'remove'],
13
- idempotent: false,
14
- requires: { auth: true, org: true, region: true },
15
- examples: [
16
- getCommand('cloud resource delete'),
17
- getCommand('cloud resource delete --type db --name my-database'),
18
- getCommand('cloud resource delete --type s3 --name uploads'),
19
- getCommand('--explain cloud resource delete --type db --name old-db'),
20
- getCommand('--dry-run cloud resource rm --type s3 --name temp-bucket'),
21
- ],
22
- schema: {
23
- options: z.object({
24
- type: z.enum(['db', 's3']).optional().describe('Resource type (db or s3)'),
25
- name: z.string().optional().describe('Resource name to delete'),
26
- confirm: z.boolean().optional().describe('Skip confirmation prompts'),
27
- }),
28
- response: z.object({
29
- success: z.boolean().describe('Whether deletion succeeded'),
30
- count: z.number().describe('Number of resources deleted'),
31
- resources: z.array(z.string()).describe('Deleted resource names'),
32
- }),
33
- },
34
- async handler(ctx) {
35
- const { logger, opts, config, orgId, region, auth } = ctx;
36
- const catalystClient = getCatalystAPIClient(config, logger, auth);
37
- // Determine what to delete
38
- let resourcesToDelete = [];
39
- if (opts.type && opts.name) {
40
- // Command line arguments provided
41
- resourcesToDelete = [{ type: opts.type, name: opts.name }];
42
- }
43
- else {
44
- // Fetch resources and prompt for selection
45
- const resources = await tui.spinner({
46
- message: `Fetching resources for ${orgId} in ${region}`,
47
- clearOnSuccess: true,
48
- callback: async () => {
49
- return listResources(catalystClient, orgId, region);
50
- },
51
- });
52
- if (resources.db.length === 0 && resources.s3.length === 0) {
53
- tui.info('No resources found to delete');
54
- return { success: false, count: 0, resources: [] };
55
- }
56
- // Build choices for multi-select and resource map
57
- const choices = [];
58
- const resourceMap = new Map();
59
- for (const db of resources.db) {
60
- const key = `db:${db.name}`;
61
- choices.push({
62
- name: key,
63
- message: `Database: ${db.name}`,
64
- });
65
- resourceMap.set(key, { type: 'db', name: db.name });
66
- }
67
- for (const s3 of resources.s3) {
68
- const key = `s3:${s3.bucket_name}`;
69
- choices.push({
70
- name: key,
71
- message: `Storage: ${s3.bucket_name}`,
72
- });
73
- resourceMap.set(key, { type: 's3', name: s3.bucket_name });
74
- }
75
- const response = await enquirer.prompt({
76
- type: 'multiselect',
77
- name: 'resources',
78
- message: 'Select resource(s) to delete:',
79
- choices,
80
- });
81
- // Map selected keys back to resource objects
82
- resourcesToDelete = response.resources
83
- .map((key) => resourceMap.get(key))
84
- .filter((r) => r !== undefined);
85
- }
86
- if (resourcesToDelete.length === 0) {
87
- tui.info('No resources selected for deletion');
88
- return { success: false, count: 0, resources: [] };
89
- }
90
- // Confirm deletion
91
- if (!opts.confirm) {
92
- const resourceNames = resourcesToDelete.map((r) => `${r.type}:${r.name}`).join(', ');
93
- tui.warning(`You are about to delete: ${tui.bold(resourceNames)}`);
94
- const confirm = await enquirer.prompt({
95
- type: 'confirm',
96
- name: 'confirm',
97
- message: 'Are you sure you want to delete these resources?',
98
- initial: false,
99
- });
100
- if (!confirm.confirm) {
101
- tui.info('Deletion cancelled');
102
- return { success: false, count: 0, resources: [] };
103
- }
104
- }
105
- // Delete resources
106
- const deleted = await tui.spinner({
107
- message: `Deleting ${resourcesToDelete.length} resource(s)`,
108
- clearOnSuccess: true,
109
- callback: async () => {
110
- return deleteResources(catalystClient, orgId, region, resourcesToDelete);
111
- },
112
- });
113
- if (deleted.length > 0) {
114
- tui.success(`Deleted ${deleted.length} resource(s): ${deleted.join(', ')}`);
115
- }
116
- else {
117
- tui.error('Failed to delete resources');
118
- }
119
- return {
120
- success: deleted.length > 0,
121
- count: deleted.length,
122
- resources: deleted,
123
- };
124
- },
125
- });
126
- //# sourceMappingURL=delete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,8CAA8C;IAC3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CAAC;YACP,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACzC,CAAC;QAED,OAAO;YACN,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;YAC3B,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,SAAS,EAAE,OAAO;SAClB,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const resourceSubcommand: import("../../..").CommandDefinition;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,sCAM7B,CAAC"}
@@ -1,12 +0,0 @@
1
- import { createCommand } from '../../../types';
2
- import { listSubcommand } from './list';
3
- import { addSubcommand } from './add';
4
- import { deleteSubcommand } from './delete';
5
- export const resourceSubcommand = createCommand({
6
- name: 'resource',
7
- aliases: ['resources'],
8
- description: 'Manage cloud resources',
9
- tags: ['fast', 'requires-auth', 'requires-deployment'],
10
- subcommands: [listSubcommand, addSubcommand, deleteSubcommand],
11
- });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;IAC/C,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,qBAAqB,CAAC;IACtD,WAAW,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,gBAAgB,CAAC;CAC9D,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/list.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,cAAc,yCA2EzB,CAAC"}
@@ -1,100 +0,0 @@
1
- import { z } from 'zod';
2
- import { listResources } from '@agentuity/server';
3
- import { createSubcommand } from '../../../types';
4
- import * as tui from '../../../tui';
5
- import { getCatalystAPIClient } from '../../../config';
6
- import { getCommand } from '../../../command-prefix';
7
- const ResourceListResponseSchema = z.object({
8
- db: z
9
- .array(z.object({
10
- name: z.string().describe('Database name'),
11
- url: z.string().optional().describe('Database connection URL'),
12
- }))
13
- .describe('List of database resources'),
14
- s3: z
15
- .array(z.object({
16
- bucket_name: z.string().describe('Storage bucket name'),
17
- access_key: z.string().optional().describe('S3 access key'),
18
- secret_key: z.string().optional().describe('S3 secret key'),
19
- region: z.string().optional().describe('S3 region'),
20
- endpoint: z.string().optional().describe('S3 endpoint URL'),
21
- }))
22
- .describe('List of storage resources'),
23
- });
24
- export const listSubcommand = createSubcommand({
25
- name: 'list',
26
- description: 'List cloud resources for an organization',
27
- tags: ['read-only', 'fast', 'requires-auth'],
28
- aliases: ['ls'],
29
- requires: { auth: true, org: true, region: true },
30
- idempotent: true,
31
- examples: [
32
- getCommand('cloud resource list'),
33
- getCommand('--json cloud resource list'),
34
- getCommand('cloud resource ls'),
35
- ],
36
- schema: {
37
- response: ResourceListResponseSchema,
38
- },
39
- async handler(ctx) {
40
- const { logger, options, orgId, region, config, auth } = ctx;
41
- const catalystClient = getCatalystAPIClient(config, logger, auth);
42
- const resources = await tui.spinner({
43
- message: `Fetching resources for ${orgId} in ${region}`,
44
- clearOnSuccess: true,
45
- callback: async () => {
46
- return listResources(catalystClient, orgId, region);
47
- },
48
- });
49
- // Output based on format
50
- if (!options.json) {
51
- // Text table format
52
- if (resources.db.length === 0 && resources.s3.length === 0) {
53
- tui.info('No resources found');
54
- }
55
- else {
56
- if (resources.db.length > 0) {
57
- tui.info(tui.bold('Databases'));
58
- tui.newline();
59
- for (const db of resources.db) {
60
- console.log(tui.bold(db.name));
61
- if (db.url)
62
- console.log(` URL: ${tui.muted(db.url)}`);
63
- tui.newline();
64
- }
65
- }
66
- if (resources.s3.length > 0) {
67
- tui.info(tui.bold('Storage'));
68
- tui.newline();
69
- for (const s3 of resources.s3) {
70
- console.log(tui.bold(s3.bucket_name));
71
- if (s3.access_key)
72
- console.log(` Access Key: ${tui.muted(s3.access_key)}`);
73
- if (s3.secret_key)
74
- console.log(` Secret Key: ${tui.muted(s3.secret_key)}`);
75
- if (s3.region)
76
- console.log(` Region: ${tui.muted(s3.region)}`);
77
- if (s3.endpoint)
78
- console.log(` Endpoint: ${tui.muted(s3.endpoint)}`);
79
- tui.newline();
80
- }
81
- }
82
- }
83
- }
84
- // Convert null to undefined for schema compliance
85
- return {
86
- db: resources.db.map((db) => ({
87
- name: db.name,
88
- url: db.url ?? undefined,
89
- })),
90
- s3: resources.s3.map((s3) => ({
91
- bucket_name: s3.bucket_name,
92
- access_key: s3.access_key ?? undefined,
93
- secret_key: s3.secret_key ?? undefined,
94
- region: s3.region ?? undefined,
95
- endpoint: s3.endpoint ?? undefined,
96
- })),
97
- };
98
- },
99
- });
100
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/cmd/cloud/resource/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EA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F,CAAC;QACF,CAAC;QAED,kDAAkD;QAClD,OAAO;YACN,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7B,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,SAAS;aACxB,CAAC,CAAC;YACH,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7B,WAAW,EAAE,EAAE,CAAC,WAAW;gBAC3B,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,SAAS;gBACtC,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,SAAS;gBACtC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,SAAS;gBAC9B,QAAQ,EAAE,EAAE,CAAC,QAAQ,IAAI,SAAS;aAClC,CAAC,CAAC;SACH,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1,75 +0,0 @@
1
- import { z } from 'zod';
2
- import { createResources } from '@agentuity/server';
3
- import enquirer from 'enquirer';
4
- import { createSubcommand } from '../../../types';
5
- import * as tui from '../../../tui';
6
- import { getCatalystAPIClient } from '../../../config';
7
- import { getCommand } from '../../../command-prefix';
8
-
9
- export const addSubcommand = createSubcommand({
10
- name: 'add',
11
- aliases: ['create'],
12
- description: 'Add a cloud resource for an organization',
13
- tags: ['mutating', 'creates-resource', 'slow', 'requires-auth', 'requires-deployment'],
14
- idempotent: false,
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
- ],
22
- schema: {
23
- options: z.object({
24
- type: z.enum(['database', 'storage']).optional().describe('Resource type'),
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
- }),
31
- },
32
-
33
- async handler(ctx) {
34
- const { logger, opts, orgId, region, config, auth } = ctx;
35
-
36
- // Determine resource type
37
- let resourceType = opts.type;
38
- if (!resourceType) {
39
- const response = await enquirer.prompt<{ type: 'database' | 'storage' }>({
40
- type: 'select',
41
- name: 'type',
42
- message: 'Select resource type:',
43
- choices: [
44
- { name: 'database', message: 'Database (PostgreSQL)' },
45
- { name: 'storage', message: 'Storage (S3)' },
46
- ],
47
- });
48
- resourceType = response.type;
49
- }
50
-
51
- // Map user-friendly type to API type
52
- const apiType = resourceType === 'database' ? 'db' : 's3';
53
-
54
- const catalystClient = getCatalystAPIClient(config, logger, auth);
55
-
56
- const created = await tui.spinner({
57
- message: `Creating ${resourceType} in ${region}`,
58
- clearOnSuccess: true,
59
- callback: async () => {
60
- return createResources(catalystClient, orgId, region!, [{ type: apiType }]);
61
- },
62
- });
63
-
64
- if (created.length > 0) {
65
- tui.success(`Created ${resourceType}: ${tui.bold(created[0].name)}`);
66
- return {
67
- success: true,
68
- type: resourceType,
69
- name: created[0].name,
70
- };
71
- } else {
72
- tui.fatal('Failed to create resource');
73
- }
74
- },
75
- });