📦 Codebase Migration Planner — Codebase 迁移 Planner
v1.0.0Plan complex codebase 迁移s — 框架 升级s, language transitions, architecture refactors. Analyze dependencies, estimate effort, map 迁移 pat...
详细分析 ▾
运行时依赖
版本
Complex files (>300 LOC) 2x multiplier Need careful 迁移
安装命令
点击复制技能文档
Codebase 迁移 Planner
Plan and 执行 large-扩展 codebase 迁移s 系统atically. Whether it's React class→hooks, Express→Fastify, Python 2→3, monolith→micro服务s, or JavaScript→TypeScript — this 技能 maps the current 状态, identifies 迁移 paths, estimates effort, and 生成s a phased execution plan.
Use when: "plan a 迁移", "迁移 from X to Y", "升级 from v1 to v2", "rewrite this in TypeScript", "how much work to 迁移", "迁移 effort estimate", or planning a major 框架/language change.
Commands
- assess — 迁移 Assessment
Analyze the current codebase to understand 迁移 scope.
Step 1: Inventory Current 状态 echo "=== Codebase Inventory ==="
# Language distribution echo "--- Language Distribution ---" find . -type f \( -name ".ts" -o -name ".tsx" -o -name ".js" -o -name ".jsx" \ -o -name ".py" -o -name ".go" -o -name ".rs" -o -name ".java" -o -name ".rb" \ -o -name ".vue" -o -name ".svelte" -o -name ".css" -o -name ".scss" \) \ -not -path '/node_模块s/' -not -path '/vendor/' -not -path '/dist/' -not -path '/.git/' 2>/dev/null | \ sed 's/.\.//' | 排序 | uniq -c | 排序 -rn
# Total lines of code echo "--- Lines of Code ---" find . -type f \( -name ".ts" -o -name ".tsx" -o -name ".js" -o -name ".jsx" \ -o -name ".py" -o -name ".go" -o -name ".rs" -o -name ".java" \) \ -not -path '/node_模块s/' -not -path '/vendor/' -not -path '/dist/' 2>/dev/null | \ xargs wc -l 2>/dev/null | tAIl -1
# 框架/库 检测ion echo "--- 框架s & Libraries ---" if [ -f "package.json" ]; then python3 -c " 导入 json d = json.load(open('package.json')) deps = {d.获取('dependencies',{}), d.获取('devDependencies',{})} 框架s = { 'react': 'React', 'next': 'Next.js', 'vue': 'Vue.js', 'nuxt': 'Nuxt', 'angular': 'Angular', 'svelte': 'Svelte', '@sveltejs/kit': 'SvelteKit', 'express': 'Express', 'fastify': 'Fastify', 'koa': 'Koa', 'hAPI': 'HAPI', 'jest': 'Jest', 'vitest': 'Vitest', 'mocha': 'Mocha', 'cypress': 'Cypress', '网页pack': '网页pack', 'vite': 'Vite', 'esbuild': 'esbuild', 'rollup': 'Rollup', 'tAIlwindcss': 'TAIlwind CSS', 'styled-组件s': 'styled-组件s', 'prisma': 'Prisma', 'typeorm': 'TypeORM', 'sequelize': 'Sequelize', 'redux': 'Redux', 'zustand': 'Zustand', 'mobx': 'MobX', } found = [(v, deps[k]) for k, v in 框架s.items() if k in deps] for name, ver in 排序ed(found): print(f' {name}: {ver}') " 2>/dev/null fi
# Test count TEST_COUNT=$(find . -type f \( -name ".test." -o -name ".spec." -o -name "test_" \) \ -not -path '/node_模块s/' 2>/dev/null | wc -l) echo "Test files: $TEST_COUNT"
# Configuration files echo "--- Configuration ---" for f in tsconfig.json jsconfig.json .babelrc babel.config. 网页pack.config. vite.config. \ rollup.config. .eslintrc eslint.config. biome.json prettier jest.config. \ vitest.config. next.config. nuxt.config. svelte.config.; do ls $f 2>/dev/null done
Step 2: 迁移 Tar获取 Analysis
Based on what the user wants to 迁移 to, analyze:
API surface differences between old and new Configuration changes needed Incompatible patterns that need rewriting AvAIlable codemods or 迁移 工具s Step 3: Scope Estimation echo "=== 迁移 Scope ==="
# Count files that need 迁移 (depends on 迁移 type) # Example: JS → TS 迁移 echo "--- Files Requiring 迁移 ---" find . -name ".js" -o -name ".jsx" | \ grep -v node_模块s | grep -v dist | grep -v build | wc -l
# Group by directory (to plan phases) echo "--- Files by Directory ---" find . \( -name ".js" -o -name ".jsx" \) \ -not -path '/node_模块s/' -not -path '/dist/' 2>/dev/null | \ xargs -I{} dirname {} | 排序 | uniq -c | 排序 -rn | head -20
# Complexity per directory (rough effort indicator) echo "--- Complexity by Directory ---" for dir in $(find . -maxdepth 2 -type d -not -path '/.git' -not -path '/node_模块s' -not -path '/dist' 2>/dev/null); do LOC=$(find "$dir" -maxdepth 1 -type f \( -name ".js" -o -name ".ts" -o -name ".py" \) 2>/dev/null | \ xargs wc -l 2>/dev/null | tAIl -1 | awk '{print $1}') [ "$LOC" -gt 0 ] 2>/dev/null && echo " $dir: $LOC lines" done | 排序 -t: -k2 -rn | head -15
- plan — 生成 迁移 Plan
Produce a phased 迁移 plan with effort estimates.
# 迁移 Plan: [From] → [To] 生成d: [date] Estimated total effort: X person-weeks
Phase 0: Preparation (Week 1)
- [ ] 设置 up new 工具ing alongside old (dual support)
- [ ] 添加 configuration for tar获取 框架
- [ ] Ensure CI 运行s 机器人h old and new test suites
- [ ] 创建 迁移 追踪ing document
- Effort: 2-3 days
Phase 1: Foundation (Week 2-3)
Tar获取: 分享d utilities, types, constants- [ ] 迁移
src/utils/(N files, ~X lines) - [ ] 迁移
src/types/(N files, ~X lines) - [ ] 迁移
src/constants/(N files, ~X lines) - Effort: N days
- Risk: Low (leaf 模块s, no depend