@curenorway/kode-cli 1.9.2 → 1.10.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.
Files changed (2) hide show
  1. package/README.md +154 -67
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Command-line tool for managing JavaScript and CSS scripts for Webflow sites via Cure Kode CDN.
4
4
 
5
+ ## Features
6
+
7
+ - **Pull/Push scripts** - Sync scripts between local files and remote CDN
8
+ - **Watch mode** - Auto-sync on file changes with retry on failure
9
+ - **Staging/Production** - Separate environments with explicit production enable
10
+ - **Rollback** - Quick recovery to previous deployments
11
+ - **AI Context** - Generate and manage context for AI agents
12
+ - **Page Context Caching** - Save page structures for AI development
13
+ - **MCP Integration** - Works with Cure Kode MCP for AI agents
14
+
5
15
  ## Installation
6
16
 
7
17
  ```bash
@@ -13,13 +23,13 @@ pnpm add -g @curenorway/kode-cli
13
23
  ## Quick Start
14
24
 
15
25
  ```bash
16
- # Initialize a new project
26
+ # Initialize a new project (creates config + AI context)
17
27
  kode init
18
28
 
19
29
  # Pull existing scripts from remote
20
30
  kode pull
21
31
 
22
- # Edit your scripts locally...
32
+ # Edit your scripts locally in .cure-kode-scripts/
23
33
 
24
34
  # Push changes
25
35
  kode push
@@ -41,7 +51,12 @@ Initialize a Cure Kode project in the current directory.
41
51
  kode init
42
52
  ```
43
53
 
44
- This creates a `.cure-kode/config.json` file with your site configuration.
54
+ Creates:
55
+ - `.cure-kode/config.json` - Site configuration and API key
56
+ - `.cure-kode/context.md` - AI context file
57
+ - `.cure-kode-scripts/` - Scripts directory
58
+ - `CLAUDE.md` - AI agent instructions (with metadata documentation)
59
+ - `.mcp.json` - MCP server configuration (cure-kode, webflow, playwright)
45
60
 
46
61
  ### `kode pull`
47
62
 
@@ -52,6 +67,10 @@ kode pull # Pull all scripts
52
67
  kode pull --force # Overwrite local changes
53
68
  ```
54
69
 
70
+ Output shows script status:
71
+ - `[G]` = Global scope, `[P]` = Page-specific
72
+ - `⚡` = Auto-load enabled, `○` = Manual load only
73
+
55
74
  ### `kode push`
56
75
 
57
76
  Upload local scripts to remote.
@@ -61,6 +80,8 @@ kode push # Push all changed scripts
61
80
  kode push my-script.js # Push specific script
62
81
  kode push --all # Push all scripts
63
82
  kode push -m "Fixed bug" # Add change message
83
+ kode push --auto-load # Enable auto-load for new scripts
84
+ kode push --no-auto-load # Disable auto-load
64
85
  ```
65
86
 
66
87
  ### `kode watch`
@@ -69,30 +90,77 @@ Watch for file changes and automatically push to remote.
69
90
 
70
91
  ```bash
71
92
  kode watch # Watch and push
72
- kode watch --deploy # Watch, push, and deploy
73
- kode watch --env production # Watch with specific environment
93
+ kode watch --deploy # Watch, push, and deploy on changes
74
94
  ```
75
95
 
96
+ Features:
97
+ - Retry on network failure with exponential backoff
98
+ - Session summary on exit (Ctrl+C)
99
+ - Debounced uploads to prevent rapid-fire pushes
100
+
76
101
  ### `kode deploy`
77
102
 
78
103
  Deploy scripts to staging or production.
79
104
 
80
105
  ```bash
81
106
  kode deploy # Deploy to staging (default)
82
- kode deploy --env production # Deploy to production
83
107
  kode deploy --promote # Promote staging to production
108
+ kode deploy --force # Force release stale deploy lock
84
109
  kode deploy -n "Release v2" # Deploy with notes
85
110
  ```
86
111
 
112
+ **Note:** Production must be enabled before promoting. See `kode production`.
113
+
114
+ ### `kode rollback`
115
+
116
+ Rollback to a previous deployment.
117
+
118
+ ```bash
119
+ kode rollback # Rollback staging to previous version
120
+ kode rollback production # Rollback production to previous version
121
+ ```
122
+
123
+ ### `kode production`
124
+
125
+ Manage production environment (disabled by default for safety).
126
+
127
+ ```bash
128
+ kode production status # Check if production is enabled
129
+ kode production enable # Enable production environment
130
+ kode production enable --domain example.com # Enable with specific domain
131
+ kode production disable # Disable production environment
132
+ ```
133
+
87
134
  ### `kode html <url>`
88
135
 
89
136
  Fetch and analyze HTML from a URL.
90
137
 
91
138
  ```bash
