()
| 358 | // ── Main ────────────────────────────────────────────────────────────────────── |
| 359 | |
| 360 | function main() { |
| 361 | if (!fs.existsSync(SKILLS_DIR)) { |
| 362 | console.error(`Error: skills/ directory not found at ${SKILLS_DIR}`); |
| 363 | console.error('Is this script running from inside a Citadel installation?'); |
| 364 | process.exit(1); |
| 365 | } |
| 366 | |
| 367 | let skillNames = discoverSkills(); |
| 368 | |
| 369 | if (skillNames.length === 0) { |
| 370 | console.log('No skills found in skills/. Nothing to lint.'); |
| 371 | process.exit(0); |
| 372 | } |
| 373 | |
| 374 | // Filter to a single skill if requested |
| 375 | if (SKILL_FILTER) { |
| 376 | skillNames = skillNames.filter(n => n === SKILL_FILTER || n.includes(SKILL_FILTER)); |
| 377 | if (skillNames.length === 0) { |
| 378 | console.error(`No skill found matching "${SKILL_FILTER}". Available: ${discoverSkills().join(', ')}`); |
| 379 | process.exit(1); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | const skillResults = skillNames.map(lintSkill); |
| 384 | |
| 385 | if (JSON_MODE) { |
| 386 | console.log(JSON.stringify(skillResults, null, 2)); |
| 387 | } else { |
| 388 | printResults(skillResults); |
| 389 | } |
| 390 | |
| 391 | const anyFail = skillResults.some(r => r.failCount > 0); |
| 392 | const anyWarn = skillResults.some(r => r.warnCount > 0); |
| 393 | |
| 394 | if (STRICT_MODE) { |
| 395 | process.exit(anyFail || anyWarn ? 1 : 0); |
| 396 | } else { |
| 397 | process.exit(anyFail ? 1 : 0); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | main(); |
no test coverage detected