clckernel 1.2.9 → 1.2.11

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
@@ -22,6 +22,7 @@ Los agentes de programación con IA (Cursor, Claude Code, Windsurf, Copilot) cod
22
22
  - [🏛️ El Proceso Unificado de IA (AIUP)](#️-el-proceso-unificado-de-ia-aiup)
23
23
  - [⚡ Guía Paso a Paso (Ciclo Completo)](#-guía-paso-a-paso-ciclo-completo)
24
24
  - [🎮 Interfaz Universal de Comandos](#-interfaz-universal-de-comandos)
25
+ - [🔄 Actualización de Proyectos Existentes](#-actualización-de-proyectos-existentes)
25
26
  - [🌐 Ecosistemas Soportados y Arquetipos](#-ecosistemas-soportados-y-arquetipos)
26
27
  - [🧩 Herramientas Complementarias (Opcionales)](#-herramientas-complementarias-opcionales)
27
28
  - [📄 Licencia](#-licencia)
@@ -123,10 +124,34 @@ CLC Kernel provee una gramática de comandos determinista soportada de forma nat
123
124
  | `clckernel doctor` | Diagnóstico | Valida hooks pre-commit de Git, symlinks espejo para IDEs e integridad del motor AST. |
124
125
  | `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
126
  | `clckernel guard create <nombre>` | Salvaguardas | Genera el scaffold de un nuevo script de guard AST en el lenguaje nativo del stack en `tools/guards/`. |
127
+ | `clckernel update` | Mantenimiento | Actualización no destructiva: refresca herramientas core, skills y symlinks de IDEs sin sobreescribir SDDs, guards personalizados ni `.clckernel.yaml`. |
126
128
  | `clckernel start` | Configuración | Detecta el stack automáticamente, propone el ciclo de vida AIUP y genera `.clckernel.yaml`. |
127
129
 
128
130
  ---
129
131
 
132
+ <a id="actualizacion-de-proyectos-existentes"></a>
133
+ ## 🔄 Actualización de Proyectos Existentes (No Destructiva)
134
+
135
+ Cuando se publican nuevas versiones de CLC Kernel con nuevos guards AST, playbooks actualizados o reglas optimizadas para IDEs, podés actualizar tu repositorio de forma segura sin perder tu trabajo:
136
+
137
+ ```bash
138
+ npx clckernel update
139
+ ```
140
+ O directamente desde el chat de tu agente IA:
141
+ ```bash
142
+ clckernel update
143
+ ```
144
+
145
+ ### 🔒 La Garantía de Actualización No Destructiva:
146
+ - **Refresca y Actualiza:** Orquestadores centrales (`tools/audit.js`, `tools/audit.py`), guards AST nativos, Skills de agentes (`.agents/skills/`) y symlinks de IDEs (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`, Copilot, Antigravity).
147
+ - **100% Preservado:**
148
+ - `sdds/`: Todas las especificaciones locales, planes y recibos de verificación permanecen intactos.
149
+ - `tools/guards/`: Todos los guards AST personalizados creados por el equipo se conservan sin modificaciones.
150
+ - `.clckernel.yaml`: Todas las configuraciones y umbrales personalizados se mantienen.
151
+ - El código fuente de la aplicación y modelos de dominio jamás se tocan.
152
+
153
+ ---
154
+
130
155
  <a id="ecosistemas-soportados"></a>
131
156
  ## 🌐 Ecosistemas Soportados y Arquetipos
132
157
 
package/README.md CHANGED
@@ -22,6 +22,7 @@ AI coding agents (Cursor, Claude Code, Windsurf, Copilot) code fast, but without
22
22
  - [🏛️ The AI Unified Process (AIUP)](#️-the-ai-unified-process-aiup)
23
23
  - [⚡ Step-by-Step Guide (Full Lifecycle)](#-step-by-step-guide-full-lifecycle)
24
24
  - [🎮 Universal Command Interface](#-universal-command-interface)
25
+ - [🔄 Updating an Existing Project](#-updating-an-existing-project)
25
26
  - [🌐 Supported Stacks & Archetypes](#-supported-stacks--archetypes)
26
27
  - [🧩 Optional Ecosystem Companions](#-optional-ecosystem-companions)
27
28
  - [📄 License](#-license)
@@ -123,10 +124,34 @@ CLC Kernel provides a deterministic command grammar supported natively by **Clau
123
124
  | `clckernel doctor` | Diagnostics | Checks Git pre-commit hooks, IDE mirror symlinks, and AST engine integrity. |
124
125
  | `clckernel commit <message>` | Version Control | Pre-flight audit, verifies diff vs SDD scope, and commits with Conventional Commits (zero AI attribution). |
125
126
  | `clckernel guard create <name>` | Safeguards | Scaffolds a new AST guard script in the stack's native language in `tools/guards/`. |
127
+ | `clckernel update` | Maintenance | Non-destructive update: refreshes core tools, skills & IDE symlinks without overwriting SDDs, custom guards, or `.clckernel.yaml`. |
126
128
  | `clckernel start` | Setup | Auto-detects stack, proposes AIUP lifecycle, and generates `.clckernel.yaml`. |
127
129
 
128
130
  ---
129
131
 
132
+ <a id="updating-an-existing-project"></a>
133
+ ## 🔄 Updating an Existing Project (Non-Destructive)
134
+
135
+ When new versions of CLC Kernel are released with new AST guards, upgraded playbooks, or improved IDE rules, update your project safely without losing your work:
136
+
137
+ ```bash
138
+ npx clckernel update
139
+ ```
140
+ Or from your AI agent chat:
141
+ ```bash
142
+ clckernel update
143
+ ```
144
+
145
+ ### 🔒 The Non-Destructive Update Guarantee:
146
+ - **Refreshes & Upgrades:** Core orchestrators (`tools/audit.js`, `tools/audit.py`), built-in AST guards, Agent Skills (`.agents/skills/`), and IDE symlinks (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`, Copilot, Antigravity).
147
+ - **100% Preserved:**
148
+ - `sdds/`: All local specifications, plans, and verification receipts remain intact.
149
+ - `tools/guards/`: All team-authored custom AST guards are preserved without modification.
150
+ - `.clckernel.yaml`: All custom thresholds and active safeguard selections are preserved.
151
+ - Application source code and domain models are never touched.
152
+
153
+ ---
154
+
130
155
  <a id="supported-stacks"></a>
131
156
  ## 🌐 Supported Stacks & Archetypes
132
157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clckernel",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
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": [
@@ -113,8 +113,11 @@ class AgentOSAdapter extends BaseAdapter {
113
113
  }
114
114
 
115
115
  provision(targetDir, config) {
116
- // 1. Create docs/, sdds/, and tools/
117
- super.provision(targetDir, config);
116
+ // 1. Create docs/, sdds/, and tools/. AGENTS.md is owned by this adapter
117
+ // (dual-layer template below), so BaseAdapter must not write its generic
118
+ // law file — otherwise the generic one lands first and, being present,
119
+ // would make the guard below skip the dual-layer render entirely.
120
+ super.provision(targetDir, { ...(config || {}), skipAgentsMd: true });
118
121
 
119
122
  // 2. Write Dual-Layer AGENTS.md
120
123
  const dualLayerAgents = `# Standard Operating Procedure (SOP) — AGENTS
@@ -165,6 +168,7 @@ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`,
165
168
  | \`clckernel doctor\` | Diagnostics | Check git pre-commit hooks, IDE symlinks, and AST engine integrity. |
166
169
  | \`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
170
  | \`clckernel guard create <name>\` | Safeguards | Scaffold a new AST guard in the stack's native language in \`tools/guards/\`. |
171
+ | \`clckernel update\` | Maintenance | Non-destructive update: refresh core tools, playbooks & symlinks (preserves SDDs & custom guards). |
168
172
  | \`clckernel start\` | Setup | Scan codebase, propose governance plan, and materialize \`.clckernel.yaml\`. |
169
173
 
170
174
  ---
@@ -173,7 +177,12 @@ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`,
173
177
  ${this.getSafeguards().map(s => `- ${s}`).join('\n')}
174
178
  `;
175
179
 
176
- fs.writeFileSync(path.join(targetDir, 'AGENTS.md'), dualLayerAgents, 'utf-8');
180
+ // Guard: never overwrite a project-customized AGENTS.md (e.g. a Laila MOS
181
+ // law file carrying domain invariants the template cannot know about).
182
+ const dualAgentsPath = path.join(targetDir, 'AGENTS.md');
183
+ if (!fs.existsSync(dualAgentsPath)) {
184
+ fs.writeFileSync(dualAgentsPath, dualLayerAgents, 'utf-8');
185
+ }
177
186
 
178
187
  // 3. Create AI IDE mirror symlinks
179
188
  const mirrors = ['CLAUDE.md', 'GEMINI.md', '.cursorrules', '.windsurfrules'];
@@ -57,6 +57,10 @@ class BaseAdapter {
57
57
  }
58
58
 
59
59
  provision(targetDir, config) {
60
+ // Subclasses that render their own AGENTS.md pass { skipAgentsMd: true }
61
+ // so this generic law file is never written alongside (or over) theirs.
62
+ const skipAgentsMd = !!(config && config.skipAgentsMd);
63
+
60
64
  // 1. Create docs/ and sdds/
61
65
  fs.mkdirSync(path.join(targetDir, 'docs', 'Journal'), { recursive: true });
62
66
  fs.mkdirSync(path.join(targetDir, 'docs', 'Architecture'), { recursive: true });
@@ -75,7 +79,7 @@ class BaseAdapter {
75
79
 
76
80
  // 3. Write AGENTS.md
77
81
  const isFront = this.projectType === 'frontend';
78
- const agentsContent = `# 🔨 CLC Kernel ${this.name} (${this.projectType.toUpperCase()}) — AGENTS
82
+ const agentsContent = skipAgentsMd ? '' : `# 🔨 CLC Kernel ${this.name} (${this.projectType.toUpperCase()}) — AGENTS
79
83
 
80
84
  This document is the **authoritative law** for AI agents working in this repository.
81
85
  Forged by **CLC Kernel: The AI Agent Governance Engine**.
@@ -102,7 +106,14 @@ Forged by **CLC Kernel: The AI Agent Governance Engine**.
102
106
  ## 2. Core AI Safeguards (${this.name})
103
107
  ${this.getSafeguards().map(s => `- ${s}`).join('\n')}
104
108
  `;
105
- fs.writeFileSync(path.join(targetDir, 'AGENTS.md'), agentsContent, 'utf-8');
109
+ // Guard: never overwrite a project-customized AGENTS.md.
110
+ if (skipAgentsMd) {
111
+ return;
112
+ }
113
+ const agentsPath = path.join(targetDir, 'AGENTS.md');
114
+ if (!fs.existsSync(agentsPath)) {
115
+ fs.writeFileSync(agentsPath, agentsContent, 'utf-8');
116
+ }
106
117
  }
107
118
  }
108
119
 
package/src/generator.js CHANGED
@@ -338,9 +338,16 @@ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`,
338
338
  | \`clckernel doctor\` | Diagnostics | Check git pre-commit hooks, IDE symlinks, and AST engine integrity. |
339
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
340
  | \`clckernel guard create <name>\` | Safeguards | Scaffold a new AST guard in the stack's native language in \`tools/guards/\`. |
341
+ | \`clckernel update\` | Maintenance | Non-destructive update: refresh core tools, playbooks & symlinks (preserves SDDs & custom guards). |
341
342
  | \`clckernel start\` | Setup | Scan codebase, propose governance plan, and materialize \`.clckernel.yaml\`. |
342
343
  `;
343
- fs.writeFileSync(path.join(targetDir, 'AGENTS.md'), agentsContent, 'utf-8');
344
+ // Guard: never overwrite an existing project-customized AGENTS.md.
345
+ // This prevents clckernel update from replacing Laila MOS invariants
346
+ // (carousel format, one-question-onboarding, dynamic calendar, immutability).
347
+ if (!fs.existsSync(path.join(targetDir, 'AGENTS.md'))) {
348
+ fs.writeFileSync(path.join(targetDir, 'AGENTS.md'), agentsContent, 'utf-8');
349
+ }
350
+
344
351
  }
345
352
 
346
353
  // Step 2: Install tools (manifest-driven or fallback)
package/src/index.js CHANGED
@@ -14,16 +14,23 @@ async function runCli() {
14
14
  const command = args[0];
15
15
 
16
16
  let targetDir = process.cwd();
17
- if (command && !command.startsWith('-') && command !== 'doctor') {
17
+ if (command && !command.startsWith('-') && command !== 'doctor' && command !== 'update') {
18
18
  targetDir = path.resolve(command);
19
19
  }
20
20
 
21
21
  if (command === 'doctor' || args.includes('--doctor')) {
22
- if (args[1]) targetDir = path.resolve(args[1]);
22
+ if (args[1] && args[1] !== '--doctor') targetDir = path.resolve(args[1]);
23
23
  runDoctor(targetDir);
24
24
  return;
25
25
  }
26
26
 
27
+ if (command === 'update' || args.includes('--update')) {
28
+ if (args[1] && args[1] !== '--update') targetDir = path.resolve(args[1]);
29
+ const { runUpdate } = require('./updater');
30
+ await runUpdate(targetDir);
31
+ return;
32
+ }
33
+
27
34
  // 1. Print Pro ASCII Banner
28
35
  printBanner();
29
36
 
package/src/updater.js ADDED
@@ -0,0 +1,95 @@
1
+ /**
2
+ * CLC Kernel — Non-Destructive Harness Updater
3
+ * Safely updates core AST tools, skills, playbooks, and IDE symlinks in an existing
4
+ * project while guaranteeing 100% preservation of:
5
+ * - Local specifications (sdds/)
6
+ * - Custom AST guards (tools/guards/)
7
+ * - Project configuration and custom thresholds (.clckernel.yaml / .clc-forge.yaml)
8
+ * - Application source code and domain models
9
+ */
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const { autoDetectStack } = require('./detector');
14
+ const { generateHarness } = require('./generator');
15
+
16
+ function updateHarness(targetDir = process.cwd(), options = {}) {
17
+ const resolvedDir = path.resolve(targetDir);
18
+
19
+ if (!fs.existsSync(resolvedDir)) {
20
+ throw new Error(`Target directory "${resolvedDir}" does not exist.`);
21
+ }
22
+
23
+ // 1. Detect Stack
24
+ const detected = autoDetectStack(resolvedDir);
25
+
26
+ // 2. Identify existing preserved assets
27
+ const preserved = {
28
+ sdds: fs.existsSync(path.join(resolvedDir, 'sdds')),
29
+ customGuards: fs.existsSync(path.join(resolvedDir, 'tools', 'guards')),
30
+ configYaml: fs.existsSync(path.join(resolvedDir, '.clckernel.yaml')) || fs.existsSync(path.join(resolvedDir, '.clc-forge.yaml')),
31
+ };
32
+
33
+ // 3. Run harness generation (refreshes tools, hooks, skills, and symlinks)
34
+ generateHarness(resolvedDir, detected);
35
+
36
+ // 4. Ensure AGENTS.md documents the update command in its command table.
37
+ // Non-destructive: only inject into a file that already carries the CLC
38
+ // Kernel command table, and only when the row is missing (idempotent).
39
+ // A project-customized AGENTS.md without that structure is left untouched.
40
+ const agentsPath = path.join(resolvedDir, 'AGENTS.md');
41
+ if (fs.existsSync(agentsPath)) {
42
+ let agentsContent = fs.readFileSync(agentsPath, 'utf-8');
43
+ if (!agentsContent.includes('clckernel update')) {
44
+ if (agentsContent.includes('| `clckernel start`')) {
45
+ agentsContent = agentsContent.replace(
46
+ '| `clckernel start`',
47
+ '| `clckernel update` | Maintenance | Non-destructive update: refresh core tools, playbooks & symlinks (preserves SDDs & custom guards). |\n| `clckernel start`'
48
+ );
49
+ fs.writeFileSync(agentsPath, agentsContent, 'utf-8');
50
+ } else if (agentsContent.includes('## 3. Universal Command Interface')) {
51
+ agentsContent += '\n| `clckernel update` | Maintenance | Non-destructive update: refresh core tools, playbooks & symlinks (preserves SDDs & custom guards). |\n';
52
+ fs.writeFileSync(agentsPath, agentsContent, 'utf-8');
53
+ }
54
+ }
55
+ }
56
+
57
+ return {
58
+ success: true,
59
+ targetDir: resolvedDir,
60
+ preserved,
61
+ refreshed: {
62
+ tools: true,
63
+ skills: true,
64
+ symlinks: true,
65
+ hooks: true,
66
+ },
67
+ };
68
+ }
69
+
70
+ async function runUpdate(targetDir = process.cwd()) {
71
+ const { colors, printBanner } = require('./ui');
72
+ printBanner();
73
+
74
+ console.log(`\n${colors.cyan}🔄 Actualizando CLC Kernel en:${colors.reset} ${targetDir}\n`);
75
+
76
+ try {
77
+ const result = updateHarness(targetDir);
78
+
79
+ console.log(`${colors.green}✔ Salvaguardas estándar actualizadas en tools/${colors.reset}`);
80
+ console.log(`${colors.green}✔ Playbooks y Skills agénticos actualizados en .agents/skills/${colors.reset}`);
81
+ console.log(`${colors.green}✔ Enlaces simbióticos de IDEs actualizados (Cursor, Claude, Copilot, Antigravity)${colors.reset}`);
82
+ console.log(`${colors.green}✔ Hooks de git sincronizados${colors.reset}`);
83
+ console.log(`\n${colors.bold}🔒 ACTIVOS PRESERVADOS AL 100%:${colors.reset}`);
84
+ console.log(` • ${colors.emerald}sdds/${colors.reset} (Especificaciones locales intactas)`);
85
+ console.log(` • ${colors.emerald}tools/guards/${colors.reset} (Reglas y salvaguardas personalizadas intactas)`);
86
+ console.log(` • ${colors.emerald}.clckernel.yaml${colors.reset} (Configuraciones de equipo intactas)\n`);
87
+ console.log(`${colors.green}✨ ¡Proyecto actualizado con éxito a la última versión de CLC Kernel!${colors.reset}\n`);
88
+ return result;
89
+ } catch (err) {
90
+ console.error(`\n❌ Error actualizando el arnés: ${err.message}`);
91
+ process.exit(1);
92
+ }
93
+ }
94
+
95
+ module.exports = { updateHarness, runUpdate };