mcp-react-toolkit 1.0.1 → 1.3.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.
Files changed (275) hide show
  1. package/README.md +194 -44
  2. package/bin/cli.mjs +59 -0
  3. package/node_modules/@mcp-showcase/shared/build/McpServerBase.d.ts +18 -0
  4. package/node_modules/@mcp-showcase/shared/build/McpServerBase.d.ts.map +1 -0
  5. package/node_modules/@mcp-showcase/shared/build/McpServerBase.js +74 -0
  6. package/node_modules/@mcp-showcase/shared/build/McpServerBase.js.map +1 -0
  7. package/node_modules/@mcp-showcase/shared/build/ToolRegistry.d.ts +9 -0
  8. package/node_modules/@mcp-showcase/shared/build/ToolRegistry.d.ts.map +1 -0
  9. package/node_modules/@mcp-showcase/shared/build/ToolRegistry.js +22 -0
  10. package/node_modules/@mcp-showcase/shared/build/ToolRegistry.js.map +1 -0
  11. package/node_modules/@mcp-showcase/shared/build/fs.d.ts +8 -0
  12. package/node_modules/@mcp-showcase/shared/build/fs.d.ts.map +1 -0
  13. package/node_modules/@mcp-showcase/shared/build/fs.js +45 -0
  14. package/node_modules/@mcp-showcase/shared/build/fs.js.map +1 -0
  15. package/node_modules/@mcp-showcase/shared/build/index.d.ts +5 -0
  16. package/node_modules/@mcp-showcase/shared/build/index.d.ts.map +1 -0
  17. package/node_modules/@mcp-showcase/shared/build/index.js +5 -0
  18. package/node_modules/@mcp-showcase/shared/build/index.js.map +1 -0
  19. package/node_modules/@mcp-showcase/shared/build/types.d.ts +36 -0
  20. package/node_modules/@mcp-showcase/shared/build/types.d.ts.map +1 -0
  21. package/node_modules/@mcp-showcase/shared/build/types.js +5 -0
  22. package/node_modules/@mcp-showcase/shared/build/types.js.map +1 -0
  23. package/node_modules/@mcp-showcase/shared/package.json +24 -0
  24. package/node_modules/@mcp-showcase/shared/src/McpServerBase.ts +100 -0
  25. package/node_modules/@mcp-showcase/shared/src/ToolRegistry.ts +38 -0
  26. package/node_modules/@mcp-showcase/shared/src/fs.ts +49 -0
  27. package/node_modules/@mcp-showcase/shared/src/index.ts +12 -0
  28. package/node_modules/@mcp-showcase/shared/src/types.ts +44 -0
  29. package/node_modules/@mcp-showcase/shared/tsconfig.json +8 -0
  30. package/package.json +38 -4
  31. package/tools/accessibility-checker/build/index.js +9 -5
  32. package/tools/accessibility-checker/build/index.js.map +1 -1
  33. package/tools/accessibility-checker/build/rules.d.ts.map +1 -1
  34. package/tools/accessibility-checker/build/rules.js +325 -94
  35. package/tools/accessibility-checker/build/rules.js.map +1 -1
  36. package/tools/code-modernizer/build/tools/01-convert-to-typescript.d.ts.map +1 -1
  37. package/tools/code-modernizer/build/tools/01-convert-to-typescript.js +65 -50
  38. package/tools/code-modernizer/build/tools/01-convert-to-typescript.js.map +1 -1
  39. package/tools/code-modernizer/build/types.d.ts +1 -0
  40. package/tools/code-modernizer/build/types.d.ts.map +1 -1
  41. package/tools/code-modernizer/build/utils/ast-parser.d.ts.map +1 -1
  42. package/tools/code-modernizer/build/utils/ast-parser.js +30 -14
  43. package/tools/code-modernizer/build/utils/ast-parser.js.map +1 -1
  44. package/tools/code-modernizer/build/utils/type-generator.d.ts +1 -1
  45. package/tools/code-modernizer/build/utils/type-generator.d.ts.map +1 -1
  46. package/tools/code-modernizer/build/utils/type-generator.js +72 -23
  47. package/tools/code-modernizer/build/utils/type-generator.js.map +1 -1
  48. package/tools/component-factory/build/index.js +59 -7
  49. package/tools/component-factory/build/index.js.map +1 -1
  50. package/tools/component-fixer/README.md +44 -0
  51. package/tools/component-fixer/build/index.d.ts +3 -0
  52. package/tools/component-fixer/build/index.d.ts.map +1 -0
  53. package/tools/component-fixer/build/index.js +647 -0
  54. package/tools/component-fixer/build/index.js.map +1 -0
  55. package/tools/component-fixer/package.json +20 -0
  56. package/tools/component-reviewer/README.md +54 -0
  57. package/tools/component-reviewer/build/index.d.ts +39 -0
  58. package/tools/component-reviewer/build/index.d.ts.map +1 -0
  59. package/tools/component-reviewer/build/index.js +946 -0
  60. package/tools/component-reviewer/build/index.js.map +1 -0
  61. package/tools/component-reviewer/package.json +20 -0
  62. package/tools/dep-auditor/build/index.d.ts +1 -0
  63. package/tools/dep-auditor/build/index.d.ts.map +1 -1
  64. package/tools/dep-auditor/build/index.js +71 -16
  65. package/tools/dep-auditor/build/index.js.map +1 -1
  66. package/tools/generate-tests/build/analyzer.d.ts +14 -0
  67. package/tools/generate-tests/build/analyzer.d.ts.map +1 -1
  68. package/tools/generate-tests/build/analyzer.js +96 -42
  69. package/tools/generate-tests/build/analyzer.js.map +1 -1
  70. package/tools/generate-tests/build/generators.d.ts.map +1 -1
  71. package/tools/generate-tests/build/generators.js +304 -79
  72. package/tools/generate-tests/build/generators.js.map +1 -1
  73. package/tools/generate-tests/build/index.js +29 -10
  74. package/tools/generate-tests/build/index.js.map +1 -1
  75. package/tools/json-viewer/build/index.js +29 -6
  76. package/tools/json-viewer/build/index.js.map +1 -1
  77. package/tools/legacy-analyzer/README.md +66 -0
  78. package/tools/legacy-analyzer/build/index.d.ts +3 -0
  79. package/tools/legacy-analyzer/build/index.d.ts.map +1 -0
  80. package/tools/legacy-analyzer/build/index.js +209 -0
  81. package/tools/legacy-analyzer/build/index.js.map +1 -0
  82. package/tools/legacy-analyzer/build/tools/01-detect-project-tech.d.ts +3 -0
  83. package/tools/legacy-analyzer/build/tools/01-detect-project-tech.d.ts.map +1 -0
  84. package/tools/legacy-analyzer/build/tools/01-detect-project-tech.js +115 -0
  85. package/tools/legacy-analyzer/build/tools/01-detect-project-tech.js.map +1 -0
  86. package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.d.ts +3 -0
  87. package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.d.ts.map +1 -0
  88. package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.js +85 -0
  89. package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.js.map +1 -0
  90. package/tools/legacy-analyzer/build/tools/03-analyze-components.d.ts +3 -0
  91. package/tools/legacy-analyzer/build/tools/03-analyze-components.d.ts.map +1 -0
  92. package/tools/legacy-analyzer/build/tools/03-analyze-components.js +87 -0
  93. package/tools/legacy-analyzer/build/tools/03-analyze-components.js.map +1 -0
  94. package/tools/legacy-analyzer/build/tools/04-analyze-state-management.d.ts +3 -0
  95. package/tools/legacy-analyzer/build/tools/04-analyze-state-management.d.ts.map +1 -0
  96. package/tools/legacy-analyzer/build/tools/04-analyze-state-management.js +133 -0
  97. package/tools/legacy-analyzer/build/tools/04-analyze-state-management.js.map +1 -0
  98. package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.d.ts +3 -0
  99. package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.d.ts.map +1 -0
  100. package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.js +160 -0
  101. package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.js.map +1 -0
  102. package/tools/legacy-analyzer/build/tools/06-analyze-routing.d.ts +3 -0
  103. package/tools/legacy-analyzer/build/tools/06-analyze-routing.d.ts.map +1 -0
  104. package/tools/legacy-analyzer/build/tools/06-analyze-routing.js +150 -0
  105. package/tools/legacy-analyzer/build/tools/06-analyze-routing.js.map +1 -0
  106. package/tools/legacy-analyzer/build/tools/07-analyze-styling.d.ts +3 -0
  107. package/tools/legacy-analyzer/build/tools/07-analyze-styling.d.ts.map +1 -0
  108. package/tools/legacy-analyzer/build/tools/07-analyze-styling.js +131 -0
  109. package/tools/legacy-analyzer/build/tools/07-analyze-styling.js.map +1 -0
  110. package/tools/legacy-analyzer/build/tools/08-analyze-assets.d.ts +3 -0
  111. package/tools/legacy-analyzer/build/tools/08-analyze-assets.d.ts.map +1 -0
  112. package/tools/legacy-analyzer/build/tools/08-analyze-assets.js +85 -0
  113. package/tools/legacy-analyzer/build/tools/08-analyze-assets.js.map +1 -0
  114. package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.d.ts +3 -0
  115. package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.d.ts.map +1 -0
  116. package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.js +329 -0
  117. package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.js.map +1 -0
  118. package/tools/legacy-analyzer/build/tools/10-detect-duplication.d.ts +3 -0
  119. package/tools/legacy-analyzer/build/tools/10-detect-duplication.d.ts.map +1 -0
  120. package/tools/legacy-analyzer/build/tools/10-detect-duplication.js +192 -0
  121. package/tools/legacy-analyzer/build/tools/10-detect-duplication.js.map +1 -0
  122. package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.d.ts +3 -0
  123. package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.d.ts.map +1 -0
  124. package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.js +232 -0
  125. package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.js.map +1 -0
  126. package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.d.ts +3 -0
  127. package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.d.ts.map +1 -0
  128. package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.js +247 -0
  129. package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.js.map +1 -0
  130. package/tools/legacy-analyzer/build/tools/13-detect-features.d.ts +3 -0
  131. package/tools/legacy-analyzer/build/tools/13-detect-features.d.ts.map +1 -0
  132. package/tools/legacy-analyzer/build/tools/13-detect-features.js +141 -0
  133. package/tools/legacy-analyzer/build/tools/13-detect-features.js.map +1 -0
  134. package/tools/legacy-analyzer/build/tools/14-classify-files.d.ts +3 -0
  135. package/tools/legacy-analyzer/build/tools/14-classify-files.d.ts.map +1 -0
  136. package/tools/legacy-analyzer/build/tools/14-classify-files.js +76 -0
  137. package/tools/legacy-analyzer/build/tools/14-classify-files.js.map +1 -0
  138. package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.d.ts +3 -0
  139. package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.d.ts.map +1 -0
  140. package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.js +70 -0
  141. package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.js.map +1 -0
  142. package/tools/legacy-analyzer/build/tools/16-design-target-structure.d.ts +3 -0
  143. package/tools/legacy-analyzer/build/tools/16-design-target-structure.d.ts.map +1 -0
  144. package/tools/legacy-analyzer/build/tools/16-design-target-structure.js +26 -0
  145. package/tools/legacy-analyzer/build/tools/16-design-target-structure.js.map +1 -0
  146. package/tools/legacy-analyzer/build/tools/17-map-files-to-target.d.ts +3 -0
  147. package/tools/legacy-analyzer/build/tools/17-map-files-to-target.d.ts.map +1 -0
  148. package/tools/legacy-analyzer/build/tools/17-map-files-to-target.js +108 -0
  149. package/tools/legacy-analyzer/build/tools/17-map-files-to-target.js.map +1 -0
  150. package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.d.ts +3 -0
  151. package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.d.ts.map +1 -0
  152. package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.js +137 -0
  153. package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.js.map +1 -0
  154. package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.d.ts +3 -0
  155. package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.d.ts.map +1 -0
  156. package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.js +160 -0
  157. package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.js.map +1 -0
  158. package/tools/legacy-analyzer/build/tools/20-naming-standardizer.d.ts +3 -0
  159. package/tools/legacy-analyzer/build/tools/20-naming-standardizer.d.ts.map +1 -0
  160. package/tools/legacy-analyzer/build/tools/20-naming-standardizer.js +162 -0
  161. package/tools/legacy-analyzer/build/tools/20-naming-standardizer.js.map +1 -0
  162. package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.d.ts +3 -0
  163. package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.d.ts.map +1 -0
  164. package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.js +108 -0
  165. package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.js.map +1 -0
  166. package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.d.ts +3 -0
  167. package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.d.ts.map +1 -0
  168. package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.js +98 -0
  169. package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.js.map +1 -0
  170. package/tools/legacy-analyzer/build/types.d.ts +413 -0
  171. package/tools/legacy-analyzer/build/types.d.ts.map +1 -0
  172. package/tools/legacy-analyzer/build/types.js +12 -0
  173. package/tools/legacy-analyzer/build/types.js.map +1 -0
  174. package/tools/legacy-analyzer/build/utils/ast-parser.d.ts +34 -0
  175. package/tools/legacy-analyzer/build/utils/ast-parser.d.ts.map +1 -0
  176. package/tools/legacy-analyzer/build/utils/ast-parser.js +394 -0
  177. package/tools/legacy-analyzer/build/utils/ast-parser.js.map +1 -0
  178. package/tools/legacy-analyzer/build/utils/file-scanner.d.ts +51 -0
  179. package/tools/legacy-analyzer/build/utils/file-scanner.d.ts.map +1 -0
  180. package/tools/legacy-analyzer/build/utils/file-scanner.js +174 -0
  181. package/tools/legacy-analyzer/build/utils/file-scanner.js.map +1 -0
  182. package/tools/legacy-analyzer/build/utils/import-tracker.d.ts +38 -0
  183. package/tools/legacy-analyzer/build/utils/import-tracker.d.ts.map +1 -0
  184. package/tools/legacy-analyzer/build/utils/import-tracker.js +194 -0
  185. package/tools/legacy-analyzer/build/utils/import-tracker.js.map +1 -0
  186. package/tools/legacy-analyzer/build/utils/refactor-helpers.d.ts +88 -0
  187. package/tools/legacy-analyzer/build/utils/refactor-helpers.d.ts.map +1 -0
  188. package/tools/legacy-analyzer/build/utils/refactor-helpers.js +538 -0
  189. package/tools/legacy-analyzer/build/utils/refactor-helpers.js.map +1 -0
  190. package/tools/legacy-analyzer/package.json +20 -0
  191. package/tools/lighthouse-runner/README.md +45 -0
  192. package/tools/lighthouse-runner/build/index.d.ts +6 -0
  193. package/tools/lighthouse-runner/build/index.d.ts.map +1 -0
  194. package/tools/lighthouse-runner/build/index.js +295 -0
  195. package/tools/lighthouse-runner/build/index.js.map +1 -0
  196. package/tools/lighthouse-runner/package.json +20 -0
  197. package/tools/monorepo-manager/build/utils.d.ts.map +1 -1
  198. package/tools/monorepo-manager/build/utils.js +12 -9
  199. package/tools/monorepo-manager/build/utils.js.map +1 -1
  200. package/tools/performance-audit/README.md +37 -0
  201. package/tools/performance-audit/build/index.d.ts +13 -0
  202. package/tools/performance-audit/build/index.d.ts.map +1 -0
  203. package/tools/performance-audit/build/index.js +311 -0
  204. package/tools/performance-audit/build/index.js.map +1 -0
  205. package/tools/performance-audit/package.json +20 -0
  206. package/tools/quality-pipeline/build/index.js +55 -15
  207. package/tools/quality-pipeline/build/index.js.map +1 -1
  208. package/tools/render-analyzer/README.md +43 -0
  209. package/tools/render-analyzer/build/index.d.ts +25 -0
  210. package/tools/render-analyzer/build/index.d.ts.map +1 -0
  211. package/tools/render-analyzer/build/index.js +342 -0
  212. package/tools/render-analyzer/build/index.js.map +1 -0
  213. package/tools/render-analyzer/package.json +20 -0
  214. package/tools/shared/build/fs.d.ts +8 -0
  215. package/tools/shared/build/fs.d.ts.map +1 -0
  216. package/tools/shared/build/fs.js +45 -0
  217. package/tools/shared/build/fs.js.map +1 -0
  218. package/tools/shared/build/index.d.ts +1 -0
  219. package/tools/shared/build/index.d.ts.map +1 -1
  220. package/tools/shared/build/index.js +1 -0
  221. package/tools/shared/build/index.js.map +1 -1
  222. package/tools/shared/package.json +2 -1
  223. package/tools/storybook-generator/README.md +39 -0
  224. package/tools/storybook-generator/build/index.d.ts +13 -0
  225. package/tools/storybook-generator/build/index.d.ts.map +1 -0
  226. package/tools/storybook-generator/build/index.js +478 -0
  227. package/tools/storybook-generator/build/index.js.map +1 -0
  228. package/tools/storybook-generator/package.json +20 -0
  229. package/tools/test-gap-analyzer/README.md +41 -0
  230. package/tools/test-gap-analyzer/build/index.d.ts +20 -0
  231. package/tools/test-gap-analyzer/build/index.d.ts.map +1 -0
  232. package/tools/test-gap-analyzer/build/index.js +371 -0
  233. package/tools/test-gap-analyzer/build/index.js.map +1 -0
  234. package/tools/test-gap-analyzer/package.json +20 -0
  235. package/tools/typescript-enforcer/build/scanner.d.ts.map +1 -1
  236. package/tools/typescript-enforcer/build/scanner.js +13 -1
  237. package/tools/typescript-enforcer/build/scanner.js.map +1 -1
  238. package/tools/typescript-enforcer/build/types.d.ts +1 -0
  239. package/tools/typescript-enforcer/build/types.d.ts.map +1 -1
  240. package/CONTRIBUTING.md +0 -157
  241. package/demo/legacy-app/src/App.jsx +0 -12
  242. package/demo/legacy-app/src/components/Dashboard.jsx +0 -51
  243. package/demo/legacy-app/src/components/UserCard.jsx +0 -32
  244. package/demo/legacy-app/src/hooks/useUsers.js +0 -38
  245. package/demo/legacy-app/src/utils/api.js +0 -30
  246. package/glama.json +0 -4
  247. package/mcp-publisher +0 -0
  248. package/server.json +0 -20
  249. package/tools/accessibility-checker/build/rules.test.d.ts +0 -2
  250. package/tools/accessibility-checker/build/rules.test.d.ts.map +0 -1
  251. package/tools/accessibility-checker/build/rules.test.js.map +0 -1
  252. package/tools/code-modernizer/build/utils/file-ops.test.d.ts +0 -2
  253. package/tools/code-modernizer/build/utils/file-ops.test.d.ts.map +0 -1
  254. package/tools/code-modernizer/build/utils/file-ops.test.js.map +0 -1
  255. package/tools/component-factory/build/utils.test.d.ts +0 -2
  256. package/tools/component-factory/build/utils.test.d.ts.map +0 -1
  257. package/tools/component-factory/build/utils.test.js.map +0 -1
  258. package/tools/dep-auditor/build/index.test.d.ts +0 -2
  259. package/tools/dep-auditor/build/index.test.d.ts.map +0 -1
  260. package/tools/dep-auditor/build/index.test.js.map +0 -1
  261. package/tools/generate-tests/build/analyzer.test.d.ts +0 -2
  262. package/tools/generate-tests/build/analyzer.test.d.ts.map +0 -1
  263. package/tools/generate-tests/build/analyzer.test.js.map +0 -1
  264. package/tools/json-viewer/build/utils.test.d.ts +0 -2
  265. package/tools/json-viewer/build/utils.test.d.ts.map +0 -1
  266. package/tools/json-viewer/build/utils.test.js.map +0 -1
  267. package/tools/monorepo-manager/build/utils.test.d.ts +0 -2
  268. package/tools/monorepo-manager/build/utils.test.d.ts.map +0 -1
  269. package/tools/monorepo-manager/build/utils.test.js.map +0 -1
  270. package/tools/quality-pipeline/build/utils.test.d.ts +0 -2
  271. package/tools/quality-pipeline/build/utils.test.d.ts.map +0 -1
  272. package/tools/quality-pipeline/build/utils.test.js.map +0 -1
  273. package/tools/typescript-enforcer/build/scanner.test.d.ts +0 -2
  274. package/tools/typescript-enforcer/build/scanner.test.d.ts.map +0 -1
  275. package/tools/typescript-enforcer/build/scanner.test.js.map +0 -1
