MCPcopy Create free account
hub / github.com/aghyad97/browserytools / validateTools

Function validateTools

scripts/validate-tools.js:168–289  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 }
167 }
168
169 return tools;
170 } catch (error) {
171 logError(`Failed to load README: ${error.message}`);
172 process.exit(1);
173 }
174}
175
176// Validate tools
177function validateTools() {
178 logInfo("🔍 Validating tools list...\n");
179
180 const configTools = loadToolsConfig();
181 const readmeTools = loadReadmeTools();
182
183 // Flatten config tools for easier comparison
184 const configToolsFlat = [];
185 configTools.forEach((category) => {
186 category.items.forEach((tool) => {
187 configToolsFlat.push({
188 name: tool.name,
189 category: category.category,
190 available: tool.available,
191 });
192 });
193 });
194
195 let errors = 0;
196 let warnings = 0;
197
198 // Check for tools in README that are not in config
199 logInfo("Checking for tools in README that are not in config...");
200 const readmeToolNames = readmeTools.map((t) => t.name);
201 const configToolNames = configToolsFlat.map((t) => t.name);
202
203 const extraInReadme = readmeToolNames.filter(
204 (name) => !configToolNames.includes(name)
205 );
206 if (extraInReadme.length > 0) {
207 logError(`Tools in README but not in config: ${extraInReadme.join(", ")}`);
208 errors++;
209 }
210
211 // Check for tools in config that are not in README
212 logInfo("Checking for tools in config that are not in README...");
213 const missingInReadme = configToolNames.filter(
214 (name) => !readmeToolNames.includes(name)
215 );
216 if (missingInReadme.length > 0) {
217 logError(
218 `Tools in config but not in README: ${missingInReadme.join(", ")}`
219 );
220 errors++;
221 }
222
223 // Check for category mismatches
224 logInfo("Checking for category mismatches...");
225 const categoryMismatches = [];

Callers 2

test-validation.jsFile · 0.85
validate-tools.jsFile · 0.85

Calls 12

logInfoFunction · 0.85
loadToolsConfigFunction · 0.85
loadReadmeToolsFunction · 0.85
logErrorFunction · 0.85
logWarningFunction · 0.85
logFunction · 0.85
logSuccessFunction · 0.85
mapMethod · 0.80
findMethod · 0.80
forEachMethod · 0.45
pushMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected