galaxy-code 0.1.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/LICENSE +21 -0
- package/README.md +679 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +596 -0
- package/dist/auto-updater.d.ts +21 -0
- package/dist/auto-updater.js +144 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +159 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +29 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.js +8 -0
- package/dist/update-checker.d.ts +22 -0
- package/dist/update-checker.js +85 -0
- package/package.json +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Bùi Trọng Hiếu (Kevin Bui)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
# 🌌 Galaxy CLI
|
|
2
|
+
|
|
3
|
+
**AI Pair Programming Tool** - Công cụ lập trình với AI trợ lý thông minh, hỗ trợ phân tích, lập kế hoạch và tạo code tự động.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⚠️ Trạng thái Alpha
|
|
8
|
+
|
|
9
|
+
> **Dự án đang trong giai đoạn phát triển Alpha**
|
|
10
|
+
>
|
|
11
|
+
> Galaxy CLI hiện đang trong giai đoạn phát triển và thử nghiệm Alpha. Phiên bản chính thức (stable release) sẽ được công bố trong tương lai khi dự án đã hoàn thiện và được kiểm thử kỹ lưỡng.
|
|
12
|
+
>
|
|
13
|
+
> **Lưu ý:**
|
|
14
|
+
> - ⚠️ Dự án chưa được public trên GitHub hay các kho package registry
|
|
15
|
+
> - 🔄 API và cấu trúc có thể thay đổi trong quá trình phát triển
|
|
16
|
+
> - ⛔ Không khuyến nghị sử dụng cho môi trường production hiện tại
|
|
17
|
+
>
|
|
18
|
+
> **Để cập nhật thông tin về phiên bản chính thức:**
|
|
19
|
+
> - 📧 Email: kevinbui210191@gmail.com / hieubt2@msb.com.vn
|
|
20
|
+
> - 📱 Theo dõi repository để nhận thông báo khi project được public
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📋 Mục lục
|
|
25
|
+
|
|
26
|
+
- [Giới thiệu](#giới-thiệu)
|
|
27
|
+
- [Công nghệ sử dụng](#công-nghệ-sử-dụng)
|
|
28
|
+
- [Kiến trúc hệ thống](#kiến-trúc-hệ-thống)
|
|
29
|
+
- [Luồng hoạt động](#luồng-hoạt-động)
|
|
30
|
+
- [Cài đặt](#cài-đặt)
|
|
31
|
+
- [Sử dụng](#sử-dụng)
|
|
32
|
+
- [AI Models & Vai trò](#ai-models--vai-trò)
|
|
33
|
+
- [Danh sách Tools](#danh-sách-tools)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 🎯 Giới thiệu
|
|
38
|
+
|
|
39
|
+
**Galaxy CLI** là công cụ AI pair programming mạnh mẽ được xây dựng với:
|
|
40
|
+
|
|
41
|
+
- **Giao diện CLI hiện đại** sử dụng Ink (React for CLI)
|
|
42
|
+
- **Multi-AI orchestration** với Gemini 2.5 Flash làm trung tâm điều phối
|
|
43
|
+
- **27+ công cụ chuyên biệt** cho file operations, git, testing, document parsing
|
|
44
|
+
- **Intelligent planning** với qwen3-coder:480b-cloud
|
|
45
|
+
- **Business Analysis** với gpt-oss:120b-cloud
|
|
46
|
+
|
|
47
|
+
## 🛠 Công nghệ sử dụng
|
|
48
|
+
|
|
49
|
+
### Frontend CLI
|
|
50
|
+
|
|
51
|
+
- **Ink** - React cho terminal, render component như web app
|
|
52
|
+
- **ink-spinner** - Loading animations (dots, arc, etc.)
|
|
53
|
+
- **figlet** - ASCII art banner
|
|
54
|
+
- **TypeScript** - Type safety
|
|
55
|
+
|
|
56
|
+
### AI & LLM Stack
|
|
57
|
+
|
|
58
|
+
- **Google Gemini 2.5 Flash** - Orchestrator chính, tool calling
|
|
59
|
+
- **Ollama Models**:
|
|
60
|
+
- `gpt-oss:120b-cloud` - Business Analysis & Requirements
|
|
61
|
+
- `qwen3-coder:480b-cloud` - Code generation & Planning
|
|
62
|
+
|
|
63
|
+
### Tools & Utilities
|
|
64
|
+
|
|
65
|
+
- **Bun** - Fast runtime và package manager
|
|
66
|
+
- **PDF/DOCX/XLSX parsers** - Document analysis
|
|
67
|
+
- **Node.js child_process** - Command execution
|
|
68
|
+
- **Git CLI integration** - Version control
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🏗 Kiến trúc hệ thống
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
┌─────────────────────────────────────────────┐
|
|
76
|
+
│ Galaxy CLI (Ink React App) │
|
|
77
|
+
│ - User Input với autocomplete │
|
|
78
|
+
│ - Spinner loading states │
|
|
79
|
+
│ - Figlet banner │
|
|
80
|
+
└─────────────────┬───────────────────────────┘
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
┌─────────────────────────────────────────────┐
|
|
84
|
+
│ Gemini 2.5 Flash (Orchestrator) │
|
|
85
|
+
│ - Tool calling & function execution │
|
|
86
|
+
│ - Plan execution & todos display │
|
|
87
|
+
│ - Multi-language support (EN/VI) │
|
|
88
|
+
└─────────────────┬───────────────────────────┘
|
|
89
|
+
│
|
|
90
|
+
┌─────────┴─────────────┐
|
|
91
|
+
│ │
|
|
92
|
+
▼ ▼
|
|
93
|
+
┌───────────────┐ ┌──────────────────┐
|
|
94
|
+
│ BA Analyzer │ │ Planning Agent │
|
|
95
|
+
│ gpt-oss:120b │ │ qwen3-coder:480b │
|
|
96
|
+
│ │ │ Feature-driven │
|
|
97
|
+
└───────────────┘ └──────────────────┘
|
|
98
|
+
│ │
|
|
99
|
+
│ ▼
|
|
100
|
+
│ ┌──────────────────────┐
|
|
101
|
+
│ │ Execution Plan │
|
|
102
|
+
│ │ - Feature steps │
|
|
103
|
+
│ │ - Tool selection │
|
|
104
|
+
│ └──────────────────────┘
|
|
105
|
+
│ │
|
|
106
|
+
└───────────┬───────────┘
|
|
107
|
+
▼
|
|
108
|
+
┌───────────────────────────┐
|
|
109
|
+
│ Code Generate Agent │
|
|
110
|
+
│ qwen3-coder:480b-cloud │
|
|
111
|
+
│ │
|
|
112
|
+
│ ┌─────────────────────┐ │
|
|
113
|
+
│ │ Integrated Tools: │ │
|
|
114
|
+
│ │ - file_write │ │
|
|
115
|
+
│ │ - file_read │ │
|
|
116
|
+
│ │ - command_run │ │
|
|
117
|
+
│ │ - file_search │ │
|
|
118
|
+
│ └─────────────────────┘ │
|
|
119
|
+
│ │
|
|
120
|
+
│ Output: {step, status, │
|
|
121
|
+
│ message, filesCreated} │
|
|
122
|
+
└───────────────────────────┘
|
|
123
|
+
│
|
|
124
|
+
▼
|
|
125
|
+
┌───────────────────────────┐
|
|
126
|
+
│ Tool Registry (28 tools) │
|
|
127
|
+
│ │
|
|
128
|
+
│ 📁 File 🔧 Command │
|
|
129
|
+
│ 🔀 Git 📝 Document │
|
|
130
|
+
│ 🧪 Test 🔍 Search │
|
|
131
|
+
└───────────────────────────┘
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Design Pattern: **Orchestrator + Tools**
|
|
135
|
+
|
|
136
|
+
**Trước đây** (Multi-agent):
|
|
137
|
+
|
|
138
|
+
- 11 agents riêng biệt
|
|
139
|
+
- Phức tạp, khó maintain
|
|
140
|
+
- Nhiều context switching
|
|
141
|
+
|
|
142
|
+
**Hiện tại** (Feature-Driven):
|
|
143
|
+
|
|
144
|
+
- 1 Orchestrator (Gemini) - Điều phối & todos display
|
|
145
|
+
- 3 Specialized agents:
|
|
146
|
+
- BA Analyzer (gpt-oss) - Requirements analysis
|
|
147
|
+
- Planning Agent (qwen3-coder) - Feature-based planning
|
|
148
|
+
- Code Generate Agent (qwen3-coder) - Self-contained executor
|
|
149
|
+
- 28 focused tools
|
|
150
|
+
- Feature-driven execution (1 feature = 1 step)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🔄 Luồng hoạt động
|
|
155
|
+
|
|
156
|
+
### 1️⃣ **Analyze Existing Project**
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
User: "Phân tích dự án này"
|
|
160
|
+
│
|
|
161
|
+
├─> file_tree(cwd) → Lấy cấu trúc thư mục
|
|
162
|
+
├─> file_read(package.json, README) → Đọc tech stack
|
|
163
|
+
└─> Trả về phân tích toàn diện
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Output**: Project description, tech stack, features, architecture
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### 2️⃣ **Create New Project**
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
User: "Tạo app Next.js e-commerce"
|
|
174
|
+
│
|
|
175
|
+
├─> 🔍 ba_it_analyze(userRequest, context)
|
|
176
|
+
│ ↓
|
|
177
|
+
│ ┌─────────────────────────────────────┐
|
|
178
|
+
│ │ BA Analysis Result (English) │
|
|
179
|
+
│ │ - projectName │
|
|
180
|
+
│ │ - type: "create_project" │
|
|
181
|
+
│ │ - coreFeatures: [...] │
|
|
182
|
+
│ │ - technicalStack: {...} │
|
|
183
|
+
│ │ - estimatedDevelopmentTime │
|
|
184
|
+
│ │ - recommendations: [...] │
|
|
185
|
+
│ │ - questionsForUser: [...] │
|
|
186
|
+
│ └─────────────────────────────────────┘
|
|
187
|
+
│ ↓
|
|
188
|
+
├─> 📊 PRESENT to User (Vietnamese/English)
|
|
189
|
+
│
|
|
190
|
+
│ 📊 **Phân tích dự án**: Next.js E-commerce
|
|
191
|
+
│ 💡 **Mô tả**: Ứng dụng thương mại điện tử...
|
|
192
|
+
│
|
|
193
|
+
│ **✨ Tính năng chính**:
|
|
194
|
+
│ - Catalog sản phẩm
|
|
195
|
+
│ - Giỏ hàng
|
|
196
|
+
│ - Thanh toán (Stripe)
|
|
197
|
+
│ ...
|
|
198
|
+
│
|
|
199
|
+
│ Bạn đồng ý phương án này?
|
|
200
|
+
│
|
|
201
|
+
│ ↓
|
|
202
|
+
├─> ⏸️ WAIT for user confirmation
|
|
203
|
+
│ ↓
|
|
204
|
+
├─> ✅ User: "Đồng ý, làm đi"
|
|
205
|
+
│ ↓
|
|
206
|
+
├─> 📋 plan_task(userContext, baAnalysis)
|
|
207
|
+
│ ↓
|
|
208
|
+
│ ┌─────────────────────────────────────────────┐
|
|
209
|
+
│ │ Feature-Driven Plan │
|
|
210
|
+
│ │ { │
|
|
211
|
+
│ │ summary: "Build e-commerce with 3 features",│
|
|
212
|
+
│ │ steps: [ │
|
|
213
|
+
│ │ {step: 1, tool: "command_run", │
|
|
214
|
+
│ │ action: "Init Next.js"}, │
|
|
215
|
+
│ │ {step: 2, tool: "install_dependencies"},│
|
|
216
|
+
│ │ {step: 3, tool: "code_generate", │
|
|
217
|
+
│ │ featureName: "Product Catalog", │
|
|
218
|
+
│ │ featureDescription: "...", │
|
|
219
|
+
│ │ priority: "must-have"}, │
|
|
220
|
+
│ │ {step: 4, tool: "code_generate", │
|
|
221
|
+
│ │ featureName: "Shopping Cart"}, │
|
|
222
|
+
│ │ {step: 5, tool: "code_generate", │
|
|
223
|
+
│ │ featureName: "Checkout"} │
|
|
224
|
+
│ │ ], │
|
|
225
|
+
│ │ estimatedTime: "long" │
|
|
226
|
+
│ │ } │
|
|
227
|
+
│ └─────────────────────────────────────────────┘
|
|
228
|
+
│ ↓
|
|
229
|
+
├─> 📋 **Present Plan with Todos**:
|
|
230
|
+
│
|
|
231
|
+
│ 📋 Implementation Plan (long):
|
|
232
|
+
│ ☐ Step 1: Initialize Next.js project
|
|
233
|
+
│ ☐ Step 2: Install dependencies
|
|
234
|
+
│ ☐ Step 3: Implement Product Catalog
|
|
235
|
+
│ ☐ Step 4: Implement Shopping Cart
|
|
236
|
+
│ ☐ Step 5: Implement Checkout
|
|
237
|
+
│
|
|
238
|
+
│ ↓
|
|
239
|
+
└─> 🚀 **Execute Steps Sequentially**:
|
|
240
|
+
|
|
241
|
+
Step 1: command_run("npm create next-app...")
|
|
242
|
+
☒ Step 1: Initialize Next.js - Completed
|
|
243
|
+
|
|
244
|
+
Step 2: install_dependencies()
|
|
245
|
+
☒ Step 2: Install dependencies - Installed
|
|
246
|
+
|
|
247
|
+
Step 3: code_generate({
|
|
248
|
+
step: 3,
|
|
249
|
+
featureName: "Product Catalog",
|
|
250
|
+
technicalStack: {...},
|
|
251
|
+
userStories: [...],
|
|
252
|
+
dataModel: [...]
|
|
253
|
+
})
|
|
254
|
+
↓ Code Generate Agent:
|
|
255
|
+
- Generates complete code
|
|
256
|
+
- Writes files: components/, api/, types/
|
|
257
|
+
- Returns: {step: 3, status: 'done', filesCreated: [...]}
|
|
258
|
+
☒ Step 3: Product Catalog - Created 5 files
|
|
259
|
+
|
|
260
|
+
Step 4: code_generate(Shopping Cart)
|
|
261
|
+
☒ Step 4: Shopping Cart - Created 3 files
|
|
262
|
+
|
|
263
|
+
Step 5: code_generate(Checkout)
|
|
264
|
+
☒ Step 5: Checkout - Created 4 files
|
|
265
|
+
|
|
266
|
+
✅ All steps completed! Created 12 files total.
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### 3️⃣ **Add Feature to Existing Project**
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
User: "Thêm authentication vào app"
|
|
275
|
+
│
|
|
276
|
+
├─> 🔍 ba_it_analyze(userRequest, context)
|
|
277
|
+
│ │ type: "update_project"
|
|
278
|
+
│ ↓
|
|
279
|
+
├─> 📊 Present analysis
|
|
280
|
+
│ ↓
|
|
281
|
+
├─> 📋 plan_task(userContext, baAnalysis)
|
|
282
|
+
│ │ → Skip project setup
|
|
283
|
+
│ │ → Focus on feature implementation
|
|
284
|
+
│ ↓
|
|
285
|
+
└─> 🚀 Execute steps
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### 4️⃣ **Simple Questions**
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
User: "React hooks là gì?"
|
|
294
|
+
│
|
|
295
|
+
└─> 💬 Direct answer (no tools)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## 📦 Cài đặt
|
|
301
|
+
|
|
302
|
+
### Yêu cầu hệ thống
|
|
303
|
+
|
|
304
|
+
- **Bun** >= 1.0
|
|
305
|
+
- **Ollama** với models:
|
|
306
|
+
- `gpt-oss:120b-cloud`
|
|
307
|
+
- `qwen3-coder:480b-cloud`
|
|
308
|
+
- **Google Gemini API Key**
|
|
309
|
+
|
|
310
|
+
### Bước 1: Clone & Install
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
cd terminal/galaxy_cli
|
|
314
|
+
bun install
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Bước 2: Setup Environment
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# .env file
|
|
321
|
+
GEMINI_API_KEY=your_gemini_api_key_here
|
|
322
|
+
OLLAMA_HOST=http://localhost:11434
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Bước 3: Build
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
bun run build
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Bước 4: Run
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
bun run start
|
|
335
|
+
# hoặc
|
|
336
|
+
bun run dev
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## 🚀 Sử dụng
|
|
342
|
+
|
|
343
|
+
### Chạy CLI
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Development mode với watch
|
|
347
|
+
bun run dev
|
|
348
|
+
|
|
349
|
+
# Production mode
|
|
350
|
+
bun run start
|
|
351
|
+
|
|
352
|
+
# Với CLI flags
|
|
353
|
+
bun run start --test # Enable test planning
|
|
354
|
+
bun run start --review # Enable review planning
|
|
355
|
+
bun run start --test --review # Enable both
|
|
356
|
+
bun run start --help # Show help
|
|
357
|
+
bun run start --version # Show version
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### CLI Flags
|
|
361
|
+
|
|
362
|
+
| Flag | Short | Default | Mô tả |
|
|
363
|
+
| ----------- | ----- | ------- | --------------------------- |
|
|
364
|
+
| `--help` | `-h` | - | Hiển thị trợ giúp |
|
|
365
|
+
| `--version` | `-v` | - | Hiển thị version |
|
|
366
|
+
| `--test` | - | `false` | Enable test planning step |
|
|
367
|
+
| `--review` | - | `false` | Enable review planning step |
|
|
368
|
+
|
|
369
|
+
### Commands (Trong CLI)
|
|
370
|
+
|
|
371
|
+
| Command | Mô tả | Example |
|
|
372
|
+
| -------------- | --------------------------- | ----------------------------------- |
|
|
373
|
+
| `/help` | Hiển thị danh sách lệnh | `/help` |
|
|
374
|
+
| `/exit` | Thoát khỏi Galaxy CLI | `/exit` |
|
|
375
|
+
| `/clear` | Xóa lịch sử hội thoại | `/clear` |
|
|
376
|
+
| `/history` | Xem 10 input gần nhất | `/history` |
|
|
377
|
+
| `/pwd` | Hiển thị thư mục làm việc | `/pwd` |
|
|
378
|
+
| `/information` | Hiển thị thông tin hệ thống | `/information` |
|
|
379
|
+
| `/test` | Toggle test planning | `/test true` hoặc `/test false` |
|
|
380
|
+
| `/review` | Toggle review planning | `/review true` hoặc `/review false` |
|
|
381
|
+
|
|
382
|
+
### Example Usage
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Phân tích dự án hiện tại
|
|
386
|
+
> Phân tích dự án này
|
|
387
|
+
|
|
388
|
+
# Tạo project mới
|
|
389
|
+
> Tạo app Next.js với TypeScript và Tailwind
|
|
390
|
+
|
|
391
|
+
# Thêm tính năng
|
|
392
|
+
> Thêm authentication với JWT
|
|
393
|
+
|
|
394
|
+
# Hỏi đáp
|
|
395
|
+
> Giải thích về React Context API
|
|
396
|
+
|
|
397
|
+
# Bật/tắt test planning
|
|
398
|
+
> /test true
|
|
399
|
+
✅ Test planning enabled
|
|
400
|
+
|
|
401
|
+
# Kiểm tra thông tin hệ thống
|
|
402
|
+
> /information
|
|
403
|
+
📊 System Information:
|
|
404
|
+
Name: Galaxy CLI
|
|
405
|
+
Version: 2.0.0
|
|
406
|
+
Current Project: /home/user/my-project
|
|
407
|
+
Testing: ON
|
|
408
|
+
Review Code: OFF
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## 🤖 AI Models & Vai trò
|
|
414
|
+
|
|
415
|
+
### 1. **Gemini 2.5 Flash** (Orchestrator)
|
|
416
|
+
|
|
417
|
+
- **Vai trò**: Central coordinator & plan executor
|
|
418
|
+
- **Nhiệm vụ**:
|
|
419
|
+
- Tool calling & function execution
|
|
420
|
+
- Plan execution với todos display (☐/☒)
|
|
421
|
+
- Workflow decision making
|
|
422
|
+
- Multi-language response (EN/VI)
|
|
423
|
+
- User interaction & confirmation
|
|
424
|
+
|
|
425
|
+
### 2. **gpt-oss:120b-cloud** (BA Analyzer)
|
|
426
|
+
|
|
427
|
+
- **Vai trò**: Business Analysis expert
|
|
428
|
+
- **Nhiệm vụ**:
|
|
429
|
+
- Phân tích yêu cầu người dùng
|
|
430
|
+
- Xác định features, tech stack, data model
|
|
431
|
+
- Phân loại: `create_project` vs `update_project`
|
|
432
|
+
- Đề xuất recommendations & questions
|
|
433
|
+
- Output: **English only** (internal consistency)
|
|
434
|
+
|
|
435
|
+
### 3. **qwen3-coder:480b-cloud** (Planning Agent)
|
|
436
|
+
|
|
437
|
+
- **Vai trò**: Feature-driven planner
|
|
438
|
+
- **Nhiệm vụ**:
|
|
439
|
+
- Map coreFeatures → execution steps
|
|
440
|
+
- 1 must-have feature = 1 code_generate step
|
|
441
|
+
- **Conditional test/review steps** based on CLI flags
|
|
442
|
+
- Chọn tools phù hợp (command_run, install_dependencies, code_generate)
|
|
443
|
+
- Ước lượng thời gian (quick/medium/long)
|
|
444
|
+
- Input: userContext + baAnalysis + system context (test/review flags)
|
|
445
|
+
- Output: **English only** (step array với featureName, tool, reasoning)
|
|
446
|
+
|
|
447
|
+
### 4. **qwen3-coder:480b-cloud** (Code Generate Agent) ✨ NEW
|
|
448
|
+
|
|
449
|
+
- **Vai trò**: Self-contained feature executor
|
|
450
|
+
- **Nhiệm vụ**:
|
|
451
|
+
- Nhận feature spec từ planning step
|
|
452
|
+
- Generate production-ready code (NO placeholders)
|
|
453
|
+
- Tự động write files, run commands
|
|
454
|
+
- Integrated tools: file_write, file_read, command_run, file_search
|
|
455
|
+
- Return: `{step, status: 'done'|'error', message, filesCreated}`
|
|
456
|
+
- **Input**:
|
|
457
|
+
- step, featureName, featureDescription, priority
|
|
458
|
+
- technicalStack, userStories, dataModel, apiEndpoints
|
|
459
|
+
- **Output**: Execution result với file list
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## 🔧 Danh sách Tools
|
|
464
|
+
|
|
465
|
+
### 📁 File Operations (6 tools)
|
|
466
|
+
|
|
467
|
+
- `file_read` - Đọc nội dung file
|
|
468
|
+
- `file_write` - Ghi/tạo file mới
|
|
469
|
+
- `file_list` - List files trong thư mục
|
|
470
|
+
- `file_search` - Tìm kiếm pattern trong files
|
|
471
|
+
- `file_tree` - Hiển thị cây thư mục
|
|
472
|
+
- `file_delete` - Xóa file
|
|
473
|
+
|
|
474
|
+
### 🔀 Git Operations (5 tools)
|
|
475
|
+
|
|
476
|
+
- `git_status` - Check git status
|
|
477
|
+
- `git_commit` - Commit changes
|
|
478
|
+
- `git_push` - Push to remote
|
|
479
|
+
- `git_pull` - Pull từ remote
|
|
480
|
+
- `git_diff` - Xem git diff
|
|
481
|
+
|
|
482
|
+
### 🔧 Command & Testing (3 tools)
|
|
483
|
+
|
|
484
|
+
- `command_run` - Chạy shell command
|
|
485
|
+
- `install_dependencies` - Auto-detect & install deps
|
|
486
|
+
- `test_run` - Chạy tests
|
|
487
|
+
|
|
488
|
+
### 📝 Document Parsing (1 tool)
|
|
489
|
+
|
|
490
|
+
- `document_parse` - Parse PDF, DOCX, XLSX
|
|
491
|
+
|
|
492
|
+
### 🧠 AI Analysis & Planning (3 tools)
|
|
493
|
+
|
|
494
|
+
- `ba_it_analyze` - Business analysis với gpt-oss:120b
|
|
495
|
+
- `plan_task` - Feature-driven planning với qwen3-coder:480b
|
|
496
|
+
- `code_generate` - ✨ **Self-contained feature executor** với qwen3-coder:480b
|
|
497
|
+
|
|
498
|
+
### 🏗 Project Setup (2 tools)
|
|
499
|
+
|
|
500
|
+
- `project_ask_config` - Interactive project setup
|
|
501
|
+
- `project_build_command` - Generate build commands
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## 📊 Decision Logic
|
|
506
|
+
|
|
507
|
+
### Khi nào dùng `ba_it_analyze`?
|
|
508
|
+
|
|
509
|
+
✅ **Dùng khi**:
|
|
510
|
+
|
|
511
|
+
- Tạo dự án MỚI (bắt buộc)
|
|
512
|
+
- Thêm tính năng LỚN (auth, payments, complex systems)
|
|
513
|
+
- Yêu cầu CHUNG CHUNG ("build app", "e-commerce")
|
|
514
|
+
|
|
515
|
+
❌ **Không dùng**:
|
|
516
|
+
|
|
517
|
+
- Câu hỏi đơn giản
|
|
518
|
+
- Phân tích dự án hiện tại (dùng `file_tree` + `file_read`)
|
|
519
|
+
|
|
520
|
+
### Khi nào dùng `plan_task`?
|
|
521
|
+
|
|
522
|
+
✅ **Dùng khi**:
|
|
523
|
+
|
|
524
|
+
- Sau khi user xác nhận BA analysis
|
|
525
|
+
- Cần implementation nhiều bước
|
|
526
|
+
- Refactoring phức tạp
|
|
527
|
+
|
|
528
|
+
**Required params**:
|
|
529
|
+
|
|
530
|
+
- `userContext` (bắt buộc) - Yêu cầu của user
|
|
531
|
+
- `baAnalysis` (optional) - Kết quả từ ba_it_analyze
|
|
532
|
+
|
|
533
|
+
### Khi nào dùng `code_generate`?
|
|
534
|
+
|
|
535
|
+
✅ **Dùng khi**:
|
|
536
|
+
|
|
537
|
+
- Orchestrator execute step từ plan
|
|
538
|
+
- Step có tool = "code_generate"
|
|
539
|
+
- Cần implement 1 feature hoàn chỉnh
|
|
540
|
+
|
|
541
|
+
**Required params**:
|
|
542
|
+
|
|
543
|
+
- `step` - Step number
|
|
544
|
+
- `featureName` - Tên feature từ coreFeatures
|
|
545
|
+
- `featureDescription` - Mô tả chi tiết
|
|
546
|
+
- `technicalStack` - Tech stack từ BA
|
|
547
|
+
- Optional: userStories, dataModel, apiEndpoints
|
|
548
|
+
|
|
549
|
+
**Output**: `{step, status: 'done'|'error', message, filesCreated: [...]}`
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## 🎨 UI Components
|
|
554
|
+
|
|
555
|
+
### Banner
|
|
556
|
+
|
|
557
|
+
```
|
|
558
|
+
____ _ ____ _ ___
|
|
559
|
+
/ ___| __ _| | __ ___ ___ _ / ___| | |_ _|
|
|
560
|
+
| | _ / _` | |/ _` \ \/ / | | || | | | | |
|
|
561
|
+
| |_| | (_| | | (_| |> <| |_| || |___| |___ | |
|
|
562
|
+
\____|\__,_|_|\__,_/_/\_\\__, | \____|_____|___|
|
|
563
|
+
|___/
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Loading States
|
|
567
|
+
|
|
568
|
+
- Spinner với dots animation: `⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏`
|
|
569
|
+
- Color: cyan
|
|
570
|
+
- Text: "Thinking..."
|
|
571
|
+
|
|
572
|
+
---
|
|
573
|
+
|
|
574
|
+
## 🔐 Environment Variables
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
# Required
|
|
578
|
+
GEMINI_API_KEY= # Google Gemini API key
|
|
579
|
+
OLLAMA_HOST= # Ollama server URL (default: http://localhost:11434)
|
|
580
|
+
|
|
581
|
+
# Optional
|
|
582
|
+
DEBUG= # Enable debug logs (true/false)
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## 🏃 Development
|
|
588
|
+
|
|
589
|
+
### Project Structure
|
|
590
|
+
|
|
591
|
+
```
|
|
592
|
+
terminal/galaxy_cli/
|
|
593
|
+
├── source/
|
|
594
|
+
│ ├── ai/
|
|
595
|
+
│ │ └── orchestrator.ts # Gemini orchestrator
|
|
596
|
+
│ ├── connections/
|
|
597
|
+
│ │ ├── gemini.ts # Gemini connection
|
|
598
|
+
│ │ └── ollama.ts # Ollama connection
|
|
599
|
+
│ ├── prompts/
|
|
600
|
+
│ │ ├── orchestrator.ts # Main workflow prompts
|
|
601
|
+
│ │ ├── ba-it-analyzer.ts # BA analysis prompts
|
|
602
|
+
│ │ └── planning-agent.ts # Planning prompts
|
|
603
|
+
│ ├── tools/
|
|
604
|
+
│ │ ├── ba-it-analyzer.ts # BA analyzer tool
|
|
605
|
+
│ │ ├── planning-agent.ts # Planning agent tool
|
|
606
|
+
│ │ ├── file-operations.ts # File tools
|
|
607
|
+
│ │ ├── git-operations.ts # Git tools
|
|
608
|
+
│ │ └── registry.ts # Tool registry
|
|
609
|
+
│ ├── app.tsx # Main Ink app
|
|
610
|
+
│ └── cli.tsx # CLI entry
|
|
611
|
+
├── dist/ # Compiled output
|
|
612
|
+
├── package.json
|
|
613
|
+
└── tsconfig.json
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Build & Test
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
# Development với auto-reload
|
|
620
|
+
bun run dev
|
|
621
|
+
|
|
622
|
+
# Build TypeScript
|
|
623
|
+
bun run build
|
|
624
|
+
|
|
625
|
+
# Type checking
|
|
626
|
+
bun run type-check
|
|
627
|
+
|
|
628
|
+
# Format code
|
|
629
|
+
bun run format
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## 📈 Roadmap
|
|
635
|
+
|
|
636
|
+
- [ ] **Execution Engine**: Tự động chạy plan steps
|
|
637
|
+
- [ ] **Code Review Agent**: Review code trước khi commit
|
|
638
|
+
- [ ] **Testing Agent**: Tự động generate tests
|
|
639
|
+
- [ ] **Documentation Agent**: Auto-generate docs
|
|
640
|
+
- [ ] **Multi-project support**: Làm việc với nhiều projects
|
|
641
|
+
- [ ] **Plugin system**: Mở rộng tools dễ dàng
|
|
642
|
+
- [ ] **Web UI**: Dashboard quản lý projects
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## 🤝 Contributing
|
|
647
|
+
|
|
648
|
+
Contributions are welcome! Please follow these steps:
|
|
649
|
+
|
|
650
|
+
1. Fork the repo
|
|
651
|
+
2. Create feature branch (`git checkout -b feature/amazing-feature`)
|
|
652
|
+
3. Commit changes (`git commit -m 'Add amazing feature'`)
|
|
653
|
+
4. Push to branch (`git push origin feature/amazing-feature`)
|
|
654
|
+
5. Open Pull Request
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## 📄 License
|
|
659
|
+
|
|
660
|
+
MIT License - see LICENSE file for details
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## 👨💻 Author
|
|
665
|
+
|
|
666
|
+
**Bùi Trọng Hiếu (Kevin Bui)**
|
|
667
|
+
|
|
668
|
+
- **Personal Email:** kevinbui210191@gmail.com
|
|
669
|
+
- **Work Email:** hieubt2@msb.com.vn
|
|
670
|
+
- **GitHub:** [@kevinbui210191](https://github.com/kevinbui210191)
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## 🙏 Acknowledgments
|
|
675
|
+
|
|
676
|
+
- **Ink** - React for CLI
|
|
677
|
+
- **Google Gemini** - LLM orchestration
|
|
678
|
+
- **Ollama** - Local LLM hosting
|
|
679
|
+
- **Bun** - Fast JavaScript runtime
|