@claudiv/cli 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Amir Guterman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,430 @@
1
+ # @claudiv/cli
2
+
3
+ ### *Claude in a Div - CLI Tool*
4
+
5
+ > **Conversational Development with Claude** - Build applications by describing what you want in CDML
6
+
7
+ **@claudiv/cli** is the command-line tool for the Claudiv platform. It watches `.cdml` (Claudiv Markup Language) files, generates code through conversations with Claude AI, and provides a development server with hot reload.
8
+
9
+ **Powered by [@claudiv/core](https://npmjs.com/package/@claudiv/core)** - The pure generation engine
10
+
11
+ ## ✨ What Makes Claudiv Special
12
+
13
+ - 🗣️ **Conversational Development** - Describe your UI naturally, Claude generates the code
14
+ - 🏗️ **Freeform Structure** - Use ANY tag names - no conventions to learn
15
+ - 🎯 **Attribute-Based Actions** - Just add `gen=""` to trigger AI generation
16
+ - 🔒 **Selective Regeneration** - Lock what works, regenerate what needs improvement
17
+ - 🔥 **Hot Reload** - See changes instantly in your browser
18
+ - 🌳 **Hierarchical Context** - Nested structure automatically provides AI context
19
+ - 📝 **Living Specification** - Your spec.html is the source of truth, not the generated code
20
+
21
+ ## 🚀 Quick Start
22
+
23
+ ```bash
24
+ # Install globally
25
+ npm install -g @claudiv/cli
26
+
27
+ # Create a .cdml file
28
+ mkdir claudiv
29
+ echo '<app><button gen>Make a blue button</button></app>' > claudiv/app.cdml
30
+
31
+ # Start development
32
+ claudiv
33
+ ```
34
+
35
+ Your browser opens at `http://localhost:30004` with a working blue button. **That's it.**
36
+
37
+ ## 💡 How It Works
38
+
39
+ ### 1. Write CDML Specifications
40
+
41
+ Create `.cdml` files with declarative markup:
42
+
43
+ ```xml
44
+ <!-- claudiv/app.cdml -->
45
+ <app target="html">
46
+ <hero-section gen>
47
+ Create a hero section with gradient background,
48
+ large heading "Welcome to the Future",
49
+ and a call-to-action button
50
+ </hero-section>
51
+ </app>
52
+ ```
53
+
54
+ ### 2. Claude Generates Implementation
55
+
56
+ Claudiv sends your specification to Claude (via CLI subscription or API), which generates complete code and updates your browser automatically.
57
+
58
+ Generated artifacts:
59
+ - `app.html` - Final HTML/CSS implementation
60
+ - `app.spec.cdml` - Structured specification
61
+ - `app.rules.cdml` - Extracted rules and conventions
62
+ - `app.models.cdml` - Data models and entities
63
+ - `app.tests.cdml` - Test specifications
64
+
65
+ ### 3. Iterate Naturally
66
+
67
+ ```xml
68
+ <!-- claudiv/app.cdml -->
69
+ <app target="html">
70
+ <hero-section lock>
71
+ <!-- Already perfect, keep this -->
72
+ </hero-section>
73
+
74
+ <features-grid gen>
75
+ Add a 3-column grid showcasing key features
76
+ with icons and descriptions
77
+ </features-grid>
78
+ </app>
79
+ ```
80
+
81
+ Lock what works, regenerate what needs improvement. **No manual code editing required.**
82
+
83
+ ## 🎯 Core Concepts
84
+
85
+ ### Freeform Tag Names
86
+
87
+ Use **any** tag name that makes sense to you:
88
+
89
+ ```xml
90
+ <user-dashboard gen="">
91
+ <pricing-table gen="">
92
+ <testimonial-carousel gen="">
93
+ <contact-form gen="">
94
+ ```
95
+
96
+ Tag names help you organize and help Claude understand intent.
97
+
98
+ ### Attributes as Specifications
99
+
100
+ Provide structured specifications via attributes:
101
+
102
+ ```xml
103
+ <button
104
+ color="blue"
105
+ size="large"
106
+ icon="checkmark"
107
+ action="submit-form"
108
+ gen="">
109
+ </button>
110
+ ```
111
+
112
+ Claude uses these to guide implementation.
113
+
114
+ ### Action Attributes
115
+
116
+ - `gen=""` - Generate new implementation
117
+ - `retry=""` - Regenerate with same specs
118
+ - `undo=""` - Revert previous change
119
+ - `lock=""` - Prevent children from regeneration
120
+ - `unlock=""` - Override parent lock
121
+
122
+ ### Lock/Unlock System
123
+
124
+ Perfect for iterative development:
125
+
126
+ ```xml
127
+ <!-- Lock everything, regenerate only header -->
128
+ <website lock="" gen="">
129
+ <header unlock="">
130
+ Update header with sticky navigation
131
+ </header>
132
+ <sidebar>Stays locked</sidebar>
133
+ <content>Stays locked</content>
134
+ </website>
135
+ ```
136
+
137
+ ## 🎨 Real-World Example
138
+
139
+ ```xml
140
+ <app theme="dark">
141
+ <!-- Navigation -->
142
+ <nav-menu dock="left" styling="professional compact" gen="">
143
+ <pages>
144
+ <home>Home</home>
145
+ <gallery>Gallery</gallery>
146
+ <about>About</about>
147
+ </pages>
148
+ </nav-menu>
149
+
150
+ <!-- Main Content -->
151
+ <pages gen="">
152
+ <home content="classic home">
153
+ Hero section with welcome message,
154
+ 3 feature cards highlighting benefits,
155
+ testimonials section with 4 reviews
156
+ </home>
157
+
158
+ <gallery layout="grid" columns="3">
159
+ Photo gallery with hover effects,
160
+ lightbox on click, responsive grid
161
+ </gallery>
162
+ </pages>
163
+ </app>
164
+ ```
165
+
166
+ **Result**: Complete, working website with navigation, pages, and all features implemented.
167
+
168
+ ## 📚 Documentation
169
+
170
+ - **[Getting Started Guide](../../docs/FEATURES-SUMMARY.md)** - Complete feature overview
171
+ - **[Attribute Syntax](../../docs/ATTRIBUTE-SYNTAX.md)** - Full syntax reference
172
+ - **[Lock/Unlock Guide](../../docs/LOCK-UNLOCK-GUIDE.md)** - Selective regeneration patterns
173
+ - **[CDML Schema Guide](../../docs/SCHEMA-GUIDE.md)** - IDE autocomplete setup
174
+ - **[Core API Documentation](https://npmjs.com/package/@claudiv/core)** - @claudiv/core reference
175
+
176
+ ## ⚙️ Configuration
177
+
178
+ ### Configuration File
179
+
180
+ Create `claudiv.json` in your project root:
181
+
182
+ ```json
183
+ {
184
+ "mode": "cli",
185
+ "specFile": "claudiv/app.cdml",
186
+ "outputDir": "src/generated",
187
+ "target": "html"
188
+ }
189
+ ```
190
+
191
+ ### Two Generation Modes
192
+
193
+ **CLI Mode** (uses Claude Code subscription):
194
+ ```bash
195
+ # Set in claudiv.json
196
+ { "mode": "cli" }
197
+
198
+ # Or via environment variable
199
+ MODE=cli claudiv
200
+ ```
201
+
202
+ **API Mode** (pay-per-use via Anthropic API):
203
+ ```env
204
+ # .claudiv/.env file
205
+ MODE=api
206
+ ANTHROPIC_API_KEY=sk-ant-api03-...
207
+ ```
208
+
209
+ ### Project Structure
210
+
211
+ ```
212
+ my-project/
213
+ ├── claudiv/ # CDML source files (version controlled)
214
+ │ ├── app.cdml # Main specification
215
+ │ ├── app.spec.cdml # Generated structured spec
216
+ │ ├── app.rules.cdml # Generated rules
217
+ │ ├── app.models.cdml # Generated data models
218
+ │ └── app.tests.cdml # Generated tests
219
+
220
+ ├── src/generated/ # Generated code (gitignored)
221
+ │ └── app.html
222
+
223
+ ├── .claudiv/ # Metadata (gitignored)
224
+ │ ├── .env # API keys
225
+ │ ├── cache/
226
+ │ └── logs/
227
+
228
+ ├── claudiv.json # Configuration
229
+ └── .gitignore
230
+ ```
231
+
232
+ ### IDE Support
233
+
234
+ Install the **Red Hat XML** extension in VS Code for:
235
+ - Autocomplete for CDML attributes
236
+ - Documentation on hover
237
+ - Real-time validation
238
+
239
+ See [SCHEMA-GUIDE.md](../../docs/SCHEMA-GUIDE.md) for setup instructions.
240
+
241
+ ## 🔥 Advanced Features
242
+
243
+ ### Nested Component Specifications
244
+
245
+ All nested elements are automatically implemented:
246
+
247
+ ```xml
248
+ <dashboard gen="">
249
+ <header>App header with logo and user menu</header>
250
+ <sidebar>
251
+ <nav-links>Dashboard, Analytics, Settings</nav-links>
252
+ </sidebar>
253
+ <main-content>
254
+ <stats-cards count="4">Revenue, Users, Sales, Growth</stats-cards>
255
+ <chart type="line">Monthly revenue chart</chart>
256
+ </main-content>
257
+ </dashboard>
258
+ ```
259
+
260
+ **Every** nested element gets a complete implementation.
261
+
262
+ ### Iterative Development Workflow
263
+
264
+ ```xml
265
+ <!-- Step 1: Generate everything -->
266
+ <app gen="">
267
+ <header>...</header>
268
+ <sidebar>...</sidebar>
269
+ <main>...</main>
270
+ </app>
271
+
272
+ <!-- Step 2: Lock header, improve sidebar -->
273
+ <app retry="">
274
+ <header lock="">Perfect!</header>
275
+ <sidebar>Better navigation layout</sidebar>
276
+ <main lock="">Keep this</main>
277
+ </app>
278
+
279
+ <!-- Step 3: Lock everything, update theme -->
280
+ <app theme="dark" lock="" retry="">
281
+ <header unlock="">Update with dark theme</header>
282
+ </app>
283
+ ```
284
+
285
+ ### Structured AI Responses
286
+
287
+ Claude responds with semantic XML:
288
+
289
+ ```xml
290
+ <ai>
291
+ <changes>Created responsive dashboard with 4 stat cards</changes>
292
+ <details>
293
+ <layout>Flexbox layout with responsive breakpoints</layout>
294
+ <styling>Modern card design with shadows and hover effects</styling>
295
+ <theme>Dark mode support via CSS variables</theme>
296
+ </details>
297
+ <summary>Complete dashboard implementation...</summary>
298
+ </ai>
299
+ ```
300
+
301
+ ## 🎯 Use Cases
302
+
303
+ ### Rapid Prototyping
304
+ Describe UIs in natural language, get working prototypes instantly.
305
+
306
+ ### Design Iteration
307
+ Lock components that work, iterate on specific sections.
308
+
309
+ ### Learning & Exploration
310
+ See how AI implements your ideas, learn patterns and techniques.
311
+
312
+ ### Living Documentation
313
+ spec.html serves as both specification and documentation.
314
+
315
+ ## 🛠️ Commands
316
+
317
+ ```bash
318
+ # Watch mode with dev server (default)
319
+ claudiv
320
+
321
+ # Generate once (no watching)
322
+ claudiv gen
323
+
324
+ # Specify file explicitly
325
+ claudiv --file claudiv/app.cdml
326
+
327
+ # Use API mode
328
+ claudiv --mode api
329
+
330
+ # Show help
331
+ claudiv --help
332
+ ```
333
+
334
+ ## 📦 Generated Artifacts
335
+
336
+ When you run Claudiv, multiple files are generated from your `.cdml` source:
337
+
338
+ **Input:**
339
+ - `claudiv/app.cdml` - Your source specification (version controlled)
340
+
341
+ **Generated Artifacts:** (all gitignored)
342
+ - `app.html` - Final HTML/CSS implementation (browser-ready)
343
+ - `app.spec.cdml` - Structured specification for tracking
344
+ - `app.rules.cdml` - Extracted rules and conventions
345
+ - `app.models.cdml` - Data models and business entities
346
+ - `app.tests.cdml` - Test specifications
347
+ - `.claudiv/cache/` - Generation cache
348
+ - `.claudiv/logs/` - Execution logs
349
+
350
+ **IDE Support:**
351
+ - `claudiv.xsd` - XML Schema for autocomplete (auto-generated)
352
+ - `.vscode/settings.json` - IDE configuration
353
+
354
+ ## 🌟 Why Claudiv?
355
+
356
+ Traditional development:
357
+ 1. Design mockups
358
+ 2. Write HTML structure
359
+ 3. Write CSS styling
360
+ 4. Write JavaScript behavior
361
+ 5. Debug and refine
362
+ 6. Repeat for every component
363
+
364
+ **Claudiv development:**
365
+ 1. Describe what you want
366
+ 2. ✨ *Everything else happens automatically*
367
+
368
+ ## Architecture
369
+
370
+ @claudiv/cli is built on top of [@claudiv/core](https://npmjs.com/package/@claudiv/core):
371
+
372
+ - **@claudiv/core** - Pure generation engine (framework-agnostic)
373
+ - **@claudiv/cli** - File watching, Claude integration, dev server
374
+ - **Chokidar** - Cross-platform file watching
375
+ - **Anthropic SDK** - API mode integration
376
+
377
+ The CLI handles I/O while @claudiv/core handles generation logic. This separation enables reuse in build plugins, VS Code extensions, and other integrations.
378
+
379
+ ## Installation
380
+
381
+ ### Global Installation
382
+
383
+ ```bash
384
+ npm install -g @claudiv/cli
385
+ ```
386
+
387
+ ### Local Project Installation
388
+
389
+ ```bash
390
+ npm install --save-dev @claudiv/cli
391
+ ```
392
+
393
+ Add to `package.json` scripts:
394
+ ```json
395
+ {
396
+ "scripts": {
397
+ "dev": "claudiv",
398
+ "gen": "claudiv gen"
399
+ }
400
+ }
401
+ ```
402
+
403
+ ## 🤝 Contributing
404
+
405
+ Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
406
+
407
+ ## 📄 License
408
+
409
+ MIT © 2026 Amir Guterman
410
+
411
+ See [LICENSE](./LICENSE) for details.
412
+
413
+ ## 🔗 Links
414
+
415
+ - **Homepage:** [https://claudiv.org](https://claudiv.org)
416
+ - **GitHub:** [https://github.com/claudiv-ai/cli](https://github.com/claudiv-ai/cli)
417
+ - **npm:** [https://npmjs.com/package/@claudiv/cli](https://npmjs.com/package/@claudiv/cli)
418
+ - **Documentation:** [https://docs.claudiv.org](https://docs.claudiv.org)
419
+ - **Claude Code:** [https://claude.ai/code](https://claude.ai/code)
420
+
421
+ ## Related Packages
422
+
423
+ - [@claudiv/core](https://npmjs.com/package/@claudiv/core) - Core generation engine
424
+ - [@claudiv/vite-sdk](https://npmjs.com/package/@claudiv/vite-sdk) - Vite plugin with HMR
425
+
426
+ ---
427
+
428
+ **Built with ❤️ for developers who want to focus on what to build, not how to code it.**
429
+
430
+ *Claudiv - Where conversation meets creation.*