sh-ui-cli 0.45.1 → 0.45.3

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.
Files changed (93) hide show
  1. package/data/changelog/versions.json +25 -0
  2. package/data/registry/react/components/accordion/index.tailwind.tsx +5 -7
  3. package/data/registry/react/components/accordion/index.tsx +5 -7
  4. package/data/registry/react/components/avatar/index.tailwind.tsx +4 -6
  5. package/data/registry/react/components/avatar/index.tsx +4 -6
  6. package/data/registry/react/components/badge/index.tailwind.tsx +2 -4
  7. package/data/registry/react/components/badge/index.tsx +2 -4
  8. package/data/registry/react/components/breadcrumb/index.tailwind.tsx +8 -10
  9. package/data/registry/react/components/breadcrumb/index.tsx +8 -10
  10. package/data/registry/react/components/button/index.tailwind.tsx +2 -1
  11. package/data/registry/react/components/button/index.tsx +3 -4
  12. package/data/registry/react/components/calendar/index.tailwind.tsx +10 -12
  13. package/data/registry/react/components/calendar/index.tsx +9 -11
  14. package/data/registry/react/components/card/index.tailwind.tsx +8 -10
  15. package/data/registry/react/components/card/index.tsx +8 -10
  16. package/data/registry/react/components/carousel/index.tailwind.tsx +7 -9
  17. package/data/registry/react/components/carousel/index.tsx +7 -9
  18. package/data/registry/react/components/checkbox/index.tailwind.tsx +3 -5
  19. package/data/registry/react/components/checkbox/index.tsx +3 -5
  20. package/data/registry/react/components/code-editor/index.tailwind.tsx +2 -4
  21. package/data/registry/react/components/code-editor/index.tsx +2 -4
  22. package/data/registry/react/components/code-panel/index.tailwind.tsx +5 -7
  23. package/data/registry/react/components/code-panel/index.tsx +5 -7
  24. package/data/registry/react/components/color-picker/index.tailwind.tsx +7 -6
  25. package/data/registry/react/components/color-picker/index.tsx +7 -6
  26. package/data/registry/react/components/combobox/index.tailwind.tsx +8 -10
  27. package/data/registry/react/components/combobox/index.tsx +8 -10
  28. package/data/registry/react/components/context-menu/index.tailwind.tsx +10 -12
  29. package/data/registry/react/components/context-menu/index.tsx +10 -12
  30. package/data/registry/react/components/date-picker/index.tailwind.tsx +7 -9
  31. package/data/registry/react/components/date-picker/index.tsx +7 -9
  32. package/data/registry/react/components/dialog/index.tailwind.tsx +6 -8
  33. package/data/registry/react/components/dialog/index.tsx +6 -8
  34. package/data/registry/react/components/dropdown-menu/index.tailwind.tsx +10 -12
  35. package/data/registry/react/components/dropdown-menu/index.tsx +10 -12
  36. package/data/registry/react/components/file-upload/index.tailwind.tsx +6 -8
  37. package/data/registry/react/components/file-upload/index.tsx +6 -8
  38. package/data/registry/react/components/form/field.tailwind.tsx +2 -1
  39. package/data/registry/react/components/form/field.tsx +2 -3
  40. package/data/registry/react/components/header/index.tailwind.tsx +17 -19
  41. package/data/registry/react/components/header/index.tsx +17 -19
  42. package/data/registry/react/components/input/index.tailwind.tsx +4 -6
  43. package/data/registry/react/components/input/index.tsx +4 -6
  44. package/data/registry/react/components/label/index.tailwind.tsx +6 -8
  45. package/data/registry/react/components/label/index.tsx +6 -8
  46. package/data/registry/react/components/markdown-editor/index.tailwind.tsx +2 -4
  47. package/data/registry/react/components/markdown-editor/index.tsx +2 -4
  48. package/data/registry/react/components/menubar/index.tailwind.tsx +2 -4
  49. package/data/registry/react/components/menubar/index.tsx +2 -4
  50. package/data/registry/react/components/numeric-input/index.tailwind.tsx +2 -4
  51. package/data/registry/react/components/numeric-input/index.tsx +2 -4
  52. package/data/registry/react/components/page-toc/index.tailwind.tsx +3 -2
  53. package/data/registry/react/components/page-toc/index.tsx +2 -3
  54. package/data/registry/react/components/pagination/index.tailwind.tsx +8 -10
  55. package/data/registry/react/components/pagination/index.tsx +8 -10
  56. package/data/registry/react/components/popover/index.tailwind.tsx +4 -6
  57. package/data/registry/react/components/popover/index.tsx +4 -6
  58. package/data/registry/react/components/progress/index.tailwind.tsx +3 -5
  59. package/data/registry/react/components/progress/index.tsx +2 -4
  60. package/data/registry/react/components/radio/index.tailwind.tsx +3 -5
  61. package/data/registry/react/components/radio/index.tsx +3 -5
  62. package/data/registry/react/components/rich-text-editor/index.tailwind.tsx +3 -5
  63. package/data/registry/react/components/rich-text-editor/index.tsx +3 -5
  64. package/data/registry/react/components/select/index.tailwind.tsx +8 -10
  65. package/data/registry/react/components/select/index.tsx +8 -10
  66. package/data/registry/react/components/separator/index.tailwind.tsx +2 -4
  67. package/data/registry/react/components/separator/index.tsx +2 -4
  68. package/data/registry/react/components/sidebar/index.tailwind.tsx +32 -43
  69. package/data/registry/react/components/sidebar/index.tsx +29 -46
  70. package/data/registry/react/components/skeleton/index.tailwind.tsx +2 -4
  71. package/data/registry/react/components/skeleton/index.tsx +2 -4
  72. package/data/registry/react/components/slider/index.tailwind.tsx +5 -7
  73. package/data/registry/react/components/slider/index.tsx +5 -7
  74. package/data/registry/react/components/spinner/index.tailwind.tsx +3 -5
  75. package/data/registry/react/components/spinner/index.tsx +2 -4
  76. package/data/registry/react/components/switch/index.tailwind.tsx +3 -5
  77. package/data/registry/react/components/switch/index.tsx +2 -4
  78. package/data/registry/react/components/tabs/index.tailwind.tsx +6 -8
  79. package/data/registry/react/components/tabs/index.tsx +6 -8
  80. package/data/registry/react/components/textarea/index.tailwind.tsx +2 -4
  81. package/data/registry/react/components/textarea/index.tsx +2 -4
  82. package/data/registry/react/components/toggle/index.tailwind.tsx +4 -6
  83. package/data/registry/react/components/toggle/index.tsx +4 -6
  84. package/data/registry/react/components/tooltip/index.tailwind.tsx +2 -4
  85. package/data/registry/react/components/tooltip/index.tsx +2 -4
  86. package/data/registry/react/lib/cn.tailwind.ts +17 -0
  87. package/data/registry/react/peer-versions.json +3 -1
  88. package/data/registry/react/registry.json +159 -43
  89. package/package.json +1 -1
  90. package/src/add.mjs +25 -1
  91. package/src/mcp-init.mjs +13 -5
  92. package/src/mcp.mjs +20 -15
  93. package/templates/ui-app-template/sh-ui.config.json +5 -0
