evnict-kit 0.2.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 +19 -0
- package/bin/cli.js +38 -0
- package/package.json +48 -0
- package/src/commands/add.js +129 -0
- package/src/commands/init-check.js +19 -0
- package/src/commands/init-context.js +37 -0
- package/src/commands/init-rules.js +42 -0
- package/src/commands/init-workflow.js +36 -0
- package/src/commands/init.js +722 -0
- package/src/utils/config.js +167 -0
- package/src/utils/file.js +53 -0
- package/templates/GETTING-STARTED.md +196 -0
- package/templates/content/context/AGENTS.md.template +462 -0
- package/templates/content/rules/01-evnict-kit-general-rules.md +303 -0
- package/templates/content/rules/02-evnict-kit-security-rules.md +423 -0
- package/templates/content/rules/03-evnict-kit-backend-conventions.md +383 -0
- package/templates/content/rules/04-evnict-kit-frontend-conventions.md +402 -0
- package/templates/content/rules/05-evnict-kit-project-conventions.md +228 -0
- package/templates/content/skills/evnict-kit-brainstorm/SKILL.md +140 -0
- package/templates/content/skills/evnict-kit-bug-fix/SKILL.md +108 -0
- package/templates/content/skills/evnict-kit-checkpoint/SKILL.md +156 -0
- package/templates/content/skills/evnict-kit-code-review/SKILL.md +158 -0
- package/templates/content/skills/evnict-kit-coordinate/SKILL.md +274 -0
- package/templates/content/skills/evnict-kit-create-api/SKILL.md +281 -0
- package/templates/content/skills/evnict-kit-create-component/SKILL.md +263 -0
- package/templates/content/skills/evnict-kit-create-page/SKILL.md +247 -0
- package/templates/content/skills/evnict-kit-database-migration/SKILL.md +164 -0
- package/templates/content/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
- package/templates/content/skills/evnict-kit-finish-branch/SKILL.md +87 -0
- package/templates/content/skills/evnict-kit-fix-attt/SKILL.md +129 -0
- package/templates/content/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
- package/templates/content/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
- package/templates/content/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
- package/templates/content/skills/evnict-kit-onboard/SKILL.md +143 -0
- package/templates/content/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
- package/templates/content/skills/evnict-kit-receiving-review/SKILL.md +89 -0
- package/templates/content/skills/evnict-kit-security-audit/SKILL.md +190 -0
- package/templates/content/skills/evnict-kit-spec/SKILL.md +237 -0
- package/templates/content/skills/evnict-kit-tdd/SKILL.md +413 -0
- package/templates/content/skills/evnict-kit-wiki/SKILL.md +412 -0
- package/templates/content/workflows/evnict-kit-archive-wiki.md +100 -0
- package/templates/content/workflows/evnict-kit-attt.md +100 -0
- package/templates/content/workflows/evnict-kit-bug-fix.md +107 -0
- package/templates/content/workflows/evnict-kit-feature-large.md +393 -0
- package/templates/content/workflows/evnict-kit-feature-small.md +86 -0
- package/templates/content/workflows/evnict-kit-handoff.md +243 -0
- package/templates/content/workflows/evnict-kit-implement.md +247 -0
- package/templates/content/workflows/evnict-kit-init-check.md +76 -0
- package/templates/content/workflows/evnict-kit-init-context.md +58 -0
- package/templates/content/workflows/evnict-kit-init-rules.md +114 -0
- package/templates/content/workflows/evnict-kit-init-wiki.md +80 -0
- package/templates/content/workflows/evnict-kit-plan.md +308 -0
- package/templates/content/workflows/evnict-kit-review.md +53 -0
- package/templates/content/workflows/evnict-kit-spec-archive.md +53 -0
- package/templates/content/workflows/evnict-kit-wiki-archive-feature.md +164 -0
- package/templates/content/workflows/evnict-kit-wiki-query.md +91 -0
- package/templates/content/workflows/evnict-kit-wiki-scan-project.md +272 -0
- package/templates/context/AGENT.md.template +9 -0
- package/templates/context/AGENTS.md.template +462 -0
- package/templates/context/CLAUDE.md.template +301 -0
- package/templates/context/copilot-instructions.md.template +60 -0
- package/templates/context/cursorrules.template +114 -0
- package/templates/instruct/Instruct-Agent-AI.be.md +96 -0
- package/templates/instruct/Instruct-Agent-AI.fe.md +79 -0
- package/templates/rules/antigravity/01-evnict-kit-general-rules.md +303 -0
- package/templates/rules/antigravity/02-evnict-kit-security-rules.md +423 -0
- package/templates/rules/antigravity/03-evnict-kit-backend-conventions.md +383 -0
- package/templates/rules/antigravity/04-evnict-kit-frontend-conventions.md +402 -0
- package/templates/rules/antigravity/05-evnict-kit-project-conventions.md +228 -0
- package/templates/rules/claude/README.md +8 -0
- package/templates/rules/cursor/01-evnict-kit-general-rules.mdc +46 -0
- package/templates/rules/cursor/02-evnict-kit-security-rules.mdc +46 -0
- package/templates/rules/cursor/03-evnict-kit-backend-conventions.mdc +50 -0
- package/templates/rules/cursor/04-evnict-kit-frontend-conventions.mdc +43 -0
- package/templates/rules/cursor/05-evnict-kit-project-conventions.mdc +63 -0
- package/templates/rules/cursor/README.md +7 -0
- package/templates/skills/evnict-kit-brainstorm/SKILL.md +140 -0
- package/templates/skills/evnict-kit-bug-fix/SKILL.md +108 -0
- package/templates/skills/evnict-kit-checkpoint/SKILL.md +156 -0
- package/templates/skills/evnict-kit-code-review/SKILL.md +158 -0
- package/templates/skills/evnict-kit-coordinate/SKILL.md +274 -0
- package/templates/skills/evnict-kit-create-api/SKILL.md +281 -0
- package/templates/skills/evnict-kit-create-component/SKILL.md +263 -0
- package/templates/skills/evnict-kit-create-page/SKILL.md +247 -0
- package/templates/skills/evnict-kit-database-migration/SKILL.md +164 -0
- package/templates/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
- package/templates/skills/evnict-kit-finish-branch/SKILL.md +87 -0
- package/templates/skills/evnict-kit-fix-attt/SKILL.md +129 -0
- package/templates/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
- package/templates/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
- package/templates/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
- package/templates/skills/evnict-kit-onboard/SKILL.md +143 -0
- package/templates/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
- package/templates/skills/evnict-kit-receiving-review/SKILL.md +89 -0
- package/templates/skills/evnict-kit-security-audit/SKILL.md +190 -0
- package/templates/skills/evnict-kit-spec/SKILL.md +237 -0
- package/templates/skills/evnict-kit-tdd/SKILL.md +413 -0
- package/templates/skills/evnict-kit-wiki/SKILL.md +412 -0
- package/templates/wiki/README.md +35 -0
- package/templates/wiki/config.example.yaml +17 -0
- package/templates/wiki/package.json +17 -0
- package/templates/wiki/raw/notes/.gitkeep +1 -0
- package/templates/wiki/scripts/ingest.js +66 -0
- package/templates/workflows/antigravity/evnict-kit-archive-wiki.md +100 -0
- package/templates/workflows/antigravity/evnict-kit-attt.md +100 -0
- package/templates/workflows/antigravity/evnict-kit-bug-fix.md +107 -0
- package/templates/workflows/antigravity/evnict-kit-feature-large.md +393 -0
- package/templates/workflows/antigravity/evnict-kit-feature-small.md +86 -0
- package/templates/workflows/antigravity/evnict-kit-handoff.md +243 -0
- package/templates/workflows/antigravity/evnict-kit-implement.md +247 -0
- package/templates/workflows/antigravity/evnict-kit-init-check.md +76 -0
- package/templates/workflows/antigravity/evnict-kit-init-context.md +58 -0
- package/templates/workflows/antigravity/evnict-kit-init-rules.md +114 -0
- package/templates/workflows/antigravity/evnict-kit-init-wiki.md +80 -0
- package/templates/workflows/antigravity/evnict-kit-plan.md +308 -0
- package/templates/workflows/antigravity/evnict-kit-review.md +53 -0
- package/templates/workflows/antigravity/evnict-kit-spec-archive.md +53 -0
- package/templates/workflows/antigravity/evnict-kit-wiki-archive-feature.md +164 -0
- package/templates/workflows/antigravity/evnict-kit-wiki-query.md +91 -0
- package/templates/workflows/antigravity/evnict-kit-wiki-scan-project.md +272 -0
- package/templates/workflows/claude/README.md +6 -0
- package/templates/workflows/claude/evnict-kit-archive-wiki.md +98 -0
- package/templates/workflows/claude/evnict-kit-attt.md +98 -0
- package/templates/workflows/claude/evnict-kit-bug-fix.md +105 -0
- package/templates/workflows/claude/evnict-kit-feature-large.md +391 -0
- package/templates/workflows/claude/evnict-kit-feature-small.md +84 -0
- package/templates/workflows/claude/evnict-kit-handoff.md +240 -0
- package/templates/workflows/claude/evnict-kit-implement.md +245 -0
- package/templates/workflows/claude/evnict-kit-init-check.md +74 -0
- package/templates/workflows/claude/evnict-kit-init-context.md +56 -0
- package/templates/workflows/claude/evnict-kit-init-rules.md +112 -0
- package/templates/workflows/claude/evnict-kit-init-wiki.md +78 -0
- package/templates/workflows/claude/evnict-kit-plan.md +305 -0
- package/templates/workflows/claude/evnict-kit-review.md +51 -0
- package/templates/workflows/claude/evnict-kit-spec-archive.md +51 -0
- package/templates/workflows/claude/evnict-kit-wiki-archive-feature.md +162 -0
- package/templates/workflows/claude/evnict-kit-wiki-query.md +89 -0
- package/templates/workflows/claude/evnict-kit-wiki-scan-project.md +270 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evnict-kit-wiki
|
|
3
|
+
description: Quản lý knowledge base dự án bằng LLM Wiki. Push tri thức, query, ingest, status, scan-code. Tích hợp sẵn vào cuối mọi workflow.
|
|
4
|
+
compatibility: Node.js 18+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# evnict-kit-wiki — Project Knowledge Base
|
|
8
|
+
|
|
9
|
+
## Khi nào dùng
|
|
10
|
+
- Push kiến thức mới vào wiki sau khi hoàn thành feature/bugfix/ATTT
|
|
11
|
+
- Query wiki để tìm context trước khi bắt đầu task mới
|
|
12
|
+
- Ingest raw notes thành wiki pages
|
|
13
|
+
- Scan code hiện có để sinh wiki notes
|
|
14
|
+
- Kiểm tra health/status wiki
|
|
15
|
+
|
|
16
|
+
## Sub-commands
|
|
17
|
+
|
|
18
|
+
| Command | Mô tả | Trigger bởi |
|
|
19
|
+
|---------|-------|-------------|
|
|
20
|
+
| push | Thêm tri thức mới vào wiki | Agent gọi sau feature/bugfix/ATTT |
|
|
21
|
+
| query | Tìm kiếm tri thức | Agent gọi trước khi bắt đầu task |
|
|
22
|
+
| ingest | Xử lý raw notes thành wiki pages | Tự động sau push |
|
|
23
|
+
| status | Xem trạng thái wiki | Kiểm tra health |
|
|
24
|
+
| scan-code | Đọc code BE/FE → sinh wiki notes | Dùng cho dự án có sẵn code |
|
|
25
|
+
|
|
26
|
+
## Input Parameters
|
|
27
|
+
- `action` (bắt buộc): push | query | ingest | status | scan-code
|
|
28
|
+
- `content` (cho push): Nội dung cần push
|
|
29
|
+
- `keyword` (cho query): Từ khóa tìm kiếm
|
|
30
|
+
- `domain` (optional): Module/domain filter
|
|
31
|
+
- `tags` (optional): Tags filter
|
|
32
|
+
- `scope` (cho scan-code): all | controllers | services | entities
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Xác định Wiki Path (qua symlink)
|
|
37
|
+
|
|
38
|
+
**Thứ tự ưu tiên:**
|
|
39
|
+
1. **Symlink (Ưu tiên):** Kiểm tra ở root dự án có thư mục `{project_name}-wiki/`
|
|
40
|
+
- Dùng Relative Path (đường dẫn tương đối) để tránh bug pathing OS chéo
|
|
41
|
+
2. **Config (Fallback):** Đọc `.evnict/config.yaml` → `wiki.folder`
|
|
42
|
+
3. **Verify:** Tồn tại `config.yaml` + `raw/` + `wiki/` trong wiki path
|
|
43
|
+
4. **Nếu chưa setup** → DỪNG VÀ BÁO: *"Chạy `/evnict-kit:init-wiki` trước"*
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Quick check
|
|
47
|
+
ls {project_name}-wiki/config.yaml 2>/dev/null || echo "Wiki chưa setup"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Sub-command: PUSH — Thêm tri thức vào wiki
|
|
53
|
+
|
|
54
|
+
### Khi nào
|
|
55
|
+
- Sau khi hoàn thành feature (gọi bởi workflow archive-wiki)
|
|
56
|
+
- Sau khi fix bug (gọi bởi workflow bug-fix)
|
|
57
|
+
- Sau khi fix ATTT (gọi bởi workflow attt — BẮT BUỘC)
|
|
58
|
+
- Khi user yêu cầu thêm tri thức thủ công
|
|
59
|
+
|
|
60
|
+
### Quy trình
|
|
61
|
+
|
|
62
|
+
#### Bước 1: Sinh markdown file với frontmatter chuẩn llm-wiki
|
|
63
|
+
```yaml
|
|
64
|
+
---
|
|
65
|
+
title: "{title}"
|
|
66
|
+
url: ""
|
|
67
|
+
discovered: {YYYY-MM-DD}
|
|
68
|
+
topic: "{module/domain}"
|
|
69
|
+
tags: [{tags}]
|
|
70
|
+
source: "evnict-kit-auto"
|
|
71
|
+
type: feature|bugfix|attt|architecture|convention
|
|
72
|
+
related_specs: ["{spec_path}"]
|
|
73
|
+
---
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Bước 2: Viết nội dung — PHẢI bao gồm đầy đủ
|
|
77
|
+
Nội dung push PHẢI chứa tất cả các mục sau (nếu applicable):
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
## Tóm tắt
|
|
81
|
+
{Mô tả feature/bugfix — 3-5 câu}
|
|
82
|
+
|
|
83
|
+
## API Endpoints
|
|
84
|
+
| Method | Path | Mô tả |
|
|
85
|
+
|--------|------|-------|
|
|
86
|
+
| POST | /api/{module}/{action} | {description} |
|
|
87
|
+
| ... | ... | ... |
|
|
88
|
+
|
|
89
|
+
## Database Changes
|
|
90
|
+
| Table | Change | Details |
|
|
91
|
+
|-------|--------|---------|
|
|
92
|
+
| {TABLE} | CREATE/ALTER | {columns added/modified} |
|
|
93
|
+
|
|
94
|
+
## Business Rules áp dụng
|
|
95
|
+
| Mã | Rule | Implementation |
|
|
96
|
+
|----|------|----------------|
|
|
97
|
+
| BR01 | {rule} | {how it was implemented} |
|
|
98
|
+
|
|
99
|
+
## Key Code Patterns sử dụng
|
|
100
|
+
- Repository Pattern: {file} — JOOQ type-safe queries
|
|
101
|
+
- DTO mapping: {file} — @JsonProperty UPPER_SNAKE
|
|
102
|
+
- ...
|
|
103
|
+
|
|
104
|
+
## Files thay đổi chính
|
|
105
|
+
| File | Action | Lines |
|
|
106
|
+
|------|--------|-------|
|
|
107
|
+
| {path} | CREATE | {N} |
|
|
108
|
+
| {path} | MODIFY | {N} |
|
|
109
|
+
|
|
110
|
+
## Lessons Learned
|
|
111
|
+
- {Issue encountered} → {How resolved}
|
|
112
|
+
- {Pattern discovered} → {How applied}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Bước 3: Copy vào wiki
|
|
116
|
+
```bash
|
|
117
|
+
# Naming convention: {domain}-{slug}.md
|
|
118
|
+
cp {generated_file} {wiki_path}/raw/notes/{domain}-{slug}.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Bước 4: TỰ ĐỘNG chạy ingest
|
|
122
|
+
**KHÔNG bắt user chạy npm thủ công.** Agent TRỰC TIẾP chạy:
|
|
123
|
+
```bash
|
|
124
|
+
cd {wiki_path} && node scripts/ingest.js
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Nếu `scripts/ingest.js` không tồn tại → thử:
|
|
128
|
+
```bash
|
|
129
|
+
cd {wiki_path} && npm run ingest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Nếu vẫn fail → retry 1 lần → nếu vẫn fail → báo lỗi cụ thể:
|
|
133
|
+
```
|
|
134
|
+
❌ Ingest failed: {error message}
|
|
135
|
+
Thử: cd {wiki_path} && npm install && node scripts/ingest.js
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Bước 5: Confirm
|
|
139
|
+
```
|
|
140
|
+
✅ Wiki pushed: {wiki_path}/raw/notes/{domain}-{slug}.md
|
|
141
|
+
✅ Ingest completed: {N} pages created/updated
|
|
142
|
+
📚 Wiki size: {total_raw} raw, {total_wiki} wiki pages
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Sub-command: QUERY — Tìm kiếm trong wiki
|
|
148
|
+
|
|
149
|
+
### Khi nào
|
|
150
|
+
- Trước khi bắt đầu feature mới → tìm context liên quan
|
|
151
|
+
- Khi fix bug → tìm chức năng bị bug đã được document chưa
|
|
152
|
+
- Khi brainstorm → explore cái đã có
|
|
153
|
+
|
|
154
|
+
### Quy trình
|
|
155
|
+
|
|
156
|
+
#### Bước 1: Đọc wiki INDEX
|
|
157
|
+
```bash
|
|
158
|
+
cat {wiki_path}/wiki/INDEX.md 2>/dev/null || cat {wiki_path}/processed/INDEX.md 2>/dev/null
|
|
159
|
+
```
|
|
160
|
+
Map keywords từ input vào index.
|
|
161
|
+
|
|
162
|
+
#### Bước 2: Tìm kiếm theo keyword
|
|
163
|
+
```bash
|
|
164
|
+
# Tìm trong wiki pages
|
|
165
|
+
grep -rl "{keyword}" {wiki_path}/wiki/ --include="*.md" 2>/dev/null
|
|
166
|
+
grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md" 2>/dev/null
|
|
167
|
+
# Tìm trong raw notes
|
|
168
|
+
grep -rl "{keyword}" {wiki_path}/raw/notes/ --include="*.md" 2>/dev/null
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Bước 3: Đọc nội dung tìm được
|
|
172
|
+
Đọc các file match → extract phần liên quan.
|
|
173
|
+
|
|
174
|
+
#### Bước 4: Format output
|
|
175
|
+
```markdown
|
|
176
|
+
## 📚 Wiki Results for "{keyword}"
|
|
177
|
+
|
|
178
|
+
### Found {N} results:
|
|
179
|
+
|
|
180
|
+
#### 1. {title} ({domain})
|
|
181
|
+
- File: {path}
|
|
182
|
+
- Date: {date}
|
|
183
|
+
- Tags: {tags}
|
|
184
|
+
- Summary: {2-3 câu tóm tắt}
|
|
185
|
+
|
|
186
|
+
#### 2. ...
|
|
187
|
+
|
|
188
|
+
### Gaps detected
|
|
189
|
+
{Nếu wiki thiếu thông tin về keyword → gợi ý:}
|
|
190
|
+
💡 Wiki chưa có đủ thông tin về "{keyword}".
|
|
191
|
+
Gợi ý: Chạy scan-code hoặc push thêm tri thức.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Sub-command: INGEST — Xử lý raw → wiki pages
|
|
197
|
+
|
|
198
|
+
### Quy trình
|
|
199
|
+
|
|
200
|
+
#### Bước 1: Scan raw sources
|
|
201
|
+
```bash
|
|
202
|
+
ls {wiki_path}/raw/notes/ | wc -l # Đếm raw files
|
|
203
|
+
ls {wiki_path}/wiki/ | wc -l # Đếm wiki pages
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Bước 2: Chạy ingest script
|
|
207
|
+
Agent TRỰC TIẾP chạy (KHÔNG bắt user):
|
|
208
|
+
```bash
|
|
209
|
+
cd {wiki_path} && node scripts/ingest.js
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Bước 3: Verify kết quả
|
|
213
|
+
Với mỗi raw file đã xử lý:
|
|
214
|
+
- Source summary → `wiki/sources/`
|
|
215
|
+
- Entities extracted → `wiki/entities/`
|
|
216
|
+
- Concepts extracted → `wiki/concepts/`
|
|
217
|
+
- Cross-references thêm vào
|
|
218
|
+
|
|
219
|
+
#### Bước 4: Cập nhật index
|
|
220
|
+
```bash
|
|
221
|
+
cat {wiki_path}/wiki/INDEX.md # Verify index updated
|
|
222
|
+
cat {wiki_path}/wiki/LOG.md # Check log
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### QUAN TRỌNG
|
|
226
|
+
- **KHÔNG BAO GIỜ** sửa file trong `raw/`
|
|
227
|
+
- Trích dẫn nguồn: `[Nguồn: filename](../raw/path)`
|
|
228
|
+
- Nếu mâu thuẫn giữa sources → giữ cả hai, ghi rõ
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Sub-command: SCAN-CODE — Sinh wiki từ codebase
|
|
233
|
+
|
|
234
|
+
### Mục đích
|
|
235
|
+
Đọc code hiện có của dự án → sinh wiki notes cho tri thức chưa được document.
|
|
236
|
+
|
|
237
|
+
### Khi nào
|
|
238
|
+
- Dự án đã có sẵn code nhưng chưa có wiki
|
|
239
|
+
- Sau khi init-rules xong → scan-code để populate wiki
|
|
240
|
+
- Khi onboard member mới → document codebase nhanh
|
|
241
|
+
|
|
242
|
+
### Quy trình
|
|
243
|
+
|
|
244
|
+
#### Bước 1: Thu thập context
|
|
245
|
+
1. Đọc AGENTS.md → hiểu project overview
|
|
246
|
+
2. Đọc `.agent/rules/05-*-project-conventions.md` → conventions đã detect
|
|
247
|
+
3. Đọc `.evnict/config.yaml` → project structure
|
|
248
|
+
|
|
249
|
+
#### Bước 2: Scan source code
|
|
250
|
+
**Controllers:**
|
|
251
|
+
```bash
|
|
252
|
+
find src/ -name "*Controller.java" -type f 2>/dev/null
|
|
253
|
+
# hoặc Angular
|
|
254
|
+
find src/ -name "*.service.ts" -type f 2>/dev/null
|
|
255
|
+
```
|
|
256
|
+
→ Sinh wiki note cho mỗi API module:
|
|
257
|
+
- Endpoints list
|
|
258
|
+
- Request/Response format
|
|
259
|
+
- Auth requirements
|
|
260
|
+
|
|
261
|
+
**Services:**
|
|
262
|
+
→ Sinh wiki note cho business logic:
|
|
263
|
+
- Methods và mục đích
|
|
264
|
+
- Business rules enforced
|
|
265
|
+
- Dependencies
|
|
266
|
+
|
|
267
|
+
**Entities/DTOs:**
|
|
268
|
+
→ Sinh wiki note cho data model:
|
|
269
|
+
- Fields mapping
|
|
270
|
+
- Database tables
|
|
271
|
+
- Relationships
|
|
272
|
+
|
|
273
|
+
#### Bước 3: Đọc handoff files (nếu có)
|
|
274
|
+
```bash
|
|
275
|
+
ls .evnict/handoff/ 2>/dev/null
|
|
276
|
+
```
|
|
277
|
+
Kết hợp context từ BE/FE handoff.
|
|
278
|
+
|
|
279
|
+
#### Bước 4: Push tất cả vào wiki
|
|
280
|
+
Với mỗi note đã sinh → copy vào `raw/notes/`
|
|
281
|
+
Naming: `{domain}-{type}-{slug}.md`
|
|
282
|
+
|
|
283
|
+
#### Bước 5: Chạy ingest
|
|
284
|
+
```bash
|
|
285
|
+
cd {wiki_path} && node scripts/ingest.js
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### Bước 6: Report
|
|
289
|
+
```
|
|
290
|
+
📊 Scan-Code Results
|
|
291
|
+
═══════════════════════════════════
|
|
292
|
+
Scanned: {N} controllers, {M} services, {K} entities
|
|
293
|
+
Generated: {X} wiki notes
|
|
294
|
+
Topics: {list of domains/modules}
|
|
295
|
+
|
|
296
|
+
New wiki pages:
|
|
297
|
+
+ {domain}-api-{module}.md
|
|
298
|
+
+ {domain}-service-{module}.md
|
|
299
|
+
+ {domain}-model-{entity}.md
|
|
300
|
+
...
|
|
301
|
+
═══════════════════════════════════
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Bổ sung nghiệp vụ khi scan
|
|
305
|
+
Khi scan code và sinh wiki note:
|
|
306
|
+
1. ĐỌC code để HIỂU nghiệp vụ — suy ra "user có thể làm gì"
|
|
307
|
+
2. Từ validation rules → suy ra business rules (BR01, BR02...)
|
|
308
|
+
3. Từ foreign keys → suy ra liên kết chức năng
|
|
309
|
+
4. Từ auth checks → suy ra phân quyền
|
|
310
|
+
5. Đặt phần nghiệp vụ LÊN TRƯỚC, phần kỹ thuật SAU
|
|
311
|
+
6. Tỷ lệ: 50% nghiệp vụ + 50% kỹ thuật
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Sub-command: STATUS — Kiểm tra wiki health
|
|
316
|
+
|
|
317
|
+
### Output Format
|
|
318
|
+
```
|
|
319
|
+
📚 Wiki Status: {project_name}-wiki
|
|
320
|
+
══════════════════════════════════
|
|
321
|
+
Path: {wiki_path}
|
|
322
|
+
Raw sources: {N} files
|
|
323
|
+
Wiki pages: {M} pages
|
|
324
|
+
Last push: {date} ({file_name})
|
|
325
|
+
Last ingest: {date}
|
|
326
|
+
Health: ✅ Good | ⚠️ Warning | ❌ Needs Attention
|
|
327
|
+
|
|
328
|
+
Domains: {list unique domains}
|
|
329
|
+
Gaps: {list topics chưa có wiki}
|
|
330
|
+
══════════════════════════════════
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Health check rules
|
|
334
|
+
| Status | Condition |
|
|
335
|
+
|--------|-----------|
|
|
336
|
+
| ✅ Good | Raw đã ingest hết, wiki pages > 0 |
|
|
337
|
+
| ⚠️ Warning | Có raw chưa ingest, hoặc > 30 ngày chưa push |
|
|
338
|
+
| ❌ Needs Attention | Wiki rỗng, hoặc ingest lỗi |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Tích hợp vào các Workflow khác
|
|
343
|
+
|
|
344
|
+
Mỗi workflow khi hoàn thành PHẢI gợi ý wiki:
|
|
345
|
+
|
|
346
|
+
### feature-large / feature-small
|
|
347
|
+
Sau archive → **tự động push wiki → ingest**
|
|
348
|
+
|
|
349
|
+
### bug-fix
|
|
350
|
+
Sau fix xong → gợi ý:
|
|
351
|
+
```
|
|
352
|
+
💡 Bug fix hoàn thành. Bạn muốn thêm tri thức vào wiki không?
|
|
353
|
+
A) Có — tôi sẽ tóm tắt bug + fix → push wiki
|
|
354
|
+
B) Không — skip
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### attt
|
|
358
|
+
Sau fix ATTT → **tự động push wiki** (BẮT BUỘC — ATTT fix luôn cần document)
|
|
359
|
+
|
|
360
|
+
### init (lần đầu)
|
|
361
|
+
Sau init-rules + init-context xong → gợi ý:
|
|
362
|
+
```
|
|
363
|
+
💡 Project đã có code sẵn. Chạy scan-code để tạo wiki từ codebase?
|
|
364
|
+
A) Có — scan-code → push → ingest
|
|
365
|
+
B) Không — skip, tôi sẽ push thủ công sau
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Frontmatter Rules
|
|
371
|
+
|
|
372
|
+
### Required fields
|
|
373
|
+
| Field | Type | Description |
|
|
374
|
+
|-------|------|-------------|
|
|
375
|
+
| title | string | Tiêu đề ngắn gọn |
|
|
376
|
+
| discovered | string | YYYY-MM-DD (ngày tạo) |
|
|
377
|
+
| topic | string | Module/domain (customer, order, auth...) |
|
|
378
|
+
| tags | string[] | Auto-detected keywords |
|
|
379
|
+
| source | string | "evnict-kit-auto" hoặc "manual" |
|
|
380
|
+
| type | string | feature, bugfix, attt, architecture, convention |
|
|
381
|
+
|
|
382
|
+
### Optional fields
|
|
383
|
+
| Field | Type | Description |
|
|
384
|
+
|-------|------|-------------|
|
|
385
|
+
| url | string | URL tham chiếu (trống nếu internal) |
|
|
386
|
+
| related_specs | string[] | Paths to related spec files |
|
|
387
|
+
| deprecated | boolean | Đánh dấu nếu obsolete |
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Error Handling
|
|
392
|
+
|
|
393
|
+
### DỪNG khi:
|
|
394
|
+
- Wiki folder không tồn tại → *"Chạy `/evnict-kit:init-wiki` trước"*
|
|
395
|
+
- `node scripts/ingest.js` fail → Retry 1 lần → hiển thị error cụ thể
|
|
396
|
+
- Frontmatter thiếu required fields → KHÔNG push, sửa trước
|
|
397
|
+
|
|
398
|
+
### Auto-recovery:
|
|
399
|
+
- ingest fail lần 1 → retry lần 2
|
|
400
|
+
- scripts/ingest.js không tồn tại → thử npm run ingest
|
|
401
|
+
- npm run ingest fail → báo: "cd {wiki_path} && npm install"
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Tiêu chí hoàn thành
|
|
406
|
+
- [ ] File markdown tạo đúng format frontmatter (llm-wiki chuẩn)
|
|
407
|
+
- [ ] Nội dung đầy đủ (API, DB, BR, files, lessons)
|
|
408
|
+
- [ ] File đã copy vào `raw/notes/` đúng naming
|
|
409
|
+
- [ ] Ingest đã trigger TỰ ĐỘNG (node scripts/ingest.js)
|
|
410
|
+
- [ ] Query trả về results có format rõ ràng + gap detection
|
|
411
|
+
- [ ] scan-code sinh được wiki notes từ codebase
|
|
412
|
+
- [ ] Status cho health check chính xác
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# LLM Wiki — Knowledge Base
|
|
2
|
+
# Source: https://github.com/mduongvandinh/llm-wiki (MIT License)
|
|
3
|
+
|
|
4
|
+
Hệ thống quản lý kiến thức cho AI-assisted development.
|
|
5
|
+
|
|
6
|
+
## Cấu trúc
|
|
7
|
+
```
|
|
8
|
+
raw/notes/ ← Viết notes ở đây (markdown + frontmatter)
|
|
9
|
+
processed/ ← Auto-generated sau ingest
|
|
10
|
+
scripts/ ← Ingest, query scripts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Sử dụng
|
|
14
|
+
|
|
15
|
+
### Push note
|
|
16
|
+
Tạo file `raw/notes/{domain}-{slug}.md` với frontmatter:
|
|
17
|
+
```markdown
|
|
18
|
+
---
|
|
19
|
+
title: "Tiêu đề"
|
|
20
|
+
domain: "module-name"
|
|
21
|
+
type: feature | bugfix | architecture
|
|
22
|
+
date: 2026-01-01
|
|
23
|
+
tags: [tag1, tag2]
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Nội dung...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Ingest
|
|
30
|
+
```bash
|
|
31
|
+
npm run ingest
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Query
|
|
35
|
+
Search trong `processed/index.json` hoặc grep files.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# LLM Wiki Configuration
|
|
2
|
+
project: "{{PROJECT_NAME}}"
|
|
3
|
+
raw_path: "raw/notes"
|
|
4
|
+
processed_path: "processed"
|
|
5
|
+
index_path: "processed/index.json"
|
|
6
|
+
|
|
7
|
+
# Ingest settings
|
|
8
|
+
ingest:
|
|
9
|
+
auto: true
|
|
10
|
+
on_push: true
|
|
11
|
+
format: markdown
|
|
12
|
+
frontmatter: required
|
|
13
|
+
|
|
14
|
+
# Query settings
|
|
15
|
+
query:
|
|
16
|
+
search_type: keyword
|
|
17
|
+
max_results: 10
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "llm-wiki",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "LLM Wiki — Knowledge base for AI-assisted development",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"ingest": "node scripts/ingest.js",
|
|
8
|
+
"query": "node scripts/query.js",
|
|
9
|
+
"status": "node scripts/status.js"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "mduongvandinh",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/mduongvandinh/llm-wiki"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder — raw notes go here
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* LLM Wiki — Ingest Script
|
|
4
|
+
* Reads raw/notes/*.md → processes → outputs to processed/
|
|
5
|
+
*
|
|
6
|
+
* Source: https://github.com/mduongvandinh/llm-wiki
|
|
7
|
+
* License: MIT
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync, writeFileSync, readdirSync, existsSync, mkdirSync } from 'node:fs';
|
|
11
|
+
import { join, basename } from 'node:path';
|
|
12
|
+
|
|
13
|
+
const RAW_PATH = 'raw/notes';
|
|
14
|
+
const PROCESSED_PATH = 'processed';
|
|
15
|
+
const INDEX_PATH = join(PROCESSED_PATH, 'index.json');
|
|
16
|
+
|
|
17
|
+
// Ensure directories
|
|
18
|
+
if (!existsSync(PROCESSED_PATH)) mkdirSync(PROCESSED_PATH, { recursive: true });
|
|
19
|
+
|
|
20
|
+
// Read all markdown files
|
|
21
|
+
const files = existsSync(RAW_PATH)
|
|
22
|
+
? readdirSync(RAW_PATH).filter(f => f.endsWith('.md'))
|
|
23
|
+
: [];
|
|
24
|
+
|
|
25
|
+
console.log(`📚 Ingesting ${files.length} notes...`);
|
|
26
|
+
|
|
27
|
+
const index = [];
|
|
28
|
+
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
const content = readFileSync(join(RAW_PATH, file), 'utf8');
|
|
31
|
+
|
|
32
|
+
// Extract frontmatter
|
|
33
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
34
|
+
const frontmatter = {};
|
|
35
|
+
if (fmMatch) {
|
|
36
|
+
fmMatch[1].split('\n').forEach(line => {
|
|
37
|
+
const [key, ...val] = line.split(':');
|
|
38
|
+
if (key && val.length) frontmatter[key.trim()] = val.join(':').trim().replace(/^["']|["']$/g, '');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Extract body (after frontmatter)
|
|
43
|
+
const body = fmMatch ? content.slice(fmMatch[0].length).trim() : content;
|
|
44
|
+
|
|
45
|
+
// Create processed entry
|
|
46
|
+
const entry = {
|
|
47
|
+
file: file,
|
|
48
|
+
title: frontmatter.title || basename(file, '.md'),
|
|
49
|
+
domain: frontmatter.domain || 'general',
|
|
50
|
+
type: frontmatter.type || 'note',
|
|
51
|
+
date: frontmatter.date || new Date().toISOString().split('T')[0],
|
|
52
|
+
tags: frontmatter.tags ? frontmatter.tags.replace(/[\[\]]/g, '').split(',').map(t => t.trim()) : [],
|
|
53
|
+
summary: body.split('\n').filter(l => l.trim()).slice(0, 3).join(' ').slice(0, 200),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
index.push(entry);
|
|
57
|
+
|
|
58
|
+
// Copy processed file
|
|
59
|
+
writeFileSync(join(PROCESSED_PATH, file), content, 'utf8');
|
|
60
|
+
console.log(` ✅ ${file} → ${entry.title} (${entry.domain})`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Write index
|
|
64
|
+
writeFileSync(INDEX_PATH, JSON.stringify(index, null, 2), 'utf8');
|
|
65
|
+
console.log(`\n📋 Index: ${index.length} entries → ${INDEX_PATH}`);
|
|
66
|
+
console.log('✅ Ingest complete!');
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Archive workflow — summarize feature → push wiki → archive spec → tạo postmortem. Dùng sau khi implement xong và user đã review.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Archive + Wiki
|
|
6
|
+
**Command:** `/evnict-kit:archive-wiki`
|
|
7
|
+
|
|
8
|
+
## Khi nào dùng
|
|
9
|
+
- Sau khi implement xong
|
|
10
|
+
- User đã review code
|
|
11
|
+
- Cần archive spec + push kiến thức vào wiki
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
- Feature slug (auto-detect từ branch hoặc chỉ định)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Pre-checks (Danh sách kiểm định PHẢI pass trước khi chạy)
|
|
19
|
+
|
|
20
|
+
### Check 1: Wiki accessible
|
|
21
|
+
Agent thực hiện:
|
|
22
|
+
```bash
|
|
23
|
+
# Check symlink wiki tồn tại trong thư mục Root của Project
|
|
24
|
+
ls -la {project_name}-wiki/
|
|
25
|
+
```
|
|
26
|
+
Nếu không tồn tại → DỪNG VÀ BÁO LỖI:
|
|
27
|
+
*"Thư mục Wiki chưa được liên kết (symlink) vào project này. Vui lòng chạy lệnh evnict-kit init ở ngoài Workspace hoặc tạo symlink thủ công."*
|
|
28
|
+
|
|
29
|
+
### Check 2: Wiki Software đã setup
|
|
30
|
+
Agent thực hiện:
|
|
31
|
+
```bash
|
|
32
|
+
ls {project_name}-wiki/package.json
|
|
33
|
+
```
|
|
34
|
+
Nếu không tồn tại file package.json → DỪNG VÀ BÁO LỖI:
|
|
35
|
+
*"Thư mục Wiki chưa được khởi tạo thư viện Ingestion. Vui lòng chạy `/evnict-kit:init-wiki` trước."*
|
|
36
|
+
|
|
37
|
+
### Check 3: Read/Write Permissions
|
|
38
|
+
Agent thực hiện:
|
|
39
|
+
```bash
|
|
40
|
+
touch {project_name}-wiki/raw/notes/.test-write && rm {project_name}-wiki/raw/notes/.test-write
|
|
41
|
+
```
|
|
42
|
+
Nếu văng lỗi Permission Denied → DỪNG VÀ BÁO LỖI:
|
|
43
|
+
*"Không có quyền ghi vào thư mục Wiki. Vui lòng kiểm tra Administrator/Permissions trên MacOS/Windows."*
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Bước 1: Tóm tắt feature
|
|
48
|
+
Đọc:
|
|
49
|
+
- `.evnict/specs/{feature}/spec.md`
|
|
50
|
+
- `git log --oneline main..HEAD`
|
|
51
|
+
- `git diff --stat main..HEAD`
|
|
52
|
+
|
|
53
|
+
## Bước 2: Push wiki
|
|
54
|
+
Gọi skill `evnict-kit-wiki` action=push:
|
|
55
|
+
- Sinh markdown file với frontmatter chuẩn
|
|
56
|
+
- Copy vào `{wiki_path}/raw/notes/`
|
|
57
|
+
|
|
58
|
+
## Bước 3: Auto-ingest (THAY CHO npm run ingest thủ công)
|
|
59
|
+
Agent TRỰC TIẾP chạy:
|
|
60
|
+
```bash
|
|
61
|
+
cd {wiki_path} && node scripts/ingest.js
|
|
62
|
+
```
|
|
63
|
+
KHÔNG bắt user switch terminal hay chạy npm thủ công.
|
|
64
|
+
Nếu `scripts/ingest.js` không tồn tại → thử `npm run ingest`.
|
|
65
|
+
Nếu vẫn fail → báo: *"Chạy `/evnict-kit:init-wiki`"*
|
|
66
|
+
|
|
67
|
+
## Bước 4: Archive spec
|
|
68
|
+
```bash
|
|
69
|
+
cp -r .evnict/specs/{feature}/ docs/specs/{feature}/
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Bước 5: Tạo postmortem
|
|
73
|
+
Gọi skill `evnict-kit-doc-postmortem`:
|
|
74
|
+
- Tạo `docs/postmortem/{feature}-{date}.md`
|
|
75
|
+
- 7 sections theo QĐ-TTPM Mục 8.9
|
|
76
|
+
|
|
77
|
+
## Bước 6: Confirm
|
|
78
|
+
```
|
|
79
|
+
✅ Wiki updated: {wiki_path}/raw/notes/{file}
|
|
80
|
+
✅ Spec archived: docs/specs/{feature}/
|
|
81
|
+
✅ Postmortem: docs/postmortem/{feature}-{date}.md
|
|
82
|
+
✅ Ingest triggered
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Lưu ý
|
|
88
|
+
Workflow này là shortcut. Để nạp tri thức chi tiết hơn, dùng:
|
|
89
|
+
- `/evnict-kit:wiki-archive-feature` — nạp đầy đủ từ spec+plan+code
|
|
90
|
+
- `/evnict-kit:wiki-scan-project` — scan toàn bộ codebase
|
|
91
|
+
- `/evnict-kit:wiki-query` — truy vấn tri thức
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Checklist
|
|
96
|
+
- [ ] Feature summarized
|
|
97
|
+
- [ ] Wiki pushed
|
|
98
|
+
- [ ] Ingest triggered
|
|
99
|
+
- [ ] Spec archived to docs/
|
|
100
|
+
- [ ] Postmortem created (nếu > 20 dòng code)
|