@burgan-tech/vnext-workflow-cli 1.0.0 → 1.0.2
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/.github/CODEOWNERS +2 -0
- package/README.md +244 -82
- package/bin/workflow.js +0 -0
- package/package.json +5 -5
- package/src/commands/check.js +62 -22
- package/src/commands/config.js +5 -6
- package/src/commands/csx.js +125 -44
- package/src/commands/reset.js +198 -80
- package/src/commands/sync.js +189 -107
- package/src/commands/update.js +217 -99
- package/src/lib/api.js +52 -34
- package/src/lib/config.js +43 -5
- package/src/lib/csx.js +130 -57
- package/src/lib/discover.js +131 -29
- package/src/lib/vnextConfig.js +124 -0
- package/src/lib/workflow.js +86 -39
package/README.md
CHANGED
|
@@ -53,18 +53,62 @@ npm link
|
|
|
53
53
|
|
|
54
54
|
---
|
|
55
55
|
|
|
56
|
+
## 📄 vnext.config.json (Required)
|
|
57
|
+
|
|
58
|
+
Every vNext project must have a `vnext.config.json` file in the **project root**. This file defines the domain and component paths.
|
|
59
|
+
|
|
60
|
+
### Example Configuration
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"version": "1.0.0",
|
|
65
|
+
"domain": "core",
|
|
66
|
+
"paths": {
|
|
67
|
+
"componentsRoot": "core",
|
|
68
|
+
"tasks": "Tasks",
|
|
69
|
+
"views": "Views",
|
|
70
|
+
"functions": "Functions",
|
|
71
|
+
"extensions": "Extensions",
|
|
72
|
+
"workflows": "Workflows",
|
|
73
|
+
"schemas": "Schemas"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Key Properties
|
|
79
|
+
|
|
80
|
+
| Property | Description |
|
|
81
|
+
|----------|-------------|
|
|
82
|
+
| `domain` | Domain name used for API calls (replaces config's API_DOMAIN) |
|
|
83
|
+
| `paths.componentsRoot` | Root folder where all components are located |
|
|
84
|
+
| `paths.tasks` | Tasks folder name under componentsRoot |
|
|
85
|
+
| `paths.workflows` | Workflows folder name under componentsRoot |
|
|
86
|
+
| `paths.schemas` | Schemas folder name under componentsRoot |
|
|
87
|
+
| `paths.views` | Views folder name under componentsRoot |
|
|
88
|
+
| `paths.functions` | Functions folder name under componentsRoot |
|
|
89
|
+
| `paths.extensions` | Extensions folder name under componentsRoot |
|
|
90
|
+
|
|
91
|
+
### Component Discovery
|
|
92
|
+
|
|
93
|
+
The CLI scans `componentsRoot` recursively and:
|
|
94
|
+
- Includes all `.json` files in subfolders
|
|
95
|
+
- Ignores `.meta` folders
|
|
96
|
+
- Ignores `*.diagram.json` files
|
|
97
|
+
- Ignores `package*.json` and `*config*.json` files
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
56
101
|
## ⚡ Quick Start
|
|
57
102
|
|
|
58
103
|
### Initial Configuration
|
|
59
104
|
|
|
60
|
-
After installation,
|
|
105
|
+
After installation, navigate to your vNext project and run:
|
|
61
106
|
|
|
62
107
|
```bash
|
|
63
|
-
#
|
|
64
|
-
|
|
108
|
+
# Go to your vNext project directory
|
|
109
|
+
cd /path/to/your/vnext-project
|
|
65
110
|
|
|
66
|
-
# Database settings
|
|
67
|
-
wf config set DB_PASSWORD postgres
|
|
111
|
+
# Database settings (if using Docker)
|
|
68
112
|
wf config set USE_DOCKER true
|
|
69
113
|
wf config set DOCKER_POSTGRES_CONTAINER vnext-postgres
|
|
70
114
|
|
|
@@ -72,6 +116,8 @@ wf config set DOCKER_POSTGRES_CONTAINER vnext-postgres
|
|
|
72
116
|
wf check
|
|
73
117
|
```
|
|
74
118
|
|
|
119
|
+
**Note:** The CLI automatically uses the current working directory as the project root. Just `cd` into your project folder before running commands.
|
|
120
|
+
|
|
75
121
|
### Basic Usage
|
|
76
122
|
|
|
77
123
|
```bash
|
|
@@ -93,147 +139,256 @@ wf reset
|
|
|
93
139
|
## 📖 Commands
|
|
94
140
|
|
|
95
141
|
### `wf check`
|
|
96
|
-
Checks system status (API, DB, folders).
|
|
97
142
|
|
|
98
|
-
|
|
99
|
-
|
|
143
|
+
**Purpose**: System health check
|
|
144
|
+
|
|
145
|
+
Checks and displays:
|
|
146
|
+
- vnext.config.json status and domain info
|
|
147
|
+
- API connection status
|
|
148
|
+
- Database connection status
|
|
149
|
+
- Component folders found
|
|
150
|
+
|
|
100
151
|
```bash
|
|
101
|
-
wf
|
|
102
|
-
wf config get PROJECT_ROOT # Show a specific setting
|
|
103
|
-
wf config set DB_PASSWORD pass # Change a setting
|
|
152
|
+
wf check
|
|
104
153
|
```
|
|
105
154
|
|
|
106
|
-
|
|
107
|
-
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### `wf sync`
|
|
158
|
+
|
|
159
|
+
**Purpose**: Add missing components to database (skip existing)
|
|
160
|
+
|
|
161
|
+
**What it does**:
|
|
162
|
+
1. Scans all CSX files and updates JSON files with base64 encoded content
|
|
163
|
+
2. For each component JSON file:
|
|
164
|
+
- Checks if it exists in DB (by key)
|
|
165
|
+
- If **exists** → Skip (already synced)
|
|
166
|
+
- If **not exists** → Publish to API
|
|
167
|
+
3. Re-initializes the system
|
|
168
|
+
|
|
169
|
+
**Use when**: Initial setup, adding new components without affecting existing ones
|
|
170
|
+
|
|
108
171
|
```bash
|
|
109
|
-
wf
|
|
110
|
-
wf csx --all # Process all CSX files
|
|
111
|
-
wf csx --file x.csx # Process a single file
|
|
172
|
+
wf sync
|
|
112
173
|
```
|
|
113
174
|
|
|
175
|
+
---
|
|
176
|
+
|
|
114
177
|
### `wf update [options]`
|
|
115
|
-
|
|
178
|
+
|
|
179
|
+
**Purpose**: Update changed components (delete + re-add)
|
|
180
|
+
|
|
181
|
+
**What it does**:
|
|
182
|
+
1. Finds changed CSX files (Git) and updates JSON files
|
|
183
|
+
2. For each component JSON file:
|
|
184
|
+
- Checks if it exists in DB (by key)
|
|
185
|
+
- If **exists** → Delete from DB, then publish to API
|
|
186
|
+
- If **not exists** → Publish to API
|
|
187
|
+
3. Re-initializes the system
|
|
188
|
+
|
|
189
|
+
**Use when**: You modified existing components and want to update them
|
|
190
|
+
|
|
116
191
|
```bash
|
|
117
192
|
wf update # Process changed files in Git (CSX + JSON)
|
|
118
193
|
wf update --all # Update all (asks for confirmation)
|
|
119
194
|
wf update --file x.json # Process a single file
|
|
120
195
|
```
|
|
121
196
|
|
|
122
|
-
|
|
123
|
-
1. 📝 Converts changed CSX files to base64 and writes to JSON files
|
|
124
|
-
2. 🗑️ Deletes existing record from DB
|
|
125
|
-
3. 📤 POSTs to API
|
|
126
|
-
4. ✅ Activates the workflow
|
|
127
|
-
5. 🔄 Restarts the system
|
|
128
|
-
|
|
129
|
-
### `wf sync`
|
|
130
|
-
Updates all CSX files and adds missing ones to the database.
|
|
131
|
-
```bash
|
|
132
|
-
wf sync # Update all CSX files + add missing ones
|
|
133
|
-
```
|
|
197
|
+
---
|
|
134
198
|
|
|
135
199
|
### `wf reset`
|
|
136
|
-
|
|
200
|
+
|
|
201
|
+
**Purpose**: Force reset components (always delete + re-add)
|
|
202
|
+
|
|
203
|
+
**What it does**:
|
|
204
|
+
1. Shows interactive menu to select component type
|
|
205
|
+
2. For each component JSON file:
|
|
206
|
+
- Checks if it exists in DB (by key)
|
|
207
|
+
- If **exists** → Delete from DB, then publish to API
|
|
208
|
+
- If **not exists** → Publish to API
|
|
209
|
+
3. Re-initializes the system
|
|
210
|
+
|
|
211
|
+
**Use when**: You need to force reset components regardless of changes
|
|
212
|
+
|
|
137
213
|
```bash
|
|
138
|
-
wf reset # Select folder from menu
|
|
214
|
+
wf reset # Select folder from interactive menu
|
|
139
215
|
```
|
|
140
216
|
|
|
141
|
-
**Menu
|
|
217
|
+
**Menu Options**:
|
|
142
218
|
```
|
|
143
219
|
? Which folder should be reset?
|
|
144
|
-
❯
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
220
|
+
❯ tasks (Tasks/)
|
|
221
|
+
views (Views/)
|
|
222
|
+
functions (Functions/)
|
|
223
|
+
extensions (Extensions/)
|
|
224
|
+
workflows (Workflows/)
|
|
225
|
+
schemas (Schemas/)
|
|
150
226
|
──────────────
|
|
151
|
-
|
|
227
|
+
TUMU (All folders)
|
|
152
228
|
```
|
|
153
229
|
|
|
154
230
|
---
|
|
155
231
|
|
|
156
|
-
|
|
232
|
+
### `wf csx [options]`
|
|
157
233
|
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
# Edit CSX file
|
|
161
|
-
vim AddToCartMapping.csx
|
|
234
|
+
**Purpose**: Convert CSX files to Base64 and embed in JSON files
|
|
162
235
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
236
|
+
**What it does**:
|
|
237
|
+
1. Finds CSX files (changed or all)
|
|
238
|
+
2. Converts to Base64
|
|
239
|
+
3. Updates ALL JSON files that reference the CSX file
|
|
240
|
+
4. Updates ALL matching `location` references in each JSON
|
|
166
241
|
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# Convert CSX files to base64 and write to JSON files
|
|
170
|
-
wf csx
|
|
171
|
-
```
|
|
242
|
+
**Use when**: You only want to update CSX content in JSONs without publishing to API
|
|
172
243
|
|
|
173
|
-
### 3. Initial Setup / Full Sync
|
|
174
244
|
```bash
|
|
175
|
-
#
|
|
176
|
-
wf
|
|
245
|
+
wf csx # Process changed files in Git
|
|
246
|
+
wf csx --all # Process all CSX files
|
|
247
|
+
wf csx --file x.csx # Process a single file
|
|
177
248
|
```
|
|
178
249
|
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
# With interactive menu (RECOMMENDED)
|
|
182
|
-
wf reset
|
|
250
|
+
---
|
|
183
251
|
|
|
184
|
-
|
|
185
|
-
|
|
252
|
+
### `wf config <action> [key] [value]`
|
|
253
|
+
|
|
254
|
+
**Purpose**: Configuration management
|
|
186
255
|
|
|
187
|
-
|
|
188
|
-
wf
|
|
256
|
+
```bash
|
|
257
|
+
wf config get # Show all settings
|
|
258
|
+
wf config get PROJECT_ROOT # Show a specific setting
|
|
259
|
+
wf config set DB_PASSWORD pass # Change a setting
|
|
189
260
|
```
|
|
190
261
|
|
|
191
262
|
---
|
|
192
263
|
|
|
193
|
-
## ⚙️ Configuration
|
|
264
|
+
## ⚙️ Configuration Variables
|
|
194
265
|
|
|
195
266
|
Config file location: `~/.config/vnext-workflow-cli/config.json`
|
|
196
267
|
|
|
197
|
-
###
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
268
|
+
### All Available Settings
|
|
269
|
+
|
|
270
|
+
| Variable | Default | Description |
|
|
271
|
+
|----------|---------|-------------|
|
|
272
|
+
| `PROJECT_ROOT` | `process.cwd()` | **Auto.** Always uses current working directory (cannot be changed) |
|
|
273
|
+
| `AUTO_DISCOVER` | `true` | Enable automatic component folder discovery |
|
|
274
|
+
| `API_BASE_URL` | `http://localhost:4201` | vNext API base URL |
|
|
275
|
+
| `API_VERSION` | `v1` | API version |
|
|
276
|
+
| `DB_HOST` | `localhost` | PostgreSQL host |
|
|
277
|
+
| `DB_PORT` | `5432` | PostgreSQL port |
|
|
278
|
+
| `DB_NAME` | `vNext_WorkflowDb` | PostgreSQL database name |
|
|
279
|
+
| `DB_USER` | `postgres` | PostgreSQL username |
|
|
280
|
+
| `DB_PASSWORD` | `postgres` | PostgreSQL password |
|
|
281
|
+
| `USE_DOCKER` | `false` | Use Docker for PostgreSQL connection |
|
|
282
|
+
| `DOCKER_POSTGRES_CONTAINER` | `vnext-postgres` | Docker container name for PostgreSQL |
|
|
283
|
+
| `DEBUG_MODE` | `false` | Enable debug logging |
|
|
284
|
+
|
|
285
|
+
**Note:** `PROJECT_ROOT` is always the current working directory (`process.cwd()`). Simply `cd` into your project folder before running any command.
|
|
286
|
+
|
|
287
|
+
### Quick Setup Examples
|
|
201
288
|
|
|
289
|
+
```bash
|
|
202
290
|
# API settings
|
|
203
291
|
wf config set API_BASE_URL http://localhost:4201
|
|
204
292
|
wf config set API_VERSION v1
|
|
205
293
|
|
|
206
|
-
# Database settings
|
|
294
|
+
# Database settings (direct connection)
|
|
207
295
|
wf config set DB_HOST localhost
|
|
208
296
|
wf config set DB_PORT 5432
|
|
209
297
|
wf config set DB_NAME vNext_WorkflowDb
|
|
210
298
|
wf config set DB_USER postgres
|
|
211
299
|
wf config set DB_PASSWORD your_password
|
|
300
|
+
wf config set USE_DOCKER false
|
|
212
301
|
|
|
213
|
-
#
|
|
302
|
+
# Database settings (Docker)
|
|
214
303
|
wf config set USE_DOCKER true
|
|
215
304
|
wf config set DOCKER_POSTGRES_CONTAINER vnext-postgres
|
|
216
305
|
|
|
217
|
-
#
|
|
306
|
+
# Other settings
|
|
218
307
|
wf config set AUTO_DISCOVER true
|
|
308
|
+
wf config set DEBUG_MODE false
|
|
219
309
|
```
|
|
220
310
|
|
|
221
311
|
---
|
|
222
312
|
|
|
313
|
+
## 💡 Usage Scenarios
|
|
314
|
+
|
|
315
|
+
### 1. First Time Setup
|
|
316
|
+
```bash
|
|
317
|
+
# Go to your vNext project
|
|
318
|
+
cd /path/to/project
|
|
319
|
+
|
|
320
|
+
# Check system status
|
|
321
|
+
wf check
|
|
322
|
+
|
|
323
|
+
# Sync all components (add missing ones)
|
|
324
|
+
wf sync
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 2. Daily Development - Changed Files
|
|
328
|
+
```bash
|
|
329
|
+
# Edit CSX or JSON files
|
|
330
|
+
vim MyTask.csx
|
|
331
|
+
|
|
332
|
+
# Update only changed components
|
|
333
|
+
wf update
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 3. Update All Components
|
|
337
|
+
```bash
|
|
338
|
+
# Force update all components
|
|
339
|
+
wf update --all
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### 4. Reset Specific Component Type
|
|
343
|
+
```bash
|
|
344
|
+
# Interactive menu
|
|
345
|
+
wf reset
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### 5. Only Update CSX in JSONs (No API)
|
|
349
|
+
```bash
|
|
350
|
+
# Update CSX content in JSON files without publishing
|
|
351
|
+
wf csx
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## 🔄 Command Comparison
|
|
357
|
+
|
|
358
|
+
| Command | DB Check | Existing Action | New Action | Use Case |
|
|
359
|
+
|---------|----------|-----------------|------------|----------|
|
|
360
|
+
| `sync` | Yes | Skip | Publish | Add missing components |
|
|
361
|
+
| `update` | Yes | Delete + Publish | Publish | Update changed components |
|
|
362
|
+
| `reset` | Yes | Delete + Publish | Publish | Force reset components |
|
|
363
|
+
| `csx` | No | N/A | N/A | Only update CSX in JSONs |
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
223
367
|
## 🆘 Troubleshooting
|
|
224
368
|
|
|
225
|
-
### "
|
|
369
|
+
### "vnext.config.json not found"
|
|
226
370
|
```bash
|
|
227
|
-
#
|
|
371
|
+
# Make sure you're in the correct directory
|
|
372
|
+
pwd
|
|
373
|
+
|
|
374
|
+
# Check if vnext.config.json exists
|
|
375
|
+
ls -la vnext.config.json
|
|
376
|
+
|
|
377
|
+
# Check current working directory
|
|
228
378
|
wf config get PROJECT_ROOT
|
|
379
|
+
```
|
|
229
380
|
|
|
230
|
-
|
|
231
|
-
|
|
381
|
+
### "Files not found" (When using on another PC)
|
|
382
|
+
```bash
|
|
383
|
+
# Just cd into the project directory
|
|
384
|
+
cd /Users/NewUser/path/to/project
|
|
232
385
|
|
|
233
386
|
# Verify
|
|
234
387
|
wf check
|
|
235
388
|
```
|
|
236
389
|
|
|
390
|
+
**Note:** No need to set PROJECT_ROOT - just `cd` into your project folder.
|
|
391
|
+
|
|
237
392
|
### "Cannot connect to API"
|
|
238
393
|
```bash
|
|
239
394
|
# Check API
|
|
@@ -350,12 +505,13 @@ vnext-workflow-cli/
|
|
|
350
505
|
│ │ ├── sync.js
|
|
351
506
|
│ │ └── update.js
|
|
352
507
|
│ └── lib/ # Library modules
|
|
353
|
-
│ ├── api.js
|
|
354
|
-
│ ├── config.js
|
|
355
|
-
│ ├── csx.js
|
|
356
|
-
│ ├── db.js
|
|
357
|
-
│ ├── discover.js
|
|
358
|
-
│
|
|
508
|
+
│ ├── api.js # API client (publish, reinitialize)
|
|
509
|
+
│ ├── config.js # CLI configuration
|
|
510
|
+
│ ├── csx.js # CSX processing
|
|
511
|
+
│ ├── db.js # Database operations
|
|
512
|
+
│ ├── discover.js # Component discovery
|
|
513
|
+
│ ├── vnextConfig.js # vnext.config.json reader
|
|
514
|
+
│ └── workflow.js # Workflow processing
|
|
359
515
|
├── .github/
|
|
360
516
|
│ └── workflows/ # GitHub Actions workflows
|
|
361
517
|
│ ├── build-and-publish.yml
|
|
@@ -379,4 +535,10 @@ wf check
|
|
|
379
535
|
|
|
380
536
|
# Run development
|
|
381
537
|
npm run dev
|
|
382
|
-
```
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## 📝 License
|
|
543
|
+
|
|
544
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
package/bin/workflow.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burgan-tech/vnext-workflow-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "vNext Workflow Manager - CLI tool for managing workflows, tasks, schemas and more",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"node": ">=14.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"commander": "^11.1.0",
|
|
36
|
-
"chalk": "^4.1.2",
|
|
37
35
|
"axios": "^1.6.2",
|
|
38
|
-
"
|
|
36
|
+
"chalk": "^4.1.2",
|
|
37
|
+
"commander": "^11.1.0",
|
|
38
|
+
"conf": "^10.2.0",
|
|
39
39
|
"glob": "^10.3.10",
|
|
40
40
|
"inquirer": "^8.2.6",
|
|
41
41
|
"ora": "^5.4.1",
|
|
42
|
-
"
|
|
42
|
+
"pg": "^8.11.3"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/commands/check.js
CHANGED
|
@@ -2,73 +2,113 @@ const chalk = require('chalk');
|
|
|
2
2
|
const ora = require('ora');
|
|
3
3
|
const config = require('../lib/config');
|
|
4
4
|
const { discoverComponents, listDiscovered } = require('../lib/discover');
|
|
5
|
+
const { getDomain, getComponentTypes, getComponentsRoot } = require('../lib/vnextConfig');
|
|
5
6
|
const { testApiConnection } = require('../lib/api');
|
|
6
7
|
const { testDbConnection } = require('../lib/db');
|
|
7
8
|
|
|
9
|
+
// Logging helpers
|
|
10
|
+
const LOG = {
|
|
11
|
+
separator: () => console.log(chalk.cyan('═'.repeat(60))),
|
|
12
|
+
subSeparator: () => console.log(chalk.cyan('─'.repeat(60))),
|
|
13
|
+
header: (text) => {
|
|
14
|
+
console.log();
|
|
15
|
+
LOG.separator();
|
|
16
|
+
console.log(chalk.cyan.bold(` ${text}`));
|
|
17
|
+
LOG.separator();
|
|
18
|
+
},
|
|
19
|
+
success: (text) => console.log(chalk.green(` ✓ ${text}`)),
|
|
20
|
+
error: (text) => console.log(chalk.red(` ✗ ${text}`)),
|
|
21
|
+
warning: (text) => console.log(chalk.yellow(` ⚠ ${text}`)),
|
|
22
|
+
info: (text) => console.log(chalk.dim(` ○ ${text}`))
|
|
23
|
+
};
|
|
24
|
+
|
|
8
25
|
async function checkCommand() {
|
|
9
|
-
|
|
26
|
+
LOG.header('SYSTEM CHECK');
|
|
10
27
|
|
|
11
28
|
const projectRoot = config.get('PROJECT_ROOT');
|
|
12
29
|
const autoDiscover = config.get('AUTO_DISCOVER');
|
|
13
30
|
|
|
14
|
-
//
|
|
15
|
-
|
|
31
|
+
// vnext.config.json check
|
|
32
|
+
console.log(chalk.white.bold('\n Configuration:\n'));
|
|
33
|
+
|
|
34
|
+
let domain, componentTypes, componentsRoot;
|
|
35
|
+
try {
|
|
36
|
+
domain = getDomain(projectRoot);
|
|
37
|
+
componentTypes = getComponentTypes(projectRoot);
|
|
38
|
+
componentsRoot = getComponentsRoot(projectRoot);
|
|
39
|
+
|
|
40
|
+
LOG.success(`vnext.config.json found`);
|
|
41
|
+
console.log(chalk.dim(` Domain: ${domain}`));
|
|
42
|
+
console.log(chalk.dim(` Components Root: ${componentsRoot}`));
|
|
43
|
+
} catch (error) {
|
|
44
|
+
LOG.error(`vnext.config.json: ${error.message}`);
|
|
45
|
+
componentTypes = {};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// API check
|
|
49
|
+
console.log(chalk.white.bold('\n Connection Status:\n'));
|
|
50
|
+
|
|
51
|
+
let apiSpinner = ora(' Checking API...').start();
|
|
16
52
|
try {
|
|
17
53
|
const apiUrl = config.get('API_BASE_URL');
|
|
18
54
|
const isApiOk = await testApiConnection(apiUrl);
|
|
19
55
|
if (isApiOk) {
|
|
20
|
-
apiSpinner.succeed(chalk.green(
|
|
56
|
+
apiSpinner.succeed(chalk.green(` API: Accessible (${apiUrl})`));
|
|
21
57
|
} else {
|
|
22
|
-
apiSpinner.fail(chalk.red(
|
|
58
|
+
apiSpinner.fail(chalk.red(` API: Not accessible (${apiUrl})`));
|
|
23
59
|
}
|
|
24
60
|
} catch (error) {
|
|
25
|
-
apiSpinner.fail(chalk.red(`API:
|
|
61
|
+
apiSpinner.fail(chalk.red(` API: Error - ${error.message}`));
|
|
26
62
|
}
|
|
27
63
|
|
|
28
|
-
// DB
|
|
29
|
-
let dbSpinner = ora('
|
|
64
|
+
// DB check
|
|
65
|
+
let dbSpinner = ora(' Checking database...').start();
|
|
30
66
|
try {
|
|
67
|
+
const useDockerValue = config.get('USE_DOCKER');
|
|
31
68
|
const isDbOk = await testDbConnection({
|
|
32
69
|
host: config.get('DB_HOST'),
|
|
33
70
|
port: config.get('DB_PORT'),
|
|
34
71
|
database: config.get('DB_NAME'),
|
|
35
72
|
user: config.get('DB_USER'),
|
|
36
73
|
password: config.get('DB_PASSWORD'),
|
|
37
|
-
useDocker:
|
|
74
|
+
useDocker: useDockerValue === true || useDockerValue === 'true',
|
|
38
75
|
dockerContainer: config.get('DOCKER_POSTGRES_CONTAINER')
|
|
39
76
|
});
|
|
40
77
|
if (isDbOk) {
|
|
41
|
-
dbSpinner.succeed(chalk.green(
|
|
78
|
+
dbSpinner.succeed(chalk.green(` DB: Connected (${config.get('DB_HOST')}:${config.get('DB_PORT')})`));
|
|
42
79
|
} else {
|
|
43
|
-
dbSpinner.fail(chalk.red('DB:
|
|
80
|
+
dbSpinner.fail(chalk.red(' DB: Cannot connect'));
|
|
44
81
|
}
|
|
45
82
|
} catch (error) {
|
|
46
|
-
dbSpinner.fail(chalk.red(`DB:
|
|
83
|
+
dbSpinner.fail(chalk.red(` DB: Error - ${error.message}`));
|
|
47
84
|
}
|
|
48
85
|
|
|
49
|
-
//
|
|
50
|
-
if (autoDiscover) {
|
|
51
|
-
console.log(chalk.
|
|
52
|
-
|
|
86
|
+
// Folder scan
|
|
87
|
+
if (autoDiscover && Object.keys(componentTypes).length > 0) {
|
|
88
|
+
console.log(chalk.white.bold('\n Component Folders:\n'));
|
|
89
|
+
|
|
90
|
+
let discoverSpinner = ora(' Scanning folders...').start();
|
|
53
91
|
try {
|
|
54
92
|
const discovered = await discoverComponents(projectRoot);
|
|
55
93
|
discoverSpinner.stop();
|
|
56
94
|
|
|
57
|
-
const list = listDiscovered(discovered);
|
|
95
|
+
const list = listDiscovered(discovered, componentTypes);
|
|
58
96
|
for (const item of list) {
|
|
59
97
|
if (item.found) {
|
|
60
|
-
console.log(chalk.green(` ✓ ${item.name}
|
|
98
|
+
console.log(chalk.green(` ✓ ${item.name.padEnd(12)} → ${item.folderName}/`));
|
|
61
99
|
} else {
|
|
62
|
-
console.log(chalk.yellow(` ○ ${item.name} ${chalk.dim('(
|
|
100
|
+
console.log(chalk.yellow(` ○ ${item.name.padEnd(12)} ${chalk.dim('(not found)')}`));
|
|
63
101
|
}
|
|
64
102
|
}
|
|
65
103
|
} catch (error) {
|
|
66
|
-
discoverSpinner.fail(chalk.red(`
|
|
104
|
+
discoverSpinner.fail(chalk.red(` Folder scan error: ${error.message}`));
|
|
67
105
|
}
|
|
106
|
+
} else if (!autoDiscover) {
|
|
107
|
+
console.log(chalk.yellow('\n ⚠ AUTO_DISCOVER is disabled'));
|
|
68
108
|
}
|
|
69
109
|
|
|
70
|
-
|
|
110
|
+
LOG.separator();
|
|
111
|
+
console.log(chalk.green.bold('\n ✓ Check completed\n'));
|
|
71
112
|
}
|
|
72
113
|
|
|
73
114
|
module.exports = checkCommand;
|
|
74
|
-
|
package/src/commands/config.js
CHANGED
|
@@ -7,25 +7,24 @@ async function configCommand(action, key, value) {
|
|
|
7
7
|
const val = config.get(key);
|
|
8
8
|
console.log(chalk.cyan(`${key}:`), val);
|
|
9
9
|
} else {
|
|
10
|
-
//
|
|
11
|
-
console.log(chalk.cyan.bold('\n📝
|
|
10
|
+
// Show all config
|
|
11
|
+
console.log(chalk.cyan.bold('\n📝 Current Configuration:\n'));
|
|
12
12
|
const all = config.getAll();
|
|
13
13
|
for (const [k, v] of Object.entries(all)) {
|
|
14
14
|
console.log(chalk.cyan(`${k}:`), chalk.white(v));
|
|
15
15
|
}
|
|
16
|
-
console.log(chalk.dim(`\
|
|
16
|
+
console.log(chalk.dim(`\nConfig file: ${config.path}\n`));
|
|
17
17
|
}
|
|
18
18
|
} else if (action === 'set') {
|
|
19
19
|
if (!key || value === undefined) {
|
|
20
|
-
console.log(chalk.red('
|
|
20
|
+
console.log(chalk.red('Usage: workflow config set <key> <value>'));
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
config.set(key, value);
|
|
24
24
|
console.log(chalk.green(`✓ ${key} = ${value}`));
|
|
25
25
|
} else {
|
|
26
|
-
console.log(chalk.red('
|
|
26
|
+
console.log(chalk.red('Invalid action. Use: get or set'));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
module.exports = configCommand;
|
|
31
|
-
|