@julong/mono-rele2-utils 1.8.0 → 1.10.0
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/cli.js +4 -7
- package/dist/index.js +7 -21
- package/dist/server.js +11 -21
- package/dist/skills/{mono-rele2-utils-cli → mono-rele2-utils}/skill.md +10 -10
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -32,8 +32,7 @@ ${paramLines}`;
|
|
|
32
32
|
return "Available skills:\n\n" + sections.join("\n\n");
|
|
33
33
|
}
|
|
34
34
|
async function runCli(tools2) {
|
|
35
|
-
const [, ,
|
|
36
|
-
console.log(process.argv);
|
|
35
|
+
const [, , toolName, ...rawArgs] = process.argv;
|
|
37
36
|
if (!toolName || !(toolName in tools2)) {
|
|
38
37
|
if (toolName) console.error(`Unknown skill: "${toolName}"
|
|
39
38
|
`);
|
|
@@ -70,7 +69,7 @@ function handleCliError(err) {
|
|
|
70
69
|
// ../common/kit/skill.ts
|
|
71
70
|
import { z as z2 } from "zod";
|
|
72
71
|
|
|
73
|
-
// src/tools/
|
|
72
|
+
// src/tools/index.ts
|
|
74
73
|
import { z as z3 } from "zod";
|
|
75
74
|
|
|
76
75
|
// src/cn.ts
|
|
@@ -78,7 +77,7 @@ function cn(...classes) {
|
|
|
78
77
|
return classes.filter(Boolean).join(" ");
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
// src/tools/
|
|
80
|
+
// src/tools/index.ts
|
|
82
81
|
var tools = {
|
|
83
82
|
cnTool: toolDef({
|
|
84
83
|
name: "cn",
|
|
@@ -87,9 +86,7 @@ var tools = {
|
|
|
87
86
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
88
87
|
},
|
|
89
88
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
90
|
-
examples: [
|
|
91
|
-
{ args: [`'["btn","active","large"]'`], result: "btn active large" }
|
|
92
|
-
]
|
|
89
|
+
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
93
90
|
}),
|
|
94
91
|
caseConvertTool: toolDef({
|
|
95
92
|
name: "case_convert",
|
package/dist/index.js
CHANGED
|
@@ -13,20 +13,16 @@ function text(content) {
|
|
|
13
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
14
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
15
15
|
function createMcpServer(config, tools2) {
|
|
16
|
-
const
|
|
16
|
+
const server = new McpServer(config);
|
|
17
17
|
for (const tool of tools2) {
|
|
18
|
-
|
|
18
|
+
server.registerTool(
|
|
19
19
|
tool.name,
|
|
20
20
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
22
|
tool.handler
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
async function startServer(server2) {
|
|
28
|
-
const transport = new StdioServerTransport();
|
|
29
|
-
await server2.connect(transport);
|
|
25
|
+
return server;
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
// ../common/kit/cli.ts
|
|
@@ -212,7 +208,7 @@ function describeReadmeDesc(schema) {
|
|
|
212
208
|
return baseDesc;
|
|
213
209
|
}
|
|
214
210
|
|
|
215
|
-
// src/tools/
|
|
211
|
+
// src/tools/index.ts
|
|
216
212
|
import { z as z3 } from "zod";
|
|
217
213
|
|
|
218
214
|
// src/cn.ts
|
|
@@ -220,7 +216,7 @@ function cn(...classes) {
|
|
|
220
216
|
return classes.filter(Boolean).join(" ");
|
|
221
217
|
}
|
|
222
218
|
|
|
223
|
-
// src/tools/
|
|
219
|
+
// src/tools/index.ts
|
|
224
220
|
var tools = {
|
|
225
221
|
cnTool: toolDef({
|
|
226
222
|
name: "cn",
|
|
@@ -229,9 +225,7 @@ var tools = {
|
|
|
229
225
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
230
226
|
},
|
|
231
227
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
232
|
-
examples: [
|
|
233
|
-
{ args: [`'["btn","active","large"]'`], result: "btn active large" }
|
|
234
|
-
]
|
|
228
|
+
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
235
229
|
}),
|
|
236
230
|
caseConvertTool: toolDef({
|
|
237
231
|
name: "case_convert",
|
|
@@ -287,16 +281,8 @@ function convert(input, to) {
|
|
|
287
281
|
|
|
288
282
|
// src/index.ts
|
|
289
283
|
function createUtilsServer() {
|
|
290
|
-
return createMcpServer(
|
|
291
|
-
{ name: "mono-rele2-utils", version: "1.0.0" },
|
|
292
|
-
[cnTool, caseConvertTool, truncateTool]
|
|
293
|
-
);
|
|
284
|
+
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
294
285
|
}
|
|
295
|
-
var server = createUtilsServer();
|
|
296
|
-
startServer(server).catch((err) => {
|
|
297
|
-
console.error("[utils] server error:", err);
|
|
298
|
-
process.exit(1);
|
|
299
|
-
});
|
|
300
286
|
export {
|
|
301
287
|
cn,
|
|
302
288
|
createUtilsServer,
|
package/dist/server.js
CHANGED
|
@@ -15,20 +15,20 @@ function text(content) {
|
|
|
15
15
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
17
|
function createMcpServer(config, tools2) {
|
|
18
|
-
const
|
|
18
|
+
const server2 = new McpServer(config);
|
|
19
19
|
for (const tool of tools2) {
|
|
20
|
-
|
|
20
|
+
server2.registerTool(
|
|
21
21
|
tool.name,
|
|
22
22
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
24
|
tool.handler
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return server2;
|
|
28
28
|
}
|
|
29
|
-
async function startServer(
|
|
29
|
+
async function startServer(server2) {
|
|
30
30
|
const transport = new StdioServerTransport();
|
|
31
|
-
await
|
|
31
|
+
await server2.connect(transport);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// ../common/kit/cli.ts
|
|
@@ -37,7 +37,7 @@ import { z } from "zod";
|
|
|
37
37
|
// ../common/kit/skill.ts
|
|
38
38
|
import { z as z2 } from "zod";
|
|
39
39
|
|
|
40
|
-
// src/tools/
|
|
40
|
+
// src/tools/index.ts
|
|
41
41
|
import { z as z3 } from "zod";
|
|
42
42
|
|
|
43
43
|
// src/cn.ts
|
|
@@ -45,7 +45,7 @@ function cn(...classes) {
|
|
|
45
45
|
return classes.filter(Boolean).join(" ");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// src/tools/
|
|
48
|
+
// src/tools/index.ts
|
|
49
49
|
var tools = {
|
|
50
50
|
cnTool: toolDef({
|
|
51
51
|
name: "cn",
|
|
@@ -54,9 +54,7 @@ var tools = {
|
|
|
54
54
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
55
55
|
},
|
|
56
56
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
57
|
-
examples: [
|
|
58
|
-
{ args: [`'["btn","active","large"]'`], result: "btn active large" }
|
|
59
|
-
]
|
|
57
|
+
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
60
58
|
}),
|
|
61
59
|
caseConvertTool: toolDef({
|
|
62
60
|
name: "case_convert",
|
|
@@ -112,20 +110,12 @@ function convert(input, to) {
|
|
|
112
110
|
|
|
113
111
|
// src/index.ts
|
|
114
112
|
function createUtilsServer() {
|
|
115
|
-
return createMcpServer(
|
|
116
|
-
{ name: "mono-rele2-utils", version: "1.0.0" },
|
|
117
|
-
[cnTool, caseConvertTool, truncateTool]
|
|
118
|
-
);
|
|
113
|
+
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
119
114
|
}
|
|
120
|
-
var server = createUtilsServer();
|
|
121
|
-
startServer(server).catch((err) => {
|
|
122
|
-
console.error("[utils] server error:", err);
|
|
123
|
-
process.exit(1);
|
|
124
|
-
});
|
|
125
115
|
|
|
126
116
|
// src/server.ts
|
|
127
|
-
var
|
|
128
|
-
startServer(
|
|
117
|
+
var server = createUtilsServer();
|
|
118
|
+
startServer(server).catch((err) => {
|
|
129
119
|
console.error("[utils] server error:", err);
|
|
130
120
|
process.exit(1);
|
|
131
121
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: mono-rele2-utils
|
|
2
|
+
name: mono-rele2-utils
|
|
3
3
|
description: Use this skill to invoke text utility functions via the mono-rele2-utils CLI. Handles class name merging, case conversion, and text truncation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# mono-rele2-utils
|
|
6
|
+
# mono-rele2-utils
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
mono-rele2-utils
|
|
9
|
+
mono-rele2-utils <skillName> [...args]
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Skills
|
|
@@ -40,12 +40,12 @@ Truncates text to a maximum length and appends a suffix
|
|
|
40
40
|
|
|
41
41
|
## Examples
|
|
42
42
|
|
|
43
|
-
- `mono-rele2-utils
|
|
44
|
-
- `mono-rele2-utils
|
|
45
|
-
- `mono-rele2-utils
|
|
46
|
-
- `mono-rele2-utils
|
|
47
|
-
- `mono-rele2-utils
|
|
48
|
-
- `mono-rele2-utils
|
|
43
|
+
- `mono-rele2-utils cnTool '["btn","active","large"]'` => `btn active large`
|
|
44
|
+
- `mono-rele2-utils caseConvertTool "hello world" camel` => `helloWorld`
|
|
45
|
+
- `mono-rele2-utils caseConvertTool "helloWorld" snake` => `hello_world`
|
|
46
|
+
- `mono-rele2-utils caseConvertTool "hello world" kebab` => `hello-world`
|
|
47
|
+
- `mono-rele2-utils truncateTool "hello world long text" 10` => `hello w...`
|
|
48
|
+
- `mono-rele2-utils truncateTool "hello world" 8 "…"` => `hello w…`
|
|
49
49
|
|
|
50
50
|
## Guidelines
|
|
51
51
|
|
|
@@ -53,4 +53,4 @@ Truncates text to a maximum length and appends a suffix
|
|
|
53
53
|
- Numeric args are auto-parsed — pass as plain numbers (e.g. `10`)
|
|
54
54
|
- Array args must be valid JSON — wrap in single quotes on Unix shells (e.g. `'["a","b"]'`)
|
|
55
55
|
- Optional args with defaults may be omitted
|
|
56
|
-
- Run `mono-rele2-utils
|
|
56
|
+
- Run `mono-rele2-utils` with no args to list all available skills
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Use this skill to invoke text utility functions via the mono-rele2-utils CLI. Handles class name merging, case conversion, and text truncation.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"
|
|
15
|
-
"mono-rele2-utils
|
|
14
|
+
"mcp-utils": "./dist/server.js",
|
|
15
|
+
"mono-rele2-utils": "./dist/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|