@prbe.ai/electron-sdk 0.1.9 → 0.1.10
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/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -699,7 +699,8 @@ var SearchContentTool = class {
|
|
|
699
699
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Regex pattern", required: true },
|
|
700
700
|
{ name: "path", type: "STRING" /* STRING */, description: "File or directory to search", required: true },
|
|
701
701
|
{ name: "context_lines", type: "INTEGER" /* INTEGER */, description: "Context lines (default 2)", required: false },
|
|
702
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
702
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
703
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive search (default false)", required: false }
|
|
703
704
|
]
|
|
704
705
|
};
|
|
705
706
|
}
|
|
@@ -712,9 +713,10 @@ var SearchContentTool = class {
|
|
|
712
713
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
713
714
|
const contextLines = typeof args["context_lines"] === "number" ? args["context_lines"] : 2;
|
|
714
715
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
716
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
715
717
|
let regex;
|
|
716
718
|
try {
|
|
717
|
-
regex = new RegExp(pattern);
|
|
719
|
+
regex = new RegExp(pattern, caseSensitive ? "" : "i");
|
|
718
720
|
} catch {
|
|
719
721
|
return `Error: invalid regex pattern '${pattern}'`;
|
|
720
722
|
}
|
|
@@ -802,7 +804,8 @@ var FindFilesTool = class {
|
|
|
802
804
|
parameters: [
|
|
803
805
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Glob pattern", required: true },
|
|
804
806
|
{ name: "path", type: "STRING" /* STRING */, description: "Directory to search", required: true },
|
|
805
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
807
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
808
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive matching (default false)", required: false }
|
|
806
809
|
]
|
|
807
810
|
};
|
|
808
811
|
}
|
|
@@ -814,8 +817,9 @@ var FindFilesTool = class {
|
|
|
814
817
|
const [resolved, resolveErr] = await resolvePath(pathStr, this.autoApprovedDirs, this.requester, this.grantedPaths);
|
|
815
818
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
816
819
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
820
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
817
821
|
const matches = [];
|
|
818
|
-
this.walkAndMatch(resolved, pattern, matches);
|
|
822
|
+
this.walkAndMatch(resolved, pattern, matches, caseSensitive);
|
|
819
823
|
matches.sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
820
824
|
const limited = matches.slice(0, maxResults);
|
|
821
825
|
if (limited.length === 0) {
|
|
@@ -832,7 +836,7 @@ var FindFilesTool = class {
|
|
|
832
836
|
}
|
|
833
837
|
return result;
|
|
834
838
|
}
|
|
835
|
-
walkAndMatch(dirPath, pattern, matches) {
|
|
839
|
+
walkAndMatch(dirPath, pattern, matches, caseSensitive) {
|
|
836
840
|
let entries;
|
|
837
841
|
try {
|
|
838
842
|
entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
@@ -843,9 +847,9 @@ var FindFilesTool = class {
|
|
|
843
847
|
if (entry.name.startsWith(".")) continue;
|
|
844
848
|
const fullPath = path2.join(dirPath, entry.name);
|
|
845
849
|
if (entry.isDirectory()) {
|
|
846
|
-
this.walkAndMatch(fullPath, pattern, matches);
|
|
850
|
+
this.walkAndMatch(fullPath, pattern, matches, caseSensitive);
|
|
847
851
|
} else if (entry.isFile()) {
|
|
848
|
-
if (this.globMatch(entry.name, pattern)) {
|
|
852
|
+
if (this.globMatch(entry.name, pattern, caseSensitive)) {
|
|
849
853
|
try {
|
|
850
854
|
const stat = fs.statSync(fullPath);
|
|
851
855
|
matches.push({
|
|
@@ -863,7 +867,7 @@ var FindFilesTool = class {
|
|
|
863
867
|
* Simple glob matching: supports *, ?, and character classes [...].
|
|
864
868
|
* Converts glob to regex and tests against the filename.
|
|
865
869
|
*/
|
|
866
|
-
globMatch(filename, pattern) {
|
|
870
|
+
globMatch(filename, pattern, caseSensitive) {
|
|
867
871
|
let regexStr = "^";
|
|
868
872
|
for (let i = 0; i < pattern.length; i++) {
|
|
869
873
|
const c = pattern[i];
|
|
@@ -901,7 +905,7 @@ var FindFilesTool = class {
|
|
|
901
905
|
}
|
|
902
906
|
regexStr += "$";
|
|
903
907
|
try {
|
|
904
|
-
return new RegExp(regexStr).test(filename);
|
|
908
|
+
return new RegExp(regexStr, caseSensitive ? "" : "i").test(filename);
|
|
905
909
|
} catch {
|
|
906
910
|
return false;
|
|
907
911
|
}
|