@agentuity/cli 0.1.14 → 0.1.15

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 (65) hide show
  1. package/dist/auth.d.ts.map +1 -1
  2. package/dist/auth.js +7 -6
  3. package/dist/auth.js.map +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +54 -10
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cmd/ai/index.d.ts.map +1 -1
  8. package/dist/cmd/ai/index.js +6 -1
  9. package/dist/cmd/ai/index.js.map +1 -1
  10. package/dist/cmd/ai/opencode/index.d.ts +3 -0
  11. package/dist/cmd/ai/opencode/index.d.ts.map +1 -0
  12. package/dist/cmd/ai/opencode/index.js +27 -0
  13. package/dist/cmd/ai/opencode/index.js.map +1 -0
  14. package/dist/cmd/ai/opencode/install.d.ts +3 -0
  15. package/dist/cmd/ai/opencode/install.d.ts.map +1 -0
  16. package/dist/cmd/ai/opencode/install.js +102 -0
  17. package/dist/cmd/ai/opencode/install.js.map +1 -0
  18. package/dist/cmd/ai/opencode/run.d.ts +3 -0
  19. package/dist/cmd/ai/opencode/run.d.ts.map +1 -0
  20. package/dist/cmd/ai/opencode/run.js +88 -0
  21. package/dist/cmd/ai/opencode/run.js.map +1 -0
  22. package/dist/cmd/ai/opencode/uninstall.d.ts +3 -0
  23. package/dist/cmd/ai/opencode/uninstall.d.ts.map +1 -0
  24. package/dist/cmd/ai/opencode/uninstall.js +82 -0
  25. package/dist/cmd/ai/opencode/uninstall.js.map +1 -0
  26. package/dist/cmd/build/vite/beacon-plugin.d.ts.map +1 -1
  27. package/dist/cmd/build/vite/beacon-plugin.js.map +1 -1
  28. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  29. package/dist/cmd/build/vite/vite-builder.js +1 -1
  30. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  31. package/dist/cmd/project/create.d.ts.map +1 -1
  32. package/dist/cmd/project/create.js +8 -2
  33. package/dist/cmd/project/create.js.map +1 -1
  34. package/dist/cmd/project/download.d.ts +3 -1
  35. package/dist/cmd/project/download.d.ts.map +1 -1
  36. package/dist/cmd/project/download.js +5 -0
  37. package/dist/cmd/project/download.js.map +1 -1
  38. package/dist/cmd/project/template-flow.d.ts +2 -0
  39. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  40. package/dist/cmd/project/template-flow.js +32 -12
  41. package/dist/cmd/project/template-flow.js.map +1 -1
  42. package/dist/tui/prompt.d.ts.map +1 -1
  43. package/dist/tui/prompt.js +7 -1
  44. package/dist/tui/prompt.js.map +1 -1
  45. package/dist/tui.d.ts.map +1 -1
  46. package/dist/tui.js +74 -21
  47. package/dist/tui.js.map +1 -1
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/types.js.map +1 -1
  50. package/package.json +7 -7
  51. package/src/auth.ts +7 -6
  52. package/src/cli.ts +70 -10
  53. package/src/cmd/ai/index.ts +6 -1
  54. package/src/cmd/ai/opencode/index.ts +28 -0
  55. package/src/cmd/ai/opencode/install.ts +120 -0
  56. package/src/cmd/ai/opencode/run.ts +103 -0
  57. package/src/cmd/ai/opencode/uninstall.ts +90 -0
  58. package/src/cmd/build/vite/beacon-plugin.ts +3 -1
  59. package/src/cmd/build/vite/vite-builder.ts +5 -1
  60. package/src/cmd/project/create.ts +9 -2
  61. package/src/cmd/project/download.ts +7 -1
  62. package/src/cmd/project/template-flow.ts +33 -12
  63. package/src/tui/prompt.ts +10 -3
  64. package/src/tui.ts +76 -22
  65. package/src/types.ts +1 -0
