vg-coder-cli 2.0.0 → 2.0.3
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/package.json +1 -1
- package/src/index.js +60 -0
- package/vg/README-WORKSPACE.md +82 -0
- package/vg/bin/vg-workspace.js +43 -0
- package/vg/package-workspace.json +38 -0
- package/vg/package.json +37 -74
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vg-coder-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "🚀 CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting. Now with modern NestJS API and Angular dashboard!",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/index.js
CHANGED
|
@@ -66,6 +66,7 @@ class VGCoderCLI {
|
|
|
66
66
|
.alias('s')
|
|
67
67
|
.description('Khởi động API server')
|
|
68
68
|
.option('-p, --port <port>', 'Port cho server', '6868')
|
|
69
|
+
.option('--new', 'Khởi động NestJS/Angular stack (modern)')
|
|
69
70
|
.action(this.handleStart.bind(this));
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -367,11 +368,69 @@ class VGCoderCLI {
|
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
370
|
|
|
371
|
+
|
|
370
372
|
/**
|
|
371
373
|
* Handle start command
|
|
372
374
|
*/
|
|
373
375
|
async handleStart(options) {
|
|
374
376
|
try {
|
|
377
|
+
// Check if --new flag is set
|
|
378
|
+
if (options.new) {
|
|
379
|
+
console.log(chalk.blue('🚀 VG Coder - Modern NestJS/Angular Stack'));
|
|
380
|
+
console.log('');
|
|
381
|
+
console.log(chalk.yellow('Starting the modern workspace...'));
|
|
382
|
+
console.log('');
|
|
383
|
+
|
|
384
|
+
// Use npx to run the workspace package
|
|
385
|
+
const { spawn } = require('child_process');
|
|
386
|
+
|
|
387
|
+
console.log(chalk.cyan('Running: npx vg-coder-workspace@latest'));
|
|
388
|
+
console.log('');
|
|
389
|
+
console.log(chalk.gray('This will:'));
|
|
390
|
+
console.log(chalk.gray(' • Install the workspace package (if needed)'));
|
|
391
|
+
console.log(chalk.gray(' • Start NestJS API on http://localhost:3000'));
|
|
392
|
+
console.log(chalk.gray(' • Start Angular Dashboard on http://localhost:4200'));
|
|
393
|
+
console.log('');
|
|
394
|
+
|
|
395
|
+
const child = spawn('npx', ['vg-coder-workspace@latest'], {
|
|
396
|
+
stdio: 'inherit',
|
|
397
|
+
shell: true
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
child.on('error', (error) => {
|
|
401
|
+
console.error(chalk.red('\n❌ Failed to start workspace:'), error.message);
|
|
402
|
+
console.log('');
|
|
403
|
+
console.log(chalk.yellow('💡 Alternative: Clone and run locally'));
|
|
404
|
+
console.log(chalk.cyan(' git clone https://github.com/tinhthanh/vg-coder-cli.git'));
|
|
405
|
+
console.log(chalk.cyan(' cd vg-coder-cli/vg && npm install && ./start-dev.sh'));
|
|
406
|
+
process.exit(1);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
child.on('exit', (code) => {
|
|
410
|
+
if (code !== 0 && code !== null) {
|
|
411
|
+
console.error(chalk.red(`\nProcess exited with code ${code}`));
|
|
412
|
+
}
|
|
413
|
+
process.exit(code || 0);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
// Handle graceful shutdown
|
|
417
|
+
const shutdown = () => {
|
|
418
|
+
console.log(chalk.yellow('\n\nShutting down...'));
|
|
419
|
+
child.kill('SIGTERM');
|
|
420
|
+
setTimeout(() => process.exit(0), 1000);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
process.on('SIGINT', shutdown);
|
|
424
|
+
process.on('SIGTERM', shutdown);
|
|
425
|
+
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Legacy Express server
|
|
430
|
+
console.log(chalk.blue('🚀 Starting Express server (legacy)...'));
|
|
431
|
+
console.log(chalk.yellow('💡 Tip: Use --new flag to start the modern NestJS/Angular stack'));
|
|
432
|
+
console.log('');
|
|
433
|
+
|
|
375
434
|
const port = parseInt(options.port);
|
|
376
435
|
const server = new ApiServer(port);
|
|
377
436
|
|
|
@@ -415,6 +474,7 @@ class VGCoderCLI {
|
|
|
415
474
|
}
|
|
416
475
|
}
|
|
417
476
|
|
|
477
|
+
|
|
418
478
|
/**
|
|
419
479
|
* Run CLI
|
|
420
480
|
*/
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# VG Coder Workspace
|
|
2
|
+
|
|
3
|
+
Modern NestJS + Angular workspace for VG Coder CLI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Global Installation
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @vg-coder/workspace
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Run with npx (Recommended)
|
|
13
|
+
```bash
|
|
14
|
+
npx @vg-coder/workspace@latest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Start Development Servers
|
|
20
|
+
```bash
|
|
21
|
+
vg-workspace
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This will start:
|
|
25
|
+
- **NestJS API**: http://localhost:3000
|
|
26
|
+
- **Angular Dashboard**: http://localhost:4200
|
|
27
|
+
|
|
28
|
+
### From VG Coder CLI
|
|
29
|
+
```bash
|
|
30
|
+
vg start --new
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What's Included
|
|
34
|
+
|
|
35
|
+
- **NestJS Backend** (`apps/api`)
|
|
36
|
+
- REST API with CORS support
|
|
37
|
+
- Project analysis endpoints
|
|
38
|
+
- Bash script execution
|
|
39
|
+
- Token counting
|
|
40
|
+
|
|
41
|
+
- **Angular Frontend** (`apps/ng-app`)
|
|
42
|
+
- Modern dashboard UI
|
|
43
|
+
- Reactive forms
|
|
44
|
+
- Real-time updates
|
|
45
|
+
|
|
46
|
+
- **Core Library** (`packages/core`)
|
|
47
|
+
- Shared TypeScript utilities
|
|
48
|
+
- Project detection
|
|
49
|
+
- File scanning
|
|
50
|
+
- Token management
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
### Build All Projects
|
|
55
|
+
```bash
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Build Individual Projects
|
|
60
|
+
```bash
|
|
61
|
+
npm run build:api
|
|
62
|
+
npm run build:ng-app
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Serve Individual Projects
|
|
66
|
+
```bash
|
|
67
|
+
npm run serve:api # API only
|
|
68
|
+
npm run serve:ng-app # Frontend only
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
- Node.js >= 16.0.0
|
|
74
|
+
- npm >= 7.0.0
|
|
75
|
+
|
|
76
|
+
## Related Packages
|
|
77
|
+
|
|
78
|
+
- [vg-coder-cli](https://www.npmjs.com/package/vg-coder-cli) - Main CLI tool
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
|
|
7
|
+
console.log(chalk.blue('🚀 VG Coder Workspace'));
|
|
8
|
+
console.log(chalk.yellow('Starting NestJS API and Angular Dashboard...'));
|
|
9
|
+
console.log('');
|
|
10
|
+
|
|
11
|
+
// Get the directory where this package is installed
|
|
12
|
+
const workspaceDir = path.join(__dirname, '..');
|
|
13
|
+
|
|
14
|
+
// Start both services
|
|
15
|
+
const child = spawn('npx', ['nx', 'run-many', '--target=serve', '--projects=api,ng-app', '--parallel=2'], {
|
|
16
|
+
cwd: workspaceDir,
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
shell: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
child.on('error', (error) => {
|
|
22
|
+
console.error(chalk.red('Failed to start:'), error.message);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('exit', (code) => {
|
|
27
|
+
if (code !== 0 && code !== null) {
|
|
28
|
+
console.error(chalk.red(`Process exited with code ${code}`));
|
|
29
|
+
process.exit(code);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Handle graceful shutdown
|
|
34
|
+
const shutdown = () => {
|
|
35
|
+
console.log(chalk.yellow('\n\nShutting down...'));
|
|
36
|
+
child.kill('SIGTERM');
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}, 1000);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
process.on('SIGINT', shutdown);
|
|
43
|
+
process.on('SIGTERM', shutdown);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vg-coder/workspace",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Modern NestJS/Angular workspace for VG Coder CLI",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vg-workspace": "./bin/vg-workspace.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "nx run-many --target=serve --projects=api,ng-app --parallel=2",
|
|
11
|
+
"build": "nx run-many --target=build --all --configuration=production",
|
|
12
|
+
"build:api": "nx build api",
|
|
13
|
+
"build:ng-app": "nx build ng-app",
|
|
14
|
+
"serve:api": "nx serve api",
|
|
15
|
+
"serve:ng-app": "nx serve ng-app"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"vg-coder",
|
|
19
|
+
"nestjs",
|
|
20
|
+
"angular",
|
|
21
|
+
"nx-monorepo",
|
|
22
|
+
"api-server",
|
|
23
|
+
"dashboard"
|
|
24
|
+
],
|
|
25
|
+
"author": "VG Coder",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/tinhthanh/vg-coder-cli.git",
|
|
30
|
+
"directory": "vg"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"vg-coder-cli": "^2.0.0"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=16.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/vg/package.json
CHANGED
|
@@ -1,75 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"jest": "^29.7.0",
|
|
40
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
41
|
-
"jest-environment-node": "^29.7.0",
|
|
42
|
-
"jest-preset-angular": "~14.6.1",
|
|
43
|
-
"jest-util": "^29.7.0",
|
|
44
|
-
"jsonc-eslint-parser": "^2.1.0",
|
|
45
|
-
"nx": "22.1.3",
|
|
46
|
-
"prettier": "^2.6.2",
|
|
47
|
-
"supertest": "^7.1.4",
|
|
48
|
-
"ts-jest": "^29.1.0",
|
|
49
|
-
"ts-node": "10.9.1",
|
|
50
|
-
"tslib": "^2.3.0",
|
|
51
|
-
"typescript": "~5.9.2",
|
|
52
|
-
"typescript-eslint": "^8.40.0",
|
|
53
|
-
"webpack-cli": "^5.1.4"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@angular/common": "~20.3.0",
|
|
57
|
-
"@angular/compiler": "~20.3.0",
|
|
58
|
-
"@angular/core": "~20.3.0",
|
|
59
|
-
"@angular/forms": "~20.3.0",
|
|
60
|
-
"@angular/platform-browser": "~20.3.0",
|
|
61
|
-
"@angular/platform-browser-dynamic": "~20.3.0",
|
|
62
|
-
"@angular/router": "~20.3.0",
|
|
63
|
-
"@nestjs/common": "^11.0.0",
|
|
64
|
-
"@nestjs/core": "^11.0.0",
|
|
65
|
-
"@nestjs/platform-express": "^11.0.0",
|
|
66
|
-
"axios": "^1.6.0",
|
|
67
|
-
"directory-tree": "^3.5.2",
|
|
68
|
-
"fs-extra": "^11.3.2",
|
|
69
|
-
"ignore": "^7.0.5",
|
|
70
|
-
"reflect-metadata": "^0.1.13",
|
|
71
|
-
"rxjs": "^7.8.0",
|
|
72
|
-
"tiktoken": "^1.0.22",
|
|
73
|
-
"zone.js": "~0.15.0"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
2
|
+
"name": "vg-coder-workspace",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Modern NestJS/Angular workspace for VG Coder CLI",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vg-workspace": "./bin/vg-workspace.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "nx run-many --target=serve --projects=api,ng-app --parallel=2",
|
|
11
|
+
"build": "nx run-many --target=build --all --configuration=production",
|
|
12
|
+
"build:api": "nx build api",
|
|
13
|
+
"build:ng-app": "nx build ng-app",
|
|
14
|
+
"serve:api": "nx serve api",
|
|
15
|
+
"serve:ng-app": "nx serve ng-app"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"vg-coder",
|
|
19
|
+
"nestjs",
|
|
20
|
+
"angular",
|
|
21
|
+
"nx-monorepo",
|
|
22
|
+
"api-server",
|
|
23
|
+
"dashboard"
|
|
24
|
+
],
|
|
25
|
+
"author": "VG Coder",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/tinhthanh/vg-coder-cli.git",
|
|
30
|
+
"directory": "vg"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"vg-coder-cli": "^2.0.0"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=16.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|