@curenorway/kode-cli 1.0.1 → 1.0.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.
- package/dist/{chunk-Q64DBAYJ.js → chunk-LYIXUQOG.js} +67 -13
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -459,7 +459,7 @@ If using the Kode MCP server, these tools are available:
|
|
|
459
459
|
import chalk from "chalk";
|
|
460
460
|
import ora from "ora";
|
|
461
461
|
import enquirer from "enquirer";
|
|
462
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
462
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, readFileSync as readFileSync3 } from "fs";
|
|
463
463
|
import { join as join3 } from "path";
|
|
464
464
|
var { prompt } = enquirer;
|
|
465
465
|
async function initCommand(options) {
|
|
@@ -578,15 +578,65 @@ config.json
|
|
|
578
578
|
}
|
|
579
579
|
} catch {
|
|
580
580
|
}
|
|
581
|
+
const claudeMdPath = join3(cwd, "CLAUDE.md");
|
|
581
582
|
const claudeMdContent = generateClaudeMd(config.siteName, config.scriptsDir || "scripts");
|
|
582
|
-
|
|
583
|
+
let claudeMdAction = "created";
|
|
584
|
+
if (existsSync3(claudeMdPath)) {
|
|
585
|
+
spinner.stop();
|
|
586
|
+
console.log(chalk.yellow("\n\u26A0\uFE0F CLAUDE.md already exists in this directory.\n"));
|
|
587
|
+
const { action } = await prompt([
|
|
588
|
+
{
|
|
589
|
+
type: "select",
|
|
590
|
+
name: "action",
|
|
591
|
+
message: "How would you like to handle Kode instructions?",
|
|
592
|
+
choices: [
|
|
593
|
+
{
|
|
594
|
+
name: "append",
|
|
595
|
+
message: "Append to existing CLAUDE.md (recommended)"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: "separate",
|
|
599
|
+
message: "Create separate KODE.md file"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: "skip",
|
|
603
|
+
message: "Skip - I'll add instructions manually"
|
|
604
|
+
}
|
|
605
|
+
],
|
|
606
|
+
initial: 0
|
|
607
|
+
}
|
|
608
|
+
]);
|
|
609
|
+
spinner.start("Generating AI context files...");
|
|
610
|
+
if (action === "append") {
|
|
611
|
+
const existingContent = readFileSync3(claudeMdPath, "utf-8");
|
|
612
|
+
const separator = "\n\n---\n\n";
|
|
613
|
+
writeFileSync3(claudeMdPath, existingContent + separator + claudeMdContent);
|
|
614
|
+
claudeMdAction = "appended";
|
|
615
|
+
} else if (action === "separate") {
|
|
616
|
+
writeFileSync3(join3(cwd, "KODE.md"), claudeMdContent);
|
|
617
|
+
claudeMdAction = "separate";
|
|
618
|
+
} else {
|
|
619
|
+
claudeMdAction = "skipped";
|
|
620
|
+
}
|
|
621
|
+
} else {
|
|
622
|
+
writeFileSync3(claudeMdPath, claudeMdContent);
|
|
623
|
+
}
|
|
583
624
|
const contextMdContent = generateInitialContext(config, scripts, siteInfo);
|
|
584
625
|
writeFileSync3(join3(cwd, ".cure-kode", "context.md"), contextMdContent);
|
|
585
626
|
spinner.succeed("AI context files generated");
|
|
586
627
|
console.log(chalk.green("\n\u2705 Cure Kode initialized successfully!\n"));
|
|
587
628
|
console.log(chalk.dim("Project structure:"));
|
|
588
629
|
console.log(chalk.dim(` ${cwd}/`));
|
|
589
|
-
|
|
630
|
+
if (claudeMdAction === "created") {
|
|
631
|
+
console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (AI agent instructions)`));
|
|
632
|
+
} else if (claudeMdAction === "appended") {
|
|
633
|
+
console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (Kode instructions appended)`));
|
|
634
|
+
} else if (claudeMdAction === "separate") {
|
|
635
|
+
console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (existing - unchanged)`));
|
|
636
|
+
console.log(chalk.dim(` \u251C\u2500\u2500 KODE.md (Kode AI instructions)`));
|
|
637
|
+
} else {
|
|
638
|
+
console.log(chalk.dim(` \u251C\u2500\u2500 CLAUDE.md (existing - unchanged)`));
|
|
639
|
+
}
|
|
590
640
|
console.log(chalk.dim(` \u251C\u2500\u2500 .cure-kode/`));
|
|
591
641
|
console.log(chalk.dim(` \u2502 \u251C\u2500\u2500 config.json (your configuration)`));
|
|
592
642
|
console.log(chalk.dim(` \u2502 \u251C\u2500\u2500 context.md (dynamic AI context)`));
|
|
@@ -597,6 +647,10 @@ config.json
|
|
|
597
647
|
console.log(chalk.cyan(" 1. kode pull ") + chalk.dim("Download existing scripts"));
|
|
598
648
|
console.log(chalk.cyan(" 2. kode watch ") + chalk.dim("Watch for changes and auto-push"));
|
|
599
649
|
console.log(chalk.cyan(" 3. kode deploy ") + chalk.dim("Deploy to staging/production"));
|
|
650
|
+
if (claudeMdAction === "separate") {
|
|
651
|
+
console.log(chalk.yellow("\n\u{1F4A1} Tip: Add this line to your CLAUDE.md to reference Kode instructions:"));
|
|
652
|
+
console.log(chalk.dim(" See KODE.md for Cure Kode CDN management instructions."));
|
|
653
|
+
}
|
|
600
654
|
} catch (error) {
|
|
601
655
|
spinner.fail("Initialization failed");
|
|
602
656
|
console.error(chalk.red("\nError:"), error);
|
|
@@ -818,7 +872,7 @@ async function pullCommand(options) {
|
|
|
818
872
|
// src/commands/push.ts
|
|
819
873
|
import chalk3 from "chalk";
|
|
820
874
|
import ora3 from "ora";
|
|
821
|
-
import { readFileSync as
|
|
875
|
+
import { readFileSync as readFileSync4, existsSync as existsSync5, readdirSync } from "fs";
|
|
822
876
|
import { join as join5, basename, extname } from "path";
|
|
823
877
|
async function pushCommand(options) {
|
|
824
878
|
const projectRoot = findProjectRoot();
|
|
@@ -842,7 +896,7 @@ async function pushCommand(options) {
|
|
|
842
896
|
const metadataPath = join5(projectRoot, ".cure-kode", "scripts.json");
|
|
843
897
|
let metadata = [];
|
|
844
898
|
if (existsSync5(metadataPath)) {
|
|
845
|
-
metadata = JSON.parse(
|
|
899
|
+
metadata = JSON.parse(readFileSync4(metadataPath, "utf-8"));
|
|
846
900
|
}
|
|
847
901
|
const files = readdirSync(scriptsDir).filter(
|
|
848
902
|
(f) => f.endsWith(".js") || f.endsWith(".css")
|
|
@@ -874,7 +928,7 @@ async function pushCommand(options) {
|
|
|
874
928
|
console.log();
|
|
875
929
|
for (const file of filesToPush) {
|
|
876
930
|
const filePath = join5(scriptsDir, file);
|
|
877
|
-
const content =
|
|
931
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
878
932
|
const slug = basename(file, extname(file));
|
|
879
933
|
const type = extname(file) === ".js" ? "javascript" : "css";
|
|
880
934
|
const remoteScript = remoteScripts.find((s) => s.slug === slug);
|
|
@@ -940,7 +994,7 @@ async function pushCommand(options) {
|
|
|
940
994
|
// src/commands/watch.ts
|
|
941
995
|
import chalk4 from "chalk";
|
|
942
996
|
import chokidar from "chokidar";
|
|
943
|
-
import { readFileSync as
|
|
997
|
+
import { readFileSync as readFileSync5, existsSync as existsSync6 } from "fs";
|
|
944
998
|
import { join as join6, basename as basename2, extname as extname2 } from "path";
|
|
945
999
|
async function watchCommand(options) {
|
|
946
1000
|
const projectRoot = findProjectRoot();
|
|
@@ -974,7 +1028,7 @@ async function watchCommand(options) {
|
|
|
974
1028
|
const metadataPath = join6(projectRoot, ".cure-kode", "scripts.json");
|
|
975
1029
|
let metadata = [];
|
|
976
1030
|
if (existsSync6(metadataPath)) {
|
|
977
|
-
metadata = JSON.parse(
|
|
1031
|
+
metadata = JSON.parse(readFileSync5(metadataPath, "utf-8"));
|
|
978
1032
|
}
|
|
979
1033
|
let remoteScripts = [];
|
|
980
1034
|
try {
|
|
@@ -996,7 +1050,7 @@ async function watchCommand(options) {
|
|
|
996
1050
|
const timeout = setTimeout(async () => {
|
|
997
1051
|
pendingChanges.delete(filePath);
|
|
998
1052
|
try {
|
|
999
|
-
const content =
|
|
1053
|
+
const content = readFileSync5(filePath, "utf-8");
|
|
1000
1054
|
const remoteScript = remoteScripts.find((s) => s.slug === slug);
|
|
1001
1055
|
const localMeta = metadata.find((m) => m.slug === slug);
|
|
1002
1056
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("nb-NO");
|
|
@@ -1143,7 +1197,7 @@ import chalk6 from "chalk";
|
|
|
1143
1197
|
import ora5 from "ora";
|
|
1144
1198
|
|
|
1145
1199
|
// src/lib/page-cache.ts
|
|
1146
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as
|
|
1200
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync5, unlinkSync } from "fs";
|
|
1147
1201
|
import { join as join7, basename as basename3 } from "path";
|
|
1148
1202
|
var PROJECT_CONFIG_DIR3 = ".cure-kode";
|
|
1149
1203
|
var PAGES_DIR = "pages";
|
|
@@ -1183,7 +1237,7 @@ function readPageContext(projectRoot, urlOrSlug) {
|
|
|
1183
1237
|
return null;
|
|
1184
1238
|
}
|
|
1185
1239
|
try {
|
|
1186
|
-
const content =
|
|
1240
|
+
const content = readFileSync6(cachePath, "utf-8");
|
|
1187
1241
|
return JSON.parse(content);
|
|
1188
1242
|
} catch {
|
|
1189
1243
|
return null;
|
|
@@ -1482,7 +1536,7 @@ function printPageContext(context) {
|
|
|
1482
1536
|
// src/commands/status.ts
|
|
1483
1537
|
import chalk7 from "chalk";
|
|
1484
1538
|
import ora6 from "ora";
|
|
1485
|
-
import { readFileSync as
|
|
1539
|
+
import { readFileSync as readFileSync7, existsSync as existsSync8, readdirSync as readdirSync3, statSync } from "fs";
|
|
1486
1540
|
import { join as join8, basename as basename4, extname as extname3 } from "path";
|
|
1487
1541
|
async function statusCommand(options) {
|
|
1488
1542
|
const projectRoot = findProjectRoot();
|
|
@@ -1544,7 +1598,7 @@ async function statusCommand(options) {
|
|
|
1544
1598
|
for (const file of localFiles) {
|
|
1545
1599
|
const slug = basename4(file, extname3(file));
|
|
1546
1600
|
const filePath = join8(scriptsDir, file);
|
|
1547
|
-
const content =
|
|
1601
|
+
const content = readFileSync7(filePath, "utf-8");
|
|
1548
1602
|
const stats = statSync(filePath);
|
|
1549
1603
|
localBySlug.set(slug, { file, content, modified: stats.mtime });
|
|
1550
1604
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED