@ariacode/cli 0.2.1 → 0.2.3
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.
- package/README.md +78 -11
- package/dist/actions/db-ask.d.ts +7 -1
- package/dist/actions/db-ask.js +27 -10
- package/dist/actions/db-ask.js.map +1 -1
- package/dist/actions/db-explain.d.ts +6 -0
- package/dist/actions/db-explain.js +25 -7
- package/dist/actions/db-explain.js.map +1 -1
- package/dist/actions/db-migrate.d.ts +4 -0
- package/dist/actions/db-migrate.js +2 -2
- package/dist/actions/db-migrate.js.map +1 -1
- package/dist/actions/db-schema.d.ts +3 -1
- package/dist/actions/db-schema.js +18 -5
- package/dist/actions/db-schema.js.map +1 -1
- package/dist/actions/upgrade-deps.d.ts +6 -0
- package/dist/actions/upgrade-deps.js +20 -2
- package/dist/actions/upgrade-deps.js.map +1 -1
- package/dist/actions/upgrade-prisma.d.ts +4 -0
- package/dist/actions/upgrade-prisma.js +2 -2
- package/dist/actions/upgrade-prisma.js.map +1 -1
- package/dist/actions.d.ts +106 -71
- package/dist/actions.js +438 -204
- package/dist/actions.js.map +1 -1
- package/dist/agent.d.ts +0 -1
- package/dist/agent.js +1 -2
- package/dist/agent.js.map +1 -1
- package/dist/app.d.ts +3 -3
- package/dist/app.js +3 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +37 -5
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +17 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/output/schemas.d.ts +92 -0
- package/dist/output/schemas.js +142 -0
- package/dist/output/schemas.js.map +1 -0
- package/dist/parser.d.ts +10 -3
- package/dist/parser.js +70 -8
- package/dist/parser.js.map +1 -1
- package/dist/provider.d.ts +7 -2
- package/dist/provider.js +6 -4
- package/dist/provider.js.map +1 -1
- package/dist/repo.d.ts +0 -1
- package/dist/repo.js +6 -9
- package/dist/repo.js.map +1 -1
- package/dist/safety.d.ts +0 -4
- package/dist/safety.js +0 -4
- package/dist/safety.js.map +1 -1
- package/dist/storage/queries.d.ts +39 -0
- package/dist/storage/queries.js +211 -0
- package/dist/storage/queries.js.map +1 -0
- package/dist/tools.d.ts +6 -7
- package/dist/tools.js +20 -7
- package/dist/tools.js.map +1 -1
- package/dist/ui/diff-renderer.d.ts +28 -0
- package/dist/ui/diff-renderer.js +388 -0
- package/dist/ui/diff-renderer.js.map +1 -0
- package/dist/ui/highlight.d.ts +25 -0
- package/dist/ui/highlight.js +239 -0
- package/dist/ui/highlight.js.map +1 -0
- package/dist/ui.d.ts +3 -16
- package/dist/ui.js +7 -28
- package/dist/ui.js.map +1 -1
- package/dist/upgrade/prisma-upgrade.js +5 -2
- package/dist/upgrade/prisma-upgrade.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,9 @@ After installation the `aria` binary is available globally.
|
|
|
32
32
|
# Ask a question about your codebase
|
|
33
33
|
aria ask "How is authentication handled in this project?"
|
|
34
34
|
|
|
35
|
+
# Use a different provider for a single command
|
|
36
|
+
aria ask "Explain the data model" --provider openrouter --model deepseek/deepseek-chat
|
|
37
|
+
|
|
35
38
|
# Generate an implementation plan (read-only, no changes)
|
|
36
39
|
aria plan "Add rate limiting to the API routes"
|
|
37
40
|
|
|
@@ -70,7 +73,7 @@ aria doctor
|
|
|
70
73
|
Ask a read-only question about the repository. The agent uses `read_file`, `list_directory`, and `search_code` to explore the codebase and answer your question.
|
|
71
74
|
|
|
72
75
|
```
|
|
73
|
-
aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet]
|
|
76
|
+
aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet] [--provider <name>] [--model <name>]
|
|
74
77
|
```
|
|
75
78
|
|
|
76
79
|
| Flag | Description |
|
|
@@ -78,6 +81,8 @@ aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet]
|
|
|
78
81
|
| `--session <id>` | Resume an existing session |
|
|
79
82
|
| `--max-tokens <n>` | Override max tokens for this response |
|
|
80
83
|
| `--quiet` | Suppress non-essential output |
|
|
84
|
+
| `--provider <name>` | Override provider for this command |
|
|
85
|
+
| `--model <name>` | Override LLM model for this command |
|
|
81
86
|
|
|
82
87
|
### `aria plan <goal>`
|
|
83
88
|
|
|
@@ -97,13 +102,15 @@ aria plan "<goal>" [--session <id>] [--output <path>]
|
|
|
97
102
|
Analyze the repository, propose a unified diff, show a preview, and apply changes atomically after confirmation.
|
|
98
103
|
|
|
99
104
|
```
|
|
100
|
-
aria patch "<description>" [--dry-run] [--yes] [--session <id>]
|
|
105
|
+
aria patch "<description>" [--dry-run] [--yes] [--split] [--format text|json|ndjson|plain] [--session <id>]
|
|
101
106
|
```
|
|
102
107
|
|
|
103
108
|
| Flag | Description |
|
|
104
109
|
|------|-------------|
|
|
105
110
|
| `--dry-run` | Preview the diff without applying changes |
|
|
106
111
|
| `--yes` | Skip the confirmation prompt |
|
|
112
|
+
| `--split` | Render diff side-by-side (requires terminal width > 120 columns) |
|
|
113
|
+
| `--format plain` | Plain-text diff output with no ANSI codes; requires `--yes` |
|
|
107
114
|
| `--session <id>` | Resume an existing session |
|
|
108
115
|
|
|
109
116
|
### `aria review`
|
|
@@ -111,14 +118,14 @@ aria patch "<description>" [--dry-run] [--yes] [--session <id>]
|
|
|
111
118
|
Review git changes with AI assistance. Reads staged changes by default and returns a structured review with summary, issues, and suggestions.
|
|
112
119
|
|
|
113
120
|
```
|
|
114
|
-
aria review [--unstaged] [--branch <base>] [--format text|json]
|
|
121
|
+
aria review [--unstaged] [--branch <base>] [--format text|json|ndjson|plain]
|
|
115
122
|
```
|
|
116
123
|
|
|
117
124
|
| Flag | Description |
|
|
118
125
|
|------|-------------|
|
|
119
126
|
| `--unstaged` | Review unstaged changes instead of staged |
|
|
120
127
|
| `--branch <base>` | Compare current branch to a base branch |
|
|
121
|
-
| `--format
|
|
128
|
+
| `--format <fmt>` | Output format: `text` (default), `json`, `ndjson`, `plain` |
|
|
122
129
|
|
|
123
130
|
### `aria explore`
|
|
124
131
|
|
|
@@ -138,14 +145,30 @@ aria explore [--depth <n>] [--save]
|
|
|
138
145
|
Inspect past sessions stored in the local SQLite database.
|
|
139
146
|
|
|
140
147
|
```
|
|
141
|
-
aria history [--limit <n>] [--session <id>] [--tree]
|
|
148
|
+
aria history [--limit <n>] [--session <id>] [--tree] [--format text|json|ndjson|plain]
|
|
149
|
+
aria history search "<query>"
|
|
150
|
+
aria history [--command <cmd>] [--since "<expr>"] [--status <status>]
|
|
151
|
+
aria history --session <id> --export <path>
|
|
142
152
|
```
|
|
143
153
|
|
|
144
154
|
| Flag | Description |
|
|
145
155
|
|------|-------------|
|
|
146
|
-
| `--limit <n>` | Limit the number of sessions shown |
|
|
156
|
+
| `--limit <n>` | Limit the number of sessions shown (default: 20) |
|
|
147
157
|
| `--session <id>` | Show the full log for a specific session |
|
|
148
|
-
| `--tree` | Render the tool execution tree |
|
|
158
|
+
| `--tree` | Render the tool execution tree with type icons (`[R]` read, `[S]` search, `[W]` mutation, `[.]` other) |
|
|
159
|
+
| `--command <cmd>` | Filter sessions by command name |
|
|
160
|
+
| `--since "<expr>"` | Filter by date — supports `"N days ago"`, `"N hours ago"`, `"N minutes ago"`, or ISO 8601 |
|
|
161
|
+
| `--status <status>` | Filter by status: `running`, `completed`, `failed`, `cancelled` |
|
|
162
|
+
| `--export <path>` | Export session transcript as a markdown file (requires `--session`) |
|
|
163
|
+
| `--format <fmt>` | Output format: `text` (default), `json`, `ndjson`, `plain` |
|
|
164
|
+
|
|
165
|
+
**Search example:**
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
aria history search "rate limiting"
|
|
169
|
+
aria history --command patch --status completed --since "7 days ago"
|
|
170
|
+
aria history --session abc123 --export ./session-transcript.md
|
|
171
|
+
```
|
|
149
172
|
|
|
150
173
|
### `aria config`
|
|
151
174
|
|
|
@@ -166,7 +189,7 @@ aria config init # Create ./.aria.toml with defaults
|
|
|
166
189
|
Run environment diagnostics: Node.js version, git, ripgrep, config validity, history DB, provider API keys, project detection, and Prisma schema presence.
|
|
167
190
|
|
|
168
191
|
```
|
|
169
|
-
aria doctor [--format text|json]
|
|
192
|
+
aria doctor [--format text|json|ndjson|plain]
|
|
170
193
|
```
|
|
171
194
|
|
|
172
195
|
### `aria db schema`
|
|
@@ -174,13 +197,13 @@ aria doctor [--format text|json]
|
|
|
174
197
|
Parse and render `schema.prisma` content — models, fields, relations, enums, indexes. No LLM call, instant and free.
|
|
175
198
|
|
|
176
199
|
```
|
|
177
|
-
aria db schema [--json] [--model <name>]
|
|
200
|
+
aria db schema [--json] [--prisma-model <name>]
|
|
178
201
|
```
|
|
179
202
|
|
|
180
203
|
| Flag | Description |
|
|
181
204
|
|------|-------------|
|
|
182
205
|
| `--json` | Output raw `PrismaSchemaInfo` as JSON |
|
|
183
|
-
| `--model <name>` | Filter to a single model |
|
|
206
|
+
| `--prisma-model <name>` | Filter to a single Prisma model |
|
|
184
207
|
|
|
185
208
|
Example output:
|
|
186
209
|
|
|
@@ -209,7 +232,7 @@ Enums (1)
|
|
|
209
232
|
Q&A over your Prisma schema. Generates runnable Prisma Client code. Warns when queries touch sensitive fields (password, token, secret, apiKey).
|
|
210
233
|
|
|
211
234
|
```
|
|
212
|
-
aria db ask "<question>" [--session <id>] [--model <
|
|
235
|
+
aria db ask "<question>" [--session <id>] [--prisma-model <name>] [--provider <name>] [--model <name>]
|
|
213
236
|
```
|
|
214
237
|
|
|
215
238
|
### `aria db explain <description>`
|
|
@@ -344,6 +367,14 @@ default = "anthropic" # anthropic | openai | ollama | openrouter
|
|
|
344
367
|
model = "claude-sonnet-4-6"
|
|
345
368
|
max_tokens = 4096
|
|
346
369
|
|
|
370
|
+
# Per-provider overrides (optional)
|
|
371
|
+
[provider.anthropic]
|
|
372
|
+
model = "claude-sonnet-4-6" # override model when using Anthropic
|
|
373
|
+
|
|
374
|
+
[provider.openrouter]
|
|
375
|
+
model = "deepseek/deepseek-chat" # override model when using OpenRouter
|
|
376
|
+
base_url = "https://openrouter.ai/api/v1" # custom endpoint (optional)
|
|
377
|
+
|
|
347
378
|
[agent]
|
|
348
379
|
max_iterations = 25
|
|
349
380
|
mode = "build" # build | plan
|
|
@@ -372,6 +403,7 @@ Run `aria config init` to generate a `.aria.toml` in the current directory.
|
|
|
372
403
|
| `ANTHROPIC_API_KEY` | API key for Anthropic provider |
|
|
373
404
|
| `OPENAI_API_KEY` | API key for OpenAI provider |
|
|
374
405
|
| `OPENROUTER_API_KEY` | API key for OpenRouter provider |
|
|
406
|
+
| `OPENROUTER_BASE_URL` | Custom base URL for OpenRouter-compatible endpoints |
|
|
375
407
|
| `ARIA_PROVIDER` | Override default provider |
|
|
376
408
|
| `ARIA_MODEL` | Override model name |
|
|
377
409
|
| `ARIA_MAX_TOKENS` | Override max tokens |
|
|
@@ -539,6 +571,33 @@ See the full model catalogue at [openrouter.ai/models](https://openrouter.ai/mod
|
|
|
539
571
|
| `5` | Project detection error / Prisma not found |
|
|
540
572
|
| `130` | User cancelled (Ctrl+C or declined confirmation) |
|
|
541
573
|
|
|
574
|
+
## Structured Output
|
|
575
|
+
|
|
576
|
+
All data-producing commands support `--format json`, `--format ndjson`, and `--format plain` for scripting and pipeline integration.
|
|
577
|
+
|
|
578
|
+
| Format | Description |
|
|
579
|
+
|--------|-------------|
|
|
580
|
+
| `text` | Default — colored terminal output |
|
|
581
|
+
| `json` | Single validated JSON object to stdout; all spinner/info output suppressed |
|
|
582
|
+
| `ndjson` | One JSON object per line; final `{"version":"1","event":"done"}` on success |
|
|
583
|
+
| `plain` | Tab-separated output with no ANSI codes and no box-drawing characters |
|
|
584
|
+
|
|
585
|
+
All JSON output includes a top-level `"version": "1"` field for downstream stability.
|
|
586
|
+
|
|
587
|
+
On failure with `--format json`, a JSON error object is written to **stderr** and stdout remains empty:
|
|
588
|
+
|
|
589
|
+
```json
|
|
590
|
+
{"version":"1","error":"Provider API key not configured","exitCode":4}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
On failure with `--format ndjson`, an error event is emitted to **stderr**:
|
|
594
|
+
|
|
595
|
+
```json
|
|
596
|
+
{"version":"1","event":"error","error":"Provider API key not configured"}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
**Commands that support `--format`:** `ask`, `plan`, `patch`, `review`, `explore`, `db schema`, `db ask`, `db explain`, `history`, `doctor`, `upgrade deps`
|
|
600
|
+
|
|
542
601
|
## Session History
|
|
543
602
|
|
|
544
603
|
Every command execution is logged to `~/.aria/history.db` (SQLite). Sessions record messages, tool executions, and mutations. The database is created automatically on first run with permissions set to `600` (user-only).
|
|
@@ -550,6 +609,14 @@ aria history
|
|
|
550
609
|
aria history --limit 10
|
|
551
610
|
aria history --session <id>
|
|
552
611
|
aria history --session <id> --tree
|
|
612
|
+
|
|
613
|
+
# Search and filter
|
|
614
|
+
aria history search "authentication"
|
|
615
|
+
aria history --command patch --status completed
|
|
616
|
+
aria history --since "3 days ago"
|
|
617
|
+
|
|
618
|
+
# Export a session transcript
|
|
619
|
+
aria history --session <id> --export ./transcript.md
|
|
553
620
|
```
|
|
554
621
|
|
|
555
622
|
Sessions older than `retain_days` (default: 90) are cleaned up automatically.
|
package/dist/actions/db-ask.d.ts
CHANGED
|
@@ -5,8 +5,14 @@
|
|
|
5
5
|
export interface DbAskOptions {
|
|
6
6
|
question: string;
|
|
7
7
|
session?: string;
|
|
8
|
-
|
|
8
|
+
prismaModel?: string;
|
|
9
9
|
quiet?: boolean;
|
|
10
10
|
projectRoot?: string;
|
|
11
|
+
/** Override provider (v0.2.2) */
|
|
12
|
+
provider?: string;
|
|
13
|
+
/** Override LLM model (v0.2.2) */
|
|
14
|
+
model?: string;
|
|
15
|
+
/** Output format (v0.2.3) */
|
|
16
|
+
format?: 'text' | 'json' | 'ndjson' | 'plain';
|
|
11
17
|
}
|
|
12
18
|
export declare function runDbAsk(options: DbAskOptions): Promise<void>;
|
package/dist/actions/db-ask.js
CHANGED
|
@@ -12,11 +12,12 @@ import { parsePrismaSchema } from '../db/schema.js';
|
|
|
12
12
|
import { renderSchemaSummary } from '../db/summary.js';
|
|
13
13
|
import { detectProjectType } from '../repo.js';
|
|
14
14
|
import { createProvider } from '../provider.js';
|
|
15
|
-
import { initializeDatabase, createSession, updateSessionStatus, logMessage } from '../storage.js';
|
|
15
|
+
import { initializeDatabase, createSession, updateSessionStatus, logMessage, getSession } from '../storage.js';
|
|
16
16
|
import { readFileTool, searchCodeTool, readPrismaSchemaParserTool, findPrismaUsageTool, findModelReferencesTool, } from '../tools.js';
|
|
17
17
|
import { agentLoop, UserCancelledError } from '../agent.js';
|
|
18
|
-
import { initUI, info, error as uiError, yellow } from '../ui.js';
|
|
18
|
+
import { initUI, info, error as uiError, yellow, stripAnsi } from '../ui.js';
|
|
19
19
|
import { ConfirmCancelledError } from '../ui.js';
|
|
20
|
+
import { formatOutput, DbAskOutputSchema } from '../output/schemas.js';
|
|
20
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
22
|
const DB_ASK_TOOLS = [
|
|
22
23
|
readPrismaSchemaParserTool,
|
|
@@ -28,8 +29,8 @@ const DB_ASK_TOOLS = [
|
|
|
28
29
|
const SENSITIVE_PATTERN = /password|token|secret|hash|apiKey|stripeCustomerId|ssn/i;
|
|
29
30
|
export async function runDbAsk(options) {
|
|
30
31
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
31
|
-
const config = getConfig(projectRoot, { quiet: options.quiet });
|
|
32
|
-
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet));
|
|
32
|
+
const config = getConfig(projectRoot, { quiet: options.quiet, provider: options.provider, model: options.model });
|
|
33
|
+
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet) || (options.format === 'json' || options.format === 'ndjson'));
|
|
33
34
|
// Validate schema exists
|
|
34
35
|
const schemaInfo = parsePrismaSchema(projectRoot);
|
|
35
36
|
if (!schemaInfo) {
|
|
@@ -40,8 +41,6 @@ export async function runDbAsk(options) {
|
|
|
40
41
|
const db = initializeDatabase();
|
|
41
42
|
let sessionId;
|
|
42
43
|
if (options.session) {
|
|
43
|
-
// Validate session exists before resuming
|
|
44
|
-
const { getSession } = await import('../storage.js');
|
|
45
44
|
const existing = getSession(db, options.session);
|
|
46
45
|
if (!existing) {
|
|
47
46
|
uiError(`Session not found: ${options.session}`);
|
|
@@ -61,7 +60,7 @@ export async function runDbAsk(options) {
|
|
|
61
60
|
}
|
|
62
61
|
let provider;
|
|
63
62
|
try {
|
|
64
|
-
provider = createProvider(config.provider.default);
|
|
63
|
+
provider = createProvider(config.provider.default, config.provider);
|
|
65
64
|
}
|
|
66
65
|
catch (err) {
|
|
67
66
|
uiError(err instanceof Error ? err.message : String(err));
|
|
@@ -90,14 +89,21 @@ export async function runDbAsk(options) {
|
|
|
90
89
|
logMessage(db, sessionId, 'system', systemPrompt);
|
|
91
90
|
// Prepend sensitivity warning hint to question if relevant
|
|
92
91
|
let userRequest = options.question;
|
|
93
|
-
if (options.
|
|
94
|
-
userRequest = `[Focus on model: ${options.
|
|
92
|
+
if (options.prismaModel) {
|
|
93
|
+
userRequest = `[Focus on model: ${options.prismaModel}]\n\n${userRequest}`;
|
|
95
94
|
}
|
|
96
95
|
if (SENSITIVE_PATTERN.test(options.question)) {
|
|
97
96
|
userRequest = `[NOTE: This question may involve sensitive fields. Add a WARNING above the code.]\n\n${userRequest}`;
|
|
98
97
|
}
|
|
99
98
|
try {
|
|
100
|
-
await agentLoop(ctx, userRequest, DB_ASK_TOOLS, provider, config, 'db ask', db, systemPrompt);
|
|
99
|
+
const answer = await agentLoop(ctx, userRequest, DB_ASK_TOOLS, provider, config, 'db ask', db, systemPrompt);
|
|
100
|
+
// v0.2.3: structured output
|
|
101
|
+
if (options.format === 'json' || options.format === 'ndjson') {
|
|
102
|
+
process.stdout.write(formatOutput({ version: '1', answer, sessionId }, options.format, DbAskOutputSchema));
|
|
103
|
+
}
|
|
104
|
+
else if (options.format === 'plain') {
|
|
105
|
+
process.stdout.write(stripAnsi(answer) + '\n');
|
|
106
|
+
}
|
|
101
107
|
updateSessionStatus(db, sessionId, 'completed');
|
|
102
108
|
}
|
|
103
109
|
catch (err) {
|
|
@@ -107,6 +113,17 @@ export async function runDbAsk(options) {
|
|
|
107
113
|
process.exit(130);
|
|
108
114
|
}
|
|
109
115
|
const message = err instanceof Error ? err.message : String(err);
|
|
116
|
+
// v0.2.3: structured error output
|
|
117
|
+
if (options.format === 'json') {
|
|
118
|
+
process.stderr.write(JSON.stringify({ version: '1', error: message, exitCode: 1 }) + '\n');
|
|
119
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
else if (options.format === 'ndjson') {
|
|
123
|
+
process.stderr.write(JSON.stringify({ version: '1', event: 'error', error: message }) + '\n');
|
|
124
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
110
127
|
uiError(message);
|
|
111
128
|
updateSessionStatus(db, sessionId, 'failed', message);
|
|
112
129
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-ask.js","sourceRoot":"","sources":["../../src/actions/db-ask.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,g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C;YAC9F,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,CAAC;QACjB,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAMzB;IACC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC9D,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,qEAAqE,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ;SACZ,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,WAAW,CAAC;SACjD,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,CAAC;SAC/C,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC,kBAAkB,CAAC;SAC/D,OAAO,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -8,5 +8,11 @@ export interface DbExplainOptions {
|
|
|
8
8
|
session?: string;
|
|
9
9
|
quiet?: boolean;
|
|
10
10
|
projectRoot?: string;
|
|
11
|
+
/** Override provider (v0.2.2) */
|
|
12
|
+
provider?: string;
|
|
13
|
+
/** Override LLM model (v0.2.2) */
|
|
14
|
+
model?: string;
|
|
15
|
+
/** Output format (v0.2.3) */
|
|
16
|
+
format?: 'text' | 'json' | 'ndjson' | 'plain';
|
|
11
17
|
}
|
|
12
18
|
export declare function runDbExplain(options: DbExplainOptions): Promise<void>;
|
|
@@ -12,11 +12,12 @@ import { parsePrismaSchema } from '../db/schema.js';
|
|
|
12
12
|
import { renderSchemaSummary } from '../db/summary.js';
|
|
13
13
|
import { detectProjectType } from '../repo.js';
|
|
14
14
|
import { createProvider } from '../provider.js';
|
|
15
|
-
import { initializeDatabase, createSession, updateSessionStatus, logMessage } from '../storage.js';
|
|
15
|
+
import { initializeDatabase, createSession, updateSessionStatus, logMessage, getSession } from '../storage.js';
|
|
16
16
|
import { readFileTool, searchCodeTool, readPrismaSchemaParserTool, findPrismaUsageTool, findModelReferencesTool, } from '../tools.js';
|
|
17
17
|
import { agentLoop, UserCancelledError } from '../agent.js';
|
|
18
|
-
import { initUI, info, error as uiError, yellow } from '../ui.js';
|
|
18
|
+
import { initUI, info, error as uiError, yellow, stripAnsi } from '../ui.js';
|
|
19
19
|
import { ConfirmCancelledError } from '../ui.js';
|
|
20
|
+
import { formatOutput, DbExplainOutputSchema } from '../output/schemas.js';
|
|
20
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
22
|
const DB_EXPLAIN_TOOLS = [
|
|
22
23
|
readPrismaSchemaParserTool,
|
|
@@ -27,8 +28,8 @@ const DB_EXPLAIN_TOOLS = [
|
|
|
27
28
|
];
|
|
28
29
|
export async function runDbExplain(options) {
|
|
29
30
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
30
|
-
const config = getConfig(projectRoot, { quiet: options.quiet });
|
|
31
|
-
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet));
|
|
31
|
+
const config = getConfig(projectRoot, { quiet: options.quiet, provider: options.provider, model: options.model });
|
|
32
|
+
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet) || (options.format === 'json' || options.format === 'ndjson'));
|
|
32
33
|
const schemaInfo = parsePrismaSchema(projectRoot);
|
|
33
34
|
if (!schemaInfo) {
|
|
34
35
|
uiError('No schema.prisma found. aria db explain requires a Prisma project.');
|
|
@@ -38,7 +39,6 @@ export async function runDbExplain(options) {
|
|
|
38
39
|
const db = initializeDatabase();
|
|
39
40
|
let sessionId;
|
|
40
41
|
if (options.session) {
|
|
41
|
-
const { getSession } = await import('../storage.js');
|
|
42
42
|
const existing = getSession(db, options.session);
|
|
43
43
|
if (!existing) {
|
|
44
44
|
uiError(`Session not found: ${options.session}`);
|
|
@@ -58,7 +58,7 @@ export async function runDbExplain(options) {
|
|
|
58
58
|
}
|
|
59
59
|
let provider;
|
|
60
60
|
try {
|
|
61
|
-
provider = createProvider(config.provider.default);
|
|
61
|
+
provider = createProvider(config.provider.default, config.provider);
|
|
62
62
|
}
|
|
63
63
|
catch (err) {
|
|
64
64
|
uiError(err instanceof Error ? err.message : String(err));
|
|
@@ -90,7 +90,14 @@ export async function runDbExplain(options) {
|
|
|
90
90
|
userRequest = `[Focus on file: ${options.file}]\n\n${userRequest}`;
|
|
91
91
|
}
|
|
92
92
|
try {
|
|
93
|
-
await agentLoop(ctx, userRequest, DB_EXPLAIN_TOOLS, provider, config, 'db explain', db, systemPrompt);
|
|
93
|
+
const explanation = await agentLoop(ctx, userRequest, DB_EXPLAIN_TOOLS, provider, config, 'db explain', db, systemPrompt);
|
|
94
|
+
// v0.2.3: structured output
|
|
95
|
+
if (options.format === 'json' || options.format === 'ndjson') {
|
|
96
|
+
process.stdout.write(formatOutput({ version: '1', explanation, sessionId }, options.format, DbExplainOutputSchema));
|
|
97
|
+
}
|
|
98
|
+
else if (options.format === 'plain') {
|
|
99
|
+
process.stdout.write(stripAnsi(explanation) + '\n');
|
|
100
|
+
}
|
|
94
101
|
updateSessionStatus(db, sessionId, 'completed');
|
|
95
102
|
}
|
|
96
103
|
catch (err) {
|
|
@@ -100,6 +107,17 @@ export async function runDbExplain(options) {
|
|
|
100
107
|
process.exit(130);
|
|
101
108
|
}
|
|
102
109
|
const message = err instanceof Error ? err.message : String(err);
|
|
110
|
+
// v0.2.3: structured error output
|
|
111
|
+
if (options.format === 'json') {
|
|
112
|
+
process.stderr.write(JSON.stringify({ version: '1', error: message, exitCode: 1 }) + '\n');
|
|
113
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
else if (options.format === 'ndjson') {
|
|
117
|
+
process.stderr.write(JSON.stringify({ version: '1', event: 'error', error: message }) + '\n');
|
|
118
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
103
121
|
uiError(message);
|
|
104
122
|
updateSessionStatus(db, sessionId, 'failed', message);
|
|
105
123
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-explain.js","sourceRoot":"","sources":["../../src/actions/db-explain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"db-explain.js","sourceRoot":"","sources":["../../src/actions/db-explain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OA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AAI,CAAC;QACH,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,uEAAuE,CAAC;IACrF,CAAC;IAED,OAAO,QAAQ;SACZ,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,WAAW,CAAC;SACjD,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,CAAC;SAC/C,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC,kBAAkB,CAAC;SAC/D,OAAO,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -9,5 +9,9 @@ export interface DbMigrateOptions {
|
|
|
9
9
|
session?: string;
|
|
10
10
|
quiet?: boolean;
|
|
11
11
|
projectRoot?: string;
|
|
12
|
+
/** Override provider (v0.2.2) */
|
|
13
|
+
provider?: string;
|
|
14
|
+
/** Override LLM model (v0.2.2) */
|
|
15
|
+
model?: string;
|
|
12
16
|
}
|
|
13
17
|
export declare function runDbMigrate(options: DbMigrateOptions): Promise<void>;
|
|
@@ -25,7 +25,7 @@ const DB_MIGRATE_TOOLS = [
|
|
|
25
25
|
];
|
|
26
26
|
export async function runDbMigrate(options) {
|
|
27
27
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
28
|
-
const config = getConfig(projectRoot, { quiet: options.quiet });
|
|
28
|
+
const config = getConfig(projectRoot, { quiet: options.quiet, provider: options.provider, model: options.model });
|
|
29
29
|
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet));
|
|
30
30
|
const schemaInfo = parsePrismaSchema(projectRoot);
|
|
31
31
|
if (!schemaInfo) {
|
|
@@ -51,7 +51,7 @@ export async function runDbMigrate(options) {
|
|
|
51
51
|
});
|
|
52
52
|
let provider;
|
|
53
53
|
try {
|
|
54
|
-
provider = createProvider(config.provider.default);
|
|
54
|
+
provider = createProvider(config.provider.default, config.provider);
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
57
|
uiError(err instanceof Error ? err.message : String(err));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-migrate.js","sourceRoot":"","sources":["../../src/actions/db-migrate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,MAAM,EACN,IAAI,EACJ,KAAK,IAAI,OAAO,EAChB,MAAM,EACN,KAAK,EACL,IAAI,EACJ,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,gBAAgB,GAAW;IAC/B,0BAA0B;IAC1B,mBAAmB;IACnB,YAAY;IACZ,cAAc;IACd,uBAAuB;IACvB,qBAAqB;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":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CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,OAAO,CAAC,CAAC;QACjB,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,IAK7B;IACC,MAAM,QAAQ,GAAG,kBAAkB,CACjC,YAAY,EACZ,uFAAuF,CACxF,CAAC;IAEF,sFAAsF;IACtF,OAAO,QAAQ;SACZ,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,WAAW,CAAC;SACjD,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,CAAC;SAC/C,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC,kBAAkB,CAAC;SAC/D,OAAO,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export interface DbSchemaOptions {
|
|
6
6
|
json?: boolean;
|
|
7
|
-
|
|
7
|
+
prismaModel?: string;
|
|
8
8
|
quiet?: boolean;
|
|
9
9
|
projectRoot?: string;
|
|
10
|
+
/** Output format (v0.2.3) */
|
|
11
|
+
format?: 'text' | 'json' | 'ndjson' | 'plain';
|
|
10
12
|
}
|
|
11
13
|
export declare function runDbSchema(options: DbSchemaOptions): Promise<void>;
|
|
@@ -6,6 +6,7 @@ import { parsePrismaSchema } from '../db/schema.js';
|
|
|
6
6
|
import { renderSchemaSummary, renderModelSummary } from '../db/summary.js';
|
|
7
7
|
import { initUI, info, error as uiError } from '../ui.js';
|
|
8
8
|
import { getConfig } from '../config.js';
|
|
9
|
+
import { formatOutput, DbSchemaOutputSchema } from '../output/schemas.js';
|
|
9
10
|
import * as path from 'node:path';
|
|
10
11
|
export async function runDbSchema(options) {
|
|
11
12
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
@@ -16,23 +17,35 @@ export async function runDbSchema(options) {
|
|
|
16
17
|
uiError('No schema.prisma found in project. Run `prisma init` to create one.');
|
|
17
18
|
process.exit(5);
|
|
18
19
|
}
|
|
19
|
-
//
|
|
20
|
+
// v0.2.3: structured output via formatOutput
|
|
21
|
+
const effectiveFormat = options.format ?? (options.json ? 'json' : 'text');
|
|
22
|
+
if (effectiveFormat === 'json' || effectiveFormat === 'ndjson') {
|
|
23
|
+
const data = {
|
|
24
|
+
version: '1',
|
|
25
|
+
models: schemaInfo.models.map((m) => ({ name: m.name, fieldCount: m.fields.length })),
|
|
26
|
+
enumCount: schemaInfo.enums?.length ?? 0,
|
|
27
|
+
datasourceProvider: schemaInfo.datasourceProvider ?? null,
|
|
28
|
+
};
|
|
29
|
+
process.stdout.write(formatOutput(data, effectiveFormat, DbSchemaOutputSchema));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// --json: legacy output (backward compat)
|
|
20
33
|
if (options.json) {
|
|
21
34
|
process.stdout.write(JSON.stringify(schemaInfo, null, 2) + '\n');
|
|
22
35
|
return;
|
|
23
36
|
}
|
|
24
37
|
// --model <name>: filter to single model
|
|
25
|
-
if (options.
|
|
26
|
-
const model = schemaInfo.models.find((m) => m.name.toLowerCase() === options.
|
|
38
|
+
if (options.prismaModel) {
|
|
39
|
+
const model = schemaInfo.models.find((m) => m.name.toLowerCase() === options.prismaModel.toLowerCase());
|
|
27
40
|
if (!model) {
|
|
28
|
-
uiError(`Model "${options.
|
|
41
|
+
uiError(`Model "${options.prismaModel}" not found in schema. Available: ${schemaInfo.models.map((m) => m.name).join(', ')}`);
|
|
29
42
|
process.exit(2);
|
|
30
43
|
}
|
|
31
44
|
const colorEnabled = config.ui.color !== 'never';
|
|
32
45
|
info(renderModelSummary(model, colorEnabled));
|
|
33
46
|
return;
|
|
34
47
|
}
|
|
35
|
-
const colorEnabled = config.ui.color !== 'never';
|
|
48
|
+
const colorEnabled = config.ui.color !== 'never' && effectiveFormat !== 'plain';
|
|
36
49
|
info(renderSchemaSummary(schemaInfo, colorEnabled));
|
|
37
50
|
}
|
|
38
51
|
//# sourceMappingURL=db-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-schema.js","sourceRoot":"","sources":["../../src/actions/db-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"db-schema.js","sourceRoot":"","sources":["../../src/actions/db-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAWlC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAwB;IACxD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OA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,GAAG,IAAI,CAAC,CAAC;QACjE,OAAO;IACT,CAAC;IAED,yCAAyC;IACzC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAY,CAAC,WAAW,EAAE,CACnE,CAAC;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,UAAU,OAAO,CAAC,WAAW,qCAAqC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC;QACjD,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,OAAO,IAAI,eAAe,KAAK,OAAO,CAAC;IAChF,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -10,5 +10,11 @@ export interface UpgradeDepsOptions {
|
|
|
10
10
|
session?: string;
|
|
11
11
|
quiet?: boolean;
|
|
12
12
|
projectRoot?: string;
|
|
13
|
+
/** Override provider (v0.2.2) */
|
|
14
|
+
provider?: string;
|
|
15
|
+
/** Override LLM model (v0.2.2) */
|
|
16
|
+
model?: string;
|
|
17
|
+
/** Output format (v0.2.3) */
|
|
18
|
+
format?: 'text' | 'json' | 'ndjson' | 'plain';
|
|
13
19
|
}
|
|
14
20
|
export declare function runUpgradeDeps(options: UpgradeDepsOptions): Promise<void>;
|
|
@@ -13,9 +13,10 @@ import { classifyAll, } from '../upgrade/classifier.js';
|
|
|
13
13
|
import { fetchChangelogInfo } from '../upgrade/changelog.js';
|
|
14
14
|
import { readJsonFile, writeFileAtomic } from '../fs-helpers.js';
|
|
15
15
|
import { loadPromptTemplate } from '../prompt-loader.js';
|
|
16
|
+
import { formatOutput, UpgradeDepsOutputSchema } from '../output/schemas.js';
|
|
16
17
|
export async function runUpgradeDeps(options) {
|
|
17
18
|
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
18
|
-
const config = getConfig(projectRoot, { quiet: options.quiet });
|
|
19
|
+
const config = getConfig(projectRoot, { quiet: options.quiet, provider: options.provider, model: options.model });
|
|
19
20
|
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet));
|
|
20
21
|
const project = detectProjectType(projectRoot);
|
|
21
22
|
const pm = project.packageManager ?? 'npm';
|
|
@@ -47,6 +48,23 @@ export async function runUpgradeDeps(options) {
|
|
|
47
48
|
}
|
|
48
49
|
// 4. Render upgrade preview table
|
|
49
50
|
renderUpgradeTable(filtered);
|
|
51
|
+
// v0.2.3: structured output
|
|
52
|
+
if (options.format === 'json' || options.format === 'ndjson') {
|
|
53
|
+
const upgrades = filtered.map((u) => ({
|
|
54
|
+
name: u.name,
|
|
55
|
+
current: u.current,
|
|
56
|
+
target: u.target,
|
|
57
|
+
risk: u.risk,
|
|
58
|
+
}));
|
|
59
|
+
process.stdout.write(formatOutput({
|
|
60
|
+
version: '1',
|
|
61
|
+
upgrades,
|
|
62
|
+
applied: !options.dryRun && Boolean(options.yes),
|
|
63
|
+
dryRun: Boolean(options.dryRun),
|
|
64
|
+
}, options.format, UpgradeDepsOutputSchema));
|
|
65
|
+
if (options.dryRun || !options.yes)
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
50
68
|
// 5. For major upgrades, use LLM to summarize breaking changes
|
|
51
69
|
const majors = filtered.filter((u) => u.risk === 'major');
|
|
52
70
|
if (majors.length > 0) {
|
|
@@ -196,7 +214,7 @@ async function summarizeMajorUpgrades(majors, projectType, projectRoot, config)
|
|
|
196
214
|
info('');
|
|
197
215
|
info(bold('Major upgrade analysis:'));
|
|
198
216
|
try {
|
|
199
|
-
const provider = createProvider(config.provider.default);
|
|
217
|
+
const provider = createProvider(config.provider.default, config.provider);
|
|
200
218
|
const db = initializeDatabase();
|
|
201
219
|
const sessionId = resolveOrCreateSession(db, {
|
|
202
220
|
command: 'upgrade deps analysis',
|