@mrtrinhvn/ag-kit 1.1.1 → 1.1.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/README.md +46 -49
- package/bin/cli.js +31 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,78 +1,75 @@
|
|
|
1
1
|
# Antigravity Kit Core (`@mrtrinhvn/ag-kit`) 🚀
|
|
2
2
|
|
|
3
|
-
A generic, institutional-grade AI programming framework for automating scaffolding, architecture, and coding directly inside your software projects.
|
|
3
|
+
A generic, institutional-grade AI programming framework for automating scaffolding, architecture, and coding directly inside your software projects.
|
|
4
4
|
|
|
5
|
-
## 📦 Quick
|
|
5
|
+
## 📦 Quick Start
|
|
6
6
|
|
|
7
|
-
The best way to
|
|
7
|
+
The best way to inject AG-Kit into any project is via `npx`:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
> **Note**: This is the **recommended** method for remote machines as it avoids all `EACCES` permission issues.
|
|
10
|
+
# 1. Khởi tạo bộ não (Inject .agent folder)
|
|
11
|
+
npx @mrtrinhvn/ag-kit@latest init
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
# 2. Kiểm tra sức khỏe hệ thống (CDP, Ollama, Models)
|
|
14
|
+
npx @mrtrinhvn/ag-kit@latest check
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g @mrtrinhvn/ag-kit
|
|
16
|
+
# 3. Kiểm tra trạng thái và phiên bản
|
|
17
|
+
npx @mrtrinhvn/ag-kit@latest status
|
|
21
18
|
```
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
---
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
## 🛠 Lệnh CLI & Cách sử dụng
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
| Lệnh | Ý nghĩa | Chi tiết |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `ag-kit init` | **Khởi tạo** | Cài đặt tủy não `.agent` và tạo file `.env` mẫu. |
|
|
27
|
+
| `ag-kit check` | **Kiểm tra** | Quét cổng CDP (mặc định 9555), kiểm tra Ollama và AI Models. |
|
|
28
|
+
| `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. |
|
|
29
|
+
| `ag-kit status` | **Trạng thái** | Hiển thị rõ: Phiên bản Tool (CLI) và Phiên bản Core (Brain) đang dùng. |
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### ⚙️ Cấu hình Cổng (Custom Port)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Mặc định AG-Kit quét cổng **9555** và **9222**. Nếu bạn muốn dùng một cổng riêng cho từng dự án (để tránh xung đột khi mở nhiều IDE), hãy sửa file `.env`:
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
sudo npm install -g @mrtrinhvn/ag-kit
|
|
35
|
+
```env
|
|
36
|
+
CDP_PORT=12345
|
|
38
37
|
```
|
|
38
|
+
Lệnh `ag-kit check` sẽ tự động ưu tiên cổng này để kết nối với IDE.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
npx sẽ tự động tải và chạy mà không cần quyền ghi vào thư mục hệ thống.
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🏗 Cấu trúc hệ thống (.agent)
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
Sau khi chạy `init`, dự án của bạn sẽ có bộ khung tiêu chuẩn:
|
|
45
|
+
|
|
46
|
+
- **`GEMINI.md`**: "Hiến pháp" tối cao của Agent, đảm bảo tư duy hệ thống và an toàn.
|
|
47
|
+
- **`agents/`**: Các đặc vụ chuyên trách (Orchestrator, Frontend, Backend, Debugger).
|
|
48
|
+
- **`skills/`**: Các thuật toán tác chiến (Clean code, TDD, React Expert, Rust Pro...).
|
|
49
|
+
- **`workflows/`**: Các lệnh gõ tắt (slash commands) như `/create`, `/plan`, `/debug`.
|
|
50
|
+
- **`knowledge/`**: Nơi lưu giữ giao thức v3 và các kiến thức tự chữa lành (`self-healing`).
|
|
48
51
|
|
|
49
52
|
---
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
## 🔄 Cập nhật & Bảo trì
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|---|---|
|
|
55
|
-
| `ag-kit init` | Scaffolds the `.agent` framework (Agents, Skills, Workflows) into your current directory. |
|
|
56
|
-
| `ag-kit check` | Verifies environment health (CDP, Tokens, Ollama, Models). |
|
|
57
|
-
| `ag-kit update` | Pulls the latest rules and templates and safely overwrites the core `.agent` folders without breaking your custom `knowledge/` base. |
|
|
58
|
-
| `ag-kit status` | Checks exactly which version of the AG-Kit is active in your current working directory. |
|
|
56
|
+
Chúng tôi liên tục cập nhật các kỹ năng mới từ dự án `ag-orchestrator`. Để đảm bảo "bộ não" của bạn luôn thông minh nhất:
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
```bash
|
|
59
|
+
# Luôn dùng @latest để lấy những tinh hoa mới nhất từ NPM
|
|
60
|
+
npx @mrtrinhvn/ag-kit@latest update
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
## ❌ Xử lý lỗi thường gặp (Troubleshooting)
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
- **`workflows/`**: Pre-defined step-by-step instructions (slash commands) like `/create`, `/plan`, `/brainstorm`, and `/debug`.
|
|
68
|
-
- **`scripts/`**: CI/CD automation checkers like `lint_runner.py` and `security_scan.py`.
|
|
67
|
+
**1. Lỗi phiên bản không khớp (Version ghosting):**
|
|
68
|
+
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`.
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
1. The AI reads `GEMINI.md` first.
|
|
73
|
-
2. It assumes the persona of the relevant specialist in `agents/`.
|
|
74
|
-
3. It selectively loads specific techniques from `skills/` based on context.
|
|
75
|
-
4. It continuously documents important technical learnings in `knowledge/`.
|
|
71
|
+
**2. Lỗi EACCES (Quyền truy cập):**
|
|
72
|
+
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`.
|
|
76
73
|
|
|
77
74
|
---
|
|
78
75
|
*Built with ❤️ to enforce Institutional-Grade Software Standards.*
|
package/bin/cli.js
CHANGED
|
@@ -73,7 +73,22 @@ program.command('init')
|
|
|
73
73
|
const srcAgent = path.join(TEMPLATE_DIR, '.agent');
|
|
74
74
|
if (!fs.existsSync(TARGET_AGENT_DIR)) {
|
|
75
75
|
copyRecursiveSync(srcAgent, TARGET_AGENT_DIR);
|
|
76
|
+
// Ghi lại version vào .agent/.version
|
|
77
|
+
fs.writeFileSync(path.join(TARGET_AGENT_DIR, '.version'), pkg.version);
|
|
76
78
|
console.log('\x1b[32m✅ Đã cài ráp thành công thư mục .agent vào Project!\x1b[0m');
|
|
79
|
+
|
|
80
|
+
// Khởi tạo .env nếu chưa có
|
|
81
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
82
|
+
if (!fs.existsSync(envPath)) {
|
|
83
|
+
fs.writeFileSync(envPath, 'CDP_PORT=9555\n');
|
|
84
|
+
console.log('\x1b[34mℹ️ Đã tạo file .env mẫu với CDP_PORT=9555\x1b[0m');
|
|
85
|
+
} else {
|
|
86
|
+
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
87
|
+
if (!envContent.includes('CDP_PORT=')) {
|
|
88
|
+
fs.appendFileSync(envPath, '\nCDP_PORT=9555\n');
|
|
89
|
+
console.log('\x1b[34mℹ️ Đã thêm cấu hình CDP_PORT=9555 vào file .env hiện tại\x1b[0m');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
77
92
|
} else {
|
|
78
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');
|
|
79
94
|
}
|
|
@@ -102,6 +117,8 @@ program.command('update')
|
|
|
102
117
|
});
|
|
103
118
|
|
|
104
119
|
migrateLegacyMemories();
|
|
120
|
+
// Cập nhật version vào .agent/.version
|
|
121
|
+
fs.writeFileSync(path.join(TARGET_AGENT_DIR, '.version'), pkg.version);
|
|
105
122
|
console.log('\x1b[32m✅ Cập nhật thành công 100% Cấu trúc kỹ năng siêu cấp!\x1b[0m');
|
|
106
123
|
});
|
|
107
124
|
|
|
@@ -182,15 +199,22 @@ program.command('status')
|
|
|
182
199
|
.action(() => {
|
|
183
200
|
console.log('\x1b[36m📊 Trạng thái AG-Kit trong dự án hiện tại:\x1b[0m');
|
|
184
201
|
if (fs.existsSync(TARGET_AGENT_DIR)) {
|
|
185
|
-
console.log('\x1b[32m✅ Trạng thái: Đã Cài Đặt (Active)\x1b[0m');
|
|
186
|
-
console.log(`📁 Đường dẫn
|
|
202
|
+
console.log('\x1b[32m✅ Trạng thái : Đã Cài Đặt (Active)\x1b[0m');
|
|
203
|
+
console.log(`📁 Đường dẫn : ${TARGET_AGENT_DIR}`);
|
|
204
|
+
|
|
205
|
+
const vPath = path.join(TARGET_AGENT_DIR, '.version');
|
|
206
|
+
if (fs.existsSync(vPath)) {
|
|
207
|
+
const installedVersion = fs.readFileSync(vPath, 'utf-8').trim();
|
|
208
|
+
console.log(`🧠 Bản cài đặt : v${installedVersion}`);
|
|
209
|
+
} else {
|
|
210
|
+
console.log(`🧠 Bản cài đặt : Không rõ (Legacy)`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
console.log(`🏷 Bản Tool : v${pkg.version}`);
|
|
187
214
|
|
|
188
|
-
try {
|
|
189
|
-
const pJson = require('../package.json');
|
|
190
|
-
console.log(`🏷 Phiên bản : v${pJson.version}`);
|
|
191
|
-
} catch (e) {}
|
|
192
215
|
} else {
|
|
193
|
-
console.log('\x1b[31m❌ Trạng thái: Chưa có gì. Gõ "ag-kit init" để Setup.\x1b[0m');
|
|
216
|
+
console.log('\x1b[31m❌ Trạng thái : Chưa có gì. Gõ "ag-kit init" để Setup.\x1b[0m');
|
|
217
|
+
console.log(`🏷 Bản Tool : v${pkg.version}`);
|
|
194
218
|
}
|
|
195
219
|
});
|
|
196
220
|
|