@stackweld/core 0.2.0
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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-lint.log +498 -0
- package/.turbo/turbo-test.log +21 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/dist/__tests__/compatibility-scorer.test.d.ts +2 -0
- package/dist/__tests__/compatibility-scorer.test.d.ts.map +1 -0
- package/dist/__tests__/compatibility-scorer.test.js +226 -0
- package/dist/__tests__/compatibility-scorer.test.js.map +1 -0
- package/dist/__tests__/rules-engine.test.d.ts +2 -0
- package/dist/__tests__/rules-engine.test.d.ts.map +1 -0
- package/dist/__tests__/rules-engine.test.js +161 -0
- package/dist/__tests__/rules-engine.test.js.map +1 -0
- package/dist/__tests__/scaffold-orchestrator.test.d.ts +2 -0
- package/dist/__tests__/scaffold-orchestrator.test.d.ts.map +1 -0
- package/dist/__tests__/scaffold-orchestrator.test.js +149 -0
- package/dist/__tests__/scaffold-orchestrator.test.js.map +1 -0
- package/dist/__tests__/stack-engine.test.d.ts +2 -0
- package/dist/__tests__/stack-engine.test.d.ts.map +1 -0
- package/dist/__tests__/stack-engine.test.js +278 -0
- package/dist/__tests__/stack-engine.test.js.map +1 -0
- package/dist/db/database.d.ts +9 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/database.js +106 -0
- package/dist/db/database.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +2 -0
- package/dist/db/index.js.map +1 -0
- package/dist/engine/compatibility-scorer.d.ts +37 -0
- package/dist/engine/compatibility-scorer.d.ts.map +1 -0
- package/dist/engine/compatibility-scorer.js +178 -0
- package/dist/engine/compatibility-scorer.js.map +1 -0
- package/dist/engine/compose-generator.d.ts +35 -0
- package/dist/engine/compose-generator.d.ts.map +1 -0
- package/dist/engine/compose-generator.js +95 -0
- package/dist/engine/compose-generator.js.map +1 -0
- package/dist/engine/cost-estimator.d.ts +22 -0
- package/dist/engine/cost-estimator.d.ts.map +1 -0
- package/dist/engine/cost-estimator.js +451 -0
- package/dist/engine/cost-estimator.js.map +1 -0
- package/dist/engine/env-analyzer.d.ts +36 -0
- package/dist/engine/env-analyzer.d.ts.map +1 -0
- package/dist/engine/env-analyzer.js +111 -0
- package/dist/engine/env-analyzer.js.map +1 -0
- package/dist/engine/health-checker.d.ts +20 -0
- package/dist/engine/health-checker.d.ts.map +1 -0
- package/dist/engine/health-checker.js +377 -0
- package/dist/engine/health-checker.js.map +1 -0
- package/dist/engine/index.d.ts +11 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +7 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/infra-generator.d.ts +26 -0
- package/dist/engine/infra-generator.d.ts.map +1 -0
- package/dist/engine/infra-generator.js +751 -0
- package/dist/engine/infra-generator.js.map +1 -0
- package/dist/engine/migration-planner.d.ts +34 -0
- package/dist/engine/migration-planner.d.ts.map +1 -0
- package/dist/engine/migration-planner.js +427 -0
- package/dist/engine/migration-planner.js.map +1 -0
- package/dist/engine/performance-profiler.d.ts +22 -0
- package/dist/engine/performance-profiler.d.ts.map +1 -0
- package/dist/engine/performance-profiler.js +292 -0
- package/dist/engine/performance-profiler.js.map +1 -0
- package/dist/engine/plugin-loader.d.ts +36 -0
- package/dist/engine/plugin-loader.d.ts.map +1 -0
- package/dist/engine/plugin-loader.js +157 -0
- package/dist/engine/plugin-loader.js.map +1 -0
- package/dist/engine/preferences.d.ts +24 -0
- package/dist/engine/preferences.d.ts.map +1 -0
- package/dist/engine/preferences.js +62 -0
- package/dist/engine/preferences.js.map +1 -0
- package/dist/engine/rules-engine.d.ts +31 -0
- package/dist/engine/rules-engine.d.ts.map +1 -0
- package/dist/engine/rules-engine.js +179 -0
- package/dist/engine/rules-engine.js.map +1 -0
- package/dist/engine/runtime-manager.d.ts +65 -0
- package/dist/engine/runtime-manager.d.ts.map +1 -0
- package/dist/engine/runtime-manager.js +181 -0
- package/dist/engine/runtime-manager.js.map +1 -0
- package/dist/engine/scaffold-orchestrator.d.ts +103 -0
- package/dist/engine/scaffold-orchestrator.d.ts.map +1 -0
- package/dist/engine/scaffold-orchestrator.js +934 -0
- package/dist/engine/scaffold-orchestrator.js.map +1 -0
- package/dist/engine/stack-detector.d.ts +21 -0
- package/dist/engine/stack-detector.d.ts.map +1 -0
- package/dist/engine/stack-detector.js +313 -0
- package/dist/engine/stack-detector.js.map +1 -0
- package/dist/engine/stack-differ.d.ts +26 -0
- package/dist/engine/stack-differ.d.ts.map +1 -0
- package/dist/engine/stack-differ.js +80 -0
- package/dist/engine/stack-differ.js.map +1 -0
- package/dist/engine/stack-engine.d.ts +54 -0
- package/dist/engine/stack-engine.d.ts.map +1 -0
- package/dist/engine/stack-engine.js +186 -0
- package/dist/engine/stack-engine.js.map +1 -0
- package/dist/engine/stack-serializer.d.ts +32 -0
- package/dist/engine/stack-serializer.d.ts.map +1 -0
- package/dist/engine/stack-serializer.js +75 -0
- package/dist/engine/stack-serializer.js.map +1 -0
- package/dist/engine/standards-linter.d.ts +34 -0
- package/dist/engine/standards-linter.d.ts.map +1 -0
- package/dist/engine/standards-linter.js +162 -0
- package/dist/engine/standards-linter.js.map +1 -0
- package/dist/engine/tech-installer.d.ts +37 -0
- package/dist/engine/tech-installer.d.ts.map +1 -0
- package/dist/engine/tech-installer.js +508 -0
- package/dist/engine/tech-installer.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/project.d.ts +33 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +6 -0
- package/dist/types/project.js.map +1 -0
- package/dist/types/stack.d.ts +29 -0
- package/dist/types/stack.d.ts.map +1 -0
- package/dist/types/stack.js +6 -0
- package/dist/types/stack.js.map +1 -0
- package/dist/types/technology.d.ts +47 -0
- package/dist/types/technology.d.ts.map +1 -0
- package/dist/types/technology.js +6 -0
- package/dist/types/technology.js.map +1 -0
- package/dist/types/template.d.ts +34 -0
- package/dist/types/template.d.ts.map +1 -0
- package/dist/types/template.js +6 -0
- package/dist/types/template.js.map +1 -0
- package/dist/types/validation.d.ts +20 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +5 -0
- package/dist/types/validation.js.map +1 -0
- package/package.json +39 -0
- package/src/__tests__/compatibility-scorer.test.ts +264 -0
- package/src/__tests__/rules-engine.test.ts +170 -0
- package/src/__tests__/scaffold-orchestrator.test.ts +161 -0
- package/src/__tests__/stack-engine.test.ts +328 -0
- package/src/db/database.ts +112 -0
- package/src/db/index.ts +1 -0
- package/src/engine/compatibility-scorer.ts +222 -0
- package/src/engine/compose-generator.ts +134 -0
- package/src/engine/cost-estimator.ts +498 -0
- package/src/engine/env-analyzer.ts +156 -0
- package/src/engine/health-checker.ts +421 -0
- package/src/engine/index.ts +17 -0
- package/src/engine/infra-generator.ts +837 -0
- package/src/engine/migration-planner.ts +496 -0
- package/src/engine/performance-profiler.ts +354 -0
- package/src/engine/plugin-loader.ts +216 -0
- package/src/engine/preferences.ts +85 -0
- package/src/engine/rules-engine.ts +204 -0
- package/src/engine/runtime-manager.ts +207 -0
- package/src/engine/scaffold-orchestrator.ts +1052 -0
- package/src/engine/stack-detector.ts +345 -0
- package/src/engine/stack-differ.ts +118 -0
- package/src/engine/stack-engine.ts +258 -0
- package/src/engine/stack-serializer.ts +95 -0
- package/src/engine/standards-linter.ts +210 -0
- package/src/engine/tech-installer.ts +650 -0
- package/src/index.ts +78 -0
- package/src/types/index.ts +10 -0
- package/src/types/project.ts +36 -0
- package/src/types/stack.ts +32 -0
- package/src/types/technology.ts +58 -0
- package/src/types/template.ts +37 -0
- package/src/types/validation.ts +22 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration Planner — Generates step-by-step migration plans between technologies.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Technology } from "../types/technology.js";
|
|
6
|
+
|
|
7
|
+
export interface MigrationStep {
|
|
8
|
+
order: number;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
commands?: string[];
|
|
12
|
+
files?: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MigrationPlan {
|
|
16
|
+
from: { id: string; name: string };
|
|
17
|
+
to: { id: string; name: string };
|
|
18
|
+
steps: MigrationStep[];
|
|
19
|
+
difficulty: "easy" | "moderate" | "hard" | "expert";
|
|
20
|
+
estimatedTime: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ─── Migration Knowledge Base ──────────────────────────
|
|
24
|
+
|
|
25
|
+
interface MigrationKnowledge {
|
|
26
|
+
difficulty: MigrationPlan["difficulty"];
|
|
27
|
+
estimatedTime: string;
|
|
28
|
+
steps: Omit<MigrationStep, "order">[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const MIGRATION_KNOWLEDGE: Record<string, MigrationKnowledge> = {
|
|
32
|
+
"express->fastify": {
|
|
33
|
+
difficulty: "moderate",
|
|
34
|
+
estimatedTime: "4-8 hours",
|
|
35
|
+
steps: [
|
|
36
|
+
{
|
|
37
|
+
title: "Install Fastify",
|
|
38
|
+
description: "Install Fastify and its ecosystem plugins.",
|
|
39
|
+
commands: [
|
|
40
|
+
"npm install fastify @fastify/cors @fastify/helmet @fastify/sensible",
|
|
41
|
+
"npm uninstall express cors helmet",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "Update Server Entry",
|
|
46
|
+
description:
|
|
47
|
+
"Rewrite the Express app initialization to use Fastify's createServer pattern. Replace app.listen() with fastify.listen().",
|
|
48
|
+
files: ["src/server.ts", "src/app.ts", "src/index.ts"],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: "Convert Route Handlers",
|
|
52
|
+
description:
|
|
53
|
+
"Replace Express (req, res, next) handlers with Fastify's (request, reply) pattern. Add JSON schema validation for request/response.",
|
|
54
|
+
files: ["src/routes/*.ts"],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "Update Middleware",
|
|
58
|
+
description:
|
|
59
|
+
"Replace Express middleware with Fastify plugins. Use fastify.register() instead of app.use().",
|
|
60
|
+
files: ["src/middleware/*.ts", "src/plugins/*.ts"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: "Update Error Handling",
|
|
64
|
+
description:
|
|
65
|
+
"Replace Express error middleware with Fastify's setErrorHandler() and setNotFoundHandler().",
|
|
66
|
+
files: ["src/errors.ts"],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "Run Tests",
|
|
70
|
+
description: "Execute the test suite and fix any failures caused by the migration.",
|
|
71
|
+
commands: ["npm test"],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"express->nestjs": {
|
|
77
|
+
difficulty: "hard",
|
|
78
|
+
estimatedTime: "1-3 days",
|
|
79
|
+
steps: [
|
|
80
|
+
{
|
|
81
|
+
title: "Install NestJS",
|
|
82
|
+
description: "Install the NestJS CLI and core packages.",
|
|
83
|
+
commands: [
|
|
84
|
+
"npm install -g @nestjs/cli",
|
|
85
|
+
"npm install @nestjs/common @nestjs/core @nestjs/platform-express reflect-metadata rxjs",
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: "Set Up Module Structure",
|
|
90
|
+
description:
|
|
91
|
+
"Create the root AppModule and restructure the project into NestJS modules. Each feature area becomes a module with its own controller and service.",
|
|
92
|
+
files: ["src/app.module.ts", "src/main.ts"],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
title: "Convert Routes to Controllers",
|
|
96
|
+
description:
|
|
97
|
+
"Replace Express route handlers with NestJS controllers using decorators (@Get, @Post, etc.).",
|
|
98
|
+
files: ["src/*/*.controller.ts"],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: "Extract Business Logic to Services",
|
|
102
|
+
description:
|
|
103
|
+
"Move business logic from route handlers into injectable service classes. Use NestJS dependency injection.",
|
|
104
|
+
files: ["src/*/*.service.ts"],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: "Convert Middleware",
|
|
108
|
+
description:
|
|
109
|
+
"Replace Express middleware with NestJS guards, interceptors, and pipes as appropriate.",
|
|
110
|
+
files: ["src/common/*.ts"],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: "Update Configuration",
|
|
114
|
+
description:
|
|
115
|
+
"Use @nestjs/config for environment variables. Replace any custom config loading.",
|
|
116
|
+
commands: ["npm install @nestjs/config"],
|
|
117
|
+
files: ["src/config/*.ts"],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: "Run Tests",
|
|
121
|
+
description: "Update test setup for NestJS testing utilities and verify all tests pass.",
|
|
122
|
+
commands: ["npm test"],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
"django->fastapi": {
|
|
128
|
+
difficulty: "hard",
|
|
129
|
+
estimatedTime: "2-5 days",
|
|
130
|
+
steps: [
|
|
131
|
+
{
|
|
132
|
+
title: "Install FastAPI",
|
|
133
|
+
description: "Install FastAPI, Uvicorn, and supporting libraries.",
|
|
134
|
+
commands: ["pip install fastapi uvicorn[standard] pydantic sqlalchemy alembic"],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: "Create FastAPI App Entry",
|
|
138
|
+
description:
|
|
139
|
+
"Create the main FastAPI application file with CORS, middleware, and router includes.",
|
|
140
|
+
files: ["app/main.py"],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: "Convert Models",
|
|
144
|
+
description:
|
|
145
|
+
"Rewrite Django ORM models as SQLAlchemy models. Create Pydantic schemas for request/response validation.",
|
|
146
|
+
files: ["app/models/*.py", "app/schemas/*.py"],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title: "Rewrite Views as Endpoints",
|
|
150
|
+
description:
|
|
151
|
+
"Convert Django views/viewsets to FastAPI async route functions. Replace DRF serializers with Pydantic models.",
|
|
152
|
+
files: ["app/routers/*.py"],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: "Update Authentication",
|
|
156
|
+
description:
|
|
157
|
+
"Replace Django auth with FastAPI security utilities (OAuth2, JWT). Implement dependency injection for auth.",
|
|
158
|
+
files: ["app/auth.py", "app/dependencies.py"],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
title: "Migrate Database Setup",
|
|
162
|
+
description:
|
|
163
|
+
"Replace Django migrations with Alembic. Set up SQLAlchemy session management.",
|
|
164
|
+
commands: ["alembic init alembic", "alembic revision --autogenerate -m 'initial'"],
|
|
165
|
+
files: ["alembic.ini", "alembic/env.py"],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
title: "Run Tests",
|
|
169
|
+
description: "Rewrite tests using httpx.AsyncClient and pytest-asyncio.",
|
|
170
|
+
commands: ["pip install httpx pytest-asyncio", "pytest"],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
"flask->fastapi": {
|
|
176
|
+
difficulty: "moderate",
|
|
177
|
+
estimatedTime: "4-8 hours",
|
|
178
|
+
steps: [
|
|
179
|
+
{
|
|
180
|
+
title: "Install FastAPI",
|
|
181
|
+
description: "Install FastAPI and Uvicorn.",
|
|
182
|
+
commands: ["pip install fastapi uvicorn[standard] pydantic", "pip uninstall flask"],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: "Create FastAPI App",
|
|
186
|
+
description: "Replace Flask() with FastAPI(). Update the application entry point.",
|
|
187
|
+
files: ["app/main.py", "app/__init__.py"],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
title: "Convert Routes",
|
|
191
|
+
description:
|
|
192
|
+
"Replace @app.route() decorators with @app.get()/@app.post() etc. Add type hints and Pydantic models for request validation.",
|
|
193
|
+
files: ["app/routes/*.py"],
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
title: "Make Endpoints Async",
|
|
197
|
+
description:
|
|
198
|
+
"Convert synchronous route functions to async where beneficial. Update database calls accordingly.",
|
|
199
|
+
files: ["app/routes/*.py"],
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
title: "Update Extensions",
|
|
203
|
+
description:
|
|
204
|
+
"Replace Flask extensions (Flask-CORS, Flask-SQLAlchemy) with FastAPI equivalents or middleware.",
|
|
205
|
+
files: ["app/extensions.py", "app/config.py"],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
title: "Run Tests",
|
|
209
|
+
description: "Update test client from Flask's test_client to httpx.AsyncClient.",
|
|
210
|
+
commands: ["pip install httpx pytest-asyncio", "pytest"],
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
"react->vue": {
|
|
216
|
+
difficulty: "hard",
|
|
217
|
+
estimatedTime: "1-3 days",
|
|
218
|
+
steps: [
|
|
219
|
+
{
|
|
220
|
+
title: "Install Vue",
|
|
221
|
+
description: "Install Vue 3 and its ecosystem.",
|
|
222
|
+
commands: [
|
|
223
|
+
"npm install vue @vitejs/plugin-vue",
|
|
224
|
+
"npm uninstall react react-dom @types/react @types/react-dom",
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
title: "Update Build Config",
|
|
229
|
+
description: "Replace React-specific Vite/webpack config with Vue plugin configuration.",
|
|
230
|
+
files: ["vite.config.ts", "tsconfig.json"],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
title: "Convert Components",
|
|
234
|
+
description:
|
|
235
|
+
"Rewrite JSX/TSX components as Vue Single File Components (.vue). Replace props/state with Vue's defineProps/ref/reactive.",
|
|
236
|
+
files: ["src/components/*.vue"],
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
title: "Replace Hooks with Composition API",
|
|
240
|
+
description:
|
|
241
|
+
"Convert React hooks (useState, useEffect, useMemo) to Vue Composition API (ref, watch, computed).",
|
|
242
|
+
files: ["src/composables/*.ts"],
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
title: "Update Routing",
|
|
246
|
+
description:
|
|
247
|
+
"Replace react-router with vue-router. Update route definitions and navigation guards.",
|
|
248
|
+
commands: ["npm install vue-router@4", "npm uninstall react-router-dom"],
|
|
249
|
+
files: ["src/router/index.ts"],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
title: "Update State Management",
|
|
253
|
+
description: "Replace Redux/Zustand with Pinia for global state management.",
|
|
254
|
+
commands: ["npm install pinia"],
|
|
255
|
+
files: ["src/stores/*.ts"],
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
title: "Run Tests",
|
|
259
|
+
description: "Update test setup for Vue Test Utils.",
|
|
260
|
+
commands: ["npm install @vue/test-utils", "npm test"],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
"jest->vitest": {
|
|
266
|
+
difficulty: "easy",
|
|
267
|
+
estimatedTime: "1-2 hours",
|
|
268
|
+
steps: [
|
|
269
|
+
{
|
|
270
|
+
title: "Install Vitest",
|
|
271
|
+
description: "Install Vitest and remove Jest.",
|
|
272
|
+
commands: [
|
|
273
|
+
"npm install -D vitest @vitest/coverage-v8",
|
|
274
|
+
"npm uninstall jest ts-jest @types/jest babel-jest",
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
title: "Create Vitest Config",
|
|
279
|
+
description:
|
|
280
|
+
"Create vitest.config.ts or add test config to vite.config.ts. Migrate Jest config options.",
|
|
281
|
+
files: ["vitest.config.ts", "vite.config.ts"],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
title: "Update Test Globals",
|
|
285
|
+
description:
|
|
286
|
+
"Replace jest.fn() with vi.fn(), jest.mock() with vi.mock(), jest.spyOn() with vi.spyOn(). Enable globals in config or add imports.",
|
|
287
|
+
files: ["src/**/*.test.ts", "src/**/*.spec.ts"],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
title: "Update package.json Scripts",
|
|
291
|
+
description: "Replace 'jest' with 'vitest' in test scripts.",
|
|
292
|
+
files: ["package.json"],
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
title: "Run Tests",
|
|
296
|
+
description: "Verify all tests pass with Vitest.",
|
|
297
|
+
commands: ["npx vitest run"],
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
"prisma->drizzle": {
|
|
303
|
+
difficulty: "moderate",
|
|
304
|
+
estimatedTime: "4-8 hours",
|
|
305
|
+
steps: [
|
|
306
|
+
{
|
|
307
|
+
title: "Install Drizzle",
|
|
308
|
+
description: "Install Drizzle ORM and its kit.",
|
|
309
|
+
commands: [
|
|
310
|
+
"npm install drizzle-orm",
|
|
311
|
+
"npm install -D drizzle-kit",
|
|
312
|
+
"npm uninstall prisma @prisma/client",
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
title: "Convert Schema",
|
|
317
|
+
description:
|
|
318
|
+
"Rewrite Prisma schema (.prisma) as Drizzle TypeScript schema definitions using table() and column helpers.",
|
|
319
|
+
files: ["src/db/schema.ts"],
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
title: "Set Up Database Client",
|
|
323
|
+
description:
|
|
324
|
+
"Create the Drizzle database client instance. Replace PrismaClient initialization.",
|
|
325
|
+
files: ["src/db/index.ts", "src/db/client.ts"],
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
title: "Update Queries",
|
|
329
|
+
description:
|
|
330
|
+
"Rewrite Prisma queries (findMany, create, update, delete) to Drizzle's SQL-like builder pattern (select, insert, update, delete).",
|
|
331
|
+
files: ["src/**/*.ts"],
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
title: "Update Migrations",
|
|
335
|
+
description: "Generate Drizzle migrations from the new schema.",
|
|
336
|
+
commands: ["npx drizzle-kit generate", "npx drizzle-kit migrate"],
|
|
337
|
+
files: ["drizzle.config.ts"],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
title: "Run Tests",
|
|
341
|
+
description: "Verify all database operations work correctly.",
|
|
342
|
+
commands: ["npm test"],
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
"npm->pnpm": {
|
|
348
|
+
difficulty: "easy",
|
|
349
|
+
estimatedTime: "30 minutes",
|
|
350
|
+
steps: [
|
|
351
|
+
{
|
|
352
|
+
title: "Install pnpm",
|
|
353
|
+
description: "Install pnpm globally if not already available.",
|
|
354
|
+
commands: ["npm install -g pnpm"],
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
title: "Remove npm Artifacts",
|
|
358
|
+
description: "Delete node_modules and package-lock.json.",
|
|
359
|
+
commands: ["rm -rf node_modules", "rm -f package-lock.json"],
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
title: "Install with pnpm",
|
|
363
|
+
description: "Run pnpm install to generate pnpm-lock.yaml and a new node_modules.",
|
|
364
|
+
commands: ["pnpm install"],
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
title: "Update Scripts and CI",
|
|
368
|
+
description: "Replace 'npm run' with 'pnpm' in scripts, CI configs, and documentation.",
|
|
369
|
+
files: ["package.json", ".github/workflows/*.yml", "Dockerfile"],
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
title: "Verify",
|
|
373
|
+
description: "Run the project to ensure everything works with pnpm.",
|
|
374
|
+
commands: ["pnpm build", "pnpm test"],
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
"javascript->typescript": {
|
|
380
|
+
difficulty: "moderate",
|
|
381
|
+
estimatedTime: "2-8 hours",
|
|
382
|
+
steps: [
|
|
383
|
+
{
|
|
384
|
+
title: "Install TypeScript",
|
|
385
|
+
description: "Install TypeScript and type definitions for your dependencies.",
|
|
386
|
+
commands: ["npm install -D typescript @types/node"],
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
title: "Create tsconfig.json",
|
|
390
|
+
description:
|
|
391
|
+
"Initialize TypeScript configuration with appropriate settings (strict mode recommended).",
|
|
392
|
+
commands: ["npx tsc --init"],
|
|
393
|
+
files: ["tsconfig.json"],
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
title: "Rename Files",
|
|
397
|
+
description:
|
|
398
|
+
"Rename .js files to .ts (and .jsx to .tsx). Start with entry points and work outward.",
|
|
399
|
+
files: ["src/**/*.ts"],
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
title: "Add Type Annotations",
|
|
403
|
+
description:
|
|
404
|
+
"Add type annotations to function parameters, return types, and variables. Create interfaces for data structures.",
|
|
405
|
+
files: ["src/**/*.ts"],
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
title: "Fix Type Errors",
|
|
409
|
+
description:
|
|
410
|
+
"Run the TypeScript compiler and fix all type errors. Use 'any' sparingly as a last resort.",
|
|
411
|
+
commands: ["npx tsc --noEmit"],
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
title: "Update Build Scripts",
|
|
415
|
+
description: "Update package.json scripts to compile TypeScript before running.",
|
|
416
|
+
files: ["package.json"],
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
title: "Run Tests",
|
|
420
|
+
description: "Ensure all tests pass with the TypeScript setup.",
|
|
421
|
+
commands: ["npm test"],
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
},
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// ─── Planner ───────────────────────────────────────────
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Generate a migration plan between two technologies.
|
|
431
|
+
* Uses known migration paths when available, otherwise generates generic steps.
|
|
432
|
+
*/
|
|
433
|
+
export function planMigration(fromId: string, toId: string, techs: Technology[]): MigrationPlan {
|
|
434
|
+
const fromTech = techs.find((t) => t.id === fromId);
|
|
435
|
+
const toTech = techs.find((t) => t.id === toId);
|
|
436
|
+
|
|
437
|
+
const fromName = fromTech?.name ?? fromId;
|
|
438
|
+
const toName = toTech?.name ?? toId;
|
|
439
|
+
|
|
440
|
+
const key = `${fromId}->${toId}`;
|
|
441
|
+
const knowledge = MIGRATION_KNOWLEDGE[key];
|
|
442
|
+
|
|
443
|
+
if (knowledge) {
|
|
444
|
+
return {
|
|
445
|
+
from: { id: fromId, name: fromName },
|
|
446
|
+
to: { id: toId, name: toName },
|
|
447
|
+
steps: knowledge.steps.map((s, i) => ({ ...s, order: i + 1 })),
|
|
448
|
+
difficulty: knowledge.difficulty,
|
|
449
|
+
estimatedTime: knowledge.estimatedTime,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Generic migration plan for unknown pairs
|
|
454
|
+
return {
|
|
455
|
+
from: { id: fromId, name: fromName },
|
|
456
|
+
to: { id: toId, name: toName },
|
|
457
|
+
difficulty: "moderate",
|
|
458
|
+
estimatedTime: "varies",
|
|
459
|
+
steps: [
|
|
460
|
+
{
|
|
461
|
+
order: 1,
|
|
462
|
+
title: `Install ${toName}`,
|
|
463
|
+
description: `Install ${toName} and its required dependencies.`,
|
|
464
|
+
commands: toTech?.officialScaffold ? [toTech.officialScaffold] : undefined,
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
order: 2,
|
|
468
|
+
title: `Uninstall ${fromName}`,
|
|
469
|
+
description: `Remove ${fromName} and its specific dependencies that are no longer needed.`,
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
order: 3,
|
|
473
|
+
title: "Update Imports and Configuration",
|
|
474
|
+
description: `Update all import statements and configuration files to use ${toName} APIs instead of ${fromName}.`,
|
|
475
|
+
files: toTech?.configFiles ?? undefined,
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
order: 4,
|
|
479
|
+
title: "Rewrite Integration Code",
|
|
480
|
+
description: `Rewrite code that uses ${fromName}-specific APIs to use ${toName} equivalents.`,
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
order: 5,
|
|
484
|
+
title: "Update Environment Variables",
|
|
485
|
+
description: "Review and update environment variables for the new technology.",
|
|
486
|
+
files: [".env", ".env.example"],
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
order: 6,
|
|
490
|
+
title: "Run Tests",
|
|
491
|
+
description: "Execute the full test suite and fix any failures.",
|
|
492
|
+
commands: ["npm test"],
|
|
493
|
+
},
|
|
494
|
+
],
|
|
495
|
+
};
|
|
496
|
+
}
|