@curenorway/kode-cli 1.3.0 → 1.3.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-5S7XIMSB.js → chunk-JK2QLASG.js} +23 -5
- package/dist/cli.js +94 -17
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -405,15 +405,30 @@ Add this to Webflow \u2192 Project Settings \u2192 Custom Code \u2192 Footer Cod
|
|
|
405
405
|
|---------|-------------|
|
|
406
406
|
| \`kode pull\` | Download scripts from remote |
|
|
407
407
|
| \`kode push\` | Upload local scripts |
|
|
408
|
+
| \`kode set <script> --scope <scope>\` | Change script to global or page-specific |
|
|
409
|
+
| \`kode set <script> --auto-load\` | Enable/disable auto-loading |
|
|
408
410
|
| \`kode status\` | Show sync status and CDN URL |
|
|
409
|
-
| \`kode deploy
|
|
410
|
-
| \`kode deploy
|
|
411
|
+
| \`kode deploy staging\` | Deploy to staging |
|
|
412
|
+
| \`kode deploy production\` | Deploy to production |
|
|
411
413
|
| \`kode html <url> --save\` | Analyze and cache page HTML structure |
|
|
412
414
|
|
|
415
|
+
### Script Loading
|
|
416
|
+
|
|
417
|
+
Scripts have two properties: **scope** and **autoLoad**.
|
|
418
|
+
|
|
419
|
+
| Scope | Auto-Load | Behavior |
|
|
420
|
+
|-------|-----------|----------|
|
|
421
|
+
| global + true | **Default**. Inlined into init.js, runs on all pages |
|
|
422
|
+
| global + false | Not loaded. Call \`CK.loadScript('slug')\` manually |
|
|
423
|
+
| page-specific + true | Loaded when URL matches page patterns |
|
|
424
|
+
| page-specific + false | Not loaded. Call \`CK.loadScript('slug')\` manually |
|
|
425
|
+
|
|
426
|
+
**CLI flags**: \`kode push --auto-load\` or \`kode push --no-auto-load\`
|
|
427
|
+
|
|
413
428
|
### Context
|
|
414
429
|
|
|
415
430
|
**Read \`.cure-kode/context.md\` before working on scripts** - it contains:
|
|
416
|
-
- Script inventory with purposes
|
|
431
|
+
- Script inventory with purposes and auto-load status
|
|
417
432
|
- Cached page structures (sections, CTAs, forms)
|
|
418
433
|
- Notes from previous sessions
|
|
419
434
|
|
|
@@ -453,9 +468,12 @@ Add this script tag to your Webflow site's **Custom Code** (Project Settings \u2
|
|
|
453
468
|
|---------|-------------|
|
|
454
469
|
| \`kode pull\` | Download scripts from remote |
|
|
455
470
|
| \`kode push\` | Upload local scripts |
|
|
471
|
+
| \`kode set <script> --scope <scope>\` | Change script to global or page-specific |
|
|
472
|
+
| \`kode set <script> --auto-load\` | Enable auto-loading |
|
|
473
|
+
| \`kode set <script> --no-auto-load\` | Disable auto-loading |
|
|
456
474
|
| \`kode watch\` | Auto-sync on file changes |
|
|
457
|
-
| \`kode deploy
|
|
458
|
-
| \`kode deploy
|
|
475
|
+
| \`kode deploy staging\` | Deploy to staging |
|
|
476
|
+
| \`kode deploy production\` | Deploy to production |
|
|
459
477
|
| \`kode status\` | Show sync status and CDN URLs |
|
|
460
478
|
| \`kode html <url>\` | Analyze page HTML |
|
|
461
479
|
| \`kode html <url> --save\` | Analyze and cache page structure |
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
contextCommand,
|
|
4
|
+
createApiClient,
|
|
4
5
|
deletePageContext,
|
|
5
6
|
deployCommand,
|
|
6
7
|
findProjectRoot,
|
|
@@ -14,11 +15,11 @@ import {
|
|
|
14
15
|
readPageContext,
|
|
15
16
|
statusCommand,
|
|
16
17
|
watchCommand
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JK2QLASG.js";
|
|
18
19
|
|
|
19
20
|
// src/cli.ts
|
|
20
21
|
import { Command } from "commander";
|
|
21
|
-
import
|
|
22
|
+
import chalk4 from "chalk";
|
|
22
23
|
import { createRequire } from "module";
|
|
23
24
|
|
|
24
25
|
// src/commands/pages.ts
|
|
@@ -174,11 +175,10 @@ function printPageDetails(context) {
|
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
// src/commands/
|
|
178
|
+
// src/commands/set.ts
|
|
178
179
|
import chalk2 from "chalk";
|
|
179
|
-
import
|
|
180
|
-
|
|
181
|
-
async function updateClaudeMdCommand() {
|
|
180
|
+
import ora from "ora";
|
|
181
|
+
async function setCommand(script, options) {
|
|
182
182
|
const projectRoot = findProjectRoot();
|
|
183
183
|
if (!projectRoot) {
|
|
184
184
|
console.log(chalk2.red("\u274C Not in a Cure Kode project."));
|
|
@@ -190,11 +190,85 @@ async function updateClaudeMdCommand() {
|
|
|
190
190
|
console.log(chalk2.red("\u274C Could not read project configuration."));
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
+
if (!options.scope && options.autoLoad === void 0) {
|
|
194
|
+
console.log(chalk2.yellow("\u26A0\uFE0F No changes specified."));
|
|
195
|
+
console.log(chalk2.dim(" Use --scope or --auto-load/--no-auto-load"));
|
|
196
|
+
console.log();
|
|
197
|
+
console.log(chalk2.dim("Examples:"));
|
|
198
|
+
console.log(chalk2.dim(" kode set my-script --scope page-specific"));
|
|
199
|
+
console.log(chalk2.dim(" kode set my-script --scope global --auto-load"));
|
|
200
|
+
console.log(chalk2.dim(" kode set my-script --no-auto-load"));
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const spinner = ora(`Updating ${script}...`).start();
|
|
204
|
+
try {
|
|
205
|
+
const client = createApiClient(config);
|
|
206
|
+
const scripts = await client.listScripts(config.siteId);
|
|
207
|
+
const targetScript = scripts.find((s) => s.slug === script || s.name === script);
|
|
208
|
+
if (!targetScript) {
|
|
209
|
+
spinner.fail(`Script "${script}" not found`);
|
|
210
|
+
console.log(chalk2.dim("\nAvailable scripts:"));
|
|
211
|
+
scripts.forEach((s) => {
|
|
212
|
+
console.log(chalk2.dim(` - ${s.slug}`));
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const updates = {};
|
|
217
|
+
const changes = [];
|
|
218
|
+
if (options.scope && options.scope !== targetScript.scope) {
|
|
219
|
+
updates.scope = options.scope;
|
|
220
|
+
changes.push(`scope: ${targetScript.scope} \u2192 ${options.scope}`);
|
|
221
|
+
}
|
|
222
|
+
if (options.autoLoad !== void 0 && options.autoLoad !== targetScript.auto_load) {
|
|
223
|
+
updates.autoLoad = options.autoLoad;
|
|
224
|
+
changes.push(`autoLoad: ${targetScript.auto_load} \u2192 ${options.autoLoad}`);
|
|
225
|
+
}
|
|
226
|
+
if (changes.length === 0) {
|
|
227
|
+
spinner.info("No changes needed (already set to specified values)");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
updates.changeSummary = `Updated settings: ${changes.join(", ")}`;
|
|
231
|
+
const updated = await client.updateScript(targetScript.id, updates);
|
|
232
|
+
spinner.succeed(chalk2.green(`Updated ${script}`));
|
|
233
|
+
console.log();
|
|
234
|
+
for (const change of changes) {
|
|
235
|
+
console.log(chalk2.dim(` ${change}`));
|
|
236
|
+
}
|
|
237
|
+
console.log();
|
|
238
|
+
if (options.scope === "page-specific") {
|
|
239
|
+
console.log(chalk2.yellow("\u26A0\uFE0F Page-specific scripts need page assignments to load."));
|
|
240
|
+
console.log(chalk2.dim(" Use app.cure.no \u2192 Kode to assign pages, or use MCP:"));
|
|
241
|
+
console.log(chalk2.dim(" kode_assign_script_to_page(scriptSlug, pageSlug)"));
|
|
242
|
+
console.log();
|
|
243
|
+
}
|
|
244
|
+
console.log(chalk2.dim('Run "kode deploy" to make changes live.'));
|
|
245
|
+
} catch (error) {
|
|
246
|
+
spinner.fail("Failed to update script");
|
|
247
|
+
console.error(chalk2.red("\nError:"), error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/commands/update-claude-md.ts
|
|
252
|
+
import chalk3 from "chalk";
|
|
253
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
254
|
+
import { join } from "path";
|
|
255
|
+
async function updateClaudeMdCommand() {
|
|
256
|
+
const projectRoot = findProjectRoot();
|
|
257
|
+
if (!projectRoot) {
|
|
258
|
+
console.log(chalk3.red("\u274C Not in a Cure Kode project."));
|
|
259
|
+
console.log(chalk3.dim(' Run "kode init" first.'));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const config = getProjectConfig(projectRoot);
|
|
263
|
+
if (!config) {
|
|
264
|
+
console.log(chalk3.red("\u274C Could not read project configuration."));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
193
267
|
const claudeMdPath = join(projectRoot, "CLAUDE.md");
|
|
194
268
|
const newKodeSection = generateClaudeMdMinimal(config.siteName, config.siteSlug);
|
|
195
269
|
if (!existsSync(claudeMdPath)) {
|
|
196
270
|
writeFileSync(claudeMdPath, newKodeSection);
|
|
197
|
-
console.log(
|
|
271
|
+
console.log(chalk3.green("\u2705 Created CLAUDE.md with Cure Kode section"));
|
|
198
272
|
return;
|
|
199
273
|
}
|
|
200
274
|
let content = readFileSync(claudeMdPath, "utf-8");
|
|
@@ -213,18 +287,18 @@ async function updateClaudeMdCommand() {
|
|
|
213
287
|
content = newKodeSection + "---\n\n" + content;
|
|
214
288
|
writeFileSync(claudeMdPath, content);
|
|
215
289
|
if (removedCount > 1) {
|
|
216
|
-
console.log(
|
|
290
|
+
console.log(chalk3.green(`\u2705 Cleaned up ${removedCount} duplicate Kode sections and added fresh one`));
|
|
217
291
|
} else if (removedCount === 1) {
|
|
218
|
-
console.log(
|
|
292
|
+
console.log(chalk3.green("\u2705 Updated Cure Kode section in CLAUDE.md"));
|
|
219
293
|
} else {
|
|
220
|
-
console.log(
|
|
294
|
+
console.log(chalk3.green("\u2705 Added Cure Kode section to CLAUDE.md"));
|
|
221
295
|
}
|
|
222
296
|
console.log();
|
|
223
|
-
console.log(
|
|
224
|
-
console.log(
|
|
225
|
-
console.log(
|
|
226
|
-
console.log(
|
|
227
|
-
console.log(
|
|
297
|
+
console.log(chalk3.dim("The Cure Kode section now includes:"));
|
|
298
|
+
console.log(chalk3.dim(" \u2022 What is Cure Kode (internal tool explanation)"));
|
|
299
|
+
console.log(chalk3.dim(" \u2022 CDN URL with script tag for Webflow"));
|
|
300
|
+
console.log(chalk3.dim(" \u2022 Workflow steps"));
|
|
301
|
+
console.log(chalk3.dim(" \u2022 Command reference"));
|
|
228
302
|
}
|
|
229
303
|
|
|
230
304
|
// src/cli.ts
|
|
@@ -259,12 +333,15 @@ program.command("status").description("Show current status of scripts and deploy
|
|
|
259
333
|
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) => {
|
|
260
334
|
contextCommand(options);
|
|
261
335
|
});
|
|
336
|
+
program.command("set <script>").description("Update script settings (scope, autoLoad)").option("--scope <scope>", "Set scope: global or page-specific").option("--auto-load", "Enable auto-loading").option("--no-auto-load", "Disable auto-loading").action((script, options) => {
|
|
337
|
+
setCommand(script, options);
|
|
338
|
+
});
|
|
262
339
|
program.command("update-claude-md").alias("ucm").description("Add or update Cure Kode section in CLAUDE.md").action(() => {
|
|
263
340
|
updateClaudeMdCommand();
|
|
264
341
|
});
|
|
265
342
|
program.showHelpAfterError();
|
|
266
343
|
console.log();
|
|
267
|
-
console.log(
|
|
268
|
-
console.log(
|
|
344
|
+
console.log(chalk4.bold(" Cure Kode CLI"));
|
|
345
|
+
console.log(chalk4.dim(" Manage JS/CSS for Webflow sites"));
|
|
269
346
|
console.log();
|
|
270
347
|
program.parse();
|
package/dist/index.js
CHANGED