@julong/mono-rele2-core 1.18.0 → 1.20.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/README.md +2 -2
- package/dist/cli.js +2 -9
- package/dist/index.d.ts +22 -0
- package/dist/index.js +30 -19
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,13 +18,13 @@ npx @julong/mono-rele2-core-cli <toolName> [...args]
|
|
|
18
18
|
mono-rele2-core-cli <toolName> [...args]
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Run without arguments to list all available
|
|
21
|
+
Run without arguments to list all available tools:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
mono-rele2-core-cli
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Tools
|
|
28
28
|
|
|
29
29
|
#### `echoTool`
|
|
30
30
|
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
`+Object.entries(e).map(([c,t])=>{let s=Object.entries(t.inputSchema),i=Math.max(...s.map(([a])=>a.length)),u=s.map(([a,o])=>{let l=o.description??"";return` ${a.padEnd(i+2)}${l}`}).join(`
|
|
5
|
-
`);return` ${c}
|
|
6
|
-
${t.description}
|
|
7
|
-
${u}`}).join(`
|
|
8
|
-
|
|
9
|
-
`)}async function m(e){let[,,n,...c]=process.argv;console.log(process.argv),(!n||!(n in e))&&(n&&console.error(`Unknown skill: "${n}"
|
|
10
|
-
`),console.log(y(e)),process.exit(n?1:0));let t=e[n],s=Object.keys(t.inputSchema),i={};for(let o=0;o<s.length;o++){let l=c[o];if(l!==void 0)try{i[s[o]]=JSON.parse(l)}catch{i[s[o]]=l}}let u=f.object(t.inputSchema).parse(i),a=await t.handler(u);for(let o of a.content)o.type==="text"&&console.log(o.text)}function g(e){e instanceof f.ZodError?console.error("Validation error:",e.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join(", ")):console.error("Error:",e instanceof Error?e.message:String(e)),process.exit(1)}import{z as j}from"zod";import{z as d}from"zod";import{randomUUID as T}from"crypto";var r={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:d.string().describe("Message to echo")},handler:async({message:e})=>p(e),examples:[{args:['"hello world"'],result:"hello world"}]},timestampTool:{name:"timestamp",description:"Returns the current UTC timestamp",inputSchema:{format:d.enum(["iso","unix"]).default("iso").describe("Timestamp format")},handler:async({format:e})=>{let n=e==="unix"?String(Date.now()):new Date().toISOString();return p(n)},examples:[{args:[],result:"2026-05-02T00:00:00.000Z"},{args:["unix"],result:"1746144000000"}]},envTool:{name:"env",description:"Returns the value of an environment variable",inputSchema:{key:d.string().describe("Environment variable name")},handler:async({key:e})=>p(process.env[e]??""),examples:[{args:["HOME"],result:"/Users/julong"},{args:["NODE_ENV"],result:"development"}],guidelines:["`envTool` returns an empty string when the variable is not set"]},uuidTool:{name:"uuid",description:"Generates a random UUID v4",inputSchema:{},handler:async()=>p(T()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},L=r.echoTool,q=r.timestampTool,F=r.envTool,H=r.uuidTool;m(r).catch(g);
|
|
2
|
+
function s(e){return{content:[{type:"text",text:e}]}}import{McpServer as S}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as $}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as c}from"zod";async function u(e){let[,,n,...f]=process.argv;(!n||!(n in e))&&(n&&console.error(`Unknown skill: "${n}"
|
|
3
|
+
`),process.exit(n?1:0));let r=e[n],i=Object.keys(r.inputSchema),a={};for(let o=0;o<i.length;o++){let l=f[o];if(l!==void 0)try{a[i[o]]=JSON.parse(l)}catch{a[i[o]]=l}}let m=c.object(r.inputSchema).parse(a),y=await r.handler(m);for(let o of y.content)o.type==="text"&&console.log(o.text)}function d(e){e instanceof c.ZodError?console.error("Validation error:",e.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join(", ")):console.error("Error:",e instanceof Error?e.message:String(e)),process.exit(1)}import{z as A}from"zod";import{z as p}from"zod";import{randomUUID as g}from"crypto";var t={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:p.string().describe("Message to echo")},handler:async({message:e})=>s(e),examples:[{args:['"hello world"'],result:"hello world"}]},timestampTool:{name:"timestamp",description:"Returns the current UTC timestamp",inputSchema:{format:p.enum(["iso","unix"]).default("iso").describe("Timestamp format")},handler:async({format:e})=>{let n=e==="unix"?String(Date.now()):new Date().toISOString();return s(n)},examples:[{args:[],result:"2026-05-02T00:00:00.000Z"},{args:["unix"],result:"1746144000000"}]},envTool:{name:"env",description:"Returns the value of an environment variable",inputSchema:{key:p.string().describe("Environment variable name")},handler:async({key:e})=>s(process.env[e]??""),examples:[{args:["HOME"],result:"/Users/julong"},{args:["NODE_ENV"],result:"development"}],guidelines:["`envTool` returns an empty string when the variable is not set"]},uuidTool:{name:"uuid",description:"Generates a random UUID v4",inputSchema:{},handler:async()=>s(g()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},L=t.echoTool,G=t.timestampTool,K=t.envTool,q=t.uuidTool;u(t).catch(d);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ type AnyToolDef = {
|
|
|
13
13
|
handler: (args: any) => Promise<ToolResult>;
|
|
14
14
|
examples?: ToolExample[];
|
|
15
15
|
guidelines?: string[];
|
|
16
|
+
typeLabels?: Record<string, string>;
|
|
17
|
+
typeDefs?: Record<string, string>;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
type SkillTools = Record<string, AnyToolDef>;
|
|
@@ -38,6 +40,12 @@ declare const tools: {
|
|
|
38
40
|
}) => Promise<ToolResult>;
|
|
39
41
|
examples?: ToolExample[];
|
|
40
42
|
guidelines?: string[];
|
|
43
|
+
typeLabels?: {
|
|
44
|
+
readonly message?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
typeDefs?: {
|
|
47
|
+
readonly message?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
41
49
|
};
|
|
42
50
|
timestampTool: {
|
|
43
51
|
name: string;
|
|
@@ -53,6 +61,12 @@ declare const tools: {
|
|
|
53
61
|
}) => Promise<ToolResult>;
|
|
54
62
|
examples?: ToolExample[];
|
|
55
63
|
guidelines?: string[];
|
|
64
|
+
typeLabels?: {
|
|
65
|
+
readonly format?: string | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
typeDefs?: {
|
|
68
|
+
readonly format?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
56
70
|
};
|
|
57
71
|
envTool: {
|
|
58
72
|
name: string;
|
|
@@ -65,6 +79,12 @@ declare const tools: {
|
|
|
65
79
|
}) => Promise<ToolResult>;
|
|
66
80
|
examples?: ToolExample[];
|
|
67
81
|
guidelines?: string[];
|
|
82
|
+
typeLabels?: {
|
|
83
|
+
readonly key?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
typeDefs?: {
|
|
86
|
+
readonly key?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
68
88
|
};
|
|
69
89
|
uuidTool: {
|
|
70
90
|
name: string;
|
|
@@ -73,6 +93,8 @@ declare const tools: {
|
|
|
73
93
|
handler: (input: Record<string, never>) => Promise<ToolResult>;
|
|
74
94
|
examples?: ToolExample[];
|
|
75
95
|
guidelines?: string[];
|
|
96
|
+
typeLabels?: {} | undefined;
|
|
97
|
+
typeDefs?: {} | undefined;
|
|
76
98
|
};
|
|
77
99
|
};
|
|
78
100
|
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,63 @@
|
|
|
1
|
-
function
|
|
2
|
-
name: ${
|
|
1
|
+
function f(s){return{content:[{type:"text",text:s}]}}import{McpServer as V}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as P}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as L}from"zod";import{z as r}from"zod";function $(s){let{binName:o,description:e,tools:t}=s;return`---
|
|
2
|
+
name: ${o}
|
|
3
3
|
description: ${e}
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# ${
|
|
6
|
+
# ${o}
|
|
7
7
|
|
|
8
8
|
\`\`\`sh
|
|
9
|
-
${
|
|
9
|
+
${o} <toolName> [...args]
|
|
10
10
|
\`\`\`
|
|
11
11
|
|
|
12
12
|
## Skills
|
|
13
13
|
|
|
14
|
-
${
|
|
14
|
+
${b(t)}
|
|
15
15
|
|
|
16
16
|
## Examples
|
|
17
17
|
|
|
18
|
-
${z(
|
|
18
|
+
${z(o,t)}
|
|
19
19
|
|
|
20
20
|
## Guidelines
|
|
21
21
|
|
|
22
|
-
${
|
|
23
|
-
`}function
|
|
24
|
-
`)
|
|
22
|
+
${j(o,t)}
|
|
23
|
+
`}function b(s){return Object.entries(s).map(([o,e])=>{let t=Object.entries(e.inputSchema).map(([a,n])=>{let l=e.typeLabels?.[a];return`| \`${a}\` | ${w(n,l)} |`}).join(`
|
|
24
|
+
`),i=e.typeDefs?Object.entries(e.typeDefs).map(([a,n])=>`
|
|
25
|
+
|
|
26
|
+
**\`${a}\`** type definition:
|
|
27
|
+
\`\`\`typescript
|
|
28
|
+
${n}
|
|
29
|
+
\`\`\``).join(""):"";return`### ${o}
|
|
25
30
|
|
|
26
31
|
${e.description}
|
|
27
32
|
|
|
28
33
|
| arg | description |
|
|
29
34
|
|-----|-------------|
|
|
30
|
-
${
|
|
35
|
+
${t}${i}`}).join(`
|
|
31
36
|
|
|
32
|
-
`)}function w(o){let
|
|
33
|
-
`)}function
|
|
34
|
-
`)}function
|
|
37
|
+
`)}function w(s,o){let e=s.description??"",t=s,i,a=!1;for(;t instanceof r.ZodOptional||t instanceof r.ZodDefault;){if(t instanceof r.ZodDefault){let l=t.def.defaultValue;i=typeof l=="function"?l():l}t instanceof r.ZodOptional&&(a=!0),t=t.unwrap()}let n=[];if(o&&n.push(`Type: ${o}`),e&&n.push(e),t instanceof r.ZodEnum){let l=t.options.map(m=>`\`${m}\``).join(" \\| ");n.push(l)}return i!==void 0?n.push(`default: \`${String(i)}\``):a&&n.push("optional"),n.join(" \u2014 ")}function z(s,o){let e=[];for(let[t,i]of Object.entries(o))if(i.examples)for(let a of i.examples){let n=[s,t,...a.args].join(" ");e.push(`- \`${n}\` => \`${a.result}\``)}return e.join(`
|
|
38
|
+
`)}function j(s,o){let e=[],t=new Set,i=n=>{t.has(n)||(t.add(n),e.push(n))};i("Arguments are positional \u2014 pass them in the order listed in each skill's table");let a=Object.values(o).flatMap(n=>Object.values(n.inputSchema));a.some(n=>h(n,r.ZodNumber))&&i("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)"),a.some(n=>h(n,r.ZodArray))&&i('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)'),a.some(n=>n instanceof r.ZodOptional||n instanceof r.ZodDefault)&&i("Optional args with defaults may be omitted");for(let n of Object.values(o))if(n.guidelines)for(let l of n.guidelines)i(l);return i(`Run \`${s}\` with no args to list all available skills`),e.map(n=>`- ${n}`).join(`
|
|
39
|
+
`)}function h(s,o){let e=s;for(;e instanceof r.ZodOptional||e instanceof r.ZodDefault;)e=e.unwrap();return e instanceof o}function A(s){let{binName:o,tools:e}=s;return Object.entries(e).map(([t,i])=>D(o,t,i)).join(`
|
|
35
40
|
|
|
36
|
-
`)}function
|
|
37
|
-
`),l=e.examples??[],
|
|
41
|
+
`)}function D(s,o,e){let t=Object.entries(e.inputSchema),i=t.map(([p,c])=>c instanceof r.ZodOptional||c instanceof r.ZodDefault?`[${p}]`:`<${p}>`).join(" "),a=[s,o,i].filter(Boolean).join(" "),n=t.map(([p,c])=>{let y=e.typeLabels?.[p],u=S(c,y),g=O(c);return`| \`${p}\` | ${u} | ${g} |`}).join(`
|
|
42
|
+
`),l=e.examples??[],m="";if(l.length>0){let p=l.map(u=>[s,o,...u.args].join(" ")),c=Math.max(...p.map(u=>u.length));m=`
|
|
38
43
|
|
|
39
44
|
\`\`\`sh
|
|
40
|
-
${l.map((u,
|
|
45
|
+
${l.map((u,g)=>`${p[g].padEnd(c)} # ${u.result}`).join(`
|
|
41
46
|
`)}
|
|
42
|
-
\`\`\``}let
|
|
47
|
+
\`\`\``}let Z=e.typeDefs?Object.entries(e.typeDefs).map(([p,c])=>`
|
|
48
|
+
|
|
49
|
+
**\`${p}\`** type definition:
|
|
50
|
+
|
|
51
|
+
\`\`\`typescript
|
|
52
|
+
${c}
|
|
53
|
+
\`\`\``).join(""):"",x=n?`
|
|
43
54
|
|
|
44
55
|
| arg | type | description |
|
|
45
56
|
|-----|------|-------------|
|
|
46
|
-
${
|
|
57
|
+
${n}`:"";return`#### \`${o}\`
|
|
47
58
|
|
|
48
59
|
${e.description}.
|
|
49
60
|
|
|
50
61
|
\`\`\`sh
|
|
51
62
|
${a}
|
|
52
|
-
\`\`\`${
|
|
63
|
+
\`\`\`${x}${Z}${m}`}function S(s,o){if(o)return o;let e=s;for(;e instanceof r.ZodOptional||e instanceof r.ZodDefault;)e=e.unwrap();return e instanceof r.ZodEnum?e.options.map(t=>`\`${t}\``).join(" \\| "):e instanceof r.ZodNumber?"number":e instanceof r.ZodString?"string":e instanceof r.ZodBoolean?"boolean":e instanceof r.ZodArray?"JSON string (array)":e instanceof r.ZodUnion?e.options.map(i=>S(i)).join(" \\| "):e instanceof r.ZodRecord?"JSON object":"unknown"}function O(s){let o=s.description??"",e=s,t,i=!1;for(;e instanceof r.ZodOptional||e instanceof r.ZodDefault;){if(e instanceof r.ZodDefault){let a=e.def.defaultValue;t=typeof a=="function"?a():a}e instanceof r.ZodOptional&&(i=!0),e=e.unwrap()}return t!==void 0?`${o} (default: \`${String(t)}\`)`:i?`${o} (optional)`:o}import{z as T}from"zod";import{randomUUID as k}from"crypto";var d={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:T.string().describe("Message to echo")},handler:async({message:s})=>f(s),examples:[{args:['"hello world"'],result:"hello world"}]},timestampTool:{name:"timestamp",description:"Returns the current UTC timestamp",inputSchema:{format:T.enum(["iso","unix"]).default("iso").describe("Timestamp format")},handler:async({format:s})=>{let o=s==="unix"?String(Date.now()):new Date().toISOString();return f(o)},examples:[{args:[],result:"2026-05-02T00:00:00.000Z"},{args:["unix"],result:"1746144000000"}]},envTool:{name:"env",description:"Returns the value of an environment variable",inputSchema:{key:T.string().describe("Environment variable name")},handler:async({key:s})=>f(process.env[s]??""),examples:[{args:["HOME"],result:"/Users/julong"},{args:["NODE_ENV"],result:"development"}],guidelines:["`envTool` returns an empty string when the variable is not set"]},uuidTool:{name:"uuid",description:"Generates a random UUID v4",inputSchema:{},handler:async()=>f(k()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},v=d.echoTool,R=d.timestampTool,E=d.envTool,N=d.uuidTool;export{A as generateReadmeSkills,$ as generateSkillMarkdown,d as tools};
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function o(e){return{content:[{type:"text",text:e}]}}import{McpServer as
|
|
2
|
+
function o(e){return{content:[{type:"text",text:e}]}}import{McpServer as f}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as m}from"@modelcontextprotocol/sdk/server/stdio.js";function u(e,n){let c=new f(e);for(let s of n)c.registerTool(s.name,{description:s.description,inputSchema:s.inputSchema},s.handler);return c}async function d(e){let n=new m;await e.connect(n)}import{z as b}from"zod";import{z as v}from"zod";import{z as r}from"zod";import{randomUUID as y}from"crypto";var t={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:r.string().describe("Message to echo")},handler:async({message:e})=>o(e),examples:[{args:['"hello world"'],result:"hello world"}]},timestampTool:{name:"timestamp",description:"Returns the current UTC timestamp",inputSchema:{format:r.enum(["iso","unix"]).default("iso").describe("Timestamp format")},handler:async({format:e})=>{let n=e==="unix"?String(Date.now()):new Date().toISOString();return o(n)},examples:[{args:[],result:"2026-05-02T00:00:00.000Z"},{args:["unix"],result:"1746144000000"}]},envTool:{name:"env",description:"Returns the value of an environment variable",inputSchema:{key:r.string().describe("Environment variable name")},handler:async({key:e})=>o(process.env[e]??""),examples:[{args:["HOME"],result:"/Users/julong"},{args:["NODE_ENV"],result:"development"}],guidelines:["`envTool` returns an empty string when the variable is not set"]},uuidTool:{name:"uuid",description:"Generates a random UUID v4",inputSchema:{},handler:async()=>o(y()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},i=t.echoTool,a=t.timestampTool,l=t.envTool,p=t.uuidTool;var g=u({name:"mono-rele2-core",version:"1.0.0"},[i,a,l,p]);d(g).catch(e=>{console.error("[core] server error:",e),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Use this skill to invoke core system utility functions via the mono-rele2-core CLI. Handles message echo, UTC timestamp generation, and environment variable lookup.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|