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.
Files changed (138) hide show
  1. package/README.md +19 -0
  2. package/bin/cli.js +38 -0
  3. package/package.json +48 -0
  4. package/src/commands/add.js +129 -0
  5. package/src/commands/init-check.js +19 -0
  6. package/src/commands/init-context.js +37 -0
  7. package/src/commands/init-rules.js +42 -0
  8. package/src/commands/init-workflow.js +36 -0
  9. package/src/commands/init.js +722 -0
  10. package/src/utils/config.js +167 -0
  11. package/src/utils/file.js +53 -0
  12. package/templates/GETTING-STARTED.md +196 -0
  13. package/templates/content/context/AGENTS.md.template +462 -0
  14. package/templates/content/rules/01-evnict-kit-general-rules.md +303 -0
  15. package/templates/content/rules/02-evnict-kit-security-rules.md +423 -0
  16. package/templates/content/rules/03-evnict-kit-backend-conventions.md +383 -0
  17. package/templates/content/rules/04-evnict-kit-frontend-conventions.md +402 -0
  18. package/templates/content/rules/05-evnict-kit-project-conventions.md +228 -0
  19. package/templates/content/skills/evnict-kit-brainstorm/SKILL.md +140 -0
  20. package/templates/content/skills/evnict-kit-bug-fix/SKILL.md +108 -0
  21. package/templates/content/skills/evnict-kit-checkpoint/SKILL.md +156 -0
  22. package/templates/content/skills/evnict-kit-code-review/SKILL.md +158 -0
  23. package/templates/content/skills/evnict-kit-coordinate/SKILL.md +274 -0
  24. package/templates/content/skills/evnict-kit-create-api/SKILL.md +281 -0
  25. package/templates/content/skills/evnict-kit-create-component/SKILL.md +263 -0
  26. package/templates/content/skills/evnict-kit-create-page/SKILL.md +247 -0
  27. package/templates/content/skills/evnict-kit-database-migration/SKILL.md +164 -0
  28. package/templates/content/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
  29. package/templates/content/skills/evnict-kit-finish-branch/SKILL.md +87 -0
  30. package/templates/content/skills/evnict-kit-fix-attt/SKILL.md +129 -0
  31. package/templates/content/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
  32. package/templates/content/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
  33. package/templates/content/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
  34. package/templates/content/skills/evnict-kit-onboard/SKILL.md +143 -0
  35. package/templates/content/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
  36. package/templates/content/skills/evnict-kit-receiving-review/SKILL.md +89 -0
  37. package/templates/content/skills/evnict-kit-security-audit/SKILL.md +190 -0
  38. package/templates/content/skills/evnict-kit-spec/SKILL.md +237 -0
  39. package/templates/content/skills/evnict-kit-tdd/SKILL.md +413 -0
  40. package/templates/content/skills/evnict-kit-wiki/SKILL.md +412 -0
  41. package/templates/content/workflows/evnict-kit-archive-wiki.md +100 -0
  42. package/templates/content/workflows/evnict-kit-attt.md +100 -0
  43. package/templates/content/workflows/evnict-kit-bug-fix.md +107 -0
  44. package/templates/content/workflows/evnict-kit-feature-large.md +393 -0
  45. package/templates/content/workflows/evnict-kit-feature-small.md +86 -0
  46. package/templates/content/workflows/evnict-kit-handoff.md +243 -0
  47. package/templates/content/workflows/evnict-kit-implement.md +247 -0
  48. package/templates/content/workflows/evnict-kit-init-check.md +76 -0
  49. package/templates/content/workflows/evnict-kit-init-context.md +58 -0
  50. package/templates/content/workflows/evnict-kit-init-rules.md +114 -0
  51. package/templates/content/workflows/evnict-kit-init-wiki.md +80 -0
  52. package/templates/content/workflows/evnict-kit-plan.md +308 -0
  53. package/templates/content/workflows/evnict-kit-review.md +53 -0
  54. package/templates/content/workflows/evnict-kit-spec-archive.md +53 -0
  55. package/templates/content/workflows/evnict-kit-wiki-archive-feature.md +164 -0
  56. package/templates/content/workflows/evnict-kit-wiki-query.md +91 -0
  57. package/templates/content/workflows/evnict-kit-wiki-scan-project.md +272 -0
  58. package/templates/context/AGENT.md.template +9 -0
  59. package/templates/context/AGENTS.md.template +462 -0
  60. package/templates/context/CLAUDE.md.template +301 -0
  61. package/templates/context/copilot-instructions.md.template +60 -0
  62. package/templates/context/cursorrules.template +114 -0
  63. package/templates/instruct/Instruct-Agent-AI.be.md +96 -0
  64. package/templates/instruct/Instruct-Agent-AI.fe.md +79 -0
  65. package/templates/rules/antigravity/01-evnict-kit-general-rules.md +303 -0
  66. package/templates/rules/antigravity/02-evnict-kit-security-rules.md +423 -0
  67. package/templates/rules/antigravity/03-evnict-kit-backend-conventions.md +383 -0
  68. package/templates/rules/antigravity/04-evnict-kit-frontend-conventions.md +402 -0
  69. package/templates/rules/antigravity/05-evnict-kit-project-conventions.md +228 -0
  70. package/templates/rules/claude/README.md +8 -0
  71. package/templates/rules/cursor/01-evnict-kit-general-rules.mdc +46 -0
  72. package/templates/rules/cursor/02-evnict-kit-security-rules.mdc +46 -0
  73. package/templates/rules/cursor/03-evnict-kit-backend-conventions.mdc +50 -0
  74. package/templates/rules/cursor/04-evnict-kit-frontend-conventions.mdc +43 -0
  75. package/templates/rules/cursor/05-evnict-kit-project-conventions.mdc +63 -0
  76. package/templates/rules/cursor/README.md +7 -0
  77. package/templates/skills/evnict-kit-brainstorm/SKILL.md +140 -0
  78. package/templates/skills/evnict-kit-bug-fix/SKILL.md +108 -0
  79. package/templates/skills/evnict-kit-checkpoint/SKILL.md +156 -0
  80. package/templates/skills/evnict-kit-code-review/SKILL.md +158 -0
  81. package/templates/skills/evnict-kit-coordinate/SKILL.md +274 -0
  82. package/templates/skills/evnict-kit-create-api/SKILL.md +281 -0
  83. package/templates/skills/evnict-kit-create-component/SKILL.md +263 -0
  84. package/templates/skills/evnict-kit-create-page/SKILL.md +247 -0
  85. package/templates/skills/evnict-kit-database-migration/SKILL.md +164 -0
  86. package/templates/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
  87. package/templates/skills/evnict-kit-finish-branch/SKILL.md +87 -0
  88. package/templates/skills/evnict-kit-fix-attt/SKILL.md +129 -0
  89. package/templates/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
  90. package/templates/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
  91. package/templates/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
  92. package/templates/skills/evnict-kit-onboard/SKILL.md +143 -0
  93. package/templates/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
  94. package/templates/skills/evnict-kit-receiving-review/SKILL.md +89 -0
  95. package/templates/skills/evnict-kit-security-audit/SKILL.md +190 -0
  96. package/templates/skills/evnict-kit-spec/SKILL.md +237 -0
  97. package/templates/skills/evnict-kit-tdd/SKILL.md +413 -0
  98. package/templates/skills/evnict-kit-wiki/SKILL.md +412 -0
  99. package/templates/wiki/README.md +35 -0
  100. package/templates/wiki/config.example.yaml +17 -0
  101. package/templates/wiki/package.json +17 -0
  102. package/templates/wiki/raw/notes/.gitkeep +1 -0
  103. package/templates/wiki/scripts/ingest.js +66 -0
  104. package/templates/workflows/antigravity/evnict-kit-archive-wiki.md +100 -0
  105. package/templates/workflows/antigravity/evnict-kit-attt.md +100 -0
  106. package/templates/workflows/antigravity/evnict-kit-bug-fix.md +107 -0
  107. package/templates/workflows/antigravity/evnict-kit-feature-large.md +393 -0
  108. package/templates/workflows/antigravity/evnict-kit-feature-small.md +86 -0
  109. package/templates/workflows/antigravity/evnict-kit-handoff.md +243 -0
  110. package/templates/workflows/antigravity/evnict-kit-implement.md +247 -0
  111. package/templates/workflows/antigravity/evnict-kit-init-check.md +76 -0
  112. package/templates/workflows/antigravity/evnict-kit-init-context.md +58 -0
  113. package/templates/workflows/antigravity/evnict-kit-init-rules.md +114 -0
  114. package/templates/workflows/antigravity/evnict-kit-init-wiki.md +80 -0
  115. package/templates/workflows/antigravity/evnict-kit-plan.md +308 -0
  116. package/templates/workflows/antigravity/evnict-kit-review.md +53 -0
  117. package/templates/workflows/antigravity/evnict-kit-spec-archive.md +53 -0
  118. package/templates/workflows/antigravity/evnict-kit-wiki-archive-feature.md +164 -0
  119. package/templates/workflows/antigravity/evnict-kit-wiki-query.md +91 -0
  120. package/templates/workflows/antigravity/evnict-kit-wiki-scan-project.md +272 -0
  121. package/templates/workflows/claude/README.md +6 -0
  122. package/templates/workflows/claude/evnict-kit-archive-wiki.md +98 -0
  123. package/templates/workflows/claude/evnict-kit-attt.md +98 -0
  124. package/templates/workflows/claude/evnict-kit-bug-fix.md +105 -0
  125. package/templates/workflows/claude/evnict-kit-feature-large.md +391 -0
  126. package/templates/workflows/claude/evnict-kit-feature-small.md +84 -0
  127. package/templates/workflows/claude/evnict-kit-handoff.md +240 -0
  128. package/templates/workflows/claude/evnict-kit-implement.md +245 -0
  129. package/templates/workflows/claude/evnict-kit-init-check.md +74 -0
  130. package/templates/workflows/claude/evnict-kit-init-context.md +56 -0
  131. package/templates/workflows/claude/evnict-kit-init-rules.md +112 -0
  132. package/templates/workflows/claude/evnict-kit-init-wiki.md +78 -0
  133. package/templates/workflows/claude/evnict-kit-plan.md +305 -0
  134. package/templates/workflows/claude/evnict-kit-review.md +51 -0
  135. package/templates/workflows/claude/evnict-kit-spec-archive.md +51 -0
  136. package/templates/workflows/claude/evnict-kit-wiki-archive-feature.md +162 -0
  137. package/templates/workflows/claude/evnict-kit-wiki-query.md +89 -0
  138. package/templates/workflows/claude/evnict-kit-wiki-scan-project.md +270 -0
