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,93 @@
1
+ ---
2
+ name: evnict-kit-doc-postmortem
3
+ description: Tạo tài liệu đặc tả theo QĐ-TTPM Mục 8.9 — ghi lại task, công cụ, prompts, thay đổi, kiểm tra, vấn đề cho mỗi phiên AI.
4
+ compatibility: All
5
+ ---
6
+
7
+ # evnict-kit-doc-postmortem — Tài Liệu Đặc Tả
8
+
9
+ ## Khi nào dùng
10
+ - Sau khi hoàn thành feature/bugfix bằng AI Agent
11
+ - Khi thay đổi > 20 dòng code (bắt buộc theo QĐ-TTPM)
12
+ - Khi Archive spec
13
+
14
+ ## Input Parameters
15
+ - `feature` (bắt buộc): Feature/task name
16
+ - `type` (optional): feature | bugfix | hotfix | refactor
17
+
18
+ ---
19
+
20
+ ## Workflow Steps
21
+
22
+ ### Bước 1: Thu thập thông tin
23
+ ```bash
24
+ git log --oneline main..HEAD # Commits
25
+ git diff --stat main..HEAD # Files changed
26
+ git diff main..HEAD --shortstat # Lines changed
27
+ ```
28
+
29
+ ### Bước 2: Tạo postmortem document
30
+ Tạo file `docs/postmortem/{feature}-{date}.md`:
31
+
32
+ ```markdown
33
+ # Tài Liệu Đặc Tả: {Feature Name}
34
+ ## Theo QĐ-TTPM Điều 8, Mục 8.9
35
+ ## Date: {YYYY-MM-DD}
36
+
37
+ ---
38
+
39
+ ### 1. Nhiệm vụ
40
+ - Task: {Mô tả nhiệm vụ giao cho Agent}
41
+ - Type: {feature | bugfix | hotfix | refactor}
42
+ - Spec: {path to spec file if exists}
43
+ - Branch: {branch name}
44
+
45
+ ### 2. Công cụ
46
+ - AI Tool: {Antigravity | Claude Code | Cursor}
47
+ - Model: {model name}
48
+ - Config: {relevant config}
49
+
50
+ ### 3. Prompt chính
51
+ {Các prompts quan trọng đã sử dụng — đã clean sensitive data}
52
+
53
+ > Prompt 1: "{prompt text}"
54
+ > Prompt 2: "{prompt text}"
55
+
56
+ ### 4. Thay đổi
57
+ | File | Action | Lines Changed | Description |
58
+ |------|--------|---------------|-------------|
59
+ | {path} | {add/modify/delete} | {+N/-M} | {desc} |
60
+
61
+ Total: {N} files changed, {X} insertions, {Y} deletions
62
+
63
+ ### 5. Kiểm tra
64
+ - [ ] Unit tests: {pass/fail} ({count} tests)
65
+ - [ ] Lint: {pass/fail}
66
+ - [ ] Build: {pass/fail}
67
+ - [ ] Security scan: {pass/fail}
68
+ - [ ] Manual test: {description}
69
+
70
+ ### 6. Vấn đề & Lessons Learned
71
+ | # | Issue | Resolution | Lesson |
72
+ |---|-------|------------|--------|
73
+ | 1 | {issue} | {resolution} | {lesson} |
74
+
75
+ ### 7. Commit References
76
+ | Hash | Message |
77
+ |------|---------|
78
+ | {hash} | {message} |
79
+ ```
80
+
81
+ ### Bước 3: Validate document
82
+ - [ ] 7 sections đầy đủ
83
+ - [ ] Không chứa secrets/IP nội bộ
84
+ - [ ] Prompts đã clean sensitive data
85
+ - [ ] File changes chính xác (từ git diff)
86
+
87
+ ---
88
+
89
+ ## Tiêu chí hoàn thành
90
+ - [ ] Postmortem file tạo đúng format 7 sections
91
+ - [ ] Stored in docs/postmortem/
92
+ - [ ] No sensitive data
93
+ - [ ] Git refs chính xác
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: evnict-kit-finish-branch
3
+ description: Quy trình để chuẩn bị merge/kết thúc quá trình phát triển (development) của một branch. Tuân thủ CI/CD checks, tạo PR Decision, Test & Dọn dẹp branch.
4
+ ---
5
+
6
+ # evnict-kit-finish-branch
7
+
8
+ ## Khi nào dùng
9
+ Hành động này đóng vai trò như một bộ "Final Quality Gate" (Chốt chặn chất lượng cuối) mà mọi lập trình viên và AI Agent cần chạy trước khi bàn giao một feature.
10
+ Kỹ năng dùng khi:
11
+ - Khi người dùng thông báo: "Xong task rồi", "Kết thúc nhánh tại đây cho anh", hoặc "Merge branch này đi".
12
+ - Khi AI Agent chạy trong chuỗi TDD Workflow đã hoàn thiện tất cả các Sub-tasks của toàn bộ Feature và chuẩn bị Review kết thúc quy trình bự.
13
+ - Đóng gói dọn dẹp các tàn dư code dở đang thử nghiệm nháp.
14
+
15
+ ## Core Rules & Mindset (Quy luật bắt buộc)
16
+ 1. BẢO VỆ NHÁNH CHÍNH: KHÔNG BAO GIỜ tự tiện tiến hành merge nhánh vào Development / Main bừa bãi khi chưa chạy qua Pre-check Pipeline (Lint, Format, Test tự động). Quá trình này ép User và Agent phải nhìn thấy báo cáo QA trước khi ấn nút.
17
+ 2. BÁO CÁO RÙI RO: Đưa ra Cảnh báo an toàn nếu phát hiện code coverage giảm đáng kể, Code Smells xuất hiện.
18
+ 3. CLEAN CODE: Tuyệt đối rào cản gắt gao các logs rác rưởi như `console.log`, `System.out.println` dính lại trong pull request. Dọn rác kĩ trước khi khoe với Sếp.
19
+
20
+ ---
21
+
22
+ ## Workflow chi tiết (Đóng gói Branch)
23
+
24
+ ### Bước 1: Quality Gate Pre-Check
25
+ Agent phải tự thực hiện bộ lệnh verify để đảm bảo branch local này hoàn toàn "vô trùng" không chứa Code Rác và Debug logs tạm:
26
+
27
+ **Với Backend (Spring Boot/Java):**
28
+ - System check: Chạy `./mvnw spotless:check` để xác nhận chuẩn style rule.
29
+ - Logic Test: Chạy `./mvnw test` để chắc chắn mọi bài tests vẫn đang ở trạng thái Xanh (Green).
30
+ - Garbage Hunt: Sử dụng Find/Grep lùng sục codebase tìm các tàn dư `System.out.println("Hello Here")` hay `e.printStackTrace()` mà Dev ném vào.
31
+
32
+ **Với Frontend (Angular/React):**
33
+ - System check: Chạy `ng lint` / `npm run lint` để kiểm tra convention TS/JS.
34
+ - Logic Test: Chạy `ng test --watch=false` hoặc `npm test` để kiểm tra logic UT fail.
35
+ - Garbage Hunt: Tìm và cảnh báo mạnh mẽ nếu vẫn chừa lại `console.log()` hoặc từ khoá `debugger;`.
36
+
37
+ > Nếu phát hiện Lỗi hệ thống: Agent ngay lúc đó tự sửa (Auto-fix routine).
38
+ > Cuối cùng Báo cáo: "Hệ thống CI Local đã bắt được X lỗi Lint và Y đoạn code rác. Agent đã dọn dẹp gọn gàng, tự đẩy commit bổ sung trước khi sẵn sàng cho Merge."
39
+
40
+ ### Bước 2: Build Verification (Compile Test)
41
+ Mã sạch không có nghĩa là Mã chạy được trên Production. Cần chạy khâu build project để chứng minh code thực sự có thể đóng gói, liên kết module chéo không vấp ngã:
42
+ - Backend: Chạy lệnh build siêu tốc `./mvnw clean package -DskipTests` (Bỏ quả test vì bước 1 đã test rồi, bước này tập trung bắt lỗi Compiler/Dependency).
43
+ - Frontend: `npm run build` hoặc `ng build`. Nếu quá trình build sinh ra Error đỏ thì STOP quy trình tức khắc để User vào xem.
44
+
45
+ ### Bước 3: Đưa ra Lựa chọn Kết thúc (Confirm Merge Decision)
46
+ Hỏi User hình thức xử lý kế tiếp với Branch đã khoẻ mạnh này. In 3 Option rõ ràng:
47
+
48
+ ```markdown
49
+ ✅ Hệ thống đã QA thành công toàn bộ nội dung của branch `feature/xxx`. Mã an toàn 100% để kết thúc luồng.
50
+ Bạn vui lòng đưa ra chỉ thị tiếp theo để tôi xử lý:
51
+
52
+ **A) Khởi tạo Pull Request / Merge Request**: Tôi sẽ tổng hợp Diff và sinh nội dung PR chuyên nghiệp đẩy lên Server Git. Đặc biệt khuyên dùng khi làm nhóm!
53
+ **B) Merge Local (Gộp và Chốt trực tiếp)**: Tool sẽ Switch thư mục sang nhánh `main` / `develop`, gộp toàn bộ nội dung này vào nhánh mẹ an toàn ngay tại local của bạn.
54
+ **C) Push Trữ Bản Draft**: Đẩy mã nguồn lên máy chủ (Push), Backup an toàn và dọn dẹp Worktree (nếu có), không gộp chéo gì.
55
+ ```
56
+
57
+ (Chờ người dùng gõ câu lệnh hoặc phím tắt Chọn A, B, C).
58
+
59
+ ### Bước 4: Xử lý Hành động theo Nhánh Điều Kiện
60
+
61
+ **Nếu user chọn (A) Create Pull Request**:
62
+ - Kéo lấy tổng hợp file khác biệt bằng `git diff main...HEAD`.
63
+ - Sinh ra một File mới `PR_DESCRIPTION.md` theo Format tiêu chuẩn xịn xò của công ty:
64
+ - Tóm tắt ý tưởng tính năng.
65
+ - Các thay đổi đặc thù về API Endpoints, Schema DB, và Màn hình UI.
66
+ - Các Issue / Task Reference có liên quan để hệ thống tự Track.
67
+ - Gửi trực tiếp bản Text này ra màn hình Chat để User tiện lợi Copy > Paste.
68
+
69
+ **Nếu user chọn (B) Merge Local**:
70
+ - Hệ điều hành chạy `git checkout develop` hoặc `git checkout main` tuỳ team chuẩn.
71
+ - Tiến hành cập nhật mới từ server `git pull origin develop`.
72
+ - Nhập lệnh gộp `git merge --no-ff feature/xxx -m "Merge branch feature/xxx: [Brief desc]"`.
73
+ - Chú ý: Nếu git hú còi báo hiệu Xung đột Conflict, KHÔNG ĐƯỢC force merge, Agent Dừng màn hình để User nhảy vào gỡ Conflict bằng tay.
74
+
75
+ **Nếu user chọn (C) Push & Keep Draft**:
76
+ - `git push origin feature/xxx` (Thêm flag `--set-upstream` hay `-u` nếu là branch chưa tồn tại trên Remote repo).
77
+
78
+ ### Bước 5: Branch Cleanup (Dọn dẹp môi trường)
79
+ Công đoạn xả rác ổ cứng:
80
+ - Tham khảo User xem có xoá Branch rác rưởi sau Merge chưa bằng lệnh gộp `git branch -D feature/xxx`. Gợi ý User xoá để bảng lệnh sạch sẽ hơn.
81
+ - Tra cứu bảng Git Worktree. Nhắc nhở & hỏi việc uỷ quyền xoá Directory rác: `git worktree remove ...`
82
+ - Vấn đề Workspace nội vụ AI: Di dời thư mục các files nháp specs sinh ra `.evnict/specs/` cất vào tủ Archive Documentation chuẩn theo quy tắc Workflow `evnict-kit-archive-wiki.md`.
83
+
84
+ ## Tiêu chí hoàn thành (Definition of Done của Kỹ Năng)
85
+ 1. Pipeline QA Linting / Testing / Build chứng nhận "All Pass". Không bỏ sót Log rác.
86
+ 2. Bản PR hoặc lựa chọn Fast-Merge được người dùng xác nhận rõ ý.
87
+ 3. Code được đóng kết, lịch sử Git Commit được dọn gọn, không còn để Branch hay Thư mục Local treo lơ lửng hoang phí ổ cứng máy hệ thống.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: evnict-kit-fix-attt
3
+ description: Fix lỗi ATTT — classify severity → hotfix branch → OWASP fix → scan similar → security review. Theo QĐ-TTPM Điều 8.
4
+ compatibility: All tech stacks
5
+ ---
6
+
7
+ # evnict-kit-fix-attt — Fix Lỗi An Toàn Thông Tin
8
+
9
+ ## Khi nào dùng
10
+ - Phát hiện lỗ hổng bảo mật (SQL Injection, XSS, CSRF, etc.)
11
+ - Kết quả OWASP dependency scan có CVE
12
+ - Security audit phát hiện vấn đề
13
+
14
+ ## Input Parameters
15
+ - `vulnerability` (bắt buộc): Mô tả lỗ hổng
16
+ - `severity` (bắt buộc): critical | high | medium | low
17
+ - `category` (optional): ATTT01-ATTT08 (auto-detect nếu không chỉ định)
18
+
19
+ ---
20
+
21
+ ## Workflow Steps
22
+
23
+ ### Bước 1: Classify & Escalate
24
+ | Severity | Response Time | Action |
25
+ |----------|--------------|--------|
26
+ | Critical | 24h | Hotfix branch NGAY, deploy ASAP, thông báo Tech Lead + Tổ trưởng ANTT |
27
+ | High | Sprint hiện tại | Fix branch, thông báo Tech Lead |
28
+ | Medium | Sprint tiếp | Lên kế hoạch, ghi vào backlog |
29
+ | Low | Đánh giá | Theo dõi, fix khi có thể |
30
+
31
+ **Critical/High → Thông báo NGAY:**
32
+ ```
33
+ ⚠️ PHÁT HIỆN LỖ HỔNG BẢO MẬT [{severity}]
34
+ Category: {ATTT-XX}
35
+ Description: {vulnerability}
36
+ File(s): {affected files}
37
+ → Cần thông báo Tech Lead + Tổ trưởng ANTT
38
+ ```
39
+
40
+ ### Bước 2: Tạo hotfix branch
41
+ ```bash
42
+ git checkout -b hotfix/attt-{category}-{date}
43
+ ```
44
+
45
+ ### Bước 3: Fix theo category
46
+
47
+ #### ATTT01 — SQL Injection
48
+ 1. Tìm tất cả string concatenation trong SQL:
49
+ ```bash
50
+ grep -rn "query.*+.*\"" --include="*.java" src/
51
+ grep -rn "DSL\.field(.*+\s" --include="*.java" src/
52
+ ```
53
+ 2. Thay thế bằng parameterized queries / JOOQ type-safe
54
+ 3. Whitelist dynamic ORDER BY
55
+
56
+ #### ATTT02 — XSS
57
+ 1. Tìm innerHTML và bypass:
58
+ ```bash
59
+ grep -rn "\[innerHTML\]" --include="*.html" src/
60
+ grep -rn "bypassSecurityTrust" --include="*.ts" src/
61
+ ```
62
+ 2. Thay bằng interpolation hoặc DOMPurify
63
+ 3. Kiểm tra CSP headers
64
+
65
+ #### ATTT03 — CSRF
66
+ 1. Kiểm tra CSRF configuration trong SecurityConfig
67
+ 2. Verify double-submit cookie hoặc JWT (nếu stateless)
68
+
69
+ #### ATTT04 — JWT Security
70
+ 1. Kiểm tra algorithm (PHẢI RS256+, KHÔNG HS256)
71
+ 2. Kiểm tra key size ≥ 2048
72
+ 3. Kiểm tra token expiration
73
+ 4. Kiểm tra refresh token rotation
74
+
75
+ #### ATTT05 — CVE Dependencies
76
+ ```bash
77
+ ./mvnw org.owasp:dependency-check-maven:check
78
+ npm audit
79
+ ```
80
+ Fix: upgrade dependency hoặc apply patch
81
+
82
+ #### ATTT06 — File Upload
83
+ 1. Kiểm tra extension whitelist
84
+ 2. Kiểm tra MIME type validation
85
+ 3. Kiểm tra file size limit
86
+ 4. UUID rename
87
+
88
+ #### ATTT07 — Data Exposure
89
+ 1. Kiểm tra DTO vs Entity return
90
+ 2. Kiểm tra stack trace exposure
91
+ 3. Kiểm tra log sensitive data
92
+
93
+ #### ATTT08 — OWASP Top 10
94
+ Tham chiếu bảng trong `02-evnict-kit-security-rules.md`
95
+
96
+ ### Bước 4: Scan Similar — Tìm lỗi tương tự toàn codebase
97
+ ```bash
98
+ # Chạy tất cả scan commands từ security rules
99
+ grep -rn "query.*+.*\"" --include="*.java" src/
100
+ grep -rn "\[innerHTML\]" --include="*.html" src/
101
+ grep -rn "password\s*=\s*\"" --include="*.java" src/
102
+ # ... các scan khác
103
+ ```
104
+
105
+ ### Bước 5: Viết test cho fix
106
+ Dùng skill `evnict-kit-tdd`:
107
+ - Test case: input injection → PHẢI bị chặn
108
+ - Test case: valid input → PHẢI hoạt động bình thường
109
+
110
+ ### Bước 6: Security Review
111
+ Dùng skill `evnict-kit-code-review` với scope=security
112
+
113
+ ### Bước 7: Commit + Document
114
+ ```bash
115
+ git add .
116
+ git commit -m "fix(security): fix {ATTT-XX} {description} [hotfix]"
117
+ ```
118
+
119
+ Tạo postmortem: `docs/attt/{ATTT-XX}-{date}.md`
120
+
121
+ ---
122
+
123
+ ## Tiêu chí hoàn thành
124
+ - [ ] Lỗ hổng đã fix
125
+ - [ ] Scan similar → không còn lỗi tương tự
126
+ - [ ] Tests viết và PASS
127
+ - [ ] Security review PASS
128
+ - [ ] Postmortem documented
129
+ - [ ] Tech Lead + Tổ trưởng ANTT đã thông báo (Critical/High)
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: evnict-kit-fix-business-logic
3
+ description: Fix lỗi nghiệp vụ — verify business rules → test scenarios → fix → validate với spec.
4
+ compatibility: All tech stacks
5
+ ---
6
+
7
+ # evnict-kit-fix-business-logic — Fix Lỗi Nghiệp Vụ
8
+
9
+ ## Khi nào dùng
10
+ - Logic nghiệp vụ cho kết quả sai
11
+ - Business rules không được áp dụng đúng
12
+ - Tính toán sai (công thức, quy tắc, workflow)
13
+
14
+ ## Input Parameters
15
+ - `description` (bắt buộc): Mô tả lỗi nghiệp vụ
16
+ - `expected` (bắt buộc): Kết quả mong đợi
17
+ - `actual` (bắt buộc): Kết quả thực tế
18
+
19
+ ---
20
+
21
+ ## Workflow Steps
22
+
23
+ ### Bước 1: Tìm Spec/Business Rules
24
+ 1. Đọc `.evnict/specs/` → tìm spec liên quan
25
+ 2. Đọc wiki → tìm business rules document
26
+ 3. Xác định business rules bị vi phạm
27
+
28
+ ```markdown
29
+ ## Business Rule Check
30
+ - Rule: {BR-XX}: {description}
31
+ - Expected: {expected behavior}
32
+ - Actual: {actual behavior}
33
+ - Source: {spec file / business document}
34
+ ```
35
+
36
+ ### Bước 2: Tạo Test Scenarios
37
+ Viết test cases bao gồm:
38
+ - Happy path (input hợp lệ → kết quả đúng)
39
+ - Edge cases (biên giới trị, giá trị đặc biệt)
40
+ - Error cases (input không hợp lệ → xử lý đúng)
41
+
42
+ ```java
43
+ @Test
44
+ @DisplayName("BR01: Đơn hàng > 1tr cần duyệt")
45
+ void order_above1M_shouldRequireApproval() {
46
+ OrderDTO order = new OrderDTO();
47
+ order.setTotal(1_500_000);
48
+
49
+ OrderDTO result = orderService.create(order);
50
+
51
+ assertTrue(result.isNeedApproval());
52
+ }
53
+
54
+ @Test
55
+ @DisplayName("BR01: Đơn hàng <= 1tr không cần duyệt")
56
+ void order_below1M_shouldNotRequireApproval() {
57
+ OrderDTO order = new OrderDTO();
58
+ order.setTotal(500_000);
59
+
60
+ OrderDTO result = orderService.create(order);
61
+
62
+ assertFalse(result.isNeedApproval());
63
+ }
64
+ ```
65
+
66
+ ### Bước 3: Fix Logic
67
+ 1. Xác định file/method chứa business logic
68
+ 2. Sửa logic → test PASS
69
+ 3. Verify với spec/business rules
70
+
71
+ ### Bước 4: Validate với Spec
72
+ So sánh kết quả fix với:
73
+ - Acceptance criteria trong spec
74
+ - Business rules table
75
+ - Luồng nghiệp vụ (main flow + exception flow)
76
+
77
+ ### Bước 5: Commit
78
+ ```bash
79
+ git commit -m "fix({module}): correct {business rule} logic [BR-{XX}]"
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Tiêu chí hoàn thành
85
+ - [ ] Business rules xác định rõ
86
+ - [ ] Test scenarios viết đủ (happy + edge + error)
87
+ - [ ] Logic fix đúng với spec
88
+ - [ ] All tests PASS
89
+ - [ ] Validate với business rules document
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: evnict-kit-git-worktrees
3
+ description: Hướng dẫn quản lý Git worktree. Git worktree cho phép check out nhiều branches đồng thời vào những folder khác nhau mà không cần clone lại toàn bộ repo. Rất hữu ích khi context-switching.
4
+ ---
5
+
6
+ # evnict-kit-git-worktrees
7
+
8
+ ## Mục đích và Lợi ích
9
+ Git Worktree sinh ra để giải quyết nỗi ám ảnh Context Switching (chuyển đổi bối cảnh) giữa các Feature.
10
+ Thay vì tải toàn bộ source code lại từ máy chủ vào một folder khác (Clone thứ hai) cực kỳ tốn thời gian, hoặc `git stash` code rủi ro cao, Git Worktree xây dựng các máy trạm rẽ nhánh (folder song song) từ chung một thư viện `.git` cốt lõi ở Local.
11
+
12
+ ## Khi nào dùng
13
+ - Khi bạn đang phát triển một Feature dài hạn (Feature A) nhưng bất ngờ bị Leader / DevOps gọi sang fix Hotfix khẩn cấp ở nhánh khác (`hotfix-prd`).
14
+ - Khi cần so sánh code đang chạy giữa 2 nhánh (Branch A vs Branch B) side-by-side trên cùng 1 máy tính để phân tích lỗi.
15
+ - Khi làm việc liên tục giữa Frontend và Backend và cần test chéo nhiều code version khác nhau kết nối tới cùng 1 DB.
16
+ - Tham gia Peer Review một PR phức tạp không thể review chay trên Web, buộc phải kéo về localhost để chạy nhưng không muốn phá luồng công việc nhánh hiện tại.
17
+
18
+ ## Tại sao dùng Worktrees thay vì Branch checkout thuần tuý?
19
+ Nếu dùng `git branch` và `git checkout` bình thường:
20
+ - Phải stash code liên tục, dễ quên stash mất code hoặc bị conflict rác khi pop ra.
21
+ - Trình soạn thảo (IDE) như VSCode/IntelliJ/Eclipse phải tự động xoá index và re-index lại các tệp tin theo luồng nhánh mới, làm giật lag, tốn thời gian.
22
+ - IDE phải khởi động lại terminal / compiler (VD: `npm start` hay Spring Boot server phải restart, Gradle phải re-sync build cache).
23
+
24
+ Với Git Worktree, bạn có một project rẽ nhánh yên bình, IDE thứ hai độc lập.
25
+
26
+ ---
27
+
28
+ ## Workflow chi tiết
29
+
30
+ ### Bước 1: Khởi tạo Worktree mới
31
+ Thay vì `git checkout -b feature/xyz`, dùng lệnh add worktree.
32
+ **Quy tắc VÀNG**: Thư mục của worktree NÊN được tạo ở vị trí ngang hàng (`../`) với thư mục gốc dự án để tránh lọt vào vòng lặp git (hoặc phải đưa thư mục này vào `.gitignore`).
33
+
34
+ **Trường hợp 1: Tạo Worktree từ một branch CÓ SẴN (Remote pull or existing local):**
35
+ ```bash
36
+ # Cấu trúc: git worktree add <path> <branch-name>
37
+ # VD: Tạo một folder ../my-project-hotfix để kéo nhánh hotfix/123-urgent-bug về.
38
+ git worktree add ../my-project-hotfix hotfix/123-urgent-bug
39
+ ```
40
+
41
+ **Trường hợp 2: Tạo Worktree mới kẹp theo lệnh tạo Branch MỚI:**
42
+ ```bash
43
+ # Cấu trúc: git worktree add -b <new-branch> <path> <source-branch>
44
+ # VD: Copy từ nhánh main, rẽ một folder mới bên ngoài để code task A.
45
+ git worktree add -b feature/xyz ../my-project-feature main
46
+ ```
47
+
48
+ Lúc này, bạn mở VSCode/IDE bằng folder `../my-project-feature` và code bình thường như một project gốc độc lập.
49
+
50
+
51
+ ### Bước 2: Quản lý các Worktrees
52
+ Để xem hiện tại bạn đang có bao nhiêu folder nhánh con đang hoạt động từ gốc dự án mẹ:
53
+ ```bash
54
+ git worktree list
55
+ ```
56
+ Output sẽ hiển thị chi tiết đường dẫn absolute của folder và commit/branch name đang liên kết.
57
+
58
+ **Lưu ý RẤT QUAN TRỌNG phần Onboarding Setup:**
59
+ Do Repo Git đã được "nhân bản mềm", những thành phần không nằm trong version control sẽ KHÔNG đi theo (Ví dụ `.env`, `node_modules`, `target/`).
60
+ Bạn cần có thao tác "Warm-up" ngay sau khi setup Folder mới:
61
+ ```bash
62
+ # Nhảy vào thư mục tạo ra
63
+ cd ../my-project-feature
64
+
65
+ # Khởi tạo NPM Dependencies (cho Frontend / Node)
66
+ npm install
67
+
68
+ # Build Gradle / Maven dependencies (cho Backend)
69
+ ./mvnw clean install -DskipTests
70
+
71
+ # Bổ sung các biến môi trường
72
+ cp ../my-project-core/.env .env
73
+ ```
74
+
75
+ ### Bước 3: Dọn dẹp (Cleanup) sau khi hoàn thành
76
+ Khi nhánh `feature/xyz` đã code xong, Pull Request đã merge, thư mục rác này không còn tác dụng. Việc để lại sẽ dần ăn hết bộ nhớ ổ cứng. Cần làm trình tự sau.
77
+
78
+ **Phase 1: Gỡ bỏ Worktree một cách hệ thống**
79
+ Đảm bảo bạn đứng ở Project Folder Mẹ (Core rễ):
80
+ ```bash
81
+ # Cắt bỏ liên kết Folder (Rút phích cắm worktree):
82
+ git worktree remove ../my-project-feature
83
+ ```
84
+ *(Lưu ý: Nếu folder worktree chưa được dọn dẹp sạch mã nguồn, tệp tin chưa add/commit, Git sẽ cảnh báo từ chối. Nếu vẫn muốn cưỡng chế xoá, dùng `git worktree remove --force ../my-project-feature`).*
85
+
86
+ **Phase 2: Xoá branch Git (Tránh nợ kỹ thuật)**
87
+ Xoá bỏ branch rác đã hoàn tất:
88
+ ```bash
89
+ git branch -d feature/xyz
90
+ ```
91
+
92
+ **Phase 3: Dọn dẹp Metadata**
93
+ Thi thoảng, có những lúc User vô tình xoá xoẹt folder `../my-project-feature` bằng Explorer (Windows) thay vì lệnh git. Hệ thống metadata của Git bị kẹt. Khắc phục bằng:
94
+ ```bash
95
+ git worktree prune
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Các thao tác AI Agent (Lưu ý)
101
+ 1. **Liên lạc trước với User**: Với Quyền hạn của Agent AI, bạn CÓ THỂ tự tạo Folder mới cho Worktree, nhưng BẮT BUỘC hỏi ý kiến User trước xem lưu trữ ở vị trí folder nào cho chuẩn.
102
+ 2. **Context Persistence**: Khi sử dụng Terminal chuyển qua lại thư mục mới, Agent buộc phải ghi nhớ cấu trúc đường dẫn absolute path. Không phụ thuộc thư mục gốc cũ. Agent cần tìm và đọc lại các `01-evnict-kit-general-rules.md`, v.v...
103
+ 3. **Cảnh báo Xoá rác**: Tuyệt đối Không tự thực hiện việc xoá (remove) worktree nếu chưa xin một lệnh confirm y/n rõ ràng của User. Xoá nhầm của User sẽ làm bay toàn bộ chất xám chưa commit.
104
+ 4. Mọi Git hook (`pre-commit`), hay Linter tích hợp đều vẫn hoạt động bình thường qua worktree do bộ não hook ở file core mẹ. Không cần cấu hình lại Git Hooks.
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: evnict-kit-merge-checklist
3
+ description: Pre-merge checklist theo QĐ-TTPM Mục 8.10 — 9 hạng mục kiểm tra bắt buộc trước khi merge vào main/develop.
4
+ compatibility: All tech stacks, Git
5
+ ---
6
+
7
+ # evnict-kit-merge-checklist — Pre-Merge Checklist
8
+
9
+ ## Khi nào dùng
10
+ - Trước MỌI merge request/pull request
11
+ - Trước khi merge feature branch vào main/develop
12
+
13
+ ## Input Parameters
14
+ - `branch` (optional): Branch cần check (default: current)
15
+
16
+ ---
17
+
18
+ ## Checklist (9 hạng mục)
19
+
20
+ Thực hiện TỪNG hạng mục. Nếu BẤT KỲ hạng mục nào FAIL → KHÔNG merge.
21
+
22
+ ### 1. ✅ Code compiles / builds
23
+ ```bash
24
+ ./mvnw compile # Java
25
+ ng build # Angular
26
+ dotnet build # .NET
27
+ ```
28
+
29
+ ### 2. ✅ All tests pass
30
+ ```bash
31
+ ./mvnw test # Java
32
+ ng test --watch=false # Angular
33
+ dotnet test # .NET
34
+ ```
35
+
36
+ ### 3. ✅ Lint / format pass
37
+ ```bash
38
+ ./mvnw spotless:check # Java
39
+ ng lint # Angular
40
+ ```
41
+
42
+ ### 4. ✅ No security vulnerabilities
43
+ ```bash
44
+ grep -rn "password\s*=\s*\"" --include="*.java" --include="*.ts" src/
45
+ grep -rn "query.*+.*\"" --include="*.java" src/
46
+ npm audit # Frontend
47
+ ```
48
+
49
+ ### 5. ✅ No hardcoded secrets
50
+ ```bash
51
+ grep -rn "secret\|apiKey\|token.*=.*\"" --include="*.java" --include="*.ts" src/
52
+ ```
53
+
54
+ ### 6. ✅ Commit messages follow convention
55
+ ```bash
56
+ git log --oneline main..HEAD
57
+ # Format: {type}({scope}): {description} [task-{N}]
58
+ # Types: feat, fix, refactor, test, docs, chore
59
+ ```
60
+
61
+ ### 7. ✅ No unnecessary file changes
62
+ ```bash
63
+ git diff --stat main..HEAD
64
+ # Verify: chỉ files liên quan đến feature/fix
65
+ ```
66
+
67
+ ### 8. ✅ Documentation updated
68
+ - [ ] API docs updated (nếu có endpoint mới)
69
+ - [ ] Spec archived (nếu feature)
70
+ - [ ] Postmortem created (nếu > 20 dòng code)
71
+
72
+ ### 9. ✅ Migration scripts have rollback
73
+ ```bash
74
+ find database/migrations -name "*ROLLBACK*"
75
+ # Mỗi UP migration PHẢI có ROLLBACK
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Output Format
81
+
82
+ ```markdown
83
+ ## 📋 Pre-Merge Checklist
84
+ ### Branch: {branch} → {target}
85
+ ### Date: {date}
86
+
87
+ | # | Hạng mục | Status | Notes |
88
+ |---|----------|--------|-------|
89
+ | 1 | Build | ✅/❌ | |
90
+ | 2 | Tests | ✅/❌ | {count} tests |
91
+ | 3 | Lint | ✅/❌ | |
92
+ | 4 | Security | ✅/❌ | |
93
+ | 5 | Secrets | ✅/❌ | |
94
+ | 6 | Commits | ✅/❌ | |
95
+ | 7 | Files | ✅/❌ | {count} files |
96
+ | 8 | Docs | ✅/❌ | |
97
+ | 9 | Migration | ✅/❌ | |
98
+
99
+ ## Verdict: {PASS | FAIL}
100
+ {Nếu FAIL: danh sách items cần fix}
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Tiêu chí hoàn thành
106
+ - [ ] 9 hạng mục đã check
107
+ - [ ] Tất cả PASS → merge OK
108
+ - [ ] Bất kỳ FAIL → KHÔNG merge, fix trước