@julong/mono-rele2-utils 1.10.1 → 1.11.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/dist/cli.js +6 -6
- package/dist/index.d.ts +12 -12
- package/dist/index.js +18 -9
- package/dist/server.js +18 -16
- package/dist/skills/mono-rele2-utils/skill.md +48 -9
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -82,19 +82,19 @@ var tools = {
|
|
|
82
82
|
cnTool: toolDef({
|
|
83
83
|
name: "cn",
|
|
84
84
|
description: "Merges class names, filtering out falsy values",
|
|
85
|
-
inputSchema: {
|
|
85
|
+
inputSchema: z3.object({
|
|
86
86
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
87
|
-
},
|
|
87
|
+
}),
|
|
88
88
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
89
89
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
90
90
|
}),
|
|
91
91
|
caseConvertTool: toolDef({
|
|
92
92
|
name: "case_convert",
|
|
93
93
|
description: "Converts text to the specified case format",
|
|
94
|
-
inputSchema: {
|
|
94
|
+
inputSchema: z3.object({
|
|
95
95
|
input: z3.string().describe("Text to convert"),
|
|
96
96
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
97
|
-
},
|
|
97
|
+
}),
|
|
98
98
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
99
99
|
examples: [
|
|
100
100
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -105,11 +105,11 @@ var tools = {
|
|
|
105
105
|
truncateTool: toolDef({
|
|
106
106
|
name: "truncate",
|
|
107
107
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
108
|
-
inputSchema: {
|
|
108
|
+
inputSchema: z3.object({
|
|
109
109
|
input: z3.string().describe("Text to truncate"),
|
|
110
110
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
111
111
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
112
|
-
},
|
|
112
|
+
}),
|
|
113
113
|
handler: async ({ input, maxLength, suffix }) => {
|
|
114
114
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
115
115
|
return text(result);
|
package/dist/index.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ declare const tools: {
|
|
|
33
33
|
cnTool: {
|
|
34
34
|
name: string;
|
|
35
35
|
description: string;
|
|
36
|
-
inputSchema: {
|
|
37
|
-
|
|
38
|
-
}
|
|
36
|
+
inputSchema: z.ZodObject<{
|
|
37
|
+
classes: z.ZodArray<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
39
|
handler: (input: {
|
|
40
40
|
classes: string[];
|
|
41
41
|
}) => Promise<ToolResult>;
|
|
@@ -45,9 +45,9 @@ declare const tools: {
|
|
|
45
45
|
caseConvertTool: {
|
|
46
46
|
name: string;
|
|
47
47
|
description: string;
|
|
48
|
-
inputSchema: {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
inputSchema: z.ZodObject<{
|
|
49
|
+
input: z.ZodString;
|
|
50
|
+
to: z.ZodEnum<{
|
|
51
51
|
upper: "upper";
|
|
52
52
|
lower: "lower";
|
|
53
53
|
capitalize: "capitalize";
|
|
@@ -55,7 +55,7 @@ declare const tools: {
|
|
|
55
55
|
snake: "snake";
|
|
56
56
|
kebab: "kebab";
|
|
57
57
|
}>;
|
|
58
|
-
}
|
|
58
|
+
}, z.core.$strip>;
|
|
59
59
|
handler: (input: {
|
|
60
60
|
input: string;
|
|
61
61
|
to: "upper" | "lower" | "capitalize" | "camel" | "snake" | "kebab";
|
|
@@ -66,11 +66,11 @@ declare const tools: {
|
|
|
66
66
|
truncateTool: {
|
|
67
67
|
name: string;
|
|
68
68
|
description: string;
|
|
69
|
-
inputSchema: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
69
|
+
inputSchema: z.ZodObject<{
|
|
70
|
+
input: z.ZodString;
|
|
71
|
+
maxLength: z.ZodNumber;
|
|
72
|
+
suffix: z.ZodDefault<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
74
|
handler: (input: {
|
|
75
75
|
input: string;
|
|
76
76
|
maxLength: number;
|
package/dist/index.js
CHANGED
|
@@ -13,16 +13,20 @@ 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 server2 = new McpServer(config);
|
|
17
17
|
for (const tool of tools2) {
|
|
18
|
-
|
|
18
|
+
server2.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
|
|
25
|
+
return server2;
|
|
26
|
+
}
|
|
27
|
+
async function startServer(server2) {
|
|
28
|
+
const transport = new StdioServerTransport();
|
|
29
|
+
await server2.connect(transport);
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
// ../common/kit/cli.ts
|
|
@@ -221,19 +225,19 @@ var tools = {
|
|
|
221
225
|
cnTool: toolDef({
|
|
222
226
|
name: "cn",
|
|
223
227
|
description: "Merges class names, filtering out falsy values",
|
|
224
|
-
inputSchema: {
|
|
228
|
+
inputSchema: z3.object({
|
|
225
229
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
226
|
-
},
|
|
230
|
+
}),
|
|
227
231
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
228
232
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
229
233
|
}),
|
|
230
234
|
caseConvertTool: toolDef({
|
|
231
235
|
name: "case_convert",
|
|
232
236
|
description: "Converts text to the specified case format",
|
|
233
|
-
inputSchema: {
|
|
237
|
+
inputSchema: z3.object({
|
|
234
238
|
input: z3.string().describe("Text to convert"),
|
|
235
239
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
236
|
-
},
|
|
240
|
+
}),
|
|
237
241
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
238
242
|
examples: [
|
|
239
243
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -244,11 +248,11 @@ var tools = {
|
|
|
244
248
|
truncateTool: toolDef({
|
|
245
249
|
name: "truncate",
|
|
246
250
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
247
|
-
inputSchema: {
|
|
251
|
+
inputSchema: z3.object({
|
|
248
252
|
input: z3.string().describe("Text to truncate"),
|
|
249
253
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
250
254
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
251
|
-
},
|
|
255
|
+
}),
|
|
252
256
|
handler: async ({ input, maxLength, suffix }) => {
|
|
253
257
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
254
258
|
return text(result);
|
|
@@ -283,6 +287,11 @@ function convert(input, to) {
|
|
|
283
287
|
function createUtilsServer() {
|
|
284
288
|
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
285
289
|
}
|
|
290
|
+
var server = createUtilsServer();
|
|
291
|
+
startServer(server).catch((err) => {
|
|
292
|
+
console.error("[utils] server error:", err);
|
|
293
|
+
process.exit(1);
|
|
294
|
+
});
|
|
286
295
|
export {
|
|
287
296
|
cn,
|
|
288
297
|
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 server3 = new McpServer(config);
|
|
19
19
|
for (const tool of tools2) {
|
|
20
|
-
|
|
20
|
+
server3.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 server3;
|
|
28
28
|
}
|
|
29
|
-
async function startServer(
|
|
29
|
+
async function startServer(server3) {
|
|
30
30
|
const transport = new StdioServerTransport();
|
|
31
|
-
await
|
|
31
|
+
await server3.connect(transport);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// ../common/kit/cli.ts
|
|
@@ -50,19 +50,19 @@ var tools = {
|
|
|
50
50
|
cnTool: toolDef({
|
|
51
51
|
name: "cn",
|
|
52
52
|
description: "Merges class names, filtering out falsy values",
|
|
53
|
-
inputSchema: {
|
|
53
|
+
inputSchema: z3.object({
|
|
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
57
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
58
58
|
}),
|
|
59
59
|
caseConvertTool: toolDef({
|
|
60
60
|
name: "case_convert",
|
|
61
61
|
description: "Converts text to the specified case format",
|
|
62
|
-
inputSchema: {
|
|
62
|
+
inputSchema: z3.object({
|
|
63
63
|
input: z3.string().describe("Text to convert"),
|
|
64
64
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
65
|
-
},
|
|
65
|
+
}),
|
|
66
66
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
67
67
|
examples: [
|
|
68
68
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -73,11 +73,11 @@ var tools = {
|
|
|
73
73
|
truncateTool: toolDef({
|
|
74
74
|
name: "truncate",
|
|
75
75
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
76
|
-
inputSchema: {
|
|
76
|
+
inputSchema: z3.object({
|
|
77
77
|
input: z3.string().describe("Text to truncate"),
|
|
78
78
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
79
79
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
80
|
-
},
|
|
80
|
+
}),
|
|
81
81
|
handler: async ({ input, maxLength, suffix }) => {
|
|
82
82
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
83
83
|
return text(result);
|
|
@@ -112,13 +112,15 @@ function convert(input, to) {
|
|
|
112
112
|
function createUtilsServer() {
|
|
113
113
|
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
// src/server.ts
|
|
117
115
|
var server = createUtilsServer();
|
|
118
116
|
startServer(server).catch((err) => {
|
|
119
117
|
console.error("[utils] server error:", err);
|
|
120
118
|
process.exit(1);
|
|
121
119
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
|
|
121
|
+
// src/server.ts
|
|
122
|
+
var server2 = createUtilsServer();
|
|
123
|
+
startServer(server2).catch((err) => {
|
|
124
|
+
console.error("[utils] server error:", err);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
});
|
|
@@ -17,7 +17,22 @@ Merges class names, filtering out falsy values
|
|
|
17
17
|
|
|
18
18
|
| arg | description |
|
|
19
19
|
|-----|-------------|
|
|
20
|
-
| `
|
|
20
|
+
| `toJSONSchema` | |
|
|
21
|
+
| `def` | |
|
|
22
|
+
| `type` | |
|
|
23
|
+
| `parse` | |
|
|
24
|
+
| `safeParse` | |
|
|
25
|
+
| `parseAsync` | |
|
|
26
|
+
| `safeParseAsync` | |
|
|
27
|
+
| `spa` | |
|
|
28
|
+
| `encode` | |
|
|
29
|
+
| `decode` | |
|
|
30
|
+
| `encodeAsync` | |
|
|
31
|
+
| `decodeAsync` | |
|
|
32
|
+
| `safeEncode` | |
|
|
33
|
+
| `safeDecode` | |
|
|
34
|
+
| `safeEncodeAsync` | |
|
|
35
|
+
| `safeDecodeAsync` | |
|
|
21
36
|
|
|
22
37
|
### caseConvertTool
|
|
23
38
|
|
|
@@ -25,8 +40,22 @@ Converts text to the specified case format
|
|
|
25
40
|
|
|
26
41
|
| arg | description |
|
|
27
42
|
|-----|-------------|
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
43
|
+
| `toJSONSchema` | |
|
|
44
|
+
| `def` | |
|
|
45
|
+
| `type` | |
|
|
46
|
+
| `parse` | |
|
|
47
|
+
| `safeParse` | |
|
|
48
|
+
| `parseAsync` | |
|
|
49
|
+
| `safeParseAsync` | |
|
|
50
|
+
| `spa` | |
|
|
51
|
+
| `encode` | |
|
|
52
|
+
| `decode` | |
|
|
53
|
+
| `encodeAsync` | |
|
|
54
|
+
| `decodeAsync` | |
|
|
55
|
+
| `safeEncode` | |
|
|
56
|
+
| `safeDecode` | |
|
|
57
|
+
| `safeEncodeAsync` | |
|
|
58
|
+
| `safeDecodeAsync` | |
|
|
30
59
|
|
|
31
60
|
### truncateTool
|
|
32
61
|
|
|
@@ -34,9 +63,22 @@ Truncates text to a maximum length and appends a suffix
|
|
|
34
63
|
|
|
35
64
|
| arg | description |
|
|
36
65
|
|-----|-------------|
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
66
|
+
| `toJSONSchema` | |
|
|
67
|
+
| `def` | |
|
|
68
|
+
| `type` | |
|
|
69
|
+
| `parse` | |
|
|
70
|
+
| `safeParse` | |
|
|
71
|
+
| `parseAsync` | |
|
|
72
|
+
| `safeParseAsync` | |
|
|
73
|
+
| `spa` | |
|
|
74
|
+
| `encode` | |
|
|
75
|
+
| `decode` | |
|
|
76
|
+
| `encodeAsync` | |
|
|
77
|
+
| `decodeAsync` | |
|
|
78
|
+
| `safeEncode` | |
|
|
79
|
+
| `safeDecode` | |
|
|
80
|
+
| `safeEncodeAsync` | |
|
|
81
|
+
| `safeDecodeAsync` | |
|
|
40
82
|
|
|
41
83
|
## Examples
|
|
42
84
|
|
|
@@ -50,7 +92,4 @@ Truncates text to a maximum length and appends a suffix
|
|
|
50
92
|
## Guidelines
|
|
51
93
|
|
|
52
94
|
- Arguments are positional — pass them in the order listed in each skill's table
|
|
53
|
-
- Numeric args are auto-parsed — pass as plain numbers (e.g. `10`)
|
|
54
|
-
- Array args must be valid JSON — wrap in single quotes on Unix shells (e.g. `'["a","b"]'`)
|
|
55
|
-
- Optional args with defaults may be omitted
|
|
56
95
|
- 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.11.1",
|
|
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": "./dist/cli.js"
|
|
14
|
+
"mono-rele2-utils": "./dist/server.js",
|
|
15
|
+
"mono-rele2-utils-cli": "./dist/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|