@julong/mono-rele2-utils 1.13.0 → 1.15.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/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 server2 = new McpServer(config);
16
+ const server = new McpServer(config);
17
17
  for (const tool of tools2) {
18
- server2.registerTool(
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 server2;
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
@@ -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 ADDED
@@ -0,0 +1,121 @@
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 server2 = new McpServer(config);
19
+ for (const tool of tools2) {
20
+ server2.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 server2;
28
+ }
29
+ async function startServer(server2) {
30
+ const transport = new StdioServerTransport();
31
+ await server2.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/text.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/text.ts
49
+ var tools = {
50
+ cnTool: toolDef({
51
+ name: "cn",
52
+ description: "Merges class names, filtering out falsy values",
53
+ inputSchema: {
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: {
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: {
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
+
116
+ // src/server.ts
117
+ var server = createUtilsServer();
118
+ startServer(server).catch((err) => {
119
+ console.error("[utils] server error:", err);
120
+ process.exit(1);
121
+ });
@@ -1,12 +1,12 @@
1
1
  ---
2
- name: mono-rele2-utils
2
+ name: mono-rele2-utils-cli
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-cli
7
7
 
8
8
  ```sh
9
- mono-rele2-utils <skillName> [...args]
9
+ mono-rele2-utils-cli <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 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…`
43
+ - `mono-rele2-utils-cli cnTool '["btn","active","large"]'` => `btn active large`
44
+ - `mono-rele2-utils-cli caseConvertTool "hello world" camel` => `helloWorld`
45
+ - `mono-rele2-utils-cli caseConvertTool "helloWorld" snake` => `hello_world`
46
+ - `mono-rele2-utils-cli caseConvertTool "hello world" kebab` => `hello-world`
47
+ - `mono-rele2-utils-cli truncateTool "hello world long text" 10` => `hello w...`
48
+ - `mono-rele2-utils-cli 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` with no args to list all available skills
56
+ - Run `mono-rele2-utils-cli` 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.13.0",
3
+ "version": "1.15.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/index.js",
14
+ "mono-rele2-utils": "./dist/server.js",
15
15
  "mono-rele2-utils-cli": "./dist/cli.js"
16
16
  },
17
17
  "files": [