@engineeros/connector 1.59.67 → 1.59.69
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/bin/context-grep.mjs +230 -0
- package/bin/engineeros-connector.mjs +482 -479
- package/package.json +2 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import ie from"node:path";import ae from"node:v8";import{Worker as ce,isMainThread as le,parentPort as L,workerData as v}from"node:worker_threads";import{constants as W}from"node:fs";import{lstat as Y,open as K,realpath as j}from"node:fs/promises";import h from"node:path";var I=10*1024*1024,N=(s,e)=>{let t=h.relative(s,e);return t&&!t.startsWith(`..${h.sep}`)&&t!==".."&&!h.isAbsolute(t)};async function R(s,e,{maxBytes:t=I}={}){let n=()=>Object.assign(new Error("Use a regular file inside the workspace without symlinks or redirected directories."),{code:"WORKSPACE_READ_UNSAFE"}),r=()=>Object.assign(new Error(`Workspace file exceeds the ${t} byte read limit. Provide a smaller file before retrying.`),{code:"WORKSPACE_READ_LIMIT"}),o=String(e||"").replaceAll("\\","/");if(!o||h.isAbsolute(o)||h.win32.isAbsolute(o))throw n();let p=await j(s),f=h.resolve(p,o);if(!N(p,f))throw n();let d=p,i;for(let c of h.relative(p,f).split(h.sep))if(d=h.join(d,c),i=await Y(d),i.isSymbolicLink())throw n();if(!i.isFile())throw n();if(i.size>t)throw r();if(!N(p,await j(f)))throw n();let m=await K(f,W.O_RDONLY|(W.O_NOFOLLOW||0));try{let c=await m.stat();if(!c.isFile()||c.ino!==i.ino||c.dev!==i.dev||!N(p,await j(f)))throw n();if(c.size>t)throw r();let b=Buffer.alloc(Math.min(t+1,64*1024)),x=[],g=0;for(;g<=t;){let{bytesRead:a}=await m.read(b,0,Math.min(b.length,t+1-g),null);if(!a)break;if(g+=a,g>t)throw r();x.push(Buffer.from(b.subarray(0,a)))}return Buffer.concat(x,g)}finally{await m.close()}}import{execFile as q}from"node:child_process";import{promisify as J}from"node:util";var Ae=J(q);var Re=Object.freeze({"skills.include_instructions":!1,"skills.bundled.enabled":!1,"features.apps":!1,"features.plugins":!1,include_apps_instructions:!1}),Me=Object.freeze({"read-only":"read-only","workspace-write":"workspace-write"});var ee="engineeros-verifier",te=Object.freeze({"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",bash:"allow",edit:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"});var ne=Object.freeze({OPENCODE_CONFIG:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({agent:{[ee]:{mode:"primary",description:"Independent Goal verification with commands and no direct edits",permission:te},plan:{permission:{"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",edit:"deny",bash:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"}}}}),OPENCODE_DISABLE_PROJECT_CONFIG:"true",OPENCODE_DISABLE_CLAUDE_CODE:"true",OPENCODE_DISABLE_EXTERNAL_SKILLS:"true"});var De=String.raw`import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
|
|
5
|
+
// Plain JSON Schema arguments are all required, so a call that names the patch
|
|
6
|
+
// "input" or "patch" was rejected by the provider before this tool ever saw it,
|
|
7
|
+
// ending the session. OpenCode installs zod beside its config tools; with it the
|
|
8
|
+
// arguments are optional and a malformed call comes back as a tool error.
|
|
9
|
+
// OpenCode recognises only zod 4 schemas (they carry _zod); a zod 3 schema would
|
|
10
|
+
// be read as plain JSON Schema and break the tool, so zod 3 is never used.
|
|
11
|
+
let z = null;
|
|
12
|
+
for (const specifier of ["zod", "zod/v4"]) {
|
|
13
|
+
try {
|
|
14
|
+
const candidate = (await import(specifier)).z;
|
|
15
|
+
if (candidate && "_zod" in candidate.string()) {
|
|
16
|
+
z = candidate;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
// Not installed here, or no zod 4 under this name.
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const PATCH_TEXT_DESCRIPTION =
|
|
25
|
+
"The complete patch, from '*** Begin Patch' to '*** End Patch', or a unified diff.";
|
|
26
|
+
|
|
27
|
+
function resolveInside(root, base, file) {
|
|
28
|
+
const target = path.resolve(base, String(file || "").trim());
|
|
29
|
+
const relative = path.relative(root, target);
|
|
30
|
+
if (!String(file || "").trim() || relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
31
|
+
throw new Error("Patch path is outside the workspace: " + file);
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parseEnvelope(text) {
|
|
37
|
+
const lines = text.replace(/\r\n/g, "\n").split("\n");
|
|
38
|
+
let index = lines.findIndex((line) => line.trim() === "*** Begin Patch");
|
|
39
|
+
if (index < 0) throw new Error("A patch must start with '*** Begin Patch' or be a unified diff.");
|
|
40
|
+
index += 1;
|
|
41
|
+
const operations = [];
|
|
42
|
+
const isHeader = (line) => line.startsWith("*** ") && line.trim() !== "*** End of File";
|
|
43
|
+
while (index < lines.length) {
|
|
44
|
+
const line = lines[index];
|
|
45
|
+
if (line.trim() === "*** End Patch") return operations;
|
|
46
|
+
let match = /^\*\*\* Add File:\s*(.+)$/.exec(line);
|
|
47
|
+
if (match) {
|
|
48
|
+
const body = [];
|
|
49
|
+
index += 1;
|
|
50
|
+
while (index < lines.length && !isHeader(lines[index])) {
|
|
51
|
+
const entry = lines[index];
|
|
52
|
+
body.push(entry.startsWith("+") ? entry.slice(1) : entry);
|
|
53
|
+
index += 1;
|
|
54
|
+
}
|
|
55
|
+
while (body.length && body[body.length - 1] === "") body.pop();
|
|
56
|
+
operations.push({ type: "add", path: match[1].trim(), content: body.join("\n") + "\n" });
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
match = /^\*\*\* Delete File:\s*(.+)$/.exec(line);
|
|
60
|
+
if (match) {
|
|
61
|
+
operations.push({ type: "delete", path: match[1].trim() });
|
|
62
|
+
index += 1;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
match = /^\*\*\* Update File:\s*(.+)$/.exec(line);
|
|
66
|
+
if (match) {
|
|
67
|
+
const operation = { type: "update", path: match[1].trim(), moveTo: null, chunks: [] };
|
|
68
|
+
index += 1;
|
|
69
|
+
const move = /^\*\*\* Move to:\s*(.+)$/.exec(lines[index] || "");
|
|
70
|
+
if (move) {
|
|
71
|
+
operation.moveTo = move[1].trim();
|
|
72
|
+
index += 1;
|
|
73
|
+
}
|
|
74
|
+
let chunk = null;
|
|
75
|
+
while (index < lines.length && !isHeader(lines[index])) {
|
|
76
|
+
const entry = lines[index];
|
|
77
|
+
index += 1;
|
|
78
|
+
if (entry.trim() === "*** End of File") continue;
|
|
79
|
+
if (entry.startsWith("@@")) {
|
|
80
|
+
chunk = { before: [], after: [] };
|
|
81
|
+
operation.chunks.push(chunk);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!chunk) {
|
|
85
|
+
chunk = { before: [], after: [] };
|
|
86
|
+
operation.chunks.push(chunk);
|
|
87
|
+
}
|
|
88
|
+
if (entry.startsWith("+")) chunk.after.push(entry.slice(1));
|
|
89
|
+
else if (entry.startsWith("-")) chunk.before.push(entry.slice(1));
|
|
90
|
+
else {
|
|
91
|
+
const context = entry.startsWith(" ") ? entry.slice(1) : entry;
|
|
92
|
+
chunk.before.push(context);
|
|
93
|
+
chunk.after.push(context);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
operations.push(operation);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (line.trim() === "") {
|
|
100
|
+
index += 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
throw new Error("Unexpected patch line: " + line);
|
|
104
|
+
}
|
|
105
|
+
throw new Error("A patch must end with '*** End Patch'.");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function findLines(lines, wanted, start) {
|
|
109
|
+
const comparisons = [
|
|
110
|
+
(left, right) => left === right,
|
|
111
|
+
(left, right) => left.trimEnd() === right.trimEnd(),
|
|
112
|
+
(left, right) => left.trim() === right.trim(),
|
|
113
|
+
];
|
|
114
|
+
for (const same of comparisons) {
|
|
115
|
+
for (const from of [start, 0]) {
|
|
116
|
+
for (let at = from; at + wanted.length <= lines.length; at += 1) {
|
|
117
|
+
if (wanted.every((line, offset) => same(lines[at + offset], line))) return at;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return -1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function applyChunks(content, chunks, file) {
|
|
125
|
+
const lines = content.split("\n");
|
|
126
|
+
let cursor = 0;
|
|
127
|
+
for (const chunk of chunks) {
|
|
128
|
+
let before = chunk.before;
|
|
129
|
+
let after = chunk.after;
|
|
130
|
+
if (before.length === 0) {
|
|
131
|
+
const at = lines[lines.length - 1] === "" ? lines.length - 1 : lines.length;
|
|
132
|
+
lines.splice(at, 0, ...after);
|
|
133
|
+
cursor = at + after.length;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
let at = findLines(lines, before, cursor);
|
|
137
|
+
// A blank line that closes a hunk is often an artefact of how it was written.
|
|
138
|
+
while (at < 0 && before.length > 1 && before[before.length - 1] === "" && after[after.length - 1] === "") {
|
|
139
|
+
before = before.slice(0, -1);
|
|
140
|
+
after = after.slice(0, -1);
|
|
141
|
+
at = findLines(lines, before, cursor);
|
|
142
|
+
}
|
|
143
|
+
if (at < 0) {
|
|
144
|
+
throw new Error("Could not find these lines in " + file + ":\n" + chunk.before.join("\n"));
|
|
145
|
+
}
|
|
146
|
+
lines.splice(at, before.length, ...after);
|
|
147
|
+
cursor = at + after.length;
|
|
148
|
+
}
|
|
149
|
+
return lines.join("\n");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function applyEnvelope(text, root, base) {
|
|
153
|
+
const planned = parseEnvelope(text).map((operation) => {
|
|
154
|
+
const target = resolveInside(root, base, operation.path);
|
|
155
|
+
if (operation.type === "add") return { ...operation, target, content: operation.content };
|
|
156
|
+
if (!existsSync(target)) throw new Error("Cannot " + operation.type + " missing file " + operation.path);
|
|
157
|
+
if (operation.type === "delete") return { ...operation, target };
|
|
158
|
+
const content = applyChunks(readFileSync(target, "utf8"), operation.chunks, operation.path);
|
|
159
|
+
const destination = operation.moveTo ? resolveInside(root, base, operation.moveTo) : target;
|
|
160
|
+
return { ...operation, target, destination, content };
|
|
161
|
+
});
|
|
162
|
+
// Every hunk is located before anything is written, so a bad patch changes nothing.
|
|
163
|
+
const summary = [];
|
|
164
|
+
for (const operation of planned) {
|
|
165
|
+
if (operation.type === "delete") {
|
|
166
|
+
rmSync(operation.target);
|
|
167
|
+
summary.push("D " + operation.path);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const destination = operation.destination || operation.target;
|
|
171
|
+
mkdirSync(path.dirname(destination), { recursive: true });
|
|
172
|
+
writeFileSync(destination, operation.content);
|
|
173
|
+
if (destination !== operation.target) rmSync(operation.target);
|
|
174
|
+
summary.push((operation.type === "add" ? "A " : "M ") + (operation.moveTo || operation.path));
|
|
175
|
+
}
|
|
176
|
+
return summary;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function applyUnifiedDiff(text, base) {
|
|
180
|
+
const input = text.endsWith("\n") ? text : text + "\n";
|
|
181
|
+
const failures = [];
|
|
182
|
+
for (const strip of ["-p1", "-p0"]) {
|
|
183
|
+
const result = spawnSync("git", ["apply", strip, "--recount", "--whitespace=nowarn", "-"], {
|
|
184
|
+
cwd: base,
|
|
185
|
+
input,
|
|
186
|
+
encoding: "utf8",
|
|
187
|
+
});
|
|
188
|
+
if (result.status === 0) return ["Applied unified diff (" + strip + ")."];
|
|
189
|
+
failures.push(String(result.stderr || result.error || "").trim());
|
|
190
|
+
}
|
|
191
|
+
throw new Error("The unified diff did not apply:\n" + failures.filter(Boolean).join("\n"));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default {
|
|
195
|
+
description:
|
|
196
|
+
"Apply a patch to files in the workspace. Use this envelope, with paths relative to the workspace:\n" +
|
|
197
|
+
"*** Begin Patch\n*** Add File: path/new.md\n+first line\n*** Update File: path/existing.md\n@@\n unchanged line\n-removed line\n+added line\n*** Delete File: path/old.md\n*** End Patch\n" +
|
|
198
|
+
"Each Update hunk starts with @@ and lists context lines with a leading space, removed lines with -, added lines with +. " +
|
|
199
|
+
"A unified diff (--- a/file, +++ b/file) is also accepted. Nothing is written unless every hunk applies.",
|
|
200
|
+
args: z
|
|
201
|
+
? {
|
|
202
|
+
patchText: z.string().optional().describe(PATCH_TEXT_DESCRIPTION),
|
|
203
|
+
input: z.string().optional().describe("The same patch; used when patchText is absent."),
|
|
204
|
+
patch: z.string().optional().describe("The same patch; used when patchText is absent."),
|
|
205
|
+
}
|
|
206
|
+
: { patchText: { type: "string", description: PATCH_TEXT_DESCRIPTION } },
|
|
207
|
+
async execute(args, context) {
|
|
208
|
+
const text = String((args && (args.patchText || args.input || args.patch)) || "");
|
|
209
|
+
if (!text.trim()) throw new Error("The patch is empty. Pass the whole patch as the patchText argument.");
|
|
210
|
+
const base = path.resolve((context && context.directory) || process.cwd());
|
|
211
|
+
const root = path.resolve((context && context.worktree) || base);
|
|
212
|
+
const summary = text.includes("*** Begin Patch")
|
|
213
|
+
? applyEnvelope(text, root, base)
|
|
214
|
+
: applyUnifiedDiff(text, base);
|
|
215
|
+
return "Patch applied:\n" + summary.join("\n");
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
`;var Xe=10080*60*1e3;import{Language as Ke,Parser as qe,Query as Je}from"web-tree-sitter";var Ve=new URL("../grammars/",import.meta.url);var M=`
|
|
219
|
+
(program (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant))
|
|
220
|
+
(program (variable_declaration (variable_declarator name: (identifier) @name) @definition.constant))
|
|
221
|
+
(program (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant)))
|
|
222
|
+
`,B=`
|
|
223
|
+
(type_alias_declaration name: (type_identifier) @name) @definition.type
|
|
224
|
+
(enum_declaration name: (identifier) @name) @definition.enum
|
|
225
|
+
`,Qe={javascript:M,typescript:M+B,tsx:M+B};var nt=40*1024*1024;var at=768*1024;var oe=new Set([".js",".jsx",".mjs",".cjs",".ts",".tsx"]),ct=new Set([...oe,".py",".go",".java",".kt",".cs",".rb",".rs"]);var lt=new RegExp([String.raw`\bassert\w*\b`,String.raw`\bexpect\w*\s*\(`,String.raw`\.should\b`,String.raw`\bpytest\.raises\b`,String.raw`\bself\.assert\w+`,String.raw`\bt\.(?:Error|Errorf|Fatal|Fatalf|Fail|FailNow)\b`,String.raw`\brequire\.\w+\(`,String.raw`\bAssert\.\w+`,String.raw`\bassert_(?:eq|ne)!`,String.raw`\bverify\s*\(`,String.raw`\bto(?:Have|Be|Equal|Contain|Match|Throw)\w*\s*\(`].join("|"),"g");var Rt=512*1024,Mt=1024*1024;var Lt=10080*60*1e3,Pt=720*60*60*1e3;var Ft=new Set("a an and are as at be been being but by can could did do does done for from had has have how into is it its may might must need needs no not of on or our our should so than that the their them then there these they this those to too use used using very was were what when where which while who why will with would you your about after all also any before between both during each every here how just make made more most need next now once only other over same should some such take then through under until up upon via want wants well when work works".split(/\s+/));var Dt=256*1024;function _(s){return String(s||"").replace(/[\u0000-\u001f\u007f]/g,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,"0")}`).replaceAll("`","'")}var re={"claude.md":"Claude Code","gemini.md":"Gemini CLI"},zt=new Set(["agents.md",...Object.keys(re)]);var ue=50,D=4e3,G=1e3,U=8,P=1e3,pe=5e3,fe=2,F=0;async function Yt(s,e,t){let n=String(e.pattern??""),r=String(e.glob??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");if(n.length>4096||r.length>1024)throw new Error("Grep pattern or glob is too long. Use a smaller pattern and narrower glob.");if(F>=fe)throw new Error("Two workspace searches are already running. Retry after one finishes.");F+=1;let o,p;try{let f=await t();return o=new ce(new URL("./context-grep.mjs",import.meta.url),{workerData:{kind:"context-grep",workspace:s,args:e,files:f},execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:128,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),await new Promise((d,i)=>{p=setTimeout(()=>i(new Error("Workspace search exceeded its five-second limit. Narrow the glob or simplify the regular expression.")),pe),o.once("message",m=>m.error?i(new Error(m.error)):d(m.text)),o.once("error",()=>i(new Error("Workspace search worker failed or exceeded its memory limit. Narrow the glob or pattern."))),o.once("exit",()=>i(new Error("Workspace search stopped before returning a result. Narrow the glob or pattern.")))})}finally{clearTimeout(p);try{o&&await o.terminate()}finally{F-=1}}}!le&&v?.kind==="context-grep"&&(ae.setFlagsFromString("--enable-experimental-regexp-engine-on-excessive-backtracks"),de(v.workspace,v.args,v.files).then(s=>L.postMessage({text:s}),s=>L.postMessage({error:s.message})).finally(()=>L.close()));async function de(s,e,t){let n=String(e.pattern??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");let r;try{r=new RegExp(e.regex===!0?n:n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e.ignore_case===!0?"i":"")}catch(l){throw new Error(`The pattern is not a valid regular expression: ${l.message}`)}let o=String(e.glob||"").trim(),p=o?he(o):()=>!0,f=t.filter(p),d=[],i=0,m=0,c=0;e:for(let l=0;l<f.length;l+=U){let S=f.slice(l,l+U),C=await Promise.all(S.map(async w=>{try{return await R(s,w)}catch(y){return y.code==="WORKSPACE_READ_LIMIT"?{tooLarge:!0}:null}}));for(let w=0;w<S.length;w+=1){m+=1;let y=C[w];if(y?.tooLarge){i+=1;continue}if(!y||y.subarray(0,8192).includes(0))continue;let E=y.toString("utf8"),T=[];for(let $=0,z=1;$<=E.length;z+=1){let k=E.indexOf(`
|
|
226
|
+
`,$),Z=k<0?E.length:k,O=E.slice($,Z).replace(/\r$/,"");if(r.test(O)&&(T.push({line:z,text:me(O,r),shortened:O.trimEnd().length>D}),c+=1),c===P||k<0)break;$=k+1}if(T.length&&d.push({path:S[w],lines:T}),c===P)break e}}let b=c===P,x=`${o?` in \`${_(o)}\``:""}`,g=`searched ${m.toLocaleString()} file(s)${i?`; ${i} file(s) over ${I/1024/1024} MB were not read`:""}`,a=["# EngineerOS Grep",""];if(o&&!f.length)return a.push(`The glob \`${_(o)}\` matched no file, so nothing was searched. A glob without a slash matches file names; name a directory as \`dir/\` or \`dir/**\`.`),a.join(`
|
|
227
|
+
`);if(!d.length)return a.push(`No file matches \`${_(n)}\`${x} (${g}).`),a.join(`
|
|
228
|
+
`);let H=e.output==="files"||e.output==="lines"?e.output:c<=ue?"lines":"files";if(a.push(`\`${_(n)}\`${x}: ${c.toLocaleString()} matching line(s) in ${d.length.toLocaleString()} file(s) (${g}).`),b&&a.push("Search reached the 1,000-line limit; counts may be partial. Narrow `glob` or the pattern to continue.",""),H==="files")return a.push('Narrow this with `glob`, or pass `output: "lines"` for the matching lines within the search limit.',"",...d.map(l=>`- \`${_(l.path)}\` (${l.lines.length})`)),a.join(`
|
|
229
|
+
`);let A=0;for(let l of d)a.push("",...l.lines.map(({line:S,text:C,shortened:w})=>(w&&(A+=1),`${l.path}:${S}: ${C}`)));return A&&a.push("",`${A} line(s) over ${D.toLocaleString()} characters (minified or generated code) are shown around their match; read the file for the rest.`),a.join(`
|
|
230
|
+
`)}function me(s,e){let t=s.trimEnd();if(t.length<=D)return t;let n=Math.max(0,t.search(e)-Math.floor(G/3)),r=n+G;return`${n?"\u2026":""}${t.slice(n,r)}${r<t.length?"\u2026":""}`}function he(s){let e=s.replaceAll("\\","/").replace(/^\.\//,"");e.endsWith("/")&&(e+="**");let t=new RegExp(`^${X(e)}$`),n=!e.includes("/"),r=/[*?{]/.test(e)?null:`${e}/`;return o=>t.test(n?ie.posix.basename(o):o)||r!==null&&o.startsWith(r)}function X(s){let e="";for(let t=0;t<s.length;t+=1){let n=s[t];if(n==="*"&&s[t+1]==="*")t+=1,s[t+1]==="/"?(t+=1,e+="(?:.*/)?"):e+=".*";else if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="{"){let r=s.indexOf("}",t);if(r<0){e+="\\{";continue}e+=`(?:${s.slice(t+1,r).split(",").map(X).join("|")})`,t=r}else e+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return e}export{P as GREP_MAX_MATCHES,pe as GREP_TIMEOUT_MS,Yt as boundedGrep,he as globMatcher};
|