fix: reject whitespace-only command/field values in CI validators, add 10 tests

validate-hooks.js: whitespace-only command strings now fail validation
validate-agents.js: whitespace-only model/tools values now fail validation
This commit is contained in:
Affaan Mustafa
2026-02-13 02:09:22 -08:00
parent 5398ac793d
commit 2dbba8877b
3 changed files with 150 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ function validateAgents() {
}
for (const field of REQUIRED_FIELDS) {
if (!frontmatter[field]) {
if (!frontmatter[field] || (typeof frontmatter[field] === 'string' && !frontmatter[field].trim())) {
console.error(`ERROR: ${file} - Missing required field: ${field}`);
hasErrors = true;
}

View File

@@ -34,7 +34,7 @@ function validateHookEntry(hook, label) {
hasErrors = true;
}
if (!hook.command || (typeof hook.command !== 'string' && !Array.isArray(hook.command))) {
if (!hook.command || (typeof hook.command !== 'string' && !Array.isArray(hook.command)) || (typeof hook.command === 'string' && !hook.command.trim())) {
console.error(`ERROR: ${label} missing or invalid 'command' field`);
hasErrors = true;
} else if (typeof hook.command === 'string') {