@flemist/mcp-project-tools 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command as a } from "commander";
|
|
2
|
-
import { l as c, A as p, S as l, a as f, b as v, p as g, s as m } from "./startMcpServer-
|
|
2
|
+
import { l as c, A as p, S as l, a as f, b as v, p as g, s as m } from "./startMcpServer-eMtH4-uF.js";
|
|
3
3
|
import * as s from "path";
|
|
4
4
|
const E = {
|
|
5
5
|
title: v,
|
package/build/index.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ declare type ProcessManagerOptions = {
|
|
|
84
84
|
* - "clear": start with empty env
|
|
85
85
|
* - false: do nothing, inherit server env
|
|
86
86
|
*/
|
|
87
|
-
envCleanup?: 'clear' | 'replaceServerPaths' | 'deleteServerPaths' | false;
|
|
87
|
+
envCleanup?: null | 'clear' | 'replaceServerPaths' | 'deleteServerPaths' | false;
|
|
88
88
|
run?: null | boolean;
|
|
89
89
|
status?: null | boolean;
|
|
90
90
|
wait?: null | boolean;
|
package/build/index.js
CHANGED
|
@@ -98,7 +98,7 @@ 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
|
|
101
|
+
function Ir(t) {
|
|
102
102
|
const { commandLine: r, commandLineRules: s } = t;
|
|
103
103
|
let o = !1;
|
|
104
104
|
for (const e of s)
|
|
@@ -115,7 +115,7 @@ function $r(t) {
|
|
|
115
115
|
}
|
|
116
116
|
return o;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function $r() {
|
|
119
119
|
return ++br;
|
|
120
120
|
}
|
|
121
121
|
let Oe = !1;
|
|
@@ -278,15 +278,8 @@ function Dr(t, r) {
|
|
|
278
278
|
return {
|
|
279
279
|
error: "Session ID is required"
|
|
280
280
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
error: `Invalid range: to (${e}) must be greater than from (${o})`
|
|
285
|
-
};
|
|
286
|
-
if (e - o > J)
|
|
287
|
-
return {
|
|
288
|
-
error: `Range size ${e - o} exceeds maximum ${J}`
|
|
289
|
-
};
|
|
281
|
+
let { from: o, toExclusive: e } = s.range;
|
|
282
|
+
e <= o && (e = o), e - o > J && (e = o + J);
|
|
290
283
|
const n = dt({
|
|
291
284
|
sessionId: r.sessionId,
|
|
292
285
|
outputId: s.outputId,
|
|
@@ -512,7 +505,7 @@ async function Ar(t, r, s) {
|
|
|
512
505
|
if ("error" in l)
|
|
513
506
|
return { error: l.error };
|
|
514
507
|
const u = l.path;
|
|
515
|
-
if (
|
|
508
|
+
if (!Ir({ commandLine: e, commandLineRules: c })) {
|
|
516
509
|
const h = c.map(
|
|
517
510
|
(g) => `${g.rule.toUpperCase()}: /${g.regexp}/ (${g.note})`
|
|
518
511
|
).join(`
|
|
@@ -530,7 +523,7 @@ To use this command line, ask the user to modify the command line rules in the c
|
|
|
530
523
|
return {
|
|
531
524
|
error: `Maximum concurrent process limit reached (${ke} processes). Cannot start new process until existing processes complete. Use process-list to see active processes, or process-kill to terminate unnecessary processes.`
|
|
532
525
|
};
|
|
533
|
-
const d =
|
|
526
|
+
const d = $r(), p = {
|
|
534
527
|
id: d,
|
|
535
528
|
cwd: u,
|
|
536
529
|
commandLine: e,
|
|
@@ -813,20 +806,20 @@ function xt(t) {
|
|
|
813
806
|
countDirs: 0,
|
|
814
807
|
countLinks: 0
|
|
815
808
|
};
|
|
816
|
-
function w(
|
|
809
|
+
function w(I, T) {
|
|
817
810
|
if (p(T.totalSize)) {
|
|
818
|
-
const S = `${T.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${
|
|
811
|
+
const S = `${T.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${I}`;
|
|
819
812
|
l?.handleLog ? l.handleLog(S) : console.log(S);
|
|
820
813
|
}
|
|
821
814
|
}
|
|
822
|
-
async function M(
|
|
815
|
+
async function M(I, T, x, S) {
|
|
823
816
|
return u ? await V({
|
|
824
817
|
pool: n,
|
|
825
818
|
func: async () => {
|
|
826
819
|
try {
|
|
827
820
|
return await u({
|
|
828
821
|
level: s,
|
|
829
|
-
path:
|
|
822
|
+
path: I,
|
|
830
823
|
stat: T,
|
|
831
824
|
itemStat: x,
|
|
832
825
|
totalStat: y,
|
|
@@ -841,18 +834,18 @@ function xt(t) {
|
|
|
841
834
|
abortSignal: g
|
|
842
835
|
}) : !0;
|
|
843
836
|
}
|
|
844
|
-
async function E(
|
|
845
|
-
S || (S =
|
|
837
|
+
async function E(I, T, x, S) {
|
|
838
|
+
S || (S = I);
|
|
846
839
|
const v = await V({
|
|
847
840
|
pool: n,
|
|
848
|
-
func: () => j.promises.lstat(
|
|
841
|
+
func: () => j.promises.lstat(I).catch(d),
|
|
849
842
|
count: 1,
|
|
850
843
|
priority: X(T, X(1, a)),
|
|
851
844
|
abortSignal: g
|
|
852
845
|
});
|
|
853
846
|
if (!v || !x && v.isFile())
|
|
854
847
|
return null;
|
|
855
|
-
const P = Kr(
|
|
848
|
+
const P = Kr(I, v);
|
|
856
849
|
if (o.has(P))
|
|
857
850
|
return null;
|
|
858
851
|
o.add(P);
|
|
@@ -863,7 +856,7 @@ function xt(t) {
|
|
|
863
856
|
countDirs: 0,
|
|
864
857
|
countLinks: 0
|
|
865
858
|
};
|
|
866
|
-
const
|
|
859
|
+
const $ = X(
|
|
867
860
|
T,
|
|
868
861
|
X(v.isDirectory() ? 2 : 3, a)
|
|
869
862
|
);
|
|
@@ -871,9 +864,9 @@ function xt(t) {
|
|
|
871
864
|
if (c) {
|
|
872
865
|
const C = await V({
|
|
873
866
|
pool: n,
|
|
874
|
-
func: () => j.promises.readlink(
|
|
867
|
+
func: () => j.promises.readlink(I).catch(d).then((N) => N ?? null),
|
|
875
868
|
count: 1,
|
|
876
|
-
priority:
|
|
869
|
+
priority: $,
|
|
877
870
|
abortSignal: g
|
|
878
871
|
});
|
|
879
872
|
if (C) {
|
|
@@ -890,12 +883,12 @@ function xt(t) {
|
|
|
890
883
|
S,
|
|
891
884
|
v,
|
|
892
885
|
O,
|
|
893
|
-
|
|
886
|
+
$
|
|
894
887
|
) && (Be(y, O), w(S, O))), O;
|
|
895
888
|
} else if (v.isDirectory()) {
|
|
896
889
|
const C = await V({
|
|
897
890
|
pool: n,
|
|
898
|
-
func: () => j.promises.readdir(
|
|
891
|
+
func: () => j.promises.readdir(I).catch(d),
|
|
899
892
|
count: 1,
|
|
900
893
|
priority: a,
|
|
901
894
|
abortSignal: g
|
|
@@ -907,7 +900,7 @@ function xt(t) {
|
|
|
907
900
|
...t,
|
|
908
901
|
paths: C,
|
|
909
902
|
abortSignal: g,
|
|
910
|
-
priority:
|
|
903
|
+
priority: $,
|
|
911
904
|
level: s + 1,
|
|
912
905
|
walkedIds: o
|
|
913
906
|
});
|
|
@@ -917,18 +910,18 @@ function xt(t) {
|
|
|
917
910
|
S,
|
|
918
911
|
v,
|
|
919
912
|
O,
|
|
920
|
-
|
|
913
|
+
$
|
|
921
914
|
) && (Be(y, O), w(S, O))), O;
|
|
922
915
|
}
|
|
923
916
|
const b = [];
|
|
924
|
-
for (let
|
|
925
|
-
const x = Hr(r[
|
|
926
|
-
S !== !1 && b.push(E(x,
|
|
917
|
+
for (let I = 0, T = r.length; I < T; I++) {
|
|
918
|
+
const x = Hr(r[I]), S = f ? f(x) : !0;
|
|
919
|
+
S !== !1 && b.push(E(x, I, S));
|
|
927
920
|
}
|
|
928
921
|
return await Promise.all(b), y;
|
|
929
922
|
});
|
|
930
923
|
}
|
|
931
|
-
function
|
|
924
|
+
function It(t) {
|
|
932
925
|
return xt(t);
|
|
933
926
|
}
|
|
934
927
|
function Yr(t, r) {
|
|
@@ -953,7 +946,7 @@ async function Zr(t) {
|
|
|
953
946
|
e = e.trim(), !(!e || e.startsWith("#")) && o.push(e);
|
|
954
947
|
}), o;
|
|
955
948
|
}
|
|
956
|
-
async function
|
|
949
|
+
async function $t(t) {
|
|
957
950
|
const r = t.rootDir ?? ".", s = [];
|
|
958
951
|
if (!t.globs?.length)
|
|
959
952
|
return s;
|
|
@@ -1026,11 +1019,11 @@ function Mt({
|
|
|
1026
1019
|
async function Xr(t) {
|
|
1027
1020
|
const r = t.rootDir ?? ".", s = [], o = {};
|
|
1028
1021
|
t.result.countFiles && (o.countFiles = 0), t.result.size && (o.size = 0);
|
|
1029
|
-
const e = await
|
|
1022
|
+
const e = await $t({
|
|
1030
1023
|
rootDir: r,
|
|
1031
1024
|
globs: t.globs
|
|
1032
1025
|
});
|
|
1033
|
-
return await
|
|
1026
|
+
return await It({
|
|
1034
1027
|
paths: [r],
|
|
1035
1028
|
walkLinks: !0,
|
|
1036
1029
|
matchPath: Mt({
|
|
@@ -1169,7 +1162,7 @@ function ts(t, r) {
|
|
|
1169
1162
|
}
|
|
1170
1163
|
return e;
|
|
1171
1164
|
}
|
|
1172
|
-
const rs = "5.0.
|
|
1165
|
+
const rs = "5.0.1", ss = {
|
|
1173
1166
|
version: rs
|
|
1174
1167
|
}, Wo = "Project Tools", Ko = "project-tools", Ho = ss.version, Qo = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
|
|
1175
1168
|
function _e(t) {
|
|
@@ -1327,7 +1320,7 @@ async function os(t, r) {
|
|
|
1327
1320
|
size: f.includes("size") || p.includes("size"),
|
|
1328
1321
|
countFiles: f.includes("countFiles") || p.includes("countFiles")
|
|
1329
1322
|
};
|
|
1330
|
-
let b = null,
|
|
1323
|
+
let b = null, I = null;
|
|
1331
1324
|
if (a || c)
|
|
1332
1325
|
try {
|
|
1333
1326
|
const S = Date.now(), v = c ? S - _e(c) : null, P = a ? S - _e(a) : null;
|
|
@@ -1340,7 +1333,7 @@ async function os(t, r) {
|
|
|
1340
1333
|
if (l || u)
|
|
1341
1334
|
try {
|
|
1342
1335
|
const S = l ? Ge(l) : null, v = u ? Ge(u) : null;
|
|
1343
|
-
|
|
1336
|
+
I = [S, v];
|
|
1344
1337
|
} catch (S) {
|
|
1345
1338
|
return {
|
|
1346
1339
|
error: S instanceof Error ? S.message : "Unknown error parsing size filter"
|
|
@@ -1351,7 +1344,7 @@ async function os(t, r) {
|
|
|
1351
1344
|
globs: M,
|
|
1352
1345
|
result: E,
|
|
1353
1346
|
dateModified: b,
|
|
1354
|
-
totalSize:
|
|
1347
|
+
totalSize: I
|
|
1355
1348
|
});
|
|
1356
1349
|
return T.items.length > qe ? {
|
|
1357
1350
|
error: `Number of paths (${T.items.length}) exceeds maximum allowed (${qe}). Consider using more specific glob patterns or filters to reduce the result set.`
|
|
@@ -1555,12 +1548,12 @@ async function Ct(t, r, s) {
|
|
|
1555
1548
|
error: x instanceof Error ? x.message : "Unknown error parsing size filter"
|
|
1556
1549
|
};
|
|
1557
1550
|
}
|
|
1558
|
-
const b = i ? i.includes("file") : !0,
|
|
1551
|
+
const b = i ? i.includes("file") : !0, I = i ? i.includes("dir") : !0, T = {
|
|
1559
1552
|
name: e,
|
|
1560
1553
|
rootDir: p,
|
|
1561
1554
|
globs: w,
|
|
1562
1555
|
matchFiles: b,
|
|
1563
|
-
matchDirs:
|
|
1556
|
+
matchDirs: I,
|
|
1564
1557
|
dateModified: M,
|
|
1565
1558
|
totalSize: E,
|
|
1566
1559
|
fields: h
|
|
@@ -1677,11 +1670,11 @@ async function us(t) {
|
|
|
1677
1670
|
size: 0
|
|
1678
1671
|
};
|
|
1679
1672
|
r.set(null, n);
|
|
1680
|
-
const i = await
|
|
1673
|
+
const i = await $t({
|
|
1681
1674
|
rootDir: o,
|
|
1682
1675
|
globs: t.globs
|
|
1683
1676
|
});
|
|
1684
|
-
return await
|
|
1677
|
+
return await It({
|
|
1685
1678
|
paths: [o],
|
|
1686
1679
|
walkLinks: !0,
|
|
1687
1680
|
matchPath: Mt({
|
|
@@ -1696,12 +1689,12 @@ async function us(t) {
|
|
|
1696
1689
|
const p = me(u || "."), h = f ? "dir" : "file", g = f ? null : c.mtimeMs, y = c.size;
|
|
1697
1690
|
let w = !0;
|
|
1698
1691
|
if (d && !t.matchFiles && (w = !1), f && !t.matchDirs && (w = !1), w && d && t.dateModified && g != null) {
|
|
1699
|
-
const [
|
|
1700
|
-
(
|
|
1692
|
+
const [I, T] = t.dateModified;
|
|
1693
|
+
(I != null && g < I || T != null && g > T) && (w = !1);
|
|
1701
1694
|
}
|
|
1702
1695
|
if (w && d && t.totalSize && y != null) {
|
|
1703
|
-
const [
|
|
1704
|
-
(
|
|
1696
|
+
const [I, T] = t.totalSize;
|
|
1697
|
+
(I != null && y < I || T != null && y > T) && (w = !1);
|
|
1705
1698
|
}
|
|
1706
1699
|
if (f && !w) {
|
|
1707
1700
|
if (!(l.countFiles && l.countFiles > 0)) return !1;
|
|
@@ -1815,11 +1808,11 @@ function ms(t) {
|
|
|
1815
1808
|
let l = 1, u, f = 0, d = 0, p = 0, h = 0, g = null, y, w, M;
|
|
1816
1809
|
if (e)
|
|
1817
1810
|
for (let b = 0; b < e.length; b++) {
|
|
1818
|
-
const
|
|
1819
|
-
a +=
|
|
1811
|
+
const I = e[b];
|
|
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);
|
|
1820
1813
|
}
|
|
1821
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);
|
|
1822
|
-
for (let b = 0,
|
|
1815
|
+
for (let b = 0, I = r.length; b < I; b++) {
|
|
1823
1816
|
const T = r[b];
|
|
1824
1817
|
switch (b > 0 && (n += " "), T) {
|
|
1825
1818
|
case "dateModified":
|
|
@@ -2014,14 +2007,14 @@ function bs(t) {
|
|
|
2014
2007
|
if (o != null && u + p.countChilds + g > o || e != null && f + p.tokensChilds + y > e) {
|
|
2015
2008
|
const w = [];
|
|
2016
2009
|
let M = null, E = 0;
|
|
2017
|
-
for (let
|
|
2018
|
-
const x = h[
|
|
2010
|
+
for (let I = 0, T = h.length; I < T; I++) {
|
|
2011
|
+
const x = h[I], S = E * a.tokens;
|
|
2019
2012
|
M != null && // Если общий лимит превышен, то не создаем новую группу, а продолжаем текущую. В случае достижения лимитов, последняя группа может содержать больше элементов, чем указано в лимитах группы, и это допустимо. Главное - дать в отчете полную картину.
|
|
2020
|
-
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && M.countGrouped + 1 + E > n || i != null && M.tokensGrouped + x.tokens + S > i) && (w.push(M), u += 1, f += a.tokens, M = null, E = 0), M = a.add(M, x,
|
|
2013
|
+
!(o != null && u + 1 > o || e != null && f + a.tokens > e) && (n != null && M.countGrouped + 1 + E > n || i != null && M.tokensGrouped + x.tokens + S > i) && (w.push(M), u += 1, f += a.tokens, M = null, E = 0), M = a.add(M, x, I), x.countChilds > 0 && (E += 1);
|
|
2021
2014
|
}
|
|
2022
2015
|
M != null && (w.push(M), u += 1, f += a.tokens);
|
|
2023
|
-
const b = w.map((
|
|
2024
|
-
text: a.getReportText(
|
|
2016
|
+
const b = w.map((I) => ({
|
|
2017
|
+
text: a.getReportText(I)
|
|
2025
2018
|
}));
|
|
2026
2019
|
if (d != null) {
|
|
2027
2020
|
if (d.childs != null)
|
|
@@ -2040,8 +2033,8 @@ function bs(t) {
|
|
|
2040
2033
|
text: E.text
|
|
2041
2034
|
};
|
|
2042
2035
|
w.push(b);
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2036
|
+
const I = s.getChilds(E);
|
|
2037
|
+
I != null && I.length > 0 && r.enqueue({
|
|
2045
2038
|
reportNode: b,
|
|
2046
2039
|
node: E
|
|
2047
2040
|
});
|
|
@@ -2076,11 +2069,9 @@ function kt(t) {
|
|
|
2076
2069
|
a = r.root;
|
|
2077
2070
|
let c, l = r.getChilds(a) ?? [];
|
|
2078
2071
|
if (o != null) {
|
|
2079
|
-
|
|
2080
|
-
if (d < 0
|
|
2081
|
-
|
|
2082
|
-
`Invalid index range: ${d}-${p} for root nodes length ${l.length}`
|
|
2083
|
-
);
|
|
2072
|
+
let [d, p] = o;
|
|
2073
|
+
if (d < 0 && (d = 0), p < 0 && (p = 0), p >= l.length && (p = l.length - 1), p < d)
|
|
2074
|
+
return [];
|
|
2084
2075
|
const h = [];
|
|
2085
2076
|
let g = null;
|
|
2086
2077
|
for (let y = d; y <= p; y++) {
|
|
@@ -2240,7 +2231,7 @@ async function xs(t, r, s) {
|
|
|
2240
2231
|
};
|
|
2241
2232
|
}
|
|
2242
2233
|
}
|
|
2243
|
-
function
|
|
2234
|
+
function Is(t, r) {
|
|
2244
2235
|
t(
|
|
2245
2236
|
"fs-snapshot-browse",
|
|
2246
2237
|
{
|
|
@@ -2283,14 +2274,14 @@ function Dt(t) {
|
|
|
2283
2274
|
return e(s.root), r;
|
|
2284
2275
|
}
|
|
2285
2276
|
const Ve = /* @__PURE__ */ new Map();
|
|
2286
|
-
function
|
|
2277
|
+
function $s(t) {
|
|
2287
2278
|
const r = H(t);
|
|
2288
2279
|
let s = Ve.get(r);
|
|
2289
2280
|
return s == null && (s = new nr(), Ve.set(r, s)), s;
|
|
2290
2281
|
}
|
|
2291
2282
|
async function Ms(t) {
|
|
2292
2283
|
const { filePath: r, func: s } = t;
|
|
2293
|
-
return
|
|
2284
|
+
return $s(r).lock(
|
|
2294
2285
|
() => V({
|
|
2295
2286
|
pool: Se,
|
|
2296
2287
|
count: 1,
|
|
@@ -2307,13 +2298,13 @@ function Os(t) {
|
|
|
2307
2298
|
let l = null, u = null, f = null, d = 0;
|
|
2308
2299
|
if (o != null) {
|
|
2309
2300
|
const b = o.length;
|
|
2310
|
-
let
|
|
2301
|
+
let I = !1;
|
|
2311
2302
|
for (let T = 0; T < b; T++)
|
|
2312
2303
|
if (o.charCodeAt(T) === de) {
|
|
2313
|
-
|
|
2304
|
+
I = !0;
|
|
2314
2305
|
break;
|
|
2315
2306
|
}
|
|
2316
|
-
if (
|
|
2307
|
+
if (I) {
|
|
2317
2308
|
u = [], f = [];
|
|
2318
2309
|
let T = 0, x = 0;
|
|
2319
2310
|
for (; x < b; ) {
|
|
@@ -2332,18 +2323,18 @@ function Os(t) {
|
|
|
2332
2323
|
else if (S === Cs)
|
|
2333
2324
|
v = rt;
|
|
2334
2325
|
else if (S >= re && S <= Xe) {
|
|
2335
|
-
let
|
|
2336
|
-
for (;
|
|
2337
|
-
const C = o.charCodeAt(
|
|
2326
|
+
let $ = x + 2;
|
|
2327
|
+
for (; $ < b; ) {
|
|
2328
|
+
const C = o.charCodeAt($);
|
|
2338
2329
|
if (C < re || C > Xe) break;
|
|
2339
|
-
|
|
2330
|
+
$++;
|
|
2340
2331
|
}
|
|
2341
|
-
v = st, P = o.substring(x + 1,
|
|
2332
|
+
v = st, P = o.substring(x + 1, $), O = $ - x;
|
|
2342
2333
|
} else if (S === vs) {
|
|
2343
|
-
let
|
|
2344
|
-
for (;
|
|
2345
|
-
|
|
2346
|
-
|
|
2334
|
+
let $ = x + 2;
|
|
2335
|
+
for (; $ < b && o.charCodeAt($) !== Es; )
|
|
2336
|
+
$++;
|
|
2337
|
+
$ < b && $ > x + 2 && (v = ks, P = o.substring(x + 2, $), O = $ + 1 - x);
|
|
2347
2338
|
}
|
|
2348
2339
|
v >= 0 ? (x > T && (u.push(se), f.push(o.substring(T, x))), u.push(v), f.push(P), x += O, T = x) : x++;
|
|
2349
2340
|
}
|
|
@@ -2355,23 +2346,23 @@ function Os(t) {
|
|
|
2355
2346
|
s.lastIndex = 0;
|
|
2356
2347
|
let y;
|
|
2357
2348
|
for (; (y = s.exec(r)) !== null; ) {
|
|
2358
|
-
const b = y.index,
|
|
2349
|
+
const b = y.index, I = y[0], T = I.length, x = b + T;
|
|
2359
2350
|
let S, v, P, O;
|
|
2360
2351
|
if (i === 1)
|
|
2361
2352
|
S = 0, v = 1, P = 0, O = e;
|
|
2362
2353
|
else {
|
|
2363
|
-
let
|
|
2364
|
-
for (;
|
|
2365
|
-
const N =
|
|
2366
|
-
n[N] <= b ?
|
|
2354
|
+
let $ = 0, C = i - 1;
|
|
2355
|
+
for (; $ < C; ) {
|
|
2356
|
+
const N = $ + C + 1 >> 1;
|
|
2357
|
+
n[N] <= b ? $ = N : C = N - 1;
|
|
2367
2358
|
}
|
|
2368
|
-
if (S =
|
|
2359
|
+
if (S = $, T > 0) {
|
|
2369
2360
|
const N = x - 1;
|
|
2370
|
-
for (C = i - 1;
|
|
2371
|
-
const R =
|
|
2372
|
-
n[R] <= N ?
|
|
2361
|
+
for (C = i - 1; $ < C; ) {
|
|
2362
|
+
const R = $ + C + 1 >> 1;
|
|
2363
|
+
n[R] <= N ? $ = R : C = R - 1;
|
|
2373
2364
|
}
|
|
2374
|
-
v =
|
|
2365
|
+
v = $ + 1;
|
|
2375
2366
|
} else
|
|
2376
2367
|
v = S + 1;
|
|
2377
2368
|
P = n[S], O = v < i ? n[v] : e;
|
|
@@ -2382,51 +2373,51 @@ function Os(t) {
|
|
|
2382
2373
|
linesOffset: [P, O]
|
|
2383
2374
|
}), o != null) {
|
|
2384
2375
|
p += r.substring(h, b);
|
|
2385
|
-
let
|
|
2376
|
+
let $;
|
|
2386
2377
|
if (l != null)
|
|
2387
|
-
|
|
2378
|
+
$ = l;
|
|
2388
2379
|
else {
|
|
2389
|
-
|
|
2380
|
+
$ = "";
|
|
2390
2381
|
const N = y.groups, R = y.length - 1;
|
|
2391
2382
|
for (let K = 0; K < d; K++) {
|
|
2392
2383
|
const q = u[K], L = f[K];
|
|
2393
2384
|
switch (q) {
|
|
2394
2385
|
case se:
|
|
2395
|
-
|
|
2386
|
+
$ += L;
|
|
2396
2387
|
break;
|
|
2397
2388
|
case et:
|
|
2398
|
-
|
|
2389
|
+
$ += I;
|
|
2399
2390
|
break;
|
|
2400
2391
|
case tt:
|
|
2401
|
-
|
|
2392
|
+
$ += r.substring(0, b);
|
|
2402
2393
|
break;
|
|
2403
2394
|
case rt:
|
|
2404
|
-
|
|
2395
|
+
$ += r.substring(x);
|
|
2405
2396
|
break;
|
|
2406
2397
|
case st: {
|
|
2407
2398
|
const B = L, z = B.length, A = B.charCodeAt(0) - re;
|
|
2408
2399
|
if (z >= 2) {
|
|
2409
2400
|
const _ = B.charCodeAt(1) - re, D = A * 10 + _;
|
|
2410
2401
|
if (D >= 1 && D <= R) {
|
|
2411
|
-
|
|
2402
|
+
$ += y[D] ?? "", z > 2 && ($ += B.substring(2));
|
|
2412
2403
|
break;
|
|
2413
2404
|
}
|
|
2414
2405
|
}
|
|
2415
|
-
A >= 1 && A <= R ? (
|
|
2406
|
+
A >= 1 && A <= R ? ($ += y[A] ?? "", z > 1 && ($ += B.substring(1))) : $ += "$" + B;
|
|
2416
2407
|
break;
|
|
2417
2408
|
}
|
|
2418
2409
|
default:
|
|
2419
|
-
N != null ?
|
|
2410
|
+
N != null ? $ += N[L] ?? "" : $ += "$<" + L + ">";
|
|
2420
2411
|
}
|
|
2421
2412
|
}
|
|
2422
2413
|
}
|
|
2423
|
-
p +=
|
|
2414
|
+
p += $;
|
|
2424
2415
|
const C = b + g;
|
|
2425
2416
|
c.push({
|
|
2426
|
-
offset: [C, C +
|
|
2417
|
+
offset: [C, C + $.length],
|
|
2427
2418
|
lines: [0, 0],
|
|
2428
2419
|
linesOffset: [0, 0]
|
|
2429
|
-
}), g +=
|
|
2420
|
+
}), g += $.length - T, h = x;
|
|
2430
2421
|
}
|
|
2431
2422
|
if (T === 0 && s.lastIndex++, !s.global)
|
|
2432
2423
|
break;
|
|
@@ -2438,11 +2429,11 @@ function Os(t) {
|
|
|
2438
2429
|
for (let b = 0; b < w; b++)
|
|
2439
2430
|
p.charCodeAt(b) === Ze && b + 1 < w && M.push(b + 1);
|
|
2440
2431
|
const E = M.length;
|
|
2441
|
-
for (let b = 0,
|
|
2432
|
+
for (let b = 0, I = c.length; b < I; b++) {
|
|
2442
2433
|
const T = c[b], x = T.offset[0], S = T.offset[1];
|
|
2443
|
-
let v, P, O,
|
|
2434
|
+
let v, P, O, $;
|
|
2444
2435
|
if (E === 1)
|
|
2445
|
-
v = 0, P = 1, O = 0,
|
|
2436
|
+
v = 0, P = 1, O = 0, $ = w;
|
|
2446
2437
|
else {
|
|
2447
2438
|
let C = 0, N = E - 1;
|
|
2448
2439
|
for (; C < N; ) {
|
|
@@ -2458,9 +2449,9 @@ function Os(t) {
|
|
|
2458
2449
|
P = C + 1;
|
|
2459
2450
|
} else
|
|
2460
2451
|
P = v + 1;
|
|
2461
|
-
O = M[v],
|
|
2452
|
+
O = M[v], $ = P < E ? M[P] : w;
|
|
2462
2453
|
}
|
|
2463
|
-
T.lines[0] = v, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] =
|
|
2454
|
+
T.lines[0] = v, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] = $;
|
|
2464
2455
|
}
|
|
2465
2456
|
return {
|
|
2466
2457
|
search: { content: r, matches: a },
|
|
@@ -2515,26 +2506,26 @@ function Rs(t, r) {
|
|
|
2515
2506
|
};
|
|
2516
2507
|
}
|
|
2517
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 = [];
|
|
2518
|
-
let y = 0, w = 0, M = 0, E = 0, b = 0,
|
|
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;
|
|
2519
2510
|
for (; y < d || w < p; )
|
|
2520
|
-
if (y < d && (b = l[y].offset[0],
|
|
2521
|
-
K = b < T ? b : T, S =
|
|
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) {
|
|
2512
|
+
K = b < T ? b : T, S = I > x ? I : x, P = y, O = w, y++, w++;
|
|
2522
2513
|
do {
|
|
2523
2514
|
for (v = S; y < d && l[y].offset[0] < S; )
|
|
2524
|
-
|
|
2515
|
+
I = l[y].offset[1], I > S && (S = I), y++;
|
|
2525
2516
|
for (; w < p && u[w].offset[0] < S; )
|
|
2526
2517
|
x = u[w].offset[1], x > S && (S = x), w++;
|
|
2527
2518
|
} while (S !== v);
|
|
2528
|
-
|
|
2519
|
+
$ = 1 / 0, C = -1 / 0, q = K, L = M;
|
|
2529
2520
|
for (let G = P; G < y; G++)
|
|
2530
|
-
B = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], _ = l[G].offset[1], q < A && (D = q + L, D <
|
|
2531
|
-
q < S && (D = q + L, D <
|
|
2521
|
+
B = c[G].offset[0], z = c[G].offset[1], A = l[G].offset[0], _ = l[G].offset[1], q < A && (D = q + L, D < $ && ($ = D), D = A + L, D > C && (C = D)), B < $ && ($ = B), z > C && (C = z), L += z - B - _ + A, q = _;
|
|
2522
|
+
q < S && (D = q + L, D < $ && ($ = D), D = S + L, D > C && (C = D)), M = L, N = 1 / 0, R = -1 / 0, q = K, L = E;
|
|
2532
2523
|
for (let G = O; G < w; G++)
|
|
2533
2524
|
B = u[G].offset[0], z = u[G].offset[1], A = f[G].offset[0], _ = f[G].offset[1], q < B && (D = q + L, D < N && (N = D), D = B + L, D > R && (R = D)), A < N && (N = A), _ > R && (R = _), L += _ - A - z + B, q = z;
|
|
2534
2525
|
q < S && (D = q + L, D < N && (N = D), D = S + L, D > R && (R = D)), E = L;
|
|
2535
|
-
const U = oe(e, i,
|
|
2526
|
+
const U = oe(e, i, $, C);
|
|
2536
2527
|
h.push({
|
|
2537
|
-
offset: [
|
|
2528
|
+
offset: [$, C],
|
|
2538
2529
|
lines: [U.startLine, U.endLine],
|
|
2539
2530
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2540
2531
|
});
|
|
@@ -2553,10 +2544,10 @@ function Rs(t, r) {
|
|
|
2553
2544
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2554
2545
|
}), M += z - B - _ + A, y++;
|
|
2555
2546
|
} else {
|
|
2556
|
-
B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1],
|
|
2557
|
-
const U = oe(e, i,
|
|
2547
|
+
B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], $ = B + M, C = z + M;
|
|
2548
|
+
const U = oe(e, i, $, C);
|
|
2558
2549
|
h.push({
|
|
2559
|
-
offset: [
|
|
2550
|
+
offset: [$, C],
|
|
2560
2551
|
lines: [U.startLine, U.endLine],
|
|
2561
2552
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2562
2553
|
}), g.push(f[w]), E += _ - A - z + B, w++;
|
|
@@ -2618,7 +2609,7 @@ async function Ds(t) {
|
|
|
2618
2609
|
}
|
|
2619
2610
|
});
|
|
2620
2611
|
}
|
|
2621
|
-
async function
|
|
2612
|
+
async function Ie(t) {
|
|
2622
2613
|
const { filePaths: r, operations: s, dryRun: o, dateModifiedMax: e } = t;
|
|
2623
2614
|
return { results: await Promise.all(
|
|
2624
2615
|
r.map(async (i) => {
|
|
@@ -2706,7 +2697,7 @@ function Bs(t) {
|
|
|
2706
2697
|
});
|
|
2707
2698
|
return { output: o + u.output + e + n + d.output + i, truncated: u.truncated || d.truncated };
|
|
2708
2699
|
}
|
|
2709
|
-
function
|
|
2700
|
+
function $e(t) {
|
|
2710
2701
|
const { result: r, rootDir: s, errorsOnly: o } = t;
|
|
2711
2702
|
let e = "";
|
|
2712
2703
|
for (let n = 0; n < r.results.length; n++) {
|
|
@@ -2785,10 +2776,10 @@ async function As(t, r, s) {
|
|
|
2785
2776
|
return {
|
|
2786
2777
|
error: "Either snapshotName or snapshot must be provided"
|
|
2787
2778
|
};
|
|
2788
|
-
const d = Dt(l), p = l.query.rootDir ?? ".", h = await
|
|
2779
|
+
const d = Dt(l), p = l.query.rootDir ?? ".", h = await Ie({
|
|
2789
2780
|
filePaths: d,
|
|
2790
2781
|
operations: i
|
|
2791
|
-
}), g =
|
|
2782
|
+
}), g = $e({
|
|
2792
2783
|
result: h,
|
|
2793
2784
|
rootDir: p
|
|
2794
2785
|
});
|
|
@@ -2887,7 +2878,7 @@ async function js(t, r, s) {
|
|
|
2887
2878
|
const d = Dt(l), p = l.query.rootDir ?? ".", h = {
|
|
2888
2879
|
filePaths: d,
|
|
2889
2880
|
operations: i
|
|
2890
|
-
}, g = Date.now(), y = await
|
|
2881
|
+
}, g = Date.now(), y = await Ie({
|
|
2891
2882
|
...h,
|
|
2892
2883
|
dryRun: !0
|
|
2893
2884
|
}), w = as();
|
|
@@ -2897,7 +2888,7 @@ async function js(t, r, s) {
|
|
|
2897
2888
|
rootDir: p,
|
|
2898
2889
|
dateCreated: g
|
|
2899
2890
|
};
|
|
2900
|
-
const M =
|
|
2891
|
+
const M = $e({
|
|
2901
2892
|
result: y,
|
|
2902
2893
|
rootDir: p
|
|
2903
2894
|
}) + `
|
|
@@ -2965,11 +2956,11 @@ async function _s(t, r, s) {
|
|
|
2965
2956
|
return {
|
|
2966
2957
|
error: `Invalid replaceId "${e}". The replaceId is located at the END of fs-snapshot-replace-prepare output. Read the ENTIRE output to find it. NEVER fabricate or guess this value.`
|
|
2967
2958
|
};
|
|
2968
|
-
const a = await
|
|
2959
|
+
const a = await Ie({
|
|
2969
2960
|
...i.options,
|
|
2970
2961
|
dateModifiedMax: i.dateCreated
|
|
2971
2962
|
});
|
|
2972
|
-
return n.preparedReplace = null, { output:
|
|
2963
|
+
return n.preparedReplace = null, { output: $e({
|
|
2973
2964
|
result: a,
|
|
2974
2965
|
rootDir: i.rootDir,
|
|
2975
2966
|
errorsOnly: !0
|
|
@@ -3000,7 +2991,7 @@ ${e.output}`), n;
|
|
|
3000
2991
|
);
|
|
3001
2992
|
}
|
|
3002
2993
|
function Js(t, r) {
|
|
3003
|
-
r.list && ns(t, r), r.snapshotQueryCreate && cs(t, r), r.snapshotCreate && ws(t, r), r.snapshotBrowse &&
|
|
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(
|
|
3004
2995
|
`File manager:
|
|
3005
2996
|
- Working directory: ${k.resolve(r.workingDir || "")}
|
|
3006
2997
|
`
|
|
@@ -4340,7 +4331,7 @@ Expected one of:
|
|
|
4340
4331
|
- flemist-mcp.config.json5
|
|
4341
4332
|
- flemist-mcp.config.yaml`);
|
|
4342
4333
|
}
|
|
4343
|
-
const
|
|
4334
|
+
const Io = {
|
|
4344
4335
|
logDir: "tmp/mcp-project-tools/logs",
|
|
4345
4336
|
tools: {
|
|
4346
4337
|
processManager: {
|
|
@@ -4381,7 +4372,7 @@ const $o = {
|
|
|
4381
4372
|
}
|
|
4382
4373
|
}
|
|
4383
4374
|
};
|
|
4384
|
-
async function
|
|
4375
|
+
async function $o(t) {
|
|
4385
4376
|
const r = k.resolve(t), s = await xo(r), o = k.join(r, ".flemist-mcpignore");
|
|
4386
4377
|
try {
|
|
4387
4378
|
await j.promises.stat(o);
|
|
@@ -4392,7 +4383,7 @@ Create .flemist-mcpignore file in: ${r}
|
|
|
4392
4383
|
|
|
4393
4384
|
This file contains glob patterns for files/directories to exclude from MCP operations.`);
|
|
4394
4385
|
}
|
|
4395
|
-
const e = dr(
|
|
4386
|
+
const e = dr(Io, s, {
|
|
4396
4387
|
arrayMerge(n, i) {
|
|
4397
4388
|
return i;
|
|
4398
4389
|
}
|
|
@@ -4500,7 +4491,7 @@ X-Project-Name header is missing. To configure MCP for this project:
|
|
|
4500
4491
|
Ask user to:
|
|
4501
4492
|
1. Add project to server's projects config: projects: { "${i}": "<project-path>" }
|
|
4502
4493
|
2. Restart MCP server`);
|
|
4503
|
-
const c = await
|
|
4494
|
+
const c = await $o(a), l = new Zt({
|
|
4504
4495
|
title: t.title,
|
|
4505
4496
|
name: t.name,
|
|
4506
4497
|
version: t.version
|