@agentuity/cli 0.0.53 → 0.0.54

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 (133) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +66 -8
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cmd/auth/ssh/add.d.ts.map +1 -1
  5. package/dist/cmd/auth/ssh/add.js +28 -13
  6. package/dist/cmd/auth/ssh/add.js.map +1 -1
  7. package/dist/cmd/auth/ssh/delete.d.ts.map +1 -1
  8. package/dist/cmd/auth/ssh/delete.js +28 -18
  9. package/dist/cmd/auth/ssh/delete.js.map +1 -1
  10. package/dist/cmd/auth/ssh/list.d.ts.map +1 -1
  11. package/dist/cmd/auth/ssh/list.js +5 -6
  12. package/dist/cmd/auth/ssh/list.js.map +1 -1
  13. package/dist/cmd/build/ast.d.ts +34 -0
  14. package/dist/cmd/build/ast.d.ts.map +1 -1
  15. package/dist/cmd/build/ast.js +159 -0
  16. package/dist/cmd/build/ast.js.map +1 -1
  17. package/dist/cmd/build/bundler.d.ts +2 -1
  18. package/dist/cmd/build/bundler.d.ts.map +1 -1
  19. package/dist/cmd/build/bundler.js +77 -16
  20. package/dist/cmd/build/bundler.js.map +1 -1
  21. package/dist/cmd/build/plugin.d.ts.map +1 -1
  22. package/dist/cmd/build/plugin.js +74 -4
  23. package/dist/cmd/build/plugin.js.map +1 -1
  24. package/dist/cmd/cloud/deployment/list.d.ts.map +1 -1
  25. package/dist/cmd/cloud/deployment/list.js +28 -23
  26. package/dist/cmd/cloud/deployment/list.js.map +1 -1
  27. package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
  28. package/dist/cmd/cloud/deployment/show.js +50 -47
  29. package/dist/cmd/cloud/deployment/show.js.map +1 -1
  30. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  31. package/dist/cmd/cloud/env/get.js +16 -14
  32. package/dist/cmd/cloud/env/get.js.map +1 -1
  33. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  34. package/dist/cmd/cloud/env/list.js +24 -20
  35. package/dist/cmd/cloud/env/list.js.map +1 -1
  36. package/dist/cmd/cloud/keyvalue/get.d.ts.map +1 -1
  37. package/dist/cmd/cloud/keyvalue/get.js +18 -16
  38. package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
  39. package/dist/cmd/cloud/keyvalue/keys.d.ts.map +1 -1
  40. package/dist/cmd/cloud/keyvalue/keys.js +11 -11
  41. package/dist/cmd/cloud/keyvalue/keys.js.map +1 -1
  42. package/dist/cmd/cloud/keyvalue/list-namespaces.d.ts.map +1 -1
  43. package/dist/cmd/cloud/keyvalue/list-namespaces.js +11 -7
  44. package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
  45. package/dist/cmd/cloud/keyvalue/search.d.ts.map +1 -1
  46. package/dist/cmd/cloud/keyvalue/search.js +16 -17
  47. package/dist/cmd/cloud/keyvalue/search.js.map +1 -1
  48. package/dist/cmd/cloud/keyvalue/stats.d.ts.map +1 -1
  49. package/dist/cmd/cloud/keyvalue/stats.js +38 -23
  50. package/dist/cmd/cloud/keyvalue/stats.js.map +1 -1
  51. package/dist/cmd/cloud/objectstore/get.d.ts.map +1 -1
  52. package/dist/cmd/cloud/objectstore/get.js +17 -15
  53. package/dist/cmd/cloud/objectstore/get.js.map +1 -1
  54. package/dist/cmd/cloud/objectstore/list-buckets.d.ts.map +1 -1
  55. package/dist/cmd/cloud/objectstore/list-buckets.js +12 -8
  56. package/dist/cmd/cloud/objectstore/list-buckets.js.map +1 -1
  57. package/dist/cmd/cloud/objectstore/list-keys.d.ts.map +1 -1
  58. package/dist/cmd/cloud/objectstore/list-keys.js +13 -10
  59. package/dist/cmd/cloud/objectstore/list-keys.js.map +1 -1
  60. package/dist/cmd/cloud/resource/list.d.ts.map +1 -1
  61. package/dist/cmd/cloud/resource/list.js +38 -27
  62. package/dist/cmd/cloud/resource/list.js.map +1 -1
  63. package/dist/cmd/cloud/secret/get.d.ts.map +1 -1
  64. package/dist/cmd/cloud/secret/get.js +17 -15
  65. package/dist/cmd/cloud/secret/get.js.map +1 -1
  66. package/dist/cmd/cloud/secret/list.d.ts.map +1 -1
  67. package/dist/cmd/cloud/secret/list.js +24 -20
  68. package/dist/cmd/cloud/secret/list.js.map +1 -1
  69. package/dist/cmd/cloud/session/logs.d.ts.map +1 -1
  70. package/dist/cmd/cloud/session/logs.js +18 -15
  71. package/dist/cmd/cloud/session/logs.js.map +1 -1
  72. package/dist/cmd/dev/agents.d.ts.map +1 -1
  73. package/dist/cmd/dev/agents.js +55 -41
  74. package/dist/cmd/dev/agents.js.map +1 -1
  75. package/dist/cmd/dev/index.d.ts.map +1 -1
  76. package/dist/cmd/dev/index.js +2 -0
  77. package/dist/cmd/dev/index.js.map +1 -1
  78. package/dist/cmd/profile/create.js +1 -1
  79. package/dist/cmd/profile/create.js.map +1 -1
  80. package/dist/cmd/profile/delete.d.ts.map +1 -1
  81. package/dist/cmd/profile/delete.js +1 -1
  82. package/dist/cmd/profile/delete.js.map +1 -1
  83. package/dist/cmd/profile/list.d.ts.map +1 -1
  84. package/dist/cmd/profile/list.js +29 -11
  85. package/dist/cmd/profile/list.js.map +1 -1
  86. package/dist/cmd/profile/show.d.ts.map +1 -1
  87. package/dist/cmd/profile/show.js +7 -10
  88. package/dist/cmd/profile/show.js.map +1 -1
  89. package/dist/cmd/project/delete.js +1 -1
  90. package/dist/cmd/project/delete.js.map +1 -1
  91. package/dist/cmd/version/index.d.ts.map +1 -1
  92. package/dist/cmd/version/index.js +1 -1
  93. package/dist/cmd/version/index.js.map +1 -1
  94. package/dist/tui.d.ts.map +1 -1
  95. package/dist/tui.js +3 -1
  96. package/dist/tui.js.map +1 -1
  97. package/dist/types.d.ts +32 -8
  98. package/dist/types.d.ts.map +1 -1
  99. package/dist/types.js.map +1 -1
  100. package/package.json +3 -3
  101. package/src/cli.ts +109 -8
  102. package/src/cmd/auth/ssh/add.ts +37 -17
  103. package/src/cmd/auth/ssh/delete.ts +36 -23
  104. package/src/cmd/auth/ssh/list.ts +8 -6
  105. package/src/cmd/build/ast.ts +203 -0
  106. package/src/cmd/build/bundler.ts +81 -15
  107. package/src/cmd/build/plugin.ts +92 -4
  108. package/src/cmd/cloud/deployment/list.ts +30 -26
  109. package/src/cmd/cloud/deployment/show.ts +47 -42
  110. package/src/cmd/cloud/env/get.ts +14 -12
  111. package/src/cmd/cloud/env/list.ts +24 -22
  112. package/src/cmd/cloud/keyvalue/get.ts +19 -14
  113. package/src/cmd/cloud/keyvalue/keys.ts +10 -12
  114. package/src/cmd/cloud/keyvalue/list-namespaces.ts +10 -8
  115. package/src/cmd/cloud/keyvalue/search.ts +14 -17
  116. package/src/cmd/cloud/keyvalue/stats.ts +52 -28
  117. package/src/cmd/cloud/objectstore/get.ts +18 -13
  118. package/src/cmd/cloud/objectstore/list-buckets.ts +11 -9
  119. package/src/cmd/cloud/objectstore/list-keys.ts +12 -11
  120. package/src/cmd/cloud/resource/list.ts +33 -23
  121. package/src/cmd/cloud/secret/get.ts +15 -13
  122. package/src/cmd/cloud/secret/list.ts +24 -22
  123. package/src/cmd/cloud/session/logs.ts +18 -17
  124. package/src/cmd/dev/agents.ts +70 -50
  125. package/src/cmd/dev/index.ts +2 -0
  126. package/src/cmd/profile/create.ts +3 -3
  127. package/src/cmd/profile/delete.ts +5 -2
  128. package/src/cmd/profile/list.ts +31 -11
  129. package/src/cmd/profile/show.ts +15 -12
  130. package/src/cmd/project/delete.ts +1 -1
  131. package/src/cmd/version/index.ts +5 -1
  132. package/src/tui.ts +3 -1
  133. package/src/types.ts +32 -10
