clckernel 1.2.8 → 1.2.9

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/README.es.md CHANGED
@@ -17,6 +17,18 @@ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) cod
17
17
 
18
18
  ---
19
19
 
20
+ ## 📋 Tabla de Contenidos
21
+ - [🎯 Casos de Uso](#-casos-de-uso)
22
+ - [🏛️ El Proceso Unificado de IA (AIUP)](#️-el-proceso-unificado-de-ia-aiup)
23
+ - [⚡ Guía Paso a Paso (Ciclo Completo)](#-guía-paso-a-paso-ciclo-completo)
24
+ - [🎮 Interfaz Universal de Comandos](#-interfaz-universal-de-comandos)
25
+ - [🌐 Ecosistemas Soportados y Arquetipos](#-ecosistemas-soportados-y-arquetipos)
26
+ - [🧩 Herramientas Complementarias (Opcionales)](#-herramientas-complementarias-opcionales)
27
+ - [📄 Licencia](#-licencia)
28
+
29
+ ---
30
+
31
+ <a id="casos-de-uso"></a>
20
32
  ## 🎯 Casos de Uso
21
33
 
22
34
  | Caso de Uso | Problema que Resuelve | Cómo lo Resuelve CLC Kernel |
@@ -28,6 +40,7 @@ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) cod
28
40
 
29
41
  ---
30
42
 
43
+ <a id="aiup"></a>
31
44
  ## 🏛️ El Proceso Unificado de IA (AIUP)
32
45
 
33
46
  ```
@@ -48,6 +61,73 @@ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) cod
48
61
 
49
62
  ---
50
63
 
64
+ <a id="guia-paso-a-paso"></a>
65
+ ## ⚡ Guía Paso a Paso (Ciclo Completo)
66
+
67
+ ```
68
+ [1. Terminal] [2. Chat del LLM] [3. Bucle TDD] [4. Git Commit]
69
+ npx clckernel ───► clckernel start ───► "Feature X con harness" ───► Hooks Pre-commit
70
+ (Bootstrap) (Setup Interactivo) (SDD -> HIT -> Tests) (Guardián AST & Secretos)
71
+ ```
72
+
73
+ ### 1️⃣ Paso 1: Inicializar el Repositorio (Terminal)
74
+ ```bash
75
+ npx clckernel start
76
+ ```
77
+ Detecta el framework, genera `AGENTS.md`, crea symlinks dinámicos para todos los IDEs (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`), provisiona hooks pre-commit e instala verificadores AST en `tools/`.
78
+
79
+ ### 2️⃣ Paso 2: Inicializar en el Chat del IDE (CLI Conversacional)
80
+ Abrí Cursor, Claude Code, Gemini CLI, Windsurf o Copilot y escribí:
81
+ > `clckernel start`
82
+
83
+ El agente escanea tu código en silencio, propone un plan de gobernanza adaptado a tu stack y genera `.clckernel.yaml`.
84
+
85
+ ### 3️⃣ Paso 3: Desarrollar con el Arnés AIUP
86
+ Al solicitar una funcionalidad o corrección, indicá al agente:
87
+ > *"Implementa el endpoint de autenticación. **Usa el harness de CLC Kernel**."*
88
+
89
+ El agente ejecutará de forma autónoma el ciclo AIUP completo:
90
+ 1. **Investigación y Causa Raíz:** Inspecciona el código base y dependencias.
91
+ 2. **Especificación SDD Local:** Redacta contratos de API y planes de prueba en `sdds/{cambio}/spec.md`.
92
+ 3. **Revisión HIT:** Solicita tu revisión y aprobación de los contratos propuestos.
93
+ 4. **Fase Roja TDD:** Escribe un test de regresión que falle demostrando el requerimiento.
94
+ 5. **Implementación Verde:** Escribe el código mínimo necesario respetando el aislamiento de capas.
95
+ 6. **Compuerta de Auditoría AST:** Ejecuta `node tools/audit.js` y emite el resumen de verificación.
96
+
97
+ ### 4️⃣ Paso 4: Verificación Determinística de Guards (Git Commit)
98
+ ```bash
99
+ git add .
100
+ git commit -m "feat(auth): add user authentication endpoint"
101
+ ```
102
+ Los hooks pre-commit ejecutan automáticamente los escáneres AST (Clean Architecture, Fuga de Secretos, Scope Guard, Idempotencia de Migraciones). Cualquier violación **bloquea físicamente** el commit.
103
+
104
+ ### 5️⃣ Paso 5: Auditar la Salud del Repositorio en Cualquier Momento (Doctor)
105
+ ```bash
106
+ npx clckernel doctor
107
+ ```
108
+ Audita el 100% de cumplimiento en `AGENTS.md`, `sdds/`, `tools/`, runners de pruebas activos y hooks de Git.
109
+
110
+ ---
111
+
112
+ <a id="interfaz-universal-de-comandos"></a>
113
+ ## 🎮 Interfaz Universal de Comandos (Todos los LLMs y Agentes)
114
+
115
+ CLC Kernel provee una gramática de comandos determinista soportada de forma nativa por **Claude Code, Cursor, Codeium/Windsurf, Copilot, Gemini y Antigravity**:
116
+
117
+ | Comando | Categoría | Protocolo de Ejecución Obligatorio |
118
+ |---|---|---|
119
+ | `clckernel feature <nombre>` | Funcionalidad | Ciclo AIUP completo: Investigación -> Spec Local (`sdds/{nombre}/spec.md`) -> Revisión HIT -> Fase Roja TDD -> Implementación Verde -> Auditoría. |
120
+ | `clckernel fix <descripción>` | Corrección | Análisis de causa raíz (sin editar código) -> Test de regresión que falle -> Corrección quirúrgica limpia -> Compuerta de auditoría. |
121
+ | `clckernel test` | Verificación | Ejecuta la suite de pruebas en el runner nativo del stack y confirma estado verde limpio. |
122
+ | `clckernel audit` | Verificación | Ejecuta `node tools/audit.js` o `python tools/audit.py` y emite el Resumen Educativo. |
123
+ | `clckernel doctor` | Diagnóstico | Valida hooks pre-commit de Git, symlinks espejo para IDEs e integridad del motor AST. |
124
+ | `clckernel commit <mensaje>` | Control de Versiones | Auditoría pre-flight, verificación de scope diff vs SDD y commit con Conventional Commits (cero atribución de IA). |
125
+ | `clckernel guard create <nombre>` | Salvaguardas | Genera el scaffold de un nuevo script de guard AST en el lenguaje nativo del stack en `tools/guards/`. |
126
+ | `clckernel start` | Configuración | Detecta el stack automáticamente, propone el ciclo de vida AIUP y genera `.clckernel.yaml`. |
127
+
128
+ ---
129
+
130
+ <a id="ecosistemas-soportados"></a>
51
131
  ## 🌐 Ecosistemas Soportados y Arquetipos
52
132
 
53
133
  | Ecosistema | Firma de Detección | Test Runner | Salvaguardas Nativas |
@@ -64,28 +144,7 @@ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) cod
64
144
 
65
145
  ---
66
146
 
67
- ## 🚀 Inicio Rápido
68
-
69
- ### 1. Inicializar en Terminal
70
- ```bash
71
- npx clckernel start
72
- ```
73
- Detecta el framework, genera `AGENTS.md`, crea symlinks para todos los IDEs, provisiona hooks pre-commit e instala verificadores AST en `tools/`.
74
-
75
- ### 2. Verificar Estado de Salud
76
- ```bash
77
- npx clckernel doctor
78
- ```
79
- Audita hooks de Git, test runners activos y la integridad del motor AST.
80
-
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**."*
84
-
85
- El agente ejecutará el ciclo AIUP completo: **Especificación SDD -> Aprobación HIT -> Test Rojo -> Implementación Verde -> Auditoría AST**.
86
-
87
- ---
88
-
147
+ <a id="herramientas-complementarias"></a>
89
148
  ## 🧩 Herramientas Complementarias (Opcionales)
90
149
 
91
150
  CLC Kernel se enfoca estrictamente en gobernanza y opera con **cero dependencias foráneas**. Se integra de forma modular con:
@@ -95,5 +154,6 @@ CLC Kernel se enfoca estrictamente en gobernanza y opera con **cero dependencias
95
154
 
96
155
  ---
97
156
 
157
+ <a id="licencia"></a>
98
158
  ## 📄 Licencia
99
159
  MIT © [CarlosLeonCode](https://github.com/carlosleoncode)
package/README.md CHANGED
@@ -17,6 +17,18 @@ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without
17
17
 
18
18
  ---
19
19
 
20
+ ## 📋 Table of Contents
21
+ - [🎯 Use Cases](#-use-cases)
22
+ - [🏛️ The AI Unified Process (AIUP)](#️-the-ai-unified-process-aiup)
23
+ - [⚡ Step-by-Step Guide (Full Lifecycle)](#-step-by-step-guide-full-lifecycle)
24
+ - [🎮 Universal Command Interface](#-universal-command-interface)
25
+ - [🌐 Supported Stacks & Archetypes](#-supported-stacks--archetypes)
26
+ - [🧩 Optional Ecosystem Companions](#-optional-ecosystem-companions)
27
+ - [📄 License](#-license)
28
+
29
+ ---
30
+
31
+ <a id="use-cases"></a>
20
32
  ## 🎯 Use Cases
21
33
 
22
34
  | Use Case | Problem It Solves | How CLC Kernel Solves It |
@@ -28,6 +40,7 @@ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without
28
40
 
29
41
  ---
30
42
 
43
+ <a id="aiup"></a>
31
44
  ## 🏛️ The AI Unified Process (AIUP)
32
45
 
33
46
  ```
@@ -48,6 +61,73 @@ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without
48
61
 
49
62
  ---
50
63
 
64
+ <a id="step-by-step-guide"></a>
65
+ ## ⚡ Step-by-Step Guide (Full Lifecycle)
66
+
67
+ ```
68
+ [1. Terminal] [2. AI Chat] [3. TDD Loop] [4. Git Commit]
69
+ npx clckernel ───► clckernel start ───► "Feature X with harness" ───► Pre-commit Hooks
70
+ (Bootstrap) (Interactive Setup) (SDD -> HIT -> Tests) (AST & Secret Guard)
71
+ ```
72
+
73
+ ### 1️⃣ Step 1: Bootstrap the Repository (Terminal)
74
+ ```bash
75
+ npx clckernel start
76
+ ```
77
+ Auto-detects your framework, generates `AGENTS.md`, creates dynamic IDE symlinks (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`), provisions pre-commit hooks, and creates native AST checks in `tools/`.
78
+
79
+ ### 2️⃣ Step 2: Initialize in Your AI Chat (Conversational CLI)
80
+ Open Cursor, Claude Code, Gemini CLI, Windsurf, or Copilot and type:
81
+ > `clckernel start`
82
+
83
+ The agent scans your codebase silently, proposes an AIUP governance plan tailored to your framework, and generates `.clckernel.yaml`.
84
+
85
+ ### 3️⃣ Step 3: Develop with the AIUP Harness
86
+ When requesting features or bugfixes, instruct your agent:
87
+ > *"Add user authentication endpoint. **Follow the CLC Kernel harness**."*
88
+
89
+ The agent autonomously executes the complete AIUP cycle:
90
+ 1. **Research & Root Cause Analysis:** Inspects codebase and dependencies.
91
+ 2. **Local SDD Spec:** Writes API contracts and test plans in `sdds/{change}/spec.md`.
92
+ 3. **HIT Review:** Requests your review and approval on proposed contracts.
93
+ 4. **TDD Red Phase:** Writes a failing regression test proving the requirement.
94
+ 5. **Clean Implementation (Green Phase):** Writes minimal code to pass tests while respecting layer isolation.
95
+ 6. **AST Audit Gate:** Runs `node tools/audit.js` and outputs the verification summary.
96
+
97
+ ### 4️⃣ Step 4: Deterministic Guard Verification (Git Commit)
98
+ ```bash
99
+ git add .
100
+ git commit -m "feat(auth): add user authentication endpoint"
101
+ ```
102
+ Pre-commit hooks automatically execute AST scanners (Clean Architecture, Secret Leaks, Scope Guard, Migration Idempotency). Any non-compliant commit is **physically blocked** before touching Git history.
103
+
104
+ ### 5️⃣ Step 5: Verify Repository Health Anytime (Doctor)
105
+ ```bash
106
+ npx clckernel doctor
107
+ ```
108
+ Audits 100% compliance across `AGENTS.md`, `sdds/`, `tools/`, active test runners, and Git hooks.
109
+
110
+ ---
111
+
112
+ <a id="universal-command-interface"></a>
113
+ ## 🎮 Universal Command Interface (All LLMs & Agents)
114
+
115
+ CLC Kernel provides a deterministic command grammar supported natively by **Claude Code, Cursor, Codeium/Windsurf, Copilot, Gemini, and Antigravity**:
116
+
117
+ | Command | Category | Mandatory Execution Protocol |
118
+ |---|---|---|
119
+ | `clckernel feature <name>` | Feature | Full AIUP cycle: Research -> Local Spec (`sdds/{name}/spec.md`) -> HIT review -> TDD Red Phase -> Green Implementation -> Audit. |
120
+ | `clckernel fix <issue>` | Bug Fix | Root-cause analysis (no direct code edits) -> Failing regression test -> Surgical clean fix -> Audit gate. |
121
+ | `clckernel test` | Verification | Runs repository test suite in the native stack runner and confirms clean pass. |
122
+ | `clckernel audit` | Verification | Runs `node tools/audit.js` or `python tools/audit.py` and emits the Educational Summary. |
123
+ | `clckernel doctor` | Diagnostics | Checks Git pre-commit hooks, IDE mirror symlinks, and AST engine integrity. |
124
+ | `clckernel commit <message>` | Version Control | Pre-flight audit, verifies diff vs SDD scope, and commits with Conventional Commits (zero AI attribution). |
125
+ | `clckernel guard create <name>` | Safeguards | Scaffolds a new AST guard script in the stack's native language in `tools/guards/`. |
126
+ | `clckernel start` | Setup | Auto-detects stack, proposes AIUP lifecycle, and generates `.clckernel.yaml`. |
127
+
128
+ ---
129
+
130
+ <a id="supported-stacks"></a>
51
131
  ## 🌐 Supported Stacks & Archetypes
52
132
 
53
133
  | Ecosystem | Detection Signature | Test Runner | Native Safeguards |
@@ -64,28 +144,7 @@ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without
64
144
 
65
145
  ---
66
146
 
67
- ## 🚀 Quickstart
68
-
69
- ### 1. Initialize in Terminal
70
- ```bash
71
- npx clckernel start
72
- ```
73
- Auto-detects your framework, generates `AGENTS.md`, creates IDE rule symlinks, provisions pre-commit hooks, and creates native AST checks in `tools/`.
74
-
75
- ### 2. Verify Health
76
- ```bash
77
- npx clckernel doctor
78
- ```
79
- Audits Git hooks, active test runners, and AST engine integrity.
80
-
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**."*
84
-
85
- The agent executes the full AIUP loop: **SDD Spec -> HIT Review -> Failing Test (Red) -> Implementation (Green) -> AST Audit**.
86
-
87
- ---
88
-
147
+ <a id="ecosystem-companions"></a>
89
148
  ## 🧩 Optional Ecosystem Companions
90
149
 
91
150
  CLC Kernel focuses strictly on governance and runs with **zero foreign dependencies**. It seamlessly integrates with companion tools:
@@ -95,5 +154,6 @@ CLC Kernel focuses strictly on governance and runs with **zero foreign dependenc
95
154
 
96
155
  ---
97
156
 
157
+ <a id="license"></a>
98
158
  ## 📄 License
99
159
  MIT © [CarlosLeonCode](https://github.com/carlosleoncode)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clckernel",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
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
6
  "files": [
@@ -95,6 +95,13 @@ class AgentOSAdapter extends BaseAdapter {
95
95
  command: 'node tools/check_domain_data.js',
96
96
  description: 'Domain deliverables schema and clean state integrity'
97
97
  },
98
+ {
99
+ name: 'check_test_calendar_sync',
100
+ language: 'node',
101
+ path: 'tools/check_test_calendar_sync.js',
102
+ command: 'node tools/check_test_calendar_sync.js',
103
+ description: 'Test calendar harness synchronization and parity check'
104
+ },
98
105
  {
99
106
  name: 'scan_secrets',
100
107
  language: 'node',
@@ -146,6 +153,22 @@ When operating as domain agents for end-users and non-technical operators:
146
153
 
147
154
  ---
148
155
 
156
+ ## 🎮 Universal Command Interface (All LLMs & Agents)
157
+ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`, execute the deterministic state machine below:
158
+
159
+ | Command | Lifecycle Phase | Mandatory Execution Protocol |
160
+ |---|---|---|
161
+ | \`clckernel feature <name>\` | New Feature | 1. Research affected layers.<br>2. Author local spec in \`sdds/{name}/spec.md\`.<br>3. Present HIT review to user and wait for approval.<br>4. Write failing test (Red Phase).<br>5. Implement clean code (Green Phase).<br>6. Run \`node tools/audit.js\` (or \`audit.py\`). |
162
+ | \`clckernel fix <issue>\` | Bug Fix | 1. Investigate root cause (no code edits).<br>2. Reproduce with failing test (Red Phase).<br>3. Minimal surgical fix respecting Clean Arch (Green Phase).<br>4. Run audit gate without skipping. |
163
+ | \`clckernel test\` | Verification | Run test suite and verify clean pass (exit code 0). |
164
+ | \`clckernel audit\` | Verification | Run \`node tools/audit.js\` or \`python tools/audit.py\` and output the Educational Summary. |
165
+ | \`clckernel doctor\` | Diagnostics | Check git pre-commit hooks, IDE symlinks, and AST engine integrity. |
166
+ | \`clckernel commit <message>\` | Version Control | Run full audit, verify tests pass, ensure no changes outside SDD scope, and commit with conventional commits (never add AI attribution). |
167
+ | \`clckernel guard create <name>\` | Safeguards | Scaffold a new AST guard in the stack's native language in \`tools/guards/\`. |
168
+ | \`clckernel start\` | Setup | Scan codebase, propose governance plan, and materialize \`.clckernel.yaml\`. |
169
+
170
+ ---
171
+
149
172
  ## 🛡️ Core AI Safeguards
150
173
  ${this.getSafeguards().map(s => `- ${s}`).join('\n')}
151
174
  `;
package/src/generator.js CHANGED
@@ -325,6 +325,20 @@ ${isFront ? `- UI Component Reuse First (components/ui/ & semantic tokens)
325
325
  - Database Efficiency & N+1 Performance Guard
326
326
  - Database Migration Idempotency Guard
327
327
  - Memory Guard (Engram / Graphify)`}
328
+
329
+ ## 3. Universal Command Interface (All LLMs & Agents)
330
+ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`, execute the deterministic state machine below:
331
+
332
+ | Command | Lifecycle Phase | Mandatory Execution Protocol |
333
+ |---|---|---|
334
+ | \`clckernel feature <name>\` | New Feature | 1. Research affected layers.<br>2. Author local spec in \`sdds/{name}/spec.md\`.<br>3. Present HIT review to user and wait for approval.<br>4. Write failing test (Red Phase).<br>5. Implement clean code (Green Phase).<br>6. Run \`node tools/audit.js\` (or \`audit.py\`). |
335
+ | \`clckernel fix <issue>\` | Bug Fix | 1. Investigate root cause (no code edits).<br>2. Reproduce with failing test (Red Phase).<br>3. Minimal surgical fix respecting Clean Arch (Green Phase).<br>4. Run audit gate without skipping. |
336
+ | \`clckernel test\` | Verification | Run test suite (\`${config.testRunner || 'npm test'}\`) and verify clean pass (exit code 0). |
337
+ | \`clckernel audit\` | Verification | Run \`node tools/audit.js\` or \`python tools/audit.py\` and output the Educational Summary. |
338
+ | \`clckernel doctor\` | Diagnostics | Check git pre-commit hooks, IDE symlinks, and AST engine integrity. |
339
+ | \`clckernel commit <message>\` | Version Control | Run full audit, verify tests pass, ensure no changes outside SDD scope, and commit with conventional commits (never add AI attribution). |
340
+ | \`clckernel guard create <name>\` | Safeguards | Scaffold a new AST guard in the stack's native language in \`tools/guards/\`. |
341
+ | \`clckernel start\` | Setup | Scan codebase, propose governance plan, and materialize \`.clckernel.yaml\`. |
328
342
  `;
329
343
  fs.writeFileSync(path.join(targetDir, 'AGENTS.md'), agentsContent, 'utf-8');
330
344
  }
@@ -372,68 +386,31 @@ function installAgenticCLI(targetDir) {
372
386
  // 1. Crear el Directorio de Skills
373
387
  const skillDir = path.join(targetDir, '.agents', 'skills', 'clckernel_cli');
374
388
  const legacySkillDir = path.join(targetDir, '.agents', 'skills', 'clc_forge_cli');
375
- fs.mkdirSync(skillDir, { recursive: true });
376
- fs.mkdirSync(legacySkillDir, { recursive: true });
377
-
378
- // 2. Inyectar el SKILL.md Maestro
379
- const skillContent = `---
380
- name: clckernel_cli
381
- description: Conversational CLI Orchestrator for the CLC Kernel AI Agent Governance Engine.
382
- triggers:
383
- - clckernel start
384
- - clckernel create_guard
385
- - clckernel remove_guard
386
- - clckernel add_phase
387
- - clckernel remove_phase
388
- - clc_forge start
389
- - clc_forge create_guard
390
- ---
391
-
392
- # 🤖 CLC Kernel — Conversational CLI
393
-
394
- You are the internal runtime engine of CLC Kernel (AIUP Orchestrator).
395
- DO NOT suggest terminal bash commands for these triggers; YOU are the execution environment. Your job is to guide the user through the agent governance lifecycle via chat, dynamically discovering the environment, and manipulating configuration files.
396
-
397
- ## 🚀 INTENT: \`clckernel start\` (or \`clc_forge start\`)
398
- Execute this exact sequence without skipping steps:
399
-
400
- ### Phase 1: Silent Discovery
401
- Scan the current project using your file-reading capabilities. Identify the primary tech stack by looking for signature files (e.g., \`package.json\`, \`Gemfile\`, \`Cargo.toml\`, \`go.mod\`).
402
- *Golden Rule: Do not assume the language. Read the files to establish context.*
403
-
404
- ### Phase 2: Interview & Proposal
405
- Introduce yourself as CLC Kernel and state the detected stack.
406
- Propose a standard governance plan for that ecosystem (SDD + TDD + stack-specific Safeguards).
407
- ASK the user directly:
408
- 1. "Should we activate these standard phases, or do you want to define custom ones?"
409
- 2. "Do you have any specific security needs that require a custom Guard?"
410
- **STOP.** Wait for the user's response.
411
-
412
- ### Phase 3: Materialization
413
- Based on user approval, generate and write the \`.clckernel.yaml\` file in the project root.
414
-
415
- ---
416
-
417
- ## 🛠️ INTENT: \`clckernel create_guard\`
418
- 1. Ask the user what behavior they want to audit or block. **STOP.** Wait for technical details.
419
- 2. Based on the detected stack, write the linter/guard script in the **NATIVE ECOSYSTEM LANGUAGE** (Ruby for Rails, Go \`ast\` for Golang, Python \`ast\` for FastAPI, JS for Node). Save it in \`tools/guards/\`.
420
- 3. Update the \`.clckernel.yaml\` file to include the new Guard.
421
-
422
- ---
423
-
424
- ## 🗑️ INTENT: \`clckernel remove_guard\`
425
- 1. Ask which guard to remove and if the script should be deleted. **STOP.** Wait for response.
426
- 2. Update \`.clckernel.yaml\` and delete the script from \`tools/guards/\` if requested.
427
-
428
- ---
429
-
430
- ## 🔄 INTENT: \`clckernel add_phase\` / \`clckernel remove_phase\`
431
- 1. Ask for details of the lifecycle phase to add or remove. **STOP.** Wait for response.
432
- 2. Update the \`execution_phases\` block in \`.clckernel.yaml\`, preserving the logical sequence.
433
- `;
434
-
435
- fs.writeFileSync(path.join(skillDir, 'SKILL.md'), skillContent, 'utf-8');
436
- fs.writeFileSync(path.join(legacySkillDir, 'SKILL.md'), skillContent, 'utf-8');
389
+ const skillRefDir = path.join(skillDir, 'reference');
390
+ const legacySkillRefDir = path.join(legacySkillDir, 'reference');
391
+ fs.mkdirSync(skillRefDir, { recursive: true });
392
+ fs.mkdirSync(legacySkillRefDir, { recursive: true });
393
+
394
+ // 2. Inyectar el SKILL.md Maestro y Playbooks de Referencia
395
+ const bundledSkillDir = path.join(__dirname, '..', '.agents', 'skills', 'clckernel_cli');
396
+ const bundledSkillFile = path.join(bundledSkillDir, 'SKILL.md');
397
+ const bundledRefDir = path.join(bundledSkillDir, 'reference');
398
+
399
+ if (fs.existsSync(bundledSkillFile)) {
400
+ fs.copyFileSync(bundledSkillFile, path.join(skillDir, 'SKILL.md'));
401
+ fs.copyFileSync(bundledSkillFile, path.join(legacySkillDir, 'SKILL.md'));
402
+ }
403
+
404
+ if (fs.existsSync(bundledRefDir)) {
405
+ const playbooks = fs.readdirSync(bundledRefDir);
406
+ for (const pb of playbooks) {
407
+ const srcPb = path.join(bundledRefDir, pb);
408
+ if (fs.statSync(srcPb).isFile()) {
409
+ fs.copyFileSync(srcPb, path.join(skillRefDir, pb));
410
+ fs.copyFileSync(srcPb, path.join(legacySkillRefDir, pb));
411
+ }
412
+ }
413
+ }
437
414
 
438
415
  // 3. Crear Symlinks Dinámicos al AGENTS.md (El Single Source of Truth)
439
416
  const sourceFile = 'AGENTS.md';
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Test Calendar Parity & Auto-Sync Guard
4
+ * Ensures that any modification made to the calendar engine (templates/content-calendar/)
5
+ * is immediately synchronized to the test calendar harness (tests/).
6
+ * Self-contained: uses only Node.js built-ins.
7
+ *
8
+ * @param {string} targetDir - Directory to scan (defaults to cwd)
9
+ * @returns {{ exitCode: number, skipped: boolean, name: string, data: object }}
10
+ */
11
+ const check = async function checkTestCalendarSync(targetDir) {
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+
15
+ const dir = targetDir || process.cwd();
16
+ const templateDir = path.join(dir, 'templates', 'content-calendar');
17
+ const testDir = path.join(dir, 'tests');
18
+
19
+ if (!fs.existsSync(templateDir) || !fs.existsSync(testDir)) {
20
+ return {
21
+ exitCode: 0,
22
+ skipped: true,
23
+ name: 'check_test_calendar_sync',
24
+ data: { violations: [], message: 'No templates/content-calendar or tests/ directory found' }
25
+ };
26
+ }
27
+
28
+ const syncPairs = [
29
+ { src: path.join(templateDir, 'index.html'), dest: path.join(testDir, 'index.html'), label: 'index.html' },
30
+ { src: path.join(templateDir, 'data.js'), dest: path.join(testDir, 'data.js'), label: 'data.js' },
31
+ { src: path.join(templateDir, 'data.js'), dest: path.join(testDir, 'mock-data.js'), label: 'mock-data.js' }
32
+ ];
33
+
34
+ const syncedFiles = [];
35
+ const violations = [];
36
+
37
+ for (const pair of syncPairs) {
38
+ if (!fs.existsSync(pair.src)) continue;
39
+
40
+ let needsSync = false;
41
+ if (!fs.existsSync(pair.dest)) {
42
+ needsSync = true;
43
+ } else {
44
+ const srcBuf = fs.readFileSync(pair.src);
45
+ const destBuf = fs.readFileSync(pair.dest);
46
+ if (!srcBuf.equals(destBuf)) {
47
+ needsSync = true;
48
+ }
49
+ }
50
+
51
+ if (needsSync) {
52
+ try {
53
+ fs.copyFileSync(pair.src, pair.dest);
54
+ syncedFiles.push(pair.label);
55
+ } catch (err) {
56
+ violations.push({
57
+ file: pair.label,
58
+ message: `Failed to synchronize ${pair.label}: ${err.message}`
59
+ });
60
+ }
61
+ }
62
+ }
63
+
64
+ // Also verify mock-content.json has channelProfiles if data.js has it
65
+ const dataJsPath = path.join(templateDir, 'data.js');
66
+ const mockContentPath = path.join(testDir, 'mock-content.json');
67
+ if (fs.existsSync(dataJsPath) && fs.existsSync(mockContentPath)) {
68
+ try {
69
+ const dataJsContent = fs.readFileSync(dataJsPath, 'utf-8');
70
+ if (dataJsContent.includes('"channelProfiles"') && !fs.readFileSync(mockContentPath, 'utf-8').includes('"channelProfiles"')) {
71
+ // Hydrate channelProfiles from data.js
72
+ const match = dataJsContent.match(/"channelProfiles":\s*\{[\s\S]*?\n\s{4}\}/);
73
+ if (match) {
74
+ let mockJson = fs.readFileSync(mockContentPath, 'utf-8');
75
+ mockJson = mockJson.replace(/"pillarMix":\s*\{[\s\S]*?\n\s{4}\}/, (m) => `${m},\n ${match[0]}`);
76
+ fs.writeFileSync(mockContentPath, mockJson, 'utf-8');
77
+ syncedFiles.push('mock-content.json');
78
+ }
79
+ }
80
+ } catch (e) {
81
+ // non-fatal
82
+ }
83
+ }
84
+
85
+ const exitCode = violations.length > 0 ? 1 : 0;
86
+ const message = violations.length > 0
87
+ ? `Failed to sync ${violations.length} test calendar files`
88
+ : (syncedFiles.length > 0
89
+ ? `Auto-synchronized ${syncedFiles.length} test calendar file(s): ${syncedFiles.join(', ')}`
90
+ : 'Test calendar is 100% in sync with templates/content-calendar');
91
+
92
+ return {
93
+ exitCode,
94
+ skipped: false,
95
+ name: 'check_test_calendar_sync',
96
+ data: {
97
+ violations,
98
+ syncedFiles,
99
+ message
100
+ }
101
+ };
102
+ };
103
+
104
+ module.exports = check;
105
+
106
+ if (require.main === module) {
107
+ check(process.argv[2]).then(result => {
108
+ console.log(JSON.stringify(result, null, 2));
109
+ process.exit(result.exitCode);
110
+ });
111
+ }