Files
cursor/rules/agent-completion-gate.mdc
ray zhou 1bcb6120dd ok
2026-05-29 17:23:17 +08:00

29 lines
1.4 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 完成前门禁:校验脚本 + Hooks 兜底
alwaysApply: true
---
# Agent 完成前门禁
## 禁止
- 未跑校验脚本前,不得写「已完成」「可以合并」「验收通过」等收尾表述。
## 必须
1. 任务收尾前执行:`~/.cursor/hooks/verify-slot-backend.sh`
2. 在最终回复粘贴完整输出(以 `=== verify-slot-backend ===` 开头)。
3. 修改 PHP 后,最终回复含 `PHPDoc: checked`(见 `php-code` 规则 PHPDoc 章节)。
4. 改动 `app/**/*.php` 须遵守 `php-code` 用例写法章节BusinessException、按层写法
5. 修改 `app/**/logic/**/*.php` 时,完成前对照 `php-clean-code` **§3 参数与日志**、**§3 编排上下文与聚合 DTO** 与 **§8 自查**(不仅依赖 verify 脚本)。
6. 工作区在 `www/ray` 时,执行校验须:`SLOT_ROOT=/Users/ray/Documents/project/www/ray ~/.cursor/hooks/verify-slot-backend.sh`(避免 `PASS (no changed files)` 误判)。
## 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)`。