fluxflow-cli 1.18.24 → 1.18.25
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/fluxflow.js +39 -21
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -4294,7 +4294,12 @@ import path13 from "path";
|
|
|
4294
4294
|
async function getFilesRecursively(dir, excludes, baseDir = dir, depth = 1) {
|
|
4295
4295
|
if (depth > 12) return [];
|
|
4296
4296
|
let results = [];
|
|
4297
|
-
|
|
4297
|
+
let list;
|
|
4298
|
+
try {
|
|
4299
|
+
list = await fs14.readdir(dir, { withFileTypes: true });
|
|
4300
|
+
} catch {
|
|
4301
|
+
return [];
|
|
4302
|
+
}
|
|
4298
4303
|
for (const file of list) {
|
|
4299
4304
|
const fullPath = path13.join(dir, file.name);
|
|
4300
4305
|
const relativePath = path13.relative(baseDir, fullPath);
|
|
@@ -4317,9 +4322,22 @@ var init_search_keyword = __esm({
|
|
|
4317
4322
|
search_keyword = async (args) => {
|
|
4318
4323
|
const { keyword, file } = parseArgs(args);
|
|
4319
4324
|
if (!keyword) return 'ERROR: Missing "keyword" argument.';
|
|
4320
|
-
const excludes = [
|
|
4325
|
+
const excludes = [
|
|
4326
|
+
"node_modules",
|
|
4327
|
+
".git",
|
|
4328
|
+
"dist",
|
|
4329
|
+
".next",
|
|
4330
|
+
".gemini",
|
|
4331
|
+
".exe",
|
|
4332
|
+
".dll",
|
|
4333
|
+
".png",
|
|
4334
|
+
".jpg",
|
|
4335
|
+
".jpeg",
|
|
4336
|
+
".gif",
|
|
4337
|
+
".zip",
|
|
4338
|
+
".tgz"
|
|
4339
|
+
];
|
|
4321
4340
|
const maxMatches = 150;
|
|
4322
|
-
let matches = [];
|
|
4323
4341
|
try {
|
|
4324
4342
|
let filesToSearch = [];
|
|
4325
4343
|
const rootDir = process.cwd();
|
|
@@ -4336,30 +4354,30 @@ var init_search_keyword = __esm({
|
|
|
4336
4354
|
} else {
|
|
4337
4355
|
filesToSearch = await getFilesRecursively(rootDir, excludes);
|
|
4338
4356
|
}
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
const displayPath = fileObj.relativePath.replace(/\\/g, "/");
|
|
4351
|
-
matches.push(`${displayPath} \u2192 ${i + 1}`);
|
|
4352
|
-
if (matches.length >= maxMatches) break;
|
|
4357
|
+
const searchPromises = filesToSearch.map(async (fileObj) => {
|
|
4358
|
+
try {
|
|
4359
|
+
const content = await fs14.readFile(fileObj.fullPath, "utf-8");
|
|
4360
|
+
if (content.includes("\0")) return [];
|
|
4361
|
+
const lines = content.split(/\r?\n/);
|
|
4362
|
+
const fileMatches = [];
|
|
4363
|
+
for (let i = 0; i < lines.length; i++) {
|
|
4364
|
+
if (lines[i].includes(keyword)) {
|
|
4365
|
+
const displayPath = fileObj.relativePath.replace(/\\/g, "/");
|
|
4366
|
+
fileMatches.push(`${displayPath} \u2192 ${i + 1}`);
|
|
4367
|
+
}
|
|
4353
4368
|
}
|
|
4369
|
+
return fileMatches;
|
|
4370
|
+
} catch {
|
|
4371
|
+
return [];
|
|
4354
4372
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4373
|
+
});
|
|
4374
|
+
const settledResults = await Promise.all(searchPromises);
|
|
4375
|
+
const matches = settledResults.flat().slice(0, maxMatches);
|
|
4358
4376
|
if (typeof global.gc === "function") {
|
|
4359
4377
|
global.gc();
|
|
4360
4378
|
}
|
|
4361
4379
|
if (matches.length === 0) {
|
|
4362
|
-
return `Found 0 matches for keyword: "${keyword}"${file ? ` in file: ${file}` : ""}`;
|
|
4380
|
+
return `Found 0 matches for keyword: "${keyword}"${file ? ` in file: ${file}` : ". Try to specify files"}`;
|
|
4363
4381
|
}
|
|
4364
4382
|
let output = `Found ${matches.length} matches:
|
|
4365
4383
|
|