composter-cli 1.0.3 → 1.0.5

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 (2) hide show
  1. package/README.md +530 -0
  2. package/package.json +17 -4
package/README.md ADDED
@@ -0,0 +1,530 @@
1
+ # 🌱 Composter CLI
2
+
3
+ > Your personal vault for storing, syncing, and retrieving reusable React components from the command line.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/composter-cli.svg)](https://www.npmjs.com/package/composter-cli)
6
+ [![license](https://img.shields.io/npm/l/composter-cli.svg)](https://github.com/binit2-1/Composter/blob/main/LICENSE)
7
+ [![node](https://img.shields.io/node/v/composter-cli.svg)](https://nodejs.org)
8
+
9
+ **Composter** is like your personal shadcn/ui — but for YOUR components. Push components from any project, pull them into new ones, and let AI assistants access your vault via MCP.
10
+
11
+ ---
12
+
13
+ ## 🎯 Why Composter?
14
+
15
+ Ever built an amazing component and wanted to reuse it in another project? Tired of copy-pasting files and forgetting dependencies? Composter solves this:
16
+
17
+ - **No more copy-paste chaos** — Push once, pull anywhere
18
+ - **Dependencies tracked automatically** — Never forget to install packages again
19
+ - **Smart bundling** — Relative imports are bundled, npm packages are tracked
20
+ - **AI-ready** — Let Claude, Cursor, or Copilot access your vault via MCP
21
+ - **Private by default** — Your components, your vault, your control
22
+
23
+ ---
24
+
25
+ ## ✨ Features
26
+
27
+ | Feature | Description |
28
+ |---------|-------------|
29
+ | 📤 **Push** | Upload components with all local dependencies auto-bundled |
30
+ | 📥 **Pull** | Download components with original folder structure preserved |
31
+ | 📁 **Categories** | Organize components into logical groups (UI, Hooks, Utils) |
32
+ | 🔗 **Smart Bundling** | Automatically crawls `./` and `@/` imports |
33
+ | 📦 **Dependency Detection** | Reads your `package.json` and tracks npm packages |
34
+ | ⚠️ **Missing Dep Alerts** | Tells you exactly what to `npm install` after pulling |
35
+ | 🤖 **MCP Integration** | Works with AI assistants via Model Context Protocol |
36
+
37
+ ---
38
+
39
+ ## 📦 Installation
40
+
41
+ ### Global Install (Recommended)
42
+
43
+ ```bash
44
+ npm install -g composter-cli
45
+ ```
46
+
47
+ ### Using npx
48
+
49
+ ```bash
50
+ npx composter-cli login
51
+ ```
52
+
53
+ ### Verify Installation
54
+
55
+ ```bash
56
+ composter --version
57
+ ```
58
+
59
+ ---
60
+
61
+ ## 🚀 Quick Start
62
+
63
+ ### 1. Create an Account
64
+
65
+ Visit **[composter.vercel.app](https://composter.vercel.app)** and sign up.
66
+
67
+ ### 2. Login via CLI
68
+
69
+ ```bash
70
+ composter login
71
+ ```
72
+
73
+ ```
74
+ === Composter Login ===
75
+ ? Email: you@example.com
76
+ ? Password: ********
77
+
78
+ Logged in successfully!
79
+ Session expires: 2025-01-09T12:00:00.000Z
80
+ ```
81
+
82
+ ### 3. Create a Category
83
+
84
+ ```bash
85
+ composter mkcat ui
86
+ ```
87
+
88
+ ### 4. Push Your First Component
89
+
90
+ ```bash
91
+ composter push ui "Fancy Button" ./src/components/FancyButton.tsx
92
+ ```
93
+
94
+ ```
95
+ Scanning FancyButton.tsx and its dependencies...
96
+ 📦 Bundled 3 file(s) and detected 2 external package(s).
97
+ ✅ Success! Component 'Fancy Button' pushed to 'ui'.
98
+ ```
99
+
100
+ ### 5. Pull It In Another Project
101
+
102
+ ```bash
103
+ composter pull ui "Fancy Button" ./src/components/
104
+ ```
105
+
106
+ ```
107
+ ⏳ Fetching 'Fancy Button' from 'ui'...
108
+ 📦 Unpacking 3 file(s) into: /Users/you/new-project/src/components
109
+ + FancyButton.tsx
110
+ + FancyButton.module.css
111
+ + useButtonAnimation.ts
112
+
113
+ ⚠️ Missing Dependencies (Run this to fix):
114
+ npm install framer-motion clsx
115
+
116
+ ✅ Component 'Fancy Button' pulled successfully!
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 📖 Commands Reference
122
+
123
+ ### `composter login`
124
+
125
+ Authenticate with your Composter account.
126
+
127
+ ```bash
128
+ composter login
129
+ ```
130
+
131
+ **What happens:**
132
+ - Prompts for email and password
133
+ - Creates a JWT session token
134
+ - Stores session at `~/.config/composter/session.json`
135
+ - Session lasts 30 days
136
+
137
+ ---
138
+
139
+ ### `composter mkcat <category-name>`
140
+
141
+ Create a new category to organize your components.
142
+
143
+ ```bash
144
+ composter mkcat hooks
145
+ ```
146
+
147
+ **Output:**
148
+ ```
149
+ Category 'hooks' created successfully!
150
+ ID: clx1234567890
151
+ ```
152
+
153
+ **Rules:**
154
+ | Rule | Example |
155
+ |------|---------|
156
+ | No spaces | ❌ `my buttons` → ✅ `buttons` |
157
+ | Max 10 characters | ❌ `superlongname` → ✅ `utils` |
158
+ | Unique per user | Each category name must be unique |
159
+
160
+ ---
161
+
162
+ ### `composter ls`
163
+
164
+ List all your categories.
165
+
166
+ ```bash
167
+ composter ls
168
+ ```
169
+
170
+ **Output:**
171
+ ```
172
+ ui hooks utils layouts forms
173
+ ```
174
+
175
+ ---
176
+
177
+ ### `composter push <category> <title> <file-path>`
178
+
179
+ Push a component to your vault.
180
+
181
+ ```bash
182
+ composter push ui "Data Table" ./src/components/DataTable/index.tsx
183
+ ```
184
+
185
+ **Arguments:**
186
+
187
+ | Argument | Description | Example |
188
+ |----------|-------------|---------|
189
+ | `category` | Target category name | `ui` |
190
+ | `title` | Human-readable component name | `"Data Table"` |
191
+ | `file-path` | Entry file path | `./src/components/DataTable.tsx` |
192
+
193
+ **What gets bundled:**
194
+ ```
195
+ Your Entry File
196
+
197
+ ├── ./relative/imports → ✅ Bundled into package
198
+ ├── @/alias/imports → ✅ Bundled (assumes @/ = src/)
199
+ ├── ./styles.css → ✅ Bundled
200
+
201
+ └── External packages → 📦 Tracked as dependencies
202
+ ├── react
203
+ ├── framer-motion
204
+ └── @tanstack/react-table
205
+ ```
206
+
207
+ **Example Output:**
208
+ ```
209
+ Scanning DataTable.tsx and its dependencies...
210
+ 📦 Bundled 5 file(s) and detected 4 external package(s).
211
+ ✅ Success! Component 'Data Table' pushed to 'ui'.
212
+ ```
213
+
214
+ ---
215
+
216
+ ### `composter pull <category> <title> <target-directory>`
217
+
218
+ Pull a component from your vault.
219
+
220
+ ```bash
221
+ composter pull ui "Data Table" ./src/components/
222
+ ```
223
+
224
+ **Arguments:**
225
+
226
+ | Argument | Description | Example |
227
+ |----------|-------------|---------|
228
+ | `category` | Source category name | `ui` |
229
+ | `title` | Component name to pull | `"Data Table"` |
230
+ | `target-directory` | Where to save files | `./src/components/` |
231
+
232
+ **What happens:**
233
+ 1. Fetches component bundle from your vault
234
+ 2. Recreates original folder structure
235
+ 3. Writes all files to target directory
236
+ 4. Checks your `package.json` for missing dependencies
237
+ 5. Suggests `npm install` command if needed
238
+
239
+ **Example Output:**
240
+ ```
241
+ ⏳ Fetching 'Data Table' from 'ui'...
242
+ 📦 Unpacking 5 file(s) into: /Users/you/project/src/components
243
+ + DataTable/index.tsx
244
+ + DataTable/DataTableHeader.tsx
245
+ + DataTable/DataTableRow.tsx
246
+ + DataTable/DataTablePagination.tsx
247
+ + DataTable/data-table.css
248
+
249
+ ⚠️ Missing Dependencies (Run this to fix):
250
+ npm install @tanstack/react-table lucide-react
251
+
252
+ ✅ Component 'Data Table' pulled successfully!
253
+ ```
254
+
255
+ ---
256
+
257
+ ## 🔧 How Smart Bundling Works
258
+
259
+ When you push a component, the CLI performs intelligent dependency crawling:
260
+
261
+ ### Import Resolution
262
+
263
+ ```tsx
264
+ // Entry: src/components/Button.tsx
265
+
266
+ import { cn } from "@/lib/utils" // ✅ Bundled (alias import)
267
+ import { useToggle } from "./hooks/toggle" // ✅ Bundled (relative import)
268
+ import "./button.css" // ✅ Bundled (CSS import)
269
+ import { motion } from "framer-motion" // 📦 Tracked as npm dependency
270
+ import React from "react" // 📦 Tracked as npm dependency
271
+ ```
272
+
273
+ ### Alias Support
274
+
275
+ The `@/` alias is automatically resolved to your `src/` directory:
276
+
277
+ ```
278
+ @/components/Button → src/components/Button
279
+ @/lib/utils → src/lib/utils
280
+ @/hooks/useAuth → src/hooks/useAuth
281
+ ```
282
+
283
+ ### File Extensions
284
+
285
+ The crawler automatically resolves these extensions:
286
+
287
+ ```
288
+ import { Button } from "./Button"
289
+
290
+ Tries: Button.tsx → Button.ts → Button.jsx → Button.js → Button/index.tsx
291
+ ```
292
+
293
+ ### Package Version Detection
294
+
295
+ npm dependencies are tracked with versions from your `package.json`:
296
+
297
+ ```json
298
+ // Your package.json
299
+ {
300
+ "dependencies": {
301
+ "framer-motion": "^10.16.0",
302
+ "clsx": "^2.0.0"
303
+ }
304
+ }
305
+
306
+ // Stored with component
307
+ {
308
+ "framer-motion": "^10.16.0",
309
+ "clsx": "^2.0.0"
310
+ }
311
+ ```
312
+
313
+ ---
314
+
315
+ ## 🤖 AI Integration (MCP)
316
+
317
+ Composter includes a Model Context Protocol (MCP) server that lets AI assistants interact with your vault.
318
+
319
+ ### Supported Assistants
320
+
321
+ - **Claude Desktop** — Full MCP support
322
+ - **Cursor** — Native MCP integration
323
+ - **VS Code + Copilot** — Via MCP extension
324
+
325
+ ### What AI Can Do
326
+
327
+ | Tool | Description |
328
+ |------|-------------|
329
+ | `search_components` | Search your vault by name or category |
330
+ | `read_component` | Read full source code of any component |
331
+
332
+ ### Setup Example (Claude Desktop)
333
+
334
+ Add to `~/.config/claude/claude_desktop_config.json`:
335
+
336
+ ```json
337
+ {
338
+ "mcpServers": {
339
+ "composter": {
340
+ "command": "node",
341
+ "args": ["/path/to/Composter/mcp/src/server.js"],
342
+ "cwd": "/path/to/Composter"
343
+ }
344
+ }
345
+ }
346
+ ```
347
+
348
+ 📖 [Full MCP Documentation](https://github.com/binit2-1/Composter/tree/main/mcp)
349
+
350
+ ---
351
+
352
+ ## 📂 File Locations
353
+
354
+ | File | Location | Purpose |
355
+ |------|----------|---------|
356
+ | Session | `~/.config/composter/session.json` | JWT auth token |
357
+ | Config Dir | `~/.config/composter/` | All CLI data |
358
+
359
+ ### Session File Structure
360
+
361
+ ```json
362
+ {
363
+ "jwt": "eyJhbGciOiJSUzI1NiIs...",
364
+ "cookies": "session_token=...",
365
+ "createdAt": "2024-12-10T10:00:00.000Z",
366
+ "expiresAt": "2025-01-09T10:00:00.000Z"
367
+ }
368
+ ```
369
+
370
+ ---
371
+
372
+ ## 🐛 Troubleshooting
373
+
374
+ ### "You must be logged in"
375
+
376
+ Your session doesn't exist or has expired.
377
+
378
+ ```bash
379
+ composter login
380
+ ```
381
+
382
+ ### "Session expired"
383
+
384
+ Sessions last 30 days. Re-authenticate:
385
+
386
+ ```bash
387
+ composter login
388
+ ```
389
+
390
+ ### "Invalid category name"
391
+
392
+ Category names have strict rules:
393
+
394
+ ```bash
395
+ # ❌ These will fail
396
+ composter mkcat "My Components" # No spaces
397
+ composter mkcat verylongcatname # Max 10 chars
398
+
399
+ # ✅ These work
400
+ composter mkcat ui
401
+ composter mkcat hooks
402
+ composter mkcat utils
403
+ ```
404
+
405
+ ### "File not found" when pushing
406
+
407
+ Check your file path:
408
+
409
+ ```bash
410
+ # Make sure you're in the right directory
411
+ pwd
412
+
413
+ # Use relative path from current directory
414
+ composter push ui "Button" ./src/components/Button.tsx
415
+
416
+ # Or use absolute path
417
+ composter push ui "Button" /Users/me/project/src/components/Button.tsx
418
+ ```
419
+
420
+ ### "Component not found" when pulling
421
+
422
+ - Check the exact component title (case-sensitive)
423
+ - Verify the category name
424
+ - List your components on the web dashboard
425
+
426
+ ### Missing dependencies after pull
427
+
428
+ The CLI tells you what's missing. Just run:
429
+
430
+ ```bash
431
+ npm install package1 package2 package3
432
+ ```
433
+
434
+ ### Network errors
435
+
436
+ - Check your internet connection
437
+ - Verify the backend is accessible: `https://composter.onrender.com/api/health`
438
+ - Try logging in again
439
+
440
+ ---
441
+
442
+ ## 🌐 Web Dashboard
443
+
444
+ Manage your components visually at **[composter.vercel.app](https://composter.vercel.app)**
445
+
446
+ - 📋 Browse all components
447
+ - 👁️ Live code preview with Sandpack
448
+ - ✏️ Edit component metadata
449
+ - 📊 View dependency graphs
450
+ - 📋 Copy code snippets
451
+ - 🗑️ Delete components
452
+
453
+ ---
454
+
455
+ ## 🔒 Security
456
+
457
+ | Feature | Description |
458
+ |---------|-------------|
459
+ | 🔐 JWT Auth | Secure token-based authentication |
460
+ | 🏠 Local Storage | Tokens stored locally, never shared |
461
+ | 🔒 User Isolation | Each vault is completely private |
462
+ | 🌐 HTTPS | All API traffic encrypted |
463
+ | ⏰ Expiring Sessions | 30-day token lifetime |
464
+
465
+ ---
466
+
467
+ ## 📋 Examples
468
+
469
+ ### Push a Shadcn-style Component
470
+
471
+ ```bash
472
+ # Push a button with all its dependencies
473
+ composter push ui "Shadcn Button" ./src/components/ui/button.tsx
474
+ ```
475
+
476
+ ### Push a Custom Hook
477
+
478
+ ```bash
479
+ composter push hooks "useLocalStorage" ./src/hooks/useLocalStorage.ts
480
+ ```
481
+
482
+ ### Push a Full Feature
483
+
484
+ ```bash
485
+ # Push a data table that imports multiple files
486
+ composter push features "User Table" ./src/features/users/UserTable.tsx
487
+ ```
488
+
489
+ ### Pull Into a New Project
490
+
491
+ ```bash
492
+ # Create components folder if needed
493
+ mkdir -p src/components
494
+
495
+ # Pull your button
496
+ composter pull ui "Shadcn Button" ./src/components/ui/
497
+
498
+ # Install any missing deps
499
+ npm install
500
+ ```
501
+
502
+ ---
503
+
504
+ ## 🔗 Links
505
+
506
+ | Resource | URL |
507
+ |----------|-----|
508
+ | 🌐 Web App | [composter.vercel.app](https://composter.vercel.app) |
509
+ | 📦 npm | [npmjs.com/package/composter-cli](https://www.npmjs.com/package/composter-cli) |
510
+ | 💻 GitHub | [github.com/binit2-1/Composter](https://github.com/binit2-1/Composter) |
511
+ | 🐛 Issues | [Report a bug](https://github.com/binit2-1/Composter/issues) |
512
+ | 🤖 MCP Docs | [MCP Setup Guide](https://github.com/binit2-1/Composter/tree/main/mcp) |
513
+
514
+ ---
515
+
516
+ ## 🤝 Contributing
517
+
518
+ Contributions welcome! See [CONTRIBUTING.md](https://github.com/binit2-1/Composter/blob/main/CONTRIBUTING.md)
519
+
520
+ ---
521
+
522
+ ## 📄 License
523
+
524
+ MIT © [binit2-1](https://github.com/binit2-1)
525
+
526
+ ---
527
+
528
+ <p align="center">
529
+ <b>Built with ❤️ for developers who hate copy-pasting components</b>
530
+ </p>
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "composter-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
- "description": "CLI tool to manage and sync React components to your personal component vault",
5
+ "description": "Your personal vault for React components. Push, pull, and sync reusable components across projects like shadcn/ui but for YOUR code.",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "composter": "./bin/composter.js"
@@ -16,13 +16,26 @@
16
16
  "cli",
17
17
  "vault",
18
18
  "library",
19
- "shadcn"
19
+ "shadcn",
20
+ "component-library",
21
+ "code-sharing",
22
+ "developer-tools",
23
+ "productivity",
24
+ "mcp",
25
+ "ai-tools"
20
26
  ],
21
27
  "author": "binit2-1",
22
28
  "license": "MIT",
23
29
  "repository": {
24
30
  "type": "git",
25
- "url": "https://github.com/binit2-1/Composter"
31
+ "url": "git+https://github.com/binit2-1/Composter.git"
32
+ },
33
+ "homepage": "https://composter.vercel.app",
34
+ "bugs": {
35
+ "url": "https://github.com/binit2-1/Composter/issues"
36
+ },
37
+ "engines": {
38
+ "node": ">=18.0.0"
26
39
  },
27
40
  "dependencies": {
28
41
  "commander": "^14.0.2",