@@ -0,0 +1,164 @@
1
+ ---
2
+ description: Nạp tri thức từ feature đã hoàn thành vào wiki — đọc spec, plan, task files, code changes → sinh wiki notes → auto-ingest
3
+ ---
4
+
5
+ # Wiki Archive Feature
6
+ **Command:** `/evnict-kit:wiki-archive-feature`
7
+
8
+ ## Khi nào dùng
9
+ - Sau khi hoàn thành feature-large hoặc feature-small
10
+ - Sau khi `/evnict-kit:archive-wiki` chạy xong (hoặc thay thế archive-wiki)
11
+ - Khi muốn nạp tri thức thủ công cho 1 feature cụ thể
12
+
13
+ ## Input
14
+ - Feature slug (auto-detect từ `.evnict/specs/` gần nhất hoặc chỉ định)
15
+
16
+ ---
17
+
18
+ ## Pre-checks
19
+
20
+ ### Check 1: Wiki accessible
21
+ ```bash
22
+ ls -la {project_name}-wiki/
23
+ ```
24
+ Nếu không tồn tại → DỪNG: *"Wiki chưa được liên kết. Chạy `evnict-kit init` hoặc tạo symlink thủ công."*
25
+
26
+ ### Check 2: Wiki đã setup
27
+ ```bash
28
+ ls {project_name}-wiki/package.json
29
+ ```
30
+ Nếu không tồn tại → DỪNG: *"Wiki chưa khởi tạo. Chạy `/evnict-kit:init-wiki` trước."*
31
+
32
+ ---
33
+
34
+ ## Bước 1: Thu thập đầu vào
35
+ Đọc TẤT CẢ files liên quan đến feature:
36
+
37
+ | Nguồn | Path | Nội dung trích xuất |
38
+ |-------|------|---------------------|
39
+ | Spec | `.evnict/specs/{feature}/spec.md` | WHAT, WHY, Business Rules, Acceptance Criteria |
40
+ | Plan | `.evnict/specs/{feature}/plan.md` | DB Schema, API Design, FE Design, Task breakdown |
41
+ | Task files | `.evnict/specs/{feature}/tasks/*.md` | Implementation details, test cases |
42
+ | API Contract | `.evnict/handoff/contracts/{feature}-api.yaml` | Endpoints, request/response |
43
+ | Git log | `git log --oneline main..HEAD` | Commits, files changed |
44
+ | Handoff | `.evnict/handoff/handoff.md` | Cross-project context (entries liên quan feature) |
45
+
46
+ > **Nếu file nào không tồn tại → bỏ qua nguồn đó, KHÔNG dừng.**
47
+
48
+ ## Bước 2: Sinh wiki note
49
+ Tạo file markdown HOÀN CHỈNH (không phải tóm tắt sơ sài):
50
+
51
+ ```markdown
52
+ ---
53
+ title: "Chức năng {feature_name}"
54
+ discovered: {YYYY-MM-DD}
55
+ topic: "{module}"
56
+ tags: [{feature, module, api, database}]
57
+ source: "evnict-kit-auto"
58
+ type: feature
59
+ ---
60
+
61
+ # ═══ PHẦN NGHIỆP VỤ ═══
62
+
63
+ ## Tổng quan
64
+ {Trích từ spec: WHAT + WHY — 5-10 câu}
65
+
66
+ ## Mục đích chức năng
67
+ {Chức năng này giải quyết vấn đề gì cho user? — 3-5 câu}
68
+ {Suy ra từ spec WHAT/WHY + code implementation}
69
+
70
+ ## Đối tượng sử dụng
71
+ {Ai dùng? Role nào? Quyền gì?}
72
+ {Suy ra từ: spec, auth annotations, role checks}
73
+
74
+ ## Nghiệp vụ chính
75
+ ### Luồng chính
76
+ {Trích từ spec: Main Flow}
77
+
78
+ ### Luồng ngoại lệ
79
+ {Trích từ spec: Exception Flow}
80
+
81
+ ### Nhập/Thêm mới
82
+ - {Mô tả hành vi, fields cần nhập, ràng buộc}
83
+
84
+ ### Danh sách/Tìm kiếm
85
+ - {Mô tả filters, phân trang, sort}
86
+
87
+ ### Sửa/Cập nhật
88
+ - {Mô tả}
89
+
90
+ ### Xóa
91
+ - {Mô tả, confirm logic}
92
+
93
+ ## Quy tắc nghiệp vụ
94
+ | Mã | Quy tắc |
95
+ |----|---------|
96
+ | BR01 | {Trích từ spec + suy ra từ validation logic} |
97
+ | BR02 | {Suy ra từ unique constraints, foreign keys} |
98
+ | BR03 | {Suy ra từ authorization checks} |
99
+
100
+ ## Liên kết chức năng
101
+ {Module này liên quan đến module nào khác?}
102
+ {Suy ra từ: foreign keys, service dependencies, shared DTOs}
103
+ - **{Module A}**: {mô tả liên kết}
104
+ - **{Module B}**: {mô tả liên kết}
105
+
106
+ # ═══ PHẦN KỸ THUẬT ═══
107
+
108
+ ## Database
109
+ {Trích từ plan: tables, columns, relationships}
110
+
111
+ ## API Endpoints
112
+ | Method | Path | Mô tả |
113
+ |--------|------|-------|
114
+ {Trích từ plan hoặc API contract}
115
+
116
+ ## Backend
117
+ - Controller: {file, endpoints}
118
+ - Service: {file, business logic}
119
+ - Repository: {file, JOOQ queries}
120
+ - DTO: {file, fields}
121
+
122
+ ## Frontend
123
+ - Component: {file, mô tả}
124
+ - Service: {file, API calls}
125
+ - Page: {route, mô tả}
126
+
127
+ ## Files liên quan
128
+ {List files created/modified — từ git diff}
129
+
130
+ ## Tham chiếu
131
+ - Spec: `.evnict/specs/{feature}/spec.md`
132
+ - Plan: `.evnict/specs/{feature}/plan.md`
133
+ - API Contract: `.evnict/handoff/contracts/{feature}-api.yaml`
134
+ ```
135
+
136
+ ## Bước 3: Push + Auto-ingest
137
+ ```bash
138
+ cp {generated_file} {wiki_path}/raw/notes/{module}-{feature-slug}.md
139
+ cd {wiki_path} && node scripts/ingest.js
140
+ ```
141
+ Nếu `scripts/ingest.js` không tồn tại → thử `npm run ingest`.
142
+ Nếu vẫn fail → báo: *"Chạy `/evnict-kit:init-wiki`"*
143
+
144
+ ## Bước 4: Confirm
145
+ ```
146
+ ✅ Wiki note created: {wiki_path}/raw/notes/{file}
147
+ Nội dung: {N} sections, {M} API endpoints, {K} business rules
148
+ ✅ Ingest completed
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Lưu ý
154
+ - Workflow này thay thế phần wiki trong `/evnict-kit:archive-wiki`
155
+ - Wiki note PHẢI hoàn chỉnh — không chỉ tóm tắt 3-5 câu
156
+ - Nếu feature có cả BE+FE → ghi đủ cả 2 phần (Backend + Frontend)
157
+ - Nếu thiếu thông tin FE/BE → ghi phần có, note phần thiếu
158
+
159
+ ## Checklist hoàn thành
160
+ - [ ] Đọc đủ nguồn (spec, plan, tasks, contract, git log)
161
+ - [ ] Wiki note sinh đúng format frontmatter
162
+ - [ ] Đủ sections: Tổng quan, Nghiệp vụ, Kỹ thuật, Files, Tham chiếu
163
+ - [ ] File copied vào `raw/notes/`
164
+ - [ ] Ingest triggered thành công
@@ -0,0 +1,91 @@
1
+ ---
2
+ description: Truy vấn tri thức từ wiki — tìm kiếm theo keyword, domain, tags. Trả context cho Agent sử dụng.
3
+ ---
4
+
5
+ # Wiki Query
6
+ **Command:** `/evnict-kit:wiki-query "từ khóa"`
7
+
8
+ ## Khi nào dùng
9
+ - Trước khi bắt đầu feature mới → tìm context liên quan
10
+ - Khi fix bug → tìm thông tin chức năng bị bug
11
+ - Khi cần hiểu business rule → tìm trong wiki
12
+ - Khi onboard → tìm hiểu module
13
+
14
+ ## Input
15
+ - Từ khóa tìm kiếm (tiếng Việt hoặc tiếng Anh)
16
+ - VD: `/evnict-kit:wiki-query "công suất giờ"`
17
+ - VD: `/evnict-kit:wiki-query "API import CSV"`
18
+
19
+ ---
20
+
21
+ ## Bước 1: Xác định wiki path
22
+ 1. Check symlink `{project_name}-wiki/` trong thư mục gốc project
23
+ 2. Nếu không tồn tại → đọc `.evnict/config.yaml` → lấy `wiki.folder`
24
+ 3. Nếu vẫn không tìm thấy → DỪNG: *"Wiki chưa được liên kết. Chạy `evnict-kit init`."*
25
+
26
+ ## Bước 2: Search
27
+ 1. Đọc `{wiki_path}/wiki/INDEX.md` → map keywords (nếu INDEX tồn tại)
28
+ 2. Search trong `{wiki_path}/processed/` và `{wiki_path}/raw/notes/`:
29
+ ```bash
30
+ grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md"
31
+ grep -rl "{keyword}" {wiki_path}/raw/notes/ --include="*.md"
32
+ ```
33
+ 3. Đọc các pages liên quan (đọc ĐỦ nội dung, không chỉ 1-2 trang)
34
+ 4. Nếu keyword không khớp chính xác → thử tìm kiếm mở rộng:
35
+ - Tách keyword thành từ đơn
36
+ - Tìm theo domain/topic trong frontmatter
37
+ - Tìm theo tags
38
+
39
+ ## Bước 3: Trả kết quả
40
+ ```
41
+ 📚 Wiki Query: "{keyword}"
42
+ ═══════════════════════════
43
+ Tìm thấy {N} trang liên quan:
44
+
45
+ 1. {page_name} — {1 dòng mô tả}
46
+ Tags: {tags}
47
+
48
+ 2. {page_name} — {1 dòng mô tả}
49
+ Tags: {tags}
50
+
51
+ ───────────────────────────
52
+ ## Context trích xuất:
53
+ {Tổng hợp nội dung liên quan từ các trang — đây là phần QUAN TRỌNG NHẤT}
54
+
55
+ ## Nguồn:
56
+ - {wiki_path}/processed/{page_1}.md
57
+ - {wiki_path}/raw/notes/{page_2}.md
58
+ ```
59
+
60
+ Nếu KHÔNG tìm thấy kết quả:
61
+ ```
62
+ 📚 Wiki Query: "{keyword}"
63
+ ═══════════════════════════
64
+ Không tìm thấy trang nào liên quan.
65
+
66
+ 💡 Gợi ý:
67
+ - Thử từ khóa khác (tiếng Việt/Anh)
68
+ - Nạp thêm tri thức: /evnict-kit:wiki-scan-project
69
+ - Wiki có thể trống — kiểm tra: ls {wiki_path}/raw/notes/
70
+ ```
71
+
72
+ ## Bước 4: Lưu synthesis (nếu phân tích sâu)
73
+ Nếu query dẫn đến so sánh/phân tích giữa nhiều trang:
74
+ 1. Tổng hợp thành 1 synthesis document
75
+ 2. Lưu vào `{wiki_path}/wiki/syntheses/{keyword-slug}-{date}.md`
76
+ 3. Thông báo: "Đã lưu tổng hợp vào syntheses/"
77
+
78
+ ---
79
+
80
+ ## Lưu ý
81
+ - Query KHÔNG sửa wiki — chỉ đọc
82
+ - Context trích xuất PHẢI đủ chi tiết để Agent sử dụng được
83
+ - Nếu trang wiki bị thiếu/cũ → gợi ý user chạy `/evnict-kit:wiki-archive-feature` hoặc `/evnict-kit:wiki-scan-project`
84
+ - Workflow này được gọi TỰ ĐỘNG bởi các workflow khác (feature-large, feature-small, bug-fix) ở bước đầu tiên
85
+
86
+ ## Checklist hoàn thành
87
+ - [ ] Wiki path xác định
88
+ - [ ] Search hoàn tất
89
+ - [ ] Context trích xuất đầy đủ
90
+ - [ ] Kết quả trả về cho Agent/User
91
+ - [ ] Synthesis lưu (nếu có phân tích sâu)
@@ -0,0 +1,272 @@
1
+ ---
2
+ description: Scan toàn bộ code BE+FE → sinh wiki notes cho mỗi module/chức năng. Dùng handoff để kết hợp tri thức từ cả 2 project.
3
+ ---
4
+
5
+ # Wiki Scan Project
6
+ **Command:** `/evnict-kit:wiki-scan-project`
7
+
8
+ ## Khi nào dùng
9
+ - Mới init evnict-kit cho dự án có sẵn code
10
+ - Dự án chưa có wiki hoặc wiki trống
11
+ - Muốn populate wiki ban đầu từ codebase
12
+
13
+ ## Input
14
+ - Không cần input — tự detect project type
15
+
16
+ ---
17
+
18
+ ## Pre-checks
19
+
20
+ ### Check 1: Wiki accessible
21
+ ```bash
22
+ ls -la {project_name}-wiki/
23
+ ```
24
+ Nếu không tồn tại → DỪNG: *"Wiki chưa được liên kết. Chạy `evnict-kit init` hoặc tạo symlink thủ công."*
25
+
26
+ ### Check 2: Wiki đã setup
27
+ ```bash
28
+ ls {project_name}-wiki/package.json
29
+ ```
30
+ Nếu không tồn tại → DỪNG: *"Wiki chưa khởi tạo. Chạy `/evnict-kit:init-wiki` trước."*
31
+
32
+ ---
33
+
34
+ ## Bước 1: Detect project type
35
+ Đang ở BE hay FE?
36
+ - Có `pom.xml` hoặc `build.gradle` → **Backend**
37
+ - Có `angular.json` → **Frontend (Angular)**
38
+ - Có `package.json` + react dependency → **Frontend (React)**
39
+
40
+ ---
41
+
42
+ ## Bước 2: Scan code theo project type
43
+
44
+ ### Nếu BACKEND:
45
+ 1. **Đọc Controllers** → liệt kê tất cả API endpoints theo module
46
+ ```bash
47
+ find src/ -name "*Controller.java" -type f
48
+ ```
49
+ Với mỗi Controller: đọc file, trích `@RequestMapping`, `@GetMapping`, `@PostMapping`...
50
+
51
+ 2. **Đọc Services** → liệt kê business logic, validations
52
+ ```bash
53
+ find src/ -name "*Service.java" -o -name "*ServiceImpl.java" -type f
54
+ ```
55
+
56
+ 3. **Đọc Repositories/DAOs** → liệt kê database queries, tables sử dụng
57
+ ```bash
58
+ find src/ -name "*Repository.java" -o -name "*Dao.java" -o -name "*DAO.java" -type f
59
+ ```
60
+
61
+ 4. **Đọc DTOs/Entities** → liệt kê data models, fields
62
+ ```bash
63
+ find src/ -name "*DTO.java" -o -name "*Entity.java" -type f
64
+ ```
65
+
66
+ 5. **Đọc Configurations** → liệt kê external integrations
67
+ ```bash
68
+ find src/ -name "*Config.java" -o -name "application*.yml" -o -name "application*.properties" -type f
69
+ ```
70
+
71
+ ### Nếu FRONTEND (Angular):
72
+ 1. **Đọc Modules** → liệt kê feature modules
73
+ ```bash
74
+ find src/ -name "*.module.ts" -type f
75
+ ```
76
+
77
+ 2. **Đọc Components** → liệt kê pages, shared components
78
+ ```bash
79
+ find src/ -name "*.component.ts" -type f
80
+ ```
81
+
82
+ 3. **Đọc Services** → liệt kê API calls, state management
83
+ ```bash
84
+ find src/ -name "*.service.ts" -type f
85
+ ```
86
+
87
+ 4. **Đọc Routing** → liệt kê routes, menu structure
88
+ ```bash
89
+ find src/ -name "*routing*.ts" -o -name "*routes*.ts" -type f
90
+ ```
91
+
92
+ 5. **Đọc Models/Interfaces** → liệt kê TypeScript types
93
+ ```bash
94
+ find src/ -name "*.model.ts" -o -name "*.interface.ts" -type f
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Bước 3: Nhóm theo module
100
+ Phân tích kết quả scan → nhóm files theo module/chức năng.
101
+ Mỗi module CÓ THỂ bao gồm: Controller + Service + Repository + DTO + Component + Page.
102
+
103
+ ---
104
+
105
+ ## Bước 4: Sinh wiki notes — MỖI MODULE 1 FILE
106
+
107
+ Với mỗi module, tạo file:
108
+ ```markdown
109
+ ---
110
+ title: "Module {module_name}"
111
+ discovered: {YYYY-MM-DD}
112
+ topic: "{project_name}"
113
+ tags: [{module, project_type, tech_stack}]
114
+ source: "evnict-kit-scan"
115
+ type: module
116
+ ---
117
+
118
+ # ═══ PHẦN NGHIỆP VỤ ═══
119
+
120
+ ## Mục đích chức năng
121
+ {Chức năng này giải quyết vấn đề gì cho user? — 3-5 câu}
122
+ {Agent ĐỌC code (controller methods, service logic) rồi SUY RA mục đích}
123
+
124
+ ## Đối tượng sử dụng
125
+ {Ai dùng? Role nào? Quyền gì?}
126
+ {Suy ra từ: auth annotations, data authorization logic, role checks}
127
+
128
+ ## Nghiệp vụ chính
129
+ {Mô tả TỪNG thao tác user có thể làm — nhập, sửa, xóa, tìm, xuất...}
130
+ {Suy ra từ: controller endpoints + service methods}
131
+
132
+ ### Nhập/Thêm mới
133
+ - {Mô tả hành vi, fields cần nhập, ràng buộc}
134
+
135
+ ### Danh sách/Tìm kiếm
136
+ - {Mô tả filters, phân trang, sort}
137
+
138
+ ### Sửa/Cập nhật
139
+ - {Mô tả}
140
+
141
+ ### Xóa
142
+ - {Mô tả, confirm logic}
143
+
144
+ ## Quy tắc nghiệp vụ
145
+ | Mã | Quy tắc |
146
+ |----|---------|
147
+ | BR01 | {Suy ra từ validation logic trong service/controller} |
148
+ | BR02 | {Suy ra từ unique constraints, foreign keys} |
149
+ | BR03 | {Suy ra từ authorization checks} |
150
+
151
+ ## Liên kết chức năng
152
+ {Module này liên quan đến module nào khác?}
153
+ {Suy ra từ: foreign keys, service dependencies, shared DTOs}
154
+ - **{Module A}**: {mô tả liên kết — VD: dropdown lấy từ danh mục đơn vị}
155
+ - **{Module B}**: {mô tả liên kết}
156
+
157
+ # ═══ PHẦN KỸ THUẬT ═══
158
+
159
+ ## API Endpoints
160
+ | Method | Path | Mô tả |
161
+ |--------|------|-------|
162
+ | {method} | {path} | {description từ annotation/comment} |
163
+
164
+ ## Database Tables
165
+ {Tables sử dụng trong Repository/DAO}
166
+
167
+ ## Services
168
+ {List services + public methods}
169
+
170
+ ## Components (nếu FE)
171
+ | Component | Route | Mô tả |
172
+ |-----------|-------|-------|
173
+ | {name} | {route} | {description} |
174
+
175
+ ## Files
176
+ {List all files thuộc module}
177
+ ```
178
+
179
+ ### Hướng dẫn viết phần Nghiệp vụ
180
+
181
+ Agent PHẢI đọc code rồi SUY RA nghiệp vụ, KHÔNG chỉ liệt kê code:
182
+
183
+ | Đọc code | Suy ra nghiệp vụ |
184
+ |----------|-------------------|
185
+ | Controller có POST /save + validation | → "Nhập mới: cần điền fields X, Y, Z. Validate: X bắt buộc, Y <= today" |
186
+ | Service check duplicate(dept+profile+date) | → "BR01: Không nhập trùng bộ key (Đơn vị + Profile + Ngày)" |
187
+ | Repository query filter by departmentId | → "Danh sách: lọc theo đơn vị" |
188
+ | Auth annotation @PreAuthorize | → "Phân quyền: chỉ role ADMIN được xóa" |
189
+ | FK đến bảng LRS_DEPARTMENT | → "Liên kết: dropdown chọn đơn vị từ danh mục" |
190
+ | Service gọi ExternalAPI (CMIS) | → "Tích hợp: upload file qua hệ thống CMIS" |
191
+
192
+ Mục tiêu: người đọc wiki note HIỂU ĐƯỢC chức năng làm gì MÀ KHÔNG CẦN đọc code.
193
+ Phần kỹ thuật bên dưới để Agent AI tra cứu khi cần implement.
194
+
195
+ Thêm 2 file đặc biệt:
196
+ - `{project_name}-architecture.md` — Kiến trúc tổng thể (tech stack, security, dual schema nếu có)
197
+ - `{project_name}-api-catalog.md` — Catalog toàn bộ API endpoints (nếu BE)
198
+
199
+ ---
200
+
201
+ ## Bước 5: Handoff cho project còn lại
202
+ Nếu feature cần cả BE+FE:
203
+
204
+ **Sinh handoff request:**
205
+ ```
206
+ ┌─────────────────────────────────────────────────┐
207
+ │ 📋 Wiki Scan — Cần bổ sung từ {FE/BE} │
208
+ │ │
209
+ │ Tôi đã scan project {BE/FE} và sinh {N} notes. │
210
+ │ Để wiki đầy đủ, cần scan thêm project {FE/BE}.│
211
+ │ │
212
+ │ 👉 Mở AI Agent trong project {FE/BE}, chạy: │
213
+ │ /evnict-kit:wiki-scan-project │
214
+ │ │
215
+ │ Agent sẽ đọc handoff và kết hợp tri thức. │
216
+ └─────────────────────────────────────────────────┘
217
+ ```
218
+
219
+ Append vào `.evnict/handoff/handoff.md`:
220
+ ```markdown
221
+ ### [{YYYY-MM-DD}] {BE/FE}→{FE/BE}: Wiki Scan — Cần bổ sung
222
+ - **Trạng thái:** 🔴 Chờ xử lý
223
+ - **Mô tả:** Đã scan project {BE/FE} và sinh {N} wiki notes. Cần scan thêm project {FE/BE} để wiki đầy đủ.
224
+ - **Đã scan:** {N} modules, {M} API endpoints, {K} components
225
+ - **Wiki notes đã tạo:** {list files}
226
+ - **Mong muốn:** Scan {FE/BE} project, kết hợp với notes {BE/FE} để tạo bức tranh toàn diện
227
+ - **Kết quả xử lý:** _(Agent bên kia điền sau khi scan xong)_
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Bước 6: Auto-ingest
233
+ ```bash
234
+ cd {wiki_path} && node scripts/ingest.js
235
+ ```
236
+ Nếu `scripts/ingest.js` không tồn tại → thử `npm run ingest`.
237
+ Nếu vẫn fail → báo: *"Chạy `/evnict-kit:init-wiki`"*
238
+
239
+ ---
240
+
241
+ ## Bước 7: Status report
242
+ ```
243
+ 📚 Wiki Scan Report
244
+ ═══════════════════════
245
+ Scanned: {type} project ({N} files đọc)
246
+ Generated: {M} wiki notes
247
+ Modules: {list}
248
+ API Endpoints: {count} (nếu BE)
249
+ Components: {count} (nếu FE)
250
+ Ingest: ✅ completed
251
+
252
+ ⚠️ Cần scan thêm {FE/BE} project — xem handoff request
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Lưu ý
258
+ - Scan KHÔNG xóa wiki notes cũ — chỉ thêm mới hoặc overwrite cùng tên
259
+ - Nếu đã scan trước đó → agent hỏi: "Wiki đã có notes. Overwrite hay skip?"
260
+ - Workflow này GỌI skill `evnict-kit-wiki` cho phần push + ingest
261
+ - Mỗi module 1 file — KHÔNG gộp tất cả vào 1 file khổng lồ
262
+
263
+ ## Checklist hoàn thành
264
+ - [ ] Project type detected
265
+ - [ ] Code scanned theo type
266
+ - [ ] Modules identified và grouped
267
+ - [ ] Wiki notes sinh cho mỗi module
268
+ - [ ] Architecture note sinh
269
+ - [ ] API catalog sinh (nếu BE)
270
+ - [ ] Handoff request ghi (nếu cần scan project còn lại)
271
+ - [ ] Auto-ingest completed
272
+ - [ ] Status report hiển thị
@@ -0,0 +1,9 @@
1
+ # {{PROJECT_NAME}} — AI Agent Context
2
+ # Generated by evnict-kit v0.1.2
3
+ ## Overview: {{TECH_STACK}} | {{DATABASE}}
4
+ ## Structure: <!-- CHƯA KHỞI TẠO -->
5
+ ## Commands: <!-- CHƯA KHỞI TẠO -->
6
+ ## Conventions: → rules/project/RP03
7
+ ## Architecture: → rules/project/RP02
8
+ ## Security: → rules/ (R01,RB02,RB05,ATTT01-08)
9
+ ## Safety: ❌ git push | ❌ xóa file | ❌ secrets | ❌ log PII