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.
- package/README.md +194 -44
- package/bin/cli.mjs +59 -0
- package/node_modules/@mcp-showcase/shared/build/McpServerBase.d.ts +18 -0
- package/node_modules/@mcp-showcase/shared/build/McpServerBase.d.ts.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/McpServerBase.js +74 -0
- package/node_modules/@mcp-showcase/shared/build/McpServerBase.js.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/ToolRegistry.d.ts +9 -0
- package/node_modules/@mcp-showcase/shared/build/ToolRegistry.d.ts.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/ToolRegistry.js +22 -0
- package/node_modules/@mcp-showcase/shared/build/ToolRegistry.js.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/fs.d.ts +8 -0
- package/node_modules/@mcp-showcase/shared/build/fs.d.ts.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/fs.js +45 -0
- package/node_modules/@mcp-showcase/shared/build/fs.js.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/index.d.ts +5 -0
- package/node_modules/@mcp-showcase/shared/build/index.d.ts.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/index.js +5 -0
- package/node_modules/@mcp-showcase/shared/build/index.js.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/types.d.ts +36 -0
- package/node_modules/@mcp-showcase/shared/build/types.d.ts.map +1 -0
- package/node_modules/@mcp-showcase/shared/build/types.js +5 -0
- package/node_modules/@mcp-showcase/shared/build/types.js.map +1 -0
- package/node_modules/@mcp-showcase/shared/package.json +24 -0
- package/node_modules/@mcp-showcase/shared/src/McpServerBase.ts +100 -0
- package/node_modules/@mcp-showcase/shared/src/ToolRegistry.ts +38 -0
- package/node_modules/@mcp-showcase/shared/src/fs.ts +49 -0
- package/node_modules/@mcp-showcase/shared/src/index.ts +12 -0
- package/node_modules/@mcp-showcase/shared/src/types.ts +44 -0
- package/node_modules/@mcp-showcase/shared/tsconfig.json +8 -0
- package/package.json +38 -4
- package/tools/accessibility-checker/build/index.js +9 -5
- package/tools/accessibility-checker/build/index.js.map +1 -1
- package/tools/accessibility-checker/build/rules.d.ts.map +1 -1
- package/tools/accessibility-checker/build/rules.js +325 -94
- package/tools/accessibility-checker/build/rules.js.map +1 -1
- package/tools/code-modernizer/build/tools/01-convert-to-typescript.d.ts.map +1 -1
- package/tools/code-modernizer/build/tools/01-convert-to-typescript.js +65 -50
- package/tools/code-modernizer/build/tools/01-convert-to-typescript.js.map +1 -1
- package/tools/code-modernizer/build/types.d.ts +1 -0
- package/tools/code-modernizer/build/types.d.ts.map +1 -1
- package/tools/code-modernizer/build/utils/ast-parser.d.ts.map +1 -1
- package/tools/code-modernizer/build/utils/ast-parser.js +30 -14
- package/tools/code-modernizer/build/utils/ast-parser.js.map +1 -1
- package/tools/code-modernizer/build/utils/type-generator.d.ts +1 -1
- package/tools/code-modernizer/build/utils/type-generator.d.ts.map +1 -1
- package/tools/code-modernizer/build/utils/type-generator.js +72 -23
- package/tools/code-modernizer/build/utils/type-generator.js.map +1 -1
- package/tools/component-factory/build/index.js +59 -7
- package/tools/component-factory/build/index.js.map +1 -1
- package/tools/component-fixer/README.md +44 -0
- package/tools/component-fixer/build/index.d.ts +3 -0
- package/tools/component-fixer/build/index.d.ts.map +1 -0
- package/tools/component-fixer/build/index.js +647 -0
- package/tools/component-fixer/build/index.js.map +1 -0
- package/tools/component-fixer/package.json +20 -0
- package/tools/component-reviewer/README.md +54 -0
- package/tools/component-reviewer/build/index.d.ts +39 -0
- package/tools/component-reviewer/build/index.d.ts.map +1 -0
- package/tools/component-reviewer/build/index.js +946 -0
- package/tools/component-reviewer/build/index.js.map +1 -0
- package/tools/component-reviewer/package.json +20 -0
- package/tools/dep-auditor/build/index.d.ts +1 -0
- package/tools/dep-auditor/build/index.d.ts.map +1 -1
- package/tools/dep-auditor/build/index.js +71 -16
- package/tools/dep-auditor/build/index.js.map +1 -1
- package/tools/generate-tests/build/analyzer.d.ts +14 -0
- package/tools/generate-tests/build/analyzer.d.ts.map +1 -1
- package/tools/generate-tests/build/analyzer.js +96 -42
- package/tools/generate-tests/build/analyzer.js.map +1 -1
- package/tools/generate-tests/build/generators.d.ts.map +1 -1
- package/tools/generate-tests/build/generators.js +304 -79
- package/tools/generate-tests/build/generators.js.map +1 -1
- package/tools/generate-tests/build/index.js +29 -10
- package/tools/generate-tests/build/index.js.map +1 -1
- package/tools/json-viewer/build/index.js +29 -6
- package/tools/json-viewer/build/index.js.map +1 -1
- package/tools/legacy-analyzer/README.md +66 -0
- package/tools/legacy-analyzer/build/index.d.ts +3 -0
- package/tools/legacy-analyzer/build/index.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/index.js +209 -0
- package/tools/legacy-analyzer/build/index.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/01-detect-project-tech.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/01-detect-project-tech.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/01-detect-project-tech.js +115 -0
- package/tools/legacy-analyzer/build/tools/01-detect-project-tech.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.js +85 -0
- package/tools/legacy-analyzer/build/tools/02-analyze-folder-structure.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/03-analyze-components.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/03-analyze-components.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/03-analyze-components.js +87 -0
- package/tools/legacy-analyzer/build/tools/03-analyze-components.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/04-analyze-state-management.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/04-analyze-state-management.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/04-analyze-state-management.js +133 -0
- package/tools/legacy-analyzer/build/tools/04-analyze-state-management.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.js +160 -0
- package/tools/legacy-analyzer/build/tools/05-analyze-api-layer.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/06-analyze-routing.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/06-analyze-routing.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/06-analyze-routing.js +150 -0
- package/tools/legacy-analyzer/build/tools/06-analyze-routing.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/07-analyze-styling.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/07-analyze-styling.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/07-analyze-styling.js +131 -0
- package/tools/legacy-analyzer/build/tools/07-analyze-styling.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/08-analyze-assets.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/08-analyze-assets.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/08-analyze-assets.js +85 -0
- package/tools/legacy-analyzer/build/tools/08-analyze-assets.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.js +329 -0
- package/tools/legacy-analyzer/build/tools/09-detect-anti-patterns.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/10-detect-duplication.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/10-detect-duplication.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/10-detect-duplication.js +192 -0
- package/tools/legacy-analyzer/build/tools/10-detect-duplication.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.js +232 -0
- package/tools/legacy-analyzer/build/tools/11-analyze-dependencies-usage.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.js +247 -0
- package/tools/legacy-analyzer/build/tools/12-analyze-legacy-app.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/13-detect-features.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/13-detect-features.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/13-detect-features.js +141 -0
- package/tools/legacy-analyzer/build/tools/13-detect-features.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/14-classify-files.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/14-classify-files.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/14-classify-files.js +76 -0
- package/tools/legacy-analyzer/build/tools/14-classify-files.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.js +70 -0
- package/tools/legacy-analyzer/build/tools/15-detect-shared-modules.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/16-design-target-structure.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/16-design-target-structure.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/16-design-target-structure.js +26 -0
- package/tools/legacy-analyzer/build/tools/16-design-target-structure.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/17-map-files-to-target.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/17-map-files-to-target.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/17-map-files-to-target.js +108 -0
- package/tools/legacy-analyzer/build/tools/17-map-files-to-target.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.js +137 -0
- package/tools/legacy-analyzer/build/tools/18-detect-boundary-violations.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.js +160 -0
- package/tools/legacy-analyzer/build/tools/19-suggest-module-splitting.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/20-naming-standardizer.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/20-naming-standardizer.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/20-naming-standardizer.js +162 -0
- package/tools/legacy-analyzer/build/tools/20-naming-standardizer.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.js +108 -0
- package/tools/legacy-analyzer/build/tools/21-generate-refactor-plan.js.map +1 -0
- package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.d.ts +3 -0
- package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.js +98 -0
- package/tools/legacy-analyzer/build/tools/22-refactor-folder-structure.js.map +1 -0
- package/tools/legacy-analyzer/build/types.d.ts +413 -0
- package/tools/legacy-analyzer/build/types.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/types.js +12 -0
- package/tools/legacy-analyzer/build/types.js.map +1 -0
- package/tools/legacy-analyzer/build/utils/ast-parser.d.ts +34 -0
- package/tools/legacy-analyzer/build/utils/ast-parser.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/utils/ast-parser.js +394 -0
- package/tools/legacy-analyzer/build/utils/ast-parser.js.map +1 -0
- package/tools/legacy-analyzer/build/utils/file-scanner.d.ts +51 -0
- package/tools/legacy-analyzer/build/utils/file-scanner.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/utils/file-scanner.js +174 -0
- package/tools/legacy-analyzer/build/utils/file-scanner.js.map +1 -0
- package/tools/legacy-analyzer/build/utils/import-tracker.d.ts +38 -0
- package/tools/legacy-analyzer/build/utils/import-tracker.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/utils/import-tracker.js +194 -0
- package/tools/legacy-analyzer/build/utils/import-tracker.js.map +1 -0
- package/tools/legacy-analyzer/build/utils/refactor-helpers.d.ts +88 -0
- package/tools/legacy-analyzer/build/utils/refactor-helpers.d.ts.map +1 -0
- package/tools/legacy-analyzer/build/utils/refactor-helpers.js +538 -0
- package/tools/legacy-analyzer/build/utils/refactor-helpers.js.map +1 -0
- package/tools/legacy-analyzer/package.json +20 -0
- package/tools/lighthouse-runner/README.md +45 -0
- package/tools/lighthouse-runner/build/index.d.ts +6 -0
- package/tools/lighthouse-runner/build/index.d.ts.map +1 -0
- package/tools/lighthouse-runner/build/index.js +295 -0
- package/tools/lighthouse-runner/build/index.js.map +1 -0
- package/tools/lighthouse-runner/package.json +20 -0
- package/tools/monorepo-manager/build/utils.d.ts.map +1 -1
- package/tools/monorepo-manager/build/utils.js +12 -9
- package/tools/monorepo-manager/build/utils.js.map +1 -1
- package/tools/performance-audit/README.md +37 -0
- package/tools/performance-audit/build/index.d.ts +13 -0
- package/tools/performance-audit/build/index.d.ts.map +1 -0
- package/tools/performance-audit/build/index.js +311 -0
- package/tools/performance-audit/build/index.js.map +1 -0
- package/tools/performance-audit/package.json +20 -0
- package/tools/quality-pipeline/build/index.js +55 -15
- package/tools/quality-pipeline/build/index.js.map +1 -1
- package/tools/render-analyzer/README.md +43 -0
- package/tools/render-analyzer/build/index.d.ts +25 -0
- package/tools/render-analyzer/build/index.d.ts.map +1 -0
- package/tools/render-analyzer/build/index.js +342 -0
- package/tools/render-analyzer/build/index.js.map +1 -0
- package/tools/render-analyzer/package.json +20 -0
- package/tools/shared/build/fs.d.ts +8 -0
- package/tools/shared/build/fs.d.ts.map +1 -0
- package/tools/shared/build/fs.js +45 -0
- package/tools/shared/build/fs.js.map +1 -0
- package/tools/shared/build/index.d.ts +1 -0
- package/tools/shared/build/index.d.ts.map +1 -1
- package/tools/shared/build/index.js +1 -0
- package/tools/shared/build/index.js.map +1 -1
- package/tools/shared/package.json +2 -1
- package/tools/storybook-generator/README.md +39 -0
- package/tools/storybook-generator/build/index.d.ts +13 -0
- package/tools/storybook-generator/build/index.d.ts.map +1 -0
- package/tools/storybook-generator/build/index.js +478 -0
- package/tools/storybook-generator/build/index.js.map +1 -0
- package/tools/storybook-generator/package.json +20 -0
- package/tools/test-gap-analyzer/README.md +41 -0
- package/tools/test-gap-analyzer/build/index.d.ts +20 -0
- package/tools/test-gap-analyzer/build/index.d.ts.map +1 -0
- package/tools/test-gap-analyzer/build/index.js +371 -0
- package/tools/test-gap-analyzer/build/index.js.map +1 -0
- package/tools/test-gap-analyzer/package.json +20 -0
- package/tools/typescript-enforcer/build/scanner.d.ts.map +1 -1
- package/tools/typescript-enforcer/build/scanner.js +13 -1
- package/tools/typescript-enforcer/build/scanner.js.map +1 -1
- package/tools/typescript-enforcer/build/types.d.ts +1 -0
- package/tools/typescript-enforcer/build/types.d.ts.map +1 -1
- package/CONTRIBUTING.md +0 -157
- package/demo/legacy-app/src/App.jsx +0 -12
- package/demo/legacy-app/src/components/Dashboard.jsx +0 -51
- package/demo/legacy-app/src/components/UserCard.jsx +0 -32
- package/demo/legacy-app/src/hooks/useUsers.js +0 -38
- package/demo/legacy-app/src/utils/api.js +0 -30
- package/glama.json +0 -4
- package/mcp-publisher +0 -0
- package/server.json +0 -20
- package/tools/accessibility-checker/build/rules.test.d.ts +0 -2
- package/tools/accessibility-checker/build/rules.test.d.ts.map +0 -1
- package/tools/accessibility-checker/build/rules.test.js.map +0 -1
- package/tools/code-modernizer/build/utils/file-ops.test.d.ts +0 -2
- package/tools/code-modernizer/build/utils/file-ops.test.d.ts.map +0 -1
- package/tools/code-modernizer/build/utils/file-ops.test.js.map +0 -1
- package/tools/component-factory/build/utils.test.d.ts +0 -2
- package/tools/component-factory/build/utils.test.d.ts.map +0 -1
- package/tools/component-factory/build/utils.test.js.map +0 -1
- package/tools/dep-auditor/build/index.test.d.ts +0 -2
- package/tools/dep-auditor/build/index.test.d.ts.map +0 -1
- package/tools/dep-auditor/build/index.test.js.map +0 -1
- package/tools/generate-tests/build/analyzer.test.d.ts +0 -2
- package/tools/generate-tests/build/analyzer.test.d.ts.map +0 -1
- package/tools/generate-tests/build/analyzer.test.js.map +0 -1
- package/tools/json-viewer/build/utils.test.d.ts +0 -2
- package/tools/json-viewer/build/utils.test.d.ts.map +0 -1
- package/tools/json-viewer/build/utils.test.js.map +0 -1
- package/tools/monorepo-manager/build/utils.test.d.ts +0 -2
- package/tools/monorepo-manager/build/utils.test.d.ts.map +0 -1
- package/tools/monorepo-manager/build/utils.test.js.map +0 -1
- package/tools/quality-pipeline/build/utils.test.d.ts +0 -2
- package/tools/quality-pipeline/build/utils.test.d.ts.map +0 -1
- package/tools/quality-pipeline/build/utils.test.js.map +0 -1
- package/tools/typescript-enforcer/build/scanner.test.d.ts +0 -2
- package/tools/typescript-enforcer/build/scanner.test.d.ts.map +0 -1
- package/tools/typescript-enforcer/build/scanner.test.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface RenderIssue {
|
|
3
|
+
type: 'missing-memo' | 'missing-usememo' | 'missing-usecallback' | 'inline-object' | 'inline-array' | 'inline-function' | 'new-object-prop' | 'context-value';
|
|
4
|
+
component: string;
|
|
5
|
+
file: string;
|
|
6
|
+
line: number;
|
|
7
|
+
description: string;
|
|
8
|
+
severity: 'high' | 'medium' | 'low';
|
|
9
|
+
fix: string;
|
|
10
|
+
}
|
|
11
|
+
interface ComponentRenderProfile {
|
|
12
|
+
name: string;
|
|
13
|
+
file: string;
|
|
14
|
+
hasMemo: boolean;
|
|
15
|
+
hasUseMemo: boolean;
|
|
16
|
+
hasUseCallback: boolean;
|
|
17
|
+
propsCount: number;
|
|
18
|
+
inlineObjects: number;
|
|
19
|
+
inlineFunctions: number;
|
|
20
|
+
issues: RenderIssue[];
|
|
21
|
+
}
|
|
22
|
+
export declare function extractComponents(content: string): string[];
|
|
23
|
+
export declare function analyzeComponent(content: string, componentName: string, filePath: string): ComponentRenderProfile;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,UAAU,WAAW;IACnB,IAAI,EAAE,cAAc,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IAC9J,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAwBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ3D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAgKjH"}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServerBase, safeReadFile } from '@mcp-showcase/shared';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// SOURCE ANALYSIS
|
|
7
|
+
// ============================================================================
|
|
8
|
+
function scanDirectory(dir) {
|
|
9
|
+
const files = [];
|
|
10
|
+
if (!fs.existsSync(dir))
|
|
11
|
+
return files;
|
|
12
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
if (entry.isSymbolicLink())
|
|
15
|
+
continue;
|
|
16
|
+
const fullPath = path.join(dir, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
if (['node_modules', 'build', 'dist', '.next', '__tests__', '.turbo', '.git'].includes(entry.name))
|
|
19
|
+
continue;
|
|
20
|
+
files.push(...scanDirectory(fullPath));
|
|
21
|
+
}
|
|
22
|
+
else if (entry.name.match(/\.(tsx|jsx)$/)) {
|
|
23
|
+
if (entry.name.includes('.test.') || entry.name.includes('.spec.') || entry.name.includes('.stories.'))
|
|
24
|
+
continue;
|
|
25
|
+
files.push(fullPath);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
export function extractComponents(content) {
|
|
31
|
+
const components = [];
|
|
32
|
+
const fnRegex = /(?:export\s+(?:default\s+)?)?(?:const|function)\s+([A-Z]\w+)/g;
|
|
33
|
+
let match;
|
|
34
|
+
while ((match = fnRegex.exec(content)) !== null) {
|
|
35
|
+
if (!components.includes(match[1]))
|
|
36
|
+
components.push(match[1]);
|
|
37
|
+
}
|
|
38
|
+
return components;
|
|
39
|
+
}
|
|
40
|
+
export function analyzeComponent(content, componentName, filePath) {
|
|
41
|
+
const hasMemo = content.includes(`memo(${componentName})`) || content.includes('React.memo');
|
|
42
|
+
const hasUseMemo = content.includes('useMemo');
|
|
43
|
+
const hasUseCallback = content.includes('useCallback');
|
|
44
|
+
let inlineObjects = 0;
|
|
45
|
+
let inlineFunctions = 0;
|
|
46
|
+
let propsCount = 0;
|
|
47
|
+
const issues = [];
|
|
48
|
+
const compStart = content.indexOf(componentName);
|
|
49
|
+
if (compStart === -1) {
|
|
50
|
+
return { name: componentName, file: filePath, hasMemo, hasUseMemo, hasUseCallback, propsCount, inlineObjects, inlineFunctions, issues };
|
|
51
|
+
}
|
|
52
|
+
const componentBody = content.slice(compStart);
|
|
53
|
+
const bodyLines = componentBody.split('\n');
|
|
54
|
+
for (let i = 0; i < bodyLines.length; i++) {
|
|
55
|
+
const line = bodyLines[i];
|
|
56
|
+
const lineNum = content.slice(0, compStart).split('\n').length + i;
|
|
57
|
+
// Inline object literals as props: style={{...}}
|
|
58
|
+
const inlineObjMatches = line.match(/\{\{[^}]+\}\}/g);
|
|
59
|
+
if (inlineObjMatches) {
|
|
60
|
+
inlineObjects += inlineObjMatches.length;
|
|
61
|
+
for (const _m of inlineObjMatches) {
|
|
62
|
+
issues.push({
|
|
63
|
+
type: 'inline-object',
|
|
64
|
+
component: componentName,
|
|
65
|
+
file: filePath,
|
|
66
|
+
line: lineNum,
|
|
67
|
+
description: 'Inline object literal creates a new reference on every render, causing child re-renders.',
|
|
68
|
+
severity: 'medium',
|
|
69
|
+
fix: 'Extract to a const outside the component or wrap with useMemo:\nconst style = useMemo(() => ({ /* styles */ }), []);',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Inline array literals as props: items={[...]}
|
|
74
|
+
const inlineArrMatches = line.match(/=\s*\[[^\]]*\]/g);
|
|
75
|
+
if (inlineArrMatches && line.includes('<')) {
|
|
76
|
+
inlineObjects += inlineArrMatches.length;
|
|
77
|
+
for (const _m of inlineArrMatches) {
|
|
78
|
+
issues.push({
|
|
79
|
+
type: 'inline-array',
|
|
80
|
+
component: componentName,
|
|
81
|
+
file: filePath,
|
|
82
|
+
line: lineNum,
|
|
83
|
+
description: 'Inline array literal creates a new reference on every render.',
|
|
84
|
+
severity: 'medium',
|
|
85
|
+
fix: 'Extract to useMemo:\nconst items = useMemo(() => [...], [deps]);',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Inline arrow functions as props: onClick={() => ...}
|
|
90
|
+
const inlineFnMatches = line.match(/on\w+=\{(?:\([^)]*\)\s*=>|[\w]+\s*=>)/g);
|
|
91
|
+
if (inlineFnMatches) {
|
|
92
|
+
inlineFunctions += inlineFnMatches.length;
|
|
93
|
+
for (const _m of inlineFnMatches) {
|
|
94
|
+
issues.push({
|
|
95
|
+
type: 'inline-function',
|
|
96
|
+
component: componentName,
|
|
97
|
+
file: filePath,
|
|
98
|
+
line: lineNum,
|
|
99
|
+
description: 'Inline function creates a new reference on every render. Use useCallback to memoize.',
|
|
100
|
+
severity: 'medium',
|
|
101
|
+
fix: 'const handler = useCallback((e) => { /* handler logic */ }, [deps]);',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Count props
|
|
106
|
+
const propsMatch = line.match(/\(\s*\{\s*([^}]+)\s*\}/);
|
|
107
|
+
if (propsMatch) {
|
|
108
|
+
propsCount = propsMatch[1].split(',').length;
|
|
109
|
+
}
|
|
110
|
+
// new Date/Object inside component
|
|
111
|
+
if (line.match(/new\s+(Date|Object|Array|Map|Set|RegExp)\(/)) {
|
|
112
|
+
issues.push({
|
|
113
|
+
type: 'new-object-prop',
|
|
114
|
+
component: componentName,
|
|
115
|
+
file: filePath,
|
|
116
|
+
line: lineNum,
|
|
117
|
+
description: 'Creating new object instance on every render. Move outside component or memoize.',
|
|
118
|
+
severity: 'low',
|
|
119
|
+
fix: 'const obj = useMemo(() => new Date(), []);',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// Context value without useMemo
|
|
123
|
+
if (line.includes('value=') && line.includes('{') && !hasUseMemo) {
|
|
124
|
+
issues.push({
|
|
125
|
+
type: 'context-value',
|
|
126
|
+
component: componentName,
|
|
127
|
+
file: filePath,
|
|
128
|
+
line: lineNum,
|
|
129
|
+
description: 'Context value object is recreated on every render. Wrap with useMemo.',
|
|
130
|
+
severity: 'high',
|
|
131
|
+
fix: 'const contextValue = useMemo(() => ({ prop1, prop2 }), [prop1, prop2]);',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Missing memo check (only flag if component has props)
|
|
136
|
+
if (!hasMemo && !content.includes('export default memo(') && propsCount > 0) {
|
|
137
|
+
issues.push({
|
|
138
|
+
type: 'missing-memo',
|
|
139
|
+
component: componentName,
|
|
140
|
+
file: filePath,
|
|
141
|
+
line: 1,
|
|
142
|
+
description: 'Component is not wrapped with React.memo. It will re-render whenever parent re-renders, even if props haven\'t changed.',
|
|
143
|
+
severity: 'medium',
|
|
144
|
+
fix: `export default memo(${componentName});`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Missing key prop in .map() renders
|
|
148
|
+
const mapMatches = [...componentBody.matchAll(/\.map\s*\(\s*(?:\([^)]*\)|[\w]+)\s*=>/g)];
|
|
149
|
+
for (const mapMatch of mapMatches) {
|
|
150
|
+
const mapIdx = mapMatch.index ?? 0;
|
|
151
|
+
const mapBlock = componentBody.slice(mapIdx, mapIdx + 300);
|
|
152
|
+
// Check if the returned JSX element has a key prop
|
|
153
|
+
if (!mapBlock.includes('key=') && mapBlock.includes('<')) {
|
|
154
|
+
const lineNum = content.slice(0, compStart + mapIdx).split('\n').length;
|
|
155
|
+
issues.push({
|
|
156
|
+
type: 'inline-function',
|
|
157
|
+
component: componentName,
|
|
158
|
+
file: filePath,
|
|
159
|
+
line: lineNum,
|
|
160
|
+
description: '.map() render missing key prop. React uses key to identify list items — missing keys cause unnecessary re-renders and reconciliation bugs.',
|
|
161
|
+
severity: 'high',
|
|
162
|
+
fix: 'Add a stable key prop to the root element: items.map((item) => <Component key={item.id} />)',
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// useEffect with no dependency array (runs on every render)
|
|
167
|
+
const effectMatches = [...componentBody.matchAll(/useEffect\s*\(\s*(?:async\s*)?\(\s*\)\s*=>/g)];
|
|
168
|
+
for (const effectMatch of effectMatches) {
|
|
169
|
+
const effectIdx = effectMatch.index ?? 0;
|
|
170
|
+
const effectBlock = componentBody.slice(effectIdx, effectIdx + 200);
|
|
171
|
+
// If no closing ", [" or ", []" pattern → missing deps array
|
|
172
|
+
if (!effectBlock.includes(', [') && !effectBlock.includes(',[')) {
|
|
173
|
+
const lineNum = content.slice(0, compStart + effectIdx).split('\n').length;
|
|
174
|
+
issues.push({
|
|
175
|
+
type: 'missing-usecallback',
|
|
176
|
+
component: componentName,
|
|
177
|
+
file: filePath,
|
|
178
|
+
line: lineNum,
|
|
179
|
+
description: 'useEffect missing dependency array — runs on every render. This is likely a bug or performance issue.',
|
|
180
|
+
severity: 'high',
|
|
181
|
+
fix: 'Add dependency array as second argument: useEffect(() => { ... }, [dep1, dep2])\nUse [] for mount-only effects.',
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { name: componentName, file: filePath, hasMemo, hasUseMemo, hasUseCallback, propsCount, inlineObjects, inlineFunctions, issues };
|
|
186
|
+
}
|
|
187
|
+
// ============================================================================
|
|
188
|
+
// MAIN SERVER
|
|
189
|
+
// ============================================================================
|
|
190
|
+
class RenderAnalyzerServer extends McpServerBase {
|
|
191
|
+
constructor() {
|
|
192
|
+
super({ name: 'render-analyzer', version: '1.0.0' });
|
|
193
|
+
}
|
|
194
|
+
registerTools() {
|
|
195
|
+
this.addTool('detect_rerenders', 'Analyze React component files for unnecessary re-render patterns: inline objects/arrays/functions, missing memo, context value issues.', {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
path: { type: 'string', description: 'Path to component file or directory to analyze' },
|
|
199
|
+
severity: { type: 'string', enum: ['high', 'medium', 'low', 'all'], description: 'Minimum severity to report (default: all)' },
|
|
200
|
+
},
|
|
201
|
+
required: ['path'],
|
|
202
|
+
}, (args) => this.handleDetectRerenders(args));
|
|
203
|
+
this.addTool('check_memo', 'Check which components are wrapped with React.memo, use useMemo, or useCallback — and which are not.', {
|
|
204
|
+
type: 'object',
|
|
205
|
+
properties: {
|
|
206
|
+
path: { type: 'string', description: 'Path to component file or directory' },
|
|
207
|
+
},
|
|
208
|
+
required: ['path'],
|
|
209
|
+
}, (args) => this.handleCheckMemo(args));
|
|
210
|
+
this.addTool('analyze_props', 'Find components that pass inline objects or functions as props — the most common cause of unnecessary child re-renders.', {
|
|
211
|
+
type: 'object',
|
|
212
|
+
properties: {
|
|
213
|
+
path: { type: 'string', description: 'Path to component file or directory' },
|
|
214
|
+
},
|
|
215
|
+
required: ['path'],
|
|
216
|
+
}, (args) => this.handleAnalyzeProps(args));
|
|
217
|
+
}
|
|
218
|
+
async handleDetectRerenders(args) {
|
|
219
|
+
const { path: targetPath, severity = 'all' } = args;
|
|
220
|
+
try {
|
|
221
|
+
const stat = fs.statSync(targetPath);
|
|
222
|
+
const files = stat.isDirectory() ? scanDirectory(targetPath) : [targetPath];
|
|
223
|
+
const severityOrder = { high: 0, medium: 1, low: 2 };
|
|
224
|
+
const minSeverity = severityOrder[severity] ?? 2;
|
|
225
|
+
const profiles = [];
|
|
226
|
+
let totalIssues = 0;
|
|
227
|
+
for (const file of files) {
|
|
228
|
+
const content = safeReadFile(file);
|
|
229
|
+
if (content === null)
|
|
230
|
+
continue;
|
|
231
|
+
const components = extractComponents(content);
|
|
232
|
+
for (const comp of components) {
|
|
233
|
+
const profile = analyzeComponent(content, comp, file);
|
|
234
|
+
const filteredIssues = profile.issues.filter(i => severityOrder[i.severity] <= minSeverity);
|
|
235
|
+
profile.issues = filteredIssues;
|
|
236
|
+
totalIssues += filteredIssues.length;
|
|
237
|
+
profiles.push(profile);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return this.success({
|
|
241
|
+
summary: {
|
|
242
|
+
totalComponents: profiles.length,
|
|
243
|
+
totalIssues,
|
|
244
|
+
componentsWithIssues: profiles.filter(p => p.issues.length > 0).length,
|
|
245
|
+
},
|
|
246
|
+
profiles: profiles.filter(p => p.issues.length > 0),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
return this.error(error);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async handleCheckMemo(args) {
|
|
254
|
+
const { path: targetPath } = args;
|
|
255
|
+
try {
|
|
256
|
+
const stat = fs.statSync(targetPath);
|
|
257
|
+
const files = stat.isDirectory() ? scanDirectory(targetPath) : [targetPath];
|
|
258
|
+
const results = [];
|
|
259
|
+
let totalComponents = 0;
|
|
260
|
+
let memoizedCount = 0;
|
|
261
|
+
let useMemoCount = 0;
|
|
262
|
+
let useCallbackCount = 0;
|
|
263
|
+
for (const file of files) {
|
|
264
|
+
const content = safeReadFile(file);
|
|
265
|
+
if (content === null)
|
|
266
|
+
continue;
|
|
267
|
+
const components = extractComponents(content);
|
|
268
|
+
for (const comp of components) {
|
|
269
|
+
totalComponents++;
|
|
270
|
+
const profile = analyzeComponent(content, comp, file);
|
|
271
|
+
if (profile.hasMemo)
|
|
272
|
+
memoizedCount++;
|
|
273
|
+
if (profile.hasUseMemo)
|
|
274
|
+
useMemoCount++;
|
|
275
|
+
if (profile.hasUseCallback)
|
|
276
|
+
useCallbackCount++;
|
|
277
|
+
results.push({
|
|
278
|
+
component: comp,
|
|
279
|
+
file,
|
|
280
|
+
hasMemo: profile.hasMemo,
|
|
281
|
+
hasUseMemo: profile.hasUseMemo,
|
|
282
|
+
hasUseCallback: profile.hasUseCallback,
|
|
283
|
+
propsCount: profile.propsCount,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return this.success({
|
|
288
|
+
summary: {
|
|
289
|
+
totalComponents,
|
|
290
|
+
memoized: memoizedCount,
|
|
291
|
+
notMemoized: totalComponents - memoizedCount,
|
|
292
|
+
useMemoUsage: useMemoCount,
|
|
293
|
+
useCallbackUsage: useCallbackCount,
|
|
294
|
+
memoizationRate: totalComponents > 0 ? Math.round((memoizedCount / totalComponents) * 100) : 100,
|
|
295
|
+
},
|
|
296
|
+
components: results,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
return this.error(error);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async handleAnalyzeProps(args) {
|
|
304
|
+
const { path: targetPath } = args;
|
|
305
|
+
try {
|
|
306
|
+
const stat = fs.statSync(targetPath);
|
|
307
|
+
const files = stat.isDirectory() ? scanDirectory(targetPath) : [targetPath];
|
|
308
|
+
const results = [];
|
|
309
|
+
for (const file of files) {
|
|
310
|
+
const content = safeReadFile(file);
|
|
311
|
+
if (content === null)
|
|
312
|
+
continue;
|
|
313
|
+
const components = extractComponents(content);
|
|
314
|
+
for (const comp of components) {
|
|
315
|
+
const profile = analyzeComponent(content, comp, file);
|
|
316
|
+
if (profile.inlineObjects > 0 || profile.inlineFunctions > 0) {
|
|
317
|
+
results.push({
|
|
318
|
+
component: comp,
|
|
319
|
+
file,
|
|
320
|
+
inlineObjects: profile.inlineObjects,
|
|
321
|
+
inlineFunctions: profile.inlineFunctions,
|
|
322
|
+
propsCount: profile.propsCount,
|
|
323
|
+
issues: profile.issues.filter(i => ['inline-object', 'inline-array', 'inline-function'].includes(i.type)),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return this.success({
|
|
329
|
+
componentsWithPropIssues: results.length,
|
|
330
|
+
results,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
return this.error(error);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// ============================================================================
|
|
339
|
+
// ENTRY POINT
|
|
340
|
+
// ============================================================================
|
|
341
|
+
new RenderAnalyzerServer().run().catch(console.error);
|
|
342
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AA4B7B,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,cAAc,EAAE;YAAE,SAAS;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC7G,KAAK,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,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,OAAO,CAAC,UAAU;4BAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;yBAC1G,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,wBAAwB,EAAE,OAAO,CAAC,MAAM;gBACxC,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAED,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,IAAI,oBAAoB,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcp-showcase/render-analyzer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc && chmod +x build/index.js",
|
|
8
|
+
"dev": "tsc --watch",
|
|
9
|
+
"test": "vitest run"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@mcp-showcase/shared": "*",
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^20.0.0",
|
|
17
|
+
"typescript": "^5.0.0",
|
|
18
|
+
"vitest": "^2.0.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const MAX_FILE_BYTES: number;
|
|
2
|
+
export declare const DEFAULT_SKIP_DIRS: Set<string>;
|
|
3
|
+
export declare function safeReadJson<T>(filePath: string): T | null;
|
|
4
|
+
export declare function safeReadFile(filePath: string): string | null;
|
|
5
|
+
export declare function isNextJsProject(dir: string): boolean;
|
|
6
|
+
export declare const NEXTJS_ROUTE_FILES: Set<string>;
|
|
7
|
+
export declare function isServerComponent(filePath: string, content: string): boolean;
|
|
8
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAmB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,aAG5B,CAAC;AAEH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAO1D;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMpD;AAED,eAAO,MAAM,kBAAkB,aAK7B,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAI5E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
export const MAX_FILE_BYTES = 10 * 1024 * 1024; // 10 MB
|
|
4
|
+
export const DEFAULT_SKIP_DIRS = new Set([
|
|
5
|
+
'node_modules', 'build', 'dist', '.next', '.turbo', '__tests__',
|
|
6
|
+
'.git', 'coverage', '.cache', 'out', '.vercel', '.svelte-kit',
|
|
7
|
+
]);
|
|
8
|
+
export function safeReadJson(filePath) {
|
|
9
|
+
try {
|
|
10
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
11
|
+
return JSON.parse(raw);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function safeReadFile(filePath) {
|
|
18
|
+
try {
|
|
19
|
+
const stat = fs.statSync(filePath);
|
|
20
|
+
if (stat.size > MAX_FILE_BYTES)
|
|
21
|
+
return null;
|
|
22
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function isNextJsProject(dir) {
|
|
29
|
+
return (fs.existsSync(path.join(dir, 'next.config.js')) ||
|
|
30
|
+
fs.existsSync(path.join(dir, 'next.config.ts')) ||
|
|
31
|
+
fs.existsSync(path.join(dir, 'next.config.mjs')));
|
|
32
|
+
}
|
|
33
|
+
export const NEXTJS_ROUTE_FILES = new Set([
|
|
34
|
+
'page.tsx', 'page.ts', 'layout.tsx', 'layout.ts',
|
|
35
|
+
'loading.tsx', 'loading.ts', 'error.tsx', 'error.ts',
|
|
36
|
+
'not-found.tsx', 'not-found.ts', 'template.tsx', 'template.ts',
|
|
37
|
+
'route.ts', 'route.tsx',
|
|
38
|
+
]);
|
|
39
|
+
export function isServerComponent(filePath, content) {
|
|
40
|
+
const name = path.basename(filePath);
|
|
41
|
+
if (!NEXTJS_ROUTE_FILES.has(name))
|
|
42
|
+
return false;
|
|
43
|
+
return !content.includes("'use client'") && !content.includes('"use client"');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IA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AE,YAAY,EAAE,WAAW,EAAE,UAAU;IACpD,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa;IAC9D,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC;AAEH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,OAAe;IACjE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAChD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { McpServerBase } from './McpServerBase.js';
|
|
3
3
|
export { ToolRegistry } from './ToolRegistry.js';
|
|
4
|
+
export { safeReadJson, safeReadFile, isNextJsProject, isServerComponent, NEXTJS_ROUTE_FILES, DEFAULT_SKIP_DIRS, MAX_FILE_BYTES, } from './fs.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { McpServerBase } from './McpServerBase.js';
|
|
3
3
|
export { ToolRegistry } from './ToolRegistry.js';
|
|
4
|
+
export { safeReadJson, safeReadFile, isNextJsProject, isServerComponent, NEXTJS_ROUTE_FILES, DEFAULT_SKIP_DIRS, MAX_FILE_BYTES, } from './fs.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
"build": "tsc",
|
|
14
14
|
"dev": "tsc --watch"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
16
|
+
"peerDependencies": {
|
|
17
17
|
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
20
21
|
"@types/node": "^20.0.0",
|
|
21
22
|
"typescript": "^5.0.0"
|
|
22
23
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# storybook-generator
|
|
2
|
+
|
|
3
|
+
MCP server that auto-generates comprehensive Storybook stories for React components — Default, Playground, per-variant, per-size, callbacks, accessibility, and interactive play functions.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
| Tool | What it does |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `generate_stories` | Generate `.stories.tsx` for a component file or directory |
|
|
10
|
+
| `check_story_coverage` | Report which components have stories and which don't |
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
# Generate stories for a single component
|
|
16
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"generate_stories","arguments":{"path":"src/components/Button.tsx"}}}' \
|
|
17
|
+
| node build/index.js
|
|
18
|
+
|
|
19
|
+
# Check coverage across a directory
|
|
20
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"check_story_coverage","arguments":{"path":"src/components"}}}' \
|
|
21
|
+
| node build/index.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Generated stories include
|
|
25
|
+
|
|
26
|
+
- `Default` — basic render with sensible defaults
|
|
27
|
+
- `Playground` — full `argTypes` enabling Storybook controls
|
|
28
|
+
- Per-variant stories (extracted from union types or `cva()`)
|
|
29
|
+
- Per-size stories
|
|
30
|
+
- `Disabled` / `Loading` states (when props exist)
|
|
31
|
+
- `WithCallbacks` — `vi.fn()` handlers shown in Actions panel
|
|
32
|
+
- `play` function for interactive components (button, input)
|
|
33
|
+
|
|
34
|
+
## Build & test
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm run build
|
|
38
|
+
npm test
|
|
39
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface PropField {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
optional: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function extractPropsInterface(content: string, componentName: string): PropField[];
|
|
8
|
+
export declare function extractVariantValues(content: string, key: 'variant' | 'size'): string[];
|
|
9
|
+
export declare function propTypeToControl(propType: string): string;
|
|
10
|
+
export declare function generateArgTypes(props: PropField[]): string;
|
|
11
|
+
export declare function getMockValue(propName: string, propType: string, componentName: string): string | null;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AA2CD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE,CAqBzF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,CAwBvF;AAoCD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAY3D;AAMD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwDrG"}
|