Files
spark-store/.agents/workflows/feature-development.md
momen cef68a95d9 chore: add comprehensive documentation and testing infrastructure
## 文档(全部中文)
- AGENTS.md - 完整的 AI 编码指南(中文版)
- CONTRIBUTING.md - 贡献指南
- DEVELOPMENT.md - 开发文档
- DEPLOYMENT.md - 部署文档
- TESTING.md - 测试文档
- TROUBLESHOOTING.md - 问题排查指南
- FAQ.md - 常见问题
- WORKFLOW.md - 标准开发流程文档
## AI 工作流(9个详细工作流)
- feature-development.md - 新功能开发流程
- bug-fix.md - Bug 修复流程
- code-review.md - 代码审查流程
- testing.md - 测试编写流程
- release.md - 发布流程
- refactoring.md - 代码重构流程
- documentation.md - 文档更新流程
- performance-optimization.md - 性能优化流程
- security-audit.md - 安全审计流程
## 测试基础设施
- vitest.config.ts - Vitest 单元测试配置
- playwright.config.ts - Playwright E2E 测试配置
- src/__tests__/setup.ts - 测试环境设置
- src/__tests__/unit/downloadStatus.test.ts - 示例单元测试
- e2e/basic.spec.ts - 示例 E2E 测试
## CI/CD
- .github/workflows/test.yml - 新建测试 CI 工作流
- .github/workflows/build.yml - 更新构建工作流,添加测试步骤
## Issue 模板
- 更新 bug_report.md 为标准 Bug 报告模板
- 更新 help_wanted.md 为标准功能请求模板
## 配置更新
- package.json - 添加测试依赖和 7 个新的 npm 脚本
- .gitignore - 添加测试相关忽略项
## 新增 npm 脚本
- test - 运行单元测试
- test:watch - 监听模式
- test:coverage - 生成覆盖率报告
- test:e2e - 运行 E2E 测试
- test:e2e:ui - E2E UI 模式
- test:e2e:debug - E2E 调试模式
- test:all - 运行所有测试
## 新增测试依赖
- @playwright/test ^1.40.0
- @testing-library/jest-dom ^6.1.5
- @testing-library/vue ^8.0.1
- @vitest/coverage-v8 ^1.0.0
- @vue/test-utils ^2.4.3
- jsdom ^23.0.1
- vitest ^1.0.0
2026-03-10 00:42:56 +08:00

136 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: 新功能开发流程
---
## 工作流说明
此工作流指导如何开发新功能。
## 步骤
### 1. 理解需求
- 阅读 Issue 描述
- 确认功能范围
- 识别依赖关系
- 设计 API 和数据结构
### 2. 设计方案
- 设计 UI/UX如需要
- 设计数据流
- 确定 IPC 通信(如需要)
- 编写技术方案文档(可选)
### 3. 创建功能分支
```bash
git checkout -b feature/your-feature-name
```
### 4. 更新类型定义
`src/global/typedefinition.ts` 中添加新的类型定义:
```typescript
export interface NewFeatureData {
id: string;
name: string;
// ...其他字段
}
```
### 5. 编写测试
先编写测试,遵循 TDD 原则:
```typescript
// src/__tests__/unit/newFeature.test.ts
import { describe, it, expect } from "vitest";
import { newFunction } from "@/modules/newFeature";
describe("newFunction", () => {
it("should work correctly", () => {
const result = newFunction(input);
expect(result).toBe(expected);
});
});
```
### 6. 实现功能
按照以下顺序实现:
- 后端逻辑Electron 主进程)
- 前端逻辑Vue 组件)
- IPC 通信(如需要)
- 样式和布局
### 7. 运行测试
```bash
# 单元测试
npm run test
# E2E 测试
npm run test:e2e
# 代码检查
npm run lint
npm run format
```
### 8. 本地测试
- 测试所有功能场景
- 测试边界情况
- 测试错误处理
- 检查性能影响
### 9. 更新文档
- 更新 API 文档(如需要)
- 更新用户文档(如需要)
- 更新 CHANGELOG.md
### 10. 提交代码
```bash
git add .
git commit -m "feat(scope): add new feature" -s
git push origin feature/your-feature-name
```
### 11. 创建 Pull Request
- 使用 PR 模板
- 引用相关 Issue
- 添加测试说明
- 添加截图/录屏UI 变更)
### 12. 代码审查
- 响应审查意见
- 进行必要的修改
- 确保所有 CI 检查通过
### 13. 合并
- 等待审查批准
- Squash 合并到 main 分支
- 删除功能分支
## 注意事项
- ⚠️ 保持 PR 小而聚焦(建议 < 500 行)
- ⚠️ 确保 TypeScript 严格模式通过
- ⚠️ 不引入 `any` 类型(必要时使用 `eslint-disable`
- ⚠️ 所有新功能必须有测试
- ⚠️ 遵循代码规范
## 相关文档
- [CONTRIBUTING.md](../../CONTRIBUTING.md) - 贡献指南
- [DEVELOPMENT.md](../../DEVELOPMENT.md) - 开发文档
- [TESTING.md](../../TESTING.md) - 测试文档