@julong/mono-rele2-utils 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 CHANGED
@@ -18,13 +18,13 @@ npx @julong/mono-rele2-utils-cli <toolName> [...args]
18
18
  mono-rele2-utils-cli <toolName> [...args]
19
19
  ```
20
20
 
21
- Run without arguments to list all available skills:
21
+ Run without arguments to list all available tools:
22
22
 
23
23
  ```sh
24
24
  mono-rele2-utils-cli
25
25
  ```
26
26
 
27
- ### Skills
27
+ ### Tools
28
28
 
29
29
  #### `cnTool`
30
30
 
@@ -80,6 +80,94 @@ mono-rele2-utils-cli truncateTool "hello world long text" 10 # hello w...
80
80
  mono-rele2-utils-cli truncateTool "hello world" 8 "…" # hello w…
81
81
  ```
82
82
 
83
+ #### `objectFlattenTool`
84
+
85
+ Flattens a nested JSON object of any depth into dot-notation key-value pairs. Accepts a JSON string and recursively flattens all levels. Arrays and primitives at any level are treated as leaf values..
86
+
87
+ ```sh
88
+ mono-rele2-utils-cli objectFlattenTool <json>
89
+ ```
90
+
91
+ | arg | type | description |
92
+ |-----|------|-------------|
93
+ | `json` | string \| JSON object | JSON string or parsed object to flatten (unlimited depth) |
94
+
95
+ ```sh
96
+ mono-rele2-utils-cli objectFlattenTool '{"user":{"name":"Alice","address":{"city":"Seoul","zip":"12345"}},"active":true}' # {
97
+ "user.name": "Alice",
98
+ "user.address.city": "Seoul",
99
+ "user.address.zip": "12345",
100
+ "active": true
101
+ }
102
+ mono-rele2-utils-cli objectFlattenTool '{"a":{"b":{"c":{"d":{"e":"deep"}}}}}' # {
103
+ "a.b.c.d.e": "deep"
104
+ }
105
+ ```
106
+
107
+ #### `getUserTool`
108
+
109
+ RandomUser API 형식의 사용자 객체를 받아 이름과 거주 도시로 구성된 한글 문장을 반환합니다. JSON 문자열 또는 파싱된 객체를 입력받습니다..
110
+
111
+ ```sh
112
+ mono-rele2-utils-cli getUserTool <user>
113
+ ```
114
+
115
+ | arg | type | description |
116
+ |-----|------|-------------|
117
+ | `user` | RandomUser | RandomUser 형식의 JSON 문자열 또는 객체 — name.first / name.last / location.city 필수 |
118
+
119
+ **`user`** type definition:
120
+
121
+ ```typescript
122
+ interface RandomUser {
123
+ gender: "male" | "female";
124
+ name: {
125
+ title: string;
126
+ first: string;
127
+ last: string;
128
+ };
129
+ location: {
130
+ street: {
131
+ number: number;
132
+ name: string;
133
+ };
134
+ city: string;
135
+ state: string;
136
+ country: string;
137
+ postcode: string | number;
138
+ coordinates: {
139
+ latitude: string;
140
+ longitude: string;
141
+ };
142
+ timezone: {
143
+ offset: string;
144
+ description: string;
145
+ };
146
+ };
147
+ email: string;
148
+ login: {
149
+ uuid: string;
150
+ username: string;
151
+ };
152
+ dob: {
153
+ date: string;
154
+ age: number;
155
+ };
156
+ phone: string;
157
+ cell: string;
158
+ picture: {
159
+ large: string;
160
+ medium: string;
161
+ thumbnail: string;
162
+ };
163
+ nat: string;
164
+ }
165
+ ```
166
+
167
+ ```sh
168
+ mono-rele2-utils-cli getUserTool '{"name":{"title":"Mr","first":"Alice","last":"Kim"},"location":{"city":"Seoul"},"gender":"female","email":"alice@example.com","nat":"KR"}' # 이름은 Alice Kim 이고 현재 Seoul 에 살고 있습니다.
169
+ ```
170
+
83
171
  ## MCP Server
84
172
 
