@curenorway/kode-cli 1.0.1 → 1.0.3

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.
@@ -358,6 +358,17 @@ function upsertPage(projectRoot, page, agent = "kode html") {
358
358
  context.updatedBy = agent;
359
359
  writeContext(projectRoot, context);
360
360
  }
361
+ function generateClaudeMdMinimal(siteName) {
362
+ return `## Cure Kode (${siteName})
363
+
364
+ This project uses **Cure Kode** for Webflow script management.
365
+
366
+ - **Context**: Read \`.cure-kode/context.md\` before working on scripts
367
+ - **Scripts**: \`kode pull\` / \`kode push\` / \`kode deploy --env staging|production\`
368
+ - **HTML analysis**: \`kode html <url> --save\` to cache page structure
369
+
370
+ `;
371
+ }
361
372
  function generateClaudeMd(siteName, scriptsDir = "scripts") {
362
373
  return `# Cure Kode Project: ${siteName}
363
374
 
@@ -459,7 +470,7 @@ If using the Kode MCP server, these tools are available:
459
470
  import chalk from "chalk";
460
471
  import ora from "ora";
461
472
  import enquirer from "enquirer";
462
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
473
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, readFileSync as readFileSync3 } from "fs";
463
474
  import { join as join3 } from "path";
464
475
  var { prompt } = enquirer;
465
476
  async function initCommand(options) {
@@ -578,15 +589,65 @@ config.json
578
589
  }
579
590
  } catch {
580
591
  }
581
- const claudeMdContent = generateClaudeMd(config.siteName, config.scriptsDir || "scripts");
582
- writeFileSync3(join3(cwd, "CLAUDE.md"), claudeMdContent);
592
+ const claudeMdPath = join3(cwd, "CLAUDE.md");
593
+ const claudeMdContentFull = generateClaudeMd(config.siteName, config.scriptsDir || "scripts");
594
+ const claudeMdContentMinimal = generateClaudeMdMinimal(config.siteName);
595
+ let claudeMdAction = "created";
596
+ if (existsSync3(claudeMdPath)) {
597
+ spinner.stop();
598
+ console.log(chalk.yellow("\n\u26A0\uFE0F CLAUDE.md already exists in this directory.\n"));
599
+ const { action } = await prompt([
600
+ {
601
+ type: "select",
602
+ name: "action",
603
+ message: "How would you like to handle Kode instructions?",
604
+ choices: [
605
+ {
606
+ name: "prepend",
607
+ message: "Prepend minimal section to CLAUDE.md (recommended)"
608
+ },
609
+ {
610
+ name: "separate",
611
+ message: "Create separate KODE.md file (full instructions)"
612
+ },
613
+ {
614
+ name: "skip",
615
+ message: "Skip - I'll add instructions manually"
616
+ }
617
+ ],
618
+ initial: 0
619
+ }
620
+ ]);
621
+ spinner.start("Generating AI context files...");
622
+ if (action === "prepend") {
623
+ const existingContent = readFileSync3(claudeMdPath, "utf-8");
624
+ writeFileSync3(claudeMdPath, claudeMdContentMinimal + "---\n\n" + existingContent);
625
+ claudeMdAction = "prepended";
626
+ } else if (action === "separate") {
627
+ writeFileSync3(join3(cwd, "KODE.md"), claudeMdContentFull);
628
+ claudeMdAction = "separate";
629
+ } else {
630
+ claudeMdAction = "skipped";
631
+ }
632
+ } else {
633
+ writeFileSync3(claudeMdPath, claudeMdContentFull);
634
+ }
583
635
  const contextMdContent = generateInitialContext(config, scripts, siteInfo);
584
636
  writeFileSync3(join3(cwd, ".cure-kode", "context.md"), contextMdContent);
585
637
  spinner.succeed("AI context files generated");
586
638
  console.log(chalk.green("\n\u2705 Cure Kode initialized successfully!\n"));
587
639
  console.log(chalk.dim("Project structure:"));
588
640
  console.log(chalk.dim(` ${cwd}/`));
589
- console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (AI agent instructions)`));
641
+ if (claudeMdAction === "created") {
642
+ console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (AI agent instructions)`));
643
+ } else if (claudeMdAction === "prepended") {
644
+ console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (Kode section prepended)`));
645
+ } else if (claudeMdAction === "separate") {
646
+ console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (existing - unchanged)`));
647
+ console.log(chalk.dim(` \u251C\u2500\u2500 KODE.md (Kode AI instructions)`));
648
+ } else {
649
+ console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (existing - unchanged)`));
650
+ }
590
651
  console.log(chalk.dim(` \u251C\u2500\u2500 .cure-kode/`));
