liferewind 0.1.2 → 0.1.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/collect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,cAAc,SAyDvB,CAAC"}
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/collect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,eAAO,MAAM,cAAc,SAiEvB,CAAC"}
@@ -14,19 +14,58 @@ function showSkippedInfo(result, verbose) {
14
14
  console.log(` - ${item.path} (${item.reason})`);
15
15
  }
16
16
  }
17
+ /** Apply initialSinceDays to sinceDays for initial collection */
18
+ function applyInitialSinceDays(config) {
19
+ return {
20
+ ...config,
21
+ sources: {
22
+ git: config.sources.git.options.initialSinceDays
23
+ ? {
24
+ ...config.sources.git,
25
+ options: { ...config.sources.git.options, sinceDays: config.sources.git.options.initialSinceDays },
26
+ }
27
+ : config.sources.git,
28
+ browser: config.sources.browser.options.initialSinceDays
29
+ ? {
30
+ ...config.sources.browser,
31
+ options: { ...config.sources.browser.options, sinceDays: config.sources.browser.options.initialSinceDays },
32
+ }
33
+ : config.sources.browser,
34
+ filesystem: config.sources.filesystem.options.initialSinceDays
35
+ ? {
36
+ ...config.sources.filesystem,
37
+ options: { ...config.sources.filesystem.options, sinceDays: config.sources.filesystem.options.initialSinceDays },
38
+ }
39
+ : config.sources.filesystem,
40
+ chatbot: config.sources.chatbot.options.initialSinceDays
41
+ ? {
42
+ ...config.sources.chatbot,
43
+ options: { ...config.sources.chatbot.options, sinceDays: config.sources.chatbot.options.initialSinceDays },
44
+ }
45
+ : config.sources.chatbot,
46
+ },
47
+ };
48
+ }
17
49
  export const collectCommand = new Command('collect')
18
50
  .description('Manually trigger data collection')
19
51
  .argument('[source]', 'specific source to collect (git, browser, filesystem, chatbot)')