package/src/tui.ts CHANGED
@@ -247,7 +247,8 @@ export function getSeverityColor(severity: string): (text: string) => string {
247
247
  export function success(message: string): void {
248
248
  const color = getColor('success');
249
249
  const reset = getColor('reset');
250
- process.stderr.write(`${color}${ICONS.success} ${message}${reset}\n`);
250
+ // Clear line first to ensure no leftover content from previous output
251
+ process.stderr.write(`\r\x1b[2K${color}${ICONS.success} ${message}${reset}\n`);
251
252
  }
252
253
 
253
254
  /**
@@ -829,7 +830,11 @@ export function showLoggedOutMessage(appBaseUrl: string, hasProfile = false): vo
829
830
  // Padding needed: 46 - 17 - signupTitle.length - 1 (space before link) = 28 - signupTitle.length
830
831
  const paddingLength = 28 - signupTitle.length;
831
832
  const padding = ' '.repeat(paddingLength);
832
- const showNewLine = showInline ? '' : `║ ${RESET}${link(signupURL)}${YELLOW} ║`;
833
+ // When not showing inline hyperlink, show URL on separate line with proper padding
834
+ // Box format: "║ " + content + "║" = 48 chars total
835
+ // Content area = 46 chars, with leading space = 45 chars for URL + padding
836
+ const urlPadding = Math.max(0, 45 - signupURL.length);
837
+ const showNewLine = showInline ? '' : `║ ${RESET}${link(signupURL)}${YELLOW}${' '.repeat(urlPadding)}║`;
833
838
 
834
839
  const lines = [
835
840
  '╔══════════════════════════════════════════════╗',
@@ -844,6 +849,8 @@ export function showLoggedOutMessage(appBaseUrl: string, hasProfile = false): vo
844
849
 
845
850
  console.log('');
846
851
  lines.filter(Boolean).map((line) => console.log(YELLOW + line + RESET));
852
+ console.log('');
853
+ console.log('');
847
854
  }
848
855
 
849
856
  /**
@@ -1303,11 +1310,17 @@ export async function spinner<T>(
1303
1310
  // Stop animation
1304
1311
  clearInterval(interval);
1305
1312
 
1306
- // Move cursor to start of output, clear all lines
1313
+ // Move cursor to start of output, clear only our lines (not to end of screen)
1307
1314
  if (linesRendered > 0) {
1308
1315
  process.stderr.write(`\x1b[${linesRendered}A`);
1316
+ for (let i = 0; i < linesRendered; i++) {
1317
+ process.stderr.write('\x1b[2K'); // Clear entire line
1318
+ if (i < linesRendered - 1) {
1319
+ process.stderr.write('\x1b[B'); // Move down one line
1320
+ }
1321
+ }
1322
+ process.stderr.write(`\x1b[${linesRendered}A\r`); // Move back up
1309
1323
  }
1310
- process.stderr.write('\x1b[J'); // Clear from cursor to end of screen
1311
1324
  process.stderr.write('\x1B[?25h'); // Show cursor
1312
1325
 
1313
1326
  process.exit(130); // Standard exit code for SIGINT
@@ -1363,11 +1376,22 @@ export async function spinner<T>(
1363
1376
  // Stop animation first
1364
1377
  clearInterval(interval);
1365
1378
 
1366
- // Move cursor to start of output, clear all lines
1379
+ // Move cursor to start of output, clear only our lines (not to end of screen)
1367
1380
  if (linesRendered > 0) {
1368
1381
  process.stderr.write(`\x1b[${linesRendered}A`);
1382
+ for (let i = 0; i < linesRendered; i++) {
1383
+ process.stderr.write('\r\x1b[2K'); // Clear entire line
1384
+ if (i < linesRendered - 1) {
1385
+ process.stderr.write('\x1b[B'); // Move down one line
1386
+ }
1387
+ }
1388
+ // After loop, cursor is at last cleared line (linesRendered - 1 from start)
1389
+ // Move up (linesRendered - 1) to get back to start position
1390
+ if (linesRendered > 1) {
1391
+ process.stderr.write(`\x1b[${linesRendered - 1}A`);
1392
+ }
1393
+ process.stderr.write('\r');
1369
1394
  }
1370
- process.stderr.write('\x1b[J'); // Clear from cursor to end of screen
1371
1395
  process.stderr.write('\x1B[?25h'); // Show cursor
1372
1396
 
1373
1397
  // If clearOnSuccess is false, show success message
@@ -1384,11 +1408,22 @@ export async function spinner<T>(
1384
1408
  // Stop animation first
1385
1409
  clearInterval(interval);
1386
1410
 
1387
- // Move cursor to start of output, clear all lines
1411
+ // Move cursor to start of output, clear only our lines (not to end of screen)
1388
1412
  if (linesRendered > 0) {
1389
1413
  process.stderr.write(`\x1b[${linesRendered}A`);
1414
+ for (let i = 0; i < linesRendered; i++) {
1415
+ process.stderr.write('\r\x1b[2K'); // Clear entire line
1416
+ if (i < linesRendered - 1) {
1417
+ process.stderr.write('\x1b[B'); // Move down one line
1418
+ }
1419
+ }
1420
+ // After loop, cursor is at last cleared line (linesRendered - 1 from start)
1421
+ // Move up (linesRendered - 1) to get back to start position
1422
+ if (linesRendered > 1) {
1423
+ process.stderr.write(`\x1b[${linesRendered - 1}A`);
1424
+ }
1425
+ process.stderr.write('\r');
1390
1426
  }
1391
- process.stderr.write('\x1b[J'); // Clear from cursor to end of screen
1392
1427
  process.stderr.write('\x1B[?25h'); // Show cursor
1393
1428
 
1394
1429
  // Show error
@@ -1561,7 +1596,8 @@ export async function runCommand(options: CommandRunnerOptions): Promise<number>
1561
1596
 
1562
1597
  for (const line of lines) {
1563
1598
  if (line.trim()) {
1564
- allOutputLines.push(line);
1599
+ // Strip ANSI codes from command output to prevent cursor/display issues
1600
+ allOutputLines.push(stripAnsi(line));
1565
1601
  renderOutput(maxLinesOutput); // Show last N lines while streaming
1566
1602
  }
1567
1603
  }
@@ -1582,25 +1618,44 @@ export async function runCommand(options: CommandRunnerOptions): Promise<number>
1582
1618
  if (linesRendered > 0) {
1583
1619
  // Move up to the command line
1584
1620
  process.stdout.write(`\x1b[${linesRendered}A`);
1585
- // Clear each line (entire line) and move cursor back up
1621
+ // Clear each line (entire line)
1586
1622
  for (let i = 0; i < linesRendered; i++) {
1587
- process.stdout.write('\x1b[2K'); // Clear entire line
1623
+ process.stdout.write('\r\x1b[2K'); // Clear entire line
1588
1624
  if (i < linesRendered - 1) {
1589
1625
  process.stdout.write('\x1b[B'); // Move down one line
1590
1626
  }
1591
1627
  }
1592
- // Move cursor back up to original position
1593
- process.stdout.write(`\x1b[${linesRendered}A\r`);
1628
+ // After loop, cursor is at last cleared line (linesRendered - 1 from start)
1629
+ // Move up (linesRendered - 1) to get back to start position
1630
+ if (linesRendered > 1) {
1631
+ process.stdout.write(`\x1b[${linesRendered - 1}A`);
1632
+ }
1633
+ process.stdout.write('\r');
1594
1634
  }
1595
1635
  return exitCode;
1596
1636
  }
1597
1637
 
1598
- // Clear all rendered lines completely
1638
+ // Determine how many lines to show in final output
1639
+ const finalLinesToShow = exitCode === 0 ? maxLinesOutput : maxLinesOnFailure;
1640
+ const finalOutputLines = allOutputLines.slice(-finalLinesToShow);
1641
+
1642
+ // Clear all rendered lines completely (only our lines, not previous output)
1599
1643
  if (linesRendered > 0) {
1600
1644
  // Move up to the command line (first line of our output)
1601
1645
  process.stdout.write(`\x1b[${linesRendered}A`);
1602
- // Move to beginning of line and clear from cursor to end of screen
1603
- process.stdout.write('\r\x1b[J');
1646
+ // Clear the lines we rendered during streaming
1647
+ for (let i = 0; i < linesRendered; i++) {
1648
+ process.stdout.write('\r\x1b[2K'); // Clear entire line
1649
+ if (i < linesRendered - 1) {
1650
+ process.stdout.write('\x1b[B'); // Move down one line
1651
+ }
1652
+ }
1653
+ // After loop, cursor is at last cleared line (linesRendered - 1 from start)
1654
+ // Move up (linesRendered - 1) to get back to start position
1655
+ if (linesRendered > 1) {
1656
+ process.stdout.write(`\x1b[${linesRendered - 1}A`);
1657
+ }
1658
+ process.stdout.write('\r');
1604
1659
  }
1605
1660
 
1606
1661
  // Determine icon based on exit code
@@ -1612,19 +1667,18 @@ export async function runCommand(options: CommandRunnerOptions): Promise<number>
1612
1667
  `\r\x1b[K${statusColor}${icon}${reset} ${cmdColor}${displayCmd}${reset}\n`
1613
1668
  );
1614
1669
 
1615
- // Determine how many lines to show in final output
1616
- const finalLinesToShow = exitCode === 0 ? maxLinesOutput : maxLinesOnFailure;
1617
-
1618
- // Show final output lines
1619
- const finalOutputLines = allOutputLines.slice(-finalLinesToShow);
1670
+ // Show final output lines (clearing each line first in case we're using more lines than before)
1620
1671
  for (const line of finalOutputLines) {
1621
1672
  const displayLine =
1622
1673
  truncate && getDisplayWidth(line) > maxLineWidth
1623
1674
  ? truncateToWidth(line, maxLineWidth)
1624
1675
  : line;
1625
- process.stdout.write(`\r\x1b[K${mutedColor}${displayLine}${reset}\n`);
1676
+ process.stdout.write(`\x1b[2K${mutedColor}${displayLine}${reset}\n`);
1626
1677
  }
1627
1678
 
1679
+ // If we're showing more lines than we had before, the extra lines may contain old content
1680
+ // We've already written over them, so they're clean now
1681
+
1628
1682
  return exitCode;
1629
1683
  } catch (err) {
1630
1684
  // Move cursor up to clear our UI
package/src/types.ts CHANGED
@@ -62,6 +62,7 @@ export const ConfigSchema = zod.object({
62
62
  })
63
63
  .optional()
64
64
  .describe('the gravity client information'),
65
+
65
66
  });
66
67
 
67
68
  export type Config = zod.infer<typeof ConfigSchema>;