@mrtrinhvn/ag-kit 1.1.4 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +10 -2
  2. package/bin/cli.js +53 -4
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -4,8 +4,14 @@ A generic, institutional-grade AI programming framework for automating scaffoldi
4
4
 
5
5
  ## 📦 Quick Start
6
6
 
7
- The best way to inject AG-Kit into any project is via `npx`:
7
+ The best way to inject AG-Kit into any project is via `npx`. Bạn có thể chạy trực tiếp để vào **Menu tương tác**:
8
8
 
9
+ ```bash
10
+ # DASHBOARD - Menu chọn tất cả tác vụ (Khuyên dùng)
11
+ npx @mrtrinhvn/ag-kit@latest
12
+ ```
13
+
14
+ Hoặc chạy các lệnh đơn lẻ:
9
15
  ```bash
10
16
  # 1. Khởi tạo bộ não (Inject .agent folder)
11
17
  npx @mrtrinhvn/ag-kit@latest init
@@ -23,6 +29,7 @@ npx @mrtrinhvn/ag-kit@latest status
23
29
 
24
30
  | Lệnh | Ý nghĩa | Chi tiết |
25
31
  |---|---|---|
32
+ | `ag-kit` | **Dashboard** | (Không tham số) Mở menu chọn tương tác cực kỳ tiện lợi. |
26
33
  | `ag-kit init` | **Khởi tạo** | Cài đặt tủy não `.agent` và tạo file `.env` mẫu. |
27
34
  | `ag-kit check` | **Kiểm tra** | Quét cổng CDP (mặc định 9555), kiểm tra Ollama và AI Models. |
28
35
  | `ag-kit update` | **Cập nhật** | Nâng cấp Agents/Skills/Workflows mới nhất mà không làm mất dữ liệu Ký ức. |
@@ -66,7 +73,8 @@ npx @mrtrinhvn/ag-kit@latest update
66
73
 
67
74
  **1. Lỗi phiên bản không khớp (Version ghosting):**
68
75
  Nếu `status` báo phiên bản cũ hơn bản trên NPM, đó là do cache của `npx` hoặc bạn đã cài global.
69
- - Cách giải quyết: Luôn thêm `@latest` sau tên gói hoặc chạy `sudo npm install -g @mrtrinhvn/ag-kit@latest`.
76
+ - Cách giải quyết: Luôn thêm `@latest` sau tên gói (`npx @mrtrinhvn/ag-kit@latest`) hoặc cập nhật bộ não bằng lệnh `ag-kit update`.
77
+ - Giờ đây, các lệnh `init` và `status` sẽ tự động phát hiện và nhắc bạn chạy `update` nếu phát hiện lệch phiên bản.
70
78
 
71
79
  **2. Lỗi EACCES (Quyền truy cập):**
72
80
  Nếu cài global bị báo lỗi quyền, hãy dùng `npx` (Khuyên dùng) hoặc dùng `sudo`.
package/bin/cli.js CHANGED
@@ -90,7 +90,18 @@ program.command('init')
90
90
  }
91
91
  }
92
92
  } else {
93
- console.log('\x1b[33m⚠️ Thư mục .agent đã tồn tại. Hãy dùng lệnh "update" để cập nhật.\x1b[0m');
93
+ console.log('\x1b[33m⚠️ Thư mục .agent đã tồn tại.\x1b[0m');
94
+ const vPath = path.join(TARGET_AGENT_DIR, '.version');
95
+ if (fs.existsSync(vPath)) {
96
+ const installedVersion = fs.readFileSync(vPath, 'utf-8').trim();
97
+ if (installedVersion !== pkg.version) {
98
+ console.log(`\x1b[35m👉 Phát hiện phiên bản cũ (v${installedVersion}). Hãy dùng lệnh "ag-kit update" để cập nhật lên v${pkg.version}.\x1b[0m`);
99
+ } else {
100
+ console.log('\x1b[34mℹ️ Bạn đang sử dụng phiên bản khớp với bộ công cụ (v${pkg.version}).\x1b[0m');
101
+ }
102
+ } else {
103
+ console.log('\x1b[35m👉 Hãy dùng lệnh "ag-kit update" để đồng bộ cấu trúc mới.\x1b[0m');
104
+ }
94
105
  }
95
106
 
96
107
  console.log('\x1b[35m\n🎉 Hoàn tất! Vui lòng copy luật GEMINI vào file GEMINI.md của dự án nếu chưa có.\x1b[0m');
@@ -127,6 +138,12 @@ program.command('check')
127
138
  .action(async () => {
128
139
  const { execSync } = require('child_process');
129
140
  console.log('\x1b[36m🔍 Đang kiểm tra hệ sinh thái Antigravity...\x1b[0m');
141
+
142
+ if (!fs.existsSync(TARGET_AGENT_DIR)) {
143
+ console.log('\x1b[31m❌ Hệ thống chưa được khởi tạo. Thư mục .agent không tồn tại.\x1b[0m');
144
+ console.log('\x1b[35m👉 Hãy chạy "ag-kit init" trước khi thực hiện kiểm tra này.\x1b[0m');
145
+ return;
146
+ }
130
147
 
131
148
  // 1. Check .env
132
149
  const envPath = path.join(process.cwd(), '.env');
@@ -203,8 +220,9 @@ program.command('status')
203
220
  console.log(`📁 Đường dẫn : ${TARGET_AGENT_DIR}`);
204
221
 
205
222
  const vPath = path.join(TARGET_AGENT_DIR, '.version');
223
+ let installedVersion = '0.0.0';
206
224
  if (fs.existsSync(vPath)) {
207
- const installedVersion = fs.readFileSync(vPath, 'utf-8').trim();
225
+ installedVersion = fs.readFileSync(vPath, 'utf-8').trim();
208
226
  console.log(`🧠 Bản cài đặt : v${installedVersion}`);
209
227
  } else {
210
228
  console.log(`🧠 Bản cài đặt : Không rõ (Legacy)`);
@@ -212,10 +230,41 @@ program.command('status')
212
230
 
213
231
  console.log(`🏷 Bản Tool : v${pkg.version}`);
214
232
 
233
+ if (installedVersion !== pkg.version) {
234
+ console.log('\n\x1b[33m⚠️ CẢNH BÁO: Phiên bản bộ não (.agent) đang lệch với bộ công cụ (ag-kit)!\x1b[0m');
235
+ console.log(`\x1b[35m👉 Hãy chạy "ag-kit update" để đồng bộ ngay.\x1b[0m`);
236
+ }
237
+
215
238
  } else {
216
- console.log('\x1b[31m❌ Trạng thái : Chưa có gì. Gõ "ag-kit init" để Setup.\x1b[0m');
239
+ console.log('\x1b[31m❌ Trạng thái : Chưa có gì.\x1b[0m');
240
+ console.log('\x1b[35m👉 Gõ "ag-kit init" để biến thư mục này thành một Agentic Workspace!\x1b[0m');
217
241
  console.log(`🏷 Bản Tool : v${pkg.version}`);
218
242
  }
219
243
  });
220
244
 
221
- program.parse(process.argv);
245
+
246
+ if (process.argv.length <= 2) {
247
+ const inquirer = require('inquirer');
248
+ console.log('\x1b[35m\n🧠 ANTIGRAVITY KIT - BẢNG ĐIỀU KHIỂN TÁC VỤ\x1b[0m');
249
+ inquirer.prompt([
250
+ {
251
+ type: 'list',
252
+ name: 'action',
253
+ message: 'Chọn một tác vụ để thực hiện:',
254
+ choices: [
255
+ { name: '🚀 Khởi tạo (init) - Cài đặt .agent', value: 'init' },
256
+ { name: '🔄 Cập nhật (update) - Nâng cấp bộ não', value: 'update' },
257
+ { name: '🔍 Kiểm tra (check) - Test môi trường', value: 'check' },
258
+ { name: '📊 Trạng thái (status) - Xem version', value: 'status' },
259
+ new inquirer.Separator(),
260
+ { name: '❌ Thoát', value: 'exit' }
261
+ ]
262
+ }
263
+ ]).then(answers => {
264
+ if (answers.action !== 'exit') {
265
+ program.parse([process.argv[0], process.argv[1], answers.action]);
266
+ }
267
+ });
268
+ } else {
269
+ program.parse(process.argv);
270
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrtrinhvn/ag-kit",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Antigravity Kit Base Framework - Generic Agentic AI Programming Core",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -29,6 +29,7 @@
29
29
  "package.json"
30
30
  ],
31
31
  "dependencies": {
32
- "commander": "^14.0.3"
32
+ "commander": "^14.0.3",
33
+ "inquirer": "^8.2.5"
33
34
  }
34
35
  }