591
652
  console.log(chalk.dim(` \u2502 \u251C\u2500\u2500 config.json (your configuration)`));
592
653
  console.log(chalk.dim(` \u2502 \u251C\u2500\u2500 context.md (dynamic AI context)`));
@@ -597,6 +658,10 @@ config.json
597
658
  console.log(chalk.cyan(" 1. kode pull ") + chalk.dim("Download existing scripts"));
598
659
  console.log(chalk.cyan(" 2. kode watch ") + chalk.dim("Watch for changes and auto-push"));
599
660
  console.log(chalk.cyan(" 3. kode deploy ") + chalk.dim("Deploy to staging/production"));
661
+ if (claudeMdAction === "separate") {
662
+ console.log(chalk.yellow("\n\u{1F4A1} Tip: Add this line to your CLAUDE.md to reference Kode instructions:"));
663
+ console.log(chalk.dim(" See KODE.md for Cure Kode CDN management instructions."));
664
+ }
600
665
  } catch (error) {
601
666
  spinner.fail("Initialization failed");
602
667
  console.error(chalk.red("\nError:"), error);
@@ -818,7 +883,7 @@ async function pullCommand(options) {
818
883
  // src/commands/push.ts
819
884
  import chalk3 from "chalk";
820
885
  import ora3 from "ora";
821
- import { readFileSync as readFileSync3, existsSync as existsSync5, readdirSync } from "fs";
886
+ import { readFileSync as readFileSync4, existsSync as existsSync5, readdirSync } from "fs";
822
887
  import { join as join5, basename, extname } from "path";
823
888
  async function pushCommand(options) {
824
889
  const projectRoot = findProjectRoot();
@@ -842,7 +907,7 @@ async function pushCommand(options) {
842
907
  const metadataPath = join5(projectRoot, ".cure-kode", "scripts.json");
843
908
  let metadata = [];
844
909
  if (existsSync5(metadataPath)) {
845
- metadata = JSON.parse(readFileSync3(metadataPath, "utf-8"));
910
+ metadata = JSON.parse(readFileSync4(metadataPath, "utf-8"));
846
911
  }
847
912
  const files = readdirSync(scriptsDir).filter(
848
913
  (f) => f.endsWith(".js") || f.endsWith(".css")
@@ -874,7 +939,7 @@ async function pushCommand(options) {
874
939
  console.log();
875
940
  for (const file of filesToPush) {
876
941
  const filePath = join5(scriptsDir, file);
877
- const content = readFileSync3(filePath, "utf-8");
942
+ const content = readFileSync4(filePath, "utf-8");
878
943
  const slug = basename(file, extname(file));
879
944
  const type = extname(file) === ".js" ? "javascript" : "css";
880
945
  const remoteScript = remoteScripts.find((s) => s.slug === slug);
@@ -940,7 +1005,7 @@ async function pushCommand(options) {
940
1005
  // src/commands/watch.ts
941
1006
  import chalk4 from "chalk";
942
1007
  import chokidar from "chokidar";
943
- import { readFileSync as readFileSync4, existsSync as existsSync6 } from "fs";
1008
+ import { readFileSync as readFileSync5, existsSync as existsSync6 } from "fs";
944
1009
  import { join as join6, basename as basename2, extname as extname2 } from "path";
945
1010
  async function watchCommand(options) {
946
1011
  const projectRoot = findProjectRoot();
@@ -974,7 +1039,7 @@ async function watchCommand(options) {
974
1039
  const metadataPath = join6(projectRoot, ".cure-kode", "scripts.json");
975
1040
  let metadata = [];
976
1041
  if (existsSync6(metadataPath)) {
977
- metadata = JSON.parse(readFileSync4(metadataPath, "utf-8"));
1042
+ metadata = JSON.parse(readFileSync5(metadataPath, "utf-8"));
978
1043
  }
979
1044
  let remoteScripts = [];
980
1045
  try {
@@ -996,7 +1061,7 @@ async function watchCommand(options) {
996
1061
  const timeout = setTimeout(async () => {
997
1062
  pendingChanges.delete(filePath);
998
1063
  try {
999
- const content = readFileSync4(filePath, "utf-8");
1064
+ const content = readFileSync5(filePath, "utf-8");
1000
1065
  const remoteScript = remoteScripts.find((s) => s.slug === slug);
1001
1066
  const localMeta = metadata.find((m) => m.slug === slug);
1002
1067
  const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("nb-NO");
@@ -1143,7 +1208,7 @@ import chalk6 from "chalk";
1143
1208
  import ora5 from "ora";
1144
1209
 
1145
1210
  // src/lib/page-cache.ts
1146
- import { existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync5, unlinkSync } from "fs";
1211
+ import { existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync5, unlinkSync } from "fs";
1147
1212
  import { join as join7, basename as basename3 } from "path";
1148
1213
  var PROJECT_CONFIG_DIR3 = ".cure-kode";
1149
1214
  var PAGES_DIR = "pages";
@@ -1183,7 +1248,7 @@ function readPageContext(projectRoot, urlOrSlug) {
1183
1248
  return null;
1184
1249
  }
1185
1250
  try {
1186
- const content = readFileSync5(cachePath, "utf-8");
1251
+ const content = readFileSync6(cachePath, "utf-8");
1187
1252
  return JSON.parse(content);
1188
1253
  } catch {
1189
1254
  return null;
@@ -1482,7 +1547,7 @@ function printPageContext(context) {
1482
1547
  // src/commands/status.ts
1483
1548
  import chalk7 from "chalk";
1484
1549
  import ora6 from "ora";
1485
- import { readFileSync as readFileSync6, existsSync as existsSync8, readdirSync as readdirSync3, statSync } from "fs";
1550
+ import { readFileSync as readFileSync7, existsSync as existsSync8, readdirSync as readdirSync3, statSync } from "fs";
1486
1551
  import { join as join8, basename as basename4, extname as extname3 } from "path";
1487
1552
  async function statusCommand(options) {
1488
1553
  const projectRoot = findProjectRoot();
@@ -1544,7 +1609,7 @@ async function statusCommand(options) {
1544
1609
  for (const file of localFiles) {
1545
1610
  const slug = basename4(file, extname3(file));
1546
1611
  const filePath = join8(scriptsDir, file);
1547
- const content = readFileSync6(filePath, "utf-8");
1612
+ const content = readFileSync7(filePath, "utf-8");
1548
1613
  const stats = statSync(filePath);
1549
1614
  localBySlug.set(slug, { file, content, modified: stats.mtime });
1550
1615
  }
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  readPageContext,
14
14
  statusCommand,
15
15
  watchCommand
16
- } from "./chunk-Q64DBAYJ.js";
16
+ } from "./chunk-RS5LGRLV.js";
17
17
 
18
18
  // src/cli.ts
19
19
  import { Command } from "commander";
package/dist/index.d.ts CHANGED
@@ -306,7 +306,7 @@ declare function generateInitialContext(config: ProjectConfig, scripts: CdnScrip
306
306
  staging_domain?: string | null;
307
307
  }): string;
308
308
  /**
309
- * Generate CLAUDE.md content
309
+ * Generate full CLAUDE.md content for new projects
310
310
  */
311
311
  declare function generateClaudeMd(siteName: string, scriptsDir?: string): string;
312
312
 
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  updateScriptPurpose,
28
28
  watchCommand,
29
29
  writeContext
30
- } from "./chunk-Q64DBAYJ.js";
30
+ } from "./chunk-RS5LGRLV.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.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
5
5
  "type": "module",
6
6
  "bin": {