clckernel 1.2.10 → 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/package.json +1 -1
- package/src/adapters/agent-os.js +11 -3
- package/src/adapters/base.js +13 -2
- package/src/generator.js +7 -1
- package/src/updater.js +4 -1
package/package.json
CHANGED
package/src/adapters/agent-os.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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'];
|
package/src/adapters/base.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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');
|