package/src/mcp-init.mjs CHANGED
@@ -19,10 +19,18 @@ import { homedir, platform as osPlatform } from "node:os";
19
19
 
20
20
  const CLIENTS = ["claude-code", "cursor", "claude-desktop"];
21
21
 
22
- const SH_UI_ENTRY = {
23
- command: "npx",
24
- args: ["-y", "sh-ui-cli", "mcp"],
25
- };
22
+ /**
23
+ * `npx -y <cliName> mcp` 형태의 MCP 엔트리 빌더.
24
+ * 패키지명을 package.json 에서 동적으로 읽어 cli rename 시에도 자동 따라감.
25
+ */
26
+ async function buildShUiEntry() {
27
+ const pkgUrl = new URL("../package.json", import.meta.url);
28
+ const pkg = JSON.parse(await readFile(pkgUrl, "utf8"));
29
+ return {
30
+ command: "npx",
31
+ args: ["-y", pkg.name, "mcp"],
32
+ };
33
+ }
26
34
 
27
35
  /** 클라이언트·스코프별 설정 파일 절대 경로. */
28
36
  function resolveConfigPath(client, scope, cwd) {
@@ -115,7 +123,7 @@ export async function mcpInit({ cwd, args }) {
115
123
  }
116
124
 
117
125
  const before = config.mcpServers["sh-ui"];
118
- config.mcpServers["sh-ui"] = SH_UI_ENTRY;
126
+ config.mcpServers["sh-ui"] = await buildShUiEntry();
119
127
 
120
128
  await mkdir(dirname(configPath), { recursive: true });
121
129
  await writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
package/src/mcp.mjs CHANGED
@@ -120,7 +120,22 @@ function resolveCwd(input) {
120
120
  return input?.cwd ? resolve(input.cwd) : process.cwd();
121
121
  }
122
122
 
123
- const SERVER_INSTRUCTIONS = `sh-ui — Base UI 위에 빌드된 React/Flutter 디자인 시스템.
123
+ /**
124
+ * 하드코딩 제거 — packages/cli/package.json 에서 version + name 을 시작 시점에 읽어 그대로 사용.
125
+ * mcp.mjs 가 src/ 에 있고 package.json 은 그 상위 (../package.json) 라 상대 URL 로 해석.
126
+ * 출고 모드 (data/ 번들) 에서도 동일 경로 (src/mcp.mjs ↔ package.json) 라 그대로 동작.
127
+ *
128
+ * version: McpServer 식별자 — 클라이언트가 캐시·진단용으로 표시
129
+ * name: SERVER_INSTRUCTIONS 의 `npx <cli> ...` 예시에 보간 — cli rename 시 자동 따라감
130
+ */
131
+ async function readPackageMeta() {
132
+ const pkgUrl = new URL("../package.json", import.meta.url);
133
+ const pkg = JSON.parse(await readFile(pkgUrl, "utf8"));
134
+ return { version: pkg.version, name: pkg.name };
135
+ }
136
+
137
+ function buildServerInstructions(cliName) {
138
+ return `sh-ui — Base UI 위에 빌드된 React/Flutter 디자인 시스템.
124
139
 
125
140
  ## 새 프로젝트를 만드는 경우
126
141
 
@@ -131,7 +146,7 @@ const SERVER_INSTRUCTIONS = `sh-ui — Base UI 위에 빌드된 React/Flutter
131
146
  - 인터랙티브 프롬프트 없이 한 번에 스캐폴드 + 토큰 + sh-ui.config.json 생성
132
147
 
133
148
  **2차 — Bash** (사용자가 직접 셸에서 돌리고 싶다고 명시할 때만):
134
- npx sh-ui-cli create my-app --platform next --structure standalone --yes
149
+ npx ${cliName} create my-app --platform next --structure standalone --yes
135
150
 
136
151
  \`create-next-app\` + \`sh_ui_init\` 조합은 **쓰지 말 것** — 위 두 경로가 더 짧고 sh-ui 관용에 맞다.
137
152
 
@@ -149,25 +164,15 @@ const SERVER_INSTRUCTIONS = `sh-ui — Base UI 위에 빌드된 React/Flutter
149
164
  - \`sh_ui_add_component\` / \`sh_ui_remove_component\` — 설치/삭제
150
165
  - \`sh_ui_get_changelog\` — 최근 변경 내역
151
166
  `;
152
-
153
- /**
154
- * 하드코딩 제거 — packages/cli/package.json 의 version 을 시작 시점에 읽어 그대로 사용.
155
- * mcp.mjs 가 src/ 에 있고 package.json 은 그 상위 (../package.json) 라 상대 URL 로 해석.
156
- * 출고 모드 (data/ 번들) 에서도 동일 경로 (src/mcp.mjs ↔ package.json) 라 그대로 동작.
157
- */
158
- async function readPackageVersion() {
159
- const pkgUrl = new URL("../package.json", import.meta.url);
160
- const pkg = JSON.parse(await readFile(pkgUrl, "utf8"));
161
- return pkg.version;
162
167
  }
163
168
 
164
169
  export async function startMcpServer() {
165
- const version = await readPackageVersion();
170
+ const { version, name: cliName } = await readPackageMeta();
166
171
  const server = new McpServer(
167
172
  { name: "sh-ui", version },
168
173
  {
169
174
  capabilities: { tools: {} },
170
- instructions: SERVER_INSTRUCTIONS,
175
+ instructions: buildServerInstructions(cliName),
171
176
  },
172
177
  );
173
178
 
@@ -187,7 +192,7 @@ export async function startMcpServer() {
187
192
  {
188
193
  description:
189
194
  "빈 폴더에 sh-ui 프로젝트 스캐폴드 — Next.js (standalone/monorepo) 또는 Flutter. " +
190
- "FSD 폴더 구조 + 토큰 + sh-ui.config.json 일괄 생성. 사용자가 '새 프로젝트' / '빈 폴더' / '스캐폴드부터' 류 요청을 하면 이 툴 사용 (Bash 로 npx sh-ui-cli create 직접 호출보다 우선).",
195
+ `FSD 폴더 구조 + 토큰 + sh-ui.config.json 일괄 생성. 사용자가 '새 프로젝트' / '빈 폴더' / '스캐폴드부터' 류 요청을 하면 이 툴 사용 (Bash 로 npx ${cliName} create 직접 호출보다 우선).`,
191
196
  inputSchema: {
192
197
  name: z.string().min(1)
193
198
  .describe("프로젝트 디렉토리 이름. 예: my-app"),
@@ -10,5 +10,10 @@
10
10
  "tokens": "src/styles/tokens.css",
11
11
  "components": "src/components",
12
12
  "utils": "src/lib/utils.ts"
13
+ },
14
+ "aliases": {
15
+ "components": "@/components",
16
+ "utils": "@/lib/utils",
17
+ "ui": "@/components"
13
18
  }
14
19
  }