vg-coder-cli 1.0.16 → 2.0.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/CHANGELOG.md +59 -0
- package/PUBLISHING.md +86 -0
- package/README.md +92 -318
- package/SYSTEM_PROMPT.md +157 -0
- package/init-nx-monorepo.sh +107 -0
- package/package.json +11 -4
- package/src/server/api-server.js +6 -1
- package/src/server/views/dashboard.html +69 -4
- package/vg/.vscode/extensions.json +8 -0
- package/vg/.vscode/launch.json +23 -0
- package/vg/README.md +85 -0
- package/vg/apps/api/project.json +83 -0
- package/vg/apps/api/src/app/analyze.controller.ts +17 -0
- package/vg/apps/api/src/app/analyze.service.ts +57 -0
- package/vg/apps/api/src/app/app.controller.ts +12 -0
- package/vg/apps/api/src/app/app.module.ts +29 -0
- package/vg/apps/api/src/app/app.service.ts +8 -0
- package/vg/apps/api/src/app/clean.controller.ts +40 -0
- package/vg/apps/api/src/app/execute.controller.ts +19 -0
- package/vg/apps/api/src/app/execute.service.ts +46 -0
- package/vg/apps/api/src/app/info.controller.ts +12 -0
- package/vg/apps/api/src/app/info.service.ts +65 -0
- package/vg/apps/api/src/assets/.gitkeep +0 -0
- package/vg/apps/api/src/main.ts +28 -0
- package/vg/apps/api/webpack.config.js +25 -0
- package/vg/apps/api-e2e/jest.config.cts +18 -0
- package/vg/apps/api-e2e/project.json +17 -0
- package/vg/apps/api-e2e/src/support/global-setup.ts +16 -0
- package/vg/apps/api-e2e/src/support/global-teardown.ts +10 -0
- package/vg/apps/api-e2e/src/support/test-setup.ts +9 -0
- package/vg/apps/ng-app/jest.config.ts +21 -0
- package/vg/apps/ng-app/project.json +110 -0
- package/vg/apps/ng-app/proxy.conf.json +8 -0
- package/vg/apps/ng-app/public/favicon.ico +0 -0
- package/vg/apps/ng-app/src/app/app.config.ts +17 -0
- package/vg/apps/ng-app/src/app/app.html +1 -0
- package/vg/apps/ng-app/src/app/app.routes.ts +7 -0
- package/vg/apps/ng-app/src/app/app.scss +0 -0
- package/vg/apps/ng-app/src/app/app.ts +12 -0
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.html +87 -0
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.scss +290 -0
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.ts +236 -0
- package/vg/apps/ng-app/src/app/nx-welcome.ts +872 -0
- package/vg/apps/ng-app/src/app/services/api.service.ts +28 -0
- package/vg/apps/ng-app/src/index.html +13 -0
- package/vg/apps/ng-app/src/main.ts +5 -0
- package/vg/apps/ng-app/src/styles.scss +1 -0
- package/vg/apps/ng-app/src/test-setup.ts +6 -0
- package/vg/jest.config.ts +6 -0
- package/vg/nx.json +85 -0
- package/vg/package-lock.json +30707 -0
- package/vg/package.json +75 -0
- package/vg/packages/client/data-access/README.md +7 -0
- package/vg/packages/client/data-access/jest.config.ts +21 -0
- package/vg/packages/client/data-access/project.json +21 -0
- package/vg/packages/client/data-access/src/index.ts +1 -0
- package/vg/packages/client/data-access/src/lib/data-access/data-access.html +1 -0
- package/vg/packages/client/data-access/src/lib/data-access/data-access.scss +0 -0
- package/vg/packages/client/data-access/src/lib/data-access/data-access.ts +9 -0
- package/vg/packages/client/data-access/src/test-setup.ts +6 -0
- package/vg/packages/core/README.md +11 -0
- package/vg/packages/core/jest.config.ts +10 -0
- package/vg/packages/core/package.json +11 -0
- package/vg/packages/core/project.json +26 -0
- package/vg/packages/core/src/index.ts +6 -0
- package/vg/packages/core/src/lib/core.ts +3 -0
- package/vg/packages/core/src/lib/detectors/project-detector.ts +343 -0
- package/vg/packages/core/src/lib/ignore/ignore-manager.ts +315 -0
- package/vg/packages/core/src/lib/scanner/file-scanner.ts +675 -0
- package/vg/packages/core/src/lib/tokenizer/token-manager.ts +435 -0
- package/vg/packages/core/src/lib/utils/bash-executor.ts +146 -0
- package/vg/packages/shared/data-types/README.md +11 -0
- package/vg/packages/shared/data-types/jest.config.ts +10 -0
- package/vg/packages/shared/data-types/package.json +11 -0
- package/vg/packages/shared/data-types/project.json +26 -0
- package/vg/packages/shared/data-types/src/index.ts +1 -0
- package/vg/packages/shared/data-types/src/lib/data-types.ts +3 -0
- package/vg/start-dev.sh +22 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [2.0.0] - 2025-11-30
|
|
4
|
+
|
|
5
|
+
### 🚀 Major Update: NestJS + Angular Architecture
|
|
6
|
+
|
|
7
|
+
#### Added
|
|
8
|
+
- **NestJS Backend** (`vg/apps/api`)
|
|
9
|
+
- Modern REST API with dependency injection
|
|
10
|
+
- CORS support for Angular frontend
|
|
11
|
+
- Controllers for analyze, execute, info, and clean endpoints
|
|
12
|
+
- Comprehensive error handling and logging
|
|
13
|
+
|
|
14
|
+
- **Angular Frontend** (`vg/apps/ng-app`)
|
|
15
|
+
- Modern dashboard with standalone components
|
|
16
|
+
- Reactive forms and HTTP client integration
|
|
17
|
+
- Proxy configuration for seamless API communication
|
|
18
|
+
- Same UI/UX as original HTML dashboard
|
|
19
|
+
|
|
20
|
+
- **Core Library** (`vg/packages/core`)
|
|
21
|
+
- Shared TypeScript library with strict typing
|
|
22
|
+
- ProjectDetector, FileScanner, TokenManager, BashExecutor, IgnoreManager
|
|
23
|
+
- Reusable across CLI and API
|
|
24
|
+
|
|
25
|
+
- **Nx Monorepo**
|
|
26
|
+
- Structured workspace with apps and packages
|
|
27
|
+
- Build caching and task orchestration
|
|
28
|
+
- Easy to add new applications
|
|
29
|
+
|
|
30
|
+
- **Development Scripts**
|
|
31
|
+
- `npm run build:vg` - Build all VG workspace projects
|
|
32
|
+
- `npm run start:vg` - Start development servers
|
|
33
|
+
- `./vg/start-dev.sh` - Convenient startup script
|
|
34
|
+
|
|
35
|
+
#### Changed
|
|
36
|
+
- Bumped version to 2.0.0 for major architecture change
|
|
37
|
+
- Updated package description and keywords
|
|
38
|
+
- Enhanced README with migration information
|
|
39
|
+
|
|
40
|
+
#### Technical Details
|
|
41
|
+
- Full TypeScript migration for core logic
|
|
42
|
+
- CORS configured for localhost:4200
|
|
43
|
+
- Proxy configuration for Angular dev server
|
|
44
|
+
- All original CLI functionality preserved
|
|
45
|
+
- API endpoints tested and verified
|
|
46
|
+
|
|
47
|
+
### Migration Notes
|
|
48
|
+
- Original Express/HTML app still available in `src/` directory
|
|
49
|
+
- New architecture in `vg/` directory
|
|
50
|
+
- Both can run independently
|
|
51
|
+
- API endpoints remain compatible
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## [1.0.17] - Previous Version
|
|
56
|
+
- Original Express/HTML implementation
|
|
57
|
+
- CLI tool for project analysis
|
|
58
|
+
- Token counting with tiktoken
|
|
59
|
+
- HTML export with syntax highlighting
|
package/PUBLISHING.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Publishing VG Coder CLI to NPM
|
|
2
|
+
|
|
3
|
+
## Pre-publish Checklist
|
|
4
|
+
|
|
5
|
+
✅ **Version Updated**: 2.0.0
|
|
6
|
+
✅ **Package.json Updated**: New scripts and keywords added
|
|
7
|
+
✅ **CHANGELOG Created**: Documenting all changes
|
|
8
|
+
✅ **.npmignore Created**: Excluding dev files
|
|
9
|
+
✅ **README Updated**: Migration information included
|
|
10
|
+
✅ **Tests**: E2E test suite created
|
|
11
|
+
✅ **Build Verified**: All projects build successfully
|
|
12
|
+
|
|
13
|
+
## Publishing Steps
|
|
14
|
+
|
|
15
|
+
### 1. Login to NPM (if not already logged in)
|
|
16
|
+
```bash
|
|
17
|
+
npm login
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Test Package Build
|
|
21
|
+
```bash
|
|
22
|
+
npm pack --dry-run
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 3. Build Production Artifacts (Optional - for VG workspace)
|
|
26
|
+
```bash
|
|
27
|
+
npm run build:vg
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 4. Publish to NPM
|
|
31
|
+
```bash
|
|
32
|
+
npm publish
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or use the convenience script:
|
|
36
|
+
```bash
|
|
37
|
+
npm run push
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Post-publish Verification
|
|
41
|
+
|
|
42
|
+
### Install from NPM
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g vg-coder-cli@2.0.0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Test CLI Commands
|
|
48
|
+
```bash
|
|
49
|
+
vg --version
|
|
50
|
+
vg analyze .
|
|
51
|
+
vg start
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Test New Features
|
|
55
|
+
```bash
|
|
56
|
+
# Start VG workspace
|
|
57
|
+
npm run start:vg
|
|
58
|
+
|
|
59
|
+
# Build VG workspace
|
|
60
|
+
npm run build:vg
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Package Contents
|
|
64
|
+
|
|
65
|
+
The published package includes:
|
|
66
|
+
- ✅ CLI binaries (`bin/vg.js`, `bin/vg-coder.js`)
|
|
67
|
+
- ✅ Source code (`src/`)
|
|
68
|
+
- ✅ VG workspace (`vg/` - for advanced users)
|
|
69
|
+
- ✅ README and documentation
|
|
70
|
+
- ✅ CHANGELOG
|
|
71
|
+
- ❌ Development files (excluded via .npmignore)
|
|
72
|
+
- ❌ Test files (excluded)
|
|
73
|
+
- ❌ Build artifacts (excluded)
|
|
74
|
+
|
|
75
|
+
## Version Strategy
|
|
76
|
+
|
|
77
|
+
- **1.x.x**: Original Express/HTML implementation
|
|
78
|
+
- **2.0.0**: Major upgrade with NestJS/Angular architecture
|
|
79
|
+
- **2.x.x**: Future enhancements to the new architecture
|
|
80
|
+
|
|
81
|
+
## Notes
|
|
82
|
+
|
|
83
|
+
- The original CLI functionality (`vg analyze`, `vg start`) remains unchanged
|
|
84
|
+
- New VG workspace is included for users who want to run the modern stack
|
|
85
|
+
- Both architectures can coexist
|
|
86
|
+
- Users can choose which one to use based on their needs
|
package/README.md
CHANGED
|
@@ -1,361 +1,135 @@
|
|
|
1
|
-
# VG Coder CLI
|
|
1
|
+
# VG Coder CLI - Migration Complete! 🎉
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This project has been successfully migrated from Express/HTML to a modern **NestJS + Angular** architecture using Nx monorepo.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- 🔍 **Phát hiện loại dự án**: Tự động nhận diện Angular, Spring Boot, React, Vue, Node.js, Python, Java, .NET
|
|
9
|
-
- 📁 **Xử lý `.gitignore`**: Tuân thủ chuẩn Git với multi-level ignore rules
|
|
10
|
-
- 🛡️ **Hỗ trợ `.vgignore`**: Có độ ưu tiên cao hơn `.gitignore`, với cú pháp giống hệt
|
|
11
|
-
- 📜 **Bỏ qua file mặc định**: Tự động bỏ qua `node_modules`, `dist`, `.git`, `build`, `target`
|
|
12
|
-
- 📄 **Scan và nối file**: Quét toàn bộ dự án và nối các file mã nguồn
|
|
13
|
-
- 🧮 **Đếm token**: Sử dụng `tiktoken` để đếm token chính xác cho AI models
|
|
14
|
-
- ✂️ **Chia nhỏ nội dung**: Chia nội dung thông minh thành chunks nhỏ hơn
|
|
15
|
-
- 🌐 **Xuất HTML**: Tạo báo cáo HTML tương tác với syntax highlighting
|
|
16
|
-
- 📋 **Sao chép vào Clipboard**: Chế độ `-c` sao chép toàn bộ code vào clipboard
|
|
17
|
-
- 🤖 **Tối ưu cho AI**: Xuất file `combined.txt` với định dạng thân thiện cho AI
|
|
7
|
+
## Quick Start
|
|
18
8
|
|
|
19
|
-
###
|
|
20
|
-
- 🌐 **REST API Server**: Khởi động server với `vg start`
|
|
21
|
-
- 🎨 **Beautiful Dashboard**: Tự động mở web UI để test API
|
|
22
|
-
- 📡 **5 API Endpoints**:
|
|
23
|
-
- `GET /health` - Health check
|
|
24
|
-
- `POST /api/analyze` - Phân tích dự án, download project.txt
|
|
25
|
-
- `GET /api/info` - Lấy thông tin dự án (JSON)
|
|
26
|
-
- `POST /api/execute` - **Thực thi bash scripts** với validation
|
|
27
|
-
- `DELETE /api/clean` - Xóa output directory
|
|
28
|
-
- ⚡ **Real-time Status**: Dashboard hiển thị server status live
|
|
29
|
-
- 🔒 **Syntax Validation**: Validate bash syntax trước khi execute
|
|
30
|
-
- 🧹 **Auto Cleanup**: Tự động dọn dẹp temp files
|
|
31
|
-
|
|
32
|
-
## 📦 Cài đặt
|
|
33
|
-
|
|
34
|
-
### Từ NPM (Recommended)
|
|
35
|
-
```bash
|
|
36
|
-
# Global install
|
|
37
|
-
npm install -g vg-coder-cli
|
|
38
|
-
|
|
39
|
-
# Local install
|
|
40
|
-
npm install vg-coder-cli
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Từ Source
|
|
44
|
-
```bash
|
|
45
|
-
git clone https://github.com/tinhthanh/vg-coder-cli.git
|
|
46
|
-
cd vg-coder-cli
|
|
47
|
-
npm install
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## 🚀 Sử dụng
|
|
51
|
-
|
|
52
|
-
### CLI Commands
|
|
53
|
-
|
|
54
|
-
#### 1. Phân tích dự án
|
|
55
|
-
```bash
|
|
56
|
-
# Phân tích và xuất HTML
|
|
57
|
-
vg analyze
|
|
58
|
-
vg a # Alias rút gọn
|
|
59
|
-
|
|
60
|
-
# Với options
|
|
61
|
-
vg analyze /path/to/project --max-tokens 8192 --output ./my-output
|
|
62
|
-
|
|
63
|
-
# Copy vào clipboard (không tạo file)
|
|
64
|
-
vg analyze -c
|
|
65
|
-
vg analyze --clipboard
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
#### 2. Xem thông tin dự án
|
|
69
|
-
```bash
|
|
70
|
-
vg info
|
|
71
|
-
vg info /path/to/project
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
#### 3. Xóa output
|
|
75
|
-
```bash
|
|
76
|
-
vg clean
|
|
77
|
-
vg clean --output ./my-output
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### 4. **Khởi động API Server** 🆕
|
|
81
|
-
```bash
|
|
82
|
-
# Start server (mặc định port 6868)
|
|
83
|
-
vg start
|
|
84
|
-
vg s # Alias rút gọn
|
|
85
|
-
|
|
86
|
-
# Custom port
|
|
87
|
-
vg start -p 8080
|
|
88
|
-
|
|
89
|
-
# Browser tự động mở dashboard tại http://localhost:6868
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### API Endpoints
|
|
93
|
-
|
|
94
|
-
#### Health Check
|
|
95
|
-
```bash
|
|
96
|
-
GET http://localhost:6868/health
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Response:**
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"status": "ok",
|
|
103
|
-
"version": "1.0.10",
|
|
104
|
-
"timestamp": "2025-11-24T15:00:00.000Z"
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### Analyze Project
|
|
109
|
-
```bash
|
|
110
|
-
POST http://localhost:6868/api/analyze
|
|
111
|
-
Content-Type: application/json
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
"path": ".",
|
|
115
|
-
"options": {
|
|
116
|
-
"maxTokens": 8000
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Response:** Downloads `project.txt` file
|
|
122
|
-
|
|
123
|
-
#### Get Project Info
|
|
9
|
+
### Development Mode
|
|
124
10
|
```bash
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
**Response:**
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"path": "/path/to/project",
|
|
132
|
-
"primaryType": "nodejs",
|
|
133
|
-
"stats": {
|
|
134
|
-
"totalFiles": 42,
|
|
135
|
-
"totalSize": 123456,
|
|
136
|
-
"totalLines": 5000
|
|
137
|
-
},
|
|
138
|
-
"tokens": {
|
|
139
|
-
"total": 15000,
|
|
140
|
-
"averagePerFile": 357
|
|
141
|
-
}
|
|
142
|
-
}
|
|
11
|
+
cd vg
|
|
12
|
+
./start-dev.sh
|
|
143
13
|
```
|
|
144
14
|
|
|
145
|
-
|
|
15
|
+
Or manually:
|
|
146
16
|
```bash
|
|
147
|
-
|
|
148
|
-
Content-Type: application/json
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
"bash": "mkdir -p $(dirname \"src/test.js\")\ncat <<'EOF' > src/test.js\nconsole.log('Hello');\nEOF"
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**Response:**
|
|
156
|
-
```json
|
|
157
|
-
{
|
|
158
|
-
"success": true,
|
|
159
|
-
"stdout": "",
|
|
160
|
-
"stderr": "",
|
|
161
|
-
"exitCode": 0,
|
|
162
|
-
"executionTime": 15
|
|
163
|
-
}
|
|
17
|
+
nx run-many --target=serve --projects=api,ng-app
|
|
164
18
|
```
|
|
165
19
|
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
- ✅ Auto cleanup temp files
|
|
170
|
-
- ✅ Return stdout/stderr/exitCode
|
|
20
|
+
This starts:
|
|
21
|
+
- **API Backend**: http://localhost:3000
|
|
22
|
+
- **Dashboard**: http://localhost:4200
|
|
171
23
|
|
|
172
|
-
|
|
24
|
+
### Production Build
|
|
173
25
|
```bash
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
"output": "./vg-output"
|
|
179
|
-
}
|
|
26
|
+
cd vg
|
|
27
|
+
nx run-many --target=build --all --configuration=production
|
|
180
28
|
```
|
|
181
29
|
|
|
182
|
-
##
|
|
183
|
-
|
|
184
|
-
### CLI Options
|
|
185
|
-
|
|
186
|
-
| Option | Mô tả | Default |
|
|
187
|
-
|--------|-------|---------|
|
|
188
|
-
| `-o, --output <path>` | Thư mục output | ./vg-output |
|
|
189
|
-
| `-m, --max-tokens <number>` | Số token tối đa mỗi chunk | 8000 |
|
|
190
|
-
| `-t, --model <model>` | Model AI để đếm token | gpt-4 |
|
|
191
|
-
| `--extensions <list>` | Extensions (comma-separated) | Auto-detect |
|
|
192
|
-
| `--include-hidden` | Bao gồm file ẩn | false |
|
|
193
|
-
| `--no-structure` | Không giữ cấu trúc file | false |
|
|
194
|
-
| `--theme <theme>` | Theme cho syntax highlighting | github |
|
|
195
|
-
| `-c, --clipboard` | Copy vào clipboard | false |
|
|
196
|
-
| `--save-txt` | Lưu vào vg-projects.txt | false |
|
|
197
|
-
|
|
198
|
-
### Server Options
|
|
199
|
-
|
|
200
|
-
| Option | Mô tả | Default |
|
|
201
|
-
|--------|-------|---------|
|
|
202
|
-
| `-p, --port <port>` | Port cho server | 6868 |
|
|
203
|
-
|
|
204
|
-
## 🎨 Dashboard UI
|
|
205
|
-
|
|
206
|
-
Khi chạy `vg start`, browser tự động mở dashboard với:
|
|
207
|
-
|
|
208
|
-
- 🎯 **Interactive Forms** cho tất cả endpoints
|
|
209
|
-
- 🎨 **Beautiful Gradient UI** (purple to violet)
|
|
210
|
-
- 📊 **Real-time Server Status** (green/red indicator)
|
|
211
|
-
- 💻 **Syntax Highlighting** cho responses
|
|
212
|
-
- ⚡ **Loading States** cho async operations
|
|
213
|
-
- 📥 **Auto Download** cho analyze endpoint
|
|
214
|
-
|
|
215
|
-
## 🤖 Tích hợp AI
|
|
216
|
-
|
|
217
|
-
### System Prompt cho AI
|
|
218
|
-
|
|
219
|
-
Xem file [SYSTEM_PROMPT.md](SYSTEM_PROMPT.md) để biết cách tích hợp với AI.
|
|
220
|
-
|
|
221
|
-
**Command Prefixes:**
|
|
222
|
-
- `/ask` - Q&A mode (Markdown response)
|
|
223
|
-
- `/plan` - Planning mode (Checklist + bash)
|
|
224
|
-
- `/fix` - Bug fix mode (Analysis + solution)
|
|
225
|
-
- `/code` - Code generation (Bash script only)
|
|
226
|
-
|
|
227
|
-
### Bash Script Format
|
|
30
|
+
## Project Structure
|
|
228
31
|
|
|
229
|
-
Khi AI generate code với `/code`, format chuẩn:
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
mkdir -p $(dirname "path/to/file.ext")
|
|
233
|
-
cat <<'EOF' > path/to/file.ext
|
|
234
|
-
... file content ...
|
|
235
|
-
EOF
|
|
236
32
|
```
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
- ✅ Chỉ include files có thay đổi
|
|
242
|
-
- ✅ Ghi đè hoàn toàn file content
|
|
243
|
-
|
|
244
|
-
## 📁 Cấu trúc Output
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
vg-output/
|
|
248
|
-
├── index.html # Trang chính với navigation
|
|
249
|
-
├── combined.html # Tất cả code, có search
|
|
250
|
-
├── combined.txt # Text format, tối ưu cho AI
|
|
251
|
-
├── chunks/ # Chunks riêng biệt
|
|
252
|
-
│ ├── chunk-1.html
|
|
33
|
+
vg-coder-cli/
|
|
34
|
+
├── src/ # Original Express/HTML app (legacy)
|
|
35
|
+
│ ├── server/
|
|
36
|
+
│ ├── scanner/
|
|
253
37
|
│ └── ...
|
|
254
|
-
└──
|
|
38
|
+
└── vg/ # New Nx monorepo
|
|
39
|
+
├── apps/
|
|
40
|
+
│ ├── api/ # NestJS backend
|
|
41
|
+
│ └── ng-app/ # Angular frontend
|
|
42
|
+
└── packages/
|
|
43
|
+
└── core/ # Shared TypeScript library
|
|
255
44
|
```
|
|
256
45
|
|
|
257
|
-
##
|
|
258
|
-
|
|
259
|
-
- **Frontend**: Angular, React, Vue.js, Svelte
|
|
260
|
-
- **Backend**: Node.js, Spring Boot, Python, .NET
|
|
261
|
-
- **Mobile**: React Native, Flutter
|
|
262
|
-
- **Languages**: JavaScript, TypeScript, Java, Python, C#, Go, Rust
|
|
263
|
-
- **Config**: JSON, YAML, XML, TOML
|
|
46
|
+
## What's New
|
|
264
47
|
|
|
265
|
-
|
|
48
|
+
### ✅ Migrated Components
|
|
266
49
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
50
|
+
1. **Core Library** (`@vg/core`)
|
|
51
|
+
- ProjectDetector
|
|
52
|
+
- FileScanner
|
|
53
|
+
- TokenManager
|
|
54
|
+
- BashExecutor
|
|
55
|
+
- IgnoreManager
|
|
271
56
|
|
|
272
|
-
|
|
57
|
+
2. **NestJS Backend** (`apps/api`)
|
|
58
|
+
- REST API with controllers & services
|
|
59
|
+
- CORS enabled
|
|
60
|
+
- Global `/api` prefix
|
|
273
61
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
62
|
+
3. **Angular Frontend** (`apps/ng-app`)
|
|
63
|
+
- Modern standalone components
|
|
64
|
+
- Reactive forms
|
|
65
|
+
- HTTP client integration
|
|
66
|
+
- Proxy configuration
|
|
278
67
|
|
|
279
|
-
|
|
280
|
-
```
|
|
68
|
+
### 📡 API Endpoints
|
|
281
69
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
70
|
+
| Endpoint | Method | Description |
|
|
71
|
+
|----------|--------|-------------|
|
|
72
|
+
| `/api/analyze` | POST | Analyze project and return source code |
|
|
73
|
+
| `/api/execute` | POST | Execute bash scripts with validation |
|
|
74
|
+
| `/api/info` | GET | Get project information and statistics |
|
|
75
|
+
| `/api/clean` | DELETE | Clean output directories |
|
|
286
76
|
|
|
287
|
-
|
|
288
|
-
# 3. Test endpoints trực tiếp trên UI
|
|
289
|
-
# 4. Hoặc dùng Postman/curl
|
|
77
|
+
## Development
|
|
290
78
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
79
|
+
### Build Individual Projects
|
|
80
|
+
```bash
|
|
81
|
+
nx build core
|
|
82
|
+
nx build api
|
|
83
|
+
nx build ng-app
|
|
295
84
|
```
|
|
296
85
|
|
|
297
|
-
###
|
|
86
|
+
### Run Tests
|
|
298
87
|
```bash
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
# 2. Paste vào AI với prompt:
|
|
303
|
-
# "/code Thêm authentication vào project này"
|
|
304
|
-
|
|
305
|
-
# 3. AI trả về bash script
|
|
306
|
-
# 4. Copy bash script
|
|
307
|
-
|
|
308
|
-
# 5. Execute qua API
|
|
309
|
-
curl -X POST http://localhost:6868/api/execute \
|
|
310
|
-
-H "Content-Type: application/json" \
|
|
311
|
-
-d '{"bash": "..."}'
|
|
88
|
+
nx test core
|
|
89
|
+
nx test api
|
|
90
|
+
nx test ng-app
|
|
312
91
|
```
|
|
313
92
|
|
|
314
|
-
|
|
315
|
-
|
|
93
|
+
### Lint
|
|
316
94
|
```bash
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
# Run tests
|
|
321
|
-
npm test
|
|
322
|
-
|
|
323
|
-
# Run in dev mode
|
|
324
|
-
npm run dev
|
|
325
|
-
|
|
326
|
-
# Build and publish
|
|
327
|
-
npm run push
|
|
95
|
+
nx lint api
|
|
96
|
+
nx lint ng-app
|
|
328
97
|
```
|
|
329
98
|
|
|
330
|
-
##
|
|
99
|
+
## Documentation
|
|
331
100
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
4. Push to branch (`git push origin feature/amazing-feature`)
|
|
336
|
-
5. Create Pull Request
|
|
101
|
+
- **Implementation Plan**: See `.gemini/antigravity/brain/.../implementation_plan.md`
|
|
102
|
+
- **Walkthrough**: See `.gemini/antigravity/brain/.../walkthrough.md`
|
|
103
|
+
- **Workspace README**: See `vg/README.md`
|
|
337
104
|
|
|
338
|
-
##
|
|
105
|
+
## Legacy vs New
|
|
339
106
|
|
|
340
|
-
|
|
107
|
+
| Feature | Legacy (src/) | New (vg/) |
|
|
108
|
+
|---------|--------------|-----------|
|
|
109
|
+
| Backend | Express.js | NestJS |
|
|
110
|
+
| Frontend | HTML/jQuery | Angular |
|
|
111
|
+
| Language | JavaScript | TypeScript |
|
|
112
|
+
| Architecture | Monolithic | Nx Monorepo |
|
|
113
|
+
| Type Safety | ❌ | ✅ |
|
|
114
|
+
| Dependency Injection | ❌ | ✅ |
|
|
115
|
+
| Reactive Patterns | ❌ | ✅ |
|
|
341
116
|
|
|
342
|
-
##
|
|
117
|
+
## Next Steps
|
|
343
118
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
119
|
+
1. ✅ Core library migration
|
|
120
|
+
2. ✅ Backend implementation
|
|
121
|
+
3. ✅ Frontend implementation
|
|
122
|
+
4. ✅ CORS & Proxy configuration
|
|
123
|
+
5. ✅ Testing & verification
|
|
124
|
+
6. 🔄 E2E tests (optional)
|
|
125
|
+
7. 🔄 Production deployment (when ready)
|
|
347
126
|
|
|
348
|
-
##
|
|
127
|
+
## Contributing
|
|
349
128
|
|
|
350
|
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
- 📝 System prompt documentation
|
|
129
|
+
The new architecture makes it easier to:
|
|
130
|
+
- Add new features
|
|
131
|
+
- Write tests
|
|
132
|
+
- Scale the application
|
|
133
|
+
- Maintain code quality
|
|
356
134
|
|
|
357
|
-
|
|
358
|
-
- 🚀 Initial release
|
|
359
|
-
- 📊 Code analysis and token counting
|
|
360
|
-
- 🌐 HTML export with syntax highlighting
|
|
361
|
-
- 📋 Clipboard integration
|
|
135
|
+
For more details, see the documentation in the `vg/` directory.
|