@ariacode/cli 0.1.0

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +404 -0
  3. package/dist/actions.d.ts +271 -0
  4. package/dist/actions.js +1809 -0
  5. package/dist/actions.js.map +1 -0
  6. package/dist/agent.d.ts +26 -0
  7. package/dist/agent.js +182 -0
  8. package/dist/agent.js.map +1 -0
  9. package/dist/app.d.ts +14 -0
  10. package/dist/app.js +83 -0
  11. package/dist/app.js.map +1 -0
  12. package/dist/cli.d.ts +12 -0
  13. package/dist/cli.js +157 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/config.d.ts +170 -0
  16. package/dist/config.js +291 -0
  17. package/dist/config.js.map +1 -0
  18. package/dist/context.d.ts +58 -0
  19. package/dist/context.js +44 -0
  20. package/dist/context.js.map +1 -0
  21. package/dist/parser.d.ts +39 -0
  22. package/dist/parser.js +323 -0
  23. package/dist/parser.js.map +1 -0
  24. package/dist/prompts/ask.md +20 -0
  25. package/dist/prompts/explore.md +38 -0
  26. package/dist/prompts/patch.md +27 -0
  27. package/dist/prompts/plan.md +41 -0
  28. package/dist/prompts/prompts/ask.md +20 -0
  29. package/dist/prompts/prompts/explore.md +38 -0
  30. package/dist/prompts/prompts/patch.md +27 -0
  31. package/dist/prompts/prompts/plan.md +41 -0
  32. package/dist/prompts/prompts/review.md +33 -0
  33. package/dist/prompts/review.md +33 -0
  34. package/dist/provider.d.ts +148 -0
  35. package/dist/provider.js +486 -0
  36. package/dist/provider.js.map +1 -0
  37. package/dist/repo.d.ts +22 -0
  38. package/dist/repo.js +154 -0
  39. package/dist/repo.js.map +1 -0
  40. package/dist/safety.d.ts +48 -0
  41. package/dist/safety.js +140 -0
  42. package/dist/safety.js.map +1 -0
  43. package/dist/storage.d.ts +133 -0
  44. package/dist/storage.js +300 -0
  45. package/dist/storage.js.map +1 -0
  46. package/dist/tools.d.ts +70 -0
  47. package/dist/tools.js +654 -0
  48. package/dist/tools.js.map +1 -0
  49. package/dist/ui.d.ts +203 -0
  50. package/dist/ui.js +410 -0
  51. package/dist/ui.js.map +1 -0
  52. package/package.json +73 -0