85
173
  ```sh
package/dist/cli.js CHANGED
@@ -1,10 +1,6 @@
1
1
  #!/usr/bin/env node
2
- function u(e){return{content:[{type:"text",text:e}]}}import{McpServer as w}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as z}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as f}from"zod";function h(e){return`Available skills:
2
+ function r(e){return{content:[{type:"text",text:e}]}}import{McpServer as C}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as U}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as h}from"zod";async function T(e){let[,,t,...n]=process.argv;(!t||!(t in e))&&(t&&console.error(`Unknown skill: "${t}"
3
+ `),process.exit(t?1:0));let o=e[t],s=Object.keys(o.inputSchema),a={};for(let i=0;i<s.length;i++){let m=n[i];if(m!==void 0)try{a[s[i]]=JSON.parse(m)}catch{a[s[i]]=m}}let d=h.object(o.inputSchema).parse(a),f=await o.handler(d);for(let i of f.content)i.type==="text"&&console.log(i.text)}function b(e){e instanceof h.ZodError?console.error("Validation error:",e.issues.map(t=>`${t.path.join(".")}: ${t.message}`).join(", ")):console.error("Error:",e instanceof Error?e.message:String(e)),process.exit(1)}import{z as _}from"zod";import{z as l}from"zod";function x(...e){return e.filter(Boolean).join(" ")}var c={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:l.array(l.string()).describe("List of class names to merge")},handler:async({classes:e})=>r(x(...e)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:l.string().describe("Text to convert"),to:l.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:e,to:t})=>r(A(e,t)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:l.string().describe("Text to truncate"),maxLength:l.number().int().positive().describe("Maximum character length"),suffix:l.string().default("...").describe("Suffix to append when truncated")},handler:async({input:e,maxLength:t,suffix:n})=>{let o=e.length<=t?e:e.slice(0,t-n.length)+n;return r(o)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},$=c.cnTool,j=c.caseConvertTool,O=c.truncateTool;function A(e,t){switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();case"camel":return e.replace(/[-_\s]+(.)/g,(n,o)=>o.toUpperCase()).replace(/^(.)/,n=>n.toLowerCase());case"snake":return e.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return e.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}import{z as p}from"zod";function z(e){let t=typeof e=="string"?JSON.parse(e):e,n={};function o(s,a){if(s===null||typeof s!="object"||Array.isArray(s)){n[a]=s;return}for(let[d,f]of Object.entries(s)){let i=a?`${a}.${d}`:d;o(f,i)}}return o(t,""),n}var g={objectFlattenTool:{name:"object_flatten",description:"Flattens a nested JSON object of any depth into dot-notation key-value pairs. Accepts a JSON string and recursively flattens all levels. Arrays and primitives at any level are treated as leaf values.",inputSchema:{json:p.union([p.string(),p.record(p.string(),p.any())]).describe("JSON string or parsed object to flatten (unlimited depth)")},handler:async({json:e})=>{try{let n=z(e);return r(JSON.stringify(n,null,2))}catch(t){return t instanceof SyntaxError?r("Error: invalid JSON string \u2014 unable to parse input"):r(`Error: failed to flatten object \u2014 ${t.message}`)}},examples:[{args:[`'{"user":{"name":"Alice","address":{"city":"Seoul","zip":"12345"}},"active":true}'`],result:JSON.stringify({"user.name":"Alice","user.address.city":"Seoul","user.address.zip":"12345",active:!0},null,2)},{args:[`'{"a":{"b":{"c":{"d":{"e":"deep"}}}}}'`],result:JSON.stringify({"a.b.c.d.e":"deep"},null,2)}],guidelines:["Arrays and primitives at any level are always treated as leaf values \u2014 they are never traversed.","The result is always a flat JSON object with dot-notation keys.","There is no depth limit \u2014 objects of any nesting level are fully flattened.","Input is accepted as a JSON string (MCP/CLI) and parsed internally."]}},k=g.objectFlattenTool;import{z as u}from"zod";function v(e){let t=typeof e=="string"?JSON.parse(e):e,{first:n,last:o}=t.name,s=t.location.city;return`\uC774\uB984\uC740 ${n} ${o} \uC774\uACE0 \uD604\uC7AC ${s} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.`}var y={getUserTool:{name:"getUser",description:"RandomUser API \uD615\uC2DD\uC758 \uC0AC\uC6A9\uC790 \uAC1D\uCCB4\uB97C \uBC1B\uC544 \uC774\uB984\uACFC \uAC70\uC8FC \uB3C4\uC2DC\uB85C \uAD6C\uC131\uB41C \uD55C\uAE00 \uBB38\uC7A5\uC744 \uBC18\uD658\uD569\uB2C8\uB2E4. JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uD30C\uC2F1\uB41C \uAC1D\uCCB4\uB97C \uC785\uB825\uBC1B\uC2B5\uB2C8\uB2E4.",inputSchema:{user:u.union([u.string(),u.record(u.string(),u.any())]).describe("RandomUser \uD615\uC2DD\uC758 JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uAC1D\uCCB4 \u2014 name.first / name.last / location.city \uD544\uC218")},typeLabels:{user:"RandomUser"},typeDefs:{user:["interface RandomUser {",' gender: "male" | "female";'," name: {"," title: string;"," first: string;"," last: string;"," };"," location: {"," street: {"," number: number;"," name: string;"," };"," city: string;"," state: string;"," country: string;"," postcode: string | number;"," coordinates: {"," latitude: string;"," longitude: string;"," };"," timezone: {"," offset: string;"," description: string;"," };"," };"," email: string;"," login: {"," uuid: string;"," username: string;"," };"," dob: {"," date: string;"," age: number;"," };"," phone: string;"," cell: string;"," picture: {"," large: string;"," medium: string;"," thumbnail: string;"," };"," nat: string;","}"].join(`
4
+ `)},handler:async({user:e})=>{try{let n=v(e);return r(n)}catch(t){return t instanceof SyntaxError?r("Error: invalid JSON string \u2014 unable to parse input"):r(`Error: failed to process user data \u2014 ${t.message}
3
5
 
4
- `+Object.entries(e).map(([r,o])=>{let a=Object.entries(o.inputSchema),i=Math.max(...a.map(([l])=>l.length)),d=a.map(([l,t])=>{let c=t.description??"";return` ${l.padEnd(i+2)}${c}`}).join(`
5
- `);return` ${r}
6
- ${o.description}
7
- ${d}`}).join(`
8
-
9
- `)}async function m(e){let[,,n,...r]=process.argv;console.log(process.argv),(!n||!(n in e))&&(n&&console.error(`Unknown skill: "${n}"
10
- `),console.log(h(e)),process.exit(n?1:0));let o=e[n],a=Object.keys(o.inputSchema),i={};for(let t=0;t<a.length;t++){let c=r[t];if(c!==void 0)try{i[a[t]]=JSON.parse(c)}catch{i[a[t]]=c}}let d=f.object(o.inputSchema).parse(i),l=await o.handler(d);for(let t of l.content)t.type==="text"&&console.log(t.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 v}from"zod";import{z as s}from"zod";function y(...e){return e.filter(Boolean).join(" ")}var p={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:s.array(s.string()).describe("List of class names to merge")},handler:async({classes:e})=>u(y(...e)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:s.string().describe("Text to convert"),to:s.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:e,to:n})=>u(T(e,n)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:s.string().describe("Text to truncate"),maxLength:s.number().int().positive().describe("Maximum character length"),suffix:s.string().default("...").describe("Suffix to append when truncated")},handler:async({input:e,maxLength:n,suffix:r})=>{let o=e.length<=n?e:e.slice(0,n-r.length)+r;return u(o)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},W=p.cnTool,q=p.caseConvertTool,F=p.truncateTool;function T(e,n){switch(n){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();case"camel":return e.replace(/[-_\s]+(.)/g,(r,o)=>o.toUpperCase()).replace(/^(.)/,r=>r.toLowerCase());case"snake":return e.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return e.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}m(p).catch(g);
6
+ Input must include \`name.first\`, \`name.last\`, and \`location.city\`.`)}},examples:[{args:[`'{"name":{"title":"Mr","first":"Alice","last":"Kim"},"location":{"city":"Seoul"},"gender":"female","email":"alice@example.com","nat":"KR"}'`],result:"\uC774\uB984\uC740 Alice Kim \uC774\uACE0 \uD604\uC7AC Seoul \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4."}],guidelines:["\uC785\uB825\uC740 RandomUser API \uC2A4\uD399\uC744 \uB530\uB985\uB2C8\uB2E4. \uCD5C\uC18C\uD55C name.first, name.last, location.city \uD544\uB4DC\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.","JSON \uBB38\uC790\uC5F4(string)\uACFC \uD30C\uC2F1\uB41C \uAC1D\uCCB4 \uBAA8\uB450 \uD5C8\uC6A9\uB429\uB2C8\uB2E4 (CLI / MCP \uBAA8\uB450 \uB3D9\uC791).","\uACB0\uACFC\uB294 \uD56D\uC0C1 '\uC774\uB984\uC740 {first} {last} \uC774\uACE0 \uD604\uC7AC {city} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.' \uD615\uC2DD\uC758 \uD55C\uAE00 \uBB38\uC7A5\uC785\uB2C8\uB2E4."]}},D=y.getUserTool;var w={...c,...g,...y};T(w).catch(b);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import * as zod from 'zod';
2
3
  import { z } from 'zod';
