@mandujs/cli 0.12.1 → 0.13.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.ko.md +234 -234
- package/README.md +354 -354
- package/package.json +2 -2
- package/src/commands/contract.ts +173 -173
- package/src/commands/dev.ts +8 -68
- package/src/commands/doctor.ts +27 -27
- package/src/commands/guard-arch.ts +303 -303
- package/src/commands/guard-check.ts +3 -3
- package/src/commands/monitor.ts +300 -300
- package/src/commands/openapi.ts +107 -107
- package/src/commands/registry.ts +367 -357
- package/src/commands/routes.ts +228 -228
- package/src/commands/start.ts +184 -0
- package/src/errors/codes.ts +35 -35
- package/src/errors/index.ts +2 -2
- package/src/errors/messages.ts +143 -143
- package/src/hooks/index.ts +17 -17
- package/src/hooks/preaction.ts +256 -256
- package/src/main.ts +37 -34
- package/src/terminal/banner.ts +166 -166
- package/src/terminal/help.ts +306 -306
- package/src/terminal/index.ts +71 -71
- package/src/terminal/output.ts +295 -295
- package/src/terminal/palette.ts +30 -30
- package/src/terminal/progress.ts +327 -327
- package/src/terminal/stream-writer.ts +214 -214
- package/src/terminal/table.ts +354 -354
- package/src/terminal/theme.ts +142 -142
- package/src/util/bun.ts +6 -6
- package/src/util/fs.ts +23 -23
- package/src/util/handlers.ts +96 -0
- package/src/util/manifest.ts +52 -52
- package/src/util/output.ts +22 -22
- package/src/util/port.ts +71 -71
- package/templates/default/AGENTS.md +96 -96
- package/templates/default/app/api/health/route.ts +13 -13
- package/templates/default/app/globals.css +49 -49
- package/templates/default/app/layout.tsx +27 -27
- package/templates/default/app/page.tsx +38 -38
- package/templates/default/package.json +1 -0
- package/templates/default/src/client/shared/lib/utils.ts +16 -16
- package/templates/default/src/client/shared/ui/button.tsx +57 -57
- package/templates/default/src/client/shared/ui/card.tsx +78 -78
- package/templates/default/src/client/shared/ui/index.ts +21 -21
- package/templates/default/src/client/shared/ui/input.tsx +24 -24
- package/templates/default/tests/example.test.ts +58 -58
- package/templates/default/tests/helpers.ts +52 -52
- package/templates/default/tests/setup.ts +9 -9
- package/templates/default/tsconfig.json +12 -14
- package/templates/default/apps/server/main.ts +0 -67
- package/templates/default/apps/web/entry.tsx +0 -35
package/README.md
CHANGED
|
@@ -1,354 +1,354 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/konamgil/mandu/main/mandu_only_simbol.png" alt="Mandu" width="200" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">@mandujs/cli</h1>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<strong>Agent-Native Fullstack Framework CLI</strong><br/>
|
|
9
|
-
Architecture stays intact even when AI agents write your code
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
<p align="center">
|
|
13
|
-
English | <a href="./README.ko.md"><strong>한국어</strong></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
bun add -D @mandujs/cli
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or use directly with `bunx`:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
bunx @mandujs/cli init my-app
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Quick Start
|
|
29
|
-
|
|
30
|
-
### 1. Create a New Project
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
bunx @mandujs/cli init my-app
|
|
34
|
-
cd my-app
|
|
35
|
-
bun install
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Start Development Server
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
bun run dev
|
|
42
|
-
# or
|
|
43
|
-
bunx mandu dev
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Your app is now running at `http://localhost:3333`.
|
|
47
|
-
|
|
48
|
-
To change the port, set `PORT` or use `server.port` in `mandu.config`. If the port is in use, Mandu will pick the next available port.
|
|
49
|
-
|
|
50
|
-
### 3. Create Pages in `app/` Directory
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
app/
|
|
54
|
-
├── page.tsx → /
|
|
55
|
-
├── about/page.tsx → /about
|
|
56
|
-
├── users/[id]/page.tsx → /users/:id
|
|
57
|
-
└── api/hello/route.ts → /api/hello
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 4. Build for Production
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
bunx mandu build
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Default Architecture Layout
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
app/ # FS Routes
|
|
70
|
-
src/
|
|
71
|
-
client/ # Client (FSD)
|
|
72
|
-
app/
|
|
73
|
-
pages/
|
|
74
|
-
widgets/
|
|
75
|
-
features/
|
|
76
|
-
entities/
|
|
77
|
-
shared/
|
|
78
|
-
server/ # Server (Clean)
|
|
79
|
-
api/
|
|
80
|
-
application/
|
|
81
|
-
domain/
|
|
82
|
-
infra/
|
|
83
|
-
core/
|
|
84
|
-
shared/ # Universal shared
|
|
85
|
-
contracts/ # Client-safe contracts
|
|
86
|
-
types/
|
|
87
|
-
utils/
|
|
88
|
-
client/ # Client-safe utils
|
|
89
|
-
server/ # Server-only utils
|
|
90
|
-
schema/ # Server-only schema
|
|
91
|
-
env/ # Server-only env
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
That's it!
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Commands
|
|
99
|
-
|
|
100
|
-
### Core Commands
|
|
101
|
-
|
|
102
|
-
| Command | Description |
|
|
103
|
-
|---------|-------------|
|
|
104
|
-
| `mandu init [name]` | Create new project |
|
|
105
|
-
| `mandu dev` | Start dev server (FS Routes + HMR) |
|
|
106
|
-
| `mandu build` | Build for production |
|
|
107
|
-
|
|
108
|
-
### FS Routes Commands
|
|
109
|
-
|
|
110
|
-
| Command | Description |
|
|
111
|
-
|---------|-------------|
|
|
112
|
-
| `mandu routes list` | Show all routes |
|
|
113
|
-
| `mandu routes generate` | Generate routes manifest |
|
|
114
|
-
| `mandu routes watch` | Watch for route changes |
|
|
115
|
-
|
|
116
|
-
### Guard Commands
|
|
117
|
-
|
|
118
|
-
| Command | Description |
|
|
119
|
-
|---------|-------------|
|
|
120
|
-
| `mandu guard` | Run architecture check (default: mandu preset) |
|
|
121
|
-
| `mandu guard --watch` | Watch mode |
|
|
122
|
-
| `mandu guard --ci` | CI mode (exit 1 on errors/warnings) |
|
|
123
|
-
| `mandu guard --preset fsd` | Use specific preset |
|
|
124
|
-
| `mandu guard --output report.md` | Generate report |
|
|
125
|
-
| `mandu guard legacy` | Legacy Spec guard (auto-correct) |
|
|
126
|
-
|
|
127
|
-
### Transaction Commands
|
|
128
|
-
|
|
129
|
-
| Command | Description |
|
|
130
|
-
|---------|-------------|
|
|
131
|
-
| `mandu change begin` | Start transaction (creates snapshot) |
|
|
132
|
-
| `mandu change commit` | Finalize changes |
|
|
133
|
-
| `mandu change rollback` | Restore from snapshot |
|
|
134
|
-
| `mandu change status` | Show current state |
|
|
135
|
-
| `mandu change list` | View history |
|
|
136
|
-
|
|
137
|
-
### Brain Commands
|
|
138
|
-
|
|
139
|
-
| Command | Description |
|
|
140
|
-
|---------|-------------|
|
|
141
|
-
| `mandu doctor` | Analyze Guard failures + suggest patches |
|
|
142
|
-
| `mandu watch` | Real-time file monitoring |
|
|
143
|
-
| `mandu monitor` | MCP Activity Monitor log stream |
|
|
144
|
-
| `mandu brain setup` | Configure sLLM (optional) |
|
|
145
|
-
| `mandu brain status` | Check Brain status |
|
|
146
|
-
|
|
147
|
-
### Contract & OpenAPI Commands
|
|
148
|
-
|
|
149
|
-
| Command | Description |
|
|
150
|
-
|---------|-------------|
|
|
151
|
-
| `mandu contract create <routeId>` | Create contract for route |
|
|
152
|
-
| `mandu contract validate` | Validate contract-slot consistency |
|
|
153
|
-
| `mandu contract build` | Build contract registry |
|
|
154
|
-
| `mandu contract diff` | Diff contracts against registry |
|
|
155
|
-
| `mandu openapi generate` | Generate OpenAPI 3.0 spec |
|
|
156
|
-
| `mandu openapi serve` | Start Swagger UI server |
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Workflow
|
|
161
|
-
|
|
162
|
-
### Modern Workflow (Recommended)
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
# 1. Create project
|
|
166
|
-
bunx @mandujs/cli init my-app
|
|
167
|
-
cd my-app && bun install
|
|
168
|
-
|
|
169
|
-
# 2. Create pages
|
|
170
|
-
# app/page.tsx → /
|
|
171
|
-
# app/users/page.tsx → /users
|
|
172
|
-
# app/api/users/route.ts → /api/users
|
|
173
|
-
|
|
174
|
-
# 3. Start development
|
|
175
|
-
bun run dev
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### With Architecture Guard
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
# Development with Guard watching
|
|
182
|
-
bunx mandu dev --guard
|
|
183
|
-
|
|
184
|
-
# Or run Guard separately
|
|
185
|
-
bunx mandu guard --watch
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### CI/CD Integration
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
# Build and check
|
|
192
|
-
bunx mandu build --minify
|
|
193
|
-
bunx mandu guard --ci --format json
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## FS Routes
|
|
199
|
-
|
|
200
|
-
Create routes by adding files to `app/`:
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
app/
|
|
204
|
-
├── page.tsx → /
|
|
205
|
-
├── layout.tsx → Layout for all pages
|
|
206
|
-
├── users/
|
|
207
|
-
│ ├── page.tsx → /users
|
|
208
|
-
│ ├── [id]/
|
|
209
|
-
│ │ └── page.tsx → /users/:id
|
|
210
|
-
│ └── [...slug]/
|
|
211
|
-
│ └── page.tsx → /users/*
|
|
212
|
-
├── api/
|
|
213
|
-
│ └── users/
|
|
214
|
-
│ └── route.ts → /api/users
|
|
215
|
-
└── (auth)/ → Group (no URL segment)
|
|
216
|
-
└── login/page.tsx → /login
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Special Files
|
|
220
|
-
|
|
221
|
-
| File | Purpose |
|
|
222
|
-
|------|---------|
|
|
223
|
-
| `page.tsx` | Page component |
|
|
224
|
-
| `layout.tsx` | Shared layout |
|
|
225
|
-
| `route.ts` | API endpoint |
|
|
226
|
-
| `loading.tsx` | Loading state |
|
|
227
|
-
| `error.tsx` | Error boundary |
|
|
228
|
-
| `slot.ts` | Business logic |
|
|
229
|
-
| `client.tsx` | Interactive component (Island) |
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Guard Presets
|
|
234
|
-
|
|
235
|
-
| Preset | Description |
|
|
236
|
-
|--------|-------------|
|
|
237
|
-
| `mandu` | FSD + Clean Architecture (default) |
|
|
238
|
-
| `fsd` | Feature-Sliced Design |
|
|
239
|
-
| `clean` | Clean Architecture |
|
|
240
|
-
| `hexagonal` | Hexagonal Architecture |
|
|
241
|
-
| `atomic` | Atomic Design |
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
# List all presets
|
|
245
|
-
bunx mandu guard --list-presets
|
|
246
|
-
|
|
247
|
-
# Use specific preset
|
|
248
|
-
bunx mandu guard --preset fsd
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## Options Reference
|
|
254
|
-
|
|
255
|
-
### `mandu dev`
|
|
256
|
-
|
|
257
|
-
| Option | Description |
|
|
258
|
-
|--------|-------------|
|
|
259
|
-
| `--guard` | Enable Guard watching |
|
|
260
|
-
| `--guard-preset <p>` | Guard preset (default: mandu) |
|
|
261
|
-
|
|
262
|
-
### `mandu build`
|
|
263
|
-
|
|
264
|
-
| Option | Description |
|
|
265
|
-
|--------|-------------|
|
|
266
|
-
| `--minify` | Minify output |
|
|
267
|
-
| `--sourcemap` | Generate sourcemaps |
|
|
268
|
-
| `--watch` | Watch mode |
|
|
269
|
-
|
|
270
|
-
### `mandu guard`
|
|
271
|
-
|
|
272
|
-
| Option | Description |
|
|
273
|
-
|--------|-------------|
|
|
274
|
-
| `--preset <p>` | Preset: fsd, clean, hexagonal, atomic, mandu |
|
|
275
|
-
| `--watch` | Watch mode |
|
|
276
|
-
| `--ci` | CI mode (exit 1 on errors/warnings) |
|
|
277
|
-
| `--quiet` | Summary only |
|
|
278
|
-
| `--format <f>` | Output: console, agent, json |
|
|
279
|
-
| `--output <path>` | Report file path |
|
|
280
|
-
| `--report-format <f>` | Report: json, markdown, html |
|
|
281
|
-
| `--save-stats` | Save for trend analysis |
|
|
282
|
-
| `--show-trend` | Show trend analysis |
|
|
283
|
-
|
|
284
|
-
### `mandu doctor`
|
|
285
|
-
|
|
286
|
-
| Option | Description |
|
|
287
|
-
|--------|-------------|
|
|
288
|
-
| `--format <f>` | Output: console, json, markdown |
|
|
289
|
-
| `--no-llm` | Template mode (no LLM) |
|
|
290
|
-
| `--output <path>` | Output file path |
|
|
291
|
-
|
|
292
|
-
### `mandu monitor`
|
|
293
|
-
|
|
294
|
-
| Option | Description |
|
|
295
|
-
|--------|-------------|
|
|
296
|
-
| `--format <f>` | Output: console, agent, json |
|
|
297
|
-
| `--summary` | Print summary (JSON log only) |
|
|
298
|
-
| `--since <d>` | Summary window: 5m, 30s, 1h |
|
|
299
|
-
| `--follow <bool>` | Follow mode (default: true) |
|
|
300
|
-
| `--file <path>` | Use custom log file |
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## Examples
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
# Initialize project
|
|
308
|
-
bunx @mandujs/cli init my-app
|
|
309
|
-
|
|
310
|
-
# Development
|
|
311
|
-
bunx mandu dev --guard
|
|
312
|
-
|
|
313
|
-
# Routes
|
|
314
|
-
bunx mandu routes list
|
|
315
|
-
bunx mandu routes generate
|
|
316
|
-
|
|
317
|
-
# Guard
|
|
318
|
-
bunx mandu guard
|
|
319
|
-
bunx mandu guard --watch
|
|
320
|
-
bunx mandu guard --ci --format json
|
|
321
|
-
bunx mandu guard --output report.md
|
|
322
|
-
bunx mandu guard legacy
|
|
323
|
-
|
|
324
|
-
# Transactions
|
|
325
|
-
bunx mandu change begin --message "Add users API"
|
|
326
|
-
bunx mandu change commit
|
|
327
|
-
bunx mandu change rollback
|
|
328
|
-
|
|
329
|
-
# Doctor
|
|
330
|
-
bunx mandu doctor
|
|
331
|
-
bunx mandu doctor --format json
|
|
332
|
-
|
|
333
|
-
# Monitor
|
|
334
|
-
bunx mandu monitor
|
|
335
|
-
bunx mandu monitor --summary --since 5m
|
|
336
|
-
|
|
337
|
-
# Build
|
|
338
|
-
bunx mandu build --minify --sourcemap
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
## Requirements
|
|
344
|
-
|
|
345
|
-
- Bun >= 1.0.0
|
|
346
|
-
|
|
347
|
-
## Related Packages
|
|
348
|
-
|
|
349
|
-
- [@mandujs/core](https://www.npmjs.com/package/@mandujs/core) - Core runtime
|
|
350
|
-
- [@mandujs/mcp](https://www.npmjs.com/package/@mandujs/mcp) - MCP server
|
|
351
|
-
|
|
352
|
-
## License
|
|
353
|
-
|
|
354
|
-
MIT
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/konamgil/mandu/main/mandu_only_simbol.png" alt="Mandu" width="200" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@mandujs/cli</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Agent-Native Fullstack Framework CLI</strong><br/>
|
|
9
|
+
Architecture stays intact even when AI agents write your code
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
English | <a href="./README.ko.md"><strong>한국어</strong></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun add -D @mandujs/cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or use directly with `bunx`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bunx @mandujs/cli init my-app
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### 1. Create a New Project
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bunx @mandujs/cli init my-app
|
|
34
|
+
cd my-app
|
|
35
|
+
bun install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Start Development Server
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bun run dev
|
|
42
|
+
# or
|
|
43
|
+
bunx mandu dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Your app is now running at `http://localhost:3333`.
|
|
47
|
+
|
|
48
|
+
To change the port, set `PORT` or use `server.port` in `mandu.config`. If the port is in use, Mandu will pick the next available port.
|
|
49
|
+
|
|
50
|
+
### 3. Create Pages in `app/` Directory
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
app/
|
|
54
|
+
├── page.tsx → /
|
|
55
|
+
├── about/page.tsx → /about
|
|
56
|
+
├── users/[id]/page.tsx → /users/:id
|
|
57
|
+
└── api/hello/route.ts → /api/hello
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 4. Build for Production
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bunx mandu build
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Default Architecture Layout
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
app/ # FS Routes
|
|
70
|
+
src/
|
|
71
|
+
client/ # Client (FSD)
|
|
72
|
+
app/
|
|
73
|
+
pages/
|
|
74
|
+
widgets/
|
|
75
|
+
features/
|
|
76
|
+
entities/
|
|
77
|
+
shared/
|
|
78
|
+
server/ # Server (Clean)
|
|
79
|
+
api/
|
|
80
|
+
application/
|
|
81
|
+
domain/
|
|
82
|
+
infra/
|
|
83
|
+
core/
|
|
84
|
+
shared/ # Universal shared
|
|
85
|
+
contracts/ # Client-safe contracts
|
|
86
|
+
types/
|
|
87
|
+
utils/
|
|
88
|
+
client/ # Client-safe utils
|
|
89
|
+
server/ # Server-only utils
|
|
90
|
+
schema/ # Server-only schema
|
|
91
|
+
env/ # Server-only env
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
That's it!
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Commands
|
|
99
|
+
|
|
100
|
+
### Core Commands
|
|
101
|
+
|
|
102
|
+
| Command | Description |
|
|
103
|
+
|---------|-------------|
|
|
104
|
+
| `mandu init [name]` | Create new project |
|
|
105
|
+
| `mandu dev` | Start dev server (FS Routes + HMR) |
|
|
106
|
+
| `mandu build` | Build for production |
|
|
107
|
+
|
|
108
|
+
### FS Routes Commands
|
|
109
|
+
|
|
110
|
+
| Command | Description |
|
|
111
|
+
|---------|-------------|
|
|
112
|
+
| `mandu routes list` | Show all routes |
|
|
113
|
+
| `mandu routes generate` | Generate routes manifest |
|
|
114
|
+
| `mandu routes watch` | Watch for route changes |
|
|
115
|
+
|
|
116
|
+
### Guard Commands
|
|
117
|
+
|
|
118
|
+
| Command | Description |
|
|
119
|
+
|---------|-------------|
|
|
120
|
+
| `mandu guard` | Run architecture check (default: mandu preset) |
|
|
121
|
+
| `mandu guard --watch` | Watch mode |
|
|
122
|
+
| `mandu guard --ci` | CI mode (exit 1 on errors/warnings) |
|
|
123
|
+
| `mandu guard --preset fsd` | Use specific preset |
|
|
124
|
+
| `mandu guard --output report.md` | Generate report |
|
|
125
|
+
| `mandu guard legacy` | Legacy Spec guard (auto-correct) |
|
|
126
|
+
|
|
127
|
+
### Transaction Commands
|
|
128
|
+
|
|
129
|
+
| Command | Description |
|
|
130
|
+
|---------|-------------|
|
|
131
|
+
| `mandu change begin` | Start transaction (creates snapshot) |
|
|
132
|
+
| `mandu change commit` | Finalize changes |
|
|
133
|
+
| `mandu change rollback` | Restore from snapshot |
|
|
134
|
+
| `mandu change status` | Show current state |
|
|
135
|
+
| `mandu change list` | View history |
|
|
136
|
+
|
|
137
|
+
### Brain Commands
|
|
138
|
+
|
|
139
|
+
| Command | Description |
|
|
140
|
+
|---------|-------------|
|
|
141
|
+
| `mandu doctor` | Analyze Guard failures + suggest patches |
|
|
142
|
+
| `mandu watch` | Real-time file monitoring |
|
|
143
|
+
| `mandu monitor` | MCP Activity Monitor log stream |
|
|
144
|
+
| `mandu brain setup` | Configure sLLM (optional) |
|
|
145
|
+
| `mandu brain status` | Check Brain status |
|
|
146
|
+
|
|
147
|
+
### Contract & OpenAPI Commands
|
|
148
|
+
|
|
149
|
+
| Command | Description |
|
|
150
|
+
|---------|-------------|
|
|
151
|
+
| `mandu contract create <routeId>` | Create contract for route |
|
|
152
|
+
| `mandu contract validate` | Validate contract-slot consistency |
|
|
153
|
+
| `mandu contract build` | Build contract registry |
|
|
154
|
+
| `mandu contract diff` | Diff contracts against registry |
|
|
155
|
+
| `mandu openapi generate` | Generate OpenAPI 3.0 spec |
|
|
156
|
+
| `mandu openapi serve` | Start Swagger UI server |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Workflow
|
|
161
|
+
|
|
162
|
+
### Modern Workflow (Recommended)
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# 1. Create project
|
|
166
|
+
bunx @mandujs/cli init my-app
|
|
167
|
+
cd my-app && bun install
|
|
168
|
+
|
|
169
|
+
# 2. Create pages
|
|
170
|
+
# app/page.tsx → /
|
|
171
|
+
# app/users/page.tsx → /users
|
|
172
|
+
# app/api/users/route.ts → /api/users
|
|
173
|
+
|
|
174
|
+
# 3. Start development
|
|
175
|
+
bun run dev
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### With Architecture Guard
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Development with Guard watching
|
|
182
|
+
bunx mandu dev --guard
|
|
183
|
+
|
|
184
|
+
# Or run Guard separately
|
|
185
|
+
bunx mandu guard --watch
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### CI/CD Integration
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Build and check
|
|
192
|
+
bunx mandu build --minify
|
|
193
|
+
bunx mandu guard --ci --format json
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## FS Routes
|
|
199
|
+
|
|
200
|
+
Create routes by adding files to `app/`:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
app/
|
|
204
|
+
├── page.tsx → /
|
|
205
|
+
├── layout.tsx → Layout for all pages
|
|
206
|
+
├── users/
|
|
207
|
+
│ ├── page.tsx → /users
|
|
208
|
+
│ ├── [id]/
|
|
209
|
+
│ │ └── page.tsx → /users/:id
|
|
210
|
+
│ └── [...slug]/
|
|
211
|
+
│ └── page.tsx → /users/*
|
|
212
|
+
├── api/
|
|
213
|
+
│ └── users/
|
|
214
|
+
│ └── route.ts → /api/users
|
|
215
|
+
└── (auth)/ → Group (no URL segment)
|
|
216
|
+
└── login/page.tsx → /login
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Special Files
|
|
220
|
+
|
|
221
|
+
| File | Purpose |
|
|
222
|
+
|------|---------|
|
|
223
|
+
| `page.tsx` | Page component |
|
|
224
|
+
| `layout.tsx` | Shared layout |
|
|
225
|
+
| `route.ts` | API endpoint |
|
|
226
|
+
| `loading.tsx` | Loading state |
|
|
227
|
+
| `error.tsx` | Error boundary |
|
|
228
|
+
| `slot.ts` | Business logic |
|
|
229
|
+
| `client.tsx` | Interactive component (Island) |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Guard Presets
|
|
234
|
+
|
|
235
|
+
| Preset | Description |
|
|
236
|
+
|--------|-------------|
|
|
237
|
+
| `mandu` | FSD + Clean Architecture (default) |
|
|
238
|
+
| `fsd` | Feature-Sliced Design |
|
|
239
|
+
| `clean` | Clean Architecture |
|
|
240
|
+
| `hexagonal` | Hexagonal Architecture |
|
|
241
|
+
| `atomic` | Atomic Design |
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# List all presets
|
|
245
|
+
bunx mandu guard --list-presets
|
|
246
|
+
|
|
247
|
+
# Use specific preset
|
|
248
|
+
bunx mandu guard --preset fsd
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Options Reference
|
|
254
|
+
|
|
255
|
+
### `mandu dev`
|
|
256
|
+
|
|
257
|
+
| Option | Description |
|
|
258
|
+
|--------|-------------|
|
|
259
|
+
| `--guard` | Enable Guard watching |
|
|
260
|
+
| `--guard-preset <p>` | Guard preset (default: mandu) |
|
|
261
|
+
|
|
262
|
+
### `mandu build`
|
|
263
|
+
|
|
264
|
+
| Option | Description |
|
|
265
|
+
|--------|-------------|
|
|
266
|
+
| `--minify` | Minify output |
|
|
267
|
+
| `--sourcemap` | Generate sourcemaps |
|
|
268
|
+
| `--watch` | Watch mode |
|
|
269
|
+
|
|
270
|
+
### `mandu guard`
|
|
271
|
+
|
|
272
|
+
| Option | Description |
|
|
273
|
+
|--------|-------------|
|
|
274
|
+
| `--preset <p>` | Preset: fsd, clean, hexagonal, atomic, mandu |
|
|
275
|
+
| `--watch` | Watch mode |
|
|
276
|
+
| `--ci` | CI mode (exit 1 on errors/warnings) |
|
|
277
|
+
| `--quiet` | Summary only |
|
|
278
|
+
| `--format <f>` | Output: console, agent, json |
|
|
279
|
+
| `--output <path>` | Report file path |
|
|
280
|
+
| `--report-format <f>` | Report: json, markdown, html |
|
|
281
|
+
| `--save-stats` | Save for trend analysis |
|
|
282
|
+
| `--show-trend` | Show trend analysis |
|
|
283
|
+
|
|
284
|
+
### `mandu doctor`
|
|
285
|
+
|
|
286
|
+
| Option | Description |
|
|
287
|
+
|--------|-------------|
|
|
288
|
+
| `--format <f>` | Output: console, json, markdown |
|
|
289
|
+
| `--no-llm` | Template mode (no LLM) |
|
|
290
|
+
| `--output <path>` | Output file path |
|
|
291
|
+
|
|
292
|
+
### `mandu monitor`
|
|
293
|
+
|
|
294
|
+
| Option | Description |
|
|
295
|
+
|--------|-------------|
|
|
296
|
+
| `--format <f>` | Output: console, agent, json |
|
|
297
|
+
| `--summary` | Print summary (JSON log only) |
|
|
298
|
+
| `--since <d>` | Summary window: 5m, 30s, 1h |
|
|
299
|
+
| `--follow <bool>` | Follow mode (default: true) |
|
|
300
|
+
| `--file <path>` | Use custom log file |
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Examples
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Initialize project
|
|
308
|
+
bunx @mandujs/cli init my-app
|
|
309
|
+
|
|
310
|
+
# Development
|
|
311
|
+
bunx mandu dev --guard
|
|
312
|
+
|
|
313
|
+
# Routes
|
|
314
|
+
bunx mandu routes list
|
|
315
|
+
bunx mandu routes generate
|
|
316
|
+
|
|
317
|
+
# Guard
|
|
318
|
+
bunx mandu guard
|
|
319
|
+
bunx mandu guard --watch
|
|
320
|
+
bunx mandu guard --ci --format json
|
|
321
|
+
bunx mandu guard --output report.md
|
|
322
|
+
bunx mandu guard legacy
|
|
323
|
+
|
|
324
|
+
# Transactions
|
|
325
|
+
bunx mandu change begin --message "Add users API"
|
|
326
|
+
bunx mandu change commit
|
|
327
|
+
bunx mandu change rollback
|
|
328
|
+
|
|
329
|
+
# Doctor
|
|
330
|
+
bunx mandu doctor
|
|
331
|
+
bunx mandu doctor --format json
|
|
332
|
+
|
|
333
|
+
# Monitor
|
|
334
|
+
bunx mandu monitor
|
|
335
|
+
bunx mandu monitor --summary --since 5m
|
|
336
|
+
|
|
337
|
+
# Build
|
|
338
|
+
bunx mandu build --minify --sourcemap
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Requirements
|
|
344
|
+
|
|
345
|
+
- Bun >= 1.0.0
|
|
346
|
+
|
|
347
|
+
## Related Packages
|
|
348
|
+
|
|
349
|
+
- [@mandujs/core](https://www.npmjs.com/package/@mandujs/core) - Core runtime
|
|
350
|
+
- [@mandujs/mcp](https://www.npmjs.com/package/@mandujs/mcp) - MCP server
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
MIT
|