@ariacode/cli 0.1.0 → 0.2.2
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 +190 -5
- package/dist/actions/db-ask.d.ts +16 -0
- package/dist/actions/db-ask.js +130 -0
- package/dist/actions/db-ask.js.map +1 -0
- package/dist/actions/db-explain.d.ts +16 -0
- package/dist/actions/db-explain.js +123 -0
- package/dist/actions/db-explain.js.map +1 -0
- package/dist/actions/db-migrate.d.ts +17 -0
- package/dist/actions/db-migrate.js +124 -0
- package/dist/actions/db-migrate.js.map +1 -0
- package/dist/actions/db-schema.d.ts +11 -0
- package/dist/actions/db-schema.js +38 -0
- package/dist/actions/db-schema.js.map +1 -0
- package/dist/actions/upgrade-deps.d.ts +18 -0
- package/dist/actions/upgrade-deps.js +227 -0
- package/dist/actions/upgrade-deps.js.map +1 -0
- package/dist/actions/upgrade-prisma.d.ts +16 -0
- package/dist/actions/upgrade-prisma.js +177 -0
- package/dist/actions/upgrade-prisma.js.map +1 -0
- package/dist/actions.d.ts +20 -0
- package/dist/actions.js +105 -36
- package/dist/actions.js.map +1 -1
- package/dist/agent.js +28 -9
- package/dist/agent.js.map +1 -1
- package/dist/cli.js +102 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +16 -0
- package/dist/config.js +39 -0
- package/dist/config.js.map +1 -1
- package/dist/db/client-usage.d.ts +19 -0
- package/dist/db/client-usage.js +107 -0
- package/dist/db/client-usage.js.map +1 -0
- package/dist/db/migrate.d.ts +26 -0
- package/dist/db/migrate.js +59 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/schema.d.ts +106 -0
- package/dist/db/schema.js +275 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/summary.d.ts +12 -0
- package/dist/db/summary.js +133 -0
- package/dist/db/summary.js.map +1 -0
- package/dist/fs-helpers.d.ts +19 -0
- package/dist/fs-helpers.js +92 -0
- package/dist/fs-helpers.js.map +1 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.js +102 -0
- package/dist/parser.js.map +1 -1
- package/dist/prompt-loader.d.ts +9 -0
- package/dist/prompt-loader.js +26 -0
- package/dist/prompt-loader.js.map +1 -0
- package/dist/prompts/db_ask.md +39 -0
- package/dist/prompts/db_explain.md +43 -0
- package/dist/prompts/db_migrate.md +48 -0
- package/dist/prompts/upgrade_deps.md +23 -0
- package/dist/prompts/upgrade_prisma.md +28 -0
- package/dist/provider.d.ts +9 -2
- package/dist/provider.js +12 -39
- package/dist/provider.js.map +1 -1
- package/dist/storage.d.ts +11 -0
- package/dist/storage.js +36 -4
- package/dist/storage.js.map +1 -1
- package/dist/tools.d.ts +26 -0
- package/dist/tools.js +256 -8
- package/dist/tools.js.map +1 -1
- package/dist/upgrade/changelog.d.ts +21 -0
- package/dist/upgrade/changelog.js +62 -0
- package/dist/upgrade/changelog.js.map +1 -0
- package/dist/upgrade/classifier.d.ts +25 -0
- package/dist/upgrade/classifier.js +78 -0
- package/dist/upgrade/classifier.js.map +1 -0
- package/dist/upgrade/outdated.d.ts +17 -0
- package/dist/upgrade/outdated.js +138 -0
- package/dist/upgrade/outdated.js.map +1 -0
- package/dist/upgrade/prisma-upgrade.d.ts +20 -0
- package/dist/upgrade/prisma-upgrade.js +66 -0
- package/dist/upgrade/prisma-upgrade.js.map +1 -0
- package/package.json +7 -4
- package/dist/prompts/prompts/ask.md +0 -20
- package/dist/prompts/prompts/explore.md +0 -38
- package/dist/prompts/prompts/patch.md +0 -27
- package/dist/prompts/prompts/plan.md +0 -41
- package/dist/prompts/prompts/review.md +0 -33
package/README.md
CHANGED
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://nodejs.org)
|
|
8
8
|
[](./LICENSE)
|
|
9
|
-
[](https://github.com/ariacodeai/ariacode/actions)
|
|
10
9
|
[](https://www.npmjs.com/package/@ariacode/cli)
|
|
11
10
|
|
|
12
11
|
A predictable, terminal-native coding agent for Next.js, Nest.js, Prisma and Node.js projects.
|
|
13
12
|
|
|
14
|
-
Aria reads your repository, generates safe diffs with preview and tracks every mutation in a local SQLite history — no surprises.
|
|
13
|
+
Aria reads your repository, generates safe diffs with preview, understands your Prisma schema, upgrades dependencies with risk analysis, and tracks every mutation in a local SQLite history — no surprises.
|
|
15
14
|
|
|
16
15
|
## Requirements
|
|
17
16
|
|
|
@@ -33,6 +32,9 @@ After installation the `aria` binary is available globally.
|
|
|
33
32
|
# Ask a question about your codebase
|
|
34
33
|
aria ask "How is authentication handled in this project?"
|
|
35
34
|
|
|
35
|
+
# Use a different provider for a single command
|
|
36
|
+
aria ask "Explain the data model" --provider openrouter --model deepseek/deepseek-chat
|
|
37
|
+
|
|
36
38
|
# Generate an implementation plan (read-only, no changes)
|
|
37
39
|
aria plan "Add rate limiting to the API routes"
|
|
38
40
|
|
|
@@ -48,6 +50,18 @@ aria review
|
|
|
48
50
|
# Explore an unfamiliar codebase
|
|
49
51
|
aria explore
|
|
50
52
|
|
|
53
|
+
# Prisma schema inspection (instant, no LLM)
|
|
54
|
+
aria db schema
|
|
55
|
+
|
|
56
|
+
# Ask about your database schema
|
|
57
|
+
aria db ask "users with more than 5 orders in the last 30 days"
|
|
58
|
+
|
|
59
|
+
# Upgrade outdated dependencies
|
|
60
|
+
aria upgrade deps
|
|
61
|
+
|
|
62
|
+
# Upgrade Prisma with migration guidance
|
|
63
|
+
aria upgrade prisma
|
|
64
|
+
|
|
51
65
|
# Check your environment
|
|
52
66
|
aria doctor
|
|
53
67
|
```
|
|
@@ -59,7 +73,7 @@ aria doctor
|
|
|
59
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.
|
|
60
74
|
|
|
61
75
|
```
|
|
62
|
-
aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet]
|
|
76
|
+
aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet] [--provider <name>] [--model <name>]
|
|
63
77
|
```
|
|
64
78
|
|
|
65
79
|
| Flag | Description |
|
|
@@ -67,6 +81,8 @@ aria ask "<question>" [--session <id>] [--max-tokens <n>] [--quiet]
|
|
|
67
81
|
| `--session <id>` | Resume an existing session |
|
|
68
82
|
| `--max-tokens <n>` | Override max tokens for this response |
|
|
69
83
|
| `--quiet` | Suppress non-essential output |
|
|
84
|
+
| `--provider <name>` | Override provider for this command |
|
|
85
|
+
| `--model <name>` | Override LLM model for this command |
|
|
70
86
|
|
|
71
87
|
### `aria plan <goal>`
|
|
72
88
|
|
|
@@ -152,12 +168,169 @@ aria config init # Create ./.aria.toml with defaults
|
|
|
152
168
|
|
|
153
169
|
### `aria doctor`
|
|
154
170
|
|
|
155
|
-
Run environment diagnostics: Node.js version, git, ripgrep, config validity, history DB, provider API keys, and
|
|
171
|
+
Run environment diagnostics: Node.js version, git, ripgrep, config validity, history DB, provider API keys, project detection, and Prisma schema presence.
|
|
156
172
|
|
|
157
173
|
```
|
|
158
174
|
aria doctor [--format text|json]
|
|
159
175
|
```
|
|
160
176
|
|
|
177
|
+
### `aria db schema`
|
|
178
|
+
|
|
179
|
+
Parse and render `schema.prisma` content — models, fields, relations, enums, indexes. No LLM call, instant and free.
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
aria db schema [--json] [--prisma-model <name>]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
| Flag | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `--json` | Output raw `PrismaSchemaInfo` as JSON |
|
|
188
|
+
| `--prisma-model <name>` | Filter to a single Prisma model |
|
|
189
|
+
|
|
190
|
+
Example output:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Prisma Schema: prisma/schema.prisma
|
|
194
|
+
Provider: postgresql
|
|
195
|
+
|
|
196
|
+
Models (3)
|
|
197
|
+
|
|
198
|
+
User
|
|
199
|
+
┌──────────────┬──────────┬──────────────────┐
|
|
200
|
+
│ Field │ Type │ Modifiers │
|
|
201
|
+
├──────────────┼──────────┼──────────────────┤
|
|
202
|
+
│ id │ String │ @id @default │
|
|
203
|
+
│ email │ String │ @unique │
|
|
204
|
+
│ createdAt │ DateTime │ @default(now()) │
|
|
205
|
+
│ orders │ Order[] │ relation │
|
|
206
|
+
└──────────────┴──────────┴──────────────────┘
|
|
207
|
+
|
|
208
|
+
Enums (1)
|
|
209
|
+
Role: ADMIN, USER, GUEST
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### `aria db ask <question>`
|
|
213
|
+
|
|
214
|
+
Q&A over your Prisma schema. Generates runnable Prisma Client code. Warns when queries touch sensitive fields (password, token, secret, apiKey).
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
aria db ask "<question>" [--session <id>] [--prisma-model <name>] [--provider <name>] [--model <name>]
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### `aria db explain <description>`
|
|
221
|
+
|
|
222
|
+
Analyze Prisma Client usage in your code. Identifies N+1 queries, missing indexes, over-fetching, and cartesian products. Suggests `@@index` additions and query improvements.
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
aria db explain "<description>" [--file <path>] [--session <id>]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `aria db migrate <description>`
|
|
229
|
+
|
|
230
|
+
Propose changes to `schema.prisma` with diff preview and confirmation. Prints manual `prisma migrate` commands — Aria never runs migrations.
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
aria db migrate "<description>" [--dry-run] [--yes] [--session <id>]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
| Flag | Description |
|
|
237
|
+
|------|-------------|
|
|
238
|
+
| `--dry-run` | Preview schema diff without writing |
|
|
239
|
+
| `--yes` | Skip confirmation prompt |
|
|
240
|
+
|
|
241
|
+
After a successful write:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
✓ Schema updated: prisma/schema.prisma
|
|
245
|
+
|
|
246
|
+
To apply this migration, run:
|
|
247
|
+
|
|
248
|
+
Development:
|
|
249
|
+
pnpm prisma migrate dev --name <migration_name>
|
|
250
|
+
|
|
251
|
+
Production:
|
|
252
|
+
pnpm prisma migrate deploy
|
|
253
|
+
|
|
254
|
+
Aria does not run migrations automatically.
|
|
255
|
+
Review the generated SQL before applying to production.
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### `aria upgrade deps`
|
|
259
|
+
|
|
260
|
+
Analyze outdated dependencies, classify by semver risk, and propose upgrades to `package.json`. Supports npm, pnpm, yarn, and bun.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
aria upgrade deps [--dry-run] [--yes] [--risk patch|minor|major|all] [--dev]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
| Flag | Description |
|
|
267
|
+
|------|-------------|
|
|
268
|
+
| `--dry-run` | Preview upgrades without modifying `package.json` |
|
|
269
|
+
| `--yes` | Skip confirmation prompt |
|
|
270
|
+
| `--risk <level>` | Filter by risk: `patch`, `minor` (default — includes patch), `major`, `all` |
|
|
271
|
+
| `--dev` | Include devDependencies |
|
|
272
|
+
|
|
273
|
+
Behavior:
|
|
274
|
+
1. Detects your package manager from lockfile
|
|
275
|
+
2. Runs `{pm} outdated --json` (read-only)
|
|
276
|
+
3. Classifies each upgrade as patch / minor / major / prerelease
|
|
277
|
+
4. For major upgrades, uses LLM to summarize breaking changes
|
|
278
|
+
5. Shows a grouped table preview
|
|
279
|
+
6. On confirmation, updates `package.json` and prints install command
|
|
280
|
+
|
|
281
|
+
Aria never runs `npm install` / `pnpm install` / `yarn install` / `bun install`. You run it.
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
✓ Updated package.json with 12 dependency upgrades
|
|
285
|
+
|
|
286
|
+
To install the new versions, run:
|
|
287
|
+
pnpm install
|
|
288
|
+
|
|
289
|
+
Then verify:
|
|
290
|
+
pnpm test
|
|
291
|
+
pnpm run build
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### `aria upgrade prisma`
|
|
295
|
+
|
|
296
|
+
Prisma-specific upgrade with version detection and migration guidance for major upgrades.
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
aria upgrade prisma [--dry-run] [--yes]
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
| Flag | Description |
|
|
303
|
+
|------|-------------|
|
|
304
|
+
| `--dry-run` | Preview without modifying `package.json` |
|
|
305
|
+
| `--yes` | Skip confirmation prompt |
|
|
306
|
+
|
|
307
|
+
For major Prisma upgrades, the LLM analyzes your `schema.prisma` for patterns affected by breaking changes and provides project-specific migration steps.
|
|
308
|
+
|
|
309
|
+
After a successful upgrade:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
✓ Updated Prisma versions in package.json:
|
|
313
|
+
prisma: 5.22.0 → 6.1.0
|
|
314
|
+
@prisma/client: 5.22.0 → 6.1.0
|
|
315
|
+
|
|
316
|
+
Next steps (run in order):
|
|
317
|
+
|
|
318
|
+
1. Install updated dependencies:
|
|
319
|
+
pnpm install
|
|
320
|
+
|
|
321
|
+
2. Regenerate Prisma Client:
|
|
322
|
+
pnpm prisma generate
|
|
323
|
+
|
|
324
|
+
3. Review breaking changes:
|
|
325
|
+
https://github.com/prisma/prisma/releases/tag/6.1.0
|
|
326
|
+
|
|
327
|
+
4. Run your test suite:
|
|
328
|
+
pnpm test
|
|
329
|
+
|
|
330
|
+
Aria has updated package.json only.
|
|
331
|
+
Migration commands must be run manually.
|
|
332
|
+
```
|
|
333
|
+
|
|
161
334
|
## Configuration
|
|
162
335
|
|
|
163
336
|
Aria loads configuration from multiple sources in this precedence order (highest wins):
|
|
@@ -176,6 +349,14 @@ default = "anthropic" # anthropic | openai | ollama | openrouter
|
|
|
176
349
|
model = "claude-sonnet-4-6"
|
|
177
350
|
max_tokens = 4096
|
|
178
351
|
|
|
352
|
+
# Per-provider overrides (optional)
|
|
353
|
+
[provider.anthropic]
|
|
354
|
+
model = "claude-sonnet-4-6" # override model when using Anthropic
|
|
355
|
+
|
|
356
|
+
[provider.openrouter]
|
|
357
|
+
model = "deepseek/deepseek-chat" # override model when using OpenRouter
|
|
358
|
+
base_url = "https://openrouter.ai/api/v1" # custom endpoint (optional)
|
|
359
|
+
|
|
179
360
|
[agent]
|
|
180
361
|
max_iterations = 25
|
|
181
362
|
mode = "build" # build | plan
|
|
@@ -204,6 +385,7 @@ Run `aria config init` to generate a `.aria.toml` in the current directory.
|
|
|
204
385
|
| `ANTHROPIC_API_KEY` | API key for Anthropic provider |
|
|
205
386
|
| `OPENAI_API_KEY` | API key for OpenAI provider |
|
|
206
387
|
| `OPENROUTER_API_KEY` | API key for OpenRouter provider |
|
|
388
|
+
| `OPENROUTER_BASE_URL` | Custom base URL for OpenRouter-compatible endpoints |
|
|
207
389
|
| `ARIA_PROVIDER` | Override default provider |
|
|
208
390
|
| `ARIA_MODEL` | Override model name |
|
|
209
391
|
| `ARIA_MAX_TOKENS` | Override max tokens |
|
|
@@ -368,7 +550,7 @@ See the full model catalogue at [openrouter.ai/models](https://openrouter.ai/mod
|
|
|
368
550
|
| `2` | Invalid arguments |
|
|
369
551
|
| `3` | Configuration error |
|
|
370
552
|
| `4` | Provider error (e.g. missing API key) |
|
|
371
|
-
| `5` | Project detection error |
|
|
553
|
+
| `5` | Project detection error / Prisma not found |
|
|
372
554
|
| `130` | User cancelled (Ctrl+C or declined confirmation) |
|
|
373
555
|
|
|
374
556
|
## Session History
|
|
@@ -394,6 +576,9 @@ Sessions older than `retain_days` (default: 90) are cleaned up automatically.
|
|
|
394
576
|
- `.env` files and `node_modules` are excluded from directory listings by default
|
|
395
577
|
- API keys are never logged to the history database or terminal output
|
|
396
578
|
- All mutations require confirmation unless `--yes` is passed
|
|
579
|
+
- `aria db migrate` never executes `prisma migrate` — prints commands for user to run
|
|
580
|
+
- `aria upgrade deps` never runs `npm/pnpm/yarn/bun install` — modifies `package.json` only
|
|
581
|
+
- `aria upgrade prisma` never runs `prisma migrate` or install commands
|
|
397
582
|
|
|
398
583
|
## Contributing
|
|
399
584
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aria db ask — Q&A over Prisma schema, generates Prisma Client code.
|
|
3
|
+
* Forced read-only (plan mode). Never mutates.
|
|
4
|
+
*/
|
|
5
|
+
export interface DbAskOptions {
|
|
6
|
+
question: string;
|
|
7
|
+
session?: string;
|
|
8
|
+
prismaModel?: string;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
projectRoot?: string;
|
|
11
|
+
/** Override provider (v0.2.2) */
|
|
12
|
+
provider?: string;
|
|
13
|
+
/** Override LLM model (v0.2.2) */
|
|
14
|
+
model?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function runDbAsk(options: DbAskOptions): Promise<void>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aria db ask — Q&A over Prisma schema, generates Prisma Client code.
|
|
3
|
+
* Forced read-only (plan mode). Never mutates.
|
|
4
|
+
*/
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
import * as fs from 'node:fs';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname } from 'node:path';
|
|
10
|
+
import { getConfig } from '../config.js';
|
|
11
|
+
import { parsePrismaSchema } from '../db/schema.js';
|
|
12
|
+
import { renderSchemaSummary } from '../db/summary.js';
|
|
13
|
+
import { detectProjectType } from '../repo.js';
|
|
14
|
+
import { createProvider } from '../provider.js';
|
|
15
|
+
import { initializeDatabase, createSession, updateSessionStatus, logMessage } from '../storage.js';
|
|
16
|
+
import { readFileTool, searchCodeTool, readPrismaSchemaParserTool, findPrismaUsageTool, findModelReferencesTool, } from '../tools.js';
|
|
17
|
+
import { agentLoop, UserCancelledError } from '../agent.js';
|
|
18
|
+
import { initUI, info, error as uiError, yellow } from '../ui.js';
|
|
19
|
+
import { ConfirmCancelledError } from '../ui.js';
|
|
20
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const DB_ASK_TOOLS = [
|
|
22
|
+
readPrismaSchemaParserTool,
|
|
23
|
+
findPrismaUsageTool,
|
|
24
|
+
findModelReferencesTool,
|
|
25
|
+
readFileTool,
|
|
26
|
+
searchCodeTool,
|
|
27
|
+
];
|
|
28
|
+
const SENSITIVE_PATTERN = /password|token|secret|hash|apiKey|stripeCustomerId|ssn/i;
|
|
29
|
+
export async function runDbAsk(options) {
|
|
30
|
+
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
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));
|
|
33
|
+
// Validate schema exists
|
|
34
|
+
const schemaInfo = parsePrismaSchema(projectRoot);
|
|
35
|
+
if (!schemaInfo) {
|
|
36
|
+
uiError('No schema.prisma found. aria db ask requires a Prisma project.');
|
|
37
|
+
process.exit(5);
|
|
38
|
+
}
|
|
39
|
+
const project = detectProjectType(projectRoot);
|
|
40
|
+
const db = initializeDatabase();
|
|
41
|
+
let sessionId;
|
|
42
|
+
if (options.session) {
|
|
43
|
+
// Validate session exists before resuming
|
|
44
|
+
const { getSession } = await import('../storage.js');
|
|
45
|
+
const existing = getSession(db, options.session);
|
|
46
|
+
if (!existing) {
|
|
47
|
+
uiError(`Session not found: ${options.session}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
sessionId = existing.id;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
sessionId = randomUUID();
|
|
54
|
+
createSession(db, {
|
|
55
|
+
id: sessionId,
|
|
56
|
+
command: 'db ask',
|
|
57
|
+
projectRoot,
|
|
58
|
+
provider: config.provider.default,
|
|
59
|
+
model: config.provider.model,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
let provider;
|
|
63
|
+
try {
|
|
64
|
+
provider = createProvider(config.provider.default, config.provider);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
uiError(err instanceof Error ? err.message : String(err));
|
|
68
|
+
updateSessionStatus(db, sessionId, 'failed', String(err));
|
|
69
|
+
process.exit(4);
|
|
70
|
+
}
|
|
71
|
+
const ctx = {
|
|
72
|
+
projectRoot,
|
|
73
|
+
sessionId,
|
|
74
|
+
provider: config.provider.default,
|
|
75
|
+
model: config.provider.model,
|
|
76
|
+
mode: 'plan', // always read-only
|
|
77
|
+
dryRun: false,
|
|
78
|
+
assumeYes: false,
|
|
79
|
+
maxIterations: config.agent.maxIterations,
|
|
80
|
+
timeoutSeconds: config.agent.timeoutSeconds,
|
|
81
|
+
};
|
|
82
|
+
const schemaSummary = renderSchemaSummary(schemaInfo, false);
|
|
83
|
+
const systemPrompt = buildDbAskPrompt({
|
|
84
|
+
projectType: project.type,
|
|
85
|
+
schemaPath: schemaInfo.path,
|
|
86
|
+
datasourceProvider: schemaInfo.datasourceProvider ?? 'unknown',
|
|
87
|
+
schemaSummary,
|
|
88
|
+
templateDir: path.join(__dirname, '..', 'prompts'),
|
|
89
|
+
});
|
|
90
|
+
logMessage(db, sessionId, 'system', systemPrompt);
|
|
91
|
+
// Prepend sensitivity warning hint to question if relevant
|
|
92
|
+
let userRequest = options.question;
|
|
93
|
+
if (options.prismaModel) {
|
|
94
|
+
userRequest = `[Focus on model: ${options.prismaModel}]\n\n${userRequest}`;
|
|
95
|
+
}
|
|
96
|
+
if (SENSITIVE_PATTERN.test(options.question)) {
|
|
97
|
+
userRequest = `[NOTE: This question may involve sensitive fields. Add a WARNING above the code.]\n\n${userRequest}`;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
await agentLoop(ctx, userRequest, DB_ASK_TOOLS, provider, config, 'db ask', db, systemPrompt);
|
|
101
|
+
updateSessionStatus(db, sessionId, 'completed');
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
if (err instanceof UserCancelledError || err instanceof ConfirmCancelledError) {
|
|
105
|
+
info(yellow('Operation cancelled.'));
|
|
106
|
+
updateSessionStatus(db, sessionId, 'cancelled');
|
|
107
|
+
process.exit(130);
|
|
108
|
+
}
|
|
109
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
110
|
+
uiError(message);
|
|
111
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function buildDbAskPrompt(opts) {
|
|
116
|
+
const templatePath = path.join(opts.templateDir, 'db_ask.md');
|
|
117
|
+
let template;
|
|
118
|
+
try {
|
|
119
|
+
template = fs.readFileSync(templatePath, 'utf-8');
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
template = 'You are Aria Code\'s Prisma DB Assistant. Schema: {{schemaSummary}}';
|
|
123
|
+
}
|
|
124
|
+
return template
|
|
125
|
+
.replace(/\{\{projectType\}\}/g, opts.projectType)
|
|
126
|
+
.replace(/\{\{schemaPath\}\}/g, opts.schemaPath)
|
|
127
|
+
.replace(/\{\{datasourceProvider\}\}/g, opts.datasourceProvider)
|
|
128
|
+
.replace(/\{\{schemaSummary\}\}/g, () => opts.schemaSummary);
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=db-ask.js.map
|
|
@@ -0,0 +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,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AAC,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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aria db explain — analyze Prisma Client usage, explain performance characteristics.
|
|
3
|
+
* Forced read-only (plan mode). Never mutates.
|
|
4
|
+
*/
|
|
5
|
+
export interface DbExplainOptions {
|
|
6
|
+
description: string;
|
|
7
|
+
file?: string;
|
|
8
|
+
session?: string;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
projectRoot?: string;
|
|
11
|
+
/** Override provider (v0.2.2) */
|
|
12
|
+
provider?: string;
|
|
13
|
+
/** Override LLM model (v0.2.2) */
|
|
14
|
+
model?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function runDbExplain(options: DbExplainOptions): Promise<void>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aria db explain — analyze Prisma Client usage, explain performance characteristics.
|
|
3
|
+
* Forced read-only (plan mode). Never mutates.
|
|
4
|
+
*/
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
import * as fs from 'node:fs';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname } from 'node:path';
|
|
10
|
+
import { getConfig } from '../config.js';
|
|
11
|
+
import { parsePrismaSchema } from '../db/schema.js';
|
|
12
|
+
import { renderSchemaSummary } from '../db/summary.js';
|
|
13
|
+
import { detectProjectType } from '../repo.js';
|
|
14
|
+
import { createProvider } from '../provider.js';
|
|
15
|
+
import { initializeDatabase, createSession, updateSessionStatus, logMessage } from '../storage.js';
|
|
16
|
+
import { readFileTool, searchCodeTool, readPrismaSchemaParserTool, findPrismaUsageTool, findModelReferencesTool, } from '../tools.js';
|
|
17
|
+
import { agentLoop, UserCancelledError } from '../agent.js';
|
|
18
|
+
import { initUI, info, error as uiError, yellow } from '../ui.js';
|
|
19
|
+
import { ConfirmCancelledError } from '../ui.js';
|
|
20
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const DB_EXPLAIN_TOOLS = [
|
|
22
|
+
readPrismaSchemaParserTool,
|
|
23
|
+
findPrismaUsageTool,
|
|
24
|
+
findModelReferencesTool,
|
|
25
|
+
readFileTool,
|
|
26
|
+
searchCodeTool,
|
|
27
|
+
];
|
|
28
|
+
export async function runDbExplain(options) {
|
|
29
|
+
const projectRoot = path.resolve(options.projectRoot ?? process.cwd());
|
|
30
|
+
const config = getConfig(projectRoot, { quiet: options.quiet, provider: options.provider, model: options.model });
|
|
31
|
+
initUI(config.ui.color, config.ui.quiet || Boolean(options.quiet));
|
|
32
|
+
const schemaInfo = parsePrismaSchema(projectRoot);
|
|
33
|
+
if (!schemaInfo) {
|
|
34
|
+
uiError('No schema.prisma found. aria db explain requires a Prisma project.');
|
|
35
|
+
process.exit(5);
|
|
36
|
+
}
|
|
37
|
+
const project = detectProjectType(projectRoot);
|
|
38
|
+
const db = initializeDatabase();
|
|
39
|
+
let sessionId;
|
|
40
|
+
if (options.session) {
|
|
41
|
+
const { getSession } = await import('../storage.js');
|
|
42
|
+
const existing = getSession(db, options.session);
|
|
43
|
+
if (!existing) {
|
|
44
|
+
uiError(`Session not found: ${options.session}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
sessionId = existing.id;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
sessionId = randomUUID();
|
|
51
|
+
createSession(db, {
|
|
52
|
+
id: sessionId,
|
|
53
|
+
command: 'db explain',
|
|
54
|
+
projectRoot,
|
|
55
|
+
provider: config.provider.default,
|
|
56
|
+
model: config.provider.model,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
let provider;
|
|
60
|
+
try {
|
|
61
|
+
provider = createProvider(config.provider.default, config.provider);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
uiError(err instanceof Error ? err.message : String(err));
|
|
65
|
+
updateSessionStatus(db, sessionId, 'failed', String(err));
|
|
66
|
+
process.exit(4);
|
|
67
|
+
}
|
|
68
|
+
const ctx = {
|
|
69
|
+
projectRoot,
|
|
70
|
+
sessionId,
|
|
71
|
+
provider: config.provider.default,
|
|
72
|
+
model: config.provider.model,
|
|
73
|
+
mode: 'plan',
|
|
74
|
+
dryRun: false,
|
|
75
|
+
assumeYes: false,
|
|
76
|
+
maxIterations: config.agent.maxIterations,
|
|
77
|
+
timeoutSeconds: config.agent.timeoutSeconds,
|
|
78
|
+
};
|
|
79
|
+
const schemaSummary = renderSchemaSummary(schemaInfo, false);
|
|
80
|
+
const systemPrompt = buildDbExplainPrompt({
|
|
81
|
+
projectType: project.type,
|
|
82
|
+
schemaPath: schemaInfo.path,
|
|
83
|
+
datasourceProvider: schemaInfo.datasourceProvider ?? 'unknown',
|
|
84
|
+
schemaSummary,
|
|
85
|
+
templateDir: path.join(__dirname, '..', 'prompts'),
|
|
86
|
+
});
|
|
87
|
+
logMessage(db, sessionId, 'system', systemPrompt);
|
|
88
|
+
let userRequest = options.description;
|
|
89
|
+
if (options.file) {
|
|
90
|
+
userRequest = `[Focus on file: ${options.file}]\n\n${userRequest}`;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
await agentLoop(ctx, userRequest, DB_EXPLAIN_TOOLS, provider, config, 'db explain', db, systemPrompt);
|
|
94
|
+
updateSessionStatus(db, sessionId, 'completed');
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof UserCancelledError || err instanceof ConfirmCancelledError) {
|
|
98
|
+
info(yellow('Operation cancelled.'));
|
|
99
|
+
updateSessionStatus(db, sessionId, 'cancelled');
|
|
100
|
+
process.exit(130);
|
|
101
|
+
}
|
|
102
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
103
|
+
uiError(message);
|
|
104
|
+
updateSessionStatus(db, sessionId, 'failed', message);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function buildDbExplainPrompt(opts) {
|
|
109
|
+
const templatePath = path.join(opts.templateDir, 'db_explain.md');
|
|
110
|
+
let template;
|
|
111
|
+
try {
|
|
112
|
+
template = fs.readFileSync(templatePath, 'utf-8');
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
template = 'You are Aria Code\'s Prisma query analyzer. Schema: {{schemaSummary}}';
|
|
116
|
+
}
|
|
117
|
+
return template
|
|
118
|
+
.replace(/\{\{projectType\}\}/g, opts.projectType)
|
|
119
|
+
.replace(/\{\{schemaPath\}\}/g, opts.schemaPath)
|
|
120
|
+
.replace(/\{\{datasourceProvider\}\}/g, opts.datasourceProvider)
|
|
121
|
+
.replace(/\{\{schemaSummary\}\}/g, () => opts.schemaSummary);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=db-explain.js.map
|
|
@@ -0,0 +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,C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-0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aria db migrate — propose changes to schema.prisma only.
|
|
3
|
+
* NEVER executes prisma migrate commands. User runs those manually.
|
|
4
|
+
*/
|
|
5
|
+
export interface DbMigrateOptions {
|
|
6
|
+
description: string;
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
yes?: boolean;
|
|
9
|
+
session?: string;
|
|
10
|
+
quiet?: boolean;
|
|
11
|
+
projectRoot?: string;
|
|
12
|
+
/** Override provider (v0.2.2) */
|
|
13
|
+
provider?: string;
|
|
14
|
+
/** Override LLM model (v0.2.2) */
|
|
15
|
+
model?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function runDbMigrate(options: DbMigrateOptions): Promise<void>;
|