# AGENTS.md instructions for 用于 PR、Issue 和仓库自动化的 GitHub CLI

Use 用于 PR、Issue 和仓库自动化的 GitHub CLI only for: 非常适合 Agent 的 GitHub 命令行工具，支持 JSON 输出、受限认证和清晰审批边界。

## Default behavior

- Prefer non-interactive commands and stable output formats: json.
- Start with read-only inspection commands before changing state.
- Show the exact command before destructive or deployment actions.
- Require explicit user approval for commands marked `requires-review` or `destructive`.

## Useful commands

- safe: `gh repo view owner/repo --json name,description,stargazerCount,defaultBranchRef` — Read-only repository context for agents.
- safe: `gh pr list --state open --json number,title,author,url,reviewDecision,mergeStateStatus,updatedAt` — Useful for triage, release checks, and review summaries.
- safe: `gh pr view 123 --json number,title,files,commits,reviews,statusCheckRollup,url` — Reads review and CI context before the agent summarizes risk.
- requires-review: `gh pr merge 123 --squash` — Changes repository state and must require human approval.

## Safety notes

- Treat repo view, issue list, pr list, and pr view as the default safe command set.
- Require approval before merge, close, delete, edit, release, or workflow-run commands.
- Prefer scoped or read-only tokens for agent sessions and always request JSON output where supported.