@agentuity/cli 0.1.41 → 0.1.42

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 (230) hide show
  1. package/dist/agent-detection.d.ts.map +1 -1
  2. package/dist/agent-detection.js +8 -2
  3. package/dist/agent-detection.js.map +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +9 -5
  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 +1 -8
  9. package/dist/cmd/ai/index.js.map +1 -1
  10. package/dist/cmd/ai/prompt/version.js +1 -1
  11. package/dist/cmd/ai/prompt/version.js.map +1 -1
  12. package/dist/cmd/auth/api.d.ts.map +1 -1
  13. package/dist/cmd/auth/api.js +4 -1
  14. package/dist/cmd/auth/api.js.map +1 -1
  15. package/dist/cmd/auth/ssh/api.js +2 -2
  16. package/dist/cmd/auth/ssh/api.js.map +1 -1
  17. package/dist/cmd/build/ast.d.ts.map +1 -1
  18. package/dist/cmd/build/ast.js +14 -13
  19. package/dist/cmd/build/ast.js.map +1 -1
  20. package/dist/cmd/build/patch/index.d.ts.map +1 -1
  21. package/dist/cmd/build/patch/index.js +3 -0
  22. package/dist/cmd/build/patch/index.js.map +1 -1
  23. package/dist/cmd/build/vite/index.d.ts +1 -0
  24. package/dist/cmd/build/vite/index.d.ts.map +1 -1
  25. package/dist/cmd/build/vite/index.js +1 -0
  26. package/dist/cmd/build/vite/index.js.map +1 -1
  27. package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +34 -0
  28. package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -0
  29. package/dist/cmd/build/vite/public-asset-path-plugin.js +107 -0
  30. package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -0
  31. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  32. package/dist/cmd/build/vite/registry-generator.js +14 -5
  33. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  34. package/dist/cmd/build/vite/route-discovery.js +1 -1
  35. package/dist/cmd/build/vite/route-discovery.js.map +1 -1
  36. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
  37. package/dist/cmd/build/vite/vite-asset-server-config.js +11 -2
  38. package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
  39. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  40. package/dist/cmd/build/vite/vite-builder.js +3 -0
  41. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  42. package/dist/cmd/canary/index.d.ts.map +1 -1
  43. package/dist/cmd/canary/index.js +9 -1
  44. package/dist/cmd/canary/index.js.map +1 -1
  45. package/dist/cmd/cloud/db/create.d.ts.map +1 -1
  46. package/dist/cmd/cloud/db/create.js +2 -2
  47. package/dist/cmd/cloud/db/create.js.map +1 -1
  48. package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
  49. package/dist/cmd/cloud/db/delete.js +2 -2
  50. package/dist/cmd/cloud/db/delete.js.map +1 -1
  51. package/dist/cmd/cloud/env/import.d.ts.map +1 -1
  52. package/dist/cmd/cloud/env/import.js +4 -1
  53. package/dist/cmd/cloud/env/import.js.map +1 -1
  54. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  55. package/dist/cmd/cloud/env/list.js +4 -1
  56. package/dist/cmd/cloud/env/list.js.map +1 -1
  57. package/dist/cmd/cloud/env/push.d.ts.map +1 -1
  58. package/dist/cmd/cloud/env/push.js +4 -1
  59. package/dist/cmd/cloud/env/push.js.map +1 -1
  60. package/dist/cmd/cloud/region/index.js +1 -1
  61. package/dist/cmd/cloud/region/index.js.map +1 -1
  62. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
  63. package/dist/cmd/cloud/sandbox/snapshot/build.js +22 -10
  64. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  65. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  66. package/dist/cmd/cloud/sandbox/snapshot/get.js +12 -2
  67. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  68. package/dist/cmd/cloud/storage/create.d.ts.map +1 -1
  69. package/dist/cmd/cloud/storage/create.js +2 -2
  70. package/dist/cmd/cloud/storage/create.js.map +1 -1
  71. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
  72. package/dist/cmd/cloud/storage/delete.js +2 -2
  73. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  74. package/dist/cmd/dev/download.d.ts.map +1 -1
  75. package/dist/cmd/dev/download.js +9 -2
  76. package/dist/cmd/dev/download.js.map +1 -1
  77. package/dist/cmd/dev/index.js +1 -1
  78. package/dist/cmd/dev/index.js.map +1 -1
  79. package/dist/cmd/git/account/add.d.ts.map +1 -1
  80. package/dist/cmd/git/account/add.js +4 -3
  81. package/dist/cmd/git/account/add.js.map +1 -1
  82. package/dist/cmd/git/link.js +2 -2
  83. package/dist/cmd/git/link.js.map +1 -1
  84. package/dist/cmd/git/list.d.ts.map +1 -1
  85. package/dist/cmd/git/list.js +3 -2
  86. package/dist/cmd/git/list.js.map +1 -1
  87. package/dist/cmd/project/auth/init.js +1 -1
  88. package/dist/cmd/project/auth/init.js.map +1 -1
  89. package/dist/cmd/project/auth/shared.d.ts.map +1 -1
  90. package/dist/cmd/project/auth/shared.js +8 -3
  91. package/dist/cmd/project/auth/shared.js.map +1 -1
  92. package/dist/cmd/project/delete.d.ts.map +1 -1
  93. package/dist/cmd/project/delete.js +3 -2
  94. package/dist/cmd/project/delete.js.map +1 -1
  95. package/dist/cmd/project/reconcile.d.ts.map +1 -1
  96. package/dist/cmd/project/reconcile.js +9 -5
  97. package/dist/cmd/project/reconcile.js.map +1 -1
  98. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  99. package/dist/cmd/project/template-flow.js +15 -5
  100. package/dist/cmd/project/template-flow.js.map +1 -1
  101. package/dist/config.d.ts.map +1 -1
  102. package/dist/config.js +3 -2
  103. package/dist/config.js.map +1 -1
  104. package/dist/domain.d.ts.map +1 -1
  105. package/dist/domain.js +4 -3
  106. package/dist/domain.js.map +1 -1
  107. package/dist/internal-logger.d.ts.map +1 -1
  108. package/dist/internal-logger.js +3 -2
  109. package/dist/internal-logger.js.map +1 -1
  110. package/dist/repl.d.ts.map +1 -1
  111. package/dist/repl.js +31 -14
  112. package/dist/repl.js.map +1 -1
  113. package/dist/schema-parser.d.ts.map +1 -1
  114. package/dist/schema-parser.js +4 -1
  115. package/dist/schema-parser.js.map +1 -1
  116. package/dist/sound.d.ts.map +1 -1
  117. package/dist/sound.js +2 -1
  118. package/dist/sound.js.map +1 -1
  119. package/dist/steps.d.ts.map +1 -1
  120. package/dist/steps.js +13 -6
  121. package/dist/steps.js.map +1 -1
  122. package/dist/terminal.js +2 -0
  123. package/dist/terminal.js.map +1 -1
  124. package/dist/tsc-output-parser.d.ts +3 -0
  125. package/dist/tsc-output-parser.d.ts.map +1 -1
  126. package/dist/tsc-output-parser.js +32 -9
  127. package/dist/tsc-output-parser.js.map +1 -1
  128. package/dist/tui/prompt.d.ts.map +1 -1
  129. package/dist/tui/prompt.js +6 -2
  130. package/dist/tui/prompt.js.map +1 -1
  131. package/dist/tui.d.ts.map +1 -1
  132. package/dist/tui.js +26 -15
  133. package/dist/tui.js.map +1 -1
  134. package/dist/typescript-errors.d.ts.map +1 -1
  135. package/dist/typescript-errors.js +5 -2
  136. package/dist/typescript-errors.js.map +1 -1
  137. package/dist/utils/date.d.ts.map +1 -1
  138. package/dist/utils/date.js +5 -1
  139. package/dist/utils/date.js.map +1 -1
  140. package/dist/utils/deps.d.ts.map +1 -1
  141. package/dist/utils/deps.js +5 -3
  142. package/dist/utils/deps.js.map +1 -1
  143. package/dist/utils/detectSubagent.js +1 -1
  144. package/dist/utils/detectSubagent.js.map +1 -1
  145. package/package.json +6 -6
  146. package/src/agent-detection.ts +9 -2
  147. package/src/cli.ts +9 -5
  148. package/src/cmd/ai/index.ts +1 -8
  149. package/src/cmd/ai/prompt/version.ts +1 -1
  150. package/src/cmd/auth/api.ts +4 -1
  151. package/src/cmd/auth/ssh/api.ts +2 -2
  152. package/src/cmd/build/ast.ts +14 -13
  153. package/src/cmd/build/patch/index.ts +3 -0
  154. package/src/cmd/build/vite/index.ts +1 -0
  155. package/src/cmd/build/vite/public-asset-path-plugin.ts +137 -0
  156. package/src/cmd/build/vite/registry-generator.ts +14 -5
  157. package/src/cmd/build/vite/route-discovery.ts +1 -1
  158. package/src/cmd/build/vite/vite-asset-server-config.ts +13 -4
  159. package/src/cmd/build/vite/vite-builder.ts +3 -0
  160. package/src/cmd/canary/index.ts +9 -1
  161. package/src/cmd/cloud/db/create.ts +16 -17
  162. package/src/cmd/cloud/db/delete.ts +19 -20
  163. package/src/cmd/cloud/env/import.ts +6 -3
  164. package/src/cmd/cloud/env/list.ts +11 -9
  165. package/src/cmd/cloud/env/push.ts +6 -3
  166. package/src/cmd/cloud/region/index.ts +3 -3
  167. package/src/cmd/cloud/sandbox/snapshot/build.ts +42 -33
  168. package/src/cmd/cloud/sandbox/snapshot/get.ts +21 -15
  169. package/src/cmd/cloud/storage/create.ts +16 -17
  170. package/src/cmd/cloud/storage/delete.ts +19 -20
  171. package/src/cmd/dev/download.ts +10 -2
  172. package/src/cmd/dev/index.ts +4 -4
  173. package/src/cmd/git/account/add.ts +5 -4
  174. package/src/cmd/git/link.ts +2 -2
  175. package/src/cmd/git/list.ts +7 -6
  176. package/src/cmd/project/auth/init.ts +6 -6
  177. package/src/cmd/project/auth/shared.ts +8 -3
  178. package/src/cmd/project/delete.ts +3 -2
  179. package/src/cmd/project/reconcile.ts +9 -5
  180. package/src/cmd/project/template-flow.ts +15 -5
  181. package/src/config.ts +3 -2
  182. package/src/domain.ts +4 -3
  183. package/src/internal-logger.ts +3 -2
  184. package/src/repl.ts +27 -14
  185. package/src/schema-parser.ts +4 -1
  186. package/src/sound.ts +2 -1
  187. package/src/steps.ts +11 -6
  188. package/src/terminal.ts +2 -1
  189. package/src/tsc-output-parser.ts +61 -38
  190. package/src/tui/prompt.ts +6 -2
  191. package/src/tui.ts +26 -17
  192. package/src/typescript-errors.ts +5 -2
  193. package/src/utils/date.ts +5 -1
  194. package/src/utils/deps.ts +5 -3
  195. package/src/utils/detectSubagent.ts +1 -1
  196. package/dist/cmd/ai/cadence/index.d.ts +0 -3
  197. package/dist/cmd/ai/cadence/index.d.ts.map +0 -1
  198. package/dist/cmd/ai/cadence/index.js +0 -35
  199. package/dist/cmd/ai/cadence/index.js.map +0 -1
  200. package/dist/cmd/ai/cadence/list.d.ts +0 -3
  201. package/dist/cmd/ai/cadence/list.d.ts.map +0 -1
  202. package/dist/cmd/ai/cadence/list.js +0 -167
  203. package/dist/cmd/ai/cadence/list.js.map +0 -1
  204. package/dist/cmd/ai/cadence/pause.d.ts +0 -3
  205. package/dist/cmd/ai/cadence/pause.d.ts.map +0 -1
  206. package/dist/cmd/ai/cadence/pause.js +0 -103
  207. package/dist/cmd/ai/cadence/pause.js.map +0 -1
  208. package/dist/cmd/ai/cadence/resume.d.ts +0 -3
  209. package/dist/cmd/ai/cadence/resume.d.ts.map +0 -1
  210. package/dist/cmd/ai/cadence/resume.js +0 -106
  211. package/dist/cmd/ai/cadence/resume.js.map +0 -1
  212. package/dist/cmd/ai/cadence/status.d.ts +0 -3
  213. package/dist/cmd/ai/cadence/status.d.ts.map +0 -1
  214. package/dist/cmd/ai/cadence/status.js +0 -129
  215. package/dist/cmd/ai/cadence/status.js.map +0 -1
  216. package/dist/cmd/ai/cadence/stop.d.ts +0 -3
  217. package/dist/cmd/ai/cadence/stop.d.ts.map +0 -1
  218. package/dist/cmd/ai/cadence/stop.js +0 -107
  219. package/dist/cmd/ai/cadence/stop.js.map +0 -1
  220. package/dist/cmd/ai/cadence/util.d.ts +0 -44
  221. package/dist/cmd/ai/cadence/util.d.ts.map +0 -1
  222. package/dist/cmd/ai/cadence/util.js +0 -52
  223. package/dist/cmd/ai/cadence/util.js.map +0 -1
  224. package/src/cmd/ai/cadence/index.ts +0 -36
  225. package/src/cmd/ai/cadence/list.ts +0 -183
  226. package/src/cmd/ai/cadence/pause.ts +0 -119
  227. package/src/cmd/ai/cadence/resume.ts +0 -124
  228. package/src/cmd/ai/cadence/status.ts +0 -141
  229. package/src/cmd/ai/cadence/stop.ts +0 -124
  230. package/src/cmd/ai/cadence/util.ts +0 -86
