@agentuity/cli 0.1.9 → 0.1.10

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 (311) hide show
  1. package/README.md +2 -2
  2. package/bin/cli.ts +8 -0
  3. package/dist/cache/index.d.ts +2 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +2 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/cache/resource-region.d.ts +46 -0
  8. package/dist/cache/resource-region.d.ts.map +1 -0
  9. package/dist/cache/resource-region.js +115 -0
  10. package/dist/cache/resource-region.js.map +1 -0
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +44 -32
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cmd/ai/capabilities/show.d.ts.map +1 -1
  15. package/dist/cmd/ai/capabilities/show.js +12 -15
  16. package/dist/cmd/ai/capabilities/show.js.map +1 -1
  17. package/dist/cmd/ai/prompt/llm.js +5 -5
  18. package/dist/cmd/ai/prompt/llm.js.map +1 -1
  19. package/dist/cmd/auth/logout.d.ts.map +1 -1
  20. package/dist/cmd/auth/logout.js +5 -2
  21. package/dist/cmd/auth/logout.js.map +1 -1
  22. package/dist/cmd/build/ast.d.ts.map +1 -1
  23. package/dist/cmd/build/ast.js +87 -1
  24. package/dist/cmd/build/ast.js.map +1 -1
  25. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
  26. package/dist/cmd/build/vite/vite-asset-server-config.js +8 -3
  27. package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
  28. package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
  29. package/dist/cmd/build/vite/vite-asset-server.js +5 -3
  30. package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
  31. package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
  32. package/dist/cmd/cloud/db/delete.js +69 -11
  33. package/dist/cmd/cloud/db/delete.js.map +1 -1
  34. package/dist/cmd/cloud/db/get.d.ts.map +1 -1
  35. package/dist/cmd/cloud/db/get.js +23 -7
  36. package/dist/cmd/cloud/db/get.js.map +1 -1
  37. package/dist/cmd/cloud/db/list.d.ts.map +1 -1
  38. package/dist/cmd/cloud/db/list.js +15 -7
  39. package/dist/cmd/cloud/db/list.js.map +1 -1
  40. package/dist/cmd/cloud/db/logs.d.ts.map +1 -1
  41. package/dist/cmd/cloud/db/logs.js +24 -4
  42. package/dist/cmd/cloud/db/logs.js.map +1 -1
  43. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  44. package/dist/cmd/cloud/deploy.js +38 -0
  45. package/dist/cmd/cloud/deploy.js.map +1 -1
  46. package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
  47. package/dist/cmd/cloud/env/delete.js +30 -13
  48. package/dist/cmd/cloud/env/delete.js.map +1 -1
  49. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  50. package/dist/cmd/cloud/env/get.js +27 -30
  51. package/dist/cmd/cloud/env/get.js.map +1 -1
  52. package/dist/cmd/cloud/env/import.d.ts.map +1 -1
  53. package/dist/cmd/cloud/env/import.js +41 -48
  54. package/dist/cmd/cloud/env/import.js.map +1 -1
  55. package/dist/cmd/cloud/env/index.d.ts.map +1 -1
  56. package/dist/cmd/cloud/env/index.js +6 -2
  57. package/dist/cmd/cloud/env/index.js.map +1 -1
  58. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  59. package/dist/cmd/cloud/env/list.js +51 -28
  60. package/dist/cmd/cloud/env/list.js.map +1 -1
  61. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  62. package/dist/cmd/cloud/env/pull.js +3 -3
  63. package/dist/cmd/cloud/env/pull.js.map +1 -1
  64. package/dist/cmd/cloud/env/push.d.ts.map +1 -1
  65. package/dist/cmd/cloud/env/push.js +31 -11
  66. package/dist/cmd/cloud/env/push.js.map +1 -1
  67. package/dist/cmd/cloud/env/set.d.ts.map +1 -1
  68. package/dist/cmd/cloud/env/set.js +41 -26
  69. package/dist/cmd/cloud/env/set.js.map +1 -1
  70. package/dist/cmd/cloud/index.d.ts.map +1 -1
  71. package/dist/cmd/cloud/index.js +0 -2
  72. package/dist/cmd/cloud/index.js.map +1 -1
  73. package/dist/cmd/cloud/region-lookup.d.ts +18 -0
  74. package/dist/cmd/cloud/region-lookup.d.ts.map +1 -0
  75. package/dist/cmd/cloud/region-lookup.js +64 -0
  76. package/dist/cmd/cloud/region-lookup.js.map +1 -0
  77. package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
  78. package/dist/cmd/cloud/sandbox/cp.js +5 -3
  79. package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
  80. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
  81. package/dist/cmd/cloud/sandbox/create.js +43 -6
  82. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  83. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
  84. package/dist/cmd/cloud/sandbox/delete.js +5 -3
  85. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  86. package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -1
  87. package/dist/cmd/cloud/sandbox/download.js +4 -3
  88. package/dist/cmd/cloud/sandbox/download.js.map +1 -1
  89. package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
  90. package/dist/cmd/cloud/sandbox/env.js +4 -3
  91. package/dist/cmd/cloud/sandbox/env.js.map +1 -1
  92. package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
  93. package/dist/cmd/cloud/sandbox/exec.js +4 -3
  94. package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
  95. package/dist/cmd/cloud/sandbox/execution/get.js +4 -4
  96. package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
  97. package/dist/cmd/cloud/sandbox/execution/index.js +1 -1
  98. package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -1
  99. package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
  100. package/dist/cmd/cloud/sandbox/execution/list.js +4 -3
  101. package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
  102. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  103. package/dist/cmd/cloud/sandbox/get.js +9 -4
  104. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  105. package/dist/cmd/cloud/sandbox/index.js +1 -1
  106. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  107. package/dist/cmd/cloud/sandbox/list.js +4 -4
  108. package/dist/cmd/cloud/sandbox/list.js.map +1 -1
  109. package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -1
  110. package/dist/cmd/cloud/sandbox/ls.js +4 -3
  111. package/dist/cmd/cloud/sandbox/ls.js.map +1 -1
  112. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -1
  113. package/dist/cmd/cloud/sandbox/mkdir.js +4 -3
  114. package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -1
  115. package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -1
  116. package/dist/cmd/cloud/sandbox/rm.js +4 -3
  117. package/dist/cmd/cloud/sandbox/rm.js.map +1 -1
  118. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -1
  119. package/dist/cmd/cloud/sandbox/rmdir.js +4 -3
  120. package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
  121. package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
  122. package/dist/cmd/cloud/sandbox/run.js +44 -6
  123. package/dist/cmd/cloud/sandbox/run.js.map +1 -1
  124. package/dist/cmd/cloud/sandbox/runtime/index.js +1 -1
  125. package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -1
  126. package/dist/cmd/cloud/sandbox/runtime/list.js +4 -4
  127. package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -1
  128. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  129. package/dist/cmd/cloud/sandbox/snapshot/create.js +5 -3
  130. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  131. package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
  132. package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
  133. package/dist/cmd/cloud/sandbox/snapshot/get.js +4 -4
  134. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  135. package/dist/cmd/cloud/sandbox/snapshot/index.js +1 -1
  136. package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
  137. package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -4
  138. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  139. package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
  140. package/dist/cmd/cloud/sandbox/snapshot/tag.js +4 -4
  141. package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
  142. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
  143. package/dist/cmd/cloud/sandbox/upload.js +4 -3
  144. package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
  145. package/dist/cmd/cloud/sandbox/util.d.ts +13 -0
  146. package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
  147. package/dist/cmd/cloud/sandbox/util.js +40 -1
  148. package/dist/cmd/cloud/sandbox/util.js.map +1 -1
  149. package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
  150. package/dist/cmd/cloud/scp/download.js +6 -2
  151. package/dist/cmd/cloud/scp/download.js.map +1 -1
  152. package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
  153. package/dist/cmd/cloud/scp/upload.js +6 -2
  154. package/dist/cmd/cloud/scp/upload.js.map +1 -1
  155. package/dist/cmd/cloud/session/get.js +4 -4
  156. package/dist/cmd/cloud/session/get.js.map +1 -1
  157. package/dist/cmd/cloud/session/list.js +4 -4
  158. package/dist/cmd/cloud/session/list.js.map +1 -1
  159. package/dist/cmd/cloud/ssh.d.ts.map +1 -1
  160. package/dist/cmd/cloud/ssh.js +7 -2
  161. package/dist/cmd/cloud/ssh.js.map +1 -1
  162. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
  163. package/dist/cmd/cloud/storage/delete.js +46 -10
  164. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  165. package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
  166. package/dist/cmd/cloud/storage/download.js +19 -6
  167. package/dist/cmd/cloud/storage/download.js.map +1 -1
  168. package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
  169. package/dist/cmd/cloud/storage/get.js +19 -6
  170. package/dist/cmd/cloud/storage/get.js.map +1 -1
  171. package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
  172. package/dist/cmd/cloud/storage/list.js +17 -7
  173. package/dist/cmd/cloud/storage/list.js.map +1 -1
  174. package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
  175. package/dist/cmd/cloud/storage/upload.js +19 -6
  176. package/dist/cmd/cloud/storage/upload.js.map +1 -1
  177. package/dist/cmd/cloud/thread/delete.js +4 -4
  178. package/dist/cmd/cloud/thread/delete.js.map +1 -1
  179. package/dist/cmd/cloud/thread/get.js +4 -4
  180. package/dist/cmd/cloud/thread/get.js.map +1 -1
  181. package/dist/cmd/cloud/thread/list.js +4 -4
  182. package/dist/cmd/cloud/thread/list.js.map +1 -1
  183. package/dist/cmd/project/auth/init.d.ts.map +1 -1
  184. package/dist/cmd/project/auth/init.js +6 -3
  185. package/dist/cmd/project/auth/init.js.map +1 -1
  186. package/dist/cmd/project/auth/shared.d.ts +6 -2
  187. package/dist/cmd/project/auth/shared.d.ts.map +1 -1
  188. package/dist/cmd/project/auth/shared.js +40 -12
  189. package/dist/cmd/project/auth/shared.js.map +1 -1
  190. package/dist/config.d.ts +37 -0
  191. package/dist/config.d.ts.map +1 -1
  192. package/dist/config.js +51 -8
  193. package/dist/config.js.map +1 -1
  194. package/dist/env-util.d.ts +25 -2
  195. package/dist/env-util.d.ts.map +1 -1
  196. package/dist/env-util.js +44 -4
  197. package/dist/env-util.js.map +1 -1
  198. package/dist/utils/apt-validator.d.ts +20 -0
  199. package/dist/utils/apt-validator.d.ts.map +1 -0
  200. package/dist/utils/apt-validator.js +157 -0
  201. package/dist/utils/apt-validator.js.map +1 -0
  202. package/package.json +6 -6
  203. package/src/cache/index.ts +11 -0
  204. package/src/cache/resource-region.ts +183 -0
  205. package/src/cli.ts +47 -38
  206. package/src/cmd/ai/capabilities/show.ts +12 -15
  207. package/src/cmd/ai/prompt/llm.ts +5 -5
  208. package/src/cmd/auth/logout.ts +5 -2
  209. package/src/cmd/build/ast.ts +160 -1
  210. package/src/cmd/build/vite/vite-asset-server-config.ts +7 -3
  211. package/src/cmd/build/vite/vite-asset-server.ts +6 -3
  212. package/src/cmd/cloud/db/delete.ts +83 -11
  213. package/src/cmd/cloud/db/get.ts +29 -7
  214. package/src/cmd/cloud/db/list.ts +16 -7
  215. package/src/cmd/cloud/db/logs.ts +33 -4
  216. package/src/cmd/cloud/deploy.ts +49 -0
  217. package/src/cmd/cloud/env/delete.ts +36 -12
  218. package/src/cmd/cloud/env/get.ts +28 -27
  219. package/src/cmd/cloud/env/import.ts +43 -56
  220. package/src/cmd/cloud/env/index.ts +6 -2
  221. package/src/cmd/cloud/env/list.ts +57 -30
  222. package/src/cmd/cloud/env/pull.ts +9 -3
  223. package/src/cmd/cloud/env/push.ts +44 -11
  224. package/src/cmd/cloud/env/set.ts +49 -30
  225. package/src/cmd/cloud/index.ts +0 -2
  226. package/src/cmd/cloud/region-lookup.ts +89 -0
  227. package/src/cmd/cloud/sandbox/cp.ts +5 -3
  228. package/src/cmd/cloud/sandbox/create.ts +50 -6
  229. package/src/cmd/cloud/sandbox/delete.ts +6 -3
  230. package/src/cmd/cloud/sandbox/download.ts +4 -3
  231. package/src/cmd/cloud/sandbox/env.ts +4 -3
  232. package/src/cmd/cloud/sandbox/exec.ts +4 -3
  233. package/src/cmd/cloud/sandbox/execution/get.ts +4 -4
  234. package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
  235. package/src/cmd/cloud/sandbox/execution/list.ts +4 -3
  236. package/src/cmd/cloud/sandbox/get.ts +10 -4
  237. package/src/cmd/cloud/sandbox/index.ts +1 -1
  238. package/src/cmd/cloud/sandbox/list.ts +4 -4
  239. package/src/cmd/cloud/sandbox/ls.ts +4 -3
  240. package/src/cmd/cloud/sandbox/mkdir.ts +4 -3
  241. package/src/cmd/cloud/sandbox/rm.ts +4 -3
  242. package/src/cmd/cloud/sandbox/rmdir.ts +4 -3
  243. package/src/cmd/cloud/sandbox/run.ts +51 -6
  244. package/src/cmd/cloud/sandbox/runtime/index.ts +1 -1
  245. package/src/cmd/cloud/sandbox/runtime/list.ts +4 -4
  246. package/src/cmd/cloud/sandbox/snapshot/create.ts +11 -5
  247. package/src/cmd/cloud/sandbox/snapshot/delete.ts +4 -4
  248. package/src/cmd/cloud/sandbox/snapshot/get.ts +4 -4
  249. package/src/cmd/cloud/sandbox/snapshot/index.ts +1 -1
  250. package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -4
  251. package/src/cmd/cloud/sandbox/snapshot/tag.ts +7 -5
  252. package/src/cmd/cloud/sandbox/upload.ts +4 -3
  253. package/src/cmd/cloud/sandbox/util.ts +60 -1
  254. package/src/cmd/cloud/scp/download.ts +14 -2
  255. package/src/cmd/cloud/scp/upload.ts +14 -2
  256. package/src/cmd/cloud/session/get.ts +4 -4
  257. package/src/cmd/cloud/session/list.ts +4 -4
  258. package/src/cmd/cloud/ssh.ts +15 -2
  259. package/src/cmd/cloud/storage/delete.ts +61 -10
  260. package/src/cmd/cloud/storage/download.ts +31 -6
  261. package/src/cmd/cloud/storage/get.ts +31 -6
  262. package/src/cmd/cloud/storage/list.ts +18 -7
  263. package/src/cmd/cloud/storage/upload.ts +31 -6
  264. package/src/cmd/cloud/thread/delete.ts +4 -4
  265. package/src/cmd/cloud/thread/get.ts +4 -4
  266. package/src/cmd/cloud/thread/list.ts +4 -4
  267. package/src/cmd/project/auth/init.ts +7 -3
  268. package/src/cmd/project/auth/shared.ts +52 -13
  269. package/src/config.ts +64 -8
  270. package/src/env-util.ts +50 -5
  271. package/src/utils/apt-validator.ts +215 -0
  272. package/dist/cmd/cloud/secret/delete.d.ts +0 -2
  273. package/dist/cmd/cloud/secret/delete.d.ts.map +0 -1
  274. package/dist/cmd/cloud/secret/delete.js +0 -53
  275. package/dist/cmd/cloud/secret/delete.js.map +0 -1
  276. package/dist/cmd/cloud/secret/get.d.ts +0 -2
  277. package/dist/cmd/cloud/secret/get.d.ts.map +0 -1
  278. package/dist/cmd/cloud/secret/get.js +0 -73
  279. package/dist/cmd/cloud/secret/get.js.map +0 -1
  280. package/dist/cmd/cloud/secret/import.d.ts +0 -2
  281. package/dist/cmd/cloud/secret/import.d.ts.map +0 -1
  282. package/dist/cmd/cloud/secret/import.js +0 -91
  283. package/dist/cmd/cloud/secret/import.js.map +0 -1
  284. package/dist/cmd/cloud/secret/index.d.ts +0 -3
  285. package/dist/cmd/cloud/secret/index.d.ts.map +0 -1
  286. package/dist/cmd/cloud/secret/index.js +0 -33
  287. package/dist/cmd/cloud/secret/index.js.map +0 -1
  288. package/dist/cmd/cloud/secret/list.d.ts +0 -2
  289. package/dist/cmd/cloud/secret/list.d.ts.map +0 -1
  290. package/dist/cmd/cloud/secret/list.js +0 -65
  291. package/dist/cmd/cloud/secret/list.js.map +0 -1
  292. package/dist/cmd/cloud/secret/pull.d.ts +0 -2
  293. package/dist/cmd/cloud/secret/pull.d.ts.map +0 -1
  294. package/dist/cmd/cloud/secret/pull.js +0 -82
  295. package/dist/cmd/cloud/secret/pull.js.map +0 -1
  296. package/dist/cmd/cloud/secret/push.d.ts +0 -2
  297. package/dist/cmd/cloud/secret/push.d.ts.map +0 -1
  298. package/dist/cmd/cloud/secret/push.js +0 -61
  299. package/dist/cmd/cloud/secret/push.js.map +0 -1
  300. package/dist/cmd/cloud/secret/set.d.ts +0 -2
  301. package/dist/cmd/cloud/secret/set.d.ts.map +0 -1
  302. package/dist/cmd/cloud/secret/set.js +0 -63
  303. package/dist/cmd/cloud/secret/set.js.map +0 -1
  304. package/src/cmd/cloud/secret/delete.ts +0 -65
  305. package/src/cmd/cloud/secret/get.ts +0 -77
  306. package/src/cmd/cloud/secret/import.ts +0 -110
  307. package/src/cmd/cloud/secret/index.ts +0 -33
  308. package/src/cmd/cloud/secret/list.ts +0 -70
  309. package/src/cmd/cloud/secret/pull.ts +0 -92
  310. package/src/cmd/cloud/secret/push.ts +0 -69
  311. package/src/cmd/cloud/secret/set.ts +0 -76
