@curenorway/kode-cli 1.1.1 → 1.2.0
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-SQEIO2SM.js → chunk-43RZM4JR.js} +67 -31
- package/dist/cli.js +62 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
665
|
-
|
|
666
|
-
{
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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
|
-
|
|
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)`));
|
|
@@ -1951,6 +1986,7 @@ export {
|
|
|
1951
1986
|
addSession,
|
|
1952
1987
|
updateScriptPurpose,
|
|
1953
1988
|
generateInitialContext,
|
|
1989
|
+
generateClaudeMdMinimal,
|
|
1954
1990
|
generateClaudeMd,
|
|
1955
1991
|
initCommand,
|
|
1956
1992
|
KodeApiError,
|
package/dist/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
deletePageContext,
|
|
5
5
|
deployCommand,
|
|
6
6
|
findProjectRoot,
|
|
7
|
+
generateClaudeMdMinimal,
|
|
7
8
|
getProjectConfig,
|
|
8
9
|
htmlCommand,
|
|
9
10
|
initCommand,
|
|
@@ -13,11 +14,11 @@ import {
|
|
|
13
14
|
readPageContext,
|
|
14
15
|
statusCommand,
|
|
15
16
|
watchCommand
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-43RZM4JR.js";
|
|
17
18
|
|
|
18
19
|
// src/cli.ts
|
|
19
20
|
import { Command } from "commander";
|
|
20
|
-
import
|
|
21
|
+
import chalk3 from "chalk";
|
|
21
22
|
import { createRequire } from "module";
|
|
22
23
|
|
|
23
24
|
// src/commands/pages.ts
|
|
@@ -173,6 +174,60 @@ function printPageDetails(context) {
|
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
// src/commands/update-claude-md.ts
|
|
178
|
+
import chalk2 from "chalk";
|
|
179
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
180
|
+
import { join } from "path";
|
|
181
|
+
async function updateClaudeMdCommand() {
|
|
182
|
+
const projectRoot = findProjectRoot();
|
|
183
|
+
if (!projectRoot) {
|
|
184
|
+
console.log(chalk2.red("\u274C Not in a Cure Kode project."));
|
|
185
|
+
console.log(chalk2.dim(' Run "kode init" first.'));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const config = getProjectConfig(projectRoot);
|
|
189
|
+
if (!config) {
|
|
190
|
+
console.log(chalk2.red("\u274C Could not read project configuration."));
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const claudeMdPath = join(projectRoot, "CLAUDE.md");
|
|
194
|
+
const newKodeSection = generateClaudeMdMinimal(config.siteName, config.siteSlug);
|
|
195
|
+
if (!existsSync(claudeMdPath)) {
|
|
196
|
+
writeFileSync(claudeMdPath, newKodeSection);
|
|
197
|
+
console.log(chalk2.green("\u2705 Created CLAUDE.md with Cure Kode section"));
|
|
198
|
+
return;
|
|
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"));
|
|
219
|
+
} else {
|
|
220
|
+
writeFileSync(claudeMdPath, newKodeSection + "---\n\n" + existingContent);
|
|
221
|
+
console.log(chalk2.green("\u2705 Added Cure Kode section to CLAUDE.md"));
|
|
222
|
+
}
|
|
223
|
+
console.log();
|
|
224
|
+
console.log(chalk2.dim("The Cure Kode section now includes:"));
|
|
225
|
+
console.log(chalk2.dim(" \u2022 What is Cure Kode (internal tool explanation)"));
|
|
226
|
+
console.log(chalk2.dim(" \u2022 CDN URL with script tag for Webflow"));
|
|
227
|
+
console.log(chalk2.dim(" \u2022 Workflow steps"));
|
|
228
|
+
console.log(chalk2.dim(" \u2022 Command reference"));
|
|
229
|
+
}
|
|
230
|
+
|
|
176
231
|
// src/cli.ts
|
|
177
232
|
var require2 = createRequire(import.meta.url);
|
|
178
233
|
var pkg = require2("../package.json");
|
|
@@ -205,9 +260,12 @@ program.command("status").description("Show current status of scripts and deploy
|
|
|
205
260
|
program.command("context").description("View or edit project context for AI agents").option("-e, --edit", "Open context.md in editor").option("-r, --refresh", "Refresh context from server").option("-j, --json", "Output as JSON").action((options) => {
|
|
206
261
|
contextCommand(options);
|
|
207
262
|
});
|
|
263
|
+
program.command("update-claude-md").alias("ucm").description("Add or update Cure Kode section in CLAUDE.md").action(() => {
|
|
264
|
+
updateClaudeMdCommand();
|
|
265
|
+
});
|
|
208
266
|
program.showHelpAfterError();
|
|
209
267
|
console.log();
|
|
210
|
-
console.log(
|
|
211
|
-
console.log(
|
|
268
|
+
console.log(chalk3.bold(" Cure Kode CLI"));
|
|
269
|
+
console.log(chalk3.dim(" Manage JS/CSS for Webflow sites"));
|
|
212
270
|
console.log();
|
|
213
271
|
program.parse();
|
package/dist/index.js
CHANGED