humanbehavior-js 0.4.16 → 0.4.17

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 (89) hide show
  1. package/dist/cjs/wizard/index.cjs +6 -8
  2. package/dist/cjs/wizard/index.cjs.map +1 -1
  3. package/dist/cli/ai-auto-install.js +6 -8
  4. package/dist/cli/ai-auto-install.js.map +1 -1
  5. package/dist/esm/wizard/index.js +6 -8
  6. package/dist/esm/wizard/index.js.map +1 -1
  7. package/package/WIZARD_USAGE_GUIDE.md +381 -0
  8. package/package/canvas-recording-demo.html +143 -0
  9. package/package/clean-console-demo.html +39 -0
  10. package/package/dist/cjs/angular/index.cjs +14354 -0
  11. package/package/dist/cjs/angular/index.cjs.map +1 -0
  12. package/package/dist/cjs/index.cjs +14323 -0
  13. package/package/dist/cjs/index.cjs.map +1 -0
  14. package/package/dist/cjs/install-wizard.cjs +1530 -0
  15. package/package/dist/cjs/install-wizard.cjs.map +1 -0
  16. package/package/dist/cjs/react/index.cjs +14478 -0
  17. package/package/dist/cjs/react/index.cjs.map +1 -0
  18. package/package/dist/cjs/remix/index.cjs +14452 -0
  19. package/package/dist/cjs/remix/index.cjs.map +1 -0
  20. package/package/dist/cjs/svelte/index.cjs +14308 -0
  21. package/package/dist/cjs/svelte/index.cjs.map +1 -0
  22. package/package/dist/cjs/vue/index.cjs +14317 -0
  23. package/package/dist/cjs/vue/index.cjs.map +1 -0
  24. package/package/dist/cjs/wizard/index.cjs +3446 -0
  25. package/package/dist/cjs/wizard/index.cjs.map +1 -0
  26. package/package/dist/cli/ai-auto-install.cjs +57161 -0
  27. package/package/dist/cli/ai-auto-install.cjs.map +1 -0
  28. package/package/dist/cli/ai-auto-install.js +1969 -0
  29. package/package/dist/cli/ai-auto-install.js.map +1 -0
  30. package/package/dist/cli/auto-install.cjs +56352 -0
  31. package/package/dist/cli/auto-install.cjs.map +1 -0
  32. package/package/dist/cli/auto-install.js +1957 -0
  33. package/package/dist/cli/auto-install.js.map +1 -0
  34. package/package/dist/esm/angular/index.js +14350 -0
  35. package/package/dist/esm/angular/index.js.map +1 -0
  36. package/package/dist/esm/index.js +14309 -0
  37. package/package/dist/esm/index.js.map +1 -0
  38. package/package/dist/esm/install-wizard.js +1507 -0
  39. package/package/dist/esm/install-wizard.js.map +1 -0
  40. package/package/dist/esm/react/index.js +14472 -0
  41. package/package/dist/esm/react/index.js.map +1 -0
  42. package/package/dist/esm/remix/index.js +14448 -0
  43. package/package/dist/esm/remix/index.js.map +1 -0
  44. package/package/dist/esm/svelte/index.js +14306 -0
  45. package/package/dist/esm/svelte/index.js.map +1 -0
  46. package/package/dist/esm/vue/index.js +14315 -0
  47. package/package/dist/esm/vue/index.js.map +1 -0
  48. package/package/dist/esm/wizard/index.js +3415 -0
  49. package/package/dist/esm/wizard/index.js.map +1 -0
  50. package/package/dist/index.min.js +2 -0
  51. package/package/dist/index.min.js.map +1 -0
  52. package/package/dist/types/angular/index.d.ts +267 -0
  53. package/package/dist/types/index.d.ts +373 -0
  54. package/package/dist/types/install-wizard.d.ts +156 -0
  55. package/package/dist/types/react/index.d.ts +255 -0
  56. package/package/dist/types/remix/index.d.ts +246 -0
  57. package/package/dist/types/svelte/index.d.ts +232 -0
  58. package/package/dist/types/vue/index.d.ts +15 -0
  59. package/package/dist/types/wizard/index.d.ts +523 -0
  60. package/package/package.json +105 -0
  61. package/package/readme.md +281 -0
  62. package/package/rollup.config.js +422 -0
  63. package/package/simple-demo.html +26 -0
  64. package/package/simple-spa.html +838 -0
  65. package/package/src/angular/index.ts +79 -0
  66. package/package/src/api.ts +376 -0
  67. package/package/src/index.ts +28 -0
  68. package/package/src/react/AutoInstallWizard.tsx +557 -0
  69. package/package/src/react/browser.ts +8 -0
  70. package/package/src/react/index.tsx +308 -0
  71. package/package/src/redact.ts +521 -0
  72. package/package/src/remix/index.ts +16 -0
  73. package/package/src/svelte/index.ts +14 -0
  74. package/package/src/tracker.ts +1319 -0
  75. package/package/src/types/clack.d.ts +31 -0
  76. package/package/src/utils/logger.ts +144 -0
  77. package/package/src/vue/index.ts +29 -0
  78. package/package/src/wizard/README.md +114 -0
  79. package/package/src/wizard/ai/ai-install-wizard.ts +897 -0
  80. package/package/src/wizard/ai/manual-framework-wizard.ts +238 -0
  81. package/package/src/wizard/cli/ai-auto-install.ts +243 -0
  82. package/package/src/wizard/cli/auto-install.ts +224 -0
  83. package/package/src/wizard/core/install-wizard.ts +1744 -0
  84. package/package/src/wizard/index.ts +23 -0
  85. package/package/src/wizard/services/centralized-ai-service.ts +668 -0
  86. package/package/src/wizard/services/remote-ai-service.ts +240 -0
  87. package/package/tsconfig.json +24 -0
  88. package/package.json +1 -1
  89. package/src/wizard/cli/ai-auto-install.ts +4 -6
