中文版 / Chinese version: CONTRIBUTING.zh.md
You must follow the two rules below. Code style, dependencies, tests, and docs are handled by the maintainer in post-merge cleanup — do not worry about them.
A PR must contain exactly one feature or one bug fix that cannot be further decomposed. If your change can be split into multiple pieces that each have standalone value, submit each piece as a separate PR.
Before opening the PR, ask your AI tool:
"Analyze this diff. Can it be decomposed into multiple PRs where each could be merged or reverted independently? If yes, list them."
If the answer is "yes, N PRs", split into N PRs before submitting.
✅ Single-PR bugs — one root cause, one fix
Picture added with only 'width' specified gets wrong default heightBody-level find: anchor throws ArgumentExceptionAddParagraph --index N is off-by-one when the body contains a table
✅ Single-PR features — one coherent capability
query ole: list embedded OLE objects with ProgID and dimensionsset wrap/hposition/vposition on floating pictures
❌ Must split — multiple independent changes bundled together
Fix picture index bug + add OLE detection + add HTML heading numbering→ 3 PRs, zero shared codeAdd OLE object detection + add EMF→PNG conversion→ 2 PRs, two independent layersAdd auto aspect ratio + fix index off-by-one + fix line spacing clipping→ 3 PRs, three unrelated root causes
🤔 Judgment calls — default to splitting
Add helper function + its first consumer→ 1 or 2 PRs; split if the helper has standalone reuse potentialAdd read support + add write support for the same property→ 1 or 2 PRs; split if you want read to land before write is vetted
State in the PR description (or a linked issue) how a reviewer can confirm your change actually works.
- officecli command sequence showing broken output before and fixed output after
- Shell or Python script that reproduces the bug and runs clean after the fix
- Authoritative reference showing what the correct behavior should be (OOXML spec, Microsoft / ECMA docs, etc.)
- Screenshot — only when the bug is purely visual
- A screenshot of the feature in action (Word / Excel / PowerPoint window, HTML preview, or terminal output)
- Optionally a command sequence showing how to trigger it
Bug fix — command sequence (ideal):
# Before my fix:
officecli blank test.docx
officecli add test.docx picture --prop "path=photo-2x1.png" --prop "width=10cm"
officecli query test.docx picture
# → height: "10.2cm" ❌ WRONG (hardcoded 4-inch default)
# After my fix:
officecli blank test.docx
officecli add test.docx picture --prop "path=photo-2x1.png" --prop "width=10cm"
officecli query test.docx picture
# → height: "5.0cm" ✓ CORRECT (auto-computed from 2:1 pixel ratio)Feature — screenshot (ideal):
Heading auto-numbering from style chain
Before: ![heading-before.png] (plain "Chapter One" with no number) After: ![heading-after.png] ("1. Chapter One" with auto-numbering span)
How to trigger:
officecli blank demo.docx officecli add demo.docx paragraph --prop "style=Heading1" --prop "text=Chapter One" officecli watch demo.docx
The maintainer reserves two options.
The maintainer closes the PR with a link to this guide and asks you to resubmit as properly decomposed PRs with validation methods.
Your credit: the PR is entirely yours, including the "Merged" badge after resubmission.
If part of your PR is clearly valuable and worth saving, the maintainer runs
git cherry-pick on those commits into main directly and closes the
original PR.
Your credit:
git cherry-pickpreserves the original author, sogit logandgit blamestill show you as author of those lines.- The maintainer's reconcile commit message carries a
Co-authored-by: <you> <your-email>trailer, which counts toward your GitHub contribution graph. - However, the original PR shows as "Closed" instead of "Merged".