@@ -59,7 +59,7 @@ export const createCommand = createSubcommand({
59
59
  return logger.fatal(
60
60
  `Profile "${name}" already exists at ${existing.filename}`,
61
61
  ErrorCode.RESOURCE_ALREADY_EXISTS
62
- );
62
+ ) as never;
63
63
  }
64
64
 
65
65
  await ensureConfigDir();
@@ -103,10 +103,10 @@ export const createCommand = createSubcommand({
103
103
  } catch (error) {
104
104
  const message = error instanceof Error ? error.message : String(error);
105
105
  const stack = error instanceof Error ? error.stack : undefined;
106
- logger.fatal(
106
+ return logger.fatal(
107
107
  `Failed to create profile: ${message}${stack ? `\n${stack}` : ''}`,
108
108
  ErrorCode.INTERNAL_ERROR
109
- );
109
+ ) as never;
110
110
  }
111
111
  },
112
112
  });
@@ -43,7 +43,7 @@ export const deleteCommand = createSubcommand({
43
43
  const profile = profiles.find((p) => p.name === name);
44
44
 
45
45
  if (!profile) {
46
- return logger.fatal(`Profile "${name}" not found`, ErrorCode.RESOURCE_NOT_FOUND);
46
+ return logger.fatal(`Profile "${name}" not found`, ErrorCode.RESOURCE_NOT_FOUND) as never;
47
47
  }
48
48
 
49
49
  // Ask for confirmation unless --confirm flag is passed
@@ -66,7 +66,10 @@ export const deleteCommand = createSubcommand({
66
66
 
67
67
  return { success: true, name };
68
68
  } catch (error) {
69
- logger.fatal(`Failed to delete profile: ${error}`);
69
+ return logger.fatal(
70
+ `Failed to delete profile: ${error}`,
71
+ ErrorCode.FILE_WRITE_ERROR
72
+ ) as never;
70
73
  }
71
74
  },
72
75
  });
