Files
cursor/rules/agent-completion-gate.mdc
ray zhou 2dd9f17da9 ok
2026-06-29 14:51:55 +08:00

34 lines
1.8 KiB
Plaintext
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: Agent 完成前门禁:校验脚本 + Skill 检测报告 + Hooks 兜底
alwaysApply: true
---
# Agent 完成前门禁
## 禁止
- 未跑校验脚本前,不得写「已完成」「可以合并」「验收通过」等收尾表述。
- 改动 PHP 后,未按 `slot-backend-completion-report` Skill 输出「检测结果」章节就收尾。
## 必须
1. **收尾前读取并执行** Skill`~/.cursor/skills/slot-backend-completion-report/SKILL.md`(或项目内 `.cursor/skills/slot-backend-completion-report/`)。
2. **跑检测**(推荐一条命令):
```bash
SLOT_ROOT="${SLOT_ROOT:-<当前 Cursor 工作区根>}" \
~/.cursor/skills/slot-backend-completion-report/scripts/report.sh
```
- `SLOT_ROOT` 为当前工作区根,**禁止写死** `www/ray` 或 `slot-xxx`;脚本内 `php -l` 的 docker `-w` 由 git 仓库路径动态映射(见 Skill
3. 最终回复**必须包含** Skill 规定的「检测结果」章节门禁输出、php -l、规范对照表、结论并含 `PHPDoc: checked`。
4. 改动 `app/**/*.php` 须遵守 `php-clean-code` 用例写法BusinessException、按层写法
5. 修改 `app/**/logic/**/*.php` 时,对照 `php-clean-code` **§3 常量规则**、**§3 参数与日志**、**§3 编排上下文与聚合 DTO** 与 **§8 自查**(不仅依赖 verify 脚本)。
## Hooks用户级 `~/.cursor/hooks.json`
- **宿主机 `php` / `composer`**:被 `block-host-php.sh` 拦截;须 `docker exec ... php`。
- **Agent 结束 `stop`**:自动跑 `verify-slot-backend.sh``FAIL` 时注入 `followup_message` 要求继续修复。
## 扫描范围
**仅** `git diff` / `git diff --cached` 里、且磁盘上仍存在的改动文件;干净仓库跳过。不做全仓库 grep。无改动 → `PASS (no changed files)`。