@curenorway/kode-cli
v1.14.0
Published
CLI for Cure Kode CDN - manage, deploy, and sync JS/CSS scripts for Webflow sites with AI agent support
Readme
Cure Kode CLI
Command-line tool for managing JavaScript and CSS scripts for Webflow sites via Cure Kode CDN.
Features
- 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)
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 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 changeConfiguration
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/
├── .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
├── .mcp.json # MCP server configuration
└── CLAUDE.md # Reference to KODE.md (your content preserved)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
