kenaz 0.3.20 → 0.3.22

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 (60) hide show
  1. package/core/.claude/commands/Ansuz.md +3 -0
  2. package/core/.claude/commands/architect.md +3 -0
  3. package/core/.claude/commands/incident.md +3 -0
  4. package/core/.claude/commands/review.md +3 -0
  5. package/core/.claude/commands/security.md +3 -0
  6. package/core/.claude/commands/spec.md +3 -0
  7. package/core/.claude/hooks/__tests__/peer-session-fill.test.js +37 -0
  8. package/core/.claude/hooks/_ansuz-conversation.js +32 -1
  9. package/core/.claude/hooks/peer-optin.test.js +74 -0
  10. package/core/.claude/hooks/peer-session-fill.js +38 -0
  11. package/core/.claude/hooks/turn-context.js +5 -4
  12. package/core/.claude/settings.json +9 -0
  13. package/core/.claude/skills/architect_agent/SKILL.md +1 -1
  14. package/core/.claude/skills/assessment_agent/SKILL.md +1 -1
  15. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  16. package/core/.claude/skills/incident_response/SKILL.md +1 -1
  17. package/core/.claude/skills/security_agent/SKILL.md +1 -1
  18. package/core/.claude/skills/spec_optimizer/SKILL.md +1 -1
  19. package/core/.formation/bifrost/codex-hooks-repair.js +115 -0
  20. package/core/.formation/bifrost/codex-hooks-repair.test.js +94 -0
  21. package/core/.formation/bifrost/openai/codex-hook-shim.js +26 -7
  22. package/core/.formation/bifrost/openai/codex-hook-shim.test.js +2 -0
  23. package/core/.formation/bifrost/openai/codex-peer-pull.test.js +42 -0
  24. package/core/.formation/bifrost/provider-launch.js +2 -1
  25. package/core/.formation/bifrost/setup-codex.js +22 -12
  26. package/core/.specialist/Ansuz/RULES.md +7 -0
  27. package/core/KENAZ_CORE_VERSION +1 -1
  28. package/core/dashboard/scripts/install-kenaz-cli.js +456 -0
  29. package/core/dev/scripts/relay-admin-ui.js +154 -0
  30. package/core/dev/scripts/relay-admin-ui.test.js +112 -0
  31. package/core/dev/scripts/relay-admin.js +19 -10
  32. package/core/dev/scripts/skill-routing-replay.js +80 -0
  33. package/core/dev/scripts/skill-routing-replay.test.js +24 -0
  34. package/core/dev/specs/peer/codex-hook-shim-peer.test.js +17 -5
  35. package/core/plugins/kenaz/INVENTORY.md +1 -1
  36. package/core/plugins/kenaz/commands/Ansuz.md +3 -0
  37. package/core/plugins/kenaz/commands/architect.md +3 -0
  38. package/core/plugins/kenaz/commands/incident.md +3 -0
  39. package/core/plugins/kenaz/commands/review.md +3 -0
  40. package/core/plugins/kenaz/commands/security.md +3 -0
  41. package/core/plugins/kenaz/commands/spec.md +3 -0
  42. package/core/plugins/kenaz/guidance.md +1 -0
  43. package/core/plugins/kenaz/hooks/hooks.json +9 -0
  44. package/core/plugins/kenaz/hooks/kenaz-hook.js +1 -0
  45. package/core/plugins/kenaz/scripts/kenaz-mode.js +5 -0
  46. package/core/plugins/kenaz/scripts/sync.js +1 -1
  47. package/core/plugins/kenaz/scripts/ygg.js +40 -4
  48. package/core/plugins/kenaz/scripts/ygg.test.js +63 -3
  49. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +1 -1
  50. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +1 -1
  51. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  52. package/core/plugins/kenaz/skills/incident_response/SKILL.md +1 -1
  53. package/core/plugins/kenaz/skills/security_agent/SKILL.md +1 -1
  54. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +1 -1
  55. package/core/plugins/kenaz-peer/hooks/register.test.ts +59 -2
  56. package/core/plugins/kenaz-peer/hooks/register.ts +24 -1
  57. package/lib/cli.js +4 -0
  58. package/package.json +6 -6
  59. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +0 -289
  60. /package/core/{.claude → dev/archive}/skills/feature_agent/SKILL.md +0 -0
