refactor: 统一项目名称从OpenFang到ZCLAW
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括:
- 配置文件中的项目名称
- 代码注释和文档引用
- 环境变量和路径
- 类型定义和接口名称
- 测试用例和模拟数据

同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
This commit is contained in:
iven
2026-03-27 07:36:03 +08:00
parent 4b08804aa9
commit 0d4fa96b82
226 changed files with 7288 additions and 5788 deletions

View File

@@ -57,12 +57,12 @@ desktop/
Run (Windows):
```bash
cd g:\ZClaw_openfang\desktop && pnpm add -D vitest@2.1.8 @testing-library/react@16.1.0 @testing-library/jest-dom@6.6.3 jsdom@25.0.1
cd g:\ZClaw_zclaw\desktop && pnpm add -D vitest@2.1.8 @testing-library/react@16.1.0 @testing-library/jest-dom@6.6.3 jsdom@25.0.1
```
Run (Unix):
```bash
cd g:/ZClaw_openfang/desktop && pnpm add -D vitest@2.1.8 @testing-library/react@16.1.0 @testing-library/jest-dom@6.6.3 jsdom@25.0.1
cd g:/ZClaw_zclaw/desktop && pnpm add -D vitest@2.1.8 @testing-library/react@16.1.0 @testing-library/jest-dom@6.6.3 jsdom@25.0.1
```
Expected: 依赖安装成功
@@ -71,7 +71,7 @@ Expected: 依赖安装成功
Run:
```bash
cd g:\ZClaw_openfang\desktop && pnpm exec vitest --version
cd g:\ZClaw_zclaw\desktop && pnpm exec vitest --version
```
Expected: 输出 `vitest/2.1.8`
@@ -214,7 +214,7 @@ Verify `desktop/package.json` scripts section includes:
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test
cd g:/ZClaw_zclaw/desktop && pnpm test
```
Expected: 测试运行成功 (可能显示 0 tests这是正常的)
@@ -222,7 +222,7 @@ Expected: 测试运行成功 (可能显示 0 tests这是正常的)
- [ ] **Step 5: 提交测试框架配置**
```bash
cd g:/ZClaw_openfang && git add desktop/vitest.config.ts desktop/tests/setup.ts desktop/package.json
cd g:/ZClaw_zclaw && git add desktop/vitest.config.ts desktop/tests/setup.ts desktop/package.json
git commit -m "test: add Vitest configuration and setup
- Add vitest.config.ts with coverage thresholds
@@ -284,7 +284,7 @@ describe('crypto-utils', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/crypto-utils.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/crypto-utils.test.ts
```
Expected: FAIL - "Cannot find module '../../src/lib/crypto-utils'"
@@ -411,7 +411,7 @@ export function generateMasterKey(): string {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/crypto-utils.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/crypto-utils.test.ts
```
Expected: PASS - 2 tests
@@ -450,7 +450,7 @@ describe('encrypt and decrypt', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/crypto-utils.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/crypto-utils.test.ts
```
Expected: PASS - 3 tests
@@ -458,7 +458,7 @@ Expected: PASS - 3 tests
- [ ] **Step 7: 提交加密工具模块**
```bash
cd g:/ZClaw_openfang && git add desktop/src/lib/crypto-utils.ts desktop/tests/lib/crypto-utils.test.ts
cd g:/ZClaw_zclaw && git add desktop/src/lib/crypto-utils.ts desktop/tests/lib/crypto-utils.test.ts
git commit -m "feat(crypto): add AES-GCM encryption utilities
- Add arrayToBase64/base64ToArray conversion functions
@@ -556,7 +556,7 @@ describe('secureStorage', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/secure-storage.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/secure-storage.test.ts
```
Expected: FAIL - localStorage 存储明文
@@ -697,7 +697,7 @@ export const secureStorage = {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/secure-storage.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/secure-storage.test.ts
```
Expected: PASS - 4 tests
@@ -705,7 +705,7 @@ Expected: PASS - 4 tests
- [ ] **Step 7: 提交凭据加密增强**
```bash
cd g:/ZClaw_openfang && git add desktop/src/lib/secure-storage.ts desktop/tests/lib/secure-storage.test.ts
cd g:/ZClaw_zclaw && git add desktop/src/lib/secure-storage.ts desktop/tests/lib/secure-storage.test.ts
git commit -m "feat(security): add AES-GCM encryption for localStorage fallback
- Encrypt credentials before storing in localStorage
@@ -836,7 +836,7 @@ describe('WebSocket Security', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/lib/gateway-security.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/lib/gateway-security.test.ts
```
Expected: PASS - 6 tests (这些是纯逻辑测试)
@@ -904,7 +904,7 @@ async connect(): Promise<void> {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test
cd g:/ZClaw_zclaw/desktop && pnpm test
```
Expected: All tests pass
@@ -912,7 +912,7 @@ Expected: All tests pass
- [ ] **Step 7: 提交 WSS 强制策略**
```bash
cd g:/ZClaw_openfang && git add desktop/src/lib/gateway-client.ts desktop/tests/lib/gateway-security.test.ts
cd g:/ZClaw_zclaw && git add desktop/src/lib/gateway-client.ts desktop/tests/lib/gateway-security.test.ts
git commit -m "feat(security): enforce WSS for non-localhost connections
- Add validateWebSocketSecurity function
@@ -939,7 +939,7 @@ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
Run:
```bash
head -n 100 g:/ZClaw_openfang/desktop/src/store/chatStore.ts
head -n 100 g:/ZClaw_zclaw/desktop/src/store/chatStore.ts
```
- [ ] **Step 2: 写失败的测试 - 基础功能**
@@ -1098,7 +1098,7 @@ describe('chatStore', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/store/chatStore.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/store/chatStore.test.ts
```
Expected: PASS - 8+ tests
@@ -1147,7 +1147,7 @@ describe('updateMessage', () => {
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test tests/store/chatStore.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test tests/store/chatStore.test.ts
```
Expected: PASS - 10+ tests
@@ -1156,7 +1156,7 @@ Expected: PASS - 10+ tests
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test:coverage tests/store/chatStore.test.ts
cd g:/ZClaw_zclaw/desktop && pnpm test:coverage tests/store/chatStore.test.ts
```
Expected: Coverage > 80% for chatStore
@@ -1164,7 +1164,7 @@ Expected: Coverage > 80% for chatStore
- [ ] **Step 7: 提交 ChatStore 测试**
```bash
cd g:/ZClaw_openfang && git add desktop/tests/store/chatStore.test.ts
cd g:/ZClaw_zclaw && git add desktop/tests/store/chatStore.test.ts
git commit -m "test(chat): add comprehensive unit tests for chatStore
- Test initial state
@@ -1189,7 +1189,7 @@ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test
cd g:/ZClaw_zclaw/desktop && pnpm test
```
Expected: All tests pass
@@ -1198,7 +1198,7 @@ Expected: All tests pass
Run:
```bash
cd g:/ZClaw_openfang/desktop && pnpm test:coverage
cd g:/ZClaw_zclaw/desktop && pnpm test:coverage
```
Expected: Overall coverage >= 60%
@@ -1254,7 +1254,7 @@ Create `docs/changelogs/2026-03-21-phase1-security.md`:
- [ ] **Step 2: 提交文档更新**
```bash
cd g:/ZClaw_openfang && git add docs/changelogs/2026-03-21-phase1-security.md
cd g:/ZClaw_zclaw && git add docs/changelogs/2026-03-21-phase1-security.md
git commit -m "docs: add Phase 1 changelog
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
@@ -1265,13 +1265,13 @@ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
- [ ] **Step 1: 创建 Phase 1 完成标签**
```bash
cd g:/ZClaw_openfang && git tag -a v0.3.0-phase1 -m "Phase 1: Security + Testing Complete"
cd g:/ZClaw_zclaw && git tag -a v0.3.0-phase1 -m "Phase 1: Security + Testing Complete"
```
- [ ] **Step 2: 推送所有提交**
```bash
cd g:/ZClaw_openfang && git push origin main --tags
cd g:/ZClaw_zclaw && git push origin main --tags
```
---