@@ -1,77 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubcommand } from '../../../types';
3
- import * as tui from '../../../tui';
4
- import { projectGet } from '@agentuity/server';
5
- import { getCommand } from '../../../command-prefix';
6
- import { ErrorCode } from '../../../errors';
7
-
8
- const SecretGetResponseSchema = z.object({
9
- key: z.string().describe('Secret key name'),
10
- value: z.string().describe('Secret value'),
11
- });
12
-
13
- export const getSubcommand = createSubcommand({
14
- name: 'get',
15
- description: 'Get a secret value',
16
- tags: ['read-only', 'fast', 'requires-auth', 'requires-project'],
17
- examples: [
18
- { command: getCommand('secret get DATABASE_URL'), description: 'Get item details' },
19
- {
20
- command: getCommand('secret get STRIPE_SECRET_KEY --no-mask'),
21
- description: 'Use no mask option',
22
- },
23
- ],
24
- requires: { auth: true, project: true, apiClient: true },
25
- schema: {
26
- args: z.object({
27
- key: z.string().describe('the secret key'),
28
- }),
29
- options: z.object({
30
- mask: z
31
- .boolean()
32
- .default(!!process.stdout.isTTY)
33
- .describe('mask the value in output (default: true in TTY, false otherwise)'),
34
- }),
35
- response: SecretGetResponseSchema,
36
- },
37
- idempotent: true,
38
-
39
- async handler(ctx) {
40
- const { args, opts, apiClient, project, options } = ctx;
41
-
42
- // Fetch project with unmasked secrets
43
- const projectData = await tui.spinner('Fetching secrets', () => {
44
- return projectGet(apiClient, { id: project.projectId, mask: false });
45
- });
46
-
47
- // Look for the key in secrets
48
- const value = projectData.secrets?.[args.key];
49
-
50
- if (value === undefined) {
51
- tui.fatal(`Secret '${args.key}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
52
- }
53
-
54
- if (!options.json) {
55
- if (process.stdout.isTTY) {
56
- // Display the value, masked by default
57
- if (opts?.mask) {
58
- tui.success(`${args.key}=${tui.maskSecret(value)}`);
59
- } else {
60
- tui.success(`${args.key}=${value}`);
61
- }
62
- } else {
63
- // Display the value, masked by default
64
- if (opts?.mask) {
65
- console.log(`${args.key}=${tui.maskSecret(value)}`);
66
- } else {
67
- console.log(`${args.key}=${value}`);
68
- }
69
- }
70
- }
71
-
72
- return {
73
- key: args.key,
74
- value,
75
- };
76
- },
77
- });
@@ -1,110 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubcommand } from '../../../types';
3
- import * as tui from '../../../tui';
4
- import { projectEnvUpdate } from '@agentuity/server';
5
- import {
6
- findExistingEnvFile,
7
- readEnvFile,
8
- writeEnvFile,
9
- filterAgentuitySdkKeys,
10
- mergeEnvVars,
11
- } from '../../../env-util';
12
- import { getCommand } from '../../../command-prefix';
13
-
14
- const SecretImportResponseSchema = z.object({
15
- success: z.boolean().describe('Whether import succeeded'),
16
- imported: z.number().describe('Number of items imported'),
17
- skipped: z.number().describe('Number of items skipped'),
18
- path: z.string().describe('Local file path where secrets were saved'),
19
- file: z.string().describe('Source file path'),
20
- });
21
-
22
- export const importSubcommand = createSubcommand({
23
- name: 'import',
24
- description: 'Import secrets from a file to cloud and local .env',
25
- tags: [
26
- 'mutating',
27
- 'creates-resource',
28
- 'slow',
29
- 'api-intensive',
30
- 'requires-auth',
31
- 'requires-project',
32
- ],
33
- examples: [
34
- { command: getCommand('secret import .env.local'), description: 'Run .env.local command' },
35
- {
36
- command: getCommand('secret import .env.backup'),
37
- description: 'Run .env.backup command',
38
- },
39
- ],
40
- idempotent: false,
41
- requires: { auth: true, project: true, apiClient: true },
42
- schema: {
43
- args: z.object({
44
- file: z.string().describe('path to the .env file to import'),
45
- }),
46
- response: SecretImportResponseSchema,
47
- },
48
-
49
- async handler(ctx) {
50
- const { args, apiClient, project, projectDir } = ctx;
51
-
52
- // Read the import file
53
- const importedSecrets = await readEnvFile(args.file);
54
-
55
- if (Object.keys(importedSecrets).length === 0) {
56
- tui.warning(`No secrets found in ${args.file}`);
57
- return {
58
- success: false,
59
- imported: 0,
60
- skipped: 0,
61
- path: '',
62
- file: args.file,
63
- };
64
- }
65
-
66
- // Filter out AGENTUITY_ prefixed keys
67
- const filteredSecrets = filterAgentuitySdkKeys(importedSecrets);
68
-
69
- if (Object.keys(filteredSecrets).length === 0) {
70
- tui.warning('No valid secrets to import (all were AGENTUITY_ prefixed)');
71
- return {
72
- success: false,
73
- imported: 0,
74
- skipped: Object.keys(importedSecrets).length,
75
- path: '',
76
- file: args.file,
77
- };
78
- }
79
-
80
- // Push to cloud (using secrets field)
81
- await tui.spinner('Importing secrets to cloud', () => {
82
- return projectEnvUpdate(apiClient, {
83
- id: project.projectId,
84
- secrets: filteredSecrets,
85
- });
86
- });
87
-
88
- // Merge with local .env file
89
- const localEnvPath = await findExistingEnvFile(projectDir);
90
- const localEnv = await readEnvFile(localEnvPath);
91
- const mergedEnv = mergeEnvVars(localEnv, filteredSecrets);
92
-
93
- await writeEnvFile(localEnvPath, mergedEnv, {
94
- skipKeys: Object.keys(mergedEnv).filter((k) => k.startsWith('AGENTUITY_')),
95
- });
96
-
97
- const count = Object.keys(filteredSecrets).length;
98
- tui.success(
99
- `Imported ${count} secret${count !== 1 ? 's' : ''} from ${args.file} to cloud and ${localEnvPath}`
100
- );
101
-
102
- return {
103
- success: true,
104
- imported: count,
105
- skipped: Object.keys(importedSecrets).length - count,
106
- path: localEnvPath,
107
- file: args.file,
108
- };
109
- },
110
- });
@@ -1,33 +0,0 @@
1
- import { createCommand } from '../../../types';
2
- import { pullSubcommand } from './pull';
3
- import { pushSubcommand } from './push';
4
- import { setSubcommand } from './set';
5
- import { getSubcommand } from './get';
6
- import { deleteSubcommand } from './delete';
7
- import { importSubcommand } from './import';
8
- import { listSubcommand } from './list';
9
- import { getCommand } from '../../../command-prefix';
10
-
11
- export const command = createCommand({
12
- name: 'secret',
13
- aliases: ['secrets'],
14
- description: 'Manage secrets for your project',
15
- tags: ['fast', 'requires-auth', 'requires-project'],
16
- examples: [
17
- { command: getCommand('cloud secret list'), description: 'List all secrets' },
18
- {
19
- command: getCommand('cloud secret set API_KEY "sk_..."'),
20
- description: 'Set a secret value',
21
- },
22
- ],
23
- subcommands: [
24
- listSubcommand,
25
- pullSubcommand,
26
- pushSubcommand,
27
- setSubcommand,
28
- getSubcommand,
29
- deleteSubcommand,
30
- importSubcommand,
31
- ],
32
- });
33
- export default command;
@@ -1,70 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubcommand } from '../../../types';
3
- import * as tui from '../../../tui';
4
- import { projectGet } from '@agentuity/server';
5
- import { getCommand } from '../../../command-prefix';
6
-
7
- const SecretListResponseSchema = z.record(z.string(), z.string().describe('Secret value'));
8
-
9
- export const listSubcommand = createSubcommand({
10
- name: 'list',
11
- aliases: ['ls'],
12
- description: 'List all secrets',
13
- tags: ['read-only', 'fast', 'requires-auth', 'requires-project'],
14
- examples: [
15
- { command: getCommand('secret list'), description: 'List items' },
16
- { command: getCommand('secret list --no-mask'), description: 'Use no mask option' },
17
- ],
18
- requires: { auth: true, project: true, apiClient: true },
19
- idempotent: true,
20
- schema: {
21
- options: z.object({
22
- mask: z
23
- .boolean()
24
- .default(!!process.stdout.isTTY)
25
- .describe('mask the values in output (default: true in TTY for secrets)'),
26
- }),
27
- response: SecretListResponseSchema,
28
- },
29
- webUrl: (ctx) => `/projects/${encodeURIComponent(ctx.project.projectId)}/settings`,
30
-
31
- async handler(ctx) {
32
- const { opts, apiClient, project, options } = ctx;
33
-
34
- // Fetch project with unmasked secrets
35
- const projectData = await tui.spinner('Fetching secrets', () => {
36
- return projectGet(apiClient, { id: project.projectId, mask: false });
37
- });
38
-
39
- const secrets = projectData.secrets || {};
40
-
41
- // Skip TUI output in JSON mode
42
- if (!options.json) {
43
- if (Object.keys(secrets).length === 0) {
44
- tui.info('No secrets found');
45
- } else {
46
- // Display the secrets
47
- if (process.stdout.isTTY) {
48
- tui.newline();
49
- tui.success(`Secrets (${Object.keys(secrets).length}):`);
50
- tui.newline();
51
- }
52
-
53
- const sortedKeys = Object.keys(secrets).sort();
54
- // For secrets, masking is enabled by default in TTY (can be disabled with --no-mask)
55
- const shouldMask = opts?.mask !== false;
56
- for (const key of sortedKeys) {
57
- const value = secrets[key];
58
- const displayValue = shouldMask ? tui.maskSecret(value) : value;
59
- if (process.stdout.isTTY) {
60
- console.log(`${tui.bold(key)}=${displayValue}`);
61
- } else {
62
- console.log(`${key}=${displayValue}`);
63
- }
64
- }
65
- }
66
- }
67
-
68
- return secrets;
69
- },
70
- });
@@ -1,92 +0,0 @@
1
- import { z } from 'zod';
2
- import { join } from 'node:path';
3
- import { createSubcommand } from '../../../types';
4
- import * as tui from '../../../tui';
5
- import { projectGet } from '@agentuity/server';
6
- import { findExistingEnvFile, readEnvFile, writeEnvFile, mergeEnvVars } from '../../../env-util';
7
- import { getCommand } from '../../../command-prefix';
8
-
9
- const SecretPullResponseSchema = z.object({
10
- success: z.boolean().describe('Whether pull succeeded'),
11
- pulled: z.number().describe('Number of items pulled'),
12
- path: z.string().describe('Local file path where secrets were saved'),
13
- force: z.boolean().describe('Whether force mode was used'),
14
- });
15
-
16
- export const pullSubcommand = createSubcommand({
17
- name: 'pull',
18
- description: 'Pull secrets from cloud to local .env file',
19
- tags: ['slow', 'requires-auth', 'requires-project'],
20
- idempotent: true,
21
- examples: [
22
- { command: getCommand('secret pull'), description: 'Run pull command' },
23
- { command: getCommand('secret pull --force'), description: 'Use force option' },
24
- ],
25
- requires: { auth: true, project: true, apiClient: true },
26
- prerequisites: ['cloud deploy'],
27
- schema: {
28
- options: z.object({
29
- force: z.boolean().default(false).describe('overwrite local values with cloud values'),
30
- }),
31
- response: SecretPullResponseSchema,
32
- },
33
-
34
- async handler(ctx) {
35
- const { opts, apiClient, project, projectDir } = ctx;
36
-
37
- // Fetch project with unmasked secrets
38
- const projectData = await tui.spinner('Pulling secrets from cloud', () => {
39
- return projectGet(apiClient, { id: project.projectId, mask: false });
40
- });
41
-
42
- const cloudSecrets = { ...projectData.env, ...projectData.secrets }; // secret pull with actually do both secrets and env since thats likely what the user would want
43
-
44
- // Target file is always .env
45
- const targetEnvPath = await findExistingEnvFile(projectDir);
46
- const localEnv = await readEnvFile(targetEnvPath);
47
-
48
- // Merge: cloud values override local if force=true, otherwise keep local
49
- let mergedEnv: Record<string, string>;
50
- if (opts?.force) {
51
- // Cloud values take priority
52
- mergedEnv = mergeEnvVars(localEnv, cloudSecrets);
53
- } else {
54
- // Local values take priority (only add new keys from cloud)
55
- mergedEnv = mergeEnvVars(cloudSecrets, localEnv);
56
- }
57
-
58
- // Write to .env (skip AGENTUITY_ keys)
59
- await writeEnvFile(targetEnvPath, mergedEnv, {
60
- skipKeys: Object.keys(mergedEnv).filter((k) => k.startsWith('AGENTUITY_')),
61
- });
62
-
63
- // Write AGENTUITY_SDK_KEY to .env if present and missing locally
64
- if (projectData.api_key) {
65
- const dotEnvPath = join(projectDir, '.env');
66
- const dotEnv = await readEnvFile(dotEnvPath);
67
-
68
- if (!dotEnv.AGENTUITY_SDK_KEY) {
69
- dotEnv.AGENTUITY_SDK_KEY = projectData.api_key;
70
- await writeEnvFile(dotEnvPath, dotEnv, {
71
- addComment: (key) => {
72
- if (key === 'AGENTUITY_SDK_KEY') {
73
- return 'AGENTUITY_SDK_KEY is a sensitive value and should not be committed to version control.';
74
- }
75
- return null;
76
- },
77
- });
78
- tui.info(`Wrote AGENTUITY_SDK_KEY to ${dotEnvPath}`);
79
- }
80
- }
81
-
82
- const count = Object.keys(cloudSecrets).length;
83
- tui.success(`Pulled ${count} secret${count !== 1 ? 's' : ''} to ${targetEnvPath}`);
84
-
85
- return {
86
- success: true,
87
- pulled: count,
88
- path: targetEnvPath,
89
- force: opts?.force ?? false,
90
- };
91
- },
92
- });
@@ -1,69 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubcommand } from '../../../types';
3
- import * as tui from '../../../tui';
4
- import { projectEnvUpdate } from '@agentuity/server';
5
- import { findExistingEnvFile, readEnvFile, filterAgentuitySdkKeys } from '../../../env-util';
6
- import { getCommand } from '../../../command-prefix';
7
-
8
- const SecretPushResponseSchema = z.object({
9
- success: z.boolean().describe('Whether push succeeded'),
10
- pushed: z.number().describe('Number of items pushed'),
11
- source: z.string().describe('Source file path'),
12
- });
13
-
14
- export const pushSubcommand = createSubcommand({
15
- name: 'push',
16
- description: 'Push secrets from local .env file to cloud',
17
- tags: [
18
- 'mutating',
19
- 'updates-resource',
20
- 'slow',
21
- 'api-intensive',
22
- 'requires-auth',
23
- 'requires-project',
24
- ],
25
- idempotent: true,
26
- examples: [{ command: getCommand('secret push'), description: 'Run push command' }],
27
- requires: { auth: true, project: true, apiClient: true },
28
- prerequisites: ['secret set'],
29
- schema: {
30
- response: SecretPushResponseSchema,
31
- },
32
-
33
- async handler(ctx) {
34
- const { apiClient, project, projectDir } = ctx;
35
-
36
- // Read local env file
37
- const envFilePath = await findExistingEnvFile(projectDir);
38
- const localEnv = await readEnvFile(envFilePath);
39
-
40
- // Filter out AGENTUITY_ prefixed keys (don't push SDK keys)
41
- const filteredSecrets = filterAgentuitySdkKeys(localEnv);
42
-
43
- if (Object.keys(filteredSecrets).length === 0) {
44
- tui.warning('No secrets to push');
45
- return {
46
- success: false,
47
- pushed: 0,
48
- source: envFilePath,
49
- };
50
- }
51
-
52
- // Push to cloud (using secrets field)
53
- await tui.spinner('Pushing secrets to cloud', () => {
54
- return projectEnvUpdate(apiClient, {
55
- id: project.projectId,
56
- secrets: filteredSecrets,
57
- });
58
- });
59
-
60
- const count = Object.keys(filteredSecrets).length;
61
- tui.success(`Pushed ${count} secret${count !== 1 ? 's' : ''} to cloud`);
62
-
63
- return {
64
- success: true,
65
- pushed: count,
66
- source: envFilePath,
67
- };
68
- },
69
- });
@@ -1,76 +0,0 @@
1
- import { z } from 'zod';
2
- import { createSubcommand } from '../../../types';
3
- import * as tui from '../../../tui';
4
- import { projectEnvUpdate } from '@agentuity/server';
5
- import {
6
- findExistingEnvFile,
7
- readEnvFile,
8
- writeEnvFile,
9
- filterAgentuitySdkKeys,
10
- } from '../../../env-util';
11
- import { getCommand } from '../../../command-prefix';
12
-
13
- const SecretSetResponseSchema = z.object({
14
- success: z.boolean().describe('Whether the operation succeeded'),
15
- key: z.string().describe('Secret key name'),
16
- path: z.string().describe('Local file path where secret was saved'),
17
- });
18
-
19
- export const setSubcommand = createSubcommand({
20
- name: 'set',
21
- description: 'Set a secret',
22
- tags: ['mutating', 'updates-resource', 'slow', 'requires-auth', 'requires-project'],
23
- idempotent: true,
24
- examples: [
25
- {
26
- command: getCommand('secret set DATABASE_URL "postgres://user:pass@host:5432/db"'),
27
- description: 'Set the DATABASE_URL environment secret',
28
- },
29
- {
30
- command: getCommand('secret set STRIPE_SECRET_KEY "sk_live_..."'),
31
- description: 'Set the STRIPE_SECRET_KEY environment secret',
32
- },
33
- ],
34
- requires: { auth: true, project: true, apiClient: true },
35
- schema: {
36
- args: z.object({
37
- key: z.string().min(1, 'key must not be empty').describe('the secret key'),
38
- value: z.string().min(1, 'value must not be empty').describe('the secret value'),
39
- }),
40
- response: SecretSetResponseSchema,
41
- },
42
-
43
- async handler(ctx) {
44
- const { args, apiClient, project, projectDir } = ctx;
45
-
46
- // Validate key doesn't start with AGENTUITY_
47
- if (args.key.startsWith('AGENTUITY_')) {
48
- tui.fatal('Cannot set AGENTUITY_ prefixed variables. These are reserved for system use.');
49
- }
50
-
51
- // Set in cloud (using secrets field)
52
- await tui.spinner('Setting secret in cloud', () => {
53
- return projectEnvUpdate(apiClient, {
54
- id: project.projectId,
55
- secrets: { [args.key]: args.value },
56
- });
57
- });
58
-
59
- // Update local .env file
60
- const envFilePath = await findExistingEnvFile(projectDir);
61
- const currentEnv = await readEnvFile(envFilePath);
62
- currentEnv[args.key] = args.value;
63
-
64
- // Filter out AGENTUITY_ keys before writing
65
- const filteredEnv = filterAgentuitySdkKeys(currentEnv);
66
- await writeEnvFile(envFilePath, filteredEnv);
67
-
68
- tui.success(`Secret '${args.key}' set successfully (cloud + ${envFilePath})`);
69
-
70
- return {
71
- success: true,
72
- key: args.key,
73
- path: envFilePath,
74
- };
75
- },
76
- });