vg-coder-cli 2.0.3 → 2.0.5
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 +318 -92
- package/{vg/apps/api/src/assets/.gitkeep → change.sh} +0 -0
- package/package.json +4 -11
- package/src/index.js +0 -60
- package/src/server/views/dashboard.html +432 -619
- package/vg-coder-cli-1.0.17.tgz +0 -0
- package/vg-coder-cli-2.0.4.tgz +0 -0
- package/vg-coder-cli-2.0.5.tgz +0 -0
- package/CHANGELOG.md +0 -59
- package/PUBLISHING.md +0 -86
- package/SYSTEM_PROMPT.md +0 -157
- package/init-nx-monorepo.sh +0 -107
- package/vg/.vscode/extensions.json +0 -8
- package/vg/.vscode/launch.json +0 -23
- package/vg/README-WORKSPACE.md +0 -82
- package/vg/README.md +0 -85
- package/vg/apps/api/project.json +0 -83
- package/vg/apps/api/src/app/analyze.controller.ts +0 -17
- package/vg/apps/api/src/app/analyze.service.ts +0 -57
- package/vg/apps/api/src/app/app.controller.ts +0 -12
- package/vg/apps/api/src/app/app.module.ts +0 -29
- package/vg/apps/api/src/app/app.service.ts +0 -8
- package/vg/apps/api/src/app/clean.controller.ts +0 -40
- package/vg/apps/api/src/app/execute.controller.ts +0 -19
- package/vg/apps/api/src/app/execute.service.ts +0 -46
- package/vg/apps/api/src/app/info.controller.ts +0 -12
- package/vg/apps/api/src/app/info.service.ts +0 -65
- package/vg/apps/api/src/main.ts +0 -28
- package/vg/apps/api/webpack.config.js +0 -25
- package/vg/apps/api-e2e/jest.config.cts +0 -18
- package/vg/apps/api-e2e/project.json +0 -17
- package/vg/apps/api-e2e/src/support/global-setup.ts +0 -16
- package/vg/apps/api-e2e/src/support/global-teardown.ts +0 -10
- package/vg/apps/api-e2e/src/support/test-setup.ts +0 -9
- package/vg/apps/ng-app/jest.config.ts +0 -21
- package/vg/apps/ng-app/project.json +0 -110
- package/vg/apps/ng-app/proxy.conf.json +0 -8
- package/vg/apps/ng-app/public/favicon.ico +0 -0
- package/vg/apps/ng-app/src/app/app.config.ts +0 -17
- package/vg/apps/ng-app/src/app/app.html +0 -1
- package/vg/apps/ng-app/src/app/app.routes.ts +0 -7
- package/vg/apps/ng-app/src/app/app.scss +0 -0
- package/vg/apps/ng-app/src/app/app.ts +0 -12
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.html +0 -87
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.scss +0 -290
- package/vg/apps/ng-app/src/app/dashboard/dashboard.component.ts +0 -236
- package/vg/apps/ng-app/src/app/nx-welcome.ts +0 -872
- package/vg/apps/ng-app/src/app/services/api.service.ts +0 -28
- package/vg/apps/ng-app/src/index.html +0 -13
- package/vg/apps/ng-app/src/main.ts +0 -5
- package/vg/apps/ng-app/src/styles.scss +0 -1
- package/vg/apps/ng-app/src/test-setup.ts +0 -6
- package/vg/bin/vg-workspace.js +0 -43
- package/vg/jest.config.ts +0 -6
- package/vg/nx.json +0 -85
- package/vg/package-lock.json +0 -30707
- package/vg/package-workspace.json +0 -38
- package/vg/package.json +0 -38
- package/vg/packages/client/data-access/README.md +0 -7
- package/vg/packages/client/data-access/jest.config.ts +0 -21
- package/vg/packages/client/data-access/project.json +0 -21
- package/vg/packages/client/data-access/src/index.ts +0 -1
- package/vg/packages/client/data-access/src/lib/data-access/data-access.html +0 -1
- 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 +0 -9
- package/vg/packages/client/data-access/src/test-setup.ts +0 -6
- package/vg/packages/core/README.md +0 -11
- package/vg/packages/core/jest.config.ts +0 -10
- package/vg/packages/core/package.json +0 -11
- package/vg/packages/core/project.json +0 -26
- package/vg/packages/core/src/index.ts +0 -6
- package/vg/packages/core/src/lib/core.ts +0 -3
- package/vg/packages/core/src/lib/detectors/project-detector.ts +0 -343
- package/vg/packages/core/src/lib/ignore/ignore-manager.ts +0 -315
- package/vg/packages/core/src/lib/scanner/file-scanner.ts +0 -675
- package/vg/packages/core/src/lib/tokenizer/token-manager.ts +0 -435
- package/vg/packages/core/src/lib/utils/bash-executor.ts +0 -146
- package/vg/packages/shared/data-types/README.md +0 -11
- package/vg/packages/shared/data-types/jest.config.ts +0 -10
- package/vg/packages/shared/data-types/package.json +0 -11
- package/vg/packages/shared/data-types/project.json +0 -26
- package/vg/packages/shared/data-types/src/index.ts +0 -1
- package/vg/packages/shared/data-types/src/lib/data-types.ts +0 -3
- package/vg/start-dev.sh +0 -22
package/README.md
CHANGED
|
@@ -1,135 +1,361 @@
|
|
|
1
|
-
# VG Coder CLI
|
|
1
|
+
# VG Coder CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
🚀 **Powerful CLI tool & API Server** để phân tích dự án, nối file mã nguồn, đếm token, xuất HTML và thực thi bash scripts qua REST API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ✨ Tính năng
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### 📊 Code Analysis & Export
|
|
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
|
|
8
18
|
|
|
9
|
-
###
|
|
19
|
+
### 🚀 API Server (NEW!)
|
|
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)
|
|
10
35
|
```bash
|
|
11
|
-
|
|
12
|
-
|
|
36
|
+
# Global install
|
|
37
|
+
npm install -g vg-coder-cli
|
|
38
|
+
|
|
39
|
+
# Local install
|
|
40
|
+
npm install vg-coder-cli
|
|
13
41
|
```
|
|
14
42
|
|
|
15
|
-
|
|
43
|
+
### Từ Source
|
|
16
44
|
```bash
|
|
17
|
-
|
|
45
|
+
git clone https://github.com/tinhthanh/vg-coder-cli.git
|
|
46
|
+
cd vg-coder-cli
|
|
47
|
+
npm install
|
|
18
48
|
```
|
|
19
49
|
|
|
20
|
-
|
|
21
|
-
- **API Backend**: http://localhost:3000
|
|
22
|
-
- **Dashboard**: http://localhost:4200
|
|
50
|
+
## 🚀 Sử dụng
|
|
23
51
|
|
|
24
|
-
###
|
|
52
|
+
### CLI Commands
|
|
53
|
+
|
|
54
|
+
#### 1. Phân tích dự án
|
|
25
55
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
28
66
|
```
|
|
29
67
|
|
|
30
|
-
|
|
68
|
+
#### 2. Xem thông tin dự án
|
|
69
|
+
```bash
|
|
70
|
+
vg info
|
|
71
|
+
vg info /path/to/project
|
|
72
|
+
```
|
|
31
73
|
|
|
74
|
+
#### 3. Xóa output
|
|
75
|
+
```bash
|
|
76
|
+
vg clean
|
|
77
|
+
vg clean --output ./my-output
|
|
32
78
|
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
124
|
+
```bash
|
|
125
|
+
GET http://localhost:6868/api/info?path=.
|
|
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
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Execute Bash Script 🆕
|
|
146
|
+
```bash
|
|
147
|
+
POST http://localhost:6868/api/execute
|
|
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
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Features:**
|
|
167
|
+
- ✅ Syntax validation trong `.vg/temp-execute`
|
|
168
|
+
- ✅ Execute tại working directory
|
|
169
|
+
- ✅ Auto cleanup temp files
|
|
170
|
+
- ✅ Return stdout/stderr/exitCode
|
|
171
|
+
|
|
172
|
+
#### Clean Output
|
|
173
|
+
```bash
|
|
174
|
+
DELETE http://localhost:6868/api/clean
|
|
175
|
+
Content-Type: application/json
|
|
176
|
+
|
|
177
|
+
{
|
|
178
|
+
"output": "./vg-output"
|
|
179
|
+
}
|
|
44
180
|
```
|
|
45
181
|
|
|
46
|
-
##
|
|
182
|
+
## ⚙️ Options
|
|
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:
|
|
47
207
|
|
|
48
|
-
|
|
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
|
|
49
214
|
|
|
50
|
-
|
|
51
|
-
- ProjectDetector
|
|
52
|
-
- FileScanner
|
|
53
|
-
- TokenManager
|
|
54
|
-
- BashExecutor
|
|
55
|
-
- IgnoreManager
|
|
215
|
+
## 🤖 Tích hợp AI
|
|
56
216
|
|
|
57
|
-
|
|
58
|
-
- REST API with controllers & services
|
|
59
|
-
- CORS enabled
|
|
60
|
-
- Global `/api` prefix
|
|
217
|
+
### System Prompt cho AI
|
|
61
218
|
|
|
62
|
-
|
|
63
|
-
- Modern standalone components
|
|
64
|
-
- Reactive forms
|
|
65
|
-
- HTTP client integration
|
|
66
|
-
- Proxy configuration
|
|
219
|
+
Xem file [SYSTEM_PROMPT.md](SYSTEM_PROMPT.md) để biết cách tích hợp với AI.
|
|
67
220
|
|
|
68
|
-
|
|
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)
|
|
69
226
|
|
|
70
|
-
|
|
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 |
|
|
227
|
+
### Bash Script Format
|
|
76
228
|
|
|
77
|
-
|
|
229
|
+
Khi AI generate code với `/code`, format chuẩn:
|
|
78
230
|
|
|
79
|
-
### Build Individual Projects
|
|
80
231
|
```bash
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
232
|
+
mkdir -p $(dirname "path/to/file.ext")
|
|
233
|
+
cat <<'EOF' > path/to/file.ext
|
|
234
|
+
... file content ...
|
|
235
|
+
EOF
|
|
84
236
|
```
|
|
85
237
|
|
|
86
|
-
|
|
238
|
+
**Quy tắc:**
|
|
239
|
+
- ✅ Luôn có `mkdir -p $(dirname "...")` trước mỗi file
|
|
240
|
+
- ✅ Sử dụng `<<'EOF'` (có quotes) để tránh expansion
|
|
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
|
|
253
|
+
│ └── ...
|
|
254
|
+
└── assets/ # CSS, JS
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## 🎯 Dự án được hỗ trợ
|
|
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
|
|
264
|
+
|
|
265
|
+
## 🛡️ Quy tắc bỏ qua file
|
|
266
|
+
|
|
267
|
+
Thứ tự ưu tiên:
|
|
268
|
+
1. **`.vgignore`** - Cao nhất
|
|
269
|
+
2. **`.gitignore`** - Trung bình
|
|
270
|
+
3. **Default rules** - Thấp nhất (node_modules, .git, dist, build, target)
|
|
271
|
+
|
|
272
|
+
## 📝 Examples
|
|
273
|
+
|
|
274
|
+
### Example 1: Analyze và Copy
|
|
275
|
+
```bash
|
|
276
|
+
# Analyze project và copy vào clipboard
|
|
277
|
+
vg a . -c
|
|
278
|
+
|
|
279
|
+
# Paste vào AI tool (Claude, ChatGPT, etc.)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Example 2: API Server Workflow
|
|
283
|
+
```bash
|
|
284
|
+
# 1. Start server
|
|
285
|
+
vg start
|
|
286
|
+
|
|
287
|
+
# 2. Browser mở dashboard tự động
|
|
288
|
+
# 3. Test endpoints trực tiếp trên UI
|
|
289
|
+
# 4. Hoặc dùng Postman/curl
|
|
290
|
+
|
|
291
|
+
# 5. Execute bash script từ AI
|
|
292
|
+
curl -X POST http://localhost:6868/api/execute \
|
|
293
|
+
-H "Content-Type: application/json" \
|
|
294
|
+
-d '{"bash": "mkdir -p src && echo \"test\" > src/file.js"}'
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Example 3: AI Integration
|
|
87
298
|
```bash
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
299
|
+
# 1. Analyze project
|
|
300
|
+
vg a . -c
|
|
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": "..."}'
|
|
91
312
|
```
|
|
92
313
|
|
|
93
|
-
|
|
314
|
+
## 🔧 Development
|
|
315
|
+
|
|
94
316
|
```bash
|
|
95
|
-
|
|
96
|
-
|
|
317
|
+
# Install dependencies
|
|
318
|
+
npm install
|
|
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
|
|
97
328
|
```
|
|
98
329
|
|
|
99
|
-
##
|
|
330
|
+
## 🤝 Đóng góp
|
|
100
331
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
332
|
+
1. Fork repository
|
|
333
|
+
2. Create feature branch (`git checkout -b feature/amazing-feature`)
|
|
334
|
+
3. Commit changes (`git commit -m 'Add amazing feature'`)
|
|
335
|
+
4. Push to branch (`git push origin feature/amazing-feature`)
|
|
336
|
+
5. Create Pull Request
|
|
104
337
|
|
|
105
|
-
##
|
|
338
|
+
## 📄 License
|
|
106
339
|
|
|
107
|
-
|
|
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 | ❌ | ✅ |
|
|
340
|
+
MIT License - xem file [LICENSE](LICENSE) để biết thêm chi tiết.
|
|
116
341
|
|
|
117
|
-
##
|
|
342
|
+
## 🔗 Links
|
|
118
343
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
4. ✅ CORS & Proxy configuration
|
|
123
|
-
5. ✅ Testing & verification
|
|
124
|
-
6. 🔄 E2E tests (optional)
|
|
125
|
-
7. 🔄 Production deployment (when ready)
|
|
344
|
+
- **GitHub**: https://github.com/tinhthanh/vg-coder-cli
|
|
345
|
+
- **NPM**: https://www.npmjs.com/package/vg-coder-cli
|
|
346
|
+
- **Issues**: https://github.com/tinhthanh/vg-coder-cli/issues
|
|
126
347
|
|
|
127
|
-
##
|
|
348
|
+
## 📊 Version History
|
|
128
349
|
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
350
|
+
### v1.0.10 (Latest)
|
|
351
|
+
- ✨ Added API Server with REST endpoints
|
|
352
|
+
- 🎨 Beautiful dashboard UI with auto-open browser
|
|
353
|
+
- ⚡ Bash script execution with validation
|
|
354
|
+
- 🔧 Shortened commands: `vg`, `a`, `-c`, `s`
|
|
355
|
+
- 📝 System prompt documentation
|
|
134
356
|
|
|
135
|
-
|
|
357
|
+
### v1.0.9
|
|
358
|
+
- 🚀 Initial release
|
|
359
|
+
- 📊 Code analysis and token counting
|
|
360
|
+
- 🌐 HTML export with syntax highlighting
|
|
361
|
+
- 📋 Clipboard integration
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vg-coder-cli",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "🚀 CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "🚀 CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting and copy functionality",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"vg": "./bin/vg.js",
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"test:watch": "jest --watch",
|
|
14
14
|
"dev": "nodemon src/index.js",
|
|
15
|
-
"push": "npm pack && npm publish"
|
|
16
|
-
"build:vg": "cd vg && nx run-many --target=build --all --configuration=production",
|
|
17
|
-
"start:vg": "cd vg && ./start-dev.sh"
|
|
15
|
+
"push": "npm pack && npm publish"
|
|
18
16
|
},
|
|
19
17
|
"keywords": [
|
|
20
18
|
"cli",
|
|
@@ -33,12 +31,7 @@
|
|
|
33
31
|
"vue",
|
|
34
32
|
"java",
|
|
35
33
|
"javascript",
|
|
36
|
-
"typescript"
|
|
37
|
-
"nestjs",
|
|
38
|
-
"nx-monorepo",
|
|
39
|
-
"modern-stack",
|
|
40
|
-
"api-server",
|
|
41
|
-
"dashboard"
|
|
34
|
+
"typescript"
|
|
42
35
|
],
|
|
43
36
|
"author": "VG Coder",
|
|
44
37
|
"license": "MIT",
|
package/src/index.js
CHANGED
|
@@ -66,7 +66,6 @@ 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)')
|
|
70
69
|
.action(this.handleStart.bind(this));
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -368,69 +367,11 @@ class VGCoderCLI {
|
|
|
368
367
|
}
|
|
369
368
|
}
|
|
370
369
|
|
|
371
|
-
|
|
372
370
|
/**
|
|
373
371
|
* Handle start command
|
|
374
372
|
*/
|
|
375
373
|
async handleStart(options) {
|
|
376
374
|
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
|
-
|
|
434
375
|
const port = parseInt(options.port);
|
|
435
376
|
const server = new ApiServer(port);
|
|
436
377
|
|
|
@@ -474,7 +415,6 @@ class VGCoderCLI {
|
|
|
474
415
|
}
|
|
475
416
|
}
|
|
476
417
|
|
|
477
|
-
|
|
478
418
|
/**
|
|
479
419
|
* Run CLI
|
|
480
420
|
*/
|