@flemist/mcp-project-tools 4.0.3 → 4.0.4
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--UfKhlmP.js";
|
|
3
3
|
import * as s from "path";
|
|
4
4
|
const E = {
|
|
5
5
|
title: v,
|
package/build/index.d.ts
CHANGED
|
@@ -79,12 +79,12 @@ declare type ProcessManagerOptions = {
|
|
|
79
79
|
env?: Record<string, string | null> | null;
|
|
80
80
|
/**
|
|
81
81
|
* Cleanup env before applying project env:
|
|
82
|
-
* -
|
|
83
|
-
* - "clear": start with empty env
|
|
82
|
+
* - "deleteServerPaths" (default): delete variables containing server paths
|
|
84
83
|
* - "replaceServerPaths": replace server paths with project paths
|
|
85
|
-
* - "
|
|
84
|
+
* - "clear": start with empty env
|
|
85
|
+
* - false: do nothing, inherit server env
|
|
86
86
|
*/
|
|
87
|
-
envCleanup?: 'clear' | 'replaceServerPaths' | 'deleteServerPaths' |
|
|
87
|
+
envCleanup?: 'clear' | 'replaceServerPaths' | 'deleteServerPaths' | false;
|
|
88
88
|
run?: null | boolean;
|
|
89
89
|
status?: null | boolean;
|
|
90
90
|
wait?: null | boolean;
|
package/build/index.js
CHANGED
|
@@ -162,33 +162,45 @@ function Tr(t, r, s, o) {
|
|
|
162
162
|
const i = Fe(t, e), a = Fe(r, e);
|
|
163
163
|
if (i !== a) {
|
|
164
164
|
const l = at(t, e);
|
|
165
|
-
for (const
|
|
165
|
+
for (const u in process.env) {
|
|
166
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, u)) continue;
|
|
167
|
+
const f = process.env[u];
|
|
166
168
|
f != null && (l.lastIndex = 0, l.test(f) ? s === "replaceServerPaths" && (n[u] = Mr(f, t, r, e)) : n[u] = f);
|
|
169
|
+
}
|
|
167
170
|
} else
|
|
168
|
-
for (const
|
|
171
|
+
for (const l in process.env) {
|
|
172
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, l)) continue;
|
|
173
|
+
const u = process.env[l];
|
|
169
174
|
u != null && (n[l] = u);
|
|
175
|
+
}
|
|
170
176
|
} else
|
|
171
|
-
for (const
|
|
177
|
+
for (const i in process.env) {
|
|
178
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, i)) continue;
|
|
179
|
+
const a = process.env[i];
|
|
172
180
|
a != null && (n[i] = a);
|
|
181
|
+
}
|
|
173
182
|
if (o)
|
|
174
|
-
for (const
|
|
183
|
+
for (const i in o) {
|
|
184
|
+
if (!Object.prototype.hasOwnProperty.call(o, i)) continue;
|
|
185
|
+
const a = o[i];
|
|
175
186
|
a === null ? delete n[i] : n[i] = a;
|
|
187
|
+
}
|
|
176
188
|
return n;
|
|
177
189
|
}
|
|
178
190
|
function Fe(t, r) {
|
|
179
191
|
const s = k.normalize(t).replace(/[\\/]+$/, "");
|
|
180
192
|
return r ? s.toLowerCase() : s;
|
|
181
193
|
}
|
|
182
|
-
const Cr = 1800 * 1e3,
|
|
194
|
+
const Cr = 1800 * 1e3, Pe = /* @__PURE__ */ new Map();
|
|
183
195
|
let vr = 0;
|
|
184
196
|
function Er() {
|
|
185
197
|
return ++vr;
|
|
186
198
|
}
|
|
187
199
|
function lt(t) {
|
|
188
|
-
let r =
|
|
200
|
+
let r = Pe.get(t);
|
|
189
201
|
return r == null && (r = {
|
|
190
202
|
storedOutputs: /* @__PURE__ */ new Map()
|
|
191
|
-
},
|
|
203
|
+
}, Pe.set(t, r)), r;
|
|
192
204
|
}
|
|
193
205
|
function ct(t) {
|
|
194
206
|
return typeof t == "function" ? t() : t;
|
|
@@ -421,7 +433,7 @@ async function gt(t, r, s) {
|
|
|
421
433
|
autoKillExecuted: f
|
|
422
434
|
};
|
|
423
435
|
}
|
|
424
|
-
function
|
|
436
|
+
function Pr(t, r) {
|
|
425
437
|
t(
|
|
426
438
|
"process-wait",
|
|
427
439
|
{
|
|
@@ -473,7 +485,7 @@ const wt = h.object({
|
|
|
473
485
|
`Maximum output characters to return. Truncated output can be retrieved via output-read tool using outputId from truncation message. Maximum: ${J}. Default: ${Q}`
|
|
474
486
|
)
|
|
475
487
|
});
|
|
476
|
-
async function
|
|
488
|
+
async function Br(t, r, s) {
|
|
477
489
|
ge();
|
|
478
490
|
let o;
|
|
479
491
|
try {
|
|
@@ -521,7 +533,7 @@ To use this command line, ask the user to modify the command line rules in the c
|
|
|
521
533
|
const m = Tr(
|
|
522
534
|
process.cwd(),
|
|
523
535
|
u,
|
|
524
|
-
r.envCleanup ??
|
|
536
|
+
r.envCleanup ?? "deleteServerPaths",
|
|
525
537
|
r.env
|
|
526
538
|
), g = er(e, [], {
|
|
527
539
|
shell: !0,
|
|
@@ -547,7 +559,7 @@ To use this command line, ask the user to modify the command line rules in the c
|
|
|
547
559
|
return p.isRunning = !1, p.endTime = /* @__PURE__ */ new Date(), p.error = m instanceof Error ? m.message : "Unknown error", { error: p.error };
|
|
548
560
|
}
|
|
549
561
|
}
|
|
550
|
-
function
|
|
562
|
+
function Lr(t, r) {
|
|
551
563
|
const s = r.commandLineRules.map((o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`).join(`
|
|
552
564
|
`);
|
|
553
565
|
t(
|
|
@@ -559,7 +571,7 @@ ${s}`,
|
|
|
559
571
|
inputSchema: wt.shape
|
|
560
572
|
},
|
|
561
573
|
async (o, e) => {
|
|
562
|
-
const n = await
|
|
574
|
+
const n = await Br(o, r, e);
|
|
563
575
|
if (!("output" in n))
|
|
564
576
|
return `Method: process-run(${JSON.stringify(o)})
|
|
565
577
|
❌ Error: ${n.error}`;
|
|
@@ -704,7 +716,7 @@ ${JSON.stringify(o, null, 2)}`;
|
|
|
704
716
|
);
|
|
705
717
|
}
|
|
706
718
|
function qr(t, r) {
|
|
707
|
-
Ir(), r.run &&
|
|
719
|
+
Ir(), r.run && Lr(t, r), r.status && Fr(t, r), r.wait && Pr(t, r), r.list && zr(t, r), r.kill && jr(t);
|
|
708
720
|
const s = r.commandLineRules?.map(
|
|
709
721
|
(o) => `${o.rule.toUpperCase()}: ${o.regexp} (${o.note})`
|
|
710
722
|
) || [];
|
|
@@ -756,7 +768,7 @@ function Wr(t) {
|
|
|
756
768
|
return t.endsWith(":") && (t += "/"), k.resolve(t);
|
|
757
769
|
}
|
|
758
770
|
const Se = new tr(nr.cpus().length);
|
|
759
|
-
function
|
|
771
|
+
function Be(t, r) {
|
|
760
772
|
t.totalSize += r.totalSize, t.maxFileDateModified = Math.max(
|
|
761
773
|
t.maxFileDateModified,
|
|
762
774
|
r.maxFileDateModified
|
|
@@ -830,10 +842,10 @@ function St(t) {
|
|
|
830
842
|
});
|
|
831
843
|
if (!v || !x && v.isFile())
|
|
832
844
|
return null;
|
|
833
|
-
const
|
|
834
|
-
if (o.has(
|
|
845
|
+
const P = Jr($, v);
|
|
846
|
+
if (o.has(P))
|
|
835
847
|
return null;
|
|
836
|
-
o.add(
|
|
848
|
+
o.add(P);
|
|
837
849
|
let O = {
|
|
838
850
|
totalSize: v.size,
|
|
839
851
|
maxFileDateModified: v.isDirectory() ? 0 : v.mtimeMs,
|
|
@@ -869,7 +881,7 @@ function St(t) {
|
|
|
869
881
|
v,
|
|
870
882
|
O,
|
|
871
883
|
I
|
|
872
|
-
) && (
|
|
884
|
+
) && (Be(y, O), w(S, O))), O;
|
|
873
885
|
} else if (v.isDirectory()) {
|
|
874
886
|
const C = await V({
|
|
875
887
|
pool: n,
|
|
@@ -896,7 +908,7 @@ function St(t) {
|
|
|
896
908
|
v,
|
|
897
909
|
O,
|
|
898
910
|
I
|
|
899
|
-
) && (
|
|
911
|
+
) && (Be(y, O), w(S, O))), O;
|
|
900
912
|
}
|
|
901
913
|
const b = [];
|
|
902
914
|
for (let $ = 0, T = r.length; $ < T; $++) {
|
|
@@ -921,7 +933,7 @@ function Qr(t) {
|
|
|
921
933
|
const r = t.startsWith("!");
|
|
922
934
|
return r && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), r && (t = "!" + t), t;
|
|
923
935
|
}
|
|
924
|
-
function
|
|
936
|
+
function Le(t) {
|
|
925
937
|
return "^" + t;
|
|
926
938
|
}
|
|
927
939
|
async function Yr(t) {
|
|
@@ -937,7 +949,7 @@ async function $t(t) {
|
|
|
937
949
|
return s;
|
|
938
950
|
const o = [];
|
|
939
951
|
return t.globs.forEach((e) => {
|
|
940
|
-
e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ?
|
|
952
|
+
e.value && (e.valueType === "file-contains-patterns" ? o.push(e) : e.valueType === "pattern" && s.push(e.exclude ? Le(e.value) : e.value));
|
|
941
953
|
}), o.length && await Promise.all(
|
|
942
954
|
o.map(async (e) => {
|
|
943
955
|
await V({
|
|
@@ -946,7 +958,7 @@ async function $t(t) {
|
|
|
946
958
|
func: async () => {
|
|
947
959
|
const n = k.resolve(r, e.value), i = await Yr(n), a = k.relative(r, k.dirname(n));
|
|
948
960
|
i.forEach((c) => {
|
|
949
|
-
c = Qr(c), c = Hr(c, a), s.push(e.exclude ?
|
|
961
|
+
c = Qr(c), c = Hr(c, a), s.push(e.exclude ? Le(c) : c);
|
|
950
962
|
});
|
|
951
963
|
}
|
|
952
964
|
});
|
|
@@ -1147,7 +1159,7 @@ function Xr(t, r) {
|
|
|
1147
1159
|
}
|
|
1148
1160
|
return e;
|
|
1149
1161
|
}
|
|
1150
|
-
const es = "4.0.
|
|
1162
|
+
const es = "4.0.4", ts = {
|
|
1151
1163
|
version: es
|
|
1152
1164
|
}, Go = "Project Tools", Jo = "project-tools", Wo = ts.version, Ko = "d00f70240703039df14c76176a055bce6b5484d2b552ba2c89820f03b8e5e60d", qe = 25e3;
|
|
1153
1165
|
function _e(t) {
|
|
@@ -1308,8 +1320,8 @@ async function rs(t, r) {
|
|
|
1308
1320
|
let b = null, $ = null;
|
|
1309
1321
|
if (a || c)
|
|
1310
1322
|
try {
|
|
1311
|
-
const S = Date.now(), v = c ? S - _e(c) : null,
|
|
1312
|
-
b = [v,
|
|
1323
|
+
const S = Date.now(), v = c ? S - _e(c) : null, P = a ? S - _e(a) : null;
|
|
1324
|
+
b = [v, P];
|
|
1313
1325
|
} catch (S) {
|
|
1314
1326
|
return {
|
|
1315
1327
|
error: S instanceof Error ? S.message : "Unknown error parsing time ago filter"
|
|
@@ -2301,9 +2313,9 @@ function Ns(t) {
|
|
|
2301
2313
|
continue;
|
|
2302
2314
|
}
|
|
2303
2315
|
const S = o.charCodeAt(x + 1);
|
|
2304
|
-
let v = -1,
|
|
2316
|
+
let v = -1, P = 0, O = 2;
|
|
2305
2317
|
if (S === de)
|
|
2306
|
-
v = se,
|
|
2318
|
+
v = se, P = "$";
|
|
2307
2319
|
else if (S === Is)
|
|
2308
2320
|
v = et;
|
|
2309
2321
|
else if (S === vs)
|
|
@@ -2317,14 +2329,14 @@ function Ns(t) {
|
|
|
2317
2329
|
if (C < re || C > Xe) break;
|
|
2318
2330
|
I++;
|
|
2319
2331
|
}
|
|
2320
|
-
v = st,
|
|
2332
|
+
v = st, P = o.substring(x + 1, I), O = I - x;
|
|
2321
2333
|
} else if (S === Ts) {
|
|
2322
2334
|
let I = x + 2;
|
|
2323
2335
|
for (; I < b && o.charCodeAt(I) !== Cs; )
|
|
2324
2336
|
I++;
|
|
2325
|
-
I < b && I > x + 2 && (v = Es,
|
|
2337
|
+
I < b && I > x + 2 && (v = Es, P = o.substring(x + 2, I), O = I + 1 - x);
|
|
2326
2338
|
}
|
|
2327
|
-
v >= 0 ? (x > T && (u.push(se), f.push(o.substring(T, x))), u.push(v), f.push(
|
|
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++;
|
|
2328
2340
|
}
|
|
2329
2341
|
T < b && (u.push(se), f.push(o.substring(T))), d = u.length;
|
|
2330
2342
|
} else
|
|
@@ -2335,9 +2347,9 @@ function Ns(t) {
|
|
|
2335
2347
|
let y;
|
|
2336
2348
|
for (; (y = s.exec(r)) !== null; ) {
|
|
2337
2349
|
const b = y.index, $ = y[0], T = $.length, x = b + T;
|
|
2338
|
-
let S, v,
|
|
2350
|
+
let S, v, P, O;
|
|
2339
2351
|
if (i === 1)
|
|
2340
|
-
S = 0, v = 1,
|
|
2352
|
+
S = 0, v = 1, P = 0, O = e;
|
|
2341
2353
|
else {
|
|
2342
2354
|
let I = 0, C = i - 1;
|
|
2343
2355
|
for (; I < C; ) {
|
|
@@ -2353,12 +2365,12 @@ function Ns(t) {
|
|
|
2353
2365
|
v = I + 1;
|
|
2354
2366
|
} else
|
|
2355
2367
|
v = S + 1;
|
|
2356
|
-
|
|
2368
|
+
P = n[S], O = v < i ? n[v] : e;
|
|
2357
2369
|
}
|
|
2358
2370
|
if (a.push({
|
|
2359
2371
|
offset: [b, x],
|
|
2360
2372
|
lines: [S, v],
|
|
2361
|
-
linesOffset: [
|
|
2373
|
+
linesOffset: [P, O]
|
|
2362
2374
|
}), o != null) {
|
|
2363
2375
|
p += r.substring(m, b);
|
|
2364
2376
|
let I;
|
|
@@ -2368,10 +2380,10 @@ function Ns(t) {
|
|
|
2368
2380
|
I = "";
|
|
2369
2381
|
const N = y.groups, R = y.length - 1;
|
|
2370
2382
|
for (let K = 0; K < d; K++) {
|
|
2371
|
-
const q = u[K],
|
|
2383
|
+
const q = u[K], L = f[K];
|
|
2372
2384
|
switch (q) {
|
|
2373
2385
|
case se:
|
|
2374
|
-
I +=
|
|
2386
|
+
I += L;
|
|
2375
2387
|
break;
|
|
2376
2388
|
case et:
|
|
2377
2389
|
I += $;
|
|
@@ -2383,19 +2395,19 @@ function Ns(t) {
|
|
|
2383
2395
|
I += r.substring(x);
|
|
2384
2396
|
break;
|
|
2385
2397
|
case st: {
|
|
2386
|
-
const
|
|
2398
|
+
const B = L, z = B.length, A = B.charCodeAt(0) - re;
|
|
2387
2399
|
if (z >= 2) {
|
|
2388
|
-
const _ =
|
|
2400
|
+
const _ = B.charCodeAt(1) - re, D = A * 10 + _;
|
|
2389
2401
|
if (D >= 1 && D <= R) {
|
|
2390
|
-
I += y[D] ?? "", z > 2 && (I +=
|
|
2402
|
+
I += y[D] ?? "", z > 2 && (I += B.substring(2));
|
|
2391
2403
|
break;
|
|
2392
2404
|
}
|
|
2393
2405
|
}
|
|
2394
|
-
A >= 1 && A <= R ? (I += y[A] ?? "", z > 1 && (I +=
|
|
2406
|
+
A >= 1 && A <= R ? (I += y[A] ?? "", z > 1 && (I += B.substring(1))) : I += "$" + B;
|
|
2395
2407
|
break;
|
|
2396
2408
|
}
|
|
2397
2409
|
default:
|
|
2398
|
-
N != null ? I += N[
|
|
2410
|
+
N != null ? I += N[L] ?? "" : I += "$<" + L + ">";
|
|
2399
2411
|
}
|
|
2400
2412
|
}
|
|
2401
2413
|
}
|
|
@@ -2419,9 +2431,9 @@ function Ns(t) {
|
|
|
2419
2431
|
const E = M.length;
|
|
2420
2432
|
for (let b = 0, $ = c.length; b < $; b++) {
|
|
2421
2433
|
const T = c[b], x = T.offset[0], S = T.offset[1];
|
|
2422
|
-
let v,
|
|
2434
|
+
let v, P, O, I;
|
|
2423
2435
|
if (E === 1)
|
|
2424
|
-
v = 0,
|
|
2436
|
+
v = 0, P = 1, O = 0, I = w;
|
|
2425
2437
|
else {
|
|
2426
2438
|
let C = 0, N = E - 1;
|
|
2427
2439
|
for (; C < N; ) {
|
|
@@ -2434,12 +2446,12 @@ function Ns(t) {
|
|
|
2434
2446
|
const K = C + N + 1 >> 1;
|
|
2435
2447
|
M[K] <= R ? C = K : N = K - 1;
|
|
2436
2448
|
}
|
|
2437
|
-
|
|
2449
|
+
P = C + 1;
|
|
2438
2450
|
} else
|
|
2439
|
-
|
|
2440
|
-
O = M[v], I =
|
|
2451
|
+
P = v + 1;
|
|
2452
|
+
O = M[v], I = P < E ? M[P] : w;
|
|
2441
2453
|
}
|
|
2442
|
-
T.lines[0] = v, T.lines[1] =
|
|
2454
|
+
T.lines[0] = v, T.lines[1] = P, T.linesOffset[0] = O, T.linesOffset[1] = I;
|
|
2443
2455
|
}
|
|
2444
2456
|
return {
|
|
2445
2457
|
search: { content: r, matches: a },
|
|
@@ -2494,23 +2506,23 @@ function ks(t, r) {
|
|
|
2494
2506
|
};
|
|
2495
2507
|
}
|
|
2496
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, m = [], g = [];
|
|
2497
|
-
let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0, T = 0, x = 0, S = 0, v = 0,
|
|
2509
|
+
let y = 0, w = 0, M = 0, E = 0, b = 0, $ = 0, T = 0, x = 0, S = 0, v = 0, P = 0, O = 0, I = 0, C = 0, N = 0, R = 0, K = 0, q = 0, L = 0, B = 0, z = 0, A = 0, _ = 0, D = 0;
|
|
2498
2510
|
for (; y < d || w < p; )
|
|
2499
2511
|
if (y < d && (b = l[y].offset[0], $ = l[y].offset[1]), w < p && (T = u[w].offset[0], x = u[w].offset[1]), y < d && w < p && b < x && T < $) {
|
|
2500
|
-
K = b < T ? b : T, S = $ > x ? $ : x,
|
|
2512
|
+
K = b < T ? b : T, S = $ > x ? $ : x, P = y, O = w, y++, w++;
|
|
2501
2513
|
do {
|
|
2502
2514
|
for (v = S; y < d && l[y].offset[0] < S; )
|
|
2503
2515
|
$ = l[y].offset[1], $ > S && (S = $), y++;
|
|
2504
2516
|
for (; w < p && u[w].offset[0] < S; )
|
|
2505
2517
|
x = u[w].offset[1], x > S && (S = x), w++;
|
|
2506
2518
|
} while (S !== v);
|
|
2507
|
-
I = 1 / 0, C = -1 / 0, q = K,
|
|
2508
|
-
for (let G =
|
|
2509
|
-
|
|
2510
|
-
q < S && (D = q +
|
|
2519
|
+
I = 1 / 0, C = -1 / 0, q = K, L = M;
|
|
2520
|
+
for (let G = P; G < y; G++)
|
|
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 < I && (I = D), D = A + L, D > C && (C = D)), B < I && (I = B), z > C && (C = z), L += z - B - _ + A, q = _;
|
|
2522
|
+
q < S && (D = q + L, D < I && (I = D), D = S + L, D > C && (C = D)), M = L, N = 1 / 0, R = -1 / 0, q = K, L = E;
|
|
2511
2523
|
for (let G = O; G < w; G++)
|
|
2512
|
-
|
|
2513
|
-
q < S && (D = q +
|
|
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;
|
|
2525
|
+
q < S && (D = q + L, D < N && (N = D), D = S + L, D > R && (R = D)), E = L;
|
|
2514
2526
|
const U = oe(e, i, I, C);
|
|
2515
2527
|
m.push({
|
|
2516
2528
|
offset: [I, C],
|
|
@@ -2524,21 +2536,21 @@ function ks(t, r) {
|
|
|
2524
2536
|
linesOffset: [te.startLineOfs, te.endLineOfs]
|
|
2525
2537
|
});
|
|
2526
2538
|
} else if (w >= p || y < d && b <= T) {
|
|
2527
|
-
|
|
2539
|
+
B = c[y].offset[0], z = c[y].offset[1], A = l[y].offset[0], _ = l[y].offset[1], N = A + E, R = _ + E;
|
|
2528
2540
|
const U = oe(n, a, N, R);
|
|
2529
2541
|
m.push(c[y]), g.push({
|
|
2530
2542
|
offset: [N, R],
|
|
2531
2543
|
lines: [U.startLine, U.endLine],
|
|
2532
2544
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2533
|
-
}), M += z -
|
|
2545
|
+
}), M += z - B - _ + A, y++;
|
|
2534
2546
|
} else {
|
|
2535
|
-
|
|
2547
|
+
B = u[w].offset[0], z = u[w].offset[1], A = f[w].offset[0], _ = f[w].offset[1], I = B + M, C = z + M;
|
|
2536
2548
|
const U = oe(e, i, I, C);
|
|
2537
2549
|
m.push({
|
|
2538
2550
|
offset: [I, C],
|
|
2539
2551
|
lines: [U.startLine, U.endLine],
|
|
2540
2552
|
linesOffset: [U.startLineOfs, U.endLineOfs]
|
|
2541
|
-
}), g.push(f[w]), E += _ - A - z +
|
|
2553
|
+
}), g.push(f[w]), E += _ - A - z + B, w++;
|
|
2542
2554
|
}
|
|
2543
2555
|
return {
|
|
2544
2556
|
search: { content: e, matches: m },
|
|
@@ -2709,7 +2721,7 @@ function Ie(t) {
|
|
|
2709
2721
|
}
|
|
2710
2722
|
return e;
|
|
2711
2723
|
}
|
|
2712
|
-
const
|
|
2724
|
+
const Ps = h.object({
|
|
2713
2725
|
pattern: h.string().describe("JS RegExp pattern"),
|
|
2714
2726
|
flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"')
|
|
2715
2727
|
}), Ft = h.object({
|
|
@@ -2717,14 +2729,14 @@ const Bs = h.object({
|
|
|
2717
2729
|
snapshot: ee.optional().describe(
|
|
2718
2730
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
2719
2731
|
),
|
|
2720
|
-
bulkOperations: h.array(
|
|
2732
|
+
bulkOperations: h.array(Ps).describe(
|
|
2721
2733
|
"All search patterns to execute; include every pattern here; never split across multiple calls"
|
|
2722
2734
|
),
|
|
2723
2735
|
outputLimit: h.number().int().min(0).max(J).default(Q).describe(
|
|
2724
2736
|
`Maximum output characters. Output exceeding this limit will be truncated. Maximum: ${J}. Default: ${Q}`
|
|
2725
2737
|
)
|
|
2726
2738
|
});
|
|
2727
|
-
async function
|
|
2739
|
+
async function Bs(t, r, s) {
|
|
2728
2740
|
let o;
|
|
2729
2741
|
try {
|
|
2730
2742
|
o = Ft.parse(t);
|
|
@@ -2777,7 +2789,7 @@ async function Ls(t, r, s) {
|
|
|
2777
2789
|
limit: a
|
|
2778
2790
|
}).content, rootDir: p, fsSnapshot: l, queryCreated: u, snapshotCreated: f };
|
|
2779
2791
|
}
|
|
2780
|
-
function
|
|
2792
|
+
function Ls(t, r) {
|
|
2781
2793
|
t(
|
|
2782
2794
|
"fs-snapshot-search",
|
|
2783
2795
|
{
|
|
@@ -2786,7 +2798,7 @@ function Ps(t, r) {
|
|
|
2786
2798
|
inputSchema: Ft.shape
|
|
2787
2799
|
},
|
|
2788
2800
|
async (s, o) => {
|
|
2789
|
-
const e = await
|
|
2801
|
+
const e = await Bs(
|
|
2790
2802
|
s,
|
|
2791
2803
|
r,
|
|
2792
2804
|
o
|
|
@@ -2811,7 +2823,7 @@ const As = h.object({
|
|
|
2811
2823
|
pattern: h.string().describe("JS RegExp pattern"),
|
|
2812
2824
|
flags: h.string().default("gm").describe('JS RegExp flags. Default: "gm"'),
|
|
2813
2825
|
replacement: h.string().describe("JS replacement pattern")
|
|
2814
|
-
}),
|
|
2826
|
+
}), Pt = h.object({
|
|
2815
2827
|
snapshotName: h.string().optional().describe("Name of previously created filesystem snapshot, to use"),
|
|
2816
2828
|
snapshot: ee.optional().describe(
|
|
2817
2829
|
"Filesystem snapshot creation options JSON to automatically create snapshot"
|
|
@@ -2826,7 +2838,7 @@ const As = h.object({
|
|
|
2826
2838
|
async function zs(t, r, s) {
|
|
2827
2839
|
let o;
|
|
2828
2840
|
try {
|
|
2829
|
-
o =
|
|
2841
|
+
o = Pt.parse(t);
|
|
2830
2842
|
} catch (b) {
|
|
2831
2843
|
return {
|
|
2832
2844
|
error: F(b)
|
|
@@ -2894,7 +2906,7 @@ function Us(t, r) {
|
|
|
2894
2906
|
{
|
|
2895
2907
|
title: "Prepare File Content Replacement",
|
|
2896
2908
|
description: "Prepares text replacement in files using JS RegExp. Use this to perform bulk replacements across snapshot files. Put all replace patterns in the bulkOperations array; use one snapshot with rootDir covering all target files; never split into multiple calls based on file locations, directories, or pattern groups. Read and review full output to the end. If all replacements are valid get replaceId from the end of output and call fs-snapshot-replace-execute to apply it.",
|
|
2897
|
-
inputSchema:
|
|
2909
|
+
inputSchema: Pt.shape
|
|
2898
2910
|
},
|
|
2899
2911
|
async (s, o) => {
|
|
2900
2912
|
const e = await zs(
|
|
@@ -2918,13 +2930,13 @@ Reminder: use one snapshot covering all target files; include all patterns in th
|
|
|
2918
2930
|
}
|
|
2919
2931
|
);
|
|
2920
2932
|
}
|
|
2921
|
-
const
|
|
2933
|
+
const Bt = h.object({
|
|
2922
2934
|
replaceId: h.string().describe("Replace ID from the END of fs-snapshot-replace-prepare output. NEVER fabricate or guess this value.")
|
|
2923
2935
|
});
|
|
2924
2936
|
async function js(t, r, s) {
|
|
2925
2937
|
let o;
|
|
2926
2938
|
try {
|
|
2927
|
-
o =
|
|
2939
|
+
o = Bt.parse(t);
|
|
2928
2940
|
} catch (l) {
|
|
2929
2941
|
return {
|
|
2930
2942
|
error: F(l)
|
|
@@ -2960,7 +2972,7 @@ function qs(t, r) {
|
|
|
2960
2972
|
{
|
|
2961
2973
|
title: "Execute Prepared Replacement",
|
|
2962
2974
|
description: "Executes prepared replacement. Requires replaceId from the end of fs-snapshot-replace-prepare output.",
|
|
2963
|
-
inputSchema:
|
|
2975
|
+
inputSchema: Bt.shape
|
|
2964
2976
|
},
|
|
2965
2977
|
async (s, o) => {
|
|
2966
2978
|
const e = await js(
|
|
@@ -2979,7 +2991,7 @@ ${e.output}`), n;
|
|
|
2979
2991
|
);
|
|
2980
2992
|
}
|
|
2981
2993
|
function _s(t, r) {
|
|
2982
|
-
r.list && ss(t, r), r.snapshotQueryCreate && as(t, r), r.snapshotCreate && ms(t, r), r.snapshotBrowse && Ss(t, r), r.snapshotSearch &&
|
|
2994
|
+
r.list && ss(t, r), r.snapshotQueryCreate && as(t, r), r.snapshotCreate && ms(t, r), r.snapshotBrowse && Ss(t, r), r.snapshotSearch && Ls(t, r), r.snapshotReplace && (Us(t, r), qs(t, r)), console.log(
|
|
2983
2995
|
`File manager:
|
|
2984
2996
|
- Working directory: ${k.resolve(r.workingDir || "")}
|
|
2985
2997
|
`
|
|
@@ -3000,7 +3012,7 @@ const Me = h.object({
|
|
|
3000
3012
|
muteAudio: h.boolean().optional().describe("Mute audio in the browser"),
|
|
3001
3013
|
devTools: h.boolean().optional().describe("Open browser with dev tools")
|
|
3002
3014
|
});
|
|
3003
|
-
async function
|
|
3015
|
+
async function Lt(t, r, s) {
|
|
3004
3016
|
let o;
|
|
3005
3017
|
try {
|
|
3006
3018
|
o = Me.parse(t);
|
|
@@ -3046,7 +3058,7 @@ function Gs(t, r) {
|
|
|
3046
3058
|
inputSchema: Me.shape
|
|
3047
3059
|
},
|
|
3048
3060
|
async (s, o) => {
|
|
3049
|
-
const e = await
|
|
3061
|
+
const e = await Lt(s, r, o);
|
|
3050
3062
|
return `Method: playwright-browser-create(${JSON.stringify(s)})
|
|
3051
3063
|
${e.error != null ? `❌ Error: ${e.error}` : `✅ Browser "${e.browserInfo.name}" (${e.browserInfo.browserType}) created successfully`}`;
|
|
3052
3064
|
}
|
|
@@ -3198,7 +3210,7 @@ async function Ut(t, r, s) {
|
|
|
3198
3210
|
error: `Browser "${n}" not found`
|
|
3199
3211
|
};
|
|
3200
3212
|
} else if (i) {
|
|
3201
|
-
const p = await
|
|
3213
|
+
const p = await Lt(i, r, s);
|
|
3202
3214
|
if (p.error != null)
|
|
3203
3215
|
return {
|
|
3204
3216
|
error: p.error
|
|
@@ -68,9 +68,10 @@
|
|
|
68
68
|
"description": "Environment variables for spawned processes. String value adds/overrides, null value deletes the variable"
|
|
69
69
|
},
|
|
70
70
|
"envCleanup": {
|
|
71
|
-
"type": ["string", "
|
|
72
|
-
"enum": ["clear", "replaceServerPaths", "deleteServerPaths",
|
|
73
|
-
"
|
|
71
|
+
"type": ["string", "boolean"],
|
|
72
|
+
"enum": ["clear", "replaceServerPaths", "deleteServerPaths", false],
|
|
73
|
+
"default": "deleteServerPaths",
|
|
74
|
+
"description": "Cleanup env before applying project env: 'deleteServerPaths' (default) removes vars containing server paths, 'replaceServerPaths' replaces server paths with project paths, 'clear' starts with empty env, false disables cleanup and inherits server env"
|
|
74
75
|
},
|
|
75
76
|
"run": {
|
|
76
77
|
"type": ["boolean", "null"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemist/mcp-project-tools",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "MCP project tools",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"mcp-project-tools": "build/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
|
-
"packageManager": "pnpm@10.18.3",
|
|
14
13
|
"engines": {
|
|
15
14
|
"node": ">=20"
|
|
16
15
|
},
|
|
@@ -22,35 +21,6 @@
|
|
|
22
21
|
"stylelint --fix --allow-empty-input"
|
|
23
22
|
]
|
|
24
23
|
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"========================= install =========================": "",
|
|
27
|
-
"prepare": "node .husky/install.mjs",
|
|
28
|
-
"_prepublishOnly": "pnpm build && pnpm test:unit && npm login",
|
|
29
|
-
"publish:check": "pnpm pack",
|
|
30
|
-
"========================= deploy =========================": "",
|
|
31
|
-
"build": "vite build",
|
|
32
|
-
"build:portable": "vite build && shx cp static/** build && shx cp package.json build && cd build && pnpm install --prod --shamefully-hoist --node-linker=hoisted --ignore-scripts && cd ..",
|
|
33
|
-
"========================= start =========================": "",
|
|
34
|
-
"dev": "tsx src/cli.ts",
|
|
35
|
-
"preview": "node build",
|
|
36
|
-
"========================= lint =========================": "",
|
|
37
|
-
"audit": "pnpm audit --prod",
|
|
38
|
-
"lint:es": "eslint --config eslint.config.mjs .",
|
|
39
|
-
"lint:es:fix": "eslint --config eslint.config.mjs --fix .",
|
|
40
|
-
"lint": "run-p lint:es",
|
|
41
|
-
"lint:fix": "run-s lint:es:fix",
|
|
42
|
-
"lint-staged": "lint-staged",
|
|
43
|
-
"========================= test =========================": "",
|
|
44
|
-
"test": "run-s test:unit test:api test:e2e",
|
|
45
|
-
"test:e2e": "vitest --run --bail 3 .e2e.",
|
|
46
|
-
"test:api": "vitest --run --bail 3 .api.",
|
|
47
|
-
"test:unit": "vitest --run --bail 3 .test.",
|
|
48
|
-
"test:types": "tsc --noEmit",
|
|
49
|
-
"========================= dev =========================": "",
|
|
50
|
-
"kill-node": "taskkill /F /IM node.exe",
|
|
51
|
-
"kill-java": "taskkill /F /IM java.exe",
|
|
52
|
-
"kill-chrome": "taskkill /F /IM chrome.exe"
|
|
53
|
-
},
|
|
54
24
|
"repository": {
|
|
55
25
|
"type": "git",
|
|
56
26
|
"url": "git+https://github.com/NikolayMakhonin/mcp-project.git"
|
|
@@ -117,5 +87,32 @@
|
|
|
117
87
|
"playwright": "^1.54.1",
|
|
118
88
|
"tree-kill": "1.2.2",
|
|
119
89
|
"zod": "3.25.74"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"========================= install =========================": "",
|
|
93
|
+
"publish:check": "pnpm pack",
|
|
94
|
+
"========================= deploy =========================": "",
|
|
95
|
+
"build": "vite build",
|
|
96
|
+
"build:portable": "vite build && shx cp static/** build && shx cp package.json build && cd build && pnpm install --prod --shamefully-hoist --node-linker=hoisted --ignore-scripts && cd ..",
|
|
97
|
+
"========================= start =========================": "",
|
|
98
|
+
"dev": "tsx src/cli.ts",
|
|
99
|
+
"preview": "node build",
|
|
100
|
+
"========================= lint =========================": "",
|
|
101
|
+
"audit": "pnpm audit --prod",
|
|
102
|
+
"lint:es": "eslint --config eslint.config.mjs .",
|
|
103
|
+
"lint:es:fix": "eslint --config eslint.config.mjs --fix .",
|
|
104
|
+
"lint": "run-p lint:es",
|
|
105
|
+
"lint:fix": "run-s lint:es:fix",
|
|
106
|
+
"lint-staged": "lint-staged",
|
|
107
|
+
"========================= test =========================": "",
|
|
108
|
+
"test": "run-s test:unit test:api test:e2e",
|
|
109
|
+
"test:e2e": "vitest --run --bail 3 .e2e.",
|
|
110
|
+
"test:api": "vitest --run --bail 3 .api.",
|
|
111
|
+
"test:unit": "vitest --run --bail 3 .test.",
|
|
112
|
+
"test:types": "tsc --noEmit",
|
|
113
|
+
"========================= dev =========================": "",
|
|
114
|
+
"kill-node": "taskkill /F /IM node.exe",
|
|
115
|
+
"kill-java": "taskkill /F /IM java.exe",
|
|
116
|
+
"kill-chrome": "taskkill /F /IM chrome.exe"
|
|
120
117
|
}
|
|
121
|
-
}
|
|
118
|
+
}
|