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,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: ATTT workflow — 2 modes. --scan toàn bộ project, hoặc check module cụ thể. Sử dụng skill evnict-kit-security-audit và evnict-kit-fix-attt.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# ATTT — An Toàn Thông Tin
|
|
6
|
+
**Command:** `/evnict-kit:attt`
|
|
7
|
+
|
|
8
|
+
## Khi nào dùng
|
|
9
|
+
- Kiểm tra ATTT định kỳ
|
|
10
|
+
- Trước khi release
|
|
11
|
+
- Review module mới
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
- Mode 1: `/evnict-kit:attt --scan` → Scan toàn bộ project
|
|
15
|
+
- Mode 2: `/evnict-kit:attt {module}` → Check module cụ thể
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Mode 1: Full Scan (`--scan`)
|
|
20
|
+
|
|
21
|
+
### Bước 1: Chạy Security Audit
|
|
22
|
+
Gọi skill `evnict-kit-security-audit` với scope=all:
|
|
23
|
+
1. Dependency scan (CVE)
|
|
24
|
+
2. Code scan ATTT01-ATTT08
|
|
25
|
+
3. Configuration review
|
|
26
|
+
4. Tạo report
|
|
27
|
+
|
|
28
|
+
### Bước 2: Fix Issues
|
|
29
|
+
Với mỗi issue Critical/High → gọi skill `evnict-kit-fix-attt`:
|
|
30
|
+
1. Classify severity
|
|
31
|
+
2. Tạo hotfix branch
|
|
32
|
+
3. Fix theo OWASP guide
|
|
33
|
+
4. Test
|
|
34
|
+
5. Commit
|
|
35
|
+
|
|
36
|
+
### Bước 3: Re-scan
|
|
37
|
+
Sau khi fix → chạy lại scan → verify 0 Critical/High.
|
|
38
|
+
|
|
39
|
+
### Bước 4: Report
|
|
40
|
+
Lưu report vào `docs/attt/security-audit-{date}.md`
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Mode 2: Module Check (`{module}`)
|
|
45
|
+
|
|
46
|
+
### Bước 1: Scope to module
|
|
47
|
+
```bash
|
|
48
|
+
# Chỉ scan files trong module
|
|
49
|
+
grep -rn "pattern" --include="*.java" src/main/java/com/evn/{project}/{module}/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Bước 2: Run ATTT checks
|
|
53
|
+
Chạy scan commands từ `02-evnict-kit-security-rules.md` nhưng chỉ trong module path.
|
|
54
|
+
|
|
55
|
+
### Bước 3: Quick Report
|
|
56
|
+
```markdown
|
|
57
|
+
## 🔒 Module ATTT Check: {module}
|
|
58
|
+
| ATTT | Status | Details |
|
|
59
|
+
|------|--------|---------|
|
|
60
|
+
| ATTT01 SQL Injection | ✅/❌ | {details} |
|
|
61
|
+
| ATTT02 XSS | ✅/❌ | |
|
|
62
|
+
| ATTT03 CSRF | ✅/❌ | |
|
|
63
|
+
| ATTT04 JWT | ✅/❌ | |
|
|
64
|
+
| ATTT06 Upload | ✅/❌ | |
|
|
65
|
+
| ATTT07 Data Exposure | ✅/❌ | |
|
|
66
|
+
| Secrets | ✅/❌ | |
|
|
67
|
+
| PII Logs | ✅/❌ | |
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Bước cuối: Wiki Integration (BẮT BUỘC cho ATTT)
|
|
73
|
+
ATTT fix **LUÔN** phải push vào wiki (không hỏi user):
|
|
74
|
+
```
|
|
75
|
+
🔒 ATTT fix → TỰ ĐỘNG push vào wiki...
|
|
76
|
+
```
|
|
77
|
+
Gọi skill `evnict-kit-wiki` action=push:
|
|
78
|
+
- Security vulnerability description
|
|
79
|
+
- ATTT category (ATTT01-ATTT08)
|
|
80
|
+
- Fix approach + OWASP reference
|
|
81
|
+
- Files changed
|
|
82
|
+
- Re-scan results
|
|
83
|
+
|
|
84
|
+
Auto-ingest:
|
|
85
|
+
```bash
|
|
86
|
+
cd {wiki_path} && node scripts/ingest.js
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> **Lưu ý:** Để nạp tri thức chi tiết hơn, dùng:
|
|
90
|
+
> - `/evnict-kit:wiki-archive-feature` — nạp đầy đủ từ spec+plan+code
|
|
91
|
+
> - `/evnict-kit:wiki-query "ATTT"` — truy vấn ATTT knowledge trước khi scan
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Checklist hoàn thành
|
|
96
|
+
- [ ] Scan completed (full hoặc module)
|
|
97
|
+
- [ ] Critical/High issues fixed
|
|
98
|
+
- [ ] Report created
|
|
99
|
+
- [ ] Re-scan verified (for full scan)
|
|
100
|
+
- [ ] Wiki pushed (BẮT BUỘC cho ATTT fix)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Bug fix workflow — query wiki → classify → reproduce → TDD fix → scan similar → archive. Sửa lỗi có hệ thống.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Bug Fix
|
|
6
|
+
**Command:** `/evnict-kit:bug-fix`
|
|
7
|
+
|
|
8
|
+
## Khi nào dùng
|
|
9
|
+
- Bug report từ tester/user/production
|
|
10
|
+
- Regression bug
|
|
11
|
+
- Lỗi phát hiện trong development
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
- Mô tả bug
|
|
15
|
+
- VD: `/evnict-kit:bug-fix API GET /api/customers trả về 500 khi keyword chứa ký tự đặc biệt '%'`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Bước 1: Query wiki
|
|
20
|
+
Kiểm tra bug đã được report/fix trước đó:
|
|
21
|
+
```bash
|
|
22
|
+
grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Bước 2: Classify severity
|
|
26
|
+
| Severity | Response |
|
|
27
|
+
|----------|----------|
|
|
28
|
+
| Critical (production down) | Hotfix branch ngay |
|
|
29
|
+
| High (feature broken) | Fix trong sprint hiện tại |
|
|
30
|
+
| Medium (workaround có) | Lên kế hoạch |
|
|
31
|
+
| Low (cosmetic) | Backlog |
|
|
32
|
+
|
|
33
|
+
## Bước 3: Checkpoint
|
|
34
|
+
```bash
|
|
35
|
+
git checkout -b fix/{bug-slug}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Bước 4: Reproduce
|
|
39
|
+
1. Tìm file/module liên quan
|
|
40
|
+
2. Viết test case reproduce lỗi (RED — test PHẢI FAIL)
|
|
41
|
+
```java
|
|
42
|
+
@Test
|
|
43
|
+
@DisplayName("BUG: {description}")
|
|
44
|
+
void should_reproduce_bug() {
|
|
45
|
+
// Arrange — setup data gây lỗi
|
|
46
|
+
// Act — action gây lỗi
|
|
47
|
+
// Assert — verify lỗi xảy ra
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Bước 5: Root Cause Analysis
|
|
52
|
+
1. Trace logic từ input → output
|
|
53
|
+
2. Xác định dòng code gây lỗi
|
|
54
|
+
3. Ghi lại root cause
|
|
55
|
+
|
|
56
|
+
## Bước 6: TDD Fix
|
|
57
|
+
1. ✅ Test reproduce FAIL (RED done)
|
|
58
|
+
2. Fix code → test PASS (GREEN)
|
|
59
|
+
3. Refactor nếu cần
|
|
60
|
+
4. Chạy ALL tests
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
./mvnw test # All tests pass
|
|
64
|
+
./mvnw compile # Build OK
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3-Strike Rule: fail > 3 lần → DỪNG, báo user.
|
|
68
|
+
|
|
69
|
+
## Bước 7: Scan similar
|
|
70
|
+
Tìm pattern lỗi tương tự trong codebase:
|
|
71
|
+
```bash
|
|
72
|
+
grep -rn "{error pattern}" --include="*.java" src/
|
|
73
|
+
```
|
|
74
|
+
Fix luôn nếu tìm thấy.
|
|
75
|
+
|
|
76
|
+
## Bước 8: Commit
|
|
77
|
+
```bash
|
|
78
|
+
git commit -m "fix({module}): {description}"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Bước cuối: Wiki
|
|
82
|
+
Gợi ý user:
|
|
83
|
+
```
|
|
84
|
+
💡 Bug fix hoàn thành. Thêm tri thức vào wiki?
|
|
85
|
+
A) Có — chạy `/evnict-kit:wiki-archive-feature` (nạp đầy đủ)
|
|
86
|
+
B) Nhanh — tôi tóm tắt bug + root cause + fix → push wiki → auto-ingest
|
|
87
|
+
C) Không — skip
|
|
88
|
+
```
|
|
89
|
+
- Nếu A → chạy `/evnict-kit:wiki-archive-feature`
|
|
90
|
+
- Nếu B → gọi skill `evnict-kit-wiki` action=push → auto-ingest
|
|
91
|
+
- Nếu C → skip
|
|
92
|
+
|
|
93
|
+
Tạo postmortem nếu thay đổi > 20 dòng.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Checklist hoàn thành
|
|
98
|
+
- [ ] Wiki queried
|
|
99
|
+
- [ ] Severity classified
|
|
100
|
+
- [ ] Checkpoint created
|
|
101
|
+
- [ ] Bug reproduced (test case)
|
|
102
|
+
- [ ] Root cause identified
|
|
103
|
+
- [ ] TDD fix applied
|
|
104
|
+
- [ ] Similar patterns scanned
|
|
105
|
+
- [ ] All tests pass
|
|
106
|
+
- [ ] Committed
|
|
107
|
+
- [ ] Wiki updated (bug knowledge pushed)
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Phát triển feature lớn — spec → clarify → plan → TDD implement → archive wiki. Dùng khi feature cần code cả BE, FE, Database.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Feature Large
|
|
6
|
+
**Command:** `/evnict-kit:feature-large`
|
|
7
|
+
|
|
8
|
+
## Khi nào dùng
|
|
9
|
+
- Feature mới cần cả Backend + Frontend + Database
|
|
10
|
+
- Độ phức tạp cao, cần spec rõ ràng trước khi code
|
|
11
|
+
- Ước lượng > 1 ngày làm việc
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
- Mô tả feature bằng ngôn ngữ tự nhiên (tiếng Việt hoặc tiếng Anh)
|
|
15
|
+
- VD: `/evnict-kit:feature-large Thêm chức năng ký số hàng loạt cho các hồ sơ đã duyệt`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Phase 0: Brainstorm (Socratic)
|
|
20
|
+
TRƯỚC KHI sinh spec, Agent PHẢI áp dụng skill `evnict-kit-brainstorm`:
|
|
21
|
+
1. Đọc mô tả thô của user.
|
|
22
|
+
2. Xác định yêu cầu cần cả BE và FE không.
|
|
23
|
+
3. Hỏi user tối đa 5 câu hỏi để clarify scope, alternatives, constraints.
|
|
24
|
+
4. Chốt Design Brief.
|
|
25
|
+
5. CHỜ user approve mới chuyển sang Phase 1.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Phase 1: Specify + Clarify
|
|
30
|
+
|
|
31
|
+
### Bước 0: Detect project context
|
|
32
|
+
1. Kiểm tra project hiện tại là BE hay FE:
|
|
33
|
+
- Có pom.xml/build.gradle → Backend
|
|
34
|
+
- Có angular.json/package.json+react → Frontend
|
|
35
|
+
2. Đọc `.evnict/config.yaml` → liệt kê TẤT CẢ repos
|
|
36
|
+
3. Nếu feature cần cả BE+FE:
|
|
37
|
+
- Spec PHẢI bao gồm cả BE và FE sections
|
|
38
|
+
- Plan PHẢI sinh tasks cho CẢ BE và FE
|
|
39
|
+
- Tasks BE đánh prefix `be-`, tasks FE đánh prefix `fe-`
|
|
40
|
+
- API contract PHẢI được sinh trong plan phase
|
|
41
|
+
4. Thông báo: "Feature sẽ cần handoff sang [FE/BE].
|
|
42
|
+
Sau implement, chạy `/evnict-kit:handoff` để chuyển tasks."
|
|
43
|
+
|
|
44
|
+
### Bước 1: Thu thập context
|
|
45
|
+
1. Đọc `.evnict/config.yaml` → lấy project name, tech stack, wiki path
|
|
46
|
+
2. **Query wiki** (nếu có) → tìm context liên quan đến chức năng được mô tả:
|
|
47
|
+
- Đọc index từ `{wiki_path}/processed/`
|
|
48
|
+
- Tìm theo keyword/domain/tags từ mô tả feature
|
|
49
|
+
- Nếu tìm được → đưa vào context khi tạo spec
|
|
50
|
+
3. Đọc rules hiện tại trong `.agent/rules/` → nắm conventions dự án
|
|
51
|
+
|
|
52
|
+
### Bước 2: Sinh spec draft
|
|
53
|
+
Tạo file `.evnict/specs/{feature-slug}/spec.md` theo format:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Spec: {Feature Name}
|
|
57
|
+
## Generated by /evnict-kit:feature-large
|
|
58
|
+
## Date: {YYYY-MM-DD}
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 1. WHAT — Chức năng gì
|
|
63
|
+
{Mô tả chức năng, user story format nếu phù hợp}
|
|
64
|
+
- As a [role], I want to [action], so that [benefit]
|
|
65
|
+
|
|
66
|
+
## 2. WHY — Tại sao cần
|
|
67
|
+
{Mục đích nghiệp vụ, giá trị mang lại}
|
|
68
|
+
|
|
69
|
+
## 3. WHO — Ai sử dụng
|
|
70
|
+
| Vai trò | Quyền hạn |
|
|
71
|
+
|---------|-----------|
|
|
72
|
+
| {role} | {permissions} |
|
|
73
|
+
|
|
74
|
+
## 4. SCOPE — Phạm vi
|
|
75
|
+
### Bao gồm
|
|
76
|
+
- {in-scope items}
|
|
77
|
+
|
|
78
|
+
### KHÔNG bao gồm
|
|
79
|
+
- {out-of-scope items}
|
|
80
|
+
|
|
81
|
+
## 5. BUSINESS RULES
|
|
82
|
+
| Mã | Quy tắc | Ví dụ |
|
|
83
|
+
|----|---------|-------|
|
|
84
|
+
| BR01 | {rule description} | {example} |
|
|
85
|
+
| BR02 | ... | ... |
|
|
86
|
+
|
|
87
|
+
## 6. LUỒNG NGHIỆP VỤ
|
|
88
|
+
### Luồng chính (Main Flow)
|
|
89
|
+
1. {step 1}
|
|
90
|
+
2. {step 2}
|
|
91
|
+
3. ...
|
|
92
|
+
|
|
93
|
+
### Luồng ngoại lệ (Exception Flow)
|
|
94
|
+
- Nếu {condition} → {behavior}
|
|
95
|
+
|
|
96
|
+
## 7. ACCEPTANCE CRITERIA
|
|
97
|
+
- [ ] {criterion 1}
|
|
98
|
+
- [ ] {criterion 2}
|
|
99
|
+
|
|
100
|
+
## 8. PHẠM VI KỸ THUẬT
|
|
101
|
+
### Backend
|
|
102
|
+
- API endpoints cần tạo: ...
|
|
103
|
+
- Database changes: ...
|
|
104
|
+
- Service logic: ...
|
|
105
|
+
|
|
106
|
+
### Frontend
|
|
107
|
+
- Pages/Components cần tạo: ...
|
|
108
|
+
- State management: ...
|
|
109
|
+
- API integration: ...
|
|
110
|
+
|
|
111
|
+
### Database
|
|
112
|
+
- New tables/columns: ...
|
|
113
|
+
- Migration scripts: ...
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Bước 3: Đặt câu hỏi clarify NGAY TRONG OUTPUT
|
|
117
|
+
Sau khi sinh spec draft, hỏi user TỐI ĐA 3 câu:
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
## ❓ Câu hỏi cần làm rõ
|
|
121
|
+
|
|
122
|
+
### Q1: Scope
|
|
123
|
+
{Câu hỏi về phạm vi — feature này bao gồm/không bao gồm gì?}
|
|
124
|
+
Gợi ý: A) ... | B) ... | C) Custom
|
|
125
|
+
|
|
126
|
+
### Q2: Edge Cases
|
|
127
|
+
{Câu hỏi về trường hợp ngoại lệ}
|
|
128
|
+
|
|
129
|
+
### Q3: Constraints
|
|
130
|
+
{Câu hỏi về ràng buộc kỹ thuật/nghiệp vụ}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Nguyên tắc clarify (theo spec-kit):**
|
|
134
|
+
- Chỉ hỏi khi choice ẢNH HƯỞNG LỚN đến scope/security/UX
|
|
135
|
+
- Có nhiều cách hiểu hợp lý nhưng kết quả khác nhau
|
|
136
|
+
- Không có default hợp lý
|
|
137
|
+
- Giới hạn TỐI ĐA 3 câu hỏi — các vấn đề nhỏ → tự quyết định, ghi vào Assumptions
|
|
138
|
+
|
|
139
|
+
### Bước 4: User trả lời → Update spec → Confirm
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Phase 2: Plan + Task Breakdown
|
|
144
|
+
|
|
145
|
+
**Trigger:** `/evnict-kit:plan` (chờ User xác nhận trả lời hết Câu hỏi làm rõ ở Phase 1)
|
|
146
|
+
|
|
147
|
+
### Bước 1: Sinh plan files
|
|
148
|
+
Sau khi spec confirmed, tạo cấu trúc:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
.evnict/specs/{feature-slug}/
|
|
152
|
+
├── spec.md ← Đã confirm ở Phase 1
|
|
153
|
+
├── plan.md ← Tổng plan (sinh ở bước này)
|
|
154
|
+
├── tasks/
|
|
155
|
+
│ ├── 01-db-migration.md
|
|
156
|
+
│ ├── 02-be-repository.md
|
|
157
|
+
│ ├── 03-be-service.md
|
|
158
|
+
│ ├── 04-be-controller.md
|
|
159
|
+
│ ├── 05-fe-service.md
|
|
160
|
+
│ ├── 06-fe-component.md
|
|
161
|
+
│ └── 07-fe-page.md
|
|
162
|
+
└── contracts/
|
|
163
|
+
└── api-contract.yaml
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Bước 2: Nội dung plan.md
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
# Plan: {Feature Name}
|
|
170
|
+
## Tổng quan
|
|
171
|
+
- Estimated: {X} subtasks, ~{Y} phút
|
|
172
|
+
- BE tasks: {N}
|
|
173
|
+
- FE tasks: {M}
|
|
174
|
+
- DB tasks: {K}
|
|
175
|
+
|
|
176
|
+
## Thứ tự thực hiện
|
|
177
|
+
1. DB Migration (PHẢI xong trước)
|
|
178
|
+
2. BE: Repository → Service → Controller (tuần tự)
|
|
179
|
+
3. FE: Service → Component → Page (tuần tự, SAU KHI BE xong API)
|
|
180
|
+
|
|
181
|
+
## Dependencies
|
|
182
|
+
- FE tasks PHẢI chờ BE hoàn thành API → đọc contract từ contracts/api-contract.yaml
|
|
183
|
+
- BE tasks PHẢI chờ DB migration xong
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Bước 3: Nội dung mỗi task file
|
|
187
|
+
|
|
188
|
+
> **CHI TIẾT:** Xem template đầy đủ trong command `/evnict-kit:plan` — Bước 4.
|
|
189
|
+
> Mỗi task file PHẢI ≥ 100 dòng, bao gồm 8 sections:
|
|
190
|
+
> Mục tiêu, Business Context, Files list, Implementation Guide (code patterns từ file mẫu thật),
|
|
191
|
+
> Test Cases (≥ 3), Acceptance Criteria, Dependencies, Estimated.
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
# Task 01: DB Migration — {description}
|
|
195
|
+
## 1. Mục tiêu
|
|
196
|
+
{3-5 câu mô tả cụ thể}
|
|
197
|
+
|
|
198
|
+
## 2. Business Context
|
|
199
|
+
- BR{XX}: {rule liên quan}
|
|
200
|
+
|
|
201
|
+
## 3. Files cần tạo/sửa
|
|
202
|
+
| File | Action | Mô tả |
|
|
203
|
+
|------|--------|-------|
|
|
204
|
+
| database/migrations/V{date}_{seq}__{desc}.sql | CREATE | Migration UP |
|
|
205
|
+
| database/migrations/V{date}_{seq}__{desc}_ROLLBACK.sql | CREATE | Rollback |
|
|
206
|
+
|
|
207
|
+
## 4. Implementation Guide
|
|
208
|
+
### Conventions: Rule 03 → Migration naming convention
|
|
209
|
+
### Code Pattern: (trích từ migration mẫu trong project)
|
|
210
|
+
|
|
211
|
+
## 5. Test Cases (TDD)
|
|
212
|
+
| # | Test | Input | Expected | Type |
|
|
213
|
+
|---|------|-------|----------|------|
|
|
214
|
+
| 1 | Migration UP thành công | run script | Table tồn tại | Integration |
|
|
215
|
+
| 2 | Columns đúng type | describe table | Match schema | Integration |
|
|
216
|
+
| 3 | Rollback thành công | run rollback | Table xóa | Integration |
|
|
217
|
+
|
|
218
|
+
## 6. Acceptance Criteria
|
|
219
|
+
- [ ] {specific criteria}
|
|
220
|
+
|
|
221
|
+
## 7. Dependencies
|
|
222
|
+
- Requires: none
|
|
223
|
+
- Blocks: Task 02 (BE Repository)
|
|
224
|
+
|
|
225
|
+
## 8. Estimated: 3 phút
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Bước 4: API Contract (cho FE↔BE coordination)
|
|
229
|
+
|
|
230
|
+
```yaml
|
|
231
|
+
# contracts/api-contract.yaml
|
|
232
|
+
feature: {feature-name}
|
|
233
|
+
generated: {date}
|
|
234
|
+
endpoints:
|
|
235
|
+
- method: POST
|
|
236
|
+
path: /api/{module}/{action}
|
|
237
|
+
description: {mô tả}
|
|
238
|
+
request:
|
|
239
|
+
body:
|
|
240
|
+
fieldName: { type: string, required: true, maxLength: 100 }
|
|
241
|
+
response:
|
|
242
|
+
200:
|
|
243
|
+
schema: ResponseData
|
|
244
|
+
data:
|
|
245
|
+
id: { type: number }
|
|
246
|
+
400:
|
|
247
|
+
schema: ResponseData
|
|
248
|
+
error: { message: string }
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Bước 5: User review plan → Confirm trước khi implement
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Phase 3: Implement (TDD per subtask)
|
|
256
|
+
|
|
257
|
+
**Trigger:** `/evnict-kit:implement` (sau khi plan đã confirm)
|
|
258
|
+
|
|
259
|
+
### Pre-conditions
|
|
260
|
+
- Plan đã được user approve
|
|
261
|
+
- Working tree clean (`git status`)
|
|
262
|
+
|
|
263
|
+
### Bước 1: Tạo feature branch
|
|
264
|
+
```bash
|
|
265
|
+
git checkout -b feature/{feature-slug}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Bước 2: Với MỖI task file, thực hiện TDD cycle
|
|
269
|
+
|
|
270
|
+
> **MANDATORY:** Sau mỗi task → STOP-AND-ASK (xem implement workflow).
|
|
271
|
+
> Agent KHÔNG ĐƯỢC tự chuyển sang task tiếp mà không hỏi user.
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
┌─────────────────────────────────────────────┐
|
|
275
|
+
│ Đọc task spec (tasks/01-xxx.md) │
|
|
276
|
+
│ ↓ │
|
|
277
|
+
│ [RED] Viết test TRƯỚC → test FAIL │
|
|
278
|
+
│ ↓ │
|
|
279
|
+
│ [GREEN] Code TỐI THIỂU để test PASS │
|
|
280
|
+
│ ↓ │
|
|
281
|
+
│ Verify: lint pass + build OK │
|
|
282
|
+
│ ↓ │
|
|
283
|
+
│ [REFACTOR] Cải thiện (test vẫn PASS) │
|
|
284
|
+
│ ↓ │
|
|
285
|
+
│ Commit: feat({module}): {task} [task-{N}] │
|
|
286
|
+
│ ↓ │
|
|
287
|
+
│ Cập nhật handoff status │
|
|
288
|
+
│ ↓ │
|
|
289
|
+
│ ══ STOP-AND-ASK ══ (6 options A-F) │
|
|
290
|
+
│ Chờ user approve trước khi tiếp tục │
|
|
291
|
+
│ ↓ │
|
|
292
|
+
│ → Task tiếp theo (chỉ khi user chọn A/F) │
|
|
293
|
+
└─────────────────────────────────────────────┘
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Bước 3: 3-Strike Rule (QĐ-TTPM Mục 8.7)
|
|
297
|
+
Nếu test fail > 3 lần cho cùng 1 đoạn code:
|
|
298
|
+
1. **DỪNG** phiên AI
|
|
299
|
+
2. Báo user: "Task {N} gặp vấn đề, cần phân tích thủ công"
|
|
300
|
+
3. KHÔNG tiếp tục implement
|
|
301
|
+
|
|
302
|
+
### Bước 4: FE↔BE Coordination
|
|
303
|
+
Khi BE agent xong API:
|
|
304
|
+
1. Ghi API contract vào `.evnict/handoff/contracts/{feature}-api.yaml`
|
|
305
|
+
2. Cập nhật `.evnict/handoff/be-status.md`:
|
|
306
|
+
```
|
|
307
|
+
status: done
|
|
308
|
+
completed_tasks: ["task-01", "task-02", "task-03", "task-04"]
|
|
309
|
+
api_contract: handoff/contracts/{feature}-api.yaml
|
|
310
|
+
last_updated: {timestamp}
|
|
311
|
+
```
|
|
312
|
+
3. FE agent đọc contract → implement FE tasks
|
|
313
|
+
|
|
314
|
+
### Bước 5: Final verify
|
|
315
|
+
```bash
|
|
316
|
+
# Tất cả test pass
|
|
317
|
+
./mvnw test # hoặc ng test --watch=false
|
|
318
|
+
# Lint pass
|
|
319
|
+
./mvnw spotless:check # hoặc ng lint
|
|
320
|
+
# Build OK
|
|
321
|
+
./mvnw compile # hoặc ng build
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Phase 4: Archive + Wiki
|
|
327
|
+
|
|
328
|
+
**Trigger:** `/evnict-kit:wiki-archive-feature` (sau khi implement xong, user đã review)
|
|
329
|
+
|
|
330
|
+
### Bước 1: Tự tóm tắt feature
|
|
331
|
+
Đọc:
|
|
332
|
+
- `.evnict/specs/{feature}/spec.md`
|
|
333
|
+
- `git log --oneline` trên feature branch
|
|
334
|
+
- Files changed (`git diff --stat main..HEAD`)
|
|
335
|
+
|
|
336
|
+
### Bước 2: Push vào wiki
|
|
337
|
+
Sinh file markdown:
|
|
338
|
+
```markdown
|
|
339
|
+
---
|
|
340
|
+
title: "{feature_name}"
|
|
341
|
+
domain: "{module}"
|
|
342
|
+
type: feature
|
|
343
|
+
date: {YYYY-MM-DD}
|
|
344
|
+
tags: [{auto-detected tags}]
|
|
345
|
+
related_specs: [".evnict/specs/{feature}/spec.md"]
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Tóm tắt
|
|
349
|
+
{AI-generated summary — 3-5 câu}
|
|
350
|
+
|
|
351
|
+
## API mới
|
|
352
|
+
{list endpoints added/changed}
|
|
353
|
+
|
|
354
|
+
## Database changes
|
|
355
|
+
{list migrations}
|
|
356
|
+
|
|
357
|
+
## Files thay đổi chính
|
|
358
|
+
{key files changed}
|
|
359
|
+
|
|
360
|
+
## Lessons learned
|
|
361
|
+
{AI-detected issues và cách giải quyết}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Copy vào `{wiki_path}/raw/notes/{domain}-{slug}.md`
|
|
365
|
+
|
|
366
|
+
### Bước 3: Trigger ingest
|
|
367
|
+
```bash
|
|
368
|
+
cd {wiki_path} && npm run ingest
|
|
369
|
+
```
|
|
370
|
+
⚠️ Nếu ingest chưa setup → nhắc user chạy `/evnict-kit:init-wiki`
|
|
371
|
+
|
|
372
|
+
### Bước 4: Archive spec
|
|
373
|
+
Copy `.evnict/specs/{feature}/` → `docs/specs/{feature}/`
|
|
374
|
+
|
|
375
|
+
### Bước 5: Tạo tài liệu đặc tả (QĐ-TTPM Mục 8.9)
|
|
376
|
+
Nếu thay đổi > 20 dòng code → tạo `docs/postmortem/{feature}-{date}.md`:
|
|
377
|
+
| # | Nội dung | Chi tiết |
|
|
378
|
+
|---|----------|----------|
|
|
379
|
+
| 1 | Nhiệm vụ | Task giao cho Agent |
|
|
380
|
+
| 2 | Công cụ | Tool + model + config |
|
|
381
|
+
| 3 | Prompt chính | Prompts quan trọng (đã clean sensitive) |
|
|
382
|
+
| 4 | Thay đổi | Files changed + tóm tắt |
|
|
383
|
+
| 5 | Kiểm tra | Tests, lint, security scan |
|
|
384
|
+
| 6 | Vấn đề | Issues + lessons learned |
|
|
385
|
+
| 7 | Commit ref | Hash các commit liên quan |
|
|
386
|
+
|
|
387
|
+
### Bước 6: Confirm
|
|
388
|
+
```
|
|
389
|
+
✅ Wiki updated: {wiki_path}/raw/notes/{file}
|
|
390
|
+
✅ Spec archived: docs/specs/{feature}/
|
|
391
|
+
✅ Postmortem: docs/postmortem/{feature}-{date}.md
|
|
392
|
+
✅ Ingest triggered
|
|
393
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Feature nhỏ nhanh — skip spec chi tiết, query wiki → plan ngắn → TDD → archive. Dùng khi feature đơn giản, dưới 1 ngày.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Feature Small
|
|
6
|
+
**Command:** `/evnict-kit:feature-small`
|
|
7
|
+
|
|
8
|
+
## Khi nào dùng
|
|
9
|
+
- Feature nhỏ, đơn giản (1 API, 1 component, sửa logic)
|
|
10
|
+
- Không cần spec chi tiết
|
|
11
|
+
- Ước lượng < 1 ngày
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
- Mô tả feature ngắn gọn
|
|
15
|
+
- VD: `/evnict-kit:feature-small Thêm API export danh sách khách hàng ra Excel`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Bước 1: Query wiki
|
|
20
|
+
Tìm context liên quan trong wiki:
|
|
21
|
+
```bash
|
|
22
|
+
grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md"
|
|
23
|
+
```
|
|
24
|
+
Đọc kết quả → áp dụng context.
|
|
25
|
+
|
|
26
|
+
## Bước 2: Plan ngắn
|
|
27
|
+
Tạo plan trực tiếp (KHÔNG tạo spec file):
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
## Quick Plan: {feature}
|
|
31
|
+
- Files cần tạo/sửa: {list}
|
|
32
|
+
- Test cases: {list}
|
|
33
|
+
- Dependencies: {list}
|
|
34
|
+
- Estimated: {X} phút
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Hỏi user confirm plan trước khi implement.
|
|
38
|
+
|
|
39
|
+
## Bước 3: Checkpoint
|
|
40
|
+
```bash
|
|
41
|
+
git checkout -b feature/{slug}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Bước 4: TDD Implement
|
|
45
|
+
Với mỗi file:
|
|
46
|
+
1. [RED] Viết test → FAIL
|
|
47
|
+
2. [GREEN] Code tối thiểu → PASS
|
|
48
|
+
3. Verify: `./mvnw test` + `./mvnw compile`
|
|
49
|
+
4. Commit: `feat({module}): {description}`
|
|
50
|
+
|
|
51
|
+
3-Strike Rule vẫn áp dụng.
|
|
52
|
+
|
|
53
|
+
## Bước 5: Final verify
|
|
54
|
+
```bash
|
|
55
|
+
./mvnw test && ./mvnw spotless:check && ./mvnw compile
|
|
56
|
+
# hoặc
|
|
57
|
+
ng test --watch=false && ng lint && ng build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Bước 6: Archive (optional)
|
|
61
|
+
Nếu thay đổi > 20 dòng → push wiki + tạo postmortem.
|
|
62
|
+
Nếu < 20 dòng → skip, chỉ commit.
|
|
63
|
+
|
|
64
|
+
## Bước cuối: Wiki
|
|
65
|
+
Gợi ý user:
|
|
66
|
+
```
|
|
67
|
+
💡 Feature hoàn thành. Thêm tri thức vào wiki?
|
|
68
|
+
A) Có — chạy `/evnict-kit:wiki-archive-feature` (nạp đầy đủ)
|
|
69
|
+
B) Nhanh — tôi tóm tắt ngắn gọn → push wiki
|
|
70
|
+
C) Không — skip
|
|
71
|
+
```
|
|
72
|
+
- Nếu A → chạy `/evnict-kit:wiki-archive-feature`
|
|
73
|
+
- Nếu B → gọi skill `evnict-kit-wiki` action=push → auto-ingest
|
|
74
|
+
- Nếu C → skip
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Checklist hoàn thành
|
|
79
|
+
- [ ] Wiki queried
|
|
80
|
+
- [ ] Plan confirmed
|
|
81
|
+
- [ ] Checkpoint created
|
|
82
|
+
- [ ] TDD implemented
|
|
83
|
+
- [ ] All tests pass
|
|
84
|
+
- [ ] Build OK
|
|
85
|
+
- [ ] Committed
|
|
86
|
+
- [ ] Wiki updated (nếu > 20 dòng)
|