Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:memo: Clarify GitHub output encoding and read-back comparisons https://github.com/siyuan-note/siyuan/issues/19962

Daniel7f38e37a0f55
diff --git a/AGENTS.md b/AGENTS.md
index a4f04b4358..061f2436fe 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -75,6 +75,8 @@ SiYuan repository guide. Module path `github.com/siyuan-note/siyuan`, license AG
4. Inspect the returned resource and read it back with `gh api` to verify the published text exactly, including line breaks and non-ASCII characters
5. Delete the temporary JSON file and confirm that it no longer exists
- For shell-independent read-back verification, query one field per `gh api --jq` call, for example `--jq .title` and `--jq .body`
+ - Prefer capturing `gh` stdout directly in a Node.js or Python script and decoding it as UTF-8. When using PowerShell to save output, explicitly use `Out-File -Encoding utf8`; Windows PowerShell 5.1 defaults to UTF-16LE for `>` and `Out-File`, and its UTF-8 output includes a BOM, so readers must handle that BOM. Explicit file encoding cannot repair text already corrupted by pipeline decoding; use direct process capture in that case
+ - Keep the submitted payload file until read-back comparison passes. Prefer parsing the returned resource as JSON and comparing its fields with the payload; normalize CRLF to LF on both sides if needed, but preserve meaningful leading/trailing whitespace and blank lines. For `--jq` text output, remove only the single output line terminator added by the command, not arbitrary trailing whitespace. Delete temporary payload and read-back files after successful verification and confirm their removal
- `gh api` applies `--jq` locally after sending the request, so an invalid or failing expression can cause a non-zero exit even when the write succeeded. Omit `--jq` on write commands and use separate read-back calls to verify individual fields. When a write command exits non-zero, confirm the remote state before deciding whether to retry; the write may already have succeeded, and retrying can create duplicate issues or comments or repeat other side effects
7. **Issue titles:** Whenever the user asks to generate an issue title, provide it in English regardless of the wording of the request, and do not start it with `Fix`. These rules choose title wording from the issue's nature; they are not an instruction to apply GitHub labels
- For a bug, objectively describe the problem or symptom instead of writing from a bug-fix perspective