@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.
Files changed (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: awf-error-translator
3
+ description: >-
4
+ Translate technical errors to human-friendly language. Keywords: error,
5
+ translate, explain, help, fix, fail, broken, crash, bug.
6
+ Activates on /debug, /code, /test when errors detected.
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # AWF Error Translator
11
+
12
+ Dịch lỗi kỹ thuật sang ngôn ngữ đời thường cho non-tech users.
13
+
14
+ ## Trigger Conditions
15
+
16
+ **Post-hook for:** `/debug`, `/code`, `/test`
17
+
18
+ **When:** Error message detected in output
19
+
20
+ ## Execution Logic
21
+
22
+ ### Step 1: Detect Error
23
+
24
+ ```
25
+ if output contains error patterns:
26
+ → Activate translation
27
+ else:
28
+ → Skip (no error)
29
+ ```
30
+
31
+ ### Step 2: Match & Translate
32
+
33
+ Match error against database, return human message + action.
34
+
35
+ ### Step 3: Display
36
+
37
+ ```
38
+ ❌ Lỗi: [human message]
39
+ 💡 Gợi ý: [action]
40
+ ```
41
+
42
+ ## Error Translation Database
43
+
44
+ ### Database Errors
45
+
46
+ | Pattern | Human Message | Action |
47
+ |---------|---------------|--------|
48
+ | `ECONNREFUSED` | Database chưa chạy | Khởi động PostgreSQL/MySQL |
49
+ | `ETIMEDOUT` | Database phản hồi chậm quá | Kiểm tra kết nối mạng |
50
+ | `ER_ACCESS_DENIED` | Sai mật khẩu database | Kiểm tra file .env |
51
+ | `relation .* does not exist` | Bảng chưa tồn tại | Chạy migration: `/run migrate` |
52
+ | `duplicate key` | Dữ liệu bị trùng | Kiểm tra unique constraint |
53
+
54
+ ### JavaScript/TypeScript Errors
55
+
56
+ | Pattern | Human Message | Action |
57
+ |---------|---------------|--------|
58
+ | `TypeError: Cannot read` | Đang đọc biến chưa có giá trị | Kiểm tra null/undefined |
59
+ | `ReferenceError` | Dùng biến chưa khai báo | Kiểm tra tên biến |
60
+ | `SyntaxError` | Code viết sai cú pháp | Kiểm tra dấu ngoặc, chấm phẩy |
61
+ | `Maximum call stack` | Vòng lặp vô hạn | Kiểm tra điều kiện dừng |
62
+ | `Cannot find module` | Thiếu package | Chạy `npm install` |
63
+
64
+ ### Network Errors
65
+
66
+ | Pattern | Human Message | Action |
67
+ |---------|---------------|--------|
68
+ | `fetch failed` | Không kết nối được server | Kiểm tra URL và internet |
69
+ | `CORS` | Website chặn request | Cấu hình CORS trên server |
70
+ | `ERR_CERT` | Chứng chỉ SSL lỗi | Dùng HTTP thay HTTPS (dev only) |
71
+ | `timeout` | Request quá lâu | Tăng timeout hoặc kiểm tra server |
72
+ | `ENOTFOUND` | Domain không tồn tại | Kiểm tra lại URL |
73
+
74
+ ### Package Errors
75
+
76
+ | Pattern | Human Message | Action |
77
+ |---------|---------------|--------|
78
+ | `npm ERR!` | Cài package bị lỗi | Xóa node_modules, cài lại |
79
+ | `peer dep` | Phiên bản không tương thích | Cập nhật package.json |
80
+ | `EACCES` | Không có quyền truy cập | Chạy với sudo hoặc sửa quyền |
81
+ | `ENOSPC` | Hết dung lượng ổ đĩa | Dọn dẹp disk |
82
+ | `gyp ERR!` | Lỗi build native module | Cài build tools |
83
+
84
+ ### Test Errors
85
+
86
+ | Pattern | Human Message | Action |
87
+ |---------|---------------|--------|
88
+ | `Expected .* but received` | Test thất bại - kết quả sai | Sửa code hoặc update test |
89
+ | `Timeout` | Test chạy quá lâu | Tăng timeout hoặc optimize |
90
+ | `before each hook` | Setup test bị lỗi | Kiểm tra beforeEach |
91
+ | `snapshot` | UI thay đổi | Update snapshot nếu đúng |
92
+ | `coverage` | Thiếu test coverage | Viết thêm test |
93
+
94
+ ### Build Errors
95
+
96
+ | Pattern | Human Message | Action |
97
+ |---------|---------------|--------|
98
+ | `tsc.*error` | Lỗi TypeScript | Sửa type errors |
99
+ | `ESLint` | Code không đúng style | Chạy lint fix |
100
+ | `Build failed` | Build thất bại | Đọc log chi tiết |
101
+ | `Out of memory` | Hết RAM | Tăng memory limit |
102
+ | `FATAL ERROR` | Lỗi nghiêm trọng | Restart và thử lại |
103
+
104
+ ### Git Errors
105
+
106
+ | Pattern | Human Message | Action |
107
+ |---------|---------------|--------|
108
+ | `conflict` | Code bị xung đột | Merge conflict manually |
109
+ | `rejected` | Push bị từ chối | Pull trước khi push |
110
+ | `detached HEAD` | Không ở branch nào | Checkout về branch |
111
+ | `not a git repo` | Chưa init git | Chạy `git init` |
112
+
113
+ ### Deploy Errors
114
+
115
+ | Pattern | Human Message | Action |
116
+ |---------|---------------|--------|
117
+ | `502 Bad Gateway` | Server không phản hồi | Restart server |
118
+ | `503 Service` | Server quá tải | Scale up resources |
119
+ | `permission denied` | Không có quyền deploy | Kiểm tra credentials |
120
+ | `quota exceeded` | Hết quota | Nâng cấp plan |
121
+
122
+ ## Output Format
123
+
124
+ ```
125
+ 🔍 Translating error...
126
+
127
+ ❌ Lỗi: [human_message]
128
+ └─ Gốc: [original_error_snippet]
129
+
130
+ 💡 Gợi ý: [action]
131
+ └─ Hoặc chạy: /debug để tìm hiểu thêm
132
+
133
+ ────────────────────────────────
134
+ ```
135
+
136
+ ## Fallback
137
+
138
+ If no pattern matches:
139
+ ```
140
+ ❌ Lỗi: Có vấn đề xảy ra
141
+ 💡 Gợi ý: Chạy /debug để em phân tích chi tiết
142
+ ```
143
+
144
+ ## Performance
145
+
146
+ - Translation: < 100ms
147
+ - Pattern matching: Simple regex
148
+ - No external API calls
149
+
150
+ ## Security
151
+
152
+ - Sanitize error messages (remove credentials, paths)
153
+ - Never expose sensitive info in translations
@@ -0,0 +1,270 @@
1
+ ---
2
+ name: awf-session-restore
3
+ description: Auto-restore context from Beads + Brain + Project Brain on session start
4
+ trigger: session_start
5
+ priority: 2
6
+ ---
7
+
8
+ # AWF Session Restore (v6.4 - Project-Aware)
9
+
10
+ > **Purpose:** Tự động khôi phục context khi bắt đầu session.
11
+ > **⛔ MANDATORY:** Luôn THỰC SỰ chạy `bd list` qua terminal — không chỉ đề cập.
12
+
13
+ ---
14
+
15
+ ## Trigger
16
+
17
+ Skill này **BẮT BUỘC** chạy khi:
18
+ - User mở session mới (đầu conversation)
19
+ - User gõ `/recap`
20
+ - AI detect context loss (conversation reset)
21
+
22
+ ---
23
+
24
+ ## Execution Flow
25
+
26
+ ### 0. Project Brain Lookup (CHẠY TRƯỚC BEADS)
27
+
28
+ **Mục đích:** Load project structure vào context — AI không cần scan cấu trúc lần nào nữa trong session này.
29
+
30
+ ```bash
31
+ # Check project identity
32
+ cat .project-identity 2>/dev/null || echo "No .project-identity found"
33
+
34
+ # Check codebase map
35
+ cat CODEBASE.md 2>/dev/null || echo "No CODEBASE.md found"
36
+ ```
37
+
38
+ **Output nếu tìm thấy:**
39
+ ```
40
+ 📚 [ProjectName] | [Stage] | [Architecture]
41
+ 🗺️ Codebase loaded: [N layers, M features indexed]
42
+ ```
43
+
44
+ **Output nếu không có:**
45
+ ```
46
+ 📚 No project identity found — raw mode
47
+ ```
48
+
49
+ ---
50
+
51
+ ### 1. Multi-Source Context Check (vẠn MANDATORY)
52
+
53
+ **Priority 1: Beads (Task State) — PHẢI CHẠY ĐẦU TIÊN**
54
+ ```bash
55
+ bd list --status in_progress
56
+ bd list --status open --limit 3
57
+ ```
58
+
59
+ **Output:**
60
+ - Tasks đang làm dở
61
+ - Tasks blocked
62
+ - Tasks ready to start
63
+
64
+ **Priority 2: Brain (Knowledge & Plans)**
65
+ ```bash
66
+ # Check active plans
67
+ cat brain/active_plans.json
68
+
69
+ # Check recent memories
70
+ ls -lt brain/ | head -5
71
+ ```
72
+
73
+ **Output:**
74
+ - Plan đang active
75
+ - Phase hiện tại
76
+ - Recent decisions/knowledge
77
+
78
+ **Priority 3: Git (Code State)**
79
+ ```bash
80
+ git status
81
+ git log -1
82
+ ```
83
+
84
+ **Output:**
85
+ - Files đang thay đổi
86
+ - Commit gần nhất
87
+
88
+ ---
89
+
90
+ ### 2. Context Synthesis
91
+
92
+ Kết hợp 4 nguồn để tạo summary:
93
+
94
+ ```markdown
95
+ 🧠 **SESSION RESTORED**
96
+
97
+ 📚 **Project Brain:**
98
+ - Project: FitBite Witness | Stage 3 | Clean Architecture + MVVM
99
+ - CODEBASE: Loaded (4 layers, 8 features indexed)
100
+
101
+ 📿 **Beads Context:**
102
+ - In Progress: Task #123 "Implement Login API" (started 2h ago)
103
+ - Ready: 3 tasks
104
+
105
+ 🧠 **Brain Context:**
106
+ - Active Plan: Shopping Cart - Phase 02 (50%)
107
+ - Last Save: 30 minutes ago
108
+
109
+ 📂 **Git Context:**
110
+ - Changed Files: 3 files (src/api/auth/*.ts)
111
+ - Last Commit: "feat: add user model" (1 hour ago)
112
+
113
+ ➡️ **SUGGESTED NEXT STEP:**
114
+ Continue task #123? `/codeExpert` or `/code`
115
+ ```
116
+
117
+ ---
118
+
119
+ ### 3. Smart Suggestions
120
+
121
+ Based on context, suggest appropriate action:
122
+
123
+ **Case 1: Task In-Progress**
124
+ ```
125
+ ➡️ Tiếp tục task #123?
126
+ `/codeExpert` (Fast) or `/code` (Guided)
127
+ ```
128
+
129
+ **Case 2: Task Blocked**
130
+ ```
131
+ ⚠️ Task #125 bị block bởi #120
132
+
133
+ ➡️ Làm task #120 trước?
134
+ `/codeExpert` or switch to another task
135
+ ```
136
+
137
+ **Case 3: No Active Task**
138
+ ```
139
+ 📋 Có 3 tasks ready to start
140
+
141
+ ➡️ Bắt đầu task mới?
142
+ `/next` để xem gợi ý
143
+ ```
144
+
145
+ **Case 4: Fresh Start**
146
+ ```
147
+ 🆕 Chưa có context
148
+
149
+ ➡️ Bắt đầu dự án mới?
150
+ `/planExpert "Feature"` or `/brainstorm`
151
+ ```
152
+
153
+ ---
154
+
155
+ ### 4. Memory Persistence
156
+
157
+ Update session state:
158
+
159
+ ```json
160
+ // brain/session.json
161
+ {
162
+ "last_session": "2026-01-30T10:00:00Z",
163
+ "working_on": {
164
+ "feature": "Shopping Cart",
165
+ "plan_path": "plans/260130-1025-shopping-cart/",
166
+ "current_phase": "phase-02",
167
+ "current_task": {
168
+ "id": 123,
169
+ "name": "Implement Login API",
170
+ "status": "in_progress"
171
+ }
172
+ },
173
+ "context_sources": {
174
+ "beads": true,
175
+ "brain": true,
176
+ "git": true
177
+ }
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Error Handling
184
+
185
+ ### Beads Unavailable
186
+ ```
187
+ ⚠️ Beads không khả dụng
188
+
189
+ Fallback: Dùng Brain + Git context
190
+ ```
191
+
192
+ ### Brain Empty
193
+ ```
194
+ ⚠️ Brain chưa có context
195
+
196
+ Gợi ý: `/plan` để tạo context mới
197
+ ```
198
+
199
+ ### All Sources Fail
200
+ ```
201
+ ❌ Không thể khôi phục context
202
+
203
+ ➡️ Bắt đầu lại:
204
+ 1. `/recap` để quét dự án
205
+ 2. `/plan` để tạo plan mới
206
+ 3. Kể cho em biết đang làm gì
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Integration with Workflows
212
+
213
+ ### Auto-Trigger in Workflows
214
+
215
+ Các workflows tự động gọi session restore:
216
+
217
+ ```markdown
218
+ # In /code workflow
219
+ 1. Check session.json
220
+ 2. If no context → Trigger awf-session-restore
221
+ 3. Resume from restored context
222
+ ```
223
+
224
+ ### Manual Trigger
225
+
226
+ User có thể gọi thủ công:
227
+
228
+ ```bash
229
+ /recap # Alias for session restore
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Performance
235
+
236
+ - **Execution Time:** < 1 second
237
+ - **Sources Checked:** 3 (Beads, Brain, Git)
238
+ - **Output:** Concise summary (< 10 lines)
239
+
240
+ ---
241
+
242
+ ## Example Output
243
+
244
+ ```
245
+ 🧠 **WELCOME BACK!**
246
+
247
+ 📿 **Beads:** Task #123 "Login API" (in_progress, 2h ago)
248
+ 🧠 **Brain:** Plan "Shopping Cart" - Phase 02 (50%)
249
+ 📂 **Git:** 3 files changed
250
+
251
+ ➡️ **NEXT:** Continue coding? `/codeExpert`
252
+
253
+ 💡 **TIP:** Gõ `/next` để xem chi tiết hơn
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Configuration
259
+
260
+ User có thể customize trong `brain/preferences.json`:
261
+
262
+ ```json
263
+ {
264
+ "session_restore": {
265
+ "auto_trigger": true,
266
+ "verbosity": "concise", // concise | detailed
267
+ "sources": ["beads", "brain", "git"]
268
+ }
269
+ }
270
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: awf-version-tracker
3
+ description: Auto-snapshot skills and workflows to ensure rollback capabilities and tracking version drift
4
+ trigger: session_start
5
+ priority: 3
6
+ ---
7
+
8
+ # AWF Version Tracker (Skill Evolver Integration)
9
+
10
+ > **Purpose:** Tự động tạo snapshot các file kỹ năng (Skills) và quy trình (Workflows) mỗi khi session mới bắt đầu.
11
+ > **Philosophy:** Regression-Averse. Giữ lại một bộ lùi version tự động để an toàn sau những lần `/customize`.
12
+
13
+ ---
14
+
15
+ ## Trigger conditions
16
+ - **Mỗi khi User bắt đầu thao tác ở 1 session mới**
17
+ - Chạy tự động, ngay sau bộ `orchestrator` và `awf-session-restore`.
18
+
19
+ ## Hành động (Execution)
20
+
21
+ 1. **Log thông báo**: "📸 Saving system snapshot..."
22
+ 2. **Chạy script `snapshot.sh`**:
23
+ - `sh ~/.gemini/antigravity/skills/awf-version-tracker/scripts/snapshot.sh`
24
+ - Kịch bản sẽ sao chép `global_workflows` và `skills` và nén vào thư mục `~/.gemini/antigravity/brain/versions/` với tên file gắn Timestamp.
25
+ - Kịch bản chỉ giữ lại tối đa 10 snapshots gần nhất.
26
+ 3. **Tiếp nối quy trình**: Không chặn hay hỏi thêm người dùng trừ khi có lỗi permission xảy ra.
27
+
28
+ ## Phục hồi (Rollback)
29
+
30
+ Nếu User yêu cầu lùi phiên bản `/skill-rollback`:
31
+ - Nhắc User xem danh sách snapshot ở `~/.gemini/antigravity/brain/versions/`
32
+ - Command để giải nén lại snapshot: `unzip -o snapshot_name.zip -d /`
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Snapshot skills and workflows
3
+ TARGET_DIR="$HOME/.gemini/antigravity"
4
+ BACKUP_DIR="$TARGET_DIR/brain/versions"
5
+
6
+ mkdir -p "$BACKUP_DIR"
7
+
8
+ TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
9
+
10
+ echo "📸 Tạo bản snapshot hệ thống AWK..."
11
+
12
+ # Tạo zip file chứa global_workflows và skills
13
+ if [ -d "$TARGET_DIR/global_workflows" ] && [ -d "$TARGET_DIR/skills" ]; then
14
+ zip -q -r "$BACKUP_DIR/awk_snapshot_$TIMESTAMP.zip" "$TARGET_DIR/global_workflows" "$TARGET_DIR/skills" -x "*.DS_Store"
15
+
16
+ # Giữ lại tối đa 10 bản snapshot gần nhất để tránh tốn dung lượng
17
+ ls -tp "$BACKUP_DIR"/awk_snapshot_*.zip | grep -v '/$' | tail -n +11 | xargs -I {} rm -- {} 2>/dev/null
18
+
19
+ echo "✅ Đã lưu snapshot: awk_snapshot_$TIMESTAMP.zip (Chỉ giữ lại 10 bản gần nhất)"
20
+ else
21
+ echo "⚠️ Không tìm thấy thư mục global_workflows hoặc skills để snapshot."
22
+ fi