@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.
Files changed (43) hide show
  1. package/README.md +203 -0
  2. package/bin/migrate.ts +60 -0
  3. package/dist/detect.d.ts +56 -0
  4. package/dist/detect.d.ts.map +1 -0
  5. package/dist/detect.js +561 -0
  6. package/dist/detect.js.map +1 -0
  7. package/dist/index.d.ts +9 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +9 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/migrate.d.ts +29 -0
  12. package/dist/migrate.d.ts.map +1 -0
  13. package/dist/migrate.js +315 -0
  14. package/dist/migrate.js.map +1 -0
  15. package/dist/report.d.ts +22 -0
  16. package/dist/report.d.ts.map +1 -0
  17. package/dist/report.js +159 -0
  18. package/dist/report.js.map +1 -0
  19. package/dist/transforms/app-ts.d.ts +29 -0
  20. package/dist/transforms/app-ts.d.ts.map +1 -0
  21. package/dist/transforms/app-ts.js +114 -0
  22. package/dist/transforms/app-ts.js.map +1 -0
  23. package/dist/transforms/barrels.d.ts +12 -0
  24. package/dist/transforms/barrels.d.ts.map +1 -0
  25. package/dist/transforms/barrels.js +103 -0
  26. package/dist/transforms/barrels.js.map +1 -0
  27. package/dist/transforms/generated.d.ts +7 -0
  28. package/dist/transforms/generated.d.ts.map +1 -0
  29. package/dist/transforms/generated.js +10 -0
  30. package/dist/transforms/generated.js.map +1 -0
  31. package/dist/transforms/routes.d.ts +49 -0
  32. package/dist/transforms/routes.d.ts.map +1 -0
  33. package/dist/transforms/routes.js +208 -0
  34. package/dist/transforms/routes.js.map +1 -0
  35. package/package.json +45 -0
  36. package/src/detect.ts +694 -0
  37. package/src/index.ts +9 -0
  38. package/src/migrate.ts +379 -0
  39. package/src/report.ts +195 -0
  40. package/src/transforms/app-ts.ts +144 -0
  41. package/src/transforms/barrels.ts +138 -0
  42. package/src/transforms/generated.ts +11 -0
  43. package/src/transforms/routes.ts +273 -0
