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.
- package/README.md +151 -0
- package/package.json +114 -79
- package/packages/angular/dist/index.d.ts +46 -0
- package/packages/angular/dist/index.d.ts.map +1 -0
- package/packages/angular/dist/index.js +2 -0
- package/packages/angular/dist/index.js.map +1 -0
- package/packages/angular/dist/index.mjs +2 -0
- package/packages/angular/dist/index.mjs.map +1 -0
- package/packages/browser/dist/index.d.ts +5 -0
- package/packages/browser/dist/index.d.ts.map +1 -0
- package/packages/browser/dist/index.iife.js +12095 -0
- package/packages/browser/dist/index.iife.js.map +1 -0
- package/packages/browser/dist/index.js +2 -0
- package/packages/browser/dist/index.js.map +1 -0
- package/packages/browser/dist/index.min.js +2 -0
- package/packages/browser/dist/index.min.js.map +1 -0
- package/packages/browser/dist/index.mjs +2 -0
- package/packages/browser/dist/index.mjs.map +1 -0
- package/packages/react/dist/browser.d.ts +2 -0
- package/packages/react/dist/browser.d.ts.map +1 -0
- package/packages/react/dist/index.d.ts +48 -0
- package/packages/react/dist/index.d.ts.map +1 -0
- package/packages/react/dist/index.js +2 -0
- package/packages/react/dist/index.js.map +1 -0
- package/packages/react/dist/index.mjs +2 -0
- package/packages/react/dist/index.mjs.map +1 -0
- package/packages/remix/dist/index.d.ts +8 -0
- package/packages/remix/dist/index.d.ts.map +1 -0
- package/packages/remix/dist/index.js +2 -0
- package/packages/remix/dist/index.js.map +1 -0
- package/packages/remix/dist/index.mjs +2 -0
- package/packages/remix/dist/index.mjs.map +1 -0
- package/packages/svelte/dist/index.d.ts +11 -0
- package/packages/svelte/dist/index.d.ts.map +1 -0
- package/packages/svelte/dist/index.js +2 -0
- package/packages/svelte/dist/index.js.map +1 -0
- package/packages/svelte/dist/index.mjs +2 -0
- package/packages/svelte/dist/index.mjs.map +1 -0
- package/{dist/types/vue → packages/vue/dist}/index.d.ts +4 -5
- package/packages/vue/dist/index.d.ts.map +1 -0
- package/packages/vue/dist/index.js +2 -0
- package/packages/vue/dist/index.js.map +1 -0
- package/packages/vue/dist/index.mjs +2 -0
- package/packages/vue/dist/index.mjs.map +1 -0
- package/packages/wizard/dist/ai/ai-install-wizard.d.ts +145 -0
- package/packages/wizard/dist/ai/ai-install-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/ai/manual-framework-wizard.d.ts +52 -0
- package/packages/wizard/dist/ai/manual-framework-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/cli/ai-auto-install.d.ts +27 -0
- package/packages/wizard/dist/cli/ai-auto-install.d.ts.map +1 -0
- package/{dist → packages/wizard/dist}/cli/ai-auto-install.js +821 -905
- package/packages/wizard/dist/cli/ai-auto-install.js.map +1 -0
- package/packages/wizard/dist/cli/auto-install.d.ts +26 -0
- package/packages/wizard/dist/cli/auto-install.d.ts.map +1 -0
- package/{dist → packages/wizard/dist}/cli/auto-install.js +821 -905
- package/packages/wizard/dist/cli/auto-install.js.map +1 -0
- package/{dist/types → packages/wizard/dist/core}/install-wizard.d.ts +6 -8
- package/packages/wizard/dist/core/install-wizard.d.ts.map +1 -0
- package/packages/wizard/dist/index.d.ts +18 -0
- package/packages/wizard/dist/index.d.ts.map +1 -0
- package/packages/wizard/dist/index.js +2 -0
- package/packages/wizard/dist/index.js.map +1 -0
- package/packages/wizard/dist/index.mjs +2 -0
- package/packages/wizard/dist/index.mjs.map +1 -0
- package/packages/wizard/dist/services/centralized-ai-service.d.ts +159 -0
- package/packages/wizard/dist/services/centralized-ai-service.d.ts.map +1 -0
- package/packages/wizard/dist/services/remote-ai-service.d.ts +58 -0
- package/packages/wizard/dist/services/remote-ai-service.d.ts.map +1 -0
- package/WIZARD_USAGE_GUIDE.md +0 -381
- package/dist/cjs/angular/index.cjs +0 -14979
- package/dist/cjs/angular/index.cjs.map +0 -1
- package/dist/cjs/index.cjs +0 -14964
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/install-wizard.cjs +0 -1576
- package/dist/cjs/install-wizard.cjs.map +0 -1
- package/dist/cjs/react/index.cjs +0 -15103
- package/dist/cjs/react/index.cjs.map +0 -1
- package/dist/cjs/remix/index.cjs +0 -15077
- package/dist/cjs/remix/index.cjs.map +0 -1
- package/dist/cjs/svelte/index.cjs +0 -14933
- package/dist/cjs/svelte/index.cjs.map +0 -1
- package/dist/cjs/vue/index.cjs +0 -14942
- package/dist/cjs/vue/index.cjs.map +0 -1
- package/dist/cjs/wizard/index.cjs +0 -3490
- package/dist/cjs/wizard/index.cjs.map +0 -1
- package/dist/cli/ai-auto-install.js.map +0 -1
- package/dist/cli/auto-install.js.map +0 -1
- package/dist/esm/angular/index.js +0 -14975
- package/dist/esm/angular/index.js.map +0 -1
- package/dist/esm/index.js +0 -14941
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/install-wizard.js +0 -1553
- package/dist/esm/install-wizard.js.map +0 -1
- package/dist/esm/react/index.js +0 -15097
- package/dist/esm/react/index.js.map +0 -1
- package/dist/esm/remix/index.js +0 -15073
- package/dist/esm/remix/index.js.map +0 -1
- package/dist/esm/svelte/index.js +0 -14931
- package/dist/esm/svelte/index.js.map +0 -1
- package/dist/esm/vue/index.js +0 -14940
- package/dist/esm/vue/index.js.map +0 -1
- package/dist/esm/wizard/index.js +0 -3459
- package/dist/esm/wizard/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/dist/types/angular/index.d.ts +0 -357
- package/dist/types/index.d.ts +0 -644
- package/dist/types/react/index.d.ts +0 -345
- package/dist/types/remix/index.d.ts +0 -336
- package/dist/types/svelte/index.d.ts +0 -322
- package/dist/types/wizard/index.d.ts +0 -523
- package/readme.md +0 -335
- package/rollup.config.js +0 -422
- package/simple-spa.html +0 -1000
- package/src/angular/index.ts +0 -79
- package/src/api.ts +0 -416
- package/src/index.ts +0 -35
- package/src/react/AutoInstallWizard.tsx +0 -557
- package/src/react/browser.ts +0 -8
- package/src/react/index.tsx +0 -308
- package/src/redact.ts +0 -327
- package/src/remix/index.ts +0 -16
- package/src/svelte/index.ts +0 -14
- package/src/tracker.ts +0 -1587
- package/src/types/clack.d.ts +0 -31
- package/src/utils/ip-detector.ts +0 -158
- package/src/utils/logger.ts +0 -144
- package/src/utils/property-detector.ts +0 -345
- package/src/utils/property-manager.ts +0 -274
- package/src/vue/index.ts +0 -29
- package/src/wizard/README.md +0 -114
- package/src/wizard/ai/ai-install-wizard.ts +0 -897
- package/src/wizard/ai/manual-framework-wizard.ts +0 -238
- package/src/wizard/cli/ai-auto-install.ts +0 -241
- package/src/wizard/cli/auto-install.ts +0 -224
- package/src/wizard/core/install-wizard.ts +0 -1794
- package/src/wizard/index.ts +0 -23
- package/src/wizard/services/centralized-ai-service.ts +0 -668
- package/src/wizard/services/remote-ai-service.ts +0 -240
- package/tsconfig.json +0 -24
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Property Manager for HumanBehavior SDK
|
|
3
|
-
* Handles automatic properties, session properties, and user properties
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { getAutomaticProperties, getInitialProperties, getCurrentPageProperties, AutomaticProperties } from './property-detector';
|
|
7
|
-
|
|
8
|
-
export interface Properties {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface PropertyManagerConfig {
|
|
13
|
-
enableAutomaticProperties?: boolean;
|
|
14
|
-
enableSessionProperties?: boolean;
|
|
15
|
-
enableUserProperties?: boolean;
|
|
16
|
-
propertyDenylist?: string[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class PropertyManager {
|
|
20
|
-
private config: PropertyManagerConfig;
|
|
21
|
-
private automaticProperties: AutomaticProperties;
|
|
22
|
-
private sessionProperties: Properties = {};
|
|
23
|
-
private userProperties: Properties = {};
|
|
24
|
-
private initialProperties: Properties = {};
|
|
25
|
-
private isInitialized: boolean = false;
|
|
26
|
-
|
|
27
|
-
constructor(config: PropertyManagerConfig = {}) {
|
|
28
|
-
this.config = {
|
|
29
|
-
enableAutomaticProperties: true,
|
|
30
|
-
enableSessionProperties: true,
|
|
31
|
-
enableUserProperties: true,
|
|
32
|
-
propertyDenylist: [],
|
|
33
|
-
...config
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
this.automaticProperties = getAutomaticProperties();
|
|
37
|
-
this.initialize();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Initialize the property manager
|
|
42
|
-
*/
|
|
43
|
-
private initialize(): void {
|
|
44
|
-
if (this.isInitialized) return;
|
|
45
|
-
|
|
46
|
-
// Capture initial properties once
|
|
47
|
-
this.initialProperties = getInitialProperties();
|
|
48
|
-
|
|
49
|
-
// Load session properties from sessionStorage
|
|
50
|
-
this.loadSessionProperties();
|
|
51
|
-
|
|
52
|
-
this.isInitialized = true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get all properties for an event
|
|
57
|
-
*/
|
|
58
|
-
public getEventProperties(eventProperties: Properties = {}): Properties {
|
|
59
|
-
const properties: Properties = { ...eventProperties };
|
|
60
|
-
|
|
61
|
-
// Add automatic properties
|
|
62
|
-
if (this.config.enableAutomaticProperties) {
|
|
63
|
-
Object.assign(properties, this.getAutomaticProperties());
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Add session properties
|
|
67
|
-
if (this.config.enableSessionProperties) {
|
|
68
|
-
Object.assign(properties, this.sessionProperties);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Add user properties
|
|
72
|
-
if (this.config.enableUserProperties) {
|
|
73
|
-
Object.assign(properties, this.userProperties);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Add initial properties (only once per session)
|
|
77
|
-
if (!this.sessionProperties['$initial_properties_captured']) {
|
|
78
|
-
Object.assign(properties, this.initialProperties);
|
|
79
|
-
this.setSessionProperty('$initial_properties_captured', true);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Apply denylist
|
|
83
|
-
this.applyDenylist(properties);
|
|
84
|
-
|
|
85
|
-
return properties;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Get automatic properties
|
|
90
|
-
*/
|
|
91
|
-
public getAutomaticProperties(): Properties {
|
|
92
|
-
return {
|
|
93
|
-
...this.automaticProperties,
|
|
94
|
-
...getCurrentPageProperties() // Always get fresh page properties
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Get automatic properties with GeoIP data merged in
|
|
100
|
-
*/
|
|
101
|
-
public getAutomaticPropertiesWithGeoIP(geoIPProperties: Record<string, any> = {}): Properties {
|
|
102
|
-
return {
|
|
103
|
-
...this.automaticProperties,
|
|
104
|
-
...getCurrentPageProperties(), // Always get fresh page properties
|
|
105
|
-
...geoIPProperties
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Set a session property
|
|
111
|
-
*/
|
|
112
|
-
public setSessionProperty(key: string, value: any): void {
|
|
113
|
-
this.sessionProperties[key] = value;
|
|
114
|
-
this.saveSessionProperties();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Set multiple session properties
|
|
119
|
-
*/
|
|
120
|
-
public setSessionProperties(properties: Properties): void {
|
|
121
|
-
Object.assign(this.sessionProperties, properties);
|
|
122
|
-
this.saveSessionProperties();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Get a session property
|
|
127
|
-
*/
|
|
128
|
-
public getSessionProperty(key: string): any {
|
|
129
|
-
return this.sessionProperties[key];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Remove a session property
|
|
134
|
-
*/
|
|
135
|
-
public removeSessionProperty(key: string): void {
|
|
136
|
-
delete this.sessionProperties[key];
|
|
137
|
-
this.saveSessionProperties();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Set a user property
|
|
142
|
-
*/
|
|
143
|
-
public setUserProperty(key: string, value: any): void {
|
|
144
|
-
this.userProperties[key] = value;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Set multiple user properties
|
|
149
|
-
*/
|
|
150
|
-
public setUserProperties(properties: Properties): void {
|
|
151
|
-
Object.assign(this.userProperties, properties);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Get a user property
|
|
156
|
-
*/
|
|
157
|
-
public getUserProperty(key: string): any {
|
|
158
|
-
return this.userProperties[key];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Remove a user property
|
|
163
|
-
*/
|
|
164
|
-
public removeUserProperty(key: string): void {
|
|
165
|
-
delete this.userProperties[key];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Set a property only if it hasn't been set before
|
|
170
|
-
*/
|
|
171
|
-
public setOnce(key: string, value: any, scope: 'session' | 'user' = 'user'): void {
|
|
172
|
-
if (scope === 'session') {
|
|
173
|
-
if (!(key in this.sessionProperties)) {
|
|
174
|
-
this.setSessionProperty(key, value);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
if (!(key in this.userProperties)) {
|
|
178
|
-
this.setUserProperty(key, value);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Clear all session properties
|
|
185
|
-
*/
|
|
186
|
-
public clearSessionProperties(): void {
|
|
187
|
-
this.sessionProperties = {};
|
|
188
|
-
this.saveSessionProperties();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Clear all user properties
|
|
193
|
-
*/
|
|
194
|
-
public clearUserProperties(): void {
|
|
195
|
-
this.userProperties = {};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Reset all properties
|
|
200
|
-
*/
|
|
201
|
-
public reset(): void {
|
|
202
|
-
this.clearSessionProperties();
|
|
203
|
-
this.clearUserProperties();
|
|
204
|
-
this.initialProperties = {};
|
|
205
|
-
this.isInitialized = false;
|
|
206
|
-
this.initialize();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Load session properties from sessionStorage
|
|
211
|
-
*/
|
|
212
|
-
private loadSessionProperties(): void {
|
|
213
|
-
if (typeof sessionStorage === 'undefined') return;
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
const stored = sessionStorage.getItem('hb_session_properties');
|
|
217
|
-
if (stored) {
|
|
218
|
-
this.sessionProperties = JSON.parse(stored);
|
|
219
|
-
}
|
|
220
|
-
} catch (error) {
|
|
221
|
-
console.warn('Failed to load session properties:', error);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Save session properties to sessionStorage
|
|
227
|
-
*/
|
|
228
|
-
private saveSessionProperties(): void {
|
|
229
|
-
if (typeof sessionStorage === 'undefined') return;
|
|
230
|
-
|
|
231
|
-
try {
|
|
232
|
-
sessionStorage.setItem('hb_session_properties', JSON.stringify(this.sessionProperties));
|
|
233
|
-
} catch (error) {
|
|
234
|
-
console.warn('Failed to save session properties:', error);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Apply property denylist
|
|
240
|
-
*/
|
|
241
|
-
private applyDenylist(properties: Properties): void {
|
|
242
|
-
if (!this.config.propertyDenylist || this.config.propertyDenylist.length === 0) {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
this.config.propertyDenylist.forEach(deniedKey => {
|
|
247
|
-
delete properties[deniedKey];
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Update automatic properties (call when page changes)
|
|
253
|
-
*/
|
|
254
|
-
public updateAutomaticProperties(): void {
|
|
255
|
-
this.automaticProperties = getAutomaticProperties();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Get all properties for debugging
|
|
260
|
-
*/
|
|
261
|
-
public getAllProperties(): {
|
|
262
|
-
automatic: Properties;
|
|
263
|
-
session: Properties;
|
|
264
|
-
user: Properties;
|
|
265
|
-
initial: Properties;
|
|
266
|
-
} {
|
|
267
|
-
return {
|
|
268
|
-
automatic: this.getAutomaticProperties(),
|
|
269
|
-
session: { ...this.sessionProperties },
|
|
270
|
-
user: { ...this.userProperties },
|
|
271
|
-
initial: { ...this.initialProperties }
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}
|
package/src/vue/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { HumanBehaviorTracker } from '../index.js';
|
|
2
|
-
import type { App } from 'vue';
|
|
3
|
-
|
|
4
|
-
interface HumanBehaviorPluginOptions {
|
|
5
|
-
apiKey: string;
|
|
6
|
-
ingestionUrl?: string;
|
|
7
|
-
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
8
|
-
redactFields?: string[];
|
|
9
|
-
suppressConsoleErrors?: boolean;
|
|
10
|
-
recordCanvas?: boolean; // Enable canvas recording with protection
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const HumanBehaviorPlugin = {
|
|
14
|
-
install: (app: App, options: HumanBehaviorPluginOptions) => {
|
|
15
|
-
const tracker = HumanBehaviorTracker.init(options.apiKey, {
|
|
16
|
-
ingestionUrl: options.ingestionUrl,
|
|
17
|
-
logLevel: options.logLevel,
|
|
18
|
-
redactFields: options.redactFields,
|
|
19
|
-
suppressConsoleErrors: options.suppressConsoleErrors,
|
|
20
|
-
recordCanvas: options.recordCanvas, // Pass canvas recording option
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Make tracker available globally
|
|
24
|
-
app.config.globalProperties.$humanBehavior = tracker;
|
|
25
|
-
|
|
26
|
-
// Also provide it via inject/provide
|
|
27
|
-
app.provide('humanBehavior', tracker);
|
|
28
|
-
}
|
|
29
|
-
};
|
package/src/wizard/README.md
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# HumanBehavior SDK Wizard Module
|
|
2
|
-
|
|
3
|
-
This module provides AI-enhanced auto-installation capabilities for the HumanBehavior SDK.
|
|
4
|
-
|
|
5
|
-
## 📁 Directory Structure
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
src/wizard/
|
|
9
|
-
├── core/ # Core installation wizard
|
|
10
|
-
│ └── install-wizard.ts
|
|
11
|
-
├── ai/ # AI-enhanced wizard components
|
|
12
|
-
│ └── ai-install-wizard.ts
|
|
13
|
-
├── cli/ # Command-line interfaces
|
|
14
|
-
│ ├── auto-install.ts
|
|
15
|
-
│ └── ai-auto-install.ts
|
|
16
|
-
├── services/ # AI service implementations
|
|
17
|
-
│ ├── remote-ai-service.ts
|
|
18
|
-
│ └── centralized-ai-service.ts
|
|
19
|
-
├── index.ts # Main exports
|
|
20
|
-
└── README.md # This file
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## 🚀 Key Components
|
|
24
|
-
|
|
25
|
-
### Core (`core/`)
|
|
26
|
-
- **`install-wizard.ts`**: Traditional installation wizard
|
|
27
|
-
- Framework detection and code modification
|
|
28
|
-
- Environment variable management
|
|
29
|
-
- Package installation
|
|
30
|
-
|
|
31
|
-
### AI (`ai/`)
|
|
32
|
-
- **`ai-install-wizard.ts`**: AI-enhanced installation wizard
|
|
33
|
-
- AI-powered framework detection
|
|
34
|
-
- Intelligent code analysis
|
|
35
|
-
- Conflict resolution
|
|
36
|
-
- Learning system
|
|
37
|
-
|
|
38
|
-
### CLI (`cli/`)
|
|
39
|
-
- **`auto-install.ts`**: Traditional CLI interface
|
|
40
|
-
- **`ai-auto-install.ts`**: AI-enhanced CLI interface
|
|
41
|
-
- User interaction and command parsing
|
|
42
|
-
- Installation mode selection
|
|
43
|
-
|
|
44
|
-
### Services (`services/`)
|
|
45
|
-
- **`remote-ai-service.ts`**: Connects to deployed Lambda AI service
|
|
46
|
-
- **`centralized-ai-service.ts`**: Local AI service implementation
|
|
47
|
-
- Heuristic fallback when AI is unavailable
|
|
48
|
-
|
|
49
|
-
## 🔧 Usage
|
|
50
|
-
|
|
51
|
-
### Traditional Installation
|
|
52
|
-
```typescript
|
|
53
|
-
import { AutoInstallationWizard } from 'humanbehavior-js/wizard';
|
|
54
|
-
|
|
55
|
-
const wizard = new AutoInstallationWizard(apiKey, projectPath);
|
|
56
|
-
const result = await wizard.install();
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### AI-Enhanced Installation
|
|
60
|
-
```typescript
|
|
61
|
-
import { AIEnhancedInstallationWizard, RemoteAIService } from 'humanbehavior-js/wizard';
|
|
62
|
-
|
|
63
|
-
const aiService = new RemoteAIService({
|
|
64
|
-
apiEndpoint: 'https://your-lambda-api.execute-api.region.amazonaws.com/prod'
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const wizard = new AIEnhancedInstallationWizard(apiKey, projectPath, aiService);
|
|
68
|
-
const result = await wizard.install();
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### CLI Usage
|
|
72
|
-
```bash
|
|
73
|
-
# Traditional installation
|
|
74
|
-
npx humanbehavior-js auto-install YOUR_API_KEY
|
|
75
|
-
|
|
76
|
-
# AI-enhanced installation
|
|
77
|
-
npx humanbehavior-js ai-auto-install YOUR_API_KEY --ai
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## 🧠 AI Features
|
|
81
|
-
|
|
82
|
-
- **Intelligent Framework Detection**: Beyond package.json analysis
|
|
83
|
-
- **Code Pattern Analysis**: Understands project structure and patterns
|
|
84
|
-
- **Conflict Resolution**: Smart handling of existing integrations
|
|
85
|
-
- **Future-Proofing**: Adaptive strategies for new frameworks
|
|
86
|
-
- **Learning System**: Improves over time with usage patterns
|
|
87
|
-
|
|
88
|
-
## 🔄 Backward Compatibility
|
|
89
|
-
|
|
90
|
-
All existing imports continue to work:
|
|
91
|
-
- `humanbehavior-js/install-wizard` → `humanbehavior-js/wizard`
|
|
92
|
-
- Traditional wizard functionality unchanged
|
|
93
|
-
- AI features are additive, not breaking
|
|
94
|
-
|
|
95
|
-
## 🚀 Lambda Deployment
|
|
96
|
-
|
|
97
|
-
The `lambda-deployment/` directory contains the AI service for AWS Lambda deployment. This is separate from the client-side wizard code and should not be modified unless deploying AI service updates.
|
|
98
|
-
|
|
99
|
-
### 📁 Lambda Deployment Structure
|
|
100
|
-
```
|
|
101
|
-
lambda-deployment/
|
|
102
|
-
├── index.js # Lambda entry point
|
|
103
|
-
├── ai-install-wizard.ts # AI service implementation
|
|
104
|
-
├── install-wizard.ts # Core wizard logic
|
|
105
|
-
├── centralized-ai-service.ts # AI service interface
|
|
106
|
-
└── README.md # Deployment documentation
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 🔗 Client-Server Relationship
|
|
110
|
-
- **Client**: `src/wizard/` - User-facing installation wizard
|
|
111
|
-
- **Server**: `lambda-deployment/` - AI service backend
|
|
112
|
-
- **Connection**: `RemoteAIService` connects client to Lambda
|
|
113
|
-
|
|
114
|
-
See `lambda-deployment/README.md` for detailed deployment instructions.
|