package/dist/ui.d.ts ADDED
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Terminal UI utilities for Aria Code CLI
3
+ *
4
+ * Provides color output, diff rendering, table rendering, confirmation prompts,
5
+ * progress indicators, and path formatting.
6
+ *
7
+ * Requirements: 20.1–20.9, 11.6
8
+ */
9
+ /**
10
+ * Color configuration mode
11
+ */
12
+ export type ColorMode = "auto" | "always" | "never";
13
+ /**
14
+ * Determine whether colors should be enabled based on the color mode and
15
+ * terminal capabilities.
16
+ *
17
+ * - "always": colors on regardless of TTY
18
+ * - "never": colors off regardless of TTY
19
+ * - "auto": colors on only when stdout is a TTY (Req 20.9)
20
+ *
21
+ * Requirements: 20.2, 20.9
22
+ */
23
+ export declare function resolveColorEnabled(mode: ColorMode): boolean;
24
+ /**
25
+ * Initialize the UI module with color mode and quiet flag.
26
+ * Must be called once at startup before any output functions are used.
27
+ *
28
+ * Requirements: 20.1, 20.2, 20.3, 20.9
29
+ */
30
+ export declare function initUI(colorMode: ColorMode, quiet: boolean): void;
31
+ /**
32
+ * Returns true when color output is currently enabled.
33
+ */
34
+ export declare function isColorEnabled(): boolean;
35
+ /**
36
+ * Returns true when quiet mode is active.
37
+ */
38
+ export declare function isQuietMode(): boolean;
39
+ /** Apply bold styling when colors are enabled */
40
+ export declare function bold(text: string): string;
41
+ /** Apply dim styling when colors are enabled */
42
+ export declare function dim(text: string): string;
43
+ /** Apply green color when colors are enabled */
44
+ export declare function green(text: string): string;
45
+ /** Apply red color when colors are enabled */
46
+ export declare function red(text: string): string;
47
+ /** Apply yellow color when colors are enabled */
48
+ export declare function yellow(text: string): string;
49
+ /** Apply cyan color when colors are enabled */
50
+ export declare function cyan(text: string): string;
51
+ /** Apply blue color when colors are enabled */
52
+ export declare function blue(text: string): string;
53
+ /** Apply magenta color when colors are enabled */
54
+ export declare function magenta(text: string): string;
55
+ /** Apply gray color when colors are enabled */
56
+ export declare function gray(text: string): string;
57
+ /**
58
+ * Print a line to stdout.
59
+ * Always printed regardless of quiet mode (essential output).
60
+ */
61
+ export declare function print(message: string): void;
62
+ /**
63
+ * Print a line to stdout only when quiet mode is NOT active.
64
+ * Use for non-essential informational output.
65
+ *
66
+ * Requirement: 20.3
67
+ */
68
+ export declare function info(message: string): void;
69
+ /**
70
+ * Print a success message (green checkmark prefix).
71
+ * Suppressed in quiet mode.
72
+ */
73
+ export declare function success(message: string): void;
74
+ /**
75
+ * Print a warning message (yellow exclamation prefix).
76
+ * Suppressed in quiet mode.
77
+ */
78
+ export declare function warn(message: string): void;
79
+ /**
80
+ * Print an error message to stderr.
81
+ * Always printed regardless of quiet mode (essential output).
82
+ */
83
+ export declare function error(message: string): void;
84
+ /**
85
+ * Render a unified diff string with syntax highlighting.
86
+ *
87
+ * @param diffText - Unified diff text (e.g. from `createPatch`)
88
+ * @returns Colorized diff string ready for terminal output
89
+ *
90
+ * Requirements: 11.6, 20.6
91
+ */
92
+ export declare function renderDiff(diffText: string): string;
93
+ /**
94
+ * Generate and render a unified diff between two strings.
95
+ *
96
+ * @param filePath - File path used as the diff header label
97
+ * @param oldContent - Original file content
98
+ * @param newContent - New file content
99
+ * @returns Colorized unified diff string
100
+ *
101
+ * Requirements: 11.6, 20.6
102
+ */
103
+ export declare function generateAndRenderDiff(filePath: string, oldContent: string, newContent: string): string;
104
+ /**
105
+ * Print a diff preview for a set of file changes.
106
+ * Suppressed in quiet mode.
107
+ *
108
+ * @param diffs - Array of { path, diff } objects
109
+ *
110
+ * Requirements: 11.6, 20.6
111
+ */
112
+ export declare function printDiffPreview(diffs: Array<{
113
+ path: string;
114
+ diff: string;
115
+ }>): void;
116
+ /**
117
+ * Options for rendering a table.
118
+ */
119
+ export interface TableOptions {
120
+ /** Column header labels */
121
+ head: string[];
122
+ /** Optional column widths */
123
+ colWidths?: number[];
124
+ }
125
+ /**
126
+ * Render tabular data using cli-table3.
127
+ *
128
+ * @param options - Table configuration (headers, column widths)
129
+ * @param rows - Array of row arrays (each row is an array of cell values)
130
+ * @returns Formatted table string ready for terminal output
131
+ *
132
+ * Requirement: 20.4
133
+ */
134
+ export declare function renderTable(options: TableOptions, rows: string[][]): string;
135
+ /**
136
+ * Print a table to stdout.
137
+ * Suppressed in quiet mode.
138
+ *
139
+ * Requirement: 20.4
140
+ */
141
+ export declare function printTable(options: TableOptions, rows: string[][]): void;
142
+ /**
143
+ * Prompt the user for a yes/no confirmation using the `prompts` library.
144
+ *
145
+ * Returns `true` if the user confirms, `false` if they decline.
146
+ * Throws `UserCancelledError` if the user cancels (Ctrl+C / SIGINT).
147
+ *
148
+ * Requirement: 20.5
149
+ */
150
+ export declare function confirm(message: string): Promise<boolean>;
151
+ /**
152
+ * Error thrown when the user cancels a confirmation prompt.
153
+ * Maps to exit code 130 (Requirement 19.7).
154
+ */
155
+ export declare class ConfirmCancelledError extends Error {
156
+ constructor();
157
+ }
158
+ /**
159
+ * A simple spinner / progress indicator for long-running operations.
160
+ *
161
+ * Usage:
162
+ * const spinner = createSpinner("Analyzing repository...");
163
+ * spinner.start();
164
+ * // ... do work ...
165
+ * spinner.succeed("Analysis complete");
166
+ *
167
+ * Requirement: 20.7
168
+ */
169
+ export interface Spinner {
170
+ /** Start the spinner animation */
171
+ start(): void;
172
+ /** Stop the spinner and display a success message */
173
+ succeed(message?: string): void;
174
+ /** Stop the spinner and display a failure message */
175
+ fail(message?: string): void;
176
+ /** Stop the spinner without any message */
177
+ stop(): void;
178
+ /** Update the spinner label */
179
+ update(message: string): void;
180
+ }
181
+ /**
182
+ * Create a terminal spinner for long-running operations.
183
+ * The spinner is suppressed in quiet mode or when colors are disabled
184
+ * (non-interactive environments).
185
+ *
186
+ * Requirement: 20.7
187
+ */
188
+ export declare function createSpinner(initialMessage: string): Spinner;
189
+ /**
190
+ * Format a file path relative to the project root for readable terminal output.
191
+ *
192
+ * If the path is already relative or cannot be made relative, it is returned
193
+ * as-is. Absolute paths outside the project root are returned unchanged.
194
+ *
195
+ * Requirement: 20.8
196
+ */
197
+ export declare function formatPath(filePath: string, projectRoot: string): string;
198
+ /**
199
+ * Format multiple file paths relative to the project root.
200
+ *
201
+ * Requirement: 20.8
202
+ */
203
+ export declare function formatPaths(filePaths: string[], projectRoot: string): string[];
package/dist/ui.js ADDED
@@ -0,0 +1,410 @@
1
+ /**
2
+ * Terminal UI utilities for Aria Code CLI
3
+ *
4
+ * Provides color output, diff rendering, table rendering, confirmation prompts,
5
+ * progress indicators, and path formatting.
6
+ *
7
+ * Requirements: 20.1–20.9, 11.6
8
+ */
9
+ import pc from "picocolors";
10
+ import Table from "cli-table3";
11
+ import prompts from "prompts";
12
+ import { createPatch } from "diff";
13
+ import * as nodePath from "node:path";
14
+ /**
15
+ * UI state — initialized once per command invocation
16
+ */
17
+ let _colorEnabled = true;
18
+ let _quietMode = false;
19
+ /**
20
+ * Determine whether colors should be enabled based on the color mode and
21
+ * terminal capabilities.
22
+ *
23
+ * - "always": colors on regardless of TTY
24
+ * - "never": colors off regardless of TTY
25
+ * - "auto": colors on only when stdout is a TTY (Req 20.9)
26
+ *
27
+ * Requirements: 20.2, 20.9
28
+ */
29
+ export function resolveColorEnabled(mode) {
30
+ if (mode === "always")
31
+ return true;
32
+ if (mode === "never")
33
+ return false;
34
+ // "auto": detect TTY
35
+ return Boolean(process.stdout.isTTY);
36
+ }
37
+ /**
38
+ * Initialize the UI module with color mode and quiet flag.
39
+ * Must be called once at startup before any output functions are used.
40
+ *
41
+ * Requirements: 20.1, 20.2, 20.3, 20.9
42
+ */
43
+ export function initUI(colorMode, quiet) {
44
+ _colorEnabled = resolveColorEnabled(colorMode);
45
+ _quietMode = quiet;
46
+ // picocolors respects the FORCE_COLOR / NO_COLOR env vars automatically,
47
+ // but we also need to honour our own config. We achieve this by wrapping
48
+ // all color calls through our own helpers below rather than calling pc.*
49
+ // directly in the rest of the codebase.
50
+ }
51
+ /**
52
+ * Returns true when color output is currently enabled.
53
+ */
54
+ export function isColorEnabled() {
55
+ return _colorEnabled;
56
+ }
57
+ /**
58
+ * Returns true when quiet mode is active.
59
+ */
60
+ export function isQuietMode() {
61
+ return _quietMode;
62
+ }
63
+ // ---------------------------------------------------------------------------
64
+ // Color helpers — thin wrappers that respect _colorEnabled
65
+ // ---------------------------------------------------------------------------
66
+ /** Apply bold styling when colors are enabled */
67
+ export function bold(text) {
68
+ return _colorEnabled ? pc.bold(text) : text;
69
+ }
70
+ /** Apply dim styling when colors are enabled */
71
+ export function dim(text) {
72
+ return _colorEnabled ? pc.dim(text) : text;
73
+ }
74
+ /** Apply green color when colors are enabled */
75
+ export function green(text) {
76
+ return _colorEnabled ? pc.green(text) : text;
77
+ }
78
+ /** Apply red color when colors are enabled */
79
+ export function red(text) {
80
+ return _colorEnabled ? pc.red(text) : text;
81
+ }
82
+ /** Apply yellow color when colors are enabled */
83
+ export function yellow(text) {
84
+ return _colorEnabled ? pc.yellow(text) : text;
85
+ }
86
+ /** Apply cyan color when colors are enabled */
87
+ export function cyan(text) {
88
+ return _colorEnabled ? pc.cyan(text) : text;
89
+ }
90
+ /** Apply blue color when colors are enabled */
91
+ export function blue(text) {
92
+ return _colorEnabled ? pc.blue(text) : text;
93
+ }
94
+ /** Apply magenta color when colors are enabled */
95
+ export function magenta(text) {
96
+ return _colorEnabled ? pc.magenta(text) : text;
97
+ }
98
+ /** Apply gray color when colors are enabled */
99
+ export function gray(text) {
100
+ return _colorEnabled ? pc.gray(text) : text;
101
+ }
102
+ // ---------------------------------------------------------------------------
103
+ // Output helpers — respect quiet mode (Requirement 20.3)
104
+ // ---------------------------------------------------------------------------
105
+ /**
106
+ * Print a line to stdout.
107
+ * Always printed regardless of quiet mode (essential output).
108
+ */
109
+ export function print(message) {
110
+ process.stdout.write(message + "\n");
111
+ }
112
+ /**
113
+ * Print a line to stdout only when quiet mode is NOT active.
114
+ * Use for non-essential informational output.
115
+ *
116
+ * Requirement: 20.3
117
+ */
118
+ export function info(message) {
119
+ if (!_quietMode) {
120
+ process.stdout.write(message + "\n");
121
+ }
122
+ }
123
+ /**
124
+ * Print a success message (green checkmark prefix).
125
+ * Suppressed in quiet mode.
126
+ */
127
+ export function success(message) {
128
+ if (!_quietMode) {
129
+ process.stdout.write(green("✓ ") + message + "\n");
130
+ }
131
+ }
132
+ /**
133
+ * Print a warning message (yellow exclamation prefix).
134
+ * Suppressed in quiet mode.
135
+ */
136
+ export function warn(message) {
137
+ if (!_quietMode) {
138
+ process.stderr.write(yellow("! ") + message + "\n");
139
+ }
140
+ }
141
+ /**
142
+ * Print an error message to stderr.
143
+ * Always printed regardless of quiet mode (essential output).
144
+ */
145
+ export function error(message) {
146
+ process.stderr.write(red("Error: ") + message + "\n");
147
+ }
148
+ // ---------------------------------------------------------------------------
149
+ // 13.2 Diff rendering (Requirements: 11.6, 20.6)
150
+ // ---------------------------------------------------------------------------
151
+ /**
152
+ * Colorize a single line of a unified diff.
153
+ *
154
+ * - Lines starting with "+" are green (additions)
155
+ * - Lines starting with "-" are red (deletions)
156
+ * - Lines starting with "@@" are cyan (hunk headers)
157
+ * - Lines starting with "---" / "+++" are bold (file headers)
158
+ * - Context lines are left unstyled
159
+ *
160
+ * Requirement: 20.6
161
+ */
162
+ function colorizeDiffLine(line) {
163
+ if (!_colorEnabled)
164
+ return line;
165
+ if (line.startsWith("+++") || line.startsWith("---")) {
166
+ return bold(line);
167
+ }
168
+ if (line.startsWith("@@")) {
169
+ return cyan(line);
170
+ }
171
+ if (line.startsWith("+")) {
172
+ return green(line);
173
+ }
174
+ if (line.startsWith("-")) {
175
+ return red(line);
176
+ }
177
+ return line;
178
+ }
179
+ /**
180
+ * Render a unified diff string with syntax highlighting.
181
+ *
182
+ * @param diffText - Unified diff text (e.g. from `createPatch`)
183
+ * @returns Colorized diff string ready for terminal output
184
+ *
185
+ * Requirements: 11.6, 20.6
186
+ */
187
+ export function renderDiff(diffText) {
188
+ return diffText
189
+ .split("\n")
190
+ .map(colorizeDiffLine)
191
+ .join("\n");
192
+ }
193
+ /**
194
+ * Generate and render a unified diff between two strings.
195
+ *
196
+ * @param filePath - File path used as the diff header label
197
+ * @param oldContent - Original file content
198
+ * @param newContent - New file content
199
+ * @returns Colorized unified diff string
200
+ *
201
+ * Requirements: 11.6, 20.6
202
+ */
203
+ export function generateAndRenderDiff(filePath, oldContent, newContent) {
204
+ const patch = createPatch(filePath, oldContent, newContent, "current", "proposed");
205
+ return renderDiff(patch);
206
+ }
207
+ /**
208
+ * Print a diff preview for a set of file changes.
209
+ * Suppressed in quiet mode.
210
+ *
211
+ * @param diffs - Array of { path, diff } objects
212
+ *
213
+ * Requirements: 11.6, 20.6
214
+ */
215
+ export function printDiffPreview(diffs) {
216
+ if (_quietMode)
217
+ return;
218
+ for (const { path: filePath, diff } of diffs) {
219
+ print(bold(`\nFile: ${filePath}`));
220
+ print(renderDiff(diff));
221
+ }
222
+ }
223
+ /**
224
+ * Render tabular data using cli-table3.
225
+ *
226
+ * @param options - Table configuration (headers, column widths)
227
+ * @param rows - Array of row arrays (each row is an array of cell values)
228
+ * @returns Formatted table string ready for terminal output
229
+ *
230
+ * Requirement: 20.4
231
+ */
232
+ export function renderTable(options, rows) {
233
+ const tableOptions = {
234
+ head: _colorEnabled
235
+ ? options.head.map((h) => cyan(bold(h)))
236
+ : options.head,
237
+ style: {
238
+ head: [], // disable cli-table3's own coloring — we handle it above
239
+ border: [],
240
+ },
241
+ };
242
+ if (options.colWidths) {
243
+ tableOptions.colWidths = options.colWidths;
244
+ }
245
+ const table = new Table(tableOptions);
246
+ for (const row of rows) {
247
+ table.push(row);
248
+ }
249
+ return table.toString();
250
+ }
251
+ /**
252
+ * Print a table to stdout.
253
+ * Suppressed in quiet mode.
254
+ *
255
+ * Requirement: 20.4
256
+ */
257
+ export function printTable(options, rows) {
258
+ if (_quietMode)
259
+ return;
260
+ print(renderTable(options, rows));
261
+ }
262
+ // ---------------------------------------------------------------------------
263
+ // 13.4 Confirmation prompts (Requirement: 20.5)
264
+ // ---------------------------------------------------------------------------
265
+ /**
266
+ * Prompt the user for a yes/no confirmation using the `prompts` library.
267
+ *
268
+ * Returns `true` if the user confirms, `false` if they decline.
269
+ * Throws `UserCancelledError` if the user cancels (Ctrl+C / SIGINT).
270
+ *
271
+ * Requirement: 20.5
272
+ */
273
+ export async function confirm(message) {
274
+ const response = await prompts({
275
+ type: "confirm",
276
+ name: "value",
277
+ message,
278
+ initial: false,
279
+ }, {
280
+ onCancel: () => {
281
+ // prompts calls onCancel when the user presses Ctrl+C
282
+ throw new ConfirmCancelledError();
283
+ },
284
+ });
285
+ // If the user pressed Ctrl+C without onCancel being triggered (edge case),
286
+ // response.value will be undefined.
287
+ if (response.value === undefined) {
288
+ throw new ConfirmCancelledError();
289
+ }
290
+ return Boolean(response.value);
291
+ }
292
+ /**
293
+ * Error thrown when the user cancels a confirmation prompt.
294
+ * Maps to exit code 130 (Requirement 19.7).
295
+ */
296
+ export class ConfirmCancelledError extends Error {
297
+ constructor() {
298
+ super("Operation cancelled by user");
299
+ this.name = "ConfirmCancelledError";
300
+ }
301
+ }
302
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
303
+ const SPINNER_INTERVAL_MS = 80;
304
+ /**
305
+ * Create a terminal spinner for long-running operations.
306
+ * The spinner is suppressed in quiet mode or when colors are disabled
307
+ * (non-interactive environments).
308
+ *
309
+ * Requirement: 20.7
310
+ */
311
+ export function createSpinner(initialMessage) {
312
+ let frameIndex = 0;
313
+ let intervalId = null;
314
+ let currentMessage = initialMessage;
315
+ const isInteractive = _colorEnabled && Boolean(process.stderr.isTTY);
316
+ function clearLine() {
317
+ if (isInteractive) {
318
+ process.stderr.write("\r\x1b[K");
319
+ }
320
+ }
321
+ function renderFrame() {
322
+ if (!isInteractive)
323
+ return;
324
+ const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
325
+ process.stderr.write(`\r${cyan(frame)} ${currentMessage}`);
326
+ frameIndex++;
327
+ }
328
+ return {
329
+ start() {
330
+ if (_quietMode)
331
+ return;
332
+ if (isInteractive) {
333
+ intervalId = setInterval(renderFrame, SPINNER_INTERVAL_MS);
334
+ // Prevent the timer from keeping the process alive if the caller
335
+ // throws before calling stop()/succeed()/fail() (leak-safe).
336
+ if (intervalId && typeof intervalId === "object" && "unref" in intervalId) {
337
+ intervalId.unref();
338
+ }
339
+ }
340
+ else {
341
+ // Non-interactive: just print the message once
342
+ process.stderr.write(`${currentMessage}...\n`);
343
+ }
344
+ },
345
+ update(message) {
346
+ currentMessage = message;
347
+ },
348
+ succeed(message) {
349
+ if (intervalId !== null) {
350
+ clearInterval(intervalId);
351
+ intervalId = null;
352
+ }
353
+ clearLine();
354
+ if (!_quietMode) {
355
+ const label = message ?? currentMessage;
356
+ process.stderr.write(green("✓ ") + label + "\n");
357
+ }
358
+ },
359
+ fail(message) {
360
+ if (intervalId !== null) {
361
+ clearInterval(intervalId);
362
+ intervalId = null;
363
+ }
364
+ clearLine();
365
+ const label = message ?? currentMessage;
366
+ process.stderr.write(red("✗ ") + label + "\n");
367
+ },
368
+ stop() {
369
+ if (intervalId !== null) {
370
+ clearInterval(intervalId);
371
+ intervalId = null;
372
+ }
373
+ clearLine();
374
+ },
375
+ };
376
+ }
377
+ // ---------------------------------------------------------------------------
378
+ // 13.6 Path formatting (Requirement: 20.8)
379
+ // ---------------------------------------------------------------------------
380
+ /**
381
+ * Format a file path relative to the project root for readable terminal output.
382
+ *
383
+ * If the path is already relative or cannot be made relative, it is returned
384
+ * as-is. Absolute paths outside the project root are returned unchanged.
385
+ *
386
+ * Requirement: 20.8
387
+ */
388
+ export function formatPath(filePath, projectRoot) {
389
+ try {
390
+ const relative = nodePath.relative(projectRoot, filePath);
391
+ // If the relative path starts with ".." it's outside the project root —
392
+ // return the original path in that case.
393
+ if (relative.startsWith("..")) {
394
+ return filePath;
395
+ }
396
+ return relative || ".";
397
+ }
398
+ catch {
399
+ return filePath;
400
+ }
401
+ }
402
+ /**
403
+ * Format multiple file paths relative to the project root.
404
+ *
405
+ * Requirement: 20.8
406
+ */
407
+ export function formatPaths(filePaths, projectRoot) {
408
+ return filePaths.map((p) => formatPath(p, projectRoot));
409
+ }
410
+ //# sourceMappingURL=ui.js.map
package/dist/ui.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAWtC;;GAEG;AACH,IAAI,aAAa,GAAG,IAAI,CAAC;AACzB,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAe;IACjD,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACnC,qBAAqB;IACrB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,SAAoB,EAAE,KAAc;IACzD,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC/C,UAAU,GAAG,KAAK,CAAC;IAEnB,yEAAyE;IACzE,yEAAyE;IACzE,yEAAyE;IACzE,wCAAwC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,UAAU,CAAC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AC1B,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;YACD,SAAS,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,OAAO,IAAI,cAAc,CAAC;YACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;QACjD,CAAC;QAED,IAAI;YACF,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACxB,aAAa,CAAC,UAAU,CAAC,CAAC;gBAC1B,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;YACD,SAAS,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,2CAA2C;AAC3C,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB,EAAE,WAAmB;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC1D,wEAAwE;QACxE,yCAAyC;QACzC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,QAAQ,IAAI,GAAG,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,SAAmB,EAAE,WAAmB;IAClE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;AAC1D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@ariacode/cli",
3
+ "version": "0.1.0",
4
+ "description": "A predictable coding agent for Next.js, Nest.js, Prisma and Node.js projects.",
5
+ "homepage": "https://www.ariacode.run",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ariacodeai/ariacode.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/ariacodeai/ariacode/issues"
12
+ },
13
+ "license": "MIT",
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "type": "module",
18
+ "bin": {
19
+ "aria": "./dist/cli.js"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "ai",
28
+ "agent",
29
+ "coding-agent",
30
+ "typescript",
31
+ "nodejs",
32
+ "nextjs",
33
+ "nestjs",
34
+ "prisma",
35
+ "cli"
36
+ ],
37
+ "scripts": {
38
+ "dev": "tsx src/cli.ts",
39
+ "build": "tsc && cp -r src/prompts dist/prompts",
40
+ "start": "node dist/cli.js",
41
+ "check": "tsc --noEmit",
42
+ "format": "prettier --write .",
43
+ "test": "vitest --run",
44
+ "test:watch": "vitest",
45
+ "prepublishOnly": "npm run check && npm run test && npm run build"
46
+ },
47
+ "engines": {
48
+ "node": ">=20"
49
+ },
50
+ "dependencies": {
51
+ "@anthropic-ai/sdk": "^0.82.0",
52
+ "better-sqlite3": "^12.8.0",
53
+ "cli-table3": "^0.6.5",
54
+ "diff": "^8.0.4",
55
+ "ignore": "^7.0.5",
56
+ "picocolors": "^1.1.1",
57
+ "prompts": "^2.4.2",
58
+ "smol-toml": "^1.3.1",
59
+ "zod": "^4.3.6"
60
+ },
61
+ "devDependencies": {
62
+ "@types/better-sqlite3": "^7.6.12",
63
+ "@types/diff": "^6.0.0",
64
+ "@types/node": "^24.3.0",
65
+ "@types/prompts": "^2.4.9",
66
+ "@vitest/coverage-v8": "^4.1.2",
67
+ "fast-check": "^3.22.0",
68
+ "prettier": "^3.8.1",
69
+ "tsx": "^4.21.0",
70
+ "typescript": "^5.9.2",
71
+ "vitest": "^4.1.2"
72
+ }
73
+ }