3
4
 
4
5
  declare function cn(...classes: (string | undefined | null | false)[]): string;
@@ -15,6 +16,8 @@ type AnyToolDef = {
15
16
  handler: (args: any) => Promise<ToolResult>;
16
17
  examples?: ToolExample[];
17
18
  guidelines?: string[];
19
+ typeLabels?: Record<string, string>;
20
+ typeDefs?: Record<string, string>;
18
21
  };
19
22
 
20
23
  type SkillTools = Record<string, AnyToolDef>;
@@ -29,24 +32,66 @@ declare function generateReadmeSkills(opts: {
29
32
  }): string;
30
33
 
31
34
  declare const tools: {
35
+ getUserTool: {
36
+ name: string;
37
+ description: string;
38
+ inputSchema: {
39
+ readonly user: zod.ZodUnion<readonly [zod.ZodString, zod.ZodRecord<zod.ZodString, zod.ZodAny>]>;
40
+ };
41
+ handler: (input: {
42
+ user: string | Record<string, any>;
43
+ }) => Promise<ToolResult>;
44
+ examples?: ToolExample[];
45
+ guidelines?: string[];
46
+ typeLabels?: {
47
+ readonly user?: string | undefined;
48
+ } | undefined;
49
+ typeDefs?: {
50
+ readonly user?: string | undefined;
51
+ } | undefined;
52
+ };
53
+ objectFlattenTool: {
54
+ name: string;
55
+ description: string;
56
+ inputSchema: {
57
+ readonly json: zod.ZodUnion<readonly [zod.ZodString, zod.ZodRecord<zod.ZodString, zod.ZodAny>]>;
58
+ };
59
+ handler: (input: {
60
+ json: string | Record<string, any>;
61
+ }) => Promise<ToolResult>;
62
+ examples?: ToolExample[];
63
+ guidelines?: string[];
64
+ typeLabels?: {
65
+ readonly json?: string | undefined;
66
+ } | undefined;
67
+ typeDefs?: {
68
+ readonly json?: string | undefined;
69
+ } | undefined;
70
+ };
32
71
  cnTool: {
33
72
  name: string;
34
73
  description: string;
35
74
  inputSchema: {
36
- readonly classes: z.ZodArray<z.ZodString>;
75
+ readonly classes: zod.ZodArray<zod.ZodString>;
37
76
  };
38
77
  handler: (input: {
39
78
  classes: string[];
40
79
  }) => Promise<ToolResult>;
41
80
  examples?: ToolExample[];
42
81
  guidelines?: string[];
82
+ typeLabels?: {
83
+ readonly classes?: string | undefined;
84
+ } | undefined;
85
+ typeDefs?: {
86
+ readonly classes?: string | undefined;
87
+ } | undefined;
43
88
  };
44
89
  caseConvertTool: {
45
90
  name: string;
46
91
  description: string;
47
92
  inputSchema: {
48
- readonly input: z.ZodString;
49
- readonly to: z.ZodEnum<{
93
+ readonly input: zod.ZodString;
94
+ readonly to: zod.ZodEnum<{
50
95
  upper: "upper";
51
96
  lower: "lower";
52
97
  capitalize: "capitalize";
@@ -61,14 +106,22 @@ declare const tools: {
61
106
  }) => Promise<ToolResult>;
62
107
  examples?: ToolExample[];
63
108
  guidelines?: string[];
109
+ typeLabels?: {
110
+ readonly input?: string | undefined;
111
+ readonly to?: string | undefined;
112
+ } | undefined;
113
+ typeDefs?: {
114
+ readonly input?: string | undefined;
115
+ readonly to?: string | undefined;
116
+ } | undefined;
64
117
  };
65
118
  truncateTool: {
66
119
  name: string;
67
120
  description: string;
68
121
  inputSchema: {
69
- readonly input: z.ZodString;
70
- readonly maxLength: z.ZodNumber;
71
- readonly suffix: z.ZodDefault<z.ZodString>;
122
+ readonly input: zod.ZodString;
123
+ readonly maxLength: zod.ZodNumber;
124
+ readonly suffix: zod.ZodDefault<zod.ZodString>;
72
125
  };
73
126
  handler: (input: {
74
127
  input: string;
@@ -77,6 +130,16 @@ declare const tools: {
77
130
  }) => Promise<ToolResult>;
78
131
  examples?: ToolExample[];
79
132
  guidelines?: string[];
133
+ typeLabels?: {
134
+ readonly input?: string | undefined;
135
+ readonly maxLength?: string | undefined;
136
+ readonly suffix?: string | undefined;
137
+ } | undefined;
138
+ typeDefs?: {
139
+ readonly input?: string | undefined;
140
+ readonly maxLength?: string | undefined;
141
+ readonly suffix?: string | undefined;
142
+ } | undefined;
80
143
  };
81
144
  };
82
145
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function y(...o){return o.filter(Boolean).join(" ")}function m(o){return{content:[{type:"text",text:o}]}}import{McpServer as V}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as B}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as J}from"zod";import{z as s}from"zod";function S(o){let{binName:n,description:e,tools:r}=o;return`---
1
+ function x(...t){return t.filter(Boolean).join(" ")}function c(t){return{content:[{type:"text",text:t}]}}import{McpServer as H}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as X}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as te}from"zod";import{z as i}from"zod";function k(t){let{binName:n,description:e,tools:o}=t;return`---
2
2
  name: ${n}
3
3
  description: ${e}
4
4
  ---
@@ -11,42 +11,56 @@ ${n} <toolName> [...args]
11
11
 
12
12
  ## Skills
13
13
 
14
- ${w(r)}
14
+ ${v(o)}
15
15
 
16
16
  ## Examples
17
17
 
18
- ${z(n,r)}
18
+ ${R(n,o)}
19
19
 
20
20
  ## Guidelines
21
21
 
22
- ${$(n,r)}
23
- `}function w(o){return Object.entries(o).map(([n,e])=>{let r=Object.entries(e.inputSchema).map(([a,i])=>`| \`${a}\` | ${b(i)} |`).join(`
24
- `);return`### ${n}
22
+ ${J(n,o)}
23
+ `}function v(t){return Object.entries(t).map(([n,e])=>{let o=Object.entries(e.inputSchema).map(([a,r])=>{let l=e.typeLabels?.[a];return`| \`${a}\` | ${D(r,l)} |`}).join(`
24
+ `),s=e.typeDefs?Object.entries(e.typeDefs).map(([a,r])=>`
25
+
26
+ **\`${a}\`** type definition:
27
+ \`\`\`typescript
28
+ ${r}
29
+ \`\`\``).join(""):"";return`### ${n}
25
30
 
26
31
  ${e.description}
27
32
 
28
33
  | arg | description |
29
34
  |-----|-------------|
30
- ${r}`}).join(`
35
+ ${o}${s}`}).join(`
31
36
 
32
- `)}function b(o){let n=o.description??"",e=o,r,a=!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&&(a=!0),e=e.unwrap()}let i=[];if(n&&i.push(n),e instanceof s.ZodEnum){let t=e.options.map(l=>`\`${l}\``).join(" \\| ");i.push(t)}return r!==void 0?i.push(`default: \`${String(r)}\``):a&&i.push("optional"),i.join(" \u2014 ")}function z(o,n){let e=[];for(let[r,a]of Object.entries(n))if(a.examples)for(let i of a.examples){let t=[o,r,...i.args].join(" ");e.push(`- \`${t}\` => \`${i.result}\``)}return e.join(`
33
- `)}function $(o,n){let e=[],r=new Set,a=t=>{r.has(t)||(r.add(t),e.push(t))};a("Arguments are positional \u2014 pass them in the order listed in each skill's table");let i=Object.values(n).flatMap(t=>Object.values(t.inputSchema));i.some(t=>h(t,s.ZodNumber))&&a("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)"),i.some(t=>h(t,s.ZodArray))&&a('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)'),i.some(t=>t instanceof s.ZodOptional||t instanceof s.ZodDefault)&&a("Optional args with defaults may be omitted");for(let t of Object.values(n))if(t.guidelines)for(let l of t.guidelines)a(l);return a(`Run \`${o}\` with no args to list all available skills`),e.map(t=>`- ${t}`).join(`
34
- `)}function h(o,n){let e=o;for(;e instanceof s.ZodOptional||e instanceof s.ZodDefault;)e=e.unwrap();return e instanceof n}function A(o){console.log(o.binName);let{binName:n,tools:e}=o;return Object.entries(e).map(([r,a])=>k(n,r,a)).join(`
37
+ `)}function D(t,n){let e=t.description??"",o=t,s,a=!1;for(;o instanceof i.ZodOptional||o instanceof i.ZodDefault;){if(o instanceof i.ZodDefault){let l=o.def.defaultValue;s=typeof l=="function"?l():l}o instanceof i.ZodOptional&&(a=!0),o=o.unwrap()}let r=[];if(n&&r.push(`Type: ${n}`),e&&r.push(e),o instanceof i.ZodEnum){let l=o.options.map(m=>`\`${m}\``).join(" \\| ");r.push(l)}return s!==void 0?r.push(`default: \`${String(s)}\``):a&&r.push("optional"),r.join(" \u2014 ")}function R(t,n){let e=[];for(let[o,s]of Object.entries(n))if(s.examples)for(let a of s.examples){let r=[t,o,...a.args].join(" ");e.push(`- \`${r}\` => \`${a.result}\``)}return e.join(`
38
+ `)}function J(t,n){let e=[],o=new Set,s=r=>{o.has(r)||(o.add(r),e.push(r))};s("Arguments are positional \u2014 pass them in the order listed in each skill's table");let a=Object.values(n).flatMap(r=>Object.values(r.inputSchema));a.some(r=>w(r,i.ZodNumber))&&s("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)"),a.some(r=>w(r,i.ZodArray))&&s('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)'),a.some(r=>r instanceof i.ZodOptional||r instanceof i.ZodDefault)&&s("Optional args with defaults may be omitted");for(let r of Object.values(n))if(r.guidelines)for(let l of r.guidelines)s(l);return s(`Run \`${t}\` with no args to list all available skills`),e.map(r=>`- ${r}`).join(`
39
+ `)}function w(t,n){let e=t;for(;e instanceof i.ZodOptional||e instanceof i.ZodDefault;)e=e.unwrap();return e instanceof n}function N(t){let{binName:n,tools:e}=t;return Object.entries(e).map(([o,s])=>C(n,o,s)).join(`
35
40
 
36
- `)}function k(o,n,e){let r=Object.entries(e.inputSchema),a=r.map(([c,p])=>p instanceof s.ZodOptional||p instanceof s.ZodDefault?`[${c}]`:`<${c}>`).join(" "),i=[o,n,a].filter(Boolean).join(" "),t=r.map(([c,p])=>{let g=j(p),u=v(p);return`| \`${c}\` | ${g} | ${u} |`}).join(`
37
- `),l=e.examples??[],T="";if(l.length>0){let c=l.map(u=>[o,n,...u.args].join(" ")),p=Math.max(...c.map(u=>u.length));T=`
41
+ `)}function C(t,n,e){let o=Object.entries(e.inputSchema),s=o.map(([p,u])=>u instanceof i.ZodOptional||u instanceof i.ZodDefault?`[${p}]`:`<${p}>`).join(" "),a=[t,n,s].filter(Boolean).join(" "),r=o.map(([p,u])=>{let T=e.typeLabels?.[p],d=$(u,T),b=E(u);return`| \`${p}\` | ${d} | ${b} |`}).join(`
42
+ `),l=e.examples??[],m="";if(l.length>0){let p=l.map(d=>[t,n,...d.args].join(" ")),u=Math.max(...p.map(d=>d.length));m=`
38
43
 
39
44
  \`\`\`sh
40
- ${l.map((u,Z)=>`${c[Z].padEnd(p)} # ${u.result}`).join(`
45
+ ${l.map((d,b)=>`${p[b].padEnd(u)} # ${d.result}`).join(`
41
46
  `)}
42
- \`\`\``}let x=t?`
47
+ \`\`\``}let A=e.typeDefs?Object.entries(e.typeDefs).map(([p,u])=>`
48
+
49
+ **\`${p}\`** type definition:
50
+
51
+ \`\`\`typescript
52
+ ${u}
53
+ \`\`\``).join(""):"",z=r?`
43
54
 
44
55
  | arg | type | description |
45
56
  |-----|------|-------------|
46
- ${t}`:"";return`#### \`${n}\`
57
+ ${r}`:"";return`#### \`${n}\`
47
58
 
48
59
  ${e.description}.
49
60
 
50
61
  \`\`\`sh
51
- ${i}
52
- \`\`\`${x}${T}`}function j(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 v(o){let n=o.description??"",e=o,r,a=!1;for(;e instanceof s.ZodOptional||e instanceof s.ZodDefault;){if(e instanceof s.ZodDefault){let i=e.def.defaultValue;r=typeof i=="function"?i():i}e instanceof s.ZodOptional&&(a=!0),e=e.unwrap()}return r!==void 0?`${n} (default: \`${String(r)}\`)`:a?`${n} (optional)`:n}import{z as d}from"zod";var f={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:d.array(d.string()).describe("List of class names to merge")},handler:async({classes:o})=>m(y(...o)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:d.string().describe("Text to convert"),to:d.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:o,to:n})=>m(C(o,n)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:d.string().describe("Text to truncate"),maxLength:d.number().int().positive().describe("Maximum character length"),suffix:d.string().default("...").describe("Suffix to append when truncated")},handler:async({input:o,maxLength:n,suffix:e})=>{let r=o.length<=n?o:o.slice(0,n-e.length)+e;return m(r)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},O=f.cnTool,D=f.caseConvertTool,R=f.truncateTool;function C(o,n){switch(n){case"upper":return o.toUpperCase();case"lower":return o.toLowerCase();case"capitalize":return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase();case"camel":return o.replace(/[-_\s]+(.)/g,(e,r)=>r.toUpperCase()).replace(/^(.)/,e=>e.toLowerCase());case"snake":return o.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return o.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}export{y as cn,A as generateReadmeSkills,S as generateSkillMarkdown,f as tools};
62
+ ${a}
63
+ \`\`\`${z}${A}${m}`}function $(t,n){if(n)return n;let e=t;for(;e instanceof i.ZodOptional||e instanceof i.ZodDefault;)e=e.unwrap();return e instanceof i.ZodEnum?e.options.map(o=>`\`${o}\``).join(" \\| "):e instanceof i.ZodNumber?"number":e instanceof i.ZodString?"string":e instanceof i.ZodBoolean?"boolean":e instanceof i.ZodArray?"JSON string (array)":e instanceof i.ZodUnion?e.options.map(s=>$(s)).join(" \\| "):e instanceof i.ZodRecord?"JSON object":"unknown"}function E(t){let n=t.description??"",e=t,o,s=!1;for(;e instanceof i.ZodOptional||e instanceof i.ZodDefault;){if(e instanceof i.ZodDefault){let a=e.def.defaultValue;o=typeof a=="function"?a():a}e instanceof i.ZodOptional&&(s=!0),e=e.unwrap()}return o!==void 0?`${n} (default: \`${String(o)}\`)`:s?`${n} (optional)`:n}import{z as f}from"zod";var g={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:f.array(f.string()).describe("List of class names to merge")},handler:async({classes:t})=>c(x(...t)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:f.string().describe("Text to convert"),to:f.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:t,to:n})=>c(V(t,n)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:f.string().describe("Text to truncate"),maxLength:f.number().int().positive().describe("Maximum character length"),suffix:f.string().default("...").describe("Suffix to append when truncated")},handler:async({input:t,maxLength:n,suffix:e})=>{let o=t.length<=n?t:t.slice(0,n-e.length)+e;return c(o)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},U=g.cnTool,M=g.caseConvertTool,L=g.truncateTool;function V(t,n){switch(n){case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();case"capitalize":return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase();case"camel":return t.replace(/[-_\s]+(.)/g,(e,o)=>o.toUpperCase()).replace(/^(.)/,e=>e.toLowerCase());case"snake":return t.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return t.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}import{z as y}from"zod";function P(t){let n=typeof t=="string"?JSON.parse(t):t,e={};function o(s,a){if(s===null||typeof s!="object"||Array.isArray(s)){e[a]=s;return}for(let[r,l]of Object.entries(s)){let m=a?`${a}.${r}`:r;o(l,m)}}return o(n,""),e}var S={objectFlattenTool:{name:"object_flatten",description:"Flattens a nested JSON object of any depth into dot-notation key-value pairs. Accepts a JSON string and recursively flattens all levels. Arrays and primitives at any level are treated as leaf values.",inputSchema:{json:y.union([y.string(),y.record(y.string(),y.any())]).describe("JSON string or parsed object to flatten (unlimited depth)")},handler:async({json:t})=>{try{let e=P(t);return c(JSON.stringify(e,null,2))}catch(n){return n instanceof SyntaxError?c("Error: invalid JSON string \u2014 unable to parse input"):c(`Error: failed to flatten object \u2014 ${n.message}`)}},examples:[{args:[`'{"user":{"name":"Alice","address":{"city":"Seoul","zip":"12345"}},"active":true}'`],result:JSON.stringify({"user.name":"Alice","user.address.city":"Seoul","user.address.zip":"12345",active:!0},null,2)},{args:[`'{"a":{"b":{"c":{"d":{"e":"deep"}}}}}'`],result:JSON.stringify({"a.b.c.d.e":"deep"},null,2)}],guidelines:["Arrays and primitives at any level are always treated as leaf values \u2014 they are never traversed.","The result is always a flat JSON object with dot-notation keys.","There is no depth limit \u2014 objects of any nesting level are fully flattened.","Input is accepted as a JSON string (MCP/CLI) and parsed internally."]}},_=S.objectFlattenTool;import{z as h}from"zod";function I(t){let n=typeof t=="string"?JSON.parse(t):t,{first:e,last:o}=n.name,s=n.location.city;return`\uC774\uB984\uC740 ${e} ${o} \uC774\uACE0 \uD604\uC7AC ${s} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.`}var Z={getUserTool:{name:"getUser",description:"RandomUser API \uD615\uC2DD\uC758 \uC0AC\uC6A9\uC790 \uAC1D\uCCB4\uB97C \uBC1B\uC544 \uC774\uB984\uACFC \uAC70\uC8FC \uB3C4\uC2DC\uB85C \uAD6C\uC131\uB41C \uD55C\uAE00 \uBB38\uC7A5\uC744 \uBC18\uD658\uD569\uB2C8\uB2E4. JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uD30C\uC2F1\uB41C \uAC1D\uCCB4\uB97C \uC785\uB825\uBC1B\uC2B5\uB2C8\uB2E4.",inputSchema:{user:h.union([h.string(),h.record(h.string(),h.any())]).describe("RandomUser \uD615\uC2DD\uC758 JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uAC1D\uCCB4 \u2014 name.first / name.last / location.city \uD544\uC218")},typeLabels:{user:"RandomUser"},typeDefs:{user:["interface RandomUser {",' gender: "male" | "female";'," name: {"," title: string;"," first: string;"," last: string;"," };"," location: {"," street: {"," number: number;"," name: string;"," };"," city: string;"," state: string;"," country: string;"," postcode: string | number;"," coordinates: {"," latitude: string;"," longitude: string;"," };"," timezone: {"," offset: string;"," description: string;"," };"," };"," email: string;"," login: {"," uuid: string;"," username: string;"," };"," dob: {"," date: string;"," age: number;"," };"," phone: string;"," cell: string;"," picture: {"," large: string;"," medium: string;"," thumbnail: string;"," };"," nat: string;","}"].join(`
64
+ `)},handler:async({user:t})=>{try{let e=I(t);return c(e)}catch(n){return n instanceof SyntaxError?c("Error: invalid JSON string \u2014 unable to parse input"):c(`Error: failed to process user data \u2014 ${n.message}
65
+
66
+ Input must include \`name.first\`, \`name.last\`, and \`location.city\`.`)}},examples:[{args:[`'{"name":{"title":"Mr","first":"Alice","last":"Kim"},"location":{"city":"Seoul"},"gender":"female","email":"alice@example.com","nat":"KR"}'`],result:"\uC774\uB984\uC740 Alice Kim \uC774\uACE0 \uD604\uC7AC Seoul \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4."}],guidelines:["\uC785\uB825\uC740 RandomUser API \uC2A4\uD399\uC744 \uB530\uB985\uB2C8\uB2E4. \uCD5C\uC18C\uD55C name.first, name.last, location.city \uD544\uB4DC\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.","JSON \uBB38\uC790\uC5F4(string)\uACFC \uD30C\uC2F1\uB41C \uAC1D\uCCB4 \uBAA8\uB450 \uD5C8\uC6A9\uB429\uB2C8\uB2E4 (CLI / MCP \uBAA8\uB450 \uB3D9\uC791).","\uACB0\uACFC\uB294 \uD56D\uC0C1 '\uC774\uB984\uC740 {first} {last} \uC774\uACE0 \uD604\uC7AC {city} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.' \uD615\uC2DD\uC758 \uD55C\uAE00 \uBB38\uC7A5\uC785\uB2C8\uB2E4."]}},F=Z.getUserTool;var B={...g,...S,...Z};export{x as cn,N as generateReadmeSkills,k as generateSkillMarkdown,B as tools};
package/dist/server.js CHANGED
@@ -1,2 +1,5 @@
1
1
  #!/usr/bin/env node
2
- function s(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 p(e,n){let o=new f(e);for(let t of n)o.registerTool(t.name,{description:t.description,inputSchema:t.inputSchema},t.handler);return o}async function u(e){let n=new m;await e.connect(n)}import{z as b}from"zod";import{z as A}from"zod";import{z as r}from"zod";function d(...e){return e.filter(Boolean).join(" ")}var a={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:r.array(r.string()).describe("List of class names to merge")},handler:async({classes:e})=>s(d(...e)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:r.string().describe("Text to convert"),to:r.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:e,to:n})=>s(g(e,n)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:r.string().describe("Text to truncate"),maxLength:r.number().int().positive().describe("Maximum character length"),suffix:r.string().default("...").describe("Suffix to append when truncated")},handler:async({input:e,maxLength:n,suffix:o})=>{let t=e.length<=n?e:e.slice(0,n-o.length)+o;return s(t)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},i=a.cnTool,l=a.caseConvertTool,c=a.truncateTool;function g(e,n){switch(n){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();case"camel":return e.replace(/[-_\s]+(.)/g,(o,t)=>t.toUpperCase()).replace(/^(.)/,o=>o.toLowerCase());case"snake":return e.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return e.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}var y=p({name:"mono-rele2-utils",version:"1.0.0"},[i,l,c]);u(y).catch(e=>{console.error("[utils] server error:",e),process.exit(1)});
2
+ function r(e){return{content:[{type:"text",text:e}]}}import{McpServer as O}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as A}from"@modelcontextprotocol/sdk/server/stdio.js";function b(e,t){let n=new O(e);for(let o of t)n.registerTool(o.name,{description:o.description,inputSchema:o.inputSchema},o.handler);return n}async function S(e){let t=new A;await e.connect(t)}import{z as M}from"zod";import{z as P}from"zod";import{z as i}from"zod";function x(...e){return e.filter(Boolean).join(" ")}var a={cnTool:{name:"cn",description:"Merges class names, filtering out falsy values",inputSchema:{classes:i.array(i.string()).describe("List of class names to merge")},handler:async({classes:e})=>r(x(...e)),examples:[{args:[`'["btn","active","large"]'`],result:"btn active large"}]},caseConvertTool:{name:"case_convert",description:"Converts text to the specified case format",inputSchema:{input:i.string().describe("Text to convert"),to:i.enum(["upper","lower","capitalize","camel","snake","kebab"]).describe("Target case format")},handler:async({input:e,to:t})=>r(z(e,t)),examples:[{args:['"hello world"',"camel"],result:"helloWorld"},{args:['"helloWorld"',"snake"],result:"hello_world"},{args:['"hello world"',"kebab"],result:"hello-world"}]},truncateTool:{name:"truncate",description:"Truncates text to a maximum length and appends a suffix",inputSchema:{input:i.string().describe("Text to truncate"),maxLength:i.number().int().positive().describe("Maximum character length"),suffix:i.string().default("...").describe("Suffix to append when truncated")},handler:async({input:e,maxLength:t,suffix:n})=>{let o=e.length<=t?e:e.slice(0,t-n.length)+n;return r(o)},examples:[{args:['"hello world long text"',"10"],result:"hello w..."},{args:['"hello world"',"8",'"\u2026"'],result:"hello w\u2026"}]}},u=a.cnTool,d=a.caseConvertTool,f=a.truncateTool;function z(e,t){switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();case"camel":return e.replace(/[-_\s]+(.)/g,(n,o)=>o.toUpperCase()).replace(/^(.)/,n=>n.toLowerCase());case"snake":return e.replace(/([A-Z])/g,"_$1").replace(/[-\s]+/g,"_").toLowerCase().replace(/^_/,"");case"kebab":return e.replace(/([A-Z])/g,"-$1").replace(/[_\s]+/g,"-").toLowerCase().replace(/^-/,"")}}import{z as l}from"zod";function v(e){let t=typeof e=="string"?JSON.parse(e):e,n={};function o(s,p){if(s===null||typeof s!="object"||Array.isArray(s)){n[p]=s;return}for(let[h,j]of Object.entries(s)){let $=p?`${p}.${h}`:h;o(j,$)}}return o(t,""),n}var m={objectFlattenTool:{name:"object_flatten",description:"Flattens a nested JSON object of any depth into dot-notation key-value pairs. Accepts a JSON string and recursively flattens all levels. Arrays and primitives at any level are treated as leaf values.",inputSchema:{json:l.union([l.string(),l.record(l.string(),l.any())]).describe("JSON string or parsed object to flatten (unlimited depth)")},handler:async({json:e})=>{try{let n=v(e);return r(JSON.stringify(n,null,2))}catch(t){return t instanceof SyntaxError?r("Error: invalid JSON string \u2014 unable to parse input"):r(`Error: failed to flatten object \u2014 ${t.message}`)}},examples:[{args:[`'{"user":{"name":"Alice","address":{"city":"Seoul","zip":"12345"}},"active":true}'`],result:JSON.stringify({"user.name":"Alice","user.address.city":"Seoul","user.address.zip":"12345",active:!0},null,2)},{args:[`'{"a":{"b":{"c":{"d":{"e":"deep"}}}}}'`],result:JSON.stringify({"a.b.c.d.e":"deep"},null,2)}],guidelines:["Arrays and primitives at any level are always treated as leaf values \u2014 they are never traversed.","The result is always a flat JSON object with dot-notation keys.","There is no depth limit \u2014 objects of any nesting level are fully flattened.","Input is accepted as a JSON string (MCP/CLI) and parsed internally."]}},g=m.objectFlattenTool;import{z as c}from"zod";function k(e){let t=typeof e=="string"?JSON.parse(e):e,{first:n,last:o}=t.name,s=t.location.city;return`\uC774\uB984\uC740 ${n} ${o} \uC774\uACE0 \uD604\uC7AC ${s} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.`}var y={getUserTool:{name:"getUser",description:"RandomUser API \uD615\uC2DD\uC758 \uC0AC\uC6A9\uC790 \uAC1D\uCCB4\uB97C \uBC1B\uC544 \uC774\uB984\uACFC \uAC70\uC8FC \uB3C4\uC2DC\uB85C \uAD6C\uC131\uB41C \uD55C\uAE00 \uBB38\uC7A5\uC744 \uBC18\uD658\uD569\uB2C8\uB2E4. JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uD30C\uC2F1\uB41C \uAC1D\uCCB4\uB97C \uC785\uB825\uBC1B\uC2B5\uB2C8\uB2E4.",inputSchema:{user:c.union([c.string(),c.record(c.string(),c.any())]).describe("RandomUser \uD615\uC2DD\uC758 JSON \uBB38\uC790\uC5F4 \uB610\uB294 \uAC1D\uCCB4 \u2014 name.first / name.last / location.city \uD544\uC218")},typeLabels:{user:"RandomUser"},typeDefs:{user:["interface RandomUser {",' gender: "male" | "female";'," name: {"," title: string;"," first: string;"," last: string;"," };"," location: {"," street: {"," number: number;"," name: string;"," };"," city: string;"," state: string;"," country: string;"," postcode: string | number;"," coordinates: {"," latitude: string;"," longitude: string;"," };"," timezone: {"," offset: string;"," description: string;"," };"," };"," email: string;"," login: {"," uuid: string;"," username: string;"," };"," dob: {"," date: string;"," age: number;"," };"," phone: string;"," cell: string;"," picture: {"," large: string;"," medium: string;"," thumbnail: string;"," };"," nat: string;","}"].join(`
3
+ `)},handler:async({user:e})=>{try{let n=k(e);return r(n)}catch(t){return t instanceof SyntaxError?r("Error: invalid JSON string \u2014 unable to parse input"):r(`Error: failed to process user data \u2014 ${t.message}
4
+
5
+ Input must include \`name.first\`, \`name.last\`, and \`location.city\`.`)}},examples:[{args:[`'{"name":{"title":"Mr","first":"Alice","last":"Kim"},"location":{"city":"Seoul"},"gender":"female","email":"alice@example.com","nat":"KR"}'`],result:"\uC774\uB984\uC740 Alice Kim \uC774\uACE0 \uD604\uC7AC Seoul \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4."}],guidelines:["\uC785\uB825\uC740 RandomUser API \uC2A4\uD399\uC744 \uB530\uB985\uB2C8\uB2E4. \uCD5C\uC18C\uD55C name.first, name.last, location.city \uD544\uB4DC\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.","JSON \uBB38\uC790\uC5F4(string)\uACFC \uD30C\uC2F1\uB41C \uAC1D\uCCB4 \uBAA8\uB450 \uD5C8\uC6A9\uB429\uB2C8\uB2E4 (CLI / MCP \uBAA8\uB450 \uB3D9\uC791).","\uACB0\uACFC\uB294 \uD56D\uC0C1 '\uC774\uB984\uC740 {first} {last} \uC774\uACE0 \uD604\uC7AC {city} \uC5D0 \uC0B4\uACE0 \uC788\uC2B5\uB2C8\uB2E4.' \uD615\uC2DD\uC758 \uD55C\uAE00 \uBB38\uC7A5\uC785\uB2C8\uB2E4."]}},T=y.getUserTool;var de={...a,...m,...y};var D=b({name:"mono-rele2-utils",version:"1.0.0"},[u,d,f,g,T]);S(D).catch(e=>{console.error("[utils] server error:",e),process.exit(1)});
@@ -38,6 +38,69 @@ Truncates text to a maximum length and appends a suffix
38
38
  | `maxLength` | Maximum character length |
