neuxnbcp 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/banner.d.ts +1 -1
- package/dist/banner.js +14 -18
- package/dist/index.js +20 -12
- package/package.json +2 -1
package/dist/banner.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const shouldShowBanner: (command: string | undefined, stream?: Pick<NodeJS.WriteStream, "isTTY">) => boolean;
|
|
2
|
-
export declare const renderNbcpBanner: (
|
|
2
|
+
export declare const renderNbcpBanner: (_stream?: Pick<NodeJS.WriteStream, "isTTY">) => string;
|
package/dist/banner.js
CHANGED
|
@@ -5,18 +5,9 @@ const LOGO_LINES = [
|
|
|
5
5
|
'NN NNN EE U U XX XX SS BB B OO OO TTT ',
|
|
6
6
|
'NN NN EEEEEEE UUUUU XX XX SSSSS BBBBB OOOOO TTT ',
|
|
7
7
|
];
|
|
8
|
+
const SUBTITLE_LINE = 'NEUXSBOT 彩票 MCP 命令行';
|
|
8
9
|
const WEBSITE_LINE = 'www.neuxsbot.com';
|
|
9
|
-
const
|
|
10
|
-
const SHADOW_COLOR = '\x1b[38;2;20;47;75m';
|
|
11
|
-
const FOREGROUND_COLORS = [
|
|
12
|
-
'\x1b[38;2;222;244;255m',
|
|
13
|
-
'\x1b[38;2;189;228;255m',
|
|
14
|
-
'\x1b[38;2;153;212;255m',
|
|
15
|
-
'\x1b[38;2;120;194;248m',
|
|
16
|
-
'\x1b[38;2;90;175;240m',
|
|
17
|
-
];
|
|
18
|
-
const WEBSITE_COLOR = '\x1b[38;2;199;231;255m';
|
|
19
|
-
const colorize = (value, color, enabled) => enabled ? `${color}${value}${ANSI_RESET}` : value;
|
|
10
|
+
const shadowify = (value) => value.replace(/[^\s]/g, '.');
|
|
20
11
|
const centerText = (value, width) => {
|
|
21
12
|
const padding = Math.max(0, Math.floor((width - value.length) / 2));
|
|
22
13
|
return `${' '.repeat(padding)}${value}`;
|
|
@@ -33,13 +24,18 @@ export const shouldShowBanner = (command, stream = process.stdout) => {
|
|
|
33
24
|
}
|
|
34
25
|
return Boolean(stream.isTTY);
|
|
35
26
|
};
|
|
36
|
-
export const renderNbcpBanner = (
|
|
37
|
-
const
|
|
38
|
-
(process.env.FORCE_COLOR === '1' || process.env.NBCP_FORCE_BANNER === '1' || Boolean(stream.isTTY));
|
|
39
|
-
const maxWidth = Math.max(...LOGO_LINES.map((line) => line.length));
|
|
27
|
+
export const renderNbcpBanner = (_stream = process.stdout) => {
|
|
28
|
+
const maxWidth = Math.max(...LOGO_LINES.map((line) => line.length), SUBTITLE_LINE.length, WEBSITE_LINE.length);
|
|
40
29
|
const renderedLines = LOGO_LINES.flatMap((line, index) => [
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
` ${shadowify(line)}`,
|
|
31
|
+
line,
|
|
43
32
|
]);
|
|
44
|
-
return [
|
|
33
|
+
return [
|
|
34
|
+
'',
|
|
35
|
+
...renderedLines,
|
|
36
|
+
'',
|
|
37
|
+
centerText(SUBTITLE_LINE, maxWidth),
|
|
38
|
+
centerText(WEBSITE_LINE, maxWidth),
|
|
39
|
+
'',
|
|
40
|
+
].join('\n');
|
|
45
41
|
};
|
package/dist/index.js
CHANGED
|
@@ -7,21 +7,29 @@ const LOTTERY_MCP_TOOLS = [
|
|
|
7
7
|
'lottery.summary',
|
|
8
8
|
];
|
|
9
9
|
const MCP_SERVER_TRANSPORT = 'stdio';
|
|
10
|
-
const HELP_TEXT =
|
|
10
|
+
const HELP_TEXT = `临时运行:
|
|
11
|
+
npx --yes neuxnbcp@latest --help
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
全局安装:
|
|
14
|
+
npm i -g neuxnbcp
|
|
15
|
+
|
|
16
|
+
安装完成后:
|
|
17
|
+
nbcp --help
|
|
18
|
+
|
|
19
|
+
使用方法:
|
|
13
20
|
nbcp <command>
|
|
14
21
|
nbcp --help
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
serve
|
|
18
|
-
init
|
|
19
|
-
doctor
|
|
20
|
-
login
|
|
23
|
+
可用命令:
|
|
24
|
+
serve 启动 MCP stdio 服务
|
|
25
|
+
init 生成本地配置文件
|
|
26
|
+
doctor 检查本地配置与网站连通性
|
|
27
|
+
login 打开网站 Token 页面
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
当前版本:
|
|
30
|
+
官网: www.neuxsbot.com
|
|
31
|
+
传输方式: ${MCP_SERVER_TRANSPORT}
|
|
32
|
+
工具列表: ${LOTTERY_MCP_TOOLS.join(', ')}
|
|
25
33
|
`;
|
|
26
34
|
const args = process.argv.slice(2);
|
|
27
35
|
const command = args[0];
|
|
@@ -33,9 +41,9 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
33
41
|
process.exit(0);
|
|
34
42
|
}
|
|
35
43
|
if (['serve', 'init', 'doctor', 'login'].includes(command)) {
|
|
36
|
-
console.log(
|
|
44
|
+
console.log(`命令 "${command}" 已预留,下一阶段接入实际功能。`);
|
|
37
45
|
process.exit(0);
|
|
38
46
|
}
|
|
39
|
-
console.error(
|
|
47
|
+
console.error(`未知命令: ${command}`);
|
|
40
48
|
console.log(HELP_TEXT);
|
|
41
49
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuxnbcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "NEUXSBOT lottery MCP command line entrypoint",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"bin": {
|
|
14
|
+
"neuxnbcp": "dist/index.js",
|
|
14
15
|
"nbcp": "dist/index.js"
|
|
15
16
|
},
|
|
16
17
|
"scripts": {
|