@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
@@ -0,0 +1,114 @@
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
+ /**
20
+ * Heuristics that identify the v1 *generated* app.ts (the 500-line blob the
21
+ * CLI wrote, not the user-facing app.ts). If we detect these, we bail out
22
+ * because the user probably has a non-standard setup.
23
+ */
24
+ const COMPLEXITY_MARKERS = [
25
+ 'bootstrapRuntimeEnv',
26
+ 'createBaseMiddleware',
27
+ 'createOtelMiddleware',
28
+ 'createAgentMiddleware',
29
+ 'setGlobalLogger',
30
+ 'setGlobalTracer',
31
+ 'setGlobalRouter',
32
+ 'getAppState',
33
+ 'getAppConfig',
34
+ 'getUserRouter',
35
+ 'loadBuildMetadata',
36
+ 'patchBunS3ForStorageDev',
37
+ 'createWorkbenchRouter',
38
+ 'injectAnalytics',
39
+ 'registerAnalyticsRoutes',
40
+ ];
41
+ /** How many complexity markers before we bail */
42
+ const COMPLEXITY_THRESHOLD = 3;
43
+ export function transformAppTs(source, detection) {
44
+ const changes = [];
45
+ // ── Complexity guard ───────────────────────────────────────────────────
46
+ const markerCount = COMPLEXITY_MARKERS.filter((m) => source.includes(m)).length;
47
+ if (markerCount >= COMPLEXITY_THRESHOLD) {
48
+ return {
49
+ source: null,
50
+ complexityError: `app.ts appears to be the v1 CLI-generated entry file (detected ${markerCount} internal ` +
51
+ `framework markers). This file cannot be automatically migrated.\n` +
52
+ `\n` +
53
+ `Action required:\n` +
54
+ ` Replace app.ts with a clean v2 entry:\n` +
55
+ `\n` +
56
+ ` import { createApp } from '@agentuity/runtime';\n` +
57
+ ` import router from './src/api';\n` +
58
+ ` import agents from './src/agent';\n` +
59
+ `\n` +
60
+ ` const { server, logger } = await createApp({\n` +
61
+ ` router: { path: '/api', router },\n` +
62
+ ` agents,\n` +
63
+ ` });\n` +
64
+ `\n` +
65
+ ` logger.debug('Running %s', server.url);\n`,
66
+ changes: [],
67
+ };
68
+ }
69
+ let out = source;
70
+ // ── 1. Remove bootstrapRuntimeEnv import binding ──────────────────────
71
+ if (detection.bootstrapCallInAppTs) {
72
+ // Remove the named import specifier (handles both standalone and combined imports)
73
+ // e.g. import { bootstrapRuntimeEnv } from '@agentuity/runtime';
74
+ // e.g. import { createApp, bootstrapRuntimeEnv } from '@agentuity/runtime';
75
+ out = out.replace(/import\s*\{([^}]*)\}\s*from\s*['"]@agentuity\/runtime['"]\s*;?/g, (match, bindings) => {
76
+ const cleaned = bindings
77
+ .split(',')
78
+ .map((s) => s.trim())
79
+ .filter((s) => s && s !== 'bootstrapRuntimeEnv')
80
+ .join(', ');
81
+ if (!cleaned)
82
+ return ''; // entire import removed
83
+ return match.replace(bindings, ` ${cleaned} `);
84
+ });
85
+ // Remove the standalone call — handles `await bootstrapRuntimeEnv();` with optional options
86
+ out = out.replace(/^\s*await\s+bootstrapRuntimeEnv\([^)]*\)\s*;?\s*\n?/gm, '');
87
+ out = out.replace(/^\s*bootstrapRuntimeEnv\([^)]*\)\s*;?\s*\n?/gm, '');
88
+ // Clean up any blank lines that result from the removal (max one blank line)
89
+ out = out.replace(/\n{3,}/g, '\n\n');
90
+ changes.push('Removed bootstrapRuntimeEnv() import and call');
91
+ }
92
+ // Note: analytics/workbench stay in createApp() in v2 - no migration needed
93
+ // ── 2. setup / shutdown scaffolding comment ───────────────────────────
94
+ if (detection.setupInCreateApp || detection.shutdownInCreateApp) {
95
+ // We do NOT remove setup/shutdown — they require human judgment.
96
+ // Instead, prepend a prominent comment block.
97
+ const comment = `// ⚠️ MIGRATION REQUIRED — setup/shutdown removed in v2\n` +
98
+ `//\n` +
99
+ `// Move initialisation logic to module-level code (top of this file).\n` +
100
+ `// For cleanup, use Hono's standard patterns or Bun's process hooks:\n` +
101
+ `//\n` +
102
+ `// process.on('beforeExit', async () => {\n` +
103
+ `// // your cleanup here\n` +
104
+ `// });\n` +
105
+ `//\n` +
106
+ `// Then remove the setup and shutdown props from createApp().\n`;
107
+ // Insert just before the createApp call
108
+ // Match: const { a, b } = await createApp OR const foo = await createApp OR export default await createApp
109
+ out = out.replace(/(const|let|var)\s+(\{[^}]+\}|\w+)\s*=\s*await\s+createApp|export default await createApp/, `${comment}\n$&`);
110
+ changes.push('Added migration comment for setup/shutdown — manual action required');
111
+ }
112
+ return { source: out, changes };
113
+ }
114
+ //# sourceMappingURL=app-ts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-ts.js","sourceRoot":"","sources":["../../src/transforms/app-ts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAaH;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IAC1B,qBAAqB;IACrB,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,aAAa;IACb,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,yBAAyB;IACzB,uBAAuB;IACvB,iBAAiB;IACjB,yBAAyB;CACzB,CAAC;AAEF,iDAAiD;AACjD,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,SAA0B;IACxE,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,0EAA0E;IAC1E,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,C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AA+C,EAAE,EAAE,CAAC,CAAC;QAEvE,6EAA6E;QAC7E,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAErC,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IAC/D,CAAC;IAED,4EAA4E;IAE5E,yEAAyE;IACzE,IAAI,SAAS,CAAC,gBAAgB,IAAI,SAAS,CAAC,mBAAmB,EAAE,CAAC;QACjE,iEAAiE;QACjE,8CAA8C;QAC9C,MAAM,OAAO,GACZ,4DAA4D;YAC5D,MAAM;YACN,yEAAyE;YACzE,wEAAwE;YACxE,MAAM;YACN,+CAA+C;YAC/C,+BAA+B;YAC/B,YAAY;YACZ,MAAM;YACN,iEAAiE,CAAC;QAEnE,wCAAwC;QACxC,+GAA+G;QAC/G,GAAG,GAAG,GAAG,CAAC,OAAO,CAChB,0FAA0F,EAC1F,GAAG,OAAO,MAAM,CAChB,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Transform: generate/update barrel files
3
+ *
4
+ * • src/agent/index.ts — exports default array of all agent runners
5
+ * • src/api/index.ts — exports composed Hono router + AppRouter type
6
+ *
7
+ * These are generated fresh; if a file already exists and is not the empty
8
+ * v1 stub we leave it alone (detection layer already decided).
9
+ */
10
+ export declare function generateAgentBarrel(projectDir: string): string | null;
11
+ export declare function generateApiBarrel(projectDir: string): string | null;
12
+ //# sourceMappingURL=barrels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrels.d.ts","sourceRoot":"","sources":["../../src/transforms/barrels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwCH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAarE;AAoCD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwCnE"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Transform: generate/update barrel files
3
+ *
4
+ * • src/agent/index.ts — exports default array of all agent runners
5
+ * • src/api/index.ts — exports composed Hono router + AppRouter type
6
+ *
7
+ * These are generated fresh; if a file already exists and is not the empty
8
+ * v1 stub we leave it alone (detection layer already decided).
9
+ */
10
+ import { existsSync, readdirSync } from 'node:fs';
11
+ import { join } from 'node:path';
12
+ function toImportName(agentDirName) {
13
+ // kebab-case or snake_case → camelCase
14
+ return agentDirName
15
+ .split(/[-_]/)
16
+ .map((part, i) => (i === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
17
+ .join('');
18
+ }
19
+ function findAgentDirs(agentDir) {
20
+ if (!existsSync(agentDir))
21
+ return [];
22
+ const entries = [];
23
+ for (const entry of readdirSync(agentDir, { withFileTypes: true })) {
24
+ if (!entry.isDirectory())
25
+ continue;
26
+ const agentFile = join(agentDir, entry.name, 'agent.ts');
27
+ if (existsSync(agentFile)) {
28
+ entries.push({
29
+ importName: toImportName(entry.name),
30
+ relativePath: `./${entry.name}/agent`,
31
+ });
32
+ }
33
+ }
34
+ return entries.sort((a, b) => a.importName.localeCompare(b.importName));
35
+ }
36
+ export function generateAgentBarrel(projectDir) {
37
+ const agentDir = join(projectDir, 'src', 'agent');
38
+ const agents = findAgentDirs(agentDir);
39
+ if (agents.length === 0)
40
+ return null;
41
+ const imports = agents
42
+ .map(({ importName, relativePath }) => `import ${importName} from '${relativePath}';`)
43
+ .join('\n');
44
+ const exportList = agents.map(({ importName }) => `\t${importName},`).join('\n');
45
+ return `${imports}\n\n` + `const agents = [\n${exportList}\n];\n\n` + `export default agents;\n`;
46
+ }
47
+ function toRouterImportName(routeDirName) {
48
+ const camel = toImportName(routeDirName);
49
+ return `${camel}Router`;
50
+ }
51
+ function findRouteFiles(apiDir) {
52
+ if (!existsSync(apiDir))
53
+ return [];
54
+ const entries = [];
55
+ for (const entry of readdirSync(apiDir, { withFileTypes: true })) {
56
+ if (!entry.isDirectory())
57
+ continue;
58
+ const routeFile = join(apiDir, entry.name, 'route.ts');
59
+ if (existsSync(routeFile)) {
60
+ entries.push({
61
+ importName: toRouterImportName(entry.name),
62
+ mountPath: `/${entry.name}`,
63
+ relativePath: `./${entry.name}/route`,
64
+ });
65
+ }
66
+ }
67
+ return entries.sort((a, b) => a.mountPath.localeCompare(b.mountPath));
68
+ }
69
+ export function generateApiBarrel(projectDir) {
70
+ const apiDir = join(projectDir, 'src', 'api');
71
+ const routes = findRouteFiles(apiDir);
72
+ if (routes.length === 0)
73
+ return null;
74
+ const imports = [
75
+ `import { Hono } from 'hono';`,
76
+ `import type { Env } from '@agentuity/runtime';`,
77
+ ...routes.map(({ importName, relativePath }) => `import ${importName} from '${relativePath}';`),
78
+ ].join('\n');
79
+ const chain = routes
80
+ .map(({ mountPath, importName }) => `\t.route('${mountPath}', ${importName})`)
81
+ .join('\n');
82
+ // The router MUST be built as a single chained expression so that TypeScript
83
+ // accumulates every route's schema into `typeof router` (AppRouter).
84
+ // Breaking the chain (e.g. separate `router.route(...)` statements) would
85
+ // produce an empty/incomplete AppRouter and break hc<AppRouter>() on the
86
+ // frontend.
87
+ //
88
+ // Frontend usage:
89
+ // import { hc } from 'hono/client';
90
+ // import type { AppRouter } from '../api';
91
+ // const client = hc<AppRouter>(window.location.origin + '/api');
92
+ // const res = await client.hello.$post({ json: { name: 'World' } });
93
+ return (`${imports}\n\n` +
94
+ `// Routes are chained in a single expression so TypeScript can accumulate\n` +
95
+ `// every sub-router's schema into AppRouter — required for Hono RPC typing.\n` +
96
+ `const router = new Hono<Env>()\n${chain};\n\n` +
97
+ `// AppRouter is the fully-typed entry point for the Hono client.\n` +
98
+ `// Import it in your frontend: import type { AppRouter } from '../api';\n` +
99
+ `// Then use: hc<AppRouter>(window.location.origin + '/api')\n` +
100
+ `export type AppRouter = typeof router;\n\n` +
101
+ `export default router;\n`);
102
+ }
103
+ //# sourceMappingURL=barrels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrels.js","sourceRoot":"","sources":["../../src/transforms/barrels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWjC,SAAS,YAAY,CAAC,YAAoB;IACzC,uCAAuC;IACvC,OAAO,YAAY;SACjB,KAAK,CAAC,MAAM,CAAC;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjF,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACpE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAAE,SAAS;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACzD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC;gBACZ,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;gBACpC,YAAY,EAAE,KAAK,KAAK,CAAC,IAAI,QAAQ;aACrC,CAAC,CAAC;QACJ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E,0EAA0E;IAC1E,yEAAyE;IACzE,YAAY;IACZ,EAAE;IACF,kBAAkB;IAClB,sCAAsC;IACtC,6CAA6C;IAC7C,mEAAmE;IACnE,uEAAuE;IACvE,OAAO,CACN,GAAG,OAAO,MAAM;QAChB,6EAA6E;QAC7E,+EAA+E;QAC/E,mCAAmC,KAAK,OAAO;QAC/C,oEAAoE;QACpE,4EAA4E;QAC5E,gEAAgE;QAChE,4CAA4C;QAC5C,0BAA0B,CAC1B,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Transform: delete src/generated/
3
+ *
4
+ * The generated directory is 100% CLI-managed in v1. In v2 it is gone.
5
+ */
6
+ export declare function deleteGeneratedDir(generatedDir: string): void;
7
+ //# sourceMappingURL=generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../src/transforms/generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAE7D"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Transform: delete src/generated/
3
+ *
4
+ * The generated directory is 100% CLI-managed in v1. In v2 it is gone.
5
+ */
6
+ import { rmSync } from 'node:fs';
7
+ export function deleteGeneratedDir(generatedDir) {
8
+ rmSync(generatedDir, { recursive: true, force: true });
9
+ }
10
+ //# sourceMappingURL=generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/transforms/generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACtD,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Transform: v1 route files → v2 Hono chained style
3
+ *
4
+ * v1 pattern:
5
+ * import { createRouter } from '@agentuity/runtime';
6
+ * const router = createRouter();
7
+ * router.get('/foo', handler);
8
+ * router.post('/bar', handler);
9
+ * export default router;
10
+ *
11
+ * v2 pattern:
12
+ * import { Hono } from 'hono';
13
+ * import type { Env } from '@agentuity/runtime';
14
+ *
15
+ * const router = new Hono<Env>()
16
+ * .get('/foo', handler)
17
+ * .post('/bar', handler);
18
+ *
19
+ * export default router;
20
+ *
21
+ * WHY CHAINING MATTERS — Hono RPC type inference:
22
+ * Hono accumulates route types via TypeScript's return-type inference on
23
+ * each chained call. If you break the chain (e.g. `router.get(...)` on a
24
+ * separate statement after the variable declaration), the Schema type
25
+ * parameter never accumulates new routes and `typeof router` carries no
26
+ * route information. The chained style is the ONLY way to get the full
27
+ * AppRouter type used by `hc<AppRouter>()` on the frontend.
28
+ *
29
+ * Individual route files export a typed router; the barrel (src/api/index.ts)
30
+ * composes them with `.route()` and re-exports `AppRouter = typeof router`.
31
+ * Frontend code imports that type:
32
+ *
33
+ * import { hc } from 'hono/client';
34
+ * import type { AppRouter } from '../api'; // or wherever
35
+ * const client = hc<AppRouter>(window.location.origin + '/api');
36
+ * const res = await client.hello.$post({ json: { name: 'World' } });
37
+ *
38
+ * COMPLEXITY GUARD: if the file:
39
+ * • Has more than one createRouter() call
40
+ * • Uses variable re-assignment of the router variable
41
+ * …we refuse and return a complexityError.
42
+ */
43
+ export interface RouteTransformResult {
44
+ source: string | null;
45
+ complexityError?: string;
46
+ changes: string[];
47
+ }
48
+ export declare function transformRouteFile(source: string): RouteTransformResult;
49
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/transforms/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAQH,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAaD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CA8MvE"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Transform: v1 route files → v2 Hono chained style
3
+ *
4
+ * v1 pattern:
5
+ * import { createRouter } from '@agentuity/runtime';
6
+ * const router = createRouter();
7
+ * router.get('/foo', handler);
8
+ * router.post('/bar', handler);
9
+ * export default router;
10
+ *
11
+ * v2 pattern:
12
+ * import { Hono } from 'hono';
13
+ * import type { Env } from '@agentuity/runtime';
14
+ *
15
+ * const router = new Hono<Env>()
16
+ * .get('/foo', handler)
17
+ * .post('/bar', handler);
18
+ *
19
+ * export default router;
20
+ *
21
+ * WHY CHAINING MATTERS — Hono RPC type inference:
22
+ * Hono accumulates route types via TypeScript's return-type inference on
23
+ * each chained call. If you break the chain (e.g. `router.get(...)` on a
24
+ * separate statement after the variable declaration), the Schema type
25
+ * parameter never accumulates new routes and `typeof router` carries no
26
+ * route information. The chained style is the ONLY way to get the full
27
+ * AppRouter type used by `hc<AppRouter>()` on the frontend.
28
+ *
29
+ * Individual route files export a typed router; the barrel (src/api/index.ts)
30
+ * composes them with `.route()` and re-exports `AppRouter = typeof router`.
31
+ * Frontend code imports that type:
32
+ *
33
+ * import { hc } from 'hono/client';
34
+ * import type { AppRouter } from '../api'; // or wherever
35
+ * const client = hc<AppRouter>(window.location.origin + '/api');
36
+ * const res = await client.hello.$post({ json: { name: 'World' } });
37
+ *
38
+ * COMPLEXITY GUARD: if the file:
39
+ * • Has more than one createRouter() call
40
+ * • Uses variable re-assignment of the router variable
41
+ * …we refuse and return a complexityError.
42
+ */
43
+ import ts from 'typescript';
44
+ function capitalize(s) {
45
+ return s.charAt(0).toUpperCase() + s.slice(1);
46
+ }
47
+ // HTTP methods supported by Hono (chained)
48
+ const HTTP_METHODS = new Set(['get', 'post', 'put', 'patch', 'delete', 'all', 'route', 'use']);
49
+ export function transformRouteFile(source) {
50
+ const changes = [];
51
+ // ── Parse ──────────────────────────────────────────────────────────────
52
+ const sf = ts.createSourceFile('route.ts', source, ts.ScriptTarget.ESNext, true);
53
+ // ── Find createRouter() variable declaration ───────────────────────────
54
+ let routerVarName = null;
55
+ ts.forEachChild(sf, (node) => {
56
+ if (ts.isVariableStatement(node) ||
57
+ (ts.isVariableDeclarationList(node) && node.declarations)) {
58
+ const declList = ts.isVariableStatement(node)
59
+ ? node.declarationList.declarations
60
+ : node.declarations;
61
+ for (const decl of declList) {
62
+ if (decl.initializer &&
63
+ ts.isCallExpression(decl.initializer) &&
64
+ ts.isIdentifier(decl.initializer.expression) &&
65
+ decl.initializer.expression.text === 'createRouter' &&
66
+ ts.isIdentifier(decl.name)) {
67
+ if (routerVarName !== null) {
68
+ return; // multiple createRouter calls
69
+ }
70
+ routerVarName = decl.name.text;
71
+ }
72
+ }
73
+ }
74
+ });
75
+ if (!routerVarName) {
76
+ // Not a v1 route file — nothing to do
77
+ return { source, changes: [] };
78
+ }
79
+ // ── Complexity checks ─────────────────────────────────────────────────
80
+ // Count how many times createRouter() is called
81
+ let createRouterCount = 0;
82
+ (source.match(/createRouter\s*\(/g) ?? []).forEach(() => createRouterCount++);
83
+ if (createRouterCount > 1) {
84
+ return {
85
+ source: null,
86
+ complexityError: `Route file calls createRouter() ${createRouterCount} times. ` +
87
+ `Only a single top-level router variable is supported by the auto-migration.`,
88
+ changes: [],
89
+ };
90
+ }
91
+ // Check for re-assignment (after declaration)
92
+ // The initial `const router = createRouter()` is one match; any additional = re-assignment
93
+ const reassignPattern = new RegExp(`\\b${routerVarName}\\s*=(?!=)`, 'g');
94
+ const reassignMatches = source.match(reassignPattern) ?? [];
95
+ if (reassignMatches.length > 1) {
96
+ return {
97
+ source: null,
98
+ complexityError: `Router variable '${routerVarName}' appears to be re-assigned. ` +
99
+ `This pattern cannot be automatically migrated.`,
100
+ changes: [],
101
+ };
102
+ }
103
+ // ── Collect router.<method>(...) calls ────────────────────────────────
104
+ const routerCalls = [];
105
+ ts.forEachChild(sf, (node) => {
106
+ if (!ts.isExpressionStatement(node))
107
+ return;
108
+ const expr = node.expression;
109
+ if (!ts.isCallExpression(expr))
110
+ return;
111
+ if (!ts.isPropertyAccessExpression(expr.expression))
112
+ return;
113
+ const obj = expr.expression.expression;
114
+ const method = expr.expression.name.text;
115
+ if (!ts.isIdentifier(obj) || obj.text !== routerVarName)
116
+ return;
117
+ if (!HTTP_METHODS.has(method))
118
+ return;
119
+ const argsText = expr.arguments.map((a) => a.getText(sf)).join(', ');
120
+ const statementText = node.getText(sf);
121
+ routerCalls.push({ method, statementText, argsText });
122
+ });
123
+ if (routerCalls.length === 0) {
124
+ // createRouter() declared but no method calls — still rewrite the declaration
125
+ }
126
+ // ── Build replacement source ──────────────────────────────────────────
127
+ // 1. Replace `import { createRouter ... } from '@agentuity/runtime'` with
128
+ // `import { Hono } from 'hono';` + `import type { Env } from '@agentuity/runtime';`
129
+ let out = source;
130
+ // Remove createRouter from the @agentuity/runtime import
131
+ out = out.replace(/import\s*\{([^}]*)\}\s*from\s*['"]@agentuity\/runtime['"]\s*;?/g, (_match, bindings) => {
132
+ const parts = bindings
133
+ .split(',')
134
+ .map((s) => s.trim())
135
+ .filter(Boolean);
136
+ const withoutCreateRouter = parts.filter((p) => p !== 'createRouter');
137
+ const runtimeParts = withoutCreateRouter.filter((p) => !p.startsWith('type '));
138
+ const typeParts = withoutCreateRouter
139
+ .filter((p) => p.startsWith('type '))
140
+ .map((p) => p.slice('type '.length).trim());
141
+ // Always add `Env` to the type imports from @agentuity/runtime
142
+ if (!typeParts.includes('Env'))
143
+ typeParts.push('Env');
144
+ const lines = [];
145
+ if (runtimeParts.length > 0) {
146
+ lines.push(`import { ${runtimeParts.join(', ')} } from '@agentuity/runtime';`);
147
+ }
148
+ if (typeParts.length > 0) {
149
+ lines.push(`import type { ${typeParts.join(', ')} } from '@agentuity/runtime';`);
150
+ }
151
+ return lines.join('\n');
152
+ });
153
+ // Add `import { Hono } from 'hono';` if not already present
154
+ if (!out.includes("from 'hono'") && !out.includes('from "hono"')) {
155
+ // Insert after the last import statement
156
+ out = out.replace(/^(import\s[^;]+;?\s*\n)(?!import\s)/m, (match) => `import { Hono } from 'hono';\n${match}`);
157
+ }
158
+ else {
159
+ // Ensure Hono is in the existing hono import
160
+ out = out.replace(/import\s*\{([^}]*)\}\s*from\s*['"]hono['"]\s*;?/, (_match, bindings) => {
161
+ const parts = bindings
162
+ .split(',')
163
+ .map((s) => s.trim())
164
+ .filter(Boolean);
165
+ if (!parts.includes('Hono')) {
166
+ parts.unshift('Hono');
167
+ }
168
+ return `import { ${parts.join(', ')} } from 'hono';`;
169
+ });
170
+ }
171
+ // 2. Replace `const router = createRouter();` with `const router = new Hono<Env>()`
172
+ // and fold the method calls into a chain.
173
+ const chainedCalls = routerCalls
174
+ .map(({ method, argsText }) => `\t.${method}(${argsText})`)
175
+ .join('\n');
176
+ const varDecl = `const ${routerVarName} = createRouter();`;
177
+ if (routerCalls.length > 0) {
178
+ const replacement = `const ${routerVarName} = new Hono<Env>()\n${chainedCalls};`;
179
+ // Remove individual router.<method>(...) statements
180
+ let modified = out;
181
+ for (const { statementText } of routerCalls) {
182
+ // Use a literal string replacement (not regex) to avoid special char issues
183
+ modified = modified.split(statementText).join('');
184
+ }
185
+ // Replace the createRouter() declaration
186
+ modified = modified.split(varDecl).join(replacement);
187
+ // Collapse extra blank lines
188
+ modified = modified.replace(/\n{3,}/g, '\n\n');
189
+ out = modified;
190
+ changes.push(`Rewrote createRouter() declaration + ${routerCalls.length} method call(s) to chained Hono<Env>`);
191
+ }
192
+ else {
193
+ // No method calls — just swap the declaration
194
+ out = out.split(varDecl).join(`const ${routerVarName} = new Hono<Env>();`);
195
+ changes.push('Rewrote createRouter() declaration to new Hono<Env>()');
196
+ }
197
+ // Add `export type` for the router if not already exported.
198
+ // This lets the barrel (src/api/index.ts) compose routers in a
199
+ // fully-typed way, and downstream consumers can reference sub-router types.
200
+ const exportDefaultPattern = new RegExp(`export\\s+default\\s+${routerVarName}\\s*;?`);
201
+ if (exportDefaultPattern.test(out) && !out.includes(`export type`)) {
202
+ out = out.replace(exportDefaultPattern, `export type ${capitalize(routerVarName)}Type = typeof ${routerVarName};\n\nexport default ${routerVarName};`);
203
+ changes.push(`Added 'export type ${capitalize(routerVarName)}Type' for Hono RPC sub-router typing`);
204
+ }
205
+ changes.push("Updated imports: added 'hono' import, replaced createRouter with Env type");
206
+ return { source: out, changes };
207
+ }
208
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/transforms/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAQD,2CAA2C;AAC3C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAU/F,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAChD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,0EAA0E;IAC1E,MAAM,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEjF,0EAA0E;IAC1E,IAAI,aAAa,GAAkB,IAAI,CAAC;IAExC,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,E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AAC,uDAAuD,CAAC,CAAC;IACvE,CAAC;IAED,4DAA4D;IAC5D,+DAA+D;IAC/D,4EAA4E;IAC5E,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,wBAAwB,aAAa,QAAQ,CAAC,CAAC;IACvF,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACpE,GAAG,GAAG,GAAG,CAAC,OAAO,CAChB,oBAAoB,EACpB,eAAe,UAAU,CAAC,aAAa,CAAC,iBAAiB,aAAa,uBAAuB,aAAa,GAAG,CAC7G,CAAC;QACF,OAAO,CAAC,IAAI,CACX,sBAAsB,UAAU,CAAC,aAAa,CAAC,sCAAsC,CACrF,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IAE1F,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@agentuity/migrate",
3
+ "version": "2.0.0-beta.1",
4
+ "description": "Migration tool from Agentuity SDK v1 to v2",
5
+ "license": "Apache-2.0",
6
+ "author": "Agentuity employees and contributors",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "bin": {
11
+ "agentuity-migrate": "./bin/migrate.ts"
12
+ },
13
+ "files": [
14
+ "README.md",
15
+ "src",
16
+ "dist",
17
+ "bin"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.js",
22
+ "types": "./dist/index.d.ts"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
27
+ "build": "bunx tsc --build --force",
28
+ "typecheck": "bunx tsc --noEmit",
29
+ "test": "bun test",
30
+ "prepublishOnly": "bun run clean && bun run build"
31
+ },
32
+ "dependencies": {
33
+ "@agentuity/core": "2.0.0-beta.1",
34
+ "typescript": "^5.9.0"
35
+ },
36
+ "devDependencies": {
37
+ "@agentuity/test-utils": "2.0.0-beta.1",
38
+ "@types/bun": "latest",
39
+ "bun-types": "latest"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "sideEffects": false
45
+ }