clckernel 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.es.md +51 -118
  2. package/README.md +48 -116
  3. package/package.json +14 -2
  4. package/src/adapters/agent-os.js +183 -0
  5. package/src/catalog.js +16 -0
  6. package/src/detector.js +2 -0
  7. package/src/index.js +11 -0
  8. package/src/ui.js +79 -35
  9. package/tools/audit.js +0 -0
  10. package/tools/audit.py +0 -0
  11. package/tools/check_custom.js +0 -0
  12. package/tools/check_custom.py +0 -0
  13. package/tools/check_db_efficiency.py +0 -0
  14. package/tools/check_domain_data.js +100 -0
  15. package/tools/check_hitl.js +93 -0
  16. package/tools/check_responsive.js +0 -0
  17. package/tools/check_seo.js +1 -1
  18. package/tools/check_symlinks.js +76 -0
  19. package/tools/scan_secrets.js +12 -1
  20. package/tools/scan_secrets.py +0 -0
  21. package/AGENTS.md +0 -124
  22. package/docs/Journal/001-adr-clckernel-governance.md +0 -18
  23. package/test/adapters/astro.test.js +0 -102
  24. package/test/adapters/base.test.js +0 -86
  25. package/test/adapters/django.test.js +0 -95
  26. package/test/adapters/fastapi.test.js +0 -88
  27. package/test/adapters/go.test.js +0 -81
  28. package/test/adapters/laravel.test.js +0 -106
  29. package/test/adapters/nextjs.test.js +0 -113
  30. package/test/adapters/rails.test.js +0 -108
  31. package/test/adapters/rust.test.js +0 -83
  32. package/test/catalog.test.js +0 -170
  33. package/test/config.test.js +0 -512
  34. package/test/detector.test.js +0 -345
  35. package/test/doctor.test.js +0 -302
  36. package/test/generator.test.js +0 -419
  37. package/test/guards_new.test.js +0 -95
  38. package/test/helpers.js +0 -36
  39. package/test/integration/cli-flow.test.js +0 -270
  40. package/test/technologies/celery_guard.test.js +0 -185
  41. package/test/technologies/detector.test.js +0 -342
  42. package/test/technologies/docker_guard.test.js +0 -187
  43. package/test/technologies/integration.test.js +0 -123
  44. package/test/technologies/postgres_guard.test.js +0 -87
  45. package/test/technologies/redis_guard.test.js +0 -128
package/README.es.md CHANGED
@@ -1,6 +1,5 @@
1
1
  <div align="center">
2
- <img width="350" height="350" alt="clckernel_logo" src="https://github.com/user-attachments/assets/2898e9c1-ec7a-4c60-a6dd-e62c05a0d446" />
3
- </div>
2
+ <img width="280" height="280" alt="clckernel_logo" src="https://github.com/user-attachments/assets/2898e9c1-ec7a-4c60-a6dd-e62c05a0d446" />
4
3
 
5
4
  # 🤖 CLC Kernel (`clckernel`)
6
5
 
