snow-ai 0.4.27 → 0.4.28
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/bundle/cli.mjs +16 -2
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -415895,9 +415895,19 @@ var init_FileList = __esm({
|
|
|
415895
415895
|
const effectiveMaxItems = (0, import_react85.useMemo)(() => {
|
|
415896
415896
|
return maxItems ? Math.min(maxItems, MAX_DISPLAY_ITEMS) : MAX_DISPLAY_ITEMS;
|
|
415897
415897
|
}, [maxItems]);
|
|
415898
|
+
const readGitignore = (0, import_react85.useCallback)(async () => {
|
|
415899
|
+
const gitignorePath = path36.join(rootPath, ".gitignore");
|
|
415900
|
+
try {
|
|
415901
|
+
const content = await fs29.promises.readFile(gitignorePath, "utf-8");
|
|
415902
|
+
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => line.replace(/\/$/, ""));
|
|
415903
|
+
} catch {
|
|
415904
|
+
return [];
|
|
415905
|
+
}
|
|
415906
|
+
}, [rootPath]);
|
|
415898
415907
|
const loadFiles = (0, import_react85.useCallback)(async () => {
|
|
415899
415908
|
const MAX_DEPTH = 5;
|
|
415900
415909
|
const MAX_FILES = 1e3;
|
|
415910
|
+
const gitignorePatterns = await readGitignore();
|
|
415901
415911
|
const getFilesRecursively = async (dir, depth = 0) => {
|
|
415902
415912
|
if (depth > MAX_DEPTH) {
|
|
415903
415913
|
return [];
|
|
@@ -415907,7 +415917,7 @@ var init_FileList = __esm({
|
|
|
415907
415917
|
withFileTypes: true
|
|
415908
415918
|
});
|
|
415909
415919
|
let result2 = [];
|
|
415910
|
-
const
|
|
415920
|
+
const baseIgnorePatterns = [
|
|
415911
415921
|
"node_modules",
|
|
415912
415922
|
"dist",
|
|
415913
415923
|
"build",
|
|
@@ -415930,6 +415940,10 @@ var init_FileList = __esm({
|
|
|
415930
415940
|
"env",
|
|
415931
415941
|
".env"
|
|
415932
415942
|
];
|
|
415943
|
+
const ignorePatterns = [
|
|
415944
|
+
...baseIgnorePatterns,
|
|
415945
|
+
...gitignorePatterns
|
|
415946
|
+
];
|
|
415933
415947
|
for (const entry of entries) {
|
|
415934
415948
|
if (result2.length >= MAX_FILES) {
|
|
415935
415949
|
break;
|
|
@@ -415970,7 +415984,7 @@ var init_FileList = __esm({
|
|
|
415970
415984
|
const fileList = await getFilesRecursively(rootPath);
|
|
415971
415985
|
setFiles(fileList);
|
|
415972
415986
|
setIsLoading(false);
|
|
415973
|
-
}, [rootPath]);
|
|
415987
|
+
}, [rootPath, readGitignore]);
|
|
415974
415988
|
const searchFileContent = (0, import_react85.useCallback)(async (query2) => {
|
|
415975
415989
|
if (!query2.trim()) {
|
|
415976
415990
|
return [];
|