humanbehavior-js 0.4.13 → 0.4.14

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  interface FrameworkInfo$2 {
8
8
  name: string;
9
- type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'node' | 'auto';
9
+ type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'astro' | 'gatsby' | 'node' | 'auto';
10
10
  bundler?: 'vite' | 'webpack' | 'esbuild' | 'rollup';
11
11
  packageManager?: 'npm' | 'yarn' | 'pnpm';
12
12
  hasTypeScript?: boolean;
@@ -55,6 +55,10 @@ declare class AutoInstallationWizard {
55
55
  * Generate Next.js-specific modifications
56
56
  */
57
57
  private generateNextJSModifications;
58
+ /**
59
+ * Generate Astro-specific modifications
60
+ */
61
+ private generateAstroModifications;
58
62
  /**
59
63
  * Generate Nuxt-specific modifications
60
64
  */
@@ -79,6 +83,10 @@ declare class AutoInstallationWizard {
79
83
  * Generate vanilla JS/TS modifications
80
84
  */
81
85
  private generateVanillaModifications;
86
+ /**
87
+ * Generate Gatsby-specific modifications
88
+ */
89
+ private generateGatsbyModifications;
82
90
  /**
83
91
  * Apply modifications to the codebase
84
92
  */
@@ -101,7 +109,13 @@ declare class AutoInstallationWizard {
101
109
  private injectSvelteStore;
102
110
  private injectSvelteKitLayout;
103
111
  private injectVanillaScript;
112
+ /**
113
+ * Inject Astro layout with HumanBehavior component
114
+ */
115
+ private injectAstroLayout;
104
116
  private injectNuxtConfig;
117
+ private injectGatsbyLayout;
118
+ private injectGatsbyBrowser;
105
119
  /**
106
120
  * Helper method to find the best environment file for a framework
107
121
  */
@@ -269,20 +283,14 @@ interface AICLIOptions {
269
283
  projectPath?: string;
270
284
  yes?: boolean;
271
285
  dryRun?: boolean;
272
- useAI?: boolean;
273
- browser?: boolean;
274
286
  framework?: string;
275
- manual?: boolean;
276
287
  }
277
288
  declare class AIAutoInstallCLI {
278
- private rl;
279
289
  private options;
280
290
  constructor(options: AICLIOptions);
281
291
  run(): Promise<void>;
282
292
  private getApiKey;
283
- private chooseInstallationMode;
284
293
  private confirmInstallation;
285
- private getInstallationModeDisplay;
286
294
  private chooseFramework;
287
295
  private displayResults;
288
296
  }
@@ -302,11 +310,11 @@ interface CLIOptions {
302
310
  dryRun?: boolean;
303
311
  }
304
312
  declare class AutoInstallCLI {
305
- private rl;
306
313
  private options;
307
314
  constructor(options: CLIOptions);
308
315
  run(): Promise<void>;
309
316
  private getApiKey;
317
+ private chooseFramework;
310
318
  private confirmInstallation;
311
319
  private displayResults;
312
320
  }
@@ -319,7 +327,7 @@ declare class AutoInstallCLI {
319
327
 
320
328
  interface FrameworkInfo$1 {
321
329
  name: string;
322
- type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'node';
330
+ type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'astro' | 'gatsby' | 'node';
323
331
  bundler?: 'vite' | 'webpack' | 'esbuild' | 'rollup';
324
332
  packageManager?: 'npm' | 'yarn' | 'pnpm';
325
333
  hasTypeScript?: boolean;
@@ -374,7 +382,7 @@ declare class RemoteAIService {
374
382
 
375
383
  interface FrameworkInfo {
376
384
  name: string;
377
- type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'node';
385
+ type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'astro' | 'node';
378
386
  bundler?: 'vite' | 'webpack' | 'esbuild' | 'rollup';
379
387
  packageManager?: 'npm' | 'yarn' | 'pnpm';
380
388
  hasTypeScript?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humanbehavior-js",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "SDK for HumanBehavior session and event recording",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -60,6 +60,8 @@
60
60
  "author": "Chirag Kawediya, Skyler Ji, Amogh Chaturvedi",
61
61
  "license": "ISC",
62
62
  "dependencies": {
63
+ "@clack/prompts": "^0.11.0",
64
+ "@rollup/plugin-json": "^6.1.0",
63
65
  "@rrweb/record": "^2.0.0-alpha.17",
64
66
  "@types/react": "^19.0.12",
65
67
  "openai": "^5.12.0",
package/rollup.config.js CHANGED
@@ -3,10 +3,11 @@ import resolve from '@rollup/plugin-node-resolve';
3
3
  import commonjs from '@rollup/plugin-commonjs';
4
4
  import terser from '@rollup/plugin-terser';
5
5
  import dts from 'rollup-plugin-dts';
6
+ import json from '@rollup/plugin-json';
6
7
 
7
8
  // External dependencies that shouldn't be bundled
8
9
  const external = ['react', 'react-dom', 'react/jsx-runtime'];
9
- const nodeExternal = ['fs', 'path', 'child_process', 'readline'];
10
+ const nodeExternal = ['fs', 'path', 'child_process', 'readline', '@clack/prompts'];
10
11
 
11
12
  // Global variables for UMD build
12
13
  const globals = {
@@ -305,6 +306,7 @@ export default [
305
306
  preferBuiltins: true
306
307
  }),
307
308
  commonjs(),
309
+ json(),
308
310
  typescript({
309
311
  tsconfig: './tsconfig.json',
310
312
  declaration: false,
@@ -327,6 +329,7 @@ export default [
327
329
  preferBuiltins: true
328
330
  }),
329
331
  commonjs(),
332
+ json(),
330
333
  typescript({
331
334
  tsconfig: './tsconfig.json',
332
335
  declaration: false,
@@ -396,6 +399,7 @@ export default [
396
399
  preferBuiltins: true
397
400
  }),
398
401
  commonjs(),
402
+ json(),
399
403
  typescript({
400
404
  tsconfig: './tsconfig.json',
401
405
  declaration: false,
@@ -0,0 +1,31 @@
1
+ declare module '@clack/prompts' {
2
+ export function intro(message: string): void;
3
+ export function outro(message: string): void;
4
+ export function cancel(message: string): void;
5
+ export function note(message: string, title?: string): void;
6
+
7
+ export function text(options: {
8
+ message: string;
9
+ placeholder?: string;
10
+ defaultValue?: string;
11
+ validate?: (value: string) => string | undefined;
12
+ }): Promise<string>;
13
+
14
+ export function select(options: {
15
+ message: string;
16
+ options: Array<{
17
+ label: string;
18
+ value: string;
19
+ hint?: string;
20
+ }>;
21
+ }): Promise<string>;
22
+
23
+ export function confirm(options: {
24
+ message: string;
25
+ }): Promise<boolean>;
26
+
27
+ export function spinner(): {
28
+ start(message: string): void;
29
+ stop(message?: string): void;
30
+ };
31
+ }
@@ -123,6 +123,9 @@ class DefaultAIService implements CentralizedAIService {
123
123
  } else if (patterns.includes('next') || patterns.includes('nextjs') || patterns.includes('next/link') || patterns.includes('next/image') || patterns.includes('next/navigation') || patterns.includes('next/router') || patterns.includes('getserverSideProps') || patterns.includes('getstaticProps') || patterns.includes('getstaticPaths') || patterns.includes('app/layout') || patterns.includes('app/page') || patterns.includes('pages/')) {
124
124
  framework = { name: 'nextjs', type: 'nextjs' };
125
125
  confidence = 0.95;
126
+ } else if (patterns.includes('gatsby') || patterns.includes('gatsby-browser') || patterns.includes('gatsby-ssr') || patterns.includes('gatsby-node') || patterns.includes('gatsby-config') || patterns.includes('useStaticQuery') || patterns.includes('graphql')) {
127
+ framework = { name: 'gatsby', type: 'gatsby' };
128
+ confidence = 0.95;
126
129
  } else if (patterns.includes('react')) {
127
130
  framework = { name: 'react', type: 'react' };
128
131
  confidence = 0.9;
@@ -139,7 +142,7 @@ class DefaultAIService implements CentralizedAIService {
139
142
 
140
143
  // Integration strategy
141
144
  let integrationStrategy: 'provider' | 'plugin' | 'module' | 'script' | 'standalone' = 'script';
142
- if (framework.type === 'react' || framework.type === 'nextjs') {
145
+ if (framework.type === 'react' || framework.type === 'nextjs' || framework.type === 'gatsby') {
143
146
  integrationStrategy = 'provider';
144
147
  } else if (framework.type === 'vue') {
145
148
  integrationStrategy = 'plugin';
@@ -187,6 +187,8 @@ export class ManualFrameworkInstallationWizard extends AutoInstallationWizard {
187
187
  'svelte': { name: 'svelte', type: 'svelte' },
188
188
  'sveltekit': { name: 'svelte', type: 'svelte' },
189
189
  'remix': { name: 'remix', type: 'remix' },
190
+ 'astro': { name: 'astro', type: 'astro' },
191
+ 'gatsby': { name: 'gatsby', type: 'gatsby' },
190
192
  'vanilla': { name: 'vanilla', type: 'vanilla' },
191
193
  'node': { name: 'node', type: 'node' },
192
194
  'auto': { name: 'auto-detected', type: 'auto' }