@flemist/mcp-project-tools 5.0.2 → 5.0.3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ne from "express";
|
|
2
2
|
import { McpServer as Zt } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { randomUUID as Xt } from "crypto";
|
|
4
|
-
import * as
|
|
4
|
+
import * as U from "fs";
|
|
5
5
|
import * as k from "path";
|
|
6
6
|
import { StreamableHTTPServerTransport as er } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
7
7
|
import { spawn as tr } from "child_process";
|
|
@@ -33,7 +33,7 @@ async function ie(r) {
|
|
|
33
33
|
${n}
|
|
34
34
|
|
|
35
35
|
`;
|
|
36
|
-
await
|
|
36
|
+
await U.promises.mkdir(k.dirname(t), { recursive: !0 }), await U.promises.appendFile(t, i);
|
|
37
37
|
} catch (e) {
|
|
38
38
|
console.error(`Failed to log "${s}":`, e);
|
|
39
39
|
}
|
|
@@ -156,7 +156,7 @@ function Tr(r, t, s, o) {
|
|
|
156
156
|
const e = at(t, o);
|
|
157
157
|
return r.replace(e, (n) => s + n.slice(t.length));
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function vr(r, t, s, o) {
|
|
160
160
|
const e = process.platform === "win32", n = {};
|
|
161
161
|
if (s !== "clear") if (s === "replaceServerPaths" || s === "deleteServerPaths") {
|
|
162
162
|
const i = Fe(r, e), a = Fe(t, e);
|
|
@@ -191,7 +191,7 @@ function Fe(r, t) {
|
|
|
191
191
|
const s = k.normalize(r).replace(/[\\/]+$/, "");
|
|
192
192
|
return t ? s.toLowerCase() : s;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const Cr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
|
|
195
195
|
let Er = 0;
|
|
196
196
|
function Nr() {
|
|
197
197
|
return ++Er;
|
|
@@ -208,7 +208,7 @@ function ct(r) {
|
|
|
208
208
|
function ut(r, t) {
|
|
209
209
|
return setTimeout(() => {
|
|
210
210
|
r.storedOutputs.delete(t);
|
|
211
|
-
},
|
|
211
|
+
}, Cr);
|
|
212
212
|
}
|
|
213
213
|
function kr(r, t, s) {
|
|
214
214
|
clearTimeout(s.cleanupTimer), s.cleanupTimer = ut(r, t);
|
|
@@ -533,7 +533,7 @@ To use this command line, ask the user to modify the command line rules in the c
|
|
|
533
533
|
};
|
|
534
534
|
Y.set(d, p);
|
|
535
535
|
try {
|
|
536
|
-
const h =
|
|
536
|
+
const h = vr(
|
|
537
537
|
process.cwd(),
|
|
538
538
|
u,
|
|
539
539
|
t.envCleanup ?? "deleteServerPaths",
|
|
@@ -546,8 +546,8 @@ To use this command line, ask the user to modify the command line rules in the c
|
|
|
546
546
|
});
|
|
547
547
|
p.pid = g.pid;
|
|
548
548
|
const y = (w) => {
|
|
549
|
-
const
|
|
550
|
-
p.output +=
|
|
549
|
+
const I = w.toString();
|
|
550
|
+
p.output += I, console.log(I);
|
|
551
551
|
};
|
|
552
552
|
return g.stdout?.on("data", y), g.stderr?.on("data", y), g.on("close", (w) => {
|
|
553
553
|
p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.exitCode = w !== null ? w : void 0, console.log(`Process ${d} (${e}) exited with code ${w}`);
|
|
@@ -601,7 +601,7 @@ 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
|
|
604
|
+
async function _r(r, t) {
|
|
605
605
|
ge();
|
|
606
606
|
let s;
|
|
607
607
|
try {
|
|
@@ -644,7 +644,7 @@ async function Ur(r, t) {
|
|
|
644
644
|
return u;
|
|
645
645
|
}) };
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Ur(r, t) {
|
|
648
648
|
r(
|
|
649
649
|
"process-list",
|
|
650
650
|
{
|
|
@@ -653,7 +653,7 @@ function jr(r, t) {
|
|
|
653
653
|
inputSchema: bt.shape
|
|
654
654
|
},
|
|
655
655
|
async (s) => {
|
|
656
|
-
const o = await
|
|
656
|
+
const o = await _r(s, t);
|
|
657
657
|
if (o.error != null)
|
|
658
658
|
return `Method: process-list(${JSON.stringify(s)})
|
|
659
659
|
❌ Error: ${o.error}`;
|
|
@@ -672,7 +672,7 @@ 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
|
|
675
|
+
function jr(r) {
|
|
676
676
|
let t;
|
|
677
677
|
try {
|
|
678
678
|
t = St.parse(r);
|
|
@@ -702,7 +702,7 @@ function qr(r) {
|
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function qr(r, t) {
|
|
706
706
|
r(
|
|
707
707
|
"process-kill",
|
|
708
708
|
{
|
|
@@ -711,7 +711,7 @@ function _r(r, t) {
|
|
|
711
711
|
inputSchema: St.shape
|
|
712
712
|
},
|
|
713
713
|
async (s) => {
|
|
714
|
-
const o =
|
|
714
|
+
const o = jr(s);
|
|
715
715
|
return o.error != null ? `Method: process-kill(${JSON.stringify(s)})
|
|
716
716
|
❌ Error: ${o.error}` : `Method: process-kill(${JSON.stringify(s)})
|
|
717
717
|
${JSON.stringify(o, null, 2)}`;
|
|
@@ -719,7 +719,7 @@ ${JSON.stringify(o, null, 2)}`;
|
|
|
719
719
|
);
|
|
720
720
|
}
|
|
721
721
|
function Gr(r, t) {
|
|
722
|
-
Mr(), t.run && zr(r, t), t.status && Br(r, t), t.wait && Lr(r, t), t.list &&
|
|
722
|
+
Mr(), t.run && zr(r, t), t.status && Br(r, t), t.wait && Lr(r, t), t.list && Ur(r, t), t.kill && qr(r);
|
|
723
723
|
const s = t.commandLineRules?.map(
|
|
724
724
|
(o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
|
|
725
725
|
) || [];
|
|
@@ -765,11 +765,92 @@ function Wr(r) {
|
|
|
765
765
|
return r.match(/^[/\\]?[^/\\]+/)[0];
|
|
766
766
|
}
|
|
767
767
|
function Kr(r, t) {
|
|
768
|
-
return Wr(r) + "|" + t
|
|
768
|
+
return Wr(r) + "|" + t;
|
|
769
769
|
}
|
|
770
770
|
function Hr(r) {
|
|
771
771
|
return r.endsWith(":") && (r += "/"), k.resolve(r);
|
|
772
772
|
}
|
|
773
|
+
class Qr {
|
|
774
|
+
_bigStat;
|
|
775
|
+
constructor(t) {
|
|
776
|
+
this._bigStat = t;
|
|
777
|
+
}
|
|
778
|
+
get ino() {
|
|
779
|
+
return this._bigStat.ino;
|
|
780
|
+
}
|
|
781
|
+
get size() {
|
|
782
|
+
return Number(this._bigStat.size);
|
|
783
|
+
}
|
|
784
|
+
get mtimeMs() {
|
|
785
|
+
return Number(this._bigStat.mtimeMs);
|
|
786
|
+
}
|
|
787
|
+
get atimeMs() {
|
|
788
|
+
return Number(this._bigStat.atimeMs);
|
|
789
|
+
}
|
|
790
|
+
get ctimeMs() {
|
|
791
|
+
return Number(this._bigStat.ctimeMs);
|
|
792
|
+
}
|
|
793
|
+
get birthtimeMs() {
|
|
794
|
+
return Number(this._bigStat.birthtimeMs);
|
|
795
|
+
}
|
|
796
|
+
get blksize() {
|
|
797
|
+
return Number(this._bigStat.blksize);
|
|
798
|
+
}
|
|
799
|
+
get blocks() {
|
|
800
|
+
return Number(this._bigStat.blocks);
|
|
801
|
+
}
|
|
802
|
+
get dev() {
|
|
803
|
+
return Number(this._bigStat.dev);
|
|
804
|
+
}
|
|
805
|
+
get gid() {
|
|
806
|
+
return Number(this._bigStat.gid);
|
|
807
|
+
}
|
|
808
|
+
get mode() {
|
|
809
|
+
return Number(this._bigStat.mode);
|
|
810
|
+
}
|
|
811
|
+
get nlink() {
|
|
812
|
+
return Number(this._bigStat.nlink);
|
|
813
|
+
}
|
|
814
|
+
get rdev() {
|
|
815
|
+
return Number(this._bigStat.rdev);
|
|
816
|
+
}
|
|
817
|
+
get uid() {
|
|
818
|
+
return Number(this._bigStat.uid);
|
|
819
|
+
}
|
|
820
|
+
get atime() {
|
|
821
|
+
return this._bigStat.atime;
|
|
822
|
+
}
|
|
823
|
+
get mtime() {
|
|
824
|
+
return this._bigStat.mtime;
|
|
825
|
+
}
|
|
826
|
+
get ctime() {
|
|
827
|
+
return this._bigStat.ctime;
|
|
828
|
+
}
|
|
829
|
+
get birthtime() {
|
|
830
|
+
return this._bigStat.birthtime;
|
|
831
|
+
}
|
|
832
|
+
isFile() {
|
|
833
|
+
return this._bigStat.isFile();
|
|
834
|
+
}
|
|
835
|
+
isDirectory() {
|
|
836
|
+
return this._bigStat.isDirectory();
|
|
837
|
+
}
|
|
838
|
+
isSymbolicLink() {
|
|
839
|
+
return this._bigStat.isSymbolicLink();
|
|
840
|
+
}
|
|
841
|
+
isBlockDevice() {
|
|
842
|
+
return this._bigStat.isBlockDevice();
|
|
843
|
+
}
|
|
844
|
+
isCharacterDevice() {
|
|
845
|
+
return this._bigStat.isCharacterDevice();
|
|
846
|
+
}
|
|
847
|
+
isFIFO() {
|
|
848
|
+
return this._bigStat.isFIFO();
|
|
849
|
+
}
|
|
850
|
+
isSocket() {
|
|
851
|
+
return this._bigStat.isSocket();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
773
854
|
const Se = new rr(ir.cpus().length);
|
|
774
855
|
function Be(r, t) {
|
|
775
856
|
r.totalSize += t.totalSize, r.maxFileDateModified = Math.max(
|
|
@@ -777,7 +858,7 @@ function Be(r, t) {
|
|
|
777
858
|
t.maxFileDateModified
|
|
778
859
|
), r.countFiles += t.countFiles, r.countDirs += t.countDirs, r.countLinks += t.countLinks;
|
|
779
860
|
}
|
|
780
|
-
const
|
|
861
|
+
const Yr = function(t) {
|
|
781
862
|
return t.code === "ENOENT";
|
|
782
863
|
};
|
|
783
864
|
function xt(r) {
|
|
@@ -792,7 +873,7 @@ function xt(r) {
|
|
|
792
873
|
});
|
|
793
874
|
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
875
|
async function d(h) {
|
|
795
|
-
if (!(i && await i(h)) && !
|
|
876
|
+
if (!(i && await i(h)) && !Yr(h))
|
|
796
877
|
throw h;
|
|
797
878
|
}
|
|
798
879
|
function p(h) {
|
|
@@ -806,117 +887,124 @@ function xt(r) {
|
|
|
806
887
|
countDirs: 0,
|
|
807
888
|
countLinks: 0
|
|
808
889
|
};
|
|
809
|
-
function w(
|
|
890
|
+
function w($, T) {
|
|
810
891
|
if (p(T.totalSize)) {
|
|
811
|
-
const
|
|
812
|
-
l?.handleLog ? l.handleLog(
|
|
892
|
+
const x = `${T.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${$}`;
|
|
893
|
+
l?.handleLog ? l.handleLog(x) : console.log(x);
|
|
813
894
|
}
|
|
814
895
|
}
|
|
815
|
-
async function
|
|
896
|
+
async function I($, T, S, x) {
|
|
816
897
|
return u ? await V({
|
|
817
898
|
pool: n,
|
|
818
899
|
func: async () => {
|
|
819
900
|
try {
|
|
820
901
|
return await u({
|
|
821
902
|
level: s,
|
|
822
|
-
path:
|
|
903
|
+
path: $,
|
|
823
904
|
stat: T,
|
|
824
|
-
itemStat:
|
|
905
|
+
itemStat: S,
|
|
825
906
|
totalStat: y,
|
|
826
907
|
abortSignal: g
|
|
827
908
|
});
|
|
828
|
-
} catch (
|
|
829
|
-
return await d(
|
|
909
|
+
} catch (C) {
|
|
910
|
+
return await d(C), !1;
|
|
830
911
|
}
|
|
831
912
|
},
|
|
832
913
|
count: 1,
|
|
833
|
-
priority:
|
|
914
|
+
priority: x,
|
|
834
915
|
abortSignal: g
|
|
835
916
|
}) : !0;
|
|
836
917
|
}
|
|
837
|
-
async function E(
|
|
838
|
-
|
|
839
|
-
const
|
|
918
|
+
async function E($, T, S, x) {
|
|
919
|
+
x || (x = $);
|
|
920
|
+
const C = await V({
|
|
840
921
|
pool: n,
|
|
841
|
-
func: () =>
|
|
922
|
+
func: async () => {
|
|
923
|
+
try {
|
|
924
|
+
const v = await U.promises.lstat($, { bigint: !0 });
|
|
925
|
+
return new Qr(v);
|
|
926
|
+
} catch (v) {
|
|
927
|
+
return await d(v);
|
|
928
|
+
}
|
|
929
|
+
},
|
|
842
930
|
count: 1,
|
|
843
931
|
priority: X(T, X(1, a)),
|
|
844
932
|
abortSignal: g
|
|
845
933
|
});
|
|
846
|
-
if (!
|
|
934
|
+
if (!C || !S && C.isFile())
|
|
847
935
|
return null;
|
|
848
|
-
const P = Kr(
|
|
936
|
+
const P = Kr($, C.ino);
|
|
849
937
|
if (o.has(P))
|
|
850
938
|
return null;
|
|
851
939
|
o.add(P);
|
|
852
940
|
let O = {
|
|
853
|
-
totalSize:
|
|
854
|
-
maxFileDateModified:
|
|
941
|
+
totalSize: C.size,
|
|
942
|
+
maxFileDateModified: C.isDirectory() ? 0 : C.mtimeMs,
|
|
855
943
|
countFiles: 0,
|
|
856
944
|
countDirs: 0,
|
|
857
945
|
countLinks: 0
|
|
858
946
|
};
|
|
859
|
-
const
|
|
947
|
+
const M = X(
|
|
860
948
|
T,
|
|
861
|
-
X(
|
|
949
|
+
X(C.isDirectory() ? 2 : 3, a)
|
|
862
950
|
);
|
|
863
|
-
if (
|
|
951
|
+
if (C.isSymbolicLink()) {
|
|
864
952
|
if (c) {
|
|
865
|
-
const
|
|
953
|
+
const v = await V({
|
|
866
954
|
pool: n,
|
|
867
|
-
func: () =>
|
|
955
|
+
func: () => U.promises.readlink($).catch(d).then((N) => N ?? null),
|
|
868
956
|
count: 1,
|
|
869
|
-
priority:
|
|
957
|
+
priority: M,
|
|
870
958
|
abortSignal: g
|
|
871
959
|
});
|
|
872
|
-
if (
|
|
873
|
-
const N = k.isAbsolute(
|
|
960
|
+
if (v) {
|
|
961
|
+
const N = k.isAbsolute(v) ? v : k.resolve(k.dirname(x), v), R = await E(
|
|
874
962
|
N,
|
|
875
963
|
T,
|
|
876
|
-
|
|
877
|
-
|
|
964
|
+
S,
|
|
965
|
+
x
|
|
878
966
|
);
|
|
879
967
|
R && (O = R);
|
|
880
968
|
}
|
|
881
969
|
}
|
|
882
|
-
return (
|
|
883
|
-
|
|
884
|
-
|
|
970
|
+
return (S || O.countFiles + O.countDirs + O.countLinks >= 1) && (O.countLinks += 1, await I(
|
|
971
|
+
x,
|
|
972
|
+
C,
|
|
885
973
|
O,
|
|
886
|
-
|
|
887
|
-
) && (Be(y, O), w(
|
|
888
|
-
} else if (
|
|
889
|
-
const
|
|
974
|
+
M
|
|
975
|
+
) && (Be(y, O), w(x, O))), O;
|
|
976
|
+
} else if (C.isDirectory()) {
|
|
977
|
+
const v = await V({
|
|
890
978
|
pool: n,
|
|
891
|
-
func: () =>
|
|
979
|
+
func: () => U.promises.readdir($).catch(d),
|
|
892
980
|
count: 1,
|
|
893
981
|
priority: a,
|
|
894
982
|
abortSignal: g
|
|
895
983
|
});
|
|
896
|
-
if (
|
|
897
|
-
for (let N = 0, R =
|
|
898
|
-
|
|
984
|
+
if (v) {
|
|
985
|
+
for (let N = 0, R = v.length; N < R; N++)
|
|
986
|
+
v[N] = k.join(x, v[N]);
|
|
899
987
|
O = await xt({
|
|
900
988
|
...r,
|
|
901
|
-
paths:
|
|
989
|
+
paths: v,
|
|
902
990
|
abortSignal: g,
|
|
903
|
-
priority:
|
|
991
|
+
priority: M,
|
|
904
992
|
level: s + 1,
|
|
905
993
|
walkedIds: o
|
|
906
994
|
});
|
|
907
995
|
}
|
|
908
996
|
}
|
|
909
|
-
return (
|
|
910
|
-
|
|
911
|
-
|
|
997
|
+
return (S || O.countFiles + O.countDirs + O.countLinks >= 1) && (C.isDirectory() ? O.countDirs += 1 : C.isFile() && (O.countFiles += 1), await I(
|
|
998
|
+
x,
|
|
999
|
+
C,
|
|
912
1000
|
O,
|
|
913
|
-
|
|
914
|
-
) && (Be(y, O), w(
|
|
1001
|
+
M
|
|
1002
|
+
) && (Be(y, O), w(x, O))), O;
|
|
915
1003
|
}
|
|
916
1004
|
const b = [];
|
|
917
|
-
for (let
|
|
918
|
-
const
|
|
919
|
-
|
|
1005
|
+
for (let $ = 0, T = t.length; $ < T; $++) {
|
|
1006
|
+
const S = Hr(t[$]), x = f ? f(S) : !0;
|
|
1007
|
+
x !== !1 && b.push(E(S, $, x));
|
|
920
1008
|
}
|
|
921
1009
|
return await Promise.all(b), y;
|
|
922
1010
|
});
|
|
@@ -924,7 +1012,7 @@ function xt(r) {
|
|
|
924
1012
|
function It(r) {
|
|
925
1013
|
return xt(r);
|
|
926
1014
|
}
|
|
927
|
-
function
|
|
1015
|
+
function Vr(r, t) {
|
|
928
1016
|
if (!t || t === ".")
|
|
929
1017
|
return r;
|
|
930
1018
|
const s = r.startsWith("^");
|
|
@@ -932,15 +1020,15 @@ function Yr(r, t) {
|
|
|
932
1020
|
const o = r.startsWith("!");
|
|
933
1021
|
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
1022
|
}
|
|
935
|
-
function
|
|
1023
|
+
function Zr(r) {
|
|
936
1024
|
const t = r.startsWith("!");
|
|
937
1025
|
return t && (r = r.substring(1)), !r.startsWith("/") && !r.startsWith("**") && !r.startsWith("../") && (r = `**/${r}`), t && (r = "!" + r), r;
|
|
938
1026
|
}
|
|
939
1027
|
function Le(r) {
|
|
940
1028
|
return "^" + r;
|
|
941
1029
|
}
|
|
942
|
-
async function
|
|
943
|
-
const s = (await
|
|
1030
|
+
async function Xr(r) {
|
|
1031
|
+
const s = (await U.promises.readFile(r, "utf-8")).split(`
|
|
944
1032
|
`), o = [];
|
|
945
1033
|
return s.forEach((e) => {
|
|
946
1034
|
e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
|
|
@@ -959,9 +1047,9 @@ async function $t(r) {
|
|
|
959
1047
|
pool: Se,
|
|
960
1048
|
count: 1,
|
|
961
1049
|
func: async () => {
|
|
962
|
-
const n = k.resolve(t, e.value), i = await
|
|
1050
|
+
const n = k.resolve(t, e.value), i = await Xr(n), a = k.relative(t, k.dirname(n));
|
|
963
1051
|
i.forEach((c) => {
|
|
964
|
-
c =
|
|
1052
|
+
c = Zr(c), c = Vr(c, a), s.push(e.exclude ? Le(c) : c);
|
|
965
1053
|
});
|
|
966
1054
|
}
|
|
967
1055
|
});
|
|
@@ -1016,7 +1104,7 @@ function Mt({
|
|
|
1016
1104
|
return a ? !1 : i;
|
|
1017
1105
|
};
|
|
1018
1106
|
}
|
|
1019
|
-
async function
|
|
1107
|
+
async function es(r) {
|
|
1020
1108
|
const t = r.rootDir ?? ".", s = [], o = {};
|
|
1021
1109
|
r.result.countFiles && (o.countFiles = 0), r.result.size && (o.size = 0);
|
|
1022
1110
|
const e = await $t({
|
|
@@ -1040,13 +1128,13 @@ async function Xr(r) {
|
|
|
1040
1128
|
type: d
|
|
1041
1129
|
};
|
|
1042
1130
|
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,
|
|
1044
|
-
if (w != null && p < w ||
|
|
1131
|
+
const [w, I] = r.dateModified;
|
|
1132
|
+
if (w != null && p < w || I != null && p > I)
|
|
1045
1133
|
return !1;
|
|
1046
1134
|
}
|
|
1047
1135
|
if (r.totalSize && h != null) {
|
|
1048
|
-
const [w,
|
|
1049
|
-
if (w != null && h < w ||
|
|
1136
|
+
const [w, I] = r.totalSize;
|
|
1137
|
+
if (w != null && h < w || I != null && h > I)
|
|
1050
1138
|
return !1;
|
|
1051
1139
|
}
|
|
1052
1140
|
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;
|
|
@@ -1054,20 +1142,20 @@ async function Xr(r) {
|
|
|
1054
1142
|
}), { items: s, totals: o };
|
|
1055
1143
|
}
|
|
1056
1144
|
const Ae = ["B", "KB", "MB", "GB", "TB"], ze = 1024;
|
|
1057
|
-
function
|
|
1145
|
+
function _e(r) {
|
|
1058
1146
|
if (r == null) return "-";
|
|
1059
1147
|
let t = r ?? 0, s = 0;
|
|
1060
1148
|
for (; t >= ze && s < Ae.length - 1; )
|
|
1061
1149
|
t /= ze, s++;
|
|
1062
1150
|
return `${s === 0 ? t.toString() : t.toFixed(2)}${Ae[s]}`;
|
|
1063
1151
|
}
|
|
1064
|
-
function
|
|
1152
|
+
function Ue(r) {
|
|
1065
1153
|
const s = Date.now() - r;
|
|
1066
1154
|
if (s < 0) return "0s";
|
|
1067
1155
|
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
1156
|
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
1157
|
}
|
|
1070
|
-
function
|
|
1158
|
+
function ts(r, t) {
|
|
1071
1159
|
return t?.length ? [...r].sort((s, o) => {
|
|
1072
1160
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
1073
1161
|
const i = t[e];
|
|
@@ -1103,8 +1191,8 @@ function es(r, t) {
|
|
|
1103
1191
|
return 0;
|
|
1104
1192
|
}) : r;
|
|
1105
1193
|
}
|
|
1106
|
-
function
|
|
1107
|
-
const s =
|
|
1194
|
+
function rs(r, t) {
|
|
1195
|
+
const s = ts(r.items, t.sort ?? []), o = t.fields && t.fields.length > 0 ? t.fields : [];
|
|
1108
1196
|
let e = "";
|
|
1109
1197
|
if (s.length > 0 && o.length > 0) {
|
|
1110
1198
|
for (let n = 0, i = o.length; n < i; n++) {
|
|
@@ -1135,10 +1223,10 @@ function ts(r, t) {
|
|
|
1135
1223
|
const u = o[c];
|
|
1136
1224
|
switch (c > 0 && (e += " | "), u) {
|
|
1137
1225
|
case "dateModified":
|
|
1138
|
-
e += a.dateModified ?
|
|
1226
|
+
e += a.dateModified ? Ue(a.dateModified) : "-";
|
|
1139
1227
|
break;
|
|
1140
1228
|
case "size":
|
|
1141
|
-
e +=
|
|
1229
|
+
e += _e(a.size);
|
|
1142
1230
|
break;
|
|
1143
1231
|
case "type":
|
|
1144
1232
|
e += a.type;
|
|
@@ -1157,15 +1245,15 @@ function ts(r, t) {
|
|
|
1157
1245
|
e.length > 0 && (e += `
|
|
1158
1246
|
---
|
|
1159
1247
|
`);
|
|
1160
|
-
const n =
|
|
1248
|
+
const n = _e(r.totals.size ?? 0), i = r.totals.dateModified ? `, last modified ${Ue(r.totals.dateModified)} ago` : "";
|
|
1161
1249
|
e += `Totals: ${r.totals.countFiles ?? 0} files in dirs, ${n}${i}`;
|
|
1162
1250
|
}
|
|
1163
1251
|
return e;
|
|
1164
1252
|
}
|
|
1165
|
-
const
|
|
1166
|
-
version:
|
|
1167
|
-
},
|
|
1168
|
-
function
|
|
1253
|
+
const ss = "5.0.2", os = {
|
|
1254
|
+
version: ss
|
|
1255
|
+
}, Ko = "Project Tools", Ho = "project-tools", Qo = os.version, Yo = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", je = 25e3;
|
|
1256
|
+
function qe(r) {
|
|
1169
1257
|
const t = r.match(
|
|
1170
1258
|
/^\s*(\d+(?:\.\d+)?)\s*([smhdwMY]|sec(onds?)?|min(utes?)?|hours?|days?|weeks?|months?|years?)\s*$/i
|
|
1171
1259
|
);
|
|
@@ -1259,7 +1347,7 @@ const Tt = m.object({
|
|
|
1259
1347
|
'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
1348
|
)
|
|
1261
1349
|
});
|
|
1262
|
-
async function
|
|
1350
|
+
async function ns(r, t) {
|
|
1263
1351
|
let s;
|
|
1264
1352
|
try {
|
|
1265
1353
|
s = Tt.parse(r);
|
|
@@ -1301,55 +1389,55 @@ async function os(r, t) {
|
|
|
1301
1389
|
const g = h.path;
|
|
1302
1390
|
try {
|
|
1303
1391
|
try {
|
|
1304
|
-
await
|
|
1305
|
-
} catch (
|
|
1306
|
-
if (
|
|
1392
|
+
await U.promises.access(g, U.constants.F_OK);
|
|
1393
|
+
} catch (x) {
|
|
1394
|
+
if (x.code === "ENOENT")
|
|
1307
1395
|
return {
|
|
1308
1396
|
error: `Directory does not exist: "${g}". Verify the path is correct and accessible. If using rootDir parameter, ensure it exists relative to the current working directory. Use fs-list without rootDir to list the current directory, or check parent directories first.`
|
|
1309
1397
|
};
|
|
1310
|
-
throw
|
|
1398
|
+
throw x;
|
|
1311
1399
|
}
|
|
1312
|
-
const y = o && o.length > 0 ? o.map((
|
|
1313
|
-
value:
|
|
1400
|
+
const y = o && o.length > 0 ? o.map((x) => ({
|
|
1401
|
+
value: x,
|
|
1314
1402
|
valueType: "pattern",
|
|
1315
1403
|
exclude: !1
|
|
1316
|
-
})) : [{ value: "**", valueType: "pattern", exclude: !1 }], w = t.globsExclude || [],
|
|
1404
|
+
})) : [{ value: "**", valueType: "pattern", exclude: !1 }], w = t.globsExclude || [], I = [...y, ...w], E = {
|
|
1317
1405
|
files: e ?? !1,
|
|
1318
1406
|
dirs: n ?? !1,
|
|
1319
1407
|
dateModified: f.includes("dateModified") || p.includes("dateModified"),
|
|
1320
1408
|
size: f.includes("size") || p.includes("size"),
|
|
1321
1409
|
countFiles: f.includes("countFiles") || p.includes("countFiles")
|
|
1322
1410
|
};
|
|
1323
|
-
let b = null,
|
|
1411
|
+
let b = null, $ = null;
|
|
1324
1412
|
if (a || c)
|
|
1325
1413
|
try {
|
|
1326
|
-
const
|
|
1327
|
-
b = [
|
|
1328
|
-
} catch (
|
|
1414
|
+
const x = Date.now(), C = c ? x - qe(c) : null, P = a ? x - qe(a) : null;
|
|
1415
|
+
b = [C, P];
|
|
1416
|
+
} catch (x) {
|
|
1329
1417
|
return {
|
|
1330
|
-
error:
|
|
1418
|
+
error: x instanceof Error ? x.message : "Unknown error parsing time ago filter"
|
|
1331
1419
|
};
|
|
1332
1420
|
}
|
|
1333
1421
|
if (l || u)
|
|
1334
1422
|
try {
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
} catch (
|
|
1423
|
+
const x = l ? Ge(l) : null, C = u ? Ge(u) : null;
|
|
1424
|
+
$ = [x, C];
|
|
1425
|
+
} catch (x) {
|
|
1338
1426
|
return {
|
|
1339
|
-
error:
|
|
1427
|
+
error: x instanceof Error ? x.message : "Unknown error parsing size filter"
|
|
1340
1428
|
};
|
|
1341
1429
|
}
|
|
1342
|
-
const T = await
|
|
1430
|
+
const T = await es({
|
|
1343
1431
|
rootDir: g || null,
|
|
1344
|
-
globs:
|
|
1432
|
+
globs: I,
|
|
1345
1433
|
result: E,
|
|
1346
1434
|
dateModified: b,
|
|
1347
|
-
totalSize:
|
|
1435
|
+
totalSize: $
|
|
1348
1436
|
});
|
|
1349
|
-
return T.items.length >
|
|
1350
|
-
error: `Number of paths (${T.items.length}) exceeds maximum allowed (${
|
|
1437
|
+
return T.items.length > je ? {
|
|
1438
|
+
error: `Number of paths (${T.items.length}) exceeds maximum allowed (${je}). Consider using more specific glob patterns or filters to reduce the result set.`
|
|
1351
1439
|
} : {
|
|
1352
|
-
output:
|
|
1440
|
+
output: rs(T, {
|
|
1353
1441
|
sort: d,
|
|
1354
1442
|
fields: f,
|
|
1355
1443
|
totals: !0
|
|
@@ -1359,7 +1447,7 @@ async function os(r, t) {
|
|
|
1359
1447
|
return { error: y instanceof Error ? y.message : "Unknown error" };
|
|
1360
1448
|
}
|
|
1361
1449
|
}
|
|
1362
|
-
function
|
|
1450
|
+
function is(r, t) {
|
|
1363
1451
|
r(
|
|
1364
1452
|
"fs-list",
|
|
1365
1453
|
{
|
|
@@ -1368,7 +1456,7 @@ function ns(r, t) {
|
|
|
1368
1456
|
inputSchema: Tt.shape
|
|
1369
1457
|
},
|
|
1370
1458
|
async (s) => {
|
|
1371
|
-
const o = await
|
|
1459
|
+
const o = await ns(s, t);
|
|
1372
1460
|
return o.error ? `Method: fs-list(${JSON.stringify(s)})
|
|
1373
1461
|
❌ Error: ${o.error}` : `Method: fs-list(${JSON.stringify(s)})
|
|
1374
1462
|
${o.output || JSON.stringify(o, null, 2)}`;
|
|
@@ -1376,9 +1464,9 @@ ${o.output || JSON.stringify(o, null, 2)}`;
|
|
|
1376
1464
|
);
|
|
1377
1465
|
}
|
|
1378
1466
|
const ue = /* @__PURE__ */ new Map();
|
|
1379
|
-
let
|
|
1380
|
-
function
|
|
1381
|
-
return `${++
|
|
1467
|
+
let as = 0;
|
|
1468
|
+
function ls() {
|
|
1469
|
+
return `${++as}-${Math.random().toString(36).slice(2)}`;
|
|
1382
1470
|
}
|
|
1383
1471
|
function Z(r) {
|
|
1384
1472
|
return ue.has(r) || ue.set(r, {
|
|
@@ -1479,11 +1567,11 @@ const xe = m.object({
|
|
|
1479
1567
|
"dateModified"
|
|
1480
1568
|
].map((r, t) => [r, t])
|
|
1481
1569
|
);
|
|
1482
|
-
function
|
|
1570
|
+
function cs(r, t) {
|
|
1483
1571
|
const s = Ke.get(r) ?? 1 / 0, o = Ke.get(t) ?? 1 / 0;
|
|
1484
1572
|
return s > o ? 1 : s < o ? -1 : 0;
|
|
1485
1573
|
}
|
|
1486
|
-
async function
|
|
1574
|
+
async function vt(r, t, s) {
|
|
1487
1575
|
let o;
|
|
1488
1576
|
try {
|
|
1489
1577
|
o = xe.parse(r);
|
|
@@ -1514,47 +1602,47 @@ async function Ct(r, t, s) {
|
|
|
1514
1602
|
const p = d.path;
|
|
1515
1603
|
try {
|
|
1516
1604
|
try {
|
|
1517
|
-
await
|
|
1518
|
-
} catch (
|
|
1519
|
-
if (
|
|
1605
|
+
await U.promises.access(p, U.constants.F_OK);
|
|
1606
|
+
} catch (S) {
|
|
1607
|
+
if (S.code === "ENOENT")
|
|
1520
1608
|
return {
|
|
1521
1609
|
error: `Directory does not exist: "${p}". Verify the path is correct and accessible. If using rootDir parameter, ensure it exists relative to the current working directory. Use fs-snapshot-query-create without rootDir to snapshot the current directory, or check parent directories first.`
|
|
1522
1610
|
};
|
|
1523
|
-
throw
|
|
1611
|
+
throw S;
|
|
1524
1612
|
}
|
|
1525
|
-
const h = o.extraFields ? o.extraFields.map((
|
|
1526
|
-
h.includes("name") || h.push("name"), h.sort(
|
|
1527
|
-
const g = n && n.length > 0 ? n.map((
|
|
1528
|
-
value:
|
|
1613
|
+
const h = o.extraFields ? o.extraFields.map((S) => S === "lastModified" ? "dateModified" : S) : [];
|
|
1614
|
+
h.includes("name") || h.push("name"), h.sort(cs);
|
|
1615
|
+
const g = n && n.length > 0 ? n.map((S) => ({
|
|
1616
|
+
value: S,
|
|
1529
1617
|
valueType: "pattern",
|
|
1530
1618
|
exclude: !1
|
|
1531
1619
|
})) : [{ value: "**", valueType: "pattern", exclude: !1 }], y = t.globsExclude || [], w = [...g, ...y];
|
|
1532
|
-
let
|
|
1620
|
+
let I = null, E = null;
|
|
1533
1621
|
if (a || c)
|
|
1534
1622
|
try {
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
} catch (
|
|
1623
|
+
const S = Date.now(), x = c ? S - Je(c) : null, C = a ? S - Je(a) : null;
|
|
1624
|
+
I = [x, C];
|
|
1625
|
+
} catch (S) {
|
|
1538
1626
|
return {
|
|
1539
|
-
error:
|
|
1627
|
+
error: S instanceof Error ? S.message : "Unknown error parsing time ago filter"
|
|
1540
1628
|
};
|
|
1541
1629
|
}
|
|
1542
1630
|
if (l || u)
|
|
1543
1631
|
try {
|
|
1544
|
-
const
|
|
1545
|
-
E = [
|
|
1546
|
-
} catch (
|
|
1632
|
+
const S = l ? We(l) : null, x = u ? We(u) : null;
|
|
1633
|
+
E = [S, x];
|
|
1634
|
+
} catch (S) {
|
|
1547
1635
|
return {
|
|
1548
|
-
error:
|
|
1636
|
+
error: S instanceof Error ? S.message : "Unknown error parsing size filter"
|
|
1549
1637
|
};
|
|
1550
1638
|
}
|
|
1551
|
-
const b = i ? i.includes("file") : !0,
|
|
1639
|
+
const b = i ? i.includes("file") : !0, $ = i ? i.includes("dir") : !0, T = {
|
|
1552
1640
|
name: e,
|
|
1553
1641
|
rootDir: p,
|
|
1554
1642
|
globs: w,
|
|
1555
1643
|
matchFiles: b,
|
|
1556
|
-
matchDirs:
|
|
1557
|
-
dateModified:
|
|
1644
|
+
matchDirs: $,
|
|
1645
|
+
dateModified: I,
|
|
1558
1646
|
totalSize: E,
|
|
1559
1647
|
fields: h
|
|
1560
1648
|
};
|
|
@@ -1567,7 +1655,7 @@ async function Ct(r, t, s) {
|
|
|
1567
1655
|
};
|
|
1568
1656
|
}
|
|
1569
1657
|
}
|
|
1570
|
-
function
|
|
1658
|
+
function us(r, t) {
|
|
1571
1659
|
r(
|
|
1572
1660
|
"fs-snapshot-query-create",
|
|
1573
1661
|
{
|
|
@@ -1576,7 +1664,7 @@ function cs(r, t) {
|
|
|
1576
1664
|
inputSchema: xe.shape
|
|
1577
1665
|
},
|
|
1578
1666
|
async (s, o) => {
|
|
1579
|
-
const e = await
|
|
1667
|
+
const e = await vt(s, t, o);
|
|
1580
1668
|
return e.error != null ? `Method: fs-snapshot-query-create(${JSON.stringify(s)})
|
|
1581
1669
|
❌ Error: ${e.error}` : `Method: fs-snapshot-query-create(${JSON.stringify(s)})
|
|
1582
1670
|
✅ Filesystem snapshot query "${e.snapshotQuery.name}" created successfully`;
|
|
@@ -1623,16 +1711,16 @@ function le(r) {
|
|
|
1623
1711
|
}
|
|
1624
1712
|
};
|
|
1625
1713
|
}
|
|
1626
|
-
function
|
|
1714
|
+
function Ct(r, t, s) {
|
|
1627
1715
|
let o = null;
|
|
1628
1716
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
1629
|
-
const i = t[e], a = r(i), c = a == null ? null :
|
|
1717
|
+
const i = t[e], a = r(i), c = a == null ? null : Ct(r, a, s), l = s(i, c);
|
|
1630
1718
|
l != null && (o == null && (o = []), o.push(l));
|
|
1631
1719
|
}
|
|
1632
1720
|
return o;
|
|
1633
1721
|
}
|
|
1634
1722
|
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 =
|
|
1723
|
+
const { getId: t, getChilds: s, rootNodes: o, createSnapshotNode: e } = r, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = Ct(
|
|
1636
1724
|
s,
|
|
1637
1725
|
o,
|
|
1638
1726
|
(u, f) => {
|
|
@@ -1660,14 +1748,15 @@ function Et(r) {
|
|
|
1660
1748
|
function me(r) {
|
|
1661
1749
|
return r = r != null ? H(r).replace(/\/$/, "") : null, !r || r === "." ? null : r;
|
|
1662
1750
|
}
|
|
1663
|
-
async function
|
|
1751
|
+
async function ds(r) {
|
|
1664
1752
|
const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = k.resolve(r.rootDir || "."), n = {
|
|
1665
1753
|
path: ".",
|
|
1666
1754
|
name: k.basename(o),
|
|
1667
1755
|
type: "dir",
|
|
1668
1756
|
isMatched: !1,
|
|
1669
1757
|
dateModified: null,
|
|
1670
|
-
size: 0
|
|
1758
|
+
size: 0,
|
|
1759
|
+
countFiles: 0
|
|
1671
1760
|
};
|
|
1672
1761
|
t.set(null, n);
|
|
1673
1762
|
const i = await $t({
|
|
@@ -1686,41 +1775,44 @@ async function us(r) {
|
|
|
1686
1775
|
const u = k.relative(o, a), f = c.isDirectory(), d = c.isFile();
|
|
1687
1776
|
if (!f && !d)
|
|
1688
1777
|
return !0;
|
|
1689
|
-
const p = me(u || "."), h = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
|
|
1690
|
-
let
|
|
1691
|
-
if (d && !r.matchFiles && (
|
|
1692
|
-
const [
|
|
1693
|
-
(
|
|
1778
|
+
const p = me(u || "."), h = f ? "dir" : "file", g = f ? l.maxFileDateModified || null : c.mtimeMs, y = f ? l.totalSize : c.size, w = f ? l.countFiles : 1;
|
|
1779
|
+
let I = !0;
|
|
1780
|
+
if (d && !r.matchFiles && (I = !1), f && !r.matchDirs && (I = !1), d && r.dateModified && g != null) {
|
|
1781
|
+
const [T, S] = r.dateModified;
|
|
1782
|
+
if (T != null && g < T || S != null && g > S)
|
|
1783
|
+
return !1;
|
|
1694
1784
|
}
|
|
1695
|
-
if (
|
|
1696
|
-
const [
|
|
1697
|
-
(
|
|
1785
|
+
if (d && r.totalSize && y != null) {
|
|
1786
|
+
const [T, S] = r.totalSize;
|
|
1787
|
+
if (T != null && y < T || S != null && y > S)
|
|
1788
|
+
return !1;
|
|
1698
1789
|
}
|
|
1699
|
-
if (f && !
|
|
1700
|
-
if (!(l.countFiles && l.countFiles > 0)) return !1;
|
|
1701
|
-
} else if (!w)
|
|
1790
|
+
if (f && !I && (!l.countFiles || l.countFiles <= 0))
|
|
1702
1791
|
return !1;
|
|
1703
|
-
|
|
1792
|
+
if (d && !I)
|
|
1793
|
+
return !0;
|
|
1794
|
+
const E = {
|
|
1704
1795
|
path: p ?? ".",
|
|
1705
1796
|
name: k.basename(a),
|
|
1706
1797
|
type: h,
|
|
1707
1798
|
dateModified: g,
|
|
1708
1799
|
size: y,
|
|
1709
|
-
|
|
1800
|
+
countFiles: w,
|
|
1801
|
+
isMatched: I
|
|
1710
1802
|
};
|
|
1711
1803
|
if (p == null)
|
|
1712
|
-
return n.dateModified = g, n.size = y, n.
|
|
1713
|
-
t.set(p,
|
|
1714
|
-
const
|
|
1715
|
-
let
|
|
1716
|
-
return
|
|
1804
|
+
return n.dateModified = g, n.size = y, n.countFiles = w, n.isMatched = I, !0;
|
|
1805
|
+
t.set(p, E);
|
|
1806
|
+
const b = me(H(k.dirname(p)));
|
|
1807
|
+
let $ = s.get(b);
|
|
1808
|
+
return $ || ($ = [], s.set(b, $)), $.push(p), !0;
|
|
1717
1809
|
}
|
|
1718
1810
|
}), {
|
|
1719
1811
|
idToNode: t,
|
|
1720
1812
|
idToChildIds: s
|
|
1721
1813
|
};
|
|
1722
1814
|
}
|
|
1723
|
-
const
|
|
1815
|
+
const fs = [
|
|
1724
1816
|
{ name: "[ ]", match: (r) => r === 32, min: 2, max: 81 },
|
|
1725
1817
|
{ name: "[\\t]", match: (r) => r === 9, min: 2, max: 20 },
|
|
1726
1818
|
{ name: "[\\n]", match: (r) => r === 10, min: 2, max: 14 },
|
|
@@ -1743,7 +1835,7 @@ const ds = [
|
|
|
1743
1835
|
// max: 2,
|
|
1744
1836
|
// },
|
|
1745
1837
|
];
|
|
1746
|
-
function He(r, t =
|
|
1838
|
+
function He(r, t = fs) {
|
|
1747
1839
|
const s = r.length;
|
|
1748
1840
|
if (s === 0) return 0;
|
|
1749
1841
|
const o = t.length;
|
|
@@ -1774,20 +1866,20 @@ function Nt(r) {
|
|
|
1774
1866
|
return t += He(r.textOpen) + 1, r.textClose != null && (t += He(r.textClose) + 1), r.indent && (t += 1), t;
|
|
1775
1867
|
}
|
|
1776
1868
|
const Qe = ["B", "KB", "MB", "GB", "TB"], Ye = 1024;
|
|
1777
|
-
function
|
|
1869
|
+
function ps(r) {
|
|
1778
1870
|
if (r == null) return "-";
|
|
1779
1871
|
let t = r ?? 0, s = 0;
|
|
1780
1872
|
for (; t >= Ye && s < Qe.length - 1; )
|
|
1781
1873
|
t /= Ye, s++;
|
|
1782
1874
|
return `${s === 0 ? t.toString() : t.toFixed(2)}${Qe[s]}`;
|
|
1783
1875
|
}
|
|
1784
|
-
function
|
|
1876
|
+
function hs(r) {
|
|
1785
1877
|
const s = Date.now() - r;
|
|
1786
1878
|
if (s < 0) return "0s";
|
|
1787
1879
|
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
1880
|
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
1881
|
}
|
|
1790
|
-
function
|
|
1882
|
+
function ms(r) {
|
|
1791
1883
|
return function(s, o) {
|
|
1792
1884
|
const e = r.get(s), n = r.get(o);
|
|
1793
1885
|
if (e.type !== n.type)
|
|
@@ -1800,26 +1892,25 @@ function hs(r) {
|
|
|
1800
1892
|
}
|
|
1801
1893
|
};
|
|
1802
1894
|
}
|
|
1803
|
-
function
|
|
1895
|
+
function gs(r) {
|
|
1804
1896
|
const t = r.fields ?? [];
|
|
1805
1897
|
return function(o, e) {
|
|
1806
1898
|
let n = "", i, a = 0;
|
|
1807
1899
|
const c = e ? e.length : 0;
|
|
1808
|
-
let l = 1, u, f = 0, d = 0, p
|
|
1809
|
-
if (e)
|
|
1900
|
+
let l = 1, u, f = 0, d = 0, p, h, g, y, w, I;
|
|
1901
|
+
if (o ? (y = o.type, w = o.name, I = o.path, p = o.size, h = o.countFiles, g = o.dateModified, i = o.isMatched, i && (a += 1)) : (y = "dir", w = "<root>", I = ".", p = 0, h = 0, g = null, i = !0), e)
|
|
1810
1902
|
for (let b = 0; b < e.length; b++) {
|
|
1811
|
-
const
|
|
1812
|
-
a +=
|
|
1903
|
+
const $ = e[b];
|
|
1904
|
+
a += $.countMatched, l += $.countTotal, f += $.tokens, d += $.tokensTotal, o || (p += $.size, h += $.countFiles, $.dateModified != null && (g == null || $.dateModified > g) && (g = $.dateModified));
|
|
1813
1905
|
}
|
|
1814
|
-
|
|
1815
|
-
for (let b = 0, I = t.length; b < I; b++) {
|
|
1906
|
+
for (let b = 0, $ = t.length; b < $; b++) {
|
|
1816
1907
|
const T = t[b];
|
|
1817
1908
|
switch (b > 0 && (n += " "), T) {
|
|
1818
1909
|
case "dateModified":
|
|
1819
|
-
n += g ?
|
|
1910
|
+
n += g ? hs(g) : "-";
|
|
1820
1911
|
break;
|
|
1821
1912
|
case "size":
|
|
1822
|
-
n +=
|
|
1913
|
+
n += ps(p);
|
|
1823
1914
|
break;
|
|
1824
1915
|
case "type":
|
|
1825
1916
|
n += y;
|
|
@@ -1840,7 +1931,7 @@ function ms(r) {
|
|
|
1840
1931
|
return u = Nt(E), d += u, {
|
|
1841
1932
|
type: y,
|
|
1842
1933
|
name: w,
|
|
1843
|
-
path:
|
|
1934
|
+
path: I,
|
|
1844
1935
|
isMatched: i,
|
|
1845
1936
|
countMatched: a,
|
|
1846
1937
|
countChilds: c,
|
|
@@ -1855,8 +1946,8 @@ function ms(r) {
|
|
|
1855
1946
|
};
|
|
1856
1947
|
};
|
|
1857
1948
|
}
|
|
1858
|
-
async function
|
|
1859
|
-
const t = await
|
|
1949
|
+
async function ws(r) {
|
|
1950
|
+
const t = await ds(r), s = le(t), o = s.getChilds(s.root), e = Et({
|
|
1860
1951
|
getId: (i) => {
|
|
1861
1952
|
const a = s.getId(i);
|
|
1862
1953
|
if (a == null)
|
|
@@ -1866,9 +1957,9 @@ async function gs(r) {
|
|
|
1866
1957
|
return a;
|
|
1867
1958
|
},
|
|
1868
1959
|
getChilds: (i) => s.getChilds(i),
|
|
1869
|
-
createSnapshotNode:
|
|
1960
|
+
createSnapshotNode: gs(r),
|
|
1870
1961
|
rootNodes: o ?? []
|
|
1871
|
-
}), n =
|
|
1962
|
+
}), n = ms(e.idToNode);
|
|
1872
1963
|
return e.idToChildIds.forEach((i) => {
|
|
1873
1964
|
i.sort(n);
|
|
1874
1965
|
}), le(e);
|
|
@@ -1910,7 +2001,7 @@ async function ce(r, t, s) {
|
|
|
1910
2001
|
};
|
|
1911
2002
|
c = u;
|
|
1912
2003
|
} else if (i) {
|
|
1913
|
-
const u = await
|
|
2004
|
+
const u = await vt(
|
|
1914
2005
|
i,
|
|
1915
2006
|
t,
|
|
1916
2007
|
s
|
|
@@ -1925,7 +2016,7 @@ async function ce(r, t, s) {
|
|
|
1925
2016
|
error: "Either queryName or query must be provided"
|
|
1926
2017
|
};
|
|
1927
2018
|
try {
|
|
1928
|
-
const u = await
|
|
2019
|
+
const u = await ws(c), f = {
|
|
1929
2020
|
name: e,
|
|
1930
2021
|
query: c,
|
|
1931
2022
|
tree: u
|
|
@@ -1940,7 +2031,7 @@ async function ce(r, t, s) {
|
|
|
1940
2031
|
};
|
|
1941
2032
|
}
|
|
1942
2033
|
}
|
|
1943
|
-
function
|
|
2034
|
+
function ys(r, t) {
|
|
1944
2035
|
r(
|
|
1945
2036
|
"fs-snapshot-create",
|
|
1946
2037
|
{
|
|
@@ -1960,7 +2051,7 @@ function ws(r, t) {
|
|
|
1960
2051
|
}
|
|
1961
2052
|
);
|
|
1962
2053
|
}
|
|
1963
|
-
class
|
|
2054
|
+
class bs {
|
|
1964
2055
|
_first = null;
|
|
1965
2056
|
_last = null;
|
|
1966
2057
|
_size = 0;
|
|
@@ -1983,8 +2074,8 @@ class ys {
|
|
|
1983
2074
|
return this._size;
|
|
1984
2075
|
}
|
|
1985
2076
|
}
|
|
1986
|
-
function
|
|
1987
|
-
const t = new
|
|
2077
|
+
function Ss(r) {
|
|
2078
|
+
const t = new bs(), {
|
|
1988
2079
|
tree: s,
|
|
1989
2080
|
limits: { maxCountTotal: o, maxTokensTotal: e, maxCountGroup: n, maxTokensGroup: i },
|
|
1990
2081
|
indexRangeGroupStrategy: a
|
|
@@ -2006,15 +2097,15 @@ function bs(r) {
|
|
|
2006
2097
|
const y = g * a.tokens;
|
|
2007
2098
|
if (o != null && u + p.countChilds + g > o || e != null && f + p.tokensChilds + y > e) {
|
|
2008
2099
|
const w = [];
|
|
2009
|
-
let
|
|
2010
|
-
for (let
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
-
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null &&
|
|
2100
|
+
let I = null, E = 0;
|
|
2101
|
+
for (let $ = 0, T = h.length; $ < T; $++) {
|
|
2102
|
+
const S = h[$], x = E * a.tokens;
|
|
2103
|
+
I != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
|
|
2104
|
+
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && I.countGrouped + 1 + E > n || i != null && I.tokensGrouped + S.tokens + x > i) && (w.push(I), u += 1, f += a.tokens, I = null, E = 0), I = a.add(I, S, $), S.countChilds > 0 && (E += 1);
|
|
2014
2105
|
}
|
|
2015
|
-
|
|
2016
|
-
const b = w.map((
|
|
2017
|
-
text: a.getReportText(
|
|
2106
|
+
I != null && (w.push(I), u += 1, f += a.tokens);
|
|
2107
|
+
const b = w.map(($) => ({
|
|
2108
|
+
text: a.getReportText($)
|
|
2018
2109
|
}));
|
|
2019
2110
|
if (d != null) {
|
|
2020
2111
|
if (d.childs != null)
|
|
@@ -2028,13 +2119,13 @@ function bs(r) {
|
|
|
2028
2119
|
} else {
|
|
2029
2120
|
u += p.countChilds, f += p.tokensChilds;
|
|
2030
2121
|
const w = [];
|
|
2031
|
-
for (let
|
|
2032
|
-
const E = h[
|
|
2122
|
+
for (let I = 0; I < h.length; I++) {
|
|
2123
|
+
const E = h[I], b = {
|
|
2033
2124
|
text: E.text
|
|
2034
2125
|
};
|
|
2035
2126
|
w.push(b);
|
|
2036
|
-
const
|
|
2037
|
-
|
|
2127
|
+
const $ = s.getChilds(E);
|
|
2128
|
+
$ != null && $.length > 0 && t.enqueue({
|
|
2038
2129
|
reportNode: b,
|
|
2039
2130
|
node: E
|
|
2040
2131
|
});
|
|
@@ -2094,7 +2185,7 @@ function kt(r) {
|
|
|
2094
2185
|
root: u,
|
|
2095
2186
|
getChilds: (d) => d === u ? [c] : d === c ? l : t.getChilds(d)
|
|
2096
2187
|
};
|
|
2097
|
-
return
|
|
2188
|
+
return Ss({
|
|
2098
2189
|
tree: f,
|
|
2099
2190
|
limits: e,
|
|
2100
2191
|
indexRangeGroupStrategy: n,
|
|
@@ -2118,7 +2209,7 @@ function Ot(r, t) {
|
|
|
2118
2209
|
}
|
|
2119
2210
|
return o(r, ""), s;
|
|
2120
2211
|
}
|
|
2121
|
-
class
|
|
2212
|
+
class xs {
|
|
2122
2213
|
tokens = 16;
|
|
2123
2214
|
// +1 indent, +1 for line break
|
|
2124
2215
|
getReportText = (t) => ({
|
|
@@ -2155,7 +2246,7 @@ const Rt = m.object({
|
|
|
2155
2246
|
// maxCountGroup: z.number().default(10).describe('Maximum items per group'),
|
|
2156
2247
|
// maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
|
|
2157
2248
|
});
|
|
2158
|
-
async function
|
|
2249
|
+
async function Is(r, t, s) {
|
|
2159
2250
|
let o;
|
|
2160
2251
|
try {
|
|
2161
2252
|
o = Rt.parse(r);
|
|
@@ -2215,7 +2306,7 @@ async function xs(r, t, s) {
|
|
|
2215
2306
|
maxTokensGroup: u
|
|
2216
2307
|
}
|
|
2217
2308
|
},
|
|
2218
|
-
indexRangeGroupStrategy: new
|
|
2309
|
+
indexRangeGroupStrategy: new xs()
|
|
2219
2310
|
}), w = Ot(y);
|
|
2220
2311
|
return {
|
|
2221
2312
|
fsSnapshot: d,
|
|
@@ -2231,7 +2322,7 @@ async function xs(r, t, s) {
|
|
|
2231
2322
|
};
|
|
2232
2323
|
}
|
|
2233
2324
|
}
|
|
2234
|
-
function
|
|
2325
|
+
function $s(r, t) {
|
|
2235
2326
|
r(
|
|
2236
2327
|
"fs-snapshot-browse",
|
|
2237
2328
|
{
|
|
@@ -2240,7 +2331,7 @@ function Is(r, t) {
|
|
|
2240
2331
|
inputSchema: Rt.shape
|
|
2241
2332
|
},
|
|
2242
2333
|
async (s, o) => {
|
|
2243
|
-
const e = await
|
|
2334
|
+
const e = await Is(s, t, o);
|
|
2244
2335
|
if (e.error != null)
|
|
2245
2336
|
return `Method: fs-snapshot-browse(${JSON.stringify(s)})
|
|
2246
2337
|
❌ Error: ${e.error}`;
|
|
@@ -2274,14 +2365,14 @@ function Dt(r) {
|
|
|
2274
2365
|
return e(s.root), t;
|
|
2275
2366
|
}
|
|
2276
2367
|
const Ve = /* @__PURE__ */ new Map();
|
|
2277
|
-
function
|
|
2368
|
+
function Ms(r) {
|
|
2278
2369
|
const t = H(r);
|
|
2279
2370
|
let s = Ve.get(t);
|
|
2280
2371
|
return s == null && (s = new nr(), Ve.set(t, s)), s;
|
|
2281
2372
|
}
|
|
2282
|
-
async function
|
|
2373
|
+
async function Ts(r) {
|
|
2283
2374
|
const { filePath: t, func: s } = r;
|
|
2284
|
-
return
|
|
2375
|
+
return Ms(t).lock(
|
|
2285
2376
|
() => V({
|
|
2286
2377
|
pool: Se,
|
|
2287
2378
|
count: 1,
|
|
@@ -2289,8 +2380,8 @@ async function Ms(r) {
|
|
|
2289
2380
|
})
|
|
2290
2381
|
);
|
|
2291
2382
|
}
|
|
2292
|
-
const Ze = 10, re = 48, Xe = 57, de = 36,
|
|
2293
|
-
function
|
|
2383
|
+
const Ze = 10, re = 48, Xe = 57, de = 36, vs = 38, Cs = 39, Es = 60, Ns = 62, ks = 96, se = 0, et = 1, tt = 2, rt = 3, st = 4, Os = 5;
|
|
2384
|
+
function Rs(r) {
|
|
2294
2385
|
const { content: t, pattern: s, replacement: o } = r, e = t.length, n = [0];
|
|
2295
2386
|
for (let b = 0; b < e; b++)
|
|
2296
2387
|
t.charCodeAt(b) === Ze && b + 1 < e && n.push(b + 1);
|
|
@@ -2298,45 +2389,45 @@ function Os(r) {
|
|
|
2298
2389
|
let l = null, u = null, f = null, d = 0;
|
|
2299
2390
|
if (o != null) {
|
|
2300
2391
|
const b = o.length;
|
|
2301
|
-
let
|
|
2392
|
+
let $ = !1;
|
|
2302
2393
|
for (let T = 0; T < b; T++)
|
|
2303
2394
|
if (o.charCodeAt(T) === de) {
|
|
2304
|
-
|
|
2395
|
+
$ = !0;
|
|
2305
2396
|
break;
|
|
2306
2397
|
}
|
|
2307
|
-
if (
|
|
2398
|
+
if ($) {
|
|
2308
2399
|
u = [], f = [];
|
|
2309
|
-
let T = 0,
|
|
2310
|
-
for (;
|
|
2311
|
-
if (o.charCodeAt(
|
|
2312
|
-
|
|
2400
|
+
let T = 0, S = 0;
|
|
2401
|
+
for (; S < b; ) {
|
|
2402
|
+
if (o.charCodeAt(S) !== de || S + 1 >= b) {
|
|
2403
|
+
S++;
|
|
2313
2404
|
continue;
|
|
2314
2405
|
}
|
|
2315
|
-
const
|
|
2316
|
-
let
|
|
2317
|
-
if (
|
|
2318
|
-
|
|
2319
|
-
else if (
|
|
2320
|
-
|
|
2321
|
-
else if (
|
|
2322
|
-
|
|
2323
|
-
else if (
|
|
2324
|
-
|
|
2325
|
-
else if (
|
|
2326
|
-
let
|
|
2327
|
-
for (;
|
|
2328
|
-
const
|
|
2329
|
-
if (
|
|
2330
|
-
|
|
2406
|
+
const x = o.charCodeAt(S + 1);
|
|
2407
|
+
let C = -1, P = 0, O = 2;
|
|
2408
|
+
if (x === de)
|
|
2409
|
+
C = se, P = "$";
|
|
2410
|
+
else if (x === vs)
|
|
2411
|
+
C = et;
|
|
2412
|
+
else if (x === ks)
|
|
2413
|
+
C = tt;
|
|
2414
|
+
else if (x === Cs)
|
|
2415
|
+
C = rt;
|
|
2416
|
+
else if (x >= re && x <= Xe) {
|
|
2417
|
+
let M = S + 2;
|
|
2418
|
+
for (; M < b; ) {
|
|
2419
|
+
const v = o.charCodeAt(M);
|
|
2420
|
+
if (v < re || v > Xe) break;
|
|
2421
|
+
M++;
|
|
2331
2422
|
}
|
|
2332
|
-
|
|
2333
|
-
} else if (
|
|
2334
|
-
let
|
|
2335
|
-
for (;
|
|
2336
|
-
|
|
2337
|
-
|
|
2423
|
+
C = st, P = o.substring(S + 1, M), O = M - S;
|
|
2424
|
+
} else if (x === Es) {
|
|
2425
|
+
let M = S + 2;
|
|
2426
|
+
for (; M < b && o.charCodeAt(M) !== Ns; )
|
|
2427
|
+
M++;
|
|
2428
|
+
M < b && M > S + 2 && (C = Os, P = o.substring(S + 2, M), O = M + 1 - S);
|
|
2338
2429
|
}
|
|
2339
|
-
|
|
2430
|
+
C >= 0 ? (S > T && (u.push(se), f.push(o.substring(T, S))), u.push(C), f.push(P), S += O, T = S) : S++;
|
|
2340
2431
|
}
|
|
2341
2432
|
T < b && (u.push(se), f.push(o.substring(T))), d = u.length;
|
|
2342
2433
|
} else
|
|
@@ -2346,78 +2437,78 @@ function Os(r) {
|
|
|
2346
2437
|
s.lastIndex = 0;
|
|
2347
2438
|
let y;
|
|
2348
2439
|
for (; (y = s.exec(t)) !== null; ) {
|
|
2349
|
-
const b = y.index,
|
|
2350
|
-
let
|
|
2440
|
+
const b = y.index, $ = y[0], T = $.length, S = b + T;
|
|
2441
|
+
let x, C, P, O;
|
|
2351
2442
|
if (i === 1)
|
|
2352
|
-
|
|
2443
|
+
x = 0, C = 1, P = 0, O = e;
|
|
2353
2444
|
else {
|
|
2354
|
-
let
|
|
2355
|
-
for (;
|
|
2356
|
-
const N =
|
|
2357
|
-
n[N] <= b ?
|
|
2445
|
+
let M = 0, v = i - 1;
|
|
2446
|
+
for (; M < v; ) {
|
|
2447
|
+
const N = M + v + 1 >> 1;
|
|
2448
|
+
n[N] <= b ? M = N : v = N - 1;
|
|
2358
2449
|
}
|
|
2359
|
-
if (
|
|
2360
|
-
const N =
|
|
2361
|
-
for (
|
|
2362
|
-
const R =
|
|
2363
|
-
n[R] <= N ?
|
|
2450
|
+
if (x = M, T > 0) {
|
|
2451
|
+
const N = S - 1;
|
|
2452
|
+
for (v = i - 1; M < v; ) {
|
|
2453
|
+
const R = M + v + 1 >> 1;
|
|
2454
|
+
n[R] <= N ? M = R : v = R - 1;
|
|
2364
2455
|
}
|
|
2365
|
-
|
|
2456
|
+
C = M + 1;
|
|
2366
2457
|
} else
|
|
2367
|
-
|
|
2368
|
-
P = n[
|
|
2458
|
+
C = x + 1;
|
|
2459
|
+
P = n[x], O = C < i ? n[C] : e;
|
|
2369
2460
|
}
|
|
2370
2461
|
if (a.push({
|
|
2371
|
-
offset: [b,
|
|
2372
|
-
lines: [
|
|
2462
|
+
offset: [b, S],
|
|
2463
|
+
lines: [x, C],
|
|
2373
2464
|
linesOffset: [P, O]
|
|
2374
2465
|
}), o != null) {
|
|
2375
2466
|
p += t.substring(h, b);
|
|
2376
|
-
let
|
|
2467
|
+
let M;
|
|
2377
2468
|
if (l != null)
|
|
2378
|
-
|
|
2469
|
+
M = l;
|
|
2379
2470
|
else {
|
|
2380
|
-
|
|
2471
|
+
M = "";
|
|
2381
2472
|
const N = y.groups, R = y.length - 1;
|
|
2382
2473
|
for (let K = 0; K < d; K++) {
|
|
2383
|
-
const
|
|
2384
|
-
switch (
|
|
2474
|
+
const j = u[K], L = f[K];
|
|
2475
|
+
switch (j) {
|
|
2385
2476
|
case se:
|
|
2386
|
-
|
|
2477
|
+
M += L;
|
|
2387
2478
|
break;
|
|
2388
2479
|
case et:
|
|
2389
|
-
|
|
2480
|
+
M += $;
|
|
2390
2481
|
break;
|
|
2391
2482
|
case tt:
|
|
2392
|
-
|
|
2483
|
+
M += t.substring(0, b);
|
|
2393
2484
|
break;
|
|
2394
2485
|
case rt:
|
|
2395
|
-
|
|
2486
|
+
M += t.substring(S);
|
|
2396
2487
|
break;
|
|
2397
2488
|
case st: {
|
|
2398
2489
|
const B = L, z = B.length, A = B.charCodeAt(0) - re;
|
|
2399
2490
|
if (z >= 2) {
|
|
2400
|
-
const
|
|
2491
|
+
const q = B.charCodeAt(1) - re, D = A * 10 + q;
|
|
2401
2492
|
if (D >= 1 && D <= R) {
|
|
2402
|
-
|
|
2493
|
+
M += y[D] ?? "", z > 2 && (M += B.substring(2));
|
|
2403
2494
|
break;
|
|
2404
2495
|
}
|
|
2405
2496
|
}
|
|
2406
|
-
A >= 1 && A <= R ? (
|
|
2497
|
+
A >= 1 && A <= R ? (M += y[A] ?? "", z > 1 && (M += B.substring(1))) : M += "$" + B;
|
|
2407
2498
|
break;
|
|
2408
2499
|
}
|
|
2409
2500
|
default:
|
|
2410
|
-
N != null ?
|
|
2501
|
+
N != null ? M += N[L] ?? "" : M += "$<" + L + ">";
|
|
2411
2502
|
}
|
|
2412
2503
|
}
|
|
2413
2504
|
}
|
|
2414
|
-
p +=
|
|
2415
|
-
const
|
|
2505
|
+
p += M;
|
|
2506
|
+
const v = b + g;
|
|
2416
2507
|
c.push({
|
|
2417
|
-
offset: [
|
|
2508
|
+
offset: [v, v + M.length],
|
|
2418
2509
|
lines: [0, 0],
|
|
2419
2510
|
linesOffset: [0, 0]
|
|
2420
|
-
}), g +=
|
|
2511
|
+
}), g += M.length - T, h = S;
|
|
2421
2512
|
}
|
|
2422
2513
|
if (T === 0 && s.lastIndex++, !s.global)
|
|
2423
2514
|
break;
|
|
@@ -2425,33 +2516,33 @@ function Os(r) {
|
|
|
2425
2516
|
if (s.lastIndex = 0, o == null)
|
|
2426
2517
|
return { search: { content: t, matches: a }, replace: null };
|
|
2427
2518
|
p += t.substring(h);
|
|
2428
|
-
const w = p.length,
|
|
2519
|
+
const w = p.length, I = [0];
|
|
2429
2520
|
for (let b = 0; b < w; b++)
|
|
2430
|
-
p.charCodeAt(b) === Ze && b + 1 < w &&
|
|
2431
|
-
const E =
|
|
2432
|
-
for (let b = 0,
|
|
2433
|
-
const T = c[b],
|
|
2434
|
-
let
|
|
2521
|
+
p.charCodeAt(b) === Ze && b + 1 < w && I.push(b + 1);
|
|
2522
|
+
const E = I.length;
|
|
2523
|
+
for (let b = 0, $ = c.length; b < $; b++) {
|
|
2524
|
+
const T = c[b], S = T.offset[0], x = T.offset[1];
|
|
2525
|
+
let C, P, O, M;
|
|
2435
2526
|
if (E === 1)
|
|
2436
|
-
|
|
2527
|
+
C = 0, P = 1, O = 0, M = w;
|
|
2437
2528
|
else {
|
|
2438
|
-
let
|
|
2439
|
-
for (;
|
|
2440
|
-
const R =
|
|
2441
|
-
|
|
2529
|
+
let v = 0, N = E - 1;
|
|
2530
|
+
for (; v < N; ) {
|
|
2531
|
+
const R = v + N + 1 >> 1;
|
|
2532
|
+
I[R] <= S ? v = R : N = R - 1;
|
|
2442
2533
|
}
|
|
2443
|
-
if (
|
|
2444
|
-
const R =
|
|
2445
|
-
for (N = E - 1;
|
|
2446
|
-
const K =
|
|
2447
|
-
|
|
2534
|
+
if (C = v, x > S) {
|
|
2535
|
+
const R = x - 1;
|
|
2536
|
+
for (N = E - 1; v < N; ) {
|
|
2537
|
+
const K = v + N + 1 >> 1;
|
|
2538
|
+
I[K] <= R ? v = K : N = K - 1;
|
|
2448
2539
|
}
|
|
2449
|
-
P = C + 1;
|
|
2450
|
-
} else
|
|
2451
2540
|
P = v + 1;
|
|
2452
|
-
|
|
2541
|
+
} else
|
|
2542
|
+
P = C + 1;
|
|
2543
|
+
O = I[C], M = P < E ? I[P] : w;
|
|
2453
2544
|
}
|
|
2454
|
-
T.lines[0] =
|
|
2545
|
+
T.lines[0] = C, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] = M;
|
|
2455
2546
|
}
|
|
2456
2547
|
return {
|
|
2457
2548
|
search: { content: t, matches: a },
|
|
@@ -2497,37 +2588,37 @@ function oe(r, t, s, o) {
|
|
|
2497
2588
|
return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: c + 1 };
|
|
2498
2589
|
return { startLine: i, endLine: l, startLineOfs: a, endLineOfs: t };
|
|
2499
2590
|
}
|
|
2500
|
-
function
|
|
2591
|
+
function Ds(r, t) {
|
|
2501
2592
|
if (r.replace == null && t.replace == null) {
|
|
2502
|
-
const
|
|
2593
|
+
const _ = [...r.search.matches, ...t.search.matches];
|
|
2503
2594
|
return {
|
|
2504
|
-
search: { content: r.search.content, matches: Ft(
|
|
2595
|
+
search: { content: r.search.content, matches: Ft(_) },
|
|
2505
2596
|
replace: null
|
|
2506
2597
|
};
|
|
2507
2598
|
}
|
|
2508
2599
|
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
|
-
let y = 0, w = 0,
|
|
2600
|
+
let y = 0, w = 0, I = 0, E = 0, b = 0, $ = 0, T = 0, S = 0, x = 0, C = 0, P = 0, O = 0, M = 0, v = 0, N = 0, R = 0, K = 0, j = 0, L = 0, B = 0, z = 0, A = 0, q = 0, D = 0;
|
|
2510
2601
|
for (; y < d || w < p; )
|
|
2511
|
-
if (y < d && (b = l[y].offset[0],
|
|
2512
|
-
K = b < T ? b : T,
|
|
2602
|
+
if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (T = u[w].offset[0], S = u[w].offset[1]), y < d && w < p && b < S && T < $) {
|
|
2603
|
+
K = b < T ? b : T, x = $ > S ? $ : S, P = y, O = w, y++, w++;
|
|
2513
2604
|
do {
|
|
2514
|
-
for (
|
|
2515
|
-
|
|
2516
|
-
for (; w < p && u[w].offset[0] <
|
|
2517
|
-
|
|
2518
|
-
} while (
|
|
2519
|
-
|
|
2605
|
+
for (C = x; y < d && l[y].offset[0] < x; )
|
|
2606
|
+
$ = l[y].offset[1], $ > x && (x = $), y++;
|
|
2607
|
+
for (; w < p && u[w].offset[0] < x; )
|
|
2608
|
+
S = u[w].offset[1], S > x && (x = S), w++;
|
|
2609
|
+
} while (x !== C);
|
|
2610
|
+
M = 1 / 0, v = -1 / 0, j = K, L = I;
|
|
2520
2611
|
for (let G = P; G < y; G++)
|
|
2521
|
-
B = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0],
|
|
2522
|
-
|
|
2612
|
+
B = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], q = l[G].offset[1], j < A && (D = j + L, D < M && (M = D), D = A + L, D > v && (v = D)), B < M && (M = B), z > v && (v = z), L += z - B - q + A, j = q;
|
|
2613
|
+
j < x && (D = j + L, D < M && (M = D), D = x + L, D > v && (v = D)), I = L, N = 1 / 0, R = -1 / 0, j = K, L = E;
|
|
2523
2614
|
for (let G = O; G < w; G++)
|
|
2524
|
-
B = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0],
|
|
2525
|
-
|
|
2526
|
-
const
|
|
2615
|
+
B = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0], q = f[G].offset[1], j < B && (D = j + L, D < N && (N = D), D = B + L, D > R && (R = D)), A < N && (N = A), q > R && (R = q), L += q - A - z + B, j = z;
|
|
2616
|
+
j < x && (D = j + L, D < N && (N = D), D = x + L, D > R && (R = D)), E = L;
|
|
2617
|
+
const _ = oe(e, i, M, v);
|
|
2527
2618
|
h.push({
|
|
2528
|
-
offset: [
|
|
2529
|
-
lines: [
|
|
2530
|
-
linesOffset: [
|
|
2619
|
+
offset: [M, v],
|
|
2620
|
+
lines: [_.startLine, _.endLine],
|
|
2621
|
+
linesOffset: [_.startLineOfs, _.endLineOfs]
|
|
2531
2622
|
});
|
|
2532
2623
|
const te = oe(n, a, N, R);
|
|
2533
2624
|
g.push({
|
|
@@ -2536,35 +2627,35 @@ function Rs(r, t) {
|
|
|
2536
2627
|
linesOffset: [te.startLineOfs, te.endLineOfs]
|
|
2537
2628
|
});
|
|
2538
2629
|
} else if (w >= p || y < d && b <= T) {
|
|
2539
|
-
B = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0],
|
|
2540
|
-
const
|
|
2630
|
+
B = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], q = l[y].offset[1], N = A + E, R = q + E;
|
|
2631
|
+
const _ = oe(n, a, N, R);
|
|
2541
2632
|
h.push(c[y]), g.push({
|
|
2542
2633
|
offset: [N, R],
|
|
2543
|
-
lines: [
|
|
2544
|
-
linesOffset: [
|
|
2545
|
-
}),
|
|
2634
|
+
lines: [_.startLine, _.endLine],
|
|
2635
|
+
linesOffset: [_.startLineOfs, _.endLineOfs]
|
|
2636
|
+
}), I += z - B - q + A, y++;
|
|
2546
2637
|
} else {
|
|
2547
|
-
B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0],
|
|
2548
|
-
const
|
|
2638
|
+
B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], q = f[w].offset[1], M = B + I, v = z + I;
|
|
2639
|
+
const _ = oe(e, i, M, v);
|
|
2549
2640
|
h.push({
|
|
2550
|
-
offset: [
|
|
2551
|
-
lines: [
|
|
2552
|
-
linesOffset: [
|
|
2553
|
-
}), g.push(f[w]), E +=
|
|
2641
|
+
offset: [M, v],
|
|
2642
|
+
lines: [_.startLine, _.endLine],
|
|
2643
|
+
linesOffset: [_.startLineOfs, _.endLineOfs]
|
|
2644
|
+
}), g.push(f[w]), E += q - A - z + B, w++;
|
|
2554
2645
|
}
|
|
2555
2646
|
return {
|
|
2556
2647
|
search: { content: e, matches: h },
|
|
2557
2648
|
replace: { content: n, matches: g }
|
|
2558
2649
|
};
|
|
2559
2650
|
}
|
|
2560
|
-
async function
|
|
2651
|
+
async function Fs(r) {
|
|
2561
2652
|
const { filePath: t, operations: s, dryRun: o } = r;
|
|
2562
|
-
return s.length === 0 ? { filePath: t, result: null } :
|
|
2653
|
+
return s.length === 0 ? { filePath: t, result: null } : Ts({
|
|
2563
2654
|
filePath: t,
|
|
2564
2655
|
func: async () => {
|
|
2565
2656
|
let e;
|
|
2566
2657
|
try {
|
|
2567
|
-
e = await
|
|
2658
|
+
e = await U.promises.readFile(t, "utf-8");
|
|
2568
2659
|
} catch (a) {
|
|
2569
2660
|
return {
|
|
2570
2661
|
filePath: t,
|
|
@@ -2585,18 +2676,18 @@ async function Ds(r) {
|
|
|
2585
2676
|
error: `Invalid RegExp pattern "${c.pattern}": ${d instanceof Error ? d.message : d + ""}`
|
|
2586
2677
|
};
|
|
2587
2678
|
}
|
|
2588
|
-
const u = n?.replace?.content ?? e, f =
|
|
2679
|
+
const u = n?.replace?.content ?? e, f = Rs({
|
|
2589
2680
|
content: u,
|
|
2590
2681
|
pattern: l,
|
|
2591
2682
|
replacement: c.replacement
|
|
2592
2683
|
});
|
|
2593
|
-
c.replacement != null && (i = !0), n == null ? n = f : n =
|
|
2684
|
+
c.replacement != null && (i = !0), n == null ? n = f : n = Ds(n, f);
|
|
2594
2685
|
}
|
|
2595
2686
|
if (i && n?.replace != null && !o) {
|
|
2596
2687
|
const a = n.replace.content;
|
|
2597
2688
|
if (a !== e)
|
|
2598
2689
|
try {
|
|
2599
|
-
await
|
|
2690
|
+
await U.promises.writeFile(t, a, "utf-8");
|
|
2600
2691
|
} catch (c) {
|
|
2601
2692
|
return {
|
|
2602
2693
|
filePath: t,
|
|
@@ -2614,7 +2705,7 @@ async function Ie(r) {
|
|
|
2614
2705
|
return { results: await Promise.all(
|
|
2615
2706
|
t.map(async (i) => {
|
|
2616
2707
|
if (e != null) {
|
|
2617
|
-
const a = await
|
|
2708
|
+
const a = await U.promises.stat(i).catch(() => null);
|
|
2618
2709
|
if (a == null)
|
|
2619
2710
|
return {
|
|
2620
2711
|
filePath: i,
|
|
@@ -2628,13 +2719,13 @@ async function Ie(r) {
|
|
|
2628
2719
|
error: "Not replaced, try again"
|
|
2629
2720
|
};
|
|
2630
2721
|
}
|
|
2631
|
-
return
|
|
2722
|
+
return Fs({ filePath: i, operations: s, dryRun: o });
|
|
2632
2723
|
})
|
|
2633
2724
|
) };
|
|
2634
2725
|
}
|
|
2635
|
-
const
|
|
2636
|
-
function
|
|
2637
|
-
const { content: t, startLine: s } = r, o = r.padWidth ??
|
|
2726
|
+
const Ps = 6;
|
|
2727
|
+
function Bs(r) {
|
|
2728
|
+
const { content: t, startLine: s } = r, o = r.padWidth ?? Ps;
|
|
2638
2729
|
let e = "", n = 0, i = 0;
|
|
2639
2730
|
for (; n < t.length; ) {
|
|
2640
2731
|
const a = t.indexOf(`
|
|
@@ -2655,7 +2746,7 @@ function fe(r) {
|
|
|
2655
2746
|
const c = e[a], l = t.substring(
|
|
2656
2747
|
c.linesOffset[0],
|
|
2657
2748
|
c.linesOffset[1]
|
|
2658
|
-
), u =
|
|
2749
|
+
), u = Bs({
|
|
2659
2750
|
content: l,
|
|
2660
2751
|
startLine: c.lines[0]
|
|
2661
2752
|
}), f = a > 0 ? 2 : 0;
|
|
@@ -2669,7 +2760,7 @@ function fe(r) {
|
|
|
2669
2760
|
return { output: n, truncated: i };
|
|
2670
2761
|
}
|
|
2671
2762
|
const ot = "BEFORE", nt = "AFTER";
|
|
2672
|
-
function
|
|
2763
|
+
function Ls(r) {
|
|
2673
2764
|
const { result: t, outputLimit: s } = r;
|
|
2674
2765
|
if (t.replace == null) {
|
|
2675
2766
|
const h = fe({
|
|
@@ -2712,7 +2803,7 @@ function $e(r) {
|
|
|
2712
2803
|
}
|
|
2713
2804
|
if (o || i.result == null || i.result.search.matches.length === 0)
|
|
2714
2805
|
continue;
|
|
2715
|
-
const l =
|
|
2806
|
+
const l = Ls({
|
|
2716
2807
|
result: i.result
|
|
2717
2808
|
});
|
|
2718
2809
|
l.output.length > 0 && (c > 0 && (e += `
|
|
@@ -2721,7 +2812,7 @@ function $e(r) {
|
|
|
2721
2812
|
}
|
|
2722
2813
|
return e;
|
|
2723
2814
|
}
|
|
2724
|
-
const
|
|
2815
|
+
const As = m.object({
|
|
2725
2816
|
pattern: m.string().describe("JS RegExp pattern"),
|
|
2726
2817
|
flags: m.string().default("gm").describe('JS RegExp flags. Default: "gm"')
|
|
2727
2818
|
}), Pt = m.object({
|
|
@@ -2729,14 +2820,14 @@ const Ls = m.object({
|
|
|
2729
2820
|
snapshot: ee.optional().describe(
|
|
2730
2821
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
2731
2822
|
),
|
|
2732
|
-
bulkOperations: m.array(
|
|
2823
|
+
bulkOperations: m.array(As).describe(
|
|
2733
2824
|
"All search patterns to execute; include every pattern here; never split across multiple calls"
|
|
2734
2825
|
),
|
|
2735
2826
|
outputLimit: m.number().int().min(0).max(J).default(Q).describe(
|
|
2736
2827
|
`Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
|
|
2737
2828
|
)
|
|
2738
2829
|
});
|
|
2739
|
-
async function
|
|
2830
|
+
async function zs(r, t, s) {
|
|
2740
2831
|
let o;
|
|
2741
2832
|
try {
|
|
2742
2833
|
o = Pt.parse(r);
|
|
@@ -2789,7 +2880,7 @@ async function As(r, t, s) {
|
|
|
2789
2880
|
limit: a
|
|
2790
2881
|
}).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
|
|
2791
2882
|
}
|
|
2792
|
-
function
|
|
2883
|
+
function _s(r, t) {
|
|
2793
2884
|
r(
|
|
2794
2885
|
"fs-snapshot-search",
|
|
2795
2886
|
{
|
|
@@ -2798,7 +2889,7 @@ function zs(r, t) {
|
|
|
2798
2889
|
inputSchema: Pt.shape
|
|
2799
2890
|
},
|
|
2800
2891
|
async (s, o) => {
|
|
2801
|
-
const e = await
|
|
2892
|
+
const e = await zs(
|
|
2802
2893
|
s,
|
|
2803
2894
|
t,
|
|
2804
2895
|
o
|
|
@@ -2881,14 +2972,14 @@ async function js(r, t, s) {
|
|
|
2881
2972
|
}, g = Date.now(), y = await Ie({
|
|
2882
2973
|
...h,
|
|
2883
2974
|
dryRun: !0
|
|
2884
|
-
}), w =
|
|
2975
|
+
}), w = ls();
|
|
2885
2976
|
c.preparedReplace = {
|
|
2886
2977
|
id: w,
|
|
2887
2978
|
options: h,
|
|
2888
2979
|
rootDir: p,
|
|
2889
2980
|
dateCreated: g
|
|
2890
2981
|
};
|
|
2891
|
-
const
|
|
2982
|
+
const I = $e({
|
|
2892
2983
|
result: y,
|
|
2893
2984
|
rootDir: p
|
|
2894
2985
|
}) + `
|
|
@@ -2896,7 +2987,7 @@ async function js(r, t, s) {
|
|
|
2896
2987
|
Review the output carefully before executing. Call fs-snapshot-replace-execute with replaceId="${w}" exclusively when all replacements are valid; never apply if you detect any problems.`;
|
|
2897
2988
|
return { output: we({
|
|
2898
2989
|
sessionId: s.sessionId,
|
|
2899
|
-
source:
|
|
2990
|
+
source: I,
|
|
2900
2991
|
limit: a
|
|
2901
2992
|
}).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
|
|
2902
2993
|
}
|
|
@@ -2933,7 +3024,7 @@ Reminder: use one snapshot covering all target files; include all patterns in th
|
|
|
2933
3024
|
const Lt = m.object({
|
|
2934
3025
|
replaceId: m.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
|
|
2935
3026
|
});
|
|
2936
|
-
async function
|
|
3027
|
+
async function Gs(r, t, s) {
|
|
2937
3028
|
let o;
|
|
2938
3029
|
try {
|
|
2939
3030
|
o = Lt.parse(r);
|
|
@@ -2966,7 +3057,7 @@ async function _s(r, t, s) {
|
|
|
2966
3057
|
errorsOnly: !0
|
|
2967
3058
|
}) || null };
|
|
2968
3059
|
}
|
|
2969
|
-
function
|
|
3060
|
+
function Js(r, t) {
|
|
2970
3061
|
r(
|
|
2971
3062
|
"fs-snapshot-replace-execute",
|
|
2972
3063
|
{
|
|
@@ -2975,7 +3066,7 @@ function Gs(r, t) {
|
|
|
2975
3066
|
inputSchema: Lt.shape
|
|
2976
3067
|
},
|
|
2977
3068
|
async (s, o) => {
|
|
2978
|
-
const e = await
|
|
3069
|
+
const e = await Gs(
|
|
2979
3070
|
s,
|
|
2980
3071
|
t,
|
|
2981
3072
|
o
|
|
@@ -2990,8 +3081,8 @@ ${e.output}`), n;
|
|
|
2990
3081
|
}
|
|
2991
3082
|
);
|
|
2992
3083
|
}
|
|
2993
|
-
function
|
|
2994
|
-
t.list &&
|
|
3084
|
+
function Ws(r, t) {
|
|
3085
|
+
t.list && is(r, t), t.snapshotQueryCreate && us(r, t), t.snapshotCreate && ys(r, t), t.snapshotBrowse && $s(r, t), t.snapshotSearch && _s(r, t), t.snapshotReplace && (qs(r, t), Js(r, t)), console.log(
|
|
2995
3086
|
`File manager:
|
|
2996
3087
|
- Working directory: ${k.resolve(t.workingDir || "")}
|
|
2997
3088
|
`
|
|
@@ -3049,7 +3140,7 @@ async function At(r, t, s) {
|
|
|
3049
3140
|
};
|
|
3050
3141
|
}
|
|
3051
3142
|
}
|
|
3052
|
-
function
|
|
3143
|
+
function Ks(r, t) {
|
|
3053
3144
|
r(
|
|
3054
3145
|
"playwright-browser-create",
|
|
3055
3146
|
{
|
|
@@ -3065,7 +3156,7 @@ ${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name
|
|
|
3065
3156
|
);
|
|
3066
3157
|
}
|
|
3067
3158
|
const zt = m.object({});
|
|
3068
|
-
async function
|
|
3159
|
+
async function Hs(r, t, s) {
|
|
3069
3160
|
let o;
|
|
3070
3161
|
try {
|
|
3071
3162
|
o = zt.parse(r);
|
|
@@ -3083,7 +3174,7 @@ async function Ks(r, t, s) {
|
|
|
3083
3174
|
browserInfos: Array.from(e.browsers.values())
|
|
3084
3175
|
};
|
|
3085
3176
|
}
|
|
3086
|
-
function
|
|
3177
|
+
function Qs(r, t) {
|
|
3087
3178
|
r(
|
|
3088
3179
|
"playwright-browser-list",
|
|
3089
3180
|
{
|
|
@@ -3092,7 +3183,7 @@ function Hs(r, t) {
|
|
|
3092
3183
|
inputSchema: zt.shape
|
|
3093
3184
|
},
|
|
3094
3185
|
async (s, o) => {
|
|
3095
|
-
const e = await
|
|
3186
|
+
const e = await Hs(s, t, o);
|
|
3096
3187
|
if (e.error != null)
|
|
3097
3188
|
return `Method: playwright-browser-list(${JSON.stringify(s)})
|
|
3098
3189
|
❌ Error: ${e.error}`;
|
|
@@ -3104,15 +3195,15 @@ ${n.length === 0 ? "No browsers found" : `Browsers: ${n.join(", ")}`}`;
|
|
|
3104
3195
|
}
|
|
3105
3196
|
);
|
|
3106
3197
|
}
|
|
3107
|
-
const
|
|
3198
|
+
const _t = m.object({
|
|
3108
3199
|
names: m.array(m.string()).optional().describe(
|
|
3109
3200
|
"Names of browsers to close. If not specified, closes all browsers"
|
|
3110
3201
|
)
|
|
3111
3202
|
});
|
|
3112
|
-
async function
|
|
3203
|
+
async function Ys(r, t, s) {
|
|
3113
3204
|
let o;
|
|
3114
3205
|
try {
|
|
3115
|
-
o =
|
|
3206
|
+
o = _t.parse(r);
|
|
3116
3207
|
} catch (l) {
|
|
3117
3208
|
return {
|
|
3118
3209
|
error: F(l)
|
|
@@ -3143,16 +3234,16 @@ async function Qs(r, t, s) {
|
|
|
3143
3234
|
...a.length > 0 && { errors: a }
|
|
3144
3235
|
};
|
|
3145
3236
|
}
|
|
3146
|
-
function
|
|
3237
|
+
function Vs(r, t) {
|
|
3147
3238
|
r(
|
|
3148
3239
|
"playwright-browser-close",
|
|
3149
3240
|
{
|
|
3150
3241
|
title: "Close Browsers",
|
|
3151
3242
|
description: "Close browsers. Automatically closes all contexts and pages within the browsers",
|
|
3152
|
-
inputSchema:
|
|
3243
|
+
inputSchema: _t.shape
|
|
3153
3244
|
},
|
|
3154
3245
|
async (s, o) => {
|
|
3155
|
-
const e = await
|
|
3246
|
+
const e = await Ys(s, t, o);
|
|
3156
3247
|
if (e.error != null)
|
|
3157
3248
|
return `Method: playwright-browser-close(${JSON.stringify(s)})
|
|
3158
3249
|
❌ Error: ${e.error}`;
|
|
@@ -3184,7 +3275,7 @@ const Te = m.object({
|
|
|
3184
3275
|
height: m.number()
|
|
3185
3276
|
}).optional().describe("Viewport size configuration")
|
|
3186
3277
|
});
|
|
3187
|
-
async function
|
|
3278
|
+
async function Ut(r, t, s) {
|
|
3188
3279
|
let o;
|
|
3189
3280
|
try {
|
|
3190
3281
|
o = Te.parse(r);
|
|
@@ -3242,7 +3333,7 @@ async function jt(r, t, s) {
|
|
|
3242
3333
|
};
|
|
3243
3334
|
}
|
|
3244
3335
|
}
|
|
3245
|
-
function
|
|
3336
|
+
function Zs(r, t) {
|
|
3246
3337
|
r(
|
|
3247
3338
|
"playwright-context-create",
|
|
3248
3339
|
{
|
|
@@ -3251,7 +3342,7 @@ function Vs(r, t) {
|
|
|
3251
3342
|
inputSchema: Te.shape
|
|
3252
3343
|
},
|
|
3253
3344
|
async (s, o) => {
|
|
3254
|
-
const e = await
|
|
3345
|
+
const e = await Ut(s, t, o);
|
|
3255
3346
|
if (e.error != null)
|
|
3256
3347
|
return `Method: playwright-context-create(${JSON.stringify(s)})
|
|
3257
3348
|
❌ Error: ${e.error}`;
|
|
@@ -3262,15 +3353,15 @@ function Vs(r, t) {
|
|
|
3262
3353
|
}
|
|
3263
3354
|
);
|
|
3264
3355
|
}
|
|
3265
|
-
const
|
|
3356
|
+
const jt = m.object({
|
|
3266
3357
|
browserName: m.string().optional().describe(
|
|
3267
3358
|
"Name of browser to list contexts from. If not specified, lists contexts from all browsers"
|
|
3268
3359
|
)
|
|
3269
3360
|
});
|
|
3270
|
-
async function
|
|
3361
|
+
async function Xs(r, t, s) {
|
|
3271
3362
|
let o;
|
|
3272
3363
|
try {
|
|
3273
|
-
o =
|
|
3364
|
+
o = jt.parse(r);
|
|
3274
3365
|
} catch (a) {
|
|
3275
3366
|
return {
|
|
3276
3367
|
error: F(a)
|
|
@@ -3304,16 +3395,16 @@ async function Zs(r, t, s) {
|
|
|
3304
3395
|
contextsByBrowser: i
|
|
3305
3396
|
};
|
|
3306
3397
|
}
|
|
3307
|
-
function
|
|
3398
|
+
function eo(r, t) {
|
|
3308
3399
|
r(
|
|
3309
3400
|
"playwright-context-list",
|
|
3310
3401
|
{
|
|
3311
3402
|
title: "List Browser Contexts",
|
|
3312
3403
|
description: "List active browser contexts",
|
|
3313
|
-
inputSchema:
|
|
3404
|
+
inputSchema: jt.shape
|
|
3314
3405
|
},
|
|
3315
3406
|
async (s, o) => {
|
|
3316
|
-
const e = await
|
|
3407
|
+
const e = await Xs(s, t, o);
|
|
3317
3408
|
if ("error" in e)
|
|
3318
3409
|
return `Method: playwright-context-list(${JSON.stringify(s)})
|
|
3319
3410
|
❌ Error: ${e.error}`;
|
|
@@ -3326,7 +3417,7 @@ function Xs(r, t) {
|
|
|
3326
3417
|
}
|
|
3327
3418
|
);
|
|
3328
3419
|
}
|
|
3329
|
-
const
|
|
3420
|
+
const qt = m.object({
|
|
3330
3421
|
names: m.array(m.string()).optional().describe(
|
|
3331
3422
|
"Names of contexts to close. If not specified, closes all contexts"
|
|
3332
3423
|
),
|
|
@@ -3334,10 +3425,10 @@ const _t = m.object({
|
|
|
3334
3425
|
"Name of browser to close contexts from. If not specified, searches all browsers"
|
|
3335
3426
|
)
|
|
3336
3427
|
});
|
|
3337
|
-
async function
|
|
3428
|
+
async function to(r, t, s) {
|
|
3338
3429
|
let o;
|
|
3339
3430
|
try {
|
|
3340
|
-
o =
|
|
3431
|
+
o = qt.parse(r);
|
|
3341
3432
|
} catch (u) {
|
|
3342
3433
|
return {
|
|
3343
3434
|
error: F(u)
|
|
@@ -3388,16 +3479,16 @@ async function eo(r, t, s) {
|
|
|
3388
3479
|
...c.length > 0 && { errors: c }
|
|
3389
3480
|
};
|
|
3390
3481
|
}
|
|
3391
|
-
function
|
|
3482
|
+
function ro(r, t) {
|
|
3392
3483
|
r(
|
|
3393
3484
|
"playwright-context-close",
|
|
3394
3485
|
{
|
|
3395
3486
|
title: "Close Browser Contexts",
|
|
3396
3487
|
description: "Close browser contexts. Automatically closes all pages within the contexts",
|
|
3397
|
-
inputSchema:
|
|
3488
|
+
inputSchema: qt.shape
|
|
3398
3489
|
},
|
|
3399
3490
|
async (s, o) => {
|
|
3400
|
-
const e = await
|
|
3491
|
+
const e = await to(s, t, o);
|
|
3401
3492
|
if ("error" in e)
|
|
3402
3493
|
return `Method: playwright-context-close(${JSON.stringify(s)})
|
|
3403
3494
|
❌ Error: ${e.error}`;
|
|
@@ -3414,7 +3505,7 @@ ${n.join(`
|
|
|
3414
3505
|
}
|
|
3415
3506
|
);
|
|
3416
3507
|
}
|
|
3417
|
-
function
|
|
3508
|
+
function so() {
|
|
3418
3509
|
class r {
|
|
3419
3510
|
prevId = 0;
|
|
3420
3511
|
objectToId = /* @__PURE__ */ new WeakMap();
|
|
@@ -3449,15 +3540,15 @@ function ro() {
|
|
|
3449
3540
|
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
3541
|
l,
|
|
3451
3542
|
u,
|
|
3452
|
-
(w,
|
|
3453
|
-
const E = f(w,
|
|
3543
|
+
(w, I) => {
|
|
3544
|
+
const E = f(w, I);
|
|
3454
3545
|
if (w != null && E != null) {
|
|
3455
3546
|
const b = c(w);
|
|
3456
3547
|
d.set(b, E), p.set(E, b);
|
|
3457
3548
|
}
|
|
3458
|
-
return E != null &&
|
|
3549
|
+
return E != null && I != null && h.set(
|
|
3459
3550
|
p.get(E),
|
|
3460
|
-
|
|
3551
|
+
I.map((b) => p.get(b))
|
|
3461
3552
|
), E;
|
|
3462
3553
|
}
|
|
3463
3554
|
), y = f(null, g);
|
|
@@ -3502,7 +3593,7 @@ function ro() {
|
|
|
3502
3593
|
}
|
|
3503
3594
|
window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom = i;
|
|
3504
3595
|
}
|
|
3505
|
-
const
|
|
3596
|
+
const oo = `(function (){function __name(fn){return fn};${so.toString()}; setupPageGlobals();})()`, ve = m.object({
|
|
3506
3597
|
contextName: m.string().optional().describe("Name of previously created context, to use"),
|
|
3507
3598
|
context: Te.optional().describe(
|
|
3508
3599
|
"Context creation options JSON to automatically create context"
|
|
@@ -3514,7 +3605,7 @@ const so = `(function (){function __name(fn){return fn};${ro.toString()}; setupP
|
|
|
3514
3605
|
async function Gt(r, t, s) {
|
|
3515
3606
|
let o;
|
|
3516
3607
|
try {
|
|
3517
|
-
o =
|
|
3608
|
+
o = ve.parse(r);
|
|
3518
3609
|
} catch (f) {
|
|
3519
3610
|
return {
|
|
3520
3611
|
error: F(f)
|
|
@@ -3542,7 +3633,7 @@ async function Gt(r, t, s) {
|
|
|
3542
3633
|
error: `Context "${n}" not found`
|
|
3543
3634
|
};
|
|
3544
3635
|
} else if (i) {
|
|
3545
|
-
const f = await
|
|
3636
|
+
const f = await Ut(i, t, s);
|
|
3546
3637
|
if (f.error != null)
|
|
3547
3638
|
return {
|
|
3548
3639
|
error: f.error
|
|
@@ -3554,7 +3645,7 @@ async function Gt(r, t, s) {
|
|
|
3554
3645
|
};
|
|
3555
3646
|
try {
|
|
3556
3647
|
const f = await u.context.newPage();
|
|
3557
|
-
await f.addInitScript(
|
|
3648
|
+
await f.addInitScript(oo), await f.goto("about:blank");
|
|
3558
3649
|
const d = {
|
|
3559
3650
|
contextInfo: u,
|
|
3560
3651
|
name: e,
|
|
@@ -3572,13 +3663,13 @@ async function Gt(r, t, s) {
|
|
|
3572
3663
|
};
|
|
3573
3664
|
}
|
|
3574
3665
|
}
|
|
3575
|
-
function
|
|
3666
|
+
function no(r, t) {
|
|
3576
3667
|
r(
|
|
3577
3668
|
"playwright-page-create",
|
|
3578
3669
|
{
|
|
3579
3670
|
title: "Create Page",
|
|
3580
3671
|
description: "Create a new page. Prefer page-goto if you need to immediately create a page and navigate",
|
|
3581
|
-
inputSchema:
|
|
3672
|
+
inputSchema: ve.shape
|
|
3582
3673
|
},
|
|
3583
3674
|
async (s, o) => {
|
|
3584
3675
|
const e = await Gt(s, t, o);
|
|
@@ -3601,7 +3692,7 @@ const Jt = m.object({
|
|
|
3601
3692
|
"Name of browser to search in. If not specified, searches all browsers"
|
|
3602
3693
|
)
|
|
3603
3694
|
});
|
|
3604
|
-
async function
|
|
3695
|
+
async function io(r, t, s) {
|
|
3605
3696
|
let o;
|
|
3606
3697
|
try {
|
|
3607
3698
|
o = Jt.parse(r);
|
|
@@ -3665,7 +3756,7 @@ async function no(r, t, s) {
|
|
|
3665
3756
|
pagesByContext: a
|
|
3666
3757
|
};
|
|
3667
3758
|
}
|
|
3668
|
-
function
|
|
3759
|
+
function ao(r, t) {
|
|
3669
3760
|
r(
|
|
3670
3761
|
"playwright-page-list",
|
|
3671
3762
|
{
|
|
@@ -3674,7 +3765,7 @@ function io(r, t) {
|
|
|
3674
3765
|
inputSchema: Jt.shape
|
|
3675
3766
|
},
|
|
3676
3767
|
async (s, o) => {
|
|
3677
|
-
const e = await
|
|
3768
|
+
const e = await io(s, t, o);
|
|
3678
3769
|
if ("error" in e)
|
|
3679
3770
|
return `Method: playwright-page-list(${JSON.stringify(s)})
|
|
3680
3771
|
❌ Error: ${e.error}`;
|
|
@@ -3696,7 +3787,7 @@ const Wt = m.object({
|
|
|
3696
3787
|
"Name of browser to search in. If not specified, searches all browsers"
|
|
3697
3788
|
)
|
|
3698
3789
|
});
|
|
3699
|
-
async function
|
|
3790
|
+
async function lo(r, t, s) {
|
|
3700
3791
|
let o;
|
|
3701
3792
|
try {
|
|
3702
3793
|
o = Wt.parse(r);
|
|
@@ -3774,7 +3865,7 @@ async function ao(r, t, s) {
|
|
|
3774
3865
|
...l.length > 0 && { errors: l }
|
|
3775
3866
|
};
|
|
3776
3867
|
}
|
|
3777
|
-
function
|
|
3868
|
+
function co(r, t) {
|
|
3778
3869
|
r(
|
|
3779
3870
|
"playwright-page-close",
|
|
3780
3871
|
{
|
|
@@ -3783,7 +3874,7 @@ function lo(r, t) {
|
|
|
3783
3874
|
inputSchema: Wt.shape
|
|
3784
3875
|
},
|
|
3785
3876
|
async (s, o) => {
|
|
3786
|
-
const e = await
|
|
3877
|
+
const e = await lo(s, t, o);
|
|
3787
3878
|
if ("error" in e)
|
|
3788
3879
|
return `Method: playwright-page-close(${JSON.stringify(s)})
|
|
3789
3880
|
❌ Error: ${e.error}`;
|
|
@@ -3796,7 +3887,7 @@ ${n.join(`
|
|
|
3796
3887
|
}
|
|
3797
3888
|
const Kt = m.object({
|
|
3798
3889
|
pageName: m.string().optional().describe("Name of previously created page to navigate"),
|
|
3799
|
-
page:
|
|
3890
|
+
page: ve.optional().describe(
|
|
3800
3891
|
"Page creation options JSON to automatically create page"
|
|
3801
3892
|
),
|
|
3802
3893
|
url: m.string().describe("URL to navigate to"),
|
|
@@ -3809,7 +3900,7 @@ const Kt = m.object({
|
|
|
3809
3900
|
- 'commit': network response received and document started loading`
|
|
3810
3901
|
)
|
|
3811
3902
|
});
|
|
3812
|
-
async function
|
|
3903
|
+
async function uo(r, t, s) {
|
|
3813
3904
|
let o;
|
|
3814
3905
|
try {
|
|
3815
3906
|
o = Kt.parse(r);
|
|
@@ -3877,7 +3968,7 @@ async function co(r, t, s) {
|
|
|
3877
3968
|
};
|
|
3878
3969
|
}
|
|
3879
3970
|
}
|
|
3880
|
-
function
|
|
3971
|
+
function fo(r, t) {
|
|
3881
3972
|
r(
|
|
3882
3973
|
"playwright-page-goto",
|
|
3883
3974
|
{
|
|
@@ -3886,7 +3977,7 @@ function uo(r, t) {
|
|
|
3886
3977
|
inputSchema: Kt.shape
|
|
3887
3978
|
},
|
|
3888
3979
|
async (s, o) => {
|
|
3889
|
-
const e = await
|
|
3980
|
+
const e = await uo(s, t, o);
|
|
3890
3981
|
if (e.error != null)
|
|
3891
3982
|
return `Method: playwright-page-goto(${JSON.stringify(s)})
|
|
3892
3983
|
❌ Error: ${e.error}`;
|
|
@@ -3899,7 +3990,7 @@ function uo(r, t) {
|
|
|
3899
3990
|
}
|
|
3900
3991
|
);
|
|
3901
3992
|
}
|
|
3902
|
-
const
|
|
3993
|
+
const Ce = m.object({
|
|
3903
3994
|
name: m.string().describe(
|
|
3904
3995
|
"Unique name for the DOM snapshot query. Recommended format: kebab-case-1, kebab-case-2, ..."
|
|
3905
3996
|
),
|
|
@@ -3908,7 +3999,7 @@ const ve = m.object({
|
|
|
3908
3999
|
async function Ht(r, t, s) {
|
|
3909
4000
|
let o;
|
|
3910
4001
|
try {
|
|
3911
|
-
o =
|
|
4002
|
+
o = Ce.parse(r);
|
|
3912
4003
|
} catch (c) {
|
|
3913
4004
|
return {
|
|
3914
4005
|
error: F(c)
|
|
@@ -3927,13 +4018,13 @@ async function Ht(r, t, s) {
|
|
|
3927
4018
|
snapshotQuery: a
|
|
3928
4019
|
};
|
|
3929
4020
|
}
|
|
3930
|
-
function
|
|
4021
|
+
function po(r, t) {
|
|
3931
4022
|
r(
|
|
3932
4023
|
"playwright-dom-snapshot-query-create",
|
|
3933
4024
|
{
|
|
3934
4025
|
title: "Create DOM Snapshot Query",
|
|
3935
4026
|
description: "Create a DOM snapshot query. Prefer dom-snapshot-browse if you need to immediately create a query and snapshot and browse it",
|
|
3936
|
-
inputSchema:
|
|
4027
|
+
inputSchema: Ce.shape
|
|
3937
4028
|
},
|
|
3938
4029
|
async (s, o) => {
|
|
3939
4030
|
const e = await Ht(s, t, o);
|
|
@@ -3943,7 +4034,7 @@ function fo(r, t) {
|
|
|
3943
4034
|
}
|
|
3944
4035
|
);
|
|
3945
4036
|
}
|
|
3946
|
-
function
|
|
4037
|
+
function ho(r) {
|
|
3947
4038
|
return function(s, o) {
|
|
3948
4039
|
let e, n = 0;
|
|
3949
4040
|
const i = o ? o.length : 0;
|
|
@@ -3979,7 +4070,7 @@ function po(r) {
|
|
|
3979
4070
|
};
|
|
3980
4071
|
};
|
|
3981
4072
|
}
|
|
3982
|
-
function
|
|
4073
|
+
function mo(r, t) {
|
|
3983
4074
|
const s = le(t), o = s.getChilds(s.root), e = Et({
|
|
3984
4075
|
getId: (n) => {
|
|
3985
4076
|
const i = s.getId(n);
|
|
@@ -3990,7 +4081,7 @@ function ho(r, t) {
|
|
|
3990
4081
|
return i;
|
|
3991
4082
|
},
|
|
3992
4083
|
getChilds: (n) => s.getChilds(n),
|
|
3993
|
-
createSnapshotNode:
|
|
4084
|
+
createSnapshotNode: ho(),
|
|
3994
4085
|
rootNodes: o ?? []
|
|
3995
4086
|
});
|
|
3996
4087
|
return le(e);
|
|
@@ -3998,7 +4089,7 @@ function ho(r, t) {
|
|
|
3998
4089
|
const Ee = m.object({
|
|
3999
4090
|
pageName: m.string().describe("Name of previously created page, to create snapshot from"),
|
|
4000
4091
|
queryName: m.string().optional().describe("Name of previously created DOM snapshot query, to use"),
|
|
4001
|
-
query:
|
|
4092
|
+
query: Ce.optional().describe(
|
|
4002
4093
|
"DOM snapshot query creation options JSON to automatically create query"
|
|
4003
4094
|
),
|
|
4004
4095
|
name: m.string().describe(
|
|
@@ -4066,17 +4157,17 @@ async function Qt(r, t, s) {
|
|
|
4066
4157
|
const w = window.__mcp_playwright_tool_tx4byhar35_createDomSnapshotTreeRawDom;
|
|
4067
4158
|
if (!w)
|
|
4068
4159
|
throw new Error("DOM snapshot global function not initialized");
|
|
4069
|
-
const
|
|
4160
|
+
const I = w(y);
|
|
4070
4161
|
return {
|
|
4071
|
-
idToNode: Array.from(
|
|
4072
|
-
idToChildIds: Array.from(
|
|
4162
|
+
idToNode: Array.from(I.idToNode.entries()),
|
|
4163
|
+
idToChildIds: Array.from(I.idToChildIds.entries())
|
|
4073
4164
|
};
|
|
4074
4165
|
},
|
|
4075
4166
|
u
|
|
4076
4167
|
), p = {
|
|
4077
4168
|
idToNode: new Map(d.idToNode),
|
|
4078
4169
|
idToChildIds: new Map(d.idToChildIds)
|
|
4079
|
-
}, h =
|
|
4170
|
+
}, h = mo(u, p), g = {
|
|
4080
4171
|
name: a,
|
|
4081
4172
|
query: u,
|
|
4082
4173
|
tree: h
|
|
@@ -4091,7 +4182,7 @@ async function Qt(r, t, s) {
|
|
|
4091
4182
|
};
|
|
4092
4183
|
}
|
|
4093
4184
|
}
|
|
4094
|
-
function
|
|
4185
|
+
function go(r, t) {
|
|
4095
4186
|
r(
|
|
4096
4187
|
"playwright-dom-snapshot-create",
|
|
4097
4188
|
{
|
|
@@ -4111,7 +4202,7 @@ function mo(r, t) {
|
|
|
4111
4202
|
}
|
|
4112
4203
|
);
|
|
4113
4204
|
}
|
|
4114
|
-
class
|
|
4205
|
+
class wo {
|
|
4115
4206
|
tokens = 20;
|
|
4116
4207
|
getReportText = (t) => ({
|
|
4117
4208
|
indent: !0,
|
|
@@ -4145,7 +4236,7 @@ const Yt = m.object({
|
|
|
4145
4236
|
// maxCountGroup: z.number().default(10).describe('Maximum items per group'),
|
|
4146
4237
|
// maxTokensGroup: z.number().default(1000).describe('Maximum tokens per group'),
|
|
4147
4238
|
});
|
|
4148
|
-
async function
|
|
4239
|
+
async function yo(r, t, s) {
|
|
4149
4240
|
let o;
|
|
4150
4241
|
try {
|
|
4151
4242
|
o = Yt.parse(r);
|
|
@@ -4216,7 +4307,7 @@ async function wo(r, t, s) {
|
|
|
4216
4307
|
maxTokensGroup: u
|
|
4217
4308
|
}
|
|
4218
4309
|
},
|
|
4219
|
-
indexRangeGroupStrategy: new
|
|
4310
|
+
indexRangeGroupStrategy: new wo()
|
|
4220
4311
|
}), w = Ot(y);
|
|
4221
4312
|
return {
|
|
4222
4313
|
domSnapshot: d,
|
|
@@ -4232,7 +4323,7 @@ async function wo(r, t, s) {
|
|
|
4232
4323
|
};
|
|
4233
4324
|
}
|
|
4234
4325
|
}
|
|
4235
|
-
function
|
|
4326
|
+
function bo(r, t) {
|
|
4236
4327
|
r(
|
|
4237
4328
|
"playwright-dom-snapshot-browse",
|
|
4238
4329
|
{
|
|
@@ -4241,7 +4332,7 @@ function yo(r, t) {
|
|
|
4241
4332
|
inputSchema: Yt.shape
|
|
4242
4333
|
},
|
|
4243
4334
|
async (s, o) => {
|
|
4244
|
-
const e = await
|
|
4335
|
+
const e = await yo(s, t, o);
|
|
4245
4336
|
if (e.error != null)
|
|
4246
4337
|
return `Method: playwright-dom-snapshot-browse(${JSON.stringify(s)})
|
|
4247
4338
|
❌ Error: ${e.error}`;
|
|
@@ -4262,10 +4353,10 @@ ${e.report}`, n;
|
|
|
4262
4353
|
}
|
|
4263
4354
|
);
|
|
4264
4355
|
}
|
|
4265
|
-
function
|
|
4266
|
-
t.browserCreate &&
|
|
4356
|
+
function So(r, t) {
|
|
4357
|
+
t.browserCreate && Ks(r, t), t.browserList && Qs(r, t), t.browserClose && Vs(r, t), t.contextCreate && Zs(r, t), t.contextList && eo(r, t), t.contextClose && ro(r, t), t.pageCreate && no(r, t), t.pageList && ao(r, t), t.pageClose && co(r, t), t.pageGoto && fo(r, t), t.domSnapshotQueryCreate && po(r, t), t.domSnapshotCreate && go(r, t), t.domSnapshotBrowse && bo(r, t), console.log("Playwright manager");
|
|
4267
4358
|
}
|
|
4268
|
-
function
|
|
4359
|
+
function xo(r) {
|
|
4269
4360
|
const { logFilePath: t } = r;
|
|
4270
4361
|
return async function(o, e, n, i) {
|
|
4271
4362
|
await ie({
|
|
@@ -4292,19 +4383,19 @@ const it = [
|
|
|
4292
4383
|
"flemist-mcp.config.json5",
|
|
4293
4384
|
"flemist-mcp.config.yaml"
|
|
4294
4385
|
];
|
|
4295
|
-
async function
|
|
4386
|
+
async function Io(r) {
|
|
4296
4387
|
const t = k.resolve(r);
|
|
4297
4388
|
for (let s = 0, o = it.length; s < o; s++) {
|
|
4298
4389
|
const e = it[s], n = k.join(t, e);
|
|
4299
4390
|
try {
|
|
4300
|
-
await
|
|
4391
|
+
await U.promises.stat(n);
|
|
4301
4392
|
} catch {
|
|
4302
4393
|
continue;
|
|
4303
4394
|
}
|
|
4304
4395
|
console.log(`Loading configuration from: ${n}`);
|
|
4305
4396
|
let i;
|
|
4306
4397
|
try {
|
|
4307
|
-
i = await
|
|
4398
|
+
i = await U.promises.readFile(n, "utf-8");
|
|
4308
4399
|
} catch (c) {
|
|
4309
4400
|
throw new Error(`MCP Error: Failed to read config file: ${n}
|
|
4310
4401
|
|
|
@@ -4331,7 +4422,7 @@ Expected one of:
|
|
|
4331
4422
|
- flemist-mcp.config.json5
|
|
4332
4423
|
- flemist-mcp.config.yaml`);
|
|
4333
4424
|
}
|
|
4334
|
-
const
|
|
4425
|
+
const $o = {
|
|
4335
4426
|
logDir: "tmp/mcp-project-tools/logs",
|
|
4336
4427
|
tools: {
|
|
4337
4428
|
processManager: {
|
|
@@ -4372,10 +4463,10 @@ const Io = {
|
|
|
4372
4463
|
}
|
|
4373
4464
|
}
|
|
4374
4465
|
};
|
|
4375
|
-
async function
|
|
4376
|
-
const t = k.resolve(r), s = await
|
|
4466
|
+
async function Mo(r) {
|
|
4467
|
+
const t = k.resolve(r), s = await Io(t), o = k.join(t, ".flemist-mcpignore");
|
|
4377
4468
|
try {
|
|
4378
|
-
await
|
|
4469
|
+
await U.promises.stat(o);
|
|
4379
4470
|
} catch {
|
|
4380
4471
|
throw new Error(`MCP Error: .flemist-mcpignore file not found in project directory.
|
|
4381
4472
|
|
|
@@ -4383,7 +4474,7 @@ Create .flemist-mcpignore file in: ${t}
|
|
|
4383
4474
|
|
|
4384
4475
|
This file contains glob patterns for files/directories to exclude from MCP operations.`);
|
|
4385
4476
|
}
|
|
4386
|
-
const e = dr(
|
|
4477
|
+
const e = dr($o, s, {
|
|
4387
4478
|
arrayMerge(n, i) {
|
|
4388
4479
|
return i;
|
|
4389
4480
|
}
|
|
@@ -4408,11 +4499,11 @@ This file contains glob patterns for files/directories to exclude from MCP opera
|
|
|
4408
4499
|
function Vt() {
|
|
4409
4500
|
return `mcp_${(/* @__PURE__ */ new Date()).toISOString().substring(0, 19).replace(/T/, "_").replace(/:/g, "-")}.log`;
|
|
4410
4501
|
}
|
|
4411
|
-
function
|
|
4412
|
-
const t = ne(), s =
|
|
4502
|
+
function To(r) {
|
|
4503
|
+
const t = ne(), s = vo();
|
|
4413
4504
|
return t.use(s), t;
|
|
4414
4505
|
}
|
|
4415
|
-
function
|
|
4506
|
+
function vo(r) {
|
|
4416
4507
|
const t = ne.Router();
|
|
4417
4508
|
return t.use((s, o, e) => {
|
|
4418
4509
|
s.method === "OPTIONS" ? o.status(403).send("CORS forbidden") : e();
|
|
@@ -4422,8 +4513,8 @@ function Co(r) {
|
|
|
4422
4513
|
const t = ne.Router();
|
|
4423
4514
|
return t.use(pr({ authToken: r.authToken })), t.all("/mcp", yr(r)), t;
|
|
4424
4515
|
}
|
|
4425
|
-
function
|
|
4426
|
-
return r.use(
|
|
4516
|
+
function Eo(r, t) {
|
|
4517
|
+
return r.use(xo({ logFilePath: t.logFilePath })), new Promise((s, o) => {
|
|
4427
4518
|
let e;
|
|
4428
4519
|
const n = () => {
|
|
4429
4520
|
s(e);
|
|
@@ -4437,7 +4528,7 @@ function vo(r, t) {
|
|
|
4437
4528
|
}
|
|
4438
4529
|
});
|
|
4439
4530
|
}
|
|
4440
|
-
function
|
|
4531
|
+
function No(r, t) {
|
|
4441
4532
|
if (!r.address())
|
|
4442
4533
|
throw new Error(
|
|
4443
4534
|
"Server address is not available. Check your DNS and host configuration."
|
|
@@ -4455,20 +4546,20 @@ SSE Endpoint: ${i}/sse
|
|
|
4455
4546
|
|
|
4456
4547
|
Log File: ${k.resolve(t.logFilePath)}`;
|
|
4457
4548
|
}
|
|
4458
|
-
function
|
|
4549
|
+
function ko(r, t) {
|
|
4459
4550
|
const s = k.join(t.logDir, Vt()), o = Jr(r, {
|
|
4460
4551
|
logFilePath: s
|
|
4461
4552
|
});
|
|
4462
4553
|
t.tools.processManager && Gr(
|
|
4463
4554
|
o,
|
|
4464
4555
|
t.tools.processManager
|
|
4465
|
-
), t.tools.fsManager &&
|
|
4556
|
+
), t.tools.fsManager && Ws(o, t.tools.fsManager), t.tools.playwrightManager && So(
|
|
4466
4557
|
o,
|
|
4467
4558
|
t.tools.playwrightManager
|
|
4468
4559
|
), Pr(o);
|
|
4469
4560
|
}
|
|
4470
|
-
async function
|
|
4471
|
-
const t = k.join(r.logDir, Vt()), s =
|
|
4561
|
+
async function Vo(r) {
|
|
4562
|
+
const t = k.join(r.logDir, Vt()), s = To(), o = Co({
|
|
4472
4563
|
authToken: r.authToken,
|
|
4473
4564
|
logFilePath: t,
|
|
4474
4565
|
createMcpServer: async (n) => {
|
|
@@ -4491,22 +4582,22 @@ X-Project-Name header is missing. To configure MCP for this project:
|
|
|
4491
4582
|
Ask user to:
|
|
4492
4583
|
1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
|
|
4493
4584
|
2. Restart MCP server`);
|
|
4494
|
-
const c = await
|
|
4585
|
+
const c = await Mo(a), l = new Zt({
|
|
4495
4586
|
title: r.title,
|
|
4496
4587
|
name: r.name,
|
|
4497
4588
|
version: r.version
|
|
4498
4589
|
});
|
|
4499
|
-
return
|
|
4590
|
+
return ko(l, c), l;
|
|
4500
4591
|
}
|
|
4501
4592
|
});
|
|
4502
4593
|
s.use(o);
|
|
4503
|
-
const e = await
|
|
4594
|
+
const e = await Eo(s, {
|
|
4504
4595
|
host: r.host,
|
|
4505
4596
|
port: r.port,
|
|
4506
4597
|
logFilePath: t
|
|
4507
4598
|
});
|
|
4508
4599
|
return console.log(
|
|
4509
|
-
|
|
4600
|
+
No(e, {
|
|
4510
4601
|
title: r.title,
|
|
4511
4602
|
name: r.name,
|
|
4512
4603
|
version: r.version,
|
|
@@ -4515,11 +4606,11 @@ Ask user to:
|
|
|
4515
4606
|
), e;
|
|
4516
4607
|
}
|
|
4517
4608
|
export {
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4609
|
+
Yo as A,
|
|
4610
|
+
Qo as S,
|
|
4611
|
+
Ho as a,
|
|
4612
|
+
Ko as b,
|
|
4613
|
+
Io as l,
|
|
4614
|
+
os as p,
|
|
4615
|
+
Vo as s
|
|
4525
4616
|
};
|