1
0

refactor: 移除 success 字段,简化为 matched 单层判定模型

This commit is contained in:
2026-05-11 13:12:55 +08:00
parent 548b44d28e
commit 35ba56888b
93 changed files with 3893 additions and 103 deletions

View File

@@ -0,0 +1,34 @@
## 1. 质量门禁配置
- [x] 1.1 添加 `eslint``@eslint/js``typescript-eslint``eslint-plugin-react-hooks``eslint-plugin-react-refresh``prettier` 开发依赖并更新 lockfile
- [x] 1.2 在 `package.json` 新增 `lint``format``format:check``check``verify` 脚本
- [x] 1.3 配置 ESLint 检查 TypeScript、React、脚本和测试代码并启用 React Hooks 规则
- [x] 1.4 配置 ESLint 禁止 `src/web` 导入 `src/server` 后端运行时实现
- [x] 1.5 配置 Prettier 和忽略规则,确保排除 `openspec/``dist/``.build/``node_modules/``bun.lock` 和临时构建产物
## 2. 开发期配置一致性
- [x] 2.1 调整全栈开发脚本,使 Vite proxy 端口从文档化的后端端口配置派生
- [x] 2.2 调整或确认运行配置校验覆盖默认值、CLI 优先级、无效端口和端口边界行为
- [x] 2.3 补充运行配置测试,覆盖默认端口、`PORT` 覆盖、CLI 优先级、无效端口和端口边界
## 3. HTTP 运行时契约
- [x] 3.1 为 `/health``/api/demo` 实现 `GET``HEAD` 语义,并对不支持 method 返回 JSON 405 和 `Allow` header
- [x] 3.2 统一 API 404 和 405 错误响应结构,确保包含 `error``status` 字段
- [x] 3.3 为生产 HTML、JSON 和静态资源响应添加低风险安全 headers
- [x] 3.4 明确生产 HTML、静态资源和未知静态资源的缓存与 404 行为
- [x] 3.5 补充 HTTP handler 单元测试,覆盖 method、HEAD、JSON 错误、缓存 headers、安全 headers 和未知静态资源
## 4. 构建与 Smoke 验证
- [x] 4.1 调整生产构建脚本,按稳定顺序生成嵌入静态资源清单
- [x] 4.2 增强 executable smoke test验证 production runtime mode、未知 API、未知静态资源、SPA fallback、缓存 headers 和低风险安全 headers
- [x] 4.3 确保 `verify` 先运行 `check`,再基于当前源码执行生产构建和 smoke test
## 5. 文档与最终验证
- [x] 5.1 更新 README说明 `check``verify`、lint、format、构建中间产物、运行配置和验证边界
- [x] 5.2 运行 `bun run check` 并修复发现的问题
- [x] 5.3 运行 `bun run verify` 并修复发现的问题
- [x] 5.4 修正 `openspec/config.yaml``tasks` artifact 规则键名并确认 OpenSpec CLI 不再告警