clckernel 1.2.10 → 1.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clckernel",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
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
@@ -174,7 +177,12 @@ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`,
174
177
  ${this.getSafeguards().map(s => `- ${s}`).join('\n')}
175
178
  `;
176
179
 
177
- 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
+ }
178
186
 
179
187
  // 3. Create AI IDE mirror symlinks
180
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
@@ -341,7 +341,13 @@ When given a command matching \`clckernel <action>\` or \`/clckernel <action>\`,
341
341
  | \`clckernel update\` | Maintenance | Non-destructive update: refresh core tools, playbooks & symlinks (preserves SDDs & custom guards). |
342
342
  | \`clckernel start\` | Setup | Scan codebase, propose governance plan, and materialize \`.clckernel.yaml\`. |
343
343
  `;
344
- 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
+
345
351
  }
346
352
 
347
353
  // Step 2: Install tools (manifest-driven or fallback)
package/src/updater.js CHANGED
@@ -33,7 +33,10 @@ function updateHarness(targetDir = process.cwd(), options = {}) {
33
33
  // 3. Run harness generation (refreshes tools, hooks, skills, and symlinks)
34
34
  generateHarness(resolvedDir, detected);
35
35
 
36
- // 4. Ensure AGENTS.md includes the update command in the command table
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.
37
40
  const agentsPath = path.join(resolvedDir, 'AGENTS.md');
38
41
  if (fs.existsSync(agentsPath)) {
39
42
  let agentsContent = fs.readFileSync(agentsPath, 'utf-8');