SPB Git

spb/llmindex Public

The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.

TypeScript 77.9% TeX 15.2% Python 3.7% SQL 1.4% JavaScript 1.1% Shell 0.5%
1.6 KB · 48 lines javascript
Raw Blame History
1/**2 * llmindex.io — CI check: mandatory author header on all source files (§4)3 * Author:  Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import { readFileSync, readdirSync, statSync } from 'node:fs';8import { join, extname } from 'node:path';910const ROOT = new URL('..', import.meta.url).pathname;11const SCAN_DIRS = ['apps', 'packages', 'infra'];12const EXTENSIONS = new Set(['.ts', '.tsx', '.py', '.sh', '.sql', '.mjs', '.cjs']);13const EXCLUDED_DIRS = new Set([14  'node_modules', '.next', 'dist', '.turbo', '__pycache__', '.venv', '.pytest_cache',15  'migrations', 'playwright-report', 'test-results', 'generated',16]);17const EXCLUDED_FILES = new Set(['next-env.d.ts']);18const REQUIRED = ['Author:  Simon-Pierre Boucher', 'contact@spboucher.ai'];1920function* walk(dir) {21  for (const entry of readdirSync(dir)) {22    const full = join(dir, entry);23    const st = statSync(full);24    if (st.isDirectory()) {25      if (!EXCLUDED_DIRS.has(entry)) yield* walk(full);26    } else if (EXTENSIONS.has(extname(entry)) && !EXCLUDED_FILES.has(entry)) {27      yield full;28    }29  }30}3132const failures = [];33for (const dir of SCAN_DIRS) {34  for (const file of walk(join(ROOT, dir))) {35    const head = readFileSync(file, 'utf8').slice(0, 600);36    if (!REQUIRED.every((needle) => head.includes(needle))) {37      failures.push(file.replace(ROOT, ''));38    }39  }40}4142if (failures.length > 0) {43  console.error(`✗ ${failures.length} file(s) missing the mandatory author header:`);44  for (const f of failures) console.error(`  - ${f}`);45  process.exit(1);46}47console.log('✓ all source files carry the author header');48