@julong/mono-rele2-utils 1.12.0 → 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/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 server = new McpServer(config);
16
+ const server2 = new McpServer(config);
17
17
  for (const tool of tools2) {
18
- server.registerTool(
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 server;
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
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julong/mono-rele2-utils",
3
- "version": "1.12.0",
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/server.js",
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,121 +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 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
- });