20
- .action(async (source, _options, cmd) => {
52
+ .option('-i, --initial', 'use extended time range for initial collection')
53
+ .action(async (source, options, cmd) => {
21
54
  const globalOpts = cmd.optsWithGlobals();
22
55
  const verbose = !!globalOpts.verbose;
56
+ const isInitial = !!options.initial;
23
57
  if (source && !SOURCE_TYPES.includes(source)) {
24
58
  printError(`Invalid source: ${source}`);
25
59
  console.log(`Valid sources: ${SOURCE_TYPES.join(', ')}`);
26
60
  process.exit(1);
27
61
  }
28
62
  try {
29
- const config = loadConfig(globalOpts.config);
63
+ let config = loadConfig(globalOpts.config);
64
+ // Apply initialSinceDays when --initial flag is used
65
+ if (isInitial) {
66
+ config = applyInitialSinceDays(config);
67
+ printInfo('Using extended time range for initial collection');
68
+ }
30
69
  let logLevel = config.logging.level;
31
70
  if (globalOpts.verbose)
32
71
  logLevel = 'debug';
@@ -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;AAgBpC,eAAO,MAAM,WAAW,SAqNpB,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;AA+BpC,eAAO,MAAM,WAAW,SA8PpB,CAAC"}
@@ -1,12 +1,27 @@
1
1
  import { Command } from 'commander';
2
2
  import { existsSync } from 'node:fs';
3
- import { confirm, select, checkbox } from '@inquirer/prompts';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { confirm, select, checkbox, input } from '@inquirer/prompts';
4
5
  import { detectInstalledBrowsers, detectGitInstalled, detectChatbotClients } from '../detect/index.js';
5
6
  import { writeConfig } from '../../config/writer.js';
6
7
  import { getUserConfigPath } from '../../config/paths.js';
7
8
  import { printBanner, printSection, printSuccess, printInfo, printDim, printWarning } from '../utils/output.js';
8
9
  import { SCHEDULE_CHOICES_WITH_HINT, GIT_PATH_PRESETS, FILESYSTEM_PATH_PRESETS, selectPaths, } from '../utils/prompts.js';
9
10
  import { inputApiUrl, inputApiKey } from '../utils/api.js';
11
+ import { DEFAULT_SOURCES } from '../../config/schema.js';
12
+ /** Create initial config with all sources disabled */
13
+ function createInitialConfig() {
14
+ return {
15
+ api: { baseUrl: '', apiKey: '', timeout: 30000, retryAttempts: 3 },
16
+ sources: {
17
+ git: { ...DEFAULT_SOURCES.git, enabled: false, options: { ...DEFAULT_SOURCES.git.options, scanPaths: [] } },
18
+ browser: { ...DEFAULT_SOURCES.browser, enabled: false, options: { ...DEFAULT_SOURCES.browser.options, browsers: [] } },
19
+ filesystem: { ...DEFAULT_SOURCES.filesystem, enabled: false, options: { ...DEFAULT_SOURCES.filesystem.options, watchPaths: [] } },
20
+ chatbot: { ...DEFAULT_SOURCES.chatbot, enabled: false, options: { ...DEFAULT_SOURCES.chatbot.options, clients: [] } },
21
+ },
22
+ logging: { level: 'info' },
23
+ };
24
+ }
10
25
  export const initCommand = new Command('init')
11
26
  .description('Initialize configuration with interactive wizard')
12
27
  .option('--force', 'overwrite existing configuration')
@@ -25,31 +40,13 @@ export const initCommand = new Command('init')
25
40
  }
26
41
  }
27
42
  printBanner();
28
- const config = {
29
- api: { baseUrl: '', apiKey: '', timeout: 30000, retryAttempts: 3 },
30
- sources: {
31
- git: { enabled: false, schedule: 'daily', options: { scanPaths: [], sinceDays: 30 } },
32
- browser: { enabled: false, schedule: 'daily', options: { browsers: [], excludeDomains: [], sinceDays: 7 } },
33
- filesystem: {
34
- enabled: false,
35
- schedule: 'daily',
36
- options: {
37
- watchPaths: [],
38
- excludePatterns: ['**/node_modules/**', '**/.git/**', '**/Library/**'],
39
- sinceDays: 7,
40
- includeContent: true,
41
- },
42
- },
43
- chatbot: { enabled: false, schedule: 'daily', options: { clients: [], sinceDays: 30, includeContent: true } },
44
- },
45
- logging: { level: 'info' },
46
- };
43
+ const config = createInitialConfig();
47
44
  // Step 1: API Configuration
48
- printSection('Step 1/5: API Configuration');
45
+ printSection('Step 1/6: API Configuration');
49
46
  config.api.baseUrl = await inputApiUrl();
50
47
  config.api.apiKey = await inputApiKey();
51
48
  // Step 2: Browser History
52
- printSection('Step 2/5: Browser History');
49
+ printSection('Step 2/6: Browser History');
53
50
  const detectedBrowsers = detectInstalledBrowsers();
54
51
  if (detectedBrowsers.length > 0) {
55
52
  printDim(` Detected: ${detectedBrowsers.join(', ')}`);
@@ -87,15 +84,15 @@ export const initCommand = new Command('init')
87
84
  enabled: true,
88
85
  schedule: browserSchedule,
89
86
  options: {
87
+ ...DEFAULT_SOURCES.browser.options,
90
88
  browsers: selectedBrowsers,
91
89
  excludeDomains: ['localhost', '127.0.0.1'],
92
- sinceDays: 7,
93
90
  },
94
91
  };
95
92
  }
96
93
  }
97
94
  // Step 3: Git Commits
98
- printSection('Step 3/5: Git Commits');
95
+ printSection('Step 3/6: Git Commits');
99
96
  const gitInstalled = detectGitInstalled();
100
97
  printDim(gitInstalled ? ' Git is installed' : ' Git not found');
101
98
  const enableGit = await confirm({
@@ -118,14 +115,14 @@ export const initCommand = new Command('init')
118
115
  enabled: true,
119
116
  schedule: gitSchedule,
120
117
  options: {
118
+ ...DEFAULT_SOURCES.git.options,
121
119
  scanPaths,
122
- sinceDays: 30,
123
120
  },
124
121
  };
125
122
  }
126
123
  }
