@curenorway/kode-cli 1.1.1 → 1.1.2

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.
@@ -660,40 +660,73 @@ config.json
660
660
  const claudeMdContentMinimal = generateClaudeMdMinimal(config.siteName, config.siteSlug);
661
661
  let claudeMdAction = "created";
662
662
  if (existsSync3(claudeMdPath)) {
663
+ const existingContent = readFileSync3(claudeMdPath, "utf-8");
664
+ const kodeHeaderPattern = /^## Cure Kode[:\s]/m;
665
+ const hasExistingKodeSection = kodeHeaderPattern.test(existingContent);
663
666
  spinner.stop();
664
- console.log(chalk.yellow("\n\u26A0\uFE0F CLAUDE.md already exists in this directory.\n"));
665
- const { action } = await prompt([
666
- {
667
- type: "select",
668
- name: "action",
669
- message: "How would you like to handle Kode instructions?",
670
- choices: [
671
- {
672
- name: "prepend",
673
- message: "Prepend minimal section to CLAUDE.md (recommended)"
674
- },
675
- {
676
- name: "separate",
677
- message: "Create separate KODE.md file (full instructions)"
678
- },
679
- {
680
- name: "skip",
681
- message: "Skip - I'll add instructions manually"
682
- }
683
- ],
684
- initial: 0
667
+ if (hasExistingKodeSection) {
668
+ console.log(chalk.yellow("\n\u26A0\uFE0F Found existing Cure Kode section in CLAUDE.md.\n"));
669
+ const { action } = await prompt([
670
+ {
671
+ type: "select",
672
+ name: "action",
673
+ message: "How would you like to handle Kode instructions?",
674
+ choices: [
675
+ {
676
+ name: "prepend",
677
+ message: "Update existing Cure Kode section (recommended)"
678
+ },
679
+ {
680
+ name: "skip",
681
+ message: "Skip - keep existing section"
682
+ }
683
+ ],
684
+ initial: 0
685
+ }
686
+ ]);
687
+ spinner.start("Generating AI context files...");
688
+ if (action === "prepend") {
689
+ const sectionEndPattern = /^## Cure Kode[:\s][\s\S]*?(?=\n---\n|\n## (?!#)|$)/m;
690
+ const updatedContent = existingContent.replace(sectionEndPattern, claudeMdContentMinimal.trim());
691
+ writeFileSync3(claudeMdPath, updatedContent);
692
+ claudeMdAction = "updated";
693
+ } else {
694
+ claudeMdAction = "skipped";
685
695
  }
686
- ]);
687
- spinner.start("Generating AI context files...");
688
- if (action === "prepend") {
689
- const existingContent = readFileSync3(claudeMdPath, "utf-8");
690
- writeFileSync3(claudeMdPath, claudeMdContentMinimal + "---\n\n" + existingContent);
691
- claudeMdAction = "prepended";
692
- } else if (action === "separate") {
693
- writeFileSync3(join3(cwd, "KODE.md"), claudeMdContentFull);
694
- claudeMdAction = "separate";
695
696
  } else {
696
- claudeMdAction = "skipped";
697
+ console.log(chalk.yellow("\n\u26A0\uFE0F CLAUDE.md already exists in this directory.\n"));
698
+ const { action } = await prompt([
699
+ {
700
+ type: "select",
701
+ name: "action",
702
+ message: "How would you like to handle Kode instructions?",
703
+ choices: [
704
+ {
705
+ name: "prepend",
706
+ message: "Prepend Kode section to CLAUDE.md (recommended)"
707
+ },
708
+ {
709
+ name: "separate",
710
+ message: "Create separate KODE.md file"
711
+ },
712
+ {
713
+ name: "skip",
714
+ message: "Skip - I'll add instructions manually"
715
+ }
716
+ ],
717
+ initial: 0
718
+ }
719
+ ]);
720
+ spinner.start("Generating AI context files...");
721
+ if (action === "prepend") {
722
+ writeFileSync3(claudeMdPath, claudeMdContentMinimal + "---\n\n" + existingContent);
723
+ claudeMdAction = "prepended";
724
+ } else if (action === "separate") {
725
+ writeFileSync3(join3(cwd, "KODE.md"), claudeMdContentFull);
726
+ claudeMdAction = "separate";
727
+ } else {
728
+ claudeMdAction = "skipped";
729
+ }
697
730
  }
698
731
  } else {
699
732
  writeFileSync3(claudeMdPath, claudeMdContentFull);
@@ -708,6 +741,8 @@ config.json
708
741
  console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (AI agent instructions)`));
709
742
  } else if (claudeMdAction === "prepended") {
710
743
  console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (Kode section prepended)`));
744
+ } else if (claudeMdAction === "updated") {
745
+ console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (Kode section updated)`));
711
746
  } else if (claudeMdAction === "separate") {
712
747
  console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (existing - unchanged)`));
713
748
  console.log(chalk.dim(` \u251C\u2500\u2500 KODE.md (Kode AI instructions)`));
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  readPageContext,
14
14
  statusCommand,
15
15
  watchCommand
16
- } from "./chunk-SQEIO2SM.js";
16
+ } from "./chunk-A5MKCPVP.js";
17
17
 
18
18
  // src/cli.ts
19
19
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  updateScriptPurpose,
28
28
  watchCommand,
29
29
  writeContext
30
- } from "./chunk-SQEIO2SM.js";
30
+ } from "./chunk-A5MKCPVP.js";
31
31
  export {
32
32
  KodeApiClient,
33
33
  KodeApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curenorway/kode-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
5
5
  "type": "module",
6
6
  "bin": {