@vc-shell/create-vc-app 1.1.98-rc.5 → 1.1.99-alpha.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 +552 -26
- package/dist/cli/argv.d.ts +4 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/constants.d.ts +4 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/errors.d.ts +12 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/runtime.d.ts +7 -0
- package/dist/cli/runtime.d.ts.map +1 -0
- package/dist/cli/types.d.ts +30 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/utils.d.ts +4 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/validation.d.ts +5 -0
- package/dist/cli/validation.d.ts.map +1 -0
- package/dist/commands/generate-blade.d.ts +16 -0
- package/dist/commands/generate-blade.d.ts.map +1 -0
- package/dist/index.js +1900 -530
- package/dist/templates/base/_package.json +5 -5
- package/dist/templates/base/ai-guides/.cursorrules-vc-shell +529 -0
- package/dist/templates/base/ai-guides/README.md +360 -0
- package/dist/templates/base/ai-guides/guides/AI_GUIDE.md +195 -0
- package/dist/templates/base/ai-guides/guides/blade-patterns.md +384 -0
- package/dist/templates/base/ai-guides/guides/complete-workflow.md +781 -0
- package/dist/templates/base/ai-guides/guides/composables-reference.md +338 -0
- package/dist/templates/base/ai-guides/guides/troubleshooting.md +529 -0
- package/dist/templates/base/ai-guides/guides/ui-components-reference.md +903 -0
- package/dist/templates/base/ai-guides/prompts/adapt-existing-module.md +1026 -0
- package/dist/templates/base/ai-guides/prompts/advanced-scenarios.md +852 -0
- package/dist/templates/base/ai-guides/prompts/api-client-generation.md +877 -0
- package/dist/templates/base/ai-guides/prompts/cli-usage.md +640 -0
- package/dist/templates/base/ai-guides/prompts/quick-start-scenarios.md +773 -0
- package/dist/templates/base/ai-guides/prompts/simple-modifications.md +987 -0
- package/dist/templates/base/src/main.ts +0 -4
- package/dist/templates/blades/details/blade.vue +175 -0
- package/dist/templates/blades/grid/blade.vue +340 -0
- package/dist/templates/composables/details-composable.ts +101 -0
- package/dist/templates/composables/grid-composable.ts +244 -0
- package/dist/templates/module/components/index.ts +2 -0
- package/dist/templates/module/components/widgets/index.ts +2 -0
- package/dist/templates/module/composables/index.ts +3 -0
- package/dist/templates/module/index.ts +13 -0
- package/dist/templates/module/locales/en.json +65 -0
- package/dist/templates/module/locales/index.ts +4 -0
- package/dist/templates/module/pages/index.ts +3 -0
- package/dist/templates/widgets/widget.vue +113 -0
- package/dist/utils/form-builder.d.ts +69 -0
- package/dist/utils/form-builder.d.ts.map +1 -0
- package/dist/utils/format.d.ts +24 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/naming.d.ts +44 -0
- package/dist/utils/naming.d.ts.map +1 -0
- package/dist/utils/register-module.d.ts +21 -0
- package/dist/utils/register-module.d.ts.map +1 -0
- package/dist/workflows/create-app.d.ts +14 -0
- package/dist/workflows/create-app.d.ts.map +1 -0
- package/package.json +12 -7
- package/dist/templates/mocks/sample-data/constants.ts +0 -89
- package/dist/templates/mocks/sample-data/index.ts +0 -2
- package/dist/templates/mocks/sample-data/methods.ts +0 -65
- package/dist/templates/modules/classic-module/composables/index.ts +0 -2
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +0 -24
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +0 -47
- package/dist/templates/modules/classic-module/index.ts +0 -8
- package/dist/templates/modules/classic-module/locales/en.json +0 -37
- package/dist/templates/modules/classic-module/locales/index.ts +0 -2
- package/dist/templates/modules/classic-module/pages/details.vue +0 -87
- package/dist/templates/modules/classic-module/pages/index.ts +0 -2
- package/dist/templates/modules/classic-module/pages/list.vue +0 -257
- package/dist/templates/sample/classic-module/composables/index.ts +0 -2
- package/dist/templates/sample/classic-module/composables/useDetails/index.ts +0 -54
- package/dist/templates/sample/classic-module/composables/useList/index.ts +0 -62
- package/dist/templates/sample/classic-module/index.ts +0 -8
- package/dist/templates/sample/classic-module/locales/en.json +0 -67
- package/dist/templates/sample/classic-module/locales/index.ts +0 -2
- package/dist/templates/sample/classic-module/pages/details.vue +0 -238
- package/dist/templates/sample/classic-module/pages/index.ts +0 -2
- package/dist/templates/sample/classic-module/pages/list.vue +0 -300
- package/dist/templates/sample/overrides/main.ts +0 -52
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
# CLI Usage Guide
|
|
2
|
+
|
|
3
|
+
Complete reference for using `create-vc-app` CLI tool to scaffold applications and generate modules.
|
|
4
|
+
|
|
5
|
+
## When to Use This
|
|
6
|
+
|
|
7
|
+
Use these prompts when you need to:
|
|
8
|
+
- Create a new VC Shell application
|
|
9
|
+
- Generate modules, blades, or widgets
|
|
10
|
+
- Add functionality to existing projects
|
|
11
|
+
- Automate module creation with specific configurations
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- Node.js 18 or higher installed
|
|
16
|
+
- Understanding of your project requirements
|
|
17
|
+
- API structure (if integrating with backend)
|
|
18
|
+
|
|
19
|
+
## Quick Reference
|
|
20
|
+
|
|
21
|
+
### Create New Application
|
|
22
|
+
|
|
23
|
+
**Interactive Mode (Recommended for first-time users):**
|
|
24
|
+
```bash
|
|
25
|
+
npx create-vc-app my-app
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Non-Interactive Mode:**
|
|
29
|
+
```bash
|
|
30
|
+
npx create-vc-app my-app \
|
|
31
|
+
--package-name "my-app" \
|
|
32
|
+
--base-path "/apps/my-app/" \
|
|
33
|
+
--skip-module-gen
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Generate Module
|
|
37
|
+
|
|
38
|
+
**Interactive Mode:**
|
|
39
|
+
```bash
|
|
40
|
+
cd my-app
|
|
41
|
+
npx create-vc-app blade
|
|
42
|
+
# Select: "Module (with blades)"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Non-Interactive Mode:**
|
|
46
|
+
```bash
|
|
47
|
+
npx create-vc-app blade \
|
|
48
|
+
--module products \
|
|
49
|
+
--type grid \
|
|
50
|
+
--name products-list \
|
|
51
|
+
--composable \
|
|
52
|
+
--locales \
|
|
53
|
+
--is-workspace
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Detailed Examples
|
|
59
|
+
|
|
60
|
+
### 1. Create New Application with Module
|
|
61
|
+
|
|
62
|
+
**Scenario:** Starting completely from scratch
|
|
63
|
+
|
|
64
|
+
**Prompt for AI:**
|
|
65
|
+
```
|
|
66
|
+
Create a new VC Shell application called "my-shop" with a products module.
|
|
67
|
+
|
|
68
|
+
The products module should have:
|
|
69
|
+
- Grid blade (list view) with table
|
|
70
|
+
- Details blade (form view) with these fields:
|
|
71
|
+
- name (text, required)
|
|
72
|
+
- price (currency, required)
|
|
73
|
+
- description (editor, optional)
|
|
74
|
+
- category (select: Electronics, Clothing, Books)
|
|
75
|
+
- inStock (switch toggle)
|
|
76
|
+
|
|
77
|
+
Use the CLI to generate everything.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**AI will run:**
|
|
81
|
+
```bash
|
|
82
|
+
# Create app
|
|
83
|
+
npx create-vc-app my-shop
|
|
84
|
+
|
|
85
|
+
# Then follow interactive prompts:
|
|
86
|
+
# - Module name: products
|
|
87
|
+
# - Entity name: Product
|
|
88
|
+
# - Create both blades: yes
|
|
89
|
+
# - Workspace blade: Grid blade
|
|
90
|
+
# - Customize form: yes
|
|
91
|
+
# - Add fields as specified
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### 2. Add Module to Existing Application
|
|
97
|
+
|
|
98
|
+
**Scenario:** You have an app, need to add new module
|
|
99
|
+
|
|
100
|
+
**Prompt for AI:**
|
|
101
|
+
```
|
|
102
|
+
Add an orders module to my existing application.
|
|
103
|
+
|
|
104
|
+
Requirements:
|
|
105
|
+
- Grid blade with columns: orderNumber, customer, total, status, date
|
|
106
|
+
- Details blade with form fields:
|
|
107
|
+
- orderNumber (text, read-only)
|
|
108
|
+
- customer (text, required)
|
|
109
|
+
- total (currency, required)
|
|
110
|
+
- status (select: pending, processing, shipped, delivered)
|
|
111
|
+
- orderDate (date, required)
|
|
112
|
+
- notes (textarea, optional)
|
|
113
|
+
|
|
114
|
+
Generate using CLI.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**AI will run:**
|
|
118
|
+
```bash
|
|
119
|
+
cd /path/to/your-app
|
|
120
|
+
|
|
121
|
+
npx create-vc-app blade \
|
|
122
|
+
--module orders \
|
|
123
|
+
--type grid \
|
|
124
|
+
--name orders-list \
|
|
125
|
+
--composable \
|
|
126
|
+
--locales \
|
|
127
|
+
--is-workspace
|
|
128
|
+
|
|
129
|
+
# Then add details blade
|
|
130
|
+
npx create-vc-app blade \
|
|
131
|
+
--module orders \
|
|
132
|
+
--type details \
|
|
133
|
+
--name order-details \
|
|
134
|
+
--composable \
|
|
135
|
+
--locales \
|
|
136
|
+
--form-fields '[
|
|
137
|
+
{"name":"orderNumber","type":"VcInput","props":"{\"required\":true,\"readonly\":true}"},
|
|
138
|
+
{"name":"customer","type":"VcInput","props":"{\"required\":true}"},
|
|
139
|
+
{"name":"total","type":"VcInputCurrency","props":"{\"required\":true}"},
|
|
140
|
+
{"name":"status","type":"VcSelect","props":"{\"required\":true,\"options\":\"pending,processing,shipped,delivered\"}"},
|
|
141
|
+
{"name":"orderDate","type":"VcInput","props":"{\"type\":\"date\",\"required\":true}"},
|
|
142
|
+
{"name":"notes","type":"VcTextarea","props":"{}"}
|
|
143
|
+
]'
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 3. Generate Module with Custom Form (Non-Interactive)
|
|
149
|
+
|
|
150
|
+
**Scenario:** Automated generation with specific form structure
|
|
151
|
+
|
|
152
|
+
**Prompt for AI:**
|
|
153
|
+
```
|
|
154
|
+
Generate a complete products module using CLI in non-interactive mode.
|
|
155
|
+
|
|
156
|
+
Form fields:
|
|
157
|
+
- title (text input, required)
|
|
158
|
+
- sku (text input, required)
|
|
159
|
+
- description (rich text editor)
|
|
160
|
+
- price (currency input, required)
|
|
161
|
+
- compareAtPrice (currency input)
|
|
162
|
+
- category (select dropdown with options: Electronics, Clothing, Books, Home)
|
|
163
|
+
- tags (multivalue input)
|
|
164
|
+
- featured (switch toggle)
|
|
165
|
+
- images (gallery)
|
|
166
|
+
- status (radio buttons: draft, active, archived)
|
|
167
|
+
|
|
168
|
+
Create both list and details blades.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**AI will run:**
|
|
172
|
+
```bash
|
|
173
|
+
npx create-vc-app blade \
|
|
174
|
+
--module products \
|
|
175
|
+
--type grid \
|
|
176
|
+
--name products \
|
|
177
|
+
--composable \
|
|
178
|
+
--locales \
|
|
179
|
+
--is-workspace
|
|
180
|
+
|
|
181
|
+
npx create-vc-app blade \
|
|
182
|
+
--module products \
|
|
183
|
+
--type details \
|
|
184
|
+
--name product-details \
|
|
185
|
+
--composable \
|
|
186
|
+
--locales \
|
|
187
|
+
--skip-form-editor \
|
|
188
|
+
--form-fields '[
|
|
189
|
+
{"name":"title","label":"Product Title","type":"VcInput","props":"{\"required\":true}"},
|
|
190
|
+
{"name":"sku","label":"SKU","type":"VcInput","props":"{\"required\":true}"},
|
|
191
|
+
{"name":"description","label":"Description","type":"VcEditor","props":"{}"},
|
|
192
|
+
{"name":"price","label":"Price","type":"VcInputCurrency","props":"{\"required\":true}"},
|
|
193
|
+
{"name":"compareAtPrice","label":"Compare at Price","type":"VcInputCurrency","props":"{}"},
|
|
194
|
+
{"name":"category","label":"Category","type":"VcSelect","props":"{\"required\":true,\"options\":\"Electronics,Clothing,Books,Home\"}"},
|
|
195
|
+
{"name":"tags","label":"Tags","type":"VcMultivalue","props":"{}"},
|
|
196
|
+
{"name":"featured","label":"Featured","type":"VcSwitch","props":"{}"},
|
|
197
|
+
{"name":"images","label":"Images","type":"VcGallery","props":"{}"},
|
|
198
|
+
{"name":"status","label":"Status","type":"VcRadioButton","props":"{\"options\":\"draft,active,archived\"}"}
|
|
199
|
+
]'
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### 4. Add Widget to Existing Blade
|
|
205
|
+
|
|
206
|
+
**Scenario:** Enhance blade with widget component
|
|
207
|
+
|
|
208
|
+
**Prompt for AI:**
|
|
209
|
+
```
|
|
210
|
+
Add a statistics widget to the product-details blade.
|
|
211
|
+
|
|
212
|
+
The widget should:
|
|
213
|
+
- Show product views count
|
|
214
|
+
- Show sales count
|
|
215
|
+
- Show revenue
|
|
216
|
+
- Be positioned on the right side
|
|
217
|
+
|
|
218
|
+
Use CLI to generate and register the widget.
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**AI will run:**
|
|
222
|
+
```bash
|
|
223
|
+
npx create-vc-app blade --widget
|
|
224
|
+
|
|
225
|
+
# Interactive prompts:
|
|
226
|
+
# - Select module: products
|
|
227
|
+
# - Select blade: product-details
|
|
228
|
+
# - Widget name: product-stats
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### 5. Generate Only Grid Blade (List Only)
|
|
234
|
+
|
|
235
|
+
**Scenario:** You only need a list view, no details
|
|
236
|
+
|
|
237
|
+
**Prompt for AI:**
|
|
238
|
+
```
|
|
239
|
+
Create a categories module with only a list view (no details blade).
|
|
240
|
+
|
|
241
|
+
List should show:
|
|
242
|
+
- Category name
|
|
243
|
+
- Number of products
|
|
244
|
+
- Status (active/inactive)
|
|
245
|
+
- Last modified date
|
|
246
|
+
|
|
247
|
+
Use CLI.
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**AI will run:**
|
|
251
|
+
```bash
|
|
252
|
+
npx create-vc-app blade \
|
|
253
|
+
--module categories \
|
|
254
|
+
--type grid \
|
|
255
|
+
--name categories \
|
|
256
|
+
--composable \
|
|
257
|
+
--locales \
|
|
258
|
+
--is-workspace
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### 6. Generate Only Details Blade (Form Only)
|
|
264
|
+
|
|
265
|
+
**Scenario:** You need a settings page (form without list)
|
|
266
|
+
|
|
267
|
+
**Prompt for AI:**
|
|
268
|
+
```
|
|
269
|
+
Create a settings module with only a details form (no list).
|
|
270
|
+
|
|
271
|
+
Form fields:
|
|
272
|
+
- storeName (text, required)
|
|
273
|
+
- storeEmail (text, required, email validation)
|
|
274
|
+
- currency (select: USD, EUR, GBP)
|
|
275
|
+
- timezone (select with multiple options)
|
|
276
|
+
- enableNotifications (switch)
|
|
277
|
+
- maintenanceMode (switch)
|
|
278
|
+
|
|
279
|
+
Use CLI.
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**AI will run:**
|
|
283
|
+
```bash
|
|
284
|
+
npx create-vc-app blade \
|
|
285
|
+
--module settings \
|
|
286
|
+
--type details \
|
|
287
|
+
--name settings \
|
|
288
|
+
--composable \
|
|
289
|
+
--locales \
|
|
290
|
+
--is-workspace \
|
|
291
|
+
--form-fields '[
|
|
292
|
+
{"name":"storeName","label":"Store Name","type":"VcInput","props":"{\"required\":true}"},
|
|
293
|
+
{"name":"storeEmail","label":"Store Email","type":"VcInput","props":"{\"required\":true,\"type\":\"email\"}"},
|
|
294
|
+
{"name":"currency","label":"Currency","type":"VcSelect","props":"{\"required\":true,\"options\":\"USD,EUR,GBP\"}"},
|
|
295
|
+
{"name":"timezone","label":"Timezone","type":"VcSelect","props":"{\"required\":true}"},
|
|
296
|
+
{"name":"enableNotifications","label":"Enable Notifications","type":"VcSwitch","props":"{}"},
|
|
297
|
+
{"name":"maintenanceMode","label":"Maintenance Mode","type":"VcSwitch","props":"{}"}
|
|
298
|
+
]'
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## CLI Command Reference
|
|
304
|
+
|
|
305
|
+
### Application Creation
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
npx create-vc-app [project-name] [options]
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Options:**
|
|
312
|
+
- `--name, --app-name <name>` - Application name
|
|
313
|
+
- `--package-name <name>` - Package name (defaults to app name)
|
|
314
|
+
- `--base-path <path>` - Base path for the application (default: /apps/<app-name>/)
|
|
315
|
+
- `--skip-module-gen` - Skip initial module generation
|
|
316
|
+
- `--skip-form-editor` - Skip interactive form builder
|
|
317
|
+
- `--form-fields <json>` - JSON string with form field definitions
|
|
318
|
+
- `--overwrite` - Overwrite existing files without confirmation
|
|
319
|
+
- `--help, -h` - Show help
|
|
320
|
+
- `--version, -v` - Show version
|
|
321
|
+
|
|
322
|
+
**Examples:**
|
|
323
|
+
```bash
|
|
324
|
+
# Basic app
|
|
325
|
+
npx create-vc-app my-app
|
|
326
|
+
|
|
327
|
+
# App without module
|
|
328
|
+
npx create-vc-app my-app --skip-module-gen
|
|
329
|
+
|
|
330
|
+
# App with custom base path
|
|
331
|
+
npx create-vc-app my-app --base-path "/custom/path/"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### Module/Blade Generation
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
npx create-vc-app blade [options]
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Options:**
|
|
343
|
+
- `--module <name>` - Target module name
|
|
344
|
+
- `--type <grid|details>` - Blade type
|
|
345
|
+
- `--name <name>` - Blade name
|
|
346
|
+
- `--composable` - Generate composable (default: true)
|
|
347
|
+
- `--locales` - Generate locales (default: true)
|
|
348
|
+
- `--is-workspace` - Mark blade as workspace blade (main module blade)
|
|
349
|
+
- `--widget` - Generate widget instead of blade
|
|
350
|
+
- `--path <path>` - Target path for generation
|
|
351
|
+
- `--skip-form-editor` - Skip interactive form builder
|
|
352
|
+
- `--form-fields <json>` - JSON array of form field definitions
|
|
353
|
+
|
|
354
|
+
**Examples:**
|
|
355
|
+
```bash
|
|
356
|
+
# Interactive mode
|
|
357
|
+
npx create-vc-app blade
|
|
358
|
+
|
|
359
|
+
# Generate grid blade
|
|
360
|
+
npx create-vc-app blade --module products --type grid --name products
|
|
361
|
+
|
|
362
|
+
# Generate details blade with form
|
|
363
|
+
npx create-vc-app blade --module products --type details --name product-details
|
|
364
|
+
|
|
365
|
+
# Generate widget
|
|
366
|
+
npx create-vc-app blade --widget
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Form Field Types Reference
|
|
372
|
+
|
|
373
|
+
When using `--form-fields` option, use this JSON structure:
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
interface FormField {
|
|
377
|
+
name: string; // Field property name
|
|
378
|
+
label?: string; // Display label (optional, uses name if not provided)
|
|
379
|
+
type: FieldType; // Component type (see below)
|
|
380
|
+
props?: string; // JSON string of component props
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Available Field Types:**
|
|
385
|
+
|
|
386
|
+
| Type | Component | Use Case | Example Props |
|
|
387
|
+
|------|-----------|----------|---------------|
|
|
388
|
+
| `VcInput` | Text input | Basic text, numbers, dates | `{"required":true,"type":"text"}` |
|
|
389
|
+
| `VcTextarea` | Multi-line text | Long text, comments | `{"rows":5}` |
|
|
390
|
+
| `VcSelect` | Dropdown | Single selection | `{"required":true,"options":"Option1,Option2"}` |
|
|
391
|
+
| `VcEditor` | Rich text editor | Formatted content | `{"placeholder":"Enter content"}` |
|
|
392
|
+
| `VcSwitch` | Toggle | Boolean values | `{}` |
|
|
393
|
+
| `VcGallery` | Image gallery | Multiple images | `{}` |
|
|
394
|
+
| `VcInputCurrency` | Currency input | Money values | `{"required":true}` |
|
|
395
|
+
| `VcRadioButton` | Radio buttons | Single choice from list | `{"options":"Option1,Option2,Option3"}` |
|
|
396
|
+
| `VcCheckbox` | Checkbox | Single boolean | `{"label":"Agree to terms"}` |
|
|
397
|
+
| `VcMultivalue` | Tag input | Multiple text values | `{"placeholder":"Add tag"}` |
|
|
398
|
+
| `VcField` | Read-only field | Display-only data | `{}` |
|
|
399
|
+
|
|
400
|
+
**Example JSON for --form-fields:**
|
|
401
|
+
```json
|
|
402
|
+
[
|
|
403
|
+
{
|
|
404
|
+
"name": "title",
|
|
405
|
+
"label": "Product Title",
|
|
406
|
+
"type": "VcInput",
|
|
407
|
+
"props": "{\"required\":true}"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"name": "price",
|
|
411
|
+
"label": "Price",
|
|
412
|
+
"type": "VcInputCurrency",
|
|
413
|
+
"props": "{\"required\":true}"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "description",
|
|
417
|
+
"label": "Description",
|
|
418
|
+
"type": "VcEditor",
|
|
419
|
+
"props": "{}"
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Expected Output
|
|
427
|
+
|
|
428
|
+
### After Creating Application
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
✨ Application created successfully!
|
|
432
|
+
|
|
433
|
+
📊 Summary:
|
|
434
|
+
Location: /path/to/my-app
|
|
435
|
+
Package: my-app
|
|
436
|
+
Base path: /apps/my-app/
|
|
437
|
+
Files created: 60+
|
|
438
|
+
|
|
439
|
+
🚀 Next steps:
|
|
440
|
+
1. cd my-app
|
|
441
|
+
2. yarn
|
|
442
|
+
3. yarn serve
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**What was created:**
|
|
446
|
+
- Complete Vue 3 + TypeScript application
|
|
447
|
+
- Router configuration
|
|
448
|
+
- Localization setup
|
|
449
|
+
- Prettier and ESLint configuration
|
|
450
|
+
- Base components and styles
|
|
451
|
+
- Development scripts
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### After Generating Module
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
✅ Module generated successfully!
|
|
459
|
+
|
|
460
|
+
Created files:
|
|
461
|
+
- src/modules/products/pages/products.vue
|
|
462
|
+
- src/modules/products/pages/product-details.vue
|
|
463
|
+
- src/modules/products/composables/useProductList.ts
|
|
464
|
+
- src/modules/products/composables/useProductDetails.ts
|
|
465
|
+
- src/modules/products/locales/en.json
|
|
466
|
+
- src/modules/products/index.ts
|
|
467
|
+
|
|
468
|
+
Module registered in src/main.ts
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**What was created:**
|
|
472
|
+
- Complete module structure
|
|
473
|
+
- Grid blade with VcTable
|
|
474
|
+
- Details blade with form fields
|
|
475
|
+
- Composables with async logic
|
|
476
|
+
- Localization files
|
|
477
|
+
- Automatic module registration
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Next Steps After Generation
|
|
482
|
+
|
|
483
|
+
### 1. Install Dependencies
|
|
484
|
+
```bash
|
|
485
|
+
cd your-app
|
|
486
|
+
yarn
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### 2. Connect to API
|
|
490
|
+
See [API Client Generation Guide](./api-client-generation.md)
|
|
491
|
+
|
|
492
|
+
### 3. Start Development Server
|
|
493
|
+
```bash
|
|
494
|
+
yarn serve
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### 4. Access Application
|
|
498
|
+
```
|
|
499
|
+
http://localhost:8080/apps/your-app/
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### 5. Customize Generated Code
|
|
503
|
+
- Update TODO comments in composables
|
|
504
|
+
- Replace placeholder API calls
|
|
505
|
+
- Add validation rules
|
|
506
|
+
- Customize UI components
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## Common Patterns
|
|
511
|
+
|
|
512
|
+
### Pattern 1: E-commerce Module Set
|
|
513
|
+
|
|
514
|
+
**Prompt:**
|
|
515
|
+
```
|
|
516
|
+
Create a complete e-commerce module set:
|
|
517
|
+
1. Products (list + details)
|
|
518
|
+
2. Categories (list + details)
|
|
519
|
+
3. Orders (list + details)
|
|
520
|
+
4. Customers (list + details)
|
|
521
|
+
|
|
522
|
+
Use CLI to generate all modules.
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
**AI will execute:**
|
|
526
|
+
```bash
|
|
527
|
+
# Products
|
|
528
|
+
npx create-vc-app blade --module products --type grid --name products --is-workspace
|
|
529
|
+
npx create-vc-app blade --module products --type details --name product-details
|
|
530
|
+
|
|
531
|
+
# Categories
|
|
532
|
+
npx create-vc-app blade --module categories --type grid --name categories --is-workspace
|
|
533
|
+
npx create-vc-app blade --module categories --type details --name category-details
|
|
534
|
+
|
|
535
|
+
# Orders
|
|
536
|
+
npx create-vc-app blade --module orders --type grid --name orders --is-workspace
|
|
537
|
+
npx create-vc-app blade --module orders --type details --name order-details
|
|
538
|
+
|
|
539
|
+
# Customers
|
|
540
|
+
npx create-vc-app blade --module customers --type grid --name customers --is-workspace
|
|
541
|
+
npx create-vc-app blade --module customers --type details --name customer-details
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
### Pattern 2: Settings Pages (Forms Only)
|
|
547
|
+
|
|
548
|
+
**Prompt:**
|
|
549
|
+
```
|
|
550
|
+
Create settings pages (no lists):
|
|
551
|
+
1. General Settings (store name, email, timezone)
|
|
552
|
+
2. Payment Settings (payment methods, currencies)
|
|
553
|
+
3. Shipping Settings (shipping zones, rates)
|
|
554
|
+
|
|
555
|
+
Use CLI.
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
**AI will execute:**
|
|
559
|
+
```bash
|
|
560
|
+
# General
|
|
561
|
+
npx create-vc-app blade --module settings-general --type details --name general --is-workspace
|
|
562
|
+
|
|
563
|
+
# Payment
|
|
564
|
+
npx create-vc-app blade --module settings-payment --type details --name payment --is-workspace
|
|
565
|
+
|
|
566
|
+
# Shipping
|
|
567
|
+
npx create-vc-app blade --module settings-shipping --type details --name shipping --is-workspace
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Troubleshooting
|
|
573
|
+
|
|
574
|
+
### Issue: Module Not Created
|
|
575
|
+
**Error:** `Module "xyz" not found`
|
|
576
|
+
|
|
577
|
+
**Solution:** When generating a blade for non-existent module in non-interactive mode, the CLI automatically creates the module. Make sure you're in the project directory.
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
### Issue: Form Fields Not Generated
|
|
582
|
+
**Error:** Invalid JSON in `--form-fields`
|
|
583
|
+
|
|
584
|
+
**Solution:** Ensure JSON is properly escaped:
|
|
585
|
+
- Use single quotes around the entire JSON
|
|
586
|
+
- Use double quotes inside for JSON properties
|
|
587
|
+
- Escape inner JSON in props: `"{\"required\":true}"`
|
|
588
|
+
|
|
589
|
+
**Correct:**
|
|
590
|
+
```bash
|
|
591
|
+
--form-fields '[{"name":"title","type":"VcInput","props":"{\"required\":true}"}]'
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
### Issue: Command Not Found
|
|
597
|
+
**Error:** `create-vc-app: command not found`
|
|
598
|
+
|
|
599
|
+
**Solution:** Use `npx` to run without global installation:
|
|
600
|
+
```bash
|
|
601
|
+
npx create-vc-app blade
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Tips for Better AI Prompts
|
|
607
|
+
|
|
608
|
+
1. **Be Specific:** Describe field types, validations, and requirements clearly
|
|
609
|
+
2. **Use Structure:** List fields in bullet points or tables
|
|
610
|
+
3. **Mention CLI:** Always say "use CLI" or "generate with create-vc-app"
|
|
611
|
+
4. **Provide Context:** Mention if adding to existing app or creating new
|
|
612
|
+
5. **Include Data Structure:** Describe your API data format if integrating
|
|
613
|
+
|
|
614
|
+
**Good Prompt Example:**
|
|
615
|
+
```
|
|
616
|
+
Use create-vc-app CLI to generate an invoices module.
|
|
617
|
+
|
|
618
|
+
Structure:
|
|
619
|
+
- List blade with columns: invoice number, customer, date, total, status
|
|
620
|
+
- Details blade with form:
|
|
621
|
+
- Invoice number (text, auto-generated, read-only)
|
|
622
|
+
- Customer (select dropdown)
|
|
623
|
+
- Date (date picker, required)
|
|
624
|
+
- Items (table with add/remove)
|
|
625
|
+
- Total (currency, auto-calculated, read-only)
|
|
626
|
+
- Status (select: draft, sent, paid)
|
|
627
|
+
- Notes (textarea)
|
|
628
|
+
|
|
629
|
+
Create both grid and details blades.
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## Related Documentation
|
|
635
|
+
|
|
636
|
+
- [Quick Start Scenarios](./quick-start-scenarios.md) - Ready-to-use examples
|
|
637
|
+
- [API Client Generation](./api-client-generation.md) - Connecting to backend
|
|
638
|
+
- [Complete Workflow Guide](../guides/complete-workflow.md) - End-to-end process
|
|
639
|
+
- [Official Documentation](https://docs.virtocommerce.org/platform/developer-guide/custom-apps-development/vc-shell/)
|
|
640
|
+
|