127
124
  // Step 4: Filesystem
128
- printSection('Step 4/5: Filesystem Changes');
125
+ printSection('Step 4/6: Filesystem Changes');
129
126
  const enableFilesystem = await confirm({
130
127
  message: 'Enable filesystem monitoring?',
131
128
  default: true,
@@ -146,16 +143,14 @@ export const initCommand = new Command('init')
146
143
  enabled: true,
147
144
  schedule: fsSchedule,
148
145
  options: {
146
+ ...DEFAULT_SOURCES.filesystem.options,
149
147
  watchPaths,
150
- excludePatterns: ['**/node_modules/**', '**/.git/**', '**/Library/**'],
151
- sinceDays: 7,
152
- includeContent: true,
153
148
  },
154
149
  };
155
150
  }
156
151
  }
157
152
  // Step 5: Chatbot
158
- printSection('Step 5/5: Chatbot History');
153
+ printSection('Step 5/6: Chatbot History');
159
154
  const detectedChatbots = detectChatbotClients();
160
155
  if (detectedChatbots.length > 0) {
161
156
  printDim(` Detected: ${detectedChatbots.join(', ')}`);
@@ -172,12 +167,47 @@ export const initCommand = new Command('init')
172
167
  enabled: true,
173
168
  schedule: 'daily',
174
169
  options: {
170
+ ...DEFAULT_SOURCES.chatbot.options,
175
171
  clients: detectedChatbots.length > 0 ? detectedChatbots : ['chatwise'],
176
- sinceDays: 30,
177
- includeContent: true,
178
172
  },
179
173
  };
180
174
  }
175
+ // Step 6: Initial Collection Settings
176
+ printSection('Step 6/6: Initial Collection');
177
+ printDim(' Configure how far back to collect data on the first run.');
178
+ printDim(' Daily collection uses a shorter range (2 days by default).');
179
+ console.log();
180
+ const customizeInitial = await confirm({
181
+ message: 'Customize initial collection range?',
182
+ default: false,
183
+ });
184
+ if (customizeInitial) {
185
+ const initialDaysInput = await input({
186
+ message: 'Days to collect on first run (applies to all sources):',
187
+ default: '90',
188
+ validate: (value) => {
189
+ const num = parseInt(value, 10);
190
+ if (isNaN(num) || num < 1 || num > 365) {
191
+ return 'Please enter a number between 1 and 365';
192
+ }
193
+ return true;
194
+ },
195
+ });
196
+ const initialDays = parseInt(initialDaysInput, 10);
197
+ // Apply to all enabled sources
198
+ if (config.sources.git.enabled) {
199
+ config.sources.git.options.initialSinceDays = initialDays;
200
+ }
201
+ if (config.sources.browser.enabled) {
202
+ config.sources.browser.options.initialSinceDays = initialDays;
203
+ }
204
+ if (config.sources.filesystem.enabled) {
205
+ config.sources.filesystem.options.initialSinceDays = initialDays;
206
+ }
207
+ if (config.sources.chatbot.enabled) {
208
+ config.sources.chatbot.options.initialSinceDays = initialDays;
209
+ }
210
+ }
181
211
  printSection('Configuration Summary');
182
212
  console.log(` API: ${config.api.baseUrl}`);
183
213
  console.log(' Sources enabled:');
