@agentuity/cli 0.0.94 → 0.0.96

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 (277) hide show
  1. package/AGENTS.md +54 -0
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +8 -5
  5. package/dist/auth.js.map +1 -1
  6. package/dist/banner.js +1 -1
  7. package/dist/banner.js.map +1 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +190 -27
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cmd/auth/signup.js +1 -1
  12. package/dist/cmd/auth/signup.js.map +1 -1
  13. package/dist/cmd/build/ast.d.ts.map +1 -1
  14. package/dist/cmd/build/ast.js +7 -0
  15. package/dist/cmd/build/ast.js.map +1 -1
  16. package/dist/cmd/build/entry-generator.d.ts +20 -0
  17. package/dist/cmd/build/entry-generator.d.ts.map +1 -0
  18. package/dist/cmd/build/entry-generator.js +366 -0
  19. package/dist/cmd/build/entry-generator.js.map +1 -0
  20. package/dist/cmd/build/index.d.ts.map +1 -1
  21. package/dist/cmd/build/index.js +5 -23
  22. package/dist/cmd/build/index.js.map +1 -1
  23. package/dist/cmd/build/vite/agent-discovery.d.ts +33 -0
  24. package/dist/cmd/build/vite/agent-discovery.d.ts.map +1 -0
  25. package/dist/cmd/build/vite/agent-discovery.js +297 -0
  26. package/dist/cmd/build/vite/agent-discovery.js.map +1 -0
  27. package/dist/cmd/build/vite/browser-env-plugin.d.ts +9 -0
  28. package/dist/cmd/build/vite/browser-env-plugin.d.ts.map +1 -0
  29. package/dist/cmd/build/vite/browser-env-plugin.js +28 -0
  30. package/dist/cmd/build/vite/browser-env-plugin.js.map +1 -0
  31. package/dist/cmd/build/vite/bun-dev-server.d.ts +29 -0
  32. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -0
  33. package/dist/cmd/build/vite/bun-dev-server.js +54 -0
  34. package/dist/cmd/build/vite/bun-dev-server.js.map +1 -0
  35. package/dist/cmd/build/vite/config-loader.d.ts +23 -0
  36. package/dist/cmd/build/vite/config-loader.d.ts.map +1 -0
  37. package/dist/cmd/build/vite/config-loader.js +50 -0
  38. package/dist/cmd/build/vite/config-loader.js.map +1 -0
  39. package/dist/cmd/build/vite/index.d.ts +26 -0
  40. package/dist/cmd/build/vite/index.d.ts.map +1 -0
  41. package/dist/cmd/build/vite/index.js +127 -0
  42. package/dist/cmd/build/vite/index.js.map +1 -0
  43. package/dist/cmd/build/vite/lifecycle-generator.d.ts +11 -0
  44. package/dist/cmd/build/vite/lifecycle-generator.d.ts.map +1 -0
  45. package/dist/cmd/build/vite/lifecycle-generator.js +35 -0
  46. package/dist/cmd/build/vite/lifecycle-generator.js.map +1 -0
  47. package/dist/cmd/build/vite/metadata-generator.d.ts +32 -0
  48. package/dist/cmd/build/vite/metadata-generator.d.ts.map +1 -0
  49. package/dist/cmd/build/vite/metadata-generator.js +489 -0
  50. package/dist/cmd/build/vite/metadata-generator.js.map +1 -0
  51. package/dist/cmd/build/vite/patch-plugin.d.ts +21 -0
  52. package/dist/cmd/build/vite/patch-plugin.d.ts.map +1 -0
  53. package/dist/cmd/build/vite/patch-plugin.js +70 -0
  54. package/dist/cmd/build/vite/patch-plugin.js.map +1 -0
  55. package/dist/cmd/build/vite/registry-generator.d.ts +19 -0
  56. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -0
  57. package/dist/cmd/build/{route-registry.js → vite/registry-generator.js} +126 -48
  58. package/dist/cmd/build/vite/registry-generator.js.map +1 -0
  59. package/dist/cmd/build/vite/route-discovery.d.ts +58 -0
  60. package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -0
  61. package/dist/cmd/build/vite/route-discovery.js +125 -0
  62. package/dist/cmd/build/vite/route-discovery.js.map +1 -0
  63. package/dist/cmd/build/vite/server-bundler.d.ts +16 -0
  64. package/dist/cmd/build/vite/server-bundler.d.ts.map +1 -0
  65. package/dist/cmd/build/vite/server-bundler.js +194 -0
  66. package/dist/cmd/build/vite/server-bundler.js.map +1 -0
  67. package/dist/cmd/build/vite/vite-asset-server-config.d.ts +19 -0
  68. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -0
  69. package/dist/cmd/build/vite/vite-asset-server-config.js +105 -0
  70. package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -0
  71. package/dist/cmd/build/vite/vite-asset-server.d.ts +23 -0
  72. package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -0
  73. package/dist/cmd/build/vite/vite-asset-server.js +40 -0
  74. package/dist/cmd/build/vite/vite-asset-server.js.map +1 -0
  75. package/dist/cmd/build/vite/vite-builder.d.ts +44 -0
  76. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -0
  77. package/dist/cmd/build/vite/vite-builder.js +232 -0
  78. package/dist/cmd/build/vite/vite-builder.js.map +1 -0
  79. package/dist/cmd/build/vite/workbench-generator.d.ts +10 -0
  80. package/dist/cmd/build/vite/workbench-generator.d.ts.map +1 -0
  81. package/dist/cmd/build/vite/workbench-generator.js +135 -0
  82. package/dist/cmd/build/vite/workbench-generator.js.map +1 -0
  83. package/dist/cmd/build/vite-bundler.d.ts +23 -0
  84. package/dist/cmd/build/vite-bundler.d.ts.map +1 -0
  85. package/dist/cmd/build/vite-bundler.js +79 -0
  86. package/dist/cmd/build/vite-bundler.js.map +1 -0
  87. package/dist/cmd/cloud/agent/get.d.ts.map +1 -1
  88. package/dist/cmd/cloud/agent/get.js +1 -0
  89. package/dist/cmd/cloud/agent/get.js.map +1 -1
  90. package/dist/cmd/cloud/agent/list.d.ts.map +1 -1
  91. package/dist/cmd/cloud/agent/list.js +1 -0
  92. package/dist/cmd/cloud/agent/list.js.map +1 -1
  93. package/dist/cmd/cloud/db/get.d.ts.map +1 -1
  94. package/dist/cmd/cloud/db/get.js +1 -0
  95. package/dist/cmd/cloud/db/get.js.map +1 -1
  96. package/dist/cmd/cloud/db/list.d.ts.map +1 -1
  97. package/dist/cmd/cloud/db/list.js +1 -0
  98. package/dist/cmd/cloud/db/list.js.map +1 -1
  99. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  100. package/dist/cmd/cloud/deploy.js +152 -128
  101. package/dist/cmd/cloud/deploy.js.map +1 -1
  102. package/dist/cmd/cloud/deployment/list.d.ts.map +1 -1
  103. package/dist/cmd/cloud/deployment/list.js +4 -0
  104. package/dist/cmd/cloud/deployment/list.js.map +1 -1
  105. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  106. package/dist/cmd/cloud/env/list.js +1 -0
  107. package/dist/cmd/cloud/env/list.js.map +1 -1
  108. package/dist/cmd/cloud/keyvalue/get.d.ts.map +1 -1
  109. package/dist/cmd/cloud/keyvalue/get.js +1 -0
  110. package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
  111. package/dist/cmd/cloud/keyvalue/keys.d.ts.map +1 -1
  112. package/dist/cmd/cloud/keyvalue/keys.js +1 -0
  113. package/dist/cmd/cloud/keyvalue/keys.js.map +1 -1
  114. package/dist/cmd/cloud/keyvalue/list-namespaces.d.ts.map +1 -1
  115. package/dist/cmd/cloud/keyvalue/list-namespaces.js +1 -0
  116. package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
  117. package/dist/cmd/cloud/keyvalue/stats.d.ts.map +1 -1
  118. package/dist/cmd/cloud/keyvalue/stats.js +1 -0
  119. package/dist/cmd/cloud/keyvalue/stats.js.map +1 -1
  120. package/dist/cmd/cloud/secret/list.d.ts.map +1 -1
  121. package/dist/cmd/cloud/secret/list.js +1 -0
  122. package/dist/cmd/cloud/secret/list.js.map +1 -1
  123. package/dist/cmd/cloud/session/list.d.ts.map +1 -1
  124. package/dist/cmd/cloud/session/list.js +4 -0
  125. package/dist/cmd/cloud/session/list.js.map +1 -1
  126. package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
  127. package/dist/cmd/cloud/storage/get.js +1 -0
  128. package/dist/cmd/cloud/storage/get.js.map +1 -1
  129. package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
  130. package/dist/cmd/cloud/storage/list.js +3 -0
  131. package/dist/cmd/cloud/storage/list.js.map +1 -1
  132. package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
  133. package/dist/cmd/cloud/stream/get.js +1 -0
  134. package/dist/cmd/cloud/stream/get.js.map +1 -1
  135. package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
  136. package/dist/cmd/cloud/stream/list.js +1 -0
  137. package/dist/cmd/cloud/stream/list.js.map +1 -1
  138. package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
  139. package/dist/cmd/cloud/vector/get.js +1 -0
  140. package/dist/cmd/cloud/vector/get.js.map +1 -1
  141. package/dist/cmd/cloud/vector/search.d.ts.map +1 -1
  142. package/dist/cmd/cloud/vector/search.js +1 -0
  143. package/dist/cmd/cloud/vector/search.js.map +1 -1
  144. package/dist/cmd/dev/index.d.ts.map +1 -1
  145. package/dist/cmd/dev/index.js +291 -751
  146. package/dist/cmd/dev/index.js.map +1 -1
  147. package/dist/cmd/dev/sync.d.ts +1 -1
  148. package/dist/cmd/dev/sync.d.ts.map +1 -1
  149. package/dist/cmd/dev/sync.js +3 -0
  150. package/dist/cmd/dev/sync.js.map +1 -1
  151. package/dist/cmd/profile/show.d.ts.map +1 -1
  152. package/dist/cmd/profile/show.js +3 -4
  153. package/dist/cmd/profile/show.js.map +1 -1
  154. package/dist/cmd/project/create.d.ts.map +1 -1
  155. package/dist/cmd/project/create.js +3 -4
  156. package/dist/cmd/project/create.js.map +1 -1
  157. package/dist/cmd/project/list.d.ts.map +1 -1
  158. package/dist/cmd/project/list.js +1 -0
  159. package/dist/cmd/project/list.js.map +1 -1
  160. package/dist/cmd/project/show.d.ts.map +1 -1
  161. package/dist/cmd/project/show.js +1 -0
  162. package/dist/cmd/project/show.js.map +1 -1
  163. package/dist/cmd/upgrade/index.d.ts.map +1 -1
  164. package/dist/cmd/upgrade/index.js +5 -3
  165. package/dist/cmd/upgrade/index.js.map +1 -1
  166. package/dist/config.d.ts +1 -1
  167. package/dist/config.d.ts.map +1 -1
  168. package/dist/config.js +29 -11
  169. package/dist/config.js.map +1 -1
  170. package/dist/index.d.ts +1 -1
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js.map +1 -1
  173. package/dist/runtime-bootstrap.d.ts +3 -2
  174. package/dist/runtime-bootstrap.d.ts.map +1 -1
  175. package/dist/runtime-bootstrap.js +7 -2
  176. package/dist/runtime-bootstrap.js.map +1 -1
  177. package/dist/schemas/deploy.d.ts +1 -1
  178. package/dist/types.d.ts +40 -1
  179. package/dist/types.d.ts.map +1 -1
  180. package/dist/types.js.map +1 -1
  181. package/dist/utils/bun-version-checker.d.ts +11 -0
  182. package/dist/utils/bun-version-checker.d.ts.map +1 -0
  183. package/dist/utils/bun-version-checker.js +56 -0
  184. package/dist/utils/bun-version-checker.js.map +1 -0
  185. package/dist/version-check.d.ts.map +1 -1
  186. package/dist/version-check.js +5 -2
  187. package/dist/version-check.js.map +1 -1
  188. package/package.json +10 -3
  189. package/src/auth.ts +9 -5
  190. package/src/banner.ts +1 -1
  191. package/src/cli.ts +228 -29
  192. package/src/cmd/auth/signup.ts +1 -1
  193. package/src/cmd/build/ast.ts +7 -0
  194. package/src/cmd/build/entry-generator.ts +404 -0
  195. package/src/cmd/build/index.ts +7 -28
  196. package/src/cmd/build/vite/agent-discovery.ts +467 -0
  197. package/src/cmd/build/vite/browser-env-plugin.ts +34 -0
  198. package/src/cmd/build/vite/bun-dev-server.ts +78 -0
  199. package/src/cmd/build/vite/config-loader.ts +70 -0
  200. package/src/cmd/build/vite/index.ts +166 -0
  201. package/src/cmd/build/vite/lifecycle-generator.ts +43 -0
  202. package/src/cmd/build/vite/metadata-generator.ts +602 -0
  203. package/src/cmd/build/vite/patch-plugin.ts +88 -0
  204. package/src/cmd/build/vite/registry-generator.ts +288 -0
  205. package/src/cmd/build/vite/route-discovery.ts +186 -0
  206. package/src/cmd/build/vite/server-bundler.ts +258 -0
  207. package/src/cmd/build/vite/vite-asset-server-config.ts +134 -0
  208. package/src/cmd/build/vite/vite-asset-server.ts +63 -0
  209. package/src/cmd/build/vite/vite-builder.ts +284 -0
  210. package/src/cmd/build/vite/workbench-generator.ts +152 -0
  211. package/src/cmd/build/vite-bundler.ts +110 -0
  212. package/src/cmd/cloud/agent/get.ts +2 -0
  213. package/src/cmd/cloud/agent/list.ts +1 -0
  214. package/src/cmd/cloud/db/get.ts +1 -0
  215. package/src/cmd/cloud/db/list.ts +1 -0
  216. package/src/cmd/cloud/deploy.ts +175 -144
  217. package/src/cmd/cloud/deployment/list.ts +4 -0
  218. package/src/cmd/cloud/env/list.ts +1 -0
  219. package/src/cmd/cloud/keyvalue/get.ts +1 -0
  220. package/src/cmd/cloud/keyvalue/keys.ts +1 -0
  221. package/src/cmd/cloud/keyvalue/list-namespaces.ts +1 -0
  222. package/src/cmd/cloud/keyvalue/stats.ts +2 -0
  223. package/src/cmd/cloud/secret/list.ts +1 -0
  224. package/src/cmd/cloud/session/list.ts +4 -0
  225. package/src/cmd/cloud/storage/get.ts +1 -0
  226. package/src/cmd/cloud/storage/list.ts +4 -0
  227. package/src/cmd/cloud/stream/get.ts +1 -0
  228. package/src/cmd/cloud/stream/list.ts +1 -0
  229. package/src/cmd/cloud/vector/get.ts +1 -0
  230. package/src/cmd/cloud/vector/search.ts +1 -0
  231. package/src/cmd/dev/index.ts +323 -914
  232. package/src/cmd/dev/sync.ts +5 -1
  233. package/src/cmd/profile/show.ts +3 -4
  234. package/src/cmd/project/create.ts +3 -4
  235. package/src/cmd/project/list.ts +1 -0
  236. package/src/cmd/project/show.ts +1 -0
  237. package/src/cmd/upgrade/index.ts +6 -3
  238. package/src/config.ts +31 -11
  239. package/src/index.ts +2 -0
  240. package/src/runtime-bootstrap.ts +8 -2
  241. package/src/types.ts +48 -1
  242. package/src/utils/bun-version-checker.ts +70 -0
  243. package/src/version-check.ts +6 -2
  244. package/dist/cmd/build/bundler.d.ts +0 -22
  245. package/dist/cmd/build/bundler.d.ts.map +0 -1
  246. package/dist/cmd/build/bundler.js +0 -766
  247. package/dist/cmd/build/bundler.js.map +0 -1
  248. package/dist/cmd/build/config-loader.d.ts +0 -16
  249. package/dist/cmd/build/config-loader.d.ts.map +0 -1
  250. package/dist/cmd/build/config-loader.js +0 -227
  251. package/dist/cmd/build/config-loader.js.map +0 -1
  252. package/dist/cmd/build/file.d.ts +0 -2
  253. package/dist/cmd/build/file.d.ts.map +0 -1
  254. package/dist/cmd/build/file.js +0 -10
  255. package/dist/cmd/build/file.js.map +0 -1
  256. package/dist/cmd/build/fix-duplicate-exports.d.ts +0 -2
  257. package/dist/cmd/build/fix-duplicate-exports.d.ts.map +0 -1
  258. package/dist/cmd/build/fix-duplicate-exports.js +0 -170
  259. package/dist/cmd/build/fix-duplicate-exports.js.map +0 -1
  260. package/dist/cmd/build/plugin.d.ts +0 -6
  261. package/dist/cmd/build/plugin.d.ts.map +0 -1
  262. package/dist/cmd/build/plugin.js +0 -645
  263. package/dist/cmd/build/plugin.js.map +0 -1
  264. package/dist/cmd/build/route-discovery.d.ts +0 -54
  265. package/dist/cmd/build/route-discovery.d.ts.map +0 -1
  266. package/dist/cmd/build/route-discovery.js +0 -148
  267. package/dist/cmd/build/route-discovery.js.map +0 -1
  268. package/dist/cmd/build/route-registry.d.ts +0 -38
  269. package/dist/cmd/build/route-registry.d.ts.map +0 -1
  270. package/dist/cmd/build/route-registry.js.map +0 -1
  271. package/src/cmd/build/bundler.ts +0 -927
  272. package/src/cmd/build/config-loader.ts +0 -268
  273. package/src/cmd/build/file.ts +0 -10
  274. package/src/cmd/build/fix-duplicate-exports.ts +0 -207
  275. package/src/cmd/build/plugin.ts +0 -782
  276. package/src/cmd/build/route-discovery.ts +0 -202
  277. package/src/cmd/build/route-registry.ts +0 -222
