@julong/mono-rele2-utils 1.11.1 → 1.12.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 +10 -9
- package/dist/index.d.ts +12 -12
- package/dist/index.js +11 -20
- package/dist/server.js +15 -20
- package/dist/skills/mono-rele2-utils/skill.md +9 -48
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32,7 +32,8 @@ ${paramLines}`;
|
|
|
32
32
|
return "Available skills:\n\n" + sections.join("\n\n");
|
|
33
33
|
}
|
|
34
34
|
async function runCli(tools2) {
|
|
35
|
-
const [, , toolName, ...rawArgs] = process.argv;
|
|
35
|
+
const [, , cliName, toolName, ...rawArgs] = process.argv;
|
|
36
|
+
console.log(process.argv);
|
|
36
37
|
if (!toolName || !(toolName in tools2)) {
|
|
37
38
|
if (toolName) console.error(`Unknown skill: "${toolName}"
|
|
38
39
|
`);
|
|
@@ -69,7 +70,7 @@ function handleCliError(err) {
|
|
|
69
70
|
// ../common/kit/skill.ts
|
|
70
71
|
import { z as z2 } from "zod";
|
|
71
72
|
|
|
72
|
-
// src/tools/
|
|
73
|
+
// src/tools/text.ts
|
|
73
74
|
import { z as z3 } from "zod";
|
|
74
75
|
|
|
75
76
|
// src/cn.ts
|
|
@@ -77,24 +78,24 @@ function cn(...classes) {
|
|
|
77
78
|
return classes.filter(Boolean).join(" ");
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
// src/tools/
|
|
81
|
+
// src/tools/text.ts
|
|
81
82
|
var tools = {
|
|
82
83
|
cnTool: toolDef({
|
|
83
84
|
name: "cn",
|
|
84
85
|
description: "Merges class names, filtering out falsy values",
|
|
85
|
-
inputSchema:
|
|
86
|
+
inputSchema: {
|
|
86
87
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
87
|
-
}
|
|
88
|
+
},
|
|
88
89
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
89
90
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
90
91
|
}),
|
|
91
92
|
caseConvertTool: toolDef({
|
|
92
93
|
name: "case_convert",
|
|
93
94
|
description: "Converts text to the specified case format",
|
|
94
|
-
inputSchema:
|
|
95
|
+
inputSchema: {
|
|
95
96
|
input: z3.string().describe("Text to convert"),
|
|
96
97
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
97
|
-
}
|
|
98
|
+
},
|
|
98
99
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
99
100
|
examples: [
|
|
100
101
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -105,11 +106,11 @@ var tools = {
|
|
|
105
106
|
truncateTool: toolDef({
|
|
106
107
|
name: "truncate",
|
|
107
108
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
108
|
-
inputSchema:
|
|
109
|
+
inputSchema: {
|
|
109
110
|
input: z3.string().describe("Text to truncate"),
|
|
110
111
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
111
112
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
112
|
-
}
|
|
113
|
+
},
|
|
113
114
|
handler: async ({ input, maxLength, suffix }) => {
|
|
114
115
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
115
116
|
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
|
-
classes: z.ZodArray<z.ZodString>;
|
|
38
|
-
}
|
|
36
|
+
inputSchema: {
|
|
37
|
+
readonly classes: z.ZodArray<z.ZodString>;
|
|
38
|
+
};
|
|
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
|
-
input: z.ZodString;
|
|
50
|
-
to: z.ZodEnum<{
|
|
48
|
+
inputSchema: {
|
|
49
|
+
readonly input: z.ZodString;
|
|
50
|
+
readonly 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
|
+
};
|
|
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
|
-
input: z.ZodString;
|
|
71
|
-
maxLength: z.ZodNumber;
|
|
72
|
-
suffix: z.ZodDefault<z.ZodString>;
|
|
73
|
-
}
|
|
69
|
+
inputSchema: {
|
|
70
|
+
readonly input: z.ZodString;
|
|
71
|
+
readonly maxLength: z.ZodNumber;
|
|
72
|
+
readonly suffix: z.ZodDefault<z.ZodString>;
|
|
73
|
+
};
|
|
74
74
|
handler: (input: {
|
|
75
75
|
input: string;
|
|
76
76
|
maxLength: number;
|
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/text.ts
|
|
216
212
|
import { z as z3 } from "zod";
|
|
217
213
|
|
|
218
214
|
// src/cn.ts
|
|
@@ -220,24 +216,24 @@ function cn(...classes) {
|
|
|
220
216
|
return classes.filter(Boolean).join(" ");
|
|
221
217
|
}
|
|
222
218
|
|
|
223
|
-
// src/tools/
|
|
219
|
+
// src/tools/text.ts
|
|
224
220
|
var tools = {
|
|
225
221
|
cnTool: toolDef({
|
|
226
222
|
name: "cn",
|
|
227
223
|
description: "Merges class names, filtering out falsy values",
|
|
228
|
-
inputSchema:
|
|
224
|
+
inputSchema: {
|
|
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
228
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
233
229
|
}),
|
|
234
230
|
caseConvertTool: toolDef({
|
|
235
231
|
name: "case_convert",
|
|
236
232
|
description: "Converts text to the specified case format",
|
|
237
|
-
inputSchema:
|
|
233
|
+
inputSchema: {
|
|
238
234
|
input: z3.string().describe("Text to convert"),
|
|
239
235
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
240
|
-
}
|
|
236
|
+
},
|
|
241
237
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
242
238
|
examples: [
|
|
243
239
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -248,11 +244,11 @@ var tools = {
|
|
|
248
244
|
truncateTool: toolDef({
|
|
249
245
|
name: "truncate",
|
|
250
246
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
251
|
-
inputSchema:
|
|
247
|
+
inputSchema: {
|
|
252
248
|
input: z3.string().describe("Text to truncate"),
|
|
253
249
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
254
250
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
255
|
-
}
|
|
251
|
+
},
|
|
256
252
|
handler: async ({ input, maxLength, suffix }) => {
|
|
257
253
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
258
254
|
return text(result);
|
|
@@ -287,11 +283,6 @@ function convert(input, to) {
|
|
|
287
283
|
function createUtilsServer() {
|
|
288
284
|
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
289
285
|
}
|
|
290
|
-
var server = createUtilsServer();
|
|
291
|
-
startServer(server).catch((err) => {
|
|
292
|
-
console.error("[utils] server error:", err);
|
|
293
|
-
process.exit(1);
|
|
294
|
-
});
|
|
295
286
|
export {
|
|
296
287
|
cn,
|
|
297
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/text.ts
|
|
41
41
|
import { z as z3 } from "zod";
|
|
42
42
|
|
|
43
43
|
// src/cn.ts
|
|
@@ -45,24 +45,24 @@ function cn(...classes) {
|
|
|
45
45
|
return classes.filter(Boolean).join(" ");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// src/tools/
|
|
48
|
+
// src/tools/text.ts
|
|
49
49
|
var tools = {
|
|
50
50
|
cnTool: toolDef({
|
|
51
51
|
name: "cn",
|
|
52
52
|
description: "Merges class names, filtering out falsy values",
|
|
53
|
-
inputSchema:
|
|
53
|
+
inputSchema: {
|
|
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: {
|
|
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: {
|
|
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,15 +112,10 @@ 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
|
-
var server = createUtilsServer();
|
|
116
|
-
startServer(server).catch((err) => {
|
|
117
|
-
console.error("[utils] server error:", err);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
});
|
|
120
115
|
|
|
121
116
|
// src/server.ts
|
|
122
|
-
var
|
|
123
|
-
startServer(
|
|
117
|
+
var server = createUtilsServer();
|
|
118
|
+
startServer(server).catch((err) => {
|
|
124
119
|
console.error("[utils] server error:", err);
|
|
125
120
|
process.exit(1);
|
|
126
121
|
});
|
|
@@ -17,22 +17,7 @@ Merges class names, filtering out falsy values
|
|
|
17
17
|
|
|
18
18
|
| arg | description |
|
|
19
19
|
|-----|-------------|
|
|
20
|
-
| `
|
|
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` | |
|
|
20
|
+
| `classes` | List of class names to merge |
|
|
36
21
|
|
|
37
22
|
### caseConvertTool
|
|
38
23
|
|
|
@@ -40,22 +25,8 @@ Converts text to the specified case format
|
|
|
40
25
|
|
|
41
26
|
| arg | description |
|
|
42
27
|
|-----|-------------|
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
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` | |
|
|
28
|
+
| `input` | Text to convert |
|
|
29
|
+
| `to` | Target case format — `upper` \| `lower` \| `capitalize` \| `camel` \| `snake` \| `kebab` |
|
|
59
30
|
|
|
60
31
|
### truncateTool
|
|
61
32
|
|
|
@@ -63,22 +34,9 @@ Truncates text to a maximum length and appends a suffix
|
|
|
63
34
|
|
|
64
35
|
| arg | description |
|
|
65
36
|
|-----|-------------|
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
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` | |
|
|
37
|
+
| `input` | Text to truncate |
|
|
38
|
+
| `maxLength` | Maximum character length |
|
|
39
|
+
| `suffix` | Suffix to append when truncated — default: `...` |
|
|
82
40
|
|
|
83
41
|
## Examples
|
|
84
42
|
|
|
@@ -92,4 +50,7 @@ Truncates text to a maximum length and appends a suffix
|
|
|
92
50
|
## Guidelines
|
|
93
51
|
|
|
94
52
|
- 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
|
|
95
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.12.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",
|