@agentuity/cli 0.0.72 → 0.0.74

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 (126) hide show
  1. package/bin/cli.ts +19 -5
  2. package/dist/auth.d.ts.map +1 -1
  3. package/dist/auth.js +13 -9
  4. package/dist/auth.js.map +1 -1
  5. package/dist/banner.js +1 -1
  6. package/dist/banner.js.map +1 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +79 -21
  9. package/dist/cli.js.map +1 -1
  10. package/dist/cmd/ai/prompt/api.d.ts.map +1 -1
  11. package/dist/cmd/ai/prompt/api.js +5 -4
  12. package/dist/cmd/ai/prompt/api.js.map +1 -1
  13. package/dist/cmd/auth/api.d.ts +2 -2
  14. package/dist/cmd/auth/api.d.ts.map +1 -1
  15. package/dist/cmd/auth/api.js +15 -14
  16. package/dist/cmd/auth/api.js.map +1 -1
  17. package/dist/cmd/auth/login.d.ts.map +1 -1
  18. package/dist/cmd/auth/login.js +37 -16
  19. package/dist/cmd/auth/login.js.map +1 -1
  20. package/dist/cmd/auth/ssh/api.d.ts.map +1 -1
  21. package/dist/cmd/auth/ssh/api.js +3 -2
  22. package/dist/cmd/auth/ssh/api.js.map +1 -1
  23. package/dist/cmd/build/ast.d.ts.map +1 -1
  24. package/dist/cmd/build/ast.js +76 -14
  25. package/dist/cmd/build/ast.js.map +1 -1
  26. package/dist/cmd/build/bundler.d.ts +3 -1
  27. package/dist/cmd/build/bundler.d.ts.map +1 -1
  28. package/dist/cmd/build/bundler.js +21 -9
  29. package/dist/cmd/build/bundler.js.map +1 -1
  30. package/dist/cmd/build/format-schema.d.ts +6 -0
  31. package/dist/cmd/build/format-schema.d.ts.map +1 -0
  32. package/dist/cmd/build/format-schema.js +60 -0
  33. package/dist/cmd/build/format-schema.js.map +1 -0
  34. package/dist/cmd/build/index.d.ts.map +1 -1
  35. package/dist/cmd/build/index.js +13 -0
  36. package/dist/cmd/build/index.js.map +1 -1
  37. package/dist/cmd/build/plugin.d.ts.map +1 -1
  38. package/dist/cmd/build/plugin.js +123 -32
  39. package/dist/cmd/build/plugin.js.map +1 -1
  40. package/dist/cmd/build/route-discovery.d.ts +50 -0
  41. package/dist/cmd/build/route-discovery.d.ts.map +1 -0
  42. package/dist/cmd/build/route-discovery.js +143 -0
  43. package/dist/cmd/build/route-discovery.js.map +1 -0
  44. package/dist/cmd/build/route-registry.d.ts.map +1 -1
  45. package/dist/cmd/build/route-registry.js +25 -10
  46. package/dist/cmd/build/route-registry.js.map +1 -1
  47. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  48. package/dist/cmd/cloud/deploy.js +8 -6
  49. package/dist/cmd/cloud/deploy.js.map +1 -1
  50. package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
  51. package/dist/cmd/cloud/deployment/show.js +34 -10
  52. package/dist/cmd/cloud/deployment/show.js.map +1 -1
  53. package/dist/cmd/dev/agents.d.ts.map +1 -1
  54. package/dist/cmd/dev/agents.js +2 -2
  55. package/dist/cmd/dev/agents.js.map +1 -1
  56. package/dist/cmd/dev/index.d.ts.map +1 -1
  57. package/dist/cmd/dev/index.js +21 -0
  58. package/dist/cmd/dev/index.js.map +1 -1
  59. package/dist/cmd/dev/sync.d.ts.map +1 -1
  60. package/dist/cmd/dev/sync.js +2 -2
  61. package/dist/cmd/dev/sync.js.map +1 -1
  62. package/dist/cmd/project/download.d.ts.map +1 -1
  63. package/dist/cmd/project/download.js +16 -2
  64. package/dist/cmd/project/download.js.map +1 -1
  65. package/dist/cmd/project/list.d.ts.map +1 -1
  66. package/dist/cmd/project/list.js +2 -10
  67. package/dist/cmd/project/list.js.map +1 -1
  68. package/dist/cmd/project/show.d.ts.map +1 -1
  69. package/dist/cmd/project/show.js +8 -7
  70. package/dist/cmd/project/show.js.map +1 -1
  71. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  72. package/dist/cmd/project/template-flow.js +14 -2
  73. package/dist/cmd/project/template-flow.js.map +1 -1
  74. package/dist/config.d.ts.map +1 -1
  75. package/dist/config.js +9 -0
  76. package/dist/config.js.map +1 -1
  77. package/dist/index.d.ts +2 -2
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/index.js.map +1 -1
  81. package/dist/steps.d.ts +20 -30
  82. package/dist/steps.d.ts.map +1 -1
  83. package/dist/steps.js +339 -184
  84. package/dist/steps.js.map +1 -1
  85. package/dist/tui/box.d.ts.map +1 -1
  86. package/dist/tui/box.js +8 -4
  87. package/dist/tui/box.js.map +1 -1
  88. package/dist/tui/prompt.d.ts.map +1 -1
  89. package/dist/tui/prompt.js +7 -2
  90. package/dist/tui/prompt.js.map +1 -1
  91. package/dist/tui.d.ts +20 -1
  92. package/dist/tui.d.ts.map +1 -1
  93. package/dist/tui.js +90 -18
  94. package/dist/tui.js.map +1 -1
  95. package/dist/types.d.ts +10 -0
  96. package/dist/types.d.ts.map +1 -1
  97. package/package.json +3 -3
  98. package/src/auth.ts +13 -10
  99. package/src/banner.ts +1 -1
  100. package/src/cli.ts +89 -27
  101. package/src/cmd/ai/prompt/api.ts +5 -4
  102. package/src/cmd/auth/api.ts +20 -22
  103. package/src/cmd/auth/login.ts +36 -17
  104. package/src/cmd/auth/ssh/api.ts +5 -9
  105. package/src/cmd/build/ast.ts +88 -14
  106. package/src/cmd/build/bundler.ts +32 -11
  107. package/src/cmd/build/format-schema.ts +66 -0
  108. package/src/cmd/build/index.ts +14 -0
  109. package/src/cmd/build/plugin.ts +146 -36
  110. package/src/cmd/build/route-discovery.ts +197 -0
  111. package/src/cmd/build/route-registry.ts +26 -10
  112. package/src/cmd/cloud/deploy.ts +19 -6
  113. package/src/cmd/cloud/deployment/show.ts +42 -10
  114. package/src/cmd/dev/agents.ts +2 -10
  115. package/src/cmd/dev/index.ts +25 -0
  116. package/src/cmd/dev/sync.ts +2 -12
  117. package/src/cmd/project/download.ts +16 -2
  118. package/src/cmd/project/list.ts +2 -9
  119. package/src/cmd/project/show.ts +8 -6
  120. package/src/cmd/project/template-flow.ts +21 -2
  121. package/src/config.ts +10 -0
  122. package/src/index.ts +2 -2
  123. package/src/steps.ts +397 -229
  124. package/src/tui/box.ts +8 -4
  125. package/src/tui/prompt.ts +7 -4
  126. package/src/tui.ts +125 -20
