@microbuild/cli 0.1.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 +555 -0
- package/dist/chunk-6YA3DSAE.js +362 -0
- package/dist/chunk-6YA3DSAE.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2279 -0
- package/dist/index.js.map +1 -0
- package/dist/outdated-TV5ERBNC.js +110 -0
- package/dist/outdated-TV5ERBNC.js.map +1 -0
- package/dist/templates/api/auth-callback-route.ts +36 -0
- package/dist/templates/api/auth-headers.ts +72 -0
- package/dist/templates/api/auth-login-route.ts +63 -0
- package/dist/templates/api/auth-logout-route.ts +41 -0
- package/dist/templates/api/auth-user-route.ts +71 -0
- package/dist/templates/api/fields-route.ts +44 -0
- package/dist/templates/api/files-id-route.ts +116 -0
- package/dist/templates/api/files-route.ts +83 -0
- package/dist/templates/api/items-id-route.ts +120 -0
- package/dist/templates/api/items-route.ts +88 -0
- package/dist/templates/api/login-page.tsx +142 -0
- package/dist/templates/api/relations-route.ts +46 -0
- package/dist/templates/app/design-tokens.css +183 -0
- package/dist/templates/app/globals.css +58 -0
- package/dist/templates/app/layout.tsx +49 -0
- package/dist/templates/app/page.tsx +23 -0
- package/dist/templates/components/ColorSchemeToggle.tsx +35 -0
- package/dist/templates/lib/common-utils.ts +156 -0
- package/dist/templates/lib/hooks/index.ts +98 -0
- package/dist/templates/lib/services/index.ts +26 -0
- package/dist/templates/lib/theme.ts +241 -0
- package/dist/templates/lib/types/index.ts +10 -0
- package/dist/templates/lib/utils-index.ts +32 -0
- package/dist/templates/lib/utils.ts +14 -0
- package/dist/templates/lib/vform/index.ts +24 -0
- package/dist/templates/middleware/middleware.ts +29 -0
- package/dist/templates/supabase/client.ts +25 -0
- package/dist/templates/supabase/middleware.ts +66 -0
- package/dist/templates/supabase/server.ts +45 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
# @microbuild/cli
|
|
2
|
+
|
|
3
|
+
A CLI for adding Microbuild components to your project.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Use the `init` command to set up a new project and the `add` command to add components.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @microbuild/cli init
|
|
11
|
+
npx @microbuild/cli add input select-dropdown
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## init
|
|
15
|
+
|
|
16
|
+
Use the `init` command to initialize configuration and dependencies for a new project.
|
|
17
|
+
|
|
18
|
+
The `init` command creates a `microbuild.json` file, sets up directory structure, and checks for required dependencies.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @microbuild/cli init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Options
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Usage: microbuild init [options]
|
|
28
|
+
|
|
29
|
+
initialize your project and install dependencies
|
|
30
|
+
|
|
31
|
+
Options:
|
|
32
|
+
-y, --yes skip confirmation prompt (default: false)
|
|
33
|
+
-c, --cwd <cwd> the working directory (defaults to current directory)
|
|
34
|
+
-h, --help display help for command
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## add
|
|
38
|
+
|
|
39
|
+
Use the `add` command to add components to your project.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @microbuild/cli add [component]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Options
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Usage: microbuild add [options] [components...]
|
|
49
|
+
|
|
50
|
+
add components to your project
|
|
51
|
+
|
|
52
|
+
Arguments:
|
|
53
|
+
components name of components to add
|
|
54
|
+
|
|
55
|
+
Options:
|
|
56
|
+
-a, --all add all available components (default: false)
|
|
57
|
+
--with-api also add API routes and Supabase auth templates
|
|
58
|
+
--category <name> add all components from a category
|
|
59
|
+
-o, --overwrite overwrite existing files (default: false)
|
|
60
|
+
-n, --dry-run preview changes without modifying files
|
|
61
|
+
--cwd <cwd> the working directory (defaults to current directory)
|
|
62
|
+
-h, --help display help for command
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Examples
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Add specific components
|
|
69
|
+
npx @microbuild/cli add input
|
|
70
|
+
npx @microbuild/cli add input select-dropdown datetime
|
|
71
|
+
|
|
72
|
+
# Add collection-form (includes VForm + all 32 interface components)
|
|
73
|
+
npx @microbuild/cli add collection-form
|
|
74
|
+
|
|
75
|
+
# Add all components from a category
|
|
76
|
+
npx @microbuild/cli add --category selection
|
|
77
|
+
|
|
78
|
+
# Add all components
|
|
79
|
+
npx @microbuild/cli add --all
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## list
|
|
83
|
+
|
|
84
|
+
Use the `list` command to view all available components.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx @microbuild/cli list
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Options
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Usage: microbuild list [options]
|
|
94
|
+
|
|
95
|
+
list available components
|
|
96
|
+
|
|
97
|
+
Options:
|
|
98
|
+
--category <name> filter by category
|
|
99
|
+
--json output as JSON
|
|
100
|
+
-h, --help display help for command
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## bootstrap
|
|
104
|
+
|
|
105
|
+
Use the `bootstrap` command for full project setup in a single non-interactive command. Recommended for AI agents and CI/CD pipelines.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx @microbuild/cli bootstrap
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Options
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Usage: microbuild bootstrap [options]
|
|
115
|
+
|
|
116
|
+
Full project setup: init + add --all + install deps + validate (single command for AI agents)
|
|
117
|
+
|
|
118
|
+
Options:
|
|
119
|
+
--cwd <cwd> the working directory (defaults to current directory)
|
|
120
|
+
--skip-deps skip npm dependency installation
|
|
121
|
+
--skip-validate skip post-install validation
|
|
122
|
+
-h, --help display help for command
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### What Bootstrap Does
|
|
126
|
+
|
|
127
|
+
1. Creates `microbuild.json` and project skeleton (package.json, tsconfig, Next.js layout/page, design tokens)
|
|
128
|
+
2. Copies all 40+ UI components to `components/ui/`
|
|
129
|
+
3. Copies types, services, hooks to `lib/microbuild/`
|
|
130
|
+
4. Copies API proxy routes (fields, items, relations, files)
|
|
131
|
+
5. Copies auth proxy routes (login, logout, user, callback) + login page
|
|
132
|
+
6. Copies Supabase auth utilities and middleware
|
|
133
|
+
7. Runs `pnpm install` to resolve all dependencies
|
|
134
|
+
8. Validates the installation
|
|
135
|
+
|
|
136
|
+
**Auth Routes Installed:**
|
|
137
|
+
| Route | Method | Purpose |
|
|
138
|
+
|-------|--------|---------|
|
|
139
|
+
| `/api/auth/login` | POST | Login via Supabase Auth (server-side, no CORS) |
|
|
140
|
+
| `/api/auth/logout` | POST | Sign out and clear session cookies |
|
|
141
|
+
| `/api/auth/user` | GET | Get current user profile |
|
|
142
|
+
| `/api/auth/callback` | GET | Handle OAuth/email-confirm redirects |
|
|
143
|
+
| `/app/login/page.tsx` | — | Login page using proxy pattern |
|
|
144
|
+
|
|
145
|
+
## validate
|
|
146
|
+
|
|
147
|
+
Use the `validate` command to check your Microbuild installation for common issues.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx @microbuild/cli validate
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Options
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Usage: microbuild validate [options]
|
|
157
|
+
|
|
158
|
+
validate Microbuild installation (check imports, missing files, SSR issues)
|
|
159
|
+
|
|
160
|
+
Options:
|
|
161
|
+
--json output as JSON for CI/CD
|
|
162
|
+
--cwd <cwd> the working directory (defaults to current directory)
|
|
163
|
+
-h, --help display help for command
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### What It Checks
|
|
167
|
+
|
|
168
|
+
- **Untransformed imports** - `@microbuild/*` imports that weren't converted to local paths
|
|
169
|
+
- **Missing lib files** - Required utility modules not present (types, services, hooks, utils)
|
|
170
|
+
- **Missing CSS files** - CSS required by rich text editors (RichTextHTML.css, InputBlockEditor.css)
|
|
171
|
+
- **SSR issues** - Components like InputBlockEditor exported without SSR-safe wrappers
|
|
172
|
+
- **Missing API routes** - DaaS integration routes for fields, items, permissions
|
|
173
|
+
|
|
174
|
+
### Example Output
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
✗ Found 2 error(s):
|
|
178
|
+
|
|
179
|
+
✗ src/components/ui/input.tsx:5
|
|
180
|
+
Untransformed import: import { Field } from '@microbuild/types';
|
|
181
|
+
|
|
182
|
+
✗ lib/microbuild/interface-registry.ts
|
|
183
|
+
Missing required file for utils module
|
|
184
|
+
|
|
185
|
+
⚠ Found 1 warning(s):
|
|
186
|
+
|
|
187
|
+
⚠ components/ui/index.ts
|
|
188
|
+
InputBlockEditor exported directly may cause SSR errors. Use input-block-editor-wrapper instead.
|
|
189
|
+
|
|
190
|
+
💡 Suggestions:
|
|
191
|
+
|
|
192
|
+
1. Fix 2 untransformed import(s) by running: pnpm cli add --all --overwrite --cwd .
|
|
193
|
+
2. Update components/ui/index.ts to export InputBlockEditor from './input-block-editor-wrapper'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## diff
|
|
197
|
+
|
|
198
|
+
Use the `diff` command to preview changes before adding a component.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx @microbuild/cli diff [component]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Options
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Usage: microbuild diff [options] <component>
|
|
208
|
+
|
|
209
|
+
preview changes before adding a component
|
|
210
|
+
|
|
211
|
+
Options:
|
|
212
|
+
--cwd <cwd> the working directory (defaults to current directory)
|
|
213
|
+
-h, --help display help for command
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## status
|
|
217
|
+
|
|
218
|
+
Use the `status` command to view all installed Microbuild components and their origins.
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npx @microbuild/cli status
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Options
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
Usage: microbuild status [options]
|
|
228
|
+
|
|
229
|
+
show installed Microbuild components and their origins
|
|
230
|
+
|
|
231
|
+
Options:
|
|
232
|
+
--json output as JSON
|
|
233
|
+
--cwd <cwd> the working directory (defaults to current directory)
|
|
234
|
+
-h, --help display help for command
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Example Output
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
📦 Microbuild Status
|
|
241
|
+
|
|
242
|
+
Config file: microbuild.json
|
|
243
|
+
Lib modules: types, hooks, services
|
|
244
|
+
Components: input, select-dropdown, list-m2m
|
|
245
|
+
|
|
246
|
+
Installed Files:
|
|
247
|
+
|
|
248
|
+
@microbuild/ui-interfaces/input
|
|
249
|
+
└─ src/components/ui/input.tsx
|
|
250
|
+
v1.0.0 (2026-01-12)
|
|
251
|
+
|
|
252
|
+
@microbuild/lib/hooks
|
|
253
|
+
└─ src/lib/microbuild/hooks/useRelationM2M.ts
|
|
254
|
+
v1.0.0 (2026-01-12)
|
|
255
|
+
|
|
256
|
+
Total: 15 files from Microbuild
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## microbuild.json
|
|
260
|
+
|
|
261
|
+
The `microbuild.json` file holds configuration for your project. We use it to understand how your project is set up and how to generate components customized for your project.
|
|
262
|
+
|
|
263
|
+
You can create a `microbuild.json` file by running the `init` command.
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"$schema": "https://microbuild.dev/schema.json",
|
|
268
|
+
"model": "copy-own",
|
|
269
|
+
"tsx": true,
|
|
270
|
+
"srcDir": true,
|
|
271
|
+
"aliases": {
|
|
272
|
+
"components": "@/components/ui",
|
|
273
|
+
"lib": "@/lib/microbuild"
|
|
274
|
+
},
|
|
275
|
+
"installedLib": [],
|
|
276
|
+
"installedComponents": []
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### tsx
|
|
281
|
+
|
|
282
|
+
Choose between TypeScript or JavaScript components.
|
|
283
|
+
|
|
284
|
+
Setting this option to `false` allows components to be added as JavaScript with the `.jsx` file extension.
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"tsx": true | false
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### srcDir
|
|
293
|
+
|
|
294
|
+
Whether your project uses the `src/` directory structure.
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"srcDir": true | false
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### aliases
|
|
303
|
+
|
|
304
|
+
The CLI uses these values to place generated components in the correct location.
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"aliases": {
|
|
309
|
+
"components": "@/components/ui",
|
|
310
|
+
"lib": "@/lib/microbuild"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Path aliases have to be set up in your `tsconfig.json` or `jsconfig.json` file:
|
|
316
|
+
|
|
317
|
+
```json
|
|
318
|
+
{
|
|
319
|
+
"compilerOptions": {
|
|
320
|
+
"baseUrl": ".",
|
|
321
|
+
"paths": {
|
|
322
|
+
"@/*": ["./src/*"]
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### installedLib and installedComponents
|
|
329
|
+
|
|
330
|
+
These arrays track what has been installed. The CLI uses them to avoid reinstalling dependencies.
|
|
331
|
+
|
|
332
|
+
## What Gets Copied
|
|
333
|
+
|
|
334
|
+
When you add a component, the CLI:
|
|
335
|
+
|
|
336
|
+
1. **Copies the component source** to your components directory
|
|
337
|
+
2. **Copies required lib modules** (types, services, hooks) if needed
|
|
338
|
+
3. **Transforms imports** from `@microbuild/*` to local paths
|
|
339
|
+
4. **Reports missing dependencies** that need to be installed
|
|
340
|
+
|
|
341
|
+
### Example: Adding `list-m2m`
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
npx @microbuild/cli add list-m2m
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
This copies:
|
|
348
|
+
- `components/ui/list-m2m.tsx` - The component
|
|
349
|
+
- `lib/microbuild/types/` - Type definitions
|
|
350
|
+
- `lib/microbuild/services/` - CRUD services
|
|
351
|
+
- `lib/microbuild/hooks/` - React hooks
|
|
352
|
+
|
|
353
|
+
### Import Transformation
|
|
354
|
+
|
|
355
|
+
Original (in source):
|
|
356
|
+
```tsx
|
|
357
|
+
import { useRelationM2M } from '@microbuild/hooks';
|
|
358
|
+
import type { M2MItem } from '@microbuild/types';
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Transformed (in your project):
|
|
362
|
+
```tsx
|
|
363
|
+
import { useRelationM2M } from '@/lib/microbuild/hooks';
|
|
364
|
+
import type { M2MItem } from '@/lib/microbuild/types';
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Component Categories
|
|
368
|
+
|
|
369
|
+
| Category | Components |
|
|
370
|
+
|----------|------------|
|
|
371
|
+
| `input` | Input, Textarea, InputCode, InputBlockEditor, Tags |
|
|
372
|
+
| `selection` | SelectDropdown, SelectRadio, SelectMultipleCheckbox, SelectIcon, AutocompleteAPI, CollectionItemDropdown |
|
|
373
|
+
| `datetime` | DateTime |
|
|
374
|
+
| `boolean` | Boolean, Toggle |
|
|
375
|
+
| `media` | FileInterface, FileImage, Files, Upload, Color |
|
|
376
|
+
| `relational` | ListM2M, ListM2O, ListO2M, ListM2A |
|
|
377
|
+
| `layout` | Divider, Notice, GroupDetail, Slider |
|
|
378
|
+
| `rich-text` | RichTextHtml, RichTextMarkdown |
|
|
379
|
+
| `collection` | VForm, CollectionForm, CollectionList |
|
|
380
|
+
|
|
381
|
+
### VForm and CollectionForm
|
|
382
|
+
|
|
383
|
+
When you add `collection-form`, it automatically includes:
|
|
384
|
+
- **VForm** - Dynamic form component that renders any field type
|
|
385
|
+
- **32 interface components** - All field types (input, select, datetime, M2M, M2O, etc.)
|
|
386
|
+
- **Lib modules** - types, services, hooks, and field-interface-mapper utilities
|
|
387
|
+
|
|
388
|
+
This is because `collection-form` has `registryDependencies: ["vform"]` and VForm has dependencies on all interface components.
|
|
389
|
+
|
|
390
|
+
## Peer Dependencies
|
|
391
|
+
|
|
392
|
+
Components require these external packages:
|
|
393
|
+
|
|
394
|
+
**Core (always needed):**
|
|
395
|
+
```bash
|
|
396
|
+
pnpm add @mantine/core @mantine/hooks react react-dom
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Component-specific:**
|
|
400
|
+
```bash
|
|
401
|
+
# DateTime component
|
|
402
|
+
pnpm add @mantine/dates dayjs
|
|
403
|
+
|
|
404
|
+
# Icon components
|
|
405
|
+
pnpm add @tabler/icons-react
|
|
406
|
+
|
|
407
|
+
# File upload
|
|
408
|
+
pnpm add @mantine/dropzone
|
|
409
|
+
|
|
410
|
+
# CollectionForm notifications
|
|
411
|
+
pnpm add @mantine/notifications
|
|
412
|
+
|
|
413
|
+
# Rich text editor
|
|
414
|
+
pnpm add @tiptap/react @tiptap/starter-kit @tiptap/extension-link
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**Utils (optional, for cn() helper):**
|
|
418
|
+
```bash
|
|
419
|
+
pnpm add clsx tailwind-merge
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Project Structure After Installation
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
your-project/
|
|
426
|
+
├── app/
|
|
427
|
+
│ ├── api/
|
|
428
|
+
│ │ ├── auth/ # Auth proxy routes
|
|
429
|
+
│ │ │ ├── login/route.ts # POST - Supabase login
|
|
430
|
+
│ │ │ ├── logout/route.ts # POST - Sign out
|
|
431
|
+
│ │ │ ├── user/route.ts # GET - Current user info
|
|
432
|
+
│ │ │ └── callback/route.ts # GET - OAuth callback
|
|
433
|
+
│ │ ├── fields/[collection]/route.ts # Fields proxy
|
|
434
|
+
│ │ ├── items/[collection]/route.ts # Items proxy
|
|
435
|
+
│ │ └── ...
|
|
436
|
+
│ └── login/page.tsx # Login page template
|
|
437
|
+
├── src/
|
|
438
|
+
│ ├── components/
|
|
439
|
+
│ │ └── ui/
|
|
440
|
+
│ │ ├── input.tsx
|
|
441
|
+
│ │ ├── select-dropdown.tsx
|
|
442
|
+
│ │ └── datetime.tsx
|
|
443
|
+
│ └── lib/
|
|
444
|
+
│ ├── microbuild/
|
|
445
|
+
│ │ ├── utils.ts
|
|
446
|
+
│ │ ├── types/
|
|
447
|
+
│ │ │ ├── index.ts
|
|
448
|
+
│ │ │ ├── core.ts
|
|
449
|
+
│ │ │ ├── file.ts
|
|
450
|
+
│ │ │ └── relations.ts
|
|
451
|
+
│ │ ├── services/
|
|
452
|
+
│ │ │ ├── index.ts
|
|
453
|
+
│ │ │ ├── api-request.ts
|
|
454
|
+
│ │ │ ├── items.ts
|
|
455
|
+
│ │ │ ├── fields.ts
|
|
456
|
+
│ │ │ └── collections.ts
|
|
457
|
+
│ │ └── hooks/
|
|
458
|
+
│ │ ├── index.ts
|
|
459
|
+
│ │ ├── useRelationM2M.ts
|
|
460
|
+
│ │ ├── useRelationM2O.ts
|
|
461
|
+
│ │ └── ...
|
|
462
|
+
│ ├── api/auth-headers.ts # Auth header utilities
|
|
463
|
+
│ └── supabase/ # Supabase client utilities
|
|
464
|
+
│ ├── server.ts
|
|
465
|
+
│ └── client.ts
|
|
466
|
+
├── middleware.ts # Auth middleware
|
|
467
|
+
├── microbuild.json
|
|
468
|
+
└── package.json
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## CLI Commands Reference
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
# Initialize project
|
|
475
|
+
microbuild init [--yes] [--cwd <path>]
|
|
476
|
+
|
|
477
|
+
# Bootstrap full project (init + add all + deps + validate)
|
|
478
|
+
microbuild bootstrap [--cwd <path>] [--skip-deps] [--skip-validate]
|
|
479
|
+
|
|
480
|
+
# Add components
|
|
481
|
+
microbuild add [components...] [--all] [--category <name>] [--overwrite] [--cwd <path>]
|
|
482
|
+
|
|
483
|
+
# List components
|
|
484
|
+
microbuild list [--category <name>] [--json]
|
|
485
|
+
|
|
486
|
+
# Preview changes
|
|
487
|
+
microbuild diff <component> [--cwd <path>]
|
|
488
|
+
|
|
489
|
+
# Validate installation
|
|
490
|
+
microbuild validate [--json] [--cwd <path>]
|
|
491
|
+
|
|
492
|
+
# Check installed components
|
|
493
|
+
microbuild status [--json] [--cwd <path>]
|
|
494
|
+
|
|
495
|
+
# Component info and dependency tree
|
|
496
|
+
microbuild info <component> [--json]
|
|
497
|
+
microbuild tree <component> [--json] [--depth <n>]
|
|
498
|
+
|
|
499
|
+
# Auto-fix common issues
|
|
500
|
+
microbuild fix [--dry-run] [--yes] [--cwd <path>]
|
|
501
|
+
|
|
502
|
+
# Check for component updates
|
|
503
|
+
microbuild outdated [--json] [--cwd <path>]
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
## Troubleshooting
|
|
507
|
+
|
|
508
|
+
### "Registry file not found"
|
|
509
|
+
|
|
510
|
+
Make sure you're running the CLI from within the Microbuild workspace or have the registry properly configured.
|
|
511
|
+
|
|
512
|
+
### "microbuild.json not found"
|
|
513
|
+
|
|
514
|
+
Run `npx @microbuild/cli init` first to initialize your project.
|
|
515
|
+
|
|
516
|
+
### Import errors after adding components
|
|
517
|
+
|
|
518
|
+
Ensure your `tsconfig.json` has the correct path aliases:
|
|
519
|
+
|
|
520
|
+
```json
|
|
521
|
+
{
|
|
522
|
+
"compilerOptions": {
|
|
523
|
+
"baseUrl": ".",
|
|
524
|
+
"paths": {
|
|
525
|
+
"@/*": ["./src/*"]
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
## Development
|
|
532
|
+
|
|
533
|
+
Build the CLI:
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
cd packages/cli
|
|
537
|
+
pnpm build
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Run in development:
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
pnpm dev
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
Test locally:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
node dist/index.js init
|
|
550
|
+
node dist/index.js add input
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
## License
|
|
554
|
+
|
|
555
|
+
MIT
|