Files
ai-proj-helper/skills-req/req-lookback-plugin/skills/SKILL.md
John Qiu de25f096e7 feat(sync): add install-skills.sh + install metadata to all 62 plugins
- Add install_name, install_type, dir_category fields to all 62 plugin.json files
  to resolve name-mapping and skill-vs-command routing issues
- Add install-skills.sh: idempotent cross-machine skill sync script
  - Routes skill→~/.claude/skills/<name>/, command→~/.claude/commands/<name>.md
  - rsync full skills/ directory (preserves multi-file skills like dev-test, req-deploy)
  - State file ~/.claude/.installed-skills.json tracks installed versions
  - Conflict detection: warns before overwriting locally modified files
  - --dry-run, --category, --force, --cleanup, --list flags
- Add 9 new plugins migrated from local ~/.claude (agent-swarm, ai-chat,
  defect-analysis, executing-plans, finishing-branch, frontend-design,
  req-audit, req-lookback, req-retro)
- Add update-plugin-meta.py helper used to bulk-update plugin.json
- Fix siyuan SKILL.md: remove hardcoded server credentials, use env vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 23:55:26 +09:30

88 lines
2.6 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.
---
name: req-lookback
description: 回归测试。部署后自动验证变更涉及的功能是否正常。可独立调用或由 /req done 自动触发。
---
# 回归测试 (lookback)
对本次部署变更的功能执行自动化验证。
## 执行流程
### 1. 获取变更文件列表
```bash
# 优先从最近合并的 PR 获取(覆盖 merge 多 commit 场景)
gh pr list --state merged --base main --limit 1 --json number,files
# 回退git diff
git diff HEAD~1..HEAD --name-only
```
### 2. 自动发现验证项(动态推断)
读取变更文件,按类型推断需要验证什么:
| 文件类型 | 推断方式 | 验证命令 |
|----------|---------|---------|
| `*.vue` / `*.tsx` | grep router 配置,提取对应路由路径 | `curl -sf -o /dev/null -w "%{http_code}" ${SERVER}${ROUTE}` |
| `app/api/*.py` | grep 路由装饰器 `@router.get/post`,提取 API 路径 | `curl -sf -o /dev/null -w "%{http_code}" ${SERVER}/api${PATH}` |
| `app/services/*.py` | 找到引用该 service 的 api 文件,提取关联 API | 同上 |
| `nginx.conf` | 提取 location 块 | `curl` 各路径检查状态码 |
| `docker-compose.yml` | 提取服务列表 | `docker ps` 检查容器状态 |
| `alembic/*.py` | 提取表名 | `psql -c "\d table_name"` |
| `*.md` / `*.txt` / `SKILL.md` | 纯文档 | **N/A自动通过** |
| `*.css` / `*.scss` | 纯样式 | 轻量验证:页面可达即可 |
### 3. 执行验证
**远端模式**SSH 可达时):
```bash
# 3 秒超时检测
ssh -o ConnectTimeout=3 ${EC2_USER}@${EC2_HOST} "echo ok" 2>/dev/null
# 成功 → 执行完整验证docker ps + curl + docker logs
```
**降级模式**SSH 不可达时):
```bash
# 检查最近 CI run 是否成功
gh run list --repo ${OWNER}/${REPO} --limit 1 --json conclusion
# conclusion=success → PASS
```
### 4. 输出报告
```markdown
## 回归测试报告
### 变更范围
| 文件 | 类型 | 推断的验证项 |
### 测试结果
| 测试项 | 方式 | 预期 | 实际 | 状态 |
### 结论: ✅ PASS / ❌ FAIL / N/A
```
### 5. 失败处理
```
⚠️ 回归测试失败:{失败项描述}
建议操作:
1. [回滚] git revert HEAD~1 + /req deploy推荐影响最小
2. [修复] 创建 hotfix 分支修复后重新部署
3. [忽略] 标记为已知问题,继续归档
输入 1/2/3:
```
- 选 1 → 执行 `git revert`,提示用户运行 `/req deploy`
- 选 2 → 创建 hotfix 任务ai-proj create_task阻断归档
- 选 3 → 记录到报告,继续
## 任务关联
- linkRole: `test`
- 任务标题: `【回归】回归测试: {需求标题}`
- 报告附加到任务文档