@leejungkiin/awkit 1.0.0
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/CHANGELOG.md +27 -0
- package/README.md +146 -0
- package/VERSION +1 -0
- package/bin/awf.js +549 -0
- package/bin/awk.js +1759 -0
- package/core/AGENTS.md +39 -0
- package/core/GEMINI.md +202 -0
- package/core/GEMINI.md.bak +244 -0
- package/core/orchestrator.md +58 -0
- package/package.json +46 -0
- package/schemas/brain.schema.json +342 -0
- package/schemas/preferences.schema.json +95 -0
- package/schemas/session.schema.json +112 -0
- package/skill-packs/neural-memory/README.md +111 -0
- package/skill-packs/neural-memory/pack.json +35 -0
- package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
- package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
- package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
- package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
- package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
- package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
- package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
- package/skills/adaptive-language/SKILL.md +189 -0
- package/skills/ambient-brain/SKILL.md +314 -0
- package/skills/ambient-brain/brain-router.md +185 -0
- package/skills/ambient-brain/brain-templates.md +201 -0
- package/skills/auto-save/SKILL.md +223 -0
- package/skills/awf-adaptive-language/SKILL.md +189 -0
- package/skills/awf-context-help/SKILL.md +180 -0
- package/skills/awf-error-translator/SKILL.md +153 -0
- package/skills/awf-session-restore/SKILL.md +270 -0
- package/skills/awf-version-tracker/SKILL.md +32 -0
- package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
- package/skills/beads-manager/SKILL.md +323 -0
- package/skills/brainstorm-agent/SKILL.md +295 -0
- package/skills/context-help/SKILL.md +180 -0
- package/skills/error-translator/SKILL.md +153 -0
- package/skills/ios-engineer/SKILL.md +101 -0
- package/skills/memory-sync/SKILL.md +378 -0
- package/skills/memory-sync/memory-router.md +185 -0
- package/skills/memory-sync/memory-templates.md +201 -0
- package/skills/orchestrator/SKILL.md +193 -0
- package/skills/session-restore/SKILL.md +240 -0
- package/templates/CODEBASE.md +80 -0
- package/templates/brain.example.json +321 -0
- package/templates/preferences.example.json +21 -0
- package/templates/project-identity/android.json +28 -0
- package/templates/project-identity/backend-nestjs.json +24 -0
- package/templates/project-identity/expo.json +27 -0
- package/templates/project-identity/ios.json +27 -0
- package/templates/project-identity/web-nextjs.json +24 -0
- package/templates/session.example.json +53 -0
- package/templates/specs/design-template.md +166 -0
- package/templates/specs/requirements-template.md +65 -0
- package/templates/specs/tasks-template.md +132 -0
- package/templates/structures/android.txt +10 -0
- package/templates/structures/backend-nestjs.txt +6 -0
- package/templates/structures/expo.txt +9 -0
- package/templates/structures/ios.txt +9 -0
- package/templates/structures/web-nextjs.txt +6 -0
- package/templates/workflow_dual_mode_template.md +87 -0
- package/workflows/_uncategorized/README.md +339 -0
- package/workflows/_uncategorized/ads-creative.md +357 -0
- package/workflows/_uncategorized/ads-full-optimization.md +308 -0
- package/workflows/_uncategorized/ads-plan.md +247 -0
- package/workflows/_uncategorized/ads-user-analysis.md +337 -0
- package/workflows/_uncategorized/skill-health.md +35 -0
- package/workflows/_uncategorized/skill-rollback.md +35 -0
- package/workflows/ads/admob.md +62 -0
- package/workflows/ads/ads-analyst.md +201 -0
- package/workflows/ads/ads-audit.md +106 -0
- package/workflows/ads/ads-optimize.md +97 -0
- package/workflows/ads/ads-targeting.md +241 -0
- package/workflows/ads/adsExpert.md +160 -0
- package/workflows/ads/smali-ads-config.md +400 -0
- package/workflows/ads/smali-ads-flow.md +331 -0
- package/workflows/ads/smali-ads-interstitial.md +377 -0
- package/workflows/ads/smali-ads-native.md +382 -0
- package/workflows/context/auto-execution-workflow.md +291 -0
- package/workflows/context/auto-implement.md +211 -0
- package/workflows/context/codebase-sync.md +163 -0
- package/workflows/context/logic-reasoning-workflow.md +260 -0
- package/workflows/context/next.md +195 -0
- package/workflows/context/recap.md +212 -0
- package/workflows/context/save-brain.md +285 -0
- package/workflows/context/user-intent-analysis-workflow.md +206 -0
- package/workflows/expert/codeExpert.md +126 -0
- package/workflows/expert/debugExpert.md +136 -0
- package/workflows/expert/planExpert.md +112 -0
- package/workflows/git/cloudflare-tunnel.md +135 -0
- package/workflows/git/git-commit-workflow.md +75 -0
- package/workflows/git/hotfix.md +357 -0
- package/workflows/git/release-notes.md +160 -0
- package/workflows/git/rollback.md +52 -0
- package/workflows/git/smart-git-ops.md +103 -0
- package/workflows/lifecycle/brainstorm.md +377 -0
- package/workflows/lifecycle/code.md +663 -0
- package/workflows/lifecycle/debug.md +116 -0
- package/workflows/lifecycle/deploy.md +95 -0
- package/workflows/lifecycle/init.md +152 -0
- package/workflows/lifecycle/master-code-workflow.md +300 -0
- package/workflows/lifecycle/migration.md +196 -0
- package/workflows/lifecycle/plan.md +91 -0
- package/workflows/lifecycle/refactor.md +165 -0
- package/workflows/lifecycle/run.md +52 -0
- package/workflows/lifecycle/test.md +91 -0
- package/workflows/meta/customize.md +346 -0
- package/workflows/meta/file-protection-rules.md +129 -0
- package/workflows/meta/help.html +350 -0
- package/workflows/meta/project-identity-enforcement.md +180 -0
- package/workflows/mobile/app-analysis.md +64 -0
- package/workflows/mobile/maestro-qa-workflow.md +470 -0
- package/workflows/mobile/maestro-test-workflow.md +84 -0
- package/workflows/mobile/structure-clean-architect.md +271 -0
- package/workflows/mobile/turbo-mobile-build.md +190 -0
- package/workflows/quality/accessibility-audit.md +311 -0
- package/workflows/quality/audit.md +217 -0
- package/workflows/quality/bug-hunter.md +243 -0
- package/workflows/quality/code-janitor.md +209 -0
- package/workflows/quality/code-quality-rules.md +132 -0
- package/workflows/quality/performance-audit.md +343 -0
- package/workflows/quality/project-audit.md +61 -0
- package/workflows/quality/self-healing-test.md +192 -0
- package/workflows/quality/ui-review.md +130 -0
- package/workflows/quality/ux-audit.md +213 -0
- package/workflows/quality/visual-debug.md +34 -0
- package/workflows/roles/oracle.md +267 -0
- package/workflows/roles/product-manager-workflow.md +52 -0
- package/workflows/roles/qa-engineer-workflow.md +41 -0
- package/workflows/roles/tech-lead-workflow.md +45 -0
- package/workflows/roles/ui-ux-designer-workflow.md +42 -0
- package/workflows/roles/vibe-coding-master-workflow.md +52 -0
- package/workflows/ui/app-screen-analyzer.md +152 -0
- package/workflows/ui/create-feature.md +332 -0
- package/workflows/ui/create-spec-architect.md +184 -0
- package/workflows/ui/design-to-ui.md +308 -0
- package/workflows/ui/ui-first-methodology.md +279 -0
- package/workflows/ui/visualize.md +298 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Phân tích và suy luận ý định thực sự của người dùng trước khi hành động.
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# User Intent Analysis & Reasoning Workflow
|
|
7
|
+
|
|
8
|
+
## Nguyên Tắc Cốt Lõi
|
|
9
|
+
|
|
10
|
+
- **_BẮT BUỘC_** kiểm tra Beads task trước khi phân tích bất kỳ yêu cầu coding nào
|
|
11
|
+
- **_BẮT BUỘC_** phân tích và suy luận ý định thực sự của người dùng
|
|
12
|
+
- **_BẮT BUỘC_** đề xuất giải pháp tối ưu thay vì chỉ làm theo nghĩa đen
|
|
13
|
+
- **_NGHIÊM CẤM_** bỏ qua Beads check kể cả khi user nói “nhanh lên”, “làm luôn”
|
|
14
|
+
|
|
15
|
+
## ⛔ Pre-Analysis Beads Gate (LUÔN LUÔN CHẠY TRƯỚC)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Trước khi phân tích bất kỳ yêu cầu coding/debug/plan:
|
|
19
|
+
bd list --status in_progress
|
|
20
|
+
|
|
21
|
+
# Nếu có task → Confirm: “Đây có liên quan đến Task #X không?”
|
|
22
|
+
# Nếu không có → Tạo task mới sau khi confirm với user
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Trigger Conditions (Kích Hoạt)
|
|
28
|
+
|
|
29
|
+
Workflow này được kích hoạt cho TẤT CẢ yêu cầu của người dùng, bao gồm:
|
|
30
|
+
|
|
31
|
+
- Yêu cầu tạo/sửa code
|
|
32
|
+
- Yêu cầu debug/fix lỗi
|
|
33
|
+
- Yêu cầu thêm tính năng
|
|
34
|
+
- Yêu cầu tối ưu hóa
|
|
35
|
+
- Yêu cầu refactoring
|
|
36
|
+
- Yêu cầu giải thích/hướng dẫn
|
|
37
|
+
- Yêu cầu phân tích/review
|
|
38
|
+
- Bất kỳ yêu cầu nào khác
|
|
39
|
+
|
|
40
|
+
## Intent Analysis Process (Quy Trình Phân Tích Ý Định)
|
|
41
|
+
|
|
42
|
+
### Phase 1: Request Parsing & Context Gathering
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
steps:
|
|
46
|
+
1. parse_user_request:
|
|
47
|
+
- extract_explicit_requirements: "Những gì người dùng nói rõ ràng"
|
|
48
|
+
- identify_implicit_needs: "Những gì người dùng có thể cần nhưng chưa nói"
|
|
49
|
+
- detect_emotional_context: "Mức độ cấp thiết, frustration, confusion"
|
|
50
|
+
|
|
51
|
+
2. gather_project_context:
|
|
52
|
+
- check_project_identity: "Loại dự án, tech stack, mục tiêu"
|
|
53
|
+
- analyze_current_state: "Trạng thái hiện tại của codebase"
|
|
54
|
+
- review_recent_changes: "Những thay đổi gần đây"
|
|
55
|
+
- check_existing_plans: "Planning files, brainstorm documents"
|
|
56
|
+
|
|
57
|
+
3. assess_user_expertise:
|
|
58
|
+
- technical_level: "Beginner/Intermediate/Advanced"
|
|
59
|
+
- domain_knowledge: "Hiểu biết về lĩnh vực cụ thể"
|
|
60
|
+
- communication_style: "Formal/Casual, Vietnamese/English preference"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Phase 2: Intent Classification & Analysis
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
intent_categories:
|
|
67
|
+
immediate_fix:
|
|
68
|
+
description: "Sửa lỗi cấp thiết, unblock development"
|
|
69
|
+
priority: "High"
|
|
70
|
+
analysis_depth: "Quick but thorough"
|
|
71
|
+
|
|
72
|
+
feature_development:
|
|
73
|
+
description: "Thêm tính năng mới hoặc cải thiện existing"
|
|
74
|
+
priority: "Medium"
|
|
75
|
+
analysis_depth: "Comprehensive with suggestions"
|
|
76
|
+
|
|
77
|
+
learning_exploration:
|
|
78
|
+
description: "Hiểu cách hoạt động, học hỏi"
|
|
79
|
+
priority: "Low"
|
|
80
|
+
analysis_depth: "Educational with explanations"
|
|
81
|
+
|
|
82
|
+
optimization_improvement:
|
|
83
|
+
description: "Cải thiện performance, code quality"
|
|
84
|
+
priority: "Medium"
|
|
85
|
+
analysis_depth: "Detailed with alternatives"
|
|
86
|
+
|
|
87
|
+
planning_strategy:
|
|
88
|
+
description: "Lập kế hoạch, brainstorm, architecture"
|
|
89
|
+
priority: "High"
|
|
90
|
+
analysis_depth: "Strategic with long-term view"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Phase 3: Root Cause & Goal Identification
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
analysis_framework:
|
|
97
|
+
what_user_said:
|
|
98
|
+
- literal_request: "Yêu cầu đúng nghĩa đen"
|
|
99
|
+
- specific_details: "Chi tiết cụ thể được đề cập"
|
|
100
|
+
|
|
101
|
+
what_user_means:
|
|
102
|
+
- underlying_problem: "Vấn đề thực sự cần giải quyết"
|
|
103
|
+
- business_goal: "Mục tiêu kinh doanh/dự án"
|
|
104
|
+
- technical_goal: "Mục tiêu kỹ thuật"
|
|
105
|
+
|
|
106
|
+
what_user_needs:
|
|
107
|
+
- immediate_solution: "Giải pháp ngay lập tức"
|
|
108
|
+
- long_term_strategy: "Chiến lược dài hạn"
|
|
109
|
+
- knowledge_transfer: "Kiến thức cần truyền đạt"
|
|
110
|
+
- risk_mitigation: "Rủi ro cần tránh"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Phase 4: Solution Strategy & Alternatives
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
solution_generation:
|
|
117
|
+
primary_solution:
|
|
118
|
+
- direct_approach: "Giải pháp trực tiếp cho yêu cầu"
|
|
119
|
+
- pros_cons: "Ưu nhược điểm"
|
|
120
|
+
- implementation_effort: "Effort cần thiết"
|
|
121
|
+
|
|
122
|
+
alternative_solutions:
|
|
123
|
+
- better_approach: "Cách tiếp cận tốt hơn (nếu có)"
|
|
124
|
+
- simpler_solution: "Giải pháp đơn giản hơn"
|
|
125
|
+
- comprehensive_solution: "Giải pháp toàn diện hơn"
|
|
126
|
+
|
|
127
|
+
recommendation:
|
|
128
|
+
- suggested_approach: "Approach được đề xuất"
|
|
129
|
+
- reasoning: "Lý do tại sao đề xuất này"
|
|
130
|
+
- trade_offs: "Trade-offs cần cân nhắc"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Reasoning Presentation Template
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
## 🧠 Phân Tích Ý Định & Suy Luận
|
|
137
|
+
|
|
138
|
+
### 📝 Yêu Cầu Của Bạn
|
|
139
|
+
|
|
140
|
+
**Yêu cầu trực tiếp**: [Những gì user nói]
|
|
141
|
+
**Ngữ cảnh dự án**: [Project context]
|
|
142
|
+
**Mức độ ưu tiên**: [High/Medium/Low]
|
|
143
|
+
|
|
144
|
+
### 🎯 Ý Định Thực Sự (Phân Tích)
|
|
145
|
+
|
|
146
|
+
**Vấn đề cần giải quyết**: [Root problem]
|
|
147
|
+
**Mục tiêu cuối cùng**: [End goal]
|
|
148
|
+
**Tại sao cần làm**: [Business/technical justification]
|
|
149
|
+
|
|
150
|
+
### 💡 Phân Tích Giải Pháp
|
|
151
|
+
|
|
152
|
+
#### ✅ Giải Pháp Đề Xuất (Recommended)
|
|
153
|
+
|
|
154
|
+
- **Approach**: [Recommended solution]
|
|
155
|
+
- **Lý do**: [Why this is better]
|
|
156
|
+
- **Effort**: [Implementation effort]
|
|
157
|
+
- **Benefits**: [Key benefits]
|
|
158
|
+
|
|
159
|
+
#### 🔄 Các Lựa Chọn Khác
|
|
160
|
+
|
|
161
|
+
1. **[Alternative 1]**: [Description] - [Pros/Cons]
|
|
162
|
+
2. **[Alternative 2]**: [Description] - [Pros/Cons]
|
|
163
|
+
|
|
164
|
+
### ⚠️ Cân Nhắc Quan Trọng
|
|
165
|
+
|
|
166
|
+
- **Rủi ro**: [Potential risks]
|
|
167
|
+
- **Dependencies**: [What this depends on]
|
|
168
|
+
- **Impact**: [How this affects other parts]
|
|
169
|
+
|
|
170
|
+
### 🤔 Xác Nhận Hiểu Đúng
|
|
171
|
+
|
|
172
|
+
**Tôi hiểu bạn muốn**: [Summary of understanding]
|
|
173
|
+
**Approach tôi đề xuất**: [Recommended approach]
|
|
174
|
+
**Có đúng không?** [Request confirmation]
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
_Nếu tôi hiểu đúng, tôi sẽ tiến hành với approach được đề xuất. Nếu không, hãy cho tôi biết điều chỉnh!_
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Quality Assurance
|
|
182
|
+
|
|
183
|
+
### Analysis Quality Metrics
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
quality_indicators:
|
|
187
|
+
understanding_accuracy:
|
|
188
|
+
- user_confirms_understanding: "User says 'yes, exactly'"
|
|
189
|
+
- no_follow_up_corrections: "No need to re-explain"
|
|
190
|
+
- solution_addresses_root_cause: "Solves the real problem"
|
|
191
|
+
|
|
192
|
+
solution_effectiveness:
|
|
193
|
+
- prevents_future_issues: "Addresses underlying problems"
|
|
194
|
+
- aligns_with_project_goals: "Supports overall objectives"
|
|
195
|
+
- considers_long_term_impact: "Sustainable solution"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Implementation Guidelines
|
|
199
|
+
|
|
200
|
+
### For AI Assistant
|
|
201
|
+
|
|
202
|
+
1. **Always start with analysis** - Never jump straight to implementation
|
|
203
|
+
2. **Show your reasoning** - Make thought process transparent
|
|
204
|
+
3. **Seek confirmation** - Ensure understanding before proceeding
|
|
205
|
+
4. **Offer alternatives** - Present multiple approaches when applicable
|
|
206
|
+
5. **Consider context** - Factor in project state and user expertise
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 💻 Code ngay lập tức (Expert Mode)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WORKFLOW: /codeExpert - Instant Coding
|
|
6
|
+
|
|
7
|
+
> **Expert Mode Only:** Code ngay dựa trên spec/plan, không hỏi gì cả.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
/codeExpert [target]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Examples:**
|
|
18
|
+
```bash
|
|
19
|
+
/codeExpert phase-01 # Code toàn bộ phase 01
|
|
20
|
+
/codeExpert "Login API" # Code task cụ thể
|
|
21
|
+
/codeExpert # Code task tiếp theo (auto-detect từ Beads)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Execution Flow
|
|
27
|
+
|
|
28
|
+
### 1. Context Detection (Auto)
|
|
29
|
+
|
|
30
|
+
**Priority 1: Beads**
|
|
31
|
+
```bash
|
|
32
|
+
bd list --status in_progress
|
|
33
|
+
```
|
|
34
|
+
- Nếu có → Resume task đó
|
|
35
|
+
- Nếu không → Check `bd list --status open` → Pick P0 task
|
|
36
|
+
|
|
37
|
+
**Priority 2: Argument**
|
|
38
|
+
- Nếu có `phase-XX` → Load phase file
|
|
39
|
+
- Nếu có task name → Search trong plan
|
|
40
|
+
|
|
41
|
+
**Priority 3: Brain**
|
|
42
|
+
- Đọc `brain/active_plans.json` → Load plan mới nhất
|
|
43
|
+
|
|
44
|
+
### 2. Load Spec/Plan
|
|
45
|
+
- Đọc spec từ `docs/specs/` hoặc phase file
|
|
46
|
+
- Parse requirements và implementation steps
|
|
47
|
+
|
|
48
|
+
### 3. Execute (Zero Questions)
|
|
49
|
+
- Viết code theo spec
|
|
50
|
+
- Tự động thêm:
|
|
51
|
+
- Input validation
|
|
52
|
+
- Error handling
|
|
53
|
+
- Type safety
|
|
54
|
+
- Comments (minimal, code tự giải thích)
|
|
55
|
+
|
|
56
|
+
### 4. Auto-Test
|
|
57
|
+
- Chạy test liên quan (nếu có)
|
|
58
|
+
- Fix lỗi tự động (max 3 lần)
|
|
59
|
+
- Nếu fail sau 3 lần → Tạo Beads task "Fix test for [Feature]"
|
|
60
|
+
|
|
61
|
+
### 5. Update Beads
|
|
62
|
+
```bash
|
|
63
|
+
bd update [task-id] --status done
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 6. Report
|
|
67
|
+
```
|
|
68
|
+
✅ **CODE COMPLETE**
|
|
69
|
+
|
|
70
|
+
📝 **Task:** Implement Login API
|
|
71
|
+
📂 **Files:**
|
|
72
|
+
- src/api/auth/login.ts (created)
|
|
73
|
+
- src/api/auth/login.test.ts (created)
|
|
74
|
+
|
|
75
|
+
✅ **Tests:** 5/5 passed
|
|
76
|
+
|
|
77
|
+
📿 **Beads:** Task #123 → Done
|
|
78
|
+
|
|
79
|
+
➡️ **Next:** /codeExpert (Auto-pick next task)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Assumptions (Expert Mode)
|
|
85
|
+
|
|
86
|
+
AI sẽ tự động quyết định:
|
|
87
|
+
- ✅ File structure (theo project conventions)
|
|
88
|
+
- ✅ Naming conventions (camelCase/PascalCase based on language)
|
|
89
|
+
- ✅ Error handling strategy (try-catch + logging)
|
|
90
|
+
- ✅ Test coverage (critical paths only)
|
|
91
|
+
|
|
92
|
+
**Không hỏi về code quality level.** Mặc định: **PRODUCTION**.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Error Handling
|
|
97
|
+
|
|
98
|
+
### No Context
|
|
99
|
+
```
|
|
100
|
+
❌ Error: No active task or plan found
|
|
101
|
+
|
|
102
|
+
Suggestions:
|
|
103
|
+
1. Create plan first: /planExpert "Feature"
|
|
104
|
+
2. Specify target: /codeExpert "Task Name"
|
|
105
|
+
3. Check Beads: bd list
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Test Fail (After 3 Retries)
|
|
109
|
+
```
|
|
110
|
+
⚠️ Auto-fix failed after 3 attempts
|
|
111
|
+
|
|
112
|
+
📿 Created task: #456 "Fix test for Login API"
|
|
113
|
+
|
|
114
|
+
Options:
|
|
115
|
+
1. Debug manually: /debugExpert
|
|
116
|
+
2. Skip tests: /codeExpert --skip-tests (Not recommended)
|
|
117
|
+
3. Continue next task: /codeExpert
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Integration
|
|
123
|
+
|
|
124
|
+
- **Beads:** Auto-update task status
|
|
125
|
+
- **Brain:** Auto-save code patterns to knowledge base
|
|
126
|
+
- **Git:** Auto-stage changes (optional)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 🐞 Sửa lỗi tự động (Expert Mode)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WORKFLOW: /debugExpert - Auto Debug & Fix
|
|
6
|
+
|
|
7
|
+
> **Expert Mode Only:** Tự động phân tích và sửa lỗi, không hỏi gì cả.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
/debugExpert [file]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Examples:**
|
|
18
|
+
```bash
|
|
19
|
+
/debugExpert # Auto-detect lỗi từ logs
|
|
20
|
+
/debugExpert src/api/auth/login.ts # Debug file cụ thể
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Execution Flow
|
|
26
|
+
|
|
27
|
+
### 1. Error Detection (Auto)
|
|
28
|
+
|
|
29
|
+
**Source Priority:**
|
|
30
|
+
1. Terminal output (last 100 lines)
|
|
31
|
+
2. Log files (`logs/*.log`)
|
|
32
|
+
3. Test failures (Jest/Mocha/XCTest output)
|
|
33
|
+
4. Linter errors (ESLint/SwiftLint)
|
|
34
|
+
|
|
35
|
+
**Parse:**
|
|
36
|
+
- Error type
|
|
37
|
+
- File & line number
|
|
38
|
+
- Stack trace
|
|
39
|
+
- Error message
|
|
40
|
+
|
|
41
|
+
### 2. Root Cause Analysis (Auto)
|
|
42
|
+
|
|
43
|
+
**Common Patterns:**
|
|
44
|
+
- `undefined/null` → Add null check
|
|
45
|
+
- `Module not found` → Add import
|
|
46
|
+
- `Type error` → Fix type annotation
|
|
47
|
+
- `API 401/403` → Check auth token
|
|
48
|
+
- `API 500` → Check server logs
|
|
49
|
+
- `CORS` → Update server config
|
|
50
|
+
|
|
51
|
+
### 3. Auto-Fix (Safe Only)
|
|
52
|
+
|
|
53
|
+
**Safe-to-Fix:**
|
|
54
|
+
- ✅ Missing imports
|
|
55
|
+
- ✅ Typos in variable names
|
|
56
|
+
- ✅ Undefined checks (`if (x)` before `x.map()`)
|
|
57
|
+
- ✅ Type annotations
|
|
58
|
+
- ✅ Linting issues
|
|
59
|
+
|
|
60
|
+
**Need-Review:**
|
|
61
|
+
- ⚠️ Logic errors → Create Beads task
|
|
62
|
+
- ⚠️ Security issues → Create Beads task + Alert
|
|
63
|
+
- ⚠️ Performance issues → Create Beads task
|
|
64
|
+
|
|
65
|
+
### 4. Verify Fix
|
|
66
|
+
|
|
67
|
+
- Chạy lại test/linter
|
|
68
|
+
- Nếu pass → Done
|
|
69
|
+
- Nếu fail → Rollback + Create Beads task
|
|
70
|
+
|
|
71
|
+
### 5. Report
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
✅ **DEBUG COMPLETE**
|
|
75
|
+
|
|
76
|
+
🐛 **Issue:** TypeError: Cannot read 'map' of undefined
|
|
77
|
+
📂 **File:** src/components/ProductList.tsx:42
|
|
78
|
+
|
|
79
|
+
🔧 **Fix Applied:**
|
|
80
|
+
Added null check before mapping products array
|
|
81
|
+
|
|
82
|
+
✅ **Verification:** Tests passed
|
|
83
|
+
|
|
84
|
+
📿 **Beads:** No new tasks (auto-fixed)
|
|
85
|
+
|
|
86
|
+
➡️ **Next:** /codeExpert (Continue coding)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Assumptions (Expert Mode)
|
|
92
|
+
|
|
93
|
+
AI sẽ tự động quyết định:
|
|
94
|
+
- ✅ Fix strategy (null check vs default value vs error throw)
|
|
95
|
+
- ✅ Test coverage (add test for fixed bug)
|
|
96
|
+
- ✅ Rollback on failure
|
|
97
|
+
|
|
98
|
+
**Không hỏi về fix approach.** Chọn cách an toàn nhất.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Error Handling
|
|
103
|
+
|
|
104
|
+
### Cannot Auto-Fix
|
|
105
|
+
```
|
|
106
|
+
⚠️ Cannot auto-fix: Complex logic error
|
|
107
|
+
|
|
108
|
+
📿 Created task: #789 "Fix logic error in calculateTotal()"
|
|
109
|
+
|
|
110
|
+
📋 **Analysis:**
|
|
111
|
+
- Issue: Calculation returns negative value
|
|
112
|
+
- Root cause: Missing validation for discount > price
|
|
113
|
+
- Suggested fix: Add validation before calculation
|
|
114
|
+
|
|
115
|
+
➡️ **Next:**
|
|
116
|
+
1. Fix manually: Open task #789
|
|
117
|
+
2. Get help: /debug (Guided Mode)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Multiple Errors
|
|
121
|
+
```
|
|
122
|
+
⚠️ Found 5 errors
|
|
123
|
+
|
|
124
|
+
✅ Auto-fixed: 3 errors
|
|
125
|
+
📿 Created tasks: 2 errors (#790, #791)
|
|
126
|
+
|
|
127
|
+
➡️ **Next:** bd list --label bug
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Integration
|
|
133
|
+
|
|
134
|
+
- **Beads:** Auto-create tasks for complex bugs
|
|
135
|
+
- **Brain:** Save bug patterns to `brain/bugs/`
|
|
136
|
+
- **Git:** Auto-commit fixes with message "fix: [description]"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 📝 Thiết kế tính năng (Expert Mode - Zero Questions)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WORKFLOW: /planExpert - Instant Plan Generation
|
|
6
|
+
|
|
7
|
+
> **Expert Mode Only:** Tạo plan ngay lập tức, không hỏi gì cả.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
/planExpert "Feature Name"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Example:**
|
|
18
|
+
```bash
|
|
19
|
+
/planExpert "E-commerce Shopping Cart"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Execution Flow
|
|
25
|
+
|
|
26
|
+
### 1. Parse Input
|
|
27
|
+
- Extract feature name from argument.
|
|
28
|
+
- If missing → Error: "Usage: /planExpert \"Feature Name\""
|
|
29
|
+
|
|
30
|
+
### 2. Auto-Generate Spec
|
|
31
|
+
- Tạo `docs/specs/[feature-slug]_spec.md` với:
|
|
32
|
+
- Executive Summary
|
|
33
|
+
- User Stories (3-5 stories cơ bản)
|
|
34
|
+
- Database Design (ERD chuẩn)
|
|
35
|
+
- API Contract (RESTful endpoints)
|
|
36
|
+
- UI Components (danh sách components)
|
|
37
|
+
|
|
38
|
+
### 3. Auto-Generate Phases
|
|
39
|
+
- Tạo `plans/[YYMMDD]-[HHMM]-[feature-slug]/`
|
|
40
|
+
- Số phases tự động dựa trên complexity:
|
|
41
|
+
- Simple: 4 phases (Setup → Backend → Frontend → Test)
|
|
42
|
+
- Medium: 6 phases (+ Database + Integration)
|
|
43
|
+
- Complex: 8+ phases (+ Auth + Deploy + Monitoring)
|
|
44
|
+
|
|
45
|
+
### 4. Sync to Beads
|
|
46
|
+
```bash
|
|
47
|
+
for each phase:
|
|
48
|
+
bd create "Phase X: [Name]" --priority [0-2]
|
|
49
|
+
|
|
50
|
+
for each task in phase:
|
|
51
|
+
bd create "[Task Name]" --parent [Phase ID]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 5. Report
|
|
55
|
+
```
|
|
56
|
+
✅ **PLAN CREATED**
|
|
57
|
+
|
|
58
|
+
📁 Location: plans/260130-1025-shopping-cart/
|
|
59
|
+
📋 Spec: docs/specs/shopping-cart_spec.md
|
|
60
|
+
|
|
61
|
+
📊 **Structure:**
|
|
62
|
+
- 6 Phases
|
|
63
|
+
- 42 Tasks
|
|
64
|
+
- Estimated: 3-4 sessions
|
|
65
|
+
|
|
66
|
+
📿 **Beads:**
|
|
67
|
+
- Created 6 phase tasks
|
|
68
|
+
- Created 42 sub-tasks
|
|
69
|
+
- Ready to start: bd list
|
|
70
|
+
|
|
71
|
+
➡️ **Next:** /codeExpert phase-01
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Assumptions (Expert Mode)
|
|
77
|
+
|
|
78
|
+
AI sẽ tự động quyết định:
|
|
79
|
+
- ✅ Tech stack (dựa trên `.project-identity`)
|
|
80
|
+
- ✅ Database schema (chuẩn 3NF)
|
|
81
|
+
- ✅ API design (RESTful best practices)
|
|
82
|
+
- ✅ UI components (Material/Tailwind based on project)
|
|
83
|
+
- ✅ Test strategy (Unit + Integration)
|
|
84
|
+
|
|
85
|
+
**Không hỏi gì cả.** Nếu cần customize → Dùng `/plan` (Guided Mode).
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Error Handling
|
|
90
|
+
|
|
91
|
+
### Missing Feature Name
|
|
92
|
+
```
|
|
93
|
+
❌ Error: Feature name required
|
|
94
|
+
Usage: /planExpert "Feature Name"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Duplicate Plan
|
|
98
|
+
```
|
|
99
|
+
⚠️ Warning: Plan for "Shopping Cart" already exists at plans/260128-1430-shopping-cart/
|
|
100
|
+
|
|
101
|
+
Options:
|
|
102
|
+
1. Overwrite? /planExpert "Shopping Cart" --force
|
|
103
|
+
2. Create new version? (Auto-append v2)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Integration
|
|
109
|
+
|
|
110
|
+
- **Brain:** Auto-save to `brain/active_plans.json`
|
|
111
|
+
- **Beads:** Auto-create tasks with dependencies
|
|
112
|
+
- **Git:** Auto-commit plan files (optional)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 🌐 Quản lý Cloudflare Tunnel
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Cloudflare Tunnel Configuration
|
|
6
|
+
|
|
7
|
+
## ⚠️ QUAN TRỌNG - ĐỌC TRƯỚC KHI THAY ĐỔI
|
|
8
|
+
|
|
9
|
+
Hệ thống sử dụng **MỘT tunnel duy nhất** cho nhiều services. KHÔNG tạo tunnel mới, chỉ thêm hostname vào config hiện có.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 📋 Hiện Trạng (Cập nhật: 2026-01-13)
|
|
14
|
+
|
|
15
|
+
### Tunnel đang sử dụng
|
|
16
|
+
| Thuộc tính | Giá trị |
|
|
17
|
+
|------------|---------|
|
|
18
|
+
| **Tunnel ID** | `aa304557-6390-44bd-a052-7d7fe2a6e7d6` |
|
|
19
|
+
| **Tunnel Name** | `revenue-bot` |
|
|
20
|
+
| **Domain** | `ebebot.click` |
|
|
21
|
+
| **Chạy như** | Windows Scheduled Task (`CloudflaredTunnel`) dưới SYSTEM account |
|
|
22
|
+
|
|
23
|
+
### Scheduled Tasks (chạy khi startup)
|
|
24
|
+
| Task Name | Executable | Mô tả |
|
|
25
|
+
|-----------|------------|-------|
|
|
26
|
+
| `CloudflaredTunnel` | `cloudflared.exe tunnel run` | Cloudflare Tunnel daemon |
|
|
27
|
+
| `WebhookServer` | `node.exe D:\revenue-bot\webhook-server.js` | LINE Bot webhook server (port 39412) |
|
|
28
|
+
|
|
29
|
+
### Hostname đã cấu hình
|
|
30
|
+
| Hostname | Service (Port) | Mô tả |
|
|
31
|
+
|----------|----------------|-------|
|
|
32
|
+
| `webhook.ebebot.click` | `http://localhost:39412` | LINE Bot webhook server |
|
|
33
|
+
| `pg.ebebot.click` | `http://localhost:8888` | Erablue App (Docker production) |
|
|
34
|
+
|
|
35
|
+
### Config file locations
|
|
36
|
+
| User | Path |
|
|
37
|
+
|------|------|
|
|
38
|
+
| **SYSTEM (production)** | `C:\Windows\System32\config\systemprofile\.cloudflared\config.yml` |
|
|
39
|
+
| **Backend user** | `C:\Users\15931 - Backend\.cloudflared\config.yml` |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🔧 Cách Thêm Hostname Mới
|
|
44
|
+
|
|
45
|
+
### Bước 1: Cập nhật config.yml
|
|
46
|
+
Thêm hostname mới vào **TRƯỚC** dòng `- service: http_status:404`:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
tunnel: aa304557-6390-44bd-a052-7d7fe2a6e7d6
|
|
50
|
+
credentials-file: C:\Windows\System32\config\systemprofile\.cloudflared\aa304557-6390-44bd-a052-7d7fe2a6e7d6.json
|
|
51
|
+
ingress:
|
|
52
|
+
- hostname: webhook.ebebot.click
|
|
53
|
+
service: http://localhost:39412
|
|
54
|
+
- hostname: pg.ebebot.click
|
|
55
|
+
service: http://localhost:8888
|
|
56
|
+
# === THÊM HOSTNAME MỚI Ở ĐÂY ===
|
|
57
|
+
- hostname: new-service.ebebot.click
|
|
58
|
+
service: http://localhost:XXXX
|
|
59
|
+
# ================================
|
|
60
|
+
- service: http_status:404 # <-- LUÔN ĐỂ CUỐI CÙNG
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Bước 2: Thêm DNS route
|
|
64
|
+
```powershell
|
|
65
|
+
cloudflared tunnel route dns aa304557-6390-44bd-a052-7d7fe2a6e7d6 new-service.ebebot.click
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Bước 3: Restart tunnel (PowerShell Admin)
|
|
69
|
+
```powershell
|
|
70
|
+
Stop-ScheduledTask -TaskName "CloudflaredTunnel"
|
|
71
|
+
Start-Sleep 2
|
|
72
|
+
Start-ScheduledTask -TaskName "CloudflaredTunnel"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Bước 4: Verify
|
|
76
|
+
```powershell
|
|
77
|
+
curl https://new-service.ebebot.click
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## ⚠️ Các Lỗi Thường Gặp
|
|
83
|
+
|
|
84
|
+
### Lỗi 1033 - Tunnel không kết nối
|
|
85
|
+
**Nguyên nhân**: Cloudflared không chạy hoặc credentials sai
|
|
86
|
+
**Giải pháp**:
|
|
87
|
+
```powershell
|
|
88
|
+
# Kiểm tra process
|
|
89
|
+
tasklist /FI "IMAGENAME eq cloudflared.exe"
|
|
90
|
+
|
|
91
|
+
# Nếu không chạy, start lại task
|
|
92
|
+
Start-ScheduledTask -TaskName "CloudflaredTunnel"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Lỗi 502 - Bad Gateway
|
|
96
|
+
**Nguyên nhân**: Service backend không chạy hoặc port sai
|
|
97
|
+
**Giải pháp**: Kiểm tra port đúng chưa
|
|
98
|
+
```powershell
|
|
99
|
+
netstat -ano | findstr ":PORT_NUMBER"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Lỗi "Failed to add route: record already exists"
|
|
103
|
+
**Nguyên nhân**: DNS record đã tồn tại
|
|
104
|
+
**Giải pháp**: Vào Cloudflare Dashboard → DNS → xóa record cũ → chạy lại lệnh
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 📁 Credentials & Files
|
|
109
|
+
|
|
110
|
+
| File | Mô tả |
|
|
111
|
+
|------|-------|
|
|
112
|
+
| `aa304557-...7d6.json` | Tunnel credentials (KHÔNG xóa!) |
|
|
113
|
+
| `cert.pem` | Account certificate |
|
|
114
|
+
| `config.yml` | Ingress rules |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🚫 KHÔNG LÀM
|
|
119
|
+
|
|
120
|
+
1. ❌ KHÔNG tạo tunnel mới - chỉ thêm hostname vào tunnel hiện có
|
|
121
|
+
2. ❌ KHÔNG xóa file `.json` credentials
|
|
122
|
+
3. ❌ KHÔNG chạy cloudflared thủ công (dùng Scheduled Task)
|
|
123
|
+
4. ❌ KHÔNG dùng tunnel cũ `d164e5de-...` (đã hỏng)
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## ✅ Checklist Khi Thêm Service Mới
|
|
128
|
+
|
|
129
|
+
- [ ] Service đang chạy ở localhost:PORT?
|
|
130
|
+
- [ ] Port đã confirm bằng `netstat`?
|
|
131
|
+
- [ ] Đã thêm hostname vào config.yml (SYSTEM path)?
|
|
132
|
+
- [ ] Đã chạy `cloudflared tunnel route dns`?
|
|
133
|
+
- [ ] Đã restart Scheduled Task?
|
|
134
|
+
- [ ] Đã test bằng curl/browser?
|
|
135
|
+
- [ ] Đã cập nhật bảng "Hostname đã cấu hình" trong file này?
|