@julong/mono-rele2-utils 1.4.0 → 1.5.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 +19 -9
- package/dist/server.js +12 -7
- package/dist/skills/mono-rele2-utils/skill.md +6 -6
- package/package.json +2 -3
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
|
|
16
|
+
const server2 = new McpServer(config);
|
|
17
17
|
for (const tool of tools2) {
|
|
18
|
-
|
|
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
|
|
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
|
|
@@ -97,7 +101,7 @@ function renderExamples(binName, tools2) {
|
|
|
97
101
|
if (!tool.examples) continue;
|
|
98
102
|
for (const ex of tool.examples) {
|
|
99
103
|
const cmd = [binName, key, ...ex.args].join(" ");
|
|
100
|
-
lines.push(`- \`${cmd}\`
|
|
104
|
+
lines.push(`- \`${cmd}\` => \`${ex.result}\``);
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
return lines.join("\n");
|
|
@@ -163,17 +167,18 @@ function renderReadmeSkill(binName, key, tool) {
|
|
|
163
167
|
${lines.join("\n")}
|
|
164
168
|
\`\`\``;
|
|
165
169
|
}
|
|
170
|
+
const tableBlock = rows ? `
|
|
171
|
+
|
|
172
|
+
| arg | type | description |
|
|
173
|
+
|-----|------|-------------|
|
|
174
|
+
${rows}` : "";
|
|
166
175
|
return `#### \`${key}\`
|
|
167
176
|
|
|
168
177
|
${tool.description}.
|
|
169
178
|
|
|
170
179
|
\`\`\`sh
|
|
171
180
|
${usage}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
| arg | type | description |
|
|
175
|
-
|-----|------|-------------|
|
|
176
|
-
${rows}${exampleBlock}`;
|
|
181
|
+
\`\`\`${tableBlock}${exampleBlock}`;
|
|
177
182
|
}
|
|
178
183
|
function describeReadmeType(schema) {
|
|
179
184
|
let inner = schema;
|
|
@@ -287,6 +292,11 @@ function createUtilsServer() {
|
|
|
287
292
|
[cnTool, caseConvertTool, truncateTool]
|
|
288
293
|
);
|
|
289
294
|
}
|
|
295
|
+
var server = createUtilsServer();
|
|
296
|
+
startServer(server).catch((err) => {
|
|
297
|
+
console.error("[utils] server error:", err);
|
|
298
|
+
process.exit(1);
|
|
299
|
+
});
|
|
290
300
|
export {
|
|
291
301
|
cn,
|
|
292
302
|
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 server3 = new McpServer(config);
|
|
19
19
|
for (const tool of tools2) {
|
|
20
|
-
|
|
20
|
+
server3.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 server3;
|
|
28
28
|
}
|
|
29
|
-
async function startServer(
|
|
29
|
+
async function startServer(server3) {
|
|
30
30
|
const transport = new StdioServerTransport();
|
|
31
|
-
await
|
|
31
|
+
await server3.connect(transport);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// ../common/kit/cli.ts
|
|
@@ -117,10 +117,15 @@ function createUtilsServer() {
|
|
|
117
117
|
[cnTool, caseConvertTool, truncateTool]
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
// src/server.ts
|
|
122
120
|
var server = createUtilsServer();
|
|
123
121
|
startServer(server).catch((err) => {
|
|
124
122
|
console.error("[utils] server error:", err);
|
|
125
123
|
process.exit(1);
|
|
126
124
|
});
|
|
125
|
+
|
|
126
|
+
// src/server.ts
|
|
127
|
+
var server2 = createUtilsServer();
|
|
128
|
+
startServer(server2).catch((err) => {
|
|
129
|
+
console.error("[utils] server error:", err);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
});
|
|
@@ -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"]'`
|
|
44
|
-
- `mono-rele2-utils caseConvertTool "hello world" camel`
|
|
45
|
-
- `mono-rele2-utils caseConvertTool "helloWorld" snake`
|
|
46
|
-
- `mono-rele2-utils caseConvertTool "hello world" kebab`
|
|
47
|
-
- `mono-rele2-utils truncateTool "hello world long text" 10`
|
|
48
|
-
- `mono-rele2-utils truncateTool "hello world" 8 "…"`
|
|
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…`
|
|
49
49
|
|
|
50
50
|
## Guidelines
|
|
51
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsup",
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
|
-
"clean": "rimraf dist"
|
|
27
|
-
"update-readme": "node ../common/build/update-readme.mjs"
|
|
26
|
+
"clean": "rimraf dist"
|
|
28
27
|
},
|
|
29
28
|
"dependencies": {
|
|
30
29
|
"@modelcontextprotocol/sdk": "^1.29.0",
|