package/src/steps.ts CHANGED
@@ -177,6 +177,7 @@ function renderAllSteps(
177
177
 
178
178
  for (let i = 0; i < state.length; i++) {
179
179
  const step = state[i];
180
+ if (step === undefined) continue;
180
181
  const isRunning = i === runningStepIndex;
181
182
  const stepSpinner = isRunning && spinner ? spinner : undefined;
182
183
 
@@ -384,9 +385,10 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
384
385
  const forceRerender = (skipMove = false) => {
385
386
  if (currentStepIndex < 0 || currentStepIndex >= state.length) return;
386
387
 
387
- const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
388
+ const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
388
389
  const color = getColor(colorKey);
389
- const spinner = `${color}${COLORS.bold}${FRAMES[currentFrameIndex % FRAMES.length]}${COLORS.reset}`;
390
+ const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
391
+ const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
390
392
  const rendered = renderAllSteps(state, currentStepIndex, spinner);
391
393
 
392
394
  // Optionally move up, then to column 0
@@ -421,15 +423,17 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
421
423
 
422
424
  const step = steps[stepIndex];
423
425
  const stepState = state[stepIndex];
426
+ if (step === undefined || stepState === undefined) continue;
424
427
  stepState.status = 'running';
425
428
 
426
429
  // Start spinner animation
427
430
  activeInterval = setInterval(() => {
428
431
  if (isPaused) return;
429
432
 
430
- const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
433
+ const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
431
434
  const color = getColor(colorKey);
432
- const spinner = `${color}${COLORS.bold}${FRAMES[currentFrameIndex % FRAMES.length]}${COLORS.reset}`;
435
+ const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
436
+ const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
433
437
 
434
438
  // Render all steps from state
435
439
  const rendered = renderAllSteps(state, currentStepIndex, spinner);
@@ -453,9 +457,10 @@ async function runStepsTUI(steps: Step[]): Promise<void> {
453
457
  stepState.progress = Math.min(100, Math.max(0, progress));
454
458
 
455
459
  // Render all steps from state
456
- const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length];
460
+ const colorKey = SPINNER_COLORS[currentFrameIndex % SPINNER_COLORS.length] ?? 'cyan';
457
461
  const color = getColor(colorKey);
458
- const spinner = `${color}${COLORS.bold}${FRAMES[currentFrameIndex % FRAMES.length]}${COLORS.reset}`;
462
+ const frame = FRAMES[currentFrameIndex % FRAMES.length] ?? FRAMES[0] ?? '◐';
463
+ const spinner = `${color}${COLORS.bold}${frame}${COLORS.reset}`;
459
464
  const rendered = renderAllSteps(state, currentStepIndex, spinner);
460
465
 
461
466
  // Move to start, clear, render
package/src/terminal.ts CHANGED
@@ -99,7 +99,8 @@ async function queryTerminalBackground(): Promise<RGBColor | null> {
99
99
 
100
100
  // Parse RGB values - they can be different bit depths
101
101
  // Normalize to 8-bit (0-255) by taking the most significant bits
102
- const parseColorValue = (hex: string): number => {
102
+ const parseColorValue = (hex: string | undefined): number => {
103
+ if (!hex) return 0;
103
104
  if (hex.length === 4) {
104
105
  // 16-bit: RRRR -> take first 2 chars
105
106
  return parseInt(hex.slice(0, 2), 16);
@@ -1,3 +1,5 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
1
3
  /**
2
4
  * TSC Output Parser
3
5
  *
@@ -12,6 +14,9 @@
12
14
  *
13
15
  * Generated by PEG.js v. 0.10.0 (ts-pegjs plugin v. 0.2.7)
14
16
  * https://pegjs.org/ https://github.com/metadevpro/ts-pegjs
17
+ *
18
+ * NOTE: This file is auto-generated. Do not edit manually.
19
+ * TypeScript and ESLint checks are disabled for this file.
15
20
  */
16
21
 
17
22
  export interface GrammarPath {
@@ -158,8 +163,10 @@ class SyntaxError extends Error {
158
163
 
159
164
  if (descriptions.length > 0) {
160
165
  for (i = 1, j = 1; i < descriptions.length; i++) {
161
- if (descriptions[i - 1] !== descriptions[i]) {
162
- descriptions[j] = descriptions[i];
166
+ const prevDesc = descriptions[i - 1];
167
+ const currDesc = descriptions[i];
168
+ if (prevDesc !== currDesc && currDesc !== undefined) {
169
+ descriptions[j] = currDesc;
163
170
  j++;
164
171
  }
165
172
  }
@@ -168,14 +175,14 @@ class SyntaxError extends Error {
168
175
 
169
176
  switch (descriptions.length) {
170
177
  case 1:
171
- return descriptions[0];
178
+ return descriptions[0] ?? '';
172
179
  case 2:
173
- return descriptions[0] + ' or ' + descriptions[1];
180
+ return (descriptions[0] ?? '') + ' or ' + (descriptions[1] ?? '');
174
181
  default:
175
182
  return (
176
183
  descriptions.slice(0, -1).join(', ') +
177
184
  ', or ' +
178
- descriptions[descriptions.length - 1]
185
+ (descriptions[descriptions.length - 1] ?? '')
179
186
  );
180
187
  }
181
188
  }
@@ -187,11 +194,11 @@ class SyntaxError extends Error {
187
194
  return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.';
188
195
  }
189
196
 
190
- public message: string;
197
+ public override message: string;
191
198
  public expected: Expectation[];
192
199
  public found: string | null;
193
200
  public location: IFileRange;
194
- public name: string;
201
+ public override name: string;
195
202
 
196
203
  constructor(
197
204
  message: string,
@@ -342,7 +349,10 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
342
349
  if (!(options.startRule in peg$startRuleFunctions)) {
343
350
  throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
344
351
  }
345
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
352
+ const startFn = peg$startRuleFunctions[options.startRule];
353
+ if (startFn) {
354
+ peg$startRuleFunction = startFn;
355
+ }
346
356
  }
347
357
 
348
358
  function peg$literalExpectation(text1: string, ignoreCase: boolean): ILiteralExpectation {
@@ -363,7 +373,7 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
363
373
 
364
374
  function peg$computePosDetails(pos: number) {
365
375
  let details = peg$posDetailsCache[pos];
366
- let p;
376
+ let p: number;
367
377
 
368
378
  if (details) {
369
379
  return details;
@@ -373,10 +383,10 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
373
383
  p--;
374
384
  }
375
385
 
376
- details = peg$posDetailsCache[p];
386
+ const cachedDetails = peg$posDetailsCache[p];
377
387
  details = {
378
- line: details.line,
379
- column: details.column,
388
+ line: cachedDetails?.line ?? 1,
389
+ column: cachedDetails?.column ?? 1,
380
390
  };
381
391
 
382
392
  while (p < pos) {
@@ -440,10 +450,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
440
450
  }
441
451
 
442
452
  function peg$parseMain(): unknown {
443
- let s0, s1, s2, s3;
453
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
454
+ let s0: any, s1: any, s2: any, s3: any;
444
455
 
445
456
  const key = peg$currPos * 13 + 0;
446
- const cached: ICached = peg$resultsCache[key];
457
+ const cached: ICached | undefined = peg$resultsCache[key];
447
458
 
448
459
  if (cached) {
449
460
  peg$currPos = cached.nextPos;
@@ -484,10 +495,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
484
495
  }
485
496
 
486
497
  function peg$parseItem(): unknown {
487
- let s0, s1, s2, s3, s4, s5, s6, s7, s8;
498
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
499
+ let s0: any, s1: any, s2: any, s3: any, s4: any, s5: any, s6: any, s7: any, s8: any;
488
500
 
489
501
  const key = peg$currPos * 13 + 1;
490
- const cached: ICached = peg$resultsCache[key];
502
+ const cached: ICached | undefined = peg$resultsCache[key];
491
503
 
492
504
  if (cached) {
493
505
  peg$currPos = cached.nextPos;
@@ -569,10 +581,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
569
581
  }
570
582
 
571
583
  function peg$parseMessage(): unknown {
572
- let s0, s1, s2, s3;
584
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
585
+ let s0: any, s1: any, s2: any, s3: any;
573
586
 
574
587
  const key = peg$currPos * 13 + 2;
575
- const cached: ICached = peg$resultsCache[key];
588
+ const cached: ICached | undefined = peg$resultsCache[key];
576
589
 
577
590
  if (cached) {
578
591
  peg$currPos = cached.nextPos;
@@ -607,10 +620,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
607
620
  }
608
621
 
609
622
  function peg$parseMessageExtraLine(): unknown {
610
- let s0, s1, s2;
623
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
624
+ let s0: any, s1: any, s2: any;
611
625
 
612
626
  const key = peg$currPos * 13 + 3;
613
- const cached: ICached = peg$resultsCache[key];
627
+ const cached: ICached | undefined = peg$resultsCache[key];
614
628
 
615
629
  if (cached) {
616
630
  peg$currPos = cached.nextPos;
@@ -640,10 +654,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
640
654
  }
641
655
 
642
656
  function peg$parseMessageExtraLineStart(): unknown {
643
- let s0, s1;
657
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
658
+ let s0: any, s1: any;
644
659
 
645
660
  const key = peg$currPos * 13 + 4;
646
- const cached: ICached = peg$resultsCache[key];
661
+ const cached: ICached | undefined = peg$resultsCache[key];
647
662
 
648
663
  if (cached) {
649
664
  peg$currPos = cached.nextPos;
@@ -672,10 +687,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
672
687
  }
673
688
 
674
689
  function peg$parseTsError(): unknown {
675
- let s0, s1, s2, s3;
690
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
691
+ let s0: any, s1: any, s2: any, s3: any;
676
692
 
677
693
  const key = peg$currPos * 13 + 5;
678
- const cached: ICached = peg$resultsCache[key];
694
+ const cached: ICached | undefined = peg$resultsCache[key];
679
695
 
680
696
  if (cached) {
681
697
  peg$currPos = cached.nextPos;
@@ -719,10 +735,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
719
735
  }
720
736
 
721
737
  function peg$parseTsErrorType(): unknown {
722
- let s0, s1;
738
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
739
+ let s0: any, s1: any;
723
740
 
724
741
  const key = peg$currPos * 13 + 6;
725
- const cached: ICached = peg$resultsCache[key];
742
+ const cached: ICached | undefined = peg$resultsCache[key];
726
743
 
727
744
  if (cached) {
728
745
  peg$currPos = cached.nextPos;
@@ -762,10 +779,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
762
779
  }
763
780
 
764
781
  function peg$parseCursor(): unknown {
765
- let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
782
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
783
+ let s0: any, s1: any, s2: any, s3: any, s4: any, s5: any, s6: any, s7: any, s8: any, s9: any;
766
784
 
767
785
  const key = peg$currPos * 13 + 7;
768
- const cached: ICached = peg$resultsCache[key];
786
+ const cached: ICached | undefined = peg$resultsCache[key];
769
787
 
770
788
  if (cached) {
771
789
  peg$currPos = cached.nextPos;
@@ -861,10 +879,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
861
879
  }
862
880
 
863
881
  function peg$parsePath(): unknown {
864
- let s0, s1, s2;
882
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
883
+ let s0: any, s1: any, s2: any;
865
884
 
866
885
  const key = peg$currPos * 13 + 8;
867
- const cached: ICached = peg$resultsCache[key];
886
+ const cached: ICached | undefined = peg$resultsCache[key];
868
887
 
869
888
  if (cached) {
870
889
  peg$currPos = cached.nextPos;
@@ -910,10 +929,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
910
929
  }
911
930
 
912
931
  function peg$parseTextLine(): unknown {
913
- let s0, s1, s2, s3;
932
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
933
+ let s0: any, s1: any, s2: any, s3: any;
914
934
 
915
935
  const key = peg$currPos * 13 + 9;
916
- const cached: ICached = peg$resultsCache[key];
936
+ const cached: ICached | undefined = peg$resultsCache[key];
917
937
 
918
938
  if (cached) {
919
939
  peg$currPos = cached.nextPos;
@@ -973,10 +993,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
973
993
  }
974
994
 
975
995
  function peg$parseAnyCharExceptNewLine(): unknown {
976
- let s0;
996
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
997
+ let s0: any;
977
998
 
978
999
  const key = peg$currPos * 13 + 10;
979
- const cached: ICached = peg$resultsCache[key];
1000
+ const cached: ICached | undefined = peg$resultsCache[key];
980
1001
 
981
1002
  if (cached) {
982
1003
  peg$currPos = cached.nextPos;
@@ -999,10 +1020,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
999
1020
  }
1000
1021
 
1001
1022
  function peg$parseInteger(): unknown {
1002
- let s0, s1, s2;
1023
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1024
+ let s0: any, s1: any, s2: any;
1003
1025
 
1004
1026
  const key = peg$currPos * 13 + 11;
1005
- const cached: ICached = peg$resultsCache[key];
1027
+ const cached: ICached | undefined = peg$resultsCache[key];
1006
1028
 
1007
1029
  if (cached) {
1008
1030
  peg$currPos = cached.nextPos;
@@ -1048,10 +1070,11 @@ function peg$parse(input: string, options?: IParseOptions): GrammarItem[] {
1048
1070
  }
1049
1071
 
1050
1072
  function peg$parse_(): unknown {
1051
- let s0, s1, s2;
1073
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1074
+ let s0: any, s1: any, s2: any;
1052
1075
 
1053
1076
  const key = peg$currPos * 13 + 12;
1054
- const cached: ICached = peg$resultsCache[key];
1077
+ const cached: ICached | undefined = peg$resultsCache[key];
1055
1078
 
1056
1079
  if (cached) {
1057
1080
  peg$currPos = cached.nextPos;
package/src/tui/prompt.ts CHANGED
@@ -347,6 +347,10 @@ export class PromptFlow {
347
347
  } else if (key.name === 'return') {
348
348
  cleanup();
349
349
  const selected = choices[selectedIndex];
350
+ if (!selected) {
351
+ reject(new Error('No selection available'));
352
+ return;
353
+ }
350
354
 
351
355
  // Clear all lines (message + all choices)
352
356
  const totalLines = choices.length + 1;
@@ -462,8 +466,8 @@ export class PromptFlow {
462
466
 
463
467
  // Sort indices to get consistent order for both values and labels
464
468
  const sortedIndices = Array.from(selected).sort((a, b) => a - b);
465
- const values = sortedIndices.map((i) => choices[i].value);
466
- const labels = sortedIndices.map((i) => choices[i].label);
469
+ const values = sortedIndices.map((i) => choices[i]?.value).filter((v) => v !== undefined);
470
+ const labels = sortedIndices.map((i) => choices[i]?.label).filter((l) => l !== undefined);
467
471
 
468
472
  // Clear all lines (message + all choices)
469
473
  const totalLines = choices.length + 1;
package/src/tui.ts CHANGED
@@ -485,7 +485,9 @@ export function truncateToWidth(str: string, maxWidth: number, ellipsis = '...')
485
485
  const targetWidth = maxWidth - ellipsis.length;
486
486
 
487
487
  for (let i = 0; i < segments.length; i++) {
488
- const segment = segments[i].segment;
488
+ const seg = segments[i];
489
+ if (!seg) continue;
490
+ const segment = seg.segment;
489
491
  const segmentWidth = Bun.stringWidth(segment);
490
492
 
491
493
  if (currentWidth + segmentWidth > targetWidth) {
@@ -493,7 +495,7 @@ export function truncateToWidth(str: string, maxWidth: number, ellipsis = '...')
493
495
  }
494
496
 
495
497
  currentWidth += segmentWidth;
496
- cutIndex = segments[i].index + segment.length;
498
+ cutIndex = seg.index + segment.length;
497
499
  }
498
500
 
499
501
  // Now reconstruct with ANSI codes preserved
@@ -1027,8 +1029,9 @@ export function wrapText(text: string, maxWidth: number): string[] {
1027
1029
  // ensure each wrapped line ends with reset (only for this paragraph's lines)
1028
1030
  if (leadingCodes && hasReset) {
1029
1031
  for (let i = paragraphStart; i < allLines.length; i++) {
1030
- if (!endsWithReset(allLines[i])) {
1031
- allLines[i] += getColor('reset');
1032
+ const line = allLines[i];
1033
+ if (line !== undefined && !endsWithReset(line)) {
1034
+ allLines[i] = line + getColor('reset');
1032
1035
  }
1033
1036
  }
1034
1037
  }
@@ -1252,9 +1255,9 @@ export async function spinner<T>(
1252
1255
  process.stderr.write(`\x1b[${linesRendered}A`);
1253
1256
  }
1254
1257
 
1255
- const colorDef = spinnerColors[frameIndex % spinnerColors.length];
1256
- const color = colorDef[currentColorScheme];
1257
- const frame = `${color}${bold}${frames[frameIndex % frames.length]}${reset}`;
1258
+ const colorDef = spinnerColors[frameIndex % spinnerColors.length] ?? spinnerColors[0];
1259
+ const color = colorDef?.[currentColorScheme] ?? '';
1260
+ const frame = `${color}${bold}${frames[frameIndex % frames.length] ?? ''}${reset}`;
1258
1261
 
1259
1262
  // Add progress indicator or countdown timer if available
1260
1263
  let indicator = '';
@@ -1780,7 +1783,7 @@ export async function selectOrganization(
1780
1783
  }
1781
1784
 
1782
1785
  // Auto-select if only one org (regardless of TTY mode)
1783
- if (orgs.length === 1) {
1786
+ if (orgs.length === 1 && orgs[0]) {
1784
1787
  return orgs[0].id;
1785
1788
  }
1786
1789
 
@@ -1798,11 +1801,14 @@ export async function selectOrganization(
1798
1801
  if (isNonInteractive) {
1799
1802
  // In non-interactive mode with multiple orgs, auto-select first org
1800
1803
  // This allows scripts and CI/CD to work without explicit org selection
1801
- warning(
1802
- `Multiple organizations found. Auto-selecting first org: ${orgs[0].name}. ` +
1803
- `Set AGENTUITY_CLOUD_ORG_ID or use --org-id to specify a different org.`
1804
- );
1805
- return orgs[0].id;
1804
+ const firstOrg = orgs[0];
1805
+ if (firstOrg) {
1806
+ warning(
1807
+ `Multiple organizations found. Auto-selecting first org: ${firstOrg.name}. ` +
1808
+ `Set AGENTUITY_CLOUD_ORG_ID or use --org-id to specify a different org.`
1809
+ );
1810
+ return firstOrg.id;
1811
+ }
1806
1812
  }
1807
1813
 
1808
1814
  // Interactive mode with no saved preference - prompt user
@@ -1888,8 +1894,9 @@ export async function showProfileList(
1888
1894
  // If non-interactive, return initial or first
1889
1895
  if (!process.stdin.isTTY) {
1890
1896
  if (initial) return initial;
1891
- if (profiles.length === 1) {
1892
- return profiles[0].name;
1897
+ const firstProfile = profiles[0];
1898
+ if (profiles.length === 1 && firstProfile) {
1899
+ return firstProfile.name;
1893
1900
  }
1894
1901
  fatal(
1895
1902
  'Profile selection required but cannot prompt in non-interactive environment. ' +
@@ -2017,6 +2024,7 @@ function renderVerticalTable<T extends Record<string, unknown>>(
2017
2024
 
2018
2025
  for (let i = 0; i < data.length; i++) {
2019
2026
  const row = data[i];
2027
+ if (!row) continue;
2020
2028
 
2021
2029
  for (const colName of columnNames) {
2022
2030
  const value = row[colName];
@@ -2071,10 +2079,11 @@ export function table<T extends Record<string, unknown>>(
2071
2079
  colAligns = columnConfigs.map((col) => col.alignment || 'left');
2072
2080
  } else {
2073
2081
  // Simple mode: determine column names from data or columns parameter
2082
+ const firstRow = data[0];
2074
2083
  columnNames = columns
2075
2084
  ? (columns as (keyof T)[]).map((c) => String(c))
2076
- : data.length > 0
2077
- ? Object.keys(data[0])
2085
+ : data.length > 0 && firstRow
2086
+ ? Object.keys(firstRow)
2078
2087
  : [];
2079
2088
  colAligns = columnNames.map(() => 'left' as const);
2080
2089
  }
@@ -129,9 +129,12 @@ async function getSourceContext(
129
129
  }
130
130
 
131
131
  const currentOriginal = lines[lineNumber - 1];
132
+ if (currentOriginal === undefined) {
133
+ return null;
134
+ }
132
135
  const current = expandTabs(currentOriginal);
133
- const beforeRaw = lineNumber > 1 ? lines[lineNumber - 2] : null;
134
- const afterRaw = lineNumber < lines.length ? lines[lineNumber] : null;
136
+ const beforeRaw = lineNumber > 1 ? (lines[lineNumber - 2] ?? null) : null;
137
+ const afterRaw = lineNumber < lines.length ? (lines[lineNumber] ?? null) : null;
135
138
  const before = beforeRaw !== null && beforeRaw.trim() !== '' ? expandTabs(beforeRaw) : null;
136
139
  const after = afterRaw !== null && afterRaw.trim() !== '' ? expandTabs(afterRaw) : null;
137
140
 
package/src/utils/date.ts CHANGED
@@ -36,7 +36,11 @@ export function parseExpiresAt(input: string): string {
36
36
  });
37
37
  }
38
38
 
39
- const [, amount, unit] = match;
39
+ const amount = match[1];
40
+ const unit = match[2];
41
+ if (!amount || !unit) {
42
+ throw new Error(`Invalid relative date format: ${input}`);
43
+ }
40
44
  const num = parseInt(amount, 10);
41
45
  const now = new Date();
42
46
 
package/src/utils/deps.ts CHANGED
@@ -58,9 +58,11 @@ export function parseBunPmLsOutput(output: string): PackageRef[] {
58
58
  if (match) {
59
59
  const name = match[1];
60
60
  const version = match[2];
61
- const key = `${name}@${version}`;
62
- if (!packages.has(key)) {
63
- packages.set(key, { name, version });
61
+ if (name && version) {
62
+ const key = `${name}@${version}`;
63
+ if (!packages.has(key)) {
64
+ packages.set(key, { name, version });
65
+ }
64
66
  }
65
67
  }
66
68
  }
@@ -25,7 +25,7 @@ export function detectSubagent(
25
25
  // Path structure assumption: ['agent', 'parent', 'child', 'agent.ts' | 'route.ts' | 'route']
26
26
  // Currently hardcoded to 4 segments - consider making configurable in the future
27
27
  const isSubagent = pathParts.length === 4 && pathParts[0] === 'agent';
28
- const parentName = isSubagent ? pathParts[1] : null;
28
+ const parentName = isSubagent ? (pathParts[1] ?? null) : null;
29
29
 
30
30
  return { isSubagent, parentName };
31
31
  }
@@ -1,3 +0,0 @@
1
- export declare const command: import("../../..").CommandDefinition;
2
- export default command;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/cadence/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO,sCAyBlB,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -1,35 +0,0 @@
1
- import { createCommand } from '../../../types';
2
- import { listSubcommand } from './list';
3
- import { statusSubcommand } from './status';
4
- import { pauseSubcommand } from './pause';
5
- import { resumeSubcommand } from './resume';
6
- import { stopSubcommand } from './stop';
7
- import { getCommand } from '../../../command-prefix';
8
- export const command = createCommand({
9
- name: 'cadence',
10
- description: 'Manage long-running Cadence loops for Open Code',
11
- tags: ['fast', 'requires-auth'],
12
- examples: [
13
- { command: getCommand('ai cadence list'), description: 'List all Cadence loops' },
14
- { command: getCommand('ai cadence status lp_auth_impl'), description: 'Get loop status' },
15
- { command: getCommand('ai cadence pause lp_auth_impl'), description: 'Pause a running loop' },
16
- {
17
- command: getCommand('ai cadence resume lp_auth_impl'),
18
- description: 'Resume a paused loop',
19
- },
20
- {
21
- command: getCommand('ai cadence stop lp_auth_impl'),
22
- description: 'Stop and cancel a loop',
23
- },
24
- ],
25
- subcommands: [
26
- listSubcommand,
27
- statusSubcommand,
28
- pauseSubcommand,
29
- resumeSubcommand,
30
- stopSubcommand,
31
- ],
32
- requires: { auth: true },
33
- });
34
- export default command;
35
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cmd/ai/cadence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC;IACpC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,iDAAiD;IAC9D,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE;QACT,EAAE,OAAO,EAAE,UAAU,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACjF,EAAE,OAAO,EAAE,UAAU,CAAC,gCAAgC,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE;QACzF,EAAE,OAAO,EAAE,UAAU,CAAC,+BAA+B,CAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAC7F;YACC,OAAO,EAAE,UAAU,CAAC,gCAAgC,CAAC;YACrD,WAAW,EAAE,sBAAsB;SACnC;QACD;YACC,OAAO,EAAE,UAAU,CAAC,8BAA8B,CAAC;YACnD,WAAW,EAAE,wBAAwB;SACrC;KACD;IACD,WAAW,EAAE;QACZ,cAAc;QACd,gBAAgB;QAChB,eAAe;QACf,gBAAgB;QAChB,cAAc;KACd;IACD,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CACxB,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const listSubcommand: import("../../..").CommandDefinition;
2
- export default listSubcommand;
3
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/cadence/list.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,cAAc,sCA+GzB,CAAC;AA4CH,eAAe,cAAc,CAAC"}