@loggi87/mcp-custom-xs 1.0.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 (2) hide show
  1. package/index.js +56 -0
  2. package/package.json +14 -0
package/index.js ADDED
@@ -0,0 +1,56 @@
1
+ // index.js - MCP Server
2
+ const fs = require("fs");
3
+
4
+ class CodeRulesMCP {
5
+ constructor() {
6
+ this.rules = {
7
+ max_lines_per_file: 80,
8
+ architecture: "atomic",
9
+ project_structure: "feature-based",
10
+ typescript_strict: true,
11
+ run_tsc_before_finish: true
12
+ };
13
+ }
14
+
15
+ // Valida un archivo
16
+ validateFile(filePath) {
17
+ const content = fs.readFileSync(filePath, "utf-8");
18
+ const lines = content.split("\n").length;
19
+
20
+ const errors = [];
21
+
22
+ // Validar líneas
23
+ if (lines > this.rules.max_lines_per_file) {
24
+ errors.push(`❌ ${lines} líneas (máx ${this.rules.max_lines_per_file})`);
25
+ }
26
+
27
+ // Validar TypeScript strict
28
+ if (!content.includes('// @ts-check')) {
29
+ errors.push("❌ Falta // @ts-check para TypeScript strict");
30
+ }
31
+
32
+ // Validar estructura atómica
33
+ if (filePath.includes("components")) {
34
+ const validDirs = ["/atoms/", "/molecules/", "/organisms/"];
35
+ if (!validDirs.some((dir) => filePath.includes(dir))) {
36
+ errors.push("❌ Componente no está en atomic/molecules/organisms");
37
+ }
38
+ }
39
+
40
+ return {
41
+ valid: errors.length === 0,
42
+ errors,
43
+ suggestions: this.getSuggestions(errors)
44
+ };
45
+ }
46
+
47
+ getSuggestions(errors) {
48
+ return {
49
+ tooManyLines: "Divide en múltiples archivos más pequeños",
50
+ noTypeScript: "Agrega strict mode a tsconfig.json",
51
+ wrongFolder: "Mueve a la carpeta de atomic design correcta"
52
+ };
53
+ }
54
+ }
55
+
56
+ module.exports = new CodeRulesMCP();
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@loggi87/mcp-custom-xs",
3
+ "version": "1.0.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "main": "index.js",
8
+ "description": "MCP con reglas: 80 líneas, atomic, TypeScript strict",
9
+ "keywords": [
10
+ "mcp",
11
+ "rules",
12
+ "atomic-design"
13
+ ]
14
+ }