clckernel 1.2.6
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.
- package/AGENTS.md +124 -0
- package/README.es.md +166 -0
- package/README.md +167 -0
- package/bin/cli.js +12 -0
- package/docs/Journal/001-adr-clckernel-governance.md +18 -0
- package/package.json +44 -0
- package/src/adapters/astro.js +67 -0
- package/src/adapters/base.js +109 -0
- package/src/adapters/django.js +70 -0
- package/src/adapters/fastapi.js +69 -0
- package/src/adapters/go.js +50 -0
- package/src/adapters/laravel.js +52 -0
- package/src/adapters/nextjs.js +72 -0
- package/src/adapters/rails.js +54 -0
- package/src/adapters/rust.js +51 -0
- package/src/catalog.js +217 -0
- package/src/config.js +250 -0
- package/src/detector.js +85 -0
- package/src/doctor.js +125 -0
- package/src/generator.js +473 -0
- package/src/index.js +52 -0
- package/src/technologies/detector.js +243 -0
- package/src/technologies/guards/_shared.js +66 -0
- package/src/ui.js +101 -0
- package/src/yaml.js +173 -0
- package/test/adapters/astro.test.js +102 -0
- package/test/adapters/base.test.js +86 -0
- package/test/adapters/django.test.js +95 -0
- package/test/adapters/fastapi.test.js +88 -0
- package/test/adapters/go.test.js +81 -0
- package/test/adapters/laravel.test.js +106 -0
- package/test/adapters/nextjs.test.js +113 -0
- package/test/adapters/rails.test.js +108 -0
- package/test/adapters/rust.test.js +83 -0
- package/test/catalog.test.js +170 -0
- package/test/config.test.js +512 -0
- package/test/detector.test.js +345 -0
- package/test/doctor.test.js +302 -0
- package/test/generator.test.js +419 -0
- package/test/guards_new.test.js +95 -0
- package/test/helpers.js +36 -0
- package/test/integration/cli-flow.test.js +270 -0
- package/test/technologies/celery_guard.test.js +185 -0
- package/test/technologies/detector.test.js +342 -0
- package/test/technologies/docker_guard.test.js +187 -0
- package/test/technologies/integration.test.js +123 -0
- package/test/technologies/postgres_guard.test.js +87 -0
- package/test/technologies/redis_guard.test.js +128 -0
- package/tools/audit.js +219 -0
- package/tools/audit.py +273 -0
- package/tools/celery_guard.py +209 -0
- package/tools/check_a11y.js +109 -0
- package/tools/check_api_contracts.js +139 -0
- package/tools/check_architecture.js +139 -0
- package/tools/check_architecture.py +264 -0
- package/tools/check_custom.js +163 -0
- package/tools/check_custom.py +395 -0
- package/tools/check_db_efficiency.py +190 -0
- package/tools/check_migrations.py +223 -0
- package/tools/check_performance.js +142 -0
- package/tools/check_responsive.js +131 -0
- package/tools/check_scope.py +180 -0
- package/tools/check_seo.js +139 -0
- package/tools/check_storybook.js +108 -0
- package/tools/check_ui_reuse.js +135 -0
- package/tools/docker_guard.py +210 -0
- package/tools/postgres_guard.py +192 -0
- package/tools/redis_guard.py +197 -0
- package/tools/scan_secrets.js +109 -0
- package/tools/scan_secrets.py +153 -0
- package/tools/verify_tdd.py +212 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# šØ CLC Kernel (Node.js / Polyglot Core) ā AGENTS
|
|
2
|
+
|
|
3
|
+
This document is the **authoritative law** for AI agents working in this repository.
|
|
4
|
+
Forged by **CLC Kernel: The AI Agent Governance Engine**.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## šÆ Project Identity & Category
|
|
9
|
+
**CLC Kernel (`clckernel`)** is the Universal Polyglot AI Agent Governance Engine & AIUP Orchestrator.
|
|
10
|
+
It creates and owns a new category in software engineering: **Deterministic AI Agent Governance**.
|
|
11
|
+
|
|
12
|
+
Unlike prompt-based rules (`.cursorrules`) or backend agent runtimes (LangGraph), CLC Kernel provides an **in-repo developer harness** that deterministically forces AI coding agents to follow strict engineering lifecycles (SDD, TDD, Clean Architecture AST Linters) across multiple tech stacks (Next.js, FastAPI, Rails, Go, Rust, Laravel, Django, Astro).
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
> šØ **RULE #0: MANDATORY EXECUTION OVERRIDE RULE (UNBYPASSABLE)**
|
|
17
|
+
> Even when the user issues a direct or urgent fix request ("fix this bug", "fix this error", "quick fix"):
|
|
18
|
+
> YOU ARE STRICTLY FORBIDDEN from modifying source code directly without completing the full quality harness:
|
|
19
|
+
> 1. **Research & Root Cause Analysis:** Investigate tracebacks and inspect affected files before editing.
|
|
20
|
+
> 2. **TDD Verification (Red Phase):** Write a failing regression test first (`npm test`).
|
|
21
|
+
> 3. **Clean Architecture Implementation (Green Phase):** Make the test pass maintaining layer isolation.
|
|
22
|
+
> 4. **Mandatory Educational Audit Gate:** Execute `npm test` and verify zero lint/test regressions.
|
|
23
|
+
> NEVER declare success or skip verification commands for quick fixes.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. The Engineering Loop (Every Task)
|
|
28
|
+
1. **Research** ā Inspect codebase / docs / existing AST linters before writing code.
|
|
29
|
+
2. **Plan** ā Write an SDD under `sdds/{change-name}/` when introducing features or architectural refactors.
|
|
30
|
+
3. **Test (TDD)** ā Write failing tests first in `test/`.
|
|
31
|
+
4. **Implement** ā Write modular, zero-external-dependency code in `src/` or `tools/`.
|
|
32
|
+
5. **Verify & Audit** ā Run `npm test` (all 236+ test cases across catalog, adapters, generator, and detector).
|
|
33
|
+
6. **DoD (Definition of Done)** ā Clean code, zero regressions, full test coverage, docs updated in English and Spanish.
|
|
34
|
+
7. **Commit** ā Pre-commit hook runs automated guards. Use Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`). Never add AI co-authorship.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 2. Core Repository Architecture & Layout
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
clckernel/
|
|
42
|
+
āāā bin/
|
|
43
|
+
ā āāā cli.js # Executable CLI entrypoint (clckernel, clc-kernel, clc-forge)
|
|
44
|
+
āāā src/
|
|
45
|
+
ā āāā index.js # CLI controller orchestration
|
|
46
|
+
ā āāā catalog.js # Central 26-guard registry (Single Source of Truth)
|
|
47
|
+
ā āāā config.js # .clckernel.yml loader & validator (ConfigError)
|
|
48
|
+
ā āāā detector.js # Stack auto-detection heuristics
|
|
49
|
+
ā āāā doctor.js # Repository health check engine (CLC KERNEL DOCTOR)
|
|
50
|
+
ā āāā generator.js # Universal harness, hook, and symlink provisioner
|
|
51
|
+
ā āāā ui.js # Terminal UI, ASCII banner & ANSI renderer
|
|
52
|
+
ā āāā yaml.js # Zero-dependency YAML parser & glob-to-regex engine
|
|
53
|
+
ā āāā adapters/ # Polyglot stack adapters (Next.js, FastAPI, Rails, Go, Rust, Laravel, Django, Astro)
|
|
54
|
+
ā āāā technologies/ # Technology-specific detectors (Celery, Redis, Postgres, Docker)
|
|
55
|
+
āāā tools/ # Deterministic AST linters & safeguard scripts (Node.js & Python stdlib)
|
|
56
|
+
ā āāā audit.js / audit.py # Multi-guard orchestrator gates
|
|
57
|
+
ā āāā scan_secrets.js / .py # Secret leak scanners
|
|
58
|
+
ā āāā check_architecture.* # Clean Architecture layer isolation checkers
|
|
59
|
+
ā āāā check_custom.js / .py # User-defined regex rules from .clckernel.yml
|
|
60
|
+
ā āāā check_a11y.js # ARIA & accessibility linter
|
|
61
|
+
ā āāā check_ui_reuse.js # UI primitive reuse enforcer
|
|
62
|
+
ā āāā check_performance.js # Next/Image & tree-shaking linter
|
|
63
|
+
ā āāā check_responsive.js # Mobile-first & touch target linter
|
|
64
|
+
ā āāā check_seo.js # OpenGraph, SEO & Core Web Vitals linter
|
|
65
|
+
ā āāā check_storybook.js # Storybook coverage guard
|
|
66
|
+
ā āāā check_api_contracts.js # Zod schema validation guard
|
|
67
|
+
ā āāā check_migrations.py # Alembic / Django migration idempotency guard
|
|
68
|
+
ā āāā check_db_efficiency.py # ORM N+1 & query efficiency guard
|
|
69
|
+
ā āāā check_scope.py # Git diff vs SDD authorized scope guard
|
|
70
|
+
ā āāā verify_tdd.py # Red-to-Green transition proof checker
|
|
71
|
+
ā āāā celery_guard.py # Celery broker & result backend safety guard
|
|
72
|
+
ā āāā redis_guard.py # Redis decode_responses & timeout guard
|
|
73
|
+
ā āāā postgres_guard.py # PostgreSQL raw query & injection guard
|
|
74
|
+
ā āāā docker_guard.py # Docker non-root USER & healthcheck guard
|
|
75
|
+
āāā test/ # Comprehensive node:test runner suites
|
|
76
|
+
āāā README.md # Primary documentation (English)
|
|
77
|
+
āāā README.es.md # Primary documentation (Spanish)
|
|
78
|
+
āāā package.json # Package manifest (@clckernel)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 3. Active Safeguard Catalog & Deterministic Rules
|
|
84
|
+
|
|
85
|
+
All AI agents operating in repositories provisioned by CLC Kernel are deterministically governed by the following safeguard layers:
|
|
86
|
+
|
|
87
|
+
### š± Frontend & UX Quality Safeguards
|
|
88
|
+
- **`check_responsive.js`**: Enforces mobile-first responsive design, warns against fixed-width pixel overflows (`width: >400px` without media queries), and requires minimum touch targets (44x44px or 48x48px) for buttons and interactive controls.
|
|
89
|
+
- **`check_seo.js`**: Validates essential SEO title/description tags, OpenGraph (`og:title`, `og:image`), GEO tags (`geo.position`, `ICBM`), heading hierarchy (`<h1>` uniqueness), and LCP image `priority` / `fetchpriority="high"`.
|
|
90
|
+
- **`check_a11y.js`**: Audits ARIA roles, missing `alt` attributes on images, and keyboard navigable interactive controls.
|
|
91
|
+
- **`check_ui_reuse.js`**: Prevents duplicate UI classes and arbitrary styling by enforcing the reuse of design system primitives in `components/ui/`.
|
|
92
|
+
- **`check_performance.js`**: Enforces framework-native image optimization (`next/image`, `astro:assets`) and prevents barrel-file imports that break tree-shaking.
|
|
93
|
+
- **`check_api_contracts.js`**: Enforces runtime schema validation (Zod) on all external HTTP requests and API boundaries.
|
|
94
|
+
- **`check_storybook.js`**: Audits Storybook `.stories.tsx` coverage for all new UI primitives.
|
|
95
|
+
|
|
96
|
+
### šļø Backend, Architecture & Data Safeguards
|
|
97
|
+
- **`check_architecture.js / .py`**: Validates Clean Architecture layer boundaries (Domain -> Use Case -> Interface -> Infrastructure) and prevents presentation/route handlers from calling DB queries directly.
|
|
98
|
+
- **`check_db_efficiency.py`**: Detects N+1 query patterns in loops and enforces eager loading (`select_related`, `prefetch_related` in Django; `joinedload` in SQLAlchemy).
|
|
99
|
+
- **`check_migrations.py`**: Ensures database migrations (Alembic / Django) are idempotent, reversible, and do not drop tables/columns destructively without down-revisions.
|
|
100
|
+
- **`scan_secrets.js / .py`**: Scans diffs for private keys, AWS/Stripe credentials, JWT secrets, and hardcoded connection strings.
|
|
101
|
+
- **`check_scope.py`**: Compares modified files against the authorized scope defined in the local SDD specification.
|
|
102
|
+
- **`verify_tdd.py`**: Validates the transition proof from a failing regression test (Red Phase) to a passing implementation (Green Phase).
|
|
103
|
+
|
|
104
|
+
### š³ Infrastructure & Technology Guards
|
|
105
|
+
- **`docker_guard.py`**: Checks Dockerfiles for non-root `USER` directives, prevents `ENV` secret exposures, and requires `HEALTHCHECK` definitions.
|
|
106
|
+
- **`celery_guard.py`**: Enforces broker URL isolation via environment variables, `@shared_task(ignore_result=True)` defaults, and secure backend configs.
|
|
107
|
+
- **`redis_guard.py`**: Enforces `decode_responses=True`, mandatory `socket_connect_timeout`, and prevents hardcoded Redis host strings.
|
|
108
|
+
- **`postgres_guard.py`**: Blocks raw SQL string formatting / Python f-strings in queries to prevent SQL injection vulnerabilities.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 4. Recommended Ecosystem Companions
|
|
113
|
+
CLC Kernel is strictly focused on **Governance, Process & Quality Guards**. It relies modularly on companion tools with graceful degradation:
|
|
114
|
+
- š§ **Engram (MCP):** Long-term memory, session state, and architectural decision records (ADRs).
|
|
115
|
+
- šøļø **Graphify:** Repository knowledge graphs and visual topology mapping.
|
|
116
|
+
- š”ļø **Gentle AI (RDD):** Review-Driven Development with adversarial dual-lens review gates.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 5. Coding & Design Principles
|
|
121
|
+
- **CONCEPTS > CODE:** Never add boilerplate without understanding architectural layer boundaries.
|
|
122
|
+
- **Zero-Dependency Core:** The CLI engine and tool scripts must use native Node.js / Python built-ins wherever possible (zero runtime npm dependencies for the parser and linters).
|
|
123
|
+
- **Polyglot Fidelity:** Native guards must be written in the ecosystem's native idioms (Go AST for Go, Python AST for Python, JS/TS AST for Node).
|
|
124
|
+
- **Graceful Fallbacks:** If optional companion tools or optional linters are missing from the host machine, guards must degrade gracefully with advisory warnings rather than hard crashes.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
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>
|
|
4
|
+
|
|
5
|
+
# š¤ CLC Kernel (`clckernel`)
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/clckernel)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](./README.md)
|
|
10
|
+
|
|
11
|
+
> **El Motor Universal de Gobernanza para Agentes de IA & Orquestador AIUP.**
|
|
12
|
+
> Creado por [CarlosLeonCode](https://github.com/carlosleoncode).
|
|
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.
|
|
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).
|
|
17
|
+
|
|
18
|
+
---
|
|
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)**.
|
|
23
|
+
|
|
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. |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
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":
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
38
|
+
ā AI UNIFIED PROCESS (AIUP) ā
|
|
39
|
+
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāā¬āāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāā¤
|
|
40
|
+
ā 1. SDD ā 2. HIT ā 3. TDD ā 4. AST ā 5. MIRROR ā
|
|
41
|
+
ā Spec-Driven ā Human-in-theā Transición ā Linters de Capas ā Single Source ā
|
|
42
|
+
ā Development ā Loop ā Rojo-a-Verdeā DeterminĆsticos ā of Truth Sync ā
|
|
43
|
+
āāāāāāāāāāāāāāā“āāāāāāāāāāāāāā“āāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāā
|
|
44
|
+
```
|
|
45
|
+
|
|
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.*
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## š” 3. Por QuĆ© Existe CLC Kernel
|
|
75
|
+
|
|
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Ɣ |
|
|
95
|
+
|---|---|---|---|
|
|
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) |
|
|
121
|
+
| š **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 |
|
|
125
|
+
| šø **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 |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## ā” 7. GuĆa Paso a Paso (Ciclo de Vida Completo)
|
|
131
|
+
|
|
132
|
+
```
|
|
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
|
+
```
|
|
137
|
+
|
|
138
|
+
### 1ļøā£ Paso 1: Inicializar el Repositorio (Terminal)
|
|
139
|
+
```bash
|
|
140
|
+
npx clckernel
|
|
141
|
+
```
|
|
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/`.
|
|
143
|
+
|
|
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`.
|
|
148
|
+
|
|
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**.
|
|
153
|
+
|
|
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.
|
|
160
|
+
|
|
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.
|
|
166
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
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>
|
|
4
|
+
|
|
5
|
+
# š¤ CLC Kernel (`clckernel`)
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/clckernel)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](./README.es.md)
|
|
10
|
+
|
|
11
|
+
> **The Universal Polyglot AI Agent Governance Engine & AIUP Orchestrator.**
|
|
12
|
+
> Built by [CarlosLeonCode](https://github.com/carlosleoncode).
|
|
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.
|
|
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).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## šÆ 1. Positioning: A New Category ā AI Agent Governance
|
|
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. |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## šļø 2. Core Conceptual Pillars
|
|
33
|
+
|
|
34
|
+
CLC Kernel is built upon five foundational engineering principles designed to eliminate "vibe coding" hazards:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
38
|
+
ā AI UNIFIED PROCESS (AIUP) ā
|
|
39
|
+
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāā¬āāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāā¤
|
|
40
|
+
ā 1. SDD ā 2. HIT ā 3. TDD ā 4. AST ā 5. MIRROR ā
|
|
41
|
+
ā Spec-Driven ā Human-in-theā Red-to-Greenā Deterministic ā Single Source ā
|
|
42
|
+
ā Development ā Loop ā Transitions ā Layer Linters ā of Truth Sync ā
|
|
43
|
+
āāāāāāāāāāāāāāā“āāāāāāāāāāāāāā“āāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāā
|
|
44
|
+
```
|
|
45
|
+
|
|
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.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## š 6. Polyglot Stack Adapters
|
|
114
|
+
|
|
115
|
+
CLC Kernel includes dedicated adapters for popular technology stacks:
|
|
116
|
+
|
|
117
|
+
| Ecosystem | Detection Signature | Test Runner | Enforced Safeguards |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| āļø **Next.js** | `next` | Vitest / Jest | UI Reuse, Semantic Tokens, RSC Rules, Zod, A11y, Responsive, SEO, Performance |
|
|
120
|
+
| ā” **FastAPI** | `fastapi` | Pytest | Pydantic V2, Alembic Idempotency, Clean Arch AST, DB Efficiency (N+1) |
|
|
121
|
+
| š **Rails** | `Gemfile` | RSpec | RuboCop AST, Brakeman Security, Migration Idempotency |
|
|
122
|
+
| š¹ **Golang** | `go.mod` | `go test` | `golangci-lint` AST, Domain/UseCase Clean Architecture |
|
|
123
|
+
| š¦ **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 |
|
|
125
|
+
| šø **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 |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## ā” 7. Step-by-Step Guide (Full Lifecycle)
|
|
131
|
+
|
|
132
|
+
```
|
|
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
|
+
```
|
|
137
|
+
|
|
138
|
+
### 1ļøā£ Step 1: Bootstrap the Repository (Terminal)
|
|
139
|
+
```bash
|
|
140
|
+
npx clckernel
|
|
141
|
+
```
|
|
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/`.
|
|
143
|
+
|
|
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`.
|
|
148
|
+
|
|
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**.
|
|
153
|
+
|
|
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.
|
|
160
|
+
|
|
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.
|
|
166
|
+
|
|
167
|
+
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLC Kernel ā Executable Binary Entry Point
|
|
4
|
+
* Invokes the main controller module for CLC Kernel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { runCli } = require('../src/index');
|
|
8
|
+
|
|
9
|
+
runCli().catch((err) => {
|
|
10
|
+
console.error('\nā Error ejecutando clckernel:', err);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ADR 001: Deterministic AI Agent Governance Engine
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
Accepted
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
AI coding agents generate code rapidly but introduce technical debt, layer violations, and false-positive test transitions when operating without deterministic guardrails.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
Establish **CLC Kernel** (`clckernel`) as a polyglot AI Agent Governance harness implementing the AI Unified Process (AIUP):
|
|
11
|
+
1. **Spec-Driven Development (SDD)** with Human-in-the-Loop gates.
|
|
12
|
+
2. **Test-Driven Development (TDD)** requiring verified failing tests prior to implementation.
|
|
13
|
+
3. **Deterministic AST Linters** tailored per tech stack (Go, Python, Rust, Ruby, JS/TS, PHP).
|
|
14
|
+
4. **Universal IDE Symlinking** from `AGENTS.md` to all AI IDEs (Cursor, Claude, Gemini, Copilot, Antigravity).
|
|
15
|
+
|
|
16
|
+
## Consequences
|
|
17
|
+
- Guarantees architectural integrity and zero secret leaks.
|
|
18
|
+
- Seamlessly integrates with Engram (memory) and Graphify (knowledge graph).
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clckernel",
|
|
3
|
+
"version": "1.2.6",
|
|
4
|
+
"description": "CLC Kernel ā The Universal Polyglot AI Agent Governance Engine (Next.js, FastAPI, Django, Astro, Rails, Go, Rust, Laravel).",
|
|
5
|
+
"main": "./bin/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"clckernel": "bin/cli.js",
|
|
8
|
+
"create-clckernel": "bin/cli.js",
|
|
9
|
+
"clc-kernel": "bin/cli.js",
|
|
10
|
+
"clc-forge": "bin/cli.js",
|
|
11
|
+
"create-clc-forge": "bin/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"clckernel",
|
|
15
|
+
"clc-kernel",
|
|
16
|
+
"clc-forge",
|
|
17
|
+
"clc_forge",
|
|
18
|
+
"carlosleoncode",
|
|
19
|
+
"polyglot",
|
|
20
|
+
"agent-governance",
|
|
21
|
+
"nextjs",
|
|
22
|
+
"fastapi",
|
|
23
|
+
"django",
|
|
24
|
+
"astro",
|
|
25
|
+
"rails",
|
|
26
|
+
"golang",
|
|
27
|
+
"rust",
|
|
28
|
+
"laravel",
|
|
29
|
+
"vitest",
|
|
30
|
+
"pytest",
|
|
31
|
+
"husky",
|
|
32
|
+
"safeguards"
|
|
33
|
+
],
|
|
34
|
+
"author": "Carlos Leon Code",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test": "node --test test/*.test.js test/**/*.test.js",
|
|
41
|
+
"test:unit": "node --test test/adapters/*.test.js",
|
|
42
|
+
"test:coverage": "NODE_V8_COVERAGE=coverage node --test test/*.test.js test/**/*.test.js"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLC Kernel ā Astro Stack Adapter
|
|
3
|
+
* Supports Astro components, Tailwind CSS v4, Vitest, A11y, and Storybook/MDX stories.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const BaseAdapter = require('./base');
|
|
9
|
+
|
|
10
|
+
class AstroAdapter extends BaseAdapter {
|
|
11
|
+
constructor() {
|
|
12
|
+
super('Astro Framework', 'frontend', 'Vitest / Playwright');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
detect(targetDir) {
|
|
16
|
+
const hasAstroConfig = fs.existsSync(path.join(targetDir, 'astro.config.mjs')) || fs.existsSync(path.join(targetDir, 'astro.config.js'));
|
|
17
|
+
const hasPkg = fs.existsSync(path.join(targetDir, 'package.json'));
|
|
18
|
+
if (!hasPkg) return false;
|
|
19
|
+
try {
|
|
20
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(targetDir, 'package.json'), 'utf-8'));
|
|
21
|
+
const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
22
|
+
return hasAstroConfig || Boolean(deps['astro']);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return hasAstroConfig;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getSafeguards() {
|
|
29
|
+
return [
|
|
30
|
+
'Astro Component & UI Primitive Reuse First Guard',
|
|
31
|
+
'Tailwind v4 Semantic Design Token Guard',
|
|
32
|
+
'Accessibility & ARIA Guard (A11y & alt tags)',
|
|
33
|
+
'Responsive Design & Mobile-First Adaptability Guard (breakpoint & touch target audit)',
|
|
34
|
+
'SEO, GEO & Web Performance Guard (metadata, OpenGraph, Core Web Vitals)',
|
|
35
|
+
'Secret & API Key Leak Scanner',
|
|
36
|
+
'Content Collection Schema Validation Guard',
|
|
37
|
+
'Vitest / Playwright Red-to-Green TDD Validator',
|
|
38
|
+
'Educational Audit Gate (05-audit-report.md)',
|
|
39
|
+
'Memory Guard (Engram / Graphify ADR Sync)'
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the tool manifest for Astro projects.
|
|
45
|
+
* Includes JS guard scripts and external CLI tools (astro check, vitest).
|
|
46
|
+
* @returns {Array<{name: string, language: string, path: string, command: string, description: string, extCLI?: string}>}
|
|
47
|
+
*/
|
|
48
|
+
getTools() {
|
|
49
|
+
const baseTools = [
|
|
50
|
+
{ name: 'scan_secrets', language: 'js', path: 'scan_secrets.js', command: 'node tools/scan_secrets.js', description: 'Scans for leaked secrets and API keys' },
|
|
51
|
+
{ name: 'check_a11y', language: 'js', path: 'check_a11y.js', command: 'node tools/check_a11y.js', description: 'Validates ARIA and accessibility rules' },
|
|
52
|
+
{ name: 'check_responsive', language: 'js', path: 'check_responsive.js', command: 'node tools/check_responsive.js', description: 'Audits mobile-first responsiveness and fixed-width overflows' },
|
|
53
|
+
{ name: 'check_seo', language: 'js', path: 'check_seo.js', command: 'node tools/check_seo.js', description: 'Validates SEO metadata, OpenGraph, GEO tags, and LCP priority' },
|
|
54
|
+
{ name: 'check_custom', language: 'js', path: 'check_custom.js', command: 'node tools/check_custom.js', description: 'Runs user-defined custom rules from .clc-forge.yml' },
|
|
55
|
+
{ name: 'astro_check', language: 'external', path: '', command: 'npx astro check', description: 'Astro type checking', extCLI: 'astro' },
|
|
56
|
+
{ name: 'vitest', language: 'external', path: '', command: 'npx vitest run', description: 'Test runner', extCLI: 'vitest' },
|
|
57
|
+
];
|
|
58
|
+
return this._mergeTechTools(baseTools);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
provision(targetDir, config) {
|
|
62
|
+
super.provision(targetDir, config);
|
|
63
|
+
// Pre-commit hook generation moved to generator.js via getTools() manifest
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = AstroAdapter;
|