@agentuity/cli 0.0.104 → 0.0.106

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 (214) hide show
  1. package/bin/cli.ts +6 -3
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +93 -21
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cmd/ai/prompt/version.d.ts +1 -0
  6. package/dist/cmd/ai/prompt/version.d.ts.map +1 -1
  7. package/dist/cmd/ai/prompt/version.js +3 -2
  8. package/dist/cmd/ai/prompt/version.js.map +1 -1
  9. package/dist/cmd/build/ast.d.ts.map +1 -1
  10. package/dist/cmd/build/ast.js +179 -37
  11. package/dist/cmd/build/ast.js.map +1 -1
  12. package/dist/cmd/build/entry-generator.d.ts.map +1 -1
  13. package/dist/cmd/build/entry-generator.js +24 -14
  14. package/dist/cmd/build/entry-generator.js.map +1 -1
  15. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  16. package/dist/cmd/build/vite/registry-generator.js +8 -9
  17. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  18. package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
  19. package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
  20. package/dist/cmd/cloud/db/create.d.ts.map +1 -1
  21. package/dist/cmd/cloud/db/create.js +11 -2
  22. package/dist/cmd/cloud/db/create.js.map +1 -1
  23. package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
  24. package/dist/cmd/cloud/db/delete.js +13 -2
  25. package/dist/cmd/cloud/db/delete.js.map +1 -1
  26. package/dist/cmd/cloud/deploy.js +3 -3
  27. package/dist/cmd/cloud/deploy.js.map +1 -1
  28. package/dist/cmd/cloud/env/delete.js +1 -1
  29. package/dist/cmd/cloud/env/delete.js.map +1 -1
  30. package/dist/cmd/cloud/env/import.js +4 -4
  31. package/dist/cmd/cloud/env/import.js.map +1 -1
  32. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  33. package/dist/cmd/cloud/env/pull.js +7 -9
  34. package/dist/cmd/cloud/env/pull.js.map +1 -1
  35. package/dist/cmd/cloud/env/push.js +2 -2
  36. package/dist/cmd/cloud/env/push.js.map +1 -1
  37. package/dist/cmd/cloud/env/set.js +3 -3
  38. package/dist/cmd/cloud/env/set.js.map +1 -1
  39. package/dist/cmd/cloud/index.d.ts.map +1 -1
  40. package/dist/cmd/cloud/index.js +2 -0
  41. package/dist/cmd/cloud/index.js.map +1 -1
  42. package/dist/cmd/cloud/sandbox/cp.d.ts +3 -0
  43. package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -0
  44. package/dist/cmd/cloud/sandbox/cp.js +334 -0
  45. package/dist/cmd/cloud/sandbox/cp.js.map +1 -0
  46. package/dist/cmd/cloud/sandbox/create.d.ts +3 -0
  47. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -0
  48. package/dist/cmd/cloud/sandbox/create.js +105 -0
  49. package/dist/cmd/cloud/sandbox/create.js.map +1 -0
  50. package/dist/cmd/cloud/sandbox/delete.d.ts +3 -0
  51. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -0
  52. package/dist/cmd/cloud/sandbox/delete.js +72 -0
  53. package/dist/cmd/cloud/sandbox/delete.js.map +1 -0
  54. package/dist/cmd/cloud/sandbox/exec.d.ts +3 -0
  55. package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -0
  56. package/dist/cmd/cloud/sandbox/exec.js +211 -0
  57. package/dist/cmd/cloud/sandbox/exec.js.map +1 -0
  58. package/dist/cmd/cloud/sandbox/execution/get.d.ts +3 -0
  59. package/dist/cmd/cloud/sandbox/execution/get.d.ts.map +1 -0
  60. package/dist/cmd/cloud/sandbox/execution/get.js +96 -0
  61. package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -0
  62. package/dist/cmd/cloud/sandbox/execution/index.d.ts +3 -0
  63. package/dist/cmd/cloud/sandbox/execution/index.d.ts.map +1 -0
  64. package/dist/cmd/cloud/sandbox/execution/index.js +24 -0
  65. package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -0
  66. package/dist/cmd/cloud/sandbox/execution/list.d.ts +3 -0
  67. package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -0
  68. package/dist/cmd/cloud/sandbox/execution/list.js +100 -0
  69. package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -0
  70. package/dist/cmd/cloud/sandbox/get.d.ts +3 -0
  71. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -0
  72. package/dist/cmd/cloud/sandbox/get.js +95 -0
  73. package/dist/cmd/cloud/sandbox/get.js.map +1 -0
  74. package/dist/cmd/cloud/sandbox/index.d.ts +3 -0
  75. package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -0
  76. package/dist/cmd/cloud/sandbox/index.js +45 -0
  77. package/dist/cmd/cloud/sandbox/index.js.map +1 -0
  78. package/dist/cmd/cloud/sandbox/list.d.ts +3 -0
  79. package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -0
  80. package/dist/cmd/cloud/sandbox/list.js +120 -0
  81. package/dist/cmd/cloud/sandbox/list.js.map +1 -0
  82. package/dist/cmd/cloud/sandbox/run.d.ts +3 -0
  83. package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -0
  84. package/dist/cmd/cloud/sandbox/run.js +152 -0
  85. package/dist/cmd/cloud/sandbox/run.js.map +1 -0
  86. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts +3 -0
  87. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -0
  88. package/dist/cmd/cloud/sandbox/snapshot/create.js +65 -0
  89. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -0
  90. package/dist/cmd/cloud/sandbox/snapshot/delete.d.ts +3 -0
  91. package/dist/cmd/cloud/sandbox/snapshot/delete.d.ts.map +1 -0
  92. package/dist/cmd/cloud/sandbox/snapshot/delete.js +66 -0
  93. package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -0
  94. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts +3 -0
  95. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -0
  96. package/dist/cmd/cloud/sandbox/snapshot/get.js +154 -0
  97. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -0
  98. package/dist/cmd/cloud/sandbox/snapshot/index.d.ts +3 -0
  99. package/dist/cmd/cloud/sandbox/snapshot/index.d.ts.map +1 -0
  100. package/dist/cmd/cloud/sandbox/snapshot/index.js +27 -0
  101. package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -0
  102. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts +3 -0
  103. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -0
  104. package/dist/cmd/cloud/sandbox/snapshot/list.js +83 -0
  105. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -0
  106. package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts +3 -0
  107. package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -0
  108. package/dist/cmd/cloud/sandbox/snapshot/tag.js +63 -0
  109. package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -0
  110. package/dist/cmd/cloud/sandbox/util.d.ts +15 -0
  111. package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -0
  112. package/dist/cmd/cloud/sandbox/util.js +50 -0
  113. package/dist/cmd/cloud/sandbox/util.js.map +1 -0
  114. package/dist/cmd/cloud/secret/delete.d.ts.map +1 -1
  115. package/dist/cmd/cloud/secret/delete.js +3 -3
  116. package/dist/cmd/cloud/secret/delete.js.map +1 -1
  117. package/dist/cmd/cloud/secret/import.js +6 -6
  118. package/dist/cmd/cloud/secret/import.js.map +1 -1
  119. package/dist/cmd/cloud/secret/index.d.ts.map +1 -1
  120. package/dist/cmd/cloud/secret/index.js +1 -0
  121. package/dist/cmd/cloud/secret/index.js.map +1 -1
  122. package/dist/cmd/cloud/secret/pull.d.ts.map +1 -1
  123. package/dist/cmd/cloud/secret/pull.js +7 -9
  124. package/dist/cmd/cloud/secret/pull.js.map +1 -1
  125. package/dist/cmd/cloud/secret/push.js +3 -3
  126. package/dist/cmd/cloud/secret/push.js.map +1 -1
  127. package/dist/cmd/cloud/secret/set.d.ts.map +1 -1
  128. package/dist/cmd/cloud/secret/set.js +3 -3
  129. package/dist/cmd/cloud/secret/set.js.map +1 -1
  130. package/dist/cmd/cloud/storage/create.d.ts.map +1 -1
  131. package/dist/cmd/cloud/storage/create.js +13 -2
  132. package/dist/cmd/cloud/storage/create.js.map +1 -1
  133. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
  134. package/dist/cmd/cloud/storage/delete.js +13 -2
  135. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  136. package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
  137. package/dist/cmd/cloud/stream/list.js +2 -13
  138. package/dist/cmd/cloud/stream/list.js.map +1 -1
  139. package/dist/cmd/dev/index.d.ts.map +1 -1
  140. package/dist/cmd/dev/index.js +14 -1
  141. package/dist/cmd/dev/index.js.map +1 -1
  142. package/dist/cmd/profile/create.d.ts.map +1 -1
  143. package/dist/cmd/profile/create.js +1 -0
  144. package/dist/cmd/profile/create.js.map +1 -1
  145. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  146. package/dist/cmd/project/template-flow.js +27 -10
  147. package/dist/cmd/project/template-flow.js.map +1 -1
  148. package/dist/config.d.ts +0 -2
  149. package/dist/config.d.ts.map +1 -1
  150. package/dist/config.js +3 -0
  151. package/dist/config.js.map +1 -1
  152. package/dist/env-util.d.ts +16 -8
  153. package/dist/env-util.d.ts.map +1 -1
  154. package/dist/env-util.js +46 -18
  155. package/dist/env-util.js.map +1 -1
  156. package/dist/tui.d.ts +20 -3
  157. package/dist/tui.d.ts.map +1 -1
  158. package/dist/tui.js +82 -23
  159. package/dist/tui.js.map +1 -1
  160. package/dist/types.d.ts +18 -4
  161. package/dist/types.d.ts.map +1 -1
  162. package/dist/types.js +1 -0
  163. package/dist/types.js.map +1 -1
  164. package/package.json +4 -4
  165. package/src/cli.ts +99 -21
  166. package/src/cmd/ai/prompt/api.md +26 -21
  167. package/src/cmd/ai/prompt/version.ts +3 -2
  168. package/src/cmd/build/ast.ts +214 -37
  169. package/src/cmd/build/entry-generator.ts +24 -14
  170. package/src/cmd/build/vite/registry-generator.ts +8 -11
  171. package/src/cmd/build/vite/vite-asset-server.ts +3 -1
  172. package/src/cmd/cloud/db/create.ts +13 -2
  173. package/src/cmd/cloud/db/delete.ts +15 -2
  174. package/src/cmd/cloud/deploy.ts +3 -3
  175. package/src/cmd/cloud/env/delete.ts +1 -1
  176. package/src/cmd/cloud/env/import.ts +4 -4
  177. package/src/cmd/cloud/env/pull.ts +7 -16
  178. package/src/cmd/cloud/env/push.ts +2 -2
  179. package/src/cmd/cloud/env/set.ts +3 -3
  180. package/src/cmd/cloud/index.ts +2 -0
  181. package/src/cmd/cloud/sandbox/cp.ts +531 -0
  182. package/src/cmd/cloud/sandbox/create.ts +114 -0
  183. package/src/cmd/cloud/sandbox/delete.ts +80 -0
  184. package/src/cmd/cloud/sandbox/exec.ts +254 -0
  185. package/src/cmd/cloud/sandbox/execution/get.ts +106 -0
  186. package/src/cmd/cloud/sandbox/execution/index.ts +25 -0
  187. package/src/cmd/cloud/sandbox/execution/list.ts +111 -0
  188. package/src/cmd/cloud/sandbox/get.ts +104 -0
  189. package/src/cmd/cloud/sandbox/index.ts +46 -0
  190. package/src/cmd/cloud/sandbox/list.ts +129 -0
  191. package/src/cmd/cloud/sandbox/run.ts +170 -0
  192. package/src/cmd/cloud/sandbox/snapshot/create.ts +71 -0
  193. package/src/cmd/cloud/sandbox/snapshot/delete.ts +74 -0
  194. package/src/cmd/cloud/sandbox/snapshot/get.ts +188 -0
  195. package/src/cmd/cloud/sandbox/snapshot/index.ts +28 -0
  196. package/src/cmd/cloud/sandbox/snapshot/list.ts +90 -0
  197. package/src/cmd/cloud/sandbox/snapshot/tag.ts +70 -0
  198. package/src/cmd/cloud/sandbox/util.ts +59 -0
  199. package/src/cmd/cloud/secret/delete.ts +8 -3
  200. package/src/cmd/cloud/secret/import.ts +6 -6
  201. package/src/cmd/cloud/secret/index.ts +1 -0
  202. package/src/cmd/cloud/secret/pull.ts +7 -16
  203. package/src/cmd/cloud/secret/push.ts +3 -3
  204. package/src/cmd/cloud/secret/set.ts +8 -3
  205. package/src/cmd/cloud/storage/create.ts +15 -2
  206. package/src/cmd/cloud/storage/delete.ts +15 -2
  207. package/src/cmd/cloud/stream/list.ts +2 -9
  208. package/src/cmd/dev/index.ts +18 -1
  209. package/src/cmd/profile/create.ts +1 -0
  210. package/src/cmd/project/template-flow.ts +29 -13
  211. package/src/config.ts +3 -0
  212. package/src/env-util.ts +52 -21
  213. package/src/tui.ts +131 -39
  214. package/src/types.ts +18 -16
