@julong/mono-rele2-utils 1.2.0 → 1.3.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/README.md +98 -0
- package/dist/cli.js +131 -0
- package/dist/index.js +44 -36
- package/dist/mono-rele2-utils/skill.md +58 -0
- package/dist/server.js +44 -36
- package/package.json +7 -2
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @julong/mono-rele2-utils
|
|
2
|
+
|
|
3
|
+
Text utility tools for the mono-rele2 monorepo. Available as an MCP server and a standalone CLI.
|
|
4
|
+
|
|
5
|
+
## CLI
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g @julong/mono-rele2-utils
|
|
11
|
+
# or
|
|
12
|
+
npx @julong/mono-rele2-utils <skillName> [...args]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
mono-rele2-utils <skillName> [...args]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Run without arguments to list all available skills:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
mono-rele2-utils
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Available skills:
|
|
29
|
+
|
|
30
|
+
caseConvertTool
|
|
31
|
+
Converts text to the specified case format
|
|
32
|
+
input Text to convert
|
|
33
|
+
to Target case format
|
|
34
|
+
...
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Skills
|
|
38
|
+
|
|
39
|
+
#### `caseConvertTool`
|
|
40
|
+
|
|
41
|
+
Converts text to the specified case format.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
mono-rele2-utils caseConvertTool <input> <to>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| arg | type | description |
|
|
48
|
+
|-----|------|-------------|
|
|
49
|
+
| `input` | string | Text to convert |
|
|
50
|
+
| `to` | `upper` \| `lower` \| `capitalize` \| `camel` \| `snake` \| `kebab` | Target case format |
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
mono-rele2-utils caseConvertTool "hello world" camel # helloWorld
|
|
54
|
+
mono-rele2-utils caseConvertTool "helloWorld" snake # hello_world
|
|
55
|
+
mono-rele2-utils caseConvertTool "hello world" kebab # hello-world
|
|
56
|
+
mono-rele2-utils caseConvertTool "hello world" upper # HELLO WORLD
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### `cnTool`
|
|
60
|
+
|
|
61
|
+
Merges class names, filtering out falsy values.
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
mono-rele2-utils cnTool <classes>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| arg | type | description |
|
|
68
|
+
|-----|------|-------------|
|
|
69
|
+
| `classes` | JSON string (array) | Class names to merge |
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
mono-rele2-utils cnTool '["btn", "active", "large"]' # btn active large
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### `truncateTool`
|
|
76
|
+
|
|
77
|
+
Truncates text to a maximum length and appends a suffix.
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
mono-rele2-utils truncateTool <input> <maxLength> [suffix]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| arg | type | description |
|
|
84
|
+
|-----|------|-------------|
|
|
85
|
+
| `input` | string | Text to truncate |
|
|
86
|
+
| `maxLength` | number | Maximum character length |
|
|
87
|
+
| `suffix` | string | Suffix to append (default: `...`) |
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
mono-rele2-utils truncateTool "hello world long text" 10 # hello w...
|
|
91
|
+
mono-rele2-utils truncateTool "hello world" 8 "…" # hello w…
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## MCP Server
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
mcp-utils
|
|
98
|
+
```
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ../common/mcp/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/mcp/server.ts
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
|
|
18
|
+
// ../common/mcp/cli.ts
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
function formatSkills(tools2) {
|
|
21
|
+
const sections = Object.entries(tools2).map(([key, tool]) => {
|
|
22
|
+
const params = Object.entries(tool.inputSchema);
|
|
23
|
+
const maxLen = Math.max(...params.map(([f]) => f.length));
|
|
24
|
+
const paramLines = params.map(([field, schema]) => {
|
|
25
|
+
const desc = schema.description ?? "";
|
|
26
|
+
return ` ${field.padEnd(maxLen + 2)}${desc}`;
|
|
27
|
+
}).join("\n");
|
|
28
|
+
return ` ${key}
|
|
29
|
+
${tool.description}
|
|
30
|
+
${paramLines}`;
|
|
31
|
+
});
|
|
32
|
+
return "Available skills:\n\n" + sections.join("\n\n");
|
|
33
|
+
}
|
|
34
|
+
async function runCli(tools2) {
|
|
35
|
+
const [, , toolName, ...rawArgs] = process.argv;
|
|
36
|
+
if (!toolName || !(toolName in tools2)) {
|
|
37
|
+
if (toolName) console.error(`Unknown skill: "${toolName}"
|
|
38
|
+
`);
|
|
39
|
+
console.log(formatSkills(tools2));
|
|
40
|
+
process.exit(toolName ? 1 : 0);
|
|
41
|
+
}
|
|
42
|
+
const tool = tools2[toolName];
|
|
43
|
+
const fieldNames = Object.keys(tool.inputSchema);
|
|
44
|
+
const rawInput = {};
|
|
45
|
+
for (let i = 0; i < fieldNames.length; i++) {
|
|
46
|
+
const raw = rawArgs[i];
|
|
47
|
+
if (raw === void 0) continue;
|
|
48
|
+
try {
|
|
49
|
+
rawInput[fieldNames[i]] = JSON.parse(raw);
|
|
50
|
+
} catch {
|
|
51
|
+
rawInput[fieldNames[i]] = raw;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const parsed = z.object(tool.inputSchema).parse(rawInput);
|
|
55
|
+
const result = await tool.handler(parsed);
|
|
56
|
+
for (const part of result.content) {
|
|
57
|
+
if (part.type === "text") console.log(part.text);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function handleCliError(err) {
|
|
61
|
+
if (err instanceof z.ZodError) {
|
|
62
|
+
console.error("Validation error:", err.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join(", "));
|
|
63
|
+
} else {
|
|
64
|
+
console.error("Error:", err instanceof Error ? err.message : String(err));
|
|
65
|
+
}
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/tools/text.ts
|
|
70
|
+
import { z as z2 } from "zod";
|
|
71
|
+
|
|
72
|
+
// src/cn.ts
|
|
73
|
+
function cn(...classes) {
|
|
74
|
+
return classes.filter(Boolean).join(" ");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/tools/text.ts
|
|
78
|
+
var tools = {
|
|
79
|
+
cnTool: toolDef({
|
|
80
|
+
name: "cn",
|
|
81
|
+
description: "Merges class names, filtering out falsy values",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
classes: z2.array(z2.string()).describe("List of class names to merge")
|
|
84
|
+
},
|
|
85
|
+
handler: async ({ classes }) => text(cn(...classes))
|
|
86
|
+
}),
|
|
87
|
+
caseConvertTool: toolDef({
|
|
88
|
+
name: "case_convert",
|
|
89
|
+
description: "Converts text to the specified case format",
|
|
90
|
+
inputSchema: {
|
|
91
|
+
input: z2.string().describe("Text to convert"),
|
|
92
|
+
to: z2.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
93
|
+
},
|
|
94
|
+
handler: async ({ input, to }) => text(convert(input, to))
|
|
95
|
+
}),
|
|
96
|
+
truncateTool: toolDef({
|
|
97
|
+
name: "truncate",
|
|
98
|
+
description: "Truncates text to a maximum length and appends a suffix",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
input: z2.string().describe("Text to truncate"),
|
|
101
|
+
maxLength: z2.number().int().positive().describe("Maximum character length"),
|
|
102
|
+
suffix: z2.string().default("...").describe("Suffix to append when truncated")
|
|
103
|
+
},
|
|
104
|
+
handler: async ({ input, maxLength, suffix }) => {
|
|
105
|
+
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
106
|
+
return text(result);
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
var cnTool = defineTool(tools.cnTool);
|
|
111
|
+
var caseConvertTool = defineTool(tools.caseConvertTool);
|
|
112
|
+
var truncateTool = defineTool(tools.truncateTool);
|
|
113
|
+
function convert(input, to) {
|
|
114
|
+
switch (to) {
|
|
115
|
+
case "upper":
|
|
116
|
+
return input.toUpperCase();
|
|
117
|
+
case "lower":
|
|
118
|
+
return input.toLowerCase();
|
|
119
|
+
case "capitalize":
|
|
120
|
+
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
|
|
121
|
+
case "camel":
|
|
122
|
+
return input.replace(/[-_\s]+(.)/g, (_, c) => c.toUpperCase()).replace(/^(.)/, (c) => c.toLowerCase());
|
|
123
|
+
case "snake":
|
|
124
|
+
return input.replace(/([A-Z])/g, "_$1").replace(/[-\s]+/g, "_").toLowerCase().replace(/^_/, "");
|
|
125
|
+
case "kebab":
|
|
126
|
+
return input.replace(/([A-Z])/g, "-$1").replace(/[_\s]+/g, "-").toLowerCase().replace(/^-/, "");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// src/cli.ts
|
|
131
|
+
runCli(tools).catch(handleCliError);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// ../common/mcp/tool.ts
|
|
2
|
+
function toolDef(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
2
5
|
function defineTool(tool) {
|
|
3
6
|
return tool;
|
|
4
7
|
}
|
|
@@ -9,9 +12,9 @@ function text(content) {
|
|
|
9
12
|
// ../common/mcp/server.ts
|
|
10
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
14
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
|
-
function createMcpServer(config,
|
|
15
|
+
function createMcpServer(config, tools2) {
|
|
13
16
|
const server = new McpServer(config);
|
|
14
|
-
for (const tool of
|
|
17
|
+
for (const tool of tools2) {
|
|
15
18
|
server.registerTool(
|
|
16
19
|
tool.name,
|
|
17
20
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
@@ -22,48 +25,53 @@ function createMcpServer(config, tools) {
|
|
|
22
25
|
return server;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
//
|
|
28
|
+
// ../common/mcp/cli.ts
|
|
26
29
|
import { z } from "zod";
|
|
27
30
|
|
|
31
|
+
// src/tools/text.ts
|
|
32
|
+
import { z as z2 } from "zod";
|
|
33
|
+
|
|
28
34
|
// src/cn.ts
|
|
29
35
|
function cn(...classes) {
|
|
30
36
|
return classes.filter(Boolean).join(" ");
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
// src/tools/text.ts
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
40
|
+
var tools = {
|
|
41
|
+
cnTool: toolDef({
|
|
42
|
+
name: "cn",
|
|
43
|
+
description: "Merges class names, filtering out falsy values",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
classes: z2.array(z2.string()).describe("List of class names to merge")
|
|
46
|
+
},
|
|
47
|
+
handler: async ({ classes }) => text(cn(...classes))
|
|
48
|
+
}),
|
|
49
|
+
caseConvertTool: toolDef({
|
|
50
|
+
name: "case_convert",
|
|
51
|
+
description: "Converts text to the specified case format",
|
|
52
|
+
inputSchema: {
|
|
53
|
+
input: z2.string().describe("Text to convert"),
|
|
54
|
+
to: z2.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
55
|
+
},
|
|
56
|
+
handler: async ({ input, to }) => text(convert(input, to))
|
|
57
|
+
}),
|
|
58
|
+
truncateTool: toolDef({
|
|
59
|
+
name: "truncate",
|
|
60
|
+
description: "Truncates text to a maximum length and appends a suffix",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
input: z2.string().describe("Text to truncate"),
|
|
63
|
+
maxLength: z2.number().int().positive().describe("Maximum character length"),
|
|
64
|
+
suffix: z2.string().default("...").describe("Suffix to append when truncated")
|
|
65
|
+
},
|
|
66
|
+
handler: async ({ input, maxLength, suffix }) => {
|
|
67
|
+
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
68
|
+
return text(result);
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
var cnTool = defineTool(tools.cnTool);
|
|
73
|
+
var caseConvertTool = defineTool(tools.caseConvertTool);
|
|
74
|
+
var truncateTool = defineTool(tools.truncateTool);
|
|
67
75
|
function convert(input, to) {
|
|
68
76
|
switch (to) {
|
|
69
77
|
case "upper":
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mono-rele2-utils
|
|
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
|
+
---
|
|
5
|
+
|
|
6
|
+
# mono-rele2-utils
|
|
7
|
+
|
|
8
|
+
CLI for running text utility functions from the mono-rele2 package.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
mono-rele2-utils <skillName> [...args]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Skills
|
|
15
|
+
|
|
16
|
+
### caseConvertTool
|
|
17
|
+
|
|
18
|
+
Converts text to the specified case format.
|
|
19
|
+
|
|
20
|
+
| arg | description |
|
|
21
|
+
|-----|-------------|
|
|
22
|
+
| `input` | Text to convert |
|
|
23
|
+
| `to` | Target format: `upper` \| `lower` \| `capitalize` \| `camel` \| `snake` \| `kebab` |
|
|
24
|
+
|
|
25
|
+
### cnTool
|
|
26
|
+
|
|
27
|
+
Merges class names, filtering out falsy values.
|
|
28
|
+
|
|
29
|
+
| arg | description |
|
|
30
|
+
|-----|-------------|
|
|
31
|
+
| `classes` | JSON array of class name strings, e.g. `'["btn","active"]'` |
|
|
32
|
+
|
|
33
|
+
### truncateTool
|
|
34
|
+
|
|
35
|
+
Truncates text to a maximum length and appends a suffix.
|
|
36
|
+
|
|
37
|
+
| arg | description |
|
|
38
|
+
|-----|-------------|
|
|
39
|
+
| `input` | Text to truncate |
|
|
40
|
+
| `maxLength` | Maximum character length |
|
|
41
|
+
| `suffix` | Suffix to append when truncated (default: `...`) |
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
- `mono-rele2-utils caseConvertTool "hello world" camel` → `helloWorld`
|
|
46
|
+
- `mono-rele2-utils caseConvertTool "helloWorld" snake` → `hello_world`
|
|
47
|
+
- `mono-rele2-utils caseConvertTool "hello world" kebab` → `hello-world`
|
|
48
|
+
- `mono-rele2-utils truncateTool "hello world long text" 10` → `hello w...`
|
|
49
|
+
- `mono-rele2-utils truncateTool "hello world" 8 "…"` → `hello w…`
|
|
50
|
+
- `mono-rele2-utils cnTool '["btn","active","large"]'` → `btn active large`
|
|
51
|
+
|
|
52
|
+
## Guidelines
|
|
53
|
+
|
|
54
|
+
- Arguments are positional — pass them in the order listed in each skill's table
|
|
55
|
+
- Numeric args (e.g. `maxLength`) are auto-parsed — pass as plain numbers: `10`
|
|
56
|
+
- Array args (e.g. `classes`) must be valid JSON — wrap in single quotes on Unix shells
|
|
57
|
+
- Optional args with defaults (e.g. `suffix`) may be omitted
|
|
58
|
+
- Run `mono-rele2-utils` with no args to list all available skills
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// ../common/mcp/tool.ts
|
|
4
|
+
function toolDef(def) {
|
|
5
|
+
return def;
|
|
6
|
+
}
|
|
4
7
|
function defineTool(tool) {
|
|
5
8
|
return tool;
|
|
6
9
|
}
|
|
@@ -11,9 +14,9 @@ function text(content) {
|
|
|
11
14
|
// ../common/mcp/server.ts
|
|
12
15
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
-
function createMcpServer(config,
|
|
17
|
+
function createMcpServer(config, tools2) {
|
|
15
18
|
const server2 = new McpServer(config);
|
|
16
|
-
for (const tool of
|
|
19
|
+
for (const tool of tools2) {
|
|
17
20
|
server2.registerTool(
|
|
18
21
|
tool.name,
|
|
19
22
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
@@ -28,48 +31,53 @@ async function startServer(server2) {
|
|
|
28
31
|
await server2.connect(transport);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
//
|
|
34
|
+
// ../common/mcp/cli.ts
|
|
32
35
|
import { z } from "zod";
|
|
33
36
|
|
|
37
|
+
// src/tools/text.ts
|
|
38
|
+
import { z as z2 } from "zod";
|
|
39
|
+
|
|
34
40
|
// src/cn.ts
|
|
35
41
|
function cn(...classes) {
|
|
36
42
|
return classes.filter(Boolean).join(" ");
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
// src/tools/text.ts
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
var tools = {
|
|
47
|
+
cnTool: toolDef({
|
|
48
|
+
name: "cn",
|
|
49
|
+
description: "Merges class names, filtering out falsy values",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
classes: z2.array(z2.string()).describe("List of class names to merge")
|
|
52
|
+
},
|
|
53
|
+
handler: async ({ classes }) => text(cn(...classes))
|
|
54
|
+
}),
|
|
55
|
+
caseConvertTool: toolDef({
|
|
56
|
+
name: "case_convert",
|
|
57
|
+
description: "Converts text to the specified case format",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
input: z2.string().describe("Text to convert"),
|
|
60
|
+
to: z2.enum(["upper", "lower", "capitalize", "camel", "snake", "kebab"]).describe("Target case format")
|
|
61
|
+
},
|
|
62
|
+
handler: async ({ input, to }) => text(convert(input, to))
|
|
63
|
+
}),
|
|
64
|
+
truncateTool: toolDef({
|
|
65
|
+
name: "truncate",
|
|
66
|
+
description: "Truncates text to a maximum length and appends a suffix",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
input: z2.string().describe("Text to truncate"),
|
|
69
|
+
maxLength: z2.number().int().positive().describe("Maximum character length"),
|
|
70
|
+
suffix: z2.string().default("...").describe("Suffix to append when truncated")
|
|
71
|
+
},
|
|
72
|
+
handler: async ({ input, maxLength, suffix }) => {
|
|
73
|
+
const result = input.length <= maxLength ? input : input.slice(0, maxLength - suffix.length) + suffix;
|
|
74
|
+
return text(result);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
var cnTool = defineTool(tools.cnTool);
|
|
79
|
+
var caseConvertTool = defineTool(tools.caseConvertTool);
|
|
80
|
+
var truncateTool = defineTool(tools.truncateTool);
|
|
73
81
|
function convert(input, to) {
|
|
74
82
|
switch (to) {
|
|
75
83
|
case "upper":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"mcp-utils": "./dist/server.js"
|
|
13
|
+
"mcp-utils": "./dist/server.js",
|
|
14
|
+
"mono-rele2-utils": "./dist/cli.js"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"dist"
|
|
@@ -22,5 +23,9 @@
|
|
|
22
23
|
"build": "tsup",
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
25
|
"clean": "rimraf dist"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
29
|
+
"zod": "^4.4.2"
|
|
25
30
|
}
|
|
26
31
|
}
|