@julong/mono-rele2-utils 1.11.1 → 1.13.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 +8 -8
- package/dist/skills/mono-rele2-utils/skill.md +9 -48
- package/package.json +2 -2
- package/dist/server.js +0 -126
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
|
@@ -212,7 +212,7 @@ function describeReadmeDesc(schema) {
|
|
|
212
212
|
return baseDesc;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
// src/tools/
|
|
215
|
+
// src/tools/text.ts
|
|
216
216
|
import { z as z3 } from "zod";
|
|
217
217
|
|
|
218
218
|
// src/cn.ts
|
|
@@ -220,24 +220,24 @@ function cn(...classes) {
|
|
|
220
220
|
return classes.filter(Boolean).join(" ");
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
// src/tools/
|
|
223
|
+
// src/tools/text.ts
|
|
224
224
|
var tools = {
|
|
225
225
|
cnTool: toolDef({
|
|
226
226
|
name: "cn",
|
|
227
227
|
description: "Merges class names, filtering out falsy values",
|
|
228
|
-
inputSchema:
|
|
228
|
+
inputSchema: {
|
|
229
229
|
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
230
|
-
}
|
|
230
|
+
},
|
|
231
231
|
handler: async ({ classes }) => text(cn(...classes)),
|
|
232
232
|
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
233
233
|
}),
|
|
234
234
|
caseConvertTool: toolDef({
|
|
235
235
|
name: "case_convert",
|
|
236
236
|
description: "Converts text to the specified case format",
|
|
237
|
-
inputSchema:
|
|
237
|
+
inputSchema: {
|
|
238
238
|
input: z3.string().describe("Text to convert"),
|
|
239
239
|
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
240
|
-
}
|
|
240
|
+
},
|
|
241
241
|
handler: async ({ input, to }) => text(convert(input, to)),
|
|
242
242
|
examples: [
|
|
243
243
|
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
@@ -248,11 +248,11 @@ var tools = {
|
|
|
248
248
|
truncateTool: toolDef({
|
|
249
249
|
name: "truncate",
|
|
250
250
|
description: "Truncates text to a maximum length and appends a suffix",
|
|
251
|
-
inputSchema:
|
|
251
|
+
inputSchema: {
|
|
252
252
|
input: z3.string().describe("Text to truncate"),
|
|
253
253
|
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
254
254
|
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
255
|
-
}
|
|
255
|
+
},
|
|
256
256
|
handler: async ({ input, maxLength, suffix }) => {
|
|
257
257
|
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
258
258
|
return text(result);
|
|
@@ -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.13.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,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"mono-rele2-utils": "./dist/
|
|
14
|
+
"mono-rele2-utils": "./dist/index.js",
|
|
15
15
|
"mono-rele2-utils-cli": "./dist/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
package/dist/server.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// ../common/kit/tool.ts
|
|
4
|
-
function toolDef(def) {
|
|
5
|
-
return def;
|
|
6
|
-
}
|
|
7
|
-
function defineTool(tool) {
|
|
8
|
-
return tool;
|
|
9
|
-
}
|
|
10
|
-
function text(content) {
|
|
11
|
-
return { content: [{ type: "text", text: content }] };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// ../common/kit/server.ts
|
|
15
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
-
function createMcpServer(config, tools2) {
|
|
18
|
-
const server3 = new McpServer(config);
|
|
19
|
-
for (const tool of tools2) {
|
|
20
|
-
server3.registerTool(
|
|
21
|
-
tool.name,
|
|
22
|
-
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
tool.handler
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
return server3;
|
|
28
|
-
}
|
|
29
|
-
async function startServer(server3) {
|
|
30
|
-
const transport = new StdioServerTransport();
|
|
31
|
-
await server3.connect(transport);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// ../common/kit/cli.ts
|
|
35
|
-
import { z } from "zod";
|
|
36
|
-
|
|
37
|
-
// ../common/kit/skill.ts
|
|
38
|
-
import { z as z2 } from "zod";
|
|
39
|
-
|
|
40
|
-
// src/tools/index.ts
|
|
41
|
-
import { z as z3 } from "zod";
|
|
42
|
-
|
|
43
|
-
// src/cn.ts
|
|
44
|
-
function cn(...classes) {
|
|
45
|
-
return classes.filter(Boolean).join(" ");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/tools/index.ts
|
|
49
|
-
var tools = {
|
|
50
|
-
cnTool: toolDef({
|
|
51
|
-
name: "cn",
|
|
52
|
-
description: "Merges class names, filtering out falsy values",
|
|
53
|
-
inputSchema: z3.object({
|
|
54
|
-
classes: z3.array(z3.string()).describe("List of class names to merge")
|
|
55
|
-
}),
|
|
56
|
-
handler: async ({ classes }) => text(cn(...classes)),
|
|
57
|
-
examples: [{ args: [`'["btn","active","large"]'`], result: "btn active large" }]
|
|
58
|
-
}),
|
|
59
|
-
caseConvertTool: toolDef({
|
|
60
|
-
name: "case_convert",
|
|
61
|
-
description: "Converts text to the specified case format",
|
|
62
|
-
inputSchema: z3.object({
|
|
63
|
-
input: z3.string().describe("Text to convert"),
|
|
64
|
-
to: z3.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
65
|
-
}),
|
|
66
|
-
handler: async ({ input, to }) => text(convert(input, to)),
|
|
67
|
-
examples: [
|
|
68
|
-
{ args: [`"hello world"`, "camel"], result: "helloWorld" },
|
|
69
|
-
{ args: [`"helloWorld"`, "snake"], result: "hello_world" },
|
|
70
|
-
{ args: [`"hello world"`, "kebab"], result: "hello-world" }
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
truncateTool: toolDef({
|
|
74
|
-
name: "truncate",
|
|
75
|
-
description: "Truncates text to a maximum length and appends a suffix",
|
|
76
|
-
inputSchema: z3.object({
|
|
77
|
-
input: z3.string().describe("Text to truncate"),
|
|
78
|
-
maxLength: z3.number().int().positive().describe("Maximum character length"),
|
|
79
|
-
suffix: z3.string().default("...").describe("Suffix to append when truncated")
|
|
80
|
-
}),
|
|
81
|
-
handler: async ({ input, maxLength, suffix }) => {
|
|
82
|
-
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
83
|
-
return text(result);
|
|
84
|
-
},
|
|
85
|
-
examples: [
|
|
86
|
-
{ args: [`"hello world long text"`, "10"], result: "hello w..." },
|
|
87
|
-
{ args: [`"hello world"`, "8", `"\u2026"`], result: "hello w\u2026" }
|
|
88
|
-
]
|
|
89
|
-
})
|
|
90
|
-
};
|
|
91
|
-
var cnTool = defineTool(tools.cnTool);
|
|
92
|
-
var caseConvertTool = defineTool(tools.caseConvertTool);
|
|
93
|
-
var truncateTool = defineTool(tools.truncateTool);
|
|
94
|
-
function convert(input, to) {
|
|
95
|
-
switch (to) {
|
|
96
|
-
case "upper":
|
|
97
|
-
return input.toUpperCase();
|
|
98
|
-
case "lower":
|
|
99
|
-
return input.toLowerCase();
|
|
100
|
-
case "capitalize":
|
|
101
|
-
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
|
|
102
|
-
case "camel":
|
|
103
|
-
return input.replace(/[-_\s]+(.)/g, (_, c) => c.toUpperCase()).replace(/^(.)/, (c) => c.toLowerCase());
|
|
104
|
-
case "snake":
|
|
105
|
-
return input.replace(/([A-Z])/g, "_$1").replace(/[-\s]+/g, "_").toLowerCase().replace(/^_/, "");
|
|
106
|
-
case "kebab":
|
|
107
|
-
return input.replace(/([A-Z])/g, "-$1").replace(/[_\s]+/g, "-").toLowerCase().replace(/^-/, "");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// src/index.ts
|
|
112
|
-
function createUtilsServer() {
|
|
113
|
-
return createMcpServer({ name: "mono-rele2-utils", version: "1.0.0" }, [cnTool, caseConvertTool, truncateTool]);
|
|
114
|
-
}
|
|
115
|
-
var server = createUtilsServer();
|
|
116
|
-
startServer(server).catch((err) => {
|
|
117
|
-
console.error("[utils] server error:", err);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
});
|
|
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
|
-
});
|