package/src/env-util.ts CHANGED
@@ -9,27 +9,10 @@ export interface EnvVars {
9
9
  }
10
10
 
11
11
  /**
12
- * Find the appropriate .env file to use for user environment variables.
13
- * Always returns .env.production path (will be created if needed).
14
- * .env should only contain AGENTUITY_SDK_KEY.
15
- */
16
- export async function findEnvFile(dir: string): Promise<string> {
17
- return join(dir, '.env.production');
18
- }
19
-
20
- /**
21
- * Find an existing env file for reading.
22
- * Preference: .env.production > .env
12
+ * Find an existing .env file for reading.
23
13
  */
24
14
  export async function findExistingEnvFile(dir: string): Promise<string> {
25
- const productionEnv = join(dir, '.env.production');
26
- const defaultEnv = join(dir, '.env');
27
-
28
- if (await Bun.file(productionEnv).exists()) {
29
- return productionEnv;
30
- }
31
-
32
- return defaultEnv;
15
+ return join(dir, '.env');
33
16
  }
34
17
 
35
18
  /**
@@ -194,9 +177,15 @@ export function filterAgentuitySdkKeys(vars: EnvVars): EnvVars {
194
177
  return filtered;
195
178
  }
196
179
 
180
+ /**
181
+ * Keys that should always be treated as secrets (exact match)
182
+ */
183
+ const secretExactKeys = ['DATABASE_URL'];
184
+
197
185
  /**
198
186
  * Split env vars into env and secrets based on key names
199
187
  * Convention: Keys ending with _SECRET, _KEY, _TOKEN, _PASSWORD are secrets
188
+ * Also treats DATABASE_URL as a secret since it contains credentials
200
189
  */
