Files
awoooi/docs/TECHNICAL_DEBT_PHASE2.md
OG T 7478dc0254 feat(phase6-9): Complete modular architecture and Agent Teams
Phase 6.4 - Modular Architecture:
- Add lewooogo-brain adapters for LLM providers
- Add lewooogo-data dual memory (Redis + PostgreSQL)
- Implement consensus engine for multi-agent decisions
- Add incident memory service for historical context

Phase 9 - Agent Teams (Claude Agent SDK):
- Add base agent class with Claude Sonnet 4 integration
- Implement action planner, blast radius, and security agents
- Add agent API endpoints and proposal workflow
- Integrate ADR-009 OpenClaw Agent Teams architecture

DevOps & CI/CD:
- Add GitHub Actions CI/CD workflows (ci.yaml, cd.yaml)
- Add pre-commit hooks and secrets baseline
- Add docker-compose for local development
- Update Kubernetes network policies

Frontend Improvements:
- Add auto-healing error boundary component
- Update i18n messages for agent features
- Enhance dual-state incident card with execution feedback

Documentation:
- Add 7 ADRs covering MCP, design system, architecture decisions
- Update ARCHITECTURE_MEMORY.md with modular design
- Add GLOBAL_RULES.md and SOUL.md for project identity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-23 18:40:36 +08:00

132 lines
4.3 KiB
Markdown

# Phase 2 Technical Debt - i18n 違憲代碼清單
> **Phase 3 首要清理任務**
> 掃描日期: 2026-03-20
> 總計違規: 40+ 處
---
## 🔴 高優先級 (紅燈)
### 1. agent/approval-card.tsx - 風險等級與資料影響標籤
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 63-81 | `'LOW RISK'`, `'MEDIUM RISK'`, `'HIGH RISK'`, `'CRITICAL'` | 改為 `tRisk('low')` 等 |
| 92-95 | `'NONE'`, `'READ ONLY'`, `'WRITE'`, `'DESTRUCTIVE'` | 改為 `tBlast('none')` 等 |
| 174-251 | `'SIGNATURES'`, `'BLAST RADIUS'`, `'AFFECTED PODS'`, `'EST. DOWNTIME'`, `'RELATED SERVICES'`, `'DATA IMPACT'`, `'DRY-RUN VALIDATION'` | 改為 `t('approval.xxx')` |
| 292 | `'Requested by '` | 改為 `t('requestedBy')` |
### 2. agent/data-pincer.tsx - 狀態標籤
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 50-78 | `'STANDBY'`, `'ANALYZING'`, `'EXECUTING'`, `'AWAITING APPROVAL'`, `'ERROR'` | 改為 `t('status.xxx')` |
### 3. status-orb.tsx - 狀態標籤
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 16-31 | `'Idle'`, `'Thinking'`, `'Executing'`, `'Awaiting Approval'` | 改為 `t('status.xxx')` |
### 4. layout/header.tsx - 連線狀態
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 55-61 | `connectionLabel` 物件: `'Offline'`, `'Connecting...'`, `'LIVE'` 等 | 移至 i18n |
### 5. dashboard/connection-status.tsx - 連線狀態
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 35-41 | `connectionLabels` 物件中英文字串 | 改為 `useTranslations('connection')` |
---
## 🟡 中優先級 (黃燈)
### 6. agent/thinking-terminal.tsx - 終端機 UI
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 58 | `'[ BLAST RADIUS ]'` | 改為 `t('graphRag.blastRadius')` |
| 93-122 | `'[ ROOT CAUSE CHAIN ]'`, `'[ UPSTREAM IMPACT ]'`, `'[ DOWNSTREAM DEPENDENCIES ]'` | 改為對應 i18n keys |
| 162-182 | `'[ FINOPS ANALYSIS ]'`, `'Wasted/mo'`, `'Realizable'`, `'Freed'` | 改為 `t('finops.xxx')` |
| 334-382 | `'AWOOOI Terminal'`, `'v0.1.0 | SSE'`, `'>_ EXECUTING...'`, `'INITIATE SYNC'`, `'Waiting for command...'` | 改為 `t('terminal.xxx')` |
### 7. dashboard/live-host-card.tsx - Baseline 標籤
| 行號 | 違規內容 | 修復方式 |
|------|----------|----------|
| 285 | `'基準線'` (中文硬寫) | 改為 `baselineLabel` prop 或 `t('dashboard.baseline')` |
---
## 🟢 低優先級 (綠燈)
### 8. Locale Hardcoding
| 檔案 | 行號 | 違規內容 | 修復方式 |
|------|------|----------|----------|
| `dashboard/host-card.tsx` | 220-223 | `toLocaleTimeString('zh-TW', ...)` | 改為動態 `params.locale` |
| `dashboard/live-host-card.tsx` | 252-256 | `toLocaleTimeString('zh-TW', ...)` | 改為動態 locale |
### 9. 技術識別符 (保持原樣)
以下為技術識別符,不需 i18n 化:
- 服務名稱: `'Harbor'`, `'GH Runner'`, `'Docker'`
- IP 地址: `'192.168.0.xxx'`
- API 路徑: `/api/v1/xxx`
---
## 修復優先順序
```
Phase 3 Week 1:
├── [P0] agent/approval-card.tsx (20+ 違規)
├── [P0] agent/data-pincer.tsx (5 違規)
├── [P0] status-orb.tsx (4 違規)
└── [P0] connection-status.tsx + header.tsx (10 違規)
Phase 3 Week 2:
├── [P1] agent/thinking-terminal.tsx (15+ 違規)
└── [P1] live-host-card.tsx baseline (1 違規)
Phase 3 Bug Bash:
└── [P2] Locale hardcoding (2 違規)
```
---
## 已修復清單 ✅
| 檔案 | 修復內容 |
|------|----------|
| `sidebar.tsx` | Logo 已套用 `mix-blend-multiply` |
| `sidebar.tsx` | `v1.0.0` / `Production` 改為 `tBrand('version')` / `tBrand('environment')` |
| `demo/page.tsx` | `useMockApprovalData` 全面 i18n 化 |
| `demo/page.tsx` | `createTestApprovalWithConfig` 使用 i18n config |
| `approval-card.tsx` (新版) | 已完全 i18n 化 |
| `host-card.tsx` | CPU/Memory 標籤已 i18n 化 |
---
---
## Phase 6 架構債 (新增 2026-03-22)
> **來源**: `docs/ARCHITECTURE_CODE_REVIEW.md`
| 類別 | 項目 | 現狀 | 目標 |
|------|------|------|------|
| 狀態持久化 | MultiSigEngine | In-Memory | Redis Hash |
| 狀態持久化 | TopologyGraph | In-Memory | Neo4j |
| 水平擴展 | SSE 廣播 | 單實例 | Redis Pub/Sub |
詳見 `docs/ARCHITECTURE_CODE_REVIEW.md` 第 5 章。
---
*最後更新: 2026-03-22*