humanbehavior-js 0.4.28 → 0.5.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 (140) hide show
  1. package/README.md +151 -0
  2. package/package.json +114 -79
  3. package/packages/angular/dist/index.d.ts +46 -0
  4. package/packages/angular/dist/index.d.ts.map +1 -0
  5. package/packages/angular/dist/index.js +2 -0
  6. package/packages/angular/dist/index.js.map +1 -0
  7. package/packages/angular/dist/index.mjs +2 -0
  8. package/packages/angular/dist/index.mjs.map +1 -0
  9. package/packages/browser/dist/index.d.ts +5 -0
  10. package/packages/browser/dist/index.d.ts.map +1 -0
  11. package/packages/browser/dist/index.iife.js +12095 -0
  12. package/packages/browser/dist/index.iife.js.map +1 -0
  13. package/packages/browser/dist/index.js +2 -0
  14. package/packages/browser/dist/index.js.map +1 -0
  15. package/packages/browser/dist/index.min.js +2 -0
  16. package/packages/browser/dist/index.min.js.map +1 -0
  17. package/packages/browser/dist/index.mjs +2 -0
  18. package/packages/browser/dist/index.mjs.map +1 -0
  19. package/packages/react/dist/browser.d.ts +2 -0
  20. package/packages/react/dist/browser.d.ts.map +1 -0
  21. package/packages/react/dist/index.d.ts +48 -0
  22. package/packages/react/dist/index.d.ts.map +1 -0
  23. package/packages/react/dist/index.js +2 -0
  24. package/packages/react/dist/index.js.map +1 -0
  25. package/packages/react/dist/index.mjs +2 -0
  26. package/packages/react/dist/index.mjs.map +1 -0
  27. package/packages/remix/dist/index.d.ts +8 -0
  28. package/packages/remix/dist/index.d.ts.map +1 -0
  29. package/packages/remix/dist/index.js +2 -0
  30. package/packages/remix/dist/index.js.map +1 -0
  31. package/packages/remix/dist/index.mjs +2 -0
  32. package/packages/remix/dist/index.mjs.map +1 -0
  33. package/packages/svelte/dist/index.d.ts +11 -0
  34. package/packages/svelte/dist/index.d.ts.map +1 -0
  35. package/packages/svelte/dist/index.js +2 -0
  36. package/packages/svelte/dist/index.js.map +1 -0
  37. package/packages/svelte/dist/index.mjs +2 -0
  38. package/packages/svelte/dist/index.mjs.map +1 -0
  39. package/{dist/types/vue → packages/vue/dist}/index.d.ts +4 -5
  40. package/packages/vue/dist/index.d.ts.map +1 -0
  41. package/packages/vue/dist/index.js +2 -0
  42. package/packages/vue/dist/index.js.map +1 -0
  43. package/packages/vue/dist/index.mjs +2 -0
  44. package/packages/vue/dist/index.mjs.map +1 -0
  45. package/packages/wizard/dist/ai/ai-install-wizard.d.ts +145 -0
  46. package/packages/wizard/dist/ai/ai-install-wizard.d.ts.map +1 -0
  47. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts +52 -0
  48. package/packages/wizard/dist/ai/manual-framework-wizard.d.ts.map +1 -0
  49. package/packages/wizard/dist/cli/ai-auto-install.d.ts +27 -0
  50. package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -0
  51. package/{dist → packages/wizard/dist}/cli/ai-auto-install.js +821 -905
  52. package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -0
  53. package/packages/wizard/dist/cli/auto-install.d.ts +26 -0
  54. package/packages/wizard/dist/cli/auto-install.d.ts.map +1 -0
  55. package/{dist → packages/wizard/dist}/cli/auto-install.js +821 -905
  56. package/packages/wizard/dist/cli/auto-install.js.map +1 -0
  57. package/{dist/types → packages/wizard/dist/core}/install-wizard.d.ts +6 -8
  58. package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -0
  59. package/packages/wizard/dist/index.d.ts +18 -0
  60. package/packages/wizard/dist/index.d.ts.map +1 -0
  61. package/packages/wizard/dist/index.js +2 -0
  62. package/packages/wizard/dist/index.js.map +1 -0
  63. package/packages/wizard/dist/index.mjs +2 -0
  64. package/packages/wizard/dist/index.mjs.map +1 -0
  65. package/packages/wizard/dist/services/centralized-ai-service.d.ts +159 -0
  66. package/packages/wizard/dist/services/centralized-ai-service.d.ts.map +1 -0
  67. package/packages/wizard/dist/services/remote-ai-service.d.ts +58 -0
  68. package/packages/wizard/dist/services/remote-ai-service.d.ts.map +1 -0
  69. package/WIZARD_USAGE_GUIDE.md +0 -381
  70. package/dist/cjs/angular/index.cjs +0 -14979
  71. package/dist/cjs/angular/index.cjs.map +0 -1
  72. package/dist/cjs/index.cjs +0 -14964
  73. package/dist/cjs/index.cjs.map +0 -1
  74. package/dist/cjs/install-wizard.cjs +0 -1576
  75. package/dist/cjs/install-wizard.cjs.map +0 -1
  76. package/dist/cjs/react/index.cjs +0 -15103
  77. package/dist/cjs/react/index.cjs.map +0 -1
  78. package/dist/cjs/remix/index.cjs +0 -15077
  79. package/dist/cjs/remix/index.cjs.map +0 -1
  80. package/dist/cjs/svelte/index.cjs +0 -14933
  81. package/dist/cjs/svelte/index.cjs.map +0 -1
  82. package/dist/cjs/vue/index.cjs +0 -14942
  83. package/dist/cjs/vue/index.cjs.map +0 -1
  84. package/dist/cjs/wizard/index.cjs +0 -3490
  85. package/dist/cjs/wizard/index.cjs.map +0 -1
  86. package/dist/cli/ai-auto-install.js.map +0 -1
  87. package/dist/cli/auto-install.js.map +0 -1
  88. package/dist/esm/angular/index.js +0 -14975
  89. package/dist/esm/angular/index.js.map +0 -1
  90. package/dist/esm/index.js +0 -14941
  91. package/dist/esm/index.js.map +0 -1
  92. package/dist/esm/install-wizard.js +0 -1553
  93. package/dist/esm/install-wizard.js.map +0 -1
  94. package/dist/esm/react/index.js +0 -15097
  95. package/dist/esm/react/index.js.map +0 -1
  96. package/dist/esm/remix/index.js +0 -15073
  97. package/dist/esm/remix/index.js.map +0 -1
  98. package/dist/esm/svelte/index.js +0 -14931
  99. package/dist/esm/svelte/index.js.map +0 -1
  100. package/dist/esm/vue/index.js +0 -14940
  101. package/dist/esm/vue/index.js.map +0 -1
  102. package/dist/esm/wizard/index.js +0 -3459
  103. package/dist/esm/wizard/index.js.map +0 -1
  104. package/dist/index.min.js +0 -2
  105. package/dist/index.min.js.map +0 -1
  106. package/dist/types/angular/index.d.ts +0 -357
  107. package/dist/types/index.d.ts +0 -644
  108. package/dist/types/react/index.d.ts +0 -345
  109. package/dist/types/remix/index.d.ts +0 -336
  110. package/dist/types/svelte/index.d.ts +0 -322
  111. package/dist/types/wizard/index.d.ts +0 -523
  112. package/readme.md +0 -335
  113. package/rollup.config.js +0 -422
  114. package/simple-spa.html +0 -1000
  115. package/src/angular/index.ts +0 -79
  116. package/src/api.ts +0 -416
  117. package/src/index.ts +0 -35
  118. package/src/react/AutoInstallWizard.tsx +0 -557
  119. package/src/react/browser.ts +0 -8
  120. package/src/react/index.tsx +0 -308
  121. package/src/redact.ts +0 -327
  122. package/src/remix/index.ts +0 -16
  123. package/src/svelte/index.ts +0 -14
  124. package/src/tracker.ts +0 -1587
  125. package/src/types/clack.d.ts +0 -31
  126. package/src/utils/ip-detector.ts +0 -158
  127. package/src/utils/logger.ts +0 -144
  128. package/src/utils/property-detector.ts +0 -345
  129. package/src/utils/property-manager.ts +0 -274
  130. package/src/vue/index.ts +0 -29
  131. package/src/wizard/README.md +0 -114
  132. package/src/wizard/ai/ai-install-wizard.ts +0 -897
  133. package/src/wizard/ai/manual-framework-wizard.ts +0 -238
  134. package/src/wizard/cli/ai-auto-install.ts +0 -241
  135. package/src/wizard/cli/auto-install.ts +0 -224
  136. package/src/wizard/core/install-wizard.ts +0 -1794
  137. package/src/wizard/index.ts +0 -23
  138. package/src/wizard/services/centralized-ai-service.ts +0 -668
  139. package/src/wizard/services/remote-ai-service.ts +0 -240
  140. package/tsconfig.json +0 -24
