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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { McpServerBase } from './McpServerBase.js';
|
|
3
|
+
export { ToolRegistry } from './ToolRegistry.js';
|
|
4
|
+
export { safeReadJson, safeReadFile, isNextJsProject, isServerComponent, NEXTJS_ROUTE_FILES, DEFAULT_SKIP_DIRS, MAX_FILE_BYTES, } from './fs.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, SchemaProperty>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface SchemaProperty {
|
|
11
|
+
type: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
default?: unknown;
|
|
14
|
+
enum?: string[];
|
|
15
|
+
items?: SchemaProperty;
|
|
16
|
+
properties?: Record<string, SchemaProperty>;
|
|
17
|
+
}
|
|
18
|
+
export interface ToolResult {
|
|
19
|
+
content: ToolContent[];
|
|
20
|
+
isError?: boolean;
|
|
21
|
+
_meta?: Record<string, unknown>;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface ToolContent {
|
|
25
|
+
type: 'text' | 'image' | 'resource';
|
|
26
|
+
text?: string;
|
|
27
|
+
data?: string;
|
|
28
|
+
mimeType?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ServerConfig {
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
capabilities?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export type ToolHandler = (args: unknown) => Promise<ToolResult>;
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAC3C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcp-showcase/shared",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./build/index.js",
|
|
8
|
+
"types": "./build/index.d.ts"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"main": "./build/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "tsc --watch"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"typescript": "^5.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// MCP SERVER BASE - Abstract base class for all MCP servers
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
6
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
7
|
+
import {
|
|
8
|
+
CallToolRequestSchema,
|
|
9
|
+
ErrorCode,
|
|
10
|
+
ListToolsRequestSchema,
|
|
11
|
+
McpError,
|
|
12
|
+
} from '@modelcontextprotocol/sdk/types.js';
|
|
13
|
+
import { ToolRegistry } from './ToolRegistry.js';
|
|
14
|
+
import type { ServerConfig, ToolDefinition, ToolHandler, ToolResult } from './types.js';
|
|
15
|
+
|
|
16
|
+
export abstract class McpServerBase {
|
|
17
|
+
protected server: Server;
|
|
18
|
+
protected registry: ToolRegistry;
|
|
19
|
+
protected config: ServerConfig;
|
|
20
|
+
|
|
21
|
+
constructor(config: ServerConfig) {
|
|
22
|
+
this.config = config;
|
|
23
|
+
this.registry = new ToolRegistry();
|
|
24
|
+
|
|
25
|
+
this.server = new Server(
|
|
26
|
+
{ name: config.name, version: config.version },
|
|
27
|
+
{ capabilities: { tools: {} } }
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
this.setupHandlers();
|
|
31
|
+
this.setupErrorHandlers();
|
|
32
|
+
this.registerTools();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected abstract registerTools(): void;
|
|
36
|
+
|
|
37
|
+
protected addTool(
|
|
38
|
+
name: string,
|
|
39
|
+
description: string,
|
|
40
|
+
inputSchema: ToolDefinition['inputSchema'],
|
|
41
|
+
handler: ToolHandler
|
|
42
|
+
): void {
|
|
43
|
+
this.registry.register(name, description, inputSchema, handler);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private setupHandlers(): void {
|
|
47
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
48
|
+
tools: this.registry.getAllDefinitions(),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
52
|
+
const { name, arguments: args } = request.params;
|
|
53
|
+
const handler = this.registry.getHandler(name);
|
|
54
|
+
if (!handler) {
|
|
55
|
+
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
return await handler(args);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error instanceof McpError) throw error;
|
|
61
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
62
|
+
throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${message}`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private setupErrorHandlers(): void {
|
|
68
|
+
this.server.onerror = (error) => {
|
|
69
|
+
console.error(`[${this.config.name}] MCP Error:`, error);
|
|
70
|
+
};
|
|
71
|
+
process.on('SIGINT', async () => {
|
|
72
|
+
await this.shutdown();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected success<T extends Record<string, unknown>>(data: T): ToolResult {
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: 'text', text: JSON.stringify({ success: true, ...data }, null, 2) }],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected error(error: unknown): ToolResult {
|
|
83
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: 'text', text: JSON.stringify({ success: false, error: msg }, null, 2) }],
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async run(): Promise<void> {
|
|
91
|
+
const transport = new StdioServerTransport();
|
|
92
|
+
await this.server.connect(transport);
|
|
93
|
+
console.error(`${this.config.name} MCP server v${this.config.version} running on stdio`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async shutdown(): Promise<void> {
|
|
97
|
+
await this.server.close();
|
|
98
|
+
process.exit(0);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// TOOL REGISTRY - Tool registration and lookup helper
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import type { ToolDefinition, ToolHandler } from './types.js';
|
|
6
|
+
|
|
7
|
+
interface RegisteredTool {
|
|
8
|
+
definition: ToolDefinition;
|
|
9
|
+
handler: ToolHandler;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class ToolRegistry {
|
|
13
|
+
private tools: Map<string, RegisteredTool> = new Map();
|
|
14
|
+
|
|
15
|
+
register(
|
|
16
|
+
name: string,
|
|
17
|
+
description: string,
|
|
18
|
+
inputSchema: ToolDefinition['inputSchema'],
|
|
19
|
+
handler: ToolHandler
|
|
20
|
+
): void {
|
|
21
|
+
if (this.tools.has(name)) {
|
|
22
|
+
throw new Error(`Tool already registered: ${name}`);
|
|
23
|
+
}
|
|
24
|
+
this.tools.set(name, { definition: { name, description, inputSchema }, handler });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getHandler(name: string): ToolHandler | undefined {
|
|
28
|
+
return this.tools.get(name)?.handler;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getAllDefinitions(): ToolDefinition[] {
|
|
32
|
+
return Array.from(this.tools.values()).map(t => t.definition);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
has(name: string): boolean {
|
|
36
|
+
return this.tools.has(name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
export const MAX_FILE_BYTES = 10 * 1024 * 1024; // 10 MB
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_SKIP_DIRS = new Set([
|
|
7
|
+
'node_modules', 'build', 'dist', '.next', '.turbo', '__tests__',
|
|
8
|
+
'.git', 'coverage', '.cache', 'out', '.vercel', '.svelte-kit',
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export function safeReadJson<T>(filePath: string): T | null {
|
|
12
|
+
try {
|
|
13
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
14
|
+
return JSON.parse(raw) as T;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function safeReadFile(filePath: string): string | null {
|
|
21
|
+
try {
|
|
22
|
+
const stat = fs.statSync(filePath);
|
|
23
|
+
if (stat.size > MAX_FILE_BYTES) return null;
|
|
24
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isNextJsProject(dir: string): boolean {
|
|
31
|
+
return (
|
|
32
|
+
fs.existsSync(path.join(dir, 'next.config.js')) ||
|
|
33
|
+
fs.existsSync(path.join(dir, 'next.config.ts')) ||
|
|
34
|
+
fs.existsSync(path.join(dir, 'next.config.mjs'))
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const NEXTJS_ROUTE_FILES = new Set([
|
|
39
|
+
'page.tsx', 'page.ts', 'layout.tsx', 'layout.ts',
|
|
40
|
+
'loading.tsx', 'loading.ts', 'error.tsx', 'error.ts',
|
|
41
|
+
'not-found.tsx', 'not-found.ts', 'template.tsx', 'template.ts',
|
|
42
|
+
'route.ts', 'route.tsx',
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
export function isServerComponent(filePath: string, content: string): boolean {
|
|
46
|
+
const name = path.basename(filePath);
|
|
47
|
+
if (!NEXTJS_ROUTE_FILES.has(name)) return false;
|
|
48
|
+
return !content.includes("'use client'") && !content.includes('"use client"');
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { McpServerBase } from './McpServerBase.js';
|
|
3
|
+
export { ToolRegistry } from './ToolRegistry.js';
|
|
4
|
+
export {
|
|
5
|
+
safeReadJson,
|
|
6
|
+
safeReadFile,
|
|
7
|
+
isNextJsProject,
|
|
8
|
+
isServerComponent,
|
|
9
|
+
NEXTJS_ROUTE_FILES,
|
|
10
|
+
DEFAULT_SKIP_DIRS,
|
|
11
|
+
MAX_FILE_BYTES,
|
|
12
|
+
} from './fs.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// MCP TYPES - Common types for all MCP tools
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
export interface ToolDefinition {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object';
|
|
10
|
+
properties: Record<string, SchemaProperty>;
|
|
11
|
+
required?: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SchemaProperty {
|
|
16
|
+
type: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
default?: unknown;
|
|
19
|
+
enum?: string[];
|
|
20
|
+
items?: SchemaProperty;
|
|
21
|
+
properties?: Record<string, SchemaProperty>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ToolResult {
|
|
25
|
+
content: ToolContent[];
|
|
26
|
+
isError?: boolean;
|
|
27
|
+
_meta?: Record<string, unknown>;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ToolContent {
|
|
32
|
+
type: 'text' | 'image' | 'resource';
|
|
33
|
+
text?: string;
|
|
34
|
+
data?: string;
|
|
35
|
+
mimeType?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ServerConfig {
|
|
39
|
+
name: string;
|
|
40
|
+
version: string;
|
|
41
|
+
capabilities?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ToolHandler = (args: unknown) => Promise<ToolResult>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-react-toolkit",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"mcpName": "io.github.Nishant-Chaudhary5338/mcp-react-toolkit",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "17 MCP servers for React + TypeScript development automation — component scaffolding, dep auditing, WCAG checking, test generation, TypeScript enforcement, render analysis, performance audit, Lighthouse, Storybook generation, legacy app analysis, component review/fix, and monorepo management.",
|
|
6
6
|
"keywords": ["mcp", "mcp-server", "model-context-protocol", "react", "typescript", "developer-tools", "claude", "ai-tools"],
|
|
7
7
|
"author": "Nishant Chaudhary <nishantchaudhary.dev@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -13,6 +13,22 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"mcp-react-toolkit": "bin/cli.mjs"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/**",
|
|
21
|
+
"tools/*/build/**",
|
|
22
|
+
"tools/*/templates/**",
|
|
23
|
+
"tools/*/package.json",
|
|
24
|
+
"!tools/**/*.test.js",
|
|
25
|
+
"!tools/**/*.test.d.ts",
|
|
26
|
+
"!tools/**/*.test.js.map",
|
|
27
|
+
"!tools/**/*.test.d.ts.map",
|
|
28
|
+
"README.md",
|
|
29
|
+
"HOW_IT_WORKS.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
16
32
|
"workspaces": [
|
|
17
33
|
"tools/shared",
|
|
18
34
|
"tools/json-viewer",
|
|
@@ -24,15 +40,33 @@
|
|
|
24
40
|
"tools/generate-tests",
|
|
25
41
|
"tools/typescript-enforcer",
|
|
26
42
|
"tools/monorepo-manager",
|
|
43
|
+
"tools/render-analyzer",
|
|
44
|
+
"tools/storybook-generator",
|
|
45
|
+
"tools/performance-audit",
|
|
46
|
+
"tools/lighthouse-runner",
|
|
47
|
+
"tools/test-gap-analyzer",
|
|
48
|
+
"tools/component-reviewer",
|
|
49
|
+
"tools/component-fixer",
|
|
50
|
+
"tools/legacy-analyzer",
|
|
27
51
|
"server",
|
|
28
52
|
"client"
|
|
29
53
|
],
|
|
30
54
|
"scripts": {
|
|
31
|
-
"build": "npm run build -w tools/shared && npm run build -w tools/json-viewer && npm run build -w tools/component-factory && npm run build -w tools/code-modernizer && npm run build -w tools/quality-pipeline && npm run build -w tools/dep-auditor && npm run build -w tools/accessibility-checker && npm run build -w tools/generate-tests && npm run build -w tools/typescript-enforcer && npm run build -w tools/monorepo-manager && npm run build -w server",
|
|
55
|
+
"build": "npm run build -w tools/shared && npm run build -w tools/json-viewer && npm run build -w tools/component-factory && npm run build -w tools/code-modernizer && npm run build -w tools/quality-pipeline && npm run build -w tools/dep-auditor && npm run build -w tools/accessibility-checker && npm run build -w tools/generate-tests && npm run build -w tools/typescript-enforcer && npm run build -w tools/monorepo-manager && npm run build -w tools/render-analyzer && npm run build -w tools/storybook-generator && npm run build -w tools/performance-audit && npm run build -w tools/lighthouse-runner && npm run build -w tools/test-gap-analyzer && npm run build -w tools/component-reviewer && npm run build -w tools/component-fixer && npm run build -w tools/legacy-analyzer && npm run build -w server",
|
|
32
56
|
"dev": "concurrently \"npm run dev -w server\" \"npm run dev -w client\"",
|
|
33
|
-
"test": "npm run test -w tools/json-viewer && npm run test -w tools/quality-pipeline && npm run test -w tools/component-factory && npm run test -w tools/code-modernizer && npm run test -w tools/dep-auditor && npm run test -w tools/accessibility-checker && npm run test -w tools/generate-tests && npm run test -w tools/typescript-enforcer && npm run test -w tools/monorepo-manager",
|
|
57
|
+
"test": "npm run test -w tools/json-viewer && npm run test -w tools/quality-pipeline && npm run test -w tools/component-factory && npm run test -w tools/code-modernizer && npm run test -w tools/dep-auditor && npm run test -w tools/accessibility-checker && npm run test -w tools/generate-tests && npm run test -w tools/typescript-enforcer && npm run test -w tools/monorepo-manager && npm run test -w tools/render-analyzer && npm run test -w tools/storybook-generator && npm run test -w tools/performance-audit && npm run test -w tools/lighthouse-runner && npm run test -w tools/test-gap-analyzer && npm run test -w tools/component-reviewer && npm run test -w tools/component-fixer && npm run test -w tools/legacy-analyzer",
|
|
34
58
|
"install:all": "npm install"
|
|
35
59
|
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@mcp-showcase/shared": "1.0.0",
|
|
62
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
63
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
64
|
+
"fs-extra": "^11.2.0",
|
|
65
|
+
"glob": "^10.3.10"
|
|
66
|
+
},
|
|
67
|
+
"bundleDependencies": [
|
|
68
|
+
"@mcp-showcase/shared"
|
|
69
|
+
],
|
|
36
70
|
"devDependencies": {
|
|
37
71
|
"concurrently": "^8.2.2"
|
|
38
72
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { McpServerBase } from '@mcp-showcase/shared';
|
|
2
|
+
import { McpServerBase, safeReadFile } from '@mcp-showcase/shared';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { analyzeFile, filterByImpact } from './rules.js';
|
|
@@ -7,8 +7,10 @@ function scanDirectory(dir, exts = ['.tsx', '.jsx', '.html']) {
|
|
|
7
7
|
const files = [];
|
|
8
8
|
if (!fs.existsSync(dir))
|
|
9
9
|
return files;
|
|
10
|
-
const SKIP = new Set(['node_modules', 'build', 'dist', '.next', '__tests__']);
|
|
10
|
+
const SKIP = new Set(['node_modules', 'build', 'dist', '.next', '.turbo', '__tests__', '.git', 'coverage', 'out']);
|
|
11
11
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
12
|
+
if (entry.isSymbolicLink())
|
|
13
|
+
continue;
|
|
12
14
|
const fullPath = path.join(dir, entry.name);
|
|
13
15
|
if (entry.isDirectory()) {
|
|
14
16
|
if (SKIP.has(entry.name))
|
|
@@ -17,8 +19,7 @@ function scanDirectory(dir, exts = ['.tsx', '.jsx', '.html']) {
|
|
|
17
19
|
}
|
|
18
20
|
else if (exts.some(e => entry.name.endsWith(e)) &&
|
|
19
21
|
!entry.name.includes('.test.') &&
|
|
20
|
-
!entry.name.includes('.spec.')
|
|
21
|
-
!entry.name.includes('.stories.')) {
|
|
22
|
+
!entry.name.includes('.spec.')) {
|
|
22
23
|
files.push(fullPath);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -29,7 +30,10 @@ function readAndAnalyze(targetPath) {
|
|
|
29
30
|
const files = stat.isDirectory() ? scanDirectory(targetPath) : [targetPath];
|
|
30
31
|
const issues = [];
|
|
31
32
|
for (const file of files) {
|
|
32
|
-
|
|
33
|
+
const content = safeReadFile(file);
|
|
34
|
+
if (content === null)
|
|
35
|
+
continue;
|
|
36
|
+
issues.push(...analyzeFile(file, content));
|
|
33
37
|
}
|
|
34
38
|
return { files, issues };
|
|
35
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
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;AAC7B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGzD,SAAS,aAAa,CAAC,GAAW,EAAE,OAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;IAC5E,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QA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AC;gBAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;YACzG,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,IAAI,0BAA0B,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,KAAK,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;AAEhE,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU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