@@ -0,0 +1,247 @@
1
+ // ============================================================================
2
+ // TOOL #12: analyze-legacy-app (AGGREGATOR)
3
+ // Calls all tools and produces final report with migration hints
4
+ // ============================================================================
5
+ import { detectProjectTech } from './01-detect-project-tech.js';
6
+ import { analyzeFolderStructure } from './02-analyze-folder-structure.js';
7
+ import { analyzeComponents } from './03-analyze-components.js';
8
+ import { analyzeStateManagement } from './04-analyze-state-management.js';
9
+ import { analyzeApiLayer } from './05-analyze-api-layer.js';
10
+ import { analyzeRouting } from './06-analyze-routing.js';
11
+ import { analyzeStyling } from './07-analyze-styling.js';
12
+ import { analyzeAssets } from './08-analyze-assets.js';
13
+ import { detectAntiPatterns } from './09-detect-anti-patterns.js';
14
+ import { detectDuplication } from './10-detect-duplication.js';
15
+ import { analyzeDependenciesUsage } from './11-analyze-dependencies-usage.js';
16
+ export async function analyzeLegacyApp(appPath, config) {
17
+ // Run all analysis tools in parallel where possible
18
+ const [tech, structure, components, state, api, routing, styling, assets, antiPatterns, duplication, dependencies,] = await Promise.all([
19
+ detectProjectTech(appPath, config),
20
+ analyzeFolderStructure(appPath, config),
21
+ analyzeComponents(appPath, config),
22
+ analyzeStateManagement(appPath, config),
23
+ analyzeApiLayer(appPath, config),
24
+ analyzeRouting(appPath, config),
25
+ analyzeStyling(appPath, config),
26
+ analyzeAssets(appPath, config),
27
+ detectAntiPatterns(appPath, config),
28
+ detectDuplication(appPath, config),
29
+ analyzeDependenciesUsage(appPath, config),
30
+ ]);
31
+ // Count total issues
32
+ const totalIssues = structure.issues.length +
33
+ state.issues.length +
34
+ api.issues.length +
35
+ routing.issues.length +
36
+ styling.issues.length +
37
+ assets.assetIssues.length +
38
+ antiPatterns.antiPatterns.length +
39
+ duplication.duplicateComponents.length +
40
+ duplication.duplicateUtils.length +
41
+ dependencies.issues.length +
42
+ components.largeComponents.length +
43
+ components.complexComponents.length;
44
+ // Calculate health score (0-100) — weighted by severity
45
+ let healthScore = 100;
46
+ // TypeScript: -15 for no TS (high impact on maintainability)
47
+ if (tech.language === 'JavaScript')
48
+ healthScore -= 15;
49
+ // Components: penalize proportionally but cap so large apps aren't destroyed
50
+ // Large = files > 300 lines; Complex = many responsibilities
51
+ const largeRatio = components.totalComponents > 0 ? components.largeComponents.length / components.totalComponents : 0;
52
+ const complexRatio = components.totalComponents > 0 ? components.complexComponents.length / components.totalComponents : 0;
53
+ healthScore -= Math.min(Math.round(largeRatio * 25), 10); // max -10 for large files
54
+ healthScore -= Math.min(Math.round(complexRatio * 25), 10); // max -10 for complex files
55
+ // Anti-patterns: penalize per pattern type, capped at 30 total
56
+ let antiPatternDeduction = 0;
57
+ for (const ap of antiPatterns.antiPatterns) {
58
+ if (ap.type === 'god-component')
59
+ antiPatternDeduction += 10;
60
+ else if (ap.type === 'missing-error-handling')
61
+ antiPatternDeduction += 8;
62
+ else if (ap.type === 'prop-drilling')
63
+ antiPatternDeduction += 6;
64
+ else if (ap.type === 'tight-coupling')
65
+ antiPatternDeduction += 6;
66
+ else if (ap.type === 'missing-alt-text')
67
+ antiPatternDeduction += 5;
68
+ else if (ap.type === 'unlabeled-inputs')
69
+ antiPatternDeduction += 5;
70
+ else if (ap.type === 'non-semantic-html')
71
+ antiPatternDeduction += 4;
72
+ else if (ap.type === 'inline-callbacks')
73
+ antiPatternDeduction += 4;
74
+ else if (ap.type === 'duplicated-logic')
75
+ antiPatternDeduction += 3;
76
+ else if (ap.type === 'react-namespace-style')
77
+ antiPatternDeduction += 3;
78
+ else if (ap.type === 'placeholder-images')
79
+ antiPatternDeduction += 3;
80
+ else
81
+ antiPatternDeduction += 4;
82
+ }
83
+ healthScore -= Math.min(antiPatternDeduction, 30);
84
+ // API issues: scattered pattern is a major structural debt
85
+ if (api.apiPattern === 'scattered')
86
+ healthScore -= 7;
87
+ else if (api.apiPattern === 'mixed')
88
+ healthScore -= 3;
89
+ healthScore -= Math.min(api.issues.length * 2, 8);
90
+ // State: all state in one component
91
+ if (state.stateType === 'mixed')
92
+ healthScore -= 4;
93
+ if (state.issues.length > 0)
94
+ healthScore -= Math.min(state.issues.length * 2, 6);
95
+ // Duplication: cap at 8 — false positives are common in large apps
96
+ healthScore -= Math.min(duplication.duplicateComponents.length * 2, 8);
97
+ healthScore -= Math.min(duplication.duplicateUtils.length * 2, 6);
98
+ // Styling
99
+ healthScore -= Math.min(styling.issues.length * 2, 6);
100
+ // Dependencies
101
+ healthScore -= Math.min(dependencies.issues.length * 2, 6);
102
+ // Structure
103
+ if (structure.structureType === 'flat' && components.totalComponents > 3)
104
+ healthScore -= 4;
105
+ // No lazy loading on large apps (Next.js/Remix do this automatically — skip)
106
+ const isFileBased = routing.routingLibrary === 'next/router' || routing.routingLibrary === 'next/navigation' || routing.routingLibrary === '@remix-run/react';
107
+ if (!routing.lazyLoading && routing.routeCount > 5 && !isFileBased)
108
+ healthScore -= 5;
109
+ healthScore = Math.max(0, Math.round(healthScore));
110
+ // Generate migration hints
111
+ const migrationHints = [];
112
+ // TypeScript migration
113
+ if (tech.language === 'JavaScript') {
114
+ migrationHints.push({
115
+ priority: 'high',
116
+ category: 'TypeScript',
117
+ description: 'Convert project to TypeScript for better type safety and developer experience. Start with renaming files to .ts/.tsx and adding type annotations.',
118
+ affectedFiles: [],
119
+ });
120
+ }
121
+ // UI package extraction
122
+ if (components.totalComponents > 10) {
123
+ migrationHints.push({
124
+ priority: 'medium',
125
+ category: 'UI Package',
126
+ description: `Extract ${Math.min(components.totalComponents, 10)}+ reusable components to @repo/ui for cross-project reuse.`,
127
+ affectedFiles: components.largeComponents.map((c) => c.file),
128
+ });
129
+ }
130
+ // API layer
131
+ if (api.apiPattern === 'scattered') {
132
+ migrationHints.push({
133
+ priority: 'high',
134
+ category: 'API Layer',
135
+ description: 'Create a centralized API service layer. Extract all fetch/axios calls into a dedicated api/ directory with proper error handling, typed responses, and request/response interceptors.',
136
+ affectedFiles: [],
137
+ });
138
+ }
139
+ // State management
140
+ if (state.stateType === 'mixed') {
141
+ migrationHints.push({
142
+ priority: 'high',
143
+ category: 'State Management',
144
+ description: 'Consolidate state management. Choose one approach (Redux Toolkit or Zustand) and migrate all state to it.',
145
+ affectedFiles: [],
146
+ });
147
+ }
148
+ // Accessibility
149
+ const a11yPatterns = antiPatterns.antiPatterns.filter((a) => ['missing-alt-text', 'unlabeled-inputs', 'non-semantic-html'].includes(a.type));
150
+ if (a11yPatterns.length > 0) {
151
+ migrationHints.push({
152
+ priority: 'high',
153
+ category: 'Accessibility',
154
+ description: `Fix ${a11yPatterns.length} accessibility violation(s): ${a11yPatterns.map((a) => a.type).join(', ')}. Required for WCAG 2.1 compliance.`,
155
+ affectedFiles: a11yPatterns.flatMap((a) => a.files),
156
+ });
157
+ }
158
+ // God component splitting
159
+ const godComponents = antiPatterns.antiPatterns.filter((a) => a.type === 'god-component');
160
+ if (godComponents.length > 0) {
161
+ migrationHints.push({
162
+ priority: 'high',
163
+ category: 'Component Architecture',
164
+ description: `Split ${godComponents.length} god component(s) into smaller single-responsibility components. Extract state, API calls, and sub-views into separate files.`,
165
+ affectedFiles: godComponents.flatMap((a) => a.files),
166
+ });
167
+ }
168
+ // Error handling
169
+ const errorHandlingIssues = antiPatterns.antiPatterns.filter((a) => a.type === 'missing-error-handling');
170
+ if (errorHandlingIssues.length > 0) {
171
+ migrationHints.push({
172
+ priority: 'high',
173
+ category: 'Error Handling',
174
+ description: `Add try/catch or .catch() to ${errorHandlingIssues.flatMap((a) => a.files).length} file(s) with unhandled API calls. Consider adding a global error boundary.`,
175
+ affectedFiles: errorHandlingIssues.flatMap((a) => a.files),
176
+ });
177
+ }
178
+ // Folder restructuring
179
+ if (structure.structureType === 'flat') {
180
+ migrationHints.push({
181
+ priority: 'medium',
182
+ category: 'Folder Structure',
183
+ description: 'Restructure to feature-based organization for better scalability. Group related components, hooks, and utilities by feature.',
184
+ affectedFiles: [],
185
+ });
186
+ }
187
+ // Code splitting
188
+ if (!routing.lazyLoading && routing.routeCount > 5) {
189
+ migrationHints.push({
190
+ priority: 'medium',
191
+ category: 'Performance',
192
+ description: `Add lazy loading for ${routing.routeCount} routes using React.lazy() and Suspense for better initial load performance.`,
193
+ affectedFiles: [],
194
+ });
195
+ }
196
+ // Deduplication
197
+ if (duplication.duplicateComponents.length > 0) {
198
+ migrationHints.push({
199
+ priority: 'medium',
200
+ category: 'Code Quality',
201
+ description: `Consolidate ${duplication.duplicateComponents.length} duplicate components into shared implementations.`,
202
+ affectedFiles: duplication.duplicateComponents.flatMap((d) => d.locations),
203
+ });
204
+ }
205
+ // Styling
206
+ if (styling.stylingType.length > 2) {
207
+ migrationHints.push({
208
+ priority: 'low',
209
+ category: 'Styling',
210
+ description: `Standardize on one styling solution. Currently using ${styling.stylingType.join(', ')}.`,
211
+ affectedFiles: [],
212
+ });
213
+ }
214
+ // Anti-patterns
215
+ if (antiPatterns.antiPatterns.length > 3) {
216
+ migrationHints.push({
217
+ priority: 'high',
218
+ category: 'Code Quality',
219
+ description: `Address ${antiPatterns.antiPatterns.length} anti-patterns (prop drilling, tight coupling, etc.) for better maintainability.`,
220
+ affectedFiles: antiPatterns.antiPatterns.flatMap((a) => a.files),
221
+ });
222
+ }
223
+ // Sort hints by priority
224
+ const priorityOrder = { high: 0, medium: 1, low: 2 };
225
+ migrationHints.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
226
+ return {
227
+ summary: {
228
+ appPath,
229
+ analysisDate: new Date().toISOString(),
230
+ totalIssues,
231
+ healthScore,
232
+ },
233
+ tech,
234
+ structure,
235
+ components,
236
+ state,
237
+ api,
238
+ routing,
239
+ styling,
240
+ assets,
241
+ antiPatterns,
242
+ duplication,
243
+ dependencies,
244
+ migrationHints,
245
+ };
246
+ }
247
+ //# sourceMappingURL=12-analyze-legacy-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"12-analyze-legacy-app.js","sourceRoot":"","sources":["../../src/tools/12-analyze-legacy-app.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4CAA4C;AAC5C,iEAAiE;AACjE,+EAA+E;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAgC;IACtF,oDAAoD;IACpD,MAAM,CACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,KAAK,EACL,GAAG,EACH,OAAO,EACP,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACX,YAAY,E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AC;SACjE,CAAC,CAAC;IACL,CAAC;IAED,yBAAyB;IACzB,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IACrD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErF,OAAO;QACL,OAAO,EAAE;YACP,OAAO;YACP,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACtC,WAAW;YACX,WAAW;SACZ;QACD,IAAI;QACJ,SAAS;QACT,UAAU;QACV,KAAK;QACL,GAAG;QACH,OAAO;QACP,OAAO;QACP,MAAM;QACN,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DetectFeaturesOutput, AnalyzerConfig } from '../types.js';
2
+ export declare function detectFeatures(appPath: string, config?: Partial<AnalyzerConfig>): Promise<DetectFeaturesOutput>;
3
+ //# sourceMappingURL=13-detect-features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"13-detect-features.d.ts","sourceRoot":"","sources":["../../src/tools/13-detect-features.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CAiJ/B"}
@@ -0,0 +1,141 @@
1
+ // ============================================================================
2
+ // TOOL #13: detect-features
3
+ // Identifies logical features/domains in the app using file names, routing,
4
+ // folder grouping, and import clustering
5
+ // ============================================================================
6
+ import * as path from 'path';
7
+ import { findSourceFiles, resolveSourceDir } from '../utils/file-scanner.js';
8
+ import { buildImportGraph, resolveImportPath } from '../utils/import-tracker.js';
9
+ import { detectFeatureFromPath, detectFeatureFromRoute, extractRoutePaths, } from '../utils/refactor-helpers.js';
10
+ export async function detectFeatures(appPath, config) {
11
+ const srcPath = resolveSourceDir(appPath);
12
+ const files = await findSourceFiles(srcPath);
13
+ if (files.length === 0) {
14
+ return { features: [], featureMap: {} };
15
+ }
16
+ // Phase 1: Detect features from file paths
17
+ const pathFeatures = new Map();
18
+ for (const file of files) {
19
+ const feature = detectFeatureFromPath(file, srcPath);
20
+ if (feature) {
21
+ if (!pathFeatures.has(feature)) {
22
+ pathFeatures.set(feature, new Set());
23
+ }
24
+ pathFeatures.get(feature).add(path.relative(srcPath, file));
25
+ }
26
+ }
27
+ // Phase 2: Detect features from routing
28
+ const routes = await extractRoutePaths(appPath);
29
+ const routeFeatures = new Map();
30
+ for (const route of routes) {
31
+ const feature = detectFeatureFromRoute(route.path);
32
+ if (feature) {
33
+ if (!routeFeatures.has(feature)) {
34
+ routeFeatures.set(feature, []);
35
+ }
36
+ routeFeatures.get(feature).push(route.component);
37
+ }
38
+ }
39
+ // Phase 3: Detect features from import clustering
40
+ const graph = await buildImportGraph(srcPath);
41
+ const importFeatures = new Map();
42
+ const visited = new Set();
43
+ for (const file of files) {
44
+ if (visited.has(file))
45
+ continue;
46
+ const feature = detectFeatureFromPath(file, srcPath);
47
+ if (!feature)
48
+ continue;
49
+ if (!importFeatures.has(feature)) {
50
+ importFeatures.set(feature, new Set());
51
+ }
52
+ importFeatures.get(feature).add(path.relative(srcPath, file));
53
+ visited.add(file);
54
+ // Follow imports to cluster related files
55
+ const imports = graph[file]?.imports || [];
56
+ for (const imp of imports) {
57
+ const resolved = resolveImportPath(file, imp.source, srcPath, files);
58
+ if (resolved && !visited.has(resolved)) {
59
+ const basename = path.basename(resolved, path.extname(resolved));
60
+ // Only cluster components and pages, not utils
61
+ if (/^[A-Z]/.test(basename) || basename.toLowerCase().includes('page')) {
62
+ importFeatures.get(feature).add(path.relative(srcPath, resolved));
63
+ visited.add(resolved);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ // Merge all feature detection sources
69
+ const allFeatures = new Set();
70
+ const featureMap = {};
71
+ // Merge path-based features
72
+ for (const [feature, files] of pathFeatures) {
73
+ allFeatures.add(feature);
74
+ if (!featureMap[feature])
75
+ featureMap[feature] = [];
76
+ for (const f of files) {
77
+ if (!featureMap[feature].includes(f)) {
78
+ featureMap[feature].push(f);
79
+ }
80
+ }
81
+ }
82
+ // Merge route-based features
83
+ for (const [feature] of routeFeatures) {
84
+ allFeatures.add(feature);
85
+ if (!featureMap[feature])
86
+ featureMap[feature] = [];
87
+ }
88
+ // Merge import-clustered features
89
+ for (const [feature, files] of importFeatures) {
90
+ allFeatures.add(feature);
91
+ if (!featureMap[feature])
92
+ featureMap[feature] = [];
93
+ for (const f of files) {
94
+ if (!featureMap[feature].includes(f)) {
95
+ featureMap[feature].push(f);
96
+ }
97
+ }
98
+ }
99
+ // Also detect features from folder names at top level
100
+ const folders = new Set();
101
+ for (const file of files) {
102
+ const relPath = path.relative(srcPath, file);
103
+ const parts = relPath.split(path.sep);
104
+ if (parts.length >= 2) {
105
+ folders.add(parts[0]);
106
+ }
107
+ }
108
+ // If no features detected from files, use folder names
109
+ if (allFeatures.size === 0) {
110
+ for (const folder of folders) {
111
+ if (folder !== 'components' &&
112
+ folder !== 'utils' &&
113
+ folder !== 'hooks' &&
114
+ folder !== 'lib' &&
115
+ folder !== 'types' &&
116
+ folder !== 'config' &&
117
+ folder !== 'api' &&
118
+ folder !== 'services' &&
119
+ folder !== 'assets' &&
120
+ folder !== 'styles' &&
121
+ folder !== 'store' &&
122
+ folder !== 'context') {
123
+ allFeatures.add(folder);
124
+ featureMap[folder] = files
125
+ .filter((f) => path.relative(srcPath, f).startsWith(folder))
126
+ .map((f) => path.relative(srcPath, f));
127
+ }
128
+ }
129
+ }
130
+ // Sort features alphabetically
131
+ const features = Array.from(allFeatures).sort();
132
+ // Sort file lists within each feature
133
+ for (const feature of features) {
134
+ featureMap[feature].sort();
135
+ }
136
+ return {
137
+ features,
138
+ featureMap,
139
+ };
140
+ }
141
+ //# sourceMappingURL=13-detect-features.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"13-detect-features.js","sourceRoot":"","sources":["../../src/tools/13-detect-features.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4BAA4B;AAC5B,4EAA4E;AAC5E,yCAAyC;AACzC,+EAA+E;AAE/E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAmB,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAGtC,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,MAAgC;IAEhC,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAC1C,CAAC;IAED,2CAA2C;IAC3C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IACpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/B,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,GAAG,EAA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AO;QACL,QAAQ;QACR,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ClassifyFilesOutput, AnalyzerConfig } from '../types.js';
2
+ export declare function classifyFiles(appPath: string, config?: Partial<AnalyzerConfig>): Promise<ClassifyFilesOutput>;
3
+ //# sourceMappingURL=14-classify-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"14-classify-files.d.ts","sourceRoot":"","sources":["../../src/tools/14-classify-files.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAsB,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3F,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CA2E9B"}
@@ -0,0 +1,76 @@
1
+ // ============================================================================
2
+ // TOOL #14: classify-files
3
+ // Classifies each file into feature-specific, shared, utility, or config
4
+ // ============================================================================
5
+ import * as path from 'path';
6
+ import { findSourceFiles, resolveSourceDir } from '../utils/file-scanner.js';
7
+ import { buildImportGraph, resolveImportPath } from '../utils/import-tracker.js';
8
+ import { classifyFileType, detectFeatureFromPath, getFileFeature, } from '../utils/refactor-helpers.js';
9
+ export async function classifyFiles(appPath, config) {
10
+ const srcPath = resolveSourceDir(appPath);
11
+ const files = await findSourceFiles(srcPath);
12
+ if (files.length === 0) {
13
+ return { files: [] };
14
+ }
15
+ // Build import graph for cross-feature analysis
16
+ const graph = await buildImportGraph(srcPath);
17
+ // Count how many different features import each file
18
+ const importedByFeatures = new Map();
19
+ for (const file of files) {
20
+ const imports = graph[file]?.imports || [];
21
+ const fromFeature = getFileFeature(file, srcPath);
22
+ for (const imp of imports) {
23
+ const resolved = resolveImportPath(file, imp.source, srcPath, files);
24
+ if (!resolved)
25
+ continue;
26
+ if (!importedByFeatures.has(resolved)) {
27
+ importedByFeatures.set(resolved, new Set());
28
+ }
29
+ if (fromFeature) {
30
+ importedByFeatures.get(resolved).add(fromFeature);
31
+ }
32
+ }
33
+ }
34
+ // Classify each file
35
+ const classifications = [];
36
+ for (const file of files) {
37
+ const relPath = path.relative(srcPath, file);
38
+ let type;
39
+ let feature;
40
+ // First check: if imported by 2+ different features, it's shared
41
+ const importingFeatures = importedByFeatures.get(file);
42
+ if (importingFeatures && importingFeatures.size >= 2) {
43
+ type = 'shared';
44
+ }
45
+ else {
46
+ // Use path-based classification
47
+ type = classifyFileType(file, srcPath);
48
+ }
49
+ // Detect feature for feature-specific files
50
+ if (type === 'feature') {
51
+ const detectedFeature = detectFeatureFromPath(file, srcPath);
52
+ if (detectedFeature) {
53
+ feature = detectedFeature;
54
+ }
55
+ else {
56
+ // If no feature detected, reclassify as shared
57
+ type = 'shared';
58
+ }
59
+ }
60
+ classifications.push({
61
+ path: relPath,
62
+ type,
63
+ feature,
64
+ });
65
+ }
66
+ // Sort by type then by path
67
+ classifications.sort((a, b) => {
68
+ const typeOrder = { feature: 0, shared: 1, utility: 2, config: 3 };
69
+ const typeDiff = typeOrder[a.type] - typeOrder[b.type];
70
+ if (typeDiff !== 0)
71
+ return typeDiff;
72
+ return a.path.localeCompare(b.path);
73
+ });
74
+ return { files: classifications };
75
+ }
76
+ //# sourceMappingURL=14-classify-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"14-classify-files.js","sourceRoot":"","sources":["../../src/tools/14-classify-files.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2BAA2B;AAC3B,yEAAyE;AACzE,+EAA+E;AAE/E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,MAAM,CAA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C,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DetectSharedModulesOutput, AnalyzerConfig } from '../types.js';
2
+ export declare function detectSharedModules(appPath: string, config?: Partial<AnalyzerConfig>): Promise<DetectSharedModulesOutput>;
3
+ //# sourceMappingURL=15-detect-shared-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"15-detect-shared-modules.d.ts","sourceRoot":"","sources":["../../src/tools/15-detect-shared-modules.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7E,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CAwEpC"}
@@ -0,0 +1,70 @@
1
+ // ============================================================================
2
+ // TOOL #15: detect-shared-modules
3
+ // Identifies files used across multiple features
4
+ // ============================================================================
5
+ import * as path from 'path';
6
+ import { findSourceFiles, resolveSourceDir } from '../utils/file-scanner.js';
7
+ import { buildImportGraph, resolveImportPath } from '../utils/import-tracker.js';
8
+ import { getFileFeature } from '../utils/refactor-helpers.js';
9
+ export async function detectSharedModules(appPath, config) {
10
+ const srcPath = resolveSourceDir(appPath);
11
+ const files = await findSourceFiles(srcPath);
12
+ if (files.length === 0) {
13
+ return { shared: [], usageCounts: {} };
14
+ }
15
+ const graph = await buildImportGraph(srcPath);
16
+ // Track which features use each file
17
+ const fileUsageByFeature = new Map();
18
+ for (const file of files) {
19
+ const fromFeature = getFileFeature(file, srcPath);
20
+ if (!fromFeature)
21
+ continue;
22
+ const imports = graph[file]?.imports || [];
23
+ for (const imp of imports) {
24
+ // Only track internal imports (relative paths)
25
+ if (!imp.source.startsWith('.'))
26
+ continue;
27
+ const resolved = resolveImportPath(file, imp.source, srcPath, files);
28
+ if (!resolved)
29
+ continue;
30
+ if (!fileUsageByFeature.has(resolved)) {
31
+ fileUsageByFeature.set(resolved, new Set());
32
+ }
33
+ fileUsageByFeature.get(resolved).add(fromFeature);
34
+ }
35
+ }
36
+ // Also track files that are imported by many files (high fan-in)
37
+ const fileImportCount = new Map();
38
+ for (const file of files) {
39
+ const importers = graph[file]?.importedBy || [];
40
+ fileImportCount.set(file, importers.length);
41
+ }
42
+ // Identify shared modules: used by 2+ features OR high import count
43
+ const shared = [];
44
+ const usageCounts = {};
45
+ for (const [file, features] of fileUsageByFeature) {
46
+ const relPath = path.relative(srcPath, file);
47
+ if (features.size >= 2) {
48
+ if (!shared.includes(relPath)) {
49
+ shared.push(relPath);
50
+ }
51
+ usageCounts[relPath] = features.size;
52
+ }
53
+ }
54
+ // Also add files with high import count (>=5 importers) that aren't already shared
55
+ for (const [file, count] of fileImportCount) {
56
+ const relPath = path.relative(srcPath, file);
57
+ if (count >= 5 && !shared.includes(relPath)) {
58
+ // Only add if it's not a component-specific file
59
+ const feature = getFileFeature(file, srcPath);
60
+ if (!feature) {
61
+ shared.push(relPath);
62
+ usageCounts[relPath] = count;
63
+ }
64
+ }
65
+ }
66
+ // Sort by usage count descending
67
+ shared.sort((a, b) => (usageCounts[b] || 0) - (usageCounts[a] || 0));
68
+ return { shared, usageCounts };
69
+ }
70
+ //# sourceMappingURL=15-detect-shared-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"15-detect-shared-modules.js","sourceRoot":"","sources":["../../src/tools/15-detect-shared-modules.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kCAAkC;AAClC,iDAAiD;AACjD,+EAA+E;AAE/E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B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b,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACrB,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,iCAAiC;IACjC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DesignTargetStructureOutput, AnalyzerConfig } from '../types.js';
2
+ export declare function designTargetStructure(appPath: string, config?: Partial<AnalyzerConfig>, features?: string[]): Promise<DesignTargetStructureOutput>;
3
+ //# sourceMappingURL=16-design-target-structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"16-design-target-structure.d.ts","sourceRoot":"","sources":["../../src/tools/16-design-target-structure.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/E,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,EAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,2BAA2B,CAAC,CAwBtC"}
@@ -0,0 +1,26 @@
1
+ // ============================================================================
2
+ // TOOL #16: design-target-structure
3
+ // Generates scalable folder structure based on detected features
4
+ // ============================================================================
5
+ import { FEATURE_SUBDIRS, SHARED_DIRS, APP_DIRS } from '../utils/refactor-helpers.js';
6
+ export async function designTargetStructure(appPath, config, features) {
7
+ const featureList = features || [];
8
+ // Build feature structure
9
+ const featuresStructure = {};
10
+ for (const feature of featureList) {
11
+ featuresStructure[feature] = [...FEATURE_SUBDIRS];
12
+ }
13
+ // If no features detected, create a default structure
14
+ if (featureList.length === 0) {
15
+ featuresStructure['common'] = ['components', 'hooks', 'api'];
16
+ }
17
+ const structure = {
18
+ src: {
19
+ features: featuresStructure,
20
+ shared: SHARED_DIRS,
21
+ app: APP_DIRS,
22
+ },
23
+ };
24
+ return { structure };
25
+ }
26
+ //# sourceMappingURL=16-design-target-structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"16-design-target-structure.js","sourceRoot":"","sources":["../../src/tools/16-design-target-structure.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oCAAoC;AACpC,iEAAiE;AACjE,+EAA+E;AAG/E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEtF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAe,EACf,MAAgC,EAChC,QAAmB;IAEnB,MAAM,WAAW,GAAG,QAAQ,IAAI,EAAE,CAAC;IAEnC,0BAA0B;IAC1B,MAAM,iBAAiB,GAA6B,EAAE,CAAC;IAEvD,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;QAClC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC;IACpD,CAAC;IAED,sDAAsD;IACtD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,SAAS,GAA6C;QAC1D,GAAG,EAAE;YACH,QAAQ,EAAE,iBAAiB;YAC3B,MAAM,EAAE,WAAW;YACnB,GAAG,EAAE,QAAQ;SACd;KACF,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC"}