liferewind 0.1.6 → 0.1.8
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/dist/api/client.d.ts +2 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +31 -12
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +6 -0
- package/dist/config/schema.d.ts +10 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +6 -0
- package/dist/core/collector.d.ts.map +1 -1
- package/dist/core/collector.js +4 -1
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { CollectionResult } from '../core/types.js';
|
|
3
3
|
import type { Logger } from '../utils/logger.js';
|
|
4
|
+
import type { DeviceConfig } from '../config/schema.js';
|
|
4
5
|
export interface ApiClientConfig {
|
|
5
6
|
baseUrl: string;
|
|
6
7
|
apiKey: string;
|
|
7
8
|
timeout: number;
|
|
8
9
|
retryAttempts: number;
|
|
10
|
+
device: DeviceConfig;
|
|
9
11
|
}
|
|
10
12
|
declare const pushResponseSchema: z.ZodObject<{
|
|
11
13
|
success: z.ZodLiteral<true>;
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,QAAA,MAAM,kBAAkB;;;;;;;iBAOtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAO9D,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAQ;IAE1C,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM;IAK7C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAQzD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YAWvB,aAAa;YA4Db,SAAS;IAyCvB,OAAO,CAAC,gBAAgB;CAOzB"}
|
package/dist/api/client.js
CHANGED
|
@@ -84,6 +84,8 @@ export class ApiClient {
|
|
|
84
84
|
'X-Source-Type': result.sourceType,
|
|
85
85
|
},
|
|
86
86
|
body: JSON.stringify({
|
|
87
|
+
deviceId: this.config.device.id,
|
|
88
|
+
deviceName: this.config.device.name,
|
|
87
89
|
sourceType: result.sourceType,
|
|
88
90
|
collectedAt: result.collectedAt.toISOString(),
|
|
89
91
|
items: result.items,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqCpC,eAAO,MAAM,WAAW,SAgSpB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { hostname } from 'node:os';
|
|
4
6
|
import { confirm, select, checkbox, input } from '@inquirer/prompts';
|
|
5
7
|
import { detectInstalledBrowsers, detectGitInstalled, detectChatbotClients, getGitUserInfo } from '../detect/index.js';
|
|
6
8
|
import { writeConfig } from '../../config/writer.js';
|
|
@@ -12,6 +14,10 @@ import { DEFAULT_SOURCES } from '../../config/schema.js';
|
|
|
12
14
|
/** Create initial config with all sources disabled */
|
|
13
15
|
function createInitialConfig() {
|
|
14
16
|
return {
|
|
17
|
+
device: {
|
|
18
|
+
id: randomUUID(),
|
|
19
|
+
name: undefined,
|
|
20
|
+
},
|
|
15
21
|
api: { baseUrl: '', apiKey: '', timeout: 30000, retryAttempts: 3 },
|
|
16
22
|
sources: {
|
|
17
23
|
git: { ...DEFAULT_SOURCES.git, enabled: false, options: { ...DEFAULT_SOURCES.git.options, scanPaths: [] } },
|
|
@@ -41,12 +47,24 @@ export const initCommand = new Command('init')
|
|
|
41
47
|
}
|
|
42
48
|
printBanner();
|
|
43
49
|
const config = createInitialConfig();
|
|
44
|
-
// Step 1:
|
|
45
|
-
printSection('Step 1/
|
|
50
|
+
// Step 1: Device Configuration
|
|
51
|
+
printSection('Step 1/7: Device Configuration');
|
|
52
|
+
printDim(` Device ID: ${config.device.id}`);
|
|
53
|
+
printDim(` Hostname: ${hostname()}`);
|
|
54
|
+
console.log();
|
|
55
|
+
const deviceName = await input({
|
|
56
|
+
message: 'Device name (for identification):',
|
|
57
|
+
default: hostname(),
|
|
58
|
+
});
|
|
59
|
+
if (deviceName.trim()) {
|
|
60
|
+
config.device.name = deviceName.trim();
|
|
61
|
+
}
|
|
62
|
+
// Step 2: API Configuration
|
|
63
|
+
printSection('Step 2/7: API Configuration');
|
|
46
64
|
config.api.baseUrl = await inputApiUrl();
|
|
47
65
|
config.api.apiKey = await inputApiKey();
|
|
48
|
-
// Step
|
|
49
|
-
printSection('Step
|
|
66
|
+
// Step 3: Browser History
|
|
67
|
+
printSection('Step 3/7: Browser History');
|
|
50
68
|
const detectedBrowsers = detectInstalledBrowsers();
|
|
51
69
|
if (detectedBrowsers.length > 0) {
|
|
52
70
|
printDim(` Detected: ${detectedBrowsers.join(', ')}`);
|
|
@@ -91,8 +109,8 @@ export const initCommand = new Command('init')
|
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
111
|
}
|
|
94
|
-
// Step
|
|
95
|
-
printSection('Step
|
|
112
|
+
// Step 4: Git Commits
|
|
113
|
+
printSection('Step 4/7: Git Commits');
|
|
96
114
|
const gitInstalled = detectGitInstalled();
|
|
97
115
|
const gitUser = getGitUserInfo();
|
|
98
116
|
printDim(gitInstalled ? ' Git is installed' : ' Git not found');
|
|
@@ -137,8 +155,8 @@ export const initCommand = new Command('init')
|
|
|
137
155
|
};
|
|
138
156
|
}
|
|
139
157
|
}
|
|
140
|
-
// Step
|
|
141
|
-
printSection('Step
|
|
158
|
+
// Step 5: Filesystem
|
|
159
|
+
printSection('Step 5/7: Filesystem Changes');
|
|
142
160
|
const enableFilesystem = await confirm({
|
|
143
161
|
message: 'Enable filesystem monitoring?',
|
|
144
162
|
default: true,
|
|
@@ -165,8 +183,8 @@ export const initCommand = new Command('init')
|
|
|
165
183
|
};
|
|
166
184
|
}
|
|
167
185
|
}
|
|
168
|
-
// Step
|
|
169
|
-
printSection('Step
|
|
186
|
+
// Step 6: Chatbot
|
|
187
|
+
printSection('Step 6/7: Chatbot History');
|
|
170
188
|
const detectedChatbots = detectChatbotClients();
|
|
171
189
|
if (detectedChatbots.length > 0) {
|
|
172
190
|
printDim(` Detected: ${detectedChatbots.join(', ')}`);
|
|
@@ -188,8 +206,8 @@ export const initCommand = new Command('init')
|
|
|
188
206
|
},
|
|
189
207
|
};
|
|
190
208
|
}
|
|
191
|
-
// Step
|
|
192
|
-
printSection('Step
|
|
209
|
+
// Step 7: Initial Collection Settings
|
|
210
|
+
printSection('Step 7/7: Initial Collection');
|
|
193
211
|
printDim(' Configure how far back to collect data on the first run.');
|
|
194
212
|
printDim(' Daily collection uses a shorter range (2 days by default).');
|
|
195
213
|
console.log();
|
|
@@ -225,6 +243,7 @@ export const initCommand = new Command('init')
|
|
|
225
243
|
}
|
|
226
244
|
}
|
|
227
245
|
printSection('Configuration Summary');
|
|
246
|
+
console.log(` Device: ${config.device.name || 'unnamed'} (${config.device.id.slice(0, 8)}...)`);
|
|
228
247
|
console.log(` API: ${config.api.baseUrl}`);
|
|
229
248
|
console.log(' Sources enabled:');
|
|
230
249
|
console.log(` ${config.sources.browser.enabled ? '✓' : '✗'} Browser`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAGjE,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAuD/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQjE"}
|
package/dist/config/loader.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { hostname } from 'node:os';
|
|
2
4
|
import { ZodError } from 'zod';
|
|
3
5
|
import { configSchema } from './schema.js';
|
|
4
6
|
import { getAllConfigPaths } from './paths.js';
|
|
@@ -32,6 +34,10 @@ export function loadConfig(customPath) {
|
|
|
32
34
|
if (envApiUrl && envApiKey) {
|
|
33
35
|
try {
|
|
34
36
|
return configSchema.parse({
|
|
37
|
+
device: {
|
|
38
|
+
id: process.env['LIFEREWIND_DEVICE_ID'] || randomUUID(),
|
|
39
|
+
name: process.env['LIFEREWIND_DEVICE_NAME'] || hostname(),
|
|
40
|
+
},
|
|
35
41
|
api: {
|
|
36
42
|
baseUrl: envApiUrl,
|
|
37
43
|
apiKey: envApiKey,
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -43,7 +43,15 @@ export declare const DEFAULT_SOURCES: {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
+
declare const deviceSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
46
50
|
export declare const configSchema: z.ZodObject<{
|
|
51
|
+
device: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
name: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>;
|
|
47
55
|
api: z.ZodObject<{
|
|
48
56
|
baseUrl: z.ZodURL;
|
|
49
57
|
apiKey: z.ZodString;
|
|
@@ -140,4 +148,6 @@ export declare const configSchema: z.ZodObject<{
|
|
|
140
148
|
}, z.core.$strip>>;
|
|
141
149
|
}, z.core.$strip>;
|
|
142
150
|
export type CollectorConfig = z.infer<typeof configSchema>;
|
|
151
|
+
export type DeviceConfig = z.infer<typeof deviceSchema>;
|
|
152
|
+
export {};
|
|
143
153
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2ExB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCa,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2ExB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCa,CAAC;AAG1C,QAAA,MAAM,YAAY;;;iBAGhB,CAAC;AAYH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUvB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
package/dist/config/schema.js
CHANGED
|
@@ -96,6 +96,11 @@ export const DEFAULT_SOURCES = {
|
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
98
|
};
|
|
99
|
+
// Device config
|
|
100
|
+
const deviceSchema = z.object({
|
|
101
|
+
id: z.string().uuid(),
|
|
102
|
+
name: z.string().optional(),
|
|
103
|
+
});
|
|
99
104
|
// Logging config
|
|
100
105
|
const loggingSchema = z.object({
|
|
101
106
|
level: z.enum(['debug', 'info', 'warn', 'error']),
|
|
@@ -105,6 +110,7 @@ const DEFAULT_LOGGING = {
|
|
|
105
110
|
};
|
|
106
111
|
// Main config schema
|
|
107
112
|
export const configSchema = z.object({
|
|
113
|
+
device: deviceSchema,
|
|
108
114
|
api: z.object({
|
|
109
115
|
baseUrl: z.url(),
|
|
110
116
|
apiKey: z.string().min(1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/core/collector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAA0C;gBAE7C,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/core/collector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAA0C;gBAE7C,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM;IAa7C,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA4B7E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAItF,iBAAiB,IAAI,UAAU,EAAE;CAGlC"}
|
package/dist/core/collector.js
CHANGED
|
@@ -11,7 +11,10 @@ export class Collector {
|
|
|
11
11
|
this.config = config;
|
|
12
12
|
this.logger = logger;
|
|
13
13
|
this.scheduler = new Scheduler(logger);
|
|
14
|
-
this.apiClient = new ApiClient(
|
|
14
|
+
this.apiClient = new ApiClient({
|
|
15
|
+
...config.api,
|
|
16
|
+
device: config.device,
|
|
17
|
+
}, logger);
|
|
15
18
|
}
|
|
16
19
|
async validateSources() {
|
|
17
20
|
const context = { logger: this.logger };
|
package/package.json
CHANGED