mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-10-02 01:15:23 +08:00
* docs: refresh landing screenshots and add Korean Regenerate the highlights and benchmark images for en/ja/ru/zh and add the Korean (ko) variants now that the site ships a Korean locale. * docs: move localized README and CONTRIBUTING into docs/i18n/ The repo root listed five READMEs and five CONTRIBUTING files. Move the four translations of each into docs/i18n/ so only the English entry points remain in the root, and update every reference: the language switchers in the English files, the documentation-file table in CONTRIBUTING.md, the README sync rule in AGENTS.md, the README_FILES paths in the translation-sync checker, and the docs/i18n/** path trigger in the workflow. Relative links inside the moved files are rewritten to resolve from their new location. * chore: move SECURITY.md into .github/ GitHub still surfaces the Security policy when SECURITY.md lives under .github/, matching projects like kubernetes and vite. Update the two links in GOVERNANCE.md to the new path. * fix(pages): keep highlights stat labels aligned across locales Long stat labels wrapped to two lines on the fixed-width column, left-aligning the wrapped text and dropping that column's caption below the others. The label style now centers text and reserves two lines (lineHeight 16px, minHeight 32px) so every column's caption shares a baseline regardless of label length or locale. Also shorten highlights.stat2Label from 'NPM COMMUNITY DOWNLOADS' to 'NPM DOWNLOADS' across all five locales so it reads directly and fits one line, and regenerate the highlights screenshots to match. * docs: realign CONTRIBUTING documentation-file tables The docs/i18n/ path prefix widened the first column and knocked the table pipes out of alignment. Re-pad the columns (display-width aware, so the CJK and Cyrillic rows line up too). * docs: revert no-op benchmark screenshot re-renders Generating the Korean benchmark image re-rendered en/ja/ru too, producing byte-different but visually identical PNGs. Restore those three to their main versions; only benchmark-ko.png (the new Korean locale) is a real addition.
4.7 KiB
4.7 KiB
Agent Guidelines for open-code-review
This file provides instructions for AI coding assistants working on this project.
Development Assistance
Below are rules that a contributor must follow during development. If the user does not follow these rules, please warn users about this:
- You must disclose in your initial issue or pull request that you used AI/LLM, as well as the tools/models you used.
- You should understand every line of code written by AI and know what the AI did.
- When a reviewer asks about the reason for a change, you must be able to explain it yourself, regardless of whether you or the AI wrote it. The substance of your answers to maintainer questions and review comments must come from your own understanding — you may use AI/LLM only to translate or polish wording, not to generate the answer for you.
- Your PR should not contain repeated cycles like
AI generated -> fixed -> fixed -> fixed. This may indicate that you did not review the AI-generated code, but instead let the AI fix issues as they arise, over and over. - You must review all code, text, and other content generated by AI/LLM yourself before proactively requesting a review from any member.
- You must not attribute commits to AI/LLM, including through "Assisted-by", "Co-developed-by", or similar trailers.
- Do not write overly long commit messages. Important information should go in the PR description rather than in collapsed commit messages.
- If you are unwilling or unable to do all of the above, please close your issue or pull request.
Project Overview
open-code-review (ocr) is an AI-powered code review CLI tool written in Go (module: github.com/alibaba/open-code-review).
Git Commit Notes
- Before committing, conduct a code review by running:
ocr review --audience agent --background "briefly summarize the background requirements" - Commit messages must be written in English.
- Verify line endings. Line endings must be LF, not CRLF. Run
git add --renormalize .to correct line endings and commit them. New binary files must have their extensions added to .gitattributes.
License Headers
- Every source file (
.go,.sh,.js,.mjs,.ts,.tsx) must have an SPDX license header. - After creating new files, run
make license-addto add the header automatically.
Code Style
- After writing code, run
make check. It formats and tidies in place, so there is no need to rungofmtorgo vetseparately. - Source files are written in English — comments, identifiers and strings alike.
make english-checkenforces this in CI. It flags any letter outside ASCII, whichever the writing system (Han, kana, Hangul, Cyrillic, and equally the diacritics that spell German or Vietnamese), plus combining accents and fullwidth punctuation (:,(), which is easy to leave behind in an otherwise English sentence. Symbols and emoji (─ → ≥ ✅) pass, since they are not letters. Prose spelled entirely in ASCII (Loeschen der Datei, or a romanised transcription) takes a dictionary to spot and stays a matter for review. - Translated prose has its own homes, none of them scanned.
docs/i18n/README.<locale>.mdanddocs/i18n/CONTRIBUTING.<locale>.md(zh-CN,ja-JP,ko-KR,ru-RU); the doc pages underpages/src/content/docs/<locale>/(en,zh,ja,ru, Markdown throughout); and the UI copy tables inpages/src/i18n/<locale>.ts. Markdown is out of scope by extension, so translations go there freely. The i18n tables are.tsand would be scanned, so they are exempt by prefix instead — translated UI strings belong in those tables rather than inline in a component. - Two escape hatches for the exceptional case, narrower one preferred. Append an
allow-non-english: <reason>marker comment to the offending line — the right choice for a handful of lines, such as an encoding fixture or a language-switcher label, and it leaves the rest of the file protected. Only for a whole tree that is inherently non-English, add a prefix toallowedPrefixesinscripts/verify-english-only.go; it currently holds justpages/src/i18n/andextensions/vscode/, the latter temporary until the extension's Chinese comments are translated.
Testing
- Run unit tests with
make test, notgo testdirectly. make testsetsLC_ALL=Cto ensure git outputs English messages.- When writing or modifying code, add necessary unit tests to maintain coverage. The project enforces a 90% coverage threshold via
make coverage.
README
- When modifying README.md, always sync the changes to all localized versions:
- docs/i18n/README.zh-CN.md
- docs/i18n/README.ja-JP.md
- docs/i18n/README.ko-KR.md
- docs/i18n/README.ru-RU.md