@@ -192,12 +222,30 @@ export const initCommand = new Command('init')
192
222
  if (shouldSave) {
193
223
  writeConfig(config, configPath);
194
224
  printSuccess('Configuration saved!');
195
- console.log(`
225
+ const runInitialCollection = await confirm({
226
+ message: 'Run initial collection now? (uses extended time range)',
227
+ default: true,
228
+ });
229
+ if (runInitialCollection) {
230
+ console.log();
231
+ printInfo('Starting initial collection...');
232
+ console.log();
233
+ const result = spawnSync(process.execPath, [process.argv[1], 'collect', '--initial'], {
234
+ stdio: 'inherit',
235
+ cwd: process.cwd(),
236
+ });
237
+ if (result.status !== 0) {
238
+ printWarning('Initial collection encountered issues. You can retry with: liferewind collect --initial');
239
+ }
240
+ }
241
+ else {
242
+ console.log(`
196
243
  Next steps:
197
- Run 'liferewind start' to begin collecting data
198
- Run 'liferewind collect' for immediate collection
244
+ Run 'liferewind collect --initial' for first-time collection (extended range)
245
+ Run 'liferewind start' to begin scheduled collection
199
246
  Run 'liferewind config edit' to modify settings
200
247
  `);
248
+ }
201
249
  }
202
250
  else {
203
251
  printInfo('Configuration not saved.');
@@ -1,4 +1,48 @@
1
1
  import { z } from 'zod';
2
+ export declare const DEFAULT_SOURCES: {
3
+ git: {
4
+ enabled: true;
5
+ schedule: "daily";
6
+ options: {
7
+ scanPaths: never[];
8
+ excludeRepositories: never[];
9
+ sinceDays: number;
10
+ initialSinceDays: number;
11
+ };
12
+ };
13
+ browser: {
14
+ enabled: true;
15
+ schedule: "daily";
16
+ options: {
17
+ browsers: "chrome"[];
18
+ excludeDomains: never[];
19
+ sinceDays: number;
20
+ initialSinceDays: number;
21
+ };
22
+ };
23
+ filesystem: {
24
+ enabled: true;
25
+ schedule: "daily";
26
+ options: {
27
+ watchPaths: never[];
28
+ excludePatterns: string[];
29
+ fileTypes: string[];
30
+ sinceDays: number;
31
+ initialSinceDays: number;
32
+ includeContent: true;
33
+ };
34
+ };
35
+ chatbot: {
36
+ enabled: true;
37
+ schedule: "daily";
38
+ options: {
39
+ clients: "chatwise"[];
40
+ sinceDays: number;
41
+ initialSinceDays: number;
42
+ includeContent: true;
43
+ };
44
+ };
45
+ };
2
46
  export declare const configSchema: z.ZodObject<{
3
47
  api: z.ZodObject<{
4
48
  baseUrl: z.ZodURL;
@@ -21,6 +65,7 @@ export declare const configSchema: z.ZodObject<{
21
65
  excludeRepositories: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
66
  authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
67
  sinceDays: z.ZodNumber;
68
+ initialSinceDays: z.ZodOptional<z.ZodNumber>;
24
69
  }, z.core.$strip>;
25
70
  }, z.core.$strip>;
26
71
  browser: z.ZodObject<{
@@ -42,6 +87,7 @@ export declare const configSchema: z.ZodObject<{
42
87
  }>>;
43
88
  excludeDomains: z.ZodArray<z.ZodString>;
44
89
  sinceDays: z.ZodNumber;
90
+ initialSinceDays: z.ZodOptional<z.ZodNumber>;
45
91
  }, z.core.$strip>;
46
92
  }, z.core.$strip>;
47
93
  filesystem: z.ZodObject<{
@@ -57,7 +103,8 @@ export declare const configSchema: z.ZodObject<{
57
103
  watchPaths: z.ZodArray<z.ZodString>;
58
104
  excludePatterns: z.ZodArray<z.ZodString>;
59
105
  fileTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- sinceDays: z.ZodDefault<z.ZodNumber>;
106
+ sinceDays: z.ZodNumber;
107
+ initialSinceDays: z.ZodOptional<z.ZodNumber>;
61
108
  maxFileSize: z.ZodOptional<z.ZodNumber>;
62
109
  includeContent: z.ZodDefault<z.ZodBoolean>;
63
110
  }, z.core.$strip>;
@@ -75,7 +122,8 @@ export declare const configSchema: z.ZodObject<{
75
122
  clients: z.ZodArray<z.ZodEnum<{
76
123
  chatwise: "chatwise";
77
124
  }>>;
78
- sinceDays: z.ZodDefault<z.ZodNumber>;
125
+ sinceDays: z.ZodNumber;
126
+ initialSinceDays: z.ZodOptional<z.ZodNumber>;
79
127
  includeContent: z.ZodDefault<z.ZodBoolean>;
80
128
  maxMessagesPerChat: z.ZodOptional<z.ZodNumber>;
81
129
  excludeModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -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;AAkHxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASvB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,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;AAY1C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASvB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -6,6 +6,7 @@ const gitOptionsSchema = z.object({
6
6
  excludeRepositories: z.array(z.string()).optional(),
7
7
  authors: z.array(z.string()).optional(),
8
8
  sinceDays: z.number(),
9
+ initialSinceDays: z.number().optional(),
9
10
  });
10
11
  const gitSourceConfigSchema = z.object({
11
12
  enabled: z.boolean(),
@@ -17,6 +18,7 @@ const browserOptionsSchema = z.object({
17
18
  browsers: z.array(z.enum(['chrome', 'safari', 'arc', 'dia', 'comet'])),
18
19
  excludeDomains: z.array(z.string()),
19
20
  sinceDays: z.number(),
21
+ initialSinceDays: z.number().optional(),
20
22
  });
21
23
  const browserSourceConfigSchema = z.object({
22
24
  enabled: z.boolean(),
@@ -28,7 +30,8 @@ const filesystemOptionsSchema = z.object({
28
30
  watchPaths: z.array(z.string()),
29
31
  excludePatterns: z.array(z.string()),
30
32
  fileTypes: z.array(z.string()).optional(),
31
- sinceDays: z.number().default(7),
33
+ sinceDays: z.number(),
34
+ initialSinceDays: z.number().optional(),
32
35
  maxFileSize: z.number().optional(),
33
36
  includeContent: z.boolean().default(true),
34
37
  });
@@ -40,7 +43,8 @@ const filesystemSourceConfigSchema = z.object({
40
43
  // Chatbot source
41
44
  const chatbotOptionsSchema = z.object({
42
45
  clients: z.array(z.enum(['chatwise'])),
43
- sinceDays: z.number().default(30),
46
+ sinceDays: z.number(),
47
+ initialSinceDays: z.number().optional(),
44
48
  includeContent: z.boolean().default(true),
45
49
  maxMessagesPerChat: z.number().optional(),
46
50
  excludeModels: z.array(z.string()).optional(),
@@ -58,16 +62,16 @@ const sourcesSchema = z.object({
58
62
  chatbot: chatbotSourceConfigSchema,
59
63
  });
60
64
  // Default values defined once
61
- const DEFAULT_SOURCES = {
65
+ export const DEFAULT_SOURCES = {
62
66
  git: {
63
67
  enabled: true,
64
68
  schedule: 'daily',
65
- options: { scanPaths: [], excludeRepositories: [], sinceDays: 30 },
69
+ options: { scanPaths: [], excludeRepositories: [], sinceDays: 2, initialSinceDays: 90 },
66
70
  },
67
71
  browser: {
68
72
  enabled: true,
69
73
  schedule: 'daily',
70
- options: { browsers: ['chrome'], excludeDomains: [], sinceDays: 7 },
74
+ options: { browsers: ['chrome'], excludeDomains: [], sinceDays: 2, initialSinceDays: 30 },
71
75
  },
72
76
  filesystem: {
73
77
  enabled: true,
@@ -76,7 +80,8 @@ const DEFAULT_SOURCES = {
76
80
  watchPaths: [],
77
81
  excludePatterns: ['**/node_modules/**', '**/.git/**', '**/Library/**', '**/AppData/**'],
78
82
  fileTypes: ['.md', '.txt', '.docx', '.doc', '.pptx', '.ppt', '.xlsx', '.xls', '.pdf', '.pages', '.numbers', '.key'],
79
- sinceDays: 7,
83
+ sinceDays: 2,
84
+ initialSinceDays: 30,
80
85
  includeContent: true,
81
86
  },
82
87
  },
@@ -85,7 +90,8 @@ const DEFAULT_SOURCES = {
85
90
  schedule: 'daily',
86
91
  options: {
87
92
  clients: ['chatwise'],
88
- sinceDays: 30,
93
+ sinceDays: 2,
94
+ initialSinceDays: 90,
89
95
  includeContent: true,
90
96
  },
91
97
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liferewind",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "AI-powered personal life review tool - collect your digital footprints from git, browser history, documents, and AI chatbots",
5
5
  "keywords": [
6
6
  "cli",