smoothui-cli 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Eduardo Calvo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,463 @@
1
+ # SmoothUI
2
+
3
+ ![Screenshot of SmoothUI](/apps/docs/public/readme.png)
4
+
5
+ <div align="center">
6
+
7
+ ![Next.js Badge](https://img.shields.io/badge/Next.js-000?logo=nextdotjs&logoColor=fff&style=flat)
8
+ ![Tailwind CSS Badge](https://img.shields.io/badge/Tailwind%20CSS-06B6D4?logo=tailwindcss&logoColor=fff&style=flat)
9
+ ![Motion Badge](https://img.shields.io/badge/Motion-ECD53F?style=flat)
10
+
11
+ [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpheralb%2Fsvgl%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/educlopez/smoothui/goto?ref=main)
12
+ ![GitHub stars](https://img.shields.io/github/stars/educlopez/smoothui)
13
+ ![GitHub issues](https://img.shields.io/github/issues/educlopez/smoothui)
14
+ ![GitHub forks](https://img.shields.io/github/forks/educlopez/smoothui)
15
+ ![GitHub PRs](https://img.shields.io/github/issues-pr/educlopez/smoothui)
16
+ [![Website](https://img.shields.io/badge/website-smoothui.dev-blue)](https://smoothui.dev)
17
+
18
+ </div>
19
+
20
+ SmoothUI is a collection of beautifully designed components with smooth animations built with React, Tailwind CSS, and Motion. This project aims to provide developers with a set of reusable UI components that enhance user experience through delightful animations and modern design patterns.
21
+
22
+ ## Table of Contents
23
+
24
+ - [SmoothUI](#smoothui)
25
+ - [Table of Contents](#table-of-contents)
26
+ - [Features](#features)
27
+ - [Quick Start](#quick-start)
28
+ - [Installation](#installation)
29
+ - [Using shadcn CLI v3 (Recommended)](#using-shadcn-cli-v3-recommended)
30
+ - [Step 1: Configure the Registry](#step-1-configure-the-registry)
31
+ - [Step 2: Install Components](#step-2-install-components)
32
+ - [Step 3: Use Components](#step-3-use-components)
33
+ - [Available Commands](#available-commands)
34
+ - [Manual Installation](#manual-installation)
35
+ - [Usage](#usage)
36
+ - [Basic Usage](#basic-usage)
37
+ - [Advanced Usage](#advanced-usage)
38
+ - [Available Components](#available-components)
39
+ - [UI Components](#ui-components)
40
+ - [Interactive Components](#interactive-components)
41
+ - [Layout Components](#layout-components)
42
+ - [Utility Components](#utility-components)
43
+ - [MCP Support](#mcp-support)
44
+ - [🤖 AI Assistant Integration](#-ai-assistant-integration)
45
+ - [Quick MCP Setup](#quick-mcp-setup)
46
+ - [Registry System](#registry-system)
47
+ - [Automatic Dependencies](#automatic-dependencies)
48
+ - [Component Structure](#component-structure)
49
+ - [Registry Features](#registry-features)
50
+ - [Troubleshooting](#troubleshooting)
51
+ - [Common Issues](#common-issues)
52
+ - [1. Authentication Error (401)](#1-authentication-error-401)
53
+ - [2. Registry Not Found](#2-registry-not-found)
54
+ - [3. Import Path Issues](#3-import-path-issues)
55
+ - [4. Missing Dependencies](#4-missing-dependencies)
56
+ - [Getting Help](#getting-help)
57
+ - [Contributing](#contributing)
58
+ - [Development Setup](#development-setup)
59
+ - [License](#license)
60
+
61
+ ## Features
62
+
63
+ - **Modern Design System**: A cohesive and contemporary design language with a new mascot called Smoothy
64
+ - **Smooth Animations**: Built-in animations powered by Motion for delightful user experiences
65
+ - **Responsive Design**: Fully responsive components designed with Tailwind CSS
66
+ - **Dark Mode Support**: Components support both light and dark themes out of the box
67
+ - **Color Customization**: Dynamic color switcher for easy theme customization
68
+ - **Documentation**: Comprehensive documentation with props, examples, and usage guidelines
69
+ - **Accessibility**: Enhanced accessibility features across all components
70
+ - **TypeScript Support**: Full TypeScript support with type definitions
71
+ - **Easy Integration**: Simple API for integrating components into your projects
72
+ - **shadcn CLI v3 Support**: Full compatibility with the new shadcn CLI v3 namespace system
73
+
74
+ ## Quick Start
75
+
76
+ Get started with SmoothUI in just a few steps:
77
+
78
+ 1. **Add the registry** to your `components.json`:
79
+
80
+ ```json
81
+ {
82
+ "registries": {
83
+ "@smoothui": "https://smoothui.dev/r/{name}.json"
84
+ }
85
+ }
86
+ ```
87
+
88
+ 2. **Install a component**:
89
+
90
+ ```bash
91
+ npx shadcn@latest add @smoothui/siri-orb
92
+ ```
93
+
94
+ 3. **Use the component**:
95
+
96
+ ```tsx
97
+ import { SiriOrb } from "@/components/smoothui/ui/SiriOrb";
98
+
99
+ export default function App() {
100
+ return <SiriOrb size="200px" />;
101
+ }
102
+ ```
103
+
104
+ ## Installation
105
+
106
+ ### Using shadcn CLI v3 (Recommended)
107
+
108
+ SmoothUI is fully compatible with the new shadcn CLI v3 namespace system. This is the easiest way to install and manage SmoothUI components.
109
+
110
+ #### Step 1: Configure the Registry
111
+
112
+ Add the SmoothUI registry to your `components.json` file:
113
+
114
+ ```json
115
+ {
116
+ "$schema": "https://ui.shadcn.com/schema.json",
117
+ "style": "new-york",
118
+ "rsc": true,
119
+ "tsx": true,
120
+ "tailwind": {
121
+ "config": "tailwind.config.js",
122
+ "css": "src/app/globals.css",
123
+ "baseColor": "neutral",
124
+ "cssVariables": true,
125
+ "prefix": ""
126
+ },
127
+ "aliases": {
128
+ "components": "@/components",
129
+ "utils": "@/lib/utils",
130
+ "ui": "@/components/ui"
131
+ },
132
+ "registries": {
133
+ "@smoothui": "https://smoothui.dev/r/{name}.json"
134
+ }
135
+ }
136
+ ```
137
+
138
+ #### Step 2: Install Components
139
+
140
+ Install components using the namespace:
141
+
142
+ ```bash
143
+ # Install a single component
144
+ npx shadcn@latest add @smoothui/siri-orb
145
+
146
+ # Install multiple components
147
+ npx shadcn@latest add @smoothui/rich-popover @smoothui/animated-input
148
+
149
+ # Install components with dependencies
150
+ npx shadcn@latest add @smoothui/scrollable-card-stack
151
+ ```
152
+
153
+ #### Step 3: Use Components
154
+
155
+ Import and use the installed components:
156
+
157
+ ```tsx
158
+ import { RichPopover } from "@/components/smoothui/ui/RichPopover";
159
+ import { SiriOrb } from "@/components/smoothui/ui/SiriOrb";
160
+
161
+ export default function App() {
162
+ return (
163
+ <div>
164
+ <SiriOrb size="200px" />
165
+ <RichPopover />
166
+ </div>
167
+ );
168
+ }
169
+ ```
170
+
171
+ #### Available Commands
172
+
173
+ ```bash
174
+ # View all available components
175
+ npx shadcn@latest search @smoothui
176
+
177
+ # View component details before installation
178
+ npx shadcn@latest view @smoothui/siri-orb
179
+
180
+ # Install components
181
+ npx shadcn@latest add @smoothui/component-name
182
+ ```
183
+
184
+ ### Manual Installation
185
+
186
+ If you prefer to install components manually, you can copy the component files directly:
187
+
188
+ 1. **Install dependencies**:
189
+
190
+ ```bash
191
+ pnpm add motion tailwindcss lucide-react clsx tailwind-merge
192
+ ```
193
+
194
+ 2. **Copy component files** from the [components directory](src/components/smoothui/ui/)
195
+
196
+ 3. **Set up utilities**:
197
+
198
+ ```bash
199
+ # Create lib/utils/cn.ts
200
+ mkdir -p lib/utils
201
+ ```
202
+
203
+ ```tsx
204
+ // lib/utils/cn.ts
205
+ import { clsx, type ClassValue } from "clsx";
206
+ import { twMerge } from "tailwind-merge";
207
+
208
+ export function cn(...inputs: ClassValue[]) {
209
+ return twMerge(clsx(inputs));
210
+ }
211
+ ```
212
+
213
+ ## Usage
214
+
215
+ ### Basic Usage
216
+
217
+ ```tsx
218
+ import { SiriOrb } from "@/components/smoothui/ui/SiriOrb";
219
+
220
+ export default function App() {
221
+ return (
222
+ <div className="flex min-h-screen items-center justify-center">
223
+ <SiriOrb
224
+ size="200px"
225
+ colors={{
226
+ bg: "oklch(95% 0.02 264.695)",
227
+ c1: "oklch(75% 0.15 350)",
228
+ c2: "oklch(80% 0.12 200)",
229
+ c3: "oklch(78% 0.14 280)",
230
+ }}
231
+ animationDuration={20}
232
+ />
233
+ </div>
234
+ );
235
+ }
236
+ ```
237
+
238
+ ### Advanced Usage
239
+
240
+ ```tsx
241
+ import { RichPopover } from "@/components/smoothui/ui/RichPopover";
242
+ import { ScrollableCardStack } from "@/components/smoothui/ui/ScrollableCardStack";
243
+
244
+ export default function Dashboard() {
245
+ const cards = [
246
+ {
247
+ id: "1",
248
+ name: "John Doe",
249
+ handle: "@johndoe",
250
+ avatar: "/avatars/john.jpg",
251
+ video: "/videos/john.mp4",
252
+ href: "https://twitter.com/johndoe",
253
+ },
254
+ // ... more cards
255
+ ];
256
+
257
+ return (
258
+ <div className="space-y-8">
259
+ <RichPopover />
260
+ <ScrollableCardStack items={cards} />
261
+ </div>
262
+ );
263
+ }
264
+ ```
265
+
266
+ ## Available Components
267
+
268
+ SmoothUI includes a wide variety of components:
269
+
270
+ ### UI Components
271
+
272
+ - **SiriOrb** - Animated orb with smooth color transitions
273
+ - **RichPopover** - Advanced popover with rich content
274
+ - **ScrollableCardStack** - Interactive card stack with smooth scrolling
275
+ - **AnimatedInput** - Input field with smooth animations
276
+ - **DynamicIsland** - iOS-style dynamic island component
277
+ - **FluidMorph** - Fluid morphing animations
278
+ - **MatrixCard** - Matrix-style card with particle effects
279
+
280
+ ### Interactive Components
281
+
282
+ - **CursorFollow** - Custom cursor following component
283
+ - **ScrambleHover** - Text scramble effect on hover
284
+ - **WaveText** - Animated wave text effect
285
+ - **TypewriterText** - Typewriter text animation
286
+
287
+ ### Layout Components
288
+
289
+ - **ExpandableCards** - Expandable card layout
290
+ - **ScrollableCardStack** - Stack of scrollable cards
291
+ - **AppDownloadStack** - App download showcase
292
+
293
+ ### Utility Components
294
+
295
+ - **ButtonCopy** - Copy button with feedback
296
+ - **ClipCornersButton** - Button with clipped corners
297
+ - **DotMorphButton** - Button with morphing dot animation
298
+
299
+ [View all components →](https://smoothui.dev)
300
+
301
+ ## MCP Support
302
+
303
+ SmoothUI is fully compatible with the **shadcn MCP server**, enabling AI assistants to discover and install components automatically.
304
+
305
+ ### 🤖 AI Assistant Integration
306
+
307
+ With MCP support, AI assistants like **Claude**, **Cursor**, and **GitHub Copilot** can:
308
+
309
+ - **Discover Components**: Browse all available SmoothUI components
310
+ - **Install Components**: Automatically install components with dependencies
311
+ - **Provide Usage Examples**: Get code examples and integration help
312
+ - **Smart Suggestions**: Receive intelligent component recommendations
313
+
314
+ ### Quick MCP Setup
315
+
316
+ 1. **Configure your registry** in `components.json`:
317
+
318
+ ```json
319
+ {
320
+ "registries": {
321
+ "@smoothui": "https://smoothui.dev/r/{name}.json"
322
+ }
323
+ }
324
+ ```
325
+
326
+ 2. **Install MCP server**:
327
+
328
+ ```bash
329
+ npx shadcn@latest mcp init --client claude
330
+ # or for Cursor: npx shadcn@latest mcp init --client cursor
331
+ # or for VS Code: npx shadcn@latest mcp init --client vscode
332
+ ```
333
+
334
+ 3. **Try these prompts**:
335
+
336
+ - "Show me the components in the smoothui registry"
337
+ - "Install the SiriOrb component from smoothui"
338
+ - "Create a landing page using smoothui components"
339
+
340
+ [Learn more about MCP support →](https://smoothui.dev/doc/mcp)
341
+
342
+ ## Registry System
343
+
344
+ SmoothUI uses a custom registry system compatible with shadcn CLI v3. Each component includes:
345
+
346
+ ### Automatic Dependencies
347
+
348
+ - **Package Dependencies**: Required npm packages are automatically included
349
+ - **Utility Files**: Shared utilities like `cn` are automatically bundled
350
+ - **Import Paths**: All import paths are automatically resolved
351
+
352
+ ### Component Structure
353
+
354
+ When you install a component, you get:
355
+
356
+ ```
357
+ components/smoothui/ui/
358
+ ├── ComponentName.tsx # Main component file
359
+ lib/utils/
360
+ └── cn.ts # Utility functions (if needed)
361
+ ```
362
+
363
+ ### Registry Features
364
+
365
+ - **Self-contained**: Each component includes all necessary dependencies
366
+ - **Type-safe**: Full TypeScript support with proper types
367
+ - **Optimized**: Components are optimized for performance
368
+ - **Accessible**: Built-in accessibility features
369
+
370
+ ## Troubleshooting
371
+
372
+ ### Common Issues
373
+
374
+ #### 1. Authentication Error (401)
375
+
376
+ **Error**: `You are not authorized to access the item`
377
+
378
+ **Solution**: This usually happens with Vercel preview deployments. Use the production URL:
379
+
380
+ ```json
381
+ {
382
+ "registries": {
383
+ "@smoothui": "https://smoothui.dev/r/{name}.json"
384
+ }
385
+ }
386
+ ```
387
+
388
+ #### 2. Registry Not Found
389
+
390
+ **Error**: `The item at https://smoothui.dev/r/registry.json was not found`
391
+
392
+ **Solution**: The search command might not work as expected. Install components directly:
393
+
394
+ ```bash
395
+ npx shadcn@latest add @smoothui/siri-orb
396
+ ```
397
+
398
+ #### 3. Import Path Issues
399
+
400
+ **Error**: `Cannot find module '@/lib/utils/cn'`
401
+
402
+ **Solution**: Make sure your `tsconfig.json` includes the path alias:
403
+
404
+ ```json
405
+ {
406
+ "compilerOptions": {
407
+ "paths": {
408
+ "@/*": ["./src/*"]
409
+ }
410
+ }
411
+ }
412
+ ```
413
+
414
+ #### 4. Missing Dependencies
415
+
416
+ **Error**: `Cannot find module 'clsx'`
417
+
418
+ **Solution**: Install missing dependencies:
419
+
420
+ ```bash
421
+ pnpm add clsx tailwind-merge motion
422
+ ```
423
+
424
+ ### Getting Help
425
+
426
+ - **Documentation**: Visit [smoothui.dev](https://smoothui.dev) for detailed documentation
427
+ - **Issues**: Report bugs on [GitHub Issues](https://github.com/educlopez/smoothui/issues)
428
+ - **Discussions**: Join discussions on [GitHub Discussions](https://github.com/educlopez/smoothui/discussions)
429
+
430
+ ## Contributing
431
+
432
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
433
+
434
+ ### Development Setup
435
+
436
+ 1. **Clone the repository**:
437
+
438
+ ```bash
439
+ git clone https://github.com/educlopez/smoothui.git
440
+ cd smoothui
441
+ ```
442
+
443
+ 2. **Install dependencies**:
444
+
445
+ ```bash
446
+ pnpm install
447
+ ```
448
+
449
+ 3. **Start development server**:
450
+
451
+ ```bash
452
+ pnpm dev
453
+ ```
454
+
455
+ 4. **Build registry**:
456
+
457
+ ```bash
458
+ pnpm run build:registry
459
+ ```
460
+
461
+ ## License
462
+
463
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{confirm as Le,isCancel as ne,select as Ne,spinner as De}from"@clack/prompts";var _="https://smoothui.dev",k={"Basic UI":["accordion","animated-input","animated-progress-bar","animated-tabs","animated-toggle","basic-dropdown","basic-modal","basic-toast","notification-badge","searchable-dropdown","skeleton-loader","tweet-card"],Buttons:["button-copy","clip-corners-button","dot-morph-button","magnetic-button"],"Text Effects":["wave-text","reveal-text","typewriter-text","scramble-hover","scroll-reveal-paragraph"],AI:["ai-branch","ai-input"],"Cards & Layouts":["expandable-cards","glow-hover-card","scrollable-card-stack","switchboard-card","phototab","job-listing-component"],"Loaders & Effects":["grid-loader","siri-orb","cursor-follow","github-stars-animation"],Interactive:["animated-o-t-p-input","animated-tags","app-download-stack","apple-invites","contribution-graph","dynamic-island","figma-comment","image-metadata-preview","infinite-slider","interactive-image-selector","number-flow","power-off-slide","price-flow","rich-popover","reviews-carousel","social-selector","user-account-avatar"]},K=["src/components/ui","components/ui","src/components","components","app/components/ui"],Y=[{file:"bun.lockb",cmd:"bun"},{file:"pnpm-lock.yaml",cmd:"pnpm"},{file:"yarn.lock",cmd:"yarn"},{file:"package-lock.json",cmd:"npm"}],d={active:"\u25C6",done:"\u25C7",selected:"\u25CF",unselected:"\u25CB",cursor:"\u276F",success:"\u2713",error:"\u2717",bar:"\u2502"};import{createInterface as le,emitKeypressEvents as pe}from"readline";import p from"picocolors";var me=e=>{let t=new Map;for(let o of e){let n=o.category||"Other";t.has(n)||t.set(n,[]),t.get(n)?.push(o)}return t},de=(e,t)=>{console.log(`${p.cyan(d.active)} ${e}`),console.log(`${p.dim(d.bar)}`),console.log(`${p.dim(d.bar)} Search: ${t}${p.dim("\u258C")}`),console.log(`${p.dim(d.bar)}`)},fe=(e,t,o)=>{let n=t?p.green(d.selected):p.dim(d.unselected),s=o?p.cyan(d.cursor):" ",r=o?p.cyan(e.label):e.label;console.log(`${p.dim(d.bar)} ${s} ${n} ${r}`)},ge=e=>{console.log(`${p.dim(d.bar)}`),console.log(`${p.dim(d.bar)} ${p.dim(`${e} selected \u2502 \u2191\u2193 navigate \u2502 space select \u2502 enter confirm \u2502 esc cancel`)}`)},ue=(e,t,o)=>{let n=0,s=t.scrollOffset,r=t.scrollOffset+o;for(let[c,a]of e){if(n>=r)break;n>=s&&console.log(`${p.dim(d.bar)} ${p.bold(p.dim(c))}`),n++;for(let i of a){if(n>=r)break;if(n>=s){let m=t.selected.has(i.value),l=n-1===t.cursorIndex;fe(i,m,l)}n++}}},he=(e,t,o,n)=>()=>{let s=B(t,o.searchQuery);process.stdout.write("\x1B[2J\x1B[H"),de(e,o.searchQuery);let r=me(s);ue(r,o,n),ge(o.selected.size)},B=(e,t)=>{if(!t)return e;let o=t.toLowerCase();return e.filter(n=>n.label.toLowerCase().includes(o)||n.category?.toLowerCase().includes(o))},ye=(e,t,o,n)=>{e.name==="up"?(t.cursorIndex=Math.max(0,t.cursorIndex-1),t.cursorIndex<t.scrollOffset&&(t.scrollOffset=t.cursorIndex)):e.name==="down"&&(t.cursorIndex=Math.min(o-1,t.cursorIndex+1),t.cursorIndex>=t.scrollOffset+n&&(t.scrollOffset=t.cursorIndex-n+1))},be=(e,t)=>{let o=t[e.cursorIndex];o&&(e.selected.has(o.value)?e.selected.delete(o.value):e.selected.add(o.value))},xe=(e,t,o)=>{t.name==="backspace"?(o.searchQuery=o.searchQuery.slice(0,-1),o.cursorIndex=0,o.scrollOffset=0):e&&e.length===1&&!t.ctrl&&!t.meta&&(o.searchQuery+=e,o.cursorIndex=0,o.scrollOffset=0)},Q=e=>{process.stdin.isTTY&&process.stdin.setRawMode(!1),e.close()},H=e=>{let{message:t,items:o,maxVisible:n=10}=e;return new Promise(s=>{let r={selected:new Set,searchQuery:"",cursorIndex:0,scrollOffset:0},c=le({input:process.stdin,output:process.stdout});process.stdin.isTTY&&process.stdin.setRawMode(!0),pe(process.stdin,c);let a=he(t,o,r,n),i=(m,l)=>{let b=B(o,r.searchQuery),R=b.length;if(l.name==="escape"||l.ctrl&&l.name==="c"){Q(c),s(null);return}if(l.name==="return"){Q(c),s([...r.selected]);return}l.name==="up"||l.name==="down"?ye(l,r,R,n):l.name==="space"?be(r,b):xe(m,l,r),a()};process.stdin.on("keypress",i),a()})};import v from"picocolors";var O=d,C=v.dim,ve=v.cyan,we=v.green,Se=v.red,He=v.yellow,L=v.bold,N=v.gray;function T(e,t){console.log(`${e} ${t}`)}function j(e){T(ve(O.active),e)}function y(e){T(C(O.done),e)}function J(e){T(we(O.success),e)}function P(e){T(Se(O.error),e)}function g(e=""){console.log(`${C(O.bar)} ${e}`)}function I(){console.log(),j(L("SmoothUI")),console.log()}import{existsSync as M,readFileSync as W}from"fs";import{join as E}from"path";var Ie=/^(npm|pnpm|yarn|bun)@/,$e=()=>{let e=process.cwd();for(let{file:o,cmd:n}of Y)if(M(E(e,o)))return n;let t=E(e,"package.json");if(M(t))try{let o=JSON.parse(W(t,"utf-8"));if(o.packageManager){let n=o.packageManager.match(Ie);if(n)return n[1]}}catch{}return"npm"},Oe=()=>{let e=process.cwd();for(let t of K)if(M(E(e,t)))return t;return null},Ce=()=>{let e=process.cwd(),t=["tsconfig.json","jsconfig.json"];for(let o of t){let n=E(e,o);if(M(n))try{let r=W(n,"utf-8").replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),a=JSON.parse(r).compilerOptions?.paths;if(a){for(let[i,m]of Object.entries(a))if(i.endsWith("/*")&&Array.isArray(m))return i.slice(0,-2)}}catch{}}return"@"},q=()=>({componentPath:Oe()||"components/ui",alias:Ce(),packageManager:$e()});import{spawnSync as je}from"child_process";import{existsSync as z,mkdirSync as Pe,readFileSync as et,writeFileSync as Re}from"fs";import{dirname as ke,join as Te}from"path";var Me=(e,t)=>t==="@"?e:e.replace(/@\/components\//g,`${t}/components/`);var V=async(e,t,o,n)=>{let s=[],r=[],c=o;for(let a of e.files){let i=Te(process.cwd(),t.componentPath,a.path),m=ke(i);if(z(m)||Pe(m,{recursive:!0}),z(i)&&!c){let b=await n(a.path);if(b==="skip"){r.push(a.path);continue}b==="all"&&(c=!0)}let l=Me(a.content,t.alias);Re(i,l,"utf-8"),s.push(a.path)}return{written:s,skipped:r}},X=(e,t)=>{if(e.length===0)return!0;let o={npm:["npm","install",...e],pnpm:["pnpm","add",...e],yarn:["yarn","add",...e],bun:["bun","add",...e]},[n,...s]=o[t];return je(n,s,{stdio:"pipe",shell:!0}).status===0};var Z=process.env.SMOOTHUI_REGISTRY_URL||_,Ee=/\/r\/([^/]+)\.json$/;async function Ae(){let e=`${Z}/r/registry.json`,t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch registry: ${t.status}`);return t.json()}async function ee(e){let t=`${Z}/r/${e}.json`,o=await fetch(t);if(!o.ok)throw new Error(`Component "${e}" not found`);return o.json()}function te(e){let t=e.match(Ee);return t?t[1]:e}async function A(){return(await Ae()).items.map(t=>t.name)}async function D(e,t=new Set){let o=await ee(e);t.add(e);let n=[];if(o.registryDependencies)for(let s of o.registryDependencies){let r=te(s);if(t.has(r)||!s.includes("smoothui.dev"))continue;let c=await D(r,t);n.push(c)}return{component:o,children:n}}function F(e){let t=[e.component];for(let o of e.children)t.push(...F(o));return t}function oe(e){let t=new Set,o=new Set,n=new Set(["react","react-dom","next","tailwindcss","@types/react","@types/react-dom","@types/node","typescript"]);for(let s of e){for(let r of s.dependencies||[])n.has(r)||t.add(r);for(let r of s.devDependencies||[])n.has(r)||o.add(r)}return{dependencies:[...t],devDependencies:[...o]}}function U(e,t="",o=!0){g(`${t}${o?"\u2514\u2500":"\u251C\u2500"} ${e.component.name}`);let s=t+(o?" ":"\u2502 "),r=[...e.component.dependencies||[]].filter(c=>!["react","react-dom","next"].includes(c));r.length>0&&e.children.length===0&&g(`${s}\u2514\u2500 ${N(`npm: ${r.join(", ")}`)}`);for(let c=0;c<e.children.length;c++){let a=e.children[c],i=c===e.children.length-1&&r.length===0;U(a,s,i)}r.length>0&&e.children.length>0&&g(`${s}\u2514\u2500 ${N(`npm: ${r.join(", ")}`)}`)}async function re(e,t){I();let o=q();t.path&&(o.componentPath=t.path),y(`Detected: ${o.componentPath}/ (${o.packageManager})`),console.log();let n=e;if(n.length===0){let h=(await A()).map(f=>{let S="Other";for(let[ie,ae]of Object.entries(k))if(ae.includes(f)){S=ie;break}return{value:f,label:f,category:S}}),x=await H({message:"Select components to install:",items:h});if(!x||x.length===0){console.log(),y("No components selected.");return}n=x,y(`Selected: ${n.join(", ")}`),console.log()}j("Resolving dependencies..."),g();let s=[],r=new Set;for(let u of n)try{let h=await D(u,r),x=F(h);for(let f of x)r.has(f.name)||(r.add(f.name),s.push(f));U(h)}catch(h){P(`Failed to resolve ${u}: ${h.message}`);return}g();let{dependencies:c,devDependencies:a}=oe(s),i=[...c,...a],m=s.length,l=i.length,b=l>0?`Install ${m} component${m>1?"s":""} + ${l} npm package${l>1?"s":""}?`:`Install ${m} component${m>1?"s":""}?`,R=await Le({message:b});if(ne(R)||!R){y("Installation cancelled.");return}console.log();let G=t.force??!1;for(let u of s){let{written:h,skipped:x}=await V(u,o,G,async f=>{let S=await Ne({message:`File exists: ${f}`,options:[{value:"overwrite",label:"Overwrite"},{value:"skip",label:"Skip"},{value:"all",label:"Overwrite all"}]});return ne(S)?"skip":(S==="all"&&(G=!0),S)});for(let f of h)y(`Written: ${o.componentPath}/${f}`);for(let f of x)y(`Skipped: ${f}`)}if(i.length>0){let u=De();u.start(`Installing ${i.join(", ")}`),X(i,o.packageManager)?u.stop(`Installed: ${i.join(", ")}`):(u.stop("Failed to install dependencies"),g(`Run manually: ${o.packageManager} add ${i.join(" ")}`))}console.log(),J(`Done! ${m} component${m>1?"s":""} installed.`)}async function se(e){let t=await A();if(e.json){console.log(JSON.stringify(t,null,2));return}I(),j(`Available components (${t.length})`),g();let o=new Map;for(let n of t){let s="Other";for(let[c,a]of Object.entries(k))if(a.includes(n)){s=c;break}let r=o.get(s);r?r.push(n):o.set(s,[n])}for(let[n,s]of o){g(L(C(n)));for(let r of s.sort())g(` ${r}`);g()}y(`Use ${C("npx smoothui add <component>")} to install`)}var $=process.argv.slice(2),w=$[0];function ce(){I(),console.log("Usage: npx smoothui <command> [options]"),console.log(),console.log("Commands:"),console.log(" add [components...] Add components to your project"),console.log(" list List available components"),console.log(),console.log("Options:"),console.log(" --path <path> Custom component install path"),console.log(" --force Overwrite existing files without asking"),console.log(" --json Output as JSON (list command)"),console.log(" --help Show this help message"),console.log(),console.log("Examples:"),console.log(" npx smoothui add siri-orb"),console.log(" npx smoothui add siri-orb grid-loader"),console.log(" npx smoothui add # Interactive mode"),console.log(" npx smoothui list")}async function Fe(){try{if(!w||w==="--help"||w==="-h"){ce();return}if(w==="add"){let e=[],t,o=!1;for(let n=1;n<$.length;n++){let s=$[n];s==="--path"&&$[n+1]?(t=$[n+1],n++):s==="--force"||s==="-f"?o=!0:s.startsWith("-")||e.push(s)}await re(e,{path:t,force:o});return}if(w==="list"||w==="ls"){let e=$.includes("--json");await se({json:e});return}P(`Unknown command: ${w}`),ce(),process.exit(1)}catch(e){P(e.message),process.exit(1)}}Fe();
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "smoothui-cli",
3
+ "version": "1.0.0",
4
+ "author": "educalvolpz",
5
+ "description": "CLI to install SmoothUI components - beautifully designed React components with smooth animations",
6
+ "private": false,
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "cli",
10
+ "components",
11
+ "ui",
12
+ "react",
13
+ "tailwindcss",
14
+ "motion",
15
+ "framer-motion",
16
+ "shadcn",
17
+ "animations"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/educlopez/smoothui.git"
22
+ },
23
+ "homepage": "https://smoothui.dev",
24
+ "bugs": {
25
+ "url": "https://github.com/educlopez/smoothui/issues"
26
+ },
27
+ "bin": {
28
+ "smoothui": "dist/index.js"
29
+ },
30
+ "files": [
31
+ "dist/index.js"
32
+ ],
33
+ "scripts": {
34
+ "build": "turbo build",
35
+ "dev": "turbo dev",
36
+ "check": "ultracite check",
37
+ "fix": "ultracite fix",
38
+ "test": "turbo test",
39
+ "analyze": "turbo analyze",
40
+ "bump-deps": "npx npm-check-updates --deep -u -x shiki,next,recharts,require-in-the-middle && pnpm install",
41
+ "bump-ui": "npx shadcn@latest add --all --overwrite -c packages/shadcn-ui && npx shadcn@latest migrate radix -c packages/shadcn-ui",
42
+ "clean": "git clean -xdf node_modules"
43
+ },
44
+ "devDependencies": {
45
+ "@auto-it/first-time-contributor": "^11.3.0",
46
+ "@biomejs/biome": "2.3.12",
47
+ "@smoothui/data": "workspace:*",
48
+ "@types/node": "^24.7.2",
49
+ "tsup": "^8.5.0",
50
+ "turbo": "^2.5.8",
51
+ "typescript": "^5.9.3",
52
+ "ultracite": "^7.1.1",
53
+ "zod": "^4.1.12"
54
+ },
55
+ "engines": {
56
+ "node": ">=18"
57
+ },
58
+ "packageManager": "pnpm@10.20.0",
59
+ "type": "module",
60
+ "pnpm": {
61
+ "overrides": {
62
+ "glob": ">=10.5.0",
63
+ "@types/react": "^19.2.7",
64
+ "@types/react-dom": "^19.2.3",
65
+ "csstype": "^3.2.3"
66
+ }
67
+ },
68
+ "dependencies": {
69
+ "@clack/prompts": "^0.11.0",
70
+ "picocolors": "^1.1.1"
71
+ }
72
+ }