diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..db19a34 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,13 @@ +# Code owners list only the high-risk paths: the workflows (one of them deploys the site) and the checks themselves. +# GitHub asks the owner to review a pull request that touches one of them. Pages under docs/ are merged once CI is +# green. How pull requests are reviewed and merged: https://github.com/ModAVD/ModAVD/blob/main/CONTRIBUTING.en.md +# 只列高风险路径:动了这些路径的 PR,GitHub 会自动请负责人审查;docs/ 下的页面 CI 绿了就能合。 +# 流程见 https://github.com/ModAVD/ModAVD/blob/main/CONTRIBUTING.md + +# Workflows and their permissions, Dependabot, this file +/.github/ @qiyinxi + +# The CI gates, the privacy scan and its allowlist +/scripts/repo_checks.py @qiyinxi +/scripts/privacy.py @qiyinxi +/scripts/privacy-allowlist.json @qiyinxi diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..39298aa --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,27 @@ + + +## 改了什么 / What changed + + + +## 怎么验证的 / How it was verified + + + + + +## 核对 / Checklist + +- [ ] 中文页(`docs/`)和对应的英文页(`docs/en/`)都改了;只会一种语言的在上面说一声 / The Chinese page (`docs/`) and the matching English page (`docs/en/`) are both changed; if you write only one of the languages, say so above + + +Refs ModAVD/ModAVD# diff --git a/docs/develop/docs.md b/docs/develop/docs.md index 1ddd8f9..78193db 100644 --- a/docs/develop/docs.md +++ b/docs/develop/docs.md @@ -5,7 +5,7 @@ | 内容 | 在哪改 | |---|---| | 本站(使用说明、组件介绍、参与开发) | [modavd.github.io](https://github.com/ModAVD/modavd.github.io) 仓库的 `docs/` | -| 各仓库自己的 README(中文 `README.md`、英文 `README.en.md`)、`CONTRIBUTING.md` | 各自的仓库 | +| 各仓库自己的 README、`CONTRIBUTING`、`AGENTS`(中文 `X.md`、英文 `X.en.md`,逐节对应) | 各自的仓库 | | 发版说明、补丁说明(`release/`、`patches/BASE.md`)、仓库清单 | ModAVD 仓库,由发版工具导出,**不要手改**,有问题先开 issue | 每页底部有「在 GitHub 上改这一页」,点进去直接改、提 PR 就行。 @@ -21,7 +21,7 @@ npm run build # 编出静态页面,有死链会报错 python scripts/i18n.py # 核对中英两边的页面和标题 ``` -- 页面是 `docs/` 下的 Markdown,英文页在 `docs/en/` 下,路径和中文页一一对应。侧边栏和导航在 `docs/.vitepress/config.mts`,两种语言各一份,新加页面要在两边都挂上。 +- 页面是 `docs/` 下的 Markdown,英文页在 `docs/en/` 下,路径和中文页一一对应。侧边栏和导航在 `docs/.vitepress/config.mts`,两种语言的标题写在同一张表里(`[链接, 中文标题, 英文标题]`),新加页面加一行。 - 提示框用 `::: tip`、`::: warning`、`::: danger`、`::: info`。 - 站内链接写相对路径、不带 `.md`,例如 `[安装](../guide/install)`;链到别的仓库的文件写完整的 GitHub 地址。 - 不加统计脚本、不从别的网站取字体或图片。 @@ -41,6 +41,7 @@ PR 上的 CI 会: - 中文是主语言,英文页逐页对应。改了中文页,在同一个 PR 里把对应的英文页也改了;不会写英文的,在 PR 里说一声,由维护者补上。 - 中文,短句,写用户看得懂的说法。英文照意思写成自然的英文,不逐字硬译。 +- 术语照[术语对照表](https://github.com/ModAVD/ModAVDManager/blob/main/internal/i18n/README.md#terms)写。管理器的按钮和菜单名,英文页照管理器英文界面上的写,不写中文原文加括号。表里没有的词,用代码里的名字或中文原文,不自己造译名;用得多了就往表里加一行。 - 写清楚是哪个版本起有的、哪个版本起变的。 - 能用表格、列表的就别写成大段。 - 命令写完整、能直接复制,路径用 `<占位符>` 标出要换的部分。 diff --git a/docs/develop/index.md b/docs/develop/index.md index 79f7645..638c66b 100644 --- a/docs/develop/index.md +++ b/docs/develop/index.md @@ -40,7 +40,7 @@ issue、PR、评论和提交说明用中文或英文都可以。 ## 改文档和代码 - 动手前在 issue 里说一声;issue 已经指派给谁,就是有人在做。 -- 从自己的 fork 开 PR。外部 PR 的 CI 要维护者批准后才会跑。 +- 从自己的 fork 开 PR。新注册的 GitHub 账号第一次提 PR 时,CI 要维护者批准后才会跑。 - 本站和各仓库 README 里写错、写得不清楚的地方:直接提 PR,见[文档和本站](./docs)。 - 随包脚本 `package/`:可以提 PR,合进来后随下一版发出。要守的写法见[随包脚本](./package)。 - arm64 执行桥 `bridge/`:改动先开 issue 商量。它直接影响游戏能不能启动,每一版都要在装了桥的实例上实跑游戏回归。 @@ -52,11 +52,25 @@ issue、PR、评论和提交说明用中文或英文都可以。 模拟器补丁怎么交,见[模拟器本体](./emulator)。 +## PR 怎么审、怎么合 {#review-and-merge} + +各仓库的 `main` 只能通过 PR 进,合并走 GitHub 的合并队列。 + +- **PR 正文**:写改了什么、为什么,实际跑过哪些检查、结果怎样。对应的 issue 单独写一行 `Refs ModAVD/ModAVD#<编号>`,在别的仓库里也写全称;ModAVD 仓库的 PR,类型和 `area:*` 标签会从 issue 自动抄过来。 +- **不写 `Fixes`、`Closes`**:issue 不在合并时关。合并的人给 issue 打上 `pending-release`,带着这个修复的版本发布时才关。文档、测试、CI 这类不随安装包发的改动,合并时直接关。 +- **更新说明**:用户看得见的改动,在同一个 PR 里加一个 `changelog.d/<名字>..md`,写一行给用户看的话,写法见各仓库的 `changelog.d/README.md`。这一行会进中文的发版公告;不会写中文就用英文写,在 PR 里说一声,由维护者改成中文。 +- **检查**:PR 上的 CI 全绿才能合。CI 跑什么见各分区的页面,本地能跑的先在本地跑过。 +- **审查**:动了高风险路径的 PR,GitHub 会自动请负责人审查,审过再合。高风险路径列在各仓库的 `.github/CODEOWNERS`:workflow、CI 检查和隐私扫描本身、发版和签名、组件下载和整包更新、推进客体的程序、数据盘、模拟器补丁。其余的 PR 不要求审批,CI 绿了就能合。 +- **问题分级**:审查里提出的问题按 P0–P3 分。P0、P1 合并前修完;P2、P3 不挡合并,合并后挂 issue。 +- **合并**:点「Merge when ready」把 PR 放进合并队列。队列在最新的 `main` 上再跑一遍检查,过了自动 squash 合并,所以分支不用自己追 `main`。有写权限的人自己点;没有的,CI 绿了以后由维护者点。PR 标题会成为 `main` 上那个提交的标题,要能单独看懂。 +- **实机测试按版本做**:不逐个 PR 测。发版前的回归在真实实例上把这一版的改动一起测;查出问题按 PR 去找,必要时先 revert 那个合并提交,修好再提。 +- **没做完的大功能**可以分几个 PR 进 `main`,前提是有开关、默认关着;做完、实机测过再默认打开。 + ## 署名与许可 - 署你自己的名字或化名,邮箱用 GitHub 的 noreply 地址(`<编号>+<登录名>@users.noreply.github.com`,在 GitHub 的邮箱设置里能看到);不写 `Co-authored-by`。收进来后保留你的署名,发版说明里会致谢。 - 你的改动按所改文件的许可证进来,见[许可证与源码](../guide/license);新文件的版权行写你的名字或化名。不用签 CLA,`Signed-off-by` 可加可不加。 -- 可以用 AI 工具,但改动要让 AI 自己测过,你为它负责。给 AI 工具看的规矩在 ModAVD 仓库根目录的 [AGENTS.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.md),Codex、Claude Code 等会自己读。见[用 AI 工具协助](./ai)。 +- 可以用 AI 工具,但改动要让 AI 自己测过,你为它负责。给 AI 工具看的规矩在 ModAVD 仓库根目录的 [AGENTS.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.md)(英文版 [AGENTS.en.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.en.md)),Codex、Claude Code 等会自己读 `AGENTS.md`。见[用 AI 工具协助](./ai)。 - 通用的修复以后可能投到 Google 上游(AOSP、google/gfxstream),上游要求作者本人签 Google CLA。到时会先问你,不愿意就只留在 ModAVD。 - 图片、图标类改动先开 issue,写明来源和许可证;同人图和来源说不清的图不收。 diff --git a/docs/develop/manager.md b/docs/develop/manager.md index cffa5e9..7961964 100644 --- a/docs/develop/manager.md +++ b/docs/develop/manager.md @@ -50,6 +50,23 @@ CI 在 PR 上跑: - Windows:全套,包括格式检查、`go vet`、`go test`、`build.ps1`、隐私扫描和作者检查,另外用 `GOOS=darwin GOARCH=arm64`、`GOOS=linux GOARCH=amd64` 各交叉 `go vet` 一遍; - macOS 和 Linux:只在对应系统上跑 `go vet` 和 `go test`,不编出可发布的程序,也不开模拟器。 +## 界面文字和翻译 + +管理器和命令行按系统语言显示中文或英文。 + +- 代码里给人看的文字照旧写中文,中文原文就是键;英文在 `internal/i18n/locales/en/<包名>.json`,页面自己的文字在 `web.json`。 +- 新加或改了中文文字以后,跑下面的命令,它把缺的键以 `""` 加进表,再把 `""` 填成英文。漏了的话 `go test` 里的 `TestCatalog` 会失败,CI 也过不了。 + + ```powershell + go test ./internal/i18n -run TestCatalog -update # 把缺的键加进表 + go test ./internal/i18n -run TestCatalog -update -prune # 同时删掉源码里已经没有的键 + ``` + +- 只进日志、问题包的文字,和机读输出(`--json`、MCP、退出码)不翻:前者的值写 `null`,后者本来就不进表。 +- 想看英文界面:设环境变量 `MODAVD_LANG=en`(只管这一个进程),或者在管理器的设置里换语言。 +- 不会写中文:键照意思写一句中文(用翻译工具也行),在 PR 里说一声,由维护者改顺。 +- 英文怎么写、术语对照表,见仓库的 [internal/i18n/README.md](https://github.com/ModAVD/ModAVDManager/blob/main/internal/i18n/README.md)。 + ## 平台层 管理器目前以 Windows x64 为主,平台相关的部分拆在两处: diff --git a/docs/en/develop/docs.md b/docs/en/develop/docs.md index f70de7f..6e2d46b 100644 --- a/docs/en/develop/docs.md +++ b/docs/en/develop/docs.md @@ -5,7 +5,7 @@ | Content | Where to change it | |---|---| | This site (user guide, component introductions, contributing) | `docs/` in the [modavd.github.io](https://github.com/ModAVD/modavd.github.io) repository | -| The README of each repository (Chinese `README.md`, English `README.en.md`), `CONTRIBUTING.md` | Each repository itself | +| The README, `CONTRIBUTING` and `AGENTS` of each repository (Chinese `X.md`, English `X.en.md`, matching section by section) | Each repository itself | | Release notes, patch notes (`release/`, `patches/BASE.md`), the repository list | The ModAVD repository. They are exported by the release tool, so **do not edit them by hand**; if you find a problem, open an issue first | Every page has "Edit this page on GitHub" at the bottom. Click through, edit directly, and send a PR. @@ -21,7 +21,7 @@ npm run build # builds the static pages; dead links cause an error python scripts/i18n.py # checks the pages and headings of the Chinese and English sides ``` -- The pages are Markdown under `docs/`. The English pages are under `docs/en/`, with paths matching the Chinese pages one to one. The sidebar and navigation are in `docs/.vitepress/config.mts`, one copy per language, so a new page must be added to both. +- The pages are Markdown under `docs/`. The English pages are under `docs/en/`, with paths matching the Chinese pages one to one. The sidebar and navigation are in `docs/.vitepress/config.mts`, with the titles of both languages in one table (`[link, Chinese title, English title]`), so a new page adds one row. - Callouts use `::: tip`, `::: warning`, `::: danger` and `::: info`. - Links inside the site are relative paths without `.md`, for example `[Installation](../guide/install)`. For files in other repositories, write the full GitHub address. - Do not add analytics scripts, and do not load fonts or images from other websites. @@ -41,6 +41,7 @@ After a merge into `main`, the site is published to GitHub Pages automatically. - Chinese is the main language, and the English pages match it page by page. If you change a Chinese page, change the matching English page in the same PR. If you cannot write English, say so in the PR and the maintainer will add it. - In Chinese, use short sentences and wording that users understand. In English, write natural English that follows the meaning, not word for word. +- Take terms from the [table of terms](https://github.com/ModAVD/ModAVDManager/blob/main/internal/i18n/README.md#terms). For the manager's buttons and menus, English pages use the names shown in the manager's English interface, not the Chinese text with a translation in brackets. For a word that is not in the table, use the name in the code or the Chinese original rather than inventing a translation; once it comes up often, add a row to the table. - Say from which version something exists and from which version it changed. - Use tables and lists where you can instead of long paragraphs. - Write commands in full so they can be copied as they are, and mark the parts of a path to replace with ``. diff --git a/docs/en/develop/index.md b/docs/en/develop/index.md index 6acfd0a..ea617de 100644 --- a/docs/en/develop/index.md +++ b/docs/en/develop/index.md @@ -40,7 +40,7 @@ This output does not contain your user name, computer name, full paths or game a ## Changing documentation and code - Say so in the issue before you start. If an issue is already assigned to someone, that person is working on it. -- Open PRs from your own fork. CI for external PRs only runs after the maintainer approves it. +- Open PRs from your own fork. For the first PR from a newly registered GitHub account, CI only runs after the maintainer approves it. - If something on this site or in the READMEs of the repositories is wrong or unclear, send a PR directly. See [Documentation and this site](./docs). - Bundled scripts, `package/`: you can send PRs, and once merged they ship with the next release. For the rules to follow, see [Bundled scripts](./package). - The arm64 execution bridge, `bridge/`: open an issue to discuss changes first. It directly affects whether games can start, so every release needs real game regression runs on an instance with the bridge installed. @@ -52,11 +52,25 @@ This output does not contain your user name, computer name, full paths or game a To submit emulator patches, see [Emulator](./emulator). +## How pull requests are reviewed and merged {#review-and-merge} + +Changes reach `main` in every repository only through a PR, and PRs are merged through GitHub's merge queue. + +- **PR description**: say what changed and why, and which checks you actually ran and how they went. Name the issue on a line of its own, `Refs ModAVD/ModAVD#`, in full even in the other repositories; on PRs in the ModAVD repository, the type and `area:*` labels are then copied from the issue automatically. +- **Do not write `Fixes` or `Closes`**: issues are not closed at merge time. Whoever merges adds `pending-release` to the issue, and it is closed when a release that contains the fix is published. Issues about documentation, tests or CI, which do not ship in the package, are closed at merge time. +- **Release note line**: for a change users can see, add a file `changelog.d/..md` in the same PR with one line written for users; how to write it is in each repository's `changelog.d/README.md`. The line goes into the release notes, which are in Chinese. If you do not write Chinese, write it in English and say so in the PR; the maintainer will put it into Chinese. +- **Checks**: a PR can be merged only when all of its CI checks are green. What CI runs is on each area's page; run locally first whatever you can. +- **Review**: for a PR that touches a high-risk path, GitHub asks the code owner for a review automatically; wait for that review before merging. The high-risk paths are listed in each repository's `.github/CODEOWNERS`: workflows, the CI checks and the privacy scan themselves, release and signing, component download and package update, programs pushed into the guest, data disks, and emulator patches. Other PRs need no approval and can be merged once CI is green. +- **Severity**: problems raised in review are graded P0 to P3. P0 and P1 are fixed before merging; P2 and P3 do not block the merge and become issues afterwards. +- **Merging**: click **Merge when ready** to put the PR into the merge queue. The queue runs the checks again on top of the latest `main` and then squash-merges, so you do not have to keep your branch up to date with `main`. If you have write access, click it yourself; otherwise the maintainer does once CI is green. The PR title becomes the title of the commit on `main`, so it should make sense on its own. +- **Testing on real instances is done per release**, not per PR. The pre-release regression tests the release's changes together on real instances; when it finds a problem, the PR that caused it is tracked down and, if needed, its merge commit is reverted first and the fix comes in a new PR. +- **A large feature that is not finished** can go into `main` over several PRs as long as it is behind a switch that is off; it is turned on by default once it is finished and tested on a real instance. + ## Credit and licensing - Sign with your own name or a pseudonym, and use a GitHub noreply address as your e-mail (`+@users.noreply.github.com`, which you can see in GitHub's e-mail settings). Do not write `Co-authored-by`. Your credit is kept after your change is accepted, and the release notes will thank you. - Your changes come in under the license of the files they change; see [Licenses and source code](../guide/license). The copyright line of a new file carries your name or pseudonym. You do not need to sign a CLA, and `Signed-off-by` is optional. -- You may use AI tools, but the AI must test the change itself, and you are responsible for it. The rules for AI tools are in [AGENTS.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.md) at the root of the ModAVD repository; Codex, Claude Code and others read it on their own. See [Using AI tools](./ai). +- You may use AI tools, but the AI must test the change itself, and you are responsible for it. The rules for AI tools are in [AGENTS.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.md) at the root of the ModAVD repository (in English: [AGENTS.en.md](https://github.com/ModAVD/ModAVD/blob/main/AGENTS.en.md)); Codex, Claude Code and others read `AGENTS.md` on their own. See [Using AI tools](./ai). - General fixes may later be sent to the Google upstream (AOSP, google/gfxstream). Upstream requires the author to sign the Google CLA personally. You will be asked first, and if you do not want to, the change stays in ModAVD only. - For image and icon changes, open an issue first with the source and the license. Fan art and images with an unclear source are not accepted. diff --git a/docs/en/develop/manager.md b/docs/en/develop/manager.md index 8827806..82a8bd6 100644 --- a/docs/en/develop/manager.md +++ b/docs/en/develop/manager.md @@ -50,6 +50,23 @@ On PRs, CI runs: - Windows: the full set: the format check, `go vet`, `go test`, `build.ps1`, the privacy scan and the author check, plus a cross `go vet` with `GOOS=darwin GOARCH=arm64` and with `GOOS=linux GOARCH=amd64`; - macOS and Linux: only `go vet` and `go test` on the matching system. They do not build a releasable program or start an emulator. +## Interface text and translations + +The manager and the CLI show Chinese or English, following the system language. + +- Text for people stays Chinese in the code, and the Chinese text is the key. The English is in `internal/i18n/locales/en/.json`; the pages' own text is in `web.json`. +- After you add or change Chinese text, run the commands below. They add the missing keys to the tables as `""`; then fill each `""` in with the English. If you miss one, `TestCatalog` fails in `go test`, and so does CI. + + ```powershell + go test ./internal/i18n -run TestCatalog -update # add the missing keys to the tables + go test ./internal/i18n -run TestCatalog -update -prune # also remove keys that are no longer in the source + ``` + +- Text that only goes into logs and problem reports, and machine-readable output (`--json`, MCP, exit codes), is not translated: the former gets the value `null`, and the latter is not in the tables at all. +- To see the English interface, set the environment variable `MODAVD_LANG=en` (it affects only that process), or switch the language in the manager's settings. +- If you do not write Chinese, write the key as a Chinese sentence with the meaning you intend (a translation tool is fine) and say so in the PR; the maintainer will polish it. +- How to write the English, and the table of terms, are in the repository's [internal/i18n/README.md](https://github.com/ModAVD/ModAVDManager/blob/main/internal/i18n/README.md). + ## Platform layer The manager is mainly for Windows x64 today. The platform-specific parts are split into two places: