@julong/mono-rele2-core 1.17.1 → 1.18.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @julong/mono-rele2-core
2
2
 
3
- Core system utility tools for the mono-rele2 monorepo. Available as an MCP server and a standalone CLI.
3
+ 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.
4
4
 
5
5
  ## CLI
6
6
 
@@ -9,13 +9,13 @@ Core system utility tools for the mono-rele2 monorepo. Available as an MCP serve
9
9
  ```sh
10
10
  npm install -g @julong/mono-rele2-core
11
11
  # or
12
- npx @julong/mono-rele2-core-cli <skillName> [...args]
12
+ npx @julong/mono-rele2-core-cli <toolName> [...args]
13
13
  ```
14
14
 
15
15
  ### Usage
16
16
 
17
17
  ```sh
18
- mono-rele2-core-cli <skillName> [...args]
18
+ mono-rele2-core-cli <toolName> [...args]
19
19
  ```
20
20
 
21
21
  Run without arguments to list all available skills:
@@ -24,19 +24,8 @@ Run without arguments to list all available skills:
24
24
  mono-rele2-core-cli
25
25
  ```
26
26
 
27
- ```
28
- Available skills:
29
-
30
- echoTool
31
- Returns the message as-is
32
- message Message to echo
33
- ...
34
- ```
35
-
36
27
  ### Skills
37
28
 
38
- <!-- SKILLS:START -->
39
-
40
29
  #### `echoTool`
41
30
 
42
31
  Returns the message as-is.
@@ -99,8 +88,6 @@ mono-rele2-core-cli uuidTool
99
88
  mono-rele2-core-cli uuidTool # 550e8400-e29b-41d4-a716-446655440000
100
89
  ```
101
90
 
102
- <!-- SKILLS:END -->
103
-
104
91
  ## MCP Server
105
92
 
106
93
  ```sh
package/dist/cli.js CHANGED
@@ -1,128 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ function p(e){return{content:[{type:"text",text:e}]}}import{McpServer as x}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as z}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as f}from"zod";function y(e){return`Available skills:
2
3
 
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
- }
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(`
13
8
 
14
- // ../common/kit/server.ts
15
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
16
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
17
-
18
- // ../common/kit/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
- console.log(process.argv);
37
- if (!toolName || !(toolName in tools2)) {
38
- if (toolName) console.error(`Unknown skill: "${toolName}"
39
- `);
40
- console.log(formatSkills(tools2));
41
- process.exit(toolName ? 1 : 0);
42
- }
43
- const tool = tools2[toolName];
44
- const fieldNames = Object.keys(tool.inputSchema);
45
- const rawInput = {};
46
- for (let i = 0; i < fieldNames.length; i++) {
47
- const raw = rawArgs[i];
48
- if (raw === void 0) continue;
49
- try {
50
- rawInput[fieldNames[i]] = JSON.parse(raw);
51
- } catch {
52
- rawInput[fieldNames[i]] = raw;
53
- }
54
- }
55
- const parsed = z.object(tool.inputSchema).parse(rawInput);
56
- const result = await tool.handler(parsed);
57
- for (const part of result.content) {
58
- if (part.type === "text") console.log(part.text);
59
- }
60
- }
61
- function handleCliError(err) {
62
- if (err instanceof z.ZodError) {
63
- console.error("Validation error:", err.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join(", "));
64
- } else {
65
- console.error("Error:", err instanceof Error ? err.message : String(err));
66
- }
67
- process.exit(1);
68
- }
69
-
70
- // ../common/kit/skill.ts
71
- import { z as z2 } from "zod";
72
-
73
- // src/tools/system.ts
74
- import { z as z3 } from "zod";
75
- import { randomUUID } from "crypto";
76
- var tools = {
77
- echoTool: toolDef({
78
- name: "echo",
79
- description: "Returns the message as-is",
80
- inputSchema: {
81
- message: z3.string().describe("Message to echo")
82
- },
83
- handler: async ({ message }) => text(message),
84
- examples: [{ args: [`"hello world"`], result: "hello world" }]
85
- }),
86
- timestampTool: toolDef({
87
- name: "timestamp",
88
- description: "Returns the current UTC timestamp",
89
- inputSchema: {
90
- format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
91
- },
92
- handler: async ({ format }) => {
93
- const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
94
- return text(value);
95
- },
96
- examples: [
97
- { args: [], result: "2026-05-02T00:00:00.000Z" },
98
- { args: ["unix"], result: "1746144000000" }
99
- ]
100
- }),
101
- envTool: toolDef({
102
- name: "env",
103
- description: "Returns the value of an environment variable",
104
- inputSchema: {
105
- key: z3.string().describe("Environment variable name")
106
- },
107
- handler: async ({ key }) => text(process.env[key] ?? ""),
108
- examples: [
109
- { args: ["HOME"], result: "/Users/julong" },
110
- { args: ["NODE_ENV"], result: "development" }
111
- ],
112
- guidelines: ["`envTool` returns an empty string when the variable is not set"]
113
- }),
114
- uuidTool: toolDef({
115
- name: "uuid",
116
- description: "Generates a random UUID v4",
117
- inputSchema: {},
118
- handler: async () => text(randomUUID()),
119
- examples: [{ args: [], result: "550e8400-e29b-41d4-a716-446655440000" }]
120
- })
121
- };
122
- var echoTool = defineTool(tools.echoTool);
123
- var timestampTool = defineTool(tools.timestampTool);
124
- var envTool = defineTool(tools.envTool);
125
- var uuidTool = defineTool(tools.uuidTool);
126
-
127
- // src/cli.ts
128
- runCli(tools).catch(handleCliError);
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);
package/dist/index.js CHANGED
@@ -1,257 +1,52 @@
1
- // ../common/kit/tool.ts
2
- function toolDef(def) {
3
- return def;
4
- }
5
- function defineTool(tool) {
6
- return tool;
7
- }
8
- function text(content) {
9
- return { content: [{ type: "text", text: content }] };
10
- }
11
-
12
- // ../common/kit/server.ts
13
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
15
-
16
- // ../common/kit/cli.ts
17
- import { z } from "zod";
18
-
19
- // ../common/kit/skill.ts
20
- import { z as z2 } from "zod";
21
- function generateSkillMarkdown(opts) {
22
- const { binName, description, tools: tools2 } = opts;
23
- return `---
24
- name: ${binName}
25
- description: ${description}
1
+ function m(o){return{content:[{type:"text",text:o}]}}import{McpServer as V}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as I}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as G}from"zod";import{z as s}from"zod";function S(o){let{binName:n,description:e,tools:r}=o;return`---
2
+ name: ${n}
3
+ description: ${e}
26
4
  ---
27
5
 
28
- # ${binName}
6
+ # ${n}
29
7
 
30
8
  \`\`\`sh
31
- ${binName} <skillName> [...args]
9
+ ${n} <toolName> [...args]
32
10
  \`\`\`
33
11
 
34
12
  ## Skills
35
13
 
36
- ${renderSkills(tools2)}
14
+ ${Z(r)}
37
15
 
38
16
  ## Examples
39
17
 
40
- ${renderExamples(binName, tools2)}
18
+ ${z(n,r)}
41
19
 
42
20
  ## Guidelines
43
21
 
44
- ${renderGuidelines(binName, tools2)}
45
- `;
46
- }
47
- function renderSkills(tools2) {
48
- return Object.entries(tools2).map(([key, tool]) => {
49
- const rows = Object.entries(tool.inputSchema).map(([field, schema]) => `| \`${field}\` | ${describeField(schema)} |`).join("\n");
50
- return `### ${key}
22
+ ${$(n,r)}
23
+ `}function Z(o){return Object.entries(o).map(([n,e])=>{let r=Object.entries(e.inputSchema).map(([i,a])=>`| \`${i}\` | ${w(a)} |`).join(`
24
+ `);return`### ${n}
51
25
 
52
- ${tool.description}
26
+ ${e.description}
53
27
 
54
28
  | arg | description |
55
29
  |-----|-------------|
56
- ${rows}`;
57
- }).join("\n\n");
58
- }
59
- function describeField(schema) {
60
- const baseDesc = schema.description ?? "";
61
- let inner = schema;
62
- let defaultValue;
63
- let isOptional = false;
64
- while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
65
- if (inner instanceof z2.ZodDefault) {
66
- const raw = inner.def.defaultValue;
67
- defaultValue = typeof raw === "function" ? raw() : raw;
68
- }
69
- if (inner instanceof z2.ZodOptional) isOptional = true;
70
- inner = inner.unwrap();
71
- }
72
- const parts = [];
73
- if (baseDesc) parts.push(baseDesc);
74
- if (inner instanceof z2.ZodEnum) {
75
- const values = inner.options.map((v) => `\`${v}\``).join(" \\| ");
76
- parts.push(values);
77
- }
78
- if (defaultValue !== void 0) parts.push(`default: \`${String(defaultValue)}\``);
79
- else if (isOptional) parts.push("optional");
80
- return parts.join(" \u2014 ");
81
- }
82
- function renderExamples(binName, tools2) {
83
- const lines = [];
84
- for (const [key, tool] of Object.entries(tools2)) {
85
- if (!tool.examples) continue;
86
- for (const ex of tool.examples) {
87
- const cmd = [binName, key, ...ex.args].join(" ");
88
- lines.push(`- \`${cmd}\` => \`${ex.result}\``);
89
- }
90
- }
91
- return lines.join("\n");
92
- }
93
- function renderGuidelines(binName, tools2) {
94
- const items = [];
95
- const seen = /* @__PURE__ */ new Set();
96
- const push = (g) => {
97
- if (seen.has(g)) return;
98
- seen.add(g);
99
- items.push(g);
100
- };
101
- push("Arguments are positional \u2014 pass them in the order listed in each skill's table");
102
- const allSchemas = Object.values(tools2).flatMap((t) => Object.values(t.inputSchema));
103
- if (allSchemas.some((s) => containsType(s, z2.ZodNumber))) {
104
- push("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)");
105
- }
106
- if (allSchemas.some((s) => containsType(s, z2.ZodArray))) {
107
- push('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)');
108
- }
109
- if (allSchemas.some((s) => s instanceof z2.ZodOptional || s instanceof z2.ZodDefault)) {
110
- push("Optional args with defaults may be omitted");
111
- }
112
- for (const tool of Object.values(tools2)) {
113
- if (!tool.guidelines) continue;
114
- for (const g of tool.guidelines) push(g);
115
- }
116
- push(`Run \`${binName}\` with no args to list all available skills`);
117
- return items.map((g) => `- ${g}`).join("\n");
118
- }
119
- function containsType(schema, ctor) {
120
- let inner = schema;
121
- while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
122
- inner = inner.unwrap();
123
- }
124
- return inner instanceof ctor;
125
- }
126
- function generateReadmeSkills(opts) {
127
- console.log(opts.binName);
128
- const { binName, tools: tools2 } = opts;
129
- return Object.entries(tools2).map(([key, tool]) => renderReadmeSkill(binName, key, tool)).join("\n\n");
130
- }
131
- function renderReadmeSkill(binName, key, tool) {
132
- const fields = Object.entries(tool.inputSchema);
133
- const usageArgs = fields.map(([field, schema]) => {
134
- const isOpt = schema instanceof z2.ZodOptional || schema instanceof z2.ZodDefault;
135
- return isOpt ? `[${field}]` : `<${field}>`;
136
- }).join(" ");
137
- const usage = [binName, key, usageArgs].filter(Boolean).join(" ");
138
- const rows = fields.map(([field, schema]) => {
139
- const t = describeReadmeType(schema);
140
- const d = describeReadmeDesc(schema);
141
- return `| \`${field}\` | ${t} | ${d} |`;
142
- }).join("\n");
143
- const examples = tool.examples ?? [];
144
- let exampleBlock = "";
145
- if (examples.length > 0) {
146
- const cmds = examples.map((ex) => [binName, key, ...ex.args].join(" "));
147
- const width = Math.max(...cmds.map((c) => c.length));
148
- const lines = examples.map((ex, i) => `${cmds[i].padEnd(width)} # ${ex.result}`);
149
- exampleBlock = `
30
+ ${r}`}).join(`
31
+
32
+ `)}function w(o){let n=o.description??"",e=o,r,i=!1;for(;e instanceof s.ZodOptional||e instanceof s.ZodDefault;){if(e instanceof s.ZodDefault){let t=e.def.defaultValue;r=typeof t=="function"?t():t}e instanceof s.ZodOptional&&(i=!0),e=e.unwrap()}let a=[];if(n&&a.push(n),e instanceof s.ZodEnum){let t=e.options.map(l=>`\`${l}\``).join(" \\| ");a.push(t)}return r!==void 0?a.push(`default: \`${String(r)}\``):i&&a.push("optional"),a.join(" \u2014 ")}function z(o,n){let e=[];for(let[r,i]of Object.entries(n))if(i.examples)for(let a of i.examples){let t=[o,r,...a.args].join(" ");e.push(`- \`${t}\` => \`${a.result}\``)}return e.join(`
33
+ `)}function $(o,n){let e=[],r=new Set,i=t=>{r.has(t)||(r.add(t),e.push(t))};i("Arguments are positional \u2014 pass them in the order listed in each skill's table");let a=Object.values(n).flatMap(t=>Object.values(t.inputSchema));a.some(t=>T(t,s.ZodNumber))&&i("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)"),a.some(t=>T(t,s.ZodArray))&&i('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)'),a.some(t=>t instanceof s.ZodOptional||t instanceof s.ZodDefault)&&i("Optional args with defaults may be omitted");for(let t of Object.values(n))if(t.guidelines)for(let l of t.guidelines)i(l);return i(`Run \`${o}\` with no args to list all available skills`),e.map(t=>`- ${t}`).join(`
34
+ `)}function T(o,n){let e=o;for(;e instanceof s.ZodOptional||e instanceof s.ZodDefault;)e=e.unwrap();return e instanceof n}function b(o){console.log(o.binName);let{binName:n,tools:e}=o;return Object.entries(e).map(([r,i])=>A(n,r,i)).join(`
35
+
36
+ `)}function A(o,n,e){let r=Object.entries(e.inputSchema),i=r.map(([p,c])=>c instanceof s.ZodOptional||c instanceof s.ZodDefault?`[${p}]`:`<${p}>`).join(" "),a=[o,n,i].filter(Boolean).join(" "),t=r.map(([p,c])=>{let f=v(c),u=j(c);return`| \`${p}\` | ${f} | ${u} |`}).join(`
37
+ `),l=e.examples??[],y="";if(l.length>0){let p=l.map(u=>[o,n,...u.args].join(" ")),c=Math.max(...p.map(u=>u.length));y=`
150
38
 
151
39
  \`\`\`sh
152
- ${lines.join("\n")}
153
- \`\`\``;
154
- }
155
- const tableBlock = rows ? `
40
+ ${l.map((u,x)=>`${p[x].padEnd(c)} # ${u.result}`).join(`
41
+ `)}
42
+ \`\`\``}let h=t?`
156
43
 
157
44
  | arg | type | description |
158
45
  |-----|------|-------------|
159
- ${rows}` : "";
160
- return `#### \`${key}\`
46
+ ${t}`:"";return`#### \`${n}\`
161
47
 
162
- ${tool.description}.
48
+ ${e.description}.
163
49
 
164
50
  \`\`\`sh
165
- ${usage}
166
- \`\`\`${tableBlock}${exampleBlock}`;
167
- }
168
- function describeReadmeType(schema) {
169
- let inner = schema;
170
- while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
171
- inner = inner.unwrap();
172
- }
173
- if (inner instanceof z2.ZodEnum) {
174
- return inner.options.map((v) => `\`${v}\``).join(" \\| ");
175
- }
176
- if (inner instanceof z2.ZodNumber) return "number";
177
- if (inner instanceof z2.ZodString) return "string";
178
- if (inner instanceof z2.ZodBoolean) return "boolean";
179
- if (inner instanceof z2.ZodArray) return "JSON string (array)";
180
- return "unknown";
181
- }
182
- function describeReadmeDesc(schema) {
183
- const baseDesc = schema.description ?? "";
184
- let inner = schema;
185
- let defaultValue;
186
- let isOptional = false;
187
- while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
188
- if (inner instanceof z2.ZodDefault) {
189
- const raw = inner.def.defaultValue;
190
- defaultValue = typeof raw === "function" ? raw() : raw;
191
- }
192
- if (inner instanceof z2.ZodOptional) isOptional = true;
193
- inner = inner.unwrap();
194
- }
195
- if (defaultValue !== void 0) return `${baseDesc} (default: \`${String(defaultValue)}\`)`;
196
- if (isOptional) return `${baseDesc} (optional)`;
197
- return baseDesc;
198
- }
199
-
200
- // src/tools/system.ts
201
- import { z as z3 } from "zod";
202
- import { randomUUID } from "crypto";
203
- var tools = {
204
- echoTool: toolDef({
205
- name: "echo",
206
- description: "Returns the message as-is",
207
- inputSchema: {
208
- message: z3.string().describe("Message to echo")
209
- },
210
- handler: async ({ message }) => text(message),
211
- examples: [{ args: [`"hello world"`], result: "hello world" }]
212
- }),
213
- timestampTool: toolDef({
214
- name: "timestamp",
215
- description: "Returns the current UTC timestamp",
216
- inputSchema: {
217
- format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
218
- },
219
- handler: async ({ format }) => {
220
- const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
221
- return text(value);
222
- },
223
- examples: [
224
- { args: [], result: "2026-05-02T00:00:00.000Z" },
225
- { args: ["unix"], result: "1746144000000" }
226
- ]
227
- }),
228
- envTool: toolDef({
229
- name: "env",
230
- description: "Returns the value of an environment variable",
231
- inputSchema: {
232
- key: z3.string().describe("Environment variable name")
233
- },
234
- handler: async ({ key }) => text(process.env[key] ?? ""),
235
- examples: [
236
- { args: ["HOME"], result: "/Users/julong" },
237
- { args: ["NODE_ENV"], result: "development" }
238
- ],
239
- guidelines: ["`envTool` returns an empty string when the variable is not set"]
240
- }),
241
- uuidTool: toolDef({
242
- name: "uuid",
243
- description: "Generates a random UUID v4",
244
- inputSchema: {},
245
- handler: async () => text(randomUUID()),
246
- examples: [{ args: [], result: "550e8400-e29b-41d4-a716-446655440000" }]
247
- })
248
- };
249
- var echoTool = defineTool(tools.echoTool);
250
- var timestampTool = defineTool(tools.timestampTool);
251
- var envTool = defineTool(tools.envTool);
252
- var uuidTool = defineTool(tools.uuidTool);
253
- export {
254
- generateReadmeSkills,
255
- generateSkillMarkdown,
256
- tools
257
- };
51
+ ${a}
52
+ \`\`\`${h}${y}`}function v(o){let n=o;for(;n instanceof s.ZodOptional||n instanceof s.ZodDefault;)n=n.unwrap();return n instanceof s.ZodEnum?n.options.map(e=>`\`${e}\``).join(" \\| "):n instanceof s.ZodNumber?"number":n instanceof s.ZodString?"string":n instanceof s.ZodBoolean?"boolean":n instanceof s.ZodArray?"JSON string (array)":"unknown"}function j(o){let n=o.description??"",e=o,r,i=!1;for(;e instanceof s.ZodOptional||e instanceof s.ZodDefault;){if(e instanceof s.ZodDefault){let a=e.def.defaultValue;r=typeof a=="function"?a():a}e instanceof s.ZodOptional&&(i=!0),e=e.unwrap()}return r!==void 0?`${n} (default: \`${String(r)}\`)`:i?`${n} (optional)`:n}import{z as g}from"zod";import{randomUUID as O}from"crypto";var d={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:g.string().describe("Message to echo")},handler:async({message:o})=>m(o),examples:[{args:['"hello world"'],result:"hello world"}]},timestampTool:{name:"timestamp",description:"Returns the current UTC timestamp",inputSchema:{format:g.enum(["iso","unix"]).default("iso").describe("Timestamp format")},handler:async({format:o})=>{let n=o==="unix"?String(Date.now()):new Date().toISOString();return m(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:g.string().describe("Environment variable name")},handler:async({key:o})=>m(process.env[o]??""),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()=>m(O()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},k=d.echoTool,D=d.timestampTool,R=d.envTool,E=d.uuidTool;export{b as generateReadmeSkills,S as generateSkillMarkdown,d as tools};
package/dist/server.js CHANGED
@@ -1,104 +1,2 @@
1
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/system.ts
41
- import { z as z3 } from "zod";
42
- import { randomUUID } from "crypto";
43
- var tools = {
44
- echoTool: toolDef({
45
- name: "echo",
46
- description: "Returns the message as-is",
47
- inputSchema: {
48
- message: z3.string().describe("Message to echo")
49
- },
50
- handler: async ({ message }) => text(message),
51
- examples: [{ args: [`"hello world"`], result: "hello world" }]
52
- }),
53
- timestampTool: toolDef({
54
- name: "timestamp",
55
- description: "Returns the current UTC timestamp",
56
- inputSchema: {
57
- format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
58
- },
59
- handler: async ({ format }) => {
60
- const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
61
- return text(value);
62
- },
63
- examples: [
64
- { args: [], result: "2026-05-02T00:00:00.000Z" },
65
- { args: ["unix"], result: "1746144000000" }
66
- ]
67
- }),
68
- envTool: toolDef({
69
- name: "env",
70
- description: "Returns the value of an environment variable",
71
- inputSchema: {
72
- key: z3.string().describe("Environment variable name")
73
- },
74
- handler: async ({ key }) => text(process.env[key] ?? ""),
75
- examples: [
76
- { args: ["HOME"], result: "/Users/julong" },
77
- { args: ["NODE_ENV"], result: "development" }
78
- ],
79
- guidelines: ["`envTool` returns an empty string when the variable is not set"]
80
- }),
81
- uuidTool: toolDef({
82
- name: "uuid",
83
- description: "Generates a random UUID v4",
84
- inputSchema: {},
85
- handler: async () => text(randomUUID()),
86
- examples: [{ args: [], result: "550e8400-e29b-41d4-a716-446655440000" }]
87
- })
88
- };
89
- var echoTool = defineTool(tools.echoTool);
90
- var timestampTool = defineTool(tools.timestampTool);
91
- var envTool = defineTool(tools.envTool);
92
- var uuidTool = defineTool(tools.uuidTool);
93
-
94
- // src/server.ts
95
- var server = createMcpServer({ name: "mono-rele2-core", version: "1.0.0" }, [
96
- echoTool,
97
- timestampTool,
98
- envTool,
99
- uuidTool
100
- ]);
101
- startServer(server).catch((err) => {
102
- console.error("[core] server error:", err);
103
- process.exit(1);
104
- });
2
+ function o(e){return{content:[{type:"text",text:e}]}}import{McpServer as m}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as f}from"@modelcontextprotocol/sdk/server/stdio.js";function u(e,n){let c=new m(e);for(let r of n)c.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema},r.handler);return c}async function d(e){let n=new f;await e.connect(n)}import{z as v}from"zod";import{z as b}from"zod";import{z as s}from"zod";import{randomUUID as g}from"crypto";var t={echoTool:{name:"echo",description:"Returns the message as-is",inputSchema:{message:s.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:s.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:s.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(g()),examples:[{args:[],result:"550e8400-e29b-41d4-a716-446655440000"}]}},i=t.echoTool,a=t.timestampTool,l=t.envTool,p=t.uuidTool;var y=u({name:"mono-rele2-core",version:"1.0.0"},[i,a,l,p]);d(y).catch(e=>{console.error("[core] server error:",e),process.exit(1)});
@@ -6,7 +6,7 @@ description: Use this skill to invoke core system utility functions via the mono
6
6
  # mono-rele2-core-cli
7
7
 
8
8
  ```sh
9
- mono-rele2-core-cli <skillName> [...args]
9
+ mono-rele2-core-cli <toolName> [...args]
10
10
  ```
11
11
 
12
12
  ## Skills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julong/mono-rele2-core",
3
- "version": "1.17.1",
3
+ "version": "1.18.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",
@@ -24,7 +24,7 @@
24
24
  "build": "tsup",
25
25
  "typecheck": "tsc --noEmit",
26
26
  "clean": "rimraf dist",
27
- "readme": "node ../common/build/update-readme.mjs"
27
+ "readme": "bun ../common/build/update-readme.mjs"
28
28
  },
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "^1.29.0",