@flemist/mcp-project-tools 5.0.1 → 5.0.2

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.
@@ -16,34 +16,34 @@ import { webkit as lr, firefox as cr, chromium as ur } from "playwright";
16
16
  import dr from "deepmerge";
17
17
  import Ne from "json5";
18
18
  import fr from "js-yaml";
19
- function pr(t) {
20
- const { authToken: r } = t;
19
+ function pr(r) {
20
+ const { authToken: t } = r;
21
21
  return function(o, e, n) {
22
- if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== r) {
22
+ if ((o.query.token || o.headers.authorization?.replace("Bearer ", "")) !== t) {
23
23
  e.status(401).json({ error: "Unauthorized" });
24
24
  return;
25
25
  }
26
26
  n();
27
27
  };
28
28
  }
29
- async function ie(t) {
30
- const { logFilePath: r, message: s, data: o } = t;
29
+ async function ie(r) {
30
+ const { logFilePath: t, message: s, data: o } = r;
31
31
  try {
32
32
  const e = (/* @__PURE__ */ new Date()).toISOString().replace(/[TZ]/g, " ").trim(), n = typeof o == "string" ? o : JSON.stringify(o, null, 2), i = `[${e}] ${s}
33
33
  ${n}
34
34
 
35
35
  `;
36
- await j.promises.mkdir(k.dirname(r), { recursive: !0 }), await j.promises.appendFile(r, i);
36
+ await j.promises.mkdir(k.dirname(t), { recursive: !0 }), await j.promises.appendFile(t, i);
37
37
  } catch (e) {
38
38
  console.error(`Failed to log "${s}":`, e);
39
39
  }
40
40
  }
41
41
  const ae = /* @__PURE__ */ new Map();
42
- function hr(t) {
43
- return t.headers["mcp-session-id"] || t.headers["x-session-id"] || t.query.token;
42
+ function hr(r) {
43
+ return r.headers["mcp-session-id"] || r.headers["x-session-id"] || r.query.token;
44
44
  }
45
- async function mr(t, r) {
46
- const s = await r.createMcpServer(t), o = new er({
45
+ async function mr(r, t) {
46
+ const s = await t.createMcpServer(r), o = new er({
47
47
  sessionIdGenerator: Xt,
48
48
  onsessioninitialized: (n) => {
49
49
  ae.set(n, o);
@@ -66,28 +66,28 @@ async function mr(t, r) {
66
66
  throw await e(), n;
67
67
  }
68
68
  }
69
- async function gr(t, r, s, o) {
69
+ async function gr(r, t, s, o) {
70
70
  await ie({
71
71
  logFilePath: s.logFilePath,
72
72
  message: "REQUEST",
73
- data: t.body
73
+ data: r.body
74
74
  });
75
75
  let e = o ? ae.get(o) : null;
76
- e || (e = await mr(t, s)), await e.handleRequest(t, r, t.body);
76
+ e || (e = await mr(r, s)), await e.handleRequest(r, t, r.body);
77
77
  }
78
- async function wr(t, r, s) {
78
+ async function wr(r, t, s) {
79
79
  const o = s ? ae.get(s) : null;
80
80
  if (!o) {
81
- r.status(400).json({ error: "No valid session found" });
81
+ t.status(400).json({ error: "No valid session found" });
82
82
  return;
83
83
  }
84
- await o.handleRequest(t, r);
84
+ await o.handleRequest(r, t);
85
85
  }
86
- function yr(t) {
86
+ function yr(r) {
87
87
  return async function(s, o) {
88
88
  try {
89
89
  const e = hr(s);
90
- s.method === "POST" ? await gr(s, o, t, e) : s.method === "GET" ? await wr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
90
+ s.method === "POST" ? await gr(s, o, r, e) : s.method === "GET" ? await wr(s, o, e) : o.status(405).json({ error: "Method not allowed" });
91
91
  } catch (e) {
92
92
  console.error("Unhandled error in streamableHttpHandler", e), o.status(500).json({
93
93
  error: "Internal server error: " + (e instanceof Error ? e.message : "Unknown error")
@@ -98,11 +98,11 @@ function yr(t) {
98
98
  const Y = /* @__PURE__ */ new Map();
99
99
  let br = 0;
100
100
  const ke = 10, Sr = 1800 * 1e3, J = 1e4, Q = 2e3, xr = 5e3;
101
- function Ir(t) {
102
- const { commandLine: r, commandLineRules: s } = t;
101
+ function Ir(r) {
102
+ const { commandLine: t, commandLineRules: s } = r;
103
103
  let o = !1;
104
104
  for (const e of s)
105
- if (new RegExp(e.regexp).test(r))
105
+ if (new RegExp(e.regexp).test(t))
106
106
  switch (e.rule) {
107
107
  case "allow":
108
108
  o = !0;
@@ -123,49 +123,49 @@ function Mr() {
123
123
  if (Oe)
124
124
  return;
125
125
  Oe = !0;
126
- const t = () => {
126
+ const r = () => {
127
127
  console.log("Auto-killing all child processes...");
128
- for (const [r, s] of Array.from(Y.entries()))
128
+ for (const [t, s] of Array.from(Y.entries()))
129
129
  if (s.isRunning && s.pid)
130
130
  try {
131
131
  he(s.pid, "SIGKILL");
132
132
  } catch (o) {
133
- console.error(`Error killing process ${r}:`, o);
133
+ console.error(`Error killing process ${t}:`, o);
134
134
  }
135
135
  process.exit(0);
136
136
  };
137
- process.on("SIGINT", t), process.on("SIGTERM", t);
137
+ process.on("SIGINT", r), process.on("SIGTERM", r);
138
138
  }
139
139
  function ge() {
140
- const t = Date.now(), r = [];
140
+ const r = Date.now(), t = [];
141
141
  for (const [s, o] of Array.from(Y.entries()))
142
- !o.isRunning && o.endTime && t - o.endTime.getTime() > Sr && r.push(s);
143
- for (const s of r)
142
+ !o.isRunning && o.endTime && r - o.endTime.getTime() > Sr && t.push(s);
143
+ for (const s of t)
144
144
  Y.delete(s);
145
145
  }
146
- function Re(t) {
147
- return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
146
+ function Re(r) {
147
+ return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
148
148
  }
149
149
  const De = "[/\\\\]";
150
- function at(t, r) {
151
- const s = t.replace(/[\\/]+$/, "");
150
+ function at(r, t) {
151
+ const s = r.replace(/[\\/]+$/, "");
152
152
  let o;
153
- return r ? o = s.split(/[\\/]/).map(Re).join(De) : o = Re(s), o += `(?=${De}|$)`, new RegExp(o, r ? "gi" : "g");
153
+ return t ? o = s.split(/[\\/]/).map(Re).join(De) : o = Re(s), o += `(?=${De}|$)`, new RegExp(o, t ? "gi" : "g");
154
154
  }
155
- function Tr(t, r, s, o) {
156
- const e = at(r, o);
157
- return t.replace(e, (n) => s + n.slice(r.length));
155
+ function Tr(r, t, s, o) {
156
+ const e = at(t, o);
157
+ return r.replace(e, (n) => s + n.slice(t.length));
158
158
  }
159
- function Cr(t, r, s, o) {
159
+ function Cr(r, t, s, o) {
160
160
  const e = process.platform === "win32", n = {};
161
161
  if (s !== "clear") if (s === "replaceServerPaths" || s === "deleteServerPaths") {
162
- const i = Fe(t, e), a = Fe(r, e);
162
+ const i = Fe(r, e), a = Fe(t, e);
163
163
  if (i !== a) {
164
- const l = at(t, e);
164
+ const l = at(r, e);
165
165
  for (const u in process.env) {
166
166
  if (!Object.prototype.hasOwnProperty.call(process.env, u)) continue;
167
167
  const f = process.env[u];
168
- f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Tr(f, t, r, e)) : n[u] = f);
168
+ f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Tr(f, r, t, e)) : n[u] = f);
169
169
  }
170
170
  } else
171
171
  for (const l in process.env) {
@@ -187,41 +187,41 @@ function Cr(t, r, s, o) {
187
187
  }
188
188
  return n;
189
189
  }
190
- function Fe(t, r) {
191
- const s = k.normalize(t).replace(/[\\/]+$/, "");
192
- return r ? s.toLowerCase() : s;
190
+ function Fe(r, t) {
191
+ const s = k.normalize(r).replace(/[\\/]+$/, "");
192
+ return t ? s.toLowerCase() : s;
193
193
  }
194
194
  const vr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
195
195
  let Er = 0;
196
196
  function Nr() {
197
197
  return ++Er;
198
198
  }
199
- function lt(t) {
200
- let r = Pe.get(t);
201
- return r == null && (r = {
199
+ function lt(r) {
200
+ let t = Pe.get(r);
201
+ return t == null && (t = {
202
202
  storedOutputs: /* @__PURE__ */ new Map()
203
- }, Pe.set(t, r)), r;
203
+ }, Pe.set(r, t)), t;
204
204
  }
205
- function ct(t) {
206
- return typeof t == "function" ? t() : t;
205
+ function ct(r) {
206
+ return typeof r == "function" ? r() : r;
207
207
  }
208
- function ut(t, r) {
208
+ function ut(r, t) {
209
209
  return setTimeout(() => {
210
- t.storedOutputs.delete(r);
210
+ r.storedOutputs.delete(t);
211
211
  }, vr);
212
212
  }
213
- function kr(t, r, s) {
214
- clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(t, r);
213
+ function kr(r, t, s) {
214
+ clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(r, t);
215
215
  }
216
- function Or(t) {
217
- const { sessionId: r, source: s } = t, o = lt(r), e = Nr(), n = {
216
+ function Or(r) {
217
+ const { sessionId: t, source: s } = r, o = lt(t), e = Nr(), n = {
218
218
  source: s,
219
219
  cleanupTimer: ut(o, e)
220
220
  };
221
221
  return o.storedOutputs.set(e, n), e;
222
222
  }
223
- function dt(t) {
224
- const { sessionId: r, outputId: s, range: o } = t, [e, n] = o, i = lt(r), a = i.storedOutputs.get(s);
223
+ function dt(r) {
224
+ const { sessionId: t, outputId: s, range: o } = r, [e, n] = o, i = lt(t), a = i.storedOutputs.get(s);
225
225
  if (a == null)
226
226
  return {
227
227
  content: "",
@@ -233,12 +233,12 @@ function dt(t) {
233
233
  const c = ct(a.source), l = c.length, u = Math.min(Math.max(e, 0), l), f = Math.min(Math.max(n, 0), l);
234
234
  return { content: c.substring(u, f), total: l, range: [u, f] };
235
235
  }
236
- function we(t) {
237
- const { sessionId: r, source: s, limit: o } = t, e = ct(s);
236
+ function we(r) {
237
+ const { sessionId: t, source: s, limit: o } = r, e = ct(s);
238
238
  if (e.length <= o)
239
239
  return { content: e, outputId: null };
240
- const n = Or({ sessionId: r, source: s }), i = dt({
241
- sessionId: r,
240
+ const n = Or({ sessionId: t, source: s }), i = dt({
241
+ sessionId: t,
242
242
  outputId: n,
243
243
  range: [0, o]
244
244
  }), a = `
@@ -248,8 +248,8 @@ function we(t) {
248
248
  outputId: n
249
249
  };
250
250
  }
251
- function F(t) {
252
- return `Invalid arguments: ${t instanceof Error ? t.message : "Unknown error"}.
251
+ function F(r) {
252
+ return `Invalid arguments: ${r instanceof Error ? r.message : "Unknown error"}.
253
253
 
254
254
  Provide valid parameters according to schema.`;
255
255
  }
@@ -265,23 +265,23 @@ const ft = m.object({
265
265
  `Character range to retrieve. Maximum range size: ${J}.`
266
266
  )
267
267
  });
268
- function Dr(t, r) {
268
+ function Dr(r, t) {
269
269
  let s;
270
270
  try {
271
- s = pt.parse(t);
271
+ s = pt.parse(r);
272
272
  } catch (i) {
273
273
  return {
274
274
  error: F(i)
275
275
  };
276
276
  }
277
- if (!r.sessionId)
277
+ if (!t.sessionId)
278
278
  return {
279
279
  error: "Session ID is required"
280
280
  };
281
281
  let { from: o, toExclusive: e } = s.range;
282
282
  e <= o && (e = o), e - o > J && (e = o + J);
283
283
  const n = dt({
284
- sessionId: r.sessionId,
284
+ sessionId: t.sessionId,
285
285
  outputId: s.outputId,
286
286
  range: [o, e]
287
287
  });
@@ -291,21 +291,21 @@ function Dr(t, r) {
291
291
  range: n.range
292
292
  };
293
293
  }
294
- function Fr(t) {
295
- t(
294
+ function Fr(r) {
295
+ r(
296
296
  "output-read",
297
297
  {
298
298
  title: "Read Stored Output Range",
299
299
  description: "Read any range from stored output. Use outputId from truncation message and specify character range [from, to).",
300
300
  inputSchema: pt.shape
301
301
  },
302
- async (r, s) => {
303
- const o = Dr(r, s);
302
+ async (t, s) => {
303
+ const o = Dr(t, s);
304
304
  if (o.error != null)
305
- return `Method: output-read(${JSON.stringify(r)})
305
+ return `Method: output-read(${JSON.stringify(t)})
306
306
  ❌ Error: ${o.error}`;
307
307
  const [e, n] = o.range, i = o.total;
308
- let a = `Method: output-read(${JSON.stringify(r)})
308
+ let a = `Method: output-read(${JSON.stringify(t)})
309
309
  showing [${e}, ${n}) of ${i} chars`;
310
310
  return e >= i && (a += `
311
311
  ⚠️ Warning: requested range is beyond content (total: ${i} chars)`), a += `
@@ -314,8 +314,8 @@ ${o.content}`, a;
314
314
  }
315
315
  );
316
316
  }
317
- function Pr(t) {
318
- Fr(t);
317
+ function Pr(r) {
318
+ Fr(r);
319
319
  }
320
320
  const ht = m.object({
321
321
  id: m.number().describe(
@@ -325,11 +325,11 @@ const ht = m.object({
325
325
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
326
326
  )
327
327
  });
328
- async function ye(t, r, s) {
328
+ async function ye(r, t, s) {
329
329
  ge();
330
330
  let o;
331
331
  try {
332
- o = ht.parse(t);
332
+ o = ht.parse(r);
333
333
  } catch (c) {
334
334
  return {
335
335
  error: F(c)
@@ -351,7 +351,7 @@ async function ye(t, r, s) {
351
351
  }).content;
352
352
  return {
353
353
  id: i.id,
354
- cwd: k.relative(r.workingDir || "", i.cwd),
354
+ cwd: k.relative(t.workingDir || "", i.cwd),
355
355
  commandLine: i.commandLine,
356
356
  pid: i.pid,
357
357
  startTime: i.startTime.toISOString().replace(/[TZ]/g, " ").trim(),
@@ -362,8 +362,8 @@ async function ye(t, r, s) {
362
362
  error: i.error
363
363
  };
364
364
  }
365
- function Br(t, r) {
366
- t(
365
+ function Br(r, t) {
366
+ r(
367
367
  "process-status",
368
368
  {
369
369
  title: "Get Host Machine Process Status",
@@ -371,7 +371,7 @@ function Br(t, r) {
371
371
  inputSchema: ht.shape
372
372
  },
373
373
  async (s, o) => {
374
- const e = await ye(s, r, o);
374
+ const e = await ye(s, t, o);
375
375
  if (!("output" in e))
376
376
  return `Method: process-status(${JSON.stringify(s)})
377
377
  ❌ Error: ${e.error}`;
@@ -384,12 +384,12 @@ ${n.trim()}`;
384
384
  }
385
385
  );
386
386
  }
387
- function mt(t) {
388
- he(t, "SIGTERM", (r) => {
389
- r && !r.message.includes("not found") && console.error(`Error sending SIGTERM to process ${t}:`, r);
387
+ function mt(r) {
388
+ he(r, "SIGTERM", (t) => {
389
+ t && !t.message.includes("not found") && console.error(`Error sending SIGTERM to process ${r}:`, t);
390
390
  }), setTimeout(() => {
391
- he(t, "SIGKILL", (r) => {
392
- r && !r.message.includes("not found") && console.error(`Error sending SIGKILL to process ${t}:`, r);
391
+ he(r, "SIGKILL", (t) => {
392
+ t && !t.message.includes("not found") && console.error(`Error sending SIGKILL to process ${r}:`, t);
393
393
  });
394
394
  }, xr);
395
395
  }
@@ -407,10 +407,10 @@ const gt = m.object({
407
407
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
408
408
  )
409
409
  });
410
- async function wt(t, r, s) {
410
+ async function wt(r, t, s) {
411
411
  let o;
412
412
  try {
413
- o = gt.parse(t);
413
+ o = gt.parse(r);
414
414
  } catch (h) {
415
415
  return {
416
416
  error: F(h)
@@ -430,14 +430,14 @@ async function wt(t, r, s) {
430
430
  });
431
431
  const d = (Date.now() - l) / 1e3;
432
432
  return {
433
- ...await ye({ id: e, outputLimit: a }, r, s),
433
+ ...await ye({ id: e, outputLimit: a }, t, s),
434
434
  waitDuration: d,
435
435
  waitTimeExceeded: u,
436
436
  autoKillExecuted: f
437
437
  };
438
438
  }
439
- function Lr(t, r) {
440
- t(
439
+ function Lr(r, t) {
440
+ r(
441
441
  "process-wait",
442
442
  {
443
443
  title: "Wait for Host Machine Process",
@@ -445,7 +445,7 @@ function Lr(t, r) {
445
445
  inputSchema: gt.shape
446
446
  },
447
447
  async (s, o) => {
448
- const e = await wt(s, r, o);
448
+ const e = await wt(s, t, o);
449
449
  if (!("output" in e))
450
450
  return `Method: process-wait(${JSON.stringify(s)})
451
451
  ❌ Error: ${e.error}`;
@@ -458,17 +458,17 @@ ${n.trim()}`;
458
458
  }
459
459
  );
460
460
  }
461
- function H(t) {
462
- return t.replace(/\\/g, "/");
461
+ function H(r) {
462
+ return r.replace(/\\/g, "/");
463
463
  }
464
- function be(t, r) {
465
- if (!t)
464
+ function be(r, t) {
465
+ if (!r)
466
466
  return { error: "Working directory is not configured" };
467
- const s = H(k.resolve(t)), o = H(
468
- k.resolve(t, r || "")
467
+ const s = H(k.resolve(r)), o = H(
468
+ k.resolve(r, t || "")
469
469
  );
470
470
  return !o.startsWith(s + "/") && o !== s ? {
471
- error: `Path "${r}" escapes root directory "${t}". Resolved path: "${o}"`
471
+ error: `Path "${t}" escapes root directory "${r}". Resolved path: "${o}"`
472
472
  } : { path: o };
473
473
  }
474
474
  const yt = m.object({
@@ -488,18 +488,18 @@ const yt = m.object({
488
488
  `Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
489
489
  )
490
490
  });
491
- async function Ar(t, r, s) {
491
+ async function Ar(r, t, s) {
492
492
  ge();
493
493
  let o;
494
494
  try {
495
- o = yt.parse(t);
495
+ o = yt.parse(r);
496
496
  } catch (h) {
497
497
  return {
498
498
  error: F(h)
499
499
  };
500
500
  }
501
- const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } = r, l = be(
502
- r.workingDir,
501
+ const { commandLine: e, waitTime: n, autoKill: i, outputLimit: a } = o, { commandLineRules: c } = t, l = be(
502
+ t.workingDir,
503
503
  o.relativeRootDir
504
504
  );
505
505
  if ("error" in l)
@@ -536,8 +536,8 @@ To use this command line, ask the user to modify the command line rules in the c
536
536
  const h = Cr(
537
537
  process.cwd(),
538
538
  u,
539
- r.envCleanup ?? "deleteServerPaths",
540
- r.env
539
+ t.envCleanup ?? "deleteServerPaths",
540
+ t.env
541
541
  ), g = tr(e, [], {
542
542
  shell: !0,
543
543
  cwd: u,
@@ -555,17 +555,17 @@ To use this command line, ask the user to modify the command line rules in the c
555
555
  p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = w.message, console.error(`Process ${d} error:`, w.message);
556
556
  }), n != null ? wt(
557
557
  { id: d, waitTime: n, autoKill: i, outputLimit: a },
558
- r,
558
+ t,
559
559
  s
560
- ) : ye({ id: d, outputLimit: a }, r, s);
560
+ ) : ye({ id: d, outputLimit: a }, t, s);
561
561
  } catch (h) {
562
562
  return p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = h instanceof Error ? h.message : "Unknown error", { error: p.error };
563
563
  }
564
564
  }
565
- function zr(t, r) {
566
- const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
565
+ function zr(r, t) {
566
+ const s = t.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
567
567
  `);
568
- t(
568
+ r(
569
569
  "process-run",
570
570
  {
571
571
  title: "Execute Command Line on Host Machine",
@@ -574,7 +574,7 @@ ${s}`,
574
574
  inputSchema: yt.shape
575
575
  },
576
576
  async (o, e) => {
577
- const n = await Ar(o, r, e);
577
+ const n = await Ar(o, t, e);
578
578
  if (!("output" in n))
579
579
  return `Method: process-run(${JSON.stringify(o)})
580
580
  ❌ Error: ${n.error}`;
@@ -601,11 +601,11 @@ const bt = m.object({
601
601
  'Specific process data fields to include in the response. If omitted, returns all available fields. Fields id, isRunning, and commandLine are always included. Available fields: id, cwd, commandLine, pid, startTime, endTime, exitCode, isRunning, output, error. Examples: ["id", "commandLine", "isRunning"] for minimal info, ["id", "output", "exitCode"] for execution results'
602
602
  )
603
603
  });
604
- async function Ur(t, r) {
604
+ async function Ur(r, t) {
605
605
  ge();
606
606
  let s;
607
607
  try {
608
- s = bt.parse(t);
608
+ s = bt.parse(r);
609
609
  } catch (l) {
610
610
  return {
611
611
  error: F(l)
@@ -624,7 +624,7 @@ async function Ur(t, r) {
624
624
  return n && (a = a.filter((l) => l.isRunning)), { processes: a.map((l) => {
625
625
  let u = {
626
626
  id: l.id,
627
- cwd: k.relative(r.workingDir || "", l.cwd),
627
+ cwd: k.relative(t.workingDir || "", l.cwd),
628
628
  commandLine: l.commandLine,
629
629
  pid: l.pid,
630
630
  startTime: l.startTime.toISOString().replace(/[TZ]/g, " ").trim(),
@@ -644,8 +644,8 @@ async function Ur(t, r) {
644
644
  return u;
645
645
  }) };
646
646
  }
647
- function jr(t, r) {
648
- t(
647
+ function jr(r, t) {
648
+ r(
649
649
  "process-list",
650
650
  {
651
651
  title: "List Host Machine Processes",
@@ -653,7 +653,7 @@ function jr(t, r) {
653
653
  inputSchema: bt.shape
654
654
  },
655
655
  async (s) => {
656
- const o = await Ur(s, r);
656
+ const o = await Ur(s, t);
657
657
  if (o.error != null)
658
658
  return `Method: process-list(${JSON.stringify(s)})
659
659
  ❌ Error: ${o.error}`;
@@ -672,16 +672,16 @@ const St = m.object({
672
672
  "Process ID of the process to terminate. Get process IDs using process-list. The process must be currently running. Examples: 1, 42, 123"
673
673
  )
674
674
  });
675
- function qr(t) {
676
- let r;
675
+ function qr(r) {
676
+ let t;
677
677
  try {
678
- r = St.parse(t);
678
+ t = St.parse(r);
679
679
  } catch (e) {
680
680
  return {
681
681
  error: F(e)
682
682
  };
683
683
  }
684
- const { id: s } = r, o = Y.get(s);
684
+ const { id: s } = t, o = Y.get(s);
685
685
  if (!o)
686
686
  return {
687
687
  error: `Process ${s} not found. The process may have already completed, been cleaned up after 30 minutes, or the ID may be incorrect. Use process-list to see available processes and their current status.`
@@ -702,8 +702,8 @@ function qr(t) {
702
702
  };
703
703
  }
704
704
  }
705
- function _r(t, r) {
706
- t(
705
+ function _r(r, t) {
706
+ r(
707
707
  "process-kill",
708
708
  {
709
709
  title: "Kill Host Machine Process",
@@ -718,31 +718,31 @@ ${JSON.stringify(o, null, 2)}`;
718
718
  }
719
719
  );
720
720
  }
721
- function Gr(t, r) {
722
- Mr(), r.run && zr(t, r), r.status && Br(t, r), r.wait && Lr(t, r), r.list && jr(t, r), r.kill && _r(t);
723
- const s = r.commandLineRules?.map(
721
+ function Gr(r, t) {
722
+ Mr(), t.run && zr(r, t), t.status && Br(r, t), t.wait && Lr(r, t), t.list && jr(r, t), t.kill && _r(r);
723
+ const s = t.commandLineRules?.map(
724
724
  (o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
725
725
  ) || [];
726
726
  console.log(
727
727
  `Process manager:
728
- - Working directory: ${k.resolve(r.workingDir || "")}
729
- - Command line rules: ${r.commandLineRules?.length || 0} rules configured:
728
+ - Working directory: ${k.resolve(t.workingDir || "")}
729
+ - Command line rules: ${t.commandLineRules?.length || 0} rules configured:
730
730
  ${s.map((o) => `- ${o}`).join(`
731
731
  `)}
732
732
  `
733
733
  );
734
734
  }
735
- function Jr(t, r) {
735
+ function Jr(r, t) {
736
736
  return function(o, e, n) {
737
737
  const i = async (...a) => {
738
738
  await ie({
739
- logFilePath: r.logFilePath,
739
+ logFilePath: t.logFilePath,
740
740
  message: "REQUEST",
741
741
  data: { name: o, args: a }
742
742
  });
743
743
  const c = await n(...a);
744
744
  return await ie({
745
- logFilePath: r.logFilePath,
745
+ logFilePath: t.logFilePath,
746
746
  message: "RESPONSE",
747
747
  data: c
748
748
  }), {
@@ -754,35 +754,35 @@ function Jr(t, r) {
754
754
  ]
755
755
  };
756
756
  };
757
- return t.registerTool(
757
+ return r.registerTool(
758
758
  o,
759
759
  e,
760
760
  i
761
761
  );
762
762
  };
763
763
  }
764
- function Wr(t) {
765
- return t.match(/^[/\\]?[^/\\]+/)[0];
764
+ function Wr(r) {
765
+ return r.match(/^[/\\]?[^/\\]+/)[0];
766
766
  }
767
- function Kr(t, r) {
768
- return Wr(t) + "|" + r.ino;
767
+ function Kr(r, t) {
768
+ return Wr(r) + "|" + t.ino;
769
769
  }
770
- function Hr(t) {
771
- return t.endsWith(":") && (t += "/"), k.resolve(t);
770
+ function Hr(r) {
771
+ return r.endsWith(":") && (r += "/"), k.resolve(r);
772
772
  }
773
773
  const Se = new rr(ir.cpus().length);
774
- function Be(t, r) {
775
- t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
776
- t.maxFileDateModified,
777
- r.maxFileDateModified
778
- ), t.countFiles += r.countFiles, t.countDirs += r.countDirs, t.countLinks += r.countLinks;
779
- }
780
- const Qr = function(r) {
781
- return r.code === "ENOENT";
774
+ function Be(r, t) {
775
+ r.totalSize += t.totalSize, r.maxFileDateModified = Math.max(
776
+ r.maxFileDateModified,
777
+ t.maxFileDateModified
778
+ ), r.countFiles += t.countFiles, r.countDirs += t.countDirs, r.countLinks += t.countLinks;
779
+ }
780
+ const Qr = function(t) {
781
+ return t.code === "ENOENT";
782
782
  };
783
- function xt(t) {
784
- const r = t.paths;
785
- if (!r || r.length === 0)
783
+ function xt(r) {
784
+ const t = r.paths;
785
+ if (!t || t.length === 0)
786
786
  return Promise.resolve({
787
787
  totalSize: 0,
788
788
  maxFileDateModified: 0,
@@ -790,7 +790,7 @@ function xt(t) {
790
790
  countDirs: 0,
791
791
  countLinks: 0
792
792
  });
793
- const s = t.level ?? 0, o = t.walkedIds ?? /* @__PURE__ */ new Set(), e = t.abortSignal, n = t.pool ?? Se, i = t.handleError, a = t.priority ?? X(0), c = t.walkLinks ?? !1, l = t.log, u = t.handlePath, f = t.matchPath;
793
+ const s = r.level ?? 0, o = r.walkedIds ?? /* @__PURE__ */ new Set(), e = r.abortSignal, n = r.pool ?? Se, i = r.handleError, a = r.priority ?? X(0), c = r.walkLinks ?? !1, l = r.log, u = r.handlePath, f = r.matchPath;
794
794
  async function d(h) {
795
795
  if (!(i && await i(h)) && !Qr(h))
796
796
  throw h;
@@ -897,7 +897,7 @@ function xt(t) {
897
897
  for (let N = 0, R = C.length; N < R; N++)
898
898
  C[N] = k.join(S, C[N]);
899
899
  O = await xt({
900
- ...t,
900
+ ...r,
901
901
  paths: C,
902
902
  abortSignal: g,
903
903
  priority: $,
@@ -914,44 +914,44 @@ function xt(t) {
914
914
  ) && (Be(y, O), w(S, O))), O;
915
915
  }
916
916
  const b = [];
917
- for (let I = 0, T = r.length; I < T; I++) {
918
- const x = Hr(r[I]), S = f ? f(x) : !0;
917
+ for (let I = 0, T = t.length; I < T; I++) {
918
+ const x = Hr(t[I]), S = f ? f(x) : !0;
919
919
  S !== !1 && b.push(E(x, I, S));
920
920
  }
921
921
  return await Promise.all(b), y;
922
922
  });
923
923
  }
924
- function It(t) {
925
- return xt(t);
924
+ function It(r) {
925
+ return xt(r);
926
926
  }
927
- function Yr(t, r) {
928
- if (!r || r === ".")
929
- return t;
930
- const s = t.startsWith("^");
931
- s && (t = t.substring(1));
932
- const o = t.startsWith("!");
933
- return o && (t = t.substring(1)), t.startsWith("/") ? (r.endsWith("/") && (r = r.substring(0, r.length - 1)), t = r + t) : (r.endsWith("/") || (r += "/"), t.startsWith("./") ? t = r + t.substring(2) : t.startsWith("../") ? t = r + t : (r.startsWith("..") && (r = ""), t.startsWith("**") ? t = r + t : t = r + "**/" + t)), t = H(k.normalize(t)), o && (t = "!" + t), s && (t = "^" + t), t;
927
+ function Yr(r, t) {
928
+ if (!t || t === ".")
929
+ return r;
930
+ const s = r.startsWith("^");
931
+ s && (r = r.substring(1));
932
+ const o = r.startsWith("!");
933
+ return o && (r = r.substring(1)), r.startsWith("/") ? (t.endsWith("/") && (t = t.substring(0, t.length - 1)), r = t + r) : (t.endsWith("/") || (t += "/"), r.startsWith("./") ? r = t + r.substring(2) : r.startsWith("../") ? r = t + r : (t.startsWith("..") && (t = ""), r.startsWith("**") ? r = t + r : r = t + "**/" + r)), r = H(k.normalize(r)), o && (r = "!" + r), s && (r = "^" + r), r;
934
934
  }
935
- function Vr(t) {
936
- const r = t.startsWith("!");
937
- return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
935
+ function Vr(r) {
936
+ const t = r.startsWith("!");
937
+ return t && (r = r.substring(1)), !r.startsWith("/") && !r.startsWith("**") && !r.startsWith("../") && (r = `**/${r}`), t && (r = "!" + r), r;
938
938
  }
939
- function Le(t) {
940
- return "^" + t;
939
+ function Le(r) {
940
+ return "^" + r;
941
941
  }
942
- async function Zr(t) {
943
- const s = (await j.promises.readFile(t, "utf-8")).split(`
942
+ async function Zr(r) {
943
+ const s = (await j.promises.readFile(r, "utf-8")).split(`
944
944
  `), o = [];
945
945
  return s.forEach((e) => {
946
946
  e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
947
947
  }), o;
948
948
  }
949
- async function $t(t) {
950
- const r = t.rootDir ?? ".", s = [];
951
- if (!t.globs?.length)
949
+ async function $t(r) {
950
+ const t = r.rootDir ?? ".", s = [];
951
+ if (!r.globs?.length)
952
952
  return s;
953
953
  const o = [];
954
- return t.globs.forEach((e) => {
954
+ return r.globs.forEach((e) => {
955
955
  e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Le(e.value) : e.value));
956
956
  }), o.length && await Promise.all(
957
957
  o.map(async (e) => {
@@ -959,7 +959,7 @@ async function $t(t) {
959
959
  pool: Se,
960
960
  count: 1,
961
961
  func: async () => {
962
- const n = k.resolve(r, e.value), i = await Zr(n), a = k.relative(r, k.dirname(n));
962
+ const n = k.resolve(t, e.value), i = await Zr(n), a = k.relative(t, k.dirname(n));
963
963
  i.forEach((c) => {
964
964
  c = Vr(c), c = Yr(c, a), s.push(e.exclude ? Le(c) : c);
965
965
  });
@@ -969,12 +969,12 @@ async function $t(t) {
969
969
  ), s;
970
970
  }
971
971
  function Mt({
972
- globs: t,
973
- rootDir: r,
972
+ globs: r,
973
+ rootDir: t,
974
974
  noCase: s
975
975
  }) {
976
976
  const o = [];
977
- return t.forEach((e) => {
977
+ return r.forEach((e) => {
978
978
  e = H(e).trim();
979
979
  const n = e.startsWith("^");
980
980
  n && (e = e.substring(1).trim());
@@ -984,7 +984,7 @@ function Mt({
984
984
  `Invalid glob pattern: "${e}". The syntax '${e.substring(0, 2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`
985
985
  );
986
986
  e.startsWith("/") && (e = "." + e);
987
- const a = H(r ? k.resolve(r, e) : e);
987
+ const a = H(t ? k.resolve(t, e) : e);
988
988
  if (!a)
989
989
  return;
990
990
  let c;
@@ -1016,61 +1016,61 @@ function Mt({
1016
1016
  return a ? !1 : i;
1017
1017
  };
1018
1018
  }
1019
- async function Xr(t) {
1020
- const r = t.rootDir ?? ".", s = [], o = {};
1021
- t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
1019
+ async function Xr(r) {
1020
+ const t = r.rootDir ?? ".", s = [], o = {};
1021
+ r.result.countFiles && (o.countFiles = 0), r.result.size && (o.size = 0);
1022
1022
  const e = await $t({
1023
- rootDir: r,
1024
- globs: t.globs
1023
+ rootDir: t,
1024
+ globs: r.globs
1025
1025
  });
1026
1026
  return await It({
1027
- paths: [r],
1027
+ paths: [t],
1028
1028
  walkLinks: !0,
1029
1029
  matchPath: Mt({
1030
1030
  globs: e,
1031
- rootDir: r,
1031
+ rootDir: t,
1032
1032
  noCase: !0
1033
1033
  }),
1034
1034
  handlePath: async ({ path: n, stat: i, itemStat: a }) => {
1035
- const c = k.relative(r, n), l = i.isDirectory(), u = i.isFile();
1035
+ const c = k.relative(t, n), l = i.isDirectory(), u = i.isFile();
1036
1036
  if (!l && !u)
1037
1037
  return !0;
1038
1038
  const f = H(c || "."), d = l ? "dir" : "file", p = l ? a.maxFileDateModified || null : i.mtimeMs, h = l ? a.totalSize : i.size, g = l ? a.countFiles : null, y = {
1039
1039
  path: f,
1040
1040
  type: d
1041
1041
  };
1042
- if (t.result.dateModified && (y.dateModified = p), t.result.size && (y.size = h), t.result.countFiles && (y.countFiles = g), t.dateModified && p != null) {
1043
- const [w, M] = t.dateModified;
1042
+ if (r.result.dateModified && (y.dateModified = p), r.result.size && (y.size = h), r.result.countFiles && (y.countFiles = g), r.dateModified && p != null) {
1043
+ const [w, M] = r.dateModified;
1044
1044
  if (w != null && p < w || M != null && p > M)
1045
1045
  return !1;
1046
1046
  }
1047
- if (t.totalSize && h != null) {
1048
- const [w, M] = t.totalSize;
1047
+ if (r.totalSize && h != null) {
1048
+ const [w, M] = r.totalSize;
1049
1049
  if (w != null && h < w || M != null && h > M)
1050
1050
  return !1;
1051
1051
  }
1052
- return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && h != null && (o.size = (o.size ?? 0) + h), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !t.result.dirs || u && !t.result.files || s.push(y), !0;
1052
+ return d === "file" && (o.countFiles = (o.countFiles ?? 0) + 1), d === "file" && h != null && (o.size = (o.size ?? 0) + h), p != null && (o.dateModified == null || p > o.dateModified) && (o.dateModified = p), l && !r.result.dirs || u && !r.result.files || s.push(y), !0;
1053
1053
  }
1054
1054
  }), { items: s, totals: o };
1055
1055
  }
1056
1056
  const Ae = ["B", "KB", "MB", "GB", "TB"], ze = 1024;
1057
- function Ue(t) {
1058
- if (t == null) return "-";
1059
- let r = t ?? 0, s = 0;
1060
- for (; r >= ze && s < Ae.length - 1; )
1061
- r /= ze, s++;
1062
- return `${s === 0 ? r.toString() : r.toFixed(2)}${Ae[s]}`;
1063
- }
1064
- function je(t) {
1065
- const s = Date.now() - t;
1057
+ function Ue(r) {
1058
+ if (r == null) return "-";
1059
+ let t = r ?? 0, s = 0;
1060
+ for (; t >= ze && s < Ae.length - 1; )
1061
+ t /= ze, s++;
1062
+ return `${s === 0 ? t.toString() : t.toFixed(2)}${Ae[s]}`;
1063
+ }
1064
+ function je(r) {
1065
+ const s = Date.now() - r;
1066
1066
  if (s < 0) return "0s";
1067
1067
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
1068
1068
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1069
1069
  }
1070
- function es(t, r) {
1071
- return r?.length ? [...t].sort((s, o) => {
1072
- for (let e = 0, n = r.length; e < n; e++) {
1073
- const i = r[e];
1070
+ function es(r, t) {
1071
+ return t?.length ? [...r].sort((s, o) => {
1072
+ for (let e = 0, n = t.length; e < n; e++) {
1073
+ const i = t[e];
1074
1074
  let a, c;
1075
1075
  switch (i.field) {
1076
1076
  case "type":
@@ -1101,10 +1101,10 @@ function es(t, r) {
1101
1101
  return i.desc ? -l : l;
1102
1102
  }
1103
1103
  return 0;
1104
- }) : t;
1104
+ }) : r;
1105
1105
  }
1106
- function ts(t, r) {
1107
- const s = es(t.items, r.sort ?? []), o = r.fields && r.fields.length > 0 ? r.fields : [];
1106
+ function ts(r, t) {
1107
+ const s = es(r.items, t.sort ?? []), o = t.fields && t.fields.length > 0 ? t.fields : [];
1108
1108
  let e = "";
1109
1109
  if (s.length > 0 && o.length > 0) {
1110
1110
  for (let n = 0, i = o.length; n < i; n++) {
@@ -1157,24 +1157,24 @@ function ts(t, r) {
1157
1157
  e.length > 0 && (e += `
1158
1158
  ---
1159
1159
  `);
1160
- const n = Ue(t.totals.size ?? 0), i = t.totals.dateModified ? `, last modified ${je(t.totals.dateModified)} ago` : "";
1161
- e += `Totals: ${t.totals.countFiles ?? 0} files in dirs, ${n}${i}`;
1160
+ const n = Ue(r.totals.size ?? 0), i = r.totals.dateModified ? `, last modified ${je(r.totals.dateModified)} ago` : "";
1161
+ e += `Totals: ${r.totals.countFiles ?? 0} files in dirs, ${n}${i}`;
1162
1162
  }
1163
1163
  return e;
1164
1164
  }
1165
- const rs = "5.0.1", ss = {
1165
+ const rs = "5.0.2", ss = {
1166
1166
  version: rs
1167
1167
  }, Wo = "Project Tools", Ko = "project-tools", Ho = ss.version, Qo = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
1168
- function _e(t) {
1169
- const r = t.match(
1168
+ function _e(r) {
1169
+ const t = r.match(
1170
1170
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
1171
1171
  );
1172
- if (!r)
1172
+ if (!t)
1173
1173
  throw new Error(
1174
- `Invalid time ago format: "${t}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
1174
+ `Invalid time ago format: "${r}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
1175
1175
  );
1176
- const s = parseFloat(r[1]);
1177
- let o = r[2];
1176
+ const s = parseFloat(t[1]);
1177
+ let o = t[2];
1178
1178
  switch (o !== "M" && (o = o.toLowerCase(), o.startsWith("month") ? o = "M" : o.length > 1 && (o = o[0])), o) {
1179
1179
  case "s":
1180
1180
  return s * 1e3;
@@ -1196,13 +1196,13 @@ function _e(t) {
1196
1196
  );
1197
1197
  }
1198
1198
  }
1199
- function Ge(t) {
1200
- const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1201
- if (!r)
1199
+ function Ge(r) {
1200
+ const t = r.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1201
+ if (!t)
1202
1202
  throw new Error(
1203
- `Invalid size format: "${t}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
1203
+ `Invalid size format: "${r}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
1204
1204
  );
1205
- const s = parseFloat(r[1]), o = r[2].toUpperCase();
1205
+ const s = parseFloat(t[1]), o = t[2].toUpperCase();
1206
1206
  switch (o) {
1207
1207
  case "B":
1208
1208
  return s;
@@ -1259,10 +1259,10 @@ const Tt = m.object({
1259
1259
  'Filter files/directories with total size at most this large. Only items with size <= this value will be included. For directories, uses total size of all contents. Format: number + unit (B/KB/MB/GB/TB). Examples: "1MB" (up to 1 megabyte), "500KB" (up to 500 kilobytes), "10GB" (up to 10 gigabytes). Combine with minTotalSize for size ranges'
1260
1260
  )
1261
1261
  });
1262
- async function os(t, r) {
1262
+ async function os(r, t) {
1263
1263
  let s;
1264
1264
  try {
1265
- s = Tt.parse(t);
1265
+ s = Tt.parse(r);
1266
1266
  } catch (y) {
1267
1267
  return {
1268
1268
  error: F(y)
@@ -1293,7 +1293,7 @@ async function os(t, r) {
1293
1293
  }) ?? null;
1294
1294
  (!d || d.length === 0) && (d = [{ field: "path", desc: !1 }]);
1295
1295
  const p = d?.map((y) => y.field) || [], h = be(
1296
- r.workingDir,
1296
+ t.workingDir,
1297
1297
  s.relativeRootDir
1298
1298
  );
1299
1299
  if ("error" in h)
@@ -1313,7 +1313,7 @@ async function os(t, r) {
1313
1313
  value: S,
1314
1314
  valueType: "pattern",
1315
1315
  exclude: !1
1316
- })) : [{ value: "**", valueType: "pattern", exclude: !1 }], w = r.globsExclude || [], M = [...y, ...w], E = {
1316
+ })) : [{ value: "**", valueType: "pattern", exclude: !1 }], w = t.globsExclude || [], M = [...y, ...w], E = {
1317
1317
  files: e ?? !1,
1318
1318
  dirs: n ?? !1,
1319
1319
  dateModified: f.includes("dateModified") || p.includes("dateModified"),
@@ -1359,8 +1359,8 @@ async function os(t, r) {
1359
1359
  return { error: y instanceof Error ? y.message : "Unknown error" };
1360
1360
  }
1361
1361
  }
1362
- function ns(t, r) {
1363
- t(
1362
+ function ns(r, t) {
1363
+ r(
1364
1364
  "fs-list",
1365
1365
  {
1366
1366
  title: "List Files and Directories",
@@ -1368,7 +1368,7 @@ function ns(t, r) {
1368
1368
  inputSchema: Tt.shape
1369
1369
  },
1370
1370
  async (s) => {
1371
- const o = await os(s, r);
1371
+ const o = await os(s, t);
1372
1372
  return o.error ? `Method: fs-list(${JSON.stringify(s)})
1373
1373
  ❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
1374
1374
  ${o.output || JSON.stringify(o, null, 2)}`;
@@ -1380,23 +1380,23 @@ let is = 0;
1380
1380
  function as() {
1381
1381
  return `${++is}-${Math.random().toString(36).slice(2)}`;
1382
1382
  }
1383
- function Z(t) {
1384
- return ue.has(t) || ue.set(t, {
1383
+ function Z(r) {
1384
+ return ue.has(r) || ue.set(r, {
1385
1385
  fsSnapshotQueries: /* @__PURE__ */ new Map(),
1386
1386
  fsSnapshots: /* @__PURE__ */ new Map(),
1387
1387
  preparedReplace: null
1388
- }), ue.get(t);
1388
+ }), ue.get(r);
1389
1389
  }
1390
- function Je(t) {
1391
- const r = t.match(
1390
+ function Je(r) {
1391
+ const t = r.match(
1392
1392
  /^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
1393
1393
  );
1394
- if (!r)
1394
+ if (!t)
1395
1395
  throw new Error(
1396
- `Invalid time ago format: "${t}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
1396
+ `Invalid time ago format: "${r}". Must be a number followed by a time unit. Valid units: s/sec/seconds (seconds), m/min/minutes (minutes), h/hours (hours), d/days (days), w/weeks (weeks), M/months (months), Y/years (years). Examples: "30s", "0.5h", "1.5d", "7d", "3w", "6M", "1Y". Format is case-insensitive except M (months) must be uppercase to distinguish from m (minutes).`
1397
1397
  );
1398
- const s = parseFloat(r[1]);
1399
- let o = r[2];
1398
+ const s = parseFloat(t[1]);
1399
+ let o = t[2];
1400
1400
  switch (o !== "M" && (o = o.toLowerCase(), o.startsWith("month") ? o = "M" : o.length > 1 && (o = o[0])), o) {
1401
1401
  case "s":
1402
1402
  return s * 1e3;
@@ -1418,13 +1418,13 @@ function Je(t) {
1418
1418
  );
1419
1419
  }
1420
1420
  }
1421
- function We(t) {
1422
- const r = t.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1423
- if (!r)
1421
+ function We(r) {
1422
+ const t = r.match(/^\s*(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)\s*$/i);
1423
+ if (!t)
1424
1424
  throw new Error(
1425
- `Invalid size format: "${t}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
1425
+ `Invalid size format: "${r}". Must be a number (integer or decimal) followed by a size unit. Valid units: B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes), TB (terabytes). Uses binary units (1024-based). Examples: "1B", "2.5KB", "100MB", "1.2GB", "0.5TB". Units are case-insensitive.`
1426
1426
  );
1427
- const s = parseFloat(r[1]), o = r[2].toUpperCase();
1427
+ const s = parseFloat(t[1]), o = t[2].toUpperCase();
1428
1428
  switch (o) {
1429
1429
  case "B":
1430
1430
  return s;
@@ -1477,16 +1477,16 @@ const xe = m.object({
1477
1477
  "countMatched",
1478
1478
  "size",
1479
1479
  "dateModified"
1480
- ].map((t, r) => [t, r])
1480
+ ].map((r, t) => [r, t])
1481
1481
  );
1482
- function ls(t, r) {
1483
- const s = Ke.get(t) ?? 1 / 0, o = Ke.get(r) ?? 1 / 0;
1482
+ function ls(r, t) {
1483
+ const s = Ke.get(r) ?? 1 / 0, o = Ke.get(t) ?? 1 / 0;
1484
1484
  return s > o ? 1 : s < o ? -1 : 0;
1485
1485
  }
1486
- async function Ct(t, r, s) {
1486
+ async function Ct(r, t, s) {
1487
1487
  let o;
1488
1488
  try {
1489
- o = xe.parse(t);
1489
+ o = xe.parse(r);
1490
1490
  } catch (h) {
1491
1491
  return {
1492
1492
  error: F(h)
@@ -1506,7 +1506,7 @@ async function Ct(t, r, s) {
1506
1506
  error: "Session ID is required"
1507
1507
  };
1508
1508
  const f = Z(s.sessionId), d = be(
1509
- r.workingDir,
1509
+ t.workingDir,
1510
1510
  o.relativeRootDir
1511
1511
  );
1512
1512
  if ("error" in d)
@@ -1528,7 +1528,7 @@ async function Ct(t, r, s) {
1528
1528
  value: x,
1529
1529
  valueType: "pattern",
1530
1530
  exclude: !1
1531
- })) : [{ value: "**", valueType: "pattern", exclude: !1 }], y = r.globsExclude || [], w = [...g, ...y];
1531
+ })) : [{ value: "**", valueType: "pattern", exclude: !1 }], y = t.globsExclude || [], w = [...g, ...y];
1532
1532
  let M = null, E = null;
1533
1533
  if (a || c)
1534
1534
  try {
@@ -1567,8 +1567,8 @@ async function Ct(t, r, s) {
1567
1567
  };
1568
1568
  }
1569
1569
  }
1570
- function cs(t, r) {
1571
- t(
1570
+ function cs(r, t) {
1571
+ r(
1572
1572
  "fs-snapshot-query-create",
1573
1573
  {
1574
1574
  title: "Create Filesystem Snapshot Query",
@@ -1576,21 +1576,21 @@ function cs(t, r) {
1576
1576
  inputSchema: xe.shape
1577
1577
  },
1578
1578
  async (s, o) => {
1579
- const e = await Ct(s, r, o);
1579
+ const e = await Ct(s, t, o);
1580
1580
  return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1581
1581
  ❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
1582
1582
  ✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
1583
1583
  }
1584
1584
  );
1585
1585
  }
1586
- function le(t) {
1587
- const { idToNode: r, idToChildIds: s } = t, o = r.get(null);
1586
+ function le(r) {
1587
+ const { idToNode: t, idToChildIds: s } = r, o = t.get(null);
1588
1588
  if (o == null)
1589
1589
  throw new Error(
1590
1590
  "Impossible behavior: root node (id: null) not found in idToNode"
1591
1591
  );
1592
1592
  const e = /* @__PURE__ */ new Map();
1593
- return r.forEach((n, i) => {
1593
+ return t.forEach((n, i) => {
1594
1594
  if (n != null) {
1595
1595
  if (e.has(n)) {
1596
1596
  const a = e.get(n);
@@ -1602,18 +1602,18 @@ function le(t) {
1602
1602
  }
1603
1603
  }), {
1604
1604
  root: o,
1605
- getNode: (n) => r.get(n) ?? null,
1605
+ getNode: (n) => t.get(n) ?? null,
1606
1606
  getId: (n) => e.get(n) ?? null,
1607
1607
  getChilds: (n) => {
1608
1608
  let i = e.get(n);
1609
1609
  if (i == null)
1610
- if (n === r.get(null))
1610
+ if (n === t.get(null))
1611
1611
  i = null;
1612
1612
  else
1613
1613
  throw new Error("Impossible behavior: node not found in idToNode");
1614
1614
  const a = s.get(i);
1615
1615
  return a == null ? null : a.map((c) => {
1616
- const l = r.get(c);
1616
+ const l = t.get(c);
1617
1617
  if (l == null)
1618
1618
  throw new Error(
1619
1619
  `Child node with id '${c}' not found in idToNode`
@@ -1623,22 +1623,22 @@ function le(t) {
1623
1623
  }
1624
1624
  };
1625
1625
  }
1626
- function vt(t, r, s) {
1626
+ function vt(r, t, s) {
1627
1627
  let o = null;
1628
- for (let e = 0, n = r.length; e < n; e++) {
1629
- const i = r[e], a = t(i), c = a == null ? null : vt(t, a, s), l = s(i, c);
1628
+ for (let e = 0, n = t.length; e < n; e++) {
1629
+ const i = t[e], a = r(i), c = a == null ? null : vt(r, a, s), l = s(i, c);
1630
1630
  l != null && (o == null && (o = []), o.push(l));
1631
1631
  }
1632
1632
  return o;
1633
1633
  }
1634
- function Et(t) {
1635
- const { getId: r, getChilds: s, rootNodes: o, createSnapshotNode: e } = t, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = vt(
1634
+ function Et(r) {
1635
+ const { getId: t, getChilds: s, rootNodes: o, createSnapshotNode: e } = r, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = vt(
1636
1636
  s,
1637
1637
  o,
1638
1638
  (u, f) => {
1639
1639
  const d = e(u, f);
1640
1640
  if (u != null && d != null) {
1641
- const p = r(u);
1641
+ const p = t(u);
1642
1642
  n.set(p, d), i.set(d, p);
1643
1643
  }
1644
1644
  return d != null && f != null && a.set(
@@ -1657,11 +1657,11 @@ function Et(t) {
1657
1657
  idToChildIds: a
1658
1658
  };
1659
1659
  }
1660
- function me(t) {
1661
- return t = t != null ? H(t).replace(/\/$/, "") : null, !t || t === "." ? null : t;
1660
+ function me(r) {
1661
+ return r = r != null ? H(r).replace(/\/$/, "") : null, !r || r === "." ? null : r;
1662
1662
  }
1663
- async function us(t) {
1664
- const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(t.rootDir || "."), n = {
1663
+ async function us(r) {
1664
+ const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(r.rootDir || "."), n = {
1665
1665
  path: ".",
1666
1666
  name: k.basename(o),
1667
1667
  type: "dir",
@@ -1669,10 +1669,10 @@ async function us(t) {
1669
1669
  dateModified: null,
1670
1670
  size: 0
1671
1671
  };
1672
- r.set(null, n);
1672
+ t.set(null, n);
1673
1673
  const i = await $t({
1674
1674
  rootDir: o,
1675
- globs: t.globs
1675
+ globs: r.globs
1676
1676
  });
1677
1677
  return await It({
1678
1678
  paths: [o],
@@ -1688,12 +1688,12 @@ async function us(t) {
1688
1688
  return !0;
1689
1689
  const p = me(u || "."), h = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
1690
1690
  let w = !0;
1691
- if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && g != null) {
1692
- const [I, T] = t.dateModified;
1691
+ if (d && !r.matchFiles && (w = !1), f && !r.matchDirs && (w = !1), w && d && r.dateModified && g != null) {
1692
+ const [I, T] = r.dateModified;
1693
1693
  (I != null && g < I || T != null && g > T) && (w = !1);
1694
1694
  }
1695
- if (w && d && t.totalSize && y != null) {
1696
- const [I, T] = t.totalSize;
1695
+ if (w && d && r.totalSize && y != null) {
1696
+ const [I, T] = r.totalSize;
1697
1697
  (I != null && y < I || T != null && y > T) && (w = !1);
1698
1698
  }
1699
1699
  if (f && !w) {
@@ -1710,26 +1710,26 @@ async function us(t) {
1710
1710
  };
1711
1711
  if (p == null)
1712
1712
  return n.dateModified = g, n.size = y, n.isMatched = w, !0;
1713
- r.set(p, M);
1713
+ t.set(p, M);
1714
1714
  const E = me(H(k.dirname(p)));
1715
1715
  let b = s.get(E);
1716
1716
  return b || (b = [], s.set(E, b)), b.push(p), !0;
1717
1717
  }
1718
1718
  }), {
1719
- idToNode: r,
1719
+ idToNode: t,
1720
1720
  idToChildIds: s
1721
1721
  };
1722
1722
  }
1723
1723
  const ds = [
1724
- { name: "[ ]", match: (t) => t === 32, min: 2, max: 81 },
1725
- { name: "[\\t]", match: (t) => t === 9, min: 2, max: 20 },
1726
- { name: "[\\n]", match: (t) => t === 10, min: 2, max: 14 },
1727
- { name: "[-]", match: (t) => t === 45, min: 2, max: 16 },
1728
- { name: "[=]", match: (t) => t === 61, min: 2, max: 16 },
1729
- { name: "[_]", match: (t) => t === 95, min: 2, max: 16 },
1730
- { name: "[*]", match: (t) => t === 42, min: 2, max: 16 },
1731
- { name: "[.]", match: (t) => t === 46, min: 2, max: 16 },
1732
- { name: "[0-9]", match: (t) => t >= 48 && t <= 57, min: 2, max: 3 }
1724
+ { name: "[ ]", match: (r) => r === 32, min: 2, max: 81 },
1725
+ { name: "[\\t]", match: (r) => r === 9, min: 2, max: 20 },
1726
+ { name: "[\\n]", match: (r) => r === 10, min: 2, max: 14 },
1727
+ { name: "[-]", match: (r) => r === 45, min: 2, max: 16 },
1728
+ { name: "[=]", match: (r) => r === 61, min: 2, max: 16 },
1729
+ { name: "[_]", match: (r) => r === 95, min: 2, max: 16 },
1730
+ { name: "[*]", match: (r) => r === 42, min: 2, max: 16 },
1731
+ { name: "[.]", match: (r) => r === 46, min: 2, max: 16 },
1732
+ { name: "[0-9]", match: (r) => r >= 48 && r <= 57, min: 2, max: 3 }
1733
1733
  // { name: '[a-z]', match: c => c >= 97 && c <= 122, min: 2, max: 2 },
1734
1734
  // { name: '[A-Z]', match: c => c >= 65 && c <= 90, min: 2, max: 2 },
1735
1735
  // Other ASCII symbols
@@ -1743,21 +1743,21 @@ const ds = [
1743
1743
  // max: 2,
1744
1744
  // },
1745
1745
  ];
1746
- function He(t, r = ds) {
1747
- const s = t.length;
1746
+ function He(r, t = ds) {
1747
+ const s = r.length;
1748
1748
  if (s === 0) return 0;
1749
- const o = r.length;
1749
+ const o = t.length;
1750
1750
  if (o === 0)
1751
1751
  return s;
1752
1752
  let e = 0, n = 0;
1753
1753
  for (; n < s; ) {
1754
- const i = t.charCodeAt(n);
1754
+ const i = r.charCodeAt(n);
1755
1755
  let a = !1;
1756
1756
  for (let c = 0; c < o; c++) {
1757
- const l = r[c];
1757
+ const l = t[c];
1758
1758
  if (l.match(i)) {
1759
1759
  let u = 1;
1760
- for (; ++n < s && l.match(t.charCodeAt(n)) && u < l.max; )
1760
+ for (; ++n < s && l.match(r.charCodeAt(n)) && u < l.max; )
1761
1761
  u++;
1762
1762
  if (u >= l.min) {
1763
1763
  e++, a = !0;
@@ -1769,27 +1769,27 @@ function He(t, r = ds) {
1769
1769
  }
1770
1770
  return e;
1771
1771
  }
1772
- function Nt(t) {
1773
- let r = 0;
1774
- return r += He(t.textOpen) + 1, t.textClose != null && (r += He(t.textClose) + 1), t.indent && (r += 1), r;
1772
+ function Nt(r) {
1773
+ let t = 0;
1774
+ return t += He(r.textOpen) + 1, r.textClose != null && (t += He(r.textClose) + 1), r.indent && (t += 1), t;
1775
1775
  }
1776
1776
  const Qe = ["B", "KB", "MB", "GB", "TB"], Ye = 1024;
1777
- function fs(t) {
1778
- if (t == null) return "-";
1779
- let r = t ?? 0, s = 0;
1780
- for (; r >= Ye && s < Qe.length - 1; )
1781
- r /= Ye, s++;
1782
- return `${s === 0 ? r.toString() : r.toFixed(2)}${Qe[s]}`;
1783
- }
1784
- function ps(t) {
1785
- const s = Date.now() - t;
1777
+ function fs(r) {
1778
+ if (r == null) return "-";
1779
+ let t = r ?? 0, s = 0;
1780
+ for (; t >= Ye && s < Qe.length - 1; )
1781
+ t /= Ye, s++;
1782
+ return `${s === 0 ? t.toString() : t.toFixed(2)}${Qe[s]}`;
1783
+ }
1784
+ function ps(r) {
1785
+ const s = Date.now() - r;
1786
1786
  if (s < 0) return "0s";
1787
1787
  const o = Math.floor(s / 1e3), e = Math.floor(o / 60), n = Math.floor(e / 60), i = Math.floor(n / 24), a = Math.floor(i / 7), c = Math.floor(i / 30), l = Math.floor(i / 365);
1788
1788
  return l > 0 ? `${l}Y` : c > 0 ? `${c}M` : a > 0 ? `${a}w` : i > 0 ? `${i}d` : n > 0 ? `${n}h` : e > 0 ? `${e}m` : `${o}s`;
1789
1789
  }
1790
- function hs(t) {
1790
+ function hs(r) {
1791
1791
  return function(s, o) {
1792
- const e = t.get(s), n = t.get(o);
1792
+ const e = r.get(s), n = r.get(o);
1793
1793
  if (e.type !== n.type)
1794
1794
  return e.type === "file" ? -1 : 1;
1795
1795
  if (e.type === "file")
@@ -1800,8 +1800,8 @@ function hs(t) {
1800
1800
  }
1801
1801
  };
1802
1802
  }
1803
- function ms(t) {
1804
- const r = t.fields ?? [];
1803
+ function ms(r) {
1804
+ const t = r.fields ?? [];
1805
1805
  return function(o, e) {
1806
1806
  let n = "", i, a = 0;
1807
1807
  const c = e ? e.length : 0;
@@ -1812,8 +1812,8 @@ function ms(t) {
1812
1812
  a += I.countMatched, l += I.countTotal, f += I.tokens, d += I.tokensTotal, p += I.size, h += I.countFiles, I.dateModified != null && (g == null || I.dateModified > g) && (g = I.dateModified);
1813
1813
  }
1814
1814
  o ? (y = o.type, w = o.name, M = o.path, i = o.isMatched, i && (a += 1), o.type === "file" ? (p = o.size || 0, h = 1, g = o.dateModified || null) : o.dateModified != null && (g == null || o.dateModified > g) && (g = o.dateModified)) : (y = "dir", w = "<root>", M = ".", i = !0);
1815
- for (let b = 0, I = r.length; b < I; b++) {
1816
- const T = r[b];
1815
+ for (let b = 0, I = t.length; b < I; b++) {
1816
+ const T = t[b];
1817
1817
  switch (b > 0 && (n += " "), T) {
1818
1818
  case "dateModified":
1819
1819
  n += g ? ps(g) : "-";
@@ -1855,8 +1855,8 @@ function ms(t) {
1855
1855
  };
1856
1856
  };
1857
1857
  }
1858
- async function gs(t) {
1859
- const r = await us(t), s = le(r), o = s.getChilds(s.root), e = Et({
1858
+ async function gs(r) {
1859
+ const t = await us(r), s = le(t), o = s.getChilds(s.root), e = Et({
1860
1860
  getId: (i) => {
1861
1861
  const a = s.getId(i);
1862
1862
  if (a == null)
@@ -1866,7 +1866,7 @@ async function gs(t) {
1866
1866
  return a;
1867
1867
  },
1868
1868
  getChilds: (i) => s.getChilds(i),
1869
- createSnapshotNode: ms(t),
1869
+ createSnapshotNode: ms(r),
1870
1870
  rootNodes: o ?? []
1871
1871
  }), n = hs(e.idToNode);
1872
1872
  return e.idToChildIds.forEach((i) => {
@@ -1882,10 +1882,10 @@ const ee = m.object({
1882
1882
  "Unique name for the filesystem snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
1883
1883
  )
1884
1884
  });
1885
- async function ce(t, r, s) {
1885
+ async function ce(r, t, s) {
1886
1886
  let o;
1887
1887
  try {
1888
- o = ee.parse(t);
1888
+ o = ee.parse(r);
1889
1889
  } catch (u) {
1890
1890
  return {
1891
1891
  error: F(u)
@@ -1912,7 +1912,7 @@ async function ce(t, r, s) {
1912
1912
  } else if (i) {
1913
1913
  const u = await Ct(
1914
1914
  i,
1915
- r,
1915
+ t,
1916
1916
  s
1917
1917
  );
1918
1918
  if (u.error != null)
@@ -1940,8 +1940,8 @@ async function ce(t, r, s) {
1940
1940
  };
1941
1941
  }
1942
1942
  }
1943
- function ws(t, r) {
1944
- t(
1943
+ function ws(r, t) {
1944
+ r(
1945
1945
  "fs-snapshot-create",
1946
1946
  {
1947
1947
  title: "Create Filesystem Snapshot",
@@ -1949,7 +1949,7 @@ function ws(t, r) {
1949
1949
  inputSchema: ee.shape
1950
1950
  },
1951
1951
  async (s, o) => {
1952
- const e = await ce(s, r, o);
1952
+ const e = await ce(s, t, o);
1953
1953
  if (e.error != null)
1954
1954
  return `Method: fs-snapshot-create(${JSON.stringify(s)})
1955
1955
  ❌ Error: ${e.error}`;
@@ -1964,14 +1964,14 @@ class ys {
1964
1964
  _first = null;
1965
1965
  _last = null;
1966
1966
  _size = 0;
1967
- enqueue(r) {
1968
- const s = { item: r, next: null };
1967
+ enqueue(t) {
1968
+ const s = { item: t, next: null };
1969
1969
  this._last ? this._last.next = s : this._first = s, this._last = s, this._size += 1;
1970
1970
  }
1971
1971
  dequeue() {
1972
1972
  if (!this._first) return null;
1973
- const r = this._first.item;
1974
- return this._first = this._first.next, this._first || (this._last = null), this._size -= 1, r;
1973
+ const t = this._first.item;
1974
+ return this._first = this._first.next, this._first || (this._last = null), this._size -= 1, t;
1975
1975
  }
1976
1976
  peek() {
1977
1977
  return this._first ? this._first.item : null;
@@ -1983,24 +1983,24 @@ class ys {
1983
1983
  return this._size;
1984
1984
  }
1985
1985
  }
1986
- function bs(t) {
1987
- const r = new ys(), {
1986
+ function bs(r) {
1987
+ const t = new ys(), {
1988
1988
  tree: s,
1989
1989
  limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
1990
1990
  indexRangeGroupStrategy: a
1991
- } = t, c = s.getChilds(s.root);
1992
- c != null && c.length > 0 && r.enqueue({
1991
+ } = r, c = s.getChilds(s.root);
1992
+ c != null && c.length > 0 && t.enqueue({
1993
1993
  reportNode: null,
1994
1994
  node: s.root
1995
1995
  });
1996
1996
  let l = null, u = 0, f = 0;
1997
- for (; !r.isEmpty(); ) {
1998
- const { reportNode: d, node: p } = r.dequeue(), h = s.getChilds(p);
1997
+ for (; !t.isEmpty(); ) {
1998
+ const { reportNode: d, node: p } = t.dequeue(), h = s.getChilds(p);
1999
1999
  if (h == null || p.countChilds === 0 || h.length !== p.countChilds)
2000
2000
  throw new Error(
2001
2001
  "Impossible behavior: nodeChilds is null or length mismatch"
2002
2002
  );
2003
- let g = r.size();
2003
+ let g = t.size();
2004
2004
  for (let w = 0; w < h.length; w++)
2005
2005
  h[w].countChilds > 0 && (g += 1);
2006
2006
  const y = g * a.tokens;
@@ -2034,7 +2034,7 @@ function bs(t) {
2034
2034
  };
2035
2035
  w.push(b);
2036
2036
  const I = s.getChilds(E);
2037
- I != null && I.length > 0 && r.enqueue({
2037
+ I != null && I.length > 0 && t.enqueue({
2038
2038
  reportNode: b,
2039
2039
  node: E
2040
2040
  });
@@ -2052,22 +2052,22 @@ function bs(t) {
2052
2052
  }
2053
2053
  return l ?? [];
2054
2054
  }
2055
- function kt(t) {
2055
+ function kt(r) {
2056
2056
  const {
2057
- tree: r,
2057
+ tree: t,
2058
2058
  request: { parentNodeId: s, childsIndexRange: o, limits: e },
2059
2059
  indexRangeGroupStrategy: n,
2060
2060
  ...i
2061
- } = t;
2061
+ } = r;
2062
2062
  let a;
2063
2063
  if (s != null) {
2064
- const d = r.getNode(s);
2064
+ const d = t.getNode(s);
2065
2065
  if (d == null)
2066
2066
  throw new Error(`Parent node "${s}" not found`);
2067
2067
  a = d;
2068
2068
  } else
2069
- a = r.root;
2070
- let c, l = r.getChilds(a) ?? [];
2069
+ a = t.root;
2070
+ let c, l = t.getChilds(a) ?? [];
2071
2071
  if (o != null) {
2072
2072
  let [d, p] = o;
2073
2073
  if (d < 0 && (d = 0), p < 0 && (p = 0), p >= l.length && (p = l.length - 1), p < d)
@@ -2090,9 +2090,9 @@ function kt(t) {
2090
2090
  countChilds: 1,
2091
2091
  tokensChilds: c.tokens
2092
2092
  }, f = {
2093
- ...r,
2093
+ ...t,
2094
2094
  root: u,
2095
- getChilds: (d) => d === u ? [c] : d === c ? l : r.getChilds(d)
2095
+ getChilds: (d) => d === u ? [c] : d === c ? l : t.getChilds(d)
2096
2096
  };
2097
2097
  return bs({
2098
2098
  tree: f,
@@ -2101,8 +2101,8 @@ function kt(t) {
2101
2101
  ...i
2102
2102
  });
2103
2103
  }
2104
- function Ot(t, r) {
2105
- if (t == null || t.length === 0)
2104
+ function Ot(r, t) {
2105
+ if (r == null || r.length === 0)
2106
2106
  return "No results found";
2107
2107
  let s = "";
2108
2108
  function o(e, n) {
@@ -2116,22 +2116,22 @@ function Ot(t, r) {
2116
2116
  `);
2117
2117
  }
2118
2118
  }
2119
- return o(t, ""), s;
2119
+ return o(r, ""), s;
2120
2120
  }
2121
2121
  class Ss {
2122
2122
  tokens = 16;
2123
2123
  // +1 indent, +1 for line break
2124
- getReportText = (r) => ({
2124
+ getReportText = (t) => ({
2125
2125
  indent: !0,
2126
- textOpen: `[${r.indexRange[0]}-${r.indexRange[1]}] see more ${r.countMatched} matched ${r.tokensGrouped} tokens`,
2126
+ textOpen: `[${t.indexRange[0]}-${t.indexRange[1]}] see more ${t.countMatched} matched ${t.tokensGrouped} tokens`,
2127
2127
  textClose: null
2128
2128
  });
2129
- add = (r, s, o) => r == null ? {
2129
+ add = (t, s, o) => t == null ? {
2130
2130
  indexRange: [o, o],
2131
2131
  countGrouped: 1,
2132
2132
  countMatched: s.countMatched,
2133
2133
  tokensGrouped: s.tokens
2134
- } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
2134
+ } : (t.indexRange[1] = o, t.countGrouped += 1, t.countMatched += s.countMatched, t.tokensGrouped += s.tokens, t);
2135
2135
  }
2136
2136
  const Rt = m.object({
2137
2137
  snapshotName: m.string().optional().describe("Name of previously created filesystem snapshot, to use"),
@@ -2155,10 +2155,10 @@ const Rt = m.object({
2155
2155
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
2156
2156
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
2157
2157
  });
2158
- async function xs(t, r, s) {
2158
+ async function xs(r, t, s) {
2159
2159
  let o;
2160
2160
  try {
2161
- o = Rt.parse(t);
2161
+ o = Rt.parse(r);
2162
2162
  } catch (g) {
2163
2163
  return {
2164
2164
  error: F(g)
@@ -2190,7 +2190,7 @@ async function xs(t, r, s) {
2190
2190
  } else if (n) {
2191
2191
  const g = await ce(
2192
2192
  n,
2193
- r,
2193
+ t,
2194
2194
  s
2195
2195
  );
2196
2196
  if (g.error != null)
@@ -2231,8 +2231,8 @@ async function xs(t, r, s) {
2231
2231
  };
2232
2232
  }
2233
2233
  }
2234
- function Is(t, r) {
2235
- t(
2234
+ function Is(r, t) {
2235
+ r(
2236
2236
  "fs-snapshot-browse",
2237
2237
  {
2238
2238
  title: "Browse Filesystem Snapshot",
@@ -2240,7 +2240,7 @@ function Is(t, r) {
2240
2240
  inputSchema: Rt.shape
2241
2241
  },
2242
2242
  async (s, o) => {
2243
- const e = await xs(s, r, o);
2243
+ const e = await xs(s, t, o);
2244
2244
  if (e.error != null)
2245
2245
  return `Method: fs-snapshot-browse(${JSON.stringify(s)})
2246
2246
  ❌ Error: ${e.error}`;
@@ -2262,26 +2262,26 @@ ${e.report}`, n;
2262
2262
  }
2263
2263
  );
2264
2264
  }
2265
- function Dt(t) {
2266
- const r = [], s = t.tree, o = t.query.rootDir ?? ".";
2265
+ function Dt(r) {
2266
+ const t = [], s = r.tree, o = r.query.rootDir ?? ".";
2267
2267
  function e(n) {
2268
- n.type === "file" && n.isMatched && r.push(o + "/" + n.path);
2268
+ n.type === "file" && n.isMatched && t.push(o + "/" + n.path);
2269
2269
  const i = s.getChilds(n);
2270
2270
  if (i != null)
2271
2271
  for (let a = 0; a < i.length; a++)
2272
2272
  e(i[a]);
2273
2273
  }
2274
- return e(s.root), r;
2274
+ return e(s.root), t;
2275
2275
  }
2276
2276
  const Ve = /* @__PURE__ */ new Map();
2277
- function $s(t) {
2278
- const r = H(t);
2279
- let s = Ve.get(r);
2280
- return s == null && (s = new nr(), Ve.set(r, s)), s;
2281
- }
2282
- async function Ms(t) {
2283
- const { filePath: r, func: s } = t;
2284
- return $s(r).lock(
2277
+ function $s(r) {
2278
+ const t = H(r);
2279
+ let s = Ve.get(t);
2280
+ return s == null && (s = new nr(), Ve.set(t, s)), s;
2281
+ }
2282
+ async function Ms(r) {
2283
+ const { filePath: t, func: s } = r;
2284
+ return $s(t).lock(
2285
2285
  () => V({
2286
2286
  pool: Se,
2287
2287
  count: 1,
@@ -2290,10 +2290,10 @@ async function Ms(t) {
2290
2290
  );
2291
2291
  }
2292
2292
  const Ze = 10, re = 48, Xe = 57, de = 36, Ts = 38, Cs = 39, vs = 60, Es = 62, Ns = 96, se = 0, et = 1, tt = 2, rt = 3, st = 4, ks = 5;
2293
- function Os(t) {
2294
- const { content: r, pattern: s, replacement: o } = t, e = r.length, n = [0];
2293
+ function Os(r) {
2294
+ const { content: t, pattern: s, replacement: o } = r, e = t.length, n = [0];
2295
2295
  for (let b = 0; b < e; b++)
2296
- r.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
2296
+ t.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
2297
2297
  const i = n.length, a = [], c = [];
2298
2298
  let l = null, u = null, f = null, d = 0;
2299
2299
  if (o != null) {
@@ -2345,7 +2345,7 @@ function Os(t) {
2345
2345
  let p = "", h = 0, g = 0;
2346
2346
  s.lastIndex = 0;
2347
2347
  let y;
2348
- for (; (y = s.exec(r)) !== null; ) {
2348
+ for (; (y = s.exec(t)) !== null; ) {
2349
2349
  const b = y.index, I = y[0], T = I.length, x = b + T;
2350
2350
  let S, v, P, O;
2351
2351
  if (i === 1)
@@ -2372,7 +2372,7 @@ function Os(t) {
2372
2372
  lines: [S, v],
2373
2373
  linesOffset: [P, O]
2374
2374
  }), o != null) {
2375
- p += r.substring(h, b);
2375
+ p += t.substring(h, b);
2376
2376
  let $;
2377
2377
  if (l != null)
2378
2378
  $ = l;
@@ -2389,10 +2389,10 @@ function Os(t) {
2389
2389
  $ += I;
2390
2390
  break;
2391
2391
  case tt:
2392
- $ += r.substring(0, b);
2392
+ $ += t.substring(0, b);
2393
2393
  break;
2394
2394
  case rt:
2395
- $ += r.substring(x);
2395
+ $ += t.substring(x);
2396
2396
  break;
2397
2397
  case st: {
2398
2398
  const B = L, z = B.length, A = B.charCodeAt(0) - re;
@@ -2423,8 +2423,8 @@ function Os(t) {
2423
2423
  break;
2424
2424
  }
2425
2425
  if (s.lastIndex = 0, o == null)
2426
- return { search: { content: r, matches: a }, replace: null };
2427
- p += r.substring(h);
2426
+ return { search: { content: t, matches: a }, replace: null };
2427
+ p += t.substring(h);
2428
2428
  const w = p.length, M = [0];
2429
2429
  for (let b = 0; b < w; b++)
2430
2430
  p.charCodeAt(b) === Ze && b + 1 < w && M.push(b + 1);
@@ -2454,23 +2454,23 @@ function Os(t) {
2454
2454
  T.lines[0] = v, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] = $;
2455
2455
  }
2456
2456
  return {
2457
- search: { content: r, matches: a },
2457
+ search: { content: t, matches: a },
2458
2458
  replace: { content: p, matches: c }
2459
2459
  };
2460
2460
  }
2461
- function Ft(t) {
2462
- if (t.length === 0)
2461
+ function Ft(r) {
2462
+ if (r.length === 0)
2463
2463
  return [];
2464
- const r = [...t].sort((i, a) => {
2464
+ const t = [...r].sort((i, a) => {
2465
2465
  const c = i.lines[0], l = a.lines[0];
2466
2466
  if (c > l) return 1;
2467
2467
  if (c < l) return -1;
2468
2468
  const u = i.lines[1], f = a.lines[1];
2469
2469
  return u > f ? 1 : u < f ? -1 : 0;
2470
2470
  }), s = [];
2471
- let o = [...r[0].offset], e = [...r[0].lines], n = [...r[0].linesOffset];
2472
- for (let i = 1; i < r.length; i++) {
2473
- const a = r[i];
2471
+ let o = [...t[0].offset], e = [...t[0].lines], n = [...t[0].linesOffset];
2472
+ for (let i = 1; i < t.length; i++) {
2473
+ const a = t[i];
2474
2474
  a.lines[0] <= e[1] ? (a.offset[0] < o[0] && (o[0] = a.offset[0]), a.offset[1] > o[1] && (o[1] = a.offset[1]), a.lines[1] > e[1] && (e[1] = a.lines[1], n[1] = a.linesOffset[1])) : (s.push({
2475
2475
  offset: o,
2476
2476
  lines: e,
@@ -2483,29 +2483,29 @@ function Ft(t) {
2483
2483
  linesOffset: n
2484
2484
  }), s;
2485
2485
  }
2486
- function oe(t, r, s, o) {
2486
+ function oe(r, t, s, o) {
2487
2487
  let e = 0, n = 0;
2488
2488
  for (let u = 0; u < s; u++)
2489
- t.charCodeAt(u) === 10 && (n = u + 1, e++);
2489
+ r.charCodeAt(u) === 10 && (n = u + 1, e++);
2490
2490
  const i = e, a = n;
2491
2491
  let c = s;
2492
2492
  for (; c < o; c++)
2493
- t.charCodeAt(c) === 10 && e++;
2493
+ r.charCodeAt(c) === 10 && e++;
2494
2494
  const l = e + 1;
2495
- for (; c < r; c++)
2496
- if (t.charCodeAt(c) === 10)
2495
+ for (; c < t; c++)
2496
+ if (r.charCodeAt(c) === 10)
2497
2497
  return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: c + 1 };
2498
- return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: r };
2498
+ return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: t };
2499
2499
  }
2500
- function Rs(t, r) {
2501
- if (t.replace == null && r.replace == null) {
2502
- const U = [...t.search.matches, ...r.search.matches];
2500
+ function Rs(r, t) {
2501
+ if (r.replace == null && t.replace == null) {
2502
+ const U = [...r.search.matches, ...t.search.matches];
2503
2503
  return {
2504
- search: { content: t.search.content, matches: Ft(U) },
2504
+ search: { content: r.search.content, matches: Ft(U) },
2505
2505
  replace: null
2506
2506
  };
2507
2507
  }
2508
- const s = t.replace ?? t.search, o = r.replace ?? r.search, e = t.search.content, n = o.content, i = e.length, a = n.length, c = t.search.matches, l = s.matches, u = r.search.matches, f = o.matches, d = l.length, p = u.length, h = [], g = [];
2508
+ const s = r.replace ?? r.search, o = t.replace ?? t.search, e = r.search.content, n = o.content, i = e.length, a = n.length, c = r.search.matches, l = s.matches, u = t.search.matches, f = o.matches, d = l.length, p = u.length, h = [], g = [];
2509
2509
  let y = 0, w = 0, M = 0, E = 0, b = 0, I = 0, T = 0, x = 0, S = 0, v = 0, P = 0, O = 0, $ = 0, C = 0, N = 0, R = 0, K = 0, q = 0, L = 0, B = 0, z = 0, A = 0, _ = 0, D = 0;
2510
2510
  for (; y < d || w < p; )
2511
2511
  if (y < d && (b = l[y].offset[0], I = l[y].offset[1]), w < p && (T = u[w].offset[0], x = u[w].offset[1]), y < d && w < p && b < x && T < I) {
@@ -2557,17 +2557,17 @@ function Rs(t, r) {
2557
2557
  replace: { content: n, matches: g }
2558
2558
  };
2559
2559
  }
2560
- async function Ds(t) {
2561
- const { filePath: r, operations: s, dryRun: o } = t;
2562
- return s.length === 0 ? { filePath: r, result: null } : Ms({
2563
- filePath: r,
2560
+ async function Ds(r) {
2561
+ const { filePath: t, operations: s, dryRun: o } = r;
2562
+ return s.length === 0 ? { filePath: t, result: null } : Ms({
2563
+ filePath: t,
2564
2564
  func: async () => {
2565
2565
  let e;
2566
2566
  try {
2567
- e = await j.promises.readFile(r, "utf-8");
2567
+ e = await j.promises.readFile(t, "utf-8");
2568
2568
  } catch (a) {
2569
2569
  return {
2570
- filePath: r,
2570
+ filePath: t,
2571
2571
  result: null,
2572
2572
  error: `Failed to read file: ${a instanceof Error ? a.message : a + ""}`
2573
2573
  };
@@ -2580,7 +2580,7 @@ async function Ds(t) {
2580
2580
  l = new RegExp(c.pattern, c.flags ?? "");
2581
2581
  } catch (d) {
2582
2582
  return {
2583
- filePath: r,
2583
+ filePath: t,
2584
2584
  result: null,
2585
2585
  error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
2586
2586
  };
@@ -2596,23 +2596,23 @@ async function Ds(t) {
2596
2596
  const a = n.replace.content;
2597
2597
  if (a !== e)
2598
2598
  try {
2599
- await j.promises.writeFile(r, a, "utf-8");
2599
+ await j.promises.writeFile(t, a, "utf-8");
2600
2600
  } catch (c) {
2601
2601
  return {
2602
- filePath: r,
2602
+ filePath: t,
2603
2603
  result: n,
2604
2604
  error: `Failed to write file: ${c instanceof Error ? c.message : c + ""}`
2605
2605
  };
2606
2606
  }
2607
2607
  }
2608
- return { filePath: r, result: n };
2608
+ return { filePath: t, result: n };
2609
2609
  }
2610
2610
  });
2611
2611
  }
2612
- async function Ie(t) {
2613
- const { filePaths: r, operations: s, dryRun: o, dateModifiedMax: e } = t;
2612
+ async function Ie(r) {
2613
+ const { filePaths: t, operations: s, dryRun: o, dateModifiedMax: e } = r;
2614
2614
  return { results: await Promise.all(
2615
- r.map(async (i) => {
2615
+ t.map(async (i) => {
2616
2616
  if (e != null) {
2617
2617
  const a = await j.promises.stat(i).catch(() => null);
2618
2618
  if (a == null)
@@ -2633,26 +2633,26 @@ async function Ie(t) {
2633
2633
  ) };
2634
2634
  }
2635
2635
  const Fs = 6;
2636
- function Ps(t) {
2637
- const { content: r, startLine: s } = t, o = t.padWidth ?? Fs;
2636
+ function Ps(r) {
2637
+ const { content: t, startLine: s } = r, o = r.padWidth ?? Fs;
2638
2638
  let e = "", n = 0, i = 0;
2639
- for (; n < r.length; ) {
2640
- const a = r.indexOf(`
2641
- `, n), c = a === -1 ? r.length : a + 1;
2642
- e += String(s + i + 1).padStart(o) + "→" + r.substring(n, c), n = c, i++;
2639
+ for (; n < t.length; ) {
2640
+ const a = t.indexOf(`
2641
+ `, n), c = a === -1 ? t.length : a + 1;
2642
+ e += String(s + i + 1).padStart(o) + "→" + t.substring(n, c), n = c, i++;
2643
2643
  }
2644
2644
  return e.length > 0 && !e.endsWith(`
2645
2645
  `) && (e += `
2646
2646
  `), e;
2647
2647
  }
2648
- function fe(t) {
2649
- const { content: r, matches: s, outputLimit: o } = t;
2648
+ function fe(r) {
2649
+ const { content: t, matches: s, outputLimit: o } = r;
2650
2650
  if (s.length === 0)
2651
2651
  return { output: "", truncated: !1 };
2652
2652
  const e = Ft(s);
2653
2653
  let n = "", i = !1;
2654
2654
  for (let a = 0; a < e.length; a++) {
2655
- const c = e[a], l = r.substring(
2655
+ const c = e[a], l = t.substring(
2656
2656
  c.linesOffset[0],
2657
2657
  c.linesOffset[1]
2658
2658
  ), u = Ps({
@@ -2669,12 +2669,12 @@ function fe(t) {
2669
2669
  return { output: n, truncated: i };
2670
2670
  }
2671
2671
  const ot = "BEFORE", nt = "AFTER";
2672
- function Bs(t) {
2673
- const { result: r, outputLimit: s } = t;
2674
- if (r.replace == null) {
2672
+ function Bs(r) {
2673
+ const { result: t, outputLimit: s } = r;
2674
+ if (t.replace == null) {
2675
2675
  const h = fe({
2676
- content: r.search.content,
2677
- matches: r.search.matches,
2676
+ content: t.search.content,
2677
+ matches: t.search.matches,
2678
2678
  outputLimit: s
2679
2679
  });
2680
2680
  return { output: h.output, truncated: h.truncated };
@@ -2687,21 +2687,21 @@ function Bs(t) {
2687
2687
  if (s != null && s < a)
2688
2688
  return { output: "", truncated: !0 };
2689
2689
  const c = s != null ? s - a : void 0, l = c != null ? Math.floor(c / 2) : void 0, u = fe({
2690
- content: r.search.content,
2691
- matches: r.search.matches,
2690
+ content: t.search.content,
2691
+ matches: t.search.matches,
2692
2692
  outputLimit: l
2693
2693
  }), f = c != null ? c - u.output.length : void 0, d = fe({
2694
- content: r.replace.content,
2695
- matches: r.replace.matches,
2694
+ content: t.replace.content,
2695
+ matches: t.replace.matches,
2696
2696
  outputLimit: f
2697
2697
  });
2698
2698
  return { output: o + u.output + e + n + d.output + i, truncated: u.truncated || d.truncated };
2699
2699
  }
2700
- function $e(t) {
2701
- const { result: r, rootDir: s, errorsOnly: o } = t;
2700
+ function $e(r) {
2701
+ const { result: t, rootDir: s, errorsOnly: o } = r;
2702
2702
  let e = "";
2703
- for (let n = 0; n < r.results.length; n++) {
2704
- const i = r.results[n], a = k.relative(s, i.filePath), c = e.length > 0 ? 1 : 0;
2703
+ for (let n = 0; n < t.results.length; n++) {
2704
+ const i = t.results[n], a = k.relative(s, i.filePath), c = e.length > 0 ? 1 : 0;
2705
2705
  if (i.error != null) {
2706
2706
  const u = a + `
2707
2707
  ❌ ` + i.error + `
@@ -2736,10 +2736,10 @@ const Ls = m.object({
2736
2736
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2737
2737
  )
2738
2738
  });
2739
- async function As(t, r, s) {
2739
+ async function As(r, t, s) {
2740
2740
  let o;
2741
2741
  try {
2742
- o = Pt.parse(t);
2742
+ o = Pt.parse(r);
2743
2743
  } catch (w) {
2744
2744
  return {
2745
2745
  error: F(w)
@@ -2764,7 +2764,7 @@ async function As(t, r, s) {
2764
2764
  } else if (n) {
2765
2765
  const w = await ce(
2766
2766
  n,
2767
- r,
2767
+ t,
2768
2768
  s
2769
2769
  );
2770
2770
  if (w.error != null)
@@ -2789,8 +2789,8 @@ async function As(t, r, s) {
2789
2789
  limit: a
2790
2790
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2791
2791
  }
2792
- function zs(t, r) {
2793
- t(
2792
+ function zs(r, t) {
2793
+ r(
2794
2794
  "fs-snapshot-search",
2795
2795
  {
2796
2796
  title: "Search File Contents in Snapshot",
@@ -2800,7 +2800,7 @@ function zs(t, r) {
2800
2800
  async (s, o) => {
2801
2801
  const e = await As(
2802
2802
  s,
2803
- r,
2803
+ t,
2804
2804
  o
2805
2805
  );
2806
2806
  if (e.error != null)
@@ -2835,10 +2835,10 @@ const Us = m.object({
2835
2835
  `Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
2836
2836
  )
2837
2837
  });
2838
- async function js(t, r, s) {
2838
+ async function js(r, t, s) {
2839
2839
  let o;
2840
2840
  try {
2841
- o = Bt.parse(t);
2841
+ o = Bt.parse(r);
2842
2842
  } catch (b) {
2843
2843
  return {
2844
2844
  error: F(b)
@@ -2863,7 +2863,7 @@ async function js(t, r, s) {
2863
2863
  } else if (n) {
2864
2864
  const b = await ce(
2865
2865
  n,
2866
- r,
2866
+ t,
2867
2867
  s
2868
2868
  );
2869
2869
  if (b.error != null)
@@ -2900,8 +2900,8 @@ Review the output carefully before executing. Call fs-snapshot-replace-execute w
2900
2900
  limit: a
2901
2901
  }).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
2902
2902
  }
2903
- function qs(t, r) {
2904
- t(
2903
+ function qs(r, t) {
2904
+ r(
2905
2905
  "fs-snapshot-replace-prepare",
2906
2906
  {
2907
2907
  title: "Prepare File Content Replacement",
@@ -2911,7 +2911,7 @@ function qs(t, r) {
2911
2911
  async (s, o) => {
2912
2912
  const e = await js(
2913
2913
  s,
2914
- r,
2914
+ t,
2915
2915
  o
2916
2916
  );
2917
2917
  if (e.error != null)
@@ -2933,10 +2933,10 @@ Reminder: use one snapshot covering all target files; include all patterns in th
2933
2933
  const Lt = m.object({
2934
2934
  replaceId: m.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
2935
2935
  });
2936
- async function _s(t, r, s) {
2936
+ async function _s(r, t, s) {
2937
2937
  let o;
2938
2938
  try {
2939
- o = Lt.parse(t);
2939
+ o = Lt.parse(r);
2940
2940
  } catch (l) {
2941
2941
  return {
2942
2942
  error: F(l)
@@ -2966,8 +2966,8 @@ async function _s(t, r, s) {
2966
2966
  errorsOnly: !0
2967
2967
  }) || null };
2968
2968
  }
2969
- function Gs(t, r) {
2970
- t(
2969
+ function Gs(r, t) {
2970
+ r(
2971
2971
  "fs-snapshot-replace-execute",
2972
2972
  {
2973
2973
  title: "Execute Prepared Replacement",
@@ -2977,7 +2977,7 @@ function Gs(t, r) {
2977
2977
  async (s, o) => {
2978
2978
  const e = await _s(
2979
2979
  s,
2980
- r,
2980
+ t,
2981
2981
  o
2982
2982
  );
2983
2983
  if (e.error != null)
@@ -2990,19 +2990,19 @@ ${e.output}`), n;
2990
2990
  }
2991
2991
  );
2992
2992
  }
2993
- function Js(t, r) {
2994
- r.list && ns(t, r), r.snapshotQueryCreate && cs(t, r), r.snapshotCreate && ws(t, r), r.snapshotBrowse && Is(t, r), r.snapshotSearch && zs(t, r), r.snapshotReplace && (qs(t, r), Gs(t, r)), console.log(
2993
+ function Js(r, t) {
2994
+ t.list && ns(r, t), t.snapshotQueryCreate && cs(r, t), t.snapshotCreate && ws(r, t), t.snapshotBrowse && Is(r, t), t.snapshotSearch && zs(r, t), t.snapshotReplace && (qs(r, t), Gs(r, t)), console.log(
2995
2995
  `File manager:
2996
- - Working directory: ${k.resolve(r.workingDir || "")}
2996
+ - Working directory: ${k.resolve(t.workingDir || "")}
2997
2997
  `
2998
2998
  );
2999
2999
  }
3000
3000
  const pe = /* @__PURE__ */ new Map();
3001
- function W(t) {
3002
- return pe.has(t) || pe.set(t, {
3001
+ function W(r) {
3002
+ return pe.has(r) || pe.set(r, {
3003
3003
  browsers: /* @__PURE__ */ new Map(),
3004
3004
  domSnapshotQueries: /* @__PURE__ */ new Map()
3005
- }), pe.get(t);
3005
+ }), pe.get(r);
3006
3006
  }
3007
3007
  const Me = m.object({
3008
3008
  name: m.string().describe(
@@ -3012,10 +3012,10 @@ const Me = m.object({
3012
3012
  muteAudio: m.boolean().optional().describe("Mute audio in the browser"),
3013
3013
  devTools: m.boolean().optional().describe("Open browser with dev tools")
3014
3014
  });
3015
- async function At(t, r, s) {
3015
+ async function At(r, t, s) {
3016
3016
  let o;
3017
3017
  try {
3018
- o = Me.parse(t);
3018
+ o = Me.parse(r);
3019
3019
  } catch (l) {
3020
3020
  return {
3021
3021
  error: F(l)
@@ -3049,8 +3049,8 @@ async function At(t, r, s) {
3049
3049
  };
3050
3050
  }
3051
3051
  }
3052
- function Ws(t, r) {
3053
- t(
3052
+ function Ws(r, t) {
3053
+ r(
3054
3054
  "playwright-browser-create",
3055
3055
  {
3056
3056
  title: "Create Browser",
@@ -3058,17 +3058,17 @@ function Ws(t, r) {
3058
3058
  inputSchema: Me.shape
3059
3059
  },
3060
3060
  async (s, o) => {
3061
- const e = await At(s, r, o);
3061
+ const e = await At(s, t, o);
3062
3062
  return `Method: playwright-browser-create(${JSON.stringify(s)})
3063
3063
  ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
3064
3064
  }
3065
3065
  );
3066
3066
  }
3067
3067
  const zt = m.object({});
3068
- async function Ks(t, r, s) {
3068
+ async function Ks(r, t, s) {
3069
3069
  let o;
3070
3070
  try {
3071
- o = zt.parse(t);
3071
+ o = zt.parse(r);
3072
3072
  } catch (i) {
3073
3073
  return {
3074
3074
  error: F(i)
@@ -3083,8 +3083,8 @@ async function Ks(t, r, s) {
3083
3083
  browserInfos: Array.from(e.browsers.values())
3084
3084
  };
3085
3085
  }
3086
- function Hs(t, r) {
3087
- t(
3086
+ function Hs(r, t) {
3087
+ r(
3088
3088
  "playwright-browser-list",
3089
3089
  {
3090
3090
  title: "List Browsers",
@@ -3092,7 +3092,7 @@ function Hs(t, r) {
3092
3092
  inputSchema: zt.shape
3093
3093
  },
3094
3094
  async (s, o) => {
3095
- const e = await Ks(s, r, o);
3095
+ const e = await Ks(s, t, o);
3096
3096
  if (e.error != null)
3097
3097
  return `Method: playwright-browser-list(${JSON.stringify(s)})
3098
3098
  ❌ Error: ${e.error}`;
@@ -3109,10 +3109,10 @@ const Ut = m.object({
3109
3109
  "Names of browsers to close. If not specified, closes all browsers"
3110
3110
  )
3111
3111
  });
3112
- async function Qs(t, r, s) {
3112
+ async function Qs(r, t, s) {
3113
3113
  let o;
3114
3114
  try {
3115
- o = Ut.parse(t);
3115
+ o = Ut.parse(r);
3116
3116
  } catch (l) {
3117
3117
  return {
3118
3118
  error: F(l)
@@ -3143,8 +3143,8 @@ async function Qs(t, r, s) {
3143
3143
  ...a.length > 0 && { errors: a }
3144
3144
  };
3145
3145
  }
3146
- function Ys(t, r) {
3147
- t(
3146
+ function Ys(r, t) {
3147
+ r(
3148
3148
  "playwright-browser-close",
3149
3149
  {
3150
3150
  title: "Close Browsers",
@@ -3152,7 +3152,7 @@ function Ys(t, r) {
3152
3152
  inputSchema: Ut.shape
3153
3153
  },
3154
3154
  async (s, o) => {
3155
- const e = await Qs(s, r, o);
3155
+ const e = await Qs(s, t, o);
3156
3156
  if (e.error != null)
3157
3157
  return `Method: playwright-browser-close(${JSON.stringify(s)})
3158
3158
  ❌ Error: ${e.error}`;
@@ -3184,10 +3184,10 @@ const Te = m.object({
3184
3184
  height: m.number()
3185
3185
  }).optional().describe("Viewport size configuration")
3186
3186
  });
3187
- async function jt(t, r, s) {
3187
+ async function jt(r, t, s) {
3188
3188
  let o;
3189
3189
  try {
3190
- o = Te.parse(t);
3190
+ o = Te.parse(r);
3191
3191
  } catch (p) {
3192
3192
  return {
3193
3193
  error: F(p)
@@ -3210,7 +3210,7 @@ async function jt(t, r, s) {
3210
3210
  error: `Browser "${n}" not found`
3211
3211
  };
3212
3212
  } else if (i) {
3213
- const p = await At(i, r, s);
3213
+ const p = await At(i, t, s);
3214
3214
  if (p.error != null)
3215
3215
  return {
3216
3216
  error: p.error
@@ -3242,8 +3242,8 @@ async function jt(t, r, s) {
3242
3242
  };
3243
3243
  }
3244
3244
  }
3245
- function Vs(t, r) {
3246
- t(
3245
+ function Vs(r, t) {
3246
+ r(
3247
3247
  "playwright-context-create",
3248
3248
  {
3249
3249
  title: "Create Browser Context",
@@ -3251,7 +3251,7 @@ function Vs(t, r) {
3251
3251
  inputSchema: Te.shape
3252
3252
  },
3253
3253
  async (s, o) => {
3254
- const e = await jt(s, r, o);
3254
+ const e = await jt(s, t, o);
3255
3255
  if (e.error != null)
3256
3256
  return `Method: playwright-context-create(${JSON.stringify(s)})
3257
3257
  ❌ Error: ${e.error}`;
@@ -3267,10 +3267,10 @@ const qt = m.object({
3267
3267
  "Name of browser to list contexts from. If not specified, lists contexts from all browsers"
3268
3268
  )
3269
3269
  });
3270
- async function Zs(t, r, s) {
3270
+ async function Zs(r, t, s) {
3271
3271
  let o;
3272
3272
  try {
3273
- o = qt.parse(t);
3273
+ o = qt.parse(r);
3274
3274
  } catch (a) {
3275
3275
  return {
3276
3276
  error: F(a)
@@ -3304,8 +3304,8 @@ async function Zs(t, r, s) {
3304
3304
  contextsByBrowser: i
3305
3305
  };
3306
3306
  }
3307
- function Xs(t, r) {
3308
- t(
3307
+ function Xs(r, t) {
3308
+ r(
3309
3309
  "playwright-context-list",
3310
3310
  {
3311
3311
  title: "List Browser Contexts",
@@ -3313,7 +3313,7 @@ function Xs(t, r) {
3313
3313
  inputSchema: qt.shape
3314
3314
  },
3315
3315
  async (s, o) => {
3316
- const e = await Zs(s, r, o);
3316
+ const e = await Zs(s, t, o);
3317
3317
  if ("error" in e)
3318
3318
  return `Method: playwright-context-list(${JSON.stringify(s)})
3319
3319
  ❌ Error: ${e.error}`;
@@ -3334,10 +3334,10 @@ const _t = m.object({
3334
3334
  "Name of browser to close contexts from. If not specified, searches all browsers"
3335
3335
  )
3336
3336
  });
3337
- async function eo(t, r, s) {
3337
+ async function eo(r, t, s) {
3338
3338
  let o;
3339
3339
  try {
3340
- o = _t.parse(t);
3340
+ o = _t.parse(r);
3341
3341
  } catch (u) {
3342
3342
  return {
3343
3343
  error: F(u)
@@ -3388,8 +3388,8 @@ async function eo(t, r, s) {
3388
3388
  ...c.length > 0 && { errors: c }
3389
3389
  };
3390
3390
  }
3391
- function to(t, r) {
3392
- t(
3391
+ function to(r, t) {
3392
+ r(
3393
3393
  "playwright-context-close",
3394
3394
  {
3395
3395
  title: "Close Browser Contexts",
@@ -3397,7 +3397,7 @@ function to(t, r) {
3397
3397
  inputSchema: _t.shape
3398
3398
  },
3399
3399
  async (s, o) => {
3400
- const e = await eo(s, r, o);
3400
+ const e = await eo(s, t, o);
3401
3401
  if ("error" in e)
3402
3402
  return `Method: playwright-context-close(${JSON.stringify(s)})
3403
3403
  ❌ Error: ${e.error}`;
@@ -3415,7 +3415,7 @@ ${n.join(`
3415
3415
  );
3416
3416
  }
3417
3417
  function ro() {
3418
- class t {
3418
+ class r {
3419
3419
  prevId = 0;
3420
3420
  objectToId = /* @__PURE__ */ new WeakMap();
3421
3421
  idToObject = /* @__PURE__ */ new Map();
@@ -3437,16 +3437,16 @@ function ro() {
3437
3437
  return u ?? (this.idToObject.delete(c), null);
3438
3438
  }
3439
3439
  }
3440
- function r(a, c, l) {
3440
+ function t(a, c, l) {
3441
3441
  let u = null;
3442
3442
  for (let f = 0, d = c.length; f < d; f++) {
3443
- const p = c[f], h = a(p), g = h == null ? null : r(a, h, l), y = l(p, g);
3443
+ const p = c[f], h = a(p), g = h == null ? null : t(a, h, l), y = l(p, g);
3444
3444
  y != null && (u == null && (u = []), u.push(y));
3445
3445
  }
3446
3446
  return u;
3447
3447
  }
3448
3448
  function s(a) {
3449
- const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = r(
3449
+ const { getId: c, getChilds: l, rootNodes: u, createSnapshotNode: f } = a, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = t(
3450
3450
  l,
3451
3451
  u,
3452
3452
  (w, M) => {
@@ -3490,7 +3490,7 @@ function ro() {
3490
3490
  };
3491
3491
  };
3492
3492
  }
3493
- const n = new t();
3493
+ const n = new r();
3494
3494
  function i(a) {
3495
3495
  const c = e(a);
3496
3496
  return s({
@@ -3511,10 +3511,10 @@ const so = `(function (){function __name(fn){return fn};${ro.toString()}; setupP
3511
3511
  "Unique name for the page. Recommended format: kebab-case-1, kebab-case-2, ..."
3512
3512
  )
3513
3513
  });
3514
- async function Gt(t, r, s) {
3514
+ async function Gt(r, t, s) {
3515
3515
  let o;
3516
3516
  try {
3517
- o = Ce.parse(t);
3517
+ o = Ce.parse(r);
3518
3518
  } catch (f) {
3519
3519
  return {
3520
3520
  error: F(f)
@@ -3542,7 +3542,7 @@ async function Gt(t, r, s) {
3542
3542
  error: `Context "${n}" not found`
3543
3543
  };
3544
3544
  } else if (i) {
3545
- const f = await jt(i, r, s);
3545
+ const f = await jt(i, t, s);
3546
3546
  if (f.error != null)
3547
3547
  return {
3548
3548
  error: f.error
@@ -3572,8 +3572,8 @@ async function Gt(t, r, s) {
3572
3572
  };
3573
3573
  }
3574
3574
  }
3575
- function oo(t, r) {
3576
- t(
3575
+ function oo(r, t) {
3576
+ r(
3577
3577
  "playwright-page-create",
3578
3578
  {
3579
3579
  title: "Create Page",
@@ -3581,7 +3581,7 @@ function oo(t, r) {
3581
3581
  inputSchema: Ce.shape
3582
3582
  },
3583
3583
  async (s, o) => {
3584
- const e = await Gt(s, r, o);
3584
+ const e = await Gt(s, t, o);
3585
3585
  if (e.error != null)
3586
3586
  return `Method: playwright-page-create(${JSON.stringify(s)})
3587
3587
  ❌ Error: ${e.error}`;
@@ -3601,10 +3601,10 @@ const Jt = m.object({
3601
3601
  "Name of browser to search in. If not specified, searches all browsers"
3602
3602
  )
3603
3603
  });
3604
- async function no(t, r, s) {
3604
+ async function no(r, t, s) {
3605
3605
  let o;
3606
3606
  try {
3607
- o = Jt.parse(t);
3607
+ o = Jt.parse(r);
3608
3608
  } catch (c) {
3609
3609
  return {
3610
3610
  error: F(c)
@@ -3665,8 +3665,8 @@ async function no(t, r, s) {
3665
3665
  pagesByContext: a
3666
3666
  };
3667
3667
  }
3668
- function io(t, r) {
3669
- t(
3668
+ function io(r, t) {
3669
+ r(
3670
3670
  "playwright-page-list",
3671
3671
  {
3672
3672
  title: "List Pages",
@@ -3674,7 +3674,7 @@ function io(t, r) {
3674
3674
  inputSchema: Jt.shape
3675
3675
  },
3676
3676
  async (s, o) => {
3677
- const e = await no(s, r, o);
3677
+ const e = await no(s, t, o);
3678
3678
  if ("error" in e)
3679
3679
  return `Method: playwright-page-list(${JSON.stringify(s)})
3680
3680
  ❌ Error: ${e.error}`;
@@ -3696,10 +3696,10 @@ const Wt = m.object({
3696
3696
  "Name of browser to search in. If not specified, searches all browsers"
3697
3697
  )
3698
3698
  });
3699
- async function ao(t, r, s) {
3699
+ async function ao(r, t, s) {
3700
3700
  let o;
3701
3701
  try {
3702
- o = Wt.parse(t);
3702
+ o = Wt.parse(r);
3703
3703
  } catch (f) {
3704
3704
  return {
3705
3705
  error: F(f)
@@ -3774,8 +3774,8 @@ async function ao(t, r, s) {
3774
3774
  ...l.length > 0 && { errors: l }
3775
3775
  };
3776
3776
  }
3777
- function lo(t, r) {
3778
- t(
3777
+ function lo(r, t) {
3778
+ r(
3779
3779
  "playwright-page-close",
3780
3780
  {
3781
3781
  title: "Close Pages",
@@ -3783,7 +3783,7 @@ function lo(t, r) {
3783
3783
  inputSchema: Wt.shape
3784
3784
  },
3785
3785
  async (s, o) => {
3786
- const e = await ao(s, r, o);
3786
+ const e = await ao(s, t, o);
3787
3787
  if ("error" in e)
3788
3788
  return `Method: playwright-page-close(${JSON.stringify(s)})
3789
3789
  ❌ Error: ${e.error}`;
@@ -3809,10 +3809,10 @@ const Kt = m.object({
3809
3809
  - 'commit': network response received and document started loading`
3810
3810
  )
3811
3811
  });
3812
- async function co(t, r, s) {
3812
+ async function co(r, t, s) {
3813
3813
  let o;
3814
3814
  try {
3815
- o = Kt.parse(t);
3815
+ o = Kt.parse(r);
3816
3816
  } catch (h) {
3817
3817
  return {
3818
3818
  error: F(h)
@@ -3843,7 +3843,7 @@ async function co(t, r, s) {
3843
3843
  error: `Page "${e}" not found`
3844
3844
  };
3845
3845
  } else if (n) {
3846
- const h = await Gt(n, r, s);
3846
+ const h = await Gt(n, t, s);
3847
3847
  if (h.error != null)
3848
3848
  return {
3849
3849
  error: h.error
@@ -3877,8 +3877,8 @@ async function co(t, r, s) {
3877
3877
  };
3878
3878
  }
3879
3879
  }
3880
- function uo(t, r) {
3881
- t(
3880
+ function uo(r, t) {
3881
+ r(
3882
3882
  "playwright-page-goto",
3883
3883
  {
3884
3884
  title: "Navigate Page",
@@ -3886,7 +3886,7 @@ function uo(t, r) {
3886
3886
  inputSchema: Kt.shape
3887
3887
  },
3888
3888
  async (s, o) => {
3889
- const e = await co(s, r, o);
3889
+ const e = await co(s, t, o);
3890
3890
  if (e.error != null)
3891
3891
  return `Method: playwright-page-goto(${JSON.stringify(s)})
3892
3892
  ❌ Error: ${e.error}`;
@@ -3905,10 +3905,10 @@ const ve = m.object({
3905
3905
  ),
3906
3906
  cssSelector: m.string().describe("CSS selector to capture page content")
3907
3907
  });
3908
- async function Ht(t, r, s) {
3908
+ async function Ht(r, t, s) {
3909
3909
  let o;
3910
3910
  try {
3911
- o = ve.parse(t);
3911
+ o = ve.parse(r);
3912
3912
  } catch (c) {
3913
3913
  return {
3914
3914
  error: F(c)
@@ -3927,8 +3927,8 @@ async function Ht(t, r, s) {
3927
3927
  snapshotQuery: a
3928
3928
  };
3929
3929
  }
3930
- function fo(t, r) {
3931
- t(
3930
+ function fo(r, t) {
3931
+ r(
3932
3932
  "playwright-dom-snapshot-query-create",
3933
3933
  {
3934
3934
  title: "Create DOM Snapshot Query",
@@ -3936,14 +3936,14 @@ function fo(t, r) {
3936
3936
  inputSchema: ve.shape
3937
3937
  },
3938
3938
  async (s, o) => {
3939
- const e = await Ht(s, r, o);
3939
+ const e = await Ht(s, t, o);
3940
3940
  return e.error != null ? `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3941
3941
  ❌ Error: ${e.error}` : `Method: playwright-dom-snapshot-query-create(${JSON.stringify(s)})
3942
3942
  ✅ DOM snapshot query "${e.snapshotQuery.name}" created successfully`;
3943
3943
  }
3944
3944
  );
3945
3945
  }
3946
- function po(t) {
3946
+ function po(r) {
3947
3947
  return function(s, o) {
3948
3948
  let e, n = 0;
3949
3949
  const i = o ? o.length : 0;
@@ -3979,8 +3979,8 @@ function po(t) {
3979
3979
  };
3980
3980
  };
3981
3981
  }
3982
- function ho(t, r) {
3983
- const s = le(r), o = s.getChilds(s.root), e = Et({
3982
+ function ho(r, t) {
3983
+ const s = le(t), o = s.getChilds(s.root), e = Et({
3984
3984
  getId: (n) => {
3985
3985
  const i = s.getId(n);
3986
3986
  if (i == null)
@@ -4005,10 +4005,10 @@ const Ee = m.object({
4005
4005
  "Unique name for the DOM snapshot. Recommended format: kebab-case-1, kebab-case-2, ..."
4006
4006
  )
4007
4007
  });
4008
- async function Qt(t, r, s) {
4008
+ async function Qt(r, t, s) {
4009
4009
  let o;
4010
4010
  try {
4011
- o = Ee.parse(t);
4011
+ o = Ee.parse(r);
4012
4012
  } catch (d) {
4013
4013
  return {
4014
4014
  error: F(d)
@@ -4048,7 +4048,7 @@ async function Qt(t, r, s) {
4048
4048
  } else if (i) {
4049
4049
  const d = await Ht(
4050
4050
  i,
4051
- r,
4051
+ t,
4052
4052
  s
4053
4053
  );
4054
4054
  if (d.error != null)
@@ -4091,8 +4091,8 @@ async function Qt(t, r, s) {
4091
4091
  };
4092
4092
  }
4093
4093
  }
4094
- function mo(t, r) {
4095
- t(
4094
+ function mo(r, t) {
4095
+ r(
4096
4096
  "playwright-dom-snapshot-create",
4097
4097
  {
4098
4098
  title: "Create DOM Snapshot",
@@ -4100,7 +4100,7 @@ function mo(t, r) {
4100
4100
  inputSchema: Ee.shape
4101
4101
  },
4102
4102
  async (s, o) => {
4103
- const e = await Qt(s, r, o);
4103
+ const e = await Qt(s, t, o);
4104
4104
  if (e.error != null)
4105
4105
  return `Method: playwright-dom-snapshot-create(${JSON.stringify(s)})
4106
4106
  ❌ Error: ${e.error}`;
@@ -4113,17 +4113,17 @@ function mo(t, r) {
4113
4113
  }
4114
4114
  class go {
4115
4115
  tokens = 20;
4116
- getReportText = (r) => ({
4116
+ getReportText = (t) => ({
4117
4117
  indent: !0,
4118
- textOpen: `[${r.indexRange[0]}-${r.indexRange[1]}] see more ${r.countMatched} matched ${r.tokensGrouped} tokens`,
4118
+ textOpen: `[${t.indexRange[0]}-${t.indexRange[1]}] see more ${t.countMatched} matched ${t.tokensGrouped} tokens`,
4119
4119
  textClose: null
4120
4120
  });
4121
- add = (r, s, o) => r == null ? {
4121
+ add = (t, s, o) => t == null ? {
4122
4122
  indexRange: [o, o],
4123
4123
  countGrouped: 1,
4124
4124
  countMatched: s.countMatched,
4125
4125
  tokensGrouped: s.tokens
4126
- } : (r.indexRange[1] = o, r.countGrouped += 1, r.countMatched += s.countMatched, r.tokensGrouped += s.tokens, r);
4126
+ } : (t.indexRange[1] = o, t.countGrouped += 1, t.countMatched += s.countMatched, t.tokensGrouped += s.tokens, t);
4127
4127
  }
4128
4128
  const Yt = m.object({
4129
4129
  snapshotName: m.string().optional().describe("Name of previously created DOM snapshot, to use"),
@@ -4145,10 +4145,10 @@ const Yt = m.object({
4145
4145
  // maxCountGroup: z.number().default(10).describe('Maximum items per group'),
4146
4146
  // maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
4147
4147
  });
4148
- async function wo(t, r, s) {
4148
+ async function wo(r, t, s) {
4149
4149
  let o;
4150
4150
  try {
4151
- o = Yt.parse(t);
4151
+ o = Yt.parse(r);
4152
4152
  } catch (g) {
4153
4153
  return {
4154
4154
  error: F(g)
@@ -4191,7 +4191,7 @@ async function wo(t, r, s) {
4191
4191
  } else if (n) {
4192
4192
  const g = await Qt(
4193
4193
  n,
4194
- r,
4194
+ t,
4195
4195
  s
4196
4196
  );
4197
4197
  if (g.error != null)
@@ -4232,8 +4232,8 @@ async function wo(t, r, s) {
4232
4232
  };
4233
4233
  }
4234
4234
  }
4235
- function yo(t, r) {
4236
- t(
4235
+ function yo(r, t) {
4236
+ r(
4237
4237
  "playwright-dom-snapshot-browse",
4238
4238
  {
4239
4239
  title: "Browse DOM Snapshot",
@@ -4241,7 +4241,7 @@ function yo(t, r) {
4241
4241
  inputSchema: Yt.shape
4242
4242
  },
4243
4243
  async (s, o) => {
4244
- const e = await wo(s, r, o);
4244
+ const e = await wo(s, t, o);
4245
4245
  if (e.error != null)
4246
4246
  return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
4247
4247
  ❌ Error: ${e.error}`;
@@ -4262,14 +4262,14 @@ ${e.report}`, n;
4262
4262
  }
4263
4263
  );
4264
4264
  }
4265
- function bo(t, r) {
4266
- r.browserCreate && Ws(t, r), r.browserList && Hs(t, r), r.browserClose && Ys(t, r), r.contextCreate && Vs(t, r), r.contextList && Xs(t, r), r.contextClose && to(t, r), r.pageCreate && oo(t, r), r.pageList && io(t, r), r.pageClose && lo(t, r), r.pageGoto && uo(t, r), r.domSnapshotQueryCreate && fo(t, r), r.domSnapshotCreate && mo(t, r), r.domSnapshotBrowse && yo(t, r), console.log("Playwright manager");
4265
+ function bo(r, t) {
4266
+ t.browserCreate && Ws(r, t), t.browserList && Hs(r, t), t.browserClose && Ys(r, t), t.contextCreate && Vs(r, t), t.contextList && Xs(r, t), t.contextClose && to(r, t), t.pageCreate && oo(r, t), t.pageList && io(r, t), t.pageClose && lo(r, t), t.pageGoto && uo(r, t), t.domSnapshotQueryCreate && fo(r, t), t.domSnapshotCreate && mo(r, t), t.domSnapshotBrowse && yo(r, t), console.log("Playwright manager");
4267
4267
  }
4268
- function So(t) {
4269
- const { logFilePath: r } = t;
4268
+ function So(r) {
4269
+ const { logFilePath: t } = r;
4270
4270
  return async function(o, e, n, i) {
4271
4271
  await ie({
4272
- logFilePath: r,
4272
+ logFilePath: t,
4273
4273
  message: "ERROR",
4274
4274
  data: {
4275
4275
  request: {
@@ -4292,10 +4292,10 @@ const it = [
4292
4292
  "flemist-mcp.config.json5",
4293
4293
  "flemist-mcp.config.yaml"
4294
4294
  ];
4295
- async function xo(t) {
4296
- const r = k.resolve(t);
4295
+ async function xo(r) {
4296
+ const t = k.resolve(r);
4297
4297
  for (let s = 0, o = it.length; s < o; s++) {
4298
- const e = it[s], n = k.join(r, e);
4298
+ const e = it[s], n = k.join(t, e);
4299
4299
  try {
4300
4300
  await j.promises.stat(n);
4301
4301
  } catch {
@@ -4324,7 +4324,7 @@ ${c instanceof Error ? c.message : String(c)}`);
4324
4324
  ${c instanceof Error ? c.message : String(c)}`);
4325
4325
  }
4326
4326
  }
4327
- throw new Error(`MCP Error: No configuration file found in: ${r}
4327
+ throw new Error(`MCP Error: No configuration file found in: ${t}
4328
4328
 
4329
4329
  Expected one of:
4330
4330
  - flemist-mcp.config.json
@@ -4372,14 +4372,14 @@ const Io = {
4372
4372
  }
4373
4373
  }
4374
4374
  };
4375
- async function $o(t) {
4376
- const r = k.resolve(t), s = await xo(r), o = k.join(r, ".flemist-mcpignore");
4375
+ async function $o(r) {
4376
+ const t = k.resolve(r), s = await xo(t), o = k.join(t, ".flemist-mcpignore");
4377
4377
  try {
4378
4378
  await j.promises.stat(o);
4379
4379
  } catch {
4380
4380
  throw new Error(`MCP Error: .flemist-mcpignore file not found in project directory.
4381
4381
 
4382
- Create .flemist-mcpignore file in: ${r}
4382
+ Create .flemist-mcpignore file in: ${t}
4383
4383
 
4384
4384
  This file contains glob patterns for files/directories to exclude from MCP operations.`);
4385
4385
  }
@@ -4389,10 +4389,10 @@ This file contains glob patterns for files/directories to exclude from MCP opera
4389
4389
  }
4390
4390
  });
4391
4391
  return e.tools?.processManager && (e.tools.processManager.workingDir = k.resolve(
4392
- r,
4392
+ t,
4393
4393
  e.tools.processManager.workingDir || ""
4394
4394
  )), e.tools?.fsManager && (e.tools.fsManager.workingDir = k.resolve(
4395
- r,
4395
+ t,
4396
4396
  e.tools.fsManager.workingDir || ""
4397
4397
  )), e.tools?.fsManager && (e.tools.fsManager.globsExclude = [
4398
4398
  {
@@ -4402,34 +4402,34 @@ This file contains glob patterns for files/directories to exclude from MCP opera
4402
4402
  },
4403
4403
  ...e.tools.fsManager.globsExclude || []
4404
4404
  ]), e.tools.fsManager?.globsExclude?.forEach((n, i, a) => {
4405
- n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(r, n.value));
4406
- }), e.logDir = k.resolve(r, e.logDir), e;
4405
+ n.valueType === "file-contains-patterns" && (a[i].value = k.resolve(t, n.value));
4406
+ }), e.logDir = k.resolve(t, e.logDir), e;
4407
4407
  }
4408
4408
  function Vt() {
4409
4409
  return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
4410
4410
  }
4411
- function Mo(t) {
4412
- const r = ne(), s = To();
4413
- return r.use(s), r;
4411
+ function Mo(r) {
4412
+ const t = ne(), s = To();
4413
+ return t.use(s), t;
4414
4414
  }
4415
- function To(t) {
4416
- const r = ne.Router();
4417
- return r.use((s, o, e) => {
4415
+ function To(r) {
4416
+ const t = ne.Router();
4417
+ return t.use((s, o, e) => {
4418
4418
  s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
4419
- }), r.use(ne.json()), r;
4419
+ }), t.use(ne.json()), t;
4420
4420
  }
4421
- function Co(t) {
4422
- const r = ne.Router();
4423
- return r.use(pr({ authToken: t.authToken })), r.all("/mcp", yr(t)), r;
4421
+ function Co(r) {
4422
+ const t = ne.Router();
4423
+ return t.use(pr({ authToken: r.authToken })), t.all("/mcp", yr(r)), t;
4424
4424
  }
4425
- function vo(t, r) {
4426
- return t.use(So({ logFilePath: r.logFilePath })), new Promise((s, o) => {
4425
+ function vo(r, t) {
4426
+ return r.use(So({ logFilePath: t.logFilePath })), new Promise((s, o) => {
4427
4427
  let e;
4428
4428
  const n = () => {
4429
4429
  s(e);
4430
4430
  };
4431
4431
  try {
4432
- e = r.host ? t.listen(r.port ?? 0, r.host, n) : t.listen(r.port ?? 0, n), e.addListener("error", (i) => {
4432
+ e = t.host ? r.listen(t.port ?? 0, t.host, n) : r.listen(t.port ?? 0, n), e.addListener("error", (i) => {
4433
4433
  o(i);
4434
4434
  });
4435
4435
  } catch (i) {
@@ -4437,40 +4437,40 @@ function vo(t, r) {
4437
4437
  }
4438
4438
  });
4439
4439
  }
4440
- function Eo(t, r) {
4441
- if (!t.address())
4440
+ function Eo(r, t) {
4441
+ if (!r.address())
4442
4442
  throw new Error(
4443
4443
  "Server address is not available. Check your DNS and host configuration."
4444
4444
  );
4445
- const o = t.address().family, e = t.address().port;
4446
- let n = t.address().address;
4445
+ const o = r.address().family, e = r.address().port;
4446
+ let n = r.address().address;
4447
4447
  n === "::" ? n = "localhost" : o === "IPv6" && (n = `[${n}]`);
4448
4448
  const i = `http://${o === "IPv6" ? `[${n}]` : n}:${e}`;
4449
4449
  return `Project Tools - MCP Server Started
4450
4450
 
4451
- Server Name: ${r.name}
4452
- Server Version: ${r.version}
4451
+ Server Name: ${t.name}
4452
+ Server Version: ${t.version}
4453
4453
  Server URL: ${i}/mcp
4454
4454
  SSE Endpoint: ${i}/sse
4455
4455
 
4456
- Log File: ${k.resolve(r.logFilePath)}`;
4456
+ Log File: ${k.resolve(t.logFilePath)}`;
4457
4457
  }
4458
- function No(t, r) {
4459
- const s = k.join(r.logDir, Vt()), o = Jr(t, {
4458
+ function No(r, t) {
4459
+ const s = k.join(t.logDir, Vt()), o = Jr(r, {
4460
4460
  logFilePath: s
4461
4461
  });
4462
- r.tools.processManager && Gr(
4462
+ t.tools.processManager && Gr(
4463
4463
  o,
4464
- r.tools.processManager
4465
- ), r.tools.fsManager && Js(o, r.tools.fsManager), r.tools.playwrightManager && bo(
4464
+ t.tools.processManager
4465
+ ), t.tools.fsManager && Js(o, t.tools.fsManager), t.tools.playwrightManager && bo(
4466
4466
  o,
4467
- r.tools.playwrightManager
4467
+ t.tools.playwrightManager
4468
4468
  ), Pr(o);
4469
4469
  }
4470
- async function Yo(t) {
4471
- const r = k.join(t.logDir, Vt()), s = Mo(), o = Co({
4472
- authToken: t.authToken,
4473
- logFilePath: r,
4470
+ async function Yo(r) {
4471
+ const t = k.join(r.logDir, Vt()), s = Mo(), o = Co({
4472
+ authToken: r.authToken,
4473
+ logFilePath: t,
4474
4474
  createMcpServer: async (n) => {
4475
4475
  const i = n.headers["x-project-name"];
4476
4476
  if (!i)
@@ -4484,7 +4484,7 @@ X-Project-Name header is missing. To configure MCP for this project:
4484
4484
  4. Create .mcp.json in project root with X-Project-Name header set to project name
4485
4485
  5. Ask user to add project to server's projects config if not already present
4486
4486
  6. Ask user to restart Claude Code`);
4487
- const a = t.projects[i];
4487
+ const a = r.projects[i];
4488
4488
  if (!a)
4489
4489
  throw new Error(`MCP Error: Project "${i}" not found in server configuration.
4490
4490
 
@@ -4492,25 +4492,25 @@ Ask user to:
4492
4492
  1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
4493
4493
  2. Restart MCP server`);
4494
4494
  const c = await $o(a), l = new Zt({
4495
- title: t.title,
4496
- name: t.name,
4497
- version: t.version
4495
+ title: r.title,
4496
+ name: r.name,
4497
+ version: r.version
4498
4498
  });
4499
4499
  return No(l, c), l;
4500
4500
  }
4501
4501
  });
4502
4502
  s.use(o);
4503
4503
  const e = await vo(s, {
4504
- host: t.host,
4505
- port: t.port,
4506
- logFilePath: r
4504
+ host: r.host,
4505
+ port: r.port,
4506
+ logFilePath: t
4507
4507
  });
4508
4508
  return console.log(
4509
4509
  Eo(e, {
4510
- title: t.title,
4511
- name: t.name,
4512
- version: t.version,
4513
- logFilePath: r
4510
+ title: r.title,
4511
+ name: r.name,
4512
+ version: r.version,
4513
+ logFilePath: t
4514
4514
  })
4515
4515
  ), e;
4516
4516
  }