ai-developer-skill-os 1.7.1 → 1.9.1
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 +97 -128
- package/bin/install.js +133 -32
- package/docs/CHI_TIET_SKILLS.md +89 -81
- package/docs/HUONG_DAN_SU_DUNG.md +51 -73
- package/package.json +1 -1
- package/skills/{qk-accessibility-audit → _archive_old_skills/qk-accessibility-audit}/SKILL.md +1 -1
- package/skills/{qk-agent-orchestrator → _archive_old_skills/qk-agent-orchestrator}/SKILL.md +1 -1
- package/skills/{qk-bug-fix → _archive_old_skills/qk-bug-fix}/SKILL.md +1 -1
- package/skills/{qk-component-generator → _archive_old_skills/qk-component-generator}/SKILL.md +1 -1
- package/skills/{qk-database-engineer → _archive_old_skills/qk-database-engineer}/SKILL.md +1 -1
- package/skills/{qk-design-system → _archive_old_skills/qk-design-system}/SKILL.md +1 -1
- package/skills/{qk-form-builder → _archive_old_skills/qk-form-builder}/SKILL.md +1 -1
- package/skills/{qk-frontend-architecture → _archive_old_skills/qk-frontend-architecture}/SKILL.md +1 -1
- package/skills/{qk-frontend-debug → _archive_old_skills/qk-frontend-debug}/SKILL.md +1 -1
- package/skills/{qk-frontend-performance → _archive_old_skills/qk-frontend-performance}/SKILL.md +1 -1
- package/skills/{qk-git-engineer → _archive_old_skills/qk-git-engineer}/SKILL.md +1 -1
- package/skills/_archive_old_skills/qk-help/SKILL.md +67 -0
- package/skills/{qk-state-management → _archive_old_skills/qk-state-management}/SKILL.md +1 -1
- package/skills/{qk-table-crud-generator → _archive_old_skills/qk-table-crud-generator}/SKILL.md +1 -1
- package/skills/qk-access-policy/SKILL.md +127 -0
- package/skills/qk-ai-builder/SKILL.md +33 -0
- package/skills/qk-api-lifecycle/SKILL.md +420 -0
- package/skills/qk-bug-resolution/SKILL.md +371 -0
- package/skills/qk-context-loader/SKILL.md +206 -0
- package/skills/qk-data-lifecycle/SKILL.md +135 -0
- package/skills/qk-design-to-code/SKILL.md +33 -0
- package/skills/qk-docs/SKILL.md +335 -0
- package/skills/qk-documentation-system/SKILL.md +33 -0
- package/skills/qk-engineering-standard/SKILL.md +171 -0
- package/skills/qk-engineering-standard/rules/backend.md +122 -0
- package/skills/qk-engineering-standard/rules/database.md +3 -0
- package/skills/qk-engineering-standard/rules/frontend.md +152 -0
- package/skills/qk-engineering-standard/rules/security.md +3 -0
- package/skills/qk-engineering-standard/rules/testing.md +3 -0
- package/skills/qk-feature-delivery/SKILL.md +432 -0
- package/skills/qk-help/SKILL.md +95 -67
- package/skills/qk-orchestrator/SKILL.md +272 -0
- package/skills/qk-policy-engine/SKILL.md +33 -0
- package/skills/qk-production-release/SKILL.md +127 -0
- package/skills/qk-project-bootstrap/SKILL.md +33 -0
- package/skills/qk-project-health/SKILL.md +650 -0
- package/skills/qk-project-memory/SKILL.md +33 -0
- package/skills/qk-system-evolution/SKILL.md +315 -0
- package/skills/qk-ui-audit/SKILL.md +152 -0
- package/skills/qk-ui-system-builder/SKILL.md +444 -0
- package/skills/qk-validation-gate/SKILL.md +33 -0
- /package/skills/{qk-api-integration → _archive_old_skills/qk-api-integration}/SKILL.md +0 -0
- /package/skills/{qk-auth-security → _archive_old_skills/qk-auth-security}/SKILL.md +0 -0
- /package/skills/{qk-backend-architecture → _archive_old_skills/qk-backend-architecture}/SKILL.md +0 -0
- /package/skills/{qk-context-manager → _archive_old_skills/qk-context-manager}/SKILL.md +0 -0
- /package/skills/{qk-deployment → _archive_old_skills/qk-deployment}/SKILL.md +0 -0
- /package/skills/{qk-frontend-testing → _archive_old_skills/qk-frontend-testing}/SKILL.md +0 -0
- /package/skills/{qk-migration → _archive_old_skills/qk-migration}/SKILL.md +0 -0
- /package/skills/{qk-project-audit → _archive_old_skills/qk-project-audit}/SKILL.md +0 -0
- /package/skills/{qk-refactor → _archive_old_skills/qk-refactor}/SKILL.md +0 -0
- /package/skills/{qk-ui-builder → _archive_old_skills/qk-ui-builder}/SKILL.md +0 -0
package/README.md
CHANGED
|
@@ -1,161 +1,130 @@
|
|
|
1
|
-
# 🚀 AI Developer Skill OS
|
|
1
|
+
# 🚀 AI Developer Skill OS (rules-skill-ai)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://github.com/phamquangkhanh2999)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
> Một hệ điều hành (AI-OS) và Nền tảng Kiến trúc Kỹ thuật (Engineering Platform) tối thượng dành cho AI Coding Agents (Cursor, Windsurf, Cline, v.v.).
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
Thay vì cung cấp các "công cụ rời rạc" (Toolbox), dự án này xây dựng một hệ thống **22 Siêu Kỹ Năng (Master Skills)**, biến Agent của bạn thành một **Senior Engineer / Chief Architect** thực thụ với khả năng tự học, tự kiểm toán và tự viết tài liệu.
|
|
8
6
|
|
|
9
7
|
---
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## 🏗️ Kiến Trúc Khối (The 7-Layer Architecture)
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Hệ thống được thiết kế hoàn hảo với 7 phân lớp, hoạt động khép kín theo chuỗi End-to-End:
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
13
|
+
### 0. Foundation Layer (Nền Tảng Cốt Lõi)
|
|
14
|
+
- `qk-orchestrator`: Bộ điều hướng yêu cầu người dùng, chọn Workflow.
|
|
15
|
+
- `qk-context-loader`: Bộ nạp ngữ cảnh, tìm file liên quan, chống tràn token.
|
|
16
|
+
- `qk-policy-engine`: Động cơ kiểm tra tính hợp lệ của Request trước khi chạy.
|
|
17
|
+
- `qk-access-policy`: Ranh giới bảo mật, phân quyền và RBAC.
|
|
18
|
+
- `qk-project-memory`: Bộ nhớ cấu trúc dự án (Architecture, UI Patterns, Conventions).
|
|
19
|
+
- `qk-engineering-standard`: Bộ luật thiết kế (Frontend, Backend, Security, Testing rules).
|
|
20
|
+
- `qk-project-bootstrap`: Trình khởi tạo dự án từ con số 0.
|
|
19
21
|
|
|
20
|
-
###
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
22
|
+
### 1. UI System Layer (Hệ Thống Giao Diện)
|
|
23
|
+
- `qk-ui-system-builder`: Quản lý Design System, Component Library.
|
|
24
|
+
- `qk-design-to-code`: Chuyển đổi Figma/Screenshot sang mã nguồn.
|
|
25
|
+
- `qk-ui-audit`: Kiểm toán tính nhất quán, Responsive, Accessibility.
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
### 2. Development Layer (Phát Triển E2E)
|
|
28
|
+
- `qk-feature-delivery`: Phân tích, code, test hoàn thiện một tính năng từ A-Z.
|
|
29
|
+
- `qk-api-lifecycle`: Vòng đời API (Spec, Service, Type, Test, Docs).
|
|
30
|
+
- `qk-data-lifecycle`: Vòng đời dữ liệu (Schema, Migration, Query Tuning).
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
### 3. Quality Assurance Layer (Đảm Bảo Chất Lượng)
|
|
33
|
+
- `qk-project-health`: Audit tình trạng dự án, Tech Debt, Code Smell.
|
|
34
|
+
- `qk-bug-resolution`: Tái hiện lỗi, tìm Root Cause, Fix và chống Regression.
|
|
35
|
+
- `qk-validation-gate`: Cổng chặn an toàn (Lint, Test, Security) trước khi hoàn tất.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
### 4. Evolution Layer (Tiến Hóa Hệ Thống)
|
|
38
|
+
- `qk-system-evolution`: Nâng cấp phiên bản, Impact Analysis, Dry-run.
|
|
32
39
|
|
|
33
|
-
###
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npx ai-developer-skill-os init
|
|
37
|
-
```
|
|
38
|
-
Hệ thống sẽ cung cấp cho bạn 2 tuỳ chọn cực kỳ linh hoạt:
|
|
39
|
-
- **(1) Local:** Cài vào thư mục ẩn `.qk-ai-skill-os/` ngay trong dự án. (Phù hợp khi làm việc nhóm, commit lên Git để ai cũng xài được).
|
|
40
|
-
- **(2) Global:** Cài thẳng vào ổ đĩa máy tính (Home Directory). Từ đó trở đi, bạn mở **BẤT KỲ DỰ ÁN NÀO** cũng sẽ tự động gọi được 23 kỹ năng mà không cần tải lại file! (Rất tuyệt vời cho cá nhân sử dụng).
|
|
40
|
+
### 5. Operation Layer (Vận Hành)
|
|
41
|
+
- `qk-production-release`: CI/CD, Build, Deploy, Observability.
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
### 6. AI Builder Layer
|
|
44
|
+
- `qk-ai-builder`: Thiết kế các hệ thống AI App, Agent, RAG.
|
|
43
45
|
|
|
44
|
-
###
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
46
|
+
### 7. Knowledge Layer (Tri Thức & Tài Liệu)
|
|
47
|
+
- `qk-docs`: Viết tài liệu cho con người (README, Changelog, Developer Guide).
|
|
48
|
+
- `qk-documentation-system`: Máy học nội bộ (Chuyển đổi Pattern thành luật nạp vào Memory).
|
|
49
|
+
- `qk-help`: Trợ lý tra cứu hướng dẫn kỹ năng.
|
|
49
50
|
|
|
50
51
|
---
|
|
51
52
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Bạn đang chạy bằng **AI Developer Skill OS** (Tác giả: Quang Khánh).
|
|
74
|
-
Vui lòng tìm đọc danh sách kỹ năng tại file `./.qk-ai-skill-os/skills.json`.
|
|
75
|
-
Bất cứ khi nào người dùng gõ lệnh `./qk [tên-skill]`, bạn BẮT BUỘC phải đọc file `SKILL.md` tương ứng trong thư mục `./.qk-ai-skill-os/skills/`.
|
|
76
|
-
Luôn giao tiếp bằng tiếng Việt nhưng viết code bằng tiếng Anh.
|
|
53
|
+
## 🔄 Luồng Vận Hành Khép Kín (Workflow)
|
|
54
|
+
|
|
55
|
+
Khi bạn ra lệnh: `"Thêm tính năng đăng nhập"`:
|
|
56
|
+
```text
|
|
57
|
+
User Request
|
|
58
|
+
↓
|
|
59
|
+
qk-orchestrator (Phân tích, chọn qk-feature-delivery)
|
|
60
|
+
↓
|
|
61
|
+
qk-context-loader (Load code liên quan Auth)
|
|
62
|
+
↓
|
|
63
|
+
qk-policy-engine & qk-access-policy (Check quyền)
|
|
64
|
+
↓
|
|
65
|
+
qk-engineering-standard (Rút luật Backend/Security)
|
|
66
|
+
↓
|
|
67
|
+
[THỰC THI BỞI qk-feature-delivery]
|
|
68
|
+
↓
|
|
69
|
+
qk-validation-gate (Test, Lint)
|
|
70
|
+
↓
|
|
71
|
+
qk-docs (Cập nhật API doc, Changelog)
|
|
72
|
+
↓
|
|
73
|
+
qk-documentation-system (Lưu các Pattern mới vào Memory)
|
|
77
74
|
```
|
|
78
75
|
|
|
79
|
-
### Cho GitHub Copilot
|
|
80
|
-
Tạo file `.github/copilot-instructions.md` và dán đoạn prompt tương tự như trên vào file này để Copilot học được các kỹ năng.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 🎯 Cách kiểm tra cài đặt thành công
|
|
85
|
-
|
|
86
|
-
Để biết AI của bạn đã thực sự "nhập môn" bộ Skill OS này chưa, hãy mở khung chat AI trong dự án và gõ cú pháp lệnh chuyên nghiệp sau:
|
|
87
|
-
> **`./qk project-audit`** Hãy cho tôi biết bạn sẽ làm những gì.
|
|
88
|
-
|
|
89
|
-
✅ **Thành công:** Nếu AI trả lời bằng tiếng Việt, liệt kê đúng các bước khám bệnh (Phase 1, Phase 2, Phase 3...) theo đúng như trong file `SKILL.md` của `project-audit`.
|
|
90
|
-
❌ **Thất bại:** Nếu AI trả lời chung chung hoặc bảo không biết skill này là gì, bạn cần kiểm tra lại đường dẫn file cấu hình ở bước trên.
|
|
91
|
-
|
|
92
76
|
---
|
|
93
77
|
|
|
94
|
-
##
|
|
78
|
+
## 💡 Ví Dụ Thực Tế (Common Examples)
|
|
95
79
|
|
|
96
|
-
|
|
80
|
+
Dưới đây là một số ví dụ sử dụng các kỹ năng phổ biến và mạnh mẽ nhất trong quá trình code hàng ngày của bạn:
|
|
97
81
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### 2. Xây dựng Giao diện (Frontend/UI)
|
|
104
|
-
> **`./qk-ui-builder`** & **`./qk-design-system`** Hãy tạo cho tôi một màn hình Đăng Nhập (Login) xịn xò. Đảm bảo Responsive và dùng đúng chuẩn Component.
|
|
105
|
-
|
|
106
|
-
### 3. Thiết kế Database (Backend)
|
|
107
|
-
> **`./qk-database-engineer`** Hãy viết cho tôi schema Prisma cho bảng Product và User có quan hệ 1-N. Tối ưu index cho truy vấn nhanh.
|
|
108
|
-
|
|
109
|
-
### 4. Tìm và Diệt Bug (Debugging)
|
|
110
|
-
> **`./qk-frontend-debug`** & **`./qk-bug-fix`** Code đang bị crash với lỗi `Hydration error`. Hãy tìm nguyên nhân gốc rễ và sửa dứt điểm giúp tôi.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## 💡 Mẹo & Workflow Thực Chiến (Best Practices)
|
|
82
|
+
### 1. `qk-orchestrator` (Trợ lý điều phối trung tâm)
|
|
83
|
+
Nếu bạn không biết nên dùng skill nào, hãy gọi Orchestrator. Nó sẽ tự động phân tích và kích hoạt đúng các skill bên dưới.
|
|
84
|
+
```bash
|
|
85
|
+
./qk-orchestrator "Tôi muốn tạo một trang Dashboard hiển thị doanh thu bằng React"
|
|
86
|
+
```
|
|
115
87
|
|
|
116
|
-
|
|
88
|
+
### 2. `qk-feature-delivery` (Phát triển tính năng E2E)
|
|
89
|
+
Dùng khi bạn muốn xây dựng trọn vẹn một tính năng từ DB, API đến UI và Test.
|
|
90
|
+
```bash
|
|
91
|
+
./qk-feature-delivery "Tạo luồng thanh toán giỏ hàng (Cart Checkout), lưu vào bảng orders và gọi API thanh toán Stripe"
|
|
92
|
+
```
|
|
117
93
|
|
|
118
|
-
###
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
### 3. `qk-bug-resolution` (Chẩn đoán và diệt Bug triệt để)
|
|
95
|
+
Tuyệt đối không dùng prompt thường để sửa lỗi. Dùng kỹ năng này để ép AI tìm Root Cause và viết Regression Test.
|
|
96
|
+
```bash
|
|
97
|
+
./qk-bug-resolution "API /users/profile đang trả về 500 khi user chưa có avatar, stack trace như sau..."
|
|
98
|
+
```
|
|
122
99
|
|
|
123
|
-
###
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
100
|
+
### 4. `qk-ui-system-builder` (Chuẩn hóa giao diện)
|
|
101
|
+
Dùng khi thiết kế các component dùng chung (Button, Card, Form) để đảm bảo không bị rác CSS.
|
|
102
|
+
```bash
|
|
103
|
+
./qk-ui-system-builder "Tạo một Data Table Component có hỗ trợ phân trang và filter, sử dụng Design Token hiện tại"
|
|
104
|
+
```
|
|
128
105
|
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
106
|
+
### 5. `qk-api-lifecycle` (Thiết kế và Code API)
|
|
107
|
+
Dành cho Backend Engineer, đi từ spec đến code, type và test.
|
|
108
|
+
```bash
|
|
109
|
+
./qk-api-lifecycle "Thiết kế API cập nhật mật khẩu, yêu cầu validate JWT token và mã hóa bcrypt"
|
|
110
|
+
```
|
|
133
111
|
|
|
134
112
|
---
|
|
135
113
|
|
|
136
|
-
##
|
|
137
|
-
*(Bạn có thể gọi trực tiếp trên Terminal hoặc Chat)*
|
|
138
|
-
|
|
139
|
-
> 💡 **Mẹo (Pro-Tip):** Bất cứ khi nào bạn quên mất danh sách kỹ năng hoặc cách dùng, chỉ cần gõ lệnh `./qk-help` (hoặc `@qk-help`), hệ thống sẽ xuất ra toàn bộ cẩm nang sử dụng và bí kíp kết hợp Kỹ năng (Skill Chaining) ngay lập tức!
|
|
114
|
+
## 💻 Cách Cài Đặt (Installation)
|
|
140
115
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
👉 [Xem danh sách toàn bộ Kỹ năng tại đây](docs/CHI_TIET_SKILLS.md)
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
<div align="center">
|
|
154
|
-
<b>Được thiết kế và phát triển bởi Quang Khánh (QK)</b><br>
|
|
155
|
-
<i>Empowering Vietnamese Developers with World-Class AI Workflows.</i>
|
|
156
|
-
</div>
|
|
116
|
+
Sử dụng npm:
|
|
117
|
+
```bash
|
|
118
|
+
npm i -g rules-skill-ai
|
|
119
|
+
```
|
|
120
|
+
Hoặc sử dụng qua `npx`:
|
|
121
|
+
```bash
|
|
122
|
+
npx rules-skill-ai init
|
|
123
|
+
```
|
|
157
124
|
|
|
158
|
-
|
|
125
|
+
## 🚀 Tra Cứu (Help)
|
|
159
126
|
|
|
160
|
-
|
|
161
|
-
|
|
127
|
+
Để tra cứu danh sách toàn bộ 22 Kỹ năng và các mẹo sử dụng, hãy gọi:
|
|
128
|
+
```bash
|
|
129
|
+
./qk-help "Hiển thị tất cả các skill liên quan đến Frontend"
|
|
130
|
+
```
|
package/bin/install.js
CHANGED
|
@@ -28,19 +28,56 @@ function cleanOldSkills(targetSkillsDir, isGeminiGlobal) {
|
|
|
28
28
|
if (fs.existsSync(targetSkillsDir)) {
|
|
29
29
|
console.log('🧹 Đang dọn dẹp phiên bản cũ để tối ưu hệ thống...');
|
|
30
30
|
if (isGeminiGlobal) {
|
|
31
|
-
// Chỉ xoá các thư mục qk-* để không ảnh hưởng các skill khác của người dùng
|
|
32
31
|
fs.readdirSync(targetSkillsDir).forEach(item => {
|
|
33
32
|
if (item.startsWith('qk-')) {
|
|
34
33
|
fs.rmSync(path.join(targetSkillsDir, item), { recursive: true, force: true });
|
|
35
34
|
}
|
|
36
35
|
});
|
|
37
36
|
} else {
|
|
38
|
-
// Xoá sạch toàn bộ thư mục kỹ năng của bộ công cụ này
|
|
39
37
|
fs.rmSync(targetSkillsDir, { recursive: true, force: true });
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
42
|
+
function ensureKiloConfig(kiloJsonPath, kiloSkillsDir, kiloThemesDir, kiloCommandsDir) {
|
|
43
|
+
if (!fs.existsSync(kiloSkillsDir)) {
|
|
44
|
+
fs.mkdirSync(kiloSkillsDir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
if (!fs.existsSync(kiloThemesDir)) {
|
|
47
|
+
fs.mkdirSync(kiloThemesDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
if (!fs.existsSync(kiloCommandsDir)) {
|
|
50
|
+
fs.mkdirSync(kiloCommandsDir, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const srcSkills = path.join(sourceDir, 'skills');
|
|
54
|
+
if (fs.existsSync(srcSkills)) {
|
|
55
|
+
copyRecursiveSync(srcSkills, kiloSkillsDir);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let kiloConfig = {};
|
|
59
|
+
if (fs.existsSync(kiloJsonPath)) {
|
|
60
|
+
try {
|
|
61
|
+
kiloConfig = JSON.parse(fs.readFileSync(kiloJsonPath, 'utf8'));
|
|
62
|
+
} catch (e) {
|
|
63
|
+
kiloConfig = {};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const skillPaths = [kiloSkillsDir];
|
|
68
|
+
if (!Array.isArray(kiloConfig.skills) || typeof kiloConfig.skills !== 'object' || !kiloConfig.skills.paths) {
|
|
69
|
+
kiloConfig.skills = { paths: skillPaths };
|
|
70
|
+
} else {
|
|
71
|
+
const exists = kiloConfig.skills.paths.some(p => path.resolve(p) === path.resolve(kiloSkillsDir));
|
|
72
|
+
if (!exists) {
|
|
73
|
+
kiloConfig.skills.paths = [...kiloConfig.skills.paths, ...skillPaths];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fs.writeFileSync(kiloJsonPath, JSON.stringify(kiloConfig, null, 2) + '\n');
|
|
78
|
+
return kiloJsonPath;
|
|
79
|
+
}
|
|
80
|
+
|
|
44
81
|
const rl = readline.createInterface({
|
|
45
82
|
input: process.stdin,
|
|
46
83
|
output: process.stdout
|
|
@@ -55,9 +92,10 @@ const questionIde = `Vui lòng chọn IDE/AI Assistant bạn đang sử dụng:
|
|
|
55
92
|
(4) Antigravity / Gemini
|
|
56
93
|
(5) Codex
|
|
57
94
|
(6) Kilo Code
|
|
95
|
+
(7) Tất cả các IDE (Multi-IDE)
|
|
58
96
|
(0) Bỏ qua (Không tạo config tự động)
|
|
59
97
|
|
|
60
|
-
Nhập số (0-
|
|
98
|
+
Nhập số (0-7): `;
|
|
61
99
|
|
|
62
100
|
const questionScope = `
|
|
63
101
|
Bạn muốn cài đặt bộ kỹ năng ở đâu?
|
|
@@ -68,6 +106,8 @@ Nhập số (1-2): `;
|
|
|
68
106
|
|
|
69
107
|
rl.question(questionIde, (answerIde) => {
|
|
70
108
|
let isGemini = false;
|
|
109
|
+
let isKilo = false;
|
|
110
|
+
let isMultiIde = false;
|
|
71
111
|
let ruleFileName = null;
|
|
72
112
|
const ideCode = answerIde.trim();
|
|
73
113
|
|
|
@@ -77,20 +117,35 @@ rl.question(questionIde, (answerIde) => {
|
|
|
77
117
|
case '3': ruleFileName = '.clinerules'; break;
|
|
78
118
|
case '4': isGemini = true; break;
|
|
79
119
|
case '5': ruleFileName = '.codexrules'; break;
|
|
80
|
-
case '6': ruleFileName = '.kilorules'; break;
|
|
120
|
+
case '6': ruleFileName = '.kilorules'; isKilo = true; break;
|
|
121
|
+
case '7': isMultiIde = true; ruleFileName = null; break;
|
|
81
122
|
case '0': default: break;
|
|
82
123
|
}
|
|
83
124
|
|
|
84
125
|
rl.question(questionScope, (answerScope) => {
|
|
85
126
|
const isGlobal = answerScope.trim() === '2';
|
|
86
127
|
|
|
128
|
+
const homeDir = os.homedir();
|
|
129
|
+
const cwd = process.cwd();
|
|
87
130
|
let targetDir = '';
|
|
88
131
|
let ruleFilePath = null;
|
|
89
132
|
let baseFolderForPrompt = '';
|
|
90
|
-
|
|
91
|
-
|
|
133
|
+
let kiloJsonPath = null;
|
|
134
|
+
let kiloSkillsDir = null;
|
|
135
|
+
let kiloThemesDir = null;
|
|
136
|
+
let kiloCommandsDir = null;
|
|
92
137
|
|
|
93
|
-
if (
|
|
138
|
+
if (isMultiIde) {
|
|
139
|
+
targetDir = path.join(cwd, '.qk-ai-skill-os');
|
|
140
|
+
baseFolderForPrompt = './.qk-ai-skill-os';
|
|
141
|
+
ruleFilePath = path.join(cwd, 'CLAUDE.md');
|
|
142
|
+
if (!isGlobal) {
|
|
143
|
+
kiloSkillsDir = path.join(cwd, '.kilo', 'skills');
|
|
144
|
+
kiloThemesDir = path.join(cwd, '.kilo', 'themes');
|
|
145
|
+
kiloCommandsDir = path.join(cwd, '.kilo', 'command');
|
|
146
|
+
kiloJsonPath = path.join(cwd, 'kilo.json');
|
|
147
|
+
}
|
|
148
|
+
} else if (isGemini) {
|
|
94
149
|
if (isGlobal) {
|
|
95
150
|
targetDir = path.join(homeDir, '.gemini', 'config');
|
|
96
151
|
ruleFilePath = path.join(targetDir, 'AGENTS.md');
|
|
@@ -100,6 +155,23 @@ rl.question(questionIde, (answerIde) => {
|
|
|
100
155
|
ruleFilePath = path.join(cwd, '.agents', 'AGENTS.md');
|
|
101
156
|
baseFolderForPrompt = '.agents/skills';
|
|
102
157
|
}
|
|
158
|
+
} else if (isKilo) {
|
|
159
|
+
if (isGlobal) {
|
|
160
|
+
targetDir = path.join(homeDir, '.qk-ai-skill-os');
|
|
161
|
+
baseFolderForPrompt = targetDir.replace(/\\/g, '/');
|
|
162
|
+
kiloSkillsDir = path.join(homeDir, '.kilo', 'skills');
|
|
163
|
+
kiloThemesDir = path.join(homeDir, '.config', 'kilo', 'themes');
|
|
164
|
+
kiloCommandsDir = path.join(homeDir, '.config', 'kilo', 'command');
|
|
165
|
+
kiloJsonPath = path.join(homeDir, '.config', 'kilo', 'kilo.json');
|
|
166
|
+
} else {
|
|
167
|
+
targetDir = path.join(cwd, '.qk-ai-skill-os');
|
|
168
|
+
baseFolderForPrompt = './.qk-ai-skill-os';
|
|
169
|
+
kiloSkillsDir = path.join(cwd, '.kilo', 'skills');
|
|
170
|
+
kiloThemesDir = path.join(cwd, '.kilo', 'themes');
|
|
171
|
+
kiloCommandsDir = path.join(cwd, '.kilo', 'command');
|
|
172
|
+
kiloJsonPath = path.join(cwd, 'kilo.json');
|
|
173
|
+
}
|
|
174
|
+
ruleFilePath = path.join(cwd, 'CLAUDE.md');
|
|
103
175
|
} else {
|
|
104
176
|
if (isGlobal) {
|
|
105
177
|
targetDir = path.join(homeDir, '.qk-ai-skill-os');
|
|
@@ -136,49 +208,78 @@ Nếu người dùng sử dụng tham số (argument), bạn BẮT BUỘC phải
|
|
|
136
208
|
'skills', '_template', 'docs', 'skills.json', 'README.md', 'CHANGELOG.md', 'LICENSE'
|
|
137
209
|
];
|
|
138
210
|
|
|
139
|
-
// Nếu là Gemini Global, chỉ cần copy skills và skills.json để tránh rác
|
|
140
211
|
if (isGemini && isGlobal) {
|
|
141
212
|
if (fs.existsSync(path.join(sourceDir, 'skills'))) {
|
|
142
|
-
|
|
213
|
+
copyRecursiveSync(path.join(sourceDir, 'skills'), path.join(targetDir, 'skills'));
|
|
143
214
|
}
|
|
144
215
|
if (fs.existsSync(path.join(sourceDir, 'skills.json'))) {
|
|
145
|
-
|
|
216
|
+
fs.copyFileSync(path.join(sourceDir, 'skills.json'), path.join(targetDir, 'skills', 'skills.json'));
|
|
146
217
|
}
|
|
147
218
|
} else {
|
|
148
219
|
filesAndFolders.forEach(item => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
220
|
+
const src = path.join(sourceDir, item);
|
|
221
|
+
let dest = path.join(targetDir, item);
|
|
222
|
+
if (fs.existsSync(src)) {
|
|
223
|
+
copyRecursiveSync(src, dest);
|
|
224
|
+
}
|
|
154
225
|
});
|
|
155
226
|
}
|
|
156
227
|
|
|
157
228
|
if (ruleFilePath) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
let writeContent = systemPrompt;
|
|
164
|
-
if (isGemini) {
|
|
165
|
-
writeContent = `\n<RULE[ai_skill_os]>\n---\ntrigger: always_on\n---\n${systemPrompt}\n</RULE[ai_skill_os]>\n`;
|
|
166
|
-
}
|
|
229
|
+
const ruleDir = path.dirname(ruleFilePath);
|
|
230
|
+
if (ruleDir !== cwd && !fs.existsSync(ruleDir)) {
|
|
231
|
+
fs.mkdirSync(ruleDir, { recursive: true });
|
|
232
|
+
}
|
|
167
233
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
234
|
+
let writeContent = systemPrompt;
|
|
235
|
+
if (isGemini) {
|
|
236
|
+
writeContent = `\n<RULE[ai_skill_os]>\n---\ntrigger: always_on\n---\n${systemPrompt}\n</RULE[ai_skill_os]>\n`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (fs.existsSync(ruleFilePath)) {
|
|
240
|
+
fs.appendFileSync(ruleFilePath, "\n\n" + writeContent);
|
|
241
|
+
console.log(`✅ Đã GHI THÊM cấu hình tự động vào file: ${ruleFilePath}`);
|
|
242
|
+
} else {
|
|
243
|
+
fs.writeFileSync(ruleFilePath, writeContent);
|
|
244
|
+
console.log(`✅ Đã TẠO MỚI file cấu hình: ${ruleFilePath}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (isKilo) {
|
|
249
|
+
ensureKiloConfig(kiloJsonPath, kiloSkillsDir, kiloThemesDir, kiloCommandsDir);
|
|
250
|
+
console.log(`✅ Đã cấu hình Kilo Code tại: ${kiloJsonPath}`);
|
|
251
|
+
console.log(` → Skills: ${kiloSkillsDir}`);
|
|
252
|
+
console.log(` → Themes: ${kiloThemesDir}`);
|
|
253
|
+
console.log(` → Commands: ${kiloCommandsDir}`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (isMultiIde) {
|
|
257
|
+
if (kiloJsonPath && kiloSkillsDir) {
|
|
258
|
+
ensureKiloConfig(kiloJsonPath, kiloSkillsDir, kiloThemesDir, kiloCommandsDir);
|
|
259
|
+
console.log(`✅ Đã cấu hình Kilo Code (Multi-IDE) tại: ${kiloJsonPath}`);
|
|
260
|
+
console.log(` → Skills: ${kiloSkillsDir}`);
|
|
261
|
+
console.log(` → Themes: ${kiloThemesDir}`);
|
|
262
|
+
console.log(` → Commands: ${kiloCommandsDir}`);
|
|
263
|
+
} else if (ruleFilePath) {
|
|
264
|
+
console.log(`✅ Đã tạo file cấu hình Multi-IDE: ${ruleFilePath}`);
|
|
265
|
+
}
|
|
175
266
|
}
|
|
176
267
|
|
|
177
268
|
console.log(`\n🎉 HOÀN TẤT! Dữ liệu kỹ năng đã được lưu tại: ${targetDir}`);
|
|
178
269
|
if (isGlobal && !isGemini) {
|
|
179
|
-
|
|
270
|
+
const name = ruleFilePath ? path.basename(ruleFilePath) : 'CLAUDE.md';
|
|
271
|
+
console.log(`💡 Lưu ý: Kỹ năng đã được cài ở cấp độ máy tính (Global). File cấu hình cục bộ (${name}) ở dự án này đang trỏ thẳng về thư mục Global đó.`);
|
|
180
272
|
} else if (isGlobal && isGemini) {
|
|
181
273
|
console.log(`💡 Lưu ý: Antigravity đã được cài Global. Từ nay bạn mở BẤT KỲ DỰ ÁN NÀO trên máy tính này, Antigravity cũng sẽ tự động có đủ 23 kỹ năng mà không cần cài lại!`);
|
|
274
|
+
} else if (isKilo) {
|
|
275
|
+
console.log(`💡 Lưu ý: Kilo Code đã sẵn sàng. Dùng \`<leader>t\` hoặc \`/themes\` để xem, và \`/skills\` để xem danh sách skill đã cài.`);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (!isGemini && !isKilo && !isMultiIde) {
|
|
279
|
+
if (fs.existsSync(path.join(cwd, '.kilorules'))) {
|
|
280
|
+
fs.unlinkSync(path.join(cwd, '.kilorules'));
|
|
281
|
+
console.log(`🧹 Đã xoá file .kilorules cũ (không còn cần thiết).`);
|
|
282
|
+
}
|
|
182
283
|
}
|
|
183
284
|
|
|
184
285
|
} catch (error) {
|