92
- kode html https://mysite.com
93
- kode html https://mysite.com --json # Output as JSON
94
- kode html https://mysite.com --scripts # Show scripts only
95
- kode html https://mysite.com --styles # Show styles only
139
+ kode html https://mysite.com # Analyze page
140
+ kode html https://mysite.com --json # Output as JSON
141
+ kode html https://mysite.com --scripts # Show scripts only
142
+ kode html https://mysite.com --styles # Show styles only
143
+ kode html https://mysite.com --save # Cache page context for AI
144
+ ```
145
+
146
+ ### `kode pages`
147
+
148
+ List cached page contexts.
149
+
150
+ ```bash
151
+ kode pages # List all cached pages
152
+ kode pages --json # Output as JSON
153
+ ```
154
+
155
+ ### `kode context`
156
+
157
+ View and manage AI context.
158
+
159
+ ```bash
160
+ kode context # View current context
161
+ kode context --edit # Open context in editor
162
+ kode context --refresh # Refresh context from remote
163
+ kode context --json # Output as JSON
96
164
  ```
97
165
 
98
166
  ### `kode status`
@@ -103,6 +171,12 @@ Show current project status.
103
171
  kode status
104
172
  ```
105
173
 
174
+ Shows:
175
+ - Site info and CDN URL
176
+ - Production enabled state
177
+ - Script sync status
178
+ - Deployment versions
179
+
106
180
  ## Configuration
107
181
 
108
182
  ### Project Config (`.cure-kode/config.json`)
@@ -113,37 +187,34 @@ kode status
113
187
  "siteSlug": "my-site",
114
188
  "siteName": "My Site",
115
189
  "apiKey": "ck_...",
116
- "scriptsDir": "kode",
190
+ "scriptsDir": ".cure-kode-scripts",
117
191
  "environment": "staging"
118
192
  }
119
193
  ```
120
194
 
121
- ### Global Config
195
+ ### Scripts Directory
122
196
 
123
- Global configuration is stored in `~/.config/cure-kode/config.json`:
124
-
125
- ```json
126
- {
127
- "apiUrl": "https://app.cure.no"
128
- }
129
- ```
197
+ Default: `.cure-kode-scripts/` (avoids conflicts with AI-generated `scripts/` folders)
130
198
 
131
199
  ### Environment Variables
132
200
 
133
201
  - `CURE_KODE_API_KEY` - API key (overrides project config)
134
- - `CURE_KODE_API_URL` - API URL (overrides global config)
202
+ - `CURE_KODE_API_URL` - API URL (default: `https://app.cure.no`)
135
203
 
136
204
  ## Project Structure
137
205
 
138
206
  ```
139
207
  your-project/
140
208
  ├── .cure-kode/
141
- │ ├── config.json # Project configuration
142
- └── scripts.json # Script metadata (versions, sync status)
143
- └── kode/ # Your scripts directory
144
- ├── init.js
145
- ├── tracking.js
146
- └── styles.css
209
+ │ ├── config.json # Project configuration
210
+ ├── context.md # AI context (notes, discoveries)
211
+ └── pages/ # Cached page contexts
212
+ ├── .cure-kode-scripts/ # Your scripts directory
213
+ ├── init.js
214
+ │ ├── tracking.js
215
+ │ └── styles.css
216
+ ├── .mcp.json # MCP server configuration
217
+ └── CLAUDE.md # AI agent instructions
147
218
  ```
148
219
 
149
220
  ## Workflow Examples
@@ -160,10 +231,31 @@ kode pull
160
231
  # 3. Start watch mode
161
232
  kode watch
162
233
 
163
- # 4. Edit files in your editor - they auto-push on save
234
+ # 4. Edit files - they auto-push on save
164
235
 
165
- # 5. When ready, deploy
236
+ # 5. When ready, deploy to staging
166
237
  kode deploy
238
+
239
+ # 6. Test, then promote to production
240
+ kode production enable
241
+ kode deploy --promote
242
+ ```
243
+
244
+ ### AI-Assisted Development
245
+
246
+ ```bash
247
+ # 1. Initialize with MCP support
248
+ kode init
249
+
250
+ # 2. Cache page structures for AI context
251
+ kode html https://mysite.com/page1 --save
252
+ kode html https://mysite.com/page2 --save
253
+
254
+ # 3. AI can now use MCP tools to:
255
+ # - Read page structure: kode_get_page_context
256
+ # - Create scripts: kode_create_script
257
+ # - Push changes: kode_push
258
+ # - Deploy: kode_deploy
167
259
  ```
168
260
 
169
261
  ### CI/CD Integration
@@ -171,25 +263,19 @@ kode deploy
171
263
  ```bash
