liferewind 0.1.4 → 0.1.6
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/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +20 -2
- package/dist/cli/detect/git.d.ts +6 -0
- package/dist/cli/detect/git.d.ts.map +1 -1
- package/dist/cli/detect/git.js +18 -0
- package/dist/cli/detect/index.d.ts +1 -1
- package/dist/cli/detect/index.d.ts.map +1 -1
- package/dist/cli/detect/index.js +1 -1
- package/dist/sources/filesystem/scanner.d.ts.map +1 -1
- package/dist/sources/filesystem/scanner.js +30 -0
- package/package.json +1 -1
|
@@ -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;AA+BpC,eAAO,MAAM,WAAW,
|
|
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,SAiRpB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
4
|
import { confirm, select, checkbox, input } from '@inquirer/prompts';
|
|
5
|
-
import { detectInstalledBrowsers, detectGitInstalled, detectChatbotClients } from '../detect/index.js';
|
|
5
|
+
import { detectInstalledBrowsers, detectGitInstalled, detectChatbotClients, getGitUserInfo } from '../detect/index.js';
|
|
6
6
|
import { writeConfig } from '../../config/writer.js';
|
|
7
7
|
import { getUserConfigPath } from '../../config/paths.js';
|
|
8
8
|
import { printBanner, printSection, printSuccess, printInfo, printDim, printWarning } from '../utils/output.js';
|
|
@@ -94,7 +94,11 @@ export const initCommand = new Command('init')
|
|
|
94
94
|
// Step 3: Git Commits
|
|
95
95
|
printSection('Step 3/6: Git Commits');
|
|
96
96
|
const gitInstalled = detectGitInstalled();
|
|
97
|
+
const gitUser = getGitUserInfo();
|
|
97
98
|
printDim(gitInstalled ? ' Git is installed' : ' Git not found');
|
|
99
|
+
if (gitUser.email) {
|
|
100
|
+
printDim(` User: ${gitUser.name || 'unknown'} <${gitUser.email}>`);
|
|
101
|
+
}
|
|
98
102
|
const enableGit = await confirm({
|
|
99
103
|
message: 'Enable git commit collection?',
|
|
100
104
|
default: true,
|
|
@@ -105,6 +109,17 @@ export const initCommand = new Command('init')
|
|
|
105
109
|
printWarning('No paths selected, git collection will be disabled.');
|
|
106
110
|
}
|
|
107
111
|
else {
|
|
112
|
+
// Ask about author filtering
|
|
113
|
+
let authors;
|
|
114
|
+
if (gitUser.email) {
|
|
115
|
+
const filterByAuthor = await confirm({
|
|
116
|
+
message: `Only collect your commits? (filter by ${gitUser.email})`,
|
|
117
|
+
default: true,
|
|
118
|
+
});
|
|
119
|
+
if (filterByAuthor) {
|
|
120
|
+
authors = [gitUser.email];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
108
123
|
const gitSchedule = await select({
|
|
109
124
|
message: 'Collection schedule:',
|
|
110
125
|
choices: SCHEDULE_CHOICES_WITH_HINT,
|
|
@@ -117,6 +132,7 @@ export const initCommand = new Command('init')
|
|
|
117
132
|
options: {
|
|
118
133
|
...DEFAULT_SOURCES.git.options,
|
|
119
134
|
scanPaths,
|
|
135
|
+
...(authors && { authors }),
|
|
120
136
|
},
|
|
121
137
|
};
|
|
122
138
|
}
|
|
@@ -212,7 +228,9 @@ export const initCommand = new Command('init')
|
|
|
212
228
|
console.log(` API: ${config.api.baseUrl}`);
|
|
213
229
|
console.log(' Sources enabled:');
|
|
214
230
|
console.log(` ${config.sources.browser.enabled ? '✓' : '✗'} Browser`);
|
|
215
|
-
|
|
231
|
+
const gitAuthors = config.sources.git.options.authors;
|
|
232
|
+
const gitAuthorInfo = gitAuthors?.length ? ` (author: ${gitAuthors[0]})` : '';
|
|
233
|
+
console.log(` ${config.sources.git.enabled ? '✓' : '✗'} Git${config.sources.git.enabled ? gitAuthorInfo : ''}`);
|
|
216
234
|
console.log(` ${config.sources.filesystem.enabled ? '✓' : '✗'} Filesystem`);
|
|
217
235
|
console.log(` ${config.sources.chatbot.enabled ? '✓' : '✗'} Chatbot`);
|
|
218
236
|
const shouldSave = await confirm({
|
package/dist/cli/detect/git.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare function detectGitInstalled(): boolean;
|
|
2
|
+
export interface GitUserInfo {
|
|
3
|
+
name: string | null;
|
|
4
|
+
email: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** Get the current git user configuration (user.name and user.email) */
|
|
7
|
+
export declare function getGitUserInfo(): GitUserInfo;
|
|
2
8
|
//# sourceMappingURL=git.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/cli/detect/git.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C"}
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/cli/detect/git.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wEAAwE;AACxE,wBAAgB,cAAc,IAAI,WAAW,CAiB5C"}
|
package/dist/cli/detect/git.js
CHANGED
|
@@ -8,3 +8,21 @@ export function detectGitInstalled() {
|
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/** Get the current git user configuration (user.name and user.email) */
|
|
12
|
+
export function getGitUserInfo() {
|
|
13
|
+
let name = null;
|
|
14
|
+
let email = null;
|
|
15
|
+
try {
|
|
16
|
+
name = execSync('git config user.name', { encoding: 'utf-8' }).trim() || null;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Not configured
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
email = execSync('git config user.email', { encoding: 'utf-8' }).trim() || null;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Not configured
|
|
26
|
+
}
|
|
27
|
+
return { name, email };
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { detectInstalledBrowsers, type BrowserType } from './browsers.js';
|
|
2
|
-
export { detectGitInstalled } from './git.js';
|
|
2
|
+
export { detectGitInstalled, getGitUserInfo, type GitUserInfo } from './git.js';
|
|
3
3
|
export { detectChatbotClients, type ChatbotClient } from './chatbot.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/detect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/detect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/cli/detect/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/sources/filesystem/scanner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/sources/filesystem/scanner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAyK1E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,cAAc,CAAS;gBAEnB,OAAO,EAAE,cAAc;IAMnC,6CAA6C;IAC7C,OAAO,CAAC,UAAU;IAMlB,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB;IAQxB,uCAAuC;IACvC,OAAO,CAAC,WAAW;IAInB,yCAAyC;IACzC,OAAO,CAAC,iBAAiB;IAezB,0CAA0C;IAC1C,OAAO,CAAC,aAAa;IA4ErB,sCAAsC;IACtC,IAAI,IAAI,cAAc,EAAE;CAiCzB"}
|
|
@@ -21,6 +21,32 @@ const TEXT_EXTENSIONS = new Set([
|
|
|
21
21
|
]);
|
|
22
22
|
/** Maximum characters to include in content preview */
|
|
23
23
|
const CONTENT_PREVIEW_LENGTH = 500;
|
|
24
|
+
/** Check if a filename is a temporary or hidden file that should be skipped */
|
|
25
|
+
function isTemporaryOrHiddenFile(fileName) {
|
|
26
|
+
// Hidden files (start with .)
|
|
27
|
+
if (fileName.startsWith('.'))
|
|
28
|
+
return true;
|
|
29
|
+
// Microsoft Office temporary files (~$xxx.docx, ~WRL0001.tmp)
|
|
30
|
+
if (fileName.startsWith('~$') || fileName.startsWith('~WRL'))
|
|
31
|
+
return true;
|
|
32
|
+
// General temporary files starting with ~
|
|
33
|
+
if (fileName.startsWith('~') && !fileName.endsWith('.md'))
|
|
34
|
+
return true;
|
|
35
|
+
// macOS temporary files (.DS_Store already caught by hidden check)
|
|
36
|
+
// Windows temporary files
|
|
37
|
+
if (fileName.endsWith('.tmp') || fileName.endsWith('.temp'))
|
|
38
|
+
return true;
|
|
39
|
+
// Backup files
|
|
40
|
+
if (fileName.endsWith('~') || fileName.endsWith('.bak'))
|
|
41
|
+
return true;
|
|
42
|
+
// Lock files
|
|
43
|
+
if (fileName.endsWith('.lock') || fileName.endsWith('.lck'))
|
|
44
|
+
return true;
|
|
45
|
+
// Swap files (vim, etc.)
|
|
46
|
+
if (fileName.endsWith('.swp') || fileName.endsWith('.swo'))
|
|
47
|
+
return true;
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
24
50
|
/** MIME type mapping for common document formats */
|
|
25
51
|
const MIME_MAP = {
|
|
26
52
|
// Text & Markdown
|
|
@@ -181,6 +207,10 @@ export class FilesystemScanner {
|
|
|
181
207
|
}
|
|
182
208
|
for (const entry of entries) {
|
|
183
209
|
const fullPath = resolve(dirPath, entry.name);
|
|
210
|
+
// Skip hidden and temporary files/directories
|
|
211
|
+
if (isTemporaryOrHiddenFile(entry.name)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
184
214
|
// Check exclusion patterns
|
|
185
215
|
if (this.isExcluded(fullPath)) {
|
|
186
216
|
continue;
|
package/package.json
CHANGED