multisite-cms-mcp 1.0.23 → 1.0.25
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-manifest.d.ts","sourceRoot":"","sources":["../../src/tools/validate-manifest.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"validate-manifest.d.ts","sourceRoot":"","sources":["../../src/tools/validate-manifest.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0Q5E"}
|
|
@@ -49,15 +49,59 @@ async function validateManifest(manifestJson) {
|
|
|
49
49
|
manifest = JSON.parse(manifestJson);
|
|
50
50
|
}
|
|
51
51
|
catch (e) {
|
|
52
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to parse JSON';
|
|
53
|
+
// Provide more specific diagnostics for common JSON errors
|
|
54
|
+
let diagnostics = '';
|
|
55
|
+
const trimmed = manifestJson.trim();
|
|
56
|
+
// Check for missing closing brace
|
|
57
|
+
if (!trimmed.endsWith('}')) {
|
|
58
|
+
diagnostics = `
|
|
59
|
+
🔍 Detected Issue: File does not end with a closing brace '}'
|
|
60
|
+
The manifest.json appears to be truncated or missing the final '}'.
|
|
61
|
+
|
|
62
|
+
Fix: Add a closing '}' at the end of the file.`;
|
|
63
|
+
}
|
|
64
|
+
// Check for missing opening brace
|
|
65
|
+
else if (!trimmed.startsWith('{')) {
|
|
66
|
+
diagnostics = `
|
|
67
|
+
🔍 Detected Issue: File does not start with an opening brace '{'
|
|
68
|
+
The manifest.json must be a JSON object starting with '{'.`;
|
|
69
|
+
}
|
|
70
|
+
// Check bracket balance
|
|
71
|
+
else {
|
|
72
|
+
const openBraces = (manifestJson.match(/{/g) || []).length;
|
|
73
|
+
const closeBraces = (manifestJson.match(/}/g) || []).length;
|
|
74
|
+
const openBrackets = (manifestJson.match(/\[/g) || []).length;
|
|
75
|
+
const closeBrackets = (manifestJson.match(/]/g) || []).length;
|
|
76
|
+
if (openBraces !== closeBraces) {
|
|
77
|
+
diagnostics = `
|
|
78
|
+
🔍 Detected Issue: Mismatched braces
|
|
79
|
+
Found ${openBraces} opening '{' but ${closeBraces} closing '}'
|
|
80
|
+
${openBraces > closeBraces ? `Missing ${openBraces - closeBraces} closing brace(s) '}'` : `Extra ${closeBraces - openBraces} closing brace(s) '}'`}`;
|
|
81
|
+
}
|
|
82
|
+
else if (openBrackets !== closeBrackets) {
|
|
83
|
+
diagnostics = `
|
|
84
|
+
🔍 Detected Issue: Mismatched brackets
|
|
85
|
+
Found ${openBrackets} opening '[' but ${closeBrackets} closing ']'
|
|
86
|
+
${openBrackets > closeBrackets ? `Missing ${openBrackets - closeBrackets} closing bracket(s) ']'` : `Extra ${closeBrackets - openBrackets} closing bracket(s) ']'`}`;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Generic guidance
|
|
90
|
+
diagnostics = `
|
|
91
|
+
🔍 Common JSON issues to check:
|
|
92
|
+
- Missing or extra commas between items
|
|
93
|
+
- Trailing comma after last item in arrays/objects
|
|
94
|
+
- Unquoted property names (must use "key" not key)
|
|
95
|
+
- Single quotes instead of double quotes
|
|
96
|
+
- Unescaped special characters in strings`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
52
99
|
return `❌ INVALID JSON
|
|
53
100
|
|
|
54
|
-
Error: ${
|
|
101
|
+
Error: ${errorMessage}
|
|
102
|
+
${diagnostics}
|
|
55
103
|
|
|
56
|
-
|
|
57
|
-
- Missing or extra commas
|
|
58
|
-
- Unquoted keys
|
|
59
|
-
- Single quotes instead of double quotes
|
|
60
|
-
- Trailing commas after last item in arrays/objects`;
|
|
104
|
+
💡 Tip: Use a JSON validator (like jsonlint.com) to find the exact error location.`;
|
|
61
105
|
}
|
|
62
106
|
// Validate against schema
|
|
63
107
|
const result = manifestSchema.safeParse(manifest);
|
package/package.json
CHANGED