package/dist/detect.js ADDED
@@ -0,0 +1,561 @@
1
+ /**
2
+ * V1 pattern detection.
3
+ *
4
+ * Analyses a project directory and returns a structured report of every v1
5
+ * artefact that needs to be migrated to v2. No files are modified here.
6
+ */
7
+ import { existsSync, readdirSync, statSync } from 'node:fs';
8
+ import { join, relative, resolve } from 'node:path';
9
+ import ts from 'typescript';
10
+ // ---------------------------------------------------------------------------
11
+ // Removed frontend API names
12
+ // ---------------------------------------------------------------------------
13
+ const REMOVED_REACT_APIS = new Set([
14
+ 'createAPIClient',
15
+ 'useAPI',
16
+ 'createClient',
17
+ 'RouteRegistry',
18
+ 'RPCRouteRegistry',
19
+ 'SSERouteRegistry',
20
+ 'WebSocketRouteRegistry',
21
+ ]);
22
+ /**
23
+ * APIs that are deprecated (still work but will be removed).
24
+ * Users should migrate away from these.
25
+ */
26
+ const DEPRECATED_REACT_APIS = new Set([
27
+ 'AgentuityProvider',
28
+ 'AgentuityContext',
29
+ 'useAgentuity',
30
+ 'useAuth',
31
+ 'useAnalytics',
32
+ 'useTrackOnMount',
33
+ 'withPageTracking',
34
+ 'useWebRTCCall',
35
+ 'useJsonMemo',
36
+ ]);
37
+ // ---------------------------------------------------------------------------
38
+ // Helpers
39
+ // ---------------------------------------------------------------------------
40
+ function rel(projectDir, abs) {
41
+ return relative(projectDir, abs);
42
+ }
43
+ /**
44
+ * Walk a directory recursively, yielding all file paths that match the
45
+ * given extension filter.
46
+ */
47
+ function* walkFiles(dir, exts) {
48
+ if (!existsSync(dir))
49
+ return;
50
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
51
+ const full = join(dir, entry.name);
52
+ if (entry.isDirectory()) {
53
+ // Skip known non-source dirs
54
+ if (['node_modules', 'dist', '.agentuity', '.git'].includes(entry.name))
55
+ continue;
56
+ yield* walkFiles(full, exts);
57
+ }
58
+ else if (entry.isFile() && exts.some((e) => entry.name.endsWith(e))) {
59
+ yield full;
60
+ }
61
+ }
62
+ }
63
+ /** Parse a TypeScript source file and return the AST */
64
+ async function parseTs(filePath) {
65
+ const src = await Bun.file(filePath).text();
66
+ return ts.createSourceFile(filePath, src, ts.ScriptTarget.ESNext, true);
67
+ }
68
+ /**
69
+ * Collect the property names present inside a specific function call's first
70
+ * object-literal argument.
71
+ *
72
+ * e.g. given `createApp({ router, agents, setup })` → ['router','agents','setup']
73
+ */
74
+ function getCreateAppProps(sourceFile) {
75
+ const props = new Set();
76
+ function visit(node) {
77
+ if (ts.isCallExpression(node) &&
78
+ ts.isIdentifier(node.expression) &&
79
+ node.expression.text === 'createApp') {
80
+ const arg = node.arguments[0];
81
+ if (arg && ts.isObjectLiteralExpression(arg)) {
82
+ for (const prop of arg.properties) {
83
+ if ((ts.isPropertyAssignment(prop) || ts.isShorthandPropertyAssignment(prop)) &&
84
+ ts.isIdentifier(prop.name)) {
85
+ props.add(prop.name.text);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ ts.forEachChild(node, visit);
91
+ }
92
+ visit(sourceFile);
93
+ return props;
94
+ }
95
+ /**
96
+ * Returns true if the source file contains a call to `bootstrapRuntimeEnv()`
97
+ */
98
+ function hasBootstrapCall(sourceFile) {
99
+ let found = false;
100
+ function visit(node) {
101
+ if (found)
102
+ return;
103
+ if (ts.isCallExpression(node) &&
104
+ ts.isIdentifier(node.expression) &&
105
+ node.expression.text === 'bootstrapRuntimeEnv') {
106
+ found = true;
107
+ return;
108
+ }
109
+ ts.forEachChild(node, visit);
110
+ }
111
+ visit(sourceFile);
112
+ return found;
113
+ }
114
+ /**
115
+ * Detect whether a route file uses v1 mutable-style `createRouter()` +
116
+ * `router.get(...)` vs v2 chained `new Hono<Env>().get(...)`.
117
+ *
118
+ * Returns 'v1' | 'v2' | 'unknown' (file doesn't look like a route at all).
119
+ */
120
+ function classifyRouteFile(sourceFile) {
121
+ // sync — receives parsed AST
122
+ let hasCreateRouter = false;
123
+ let hasMutatingCall = false; // router.get / router.post etc.
124
+ let hasHonoNew = false;
125
+ function visit(node) {
126
+ // createRouter() call
127
+ if (ts.isCallExpression(node) &&
128
+ ts.isIdentifier(node.expression) &&
129
+ node.expression.text === 'createRouter') {
130
+ hasCreateRouter = true;
131
+ }
132
+ // router.<method>(...) — mutating style
133
+ if (ts.isCallExpression(node) &&
134
+ ts.isPropertyAccessExpression(node.expression) &&
135
+ ts.isIdentifier(node.expression.name)) {
136
+ const methodName = node.expression.name.text;
137
+ if (['get', 'post', 'put', 'patch', 'delete', 'all', 'use', 'route'].includes(methodName)) {
138
+ // Check that the object being accessed is NOT a chained call (i.e., it's an identifier)
139
+ if (ts.isIdentifier(node.expression.expression)) {
140
+ hasMutatingCall = true;
141
+ }
142
+ }
143
+ }
144
+ // new Hono<...>()
145
+ if (ts.isNewExpression(node) &&
146
+ ts.isIdentifier(node.expression) &&
147
+ node.expression.text === 'Hono') {
148
+ hasHonoNew = true;
149
+ }
150
+ ts.forEachChild(node, visit);
151
+ }
152
+ visit(sourceFile);
153
+ if (hasHonoNew)
154
+ return 'v2';
155
+ if (hasCreateRouter && hasMutatingCall)
156
+ return 'v1';
157
+ return 'unknown';
158
+ }
159
+ /**
160
+ * Scan frontend (web) source files for removed API usages.
161
+ */
162
+ async function scanFrontendFiles(projectDir) {
163
+ const webDir = join(projectDir, 'src', 'web');
164
+ const findings = [];
165
+ for (const file of walkFiles(webDir, ['.ts', '.tsx'])) {
166
+ const sourceFile = await parseTs(file);
167
+ const usedApis = [];
168
+ const deprecatedApis = [];
169
+ function visit(node) {
170
+ // Check named imports from @agentuity/react or @agentuity/frontend
171
+ if (ts.isImportDeclaration(node)) {
172
+ const moduleSpecifier = node.moduleSpecifier.text;
173
+ if (moduleSpecifier === '@agentuity/react' ||
174
+ moduleSpecifier === '@agentuity/frontend') {
175
+ const namedBindings = node.importClause?.namedBindings;
176
+ if (namedBindings && ts.isNamedImports(namedBindings)) {
177
+ for (const element of namedBindings.elements) {
178
+ const name = element.name.text;
179
+ if (REMOVED_REACT_APIS.has(name)) {
180
+ usedApis.push(name);
181
+ }
182
+ if (DEPRECATED_REACT_APIS.has(name)) {
183
+ deprecatedApis.push(name);
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ ts.forEachChild(node, visit);
190
+ }
191
+ visit(sourceFile);
192
+ if (usedApis.length > 0 || deprecatedApis.length > 0) {
193
+ findings.push({
194
+ file: rel(projectDir, file),
195
+ apis: [...new Set(usedApis)],
196
+ deprecatedApis: [...new Set(deprecatedApis)],
197
+ });
198
+ }
199
+ }
200
+ return findings;
201
+ }
202
+ /**
203
+ * Find all route files under src/api (recursively, files named `route.ts` or
204
+ * `route.tsx` or `router.ts`).
205
+ */
206
+ function findRouteFiles(projectDir) {
207
+ const apiDir = join(projectDir, 'src', 'api');
208
+ const files = [];
209
+ for (const file of walkFiles(apiDir, ['.ts', '.tsx'])) {
210
+ const base = file.split('/').pop() ?? '';
211
+ if (base === 'route.ts' || base === 'route.tsx' || base === 'router.ts') {
212
+ files.push(file);
213
+ }
214
+ }
215
+ return files;
216
+ }
217
+ // ---------------------------------------------------------------------------
218
+ // Main detector
219
+ // ---------------------------------------------------------------------------
220
+ export async function detect(projectDir) {
221
+ const absDir = resolve(projectDir);
222
+ const findings = [];
223
+ const result = {
224
+ projectDir: absDir,
225
+ findings,
226
+ v1RouteFiles: [],
227
+ v2RouteFiles: [],
228
+ hasAgentBarrel: false,
229
+ hasApiBarrel: false,
230
+ hasAgentuityConfig: false,
231
+ analyticsInCreateApp: false,
232
+ workbenchInCreateApp: false,
233
+ setupInCreateApp: false,
234
+ shutdownInCreateApp: false,
235
+ bootstrapCallInAppTs: false,
236
+ frontendRemovedApis: [],
237
+ };
238
+ // ── 1. src/generated/ ───────────────────────────────────────────────────
239
+ const generatedDir = join(absDir, 'src', 'generated');
240
+ if (existsSync(generatedDir) && statSync(generatedDir).isDirectory()) {
241
+ result.generatedDir = generatedDir;
242
+ findings.push({
243
+ id: 'generated-dir',
244
+ severity: 'auto',
245
+ message: 'src/generated/ directory exists (CLI-managed codegen artefacts)',
246
+ file: rel(absDir, generatedDir),
247
+ hint: 'Will be deleted. In v2, types come from Hono RPC inference and direct imports.',
248
+ });
249
+ }
250
+ // ── 2. app.ts ────────────────────────────────────────────────────────────
251
+ const appTsPath = join(absDir, 'app.ts');
252
+ if (existsSync(appTsPath)) {
253
+ result.appTsPath = appTsPath;
254
+ const sourceFile = await parseTs(appTsPath);
255
+ const props = getCreateAppProps(sourceFile);
256
+ result.bootstrapCallInAppTs = hasBootstrapCall(sourceFile);
257
+ if (result.bootstrapCallInAppTs) {
258
+ findings.push({
259
+ id: 'bootstrap-call',
260
+ severity: 'auto',
261
+ message: 'app.ts calls bootstrapRuntimeEnv() — removed in v2',
262
+ file: 'app.ts',
263
+ hint: 'createApp() handles runtime bootstrapping internally; the call will be removed.',
264
+ });
265
+ }
266
+ result.setupInCreateApp = props.has('setup');
267
+ if (result.setupInCreateApp) {
268
+ findings.push({
269
+ id: 'setup-in-createapp',
270
+ severity: 'guided',
271
+ message: 'createApp({ setup }) — setup() lifecycle removed in v2',
272
+ file: 'app.ts',
273
+ hint: 'Move initialisation logic to module-level top-of-file code in app.ts. ' +
274
+ "For cleanup, use Hono's standard patterns or Bun's process hooks (e.g., process.on('beforeExit', ...)).",
275
+ });
276
+ }
277
+ result.shutdownInCreateApp = props.has('shutdown');
278
+ if (result.shutdownInCreateApp) {
279
+ findings.push({
280
+ id: 'shutdown-in-createapp',
281
+ severity: 'guided',
282
+ message: 'createApp({ shutdown }) — shutdown() lifecycle removed in v2',
283
+ file: 'app.ts',
284
+ hint: "Use Hono's standard patterns or Bun's process hooks for cleanup " +
285
+ "(e.g., process.on('beforeExit', async () => { /* cleanup */ })).",
286
+ });
287
+ }
288
+ result.analyticsInCreateApp = props.has('analytics');
289
+ if (result.analyticsInCreateApp) {
290
+ // v2 keeps analytics in createApp() - no migration needed
291
+ // This is tracked for informational purposes only
292
+ }
293
+ result.workbenchInCreateApp = props.has('workbench');
294
+ if (result.workbenchInCreateApp) {
295
+ // v2 keeps workbench in createApp() - no migration needed
296
+ // This is tracked for informational purposes only
297
+ }
298
+ // Check if router/agents are already wired (v2 pattern)
299
+ const hasRouter = props.has('router');
300
+ const hasAgents = props.has('agents');
301
+ if (!hasRouter && !hasAgents) {
302
+ findings.push({
303
+ id: 'app-no-router-agents',
304
+ severity: 'guided',
305
+ message: 'app.ts does not pass router or agents to createApp()',
306
+ file: 'app.ts',
307
+ hint: 'In v2, you must explicitly import and pass your router and agents array.\n' +
308
+ '\n' +
309
+ " import router from './src/api';\n" +
310
+ " import agents from './src/agent';\n" +
311
+ '\n' +
312
+ ' const { server, logger } = await createApp({\n' +
313
+ " router: { path: '/api', router },\n" +
314
+ ' agents,\n' +
315
+ ' });\n' +
316
+ '\n' +
317
+ 'The src/api/index.ts and src/agent/index.ts barrels are generated by this tool.',
318
+ });
319
+ }
320
+ }
321
+ else {
322
+ findings.push({
323
+ id: 'no-app-ts',
324
+ severity: 'manual',
325
+ message: 'No app.ts found at project root',
326
+ hint: 'Create app.ts importing createApp from @agentuity/runtime.',
327
+ });
328
+ }
329
+ // ── 3. agentuity.config.ts ───────────────────────────────────────────────
330
+ const configPath = join(absDir, 'agentuity.config.ts');
331
+ result.hasAgentuityConfig = existsSync(configPath);
332
+ // Check for vite.config.ts (v2 approach)
333
+ const viteConfigPath = join(absDir, 'vite.config.ts');
334
+ const hasViteConfig = existsSync(viteConfigPath);
335
+ // In v2, agentuity.config.ts is DEPRECATED.
336
+ // ALL config is consolidated into createApp() or native Vite config:
337
+ // - Vite keys (plugins, define, render, bundle) → vite.config.ts
338
+ // - Runtime keys (analytics, workbench) → createApp() ONLY (single source of truth)
339
+ if (result.hasAgentuityConfig) {
340
+ const configSrc = await Bun.file(configPath).text();
341
+ // Categorize config keys
342
+ const viteKeys = [];
343
+ const runtimeKeys = [];
344
+ if (configSrc.includes('plugins:'))
345
+ viteKeys.push('plugins');
346
+ if (configSrc.includes('define:'))
347
+ viteKeys.push('define');
348
+ if (configSrc.includes('render:'))
349
+ viteKeys.push('render');
350
+ if (configSrc.includes('bundle:'))
351
+ viteKeys.push('bundle');
352
+ if (configSrc.includes('analytics:'))
353
+ runtimeKeys.push('analytics');
354
+ if (configSrc.includes('workbench:'))
355
+ runtimeKeys.push('workbench');
356
+ if (viteKeys.length > 0) {
357
+ findings.push({
358
+ id: 'agentuity-config-vite-keys',
359
+ severity: 'guided',
360
+ message: `agentuity.config.ts has Vite config: ${viteKeys.join(', ')}`,
361
+ file: 'agentuity.config.ts',
362
+ hint: 'Vite config should go in vite.config.ts. Example:\n' +
363
+ '\n' +
364
+ ' // vite.config.ts\n' +
365
+ " import { defineConfig } from 'vite';\n" +
366
+ " import react from '@vitejs/plugin-react';\n" +
367
+ '\n' +
368
+ ' export default defineConfig({\n' +
369
+ ' plugins: [react()],\n' +
370
+ " define: { CUSTOM: JSON.stringify('value') },\n" +
371
+ ' });\n' +
372
+ '\n' +
373
+ 'After creating vite.config.ts, delete agentuity.config.ts.',
374
+ });
375
+ }
376
+ if (runtimeKeys.length > 0) {
377
+ findings.push({
378
+ id: 'agentuity-config-runtime-keys',
379
+ severity: 'guided',
380
+ message: `agentuity.config.ts has ${runtimeKeys.join(', ')} — remove (use createApp() only)`,
381
+ file: 'agentuity.config.ts',
382
+ hint: 'In v2, ALL runtime config goes in createApp().\n' +
383
+ 'The CLI reads these options directly from your createApp() call.\n' +
384
+ 'Remove them from agentuity.config.ts and keep only in createApp().',
385
+ });
386
+ }
387
+ if (viteKeys.length === 0 && runtimeKeys.length === 0) {
388
+ // Empty or minimal config
389
+ findings.push({
390
+ id: 'agentuity-config-empty',
391
+ severity: 'guided',
392
+ message: 'agentuity.config.ts exists but has no config keys — can be deleted',
393
+ file: 'agentuity.config.ts',
394
+ hint: 'This file is no longer needed in v2. Delete it.',
395
+ });
396
+ }
397
+ }
398
+ // ── 4. Route files ───────────────────────────────────────────────────────
399
+ const routeFiles = findRouteFiles(absDir);
400
+ for (const file of routeFiles) {
401
+ const sourceFile = await parseTs(file);
402
+ const classification = classifyRouteFile(sourceFile);
403
+ const relFile = rel(absDir, file);
404
+ if (classification === 'v1') {
405
+ result.v1RouteFiles.push(file);
406
+ findings.push({
407
+ id: `route-v1:${relFile}`,
408
+ severity: 'auto',
409
+ message: `Route file uses v1 mutable createRouter() style`,
410
+ file: relFile,
411
+ hint: 'Will be rewritten to chained new Hono<Env>().get().post()… style.\n' +
412
+ 'Chaining is required for Hono RPC — only a single chained expression\n' +
413
+ 'accumulates all route schemas into `typeof router`, which becomes the\n' +
414
+ 'AppRouter type used by hc<AppRouter>() on the frontend.',
415
+ });
416
+ }
417
+ else if (classification === 'v2') {
418
+ result.v2RouteFiles.push(file);
419
+ }
420
+ }
421
+ // ── 5. src/api/index.ts barrel ──────────────────────────────────────────
422
+ const apiIndexPath = join(absDir, 'src', 'api', 'index.ts');
423
+ result.hasApiBarrel = existsSync(apiIndexPath);
424
+ if (!result.hasApiBarrel && result.v1RouteFiles.length > 0) {
425
+ findings.push({
426
+ id: 'missing-api-barrel',
427
+ severity: 'auto',
428
+ message: 'src/api/index.ts barrel does not exist',
429
+ hint: 'Will be generated with a single chained Hono<Env>().route()… expression.\n' +
430
+ 'This exports AppRouter = typeof router, the type needed for hc<AppRouter>()\n' +
431
+ 'on the frontend. Chaining is required — broken chains produce an empty type.',
432
+ });
433
+ }
434
+ else if (result.hasApiBarrel) {
435
+ // Check if the existing index.ts is the old empty stub
436
+ const src = await Bun.file(apiIndexPath).text();
437
+ const isStub = src.includes('createRouter()') &&
438
+ !src.includes('.route(') &&
439
+ src.split('\n').filter((l) => l.trim()).length < 8;
440
+ if (isStub) {
441
+ findings.push({
442
+ id: 'api-barrel-stub',
443
+ severity: 'auto',
444
+ message: 'src/api/index.ts is the empty v1 stub (createRouter() with no routes)',
445
+ file: 'src/api/index.ts',
446
+ hint: 'Will be replaced with an explicit barrel that imports and composes all route files.',
447
+ });
448
+ }
449
+ }
450
+ // ── 6. src/agent/index.ts barrel ────────────────────────────────────────
451
+ const agentIndexPath = join(absDir, 'src', 'agent', 'index.ts');
452
+ result.hasAgentBarrel = existsSync(agentIndexPath);
453
+ if (!result.hasAgentBarrel) {
454
+ const agentDir = join(absDir, 'src', 'agent');
455
+ if (existsSync(agentDir)) {
456
+ findings.push({
457
+ id: 'missing-agent-barrel',
458
+ severity: 'auto',
459
+ message: 'src/agent/index.ts barrel does not exist',
460
+ hint: 'Will be generated by scanning src/agent/*/agent.ts files and exporting a default array.',
461
+ });
462
+ }
463
+ }
464
+ // ── 7. Frontend removed APIs ─────────────────────────────────────────────
465
+ result.frontendRemovedApis = await scanFrontendFiles(absDir);
466
+ for (const fe of result.frontendRemovedApis) {
467
+ if (fe.apis.length > 0) {
468
+ findings.push({
469
+ id: `frontend-removed:${fe.file}`,
470
+ severity: 'manual',
471
+ message: `Frontend file uses removed APIs: ${fe.apis.join(', ')}`,
472
+ file: fe.file,
473
+ hint: 'Replace with Hono RPC client (hono/client):\n' +
474
+ '\n' +
475
+ " import { hc } from 'hono/client';\n" +
476
+ " import type { AppRouter } from '../api'; // your barrel\n" +
477
+ " const client = hc<AppRouter>(window.location.origin + '/api');\n" +
478
+ " const res = await client.hello.$post({ json: { name: 'World' } });\n" +
479
+ '\n' +
480
+ 'See: https://hono.dev/docs/guides/rpc',
481
+ });
482
+ }
483
+ if (fe.deprecatedApis && fe.deprecatedApis.length > 0) {
484
+ findings.push({
485
+ id: `frontend-deprecated:${fe.file}`,
486
+ severity: 'guided',
487
+ message: `Frontend file uses deprecated @agentuity/react APIs: ${fe.deprecatedApis.join(', ')}`,
488
+ file: fe.file,
489
+ hint: '@agentuity/react is deprecated. Migration options:\n' +
490
+ '\n' +
491
+ '• AgentuityProvider/useAuth → Use your auth provider directly (better-auth, Clerk, etc.)\n' +
492
+ '• useAnalytics → Use getAnalytics() from @agentuity/frontend\n' +
493
+ '• useWebRTCCall → Use WebRTCManager from @agentuity/frontend\n' +
494
+ '• WebSocketManager/EventStreamManager → Import from @agentuity/frontend\n' +
495
+ '\n' +
496
+ 'The package will continue to work but will not receive updates.',
497
+ });
498
+ }
499
+ }
500
+ // ── 7b. Hono RPC recommendation (whenever routes exist) ─────────────────
501
+ // Fire this as a "guided" finding whenever there are any API routes,
502
+ // regardless of whether the frontend already uses removed APIs.
503
+ // It surfaces the RPC pattern to users who may not know about it yet.
504
+ const hasApiRoutes = result.v1RouteFiles.length > 0 ||
505
+ result.v2RouteFiles.length > 0 ||
506
+ existsSync(join(absDir, 'src', 'api'));
507
+ const frontendDir = join(absDir, 'src', 'web');
508
+ const hasFrontend = existsSync(frontendDir);
509
+ // ── 7c. Vite config check ───────────────────────────────────────────────
510
+ // If there's a frontend, vite.config.ts should exist with framework plugins
511
+ if (hasFrontend && !hasViteConfig) {
512
+ findings.push({
513
+ id: 'missing-vite-config',
514
+ severity: 'guided',
515
+ message: 'No vite.config.ts found - frontend requires Vite configuration',
516
+ hint: 'Create vite.config.ts with your frontend framework plugin:\n' +
517
+ '\n' +
518
+ ' // vite.config.ts\n' +
519
+ " import { defineConfig } from 'vite';\n" +
520
+ " import react from '@vitejs/plugin-react';\n" +
521
+ '\n' +
522
+ ' export default defineConfig({\n' +
523
+ ' plugins: [react()],\n' +
524
+ ' });\n' +
525
+ '\n' +
526
+ 'For other frameworks:\n' +
527
+ " • Svelte: import { svelte } from '@sveltejs/vite-plugin-svelte'\n" +
528
+ " • Vue: import vue from '@vitejs/plugin-vue'\n" +
529
+ " • Solid: import solid from 'vite-plugin-solid'",
530
+ });
531
+ }
532
+ if (hasApiRoutes && hasFrontend && result.frontendRemovedApis.length === 0) {
533
+ // Only show this if there are no already-detected frontend issues (avoid duplication)
534
+ findings.push({
535
+ id: 'hono-rpc-recommendation',
536
+ severity: 'guided',
537
+ message: 'Consider using Hono RPC for fully type-safe frontend ↔ backend calls',
538
+ hint: "v2 uses Hono's native RPC system instead of the old Agentuity typed client.\n" +
539
+ 'The barrel at src/api/index.ts exports AppRouter = typeof router.\n' +
540
+ 'Routes MUST be chained in a single expression for types to accumulate.\n' +
541
+ '\n' +
542
+ 'In your frontend (src/web/):\n' +
543
+ '\n' +
544
+ " import { hc } from 'hono/client';\n" +
545
+ " import type { AppRouter } from '../api';\n" +
546
+ '\n' +
547
+ " const client = hc<AppRouter>(window.location.origin + '/api');\n" +
548
+ '\n' +
549
+ ' // Typed call — method name mirrors route path, prefixed with $\n' +
550
+ " const res = await client.hello.$post({ json: { name: 'World' } });\n" +
551
+ ' const data = await res.json();\n' +
552
+ '\n' +
553
+ 'See: https://hono.dev/docs/guides/rpc',
554
+ });
555
+ }
556
+ // Sort: auto first, guided second, manual last
557
+ const order = { auto: 0, guided: 1, manual: 2 };
558
+ findings.sort((a, b) => order[a.severity] - order[b.severity]);
559
+ return result;
560
+ }
561
+ //# sourceMappingURL=detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,YAAY,CAAC;AA6D5B,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAClC,iBAAiB;IACjB,QAAQ;IACR,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,wBAAwB;CACxB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACrC,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,SAAS;IACT,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,eAAe;IACf,aAAa;CACb,CAAC,CAAC;AAEH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,GAAG,CAAC,UAAkB,EAAE,GAAW;IAC3C,O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E,IAAI,EACH,8DAA8D;gBAC9D,IAAI;gBACJ,uBAAuB;gBACvB,0CAA0C;gBAC1C,+CAA+C;gBAC/C,IAAI;gBACJ,mCAAmC;gBACnC,2BAA2B;gBAC3B,SAAS;gBACT,IAAI;gBACJ,yBAAyB;gBACzB,qEAAqE;gBACrE,iDAAiD;gBACjD,kDAAkD;SACnD,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,IAAI,WAAW,IAAI,MAAM,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5E,sFAAsF;QACtF,QAAQ,CAAC,IAAI,CAAC;YACb,EAAE,EAAE,yBAAyB;YAC7B,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,sEAAsE;YAC/E,IAAI,EACH,+EAA+E;gBAC/E,qEAAqE;gBACrE,0EAA0E;gBAC1E,IAAI;gBACJ,gCAAgC;gBAChC,IAAI;gBACJ,uCAAuC;gBACvC,8CAA8C;gBAC9C,IAAI;gBACJ,oEAAoE;gBACpE,IAAI;gBACJ,qEAAqE;gBACrE,wEAAwE;gBACxE,oCAAoC;gBACpC,IAAI;gBACJ,uCAAuC;SACxC,CAAC,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,MAAM,KAAK,GAA6B,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC1E,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/D,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @agentuity/migrate — public API
3
+ *
4
+ * Programmatic access to the migration tool. For CLI usage, use the bin entry:
5
+ * npx @agentuity/migrate [project-dir]
6
+ */
7
+ export { migrate, type MigrateOptions, type MigrateResult } from './migrate';
8
+ export { detect, type DetectionResult, type Finding, type Severity } from './detect';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @agentuity/migrate — public API
3
+ *
4
+ * Programmatic access to the migration tool. For CLI usage, use the bin entry:
5
+ * npx @agentuity/migrate [project-dir]
6
+ */
7
+ export { migrate } from './migrate';
8
+ export { detect } from './detect';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAA2C,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAqD,MAAM,UAAU,CAAC"}
@@ -0,0 +1,29 @@
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
+ export interface MigrateOptions {
14
+ /** Project directory (defaults to cwd) */
15
+ projectDir?: string;
16
+ /** Skip interactive confirmation */
17
+ yes?: boolean;
18
+ /** Only run detection + print report, no transforms */
19
+ dryRun?: boolean;
20
+ }
21
+ export type MigrateResult = {
22
+ ok: true;
23
+ changedFiles: string[];
24
+ } | {
25
+ ok: false;
26
+ reason: string;
27
+ };
28
+ export declare function migrate(opts?: MigrateOptions): Promise<MigrateResult>;
29
+ //# sourceMappingURL=migrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA2BH,MAAM,WAAW,cAAc;IAC9B,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAsGjG,wBAAsB,OAAO,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAqO/E"}