@curenorway/kode-cli 1.4.0 → 1.5.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.
@@ -437,8 +437,16 @@ Update context.md after your session with discoveries and changes.
437
437
 
438
438
  ### MCP Tools
439
439
 
440
- The \`.mcp.json\` file enables AI tools for page assignment, HTML caching, and context updates.
441
- Restart Claude Code after \`kode init\` to load the MCP server.
440
+ The \`.mcp.json\` file enables AI tools:
441
+
442
+ **cure-kode MCP**: Script management, HTML analysis, deployment
443
+ - \`kode_update_script\`, \`kode_deploy\`, \`kode_fetch_html_smart\`, etc.
444
+
445
+ **webflow MCP** (if configured): Webflow Designer API access
446
+ - Modify site structure, CMS collections, pages, and more
447
+ - Requires the Webflow MCP Bridge App running in Designer (press E \u2192 Apps)
448
+
449
+ Restart Claude Code after \`kode init\` to load MCP servers.
442
450
 
443
451
  `;
444
452
  }
@@ -629,9 +637,127 @@ If using the Kode MCP server, these tools are available:
629
637
  ### MCP Setup
630
638
 
631
639
  The \`.mcp.json\` file (created by \`kode init\`) enables MCP tools automatically.
632
- **Restart Claude Code** after init to load the MCP server.
640
+ **Restart Claude Code** after init to load the MCP servers.
641
+
642
+ ## Webflow MCP (Optional)
643
+
644
+ If configured during \`kode init\`, you also have access to the official Webflow MCP server.
645
+ This enables AI agents to interact directly with the Webflow Designer API.
646
+
647
+ ### Webflow MCP Tools
648
+
649
+ - **Site & Page Management**: Create, read, update pages and site settings
650
+ - **CMS Collections**: Manage collection schemas and items
651
+ - **Components**: Work with reusable components
652
+ - **Assets**: Upload and manage media assets
653
+ - **Forms**: Configure form settings
654
+
655
+ ### Using Webflow MCP
656
+
657
+ 1. **Start the Bridge App**: Open your site in Webflow Designer, press E, launch "Webflow MCP Bridge App"
658
+ 2. **OAuth Mode**: If using OAuth, you'll be prompted to authorize on first use
659
+ 3. **Token Mode**: Works immediately if a token was configured
660
+
661
+ ### Example Prompts with Webflow MCP
662
+
663
+ - "Add a new blog post to the CMS collection"
664
+ - "Create a new page at /about with a hero section"
665
+ - "Update the navigation menu to include a new link"
666
+ - "Show me all published pages on this site"
667
+
668
+ ### Combined Workflows
669
+
670
+ Use both MCPs together for powerful workflows:
671
+ 1. Use **webflow MCP** to understand site structure and create pages
672
+ 2. Use **cure-kode MCP** to add custom JavaScript behavior to those pages
673
+ 3. Deploy scripts with \`kode_deploy\`, then verify in Webflow Designer
674
+
675
+ ## \u{1F9E0} Smart Workflow Guide
676
+
677
+ **IMPORTANT**: Before writing ANY JavaScript, always gather context first. Follow this decision tree:
678
+
679
+ ### Step 1: Understand the Task
680
+
681
+ | Task Type | First Action |
682
+ |-----------|--------------|
683
+ | JS for CMS items (blog posts, products, etc.) | Use Webflow MCP \u2192 \`collections_list\`, \`collection_items\` to understand schema |
684
+ | JS for page interactions (modals, tabs, etc.) | Use Cure Kode MCP \u2192 \`kode_fetch_html_smart\` or \`kode_get_page_context\` |
685
+ | JS for forms | Use Webflow MCP \u2192 get form structure, then Cure Kode for custom validation |
686
+ | JS for navigation/menus | Use Webflow MCP \u2192 \`pages_list\` to get site structure |
687
+ | JS for dynamic content | Check BOTH - Webflow for data structure, Cure Kode for existing scripts |
688
+
689
+ ### Step 2: Discovery Workflow
690
+
691
+ \`\`\`
692
+ 1. DISCOVER: What elements/data am I working with?
693
+ - Webflow MCP: Site structure, CMS schemas, page list
694
+ - Cure Kode MCP: kode_get_page_context for CSS selectors and DOM structure
695
+
696
+ 2. CHECK: Are there existing scripts that do something similar?
697
+ - Cure Kode MCP: kode_list_scripts, kode_get_script
698
+
699
+ 3. PLAN: What selectors/APIs will my script need?
700
+ - Document in context.md using kode_update_context
701
+
702
+ 4. IMPLEMENT: Write the JavaScript
703
+ - Use kode_create_script or kode_update_script
704
+
705
+ 5. DEPLOY: Test on staging first
706
+ - kode_deploy (staging), verify, then kode_promote (production)
707
+ \`\`\`
708
+
709
+ ### Step 3: Common Patterns
710
+
711
+ **Pattern A: CMS-dependent JavaScript**
712
+ \`\`\`
713
+ User: "Add filtering to the blog posts"
714
+
715
+ AI Workflow:
716
+ 1. Webflow MCP \u2192 collections_list \u2192 find "Blog Posts" collection
717
+ 2. Webflow MCP \u2192 collection_get \u2192 understand fields (category, tags, date)
718
+ 3. Cure Kode MCP \u2192 kode_get_page_context("/blog") \u2192 get CSS selectors for blog items
719
+ 4. Write JS that uses the discovered selectors and field names
720
+ 5. Deploy to staging, test, promote
721
+ \`\`\`
722
+
723
+ **Pattern B: Interactive Component**
724
+ \`\`\`
725
+ User: "Add an accordion to the FAQ section"
726
+
727
+ AI Workflow:
728
+ 1. Cure Kode MCP \u2192 kode_get_page_context("/faq") \u2192 find FAQ section structure
729
+ 2. Check: Is it CMS-powered? If yes \u2192 Webflow MCP for collection schema
730
+ 3. Write JS using the exact CSS selectors from page context
731
+ 4. Deploy and test
732
+ \`\`\`
733
+
734
+ **Pattern C: Site-wide Feature**
735
+ \`\`\`
736
+ User: "Add a cookie consent banner"
737
+
738
+ AI Workflow:
739
+ 1. Cure Kode MCP \u2192 kode_list_scripts \u2192 check for existing consent scripts
740
+ 2. Create as GLOBAL script with autoLoad: true
741
+ 3. No page-specific context needed - runs on all pages
742
+ 4. Deploy to staging, verify on multiple pages, promote
743
+ \`\`\`
744
+
745
+ ### Key Principles
746
+
747
+ 1. **Never guess selectors** - Always use \`kode_get_page_context\` or \`kode_fetch_html_smart\`
748
+ 2. **Never assume CMS structure** - Always query Webflow MCP for collection schemas
749
+ 3. **Check before creating** - Use \`kode_list_scripts\` to avoid duplicates
750
+ 4. **Document discoveries** - Update \`context.md\` with findings for future sessions
751
+ 5. **Staging first** - Always deploy to staging before production
752
+
753
+ ### When You're Stuck
754
+
755
+ If you can't find the right selectors or understand the structure:
756
+ 1. Ask the user to open the page in browser and describe what they see
757
+ 2. Use \`kode_fetch_html_smart\` with the specific URL
758
+ 3. Check if there's cached context in \`kode_list_pages_context\`
759
+ 4. Ask the user to refresh context: \`kode html <url> --save --force\`
633
760
 
634
- MCP tools provide richer functionality than CLI alone (page assignment, context updates, HTML caching).
635
761
  `;
