@agentuity/cli 0.1.15 → 0.1.17

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 (255) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +18 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cmd/ai/opencode/install.js +1 -1
  5. package/dist/cmd/ai/opencode/install.js.map +1 -1
  6. package/dist/cmd/build/ast.d.ts.map +1 -1
  7. package/dist/cmd/build/ast.js +68 -2
  8. package/dist/cmd/build/ast.js.map +1 -1
  9. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  10. package/dist/cmd/build/vite/registry-generator.js +112 -23
  11. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  12. package/dist/cmd/build/vite/route-discovery.d.ts +4 -0
  13. package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -1
  14. package/dist/cmd/build/vite/route-discovery.js +4 -0
  15. package/dist/cmd/build/vite/route-discovery.js.map +1 -1
  16. package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
  17. package/dist/cmd/cloud/env/delete.js +93 -34
  18. package/dist/cmd/cloud/env/delete.js.map +1 -1
  19. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  20. package/dist/cmd/cloud/env/get.js +53 -16
  21. package/dist/cmd/cloud/env/get.js.map +1 -1
  22. package/dist/cmd/cloud/env/import.d.ts.map +1 -1
  23. package/dist/cmd/cloud/env/import.js +80 -39
  24. package/dist/cmd/cloud/env/import.js.map +1 -1
  25. package/dist/cmd/cloud/env/index.d.ts.map +1 -1
  26. package/dist/cmd/cloud/env/index.js +6 -2
  27. package/dist/cmd/cloud/env/index.js.map +1 -1
  28. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  29. package/dist/cmd/cloud/env/list.js +99 -23
  30. package/dist/cmd/cloud/env/list.js.map +1 -1
  31. package/dist/cmd/cloud/env/org-util.d.ts +16 -0
  32. package/dist/cmd/cloud/env/org-util.d.ts.map +1 -0
  33. package/dist/cmd/cloud/env/org-util.js +28 -0
  34. package/dist/cmd/cloud/env/org-util.js.map +1 -0
  35. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  36. package/dist/cmd/cloud/env/pull.js +61 -29
  37. package/dist/cmd/cloud/env/pull.js.map +1 -1
  38. package/dist/cmd/cloud/env/push.d.ts.map +1 -1
  39. package/dist/cmd/cloud/env/push.js +70 -30
  40. package/dist/cmd/cloud/env/push.js.map +1 -1
  41. package/dist/cmd/cloud/env/set.d.ts.map +1 -1
  42. package/dist/cmd/cloud/env/set.js +72 -26
  43. package/dist/cmd/cloud/env/set.js.map +1 -1
  44. package/dist/cmd/cloud/index.d.ts.map +1 -1
  45. package/dist/cmd/cloud/index.js +2 -0
  46. package/dist/cmd/cloud/index.js.map +1 -1
  47. package/dist/cmd/cloud/keyvalue/create-namespace.js +1 -1
  48. package/dist/cmd/cloud/keyvalue/create-namespace.js.map +1 -1
  49. package/dist/cmd/cloud/keyvalue/delete-namespace.js +2 -2
  50. package/dist/cmd/cloud/keyvalue/delete-namespace.js.map +1 -1
  51. package/dist/cmd/cloud/keyvalue/delete.js +1 -1
  52. package/dist/cmd/cloud/keyvalue/delete.js.map +1 -1
  53. package/dist/cmd/cloud/keyvalue/get.js +1 -1
  54. package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
  55. package/dist/cmd/cloud/keyvalue/index.js +1 -1
  56. package/dist/cmd/cloud/keyvalue/index.js.map +1 -1
  57. package/dist/cmd/cloud/keyvalue/keys.js +1 -1
  58. package/dist/cmd/cloud/keyvalue/keys.js.map +1 -1
  59. package/dist/cmd/cloud/keyvalue/list-namespaces.js +1 -1
  60. package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
  61. package/dist/cmd/cloud/keyvalue/repl.d.ts.map +1 -1
  62. package/dist/cmd/cloud/keyvalue/repl.js +8 -5
  63. package/dist/cmd/cloud/keyvalue/repl.js.map +1 -1
  64. package/dist/cmd/cloud/keyvalue/search.js +1 -1
  65. package/dist/cmd/cloud/keyvalue/search.js.map +1 -1
  66. package/dist/cmd/cloud/keyvalue/set.js +1 -1
  67. package/dist/cmd/cloud/keyvalue/set.js.map +1 -1
  68. package/dist/cmd/cloud/keyvalue/stats.js +1 -1
  69. package/dist/cmd/cloud/keyvalue/stats.js.map +1 -1
  70. package/dist/cmd/cloud/keyvalue/util.d.ts +4 -4
  71. package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
  72. package/dist/cmd/cloud/keyvalue/util.js +4 -9
  73. package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
  74. package/dist/cmd/cloud/queue/ack.d.ts +3 -0
  75. package/dist/cmd/cloud/queue/ack.d.ts.map +1 -0
  76. package/dist/cmd/cloud/queue/ack.js +45 -0
  77. package/dist/cmd/cloud/queue/ack.js.map +1 -0
  78. package/dist/cmd/cloud/queue/create.d.ts +3 -0
  79. package/dist/cmd/cloud/queue/create.d.ts.map +1 -0
  80. package/dist/cmd/cloud/queue/create.js +80 -0
  81. package/dist/cmd/cloud/queue/create.js.map +1 -0
  82. package/dist/cmd/cloud/queue/delete.d.ts +3 -0
  83. package/dist/cmd/cloud/queue/delete.d.ts.map +1 -0
  84. package/dist/cmd/cloud/queue/delete.js +50 -0
  85. package/dist/cmd/cloud/queue/delete.js.map +1 -0
  86. package/dist/cmd/cloud/queue/destinations.d.ts +3 -0
  87. package/dist/cmd/cloud/queue/destinations.d.ts.map +1 -0
  88. package/dist/cmd/cloud/queue/destinations.js +232 -0
  89. package/dist/cmd/cloud/queue/destinations.js.map +1 -0
  90. package/dist/cmd/cloud/queue/dlq.d.ts +3 -0
  91. package/dist/cmd/cloud/queue/dlq.d.ts.map +1 -0
  92. package/dist/cmd/cloud/queue/dlq.js +168 -0
  93. package/dist/cmd/cloud/queue/dlq.js.map +1 -0
  94. package/dist/cmd/cloud/queue/get.d.ts +3 -0
  95. package/dist/cmd/cloud/queue/get.d.ts.map +1 -0
  96. package/dist/cmd/cloud/queue/get.js +130 -0
  97. package/dist/cmd/cloud/queue/get.js.map +1 -0
  98. package/dist/cmd/cloud/queue/index.d.ts +3 -0
  99. package/dist/cmd/cloud/queue/index.d.ts.map +1 -0
  100. package/dist/cmd/cloud/queue/index.js +65 -0
  101. package/dist/cmd/cloud/queue/index.js.map +1 -0
  102. package/dist/cmd/cloud/queue/list.d.ts +3 -0
  103. package/dist/cmd/cloud/queue/list.d.ts.map +1 -0
  104. package/dist/cmd/cloud/queue/list.js +71 -0
  105. package/dist/cmd/cloud/queue/list.js.map +1 -0
  106. package/dist/cmd/cloud/queue/messages.d.ts +3 -0
  107. package/dist/cmd/cloud/queue/messages.d.ts.map +1 -0
  108. package/dist/cmd/cloud/queue/messages.js +137 -0
  109. package/dist/cmd/cloud/queue/messages.js.map +1 -0
  110. package/dist/cmd/cloud/queue/nack.d.ts +3 -0
  111. package/dist/cmd/cloud/queue/nack.d.ts.map +1 -0
  112. package/dist/cmd/cloud/queue/nack.js +45 -0
  113. package/dist/cmd/cloud/queue/nack.js.map +1 -0
  114. package/dist/cmd/cloud/queue/pause.d.ts +3 -0
  115. package/dist/cmd/cloud/queue/pause.d.ts.map +1 -0
  116. package/dist/cmd/cloud/queue/pause.js +36 -0
  117. package/dist/cmd/cloud/queue/pause.js.map +1 -0
  118. package/dist/cmd/cloud/queue/publish.d.ts +3 -0
  119. package/dist/cmd/cloud/queue/publish.d.ts.map +1 -0
  120. package/dist/cmd/cloud/queue/publish.js +76 -0
  121. package/dist/cmd/cloud/queue/publish.js.map +1 -0
  122. package/dist/cmd/cloud/queue/receive.d.ts +3 -0
  123. package/dist/cmd/cloud/queue/receive.d.ts.map +1 -0
  124. package/dist/cmd/cloud/queue/receive.js +67 -0
  125. package/dist/cmd/cloud/queue/receive.js.map +1 -0
  126. package/dist/cmd/cloud/queue/resume.d.ts +3 -0
  127. package/dist/cmd/cloud/queue/resume.d.ts.map +1 -0
  128. package/dist/cmd/cloud/queue/resume.js +35 -0
  129. package/dist/cmd/cloud/queue/resume.js.map +1 -0
  130. package/dist/cmd/cloud/queue/sources.d.ts +3 -0
  131. package/dist/cmd/cloud/queue/sources.d.ts.map +1 -0
  132. package/dist/cmd/cloud/queue/sources.js +290 -0
  133. package/dist/cmd/cloud/queue/sources.js.map +1 -0
  134. package/dist/cmd/cloud/queue/stats.d.ts +3 -0
  135. package/dist/cmd/cloud/queue/stats.d.ts.map +1 -0
  136. package/dist/cmd/cloud/queue/stats.js +239 -0
  137. package/dist/cmd/cloud/queue/stats.js.map +1 -0
  138. package/dist/cmd/cloud/queue/util.d.ts +26 -0
  139. package/dist/cmd/cloud/queue/util.d.ts.map +1 -0
  140. package/dist/cmd/cloud/queue/util.js +19 -0
  141. package/dist/cmd/cloud/queue/util.js.map +1 -0
  142. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
  143. package/dist/cmd/cloud/sandbox/snapshot/build.js +122 -28
  144. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  145. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  146. package/dist/cmd/cloud/sandbox/snapshot/create.js +19 -7
  147. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  148. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  149. package/dist/cmd/cloud/sandbox/snapshot/get.js +16 -0
  150. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  151. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
  152. package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -0
  153. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  154. package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
  155. package/dist/cmd/cloud/vector/stats.js +8 -0
  156. package/dist/cmd/cloud/vector/stats.js.map +1 -1
  157. package/dist/cmd/project/create.d.ts.map +1 -1
  158. package/dist/cmd/project/create.js +12 -0
  159. package/dist/cmd/project/create.js.map +1 -1
  160. package/dist/cmd/project/template-flow.d.ts +3 -0
  161. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  162. package/dist/cmd/project/template-flow.js +157 -68
  163. package/dist/cmd/project/template-flow.js.map +1 -1
  164. package/dist/cmd/setup/index.d.ts.map +1 -1
  165. package/dist/cmd/setup/index.js +2 -1
  166. package/dist/cmd/setup/index.js.map +1 -1
  167. package/dist/env-util.d.ts +6 -1
  168. package/dist/env-util.d.ts.map +1 -1
  169. package/dist/env-util.js +16 -2
  170. package/dist/env-util.js.map +1 -1
  171. package/dist/errors.d.ts +4 -2
  172. package/dist/errors.d.ts.map +1 -1
  173. package/dist/errors.js +6 -0
  174. package/dist/errors.js.map +1 -1
  175. package/dist/onboarding/agentPrompt.d.ts +8 -0
  176. package/dist/onboarding/agentPrompt.d.ts.map +1 -0
  177. package/dist/onboarding/agentPrompt.js +263 -0
  178. package/dist/onboarding/agentPrompt.js.map +1 -0
  179. package/dist/schema-generator.d.ts +1 -1
  180. package/dist/schema-generator.d.ts.map +1 -1
  181. package/dist/schema-parser.d.ts +1 -1
  182. package/dist/schema-parser.d.ts.map +1 -1
  183. package/dist/schema-parser.js +36 -1
  184. package/dist/schema-parser.js.map +1 -1
  185. package/dist/tui/box.d.ts +4 -0
  186. package/dist/tui/box.d.ts.map +1 -1
  187. package/dist/tui/box.js +39 -0
  188. package/dist/tui/box.js.map +1 -1
  189. package/dist/tui.d.ts +11 -1
  190. package/dist/tui.d.ts.map +1 -1
  191. package/dist/tui.js +33 -15
  192. package/dist/tui.js.map +1 -1
  193. package/dist/types.d.ts.map +1 -1
  194. package/dist/types.js.map +1 -1
  195. package/package.json +6 -6
  196. package/src/cli.ts +19 -2
  197. package/src/cmd/ai/opencode/install.ts +1 -1
  198. package/src/cmd/build/ast.ts +88 -2
  199. package/src/cmd/build/vite/registry-generator.ts +120 -24
  200. package/src/cmd/build/vite/route-discovery.ts +16 -0
  201. package/src/cmd/cloud/env/delete.ts +113 -41
  202. package/src/cmd/cloud/env/get.ts +60 -16
  203. package/src/cmd/cloud/env/import.ts +92 -44
  204. package/src/cmd/cloud/env/index.ts +6 -2
  205. package/src/cmd/cloud/env/list.ts +112 -27
  206. package/src/cmd/cloud/env/org-util.ts +37 -0
  207. package/src/cmd/cloud/env/pull.ts +72 -31
  208. package/src/cmd/cloud/env/push.ts +84 -35
  209. package/src/cmd/cloud/env/set.ts +89 -33
  210. package/src/cmd/cloud/index.ts +2 -0
  211. package/src/cmd/cloud/keyvalue/create-namespace.ts +1 -1
  212. package/src/cmd/cloud/keyvalue/delete-namespace.ts +2 -2
  213. package/src/cmd/cloud/keyvalue/delete.ts +1 -1
  214. package/src/cmd/cloud/keyvalue/get.ts +1 -1
  215. package/src/cmd/cloud/keyvalue/index.ts +1 -1
  216. package/src/cmd/cloud/keyvalue/keys.ts +1 -1
  217. package/src/cmd/cloud/keyvalue/list-namespaces.ts +1 -1
  218. package/src/cmd/cloud/keyvalue/repl.ts +8 -5
  219. package/src/cmd/cloud/keyvalue/search.ts +1 -1
  220. package/src/cmd/cloud/keyvalue/set.ts +1 -1
  221. package/src/cmd/cloud/keyvalue/stats.ts +1 -1
  222. package/src/cmd/cloud/keyvalue/util.ts +8 -17
  223. package/src/cmd/cloud/queue/ack.ts +50 -0
  224. package/src/cmd/cloud/queue/create.ts +91 -0
  225. package/src/cmd/cloud/queue/delete.ts +57 -0
  226. package/src/cmd/cloud/queue/destinations.ts +287 -0
  227. package/src/cmd/cloud/queue/dlq.ts +203 -0
  228. package/src/cmd/cloud/queue/get.ts +158 -0
  229. package/src/cmd/cloud/queue/index.ts +66 -0
  230. package/src/cmd/cloud/queue/list.ts +81 -0
  231. package/src/cmd/cloud/queue/messages.ts +160 -0
  232. package/src/cmd/cloud/queue/nack.ts +50 -0
  233. package/src/cmd/cloud/queue/pause.ts +41 -0
  234. package/src/cmd/cloud/queue/publish.ts +88 -0
  235. package/src/cmd/cloud/queue/receive.ts +76 -0
  236. package/src/cmd/cloud/queue/resume.ts +40 -0
  237. package/src/cmd/cloud/queue/sources.ts +352 -0
  238. package/src/cmd/cloud/queue/stats.ts +297 -0
  239. package/src/cmd/cloud/queue/util.ts +34 -0
  240. package/src/cmd/cloud/sandbox/snapshot/build.ts +146 -29
  241. package/src/cmd/cloud/sandbox/snapshot/create.ts +24 -7
  242. package/src/cmd/cloud/sandbox/snapshot/get.ts +16 -0
  243. package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -0
  244. package/src/cmd/cloud/vector/stats.ts +9 -0
  245. package/src/cmd/project/create.ts +12 -0
  246. package/src/cmd/project/template-flow.ts +181 -69
  247. package/src/cmd/setup/index.ts +2 -1
  248. package/src/env-util.ts +17 -2
  249. package/src/errors.ts +8 -0
  250. package/src/onboarding/agentPrompt.ts +263 -0
  251. package/src/schema-generator.ts +1 -1
  252. package/src/schema-parser.ts +45 -3
  253. package/src/tui/box.ts +52 -0
  254. package/src/tui.ts +47 -17
  255. package/src/types.ts +0 -1
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Agent Onboarding Prompt
3
+ *
4
+ * This generates the markdown prompt that coding agents use to guide developers
5
+ * through Agentuity setup after the CLI has been installed.
6
+ */
7
+
8
+ export function getAgentPromptMarkdown(): string {
9
+ return `
10
+ **Your goal:** Guide the user from zero to a deployed Agentuity project, then help them understand what they have and what to do next.
11
+
12
+ ---
13
+
14
+ ## What is Agentuity?
15
+
16
+ Agentuity is the full-stack platform for AI agents. Briefly explain to the user:
17
+
18
+ - **Full-stack agents**: Build agents, APIs, and front-end integrations with end-to-end type safety
19
+ - **Bun/TypeScript SDKs**: First-class developer experience with the fastest JavaScript runtime
20
+ - **AI Gateway**: Unified access to LLMs (OpenAI-compatible SDK) with single billing—no separate API keys needed
21
+ - **Observability**: Logs, tracing, and evals built-in so you can debug and improve agents
22
+ - **Production services**: Sandboxes, storage (S3-compatible), Postgres, KV, and enterprise features available as you grow
23
+
24
+ We're going to be setting up the default template quickly.
25
+
26
+ The default template includes AI Gateway integration, thread state persistence, structured logging, Tailwind CSS, and a local Workbench at \`/workbench\` for testing agents.
27
+
28
+ ---
29
+
30
+ ## How to Guide the User
31
+
32
+ **Your job is to make onboarding as smooth as possible with minimal user interaction.**
33
+
34
+ 1. **Start by briefly explaining** what Agentuity is and what you'll help them accomplish
35
+ 2. **Run commands automatically** when you have terminal access—don't ask permission for each step
36
+ 3. **Only pause for human action** when absolutely required
37
+ 4. **At each step**: Briefly explain what it does and why, then execute
38
+ 5. **Celebrate success**: When deployment completes, make sure the user knows they earned free credits and show them what to explore next
39
+
40
+ Assume the user is technical but new to Agentuity. Be warm, efficient, and action-oriented. The goal is a successful deployment with as few interruptions as possible.
41
+
42
+ ---
43
+
44
+ ## Onboarding Steps
45
+
46
+ ### Step 1: You're Already Logged In!
47
+
48
+ **The install command automatically authenticated you.** No manual login needed.
49
+
50
+ Verify with:
51
+ \`\`\`bash
52
+ agentuity auth whoami
53
+ \`\`\`
54
+
55
+ This outputs your user info including your \`org_id\`. You'll need this for the create command.
56
+
57
+ ---
58
+
59
+ ### Step 2: Create a New Project
60
+
61
+ **Why:** This scaffolds a full-stack agent app with AI Gateway, persistence, logging, and a testing UI.
62
+
63
+ **First, get the user's organization ID:**
64
+ \`\`\`bash
65
+ agentuity auth whoami
66
+ \`\`\`
67
+
68
+ This outputs the user's info including their \`org_id\`. You'll need this for the create command.
69
+
70
+ **Then create the project (non-interactive):**
71
+ \`\`\`bash
72
+ agentuity create --name "my-first-agent" --org-id <ORG_ID> --region usc --confirm
73
+ \`\`\`
74
+
75
+ **Required flags for non-interactive mode:**
76
+ - \`--name\`: Project name (use \`my-first-agent\` as default)
77
+ - \`--org-id\`: The organization ID from \`agentuity auth whoami\` (required in non-interactive mode)
78
+ - \`--region\`: Cloud region (use \`usc\` for US Central, or \`use\` for US East)
79
+ - \`--confirm\`: Skips interactive prompts
80
+
81
+ **Example with real org ID:**
82
+ \`\`\`bash
83
+ agentuity create --name "my-first-agent" --org-id ..... --region usc --confirm
84
+ \`\`\`
85
+
86
+ If the user wants a different location, add \`--dir\`:
87
+ \`\`\`bash
88
+ agentuity create --name "my-first-agent" --org-id <ORG_ID> --region usc --dir ~/projects/my-first-agent --confirm
89
+ \`\`\`
90
+
91
+ After creation, \`cd\` into the project directory.
92
+
93
+ **Docs:** https://agentuity.dev/Get-Started/quickstart
94
+
95
+ ---
96
+
97
+ ### Step 3: Run Locally
98
+
99
+ **Why:** Start the development server to test the project locally before deploying.
100
+
101
+ **Command:**
102
+ \`\`\`bash
103
+ agentuity dev
104
+ \`\`\`
105
+
106
+ **⚠️ This is a long-running process!** The dev server runs continuously until killed. Before or after starting it, **immediately tell the user what to do** — don't just wait silently.
107
+
108
+ **What happens:**
109
+ - **Local server** starts at \`http://localhost:3500\` — this is where your APIs and agents are served
110
+ - **Workbench** available at \`http://localhost:3500/workbench\` — a built-in UI for testing and interacting with your agents directly, without needing a frontend
111
+ - **Public tunnel URL** is automatically created — the CLI will display a public URL that tunnels to your local server, useful for testing webhooks or sharing with others
112
+ - **Hot reload** enabled — code changes reflect immediately
113
+
114
+ **Immediately after starting the dev server, tell the user:**
115
+
116
+ > "The dev server is now running! Here's what to try:
117
+ >
118
+ > 1. Open **http://localhost:3500** to see the app
119
+ > 2. Open **http://localhost:3500/workbench** to interact with your agents (this is a key feature!)
120
+ > 3. The public tunnel URL shown in the terminal can be shared with others
121
+ >
122
+ > Take a few minutes to explore. When you're ready to deploy to production, let me know!"
123
+
124
+ **Wait for the user to confirm** they're ready to deploy before proceeding to Step 4.
125
+
126
+ **Keyboard shortcuts** while dev server runs: \`h\` for help, \`r\` to restart, \`q\` to quit.
127
+
128
+ **Docs:** https://agentuity.dev/Reference/CLI/development
129
+
130
+ ---
131
+
132
+ ### Step 4: Deploy to Production
133
+
134
+ **Why:** Make the project live with observability, logs, and analytics.
135
+
136
+ **Important:** Deploying their first project earns the user **free credits** to continue experimenting with the platform. Make sure they know this is a reward for completing onboarding!
137
+
138
+ **First, stop the dev server:**
139
+ Before deploying, you must stop the dev server that's still running from Step 3. Send \`Ctrl+C\` or \`q\` to the terminal running \`agentuity dev\` to gracefully shut it down. Don't leave it running or you'll have an orphaned process on port 3500.
140
+
141
+ **Then deploy:**
142
+ \`\`\`bash
143
+ agentuity deploy
144
+ \`\`\`
145
+
146
+ **What happens:**
147
+ - Project builds and deploys to Agentuity's global edge network
148
+ - The CLI will output the production URL when deployment succeeds
149
+ - Observability (logs, tracing, analytics) is now live
150
+ - **Free credits are awarded** for their first deployment
151
+
152
+ **⚠️ CRITICAL: Do not hallucinate URLs!**
153
+ - **Only show the user URLs that the CLI actually outputs**
154
+ - Do not make up or guess production URLs (e.g., don't invent \`https://project-name.agentuity.app\`)
155
+ - If the deploy command fails or doesn't show a URL, tell the user to check the dashboard instead
156
+ - If there's an error, report the actual error message from the CLI
157
+
158
+ **After successful deployment:**
159
+ 1. Show the user the **exact production URL from the CLI output**
160
+ 2. Direct them to the Agentuity dashboard at https://app.agentuity.com to:
161
+ - View their deployed project
162
+ - Explore logs and traces
163
+ - See their credit balance
164
+ - Monitor analytics
165
+
166
+ **If deployment fails or shows errors:**
167
+ - Report the actual error message
168
+ - Don't claim success if the CLI didn't confirm it
169
+ - Suggest checking the dashboard for deployment status
170
+
171
+ ---
172
+
173
+ ## What the Template Provides
174
+
175
+ After deployment, explain what they now have:
176
+
177
+ | Feature | What It Does |
178
+ |---------|--------------|
179
+ | **AI Gateway** | OpenAI-compatible SDK routed through Agentuity—unified billing, no separate API keys |
180
+ | **Thread State** | Conversations and agent state persist automatically for multi-turn flows |
181
+ | **Structured Logging** | Logs and traces captured for debugging and analytics |
182
+ | **Workbench** | Local UI at \`/workbench\` for testing agents without a frontend |
183
+ | **Tailwind CSS** | Pre-configured styling for the frontend |
184
+ | **Type Safety** | End-to-end types from agent schemas to API routes to frontend |
185
+
186
+ ---
187
+
188
+ ## Next Steps
189
+
190
+ After successful deployment, guide the user through these recommendations:
191
+
192
+ ### 1. Celebrate the Free Credits!
193
+ - Remind the user: their first deployment earned them **free credits** to keep experimenting
194
+ - They can view their credit balance in the Agentuity dashboard
195
+ - These credits let them continue building and testing without upfront cost
196
+
197
+ ### 2. Join the Community
198
+ - **Discord**: https://discord.gg/agentuity
199
+ - Get help, see examples, share what you're building
200
+
201
+ ### 3. Explore the Dashboard
202
+ - **Observability**: View logs, traces, and evals for your deployment
203
+ - **Deployments**: See version history with rollback options
204
+ - **Analytics**: Monitor usage and performance
205
+
206
+ ### 4. Connect GitHub
207
+ - Enable GitHub integration in project settings for:
208
+ - Automatic deployments from branches
209
+ - CI/CD workflows
210
+ - Team collaboration
211
+
212
+ ### 5. Explore Additional Services
213
+ As your project grows, Agentuity provides:
214
+ - **Postgres**: Relational database
215
+ - **KV**: Fast key-value storage
216
+ - **Storage**: S3-compatible file storage
217
+ - **Sandboxes**: Isolated execution environments
218
+
219
+ ### 6. Customize Your Agents
220
+ The SDK makes it easy to:
221
+ - Add new agents in \`src/agent/\` (just add a folder with \`agent.ts\`)
222
+ - Create API routes in \`src/api/\`
223
+ - Build type-safe frontend integrations
224
+
225
+ **Docs:** https://agentuity.dev/Get-Started/project-structure
226
+
227
+ ---
228
+
229
+ ## Handling Common Issues
230
+
231
+ - **Bun not installed**: The CLI will prompt to install it, or run: \`curl -fsSL https://bun.sh/install | bash\`
232
+ - **Login fails/times out**: Rerun \`agentuity login\` and check browser
233
+ - **Port 3500 in use**: Kill the existing process or use \`agentuity dev --port 8080\`
234
+ - **Deploy fails**: Check build errors in CLI output, ensure you're in the project directory
235
+
236
+ ---
237
+
238
+ ## Success Criteria
239
+
240
+ **Onboarding is successful when the user has:**
241
+
242
+ 1. ✅ **CLI installed** and authenticated
243
+ 2. ✅ **Local dev environment running** — they've seen \`localhost:3500\` and tried the Workbench
244
+ 3. ✅ **First deployment complete** — they have a live production URL
245
+ 4. ✅ **Free credits earned** — they know they've been rewarded and can keep building
246
+ 5. ✅ **Clear next steps** — they know about Discord, the dashboard, and how to extend their project
247
+
248
+ **Make them feel accomplished!** They just went from zero to a deployed AI agent platform in minutes.
249
+
250
+ ---
251
+
252
+ ## Style Guidelines
253
+
254
+ - Keep explanations short and practical
255
+ - Explain what & why at each step
256
+ - Give exact commands
257
+ - Handle errors calmly with concrete suggestions
258
+ - Be explicit when human action is required
259
+ - Use non-interactive CLI flags (\`--confirm\`, \`--name\`, \`--org-id\`, \`--region usc\`, \`--dir\`) for smooth automation
260
+ - **Never hallucinate or make up information** — only report URLs, IDs, and status from actual CLI output
261
+ - If something fails or you're unsure, say so honestly and direct the user to the dashboard
262
+ `;
263
+ }
@@ -13,7 +13,7 @@ export interface SchemaArgument {
13
13
 
14
14
  export interface SchemaOption {
15
15
  name: string;
16
- type: 'string' | 'number' | 'boolean' | 'array';
16
+ type: 'string' | 'number' | 'boolean' | 'array' | 'optionalString';
17
17
  required: boolean;
18
18
  default?: unknown;
19
19
  description?: string;
@@ -13,7 +13,7 @@ export interface ParsedArgs {
13
13
  export interface ParsedOption {
14
14
  name: string;
15
15
  description?: string;
16
- type: 'string' | 'number' | 'boolean' | 'array';
16
+ type: 'string' | 'number' | 'boolean' | 'array' | 'optionalString';
17
17
  hasDefault?: boolean;
18
18
  defaultValue?: unknown;
19
19
  enumValues?: string[];
@@ -57,6 +57,45 @@ function unwrapSchema(schema: unknown): unknown {
57
57
  return current;
58
58
  }
59
59
 
60
+ /**
61
+ * Check if a schema is a union of boolean and string (for optional string flags like --org [value])
62
+ * This pattern is used when a flag can be used as a boolean (--org) or with a value (--org=myOrgId)
63
+ */
64
+ function isBooleanStringUnion(schema: unknown): boolean {
65
+ const unwrapped = unwrapSchema(schema) as ZodTypeInternal;
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ const def = unwrapped?._def as any;
68
+ // Zod 3 uses typeName, Zod 4 uses type
69
+ const typeId = def?.typeName || def?.type;
70
+
71
+ if (typeId !== 'ZodUnion' && typeId !== 'union') {
72
+ return false;
73
+ }
74
+
75
+ // Zod 3 uses _def.options, Zod 4 uses .options directly on the schema or _def.options
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ const options = def?.options || (unwrapped as any)?.options;
78
+ if (!Array.isArray(options) || options.length !== 2) {
79
+ return false;
80
+ }
81
+
82
+ const types = new Set<string>();
83
+ for (const opt of options) {
84
+ // Zod 4: type is directly on the object as .type
85
+ // Zod 3: type is _def.typeName
86
+ const optUnknown = opt as unknown as Record<string, unknown>;
87
+ const optDef = optUnknown?._def as Record<string, unknown> | undefined;
88
+ const optType =
89
+ (optUnknown?.type as string) || (optDef?.typeName as string) || (optDef?.type as string);
90
+ types.add(optType);
91
+ }
92
+
93
+ return (
94
+ (types.has('boolean') || types.has('ZodBoolean')) &&
95
+ (types.has('string') || types.has('ZodString'))
96
+ );
97
+ }
98
+
60
99
  function getShape(schema: ZodType): Record<string, unknown> {
61
100
  const unwrapped = unwrapSchema(schema) as ZodTypeInternal;
62
101
  const typeId = unwrapped?._def?.typeName || unwrapped?._def?.type;
@@ -182,9 +221,12 @@ export function parseOptionsSchema(schema: ZodType): ParsedOption[] {
182
221
  }
183
222
  }
184
223
 
185
- let type: 'string' | 'number' | 'boolean' | 'array' = 'string';
224
+ let type: 'string' | 'number' | 'boolean' | 'array' | 'optionalString' = 'string';
186
225
  let enumValues: string[] | undefined;
187
- if (typeId === 'ZodNumber' || typeId === 'number') {
226
+ if (isBooleanStringUnion(value)) {
227
+ // z.union([z.boolean(), z.string()]) - flag can be used as --flag or --flag=value
228
+ type = 'optionalString';
229
+ } else if (typeId === 'ZodNumber' || typeId === 'number') {
188
230
  type = 'number';
189
231
  } else if (typeId === 'ZodBoolean' || typeId === 'boolean') {
190
232
  type = 'boolean';
package/src/tui/box.ts CHANGED
@@ -198,3 +198,55 @@ export function note(message: string, title = ''): void {
198
198
  });
199
199
  console.log(output);
200
200
  }
201
+
202
+ /**
203
+ * Draw an error box with red border
204
+ */
205
+ export function errorBox(title: string, message: string): void {
206
+ const termWidth = getTerminalWidth();
207
+ const maxWidth = termWidth - 3;
208
+ const boxWidth = Math.min(60, maxWidth);
209
+ const innerWidth = Math.max(boxWidth - 2, 1);
210
+ const contentWidth = Math.max(innerWidth - 1, 0);
211
+ const padding = 2;
212
+
213
+ const lines: string[] = [];
214
+
215
+ // Title line with error symbol
216
+ const errorSymbol = colors.error('✗');
217
+ const titleText = colors.error(title);
218
+ const titleTextWidth = 1 + stringWidth(title); // symbol + title
219
+ const barsNeeded = Math.max(innerWidth - titleTextWidth - 3, 1);
220
+ const titleLine = `${errorSymbol} ${titleText} ${colors.error(symbols.barH.repeat(barsNeeded) + symbols.cornerTR)}`;
221
+
222
+ lines.push(colors.error(symbols.bar));
223
+ lines.push(titleLine);
224
+
225
+ // Empty line
226
+ const emptyLine = `${colors.error(symbols.bar)}${' '.repeat(contentWidth)}${colors.error(symbols.bar)}`;
227
+ lines.push(emptyLine);
228
+
229
+ // Wrap and render content lines
230
+ const wrapWidth = Math.max(contentWidth - padding * 2, 0);
231
+ const contentLines = message.split('\n');
232
+ for (const line of contentLines) {
233
+ const wrapped = stringWidth(line) > wrapWidth ? wrapText(line, wrapWidth) : [line];
234
+ for (const wl of wrapped) {
235
+ const lineLen = stringWidth(wl);
236
+ const leftPad = padding;
237
+ const rightPad = Math.max(contentWidth - lineLen - leftPad, 0);
238
+ lines.push(
239
+ `${colors.error(symbols.bar)}${' '.repeat(leftPad)}${wl}${' '.repeat(rightPad)}${colors.error(symbols.bar)}`
240
+ );
241
+ }
242
+ }
243
+
244
+ lines.push(emptyLine);
245
+
246
+ // Bottom border
247
+ lines.push(
248
+ colors.error(symbols.connect + symbols.barH.repeat(innerWidth - 1) + symbols.cornerBR)
249
+ );
250
+
251
+ console.log(lines.join('\n'));
252
+ }
package/src/tui.ts CHANGED
@@ -45,7 +45,7 @@ export { maskSecret };
45
45
  // Export new TUI components
46
46
  export { createPrompt, PromptFlow } from './tui/prompt';
47
47
  export { group } from './tui/group';
48
- export { note, drawBox } from './tui/box';
48
+ export { note, drawBox, errorBox } from './tui/box';
49
49
  export { symbols } from './tui/symbols';
50
50
  export { colors as tuiColors } from './tui/colors';
51
51
  export type {
@@ -834,7 +834,9 @@ export function showLoggedOutMessage(appBaseUrl: string, hasProfile = false): vo
834
834
  // Box format: "║ " + content + "║" = 48 chars total
835
835
  // Content area = 46 chars, with leading space = 45 chars for URL + padding
836
836
  const urlPadding = Math.max(0, 45 - signupURL.length);
837
- const showNewLine = showInline ? '' : `║ ${RESET}${link(signupURL)}${YELLOW}${' '.repeat(urlPadding)}║`;
837
+ const showNewLine = showInline
838
+ ? ''
839
+ : `║ ${RESET}${link(signupURL)}${YELLOW}${' '.repeat(urlPadding)}║`;
838
840
 
839
841
  const lines = [
840
842
  '╔══════════════════════════════════════════════╗',
@@ -1057,6 +1059,11 @@ export interface SimpleSpinnerOptions<T> {
1057
1059
  * Defaults to false
1058
1060
  */
1059
1061
  clearOnSuccess?: boolean;
1062
+ /**
1063
+ * If true, suppress the error message display on failure (for custom error handling)
1064
+ * Defaults to false
1065
+ */
1066
+ clearOnError?: boolean;
1060
1067
  }
1061
1068
 
1062
1069
  /**
@@ -1071,6 +1078,11 @@ export interface ProgressSpinnerOptions<T> {
1071
1078
  * Defaults to false
1072
1079
  */
1073
1080
  clearOnSuccess?: boolean;
1081
+ /**
1082
+ * If true, suppress the error message display on failure (for custom error handling)
1083
+ * Defaults to false
1084
+ */
1085
+ clearOnError?: boolean;
1074
1086
  }
1075
1087
 
1076
1088
  /**
@@ -1196,8 +1208,12 @@ export async function spinner<T>(
1196
1208
 
1197
1209
  return result;
1198
1210
  } catch (err) {
1199
- const errorColor = getColor('error');
1200
- console.error(`${errorColor}${ICONS.error} ${message}${reset}`);
1211
+ const clearOnError =
1212
+ (options.type === 'progress' || options.type === 'simple') && options.clearOnError;
1213
+ if (!clearOnError) {
1214
+ const errorColor = getColor('error');
1215
+ console.error(`${errorColor}${ICONS.error} ${message}${reset}`);
1216
+ }
1201
1217
  throw err;
1202
1218
  }
1203
1219
  }
@@ -1426,10 +1442,14 @@ export async function spinner<T>(
1426
1442
  }
1427
1443
  process.stderr.write('\x1B[?25h'); // Show cursor
1428
1444
 
1429
- // Show error
1430
- const errorColor = getColor('error');
1431
- const errorMessage = err instanceof Error ? err.message : String(err);
1432
- console.error(`${errorColor}${ICONS.error} ${message}: ${errorMessage}${reset}`);
1445
+ // Show error (unless clearOnError is set for custom error handling)
1446
+ const clearOnError =
1447
+ (options.type === 'progress' || options.type === 'simple') && options.clearOnError;
1448
+ if (!clearOnError) {
1449
+ const errorColor = getColor('error');
1450
+ const errorMessage = err instanceof Error ? err.message : String(err);
1451
+ console.error(`${errorColor}${ICONS.error} ${message}: ${errorMessage}${reset}`);
1452
+ }
1433
1453
 
1434
1454
  throw err;
1435
1455
  }
@@ -1759,23 +1779,33 @@ export async function selectOrganization(
1759
1779
  return orgs[0].id;
1760
1780
  }
1761
1781
 
1762
- if (!process.stdin.isTTY) {
1763
- if (initial) {
1764
- return initial;
1782
+ // Use saved preference if available (regardless of TTY mode)
1783
+ // This allows consistent behavior without prompting on every command
1784
+ if (initial) {
1785
+ const initialOrg = orgs.find((o) => o.id === initial);
1786
+ if (initialOrg) {
1787
+ return initialOrg.id;
1765
1788
  }
1766
- fatal(
1767
- 'Organization selection required but cannot prompt in non-interactive environment. Set AGENTUITY_CLOUD_ORG_ID or provide a default organization using --org-id'
1768
- );
1769
1789
  }
1770
1790
 
1771
- // Find the index of the initial org to pre-select it in the list
1772
- const initialIndex = initial ? orgs.findIndex((o) => o.id === initial) : -1;
1791
+ // Check for non-interactive environment (check both stdin and stdout)
1792
+ const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
1793
+ if (isNonInteractive) {
1794
+ // In non-interactive mode with multiple orgs, auto-select first org
1795
+ // This allows scripts and CI/CD to work without explicit org selection
1796
+ warning(
1797
+ `Multiple organizations found. Auto-selecting first org: ${orgs[0].name}. ` +
1798
+ `Set AGENTUITY_CLOUD_ORG_ID or use --org-id to specify a different org.`
1799
+ );
1800
+ return orgs[0].id;
1801
+ }
1773
1802
 
1803
+ // Interactive mode with no saved preference - prompt user
1774
1804
  const response = await enquirer.prompt<{ action: string }>({
1775
1805
  type: 'select',
1776
1806
  name: 'action',
1777
1807
  message: 'Select an organization',
1778
- initial: initialIndex >= 0 ? initialIndex : 0,
1808
+ initial: 0,
1779
1809
  choices: orgs.map((o) => ({ message: o.name, name: o.id })),
1780
1810
  });
1781
1811
 
package/src/types.ts CHANGED
@@ -62,7 +62,6 @@ export const ConfigSchema = zod.object({
62
62
  })
63
63
  .optional()
64
64
  .describe('the gravity client information'),
65
-
66
65
  });
67
66
 
68
67
  export type Config = zod.infer<typeof ConfigSchema>;