Skip to content

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

:memo: Update AGENTS.md

Daniele432995710f0
diff --git a/AGENTS.md b/AGENTS.md
index 178ab1d89f..2d2930ee86 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,18 +1,8 @@
# AGENTS.md
-Guidance for AI coding agents working in the **SiYuan** repository (思源笔记).
-Read this before modifying anything. Source of truth for facts cited here is in
-parenthesized file paths — verify before relying on them.
-
-SiYuan is a privacy-first, block-based note-taking application: a Go HTTP/WebSocket
-**kernel** (`kernel/`) plus a TypeScript **frontend** (`app/`) that ships as Electron
-desktop, browser-desktop, browser-mobile, and an export-render library
-(the `Protyle` global that renders code blocks / math / diagrams inside exported
-HTML and the PDF preview window). Module path
-`github.com/siyuan-note/siyuan`. License: **AGPL-3.0** (every source file carries the
-header — preserve it on edits). Versions (Go, Node, Electron, app version) change
-frequently — always read them from source instead of relying on a pinned value:
-`kernel/go.mod`, `app/package.json`, `kernel/util/working.go`.
+SiYuan repository guide. Module path `github.com/siyuan-note/siyuan`, license AGPL-3.0.
+
+**Architecture:** Go kernel (`kernel/`) + TypeScript frontend (`app/`), plus a separate `export` bundle (global `Protyle`, entry `src/protyle/method.ts`) for rendering rich content in exported HTML / PDF preview. Read versions from `kernel/go.mod`, `app/package.json`, `kernel/util/working.go`.
---
@@ -137,29 +127,20 @@ and standalone exported HTML files — so rich content renders outside the edito
---
-## 4. Critical "do not edit" artifacts
-
-These are generated or checked-in binaries. **Never hand-edit**:
-- `app/stage/protyle/js/lute/lute.min.js` — 3.6 MB **generated** Lute bundle (marked `linguist-vendored` in `.gitattributes:1`). Edit the upstream `github.com/88250/lute` Go project instead and rebuild.
-- `app/stage/build/**` — webpack output.
-- `app/src/types/dist/**` — generated `.d.ts` (`gen:types`).
-- `app/kernel/SiYuan-Kernel*`, `*.syso`, `kernel/kernel.aar` — checked-in build binaries.
-- `app/pandoc/*` — bundled third-party binary.
+## 4. Do not hand-edit
-When you change user-visible behavior, also update: `app/appearance/langs/*.json`
-(i18n) and the matching `app/changelogs/` entry.
+- `app/stage/protyle/js/lute/lute.min.js` (built from upstream `88250/lute`)
+- `app/stage/build/**`, `app/src/types/dist/**`
+- `app/kernel/SiYuan-Kernel*`, `*.syso`, `kernel/kernel.aar`
+- `app/pandoc/*`
---
-## 5. Common pitfalls
-
-1. **Go build fails without `CGO_ENABLED=1`** and a working C compiler (gcc/mingw/musl). This is non-negotiable — sqlite3 is cgo.
-2. **The `-tags fts5` flag is required** for every `go build` and `go test`, or the FTS5-dependent code won't compile.
-3. **Use `pnpm`, never `npm install` / `yarn`** in `app/` — the lockfile and `packageManager` field are pnpm-specific.
-4. **Do not edit `lute.min.js` or anything under `app/stage/`** — they are build outputs (see §4).
-5. **Line endings are LF** for `.go`, `.ts`, `.json`, `.scss` (`.gitattributes`); ensure your editor doesn't convert to CRLF on Windows.
-6. **i18n: new keys go at the top** of every `app/appearance/langs/*.json` object; add the key to **every** language file (use `en.json` as the reference; report an error when you can't produce a translation rather than silently copying the English).
-7. **Windows scripting: prefer not to use PowerShell.** PowerShell isn't forbidden, but it isn't the recommended choice here. When you need to script or automate on Windows, prefer Node.js (`.js`/`.mjs`, runnable via `node`) or Python; reach for PowerShell only if those can't do the job.
-8. **Don't run `npx webpack` to "verify" a frontend change.** A successful edit and the existing `pnpm run dev` watch are sufficient; webpack compilation verification is not required.
-9. **i18n domain swap: `ld246.com` → `liuyun.io`.** The domain `ld246.com` (the Chinese community) must appear **only in `zh-CN.json`**. In every other language file (`en.json`, `ja.json`, …) use `liuyun.io` instead — do not let `ld246.com` leak into non-Chinese strings. Check this whenever a translated value contains a URL.
+## 5. Project-specific rules
+
+1. **i18n:** New keys go at the **top** of each `langs/*.json` object; add to every language file (reference `en.json`); sync `app/changelogs/` for user-visible changes
+2. **Domains:** `ld246.com` only in `zh-CN.json`; use `liuyun.io` in all other languages
+3. **Line endings:** LF for `.go`, `.ts`, `.json`, `.scss` (`.gitattributes`)
+4. **Windows scripting:** Prefer Node.js / Python; avoid PowerShell unless necessary
+5. **Frontend verification:** Do not use `npx webpack` to verify changes