39
39
  | `suffix` | Suffix to append when truncated — default: `...` |
40
40
 
41
+ ### objectFlattenTool
42
+
43
+ Flattens a nested JSON object of any depth into dot-notation key-value pairs. Accepts a JSON string and recursively flattens all levels. Arrays and primitives at any level are treated as leaf values.
44
+
45
+ | arg | description |
46
+ |-----|-------------|
47
+ | `json` | JSON string or parsed object to flatten (unlimited depth) |
48
+
49
+ ### getUserTool
50
+
51
+ RandomUser API 형식의 사용자 객체를 받아 이름과 거주 도시로 구성된 한글 문장을 반환합니다. JSON 문자열 또는 파싱된 객체를 입력받습니다.
52
+
53
+ | arg | description |
54
+ |-----|-------------|
55
+ | `user` | Type: RandomUser — RandomUser 형식의 JSON 문자열 또는 객체 — name.first / name.last / location.city 필수 |
56
+
57
+ **`user`** type definition:
58
+ ```typescript
59
+ interface RandomUser {
60
+ gender: "male" | "female";
61
+ name: {
62
+ title: string;
63
+ first: string;
64
+ last: string;
65
+ };
66
+ location: {
67
+ street: {
68
+ number: number;
69
+ name: string;
70
+ };
71
+ city: string;
72
+ state: string;
73
+ country: string;
74
+ postcode: string | number;
75
+ coordinates: {
76
+ latitude: string;
77
+ longitude: string;
78
+ };
79
+ timezone: {
80
+ offset: string;
81
+ description: string;
82
+ };
83
+ };
84
+ email: string;
85
+ login: {
86
+ uuid: string;
87
+ username: string;
88
+ };
89
+ dob: {
90
+ date: string;
91
+ age: number;
92
+ };
93
+ phone: string;
94
+ cell: string;
95
+ picture: {
96
+ large: string;
97
+ medium: string;
98
+ thumbnail: string;
99
+ };
100
+ nat: string;
101
+ }
102
+ ```
103
+
41
104
  ## Examples
