@curenorway/kode-cli
v2.0.0
Published
CLI for Cure Kode CDN - manage, deploy, and sync JS/CSS scripts for Webflow sites with AI agent support
Downloads
364
Readme
Cure Kode CLI
Command-line tool for managing JavaScript and CSS scripts for Webflow sites via Cure Kode CDN.
Features
- Webflow Integration - Verifies init.js injection status (auto-injected at site creation in Cure App)
- Pull/Push scripts - Sync scripts between local files and remote CDN with conflict detection
- Sync awareness - Staleness indicators show when local state is out of date
- Deploy dry-run - Preview what will be deployed before executing
- Doctor command - Diagnose configuration issues and check for CLI updates
- Watch mode - Auto-sync on file changes with retry on failure
- Staging/Production - Separate environments with explicit production enable
- Rollback - Quick recovery to previous deployments
- AI-ready - Auto-generates KODE.md documentation for AI agents
- MCP Integration - Works with Cure Kode MCP for AI agents
Installation
npm install -g @curenorway/kode-cli
# or
pnpm add -g @curenorway/kode-cliQuick Start
# Initialize a new project (creates config + AI context)
kode init
# Pull existing scripts from remote
kode pull
# Edit your scripts locally in .cure-kode-scripts/
# Push changes
kode push
# Deploy to staging
kode deploy
# Watch for changes and auto-push
kode watchCommands
kode init
Initialize a Cure Kode project in the current directory.
kode initCreates:
.cure-kode/config.json- Site configuration and API key.cure-kode/KODE.md- Auto-generated documentation (scripts, pages, commands).cure-kode/context.md- AI context file.cure-kode-scripts/- Scripts directoryCLAUDE.md- Reference to KODE.md (prepended, never overwrites existing content).mcp.json- MCP server configuration (cure-kode, webflow, playwright).claude/skills/deploy/-/deployslash command for Claude Code.claude/skills/webflow-patterns/- Webflow DOM reference (auto-loaded by Claude when relevant)
Verifies that init.js has been auto-injected into Webflow (this happens when the site is created in the Cure App). If not yet injected, prompts you to run kode webflow inject.
kode pull
Download scripts from remote to your local scripts directory.
kode pull # Pull all scripts
kode pull --force # Overwrite local changesOutput shows script status:
[G]= Global scope,[P]= Page-specific⚡= Auto-load enabled,○= Manual load only
kode push
Upload local scripts to remote.
kode push # Push all changed scripts
kode push my-script.js # Push specific script
kode push --all # Push all scripts
kode push -m "Fixed bug" # Add change message
kode push --auto-load # Enable auto-load for new scripts
kode push --no-auto-load # Disable auto-loadkode watch
Watch for file changes and automatically push to remote.
kode watch # Watch and push
kode watch --deploy # Watch, push, and deploy on changesFeatures:
- Retry on network failure with exponential backoff
- Session summary on exit (Ctrl+C)
- Debounced uploads to prevent rapid-fire pushes
kode deploy
Deploy scripts to staging or production.
kode deploy # Deploy to staging (default)
kode deploy --dry-run # Preview deployment without executing
kode deploy --promote # Promote staging to production
kode deploy --force # Force release stale deploy lockNote: Production must be enabled before promoting. See kode production.
kode rollback
Rollback to a previous deployment.
kode rollback # Rollback staging to previous version
kode rollback production # Rollback production to previous versionkode production
Manage production environment (disabled by default for safety).
kode production status # Check if production is enabled
kode production enable # Enable production environment
kode production enable --domain example.com # Enable with specific domain
kode production disable # Disable production environmentkode html <url>
Fetch and analyze HTML from a URL.
kode html https://mysite.com # Analyze page
kode html https://mysite.com --json # Output as JSON
kode html https://mysite.com --scripts # Show scripts only
kode html https://mysite.com --styles # Show styles only
kode html https://mysite.com --save # Cache page context for AIkode pages
List cached page contexts.
kode pages # List all cached pages
kode pages --json # Output as JSONkode library
Browse and use the global script library (Bibliotek). Contains reusable snippets like GSAP animations, form handlers, scroll effects. Supports folders, editing, and soft-delete with 30-day recovery.
kode library # List all library snippets
kode library --tree # Show folder tree view
kode library search "scroll" # Search by name or tags
kode library add gsap-scroll-reveal # Copy snippet into project
kode library pull # Download all as local references
kode library push my-script.js # Push a local script to the library
kode library push my-script.js --folder animations # Push to folder
kode library update <slug> # Update snippet from local file
kode library update <slug> --file path/to/file.js # Update from specific file
kode library folders # List library folders
kode library folders --create "Animations" # Create folder
kode library trash # List trashed snippets
kode library trash --restore <id> # Restore from trash
kode library trash --empty # Permanently delete all trashLibrary snippets are reference material — they live in .cure-kode-scripts/library/ and are never deployed. Use kode library add to copy a snippet into your project scripts, then adapt it.
kode context
View and manage AI context.
kode context # View current context
kode context --edit # Open context in editor
kode context --refresh # Refresh context from remote
kode context --json # Output as JSONkode status
Show current project status with staleness indicators.
kode statusShows:
- Site info and CDN URL
- Production enabled state
- Script sync status with staleness warnings
- Per-script indicators: modified locally, server updated, conflicts
- Deployment versions
kode doctor
Diagnose configuration and environment issues.
kode doctorChecks:
- Project configuration and API key validity
- Network connectivity and API access
- MCP server configuration
- KODE.md and CLAUDE.md setup
- Security (.gitignore for API key)
- Sync state staleness
- CLI version and available updates
kode diff <script>
Show differences between local and remote script versions.
kode diff my-script # Compare local vs remotekode sync
Bidirectional sync with conflict detection.
kode sync # Sync both directions
kode sync --dry-run # Preview what would changekode webflow
Manage the Webflow Custom Code integration. The init.js script is auto-injected when a Kode site is created in the Cure App. These commands let you verify status, re-inject, or remove it.
kode webflow status # Check if init.js is injected (default)
kode webflow inject # Inject init.js into Webflow <head>
kode webflow inject --location footer # Inject into footer instead
kode webflow remove # Remove init.js from WebflowHow it works:
- Registers init.js as a hosted script with Webflow
- Applies it to the site's
<head>via the Custom Code API - Preserves any other scripts already managed by the API
- Does not affect manually-added code in the Webflow Designer
Note: After inject/remove, you must publish the Webflow site for changes to take effect.
Configuration
Project Config (.cure-kode/config.json)
{
"siteId": "uuid",
"siteSlug": "my-site",
"siteName": "My Site",
"apiKey": "ck_...",
"scriptsDir": ".cure-kode-scripts",
"environment": "staging"
}Scripts Directory
Default: .cure-kode-scripts/ (avoids conflicts with AI-generated scripts/ folders)
Environment Variables
CURE_KODE_API_KEY- API key (overrides project config)CURE_KODE_API_URL- API URL (default:https://app.cure.no)
Project Structure
your-project/
├── .claude/skills/ # Claude Code skills
│ ├── deploy/ # /deploy — push and deploy workflow
│ └── webflow-patterns/ # Auto-loaded Webflow DOM reference
├── .cure-kode/
│ ├── config.json # Project configuration (gitignored)
│ ├── scripts.json # Sync state for conflict detection
│ ├── KODE.md # Auto-generated documentation
│ ├── context.md # AI context (notes, discoveries)
│ └── pages/ # Cached page contexts
├── .cure-kode-scripts/ # Your scripts directory
│ ├── main.js
│ ├── form-handler.js
│ ├── styles.css
│ └── library/ # Reference only (never deployed)
│ ├── animations/
│ ├── forms/
│ └── utilities/
├── .mcp.json # MCP server configuration
└── CLAUDE.md # Reference to KODE.md (your content preserved)Claude Code Skills
kode init generates two Claude Code skills in .claude/skills/:
/deploy
Type /deploy in Claude Code to push and deploy to staging. Add --promote to promote to production.
Both you and Claude can use this — Claude will also invoke it when it finishes making changes and needs to publish them.
webflow-patterns (auto-loaded)
Background knowledge about Webflow DOM structure, reliable selectors, component patterns, and common pitfalls. Claude loads this automatically when writing or debugging Webflow scripts — it doesn't appear in the / menu.
Includes:
- Reliable vs unreliable CSS selectors for Webflow
- DOM-ready patterns with Webflow's IX2 engine
- Component reference (Navbar, Tabs, Slider, Dropdown, CMS lists, Forms)
- CSS specificity rules with Webflow's stylesheet
- Cure Kode script loading order and
window.CKAPI
The detailed reference lives in webflow-patterns/reference.md — Claude reads it when it needs specifics.
Workflow Examples
Basic Development
# 1. Initialize project
kode init
# 2. Pull existing scripts
kode pull
# 3. Start watch mode
kode watch
# 4. Edit files - they auto-push on save
# 5. When ready, deploy to staging
kode deploy
# 6. Test, then promote to production
kode production enable
kode deploy --promoteAI-Assisted Development
# 1. Initialize with MCP support
kode init
# 2. Cache page structures for AI context
kode html https://mysite.com/page1 --save
kode html https://mysite.com/page2 --save
# 3. AI can now use MCP tools to:
# - Read page structure: kode_get_page_context
# - Create scripts: kode_create_script
# - Push changes: kode_push
# - Deploy: kode_deployCI/CD Integration
# In your CI pipeline
kode push --all
kode deploy
# Run tests...
kode deploy --promoteEmergency Rollback
# Something went wrong in production
kode rollback production
# Or if deploy is stuck
kode deploy --forceAPI Key
Get your API key from the Cure app:
- Go to https://app.cure.no/tools/kode
- Open your site settings
- Generate an API key with appropriate permissions
Permissions
| Permission | CLI Commands |
|------------|--------------|
| read | pull, status, html, pages, context |
| write | push, watch |
| deploy | deploy, rollback, production |
| delete | (delete scripts) |
Security
API Key Storage
- API keys stored locally in
.cure-kode/config.json - Directory is automatically gitignored during
kode init - Keys are SHA256/HMAC hashed before server storage (V2 keys use salt)
SSRF Protection
The HTML fetch feature includes protection against Server-Side Request Forgery:
- Blocks private IP ranges (127.x.x.x, 10.x.x.x, 172.16-31.x.x, 192.168.x.x)
- Blocks localhost and internal domain names
- Blocks cloud metadata endpoints (169.254.169.254)
- Only allows HTTP/HTTPS protocols
Best Practices
- Never commit
.cure-kode/config.jsonto version control - Use separate keys for different environments
- Use read-only keys when possible
- Rotate keys periodically
Troubleshooting
"No project found"
Run kode init to initialize a project in the current directory.
"API key invalid"
Check that your API key:
- Starts with
ck_ - Has not expired
- Has the required permissions
"Deploy lock held"
Another deployment may be in progress. Wait or use:
kode deploy --force"Production not enabled"
Enable production before promoting:
kode production enable
kode deploy --promoteRequirements
- Node.js 18 or later
- Cure Kode API key
License
MIT