@@ -0,0 +1,281 @@
1
+ # HumanBehavior SDK
2
+
3
+ A simplified session recording and analytics SDK that maintains session continuity across page navigations.
4
+
5
+ 📖 **[Full Documentation](https://documentation.humanbehavior.co)** - Complete API reference, examples, and integration guides
6
+
7
+ ## Quick Start
8
+
9
+ ### Auto-Installation (Recommended)
10
+
11
+ The easiest way to get started is using our auto-installation wizard:
12
+
13
+ ```bash
14
+ # One command installation
15
+ npx humanbehavior-js auto-install YOUR_API_KEY
16
+ ```
17
+
18
+ This will automatically:
19
+ - 🔍 Detect your project's framework
20
+ - 📦 Install the humanbehavior-js package
21
+ - ✏️ Modify your codebase to integrate the SDK
22
+ - 🔧 Create environment files with your API key
23
+ - 🚀 Make your app ready to track user behavior
24
+
25
+ ### Single Page Application (Manual Setup)
26
+
27
+ For the best session continuity experience, use the SPA approach:
28
+
29
+ ```html
30
+ <!DOCTYPE html>
31
+ <html>
32
+ <head>
33
+ <script src="dist/index.min.js"></script>
34
+ </head>
35
+ <body>
36
+ <script>
37
+ // Initialize once - session persists across all navigation
38
+ const tracker = HumanBehaviorTracker.init('your-api-key', {
39
+ logLevel: 'warn', // Reduce console noise
40
+ redactFields: ['password', 'credit_card'],
41
+ suppressConsoleErrors: true, // Suppress common rrweb errors (default)
42
+ recordCanvas: false // Enable canvas recording with protection (default: false)
43
+ });
44
+
45
+ // Your SPA navigation logic here
46
+ function navigateToPage(page) {
47
+ // Update content without page reload
48
+ loadPageContent(page);
49
+
50
+ // Track navigation
51
+ tracker.trackNavigationEvent('spa_navigation', currentPage, page);
52
+ }
53
+ </script>
54
+ </body>
55
+ </html>
56
+ ```
57
+
58
+ ### Traditional Multi-Page Setup
59
+
60
+ For traditional HTML pages, the tracker will automatically restore sessions:
61
+
62
+ ```html
63
+ <!-- index.html -->
64
+ <script src="dist/index.min.js"></script>
65
+ <script>
66
+ const tracker = HumanBehaviorTracker.init('your-api-key');
67
+ </script>
68
+
69
+ <!-- about.html -->
70
+ <script src="dist/index.min.js"></script>
71
+ <script>
72
+ const tracker = HumanBehaviorTracker.init('your-api-key'); // Reuses existing session
73
+ </script>
74
+ ```
75
+
76
+ ## API Reference
77
+
78
+ ### Initialization
79
+
80
+ ```javascript
81
+ // Main initialization method
82
+ const tracker = HumanBehaviorTracker.init(apiKey, options);
83
+ ```
84
+
85
+ **Options:**
86
+ - `ingestionUrl`: Custom ingestion server URL
87
+ - `logLevel`: 'none' | 'error' | 'warn' | 'info' | 'debug'
88
+ - `redactFields`: Array of CSS selectors to redact
89
+ - `suppressConsoleErrors`: Boolean to suppress common rrweb errors (default: true)
90
+ - `recordCanvas`: Boolean to enable canvas recording with PostHog-style protection (default: false)
91
+
92
+ ### Session Management
93
+
94
+ ```javascript
95
+ // Get current session ID
96
+ const sessionId = tracker.getSessionId();
97
+
98
+ // Get current URL
99
+ const currentUrl = tracker.getCurrentUrl();
100
+
101
+ // Test connection to ingestion server
102
+ const result = await tracker.testConnection();
103
+ ```
104
+
105
+ ### Event Tracking
106
+
107
+ ```javascript
108
+ // Track custom events
109
+ await tracker.customEvent('button_click', { button: 'submit' });
110
+
111
+ // Track page views
112
+ await tracker.trackPageView();
113
+
114
+ // Track navigation (for SPAs)
115
+ await tracker.trackNavigationEvent('pushState', '/home', '/about');
116
+ ```
117
+
118
+ ### Data Redaction
119
+
120
+ ```javascript
121
+ // Redact sensitive fields
122
+ tracker.setRedactedFields(['input[type="password"]', '#email']);
123
+
124
+ // Check if redaction is active
125
+ const isActive = tracker.isRedactedFields();
126
+ ```
127
+
128
+ ### Debugging
129
+
130
+ ```javascript
131
+ // View logs
132
+ tracker.viewLogs();
133
+
134
+ // Get connection status
135
+ const status = tracker.getConnectionStatus();
136
+ ```
137
+
138
+ ### Error Suppression
139
+
140
+ The SDK automatically suppresses common rrweb errors for a clean console:
141
+
142
+ ```javascript
143
+ // Enable error suppression (default)
144
+ const tracker = HumanBehaviorTracker.init('your-api-key', {
145
+ suppressConsoleErrors: true // Suppresses canvas security errors, CORS issues, etc.
146
+ });
147
+
148
+ // Disable error suppression for debugging
149
+ const tracker = HumanBehaviorTracker.init('your-api-key', {
150
+ suppressConsoleErrors: false // Show all errors for debugging
151
+ });
152
+ ```
153
+
154
+ **Suppressed Errors:**
155
+ - Canvas security errors (`SecurityError: Failed to execute 'toDataURL'`)
156
+ - Cross-origin resource errors
157
+ - CORS policy violations
158
+ - Ad blocker interference warnings
159
+
160
+ ### Canvas Recording
161
+
162
+ The SDK supports canvas recording with PostHog-style protection against overwhelming events:
163
+
164
+ ```javascript
165
+ // Enable canvas recording with protection
166
+ const tracker = HumanBehaviorTracker.init('your-api-key', {
167
+ recordCanvas: true // Enables canvas recording with 4 FPS throttle and 40% quality
168
+ });
169
+ ```
170
+
171
+ **Protection Features:**
172
+ - **4 FPS Throttling**: Prevents canvas overwhelm (vs 60 FPS default)
173
+ - **40% Quality**: WebP format with compression
174
+ - **Opt-in Only**: Disabled by default for safety
175
+ - **Smart Sampling**: Only captures when canvas changes
176
+
177
+ ## Session Continuity
178
+
179
+ The SDK automatically handles session continuity:
180
+
181
+ 1. **Session Restoration**: Automatically restores sessions within 15 minutes
182
+ 2. **Activity Tracking**: Updates activity timestamp on user interactions
183
+ 3. **Cross-Page Persistence**: Session persists across page navigations
184
+
185
+ ## Demo
186
+
187
+ Check out `simple-spa.html` for a complete single-page application demo that shows:
188
+
189
+ - True session continuity across navigation
190
+ - Interactive event tracking
191
+ - Real-time status updates
192
+ - Modern UI with smooth transitions
193
+
194
+ ## Troubleshooting
195
+
196
+ ### Ad Blocker Issues
197
+
198
+ If you see `net::ERR_BLOCKED_BY_CLIENT` errors:
199
+
200
+ 1. Check if ad blockers are active
201
+ 2. Use `tracker.getConnectionStatus()` to diagnose
202
+ 3. Consider whitelisting your domain
203
+
204
+ ### Session Issues
205
+
206
+ - Sessions automatically expire after 15 minutes of inactivity
207
+ - Each page load calls `/init` but reuses existing sessions when possible
208
+ - Check browser console for session restoration logs
209
+
210
+ ## Development
211
+
212
+ ```bash
213
+ # Build the SDK
214
+ npm run build
215
+
216
+ # Watch for changes
217
+ npm run dev
218
+
219
+ # Run tests
220
+ npm test
221
+
222
+ # Run auto-installation
223
+ npm run auto-install
224
+ ```
225
+
226
+ ## Auto-Installation Wizard
227
+
228
+ The SDK includes an auto-installation wizard that can detect your project's framework and automatically modify your codebase to integrate the SDK.
229
+
230
+ ### CLI Usage
231
+
232
+ ```bash
233
+ # Basic usage
234
+ npx humanbehavior-js auto-install YOUR_API_KEY
235
+
236
+ # With options
237
+ npx humanbehavior-js auto-install YOUR_API_KEY --yes --project /path/to/project
238
+
239
+ # Help
240
+ npx humanbehavior-js auto-install --help
241
+ ```
242
+
243
+ ### React Component Usage
244
+
245
+ ```jsx
246
+ import { AutoInstallWizard } from 'humanbehavior-js/react';
247
+
248
+ function Dashboard() {
249
+ return (
250
+ <AutoInstallWizard
251
+ apiKey="your-api-key"
252
+ onComplete={(result) => console.log('Installation completed!', result)}
253
+ onError={(error) => console.error('Installation failed:', error)}
254
+ />
255
+ );
256
+ }
257
+ ```
258
+
259
+ ### Supported Frameworks
260
+
261
+ - ✅ React (CRA, Vite, Webpack)
262
+ - ✅ Next.js (App Router, Pages Router)
263
+ - ✅ Vue (Vue CLI, Vite)
264
+ - ✅ Angular
265
+ - ✅ Svelte (SvelteKit, Vite)
266
+ - ✅ Vanilla JS/TS
267
+ - ✅ Node.js (CommonJS & ESM)
268
+
269
+ The wizard will automatically:
270
+ 1. Detect your project's framework and setup
271
+ 2. Install the humanbehavior-js package
272
+ 3. Modify your main app files to integrate the SDK
273
+ 4. Create environment files with your API key
274
+ 5. Make your app ready to track user behavior
275
+
276
+ ## Architecture
277
+
278
+ - **Frontend**: TypeScript SDK with session restoration
279
+ - **Backend**: Node.js ingestion server with Redis storage
280
+ - **Archiver**: Processes completed sessions to S3 and Prisma
281
+ - **Session Continuity**: localStorage + cookie-based session management
@@ -0,0 +1,422 @@
1
+ import typescript from '@rollup/plugin-typescript';
2
+ import resolve from '@rollup/plugin-node-resolve';
3
+ import commonjs from '@rollup/plugin-commonjs';
4
+ import terser from '@rollup/plugin-terser';
5
+ import dts from 'rollup-plugin-dts';
6
+ import json from '@rollup/plugin-json';
7
+
8
+ // External dependencies that shouldn't be bundled
9
+ const external = ['react', 'react-dom', 'react/jsx-runtime'];
10
+ const nodeExternal = ['fs', 'path', 'child_process', 'readline', '@clack/prompts'];
11
+
12
+ // Global variables for UMD build
13
+ const globals = {
14
+ react: 'React',
15
+ 'react-dom': 'ReactDOM',
16
+ fs: 'fs',
17
+ path: 'path'
18
+ };
19
+
20
+ export default [
21
+ // Main SDK bundle
22
+ {
23
+ input: 'src/index.ts',
24
+ output: [
25
+ {
26
+ file: 'dist/cjs/index.cjs',
27
+ format: 'cjs',
28
+ name: 'HumanBehaviorTracker',
29
+ globals,
30
+ exports: 'named',
31
+ sourcemap: true
32
+ },
33
+ {
34
+ file: 'dist/esm/index.js',
35
+ format: 'es',
36
+ sourcemap: true
37
+ },
38
+ {
39
+ file: 'dist/index.min.js',
40
+ format: 'umd',
41
+ name: 'HumanBehaviorTracker',
42
+ globals,
43
+ exports: 'auto',
44
+ sourcemap: true,
45
+ plugins: [terser()]
46
+ }
47
+ ],
48
+ plugins: [
49
+ resolve({
50
+ preferBuiltins: false
51
+ }),
52
+ commonjs(),
53
+ typescript({
54
+ tsconfig: './tsconfig.json',
55
+ declaration: false,
56
+ declarationMap: false
57
+ })
58
+ ],
59
+ external: [...external, ...nodeExternal]
60
+ },
61
+
62
+ // React component bundle
63
+ {
64
+ input: './src/react/index.tsx',
65
+ output: [
66
+ {
67
+ file: 'dist/cjs/react/index.cjs',
68
+ format: 'cjs',
69
+ name: 'HumanBehaviorReact',
70
+ globals: {
71
+ ...globals,
72
+ '../index': 'HumanBehaviorTracker'
73
+ },
74
+ exports: 'named',
75
+ sourcemap: true
76
+ },
77
+ {
78
+ file: 'dist/esm/react/index.js',
79
+ format: 'es',
80
+ sourcemap: true
81
+ }
82
+ ],
83
+ plugins: [
84
+ resolve({
85
+ preferBuiltins: false
86
+ }),
87
+ commonjs(),
88
+ typescript({
89
+ tsconfig: './tsconfig.json',
90
+ declaration: false,
91
+ declarationMap: false
92
+ })
93
+ ],
94
+ external: [...external] // Only externalize React, bundle the main SDK
95
+ },
96
+
97
+ // Svelte bundle
98
+ {
99
+ input: './src/svelte/index.ts',
100
+ output: [
101
+ {
102
+ file: 'dist/cjs/svelte/index.cjs',
103
+ format: 'cjs',
104
+ name: 'HumanBehaviorSvelte',
105
+ globals: {
106
+ ...globals,
107
+ '../index': 'HumanBehaviorTracker'
108
+ },
109
+ exports: 'named',
110
+ sourcemap: true
111
+ },
112
+ {
113
+ file: 'dist/esm/svelte/index.js',
114
+ format: 'es',
115
+ sourcemap: true
116
+ }
117
+ ],
118
+ plugins: [
119
+ resolve({
120
+ preferBuiltins: false
121
+ }),
122
+ commonjs(),
123
+ typescript({
124
+ tsconfig: './tsconfig.json',
125
+ declaration: false,
126
+ declarationMap: false
127
+ })
128
+ ],
129
+ external: [...external, '../index', ...nodeExternal] // Externalize the main SDK
130
+ },
131
+
132
+ // Vue bundle
133
+ {
134
+ input: './src/vue/index.ts',
135
+ output: [
136
+ {
137
+ file: 'dist/cjs/vue/index.cjs',
138
+ format: 'cjs',
139
+ name: 'HumanBehaviorVue',
140
+ globals: {
141
+ ...globals,
142
+ '../index': 'HumanBehaviorTracker',
143
+ 'vue': 'Vue'
144
+ },
145
+ exports: 'named',
146
+ sourcemap: true
147
+ },
148
+ {
149
+ file: 'dist/esm/vue/index.js',
150
+ format: 'es',
151
+ sourcemap: true
152
+ }
153
+ ],
154
+ plugins: [
155
+ resolve({
156
+ preferBuiltins: false
157
+ }),
158
+ commonjs(),
159
+ typescript({
160
+ tsconfig: './tsconfig.json',
161
+ declaration: false,
162
+ declarationMap: false
163
+ })
164
+ ],
165
+ external: [...external, '../index', 'vue', ...nodeExternal] // Externalize Vue and the main SDK
166
+ },
167
+
168
+ // Remix bundle
169
+ {
170
+ input: './src/remix/index.ts',
171
+ output: [
172
+ {
173
+ file: 'dist/cjs/remix/index.cjs',
174
+ format: 'cjs',
175
+ name: 'HumanBehaviorRemix',
176
+ globals: {
177
+ ...globals,
178
+ '../index': 'HumanBehaviorTracker',
179
+ '../react': 'HumanBehaviorReact',
180
+ '@remix-run/node': 'RemixNode'
181
+ },
182
+ exports: 'named',
183
+ sourcemap: true
184
+ },
185
+ {
186
+ file: 'dist/esm/remix/index.js',
187
+ format: 'es',
188
+ sourcemap: true
189
+ }
190
+ ],
191
+ plugins: [
192
+ resolve({
193
+ preferBuiltins: false
194
+ }),
195
+ commonjs(),
196
+ typescript({
197
+ tsconfig: './tsconfig.json',
198
+ declaration: false,
199
+ declarationMap: false
200
+ })
201
+ ],
202
+ external: [...external, '../index', '../react', '@remix-run/node', ...nodeExternal] // Externalize dependencies
203
+ },
204
+
205
+ // Angular bundle
206
+ {
207
+ input: './src/angular/index.ts',
208
+ output: [
209
+ {
210
+ file: 'dist/cjs/angular/index.cjs',
211
+ format: 'cjs',
212
+ name: 'HumanBehaviorAngular',
213
+ globals: {
214
+ ...globals,
215
+ '../index': 'HumanBehaviorTracker'
216
+ },
217
+ exports: 'named',
218
+ sourcemap: true
219
+ },
220
+ {
221
+ file: 'dist/esm/angular/index.js',
222
+ format: 'es',
223
+ sourcemap: true
224
+ }
225
+ ],
226
+ plugins: [
227
+ resolve({
228
+ preferBuiltins: false
229
+ }),
230
+ commonjs(),
231
+ typescript({
232
+ tsconfig: './tsconfig.json',
233
+ declaration: false,
234
+ declarationMap: false
235
+ })
236
+ ],
237
+ external: [...external, '../index', ...nodeExternal] // Externalize the main SDK
238
+ },
239
+
240
+ // Type definition bundles - generate these separately
241
+ {
242
+ input: 'src/index.ts',
243
+ output: {
244
+ file: 'dist/types/index.d.ts',
245
+ format: 'es'
246
+ },
247
+ plugins: [dts()],
248
+ external: [...external, ...nodeExternal]
249
+ },
250
+ {
251
+ input: 'src/react/index.tsx',
252
+ output: {
253
+ file: 'dist/types/react/index.d.ts',
254
+ format: 'es'
255
+ },
256
+ plugins: [dts()],
257
+ external: [...external, '..', ...nodeExternal]
258
+ },
259
+ {
260
+ input: 'src/svelte/index.ts',
261
+ output: {
262
+ file: 'dist/types/svelte/index.d.ts',
263
+ format: 'es'
264
+ },
265
+ plugins: [dts()],
266
+ external: [...external, '..', ...nodeExternal]
267
+ },
268
+ {
269
+ input: 'src/vue/index.ts',
270
+ output: {
271
+ file: 'dist/types/vue/index.d.ts',
272
+ format: 'es'
273
+ },
274
+ plugins: [dts()],
275
+ external: [...external, '..', 'vue', ...nodeExternal]
276
+ },
277
+ {
278
+ input: 'src/remix/index.ts',
279
+ output: {
280
+ file: 'dist/types/remix/index.d.ts',
281
+ format: 'es'
282
+ },
283
+ plugins: [dts()],
284
+ external: [...external, '..', '../react', '@remix-run/node', ...nodeExternal]
285
+ },
286
+ {
287
+ input: 'src/angular/index.ts',
288
+ output: {
289
+ file: 'dist/types/angular/index.d.ts',
290
+ format: 'es'
291
+ },
292
+ plugins: [dts()],
293
+ external: [...external, '..', ...nodeExternal]
294
+ },
295
+
296
+ // CLI bundle
297
+ {
298
+ input: 'src/wizard/cli/auto-install.ts',
299
+ output: {
300
+ file: 'dist/cli/auto-install.js',
301
+ format: 'es',
302
+ sourcemap: true
303
+ },
304
+ plugins: [
305
+ resolve({
306
+ preferBuiltins: true
307
+ }),
308
+ commonjs(),
309
+ json(),
310
+ typescript({
311
+ tsconfig: './tsconfig.json',
312
+ declaration: false,
313
+ declarationMap: false
314
+ })
315
+ ],
316
+ external: nodeExternal
317
+ },
318
+
319
+ // AI CLI bundle
320
+ {
321
+ input: 'src/wizard/cli/ai-auto-install.ts',
322
+ output: {
323
+ file: 'dist/cli/ai-auto-install.js',
324
+ format: 'es',
325
+ sourcemap: true
326
+ },
327
+ plugins: [
328
+ resolve({
329
+ preferBuiltins: true
330
+ }),
331
+ commonjs(),
332
+ json(),
333
+ typescript({
334
+ tsconfig: './tsconfig.json',
335
+ declaration: false,
336
+ declarationMap: false
337
+ })
338
+ ],
339
+ external: nodeExternal
340
+ },
341
+
342
+ // Install wizard bundle
343
+ {
344
+ input: 'src/wizard/core/install-wizard.ts',
345
+ output: [
346
+ {
347
+ file: 'dist/cjs/install-wizard.cjs',
348
+ format: 'cjs',
349
+ sourcemap: true
350
+ },
351
+ {
352
+ file: 'dist/esm/install-wizard.js',
353
+ format: 'es',
354
+ sourcemap: true
355
+ }
356
+ ],
357
+ plugins: [
358
+ resolve({
359
+ preferBuiltins: true
360
+ }),
361
+ commonjs(),
362
+ typescript({
363
+ tsconfig: './tsconfig.json',
364
+ declaration: false,
365
+ declarationMap: false
366
+ })
367
+ ],
368
+ external: nodeExternal
369
+ },
370
+
371
+ // Install wizard types
372
+ {
373
+ input: 'src/wizard/core/install-wizard.ts',
374
+ output: {
375
+ file: 'dist/types/install-wizard.d.ts',
376
+ format: 'es'
377
+ },
378
+ plugins: [dts()],
379
+ external: nodeExternal
380
+ },
381
+
382
+ // Wizard module bundle
383
+ {
384
+ input: 'src/wizard/index.ts',
385
+ output: [
386
+ {
387
+ file: 'dist/cjs/wizard/index.cjs',
388
+ format: 'cjs',
389
+ sourcemap: true
390
+ },
391
+ {
392
+ file: 'dist/esm/wizard/index.js',
393
+ format: 'es',
394
+ sourcemap: true
395
+ }
396
+ ],
397
+ plugins: [
398
+ resolve({
399
+ preferBuiltins: true
400
+ }),
401
+ commonjs(),
402
+ json(),
403
+ typescript({
404
+ tsconfig: './tsconfig.json',
405
+ declaration: false,
406
+ declarationMap: false
407
+ })
408
+ ],
409
+ external: nodeExternal
410
+ },
411
+
412
+ // Wizard module types
413
+ {
414
+ input: 'src/wizard/index.ts',
415
+ output: {
416
+ file: 'dist/types/wizard/index.d.ts',
417
+ format: 'es'
418
+ },
419
+ plugins: [dts()],
420
+ external: nodeExternal
421
+ }
422
+ ];