42
105
 
43
106
  - `mono-rele2-utils-cli cnTool '["btn","active","large"]'` => `btn active large`
@@ -46,6 +109,16 @@ Truncates text to a maximum length and appends a suffix
46
109
  - `mono-rele2-utils-cli caseConvertTool "hello world" kebab` => `hello-world`
47
110
  - `mono-rele2-utils-cli truncateTool "hello world long text" 10` => `hello w...`
48
111
  - `mono-rele2-utils-cli truncateTool "hello world" 8 "…"` => `hello w…`
112
+ - `mono-rele2-utils-cli objectFlattenTool '{"user":{"name":"Alice","address":{"city":"Seoul","zip":"12345"}},"active":true}'` => `{
113
+ "user.name": "Alice",
114
+ "user.address.city": "Seoul",
115
+ "user.address.zip": "12345",
116
+ "active": true
117
+ }`
118
+ - `mono-rele2-utils-cli objectFlattenTool '{"a":{"b":{"c":{"d":{"e":"deep"}}}}}'` => `{
119
+ "a.b.c.d.e": "deep"
120
+ }`
121
+ - `mono-rele2-utils-cli getUserTool '{"name":{"title":"Mr","first":"Alice","last":"Kim"},"location":{"city":"Seoul"},"gender":"female","email":"alice@example.com","nat":"KR"}'` => `이름은 Alice Kim 이고 현재 Seoul 에 살고 있습니다.`
49
122
 
