@curenorway/kode-cli 1.2.0 → 1.2.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +19 -20
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -197,27 +197,26 @@ async function updateClaudeMdCommand() {
197
197
  console.log(chalk2.green("\u2705 Created CLAUDE.md with Cure Kode section"));
198
198
  return;
199
199
  }
200
- const existingContent = readFileSync(claudeMdPath, "utf-8");
201
- const kodePatterns = [
202
- /^## Cure Kode[:\s][\s\S]*?(?=\n---\n|\n## (?!#)|$)/m,
203
- // ## Cure Kode: or ## Cure Kode
204
- /^## Cure Kode\n[\s\S]*?(?=\n---\n|\n## (?!#)|$)/m
205
- // ## Cure Kode (newline)
206
- ];
207
- let updatedContent = existingContent;
208
- let foundExisting = false;
209
- for (const pattern of kodePatterns) {
210
- if (pattern.test(updatedContent)) {
211
- updatedContent = updatedContent.replace(pattern, newKodeSection.trim());
212
- foundExisting = true;
213
- break;
214
- }
215
- }
216
- if (foundExisting) {
217
- writeFileSync(claudeMdPath, updatedContent);
218
- console.log(chalk2.green("\u2705 Updated existing Cure Kode section in CLAUDE.md"));
200
+ let content = readFileSync(claudeMdPath, "utf-8");
201
+ let removedCount = 0;
202
+ const kodeSectionPattern = /^## Cure Kode[:\s(][\s\S]*?(?=\n---\n|\n## (?!#)|$)/gm;
203
+ const oldMinimalPattern = /^## Cure Kode[:\s(][^\n]*\n\nThis project uses \*\*Cure Kode\*\*[\s\S]*?(?=\n---\n|\n## (?!#)|$)/gm;
204
+ const matches1 = content.match(kodeSectionPattern) || [];
205
+ const matches2 = content.match(oldMinimalPattern) || [];
206
+ removedCount = matches1.length + matches2.length;
207
+ content = content.replace(kodeSectionPattern, "");
208
+ content = content.replace(oldMinimalPattern, "");
209
+ content = content.replace(/(\n---\n)+/g, "\n---\n");
210
+ content = content.replace(/^\n+/, "");
211
+ content = content.replace(/^(---\n)+/, "");
212
+ content = content.replace(/\n{3,}/g, "\n\n");
213
+ content = newKodeSection + "---\n\n" + content;
214
+ writeFileSync(claudeMdPath, content);
215
+ if (removedCount > 1) {
216
+ console.log(chalk2.green(`\u2705 Cleaned up ${removedCount} duplicate Kode sections and added fresh one`));
217
+ } else if (removedCount === 1) {
218
+ console.log(chalk2.green("\u2705 Updated Cure Kode section in CLAUDE.md"));
219
219
  } else {
220
- writeFileSync(claudeMdPath, newKodeSection + "---\n\n" + existingContent);
221
220
  console.log(chalk2.green("\u2705 Added Cure Kode section to CLAUDE.md"));
222
221
  }
223
222
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curenorway/kode-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
5
5
  "type": "module",
6
6
  "bin": {