@@ -365,12 +365,16 @@ export function createDevmodeSyncService({
365
365
  mock = false,
366
366
  }: {
367
367
  logger: Logger;
368
- apiClient: APIClient;
368
+ apiClient: APIClient | null;
369
369
  mock?: boolean;
370
370
  }): IDevmodeSyncService {
371
371
  if (mock) {
372
372
  return new MockDevmodeSyncService(logger);
373
373
  }
374
374
 
375
+ if (!apiClient) {
376
+ throw new Error('apiClient is required when not in mock mode');
377
+ }
378
+
375
379
  return new DevmodeSyncService(logger, apiClient);
376
380
  }
@@ -1,6 +1,6 @@
1
1
  import { createSubcommand, ConfigSchema } from '../../types';
2
2
  import { z } from 'zod';
3
- import { fetchProfiles, loadConfig } from '../../config';
3
+ import { fetchProfiles } from '../../config';
4
4
  import { readFile } from 'node:fs/promises';
5
5
  import * as tui from '../../tui';
6
6
  import { getCommand } from '../../command-prefix';
@@ -34,7 +34,6 @@ export const showCommand = createSubcommand({
34
34
  const { logger, args, options } = ctx;
35
35
 
36
36
  try {
37
- let current = false;
38
37
  let name = args.name;
39
38
 
40
39
  const profiles = await fetchProfiles();
@@ -53,9 +52,9 @@ export const showCommand = createSubcommand({
53
52
  }
54
53
 
55
54
  const profilePath = profile.filename;
56
- current = profile.selected;
57
55
 
58
- const content = await loadConfig(current ? undefined : profilePath);
56
+ // Use already-loaded config from context (respects --config flag)
57
+ const content = ctx.config;
59
58
  if (!content) {
60
59
  return logger.fatal(
61
60
  `Failed to load profile configuration`,
@@ -16,13 +16,12 @@ const ProjectCreateResponseSchema = z.object({
16
16
  export const createProjectSubcommand = createSubcommand({
17
17
  name: 'create',
18
18
  description: 'Create a new project',
19
- tags: ['mutating', 'creates-resource', 'slow', 'api-intensive', 'requires-auth'],
19
+ tags: ['mutating', 'creates-resource', 'slow'],
20
20
  aliases: ['new', 'init'],
21
21
  banner: true,
22
22
  toplevel: true,
23
23
  idempotent: false,
24
- optional: { auth: true, org: true, region: true },
25
- requires: { apiClient: true },
24
+ optional: { auth: true, org: true, region: true, apiClient: true },
26
25
  examples: [
27
26
  { command: getCommand('project create'), description: 'Create new item' },
28
27
  { command: getCommand('project create --name my-ai-agent'), description: 'Create new item' },
@@ -85,7 +84,7 @@ export const createProjectSubcommand = createSubcommand({
85
84
  auth: opts.register === true ? auth : undefined,
86
85
  config: config!,
87
86
  apiClient,
88
- orgId,
87
+ orgId: opts.register === true ? orgId : undefined,
89
88
  region,
90
89
  });
91
90
 
@@ -31,6 +31,7 @@ export const listSubcommand = createSubcommand({
31
31
  description: 'Alias for "project list" — list projects (human-readable)',
32
32
  },
33
33
  ],
34
+ webUrl: '/projects',
34
35
 
35
36
  async handler(ctx) {
36
37
  const { apiClient, options } = ctx;
@@ -34,6 +34,7 @@ export const showSubcommand = createSubcommand({
34
34
  }),
35
35
  response: ProjectShowResponseSchema,
36
36
  },
37
+ webUrl: (ctx) => `/projects/${encodeURIComponent(ctx.args.id)}`,
37
38
  idempotent: true,
38
39
 
39
40
  async handler(ctx) {
@@ -298,8 +298,8 @@ export const command = createCommand({
298
298
 
299
299
  // Confirm upgrade
300
300
  if (!force) {
301
- tui.info(`Current version: ${tui.muted(currentVersion)}`);
302
- tui.info(`Latest version: ${tui.bold(latestVersion)}`);
301
+ tui.info(`Current version: ${tui.muted(normalizedCurrent)}`);
302
+ tui.info(`Latest version: ${tui.bold(normalizedLatest)}`);
303
303
  tui.newline();
304
304
  if (toTag(currentVersion) !== toTag(latestVersion)) {
305
305
  tui.warning(
@@ -350,7 +350,10 @@ export const command = createCommand({
350
350
  await $`rm ${tmpBinaryPath}`.quiet();
351
351
  }
352
352
 
353
- const message = `Successfully upgraded from ${currentVersion} to ${latestVersion}`;
353
+ const message =
354
+ normalizedCurrent === normalizedLatest
355
+ ? `Successfully upgraded to ${normalizedLatest}`
356
+ : `Successfully upgraded from ${normalizedCurrent} to ${normalizedLatest}`;
354
357
  tui.success(message);
355
358
 
356
359
  return {
package/src/config.ts CHANGED
@@ -126,8 +126,9 @@ function expandTilde(path: string): string {
126
126
 
127
127
  let cachedConfig: Config | null | undefined;
128
128
 
129
- export async function loadConfig(customPath?: string): Promise<Config | null> {
130
- if (cachedConfig !== undefined) {
129
+ export async function loadConfig(customPath?: string, skipCache = false): Promise<Config | null> {
130
+ // Use cache if available and not skipped
131
+ if (!skipCache && cachedConfig !== undefined) {
131
132
  return cachedConfig;
132
133
  }
133
134
  const configPath = customPath ? expandTilde(customPath) : await getProfile();
@@ -189,13 +190,21 @@ export async function loadConfig(customPath?: string): Promise<Config | null> {
189
190
  result.data.overrides = overrides;
190
191
  }
191
192
 
192
- cachedConfig = result.data;
193
+ // Cache the loaded config (whether default or custom path)
194
+ // This ensures --config flag is respected across all commands
195
+ if (!skipCache) {
196
+ cachedConfig = result.data;
197
+ }
193
198
  return result.data;
194
199
  } catch (error) {
195
- if (error instanceof Error) {
196
- console.error(`Error loading config from ${configPath}:`, error.message);
200
+ tui.error(`Error loading config from ${configPath}: ${error}`);
201
+
202
+ // Cache null on error to prevent retry attempts.
203
+ // This is acceptable for CLI context where process typically exits on config errors.
204
+ // Note: For long-running processes, consider time-based cache expiry for transient failures.
205
+ if (!skipCache) {
206
+ cachedConfig = null;
197
207
  }
198
- cachedConfig = null;
199
208
  return null;
200
209
  }
201
210
  }
@@ -250,7 +259,14 @@ export async function saveConfig(config: Config, customPath?: string): Promise<v
250
259
  await writeFile(configPath, content + '\n', { mode: 0o600 });
251
260
  // Ensure existing files get correct permissions on upgrade
252
261
  await chmod(configPath, 0o600);
253
- cachedConfig = config;
262
+
263
+ // Only cache the default profile, not custom path saves.
264
+ // Note: This creates potential cache staleness - if a custom path is saved then later
265
+ // loaded without skipCache, it will use the cached default profile instead.
266
+ // Consider clearing cache on custom path saves: if (customPath) { cachedConfig = undefined; }
267
+ if (!customPath) {
268
+ cachedConfig = config;
269
+ }
254
270
  }
255
271
 
256
272
  export async function getOrInitConfig(): Promise<Config> {
@@ -286,7 +302,7 @@ export async function saveAuth(auth: AuthData): Promise<void> {
286
302
  return;
287
303
  } catch (error) {
288
304
  // Keychain failed, fall back to config file
289
- console.warn('Failed to store auth in keychain, falling back to config file:', error);
305
+ tui.warning(`Failed to store auth in keychain, falling back to config file: ${error}`);
290
306
  }
291
307
  }
292
308
 
@@ -428,10 +444,14 @@ export function generateYAMLTemplate(name: string): string {
428
444
 
429
445
  const schema = value as z.ZodTypeAny;
430
446
 
431
- // Unwrap optional to get to the inner schema
447
+ // Unwrap optional and nullable to get to the inner schema
448
+ // Note: .optional().nullable() creates ZodNullable(ZodOptional(ZodObject))
432
449
  let innerSchema = schema;
433
- if (schema instanceof z.ZodOptional) {
434
- innerSchema = (schema._def as unknown as { innerType: z.ZodTypeAny }).innerType;
450
+ if (innerSchema instanceof z.ZodNullable) {
451
+ innerSchema = (innerSchema._def as unknown as { innerType: z.ZodTypeAny }).innerType;
452
+ }
453
+ if (innerSchema instanceof z.ZodOptional) {
454
+ innerSchema = (innerSchema._def as unknown as { innerType: z.ZodTypeAny }).innerType;
435
455
  }
436
456
 
437
457
  const description = getSchemaDescription(schema);
package/src/index.ts CHANGED
@@ -113,6 +113,8 @@ export type {
113
113
  BuildContext,
114
114
  BuildConfig,
115
115
  BuildConfigFunction,
116
+ AgentuityConfig,
117
+ WorkbenchConfig,
116
118
  } from './types';
117
119
  export { createSubcommand, createCommand } from './types';
118
120
  export type { ColorScheme } from './terminal';
@@ -41,9 +41,10 @@ export interface RuntimeBootstrapResult {
41
41
  * This function:
42
42
  * 1. Resolves the active profile (from AGENTUITY_PROFILE env or profile config)
43
43
  * 2. Loads .env.{profile}, .env.development, or .env based on profile
44
- * 3. Sets AGENTUITY_REGION=local for local profile
44
+ * 3. Sets AGENTUITY_REGION=local for local profile (overrides project config for infrastructure)
45
45
  * 4. Loads agentuity.{profile}.json if it exists
46
- * 5. Does NOT override environment variables already set
46
+ * 5. Sets AGENTUITY_REGION from project config if not already set (non-local profiles only)
47
+ * 6. Does NOT override environment variables already set
47
48
  *
48
49
  * Call this BEFORE createApp() in your app.ts:
49
50
  *
@@ -114,6 +115,11 @@ export async function bootstrapRuntimeEnv(
114
115
  let projectConfig: ProjectConfig | null = null;
115
116
  try {
116
117
  projectConfig = await loadProjectConfig(projectDir, cfg ?? undefined);
118
+
119
+ // Set AGENTUITY_REGION from project config if not already set
120
+ if (projectConfig?.region && !process.env.AGENTUITY_REGION) {
121
+ process.env.AGENTUITY_REGION = projectConfig.region;
122
+ }
117
123
  } catch {
118
124
  // OK for tests that don't need project config
119
125
  }
package/src/types.ts CHANGED
@@ -107,7 +107,41 @@ export interface BuildContext {
107
107
  }
108
108
 
109
109
  /**
110
- * User-provided build configuration for a specific phase
110
+ * Workbench configuration
111
+ *
112
+ * Presence of this config object implicitly enables workbench in dev mode.
113
+ * To disable workbench, omit this config entirely.
114
+ */
115
+ export interface WorkbenchConfig {
116
+ /**
117
+ * Route where the workbench UI will be served
118
+ * @default '/workbench'
119
+ */
120
+ route?: string;
121
+ /**
122
+ * Custom headers to send with workbench requests
123
+ */
124
+ headers?: Record<string, string>;
125
+ }
126
+
127
+ /**
128
+ * Agentuity project configuration (declarative)
129
+ */
130
+ export interface AgentuityConfig {
131
+ /**
132
+ * Workbench configuration
133
+ */
134
+ workbench?: WorkbenchConfig;
135
+ /**
136
+ * Vite plugins to add to the client build
137
+ * These are added AFTER Agentuity's built-in plugins
138
+ */
139
+ plugins?: Array<import('vite').Plugin>;
140
+ }
141
+
142
+ /**
143
+ * User-provided build configuration for a specific phase (legacy Bun bundler)
144
+ * @deprecated Use AgentuityConfig instead
111
145
  */
112
146
  export interface BuildConfig {
113
147
  /**
@@ -303,6 +337,13 @@ export type CommandContext<
303
337
  Op extends z.ZodType | undefined = undefined,
304
338
  > = CommandContextFromSpecs<R, O, A, Op>;
305
339
 
340
+ export type WebUrl<
341
+ R extends Requires | undefined = undefined,
342
+ O extends Optional | undefined = undefined,
343
+ A extends z.ZodType | undefined = undefined,
344
+ Op extends z.ZodType | undefined = undefined,
345
+ > = string | ((ctx: CommandContext<R, O, A, Op>) => string | undefined | null);
346
+
306
347
  export function createSubcommand<
307
348
  R extends Requires | undefined = undefined,
308
349
  O extends Optional | undefined = undefined,
@@ -322,6 +363,7 @@ export function createSubcommand<
322
363
  prerequisites?: string[];
323
364
  pagination?: PaginationInfo;
324
365
  tags?: string[];
366
+ webUrl?: WebUrl<R, O, A, Op>;
325
367
  schema?: A extends z.ZodType
326
368
  ? Op extends z.ZodType
327
369
  ? Res extends z.ZodType
@@ -365,6 +407,7 @@ export function createCommand<
365
407
  prerequisites?: string[];
366
408
  pagination?: PaginationInfo;
367
409
  tags?: string[];
410
+ webUrl?: WebUrl<R, O, A, Op>;
368
411
  schema?: A extends z.ZodType
369
412
  ? Op extends z.ZodType
370
413
  ? Res extends z.ZodType
@@ -402,6 +445,7 @@ type CommandDefBase =
402
445
  pagination?: PaginationInfo;
403
446
  tags?: string[];
404
447
  schema?: CommandSchemas;
448
+ webUrl?: string | ((ctx: CommandContext) => string | undefined | null);
405
449
  handler(ctx: CommandContext): unknown | Promise<unknown>;
406
450
  subcommands?: SubcommandDefinition[];
407
451
  }
@@ -418,6 +462,7 @@ type CommandDefBase =
418
462
  pagination?: PaginationInfo;
419
463
  tags?: string[];
420
464
  schema?: CommandSchemas;
465
+ webUrl?: string | ((ctx: CommandContext) => string | undefined | null);
421
466
  handler?: undefined;
422
467
  subcommands: SubcommandDefinition[];
423
468
  };
@@ -435,6 +480,7 @@ type SubcommandDefBase =
435
480
  pagination?: PaginationInfo;
436
481
  tags?: string[];
437
482
  schema?: CommandSchemas;
483
+ webUrl?: string | ((ctx: CommandContext) => string | undefined | null);
438
484
  handler(ctx: CommandContext): unknown | Promise<unknown>;
439
485
  subcommands?: SubcommandDefinition[];
440
486
  }
@@ -450,6 +496,7 @@ type SubcommandDefBase =
450
496
  pagination?: PaginationInfo;
451
497
  tags?: string[];
452
498
  schema?: CommandSchemas;
499
+ webUrl?: string | ((ctx: CommandContext) => string | undefined | null);
453
500
  handler?: undefined;
454
501
  subcommands: SubcommandDefinition[];
455
502
  };
@@ -0,0 +1,70 @@
1
+ import { $, semver } from 'bun';
2
+ import { StructuredError } from '@agentuity/core';
3
+ import * as tui from '../tui';
4
+ import { pauseStepUI } from '../steps';
5
+
6
+ const InvalidBunVersion = StructuredError('InvalidBunVersion')<{
7
+ current: string;
8
+ required: string;
9
+ message: string;
10
+ }>();
11
+
12
+ const MIN_BUN_VERSION = '>=1.3.3';
13
+
14
+ /**
15
+ * Check if Bun version meets minimum requirements and optionally upgrade
16
+ * @returns Array of output messages (empty if version OK, success message if upgraded)
17
+ * @throws InvalidBunVersion if version check fails
18
+ */
19
+ export async function checkBunVersion(): Promise<string[]> {
20
+ if (semver.satisfies(Bun.version, MIN_BUN_VERSION)) {
21
+ return []; // Version is OK, no output needed
22
+ }
23
+
24
+ const message = `Bun is using version ${Bun.version}. This project requires Bun version ${MIN_BUN_VERSION} to build.`;
25
+
26
+ if (process.stdin.isTTY && process.stdout.isTTY) {
27
+ // Pause the step UI for interactive prompt
28
+ const resume = pauseStepUI();
29
+
30
+ tui.warning(message);
31
+ const ok = await tui.confirm('Would you like to upgrade now?');
32
+
33
+ // Small delay to ensure console.log('') in confirm completes
34
+ await new Promise((resolve) => setTimeout(resolve, 10));
35
+
36
+ resume(); // Resume step UI
37
+
38
+ if (ok) {
39
+ await $`bun upgrade`.quiet();
40
+ const upgradedVersion = (await $`bun -v`.quiet().text()).trim();
41
+
42
+ // Verify the upgraded version meets minimum requirements
43
+ if (semver.satisfies(upgradedVersion, MIN_BUN_VERSION)) {
44
+ // Return success message to show in output box
45
+ return [tui.colorSuccess(`Upgraded Bun to ${upgradedVersion}`)];
46
+ } else {
47
+ // Upgrade completed but still doesn't meet minimum version
48
+ throw new InvalidBunVersion({
49
+ current: upgradedVersion,
50
+ required: MIN_BUN_VERSION,
51
+ message: `Bun upgraded to ${upgradedVersion}, but still does not meet minimum requirement ${MIN_BUN_VERSION}`,
52
+ });
53
+ }
54
+ }
55
+ }
56
+
57
+ // Failed to upgrade or user declined
58
+ throw new InvalidBunVersion({
59
+ current: Bun.version,
60
+ required: MIN_BUN_VERSION,
61
+ message,
62
+ });
63
+ }
64
+
65
+ /**
66
+ * Get minimum required Bun version
67
+ */
68
+ export function getMinBunVersion(): string {
69
+ return MIN_BUN_VERSION;
70
+ }
@@ -92,10 +92,14 @@ function shouldCheckNow(config: Config | null): boolean {
92
92
  * Returns true if user wants to upgrade, false otherwise
93
93
  */
94
94
  async function promptUpgrade(currentVersion: string, latestVersion: string): Promise<boolean> {
95
+ // Strip 'v' prefix for display
96
+ const displayCurrent = currentVersion.replace(/^v/, '');
97
+ const displayLatest = latestVersion.replace(/^v/, '');
98
+
95
99
  tui.newline();
96
100
  tui.info(`${tui.bold('A new version of the CLI is available!')}`);
97
- tui.info(`Current version: ${tui.muted(currentVersion)}`);
98
- tui.info(`Latest version: ${tui.bold(latestVersion)}`);
101
+ tui.info(`Current version: ${tui.muted(displayCurrent)}`);
102
+ tui.info(`Latest version: ${tui.bold(displayLatest)}`);
99
103
  tui.newline();
100
104
  if (toTag(currentVersion) !== toTag(latestVersion)) {
101
105
  tui.warning(`What's changed: ${tui.link(getCompareUrl(currentVersion, latestVersion))}`);
@@ -1,22 +0,0 @@
1
- import type { Project } from '../../types';
2
- import type { Logger } from '../../types';
3
- import { type WorkbenchAnalysis } from './ast';
4
- import { type DeployOptions } from '../../schemas/deploy';
5
- export interface BundleOptions extends DeployOptions {
6
- rootDir: string;
7
- dev?: boolean;
8
- env?: Map<string, string>;
9
- orgId?: string;
10
- projectId?: string;
11
- deploymentId?: string;
12
- project?: Project;
13
- port?: number;
14
- outDir?: string;
15
- region: string;
16
- logger: Logger;
17
- workbench?: WorkbenchAnalysis;
18
- }
19
- export declare function bundle({ orgId, projectId, deploymentId, dev, rootDir, project, outDir: customOutDir, tag, logsUrl, commitUrl, provider, trigger, event, pullRequestNumber, pullRequestCommentId, pullRequestURL, message, env, region, logger, workbench, }: BundleOptions): Promise<{
20
- output: string[];
21
- }>;
22
- //# sourceMappingURL=bundler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../src/cmd/build/bundler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AAExD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAyC1D,MAAM,WAAW,aAAc,SAAQ,aAAa;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAqGD,wBAAsB,MAAM,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,YAAY,EACZ,GAAW,EACX,OAAO,EACP,OAAO,EACP,MAAM,EAAE,YAAY,EACpB,GAAG,EACH,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,OAAO,EACP,GAAG,EACH,MAAM,EACN,MAAM,EACN,SAAS,GACT,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA8tB/C"}