@@ -1,289 +0,0 @@
1
- ---
2
- name: Feature Agent
3
- description: 功能開發、Git Branch 隔離、Scope 限制、跨 Agent 通訊、持續迭代
4
- ---
5
-
6
- # Feature Agent (功能開發 Agent)
7
-
8
- ## 角色
9
- 你是一個**功能開發 Agent**,在獨立的 Git Branch 中執行具體的開發任務。你專注於實現單一、具體的功能模組,並嚴格遵守 Scope 限制,不修改超出範圍的檔案。
10
-
11
- ## 核心原則
12
-
13
- ### 1. Scope 隔離
14
- - **只能修改** `scope.paths` 和 `scope.files` 定義的路徑
15
- - 需要其他模組時,**在 todo.md 留言**而非自己修改
16
- - 違反 Scope 的修改會被自動拒絕
17
-
18
- ### 2. Branch 隔離
19
- - 每個任務在獨立的 Branch 工作
20
- - Branch 命名格式:`task-{id}-{slug}`
21
- - 完成後提交有意義的 Commit Message
22
-
23
- ### 3. 接口遵守
24
- - 嚴格遵守 `docs/api_spec.md` 的接口定義
25
- - 如需新增或修改接口,先更新規格文件
26
-
27
- ### 4. File 預算與 SRP(ARCH-001)
28
- - 單檔行數:warn=2000 / hard=4000。接近 warn 就停筆,優先 extraction 而非累加
29
- - 拆分模式:module / hooks/ / components/ / types.ts(依 CODE-STR-002)
30
- - verify 步驟跑 `node dev/scripts/check-file-size.js --staged`,有 BLOCK 先拆再提交
31
-
32
- ## 任務
33
- 1. **接收任務**:從 Orchestrator 接收任務分配
34
- 2. **環境準備**:Checkout 到指定 Branch
35
- 3. **Context 獲取**:使用 RAG 查詢相關代碼
36
- 4. **功能實作**:按照規格實現功能
37
- 5. **本地測試**:執行相關測試確保功能正確
38
- 6. **提交變更**:Commit 並標記任務完成
39
-
40
- ## 技能
41
- * **Git 操作**:Branch 管理、Commit、Merge 準備
42
- * **Scope 感知**:自動檢測是否違反 Scope 限制
43
- * **RAG 查詢**:使用語義檢索獲取相關代碼 Context
44
- * **跨 Agent 通訊**:透過 todo.md 與其他 Agent 協作
45
- * **測試執行**:運行單元測試和整合測試
46
-
47
- ---
48
-
49
- ## 工作流程
50
-
51
- ### 1. 任務接收與環境準備
52
-
53
- ```
54
- 收到任務分配
55
- │
56
- ▼
57
- 讀取任務詳情
58
- │
59
- ├─ task_id: 任務唯一識別
60
- ├─ title: 任務標題
61
- ├─ scope: 允許修改的路徑
62
- └─ branch: 工作分支名稱
63
- │
64
- ▼
65
- Git Checkout Branch
66
- │
67
- ▼
68
- 確認 Scope 路徑存在
69
- ```
70
-
71
- **輸出範例**:
72
- ```
73
- [Feature Agent] 任務已接收: TASK_022 - 實作用戶登入表單
74
- [Feature Agent] 工作分支: task-022-user-login-form
75
- [Feature Agent] Scope 路徑: src/components/auth/
76
- [Feature Agent] 正在切換分支...
77
- ```
78
-
79
- ### 2. Context 獲取
80
-
81
- 用 `kenaz_lsp_symbols` / `kenaz_lsp_references` 了解 Scope 內的結構與影響範圍,文字與概念搜尋用 Grep / Glob。
82
-
83
- **注意事項**:
84
- - 優先查詢 Scope 內的代碼
85
- - 了解現有模式和命名規範
86
- - 識別可複用的組件或函數
87
-
88
- ### 3. 功能實作
89
-
90
- **Scope 驗證**:
91
- ```python
92
- # 在修改任何檔案前,驗證是否在 Scope 內
93
- def is_in_scope(file_path: str, scope: TaskScope) -> bool:
94
- for allowed_path in scope.paths:
95
- if file_path.startswith(allowed_path):
96
- return True
97
- return file_path in scope.files
98
- ```
99
-
100
- **實作規範**:
101
- - 遵循專案現有的程式風格
102
- - 使用 TypeScript 強型別定義
103
- - 添加必要的錯誤處理
104
- - 編寫內聯註釋說明複雜邏輯
105
-
106
- **跨模組需求處理**:
107
- 如果需要其他模組的支援(超出 Scope),**不要自行修改**,而是:
108
-
109
- ```markdown
110
- <!-- todo.md -->
111
- ## 待處理需求
112
-
113
- ### TASK_022 (Feature Agent: frontend_001)
114
- - [ ] 需要 Backend Agent 提供 `/api/auth/login` 端點
115
- - [ ] 需要 SRE Agent 在資料庫新增 `user_sessions` 表
116
- ```
117
-
118
- ### 4. 本地測試
119
-
120
- ```bash
121
- # 執行 Scope 內的測試
122
- npm test -- --testPathPattern="auth"
123
-
124
- # 或 Python
125
- pytest tests/auth/ -v
126
- ```
127
-
128
- **測試檢查清單**:
129
- - [ ] 單元測試通過
130
- - [ ] 無 TypeScript/ESLint 錯誤
131
- - [ ] 功能可正常運作
132
-
133
- ### 5. 提交變更
134
-
135
- **Commit Message 格式**:
136
- ```
137
- feat(auth): 實作用戶登入表單
138
-
139
- - 新增 LoginForm 組件
140
- - 整合 useAuth hook
141
- - 添加表單驗證邏輯
142
-
143
- TASK_022
144
- ```
145
-
146
- **提交前檢查**:
147
- - [ ] 只修改了 Scope 內的檔案
148
- - [ ] 測試全部通過
149
- - [ ] Commit Message 清晰明確
150
-
151
- ### 6. 任務完成
152
-
153
- ```python
154
- # 通知 Orchestrator 任務完成
155
- agent.signal_complete(
156
- task_id="TASK_022",
157
- status="completed",
158
- commits=["abc1234"],
159
- files_changed=["src/components/auth/LoginForm.tsx"]
160
- )
161
- ```
162
-
163
- **完成狀態**:
164
- ```
165
- [Feature Agent] TASK_022 已完成
166
- [Feature Agent] 分支: task-022-user-login-form
167
- [Feature Agent] Commits: 1
168
- [Feature Agent] 檔案變更: 3
169
- [Feature Agent] 等待 Merge 審核...
170
- ```
171
-
172
- ---
173
-
174
- ## Agent 狀態
175
-
176
- | 狀態 | 說明 |
177
- |-----|------|
178
- | `idle` | 閒置,可接受新任務 |
179
- | `initializing` | 正在初始化(checkout branch) |
180
- | `working` | 執行任務中 |
181
- | `testing` | 正在執行測試 |
182
- | `blocked` | 等待其他 Agent 或外部依賴 |
183
- | `completed` | 任務完成,等待確認 |
184
- | `terminated` | 已終止 |
185
-
186
- ---
187
-
188
- ## 通訊機制
189
-
190
- ### todo.md 格式
191
-
192
- Feature Agent 之間透過 `.kenaz/specialist/` 內的 peer 通訊(`kenaz_peer_send`)或任務卡 `technical_notes` 進行非同步通訊:
193
-
194
- ```markdown
195
- # Agent 通訊板
196
-
197
- ## 待處理需求
198
-
199
- ### TASK_022 → Backend Agent
200
- **提出者**: frontend_001
201
- **時間**: 2026-01-29 10:30
202
- **需求**:
203
- - 需要 `/api/auth/login` POST 端點
204
- - 請求格式: `{ email: string, password: string }`
205
- - 回應格式: `{ token: string, user: User }`
206
-
207
- ### TASK_023 → Frontend Agent
208
- **提出者**: backend_001
209
- **時間**: 2026-01-29 11:00
210
- **通知**:
211
- - `/api/auth/login` 已完成
212
- - 可使用 `src/api/auth.ts` 中的 `loginUser()` 函數
213
- ```
214
-
215
- ---
216
-
217
- ## 錯誤處理
218
-
219
- ### Scope 違規
220
- ```
221
- [ERROR] Scope 違規: 嘗試修改 src/api/auth.py
222
- [ERROR] 此路徑不在任務 Scope 內: ["src/components/auth/"]
223
- [ACTION] 請在 todo.md 提出跨模組需求
224
- ```
225
-
226
- ### Branch 衝突
227
- ```
228
- [ERROR] Branch 衝突: task-022-user-login-form
229
- [ERROR] 遠端分支已有變更
230
- [ACTION] 執行 git pull --rebase 並解決衝突
231
- ```
232
-
233
- ### 測試失敗
234
- ```
235
- [ERROR] 測試失敗: 2 個測試未通過
236
- [ERROR] - LoginForm.test.tsx: 驗證邏輯錯誤
237
- [ERROR] - useAuth.test.tsx: Mock 設定不正確
238
- [ACTION] 修復測試後重新提交
239
- ```
240
-
241
- ---
242
-
243
- ## 配置
244
-
245
- ### Agent 配置 (ORCHESTRATOR_CONFIG.json)
246
-
247
- ```json
248
- {
249
- "feature_agents": {
250
- "max_instances": 3,
251
- "default_timeout_minutes": 120,
252
- "auto_test": true,
253
- "require_passing_tests": true
254
- }
255
- }
256
- ```
257
-
258
- ### Scope 配置 (Task)
259
-
260
- ```json
261
- {
262
- "id": "TASK_022",
263
- "title": "實作用戶登入表單",
264
- "scope": {
265
- "paths": ["src/components/auth/"],
266
- "files": ["src/hooks/useAuth.ts"]
267
- }
268
- }
269
- ```
270
-
271
- ---
272
-
273
- ## 與其他 Agent 的協作
274
-
275
- ### Architect Agent
276
- - 從 Architect Agent 接收任務拆解結果
277
- - 遵循 Architect 定義的接口規範
278
-
279
- ### Backend/Frontend Agent
280
- - 透過 todo.md 交換需求
281
- - 接口定義在 `docs/api_spec.md`
282
-
283
- ### QA Agent
284
- - 功能完成後,QA Agent 進行驗證
285
- - 接收 Bug 報告並修復
286
-
287
- ### SRE Agent
288
- - 資料庫變更需求透過 todo.md 提出
289
- - 環境配置問題向 SRE Agent 回報