@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.mjs
CHANGED
|
@@ -629,7 +629,8 @@ var SearchContentTool = class {
|
|
|
629
629
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Regex pattern", required: true },
|
|
630
630
|
{ name: "path", type: "STRING" /* STRING */, description: "File or directory to search", required: true },
|
|
631
631
|
{ name: "context_lines", type: "INTEGER" /* INTEGER */, description: "Context lines (default 2)", required: false },
|
|
632
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
632
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
633
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive search (default false)", required: false }
|
|
633
634
|
]
|
|
634
635
|
};
|
|
635
636
|
}
|
|
@@ -642,9 +643,10 @@ var SearchContentTool = class {
|
|
|
642
643
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
643
644
|
const contextLines = typeof args["context_lines"] === "number" ? args["context_lines"] : 2;
|
|
644
645
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
646
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
645
647
|
let regex;
|
|
646
648
|
try {
|
|
647
|
-
regex = new RegExp(pattern);
|
|
649
|
+
regex = new RegExp(pattern, caseSensitive ? "" : "i");
|
|
648
650
|
} catch {
|
|
649
651
|
return `Error: invalid regex pattern '${pattern}'`;
|
|
650
652
|
}
|
|
@@ -732,7 +734,8 @@ var FindFilesTool = class {
|
|
|
732
734
|
parameters: [
|
|
733
735
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Glob pattern", required: true },
|
|
734
736
|
{ name: "path", type: "STRING" /* STRING */, description: "Directory to search", required: true },
|
|
735
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
737
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
738
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive matching (default false)", required: false }
|
|
736
739
|
]
|
|
737
740
|
};
|
|
738
741
|
}
|
|
@@ -744,8 +747,9 @@ var FindFilesTool = class {
|
|
|
744
747
|
const [resolved, resolveErr] = await resolvePath(pathStr, this.autoApprovedDirs, this.requester, this.grantedPaths);
|
|
745
748
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
746
749
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
750
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
747
751
|
const matches = [];
|
|
748
|
-
this.walkAndMatch(resolved, pattern, matches);
|
|
752
|
+
this.walkAndMatch(resolved, pattern, matches, caseSensitive);
|
|
749
753
|
matches.sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
750
754
|
const limited = matches.slice(0, maxResults);
|
|
751
755
|
if (limited.length === 0) {
|
|
@@ -762,7 +766,7 @@ var FindFilesTool = class {
|
|
|
762
766
|
}
|
|
763
767
|
return result;
|
|
764
768
|
}
|
|
765
|
-
walkAndMatch(dirPath, pattern, matches) {
|
|
769
|
+
walkAndMatch(dirPath, pattern, matches, caseSensitive) {
|
|
766
770
|
let entries;
|
|
767
771
|
try {
|
|
768
772
|
entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
@@ -773,9 +777,9 @@ var FindFilesTool = class {
|
|
|
773
777
|
if (entry.name.startsWith(".")) continue;
|
|
774
778
|
const fullPath = path2.join(dirPath, entry.name);
|
|
775
779
|
if (entry.isDirectory()) {
|
|
776
|
-
this.walkAndMatch(fullPath, pattern, matches);
|
|
780
|
+
this.walkAndMatch(fullPath, pattern, matches, caseSensitive);
|
|
777
781
|
} else if (entry.isFile()) {
|
|
778
|
-
if (this.globMatch(entry.name, pattern)) {
|
|
782
|
+
if (this.globMatch(entry.name, pattern, caseSensitive)) {
|
|
779
783
|
try {
|
|
780
784
|
const stat = fs.statSync(fullPath);
|
|
781
785
|
matches.push({
|
|
@@ -793,7 +797,7 @@ var FindFilesTool = class {
|
|
|
793
797
|
* Simple glob matching: supports *, ?, and character classes [...].
|
|
794
798
|
* Converts glob to regex and tests against the filename.
|
|
795
799
|
*/
|
|
796
|
-
globMatch(filename, pattern) {
|
|
800
|
+
globMatch(filename, pattern, caseSensitive) {
|
|
797
801
|
let regexStr = "^";
|
|
798
802
|
for (let i = 0; i < pattern.length; i++) {
|
|
799
803
|
const c = pattern[i];
|
|
@@ -831,7 +835,7 @@ var FindFilesTool = class {
|
|
|
831
835
|
}
|
|
832
836
|
regexStr += "$";
|
|
833
837
|
try {
|
|
834
|
-
return new RegExp(regexStr).test(filename);
|
|
838
|
+
return new RegExp(regexStr, caseSensitive ? "" : "i").test(filename);
|
|
835
839
|
} catch {
|
|
836
840
|
return false;
|
|
837
841
|
}
|