Skip to content

Add Simplicity Guardian CI check (#382)#393

Open
ngarbezza wants to merge 12 commits into
mainfrom
382-simplicity-guardian
Open

Add Simplicity Guardian CI check (#382)#393
ngarbezza wants to merge 12 commits into
mainfrom
382-simplicity-guardian

Conversation

@ngarbezza

Copy link
Copy Markdown
Owner

Summary

  • Adds bin/simplicity-guardian.js — script CLI puro (zero deps) que escanea lib/ y bin/ con 3 capas: zero-dependency, dark-magic (Proxy/defineProperty/__proto__) y fan-out (>7 imports por archivo)
  • Adds .github/workflows/simplicity_guardian.yml — workflow CI triggered en pull_request, corre el guardian + ESLint y postea un comentario en el PR con el detalle de cada violación
  • Adds .github/scripts/post-pr-comment.cjs — script que construye y upsertea el comentario markdown en el PR (actualiza si existe, crea si no, limpia cuando todo está ok)
  • Adds new ESLint rules in testy-lib scope: class-methods-use-this, max-classes-per-file, no-else-return, no-restricted-syntax (Proxy/defineProperty), no-restricted-imports (layer direction: core → no depende de ui)
  • Converts applicable methods to static across lib/, adds eslint-disable where multi-class files are justified by design patterns

Test Plan

  • 437 tests pasando (12 nuevos para el guardian script, 12 nuevos para el PR comment script)
  • npm run lint — 0 errores
  • node bin/simplicity-guardian.js lib bin — produce salida de texto correcta en el repo actual
  • node bin/simplicity-guardian.js --format json lib bin — produce JSON válido con violations y summary
  • Verificar que el workflow se dispara al abrir un PR contra main (requiere merge y nuevo PR)

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

🛡️ Simplicity Guardian

❌ Zero-dependency (9)

  • lib/config/configuration.js:5 — External import 'module' — violates zero-dependency DNA
  • lib/script_action.js:8 — External import 'module' — violates zero-dependency DNA
  • lib/testy.js:9 — External import 'fs' — violates zero-dependency DNA
  • lib/testy.js:10 — External import 'path' — violates zero-dependency DNA
  • lib/testy.js:11 — External import 'url' — violates zero-dependency DNA
  • lib/typescript/typescript_transpiler.js:2 — External import 'fs' — violates zero-dependency DNA
  • lib/typescript/typescript_transpiler.js:3 — External import 'path' — violates zero-dependency DNA
  • lib/typescript/typescript_transpiler.js:4 — External import 'module' — violates zero-dependency DNA
  • lib/ui/json_formatter.js:1 — External import 'module' — violates zero-dependency DNA

✅ No dark magic — OK

❌ Fan-out (1)

  • lib/testy.js:1 — 11 imports exceed threshold of 7 — class may be doing too much

✅ ESLint — OK

Comment thread .github/workflows/simplicity_guardian.yml Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants