@curenorway/kode-cli 1.5.0 → 1.6.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.
@@ -446,6 +446,10 @@ The \`.mcp.json\` file enables AI tools:
446
446
  - Modify site structure, CMS collections, pages, and more
447
447
  - Requires the Webflow MCP Bridge App running in Designer (press E \u2192 Apps)
448
448
 
449
+ **playwright MCP**: Testing and runtime HTML inspection
450
+ - \`browser_navigate\`, \`browser_snapshot\`, \`browser_click\`, \`browser_console_messages\`
451
+ - Use to verify scripts work correctly AFTER deploying to staging
452
+
449
453
  Restart Claude Code after \`kode init\` to load MCP servers.
450
454
 
451
455
  `;
@@ -672,6 +676,191 @@ Use both MCPs together for powerful workflows:
672
676
  2. Use **cure-kode MCP** to add custom JavaScript behavior to those pages
673
677
  3. Deploy scripts with \`kode_deploy\`, then verify in Webflow Designer
674
678
 
679
+ ## \u{1F9E0} Smart Workflow Guide
680
+
681
+ **IMPORTANT**: Before writing ANY JavaScript, always gather context first. Follow this decision tree:
682
+
683
+ ### The Three MCPs
684
+
685
+ | MCP | Purpose | When to Use |
686
+ |-----|---------|-------------|
687
+ | **Cure Kode** | Script management, static HTML, deployment | Writing & deploying scripts |
688
+ | **Webflow** | Site structure, CMS, pages, assets | Understanding data & structure |
689
+ | **Playwright** | Runtime HTML, testing, screenshots | Verifying scripts work correctly |
690
+
691
+ ### Step 1: Understand the Task
692
+
693
+ | Task Type | First Action |
694
+ |-----------|--------------|
695
+ | JS for CMS items (blog posts, products, etc.) | Use Webflow MCP \u2192 \`collections_list\`, \`collection_items\` to understand schema |
696
+ | JS for page interactions (modals, tabs, etc.) | Use Cure Kode MCP \u2192 \`kode_fetch_html_smart\` or \`kode_get_page_context\` |
697
+ | JS for forms | Use Webflow MCP \u2192 get form structure, then Cure Kode for custom validation |
698
+ | JS for navigation/menus | Use Webflow MCP \u2192 \`pages_list\` to get site structure |
699
+ | JS for dynamic content | Check BOTH - Webflow for data structure, Cure Kode for existing scripts |
700
+ | Debugging existing JS | Use Playwright MCP \u2192 \`browser_navigate\` + \`browser_console_messages\` |
701
+
702
+ ### Step 2: The Complete Workflow
703
+
704
+ \`\`\`
705
+ 1. DISCOVER: What elements/data am I working with?
706
+ - Webflow MCP: Site structure, CMS schemas, page list
707
+ - Cure Kode MCP: kode_get_page_context for CSS selectors and DOM structure
708
+
709
+ 2. CHECK: Are there existing scripts that do something similar?
710
+ - Cure Kode MCP: kode_list_scripts, kode_get_script
711
+
712
+ 3. PLAN: What selectors/APIs will my script need?
713
+ - Document in context.md using kode_update_context
714
+
715
+ 4. IMPLEMENT: Write the JavaScript
716
+ - Use kode_create_script or kode_update_script
717
+
718
+ 5. DEPLOY: Push to staging
719
+ - kode_deploy (staging)
720
+
721
+ 6. VERIFY: Test that it works! \u2B05\uFE0F CRITICAL STEP
722
+ - Playwright MCP: browser_navigate to staging URL
723
+ - Playwright MCP: browser_snapshot to see runtime DOM
724
+ - Playwright MCP: browser_console_messages to check for errors
725
+ - Playwright MCP: browser_click / browser_fill to test interactions
726
+ - If issues found \u2192 fix and redeploy
727
+
728
+ 7. PROMOTE: Go live
729
+ - kode_promote (production)
730
+ - Optionally verify production with Playwright
731
+ \`\`\`
732
+
733
+ ### Step 3: Common Patterns
734
+
735
+ **Pattern A: CMS-dependent JavaScript**
736
+ \`\`\`
737
+ User: "Add filtering to the blog posts"
738
+
739
+ AI Workflow:
740
+ 1. Webflow MCP \u2192 collections_list \u2192 find "Blog Posts" collection
741
+ 2. Webflow MCP \u2192 collection_get \u2192 understand fields (category, tags, date)
742
+ 3. Cure Kode MCP \u2192 kode_get_page_context("/blog") \u2192 get CSS selectors for blog items
743
+ 4. Write JS that uses the discovered selectors and field names
744
+ 5. Deploy to staging, test, promote
745
+ \`\`\`
746
+
747
+ **Pattern B: Interactive Component**
748
+ \`\`\`
749
+ User: "Add an accordion to the FAQ section"
750
+
751
+ AI Workflow:
752
+ 1. Cure Kode MCP \u2192 kode_get_page_context("/faq") \u2192 find FAQ section structure
753
+ 2. Check: Is it CMS-powered? If yes \u2192 Webflow MCP for collection schema
754
+ 3. Write JS using the exact CSS selectors from page context
755
+ 4. Deploy and test
756
+ \`\`\`
757
+
758
+ **Pattern C: Site-wide Feature**
759
+ \`\`\`
760
+ User: "Add a cookie consent banner"
761
+
762
+ AI Workflow:
763
+ 1. Cure Kode MCP \u2192 kode_list_scripts \u2192 check for existing consent scripts
764
+ 2. Create as GLOBAL script with autoLoad: true
765
+ 3. No page-specific context needed - runs on all pages
766
+ 4. Deploy to staging, verify on multiple pages, promote
767
+ \`\`\`
768
+
769
+ ### Key Principles
770
+
771
+ 1. **Never guess selectors** - Always use \`kode_get_page_context\` or \`kode_fetch_html_smart\`
772
+ 2. **Never assume CMS structure** - Always query Webflow MCP for collection schemas
773
+ 3. **Check before creating** - Use \`kode_list_scripts\` to avoid duplicates
774
+ 4. **Document discoveries** - Update \`context.md\` with findings for future sessions
775
+ 5. **Staging first** - Always deploy to staging before production
776
+
777
+ ### When You're Stuck
778
+
779
+ If you can't find the right selectors or understand the structure:
780
+ 1. Ask the user to open the page in browser and describe what they see
781
+ 2. Use \`kode_fetch_html_smart\` with the specific URL
782
+ 3. Check if there's cached context in \`kode_list_pages_context\`
783
+ 4. Ask the user to refresh context: \`kode html <url> --save --force\`
784
+
785
+ ## \u{1F3AD} Playwright MCP (Testing & Verification)
786
+
787
+ Playwright MCP is **always included** because testing is essential. Use it to:
788
+ - Get **runtime HTML** (after JavaScript has executed)
789
+ - **Test interactions** (clicks, form fills, hovers)
790
+ - **Debug issues** (console logs, network errors)
791
+ - **Take screenshots** for visual verification
792
+
793
+ ### Playwright MCP Tools
794
+
795
+ | Tool | Purpose | Example Use |
796
+ |------|---------|-------------|
797
+ | \`browser_navigate\` | Go to a URL | Navigate to staging site |
798
+ | \`browser_snapshot\` | Get accessibility tree (runtime DOM) | See what elements exist after JS runs |
799
+ | \`browser_click\` | Click an element | Test button clicks, menu opens |
800
+ | \`browser_fill\` | Type into input | Test form interactions |
801
+ | \`browser_select\` | Select dropdown option | Test select inputs |
802
+ | \`browser_hover\` | Hover over element | Test hover states |
803
+ | \`browser_screenshot\` | Take screenshot | Visual verification |
804
+ | \`browser_console_messages\` | Get console output | Check for JS errors |
805
+ | \`browser_network_requests\` | See network activity | Debug API calls |
806
+
807
+ ### Static vs Runtime HTML
808
+
809
+ | Method | What You Get | When to Use |
810
+ |--------|--------------|-------------|
811
+ | \`kode_fetch_html_smart\` | Static HTML (before JS) | Understanding page structure |
812
+ | \`browser_snapshot\` | Runtime DOM (after JS) | Verifying JS worked correctly |
813
+
814
+ **Example**: If your script adds a class \`.is-active\` to elements, \`kode_fetch_html_smart\` won't show it, but \`browser_snapshot\` will!
815
+
816
+ ### Testing Patterns
817
+
818
+ **Pattern: Verify Script Deployed Correctly**
819
+ \`\`\`
820
+ 1. browser_navigate \u2192 staging URL
821
+ 2. browser_snapshot \u2192 check if expected elements/classes exist
822
+ 3. browser_console_messages \u2192 ensure no JS errors
823
+ \`\`\`
824
+
825
+ **Pattern: Test Click Interaction**
826
+ \`\`\`
827
+ 1. browser_navigate \u2192 page URL
828
+ 2. browser_click \u2192 target element (e.g., ".accordion-trigger")
829
+ 3. browser_snapshot \u2192 verify state changed (e.g., ".accordion-content" visible)
830
+ \`\`\`
831
+
832
+ **Pattern: Test Form Validation**
833
+ \`\`\`
834
+ 1. browser_navigate \u2192 form page
835
+ 2. browser_fill \u2192 input invalid data
836
+ 3. browser_click \u2192 submit button
837
+ 4. browser_snapshot \u2192 verify error message appears
838
+ \`\`\`
839
+
840
+ **Pattern: Debug Why Script Isn't Working**
841
+ \`\`\`
842
+ 1. browser_navigate \u2192 problem page
843
+ 2. browser_console_messages \u2192 look for errors
844
+ 3. browser_snapshot \u2192 check if elements exist
845
+ 4. Compare with kode_fetch_html_smart \u2192 is JS even loading?
846
+ \`\`\`
847
+
848
+ ### Testing Checklist
849
+
850
+ Before promoting to production, verify:
851
+ - [ ] No console errors (\`browser_console_messages\`)
852
+ - [ ] Expected DOM changes visible (\`browser_snapshot\`)
853
+ - [ ] Interactions work (\`browser_click\`, \`browser_fill\`)
854
+ - [ ] Works on key pages (test multiple URLs)
855
+
856
+ ### Staging vs Production URLs
857
+
858
+ The staging URL for testing is typically:
859
+ - \`https://[site-slug].webflow.io\` (Webflow staging)
860
+ - Or check \`kode_site_info\` for configured staging domain
861
+
862
+ Always test on staging before promoting to production!
863
+
675
864
  `;
