@claudiv/vite-sdk 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,437 @@
1
+ # @claudiv/vite-sdk
2
+
3
+ > Vite plugin for Claudiv integration - Add CDML generation with HMR to your Vite projects
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@claudiv/vite-sdk.svg)](https://www.npmjs.com/package/@claudiv/vite-sdk)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Overview
9
+
10
+ **@claudiv/vite-sdk** brings Claudiv's declarative generation capabilities to Vite projects with seamless Hot Module Replacement (HMR) integration.
11
+
12
+ **Features:**
13
+ - 🔥 **Hot Module Replacement** - Changes to .cdml files trigger instant reloads
14
+ - 📁 **Automatic File Watching** - Watches `claudiv/**/*.cdml` by default
15
+ - ⚡ **Vite-Optimized** - Leverages Vite's fast build pipeline
16
+ - 🔄 **Auto-Regeneration** - Code regenerates on .cdml file changes
17
+ - 🎯 **Type-Safe** - Full TypeScript support
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install --save-dev @claudiv/vite-sdk
23
+ ```
24
+
25
+ **Peer Dependencies:**
26
+ - `vite` ^6.0.0
27
+
28
+ ## Quick Start
29
+
30
+ ### 1. Add Plugin to Vite Config
31
+
32
+ ```typescript
33
+ // vite.config.ts
34
+ import { defineConfig } from 'vite';
35
+ import { claudiv } from '@claudiv/vite-sdk';
36
+
37
+ export default defineConfig({
38
+ plugins: [
39
+ claudiv({
40
+ specFile: 'claudiv/app.cdml',
41
+ outputDir: 'src/generated'
42
+ })
43
+ ]
44
+ });
45
+ ```
46
+
47
+ ### 2. Create CDML File
48
+
49
+ ```bash
50
+ mkdir claudiv
51
+ ```
52
+
53
+ ```xml
54
+ <!-- claudiv/app.cdml -->
55
+ <app target="html">
56
+ <dashboard gen>
57
+ Create an analytics dashboard with charts and stats
58
+ </dashboard>
59
+ </app>
60
+ ```
61
+
62
+ ### 3. Run Vite
63
+
64
+ ```bash
65
+ npm run dev
66
+ ```
67
+
68
+ Changes to `claudiv/app.cdml` will automatically regenerate code and trigger HMR!
69
+
70
+ ## Configuration
71
+
72
+ ### Plugin Options
73
+
74
+ ```typescript
75
+ interface ClaudivPluginOptions {
76
+ /**
77
+ * Path to main CDML spec file
78
+ * @default 'claudiv/app.cdml'
79
+ */
80
+ specFile?: string;
81
+
82
+ /**
83
+ * Directory for generated code output
84
+ * @default 'src/generated'
85
+ */
86
+ outputDir?: string;
87
+
88
+ /**
89
+ * Generation mode
90
+ * - 'cli': Use Claude Code CLI (requires subscription)
91
+ * - 'api': Use Anthropic API (pay-per-use)
92
+ * @default 'cli'
93
+ */
94
+ mode?: 'cli' | 'api';
95
+
96
+ /**
97
+ * Default target language
98
+ * @default 'html'
99
+ */
100
+ target?: 'html' | 'react' | 'vue' | 'python' | 'bash';
101
+
102
+ /**
103
+ * Enable/disable file watching
104
+ * @default true
105
+ */
106
+ watch?: boolean;
107
+ }
108
+ ```
109
+
110
+ ### Full Example
111
+
112
+ ```typescript
113
+ // vite.config.ts
114
+ import { defineConfig } from 'vite';
115
+ import { claudiv } from '@claudiv/vite-sdk';
116
+
117
+ export default defineConfig({
118
+ plugins: [
119
+ claudiv({
120
+ specFile: 'claudiv/app.cdml',
121
+ outputDir: 'src/generated',
122
+ mode: 'api', // Use Anthropic API
123
+ target: 'react', // Generate React components
124
+ watch: true // Enable HMR (default)
125
+ })
126
+ ]
127
+ });
128
+ ```
129
+
130
+ ## Project Structure
131
+
132
+ ### Recommended Folder Layout
133
+
134
+ ```
135
+ my-vite-app/
136
+ ├── claudiv/ # CDML source files (version controlled)
137
+ │ ├── app.cdml # Main spec
138
+ │ ├── components/ # Component specs
139
+ │ │ ├── header.cdml
140
+ │ │ └── footer.cdml
141
+ │ └── pages/ # Page specs
142
+ │ ├── home.cdml
143
+ │ └── about.cdml
144
+
145
+ ├── src/
146
+ │ ├── generated/ # Generated code (gitignored)
147
+ │ │ ├── app.html
148
+ │ │ └── components/
149
+ │ └── main.ts # Your entry point
150
+
151
+ ├── .gitignore # Ignore src/generated/
152
+ ├── claudiv.json # Claudiv config (optional)
153
+ ├── package.json
154
+ └── vite.config.ts
155
+ ```
156
+
157
+ ### .gitignore
158
+
159
+ ```gitignore
160
+ # Claudiv generated files
161
+ src/generated/
162
+
163
+ # Claudiv metadata
164
+ .claudiv/
165
+ ```
166
+
167
+ ## Usage Patterns
168
+
169
+ ### Basic HTML Generation
170
+
171
+ ```typescript
172
+ // vite.config.ts
173
+ export default defineConfig({
174
+ plugins: [
175
+ claudiv({
176
+ specFile: 'claudiv/app.cdml',
177
+ target: 'html'
178
+ })
179
+ ]
180
+ });
181
+ ```
182
+
183
+ ```xml
184
+ <!-- claudiv/app.cdml -->
185
+ <app target="html">
186
+ <landing-page gen>
187
+ Hero section with gradient background,
188
+ feature cards, and call-to-action buttons
189
+ </landing-page>
190
+ </app>
191
+ ```
192
+
193
+ Generated: `src/generated/app.html`
194
+
195
+ ### React Components
196
+
197
+ ```typescript
198
+ // vite.config.ts
199
+ import react from '@vitejs/plugin-react';
200
+ import { claudiv } from '@claudiv/vite-sdk';
201
+
202
+ export default defineConfig({
203
+ plugins: [
204
+ react(),
205
+ claudiv({
206
+ specFile: 'claudiv/app.cdml',
207
+ target: 'react',
208
+ outputDir: 'src/components'
209
+ })
210
+ ]
211
+ });
212
+ ```
213
+
214
+ ```xml
215
+ <!-- claudiv/app.cdml -->
216
+ <app target="react">
217
+ <Dashboard gen>
218
+ Analytics dashboard with charts using recharts
219
+ </Dashboard>
220
+ </app>
221
+ ```
222
+
223
+ Generated: `src/components/Dashboard.tsx`
224
+
225
+ ### Multi-File Setup
226
+
227
+ ```typescript
228
+ // vite.config.ts
229
+ export default defineConfig({
230
+ plugins: [
231
+ claudiv({
232
+ specFile: 'claudiv/**/*.cdml', // Watch all .cdml files
233
+ outputDir: 'src/generated'
234
+ })
235
+ ]
236
+ });
237
+ ```
238
+
239
+ ## API Mode Setup
240
+
241
+ ### Using Anthropic API
242
+
243
+ 1. Install @anthropic-ai/sdk:
244
+ ```bash
245
+ npm install @anthropic-ai/sdk
246
+ ```
247
+
248
+ 2. Create `.env` file:
249
+ ```env
250
+ ANTHROPIC_API_KEY=sk-ant-api03-...
251
+ ```
252
+
253
+ 3. Configure plugin:
254
+ ```typescript
255
+ export default defineConfig({
256
+ plugins: [
257
+ claudiv({
258
+ mode: 'api',
259
+ specFile: 'claudiv/app.cdml'
260
+ })
261
+ ]
262
+ });
263
+ ```
264
+
265
+ ## CLI Mode Setup
266
+
267
+ ### Using Claude Code Subscription
268
+
269
+ 1. Install Claude Code:
270
+ ```bash
271
+ # Follow installation at https://claude.ai/code
272
+ ```
273
+
274
+ 2. Configure plugin:
275
+ ```typescript
276
+ export default defineConfig({
277
+ plugins: [
278
+ claudiv({
279
+ mode: 'cli', // Default mode
280
+ specFile: 'claudiv/app.cdml'
281
+ })
282
+ ]
283
+ });
284
+ ```
285
+
286
+ ## Hot Module Replacement (HMR)
287
+
288
+ The plugin automatically enables HMR for .cdml files:
289
+
290
+ 1. Edit your CDML file:
291
+ ```xml
292
+ <!-- claudiv/app.cdml -->
293
+ <button gen>Make it blue</button>
294
+ ```
295
+
296
+ 2. Save the file
297
+ 3. Browser automatically reloads with updated code
298
+ 4. No manual refresh needed!
299
+
300
+ ### HMR Behavior
301
+
302
+ - **Full Reload:** Changes to .cdml files trigger full page reload
303
+ - **Instant:** Vite's dev server provides sub-second feedback
304
+ - **Automatic:** No configuration needed - works out of the box
305
+
306
+ ## Build-Time Generation
307
+
308
+ During production builds, Claudiv generates code before bundling:
309
+
310
+ ```bash
311
+ npm run build
312
+ ```
313
+
314
+ **Build Process:**
315
+ 1. Parse all .cdml files
316
+ 2. Generate code to `outputDir`
317
+ 3. Vite bundles generated code
318
+ 4. Outputs production-ready assets
319
+
320
+ ## Advanced Usage
321
+
322
+ ### Custom Watcher
323
+
324
+ ```typescript
325
+ import { ClaudivViteWatcher } from '@claudiv/vite-sdk';
326
+
327
+ const watcher = new ClaudivViteWatcher({
328
+ specFile: 'custom-path/**/*.cdml'
329
+ });
330
+
331
+ watcher.on('change', (file) => {
332
+ console.log('CDML file changed:', file);
333
+ });
334
+
335
+ watcher.start();
336
+ ```
337
+
338
+ ### Programmatic Generation
339
+
340
+ ```typescript
341
+ import { claudiv } from '@claudiv/vite-sdk';
342
+ import { generateCode } from '@claudiv/core';
343
+
344
+ // Use core package for custom logic
345
+ const generated = await generateCode(response, pattern, context);
346
+ ```
347
+
348
+ ## Troubleshooting
349
+
350
+ ### Plugin Not Watching Files
351
+
352
+ **Issue:** Changes to .cdml files don't trigger reloads
353
+
354
+ **Solution:**
355
+ ```typescript
356
+ // Ensure watch is enabled (default)
357
+ claudiv({
358
+ watch: true,
359
+ specFile: 'claudiv/**/*.cdml' // Correct glob pattern
360
+ })
361
+ ```
362
+
363
+ ### Generated Files Not Found
364
+
365
+ **Issue:** Import errors for generated files
366
+
367
+ **Solution:**
368
+ 1. Check `outputDir` matches import paths
369
+ 2. Verify .cdml files have `gen` attributes
370
+ 3. Check Vite dev server logs for generation errors
371
+
372
+ ### API Key Not Found
373
+
374
+ **Issue:** `ANTHROPIC_API_KEY` not detected
375
+
376
+ **Solution:**
377
+ ```bash
378
+ # Create .env file in project root
379
+ echo "ANTHROPIC_API_KEY=sk-ant-..." > .env
380
+ ```
381
+
382
+ ## Status
383
+
384
+ ⚠️ **Alpha Release** - Core functionality implemented, active development ongoing
385
+
386
+ **Current Features:**
387
+ - ✅ File watching with HMR
388
+ - ✅ Basic code generation
389
+ - ✅ Vite dev server integration
390
+
391
+ **Planned Features:**
392
+ - 🚧 Build-time generation optimization
393
+ - 🚧 Source maps for debugging
394
+ - 🚧 Multi-target support in single project
395
+ - 🚧 Plugin hooks for customization
396
+
397
+ ## Development
398
+
399
+ ```bash
400
+ # Install dependencies
401
+ npm install
402
+
403
+ # Build
404
+ npm run build
405
+
406
+ # Watch mode
407
+ npm run dev
408
+
409
+ # Clean dist
410
+ npm run clean
411
+ ```
412
+
413
+ ## Contributing
414
+
415
+ Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
416
+
417
+ ## License
418
+
419
+ MIT © 2026 Amir Guterman
420
+
421
+ See [LICENSE](./LICENSE) for details.
422
+
423
+ ## Links
424
+
425
+ - **Homepage:** [https://claudiv.org](https://claudiv.org)
426
+ - **GitHub:** [https://github.com/claudiv-ai/vite-sdk](https://github.com/claudiv-ai/vite-sdk)
427
+ - **npm:** [https://npmjs.com/package/@claudiv/vite-sdk](https://npmjs.com/package/@claudiv/vite-sdk)
428
+ - **Documentation:** [https://docs.claudiv.org/vite-sdk](https://docs.claudiv.org/vite-sdk)
429
+
430
+ ## Related Packages
431
+
432
+ - [@claudiv/core](https://npmjs.com/package/@claudiv/core) - Core generation engine
433
+ - [@claudiv/cli](https://npmjs.com/package/@claudiv/cli) - CLI tool for CDML generation
434
+
435
+ ---
436
+
437
+ **Add declarative AI-powered generation to your Vite projects!**
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @claudiv/vite-sdk - Vite plugin for Claudiv integration
3
+ *
4
+ * Enables Claudiv generation in Vite projects with HMR support.
5
+ */
6
+ export { claudiv, claudivPlugin } from './plugin.js';
7
+ export type { ClaudivPluginOptions } from './types.js';
8
+ export { ClaudivViteWatcher } from './watcher.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @claudiv/vite-sdk - Vite plugin for Claudiv integration
3
+ *
4
+ * Enables Claudiv generation in Vite projects with HMR support.
5
+ */
6
+ // Main plugin export
7
+ export { claudiv, claudivPlugin } from './plugin.js';
8
+ // Utilities (for advanced usage)
9
+ export { ClaudivViteWatcher } from './watcher.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKrD,iCAAiC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Vite plugin for Claudiv integration
3
+ */
4
+ import type { Plugin } from 'vite';
5
+ import type { ClaudivPluginOptions } from './types.js';
6
+ /**
7
+ * Claudiv Vite plugin
8
+ *
9
+ * Integrates Claudiv generation with Vite's dev server and build process.
10
+ * Watches .cdml files and regenerates code with HMR support.
11
+ */
12
+ export declare function claudiv(options?: ClaudivPluginOptions): Plugin;
13
+ export declare const claudivPlugin: typeof claudiv;
14
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAyClE;AAGD,eAAO,MAAM,aAAa,gBAAU,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Vite plugin for Claudiv integration
3
+ */
4
+ import { ClaudivViteWatcher } from './watcher.js';
5
+ /**
6
+ * Claudiv Vite plugin
7
+ *
8
+ * Integrates Claudiv generation with Vite's dev server and build process.
9
+ * Watches .cdml files and regenerates code with HMR support.
10
+ */
11
+ export function claudiv(options = {}) {
12
+ let watcher;
13
+ const config = {
14
+ specFile: options.specFile || 'claudiv/app.cdml',
15
+ outputDir: options.outputDir || 'src/generated',
16
+ mode: options.mode || 'cli',
17
+ target: options.target || 'html',
18
+ watch: options.watch !== false, // Default to true
19
+ };
20
+ return {
21
+ name: 'claudiv',
22
+ async configureServer(server) {
23
+ if (!config.watch)
24
+ return;
25
+ // Initialize watcher for .cdml files
26
+ watcher = new ClaudivViteWatcher(config);
27
+ watcher.start();
28
+ // Handle .cdml file changes
29
+ watcher.on('change', async (cdmlFile) => {
30
+ server.ws.send({
31
+ type: 'full-reload',
32
+ path: '*',
33
+ });
34
+ });
35
+ },
36
+ async buildStart() {
37
+ // Generate all code before build
38
+ // TODO: Implement build-time generation
39
+ },
40
+ async closeBundle() {
41
+ if (watcher) {
42
+ watcher.stop();
43
+ }
44
+ },
45
+ };
46
+ }
47
+ // Export alias for convenience
48
+ export const claudivPlugin = claudiv;
49
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,UAAgC,EAAE;IACxD,IAAI,OAA2B,CAAC;IAEhC,MAAM,MAAM,GAAG;QACb,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,kBAAkB;QAChD,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,eAAe;QAC/C,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;QAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,MAAM;QAChC,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,kBAAkB;KACnD,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,SAAS;QAEf,KAAK,CAAC,eAAe,CAAC,MAAM;YAC1B,IAAI,CAAC,MAAM,CAAC,KAAK;gBAAE,OAAO;YAE1B,qCAAqC;YACrC,OAAO,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;YACzC,OAAO,CAAC,KAAK,EAAE,CAAC;YAEhB,4BAA4B;YAC5B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACtC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,GAAG;iBACV,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,UAAU;YACd,iCAAiC;YACjC,wCAAwC;QAC1C,CAAC;QAED,KAAK,CAAC,WAAW;YACf,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+BAA+B;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Vite SDK type definitions
3
+ */
4
+ export interface ClaudivPluginOptions {
5
+ /**
6
+ * Path to the main .cdml spec file
7
+ * @default 'claudiv/app.cdml'
8
+ */
9
+ specFile?: string;
10
+ /**
11
+ * Output directory for generated files
12
+ * @default 'src/generated'
13
+ */
14
+ outputDir?: string;
15
+ /**
16
+ * Mode for Claude integration
17
+ * - 'cli': Use Claude Code CLI
18
+ * - 'api': Use Anthropic API directly
19
+ * @default 'cli'
20
+ */
21
+ mode?: 'cli' | 'api';
22
+ /**
23
+ * Default target language/framework
24
+ * @default 'html'
25
+ */
26
+ target?: string;
27
+ /**
28
+ * Enable file watching for hot reload
29
+ * @default true
30
+ */
31
+ watch?: boolean;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Vite SDK type definitions
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CDML file watcher for Vite integration
3
+ */
4
+ import { EventEmitter } from 'events';
5
+ import type { ClaudivPluginOptions } from './types.js';
6
+ export declare class ClaudivViteWatcher extends EventEmitter {
7
+ private watcher;
8
+ private options;
9
+ constructor(options: ClaudivPluginOptions);
10
+ start(): void;
11
+ stop(): void;
12
+ }
13
+ //# sourceMappingURL=watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,OAAO,CAAuB;gBAE1B,OAAO,EAAE,oBAAoB;IAKzC,KAAK;IAqBL,IAAI;CAML"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * CDML file watcher for Vite integration
3
+ */
4
+ import { EventEmitter } from 'events';
5
+ import chokidar from 'chokidar';
6
+ export class ClaudivViteWatcher extends EventEmitter {
7
+ watcher = null;
8
+ options;
9
+ constructor(options) {
10
+ super();
11
+ this.options = options;
12
+ }
13
+ start() {
14
+ const watchPattern = this.options.specFile || 'claudiv/**/*.cdml';
15
+ this.watcher = chokidar.watch(watchPattern, {
16
+ persistent: true,
17
+ ignoreInitial: true,
18
+ awaitWriteFinish: {
19
+ stabilityThreshold: 100,
20
+ pollInterval: 50,
21
+ },
22
+ });
23
+ this.watcher.on('change', (path) => {
24
+ this.emit('change', path);
25
+ });
26
+ this.watcher.on('add', (path) => {
27
+ this.emit('add', path);
28
+ });
29
+ }
30
+ stop() {
31
+ if (this.watcher) {
32
+ this.watcher.close();
33
+ this.watcher = null;
34
+ }
35
+ }
36
+ }
37
+ //# sourceMappingURL=watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,QAA4B,MAAM,UAAU,CAAC;AAGpD,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAC1C,OAAO,GAAqB,IAAI,CAAC;IACjC,OAAO,CAAuB;IAEtC,YAAY,OAA6B;QACvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK;QACH,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,mBAAmB,CAAC;QAElE,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE;YAC1C,UAAU,EAAE,IAAI;YAChB,aAAa,EAAE,IAAI;YACnB,gBAAgB,EAAE;gBAChB,kBAAkB,EAAE,GAAG;gBACvB,YAAY,EAAE,EAAE;aACjB;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;YACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@claudiv/vite-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Vite plugin for Claudiv integration - CDML generation with HMR",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist/**/*",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc --watch",
21
+ "clean": "rm -rf dist"
22
+ },
23
+ "peerDependencies": {
24
+ "vite": "^6.0.0"
25
+ },
26
+ "dependencies": {
27
+ "@claudiv/core": "^0.1.0",
28
+ "chokidar": "^5.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "vite": "^6.0.0",
32
+ "typescript": "^5.0.0",
33
+ "@types/node": "^20.0.0"
34
+ },
35
+ "keywords": [
36
+ "claudiv",
37
+ "vite",
38
+ "plugin",
39
+ "cdml",
40
+ "code-generation",
41
+ "hmr"
42
+ ],
43
+ "author": "Amir Guterman",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/claudiv-ai/vite-sdk.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/claudiv-ai/vite-sdk/issues"
51
+ },
52
+ "homepage": "https://claudiv.org",
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "engines": {
57
+ "node": ">=20.0.0"
58
+ }
59
+ }