201
190
  export function splitEnvAndSecrets(vars: EnvVars): {
202
191
  env: EnvVars;
@@ -213,9 +202,10 @@ export function splitEnvAndSecrets(vars: EnvVars): {
213
202
  continue;
214
203
  }
215
204
 
216
- const isSecret = secretSuffixes.some((suffix) => key.endsWith(suffix));
205
+ const isSecretByExactMatch = secretExactKeys.includes(key);
206
+ const isSecretBySuffix = secretSuffixes.some((suffix) => key.endsWith(suffix));
217
207
 
218
- if (isSecret) {
208
+ if (isSecretByExactMatch || isSecretBySuffix) {
219
209
  secrets[key] = value;
220
210
  } else {
221
211
  env[key] = value;
@@ -353,3 +343,44 @@ export function looksLikeSecret(key: string, value: string): boolean {
353
343
 
354
344
  return false;
355
345
  }
346
+
347
+ /**
348
+ * Add resource environment variables to the .env file.
349
+ * Merges with existing variables, overwriting any that already exist.
350
+ */
351
+ export async function addResourceEnvVars(dir: string, envVars: EnvVars): Promise<void> {
352
+ const envPath = join(dir, '.env');
353
+ const existing = await readEnvFile(envPath);
354
+ const merged = { ...existing, ...envVars };
355
+ await writeEnvFile(envPath, merged);
356
+ }
357
+
358
+ /**
359
+ * Remove resource environment variables from the .env file.
360
+ * Only removes the specified keys if they exist.
361
+ */
362
+ export async function removeResourceEnvVars(dir: string, keys: string[]): Promise<void> {
363
+ const envPath = join(dir, '.env');
364
+ const existing = await readEnvFile(envPath);
365
+
366
+ let changed = false;
367
+ for (const key of keys) {
368
+ if (key in existing) {
369
+ delete existing[key];
370
+ changed = true;
371
+ }
372
+ }
373
+
374
+ if (changed) {
375
+ await writeEnvFile(envPath, existing);
376
+ }
377
+ }
378
+
379
+ /**
380
+ * Get the value of a specific key from the .env file
381
+ */
382
+ export async function getEnvVar(dir: string, key: string): Promise<string | undefined> {
383
+ const envPath = join(dir, '.env');
384
+ const existing = await readEnvFile(envPath);
385
+ return existing[key];
386
+ }
package/src/tui.ts CHANGED
@@ -1722,6 +1722,85 @@ export interface TableColumn {
1722
1722
  alignment?: 'left' | 'right' | 'center';
1723
1723
  }
1724
1724
 
1725
+ /**
1726
+ * Table options
1727
+ */
1728
+ export interface TableOptions {
1729
+ /**
1730
+ * If true, returns the table as a string instead of printing to stdout
1731
+ */
1732
+ render?: boolean;
1733
+ /**
1734
+ * Force a specific layout mode
1735
+ * - 'horizontal': Traditional table with columns side by side
1736
+ * - 'vertical': Stacked format with "Column: value" on separate lines
1737
+ * - 'auto': Automatically choose based on terminal width (default)
1738
+ */
1739
+ layout?: 'horizontal' | 'vertical' | 'auto';
1740
+ }
1741
+
1742
+ /**
1743
+ * Calculate the minimum width needed to display a horizontal table
1744
+ * Accounts for column padding, borders, and content width
1745
+ */
1746
+ function calculateTableWidth<T extends Record<string, unknown>>(
1747
+ data: T[],
1748
+ columnNames: string[]
1749
+ ): number {
1750
+ const columnWidths = columnNames.map((colName) => {
1751
+ let maxWidth = getDisplayWidth(colName);
1752
+ for (const row of data) {
1753
+ const value = row[colName];
1754
+ const valueStr = value !== undefined && value !== null ? String(value) : '';
1755
+ const valueWidth = getDisplayWidth(valueStr);
1756
+ if (valueWidth > maxWidth) {
1757
+ maxWidth = valueWidth;
1758
+ }
1759
+ }
1760
+ return maxWidth;
1761
+ });
1762
+
1763
+ // Add padding (1 space each side) and border characters per column
1764
+ // cli-table3 uses: │ col1 │ col2 │ = 3 chars per column + 1 for final border
1765
+ const paddingPerColumn = 3;
1766
+ const totalWidth = columnWidths.reduce((sum, w) => sum + w + paddingPerColumn, 0) + 1;
1767
+
1768
+ return totalWidth;
1769
+ }
1770
+
1771
+ /**
1772
+ * Render table in vertical (stacked) format for narrow terminals
1773
+ */
1774
+ function renderVerticalTable<T extends Record<string, unknown>>(
1775
+ data: T[],
1776
+ columnNames: string[]
1777
+ ): string {
1778
+ const lines: string[] = [];
1779
+ const mutedColor = getColor('muted');
1780
+ const reset = getColor('reset');
1781
+
1782
+ // Calculate max column name width for alignment
1783
+ const maxLabelWidth = Math.max(...columnNames.map((name) => 1 + getDisplayWidth(name)));
1784
+
1785
+ for (let i = 0; i < data.length; i++) {
1786
+ const row = data[i];
1787
+
1788
+ for (const colName of columnNames) {
1789
+ const value = row[colName];
1790
+ const valueStr = value !== undefined && value !== null ? String(value) : '';
1791
+ const paddedLabel = `${colName}:`.padEnd(maxLabelWidth);
1792
+ lines.push(`${mutedColor}${paddedLabel}${reset} ${valueStr}`);
1793
+ }
1794
+
1795
+ // Add empty line between rows (but not after last row)
1796
+ if (i < data.length - 1) {
1797
+ lines.push('');
1798
+ }
1799
+ }
1800
+
1801
+ return lines.join('\n') + '\n';
1802
+ }
1803
+
1725
1804
  /**
1726
1805
  * Display data in a formatted table using cli-table3
1727
1806
  *
@@ -1729,6 +1808,9 @@ export interface TableColumn {
1729
1808
  * 1. Simple mode: Pass data array and optional column names
1730
1809
  * 2. Advanced mode: Pass column configurations with custom names and alignment
1731
1810
  *
1811
+ * Automatically switches between horizontal (wide) and vertical (narrow) layouts
1812
+ * based on terminal width. Use the `layout` option to force a specific mode.
1813
+ *
1732
1814
  * @param data - Array of data objects to display
1733
1815
  * @param columns - Column names or column configurations
1734
1816
  * @param options - Additional options
@@ -1737,23 +1819,8 @@ export interface TableColumn {
1737
1819
  export function table<T extends Record<string, unknown>>(
1738
1820
  data: T[],
1739
1821
  columns?: (keyof T)[] | TableColumn[],
1740
- options?: { render?: boolean }
1822
+ options?: TableOptions
1741
1823
  ): string | void {
1742
- // eslint-disable-next-line @typescript-eslint/no-require-imports
1743
- const Table = require('cli-table3') as new (options?: {
1744
- head?: string[];
1745
- colAligns?: Array<'left' | 'right' | 'center'>;
1746
- wordWrap?: boolean;
1747
- style?: {
1748
- head?: string[];
1749
- border?: string[];
1750
- };
1751
- colors?: boolean;
1752
- }) => {
1753
- push(row: unknown[]): void;
1754
- toString(): string;
1755
- };
1756
-
1757
1824
  if (!data || data.length === 0) {
1758
1825
  return options?.render ? '' : undefined;
1759
1826
  }
@@ -1764,14 +1831,11 @@ export function table<T extends Record<string, unknown>>(
1764
1831
  let columnNames: string[];
1765
1832
  let colAligns: Array<'left' | 'right' | 'center'>;
1766
1833
 
1767
- let headings: string[];
1768
-
1769
1834
  if (isAdvancedMode) {
1770
1835
  // Advanced mode: use provided column configurations
1771
1836
  const columnConfigs = columns as TableColumn[];
1772
1837
  columnNames = columnConfigs.map((col) => col.name);
1773
1838
  colAligns = columnConfigs.map((col) => col.alignment || 'left');
1774
- headings = columnNames.map((name) => heading(name));
1775
1839
  } else {
1776
1840
  // Simple mode: determine column names from data or columns parameter
1777
1841
  columnNames = columns
@@ -1780,31 +1844,59 @@ export function table<T extends Record<string, unknown>>(
1780
1844
  ? Object.keys(data[0])
1781
1845
  : [];
1782
1846
  colAligns = columnNames.map(() => 'left' as const);
1783
- headings = columnNames.map((name) => heading(name));
1784
1847
  }
1785
1848
 
1786
- const t = new Table({
1787
- head: headings,
1788
- colAligns,
1789
- wordWrap: true,
1790
- style: {
1791
- head: [], // Disable cli-table3's default red styling - we apply our own via heading()
1792
- border: [], // Disable default border styling too
1793
- },
1794
- colors: false, // Completely disable cli-table3's color system to preserve our ANSI codes
1795
- });
1849
+ // Determine layout mode
1850
+ const layout = options?.layout ?? 'auto';
1851
+ const termWidth = process.stdout.columns || 80;
1852
+ const tableWidth = calculateTableWidth(data, columnNames);
1853
+ const useVertical = layout === 'vertical' || (layout === 'auto' && tableWidth > termWidth);
1796
1854
 
1797
- // Add rows to table
1798
- for (const row of data) {
1799
- const rowData: unknown[] = [];
1800
- for (const colName of columnNames) {
1801
- const value = row[colName];
1802
- rowData.push(value !== undefined && value !== null ? String(value) : '');
1855
+ let output: string;
1856
+
1857
+ if (useVertical) {
1858
+ output = renderVerticalTable(data, columnNames);
1859
+ } else {
1860
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
1861
+ const Table = require('cli-table3') as new (options?: {
1862
+ head?: string[];
1863
+ colAligns?: Array<'left' | 'right' | 'center'>;
1864
+ wordWrap?: boolean;
1865
+ style?: {
1866
+ head?: string[];
1867
+ border?: string[];
1868
+ };
1869
+ colors?: boolean;
1870
+ }) => {
1871
+ push(row: unknown[]): void;
1872
+ toString(): string;
1873
+ };
1874
+
1875
+ const headings = columnNames.map((name) => heading(name));
1876
+
1877
+ const t = new Table({
1878
+ head: headings,
1879
+ colAligns,
1880
+ wordWrap: true,
1881
+ style: {
1882
+ head: [], // Disable cli-table3's default red styling - we apply our own via heading()
1883
+ border: [], // Disable default border styling too
1884
+ },
1885
+ colors: false, // Completely disable cli-table3's color system to preserve our ANSI codes
1886
+ });
1887
+
1888
+ // Add rows to table
1889
+ for (const row of data) {
1890
+ const rowData: unknown[] = [];
1891
+ for (const colName of columnNames) {
1892
+ const value = row[colName];
1893
+ rowData.push(value !== undefined && value !== null ? String(value) : '');
1894
+ }
1895
+ t.push(rowData);
1803
1896
  }
1804
- t.push(rowData);
1805
- }
1806
1897
 
1807
- const output = t.toString();
1898
+ output = t.toString();
1899
+ }
1808
1900
 
1809
1901
  if (options?.render) {
1810
1902
  return output;
package/src/types.ts CHANGED
@@ -34,6 +34,7 @@ export const ConfigSchema = zod.object({
34
34
  transport_url: zod.url().optional().describe('Override transport URL'),
35
35
  stream_url: zod.url().optional().describe('Override stream URL'),
36
36
  kv_url: zod.url().optional().describe('Override keyvalue URL'),
37
+ sandbox_url: zod.url().optional().describe('Override sandbox URL'),
37
38
  vector_url: zod.url().optional().describe('Override vector store URL'),
38
39
  catalyst_url: zod.url().optional().describe('Override catalyst URL'),
39
40
  ion_url: zod.url().optional().describe('Override ion URL'),
@@ -228,6 +229,7 @@ export interface CommandSchemas {
228
229
  args?: z.ZodType;
229
230
  options?: z.ZodType;
230
231
  response?: z.ZodType;
232
+ aliases?: Record<string, string[]>;
231
233
  }
232
234
 
233
235
  export type ProjectConfig = zod.infer<typeof ProjectSchema>;
@@ -377,18 +379,18 @@ export function createSubcommand<
377
379
  schema?: A extends z.ZodType
378
380
  ? Op extends z.ZodType
379
381
  ? Res extends z.ZodType
380
- ? { args: A; options: Op; response: Res }
381
- : { args: A; options: Op; response?: z.ZodType }
382
+ ? { args: A; options: Op; response: Res; aliases?: Record<string, string[]> }
383
+ : { args: A; options: Op; response?: z.ZodType; aliases?: Record<string, string[]> }
382
384
  : Res extends z.ZodType
383
- ? { args: A; response: Res }
384
- : { args: A; response?: z.ZodType }
385
+ ? { args: A; response: Res; aliases?: Record<string, string[]> }
386
+ : { args: A; response?: z.ZodType; aliases?: Record<string, string[]> }
385
387
  : Op extends z.ZodType
386
388
  ? Res extends z.ZodType
387
- ? { options: Op; response: Res }
388
- : { options: Op; response?: z.ZodType }
389
+ ? { options: Op; response: Res; aliases?: Record<string, string[]> }
390
+ : { options: Op; response?: z.ZodType; aliases?: Record<string, string[]> }
389
391
  : Res extends z.ZodType
390
- ? { response: Res }
391
- : { response?: z.ZodType };
392
+ ? { response: Res; aliases?: Record<string, string[]> }
393
+ : { response?: z.ZodType; aliases?: Record<string, string[]> };
392
394
  handler(
393
395
  ctx: CommandContext<R, O, A, Op>
394
396
  ): Res extends z.ZodType ? z.infer<Res> | Promise<z.infer<Res>> : unknown | Promise<unknown>;
@@ -422,18 +424,18 @@ export function createCommand<
422
424
  schema?: A extends z.ZodType
423
425
  ? Op extends z.ZodType
424
426
  ? Res extends z.ZodType
425
- ? { args: A; options: Op; response: Res }
426
- : { args: A; options: Op; response?: z.ZodType }
427
+ ? { args: A; options: Op; response: Res; aliases?: Record<string, string[]> }
428
+ : { args: A; options: Op; response?: z.ZodType; aliases?: Record<string, string[]> }
427
429
  : Res extends z.ZodType
428
- ? { args: A; response: Res }
429
- : { args: A; response?: z.ZodType }
430
+ ? { args: A; response: Res; aliases?: Record<string, string[]> }
431
+ : { args: A; response?: z.ZodType; aliases?: Record<string, string[]> }
430
432
  : Op extends z.ZodType
431
433
  ? Res extends z.ZodType
432
- ? { options: Op; response: Res }
433
- : { options: Op; response?: z.ZodType }
434
+ ? { options: Op; response: Res; aliases?: Record<string, string[]> }
435
+ : { options: Op; response?: z.ZodType; aliases?: Record<string, string[]> }
434
436
  : Res extends z.ZodType
435
- ? { response: Res }
436
- : { response?: z.ZodType };
437
+ ? { response: Res; aliases?: Record<string, string[]> }
438
+ : { response?: z.ZodType; aliases?: Record<string, string[]> };
437
439
  handler?(
438
440
  ctx: CommandContext<R, O, A, Op>
439
441
  ): Res extends z.ZodType ? z.infer<Res> | Promise<z.infer<Res>> : unknown | Promise<unknown>;