172
264
  # In your CI pipeline
173
265
  kode push --all
174
- kode deploy --env staging
266
+ kode deploy
175
267
  # Run tests...
176
268
  kode deploy --promote
177
269
  ```
178
270
 
179
- ### Team Workflow
271
+ ### Emergency Rollback
180
272
 
181
273
  ```bash
182
- # Developer 1: Pull latest
183
- kode pull --force
184
-
185
- # Developer 2: Push changes
186
- kode push -m "Added new animation"
187
-
188
- # Deploy to staging for review
189
- kode deploy -n "Review build"
274
+ # Something went wrong in production
275
+ kode rollback production
190
276
 
191
- # After approval, promote to production
192
- kode deploy --promote
277
+ # Or if deploy is stuck
278
+ kode deploy --force
193
279
  ```
194
280
 
195
281
  ## API Key
@@ -201,15 +287,12 @@ Get your API key from the Cure app:
201
287
 
202
288
  ### Permissions
203
289
 
204
- - `read` - Pull scripts, view status
205
- - `write` - Push scripts
206
- - `deploy` - Deploy to staging/production
207
- - `delete` - Delete scripts
208
-
209
- ## Requirements
210
-
211
- - Node.js 18 or later
212
- - Cure Kode API key
290
+ | Permission | CLI Commands |
291
+ |------------|--------------|
292
+ | `read` | `pull`, `status`, `html`, `pages`, `context` |
293
+ | `write` | `push`, `watch` |
294
+ | `deploy` | `deploy`, `rollback`, `production` |
295
+ | `delete` | (delete scripts) |
213
296
 
214
297
  ## Security
215
298
 
@@ -217,23 +300,11 @@ Get your API key from the Cure app:
217
300
 
218
301
  - API keys stored locally in `.cure-kode/config.json`
219
302
  - Directory is automatically gitignored during `kode init`
220
- - Keys are **SHA256 hashed** before server storage
221
-
222
- ### Permissions Model
303
+ - Keys are **SHA256/HMAC hashed** before server storage (V2 keys use salt)
223
304
 
224
- API keys have granular, site-scoped permissions:
225
-
226
- | Permission | CLI Commands |
227
- |------------|--------------|
228
- | `read` | `pull`, `status`, `html`, `pages`, `context` |
229
- | `write` | `push`, `watch` |
230
- | `deploy` | `deploy` |
231
- | `delete` | (delete scripts) |
232
-
233
- ### Network Security
234
-
235
- The HTML fetch feature (`kode html`) includes **SSRF protection**:
305
+ ### SSRF Protection
236
306
 
307
+ The HTML fetch feature includes protection against Server-Side Request Forgery:
237
308
  - Blocks private IP ranges (127.x.x.x, 10.x.x.x, 172.16-31.x.x, 192.168.x.x)
238
309
  - Blocks localhost and internal domain names
239
310
  - Blocks cloud metadata endpoints (169.254.169.254)
@@ -244,7 +315,7 @@ The HTML fetch feature (`kode html`) includes **SSRF protection**:
244
315
  1. **Never commit** `.cure-kode/config.json` to version control
245
316
  2. Use **separate keys** for different environments
246
317
  3. Use **read-only keys** when possible
247
- 4. **Rotate keys** periodically and when team members leave
318
+ 4. **Rotate keys** periodically
248
319
 
249
320
  ## Troubleshooting
250
321
 
@@ -259,9 +330,25 @@ Check that your API key:
259
330
  - Has not expired
260
331
  - Has the required permissions
261
332
 
262
- ### "Script not found"
333
+ ### "Deploy lock held"
334
+
335
+ Another deployment may be in progress. Wait or use:
336
+ ```bash
337
+ kode deploy --force
338
+ ```
339
+
340
+ ### "Production not enabled"
341
+
342
+ Enable production before promoting:
343
+ ```bash
344
+ kode production enable
345
+ kode deploy --promote
346
+ ```
263
347
 
264
- The script may not exist on remote. Use `kode push` to create it.
348
+ ## Requirements
349
+
350
+ - Node.js 18 or later
351
+ - Cure Kode API key
265
352
 
266
353
  ## License
267
354
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@curenorway/kode-cli",
3
- "version": "1.9.2",
4
- "description": "CLI tool for Cure Kode - manage JS/CSS scripts for Webflow sites",
3
+ "version": "1.10.0",
4
+ "description": "CLI for Cure Kode CDN - manage, deploy, and sync JS/CSS scripts for Webflow sites with AI agent support",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "cure-kode": "./dist/cli.js",