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