@agentuity/migrate 2.0.0-beta.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 +203 -0
- package/bin/migrate.ts +60 -0
- package/dist/detect.d.ts +56 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +561 -0
- package/dist/detect.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +29 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +315 -0
- package/dist/migrate.js.map +1 -0
- package/dist/report.d.ts +22 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +159 -0
- package/dist/report.js.map +1 -0
- package/dist/transforms/app-ts.d.ts +29 -0
- package/dist/transforms/app-ts.d.ts.map +1 -0
- package/dist/transforms/app-ts.js +114 -0
- package/dist/transforms/app-ts.js.map +1 -0
- package/dist/transforms/barrels.d.ts +12 -0
- package/dist/transforms/barrels.d.ts.map +1 -0
- package/dist/transforms/barrels.js +103 -0
- package/dist/transforms/barrels.js.map +1 -0
- package/dist/transforms/generated.d.ts +7 -0
- package/dist/transforms/generated.d.ts.map +1 -0
- package/dist/transforms/generated.js +10 -0
- package/dist/transforms/generated.js.map +1 -0
- package/dist/transforms/routes.d.ts +49 -0
- package/dist/transforms/routes.d.ts.map +1 -0
- package/dist/transforms/routes.js +208 -0
- package/dist/transforms/routes.js.map +1 -0
- package/package.json +45 -0
- package/src/detect.ts +694 -0
- package/src/index.ts +9 -0
- package/src/migrate.ts +379 -0
- package/src/report.ts +195 -0
- package/src/transforms/app-ts.ts +144 -0
- package/src/transforms/barrels.ts +138 -0
- package/src/transforms/generated.ts +11 -0
- package/src/transforms/routes.ts +273 -0
package/dist/migrate.js
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* Flow:
|
|
5
|
+
* 1. Check git worktree is clean (bail if not)
|
|
6
|
+
* 2. Run detection
|
|
7
|
+
* 3. Print report
|
|
8
|
+
* 4. Interactive confirmation (unless --yes)
|
|
9
|
+
* 5. Apply codemods
|
|
10
|
+
* 6. Run typecheck
|
|
11
|
+
* 7. Print final summary
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { join, resolve } from 'node:path';
|
|
15
|
+
import { detect } from './detect';
|
|
16
|
+
import { printReport, printStep, printStepDone, printStepFailed, printStepSkipped, printWarning, printError, printSuccess, printManualSummary, printChangeSummary, } from './report';
|
|
17
|
+
import { deleteGeneratedDir } from './transforms/generated';
|
|
18
|
+
import { transformAppTs } from './transforms/app-ts';
|
|
19
|
+
import { transformRouteFile } from './transforms/routes';
|
|
20
|
+
import { generateAgentBarrel, generateApiBarrel } from './transforms/barrels';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Git worktree cleanliness check
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
async function isGitWorktreeClean(projectDir) {
|
|
25
|
+
try {
|
|
26
|
+
const result = await Bun.spawn(['git', 'status', '--porcelain'], {
|
|
27
|
+
cwd: projectDir,
|
|
28
|
+
stdout: 'pipe',
|
|
29
|
+
stderr: 'pipe',
|
|
30
|
+
});
|
|
31
|
+
const output = await new Response(result.stdout).text();
|
|
32
|
+
return output.trim() === '';
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// git not available or not a git repo — allow migration to proceed
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function isGitRepo(projectDir) {
|
|
40
|
+
try {
|
|
41
|
+
const result = Bun.spawnSync(['git', 'rev-parse', '--is-inside-work-tree'], {
|
|
42
|
+
cwd: projectDir,
|
|
43
|
+
stdout: 'pipe',
|
|
44
|
+
stderr: 'pipe',
|
|
45
|
+
});
|
|
46
|
+
return result.exitCode === 0;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Interactive confirm
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
async function confirm(message) {
|
|
56
|
+
process.stdout.write(` ${message} ${'\x1b[2m'}[y/N]${'\x1b[0m'} `);
|
|
57
|
+
// Read a single line from stdin
|
|
58
|
+
const line = await new Promise((resolve) => {
|
|
59
|
+
let buf = '';
|
|
60
|
+
process.stdin.setEncoding('utf8');
|
|
61
|
+
process.stdin.resume();
|
|
62
|
+
process.stdin.once('data', (chunk) => {
|
|
63
|
+
buf += chunk.toString();
|
|
64
|
+
process.stdin.pause();
|
|
65
|
+
resolve(buf.trim());
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return line.toLowerCase() === 'y' || line.toLowerCase() === 'yes';
|
|
69
|
+
}
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
// Typecheck
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
async function runTypecheck(projectDir) {
|
|
74
|
+
try {
|
|
75
|
+
const proc = Bun.spawn(['bunx', 'tsc', '--noEmit', '--skipLibCheck'], {
|
|
76
|
+
cwd: projectDir,
|
|
77
|
+
stdout: 'pipe',
|
|
78
|
+
stderr: 'pipe',
|
|
79
|
+
});
|
|
80
|
+
await proc.exited;
|
|
81
|
+
const stdout = await new Response(proc.stdout).text();
|
|
82
|
+
const stderr = await new Response(proc.stderr).text();
|
|
83
|
+
const combined = [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
84
|
+
return { ok: proc.exitCode === 0, output: combined };
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
return { ok: false, output: String(e) };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Bun install
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
async function runBunInstall(projectDir) {
|
|
94
|
+
try {
|
|
95
|
+
const proc = Bun.spawn(['bun', 'install', '--silent'], {
|
|
96
|
+
cwd: projectDir,
|
|
97
|
+
stdout: 'pipe',
|
|
98
|
+
stderr: 'pipe',
|
|
99
|
+
});
|
|
100
|
+
await proc.exited;
|
|
101
|
+
return {
|
|
102
|
+
ok: proc.exitCode === 0,
|
|
103
|
+
error: proc.exitCode !== 0 ? 'bun install failed' : undefined,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
return { ok: false, error: String(e) };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// Main
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
export async function migrate(opts = {}) {
|
|
114
|
+
const projectDir = resolve(opts.projectDir ?? process.cwd());
|
|
115
|
+
if (!existsSync(projectDir)) {
|
|
116
|
+
printError(`Project directory does not exist: ${projectDir}`);
|
|
117
|
+
return { ok: false, reason: 'Project directory not found' };
|
|
118
|
+
}
|
|
119
|
+
// ── 1. Git worktree check ──────────────────────────────────────────────
|
|
120
|
+
if (isGitRepo(projectDir)) {
|
|
121
|
+
const isClean = await isGitWorktreeClean(projectDir);
|
|
122
|
+
if (!isClean) {
|
|
123
|
+
printError('Git worktree is not clean.\n\n' +
|
|
124
|
+
' The migration tool rewrites source files. Please commit or stash\n' +
|
|
125
|
+
' your current changes before running the migration, so you can\n' +
|
|
126
|
+
' easily review the diff or roll back if needed.\n\n' +
|
|
127
|
+
' Run: git status\n' +
|
|
128
|
+
' or: git stash');
|
|
129
|
+
return { ok: false, reason: 'Git worktree is not clean' };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
printWarning('Project is not in a git repository. It is strongly recommended to\n' +
|
|
134
|
+
' version-control your project before running the migration.');
|
|
135
|
+
if (!opts.yes) {
|
|
136
|
+
const proceed = await confirm('Proceed without git? This cannot be undone.');
|
|
137
|
+
if (!proceed) {
|
|
138
|
+
console.log('\n Migration cancelled.\n');
|
|
139
|
+
return { ok: false, reason: 'User cancelled' };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// ── 2. Detection ──────────────────────────────────────────────────────
|
|
144
|
+
console.log('\n Scanning project for v1 patterns…');
|
|
145
|
+
const detection = await detect(projectDir);
|
|
146
|
+
// ── 3. Report ─────────────────────────────────────────────────────────
|
|
147
|
+
printReport(detection);
|
|
148
|
+
if (detection.findings.length === 0) {
|
|
149
|
+
return { ok: true, changedFiles: [] };
|
|
150
|
+
}
|
|
151
|
+
if (opts.dryRun) {
|
|
152
|
+
console.log(' (dry-run mode — no files modified)\n');
|
|
153
|
+
return { ok: true, changedFiles: [] };
|
|
154
|
+
}
|
|
155
|
+
// Bail if there are manual-only findings with no automatable counterparts
|
|
156
|
+
const hasAuto = detection.findings.some((f) => f.severity === 'auto');
|
|
157
|
+
const hasGuided = detection.findings.some((f) => f.severity === 'guided');
|
|
158
|
+
if (!hasAuto && !hasGuided) {
|
|
159
|
+
console.log(' All findings require manual action. No automated transforms available.\n');
|
|
160
|
+
printManualSummary(detection);
|
|
161
|
+
return { ok: true, changedFiles: [] };
|
|
162
|
+
}
|
|
163
|
+
// ── 4. Confirmation ───────────────────────────────────────────────────
|
|
164
|
+
if (!opts.yes) {
|
|
165
|
+
const proceed = await confirm('Apply the auto-fixable and guided transforms listed above?');
|
|
166
|
+
if (!proceed) {
|
|
167
|
+
console.log('\n Migration cancelled.\n');
|
|
168
|
+
return { ok: false, reason: 'User cancelled' };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
console.log();
|
|
172
|
+
const changedFiles = [];
|
|
173
|
+
const allChangeSummary = [];
|
|
174
|
+
// ── 5a. Delete src/generated/ ─────────────────────────────────────────
|
|
175
|
+
if (detection.generatedDir) {
|
|
176
|
+
printStep('Deleting src/generated/');
|
|
177
|
+
try {
|
|
178
|
+
deleteGeneratedDir(detection.generatedDir);
|
|
179
|
+
changedFiles.push('src/generated/');
|
|
180
|
+
printStepDone('directory removed');
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
printStepFailed(String(e));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Read original app.ts source before any transforms (needed by config transform)
|
|
187
|
+
const originalAppSrc = detection.appTsPath ? await Bun.file(detection.appTsPath).text() : null;
|
|
188
|
+
// ── 5b. Transform app.ts ──────────────────────────────────────────────
|
|
189
|
+
if (detection.appTsPath && originalAppSrc !== null) {
|
|
190
|
+
printStep('Transforming app.ts');
|
|
191
|
+
const result = transformAppTs(originalAppSrc, detection);
|
|
192
|
+
if (result.complexityError) {
|
|
193
|
+
printStepFailed('complexity guard triggered');
|
|
194
|
+
printWarning(result.complexityError);
|
|
195
|
+
}
|
|
196
|
+
else if (result.source !== null && result.changes.length > 0) {
|
|
197
|
+
writeFileSync(detection.appTsPath, result.source, 'utf8');
|
|
198
|
+
changedFiles.push('app.ts');
|
|
199
|
+
allChangeSummary.push({ file: 'app.ts', changes: result.changes });
|
|
200
|
+
printStepDone(result.changes.length + ' change(s)');
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
printStepSkipped('no mechanical changes needed');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Note: analytics/workbench stay in createApp() in v2 - no config file migration needed
|
|
207
|
+
// ── 5c. Transform v1 route files ──────────────────────────────────────
|
|
208
|
+
if (detection.v1RouteFiles.length > 0) {
|
|
209
|
+
console.log(`\n Transforming ${detection.v1RouteFiles.length} route file(s):`);
|
|
210
|
+
for (const routeFile of detection.v1RouteFiles) {
|
|
211
|
+
const relPath = routeFile.replace(projectDir + '/', '');
|
|
212
|
+
printStep(relPath);
|
|
213
|
+
const src = await Bun.file(routeFile).text();
|
|
214
|
+
const result = transformRouteFile(src);
|
|
215
|
+
if (result.complexityError) {
|
|
216
|
+
printStepFailed('complexity guard triggered');
|
|
217
|
+
printWarning(`${relPath}: ${result.complexityError}`);
|
|
218
|
+
}
|
|
219
|
+
else if (result.source !== null && result.changes.length > 0) {
|
|
220
|
+
writeFileSync(routeFile, result.source, 'utf8');
|
|
221
|
+
changedFiles.push(relPath);
|
|
222
|
+
allChangeSummary.push({ file: relPath, changes: result.changes });
|
|
223
|
+
printStepDone();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
printStepSkipped('already v2 style');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// ── 5e. Generate src/api/index.ts barrel ─────────────────────────────
|
|
231
|
+
const apiBarrelFinding = detection.findings.find((f) => f.id === 'missing-api-barrel' || f.id === 'api-barrel-stub');
|
|
232
|
+
if (apiBarrelFinding) {
|
|
233
|
+
printStep('Generating src/api/index.ts barrel');
|
|
234
|
+
const barrel = generateApiBarrel(projectDir);
|
|
235
|
+
if (barrel) {
|
|
236
|
+
const apiIndexPath = join(projectDir, 'src', 'api', 'index.ts');
|
|
237
|
+
writeFileSync(apiIndexPath, barrel, 'utf8');
|
|
238
|
+
changedFiles.push('src/api/index.ts');
|
|
239
|
+
allChangeSummary.push({
|
|
240
|
+
file: 'src/api/index.ts',
|
|
241
|
+
changes: ['Generated API router barrel with AppRouter type export'],
|
|
242
|
+
});
|
|
243
|
+
printStepDone();
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
printStepSkipped('no route files found');
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// ── 5f. Generate src/agent/index.ts barrel ────────────────────────────
|
|
250
|
+
if (!detection.hasAgentBarrel) {
|
|
251
|
+
printStep('Generating src/agent/index.ts barrel');
|
|
252
|
+
const barrel = generateAgentBarrel(projectDir);
|
|
253
|
+
if (barrel) {
|
|
254
|
+
const agentIndexPath = join(projectDir, 'src', 'agent', 'index.ts');
|
|
255
|
+
writeFileSync(agentIndexPath, barrel, 'utf8');
|
|
256
|
+
changedFiles.push('src/agent/index.ts');
|
|
257
|
+
allChangeSummary.push({
|
|
258
|
+
file: 'src/agent/index.ts',
|
|
259
|
+
changes: ['Generated agent barrel exporting default array of all agents'],
|
|
260
|
+
});
|
|
261
|
+
printStepDone();
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
printStepSkipped('no agent files found');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
console.log();
|
|
268
|
+
// ── Print applied changes ──────────────────────────────────────────────
|
|
269
|
+
printChangeSummary(allChangeSummary);
|
|
270
|
+
// ── 6. Install dependencies ───────────────────────────────────────────
|
|
271
|
+
const hasPackageJson = existsSync(join(projectDir, 'package.json'));
|
|
272
|
+
if (hasPackageJson && changedFiles.length > 0) {
|
|
273
|
+
printStep('Running bun install');
|
|
274
|
+
const install = await runBunInstall(projectDir);
|
|
275
|
+
if (install.ok) {
|
|
276
|
+
printStepDone('done');
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
printStepFailed(String(install.error));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ── 7. Typecheck ─────────────────────────────────────────────────────
|
|
283
|
+
const hasTsConfig = existsSync(join(projectDir, 'tsconfig.json'));
|
|
284
|
+
if (hasTsConfig && changedFiles.length > 0) {
|
|
285
|
+
printStep('Running TypeScript type check');
|
|
286
|
+
const tc = await runTypecheck(projectDir);
|
|
287
|
+
if (tc.ok) {
|
|
288
|
+
printStepDone('no errors');
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
printStepFailed('type errors found');
|
|
292
|
+
console.log('\n TypeScript errors after migration:');
|
|
293
|
+
console.log(tc.output
|
|
294
|
+
.split('\n')
|
|
295
|
+
.map((l) => ` ${l}`)
|
|
296
|
+
.join('\n'));
|
|
297
|
+
printWarning('Type errors detected. Review the changes above and fix manually.\n' +
|
|
298
|
+
' The git diff will show exactly what was changed.');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (!hasTsConfig) {
|
|
302
|
+
printWarning('No tsconfig.json found — skipping type check.');
|
|
303
|
+
}
|
|
304
|
+
// ── 7. Manual summary ─────────────────────────────────────────────────
|
|
305
|
+
printManualSummary(detection);
|
|
306
|
+
if (changedFiles.length > 0) {
|
|
307
|
+
printSuccess(`Migration complete! ${changedFiles.length} file(s) modified.\n` +
|
|
308
|
+
` Review the changes with: git diff`);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
printSuccess('Migration complete! No files needed to be changed.');
|
|
312
|
+
}
|
|
313
|
+
return { ok: true, changedFiles };
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACN,WAAW,EACX,SAAS,EACT,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAiB9E,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IACnD,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,QAA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AY,CAAC,MAAM,sBAAsB;YAC/D,qCAAqC,CACtC,CAAC;IACH,CAAC;SAAM,CAAC;QACP,YAAY,CAAC,oDAAoD,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/report.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal report renderer.
|
|
3
|
+
*
|
|
4
|
+
* Formats the DetectionResult into a clear, readable console report.
|
|
5
|
+
* No dependencies on @agentuity/cli's TUI — we use raw ANSI codes so that
|
|
6
|
+
* this package can be run standalone via `npx @agentuity/migrate`.
|
|
7
|
+
*/
|
|
8
|
+
import type { DetectionResult } from './detect';
|
|
9
|
+
export declare function printReport(detection: DetectionResult): void;
|
|
10
|
+
export declare function printStep(message: string): void;
|
|
11
|
+
export declare function printStepDone(detail?: string): void;
|
|
12
|
+
export declare function printStepSkipped(reason: string): void;
|
|
13
|
+
export declare function printStepFailed(reason: string): void;
|
|
14
|
+
export declare function printWarning(message: string): void;
|
|
15
|
+
export declare function printError(message: string): void;
|
|
16
|
+
export declare function printSuccess(message: string): void;
|
|
17
|
+
export declare function printManualSummary(detection: DetectionResult): void;
|
|
18
|
+
export declare function printChangeSummary(allChanges: {
|
|
19
|
+
file: string;
|
|
20
|
+
changes: string[];
|
|
21
|
+
}[]): void;
|
|
22
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,UAAU,CAAC;AA6EnE,wBAAgB,WAAW,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAqD5D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAGnD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAErD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAYnE;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,GAAG,IAAI,CAW1F"}
|
package/dist/report.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal report renderer.
|
|
3
|
+
*
|
|
4
|
+
* Formats the DetectionResult into a clear, readable console report.
|
|
5
|
+
* No dependencies on @agentuity/cli's TUI — we use raw ANSI codes so that
|
|
6
|
+
* this package can be run standalone via `npx @agentuity/migrate`.
|
|
7
|
+
*/
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// ANSI helpers (minimal, no deps)
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
const isTTY = process.stdout.isTTY ?? false;
|
|
12
|
+
const ansi = {
|
|
13
|
+
reset: isTTY ? '\x1b[0m' : '',
|
|
14
|
+
bold: isTTY ? '\x1b[1m' : '',
|
|
15
|
+
dim: isTTY ? '\x1b[2m' : '',
|
|
16
|
+
green: isTTY ? '\x1b[32m' : '',
|
|
17
|
+
yellow: isTTY ? '\x1b[33m' : '',
|
|
18
|
+
red: isTTY ? '\x1b[31m' : '',
|
|
19
|
+
cyan: isTTY ? '\x1b[36m' : '',
|
|
20
|
+
blue: isTTY ? '\x1b[34m' : '',
|
|
21
|
+
magenta: isTTY ? '\x1b[35m' : '',
|
|
22
|
+
};
|
|
23
|
+
function bold(s) {
|
|
24
|
+
return `${ansi.bold}${s}${ansi.reset}`;
|
|
25
|
+
}
|
|
26
|
+
function dim(s) {
|
|
27
|
+
return `${ansi.dim}${s}${ansi.reset}`;
|
|
28
|
+
}
|
|
29
|
+
function green(s) {
|
|
30
|
+
return `${ansi.green}${s}${ansi.reset}`;
|
|
31
|
+
}
|
|
32
|
+
function yellow(s) {
|
|
33
|
+
return `${ansi.yellow}${s}${ansi.reset}`;
|
|
34
|
+
}
|
|
35
|
+
function red(s) {
|
|
36
|
+
return `${ansi.red}${s}${ansi.reset}`;
|
|
37
|
+
}
|
|
38
|
+
function cyan(s) {
|
|
39
|
+
return `${ansi.cyan}${s}${ansi.reset}`;
|
|
40
|
+
}
|
|
41
|
+
const SEVERITY_LABEL = {
|
|
42
|
+
auto: green(' auto '),
|
|
43
|
+
guided: yellow(' guided '),
|
|
44
|
+
manual: red(' manual '),
|
|
45
|
+
};
|
|
46
|
+
const SEVERITY_ICON = {
|
|
47
|
+
auto: green('✓'),
|
|
48
|
+
guided: yellow('⚠'),
|
|
49
|
+
manual: red('✗'),
|
|
50
|
+
};
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Render helpers
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
function hr(width = 70) {
|
|
55
|
+
return dim('─'.repeat(width));
|
|
56
|
+
}
|
|
57
|
+
function heading(text) {
|
|
58
|
+
return `\n${bold(text)}\n${hr()}\n`;
|
|
59
|
+
}
|
|
60
|
+
function renderFinding(f, index) {
|
|
61
|
+
const label = SEVERITY_LABEL[f.severity];
|
|
62
|
+
const icon = SEVERITY_ICON[f.severity];
|
|
63
|
+
const num = dim(`${String(index + 1).padStart(2, ' ')}.`);
|
|
64
|
+
const file = f.file ? dim(` [${f.file}]`) : '';
|
|
65
|
+
const hint = f.hint ? `\n ${dim('↳ ' + f.hint.replace(/\n/g, '\n '))}` : '';
|
|
66
|
+
return ` ${num} [${label}] ${icon} ${f.message}${file}${hint}`;
|
|
67
|
+
}
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Public API
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
export function printReport(detection) {
|
|
72
|
+
const { findings } = detection;
|
|
73
|
+
const autoFindings = findings.filter((f) => f.severity === 'auto');
|
|
74
|
+
const guidedFindings = findings.filter((f) => f.severity === 'guided');
|
|
75
|
+
const manualFindings = findings.filter((f) => f.severity === 'manual');
|
|
76
|
+
console.log(`\n${bold('━━━ Agentuity v1 → v2 Migration Report ━━━')}`);
|
|
77
|
+
console.log(dim(`Project: ${detection.projectDir}`));
|
|
78
|
+
if (findings.length === 0) {
|
|
79
|
+
console.log(`\n${green('✓')} ${bold('No v1 patterns detected!')} ` +
|
|
80
|
+
`This project may already be on v2.\n`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// Summary counts
|
|
84
|
+
console.log(`\n${bold('Summary:')} ` +
|
|
85
|
+
`${green(String(autoFindings.length))} auto-fixable, ` +
|
|
86
|
+
`${yellow(String(guidedFindings.length))} guided, ` +
|
|
87
|
+
`${red(String(manualFindings.length))} manual`);
|
|
88
|
+
// Auto-fixable
|
|
89
|
+
if (autoFindings.length > 0) {
|
|
90
|
+
console.log(heading('Auto-fixable (will be applied automatically)'));
|
|
91
|
+
autoFindings.forEach((f, i) => console.log(renderFinding(f, i)));
|
|
92
|
+
}
|
|
93
|
+
// Guided
|
|
94
|
+
if (guidedFindings.length > 0) {
|
|
95
|
+
console.log(heading('Guided (applied with your review)'));
|
|
96
|
+
guidedFindings.forEach((f, i) => console.log(renderFinding(f, i)));
|
|
97
|
+
}
|
|
98
|
+
// Manual
|
|
99
|
+
if (manualFindings.length > 0) {
|
|
100
|
+
console.log(heading('Manual (requires human action — tool will not touch these)'));
|
|
101
|
+
manualFindings.forEach((f, i) => console.log(renderFinding(f, i)));
|
|
102
|
+
}
|
|
103
|
+
// Legend
|
|
104
|
+
console.log(`\n${hr()}`);
|
|
105
|
+
console.log(`${dim('Legend:')} ` +
|
|
106
|
+
`[${green(' auto ')}] fully automated ` +
|
|
107
|
+
`[${yellow(' guided ')}] applied + verify ` +
|
|
108
|
+
`[${red(' manual ')}] instructions only`);
|
|
109
|
+
console.log();
|
|
110
|
+
}
|
|
111
|
+
export function printStep(message) {
|
|
112
|
+
process.stdout.write(` ${cyan('›')} ${message}…`);
|
|
113
|
+
}
|
|
114
|
+
export function printStepDone(detail) {
|
|
115
|
+
const suffix = detail ? dim(` (${detail})`) : '';
|
|
116
|
+
console.log(` ${green('✓')}${suffix}`);
|
|
117
|
+
}
|
|
118
|
+
export function printStepSkipped(reason) {
|
|
119
|
+
console.log(` ${dim(`skipped — ${reason}`)}`);
|
|
120
|
+
}
|
|
121
|
+
export function printStepFailed(reason) {
|
|
122
|
+
console.log(` ${red('✗')} ${reason}`);
|
|
123
|
+
}
|
|
124
|
+
export function printWarning(message) {
|
|
125
|
+
console.warn(`\n ${yellow('⚠')} ${yellow(bold('Warning:'))} ${message}\n`);
|
|
126
|
+
}
|
|
127
|
+
export function printError(message) {
|
|
128
|
+
console.error(`\n ${red('✗')} ${red(bold('Error:'))} ${message}\n`);
|
|
129
|
+
}
|
|
130
|
+
export function printSuccess(message) {
|
|
131
|
+
console.log(`\n${green('✓')} ${bold(message)}\n`);
|
|
132
|
+
}
|
|
133
|
+
export function printManualSummary(detection) {
|
|
134
|
+
const manualFindings = detection.findings.filter((f) => f.severity === 'manual');
|
|
135
|
+
if (manualFindings.length === 0)
|
|
136
|
+
return;
|
|
137
|
+
console.log(`\n${bold('━━━ Remaining Manual Steps ━━━')}\n`);
|
|
138
|
+
manualFindings.forEach((f, i) => {
|
|
139
|
+
console.log(` ${dim(`${i + 1}.`)} ${red('✗')} ${f.message}`);
|
|
140
|
+
if (f.file)
|
|
141
|
+
console.log(` ${dim(`File: ${f.file}`)}`);
|
|
142
|
+
if (f.hint) {
|
|
143
|
+
console.log(`\n ${f.hint.split('\n').join('\n ')}\n`);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
export function printChangeSummary(allChanges) {
|
|
148
|
+
if (allChanges.length === 0)
|
|
149
|
+
return;
|
|
150
|
+
console.log(`\n${bold('━━━ Applied Changes ━━━')}\n`);
|
|
151
|
+
for (const { file, changes } of allChanges) {
|
|
152
|
+
console.log(` ${cyan(file)}`);
|
|
153
|
+
for (const change of changes) {
|
|
154
|
+
console.log(` ${dim('→')} ${change}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
console.log();
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;AAE5C,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAC7B,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAC5B,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IAC9B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IAC/B,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IAC5B,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,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+1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform: app.ts
|
|
3
|
+
*
|
|
4
|
+
* Handles the following mechanical changes:
|
|
5
|
+
* 1. Remove bootstrapRuntimeEnv() import + call
|
|
6
|
+
* 2. Add migration comment for setup/shutdown (removed in v2)
|
|
7
|
+
*
|
|
8
|
+
* Note: analytics/workbench STAY in createApp() — they are not moved anywhere.
|
|
9
|
+
* In v2, createApp() is the single source of truth for all runtime config.
|
|
10
|
+
*
|
|
11
|
+
* We use simple string-level surgery rather than a full AST round-trip so that
|
|
12
|
+
* formatting and comments are preserved. The TypeScript API is used only for
|
|
13
|
+
* detection (already done in detect.ts); we apply regex-based patches here.
|
|
14
|
+
*
|
|
15
|
+
* COMPLEXITY GUARD: if the file contains anything we don't recognise (e.g. the
|
|
16
|
+
* giant generated/app.ts blob that v1 CLI wrote), we refuse to touch it and
|
|
17
|
+
* return a `complexityError`.
|
|
18
|
+
*/
|
|
19
|
+
import type { DetectionResult } from '../detect';
|
|
20
|
+
export interface AppTsTransformResult {
|
|
21
|
+
/** The transformed source, or null if transformation was skipped */
|
|
22
|
+
source: string | null;
|
|
23
|
+
/** Set when the file is too complex for automated transformation */
|
|
24
|
+
complexityError?: string;
|
|
25
|
+
/** Informational messages about what was changed */
|
|
26
|
+
changes: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function transformAppTs(source: string, detection: DetectionResult): AppTsTransformResult;
|
|
29
|
+
//# sourceMappingURL=app-ts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-ts.d.ts","sourceRoot":"","sources":["../../src/transforms/app-ts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACpC,oEAAoE;IACpE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AA4BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,oBAAoB,CAuF/F"}
|