636
762
  }
637
763
 
@@ -726,6 +852,65 @@ config.json
726
852
  args: ["-y", "@curenorway/kode-mcp"],
727
853
  env: {}
728
854
  };
855
+ let webflowToken = site.webflow_token;
856
+ let webflowMcpMethod = null;
857
+ spinner.stop();
858
+ if (webflowToken) {
859
+ console.log(chalk.green("\u2713 Webflow API token found in site settings"));
860
+ webflowMcpMethod = "token";
861
+ } else {
862
+ console.log(chalk.yellow("\n\u{1F4E6} Webflow MCP Setup"));
863
+ console.log(chalk.dim(" The Webflow MCP enables AI agents to interact with the Webflow Designer."));
864
+ console.log();
865
+ const { webflowSetup } = await prompt([
866
+ {
867
+ type: "select",
868
+ name: "webflowSetup",
869
+ message: "How would you like to set up Webflow MCP?",
870
+ choices: [
871
+ {
872
+ name: "oauth",
873
+ message: "Use OAuth (recommended) - authorize via browser when needed"
874
+ },
875
+ {
876
+ name: "token",
877
+ message: "Provide API token - use a Webflow API token"
878
+ },
879
+ {
880
+ name: "skip",
881
+ message: "Skip - set up Webflow MCP later"
882
+ }
883
+ ],
884
+ initial: 0
885
+ }
886
+ ]);
887
+ webflowMcpMethod = webflowSetup;
888
+ if (webflowSetup === "token") {
889
+ const { webflowToken: providedToken } = await prompt([
890
+ {
891
+ type: "password",
892
+ name: "webflowToken",
893
+ message: "Webflow API Token (from webflow.com/dashboard/account/integrations):",
894
+ validate: (value) => value.length > 0 ? true : "Token is required"
895
+ }
896
+ ]);
897
+ webflowToken = providedToken;
898
+ }
899
+ }
900
+ if (webflowMcpMethod === "token" && webflowToken) {
901
+ mcpConfig.mcpServers["webflow"] = {
902
+ command: "npx",
903
+ args: ["-y", "webflow-mcp-server@latest"],
904
+ env: {
905
+ WEBFLOW_TOKEN: webflowToken
906
+ }
907
+ };
908
+ } else if (webflowMcpMethod === "oauth") {
909
+ mcpConfig.mcpServers["webflow"] = {
910
+ url: "https://mcp.webflow.com/sse"
911
+ };
912
+ }
913
+ spinner.start("Generating AI context files...");
729
914
  writeFileSync3(mcpConfigPath, JSON.stringify(mcpConfig, null, 2) + "\n");
