Unifying agent instructions to AGENTS.md (#66716)

## Summary

Closes #66715

It's a follow-up of #45939

## Testing

This PR includes two commits. The first commit only removes CLAUDE.md
and GEMINI.md, and the second involves changes to
[dangerfile.ts](https://github.com/zed-industries/zed/blob/main/script/danger/dangerfile.ts).

Reset the second if not favored.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
Sha1rholder
2026-11-16 06:53:33 +00:00
committed by GitHub
parent 053d91cb14
commit a57e2fdc38
7 changed files with 383 additions and 369 deletions
+12 -6
View File
@@ -130,22 +130,28 @@ if (readmeModified) {
});
}
if (danger.git.deleted_files.includes(".rules")) {
// GitHub reports a symlink replaced by a regular file as a removal plus an addition.
const agentsMdDeleted =
danger.git.deleted_files.includes("AGENTS.md") && !danger.git.created_files.includes("AGENTS.md");
const agentsMdChanged =
danger.git.modified_files.includes("AGENTS.md") || danger.git.created_files.includes("AGENTS.md");
if (agentsMdDeleted) {
fail(
[
"This PR deletes `.rules`, which contains the mandatory agent self-review rule (the `> [!IMPORTANT]` README marker rule).",
"This PR deletes `AGENTS.md`, which contains the mandatory agent self-review rule (the `> [!IMPORTANT]` README marker rule).",
"If the deletion is intentional, move that rule to another rules file in the same PR.",
].join("\n"),
);
} else if (danger.git.modified_files.includes(".rules")) {
} else if (agentsMdChanged) {
schedule(async () => {
const rulesDiff = await danger.git.diffForFile(".rules");
const rulesDiff = await danger.git.diffForFile("AGENTS.md");
if (rulesDiff && rulesDiff.removed.includes(SELF_REVIEW_MARKER) && !rulesDiff.added.includes(SELF_REVIEW_MARKER)) {
fail(
[
"This PR removes the mandatory agent self-review rule from `.rules` (the `> [!IMPORTANT]` README marker rule).",
"This PR removes the mandatory agent self-review rule from `AGENTS.md` (the `> [!IMPORTANT]` README marker rule).",
"It has been dropped by accident before and had to be restored in https://github.com/zed-industries/zed/pull/63384.",
"If changing it is intentional, keep an equivalent rule containing the same marker text in `.rules`.",
"If changing it is intentional, keep an equivalent rule containing the same marker text in `AGENTS.md`.",
].join("\n"),
);
}