Skip to content

Commit d962b9f

Browse files
📦 NEW: Handle gitignored files in git repo memory (#60)
* 📦 NEW: Handle gitignored files in git repo memory * 📦 NEW: Use git command to get non-ignored files * 📦 NEW: remove unused params
1 parent 6d5bbd2 commit d962b9f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎packages/baseai/src/utils/memory/load-memory-files.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getDocumentContent } from './get-document-content';
66
import { formatDocSize } from './lib';
77
import loadMemoryConfig from './load-memory-config';
88
import { memoryConfigSchema, type MemoryConfigI } from 'types/memory';
9+
import { execSync } from 'child_process';
910

1011
export interface MemoryDocumentI {
1112
name: string;
@@ -64,7 +65,11 @@ export const loadMemoryFilesFromCustomDir = async ({
6465

6566
let allFiles: string[];
6667
try {
67-
allFiles = await traverseDirectory(memoryFilesPath);
68+
allFiles = execSync(`git ls-files ${memoryFilesPath}`, {
69+
encoding: 'utf-8'
70+
})
71+
.split('\n')
72+
.filter(Boolean);
6873
} catch (error) {
6974
p.cancel(`Failed to read documents in memory '${memoryName}'.`);
7075
process.exit(1);

0 commit comments

Comments
 (0)