@@ -256,6 +256,7 @@ export const command = createCommand({
256
256
  let building = false;
257
257
  let buildCompletedAt = 0;
258
258
  const BUILD_COOLDOWN_MS = 500; // Ignore file changes for 500ms after build completes
259
+ const templatedDirectories = new Map<string, number>(); // Track directories that just had templates created
259
260
  let metadata: Partial<BuildMetadata> | undefined;
260
261
  let showInitialReadyMessage = true;
261
262
  let serverStartTime = 0;
@@ -997,6 +998,7 @@ export const command = createCommand({
997
998
  }
998
999
  }
999
1000
 
1001
+ // Handle new empty directories in src/agent/ or src/api/ paths
1000
1002
  if (
1001
1003
  eventType === 'rename' &&
1002
1004
  existsSync(absPath) &&
@@ -1006,9 +1008,32 @@ export const command = createCommand({
1006
1008
  if (changedFile?.startsWith('src/agent/')) {
1007
1009
  logger.debug('agent directory created: %s', changedFile);
1008
1010
  createAgentTemplates(absPath);
1011
+ // Mark this directory as recently templated to avoid immediate rebuild
1012
+ templatedDirectories.set(absPath, Date.now());
1013
+ // Schedule cleanup of this marker after enough time for file events
1014
+ setTimeout(() => templatedDirectories.delete(absPath), 1000);
1015
+ // Don't restart - wait for the template files to trigger the rebuild
1016
+ return;
1009
1017
  } else if (changedFile?.startsWith('src/api/')) {
1010
1018
  logger.debug('api directory created: %s', changedFile);
1011
1019
  createAPITemplates(absPath);
1020
+ // Mark this directory as recently templated to avoid immediate rebuild
1021
+ templatedDirectories.set(absPath, Date.now());
1022
+ // Schedule cleanup of this marker after enough time for file events
1023
+ setTimeout(() => templatedDirectories.delete(absPath), 1000);
1024
+ // Don't restart - wait for the template files to trigger the rebuild
1025
+ return;
1026
+ }
1027
+ }
1028
+
1029
+ // Check if this file/directory was just templated - skip restart to avoid race condition
1030
+ for (const [templatedPath, timestamp] of templatedDirectories.entries()) {
1031
+ if (absPath.startsWith(templatedPath) && Date.now() - timestamp < 500) {
1032
+ logger.trace(
1033
+ 'Ignoring event in recently templated directory: %s',
1034
+ templatedPath
1035
+ );
1036
+ return;
1012
1037
  }
1013
1038
  }
1014
1039
 
@@ -253,12 +253,7 @@ class DevmodeSyncService implements IDevmodeSyncService {
253
253
  JSON.stringify(payload, null, 2)
254
254
  );
255
255
 
256
- await this.apiClient.request(
257
- 'POST',
258
- '/cli/devmode/agent',
259
- z.object({ success: z.boolean() }),
260
- payload
261
- );
256
+ await this.apiClient.post('/cli/devmode/agent', payload, z.object({ success: z.boolean() }));
262
257
  }
263
258
 
264
259
  private async syncEvals(
@@ -280,12 +275,7 @@ class DevmodeSyncService implements IDevmodeSyncService {
280
275
  JSON.stringify(payload, null, 2)
281
276
  );
282
277
 
283
- await this.apiClient.request(
284
- 'POST',
285
- '/cli/devmode/eval',
286
- z.object({ success: z.boolean() }),
287
- payload
288
- );
278
+ await this.apiClient.post('/cli/devmode/eval', payload, z.object({ success: z.boolean() }));
289
279
  }
290
280
  }
291
281
 
@@ -230,11 +230,25 @@ export async function setupProject(options: SetupOptions): Promise<void> {
230
230
  // Initialize git repository if git is available
231
231
  const gitPath = Bun.which('git');
232
232
  if (gitPath) {
233
+ // Get default branch from git config, fallback to 'main'
234
+ let defaultBranch = 'main';
235
+ try {
236
+ const result = Bun.spawnSync(['git', 'config', '--global', 'init.defaultBranch']);
237
+ if (result.exitCode === 0) {
238
+ const branch = result.stdout.toString().trim();
239
+ if (branch) {
240
+ defaultBranch = branch;
241
+ }
242
+ }
243
+ } catch {
244
+ // Ignore errors, use fallback
245
+ }
246
+
233
247
  // Git is available, initialize repository
234
248
  await tui.runCommand({
235
- command: 'git init',
249
+ command: `git init -b ${defaultBranch}`,
236
250
  cwd: dest,
237
- cmd: ['git', 'init'],
251
+ cmd: ['git', 'init', '-b', defaultBranch],
238
252
  clearOnSuccess: true,
239
253
  });
240
254
 
@@ -43,16 +43,9 @@ export const listSubcommand = createSubcommand({
43
43
  },
44
44
  });
45
45
 
46
- // TODO: might want to sort by the last org_id we used
47
- if (projects) {
48
- projects.sort((a, b) => {
49
- return a.name.localeCompare(b.name);
50
- });
51
- }
46
+ // Projects are sorted by createdAt (most recent first) from the API
52
47
 
53
- if (options.json) {
54
- console.log(JSON.stringify(projects, null, 2));
55
- } else {
48
+ if (!options.json) {
56
49
  tui.table(projects, ['id', 'name', 'orgName']);
57
50
  }
58
51
 
@@ -6,8 +6,10 @@ import { getCommand } from '../../command-prefix';
6
6
 
7
7
  const ProjectShowResponseSchema = z.object({
8
8
  id: z.string().describe('Project ID'),
9
+ name: z.string().describe('Project name'),
10
+ description: z.string().nullable().optional().describe('Project description'),
11
+ tags: z.array(z.string()).nullable().optional().describe('Project tags'),
9
12
  orgId: z.string().describe('Organization ID'),
10
- name: z.string().optional().describe('Project name'),
11
13
  secrets: z.record(z.string(), z.string()).optional().describe('Project secrets (masked)'),
12
14
  env: z.record(z.string(), z.string()).optional().describe('Environment variables'),
13
15
  });
@@ -45,16 +47,16 @@ export const showSubcommand = createSubcommand({
45
47
  tui.fatal('Project not found');
46
48
  }
47
49
 
48
- if (options.json) {
49
- console.log(JSON.stringify(project, null, 2));
50
- } else {
51
- tui.table([project], ['id', 'orgId']);
50
+ if (!options.json) {
51
+ tui.table([project], ['id', 'name', 'description', 'tags', 'orgId']);
52
52
  }
53
53
 
54
54
  return {
55
55
  id: project.id,
56
+ name: project.name,
57
+ description: project.description,
58
+ tags: project.tags,
56
59
  orgId: project.orgId,
57
- name: undefined,
58
60
  secrets: project.secrets,
59
61
  env: project.env,
60
62
  };
@@ -177,7 +177,13 @@ export async function runCreateFlow(options: CreateFlowOptions): Promise<void> {
177
177
  if (initialTemplate) {
178
178
  const found = templates.find((t) => t.id === initialTemplate);
179
179
  if (!found) {
180
- logger.fatal(`Template "${initialTemplate}" not found`, ErrorCode.RESOURCE_NOT_FOUND);
180
+ const availableTemplates = templates
181
+ .map((t) => ` - ${t.id.padEnd(20)} ${t.description}`)
182
+ .join('\n');
183
+ logger.fatal(
184
+ `Template "${initialTemplate}" not found\n\nAvailable templates:\n${availableTemplates}`,
185
+ ErrorCode.RESOURCE_NOT_FOUND
186
+ );
181
187
  return;
182
188
  }
183
189
  selectedTemplate = found;
@@ -232,7 +238,7 @@ export async function runCreateFlow(options: CreateFlowOptions): Promise<void> {
232
238
 
233
239
  const resourceConfig: ResourcesTypes = Resources.parse({});
234
240
 
235
- if (auth && apiClient && catalystClient && orgId && region) {
241
+ if (auth && apiClient && catalystClient && orgId && region && !skipPrompts) {
236
242
  // Fetch resources for selected org and region using Catalyst API
237
243
  const resources = await tui.spinner({
238
244
  message: 'Fetching resources',
@@ -316,12 +322,25 @@ export async function runCreateFlow(options: CreateFlowOptions): Promise<void> {
316
322
 
317
323
  const cloudRegion = region ?? process.env.AGENTUITY_REGION ?? 'usc';
318
324
 
325
+ const pkgJsonPath = resolve(dest, 'package.json');
326
+ let pkgJson: { description?: string; keywords?: string[] } = {};
327
+ if (existsSync(pkgJsonPath)) {
328
+ pkgJson = await Bun.file(pkgJsonPath).json();
329
+ }
330
+
331
+ const keywords = Array.isArray(pkgJson.keywords) ? pkgJson.keywords : [];
332
+ const tags = keywords.filter(
333
+ (tag) => tag.toLowerCase() !== 'agentuity' && !tag.toLowerCase().startsWith('agentuity')
334
+ );
335
+
319
336
  await tui.spinner({
320
337
  message: 'Registering your project',
321
338
  clearOnSuccess: true,
322
339
  callback: async () => {
323
340
  const project = await projectCreate(apiClient, {
324
341
  name: projectName,
342
+ description: pkgJson.description,
343
+ tags: tags.length > 0 ? tags : undefined,
325
344
  orgId,
326
345
  cloudRegion,
327
346
  });
package/src/config.ts CHANGED
@@ -51,6 +51,16 @@ export async function saveProfile(path: string): Promise<void> {
51
51
  }
52
52
 
53
53
  export async function getProfile(): Promise<string> {
54
+ // Check environment variable first
55
+ if (process.env.AGENTUITY_PROFILE) {
56
+ const profileName = process.env.AGENTUITY_PROFILE;
57
+ const envProfilePath = join(getDefaultConfigDir(), `${profileName}.yaml`);
58
+ const envFile = Bun.file(envProfilePath);
59
+ if (await envFile.exists()) {
60
+ return envProfilePath;
61
+ }
62
+ }
63
+
54
64
  const profilePath = getProfilePath();
55
65
  const defaultConfigPath = getDefaultConfigPath();
56
66
 
package/src/index.ts CHANGED
@@ -83,7 +83,7 @@ export {
83
83
  type CommandHandler,
84
84
  type TableColumn,
85
85
  } from './repl';
86
- export { runSteps, setStepsColorScheme, stepSuccess, stepSkipped, stepError } from './steps';
86
+ export { runSteps, stepSuccess, stepSkipped, stepError } from './steps';
87
87
  export { playSound } from './sound';
88
88
  export {
89
89
  downloadWithProgress,
@@ -105,4 +105,4 @@ export type {
105
105
  } from './types';
106
106
  export { createSubcommand, createCommand } from './types';
107
107
  export type { ColorScheme } from './terminal';
108
- export type { Step, SimpleStep, ProgressStep, StepOutcome, ProgressCallback } from './steps';
108
+ export type { Step, StepOutcome, StepContext } from './steps';