@@ -1,240 +0,0 @@
1
- /**
2
- * Remote AI Service Implementation
3
- *
4
- * This connects to your deployed Lambda function via API Gateway
5
- */
6
-
7
- import { AICodeAnalysis } from '../ai/ai-install-wizard';
8
-
9
- export interface FrameworkInfo {
10
- name: string;
11
- type: 'react' | 'vue' | 'angular' | 'svelte' | 'nextjs' | 'nuxt' | 'remix' | 'vanilla' | 'astro' | 'gatsby' | 'node';
12
- bundler?: 'vite' | 'webpack' | 'esbuild' | 'rollup';
13
- packageManager?: 'npm' | 'yarn' | 'pnpm';
14
- hasTypeScript?: boolean;
15
- hasRouter?: boolean;
16
- projectRoot?: string;
17
- version?: string;
18
- majorVersion?: number;
19
- features?: {
20
- hasReact18?: boolean;
21
- hasVue3?: boolean;
22
- hasNuxt3?: boolean;
23
- hasAngularStandalone?: boolean;
24
- hasNextAppRouter?: boolean;
25
- hasSvelteKit?: boolean;
26
- };
27
- }
28
-
29
- export interface RemoteAIServiceConfig {
30
- apiEndpoint: string;
31
- timeout?: number;
32
- }
33
-
34
- export class RemoteAIService {
35
- private config: RemoteAIServiceConfig;
36
-
37
- constructor(config: RemoteAIServiceConfig) {
38
- this.config = {
39
- timeout: 10000, // 10 seconds
40
- ...config
41
- };
42
- }
43
-
44
- /**
45
- * Analyze code patterns using your deployed AI service
46
- */
47
- async analyzeCodePatterns(codeSamples: string[]): Promise<AICodeAnalysis> {
48
- try {
49
- const response = await fetch(`${this.config.apiEndpoint}/analyze`, {
50
- method: 'POST',
51
- headers: {
52
- 'Content-Type': 'application/json',
53
- },
54
- body: JSON.stringify({ codeSamples }),
55
- signal: AbortSignal.timeout(this.config.timeout || 10000)
56
- });
57
-
58
- if (!response.ok) {
59
- throw new Error(`AI service returned ${response.status}: ${response.statusText}`);
60
- }
61
-
62
- const result = await response.json();
63
- return result.analysis;
64
- } catch (error) {
65
- console.warn('Remote AI service failed, falling back to heuristic analysis:', error);
66
- return this.performHeuristicAnalysis(codeSamples);
67
- }
68
- }
69
-
70
- /**
71
- * Resolve conflicts using your deployed AI service
72
- */
73
- async resolveConflicts(conflicts: string[], framework: FrameworkInfo): Promise<string[]> {
74
- try {
75
- const response = await fetch(`${this.config.apiEndpoint}/resolve-conflicts`, {
76
- method: 'POST',
77
- headers: {
78
- 'Content-Type': 'application/json',
79
- },
80
- body: JSON.stringify({ conflicts, framework }),
81
- signal: AbortSignal.timeout(this.config.timeout || 10000)
82
- });
83
-
84
- if (!response.ok) {
85
- throw new Error(`AI service returned ${response.status}: ${response.statusText}`);
86
- }
87
-
88
- const result = await response.json();
89
- return result.resolutions || [];
90
- } catch (error) {
91
- console.warn('Remote AI conflict resolution failed, using heuristic approach:', error);
92
- return this.resolveConflictsHeuristic(conflicts, framework);
93
- }
94
- }
95
-
96
- /**
97
- * Generate optimizations using your deployed AI service
98
- */
99
- async generateOptimizations(framework: FrameworkInfo, patterns: string[]): Promise<string[]> {
100
- try {
101
- const response = await fetch(`${this.config.apiEndpoint}/optimize`, {
102
- method: 'POST',
103
- headers: {
104
- 'Content-Type': 'application/json',
105
- },
106
- body: JSON.stringify({ framework, patterns }),
107
- signal: AbortSignal.timeout(this.config.timeout || 10000)
108
- });
109
-
110
- if (!response.ok) {
111
- throw new Error(`AI service returned ${response.status}: ${response.statusText}`);
112
- }
113
-
114
- const result = await response.json();
115
- return result.optimizations || [];
116
- } catch (error) {
117
- console.warn('Remote AI optimization generation failed, using heuristic approach:', error);
118
- return this.generateOptimizationsHeuristic(framework, patterns);
119
- }
120
- }
121
-
122
- /**
123
- * Heuristic analysis fallback
124
- */
125
- private performHeuristicAnalysis(codeSamples: string[]): AICodeAnalysis {
126
- const patterns = codeSamples.join(' ').toLowerCase();
127
-
128
- // Framework detection
129
- let framework: FrameworkInfo = { name: 'vanilla', type: 'vanilla' };
130
- let confidence = 0.5;
131
-
132
- if (patterns.includes('nuxt') || patterns.includes('nuxtjs') || patterns.includes('defineNuxtConfig') || patterns.includes('nuxt.config') || patterns.includes('@nuxt/') || patterns.includes('useNuxtApp') || patterns.includes('useRuntimeConfig') || patterns.includes('useSeoMeta') || patterns.includes('useHead') || patterns.includes('useLazyFetch') || patterns.includes('useFetch') || patterns.includes('useAsyncData') || patterns.includes('#app')) {
133
- framework = { name: 'nuxt', type: 'nuxt' };
134
- confidence = 0.95;
135
- } 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/')) {
136
- framework = { name: 'nextjs', type: 'nextjs' };
137
- confidence = 0.95;
138
- } 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')) {
139
- framework = { name: 'gatsby', type: 'gatsby' };
140
- confidence = 0.95;
141
- } else if (patterns.includes('react')) {
142
- framework = { name: 'react', type: 'react' };
143
- confidence = 0.9;
144
- } else if (patterns.includes('vue')) {
145
- framework = { name: 'vue', type: 'vue' };
146
- confidence = 0.9;
147
- } else if (patterns.includes('angular')) {
148
- framework = { name: 'angular', type: 'angular' };
149
- confidence = 0.9;
150
- } else if (patterns.includes('svelte')) {
151
- framework = { name: 'svelte', type: 'svelte' };
152
- confidence = 0.9;
153
- } else if (patterns.includes('astro')) {
154
- framework = { name: 'astro', type: 'astro' };
155
- confidence = 0.9;
156
- }
157
-
158
- // Integration strategy
159
- let integrationStrategy: 'provider' | 'plugin' | 'module' | 'script' | 'standalone' = 'script';
160
- if (framework.type === 'react' || framework.type === 'nextjs' || framework.type === 'gatsby') {
161
- integrationStrategy = 'provider';
162
- } else if (framework.type === 'vue') {
163
- integrationStrategy = 'plugin';
164
- } else if (framework.type === 'angular') {
165
- integrationStrategy = 'module';
166
- }
167
-
168
- // Compatibility mode
169
- let compatibilityMode: 'modern' | 'legacy' | 'hybrid' = 'modern';
170
- if (patterns.includes('require(') || patterns.includes('var ')) {
171
- compatibilityMode = 'legacy';
172
- }
173
-
174
- return {
175
- framework,
176
- confidence,
177
- patterns: codeSamples,
178
- conflicts: [],
179
- recommendations: [],
180
- integrationStrategy,
181
- compatibilityMode
182
- };
183
- }
184
-
185
- /**
186
- * Heuristic conflict resolution
187
- */
188
- private resolveConflictsHeuristic(conflicts: string[], framework: FrameworkInfo): string[] {
189
- const resolutions: string[] = [];
190
-
191
- for (const conflict of conflicts) {
192
- switch (conflict) {
193
- case 'existing_humanbehavior_code':
194
- resolutions.push('update_existing_integration');
195
- break;
196
- case 'existing_provider':
197
- resolutions.push('merge_providers');
198
- break;
199
- case 'module_system_conflict':
200
- resolutions.push('hybrid_module_support');
201
- break;
202
- default:
203
- resolutions.push('skip_conflict');
204
- }
205
- }
206
-
207
- return resolutions;
208
- }
209
-
210
- /**
211
- * Heuristic optimization generation
212
- */
213
- private generateOptimizationsHeuristic(framework: FrameworkInfo, patterns: string[]): string[] {
214
- const optimizations: string[] = [];
215
-
216
- switch (framework.type) {
217
- case 'react':
218
- optimizations.push('Use React.memo for performance optimization');
219
- optimizations.push('Implement error boundaries for better error tracking');
220
- optimizations.push('Consider using React.lazy for code splitting');
221
- break;
222
- case 'vue':
223
- optimizations.push('Use Vue 3 Composition API for better performance');
224
- optimizations.push('Implement proper error handling in components');
225
- optimizations.push('Consider using Vue Router for navigation tracking');
226
- break;
227
- case 'angular':
228
- optimizations.push('Use Angular standalone components for better tree-shaking');
229
- optimizations.push('Implement proper error handling with ErrorHandler');
230
- optimizations.push('Consider using Angular signals for state management');
231
- break;
232
- default:
233
- optimizations.push('Enable performance tracking');
234
- optimizations.push('Implement error tracking');
235
- optimizations.push('Consider progressive enhancement');
236
- }
237
-
238
- return optimizations;
239
- }
240
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "sourceMap": true,
5
- "noImplicitAny": true,
6
- "module": "ESNext",
7
- "target": "es2015",
8
- "downlevelIteration": true,
9
- "jsx": "react",
10
- "allowJs": true,
11
- "moduleResolution": "node",
12
- "allowSyntheticDefaultImports": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "esModuleInterop": true,
16
- "strict": true,
17
- "skipLibCheck": true,
18
- "forceConsistentCasingInFileNames": true,
19
- "lib": ["dom", "dom.iterable", "esnext"]
20
- },
21
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/types/**/*.d.ts"],
22
-
23
- "exclude": ["node_modules", "dist", "test-website"]
24
- }