676
865
  }
677
866
 
@@ -824,6 +1013,10 @@ config.json
824
1013
  url: "https://mcp.webflow.com/sse"
825
1014
  };
826
1015
  }
1016
+ mcpConfig.mcpServers["playwright"] = {
1017
+ command: "npx",
1018
+ args: ["-y", "@playwright/mcp@latest"]
1019
+ };
827
1020
  spinner.start("Generating AI context files...");
828
1021
  writeFileSync3(mcpConfigPath, JSON.stringify(mcpConfig, null, 2) + "\n");
829
1022
  spinner.text = "Generating AI context files...";
@@ -973,6 +1166,9 @@ config.json
973
1166
  console.log(chalk.dim(" webflow: ") + chalk.yellow("Not configured"));
974
1167
  console.log(chalk.dim(" Run `kode init --force` to set up Webflow MCP later."));
975
1168
  }
1169
+ console.log();
1170
+ console.log(chalk.dim(" playwright:"));
1171
+ console.log(chalk.dim(" Test scripts, get runtime HTML (after JS runs), take screenshots."));
976
1172
  if (claudeMdAction === "separate") {
977
1173
  console.log(chalk.yellow("\n\u{1F4A1} Tip: Add this line to your CLAUDE.md to reference Kode instructions:"));
978
1174
  console.log(chalk.dim(" See KODE.md for Cure Kode CDN management instructions."));
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  readPageContext,
16
16
  statusCommand,
17
17
  watchCommand
18
- } from "./chunk-XBDIENFY.js";
18
+ } from "./chunk-GKNPODOV.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-XBDIENFY.js";
30
+ } from "./chunk-GKNPODOV.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.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
5
5
  "type": "module",
6
6
  "bin": {