clckernel 1.2.18 → 1.2.19

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.18",
3
+ "version": "1.2.19",
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": [
@@ -68,13 +68,9 @@ class BaseAdapter {
68
68
  fs.mkdirSync(path.join(targetDir, 'sdds'), { recursive: true });
69
69
  fs.mkdirSync(path.join(targetDir, 'tools'), { recursive: true });
70
70
 
71
- // 2. Gitignore sdds/*
72
- const gitignorePath = path.join(targetDir, '.gitignore');
73
- let gitignore = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
74
- if (!gitignore.includes('sdds/*')) {
75
- gitignore += '\n\n# Local Spec-Driven Development (SDD) files\nsdds/*\n!sdds/.gitkeep\nopenspec/*\n!openspec/.gitkeep\n.ruff_cache/\n';
76
- fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
77
- }
71
+ // 2. Gitignore local SDD specs, ephemeral artifacts, and AI IDE mirrors
72
+ const { ensureGitignoreEntries } = require('../gitignore');
73
+ ensureGitignoreEntries(targetDir);
78
74
  fs.writeFileSync(path.join(targetDir, 'sdds', '.gitkeep'), '', 'utf-8');
79
75
 
80
76
  // 3. Write AGENTS.md
package/src/generator.js CHANGED
@@ -330,12 +330,8 @@ function generateHarness(targetDir, configOrNull) {
330
330
  fs.mkdirSync(path.join(targetDir, 'sdds'), { recursive: true });
331
331
  fs.mkdirSync(path.join(targetDir, 'tools'), { recursive: true });
332
332
 
333
- const gitignorePath = path.join(targetDir, '.gitignore');
334
- let gitignoreContent = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
335
- if (!gitignoreContent.includes('sdds/*')) {
336
- gitignoreContent += '\n\n# Local Spec-Driven Development (SDD) files\nsdds/*\n!sdds/.gitkeep\nopenspec/*\n!openspec/.gitkeep\n.ruff_cache/\n';
337
- fs.writeFileSync(gitignorePath, gitignoreContent, 'utf-8');
338
- }
333
+ const { ensureGitignoreEntries } = require('./gitignore');
334
+ ensureGitignoreEntries(targetDir);
339
335
  fs.writeFileSync(path.join(targetDir, 'sdds', '.gitkeep'), '', 'utf-8');
340
336
 
341
337
  const agentsContent = `# CLC Kernel ${config.framework || 'Generic'} (${(config.projectType || 'unknown').toUpperCase()}) — AGENTS
@@ -0,0 +1,98 @@
1
+ /**
2
+ * CLC Kernel — Gitignore Provisioning Engine
3
+ * Ensures AI IDE mirror symlinks, local SDD specs, and ephemeral runtime artifacts
4
+ * are safely ignored in consumer repositories to preserve AGENTS.md as the SSOT.
5
+ */
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ const MANAGED_GITIGNORE_SECTIONS = [
11
+ {
12
+ header: '# CLC Kernel: Local AI IDE Mirror Symlinks (SSOT: AGENTS.md)',
13
+ entries: [
14
+ 'CLAUDE.md',
15
+ 'GEMINI.md',
16
+ '.cursorrules',
17
+ '.windsurfrules',
18
+ '.cursor/',
19
+ '.antigravity/',
20
+ '.github/copilot-instructions.md',
21
+ ],
22
+ },
23
+ {
24
+ header: '# CLC Kernel: CLI Agent Skills & Playbooks',
25
+ entries: [
26
+ '.agents/skills/clckernel_cli/',
27
+ '.agents/skills/clc_forge_cli/',
28
+ ],
29
+ },
30
+ {
31
+ header: '# CLC Kernel: Local SDD Specs & Ephemeral Harness Artifacts',
32
+ entries: [
33
+ 'sdds/*',
34
+ '!sdds/.gitkeep',
35
+ 'openspec/*',
36
+ '!openspec/.gitkeep',
37
+ '.clckernel.resolved.json',
38
+ '.clc-forge.resolved.json',
39
+ '.husky/_/',
40
+ '.ruff_cache/',
41
+ ],
42
+ },
43
+ ];
44
+
45
+ /**
46
+ * Idempotently appends missing CLC Kernel entries to target project's .gitignore.
47
+ *
48
+ * @param {string} targetDir - Target project root
49
+ * @returns {boolean} True if .gitignore was created or modified, false if already complete.
50
+ */
51
+ function ensureGitignoreEntries(targetDir) {
52
+ const gitignorePath = path.join(targetDir, '.gitignore');
53
+ let currentContent = '';
54
+ if (fs.existsSync(gitignorePath)) {
55
+ try {
56
+ currentContent = fs.readFileSync(gitignorePath, 'utf-8');
57
+ } catch (e) {
58
+ currentContent = '';
59
+ }
60
+ }
61
+
62
+ const existingLines = new Set(
63
+ currentContent
64
+ .split('\n')
65
+ .map(line => line.trim())
66
+ .filter(line => line.length > 0)
67
+ );
68
+
69
+ const sectionsToAppend = [];
70
+
71
+ for (const section of MANAGED_GITIGNORE_SECTIONS) {
72
+ const missingEntries = section.entries.filter(entry => !existingLines.has(entry.trim()));
73
+ if (missingEntries.length > 0) {
74
+ sectionsToAppend.push(`${section.header}\n${missingEntries.join('\n')}`);
75
+ }
76
+ }
77
+
78
+ if (sectionsToAppend.length === 0) {
79
+ return false;
80
+ }
81
+
82
+ let newContent = currentContent;
83
+ if (newContent.length > 0 && !newContent.endsWith('\n')) {
84
+ newContent += '\n';
85
+ }
86
+ if (newContent.length > 0) {
87
+ newContent += '\n';
88
+ }
89
+ newContent += sectionsToAppend.join('\n\n') + '\n';
90
+
91
+ fs.writeFileSync(gitignorePath, newContent, 'utf-8');
92
+ return true;
93
+ }
94
+
95
+ module.exports = {
96
+ ensureGitignoreEntries,
97
+ MANAGED_GITIGNORE_SECTIONS,
98
+ };
package/src/updater.js CHANGED
@@ -32,6 +32,8 @@ function updateHarness(targetDir = process.cwd(), options = {}) {
32
32
 
33
33
  // 3. Run harness generation (refreshes tools, hooks, skills, and symlinks)
34
34
  generateHarness(resolvedDir, detected);
35
+ const { ensureGitignoreEntries } = require('./gitignore');
36
+ ensureGitignoreEntries(resolvedDir);
35
37
 
36
38
  // 4. Ensure AGENTS.md documents the update command in its command table.
37
39
  // Non-destructive: only inject into a file that already carries the CLC