50
123
  ## Guidelines
51
124
 
@@ -53,4 +126,11 @@ Truncates text to a maximum length and appends a suffix
53
126
  - Numeric args are auto-parsed — pass as plain numbers (e.g. `10`)
54
127
  - Array args must be valid JSON — wrap in single quotes on Unix shells (e.g. `'["a","b"]'`)
55
128
  - Optional args with defaults may be omitted
129
+ - Arrays and primitives at any level are always treated as leaf values — they are never traversed.
130
+ - The result is always a flat JSON object with dot-notation keys.
131
+ - There is no depth limit — objects of any nesting level are fully flattened.
132
+ - Input is accepted as a JSON string (MCP/CLI) and parsed internally.
133
+ - 입력은 RandomUser API 스펙을 따릅니다. 최소한 name.first, name.last, location.city 필드가 필요합니다.
134
+ - JSON 문자열(string)과 파싱된 객체 모두 허용됩니다 (CLI / MCP 모두 동작).
135
+ - 결과는 항상 '이름은 {first} {last} 이고 현재 {city} 에 살고 있습니다.' 형식의 한글 문장입니다.
56
136
  - Run `mono-rele2-utils-cli` with no args to list all available skills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julong/mono-rele2-utils",
3
- "version": "1.18.0",
3
+ "version": "1.20.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",