730
915
  spinner.text = "Generating AI context files...";
731
916
  spinner.start();
@@ -856,12 +1041,35 @@ config.json
856
1041
  console.log(chalk.cyan(" 2. kode watch ") + chalk.dim("Watch for changes and auto-push"));
857
1042
  console.log(chalk.cyan(" 3. kode deploy ") + chalk.dim("Deploy to staging"));
858
1043
  console.log(chalk.bold("\n\u{1F4A1} MCP Tools:"));
859
- console.log(chalk.dim(" Restart Claude Code, then use /mcp to approve the cure-kode server."));
860
- console.log(chalk.dim(" This enables AI tools like kode_update_script, kode_fetch_html_smart, etc."));
1044
+ console.log(chalk.dim(" Restart Claude Code, then use /mcp to approve the MCP servers."));
1045
+ console.log();
1046
+ console.log(chalk.dim(" cure-kode:"));
1047
+ console.log(chalk.dim(" kode_update_script, kode_fetch_html_smart, kode_deploy, etc."));
1048
+ if (webflowMcpMethod === "token") {
1049
+ console.log();
1050
+ console.log(chalk.dim(" webflow (token mode):"));
1051
+ console.log(chalk.dim(" Interact with Webflow Designer API, modify site structure, CMS, etc."));
1052
+ } else if (webflowMcpMethod === "oauth") {
1053
+ console.log();
1054
+ console.log(chalk.dim(" webflow (OAuth mode):"));
1055
+ console.log(chalk.dim(" You'll be prompted to authorize via browser on first use."));
1056
+ console.log(chalk.dim(" Requires Node.js 22.3.0+ for remote MCP."));
1057
+ } else {
1058
+ console.log();
1059
+ console.log(chalk.dim(" webflow: ") + chalk.yellow("Not configured"));
1060
+ console.log(chalk.dim(" Run `kode init --force` to set up Webflow MCP later."));
1061
+ }
861
1062
  if (claudeMdAction === "separate") {
862
1063
  console.log(chalk.yellow("\n\u{1F4A1} Tip: Add this line to your CLAUDE.md to reference Kode instructions:"));
863
1064
  console.log(chalk.dim(" See KODE.md for Cure Kode CDN management instructions."));
864
1065
  }
1066
+ if (webflowMcpMethod === "token" || webflowMcpMethod === "oauth") {
1067
+ console.log(chalk.bold("\n\u{1F517} Webflow Designer Integration:"));
1068
+ console.log(chalk.dim(" 1. Open your site in Webflow Designer"));
1069
+ console.log(chalk.dim(" 2. Press E to open Apps panel"));
1070
+ console.log(chalk.dim(' 3. Launch the "Webflow MCP Bridge App"'));
1071
+ console.log(chalk.dim(" 4. AI agents can now interact with the Designer"));
1072
+ }
865
1073
  } catch (error) {
866
1074
  spinner.fail("Initialization failed");
867
1075
  console.error(chalk.red("\nError:"), error);
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  readPageContext,
16
16
  statusCommand,
17
17
  watchCommand
18
- } from "./chunk-OW3XKTBO.js";
18
+ } from "./chunk-Z3QNIDBJ.js";
19
19
 
20
20
  // src/cli.ts
21
21
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  updateScriptPurpose,
28
28
  watchCommand,
29
29
  writeContext
30
- } from "./chunk-OW3XKTBO.js";
30
+ } from "./chunk-Z3QNIDBJ.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.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
5
5
  "type": "module",
6
6
  "bin": {