@@ -1,9 +1,18 @@
1
+ import { z } from 'zod';
1
2
  import { createSubcommand } from '../../types';
2
3
  import { fetchProfiles } from '../../config';
3
4
  import { basename, dirname } from 'node:path';
4
5
  import * as tui from '../../tui';
5
6
  import { getCommand } from '../../command-prefix';
6
7
 
8
+ const ProfileListResponseSchema = z.array(
9
+ z.object({
10
+ name: z.string().describe('Profile name'),
11
+ filename: z.string().describe('Profile file path'),
12
+ selected: z.boolean().describe('Whether this profile is currently selected'),
13
+ })
14
+ );
15
+
7
16
  export const listCommand = createSubcommand({
8
17
  name: 'list',
9
18
  description: 'List all available profiles',
@@ -11,21 +20,32 @@ export const listCommand = createSubcommand({
11
20
  idempotent: true,
12
21
  aliases: ['ls'],
13
22
  examples: [getCommand('profile list'), getCommand('profile ls')],
23
+ schema: {
24
+ response: ProfileListResponseSchema,
25
+ },
14
26
 
15
- async handler() {
27
+ async handler(ctx) {
28
+ const { options } = ctx;
16
29
  const profiles = await fetchProfiles();
17
30
 
18
- if (profiles.length === 0) {
19
- tui.info('No profiles found');
20
- return;
31
+ if (!options.json) {
32
+ if (profiles.length === 0) {
33
+ tui.info('No profiles found');
34
+ } else {
35
+ console.log('Available profiles:');
36
+ for (const profile of profiles) {
37
+ const marker = profile.selected ? '•' : ' ';
38
+ const name = tui.padRight(profile.name, 15, ' ');
39
+ const path = `${basename(dirname(profile.filename))}/${basename(profile.filename)}`;
40
+ console.log(`${marker} ${name} ${tui.muted(path)}`);
41
+ }
42
+ }
21
43
  }
22
44
 
23
- console.log('Available profiles:');
24
- for (const profile of profiles) {
25
- const marker = profile.selected ? '•' : ' ';
26
- const name = tui.padRight(profile.name, 15, ' ');
27
- const path = `${basename(dirname(profile.filename))}/${basename(profile.filename)}`;
28
- console.log(`${marker} ${name} ${tui.muted(path)}`);
29
- }
45
+ return profiles.map((p) => ({
46
+ name: p.name,
47
+ filename: p.filename,
48
+ selected: p.selected,
49
+ }));
30
50
  },
31
51
  });
@@ -19,9 +19,6 @@ export const showCommand = createSubcommand({
19
19
  getCommand('profile show staging --json'),
20
20
  ],
21
21
  schema: {
22
- options: z.object({
23
- json: z.boolean().optional().describe('Show the JSON config'),
24
- }),
25
22
  args: z
26
23
  .object({
27
24
  name: z.string().optional().describe('Profile name to show (optional)'),
@@ -32,7 +29,7 @@ export const showCommand = createSubcommand({
32
29
  idempotent: true,
33
30
 
34
31
  async handler(ctx) {
35
- const { logger, args, opts } = ctx;
32
+ const { logger, args, options } = ctx;
36
33
 
37
34
  try {
38
35
  let current = false;
@@ -47,19 +44,25 @@ export const showCommand = createSubcommand({
47
44
  const profile = profiles.find((p) => p.name === name);
48
45
 
49
46
  if (!profile) {
50
- return logger.fatal(`Profile "${name}" not found`, ErrorCode.RESOURCE_NOT_FOUND);
47
+ return logger.fatal(
48
+ `Profile "${name}" not found`,
49
+ ErrorCode.RESOURCE_NOT_FOUND
50
+ ) as never;
51
51
  }
52
52
 
53
53
  const profilePath = profile.filename;
54
54
  current = profile.selected;
55
55
 
56
- tui.info(`Profile: ${profilePath}`);
57
-
58
56
  const content = await loadConfig(current ? undefined : profilePath);
57
+ if (!content) {
58
+ return logger.fatal(
59
+ `Failed to load profile configuration`,
60
+ ErrorCode.INTERNAL_ERROR
61
+ ) as never;
62
+ }
59
63
 
60
- if (opts?.json) {
61
- console.log(JSON.stringify(content, null, 2));
62
- } else {
64
+ if (!options.json) {
65
+ tui.info(`Profile: ${profilePath}`);
63
66
  tui.newline();
64
67
  const textContent = await readFile(profilePath, 'utf-8');
65
68
  console.log(textContent);
@@ -68,9 +71,9 @@ export const showCommand = createSubcommand({
68
71
  return content;
69
72
  } catch (error) {
70
73
  if (error instanceof Error) {
71
- logger.fatal(`Failed to show profile: ${error.message}`);
74
+ return logger.fatal(`Failed to show profile: ${error.message}`) as never;
72
75
  } else {
73
- logger.fatal('Failed to show profile');
76
+ return logger.fatal('Failed to show profile') as never;
74
77
  }
75
78
  }
76
79
  },
@@ -59,7 +59,7 @@ export const deleteSubcommand = createSubcommand({
59
59
 
60
60
  if (projects.length === 0) {
61
61
  tui.info('No projects found to delete');
62
- return;
62
+ return { success: false, projectIds: [], count: 0 };
63
63
  }
64
64
 
65
65
  // Sort projects by name
@@ -24,7 +24,11 @@ export const command = createCommand({
24
24
  return version;
25
25
  } catch (error) {
26
26
  const logger = createLogger();
27
- logger.fatal('Failed to retrieve version: %s', error, ErrorCode.INTERNAL_ERROR);
27
+ return logger.fatal(
28
+ 'Failed to retrieve version: %s',
29
+ error,
30
+ ErrorCode.INTERNAL_ERROR
31
+ ) as never;
28
32
  }
29
33
  },
30
34
  });
package/src/tui.ts CHANGED
@@ -831,7 +831,9 @@ export async function spinner<T>(
831
831
  : await options.callback;
832
832
 
833
833
  // If clearOnSuccess is true, don't show success message
834
- if (!options.clearOnSuccess) {
834
+ // Also skip success message in JSON mode
835
+ const isJsonMode = outputOptions?.json === true;
836
+ if (!options.clearOnSuccess && !isJsonMode) {
835
837
  const successColor = getColor('success');
836
838
  console.error(`${successColor}${ICONS.success} ${message}${reset}`);
837
839
  }
package/src/types.ts CHANGED
@@ -252,6 +252,7 @@ export function createSubcommand<
252
252
  O extends Optional | undefined = undefined,
253
253
  A extends z.ZodType | undefined = undefined,
254
254
  Op extends z.ZodType | undefined = undefined,
255
+ Res extends z.ZodType | undefined = undefined,
255
256
  >(definition: {
256
257
  name: string;
257
258
  description: string;
@@ -267,12 +268,22 @@ export function createSubcommand<
267
268
  tags?: string[];
268
269
  schema?: A extends z.ZodType
269
270
  ? Op extends z.ZodType
270
- ? { args: A; options: Op; response?: z.ZodType }
271
- : { args: A; response?: z.ZodType }
271
+ ? Res extends z.ZodType
272
+ ? { args: A; options: Op; response: Res }
273
+ : { args: A; options: Op; response?: z.ZodType }
274
+ : Res extends z.ZodType
275
+ ? { args: A; response: Res }
276
+ : { args: A; response?: z.ZodType }
272
277
  : Op extends z.ZodType
273
- ? { options: Op; response?: z.ZodType }
274
- : { response?: z.ZodType };
275
- handler(ctx: CommandContext<R, O, A, Op>): unknown | Promise<unknown>;
278
+ ? Res extends z.ZodType
279
+ ? { options: Op; response: Res }
280
+ : { options: Op; response?: z.ZodType }
281
+ : Res extends z.ZodType
282
+ ? { response: Res }
283
+ : { response?: z.ZodType };
284
+ handler(
285
+ ctx: CommandContext<R, O, A, Op>
286
+ ): Res extends z.ZodType ? z.infer<Res> | Promise<z.infer<Res>> : unknown | Promise<unknown>;
276
287
  }): SubcommandDefinition {
277
288
  return definition as unknown as SubcommandDefinition;
278
289
  }
@@ -282,6 +293,7 @@ export function createCommand<
282
293
  O extends Optional | undefined = undefined,
283
294
  A extends z.ZodType | undefined = undefined,
284
295
  Op extends z.ZodType | undefined = undefined,
296
+ Res extends z.ZodType | undefined = undefined,
285
297
  >(definition: {
286
298
  name: string;
287
299
  description: string;
@@ -297,12 +309,22 @@ export function createCommand<
297
309
  tags?: string[];
298
310
  schema?: A extends z.ZodType
299
311
  ? Op extends z.ZodType
300
- ? { args: A; options: Op; response?: z.ZodType }
301
- : { args: A; response?: z.ZodType }
312
+ ? Res extends z.ZodType
313
+ ? { args: A; options: Op; response: Res }
314
+ : { args: A; options: Op; response?: z.ZodType }
315
+ : Res extends z.ZodType
316
+ ? { args: A; response: Res }
317
+ : { args: A; response?: z.ZodType }
302
318
  : Op extends z.ZodType
303
- ? { options: Op; response?: z.ZodType }
304
- : { response?: z.ZodType };
305
- handler?(ctx: CommandContext<R, O, A, Op>): unknown | Promise<unknown>;
319
+ ? Res extends z.ZodType
320
+ ? { options: Op; response: Res }
321
+ : { options: Op; response?: z.ZodType }
322
+ : Res extends z.ZodType
323
+ ? { response: Res }
324
+ : { response?: z.ZodType };
325
+ handler?(
326
+ ctx: CommandContext<R, O, A, Op>
327
+ ): Res extends z.ZodType ? z.infer<Res> | Promise<z.infer<Res>> : unknown | Promise<unknown>;
306
328
  subcommands?: SubcommandDefinition[];
307
329
  }): CommandDefinition {
308
330
  return definition as unknown as CommandDefinition;