@solongate/proxy 0.1.5 → 0.1.6
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/dist/create.js +37 -13
- package/dist/index.js +93 -32
- package/dist/init.js +22 -6
- package/dist/inject.js +32 -13
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -190,20 +190,52 @@ dist/
|
|
|
190
190
|
`
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
|
+
var c = {
|
|
194
|
+
reset: "\x1B[0m",
|
|
195
|
+
bold: "\x1B[1m",
|
|
196
|
+
dim: "\x1B[2m",
|
|
197
|
+
white: "\x1B[97m",
|
|
198
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
199
|
+
// dark blue
|
|
200
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
201
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
202
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
203
|
+
blue5: "\x1B[38;2;170;200;245m",
|
|
204
|
+
// light blue → white
|
|
205
|
+
green: "\x1B[32m",
|
|
206
|
+
red: "\x1B[31m"
|
|
207
|
+
};
|
|
208
|
+
function printBanner(subtitle) {
|
|
209
|
+
const lines = [
|
|
210
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
211
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
212
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
213
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
214
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
215
|
+
];
|
|
216
|
+
const colors = [c.blue1, c.blue2, c.blue3, c.blue4, c.blue5];
|
|
217
|
+
log("");
|
|
218
|
+
for (let i = 0; i < lines.length; i++) {
|
|
219
|
+
log(`${c.bold}${colors[i]}${lines[i]}${c.reset}`);
|
|
220
|
+
}
|
|
221
|
+
log("");
|
|
222
|
+
log(` ${c.dim}${subtitle}${c.reset}`);
|
|
223
|
+
log("");
|
|
224
|
+
}
|
|
193
225
|
function withSpinner(message, fn) {
|
|
194
|
-
const frames = ["\
|
|
226
|
+
const frames = ["\u28FE", "\u28FD", "\u28FB", "\u28BF", "\u287F", "\u28DF", "\u28EF", "\u28F7"];
|
|
195
227
|
let i = 0;
|
|
196
228
|
const id = setInterval(() => {
|
|
197
|
-
process.stderr.write(`\r ${frames[i++ % frames.length]} ${message}`);
|
|
229
|
+
process.stderr.write(`\r ${c.blue3}${frames[i++ % frames.length]}${c.reset} ${message}`);
|
|
198
230
|
}, 80);
|
|
199
231
|
try {
|
|
200
232
|
fn();
|
|
201
233
|
clearInterval(id);
|
|
202
|
-
process.stderr.write(`\r \u2713 ${message}
|
|
234
|
+
process.stderr.write(`\r ${c.green}\u2713${c.reset} ${message}
|
|
203
235
|
`);
|
|
204
236
|
} catch {
|
|
205
237
|
clearInterval(id);
|
|
206
|
-
process.stderr.write(`\r \u2717 ${message} \u2014 failed
|
|
238
|
+
process.stderr.write(`\r ${c.red}\u2717${c.reset} ${message} \u2014 failed
|
|
207
239
|
`);
|
|
208
240
|
}
|
|
209
241
|
}
|
|
@@ -215,15 +247,7 @@ function installDeps(dir) {
|
|
|
215
247
|
async function main() {
|
|
216
248
|
const opts = parseCreateArgs(process.argv);
|
|
217
249
|
const dir = resolve(opts.name);
|
|
218
|
-
|
|
219
|
-
log(" ____ _ ____ _");
|
|
220
|
-
log(" / ___| ___ | | ___ _ __ / ___| __ _| |_ ___");
|
|
221
|
-
log(" \\___ \\ / _ \\| |/ _ \\| '_ \\| | _ / _` | __/ _ \\");
|
|
222
|
-
log(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
223
|
-
log(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
224
|
-
log("");
|
|
225
|
-
log(" Create MCP Server");
|
|
226
|
-
log("");
|
|
250
|
+
printBanner("Create MCP Server");
|
|
227
251
|
if (existsSync(dir)) {
|
|
228
252
|
log(` Error: Directory "${opts.name}" already exists.`);
|
|
229
253
|
process.exit(1);
|
package/dist/index.js
CHANGED
|
@@ -143,14 +143,30 @@ POLICY PRESETS
|
|
|
143
143
|
}
|
|
144
144
|
async function main() {
|
|
145
145
|
const options = parseInitArgs(process.argv);
|
|
146
|
+
const _c = {
|
|
147
|
+
reset: "\x1B[0m",
|
|
148
|
+
bold: "\x1B[1m",
|
|
149
|
+
dim: "\x1B[2m",
|
|
150
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
151
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
152
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
153
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
154
|
+
blue5: "\x1B[38;2;170;200;245m"
|
|
155
|
+
};
|
|
156
|
+
const bannerLines = [
|
|
157
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
158
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
159
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
160
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
161
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
162
|
+
];
|
|
163
|
+
const bannerColors = [_c.blue1, _c.blue2, _c.blue3, _c.blue4, _c.blue5];
|
|
146
164
|
console.error("");
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
console.error(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
151
|
-
console.error(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
165
|
+
for (let i = 0; i < bannerLines.length; i++) {
|
|
166
|
+
console.error(`${_c.bold}${bannerColors[i]}${bannerLines[i]}${_c.reset}`);
|
|
167
|
+
}
|
|
152
168
|
console.error("");
|
|
153
|
-
console.error(
|
|
169
|
+
console.error(` ${_c.dim}Init Setup${_c.reset}`);
|
|
154
170
|
console.error("");
|
|
155
171
|
const configInfo = findConfigFile(options.configPath);
|
|
156
172
|
if (!configInfo) {
|
|
@@ -350,6 +366,23 @@ WHAT IT DOES
|
|
|
350
366
|
function log2(msg) {
|
|
351
367
|
process.stderr.write(msg + "\n");
|
|
352
368
|
}
|
|
369
|
+
function printBanner(subtitle) {
|
|
370
|
+
const lines = [
|
|
371
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
372
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
373
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
374
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
375
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
376
|
+
];
|
|
377
|
+
const colors = [c.blue1, c.blue2, c.blue3, c.blue4, c.blue5];
|
|
378
|
+
log2("");
|
|
379
|
+
for (let i = 0; i < lines.length; i++) {
|
|
380
|
+
log2(`${c.bold}${colors[i]}${lines[i]}${c.reset}`);
|
|
381
|
+
}
|
|
382
|
+
log2("");
|
|
383
|
+
log2(` ${c.dim}${subtitle}${c.reset}`);
|
|
384
|
+
log2("");
|
|
385
|
+
}
|
|
353
386
|
function detectProject() {
|
|
354
387
|
if (!existsSync3(resolve3("package.json"))) return false;
|
|
355
388
|
try {
|
|
@@ -385,8 +418,8 @@ function findTsEntryFile() {
|
|
|
385
418
|
"server.ts",
|
|
386
419
|
"main.ts"
|
|
387
420
|
];
|
|
388
|
-
for (const
|
|
389
|
-
const full = resolve3(
|
|
421
|
+
for (const c3 of candidates) {
|
|
422
|
+
const full = resolve3(c3);
|
|
390
423
|
if (existsSync3(full)) {
|
|
391
424
|
try {
|
|
392
425
|
const content = readFileSync3(full, "utf-8");
|
|
@@ -397,8 +430,8 @@ function findTsEntryFile() {
|
|
|
397
430
|
}
|
|
398
431
|
}
|
|
399
432
|
}
|
|
400
|
-
for (const
|
|
401
|
-
if (existsSync3(resolve3(
|
|
433
|
+
for (const c3 of candidates) {
|
|
434
|
+
if (existsSync3(resolve3(c3))) return resolve3(c3);
|
|
402
435
|
}
|
|
403
436
|
return null;
|
|
404
437
|
}
|
|
@@ -536,15 +569,7 @@ function showDiff(result) {
|
|
|
536
569
|
}
|
|
537
570
|
async function main2() {
|
|
538
571
|
const opts = parseInjectArgs(process.argv);
|
|
539
|
-
|
|
540
|
-
log2(" ____ _ ____ _");
|
|
541
|
-
log2(" / ___| ___ | | ___ _ __ / ___| __ _| |_ ___");
|
|
542
|
-
log2(" \\___ \\ / _ \\| |/ _ \\| '_ \\| | _ / _` | __/ _ \\");
|
|
543
|
-
log2(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
544
|
-
log2(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
545
|
-
log2("");
|
|
546
|
-
log2(" Inject SDK");
|
|
547
|
-
log2("");
|
|
572
|
+
printBanner("Inject SDK");
|
|
548
573
|
if (!detectProject()) {
|
|
549
574
|
log2(" Could not detect a TypeScript MCP server project.");
|
|
550
575
|
log2(" Make sure you are in a project directory with:");
|
|
@@ -625,9 +650,20 @@ async function main2() {
|
|
|
625
650
|
log2(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
626
651
|
log2("");
|
|
627
652
|
}
|
|
653
|
+
var c;
|
|
628
654
|
var init_inject = __esm({
|
|
629
655
|
"src/inject.ts"() {
|
|
630
656
|
"use strict";
|
|
657
|
+
c = {
|
|
658
|
+
reset: "\x1B[0m",
|
|
659
|
+
bold: "\x1B[1m",
|
|
660
|
+
dim: "\x1B[2m",
|
|
661
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
662
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
663
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
664
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
665
|
+
blue5: "\x1B[38;2;170;200;245m"
|
|
666
|
+
};
|
|
631
667
|
main2().catch((err) => {
|
|
632
668
|
log2(`Fatal: ${err instanceof Error ? err.message : String(err)}`);
|
|
633
669
|
process.exit(1);
|
|
@@ -826,20 +862,37 @@ dist/
|
|
|
826
862
|
`
|
|
827
863
|
);
|
|
828
864
|
}
|
|
865
|
+
function printBanner2(subtitle) {
|
|
866
|
+
const lines = [
|
|
867
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
868
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
869
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
870
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
871
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
872
|
+
];
|
|
873
|
+
const colors = [c2.blue1, c2.blue2, c2.blue3, c2.blue4, c2.blue5];
|
|
874
|
+
log3("");
|
|
875
|
+
for (let i = 0; i < lines.length; i++) {
|
|
876
|
+
log3(`${c2.bold}${colors[i]}${lines[i]}${c2.reset}`);
|
|
877
|
+
}
|
|
878
|
+
log3("");
|
|
879
|
+
log3(` ${c2.dim}${subtitle}${c2.reset}`);
|
|
880
|
+
log3("");
|
|
881
|
+
}
|
|
829
882
|
function withSpinner(message, fn) {
|
|
830
|
-
const frames = ["\
|
|
883
|
+
const frames = ["\u28FE", "\u28FD", "\u28FB", "\u28BF", "\u287F", "\u28DF", "\u28EF", "\u28F7"];
|
|
831
884
|
let i = 0;
|
|
832
885
|
const id = setInterval(() => {
|
|
833
|
-
process.stderr.write(`\r ${frames[i++ % frames.length]} ${message}`);
|
|
886
|
+
process.stderr.write(`\r ${c2.blue3}${frames[i++ % frames.length]}${c2.reset} ${message}`);
|
|
834
887
|
}, 80);
|
|
835
888
|
try {
|
|
836
889
|
fn();
|
|
837
890
|
clearInterval(id);
|
|
838
|
-
process.stderr.write(`\r \u2713 ${message}
|
|
891
|
+
process.stderr.write(`\r ${c2.green}\u2713${c2.reset} ${message}
|
|
839
892
|
`);
|
|
840
893
|
} catch {
|
|
841
894
|
clearInterval(id);
|
|
842
|
-
process.stderr.write(`\r \u2717 ${message} \u2014 failed
|
|
895
|
+
process.stderr.write(`\r ${c2.red}\u2717${c2.reset} ${message} \u2014 failed
|
|
843
896
|
`);
|
|
844
897
|
}
|
|
845
898
|
}
|
|
@@ -851,15 +904,7 @@ function installDeps(dir) {
|
|
|
851
904
|
async function main3() {
|
|
852
905
|
const opts = parseCreateArgs(process.argv);
|
|
853
906
|
const dir = resolve4(opts.name);
|
|
854
|
-
|
|
855
|
-
log3(" ____ _ ____ _");
|
|
856
|
-
log3(" / ___| ___ | | ___ _ __ / ___| __ _| |_ ___");
|
|
857
|
-
log3(" \\___ \\ / _ \\| |/ _ \\| '_ \\| | _ / _` | __/ _ \\");
|
|
858
|
-
log3(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
859
|
-
log3(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
860
|
-
log3("");
|
|
861
|
-
log3(" Create MCP Server");
|
|
862
|
-
log3("");
|
|
907
|
+
printBanner2("Create MCP Server");
|
|
863
908
|
if (existsSync4(dir)) {
|
|
864
909
|
log3(` Error: Directory "${opts.name}" already exists.`);
|
|
865
910
|
process.exit(1);
|
|
@@ -897,9 +942,25 @@ async function main3() {
|
|
|
897
942
|
log3(` \u2514${"\u2500".repeat(W + 2)}\u2518`);
|
|
898
943
|
log3("");
|
|
899
944
|
}
|
|
945
|
+
var c2;
|
|
900
946
|
var init_create = __esm({
|
|
901
947
|
"src/create.ts"() {
|
|
902
948
|
"use strict";
|
|
949
|
+
c2 = {
|
|
950
|
+
reset: "\x1B[0m",
|
|
951
|
+
bold: "\x1B[1m",
|
|
952
|
+
dim: "\x1B[2m",
|
|
953
|
+
white: "\x1B[97m",
|
|
954
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
955
|
+
// dark blue
|
|
956
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
957
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
958
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
959
|
+
blue5: "\x1B[38;2;170;200;245m",
|
|
960
|
+
// light blue → white
|
|
961
|
+
green: "\x1B[32m",
|
|
962
|
+
red: "\x1B[31m"
|
|
963
|
+
};
|
|
903
964
|
main3().catch((err) => {
|
|
904
965
|
log3(`Fatal: ${err instanceof Error ? err.message : String(err)}`);
|
|
905
966
|
process.exit(1);
|
package/dist/init.js
CHANGED
|
@@ -145,14 +145,30 @@ POLICY PRESETS
|
|
|
145
145
|
}
|
|
146
146
|
async function main() {
|
|
147
147
|
const options = parseInitArgs(process.argv);
|
|
148
|
+
const _c = {
|
|
149
|
+
reset: "\x1B[0m",
|
|
150
|
+
bold: "\x1B[1m",
|
|
151
|
+
dim: "\x1B[2m",
|
|
152
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
153
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
154
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
155
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
156
|
+
blue5: "\x1B[38;2;170;200;245m"
|
|
157
|
+
};
|
|
158
|
+
const bannerLines = [
|
|
159
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
160
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
161
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
162
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
163
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
164
|
+
];
|
|
165
|
+
const bannerColors = [_c.blue1, _c.blue2, _c.blue3, _c.blue4, _c.blue5];
|
|
148
166
|
console.error("");
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
console.error(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
153
|
-
console.error(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
167
|
+
for (let i = 0; i < bannerLines.length; i++) {
|
|
168
|
+
console.error(`${_c.bold}${bannerColors[i]}${bannerLines[i]}${_c.reset}`);
|
|
169
|
+
}
|
|
154
170
|
console.error("");
|
|
155
|
-
console.error(
|
|
171
|
+
console.error(` ${_c.dim}Init Setup${_c.reset}`);
|
|
156
172
|
console.error("");
|
|
157
173
|
const configInfo = findConfigFile(options.configPath);
|
|
158
174
|
if (!configInfo) {
|
package/dist/inject.js
CHANGED
|
@@ -61,6 +61,33 @@ WHAT IT DOES
|
|
|
61
61
|
function log(msg) {
|
|
62
62
|
process.stderr.write(msg + "\n");
|
|
63
63
|
}
|
|
64
|
+
var c = {
|
|
65
|
+
reset: "\x1B[0m",
|
|
66
|
+
bold: "\x1B[1m",
|
|
67
|
+
dim: "\x1B[2m",
|
|
68
|
+
blue1: "\x1B[38;2;30;64;175m",
|
|
69
|
+
blue2: "\x1B[38;2;50;100;200m",
|
|
70
|
+
blue3: "\x1B[38;2;80;140;220m",
|
|
71
|
+
blue4: "\x1B[38;2;120;170;235m",
|
|
72
|
+
blue5: "\x1B[38;2;170;200;245m"
|
|
73
|
+
};
|
|
74
|
+
function printBanner(subtitle) {
|
|
75
|
+
const lines = [
|
|
76
|
+
" ______ ______ __ ______ __ __ ______ ______ ______ ______ ",
|
|
77
|
+
'/\\ ___\\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ "-.\\ \\ /\\ ___\\ /\\ __ \\ /\\__ _\\ /\\ ___\\ ',
|
|
78
|
+
"\\ \\___ \\ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\/_/\\ \\/ \\ \\ __\\ ",
|
|
79
|
+
' \\/\\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\',
|
|
80
|
+
" \\/_____/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_____/"
|
|
81
|
+
];
|
|
82
|
+
const colors = [c.blue1, c.blue2, c.blue3, c.blue4, c.blue5];
|
|
83
|
+
log("");
|
|
84
|
+
for (let i = 0; i < lines.length; i++) {
|
|
85
|
+
log(`${c.bold}${colors[i]}${lines[i]}${c.reset}`);
|
|
86
|
+
}
|
|
87
|
+
log("");
|
|
88
|
+
log(` ${c.dim}${subtitle}${c.reset}`);
|
|
89
|
+
log("");
|
|
90
|
+
}
|
|
64
91
|
function detectProject() {
|
|
65
92
|
if (!existsSync(resolve("package.json"))) return false;
|
|
66
93
|
try {
|
|
@@ -96,8 +123,8 @@ function findTsEntryFile() {
|
|
|
96
123
|
"server.ts",
|
|
97
124
|
"main.ts"
|
|
98
125
|
];
|
|
99
|
-
for (const
|
|
100
|
-
const full = resolve(
|
|
126
|
+
for (const c2 of candidates) {
|
|
127
|
+
const full = resolve(c2);
|
|
101
128
|
if (existsSync(full)) {
|
|
102
129
|
try {
|
|
103
130
|
const content = readFileSync(full, "utf-8");
|
|
@@ -108,8 +135,8 @@ function findTsEntryFile() {
|
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
}
|
|
111
|
-
for (const
|
|
112
|
-
if (existsSync(resolve(
|
|
138
|
+
for (const c2 of candidates) {
|
|
139
|
+
if (existsSync(resolve(c2))) return resolve(c2);
|
|
113
140
|
}
|
|
114
141
|
return null;
|
|
115
142
|
}
|
|
@@ -247,15 +274,7 @@ function showDiff(result) {
|
|
|
247
274
|
}
|
|
248
275
|
async function main() {
|
|
249
276
|
const opts = parseInjectArgs(process.argv);
|
|
250
|
-
|
|
251
|
-
log(" ____ _ ____ _");
|
|
252
|
-
log(" / ___| ___ | | ___ _ __ / ___| __ _| |_ ___");
|
|
253
|
-
log(" \\___ \\ / _ \\| |/ _ \\| '_ \\| | _ / _` | __/ _ \\");
|
|
254
|
-
log(" ___) | (_) | | (_) | | | | |_| | (_| | || __/");
|
|
255
|
-
log(" |____/ \\___/|_|\\___/|_| |_|\\____|\\__,_|\\__\\___|");
|
|
256
|
-
log("");
|
|
257
|
-
log(" Inject SDK");
|
|
258
|
-
log("");
|
|
277
|
+
printBanner("Inject SDK");
|
|
259
278
|
if (!detectProject()) {
|
|
260
279
|
log(" Could not detect a TypeScript MCP server project.");
|
|
261
280
|
log(" Make sure you are in a project directory with:");
|
package/package.json
CHANGED