@curenorway/kode-cli 1.1.2 → 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.
- package/dist/{chunk-A5MKCPVP.js → chunk-43RZM4JR.js} +1 -0
- package/dist/cli.js +61 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
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,59 @@ 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
|
+
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
|
+
} else {
|
|
220
|
+
console.log(chalk2.green("\u2705 Added Cure Kode section to CLAUDE.md"));
|
|
221
|
+
}
|
|
222
|
+
console.log();
|
|
223
|
+
console.log(chalk2.dim("The Cure Kode section now includes:"));
|
|
224
|
+
console.log(chalk2.dim(" \u2022 What is Cure Kode (internal tool explanation)"));
|
|
225
|
+
console.log(chalk2.dim(" \u2022 CDN URL with script tag for Webflow"));
|
|
226
|
+
console.log(chalk2.dim(" \u2022 Workflow steps"));
|
|
227
|
+
console.log(chalk2.dim(" \u2022 Command reference"));
|
|
228
|
+
}
|
|
229
|
+
|
|
176
230
|
// src/cli.ts
|
|
177
231
|
var require2 = createRequire(import.meta.url);
|
|
178
232
|
var pkg = require2("../package.json");
|
|
@@ -205,9 +259,12 @@ program.command("status").description("Show current status of scripts and deploy
|
|
|
205
259
|
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
260
|
contextCommand(options);
|
|
207
261
|
});
|
|
262
|
+
program.command("update-claude-md").alias("ucm").description("Add or update Cure Kode section in CLAUDE.md").action(() => {
|
|
263
|
+
updateClaudeMdCommand();
|
|
264
|
+
});
|
|
208
265
|
program.showHelpAfterError();
|
|
209
266
|
console.log();
|
|
210
|
-
console.log(
|
|
211
|
-
console.log(
|
|
267
|
+
console.log(chalk3.bold(" Cure Kode CLI"));
|
|
268
|
+
console.log(chalk3.dim(" Manage JS/CSS for Webflow sites"));
|
|
212
269
|
console.log();
|
|
213
270
|
program.parse();
|
package/dist/index.js
CHANGED