@ariacode/cli 0.1.0 → 0.2.1
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 +175 -4
- package/dist/actions/db-ask.d.ts +12 -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 +12 -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 +13 -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 +14 -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 +12 -0
- package/dist/actions/upgrade-prisma.js +177 -0
- package/dist/actions/upgrade-prisma.js.map +1 -0
- package/dist/actions.js +48 -13
- package/dist/actions.js.map +1 -1
- package/dist/agent.js +28 -9
- package/dist/agent.js.map +1 -1
- package/dist/cli.js +82 -0
- package/dist/cli.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 +9 -0
- package/dist/parser.js +86 -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 +2 -0
- package/dist/provider.js +6 -35
- 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 +63 -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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch changelog/release notes for major upgrades from npm registry.
|
|
3
|
+
* Uses the npm registry API (read-only, no auth required for public packages).
|
|
4
|
+
*/
|
|
5
|
+
export interface ChangelogInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
repositoryUrl?: string;
|
|
10
|
+
releaseNotesUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build changelog info for packages. Uses npm registry to find repo URLs.
|
|
14
|
+
* Actual changelog summarization is done by the LLM via the prompt.
|
|
15
|
+
* Fetches with bounded concurrency (max 6 parallel) to avoid hammering the registry.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchChangelogInfo(packages: {
|
|
18
|
+
name: string;
|
|
19
|
+
current: string;
|
|
20
|
+
target: string;
|
|
21
|
+
}[]): Promise<ChangelogInfo[]>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch changelog/release notes for major upgrades from npm registry.
|
|
3
|
+
* Uses the npm registry API (read-only, no auth required for public packages).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Build changelog info for packages. Uses npm registry to find repo URLs.
|
|
7
|
+
* Actual changelog summarization is done by the LLM via the prompt.
|
|
8
|
+
* Fetches with bounded concurrency (max 6 parallel) to avoid hammering the registry.
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchChangelogInfo(packages) {
|
|
11
|
+
const CONCURRENCY = 6;
|
|
12
|
+
const results = [];
|
|
13
|
+
for (let i = 0; i < packages.length; i += CONCURRENCY) {
|
|
14
|
+
const batch = packages.slice(i, i + CONCURRENCY);
|
|
15
|
+
const batchResults = await Promise.all(batch.map(async (pkg) => {
|
|
16
|
+
const repoUrl = await getRepositoryUrl(pkg.name);
|
|
17
|
+
return {
|
|
18
|
+
name: pkg.name,
|
|
19
|
+
from: pkg.current,
|
|
20
|
+
to: pkg.target,
|
|
21
|
+
repositoryUrl: repoUrl ?? undefined,
|
|
22
|
+
releaseNotesUrl: repoUrl ? buildReleaseNotesUrl(repoUrl, pkg.target) : undefined,
|
|
23
|
+
};
|
|
24
|
+
}));
|
|
25
|
+
results.push(...batchResults);
|
|
26
|
+
}
|
|
27
|
+
return results;
|
|
28
|
+
}
|
|
29
|
+
async function getRepositoryUrl(packageName) {
|
|
30
|
+
try {
|
|
31
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {
|
|
32
|
+
signal: AbortSignal.timeout(5000),
|
|
33
|
+
});
|
|
34
|
+
if (!res.ok) {
|
|
35
|
+
await res.text().catch(() => { });
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const data = (await res.json());
|
|
39
|
+
const repo = data.repository;
|
|
40
|
+
if (!repo)
|
|
41
|
+
return null;
|
|
42
|
+
const url = typeof repo === 'string' ? repo : repo.url;
|
|
43
|
+
if (!url)
|
|
44
|
+
return null;
|
|
45
|
+
// Normalize git URLs to HTTPS
|
|
46
|
+
return url
|
|
47
|
+
.replace(/^git\+/, '')
|
|
48
|
+
.replace(/^git:\/\//, 'https://')
|
|
49
|
+
.replace(/\.git$/, '')
|
|
50
|
+
.replace(/^ssh:\/\/git@github\.com/, 'https://github.com');
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function buildReleaseNotesUrl(repoUrl, version) {
|
|
57
|
+
if (repoUrl.includes('github.com')) {
|
|
58
|
+
return `${repoUrl}/releases/tag/v${version}`;
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=changelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/upgrade/changelog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAA6D;IAE7D,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,OAAO,GAAoB,EAAE,CAAC;IAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC;QACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC;QACjD,MAAM,YA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AC,IAAI,CAAC,GAAG,CAAC;QACvD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,8BAA8B;QAC9B,OAAO,GAAG;aACP,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;aACrB,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC;aAChC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;aACrB,OAAO,CAAC,0BAA0B,EAAE,oBAAoB,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAe,EAAE,OAAe;IAC5D,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,OAAO,kBAAkB,OAAO,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify dependency upgrades by semver risk level.
|
|
3
|
+
*/
|
|
4
|
+
import type { OutdatedPackage } from './outdated.js';
|
|
5
|
+
export type UpgradeRisk = 'patch' | 'minor' | 'major' | 'prerelease';
|
|
6
|
+
export interface ClassifiedUpgrade {
|
|
7
|
+
name: string;
|
|
8
|
+
current: string;
|
|
9
|
+
target: string;
|
|
10
|
+
risk: UpgradeRisk;
|
|
11
|
+
type: 'dependencies' | 'devDependencies' | 'peerDependencies';
|
|
12
|
+
reasoning: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Classify the risk of upgrading from `current` to `target` using semver.diff().
|
|
16
|
+
*/
|
|
17
|
+
export declare function classifyUpgrade(current: string, target: string): UpgradeRisk;
|
|
18
|
+
/**
|
|
19
|
+
* Classify a list of outdated packages into risk-annotated upgrades.
|
|
20
|
+
*/
|
|
21
|
+
export declare function classifyAll(packages: OutdatedPackage[]): ClassifiedUpgrade[];
|
|
22
|
+
/**
|
|
23
|
+
* Group classified upgrades by risk level.
|
|
24
|
+
*/
|
|
25
|
+
export declare function groupByRisk(upgrades: ClassifiedUpgrade[]): Record<UpgradeRisk, ClassifiedUpgrade[]>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify dependency upgrades by semver risk level.
|
|
3
|
+
*/
|
|
4
|
+
import semver from 'semver';
|
|
5
|
+
/**
|
|
6
|
+
* Classify the risk of upgrading from `current` to `target` using semver.diff().
|
|
7
|
+
*/
|
|
8
|
+
export function classifyUpgrade(current, target) {
|
|
9
|
+
const parsedTarget = semver.parse(target) ?? semver.parse(semver.coerce(target));
|
|
10
|
+
const parsedCurrent = semver.parse(semver.coerce(current));
|
|
11
|
+
if (!parsedCurrent || !parsedTarget)
|
|
12
|
+
return 'major';
|
|
13
|
+
// If target has a prerelease tag, classify as prerelease regardless of diff
|
|
14
|
+
if (parsedTarget.prerelease.length > 0)
|
|
15
|
+
return 'prerelease';
|
|
16
|
+
const diff = semver.diff(parsedCurrent.version, parsedTarget.version);
|
|
17
|
+
if (!diff)
|
|
18
|
+
return 'patch'; // same version
|
|
19
|
+
switch (diff) {
|
|
20
|
+
case 'patch':
|
|
21
|
+
return 'patch';
|
|
22
|
+
case 'minor':
|
|
23
|
+
return 'minor';
|
|
24
|
+
case 'major':
|
|
25
|
+
case 'premajor':
|
|
26
|
+
return 'major';
|
|
27
|
+
case 'preminor':
|
|
28
|
+
case 'prepatch':
|
|
29
|
+
case 'prerelease':
|
|
30
|
+
return 'prerelease';
|
|
31
|
+
default:
|
|
32
|
+
return 'major';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Classify a list of outdated packages into risk-annotated upgrades.
|
|
37
|
+
*/
|
|
38
|
+
export function classifyAll(packages) {
|
|
39
|
+
return packages.map((pkg) => {
|
|
40
|
+
const risk = classifyUpgrade(pkg.current, pkg.latest);
|
|
41
|
+
return {
|
|
42
|
+
name: pkg.name,
|
|
43
|
+
current: pkg.current,
|
|
44
|
+
target: pkg.latest,
|
|
45
|
+
risk,
|
|
46
|
+
type: pkg.type,
|
|
47
|
+
reasoning: buildReasoning(risk, pkg.current, pkg.latest),
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Group classified upgrades by risk level.
|
|
53
|
+
*/
|
|
54
|
+
export function groupByRisk(upgrades) {
|
|
55
|
+
const groups = {
|
|
56
|
+
patch: [],
|
|
57
|
+
minor: [],
|
|
58
|
+
major: [],
|
|
59
|
+
prerelease: [],
|
|
60
|
+
};
|
|
61
|
+
for (const u of upgrades) {
|
|
62
|
+
groups[u.risk].push(u);
|
|
63
|
+
}
|
|
64
|
+
return groups;
|
|
65
|
+
}
|
|
66
|
+
function buildReasoning(risk, current, target) {
|
|
67
|
+
switch (risk) {
|
|
68
|
+
case 'patch':
|
|
69
|
+
return `Bug fix: ${current} → ${target}`;
|
|
70
|
+
case 'minor':
|
|
71
|
+
return `New features (backward-compatible): ${current} → ${target}`;
|
|
72
|
+
case 'major':
|
|
73
|
+
return `Breaking changes possible: ${current} → ${target}`;
|
|
74
|
+
case 'prerelease':
|
|
75
|
+
return `Pre-release version: ${current} → ${target}`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../src/upgrade/classifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAc5B;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,MAAc;IAC7D,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CA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,CACzB,QAA6B;IAE7B,MAAM,MAAM,GAA6C;QACvD,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,EAAE;KACf,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,IAAiB,EAAE,OAAe,EAAE,MAAc;IACxE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,OAAO;YACV,OAAO,YAAY,OAAO,MAAM,MAAM,EAAE,CAAC;QAC3C,KAAK,OAAO;YACV,OAAO,uCAAuC,OAAO,MAAM,MAAM,EAAE,CAAC;QACtE,KAAK,OAAO;YACV,OAAO,8BAA8B,OAAO,MAAM,MAAM,EAAE,CAAC;QAC7D,KAAK,YAAY;YACf,OAAO,wBAAwB,OAAO,MAAM,MAAM,EAAE,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `npm/pnpm/yarn outdated --json` via subprocess and parse results.
|
|
3
|
+
* Read-only: never executes install or update commands.
|
|
4
|
+
*/
|
|
5
|
+
export interface OutdatedPackage {
|
|
6
|
+
name: string;
|
|
7
|
+
current: string;
|
|
8
|
+
wanted: string;
|
|
9
|
+
latest: string;
|
|
10
|
+
type: 'dependencies' | 'devDependencies' | 'peerDependencies';
|
|
11
|
+
location: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Run the package manager's `outdated --json` command and return normalized results.
|
|
15
|
+
* npm outdated returns exit code 1 when outdated packages exist — that's expected.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getOutdatedPackages(projectRoot: string, packageManager: 'npm' | 'pnpm' | 'yarn' | 'bun'): Promise<OutdatedPackage[]>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `npm/pnpm/yarn outdated --json` via subprocess and parse results.
|
|
3
|
+
* Read-only: never executes install or update commands.
|
|
4
|
+
*/
|
|
5
|
+
import { execFile } from 'node:child_process';
|
|
6
|
+
/**
|
|
7
|
+
* Run the package manager's `outdated --json` command and return normalized results.
|
|
8
|
+
* npm outdated returns exit code 1 when outdated packages exist — that's expected.
|
|
9
|
+
*/
|
|
10
|
+
export async function getOutdatedPackages(projectRoot, packageManager) {
|
|
11
|
+
const { cmd, args } = buildCommand(packageManager);
|
|
12
|
+
const raw = await runOutdated(cmd, args, projectRoot);
|
|
13
|
+
if (!raw.trim())
|
|
14
|
+
return [];
|
|
15
|
+
return parseOutput(raw, packageManager);
|
|
16
|
+
}
|
|
17
|
+
function buildCommand(pm) {
|
|
18
|
+
switch (pm) {
|
|
19
|
+
case 'pnpm':
|
|
20
|
+
return { cmd: 'pnpm', args: ['outdated', '--json'] };
|
|
21
|
+
case 'yarn':
|
|
22
|
+
return { cmd: 'yarn', args: ['outdated', '--json'] };
|
|
23
|
+
case 'bun':
|
|
24
|
+
return { cmd: 'bun', args: ['outdated', '--json'] };
|
|
25
|
+
default:
|
|
26
|
+
return { cmd: 'npm', args: ['outdated', '--json'] };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function runOutdated(cmd, args, cwd) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
execFile(cmd, args, { cwd, timeout: 30_000 }, (error, stdout, stderr) => {
|
|
32
|
+
// npm outdated exits with code 1 when there are outdated packages — not an error
|
|
33
|
+
if (error && stdout) {
|
|
34
|
+
resolve(stdout);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (error) {
|
|
38
|
+
// Distinguish "command not found" from "outdated failed"
|
|
39
|
+
const isNotFound = error.code === 'ENOENT';
|
|
40
|
+
const msg = isNotFound
|
|
41
|
+
? `${cmd} is not installed or not in PATH`
|
|
42
|
+
: `Failed to run ${cmd} outdated: ${error.message}${stderr ? ` (${stderr.trim()})` : ''}`;
|
|
43
|
+
reject(new Error(msg));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
resolve(stdout);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Parse JSON output from different package managers into a normalized format.
|
|
52
|
+
* Each PM has a slightly different JSON structure.
|
|
53
|
+
*/
|
|
54
|
+
function parseOutput(raw, pm) {
|
|
55
|
+
if (pm === 'npm' || pm === 'bun')
|
|
56
|
+
return parseNpmOutput(raw);
|
|
57
|
+
if (pm === 'pnpm')
|
|
58
|
+
return parsePnpmOutput(raw);
|
|
59
|
+
return parseYarnOutput(raw);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* npm outdated --json returns:
|
|
63
|
+
* { "package-name": { "current": "1.0.0", "wanted": "1.0.1", "latest": "2.0.0", "type": "dependencies", "location": "..." } }
|
|
64
|
+
*/
|
|
65
|
+
function parseNpmOutput(raw) {
|
|
66
|
+
const data = JSON.parse(raw);
|
|
67
|
+
return Object.entries(data)
|
|
68
|
+
.filter(([, v]) => v.current && v.latest)
|
|
69
|
+
.map(([name, v]) => ({
|
|
70
|
+
name,
|
|
71
|
+
current: v.current,
|
|
72
|
+
wanted: v.wanted ?? v.current,
|
|
73
|
+
latest: v.latest,
|
|
74
|
+
type: normalizeDepType(v.type),
|
|
75
|
+
location: v.location ?? '',
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* pnpm outdated --json returns an array:
|
|
80
|
+
* [{ "packageName": "...", "current": "...", "latest": "...", "wanted": "...", "dependencyType": "..." }]
|
|
81
|
+
*/
|
|
82
|
+
function parsePnpmOutput(raw) {
|
|
83
|
+
const data = JSON.parse(raw);
|
|
84
|
+
const list = Array.isArray(data) ? data : [];
|
|
85
|
+
return list
|
|
86
|
+
.filter((p) => p.current && p.latest)
|
|
87
|
+
.map((p) => ({
|
|
88
|
+
name: p.packageName ?? p.name ?? '',
|
|
89
|
+
current: p.current,
|
|
90
|
+
wanted: p.wanted ?? p.current,
|
|
91
|
+
latest: p.latest,
|
|
92
|
+
type: normalizeDepType(p.dependencyType ?? p.type),
|
|
93
|
+
location: p.location ?? '',
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* yarn outdated --json outputs newline-delimited JSON.
|
|
98
|
+
* The "data" table row format: [name, current, wanted, latest, type, url]
|
|
99
|
+
*/
|
|
100
|
+
function parseYarnOutput(raw) {
|
|
101
|
+
const results = [];
|
|
102
|
+
for (const line of raw.split('\n')) {
|
|
103
|
+
if (!line.trim())
|
|
104
|
+
continue;
|
|
105
|
+
try {
|
|
106
|
+
const obj = JSON.parse(line);
|
|
107
|
+
if (obj.type === 'table' && obj.data?.body) {
|
|
108
|
+
for (const row of obj.data.body) {
|
|
109
|
+
if (row.length >= 5) {
|
|
110
|
+
results.push({
|
|
111
|
+
name: row[0],
|
|
112
|
+
current: row[1],
|
|
113
|
+
wanted: row[2],
|
|
114
|
+
latest: row[3],
|
|
115
|
+
type: normalizeDepType(row[4]),
|
|
116
|
+
location: '',
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// skip non-JSON lines
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return results;
|
|
127
|
+
}
|
|
128
|
+
function normalizeDepType(raw) {
|
|
129
|
+
if (!raw)
|
|
130
|
+
return 'dependencies';
|
|
131
|
+
const lower = raw.toLowerCase();
|
|
132
|
+
if (lower.includes('dev'))
|
|
133
|
+
return 'devDependencies';
|
|
134
|
+
if (lower.includes('peer'))
|
|
135
|
+
return 'peerDependencies';
|
|
136
|
+
return 'dependencies';
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=outdated.js.map
|
|
@@ -0,0 +1 @@
|
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@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prisma-specific upgrade logic.
|
|
3
|
+
* Detects current Prisma version, fetches latest, classifies risk.
|
|
4
|
+
*/
|
|
5
|
+
import { type UpgradeRisk } from './classifier.js';
|
|
6
|
+
export interface PrismaVersionInfo {
|
|
7
|
+
currentPrisma: string;
|
|
8
|
+
currentClient: string;
|
|
9
|
+
latestVersion: string;
|
|
10
|
+
risk: UpgradeRisk;
|
|
11
|
+
hasPrisma: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Detect current Prisma versions from package.json and fetch latest from npm registry.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPrismaVersionInfo(projectRoot: string): Promise<PrismaVersionInfo>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetch the latest version of a package from npm registry.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchLatestVersion(packageName: string): Promise<string>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prisma-specific upgrade logic.
|
|
3
|
+
* Detects current Prisma version, fetches latest, classifies risk.
|
|
4
|
+
*/
|
|
5
|
+
import { execFile } from 'node:child_process';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { classifyUpgrade } from './classifier.js';
|
|
8
|
+
import { readJsonFile } from '../fs-helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Detect current Prisma versions from package.json and fetch latest from npm registry.
|
|
11
|
+
*/
|
|
12
|
+
export async function getPrismaVersionInfo(projectRoot) {
|
|
13
|
+
const pkgPath = join(projectRoot, 'package.json');
|
|
14
|
+
const pkg = readJsonFile(pkgPath);
|
|
15
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
16
|
+
const hasPrisma = Boolean(deps.prisma || deps['@prisma/client']);
|
|
17
|
+
if (!hasPrisma) {
|
|
18
|
+
return { currentPrisma: '', currentClient: '', latestVersion: '', risk: 'patch', hasPrisma: false };
|
|
19
|
+
}
|
|
20
|
+
const currentPrisma = stripRange(deps.prisma ?? '');
|
|
21
|
+
const currentClient = stripRange(deps['@prisma/client'] ?? '');
|
|
22
|
+
const current = currentPrisma || currentClient;
|
|
23
|
+
const latestVersion = await fetchLatestVersion('prisma');
|
|
24
|
+
const risk = current && latestVersion ? classifyUpgrade(current, latestVersion) : 'major';
|
|
25
|
+
return { currentPrisma, currentClient, latestVersion, risk, hasPrisma };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fetch the latest version of a package from npm registry.
|
|
29
|
+
*/
|
|
30
|
+
export async function fetchLatestVersion(packageName) {
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {
|
|
33
|
+
signal: AbortSignal.timeout(10_000),
|
|
34
|
+
});
|
|
35
|
+
if (!res.ok) {
|
|
36
|
+
// Drain the response body to free the connection
|
|
37
|
+
await res.text().catch(() => { });
|
|
38
|
+
throw new Error(`HTTP ${res.status}`);
|
|
39
|
+
}
|
|
40
|
+
const data = (await res.json());
|
|
41
|
+
return data.version ?? '';
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Fallback: use npm view via subprocess
|
|
45
|
+
return npmViewVersion(packageName);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function npmViewVersion(packageName) {
|
|
49
|
+
return new Promise((resolve) => {
|
|
50
|
+
execFile('npm', ['view', packageName, 'version'], { timeout: 10_000 }, (error, stdout) => {
|
|
51
|
+
if (error || !stdout.trim()) {
|
|
52
|
+
resolve('');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
resolve(stdout.trim());
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Strip semver range prefixes like ^, ~, >= */
|
|
60
|
+
function stripRange(version) {
|
|
61
|
+
return version.replace(/^[\^~>=<]+/, '').trim();
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=prisma-upgr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,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gDAAgD;AAChD,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariacode/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A predictable coding agent for Next.js, Nest.js, Prisma and Node.js projects.",
|
|
5
5
|
"homepage": "https://www.ariacode.run",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/ariacodeai/ariacode.git"
|
|
8
|
+
"url": "git+https://github.com/ariacodeai/ariacode.git"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/ariacodeai/ariacode/issues"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"bin": {
|
|
19
|
-
"aria": "
|
|
19
|
+
"aria": "dist/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx src/cli.ts",
|
|
39
|
-
"build": "tsc && cp -r src/prompts dist/prompts",
|
|
39
|
+
"build": "rm -rf dist && tsc && cp -r src/prompts dist/prompts",
|
|
40
40
|
"start": "node dist/cli.js",
|
|
41
41
|
"check": "tsc --noEmit",
|
|
42
42
|
"format": "prettier --write .",
|
|
@@ -49,12 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@anthropic-ai/sdk": "^0.82.0",
|
|
52
|
+
"@mrleebo/prisma-ast": "^0.15.0",
|
|
52
53
|
"better-sqlite3": "^12.8.0",
|
|
53
54
|
"cli-table3": "^0.6.5",
|
|
54
55
|
"diff": "^8.0.4",
|
|
55
56
|
"ignore": "^7.0.5",
|
|
56
57
|
"picocolors": "^1.1.1",
|
|
57
58
|
"prompts": "^2.4.2",
|
|
59
|
+
"semver": "^7.6.0",
|
|
58
60
|
"smol-toml": "^1.3.1",
|
|
59
61
|
"zod": "^4.3.6"
|
|
60
62
|
},
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
"@types/diff": "^6.0.0",
|
|
64
66
|
"@types/node": "^24.3.0",
|
|
65
67
|
"@types/prompts": "^2.4.9",
|
|
68
|
+
"@types/semver": "^7.5.0",
|
|
66
69
|
"@vitest/coverage-v8": "^4.1.2",
|
|
67
70
|
"fast-check": "^3.22.0",
|
|
68
71
|
"prettier": "^3.8.1",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
You are Aria Code, a coding assistant for {{projectType}} projects.
|
|
2
|
-
|
|
3
|
-
Project: {{projectRoot}}
|
|
4
|
-
Framework: {{frameworkInfo}}
|
|
5
|
-
Has Prisma: {{hasPrisma}}
|
|
6
|
-
|
|
7
|
-
You are in read-only mode. Do NOT propose or apply any file changes.
|
|
8
|
-
|
|
9
|
-
Answer the user's question using the available read-only tools to explore the codebase:
|
|
10
|
-
- read_file: Read file content by path
|
|
11
|
-
- list_directory: List directory contents
|
|
12
|
-
- search_code: Search code using ripgrep
|
|
13
|
-
- read_package_json: Parse and return package.json
|
|
14
|
-
- read_prisma_schema: Read Prisma schema (when available)
|
|
15
|
-
|
|
16
|
-
Guidelines:
|
|
17
|
-
- Be concise and direct — avoid unnecessary preamble
|
|
18
|
-
- Cite specific files and line numbers when relevant
|
|
19
|
-
- If something is unclear or missing, say so explicitly
|
|
20
|
-
- Do not speculate about code you haven't read
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
You are Aria Code, a repository exploration assistant.
|
|
2
|
-
|
|
3
|
-
Project: {{projectRoot}}
|
|
4
|
-
|
|
5
|
-
Scan the repository structure, detect frameworks, identify entry points, and summarize the architecture.
|
|
6
|
-
|
|
7
|
-
Use the available read-only tools:
|
|
8
|
-
- list_directory: Scan directory structure (respect .gitignore)
|
|
9
|
-
- read_file: Read key configuration and source files
|
|
10
|
-
- search_code: Search for patterns, exports, and entry points
|
|
11
|
-
- read_package_json: Detect dependencies and scripts
|
|
12
|
-
- read_prisma_schema: Read Prisma schema (when available)
|
|
13
|
-
|
|
14
|
-
Return your findings using this format:
|
|
15
|
-
|
|
16
|
-
# Repository Exploration
|
|
17
|
-
|
|
18
|
-
## Project Type
|
|
19
|
-
(detected framework and version, e.g. Next.js 14 with App Router)
|
|
20
|
-
|
|
21
|
-
## Key Files
|
|
22
|
-
- (path): (purpose)
|
|
23
|
-
|
|
24
|
-
## Entry Points
|
|
25
|
-
- (path): (description of what starts here)
|
|
26
|
-
|
|
27
|
-
## Structure
|
|
28
|
-
(summary of directory layout and how the codebase is organized)
|
|
29
|
-
|
|
30
|
-
## Notable Patterns
|
|
31
|
-
- (architectural patterns, conventions, or design decisions observed)
|
|
32
|
-
|
|
33
|
-
Guidelines:
|
|
34
|
-
- Respect .gitignore — do not list node_modules, .git, or ignored files
|
|
35
|
-
- Identify framework-specific conventions (routing, config, middleware)
|
|
36
|
-
- Note Prisma schema if present
|
|
37
|
-
- Highlight any unusual or noteworthy patterns
|
|
38
|
-
- Be concise — focus on what a new developer needs to understand the codebase
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
You are Aria Code, a coding agent for {{projectType}} projects.
|
|
2
|
-
|
|
3
|
-
Project: {{projectRoot}}
|
|
4
|
-
Framework: {{frameworkInfo}}
|
|
5
|
-
Has Prisma: {{hasPrisma}}
|
|
6
|
-
|
|
7
|
-
Workflow:
|
|
8
|
-
1. Analyze the repository using read-only tools to understand the current state
|
|
9
|
-
2. Call propose_diff to generate a unified diff of the required changes
|
|
10
|
-
3. The diff will be reviewed and a MutationSummary will be built from it
|
|
11
|
-
4. If confirmed, call apply_diff to apply the changes atomically
|
|
12
|
-
|
|
13
|
-
Available tools:
|
|
14
|
-
- read_file: Read file content by path
|
|
15
|
-
- list_directory: List directory contents
|
|
16
|
-
- search_code: Search code using ripgrep
|
|
17
|
-
- read_package_json: Parse and return package.json
|
|
18
|
-
- read_prisma_schema: Read Prisma schema (when available)
|
|
19
|
-
- propose_diff: Generate a unified diff without applying changes
|
|
20
|
-
- apply_diff: Apply a previously proposed diff atomically
|
|
21
|
-
|
|
22
|
-
Guidelines:
|
|
23
|
-
- Read relevant files before proposing changes
|
|
24
|
-
- Be precise and minimal — only change what is necessary
|
|
25
|
-
- Produce valid unified diff format in propose_diff calls
|
|
26
|
-
- Include rollback hints when proposing changes
|
|
27
|
-
- Do not apply changes until explicitly confirmed
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
You are Aria Code, a planning assistant for {{projectType}} projects.
|
|
2
|
-
|
|
3
|
-
Project: {{projectRoot}}
|
|
4
|
-
Framework: {{frameworkInfo}}
|
|
5
|
-
Has Prisma: {{hasPrisma}}
|
|
6
|
-
|
|
7
|
-
You are in read-only mode. Do NOT propose or apply any file changes.
|
|
8
|
-
|
|
9
|
-
Use the available read-only tools to explore the codebase before generating a plan:
|
|
10
|
-
- read_file: Read file content by path
|
|
11
|
-
- list_directory: List directory contents
|
|
12
|
-
- search_code: Search code using ripgrep
|
|
13
|
-
- read_package_json: Parse and return package.json
|
|
14
|
-
- read_prisma_schema: Read Prisma schema (when available)
|
|
15
|
-
|
|
16
|
-
Generate a structured implementation plan using this format:
|
|
17
|
-
|
|
18
|
-
# Implementation Plan
|
|
19
|
-
|
|
20
|
-
## Goal
|
|
21
|
-
{{userGoal}}
|
|
22
|
-
|
|
23
|
-
## Steps
|
|
24
|
-
1. (first step)
|
|
25
|
-
2. (second step)
|
|
26
|
-
...
|
|
27
|
-
|
|
28
|
-
## Affected Files
|
|
29
|
-
- (file path and reason)
|
|
30
|
-
|
|
31
|
-
## Risks
|
|
32
|
-
- (potential issues or breaking changes)
|
|
33
|
-
|
|
34
|
-
## Implementation Notes
|
|
35
|
-
(additional context, caveats, or dependencies)
|
|
36
|
-
|
|
37
|
-
Guidelines:
|
|
38
|
-
- Explore the codebase thoroughly before planning
|
|
39
|
-
- Order steps logically with dependencies respected
|
|
40
|
-
- Flag any risks or breaking changes explicitly
|
|
41
|
-
- Keep the plan actionable and specific
|