@@ -8,30 +7,28 @@
8
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
8
  [![English](https://img.shields.io/badge/README-English-blue.svg)](./README.md)
10
9
 
11
- > **El Motor Universal de Gobernanza para Agentes de IA & Orquestador AIUP.**
12
- > Creado por [CarlosLeonCode](https://github.com/carlosleoncode).
10
+ **El Motor Universal de Gobernanza Determinista para Agentes de IA & Orquestador AIUP.**
11
+ *Creado por [CarlosLeonCode](https://github.com/carlosleoncode).*
12
+ </div>
13
13
 
14
- Los agentes de IA (Claude, Cursor, Gemini, Copilot) generan código a una velocidad sin precedentes. Sin embargo, sin límites estrictos introducen degradación arquitectónica, tests de falso positivo y deuda técnica invisible. **CLC Kernel** es el arnés de desarrollo definitivo para gobernarlos.
14
+ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) codifican a gran velocidad, pero sin límites introducen degradación arquitectónica, tests falsos positivos y fuga de credenciales.
15
15
 
16
- Establece un **Proceso Unificado de IA (AIUP)**—obligando a los LLMs a operar como ingenieros de software disciplinados en cualquier lenguaje de programación (Next.js, FastAPI, Django, Astro, Rails, Go, Rust, Laravel).
16
+ **CLC Kernel** es un arnés de desarrollo políglota que gobierna físicamente a los agentes mediante **linters AST deterministas (< 5ms)**, **especificaciones SDD locales** y el cumplimiento del **Proceso Unificado de IA (AIUP)**.
17
17
 
18
18
  ---
19
19
 
20
- ## 🎯 1. Posicionamiento: Una Nueva Categoría — AI Agent Governance
21
-
22
- CLC Kernel **no** es "otro framework de IA" ni una colección de prompts. Define una categoría de ingeniería propia: **Gobernanza Determinística de Agentes de IA (AI Agent Governance)**.
20
+ ## 🎯 Casos de Uso
23
21
 
24
- | Categoría de Herramienta | Qué Hace | Dónde se Queda Corta | Ventaja de CLC Kernel |
25
- |---|---|---|---|
26
- | **Reglas de Prompt** (`.cursorrules`, `.mdc`) | Inyecta sugerencias en markdown en el contexto del chat. | **No determinístico:** El LLM las ignora en contextos largos o pedidos rápidos. | Impone **AST Linters nativos** que bloquean físicamente commits no conformes. |
27
- | **Herramientas de Specs** (OpenSpec, Specs en MD) | Documenta especificaciones y requerimientos. | **Estático:** No comprueba tests fallidos ni custodia cambios de código en Git. | Ciclo completo **AIUP:** Spec -> Gate Humano -> TDD Rojo-a-Verde -> AST Guard. |
28
- | **Runtimes de Agentes** (LangGraph, CrewAI) | Construye apps de backend con agentes autónomos. | **Problema distinto:** No gobierna el desarrollo en el repositorio del programador. | **Arnés para Devs:** Se integra nativamente en el flujo diario de tu IDE. |
22
+ | Caso de Uso | Problema que Resuelve | Cómo lo Resuelve CLC Kernel |
23
+ |---|---|---|
24
+ | **1. Gobernanza de Coding Agents**<br>*(Cursor, Claude Code, Copilot)* | Los agentes programan por intuición ("vibe coding"), se saltan pruebas y rompen capas de arquitectura en backend y frontend. | Impone la **Regla #0** (Investigación -> SDD -> TDD Rojo a Verde -> Auditoría AST) y bloquea commits no conformes mediante linters AST. |
25
+ | **2. Arquetipos Agent-OS y Flujos de Dominio**<br>*(Bots autónomos, OS de marketing/ventas)* | Runtimes de agentes ejecutan acciones sin supervisión, alucinan métricas o desincronizan reglas en diferentes IDEs. | Provee **Gobernanza Dual-Layer**, valida symlinks de reglas para IDEs, exige compuertas Human-in-the-Loop (`check_hitl`) y valida esquemas con null seguro (`check_domain_data`). |
26
+ | **3. Refactorizaciones y Migraciones Críticas** | Los agentes modifican archivos fuera del alcance acordado, introduciendo regresiones silenciosas. | Delimita el trabajo en una especificación local `sdds/{cambio}/spec.md` y bloquea commits que toquen archivos no autorizados (`check_scope`). |
27
+ | **4. Blindaje Pre-Commit y Shift-Left en CI/CD** | Fuga de credenciales, consultas N+1 en bucles y migraciones destructivas llegan a ramas remotas. | Ejecuta validaciones AST sin dependencias foráneas en el lenguaje nativo del stack en **< 5ms** antes de cada commit. |
29
28
 
30
29
  ---
31
30
 
32
- ## 🏛️ 2. Pilares Conceptuales del Ecosistema
33
-
34
- CLC Kernel se apoya en cinco fundamentos de ingeniería diseñados para erradicar los vicios del "Vibe Coding":
31
+ ## 🏛️ El Proceso Unificado de IA (AIUP)
35
32
 
36
33
  ```
37
34
  ┌─────────────────────────────────────────────────────────────────────────────┐
@@ -43,124 +40,60 @@ CLC Kernel se apoya en cinco fundamentos de ingeniería diseñados para erradica
43
40
  └─────────────┴─────────────┴─────────────┴──────────────────┴────────────────┘
44
41
  ```
45
42
 
46
- ### 📝 A. Spec-Driven Development (SDD)
47
- Los agentes sufren del *sesgo de inmediatez*—escribir código antes de entender los requerimientos. CLC Kernel prohíbe la modificación directa: el agente debe primero redactar una especificación técnica local (gitignorada en `sdds/{feature-name}/`) detallando objetivos, capas afectadas y casos borde.
48
-
49
- ### 🛑 B. Human-in-the-Loop Gate (HIT)
50
- Antes de tocar una sola línea de código en producción, el agente debe presentar escenarios de prueba concretos al desarrollador para su validación y aprobación. **El humano es el Arquitecto/Director; la IA es el Ejecutor.**
51
-
52
- ### 🧪 C. Test-Driven Development (TDD Rojo-a-Verde)
53
- Los agentes suelen generar "tests tautológicos" que nunca fallan ante bugs reales. CLC Kernel impone TDD genuino: el agente debe escribir un test de regresión que falle primero (Fase Roja) y demostrar el fallo antes de escribir la implementación (Fase Verde).
54
-
55
- ### 🛡️ D. Salvaguardas AST Determinísticas (Linters Nativos)
56
- Las instrucciones en markdown se olvidan con facilidad. CLC Kernel provisiona linters basados en el Árbol de Sintaxis Abstracta (AST) en el lenguaje nativo del stack (Python `ast`, Go `ast`, RuboCop, PHPStan, TypeScript AST). Estos guardias validan físicamente los cambios y bloquean commits inválidos:
57
- - **📱 Frontend & UX:** Breakpoints mobile-first y touch targets de 44px (`check_responsive`), metadata SEO/tags GEO/prioridad LCP (`check_seo`), accesibilidad ARIA (`check_a11y`), reutilización de primitivas UI (`check_ui_reuse`), optimización de imágenes y tree-shaking (`check_performance`), y contratos Zod (`check_api_contracts`).
58
- - **🏛️ Backend & Arquitectura:** Aislamiento de capas Clean Architecture (`check_architecture`), prevención de queries N+1 en loops (`check_db_efficiency`), idempotencia de migraciones (`check_migrations`), y escaneo de secretos (`scan_secrets`).
59
- - **🎯 Proceso & Infraestructura:** Validación de alcance git diff vs SDD (`check_scope`), prueba de transición TDD Rojo-a-Verde (`verify_tdd`), y guardias de tecnologías (`docker_guard`, `celery_guard`, `redis_guard`, `postgres_guard`).
60
-
61
- ### 🔗 E. Single Source of Truth (SSOT) & Espejado Dinámico (Mirroring)
62
- Mantener archivos de reglas separados para Cursor, Claude, Windsurf, Copilot y Gemini produce desincronización y deriva de contexto. CLC Kernel lo resuelve mediante **Espejado Dinámico**:
63
- - `AGENTS.md` se forja como el **Single Source of Truth** (Única Fuente de Verdad).
64
- - Symlinks multiplataforma proyectan automáticamente `AGENTS.md` hacia:
65
- - 🧠 `CLAUDE.md` (Claude Desktop / Windsurf)
66
- - 🌌 `GEMINI.md` (Gemini CLI / Project IDX)
67
- - 💠 `.cursorrules` & `.cursor/rules/clckernel_context.mdc` (Cursor)
68
- - ✈️ `.github/copilot-instructions.md` (GitHub Copilot)
69
- - 🛸 `.antigravity/rules.md` (Antigravity)
70
- - *Editás una sola vez en `AGENTS.md` y todos los IDEs absorben el contexto de forma instantánea y con cero duplicación.*
43
+ 1. **SDD (Spec-Driven Development):** El agente debe redactar una especificación técnica local gitignorada (`sdds/{feature}/spec.md`) antes de tocar código de producción.
44
+ 2. **HIT (Human-in-the-Loop):** El ingeniero revisa y aprueba los contratos y escenarios de prueba antes del inicio de la implementación.
45
+ 3. **TDD (Rojo a Verde):** El agente debe demostrar un test de regresión fallido (Fase Roja) antes de escribir la solución en producción (Fase Verde).
46
+ 4. **AST (Salvaguardas Deterministas):** Parsers nativos del stack (Python `ast`, Go `ast`, RuboCop, TypeScript AST) inspeccionan el diff y bloquean físicamente commits no conformes.
47
+ 5. **SSOT (Única Fuente de Verdad):** `AGENTS.md` se define una sola vez y se proyecta mediante symlinks hacia `CLAUDE.md`, `GEMINI.md`, `.cursorrules` y Copilot.
71
48
 
72
49
  ---
73
50
 
74
- ## 💡 3. Por Qué Existe CLC Kernel
51
+ ## 🌐 Ecosistemas Soportados y Arquetipos
75
52
 
76
- Librados a su suerte, los agentes de IA generan **Deuda de Comprensión (Comprehension Debt)**—un código que crece más rápido que la capacidad del equipo de mantener su arquitectura:
77
-
78
- <div align="center">
79
- <img width="900" alt="clckernel_comparison_es" src="https://github.com/user-attachments/assets/4d2e6651-15be-46f6-ae12-c8274b6492ca" />
80
- <p><em>Izquierda: Agente de IA sin gobernanza — código caótico y alucinado. Derecha: Agente con CLC Kernel AIUP — estructurado, seguro y arquitectónicamente correcto.</em></p>
81
- </div>
82
-
83
- - ❌ **Decaimiento Arquitectónico:** Mezclar lógica de rutas con llamadas a la base de datos en lugar de respetar el aislamiento de capas.
84
- - ❌ **Duplicación de UI:** Inventar colores hexadecimales arbitrarios y HTML crudo en lugar de reutilizar los tokens del sistema de diseño.
85
- - ❌ **Tests de Falso Positivo:** Declarar que una feature funciona sin jamás demostrar la transición Rojo-a-Verde.
86
- - ❌ **Fugas de Seguridad:** Commitear accidentalmente API Keys o exponer DTOs privados del backend al cliente.
87
-
88
- ---
89
-
90
- ## 🧩 4. Dependencias Deseadas del Ecosistema (Opcionales y Modulares)
91
-
92
- CLC Kernel se enfoca estrictamente en **Gobernanza, Proceso y Salvaguardas de Calidad**. Intencionalmente **no** empaqueta un motor de grafos propietario ni una base de datos de persistencia monolítica. En su lugar, delega esas capacidades en herramientas complementarias especializadas (con degradación elegante si no se encuentran instaladas en el entorno):
93
-
94
- | Herramienta Complementaria | Rol | Por Qué es Deseada | Comportamiento si no está |
53
+ | Ecosistema | Firma de Detección | Test Runner | Salvaguardas Nativas |
95
54
  |---|---|---|---|
96
- | 🧠 **[Engram (MCP)](https://github.com/Gentleman-Programming/gentle-ai)** | Memoria de Largo Plazo & ADRs | Preserva el contexto arquitectónico, justificaciones de diseño y memoria entre sesiones de agentes. | Salteo elegante (la auditoría continúa sin persistencia). |
97
- | 🕸️ **[Graphify](https://github.com/carlosleoncode/graphify)** | Grafo de Conocimiento de Código | Genera mapas topológicos y grafos de dependencias para que el agente entienda relaciones arquitectónicas. | Salteo elegante (`verify_memory_graph` pasa como advisory). |
98
- | 🛡️ **[Gentle AI (RDD)](https://github.com/Gentleman-Programming/gentle-ai)** | Gate de Revisión Adversaria | Aplica Review-Driven Development (RDD) con inspección multi-lente antes de commitear cambios. | Salteo elegante (`verify_rdd_review_gate` pasa como advisory). |
99
- | ⚡ **Linters Nativos por Stack** | AST & Seguridad de Tipos | `ruff` (Python), `golangci-lint` (Go), `cargo clippy` (Rust), `phpstan` (PHP), `tsc` (TypeScript). | Utiliza las herramientas CLI instaladas en el entorno local del proyecto. |
100
-
101
- ---
102
-
103
- ## 🧠 5. El Paradigma de la CLI Conversacional
104
-
105
- CLC Kernel opera tanto en tu terminal como dentro del chat de tu IDE con IA. Al inicializarse, inyecta un **Agentic Playbook (`SKILL.md`)** en tu repositorio, convirtiendo cualquier LLM en un asistente interactivo de gobernanza:
106
-
107
- - 🚀 **`clckernel start`**: Detecta tu stack automáticamente, propone un ciclo de gobernanza, y materializa `.clckernel.yaml`.
108
- - 🛠️ **`clckernel create_guard`**: Escribe un linter AST personalizado en el lenguaje nativo de tu stack (`tools/guards/`).
109
- - 🔄 **`clckernel add_phase` / `remove_guard`**: Modifica el ciclo de vida AIUP interactivamente sin editar YAML manualmente.
110
-
111
- ---
112
-
113
- ## 🌐 6. Adaptadores Polyglot por Stack
114
-
115
- CLC Kernel cuenta con adaptadores dedicados para los principales ecosistemas:
116
-
117
- | Ecosistema | Firma de Detección | Test Runner | Salvaguardas Aplicadas |
118
- |---|---|---|---|
119
- | ⚛️ **Next.js** | `next` | Vitest / Jest | Reutilización de UI, Tokens Semánticos, Reglas RSC, Zod, A11y, Responsive, SEO, Performance |
120
- | ⚡ **FastAPI** | `fastapi` | Pytest | Pydantic V2, Idempotencia Alembic, AST Arquitectura Limpia, Eficiencia DB (N+1) |
55
+ | ⚛️ **Next.js** | `next` | Vitest / Jest | Clean Architecture, Reutilización de UI, Tokens Semánticos, RSC, A11y, Responsive, SEO |
56
+ | ⚡ **FastAPI** | `fastapi` | Pytest | Pydantic V2, Idempotencia Alembic, AST Clean Architecture, Eficiencia DB (N+1) |
121
57
  | 💎 **Rails** | `Gemfile` | RSpec | AST RuboCop, Seguridad Brakeman, Idempotencia de Migraciones |
122
- | 🐹 **Golang** | `go.mod` | `go test` | AST `golangci-lint`, Arquitectura Domain/UseCase |
123
- | 🦀 **Rust** | `Cargo.toml` | `cargo test` | AST `cargo clippy`, `cargo audit`, Seguridad de Memoria Estricta |
124
- | 🐘 **Laravel** | `artisan` | Pest / PHPUnit | AST PHPStan, Detección de N+1 Eloquent, Migraciones |
58
+ | 🐹 **Golang** | `go.mod` | `go test` | AST `golangci-lint`, Aislamiento de Capas Dominio/Casos de Uso |
59
+ | 🦀 **Rust** | `Cargo.toml` | `cargo test` | AST `cargo clippy`, `cargo audit`, Seguridad Estricta de Memoria |
60
+ | 🐘 **Laravel** | `artisan` | Pest / PHPUnit | AST PHPStan, Detección de Consultas N+1 en Eloquent, Migraciones |
125
61
  | 🎸 **Django** | `manage.py` | `pytest-django` | Idempotencia ORM Django, AST Ruff, Scope Guard, Eficiencia DB (N+1) |
126
- | 🚀 **Astro** | `astro.config` | Playwright | Tokens Tailwind v4, Content Collection Schema, A11y, Responsive, SEO |
62
+ | 🚀 **Astro** | `astro.config` | Playwright | Tokens Tailwind v4, Esquemas de Colección, A11y, Responsive, SEO |
63
+ | 🤖 **Agent-OS** | `skills/`, `brand/`, `templates/` | Tests de Contrato | AGENTS.md Dual-Layer, Compuertas HITL (`check_hitl`), Symlinks (`check_symlinks`), Integridad de Datos (`check_domain_data`) |
127
64
 
128
65
  ---
129
66
 
130
- ## ⚡ 7. Guía Paso a Paso (Ciclo de Vida Completo)
67
+ ## 🚀 Inicio Rápido
131
68
 
69
+ ### 1. Inicializar en Terminal
70
+ ```bash
71
+ npx clckernel start
132
72
  ```
133
- [1. Terminal] [2. Chat del LLM] [3. Bucle TDD] [4. Git Commit]
134
- npx clckernel ───► clckernel start ───► "Feature X con harness" ───► Hooks Pre-commit
135
- (Bootstrap) (Setup Interactivo) (SDD -> HIT -> Tests) (Guardián AST & Secretos)
136
- ```
73
+ Detecta el framework, genera `AGENTS.md`, crea symlinks para todos los IDEs, provisiona hooks pre-commit e instala verificadores AST en `tools/`.
137
74
 
138
- ### 1️⃣ Paso 1: Inicializar el Repositorio (Terminal)
75
+ ### 2. Verificar Estado de Salud
139
76
  ```bash
140
- npx clckernel
77
+ npx clckernel doctor
141
78
  ```
142
- Detecta tu framework, genera `AGENTS.md`, crea symlinks dinámicos para todos los IDEs, provisiona hooks pre-commit (`.husky/` o `.githooks/`) y crea herramientas AST en `tools/`.
79
+ Audita hooks de Git, test runners activos y la integridad del motor AST.
143
80
 
144
- ### 2️⃣ Paso 2: Abrir tu IDE con IA e Inicializar (CLI Conversacional)
145
- Abrí Cursor, Claude Code, Gemini CLI, Windsurf o Copilot y escribí:
146
- > `clckernel start`
147
- El agente escanea tu código en silencio, propone un plan de gobernanza AIUP adaptado a tu stack y genera `.clckernel.yaml`.
81
+ ### 3. Desarrollar con Gobernanza
82
+ En el chat del IDE (Cursor, Claude Code, Gemini CLI, Windsurf):
83
+ > *"Implementa el endpoint de autenticación. **Usa el harness de CLC Kernel**."*
148
84
 
149
- ### 3️⃣ Paso 3: Desarrollar con el Arnés AIUP
150
- Al pedir una funcionalidad o corrección, activá el workflow:
151
- > *"Agregá el endpoint de autenticación. **Usá el workflow / harness**."*
152
- El agente ejecuta de forma autónoma el ciclo de 10 pasos: **SDD Spec -> Gate HIT -> TDD Rojo-a-Verde -> Implementación Limpia -> Auditoría AST**.
85
+ El agente ejecutará el ciclo AIUP completo: **Especificación SDD -> Aprobación HIT -> Test Rojo -> Implementación Verde -> Auditoría AST**.
153
86
 
154
- ### 4️⃣ Paso 4: Verificación Determinística de Guards (Commit)
155
- ```bash
156
- git add .
157
- git commit -m "feat(auth): add user authentication endpoint"
158
- ```
159
- Los hooks pre-commit ejecutan escáneres AST automáticos (Clean Architecture, Fuga de Secretos, Scope Guard, Idempotencia de Migraciones). Cualquier violación bloquea el commit de inmediato.
87
+ ---
160
88
 
161
- ### 5️⃣ Paso 5: Auditar la Salud del Repositorio en Cualquier Momento (Terminal)
162
- ```bash
163
- npx clckernel doctor
164
- ```
165
- Ejecuta el **CLC Kernel Doctor** para verificar el 100% de cumplimiento en `AGENTS.md`, `sdds/`, `tools/` y hooks de Git.
89
+ ## 🧩 Herramientas Complementarias (Opcionales)
90
+
91
+ CLC Kernel se enfoca estrictamente en gobernanza y opera con **cero dependencias foráneas**. Se integra de forma modular con:
92
+ - 🧠 **[Engram (MCP)](https://github.com/Gentleman-Programming/gentle-ai):** Memoria arquitectónica persistente y registro de ADRs entre sesiones.
93
+ - 🕸️ **[Graphify](https://github.com/carlosleoncode/graphify):** Generación de grafos visuales de dependencias y topología del código.
94
+ - 🛡️ **[Gentle AI (RDD)](https://github.com/Gentleman-Programming/gentle-ai):** Compuerta de revisión multi-lente adversaria antes de commitear.
95
+
96
+ ---
166
97
 
98
+ ## 📄 Licencia
99
+ MIT © [CarlosLeonCode](https://github.com/carlosleoncode)
package/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  <div align="center">
2
- <img width="350" height="350" alt="clckernel_logo" src="https://github.com/user-attachments/assets/ed631ce1-c996-4347-b818-97b8ab25e0ec" />
3
- </div>
2
+ <img width="280" height="280" alt="clckernel_logo" src="https://github.com/user-attachments/assets/ed631ce1-c996-4347-b818-97b8ab25e0ec" />
4
3
 
5
4
  # 🤖 CLC Kernel (`clckernel`)
6
5
 
@@ -8,30 +7,28 @@
8
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
8
  [![Español](https://img.shields.io/badge/README-Español-blue.svg)](./README.es.md)
10
9
 
11
- > **The Universal Polyglot AI Agent Governance Engine & AIUP Orchestrator.**
12
- > Built by [CarlosLeonCode](https://github.com/carlosleoncode).
10
+ **Deterministic AI Agent Governance Engine & AIUP Orchestrator.**
11
+ *Forged by [CarlosLeonCode](https://github.com/carlosleoncode).*
12
+ </div>
13
13
 
14
- AI coding agents (Claude, Cursor, Gemini, Copilot) generate code at unprecedented speeds. However, without strict boundaries, they introduce architectural decay, false-positive tests, and invisible technical debt. **CLC Kernel** is the definitive developer harness to govern them.
14
+ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without guardrails they create architectural decay, tautological tests, and secret leaks.
15
15
 
16
- It establishes an **AI Unified Process (AIUP)**—forcing LLMs to operate like disciplined software engineers across any programming language (Next.js, FastAPI, Django, Astro, Rails, Go, Rust, Laravel).
16
+ **CLC Kernel** is a polyglot developer harness that physically governs AI agents using **deterministic AST linters (< 5ms)**, **local SDD specs**, and an enforced **AI Unified Process (AIUP)**.
17
17
 
18
18
  ---
19
19
 
20
- ## 🎯 1. Positioning: A New Category — AI Agent Governance
20
+ ## 🎯 Use Cases
21
21
 
22
- CLC Kernel is **not** "just another AI framework" or prompt collection. It pioneers a distinct engineering category: **Deterministic AI Agent Governance**.
23
-
24
- | Tool Category | What It Does | Where It Falls Short | CLC Kernel Advantage |
25
- |---|---|---|---|
26
- | **Prompt Rules** (`.cursorrules`, `.mdc`) | Injects markdown suggestions into chat context. | **Non-deterministic:** Ignored during large contexts or quick-fix prompts. | Enforces native **AST Linters** that physically block non-compliant Git commits. |
27
- | **Spec Tools** (OpenSpec, Markdown specs) | Documents specifications & design requirements. | **Static:** Doesn't verify failing test transitions or guard code changes. | Full **AIUP lifecycle:** Spec -> Human Gate -> Red-to-Green TDD -> AST Verification. |
28
- | **Agent Runtimes** (LangGraph, CrewAI) | Builds multi-agent production backend apps. | **Different problem:** Doesn't govern human-in-the-loop repo development. | **Developer Tooling Harness:** Injected directly into your daily IDE workflow. |
22
+ | Use Case | Problem It Solves | How CLC Kernel Solves It |
23
+ |---|---|---|
24
+ | **1. Coding Agent Governance**<br>*(Cursor, Claude Code, Copilot)* | Agents "vibe code", bypass tests, and violate layer boundaries in backend/frontend apps. | Enforces **Rule #0** (Research -> SDD -> TDD Red-to-Green -> AST Audit) and blocks commits via native AST guards. |
25
+ | **2. Agent-OS & Domain Workflows**<br>*(Autonomous bots, marketing/sales OS)* | Agent runtimes execute actions without review, hallucinate metrics, or drift across IDE configs. | Provides **Dual-Layer Governance**, validates IDE mirror symlinks, checks Human-in-the-Loop (`check_hitl`), and enforces null-safe schemas (`check_domain_data`). |
26
+ | **3. Complex Refactors & Migrations** | Agents modify files outside the agreed feature scope, causing silent regressions. | Locks work to a local `sdds/{change}/spec.md` and fails commits modifying untouched layers (`check_scope`). |
27
+ | **4. Shift-Left CI/CD & Pre-commit** | Secret leaks, N+1 query loops, and broken database migrations reach remote branches. | Runs zero-dependency AST checks in your stack's native language in **< 5ms** before Git commit. |
29
28
 
30
29
  ---
31
30
 
32
- ## 🏛️ 2. Core Conceptual Pillars
33
-
34
- CLC Kernel is built upon five foundational engineering principles designed to eliminate "vibe coding" hazards:
31
+ ## 🏛️ The AI Unified Process (AIUP)
35
32
 
36
33
  ```
37
34
  ┌─────────────────────────────────────────────────────────────────────────────┐
@@ -43,125 +40,60 @@ CLC Kernel is built upon five foundational engineering principles designed to el
43
40
  └─────────────┴─────────────┴─────────────┴──────────────────┴────────────────┘
44
41
  ```
45
42
 
46
- ### 📝 A. Spec-Driven Development (SDD)
47
- Agents suffer from *immediacy bias*—writing code before understanding requirements. CLC Kernel forbids direct modifications: agents must first author a local, gitignored specification under `sdds/{feature-name}/` detailing objectives, architectural layer impacts, and edge cases.
48
-
49
- ### 🛑 B. Human-in-the-Loop Gate (HIT)
50
- Before touching a single line of production code, the agent must present concrete test scenarios to the developer for review and approval. **The human is the Architect/Director; the AI is the Executor.**
51
-
52
- ### 🧪 C. Test-Driven Development (TDD Red-to-Green)
53
- AI agents frequently generate "tautological tests" that never fail against bugs. CLC Kernel enforces real TDD: the agent must produce a failing regression test (Red Phase) and prove failure before writing implementation code (Green Phase).
54
-
55
- ### 🛡️ D. Deterministic AST Safeguards (Native Code Linters)
56
- Markdown instructions can be forgotten by LLMs. CLC Kernel provisions deterministic Abstract Syntax Tree (AST) linters in the stack's native language (Python `ast`, Go `ast`, RuboCop, PHPStan, TypeScript AST). These guards physically validate code changes and block non-compliant commits:
57
- - **📱 Frontend & UX:** Mobile-first responsive breakpoints & 44px touch targets (`check_responsive`), SEO metadata/GEO tags/LCP priority (`check_seo`), ARIA accessibility (`check_a11y`), UI primitive reuse (`check_ui_reuse`), image optimization & tree-shaking (`check_performance`), and Zod API contracts (`check_api_contracts`).
58
- - **🏛️ Backend & Architecture:** Clean Architecture layer boundaries (`check_architecture`), N+1 query loop prevention (`check_db_efficiency`), migration idempotency (`check_migrations`), and secret leak scanning (`scan_secrets`).
59
- - **🎯 Process & Infrastructure:** Git diff vs SDD scope validation (`check_scope`), TDD Red-to-Green transition proof (`verify_tdd`), and tech guards (`docker_guard`, `celery_guard`, `redis_guard`, `postgres_guard`).
60
-
61
- ### 🔗 E. Single Source of Truth (SSOT) & Dynamic Mirroring
62
- Managing separate instructions for Cursor, Claude, Windsurf, Copilot, and Gemini causes documentation drift. CLC Kernel solves this via **Dynamic Mirroring**:
63
- - `AGENTS.md` is forged as the **Single Source of Truth**.
64
- - Cross-platform filesystem symlinks automatically project `AGENTS.md` to:
65
- - 🧠 `CLAUDE.md` (Claude Desktop / Windsurf)
66
- - 🌌 `GEMINI.md` (Gemini CLI / Project IDX)
67
- - 💠 `.cursorrules` & `.cursor/rules/clckernel_context.mdc` (Cursor)
68
- - ✈️ `.github/copilot-instructions.md` (GitHub Copilot)
69
- - 🛸 `.antigravity/rules.md` (Antigravity)
70
- - *Edit once in `AGENTS.md`, and all AI IDEs synchronize instantly with zero redundancy.*
71
-
72
- ---
73
-
74
- ## 💡 3. Why CLC Kernel Exists
75
-
76
- Left unguided, AI agents create compounding **Comprehension Debt**—a codebase that grows faster than the team's ability to maintain its architecture:
77
-
78
- <div align="center">
79
- <img width="900" alt="clckernel_comparison" src="https://github.com/user-attachments/assets/cb62753a-3e88-432d-9196-94eaa817864d" />
80
- <p><em>Left: AI agent without governance — chaotic, hallucinated code. Right: AI agent with CLC Kernel AIUP — structured, safe, architectural.</em></p>
81
- </div>
82
-
83
- - ❌ **Architectural Decay:** Mixing routing logic with database queries instead of respecting layer isolation.
84
- - ❌ **UI Duplication:** Inventing raw HTML and arbitrary hex colors instead of reusing design tokens.
85
- - ❌ **False-Positive Tests:** Writing mocks that pass trivially without testing domain invariants.
86
- - ❌ **Secret Leaks:** Accidental commits of API credentials or private backend DTOs.
87
-
88
- ---
89
-
90
- ## 🧩 4. Recommended Ecosystem Dependencies (Modular & Optional)
91
-
92
- CLC Kernel focuses strictly on **Governance, Process & Quality Guardrails**. It intentionally does not bundle monolithic databases or runtime graphs. Instead, it integrates modularly with companion tools (with graceful skip if absent):
93
-
94
- | Companion Tool | Role | Why It's Recommended | Fallback Behavior |
95
- |---|---|---|---|
96
- | 🧠 **[Engram (MCP)](https://github.com/Gentleman-Programming/gentle-ai)** | Long-Term Memory & ADRs | Preserves architectural context, design rationales, and cross-session knowledge for agents. | Graceful skip (audits proceed without persistent memory). |
97
- | 🕸️ **[Graphify](https://github.com/carlosleoncode/graphify)** | Code Knowledge Graph | Generates dependency graphs and visual codebase topology for architecture-aware agents. | Graceful skip (`verify_memory_graph` advisory check passes). |
98
- | 🛡️ **[Gentle AI (RDD)](https://github.com/Gentleman-Programming/gentle-ai)** | Adversarial Review Gate | Enforces Review-Driven Development (RDD) with multi-lens inspection before commits. | Graceful skip (`verify_rdd_review_gate` advisory check passes). |
99
- | ⚡ **Native Stack Linters** | AST & Type Safety | `ruff` (Python), `golangci-lint` (Go), `cargo clippy` (Rust), `phpstan` (PHP), `tsc` (TypeScript). | Uses whatever CLI is available in the local repository environment. |
100
-
101
- ---
102
-
103
- ## 🧠 5. The Conversational CLI Paradigm
104
-
105
- CLC Kernel operates both in your terminal and inside your AI chat. It injects an **Agentic Playbook (`SKILL.md`)**, turning your LLM into an interactive governance orchestrator:
106
-
107
- - 🚀 **`clckernel start`**: Auto-detects your stack, proposes an AIUP lifecycle, and generates `.clckernel.yaml`.
108
- - 🛠️ **`clckernel create_guard`**: Generates a custom AST linter in your stack's native language (`tools/guards/`).
109
- - 🔄 **`clckernel add_phase` / `remove_guard`**: Interactively mutates the AIUP workflow without manual YAML editing.
43
+ 1. **SDD (Spec-Driven Development):** Agent must write a local, gitignored specification (`sdds/{feature}/spec.md`) before editing production files.
44
+ 2. **HIT (Human-in-the-Loop):** The engineer reviews and approves test scenarios and contracts before execution begins.
45
+ 3. **TDD (Red-to-Green):** Agent must prove failure with a failing regression test (Red Phase) before writing implementation code (Green Phase).
46
+ 4. **AST (Deterministic Safeguards):** Native stack parsers (Python `ast`, Go `ast`, RuboCop, TypeScript AST) inspect diffs and physically block invalid commits.
47
+ 5. **SSOT (Single Source of Truth):** `AGENTS.md` is forged once and mirrored via filesystem symlinks to `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, and Copilot.
110
48
 
111
49
  ---
112
50
 
113
- ## 🌐 6. Polyglot Stack Adapters
51
+ ## 🌐 Supported Stacks & Archetypes
114
52
 
115
- CLC Kernel includes dedicated adapters for popular technology stacks:
116
-
117
- | Ecosystem | Detection Signature | Test Runner | Enforced Safeguards |
53
+ | Ecosystem | Detection Signature | Test Runner | Native Safeguards |
118
54
  |---|---|---|---|
119
- | ⚛️ **Next.js** | `next` | Vitest / Jest | UI Reuse, Semantic Tokens, RSC Rules, Zod, A11y, Responsive, SEO, Performance |
55
+ | ⚛️ **Next.js** | `next` | Vitest / Jest | Clean Arch, UI Reuse, Semantic Tokens, RSC, A11y, Responsive, SEO |
120
56
  | ⚡ **FastAPI** | `fastapi` | Pytest | Pydantic V2, Alembic Idempotency, Clean Arch AST, DB Efficiency (N+1) |
121
57
  | 💎 **Rails** | `Gemfile` | RSpec | RuboCop AST, Brakeman Security, Migration Idempotency |
122
- | 🐹 **Golang** | `go.mod` | `go test` | `golangci-lint` AST, Domain/UseCase Clean Architecture |
58
+ | 🐹 **Golang** | `go.mod` | `go test` | `golangci-lint` AST, Domain/UseCase Layer Isolation |
123
59
  | 🦀 **Rust** | `Cargo.toml` | `cargo test` | `cargo clippy` AST, `cargo audit`, Strict Memory Safety |
124
- | 🐘 **Laravel** | `artisan` | Pest / PHPUnit | PHPStan AST, Eloquent N+1 Detection, Migrations |
60
+ | 🐘 **Laravel** | `artisan` | Pest / PHPUnit | PHPStan AST, Eloquent N+1 Loop Detection, Migrations |
125
61
  | 🎸 **Django** | `manage.py` | `pytest-django` | Django ORM Idempotency, Ruff AST, Scope Guard, DB Efficiency (N+1) |
126
- | 🚀 **Astro** | `astro.config` | Playwright | Tailwind v4 Tokens, Content Collection Schema, A11y, Responsive, SEO |
62
+ | 🚀 **Astro** | `astro.config` | Playwright | Tailwind v4 Tokens, Content Schema, A11y, Responsive, SEO |
63
+ | 🤖 **Agent-OS** | `skills/`, `brand/`, `templates/` | Contract Tests | Dual-Layer AGENTS.md, HITL Gates (`check_hitl`), Symlinks (`check_symlinks`), Domain Data (`check_domain_data`) |
127
64
 
128
65
  ---
129
66
 
130
- ## ⚡ 7. Step-by-Step Guide (Full Lifecycle)
67
+ ## 🚀 Quickstart
131
68
 
69
+ ### 1. Initialize in Terminal
70
+ ```bash
71
+ npx clckernel start
132
72
  ```
133
- [1. Terminal] [2. AI Chat] [3. TDD Loop] [4. Git Commit]
134
- npx clckernel ───► clckernel start ───► "Feature X with harness" ───► Pre-commit Hooks
135
- (Bootstrap) (Interactive Setup) (SDD -> HIT -> Tests) (AST & Secret Guard)
136
- ```
73
+ Auto-detects your framework, generates `AGENTS.md`, creates IDE rule symlinks, provisions pre-commit hooks, and creates native AST checks in `tools/`.
137
74
 
138
- ### 1️⃣ Step 1: Bootstrap the Repository (Terminal)
75
+ ### 2. Verify Health
139
76
  ```bash
140
- npx clckernel
77
+ npx clckernel doctor
141
78
  ```
142
- Auto-detects your framework, generates `AGENTS.md`, creates dynamic IDE symlinks, provisions pre-commit hooks (`.husky/` or `.githooks/`), and creates stack-native AST tools in `tools/`.
79
+ Audits Git hooks, active test runners, and AST engine integrity.
143
80
 
144
- ### 2️⃣ Step 2: Initialize in Your AI Chat (Conversational CLI)
145
- Open Cursor, Claude Code, Gemini CLI, Windsurf, or Copilot and type:
146
- > `clckernel start`
147
- The agent scans your codebase silently, proposes an AIUP governance plan tailored to your framework, and generates `.clckernel.yaml`.
81
+ ### 3. Develop with Agentic Governance
82
+ In your IDE chat (Cursor, Claude Code, Gemini CLI, Windsurf):
83
+ > *"Implement authentication endpoint. **Follow the CLC Kernel harness**."*
148
84
 
149
- ### 3️⃣ Step 3: Develop with the AIUP Harness
150
- When requesting features or fixes, trigger the workflow:
151
- > *"Add user authentication endpoint. **Use the workflow / harness**."*
152
- The agent executes the full AIUP cycle: **SDD Spec -> HIT Approval -> TDD Red Phase -> Clean Implementation -> AST Audit**.
85
+ The agent executes the full AIUP loop: **SDD Spec -> HIT Review -> Failing Test (Red) -> Implementation (Green) -> AST Audit**.
153
86
 
154
- ### 4️⃣ Step 4: Deterministic Guard Verification (Commit)
155
- ```bash
156
- git add .
157
- git commit -m "feat(auth): add user authentication endpoint"
158
- ```
159
- Pre-commit hooks execute AST scanners (Clean Architecture, Secret Leaks, Scope Guard, Migration Idempotency). Non-compliant commits are blocked deterministically.
87
+ ---
160
88
 
161
- ### 5️⃣ Step 5: Verify Repository Health Anytime (Terminal)
162
- ```bash
163
- npx clckernel doctor
164
- ```
165
- Runs the **CLC Kernel Doctor** to verify 100% compliance across `AGENTS.md`, `sdds/`, `tools/`, and Git hooks.
89
+ ## 🧩 Optional Ecosystem Companions
166
90
 
91
+ CLC Kernel focuses strictly on governance and runs with **zero foreign dependencies**. It seamlessly integrates with companion tools:
92
+ - 🧠 **[Engram (MCP)](https://github.com/Gentleman-Programming/gentle-ai):** Persistent architectural memory and ADR tracking across agent sessions.
93
+ - 🕸️ **[Graphify](https://github.com/carlosleoncode/graphify):** Visual dependency graphs and codebase topology mapping.
94
+ - 🛡️ **[Gentle AI (RDD)](https://github.com/Gentleman-Programming/gentle-ai):** Multi-lens adversarial code review gate.
95
+
96
+ ---
167
97
 
98
+ ## 📄 License
99
+ MIT © [CarlosLeonCode](https://github.com/carlosleoncode)
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "clckernel",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "CLC Kernel — The Universal Polyglot AI Agent Governance Engine (Next.js, FastAPI, Django, Astro, Rails, Go, Rust, Laravel).",
5
5
  "main": "./bin/cli.js",
6
+ "files": [
7
+ "bin",
8
+ "src",
9
+ "tools",
10
+ "README.md",
11
+ "README.es.md"
12
+ ],
6
13
  "bin": {
7
14
  "clckernel": "bin/cli.js",
8
15
  "create-clckernel": "bin/cli.js",
@@ -39,6 +46,11 @@
39
46
  "scripts": {
40
47
  "test": "node --test test/*.test.js test/**/*.test.js",
41
48
  "test:unit": "node --test test/adapters/*.test.js",
42
- "test:coverage": "NODE_V8_COVERAGE=coverage node --test test/*.test.js test/**/*.test.js"
49
+ "test:coverage": "NODE_V8_COVERAGE=coverage node --test test/*.test.js test/**/*.test.js",
50
+ "website:dev": "npm --prefix website run dev",
51
+ "website:build": "npm --prefix website run build"
52
+ },
53
+ "dependencies": {
54
+ "@clack/prompts": "^1.8.1"
43
55
  }
44
56
  }