officecli-patch
繁體中文
officecli-patch 是 iOfficeAI OfficeCLI 的相容擴充工具。它保留官方 OfficeCLI 的所有原生指令與參數,並新增 diff 與 rewrite。
為什麼會有這個套件?
官方 OfficeCLI 很適合 dump、檢查與批次處理 Office 文件。不過,當文件已有既定格式,例如信紙、合約、婚禮菜單或公司範本時,直接回寫 AI 產生的完整 JSON,可能影響原本不該變動的文件內容。
常見需求其實是:只修改 AI 真正改過的文字,同時保留原始 DOCX 的 watermark、logo、頁首/頁尾、圖片、shape、表格、樣式與 relationship。
官方 OfficeCLI 目前尚未提供這個「以原始文件為基礎、執行完整 AI JSON batch 後再以文字 patch 修正格式」的整合流程。officecli-patch 因此將手動複製文件、執行 AI JSON batch、比較 JSON、產生 patch、再執行 batch 的流程,收斂為 rewrite 指令。
安裝與使用
pip install officecli-patch
# 先 dump 原始文件;AI 只修改 original.json 中的 props.text 後另存 ai.json
officecli-patch dump original.docx -o original.json
officecli-patch rewrite original.docx original.json ai.json -o rewritten.docx
若只需要查看文字差異:
officecli-patch diff original.json ai.json -o patch.json
其他命令都會直接轉交官方 OfficeCLI:
officecli-patch validate original.docx
officecli-patch batch document.docx --input commands.json
officecli-patch raw --help
首次執行時,PyPI 啟動器會自動判斷作業系統、CPU 架構與 Linux libc 類型,從與該 PyPI 版本相同的 GitHub Release 下載對應執行檔、驗證 SHA-256 並快取到本機。每個版本使用獨立快取,不會重用舊版 binary。
English
officecli-patch is a compatible extension for iOfficeAI OfficeCLI. It preserves all official OfficeCLI commands and arguments, and adds diff and rewrite.
Why does this package exist?
OfficeCLI is excellent for dumping, inspecting, and batch-processing Office documents. But for a document with an established design—such as letterhead, a contract, a wedding menu, or a company template—writing back an entire AI-generated JSON document can alter content that was never meant to change.
The practical requirement is usually: change only the text the AI actually changed, while retaining the original DOCX watermark, logo, headers/footers, images, shapes, tables, styles, and relationships.
Official OfficeCLI does not yet provide an integrated command for the workflow that starts from the original document, runs the complete AI JSON batch, and then corrects it with a text patch. officecli-patch provides that workflow through rewrite, replacing the manual copy → AI JSON batch → JSON comparison → patch generation → best-effort batch sequence.
Install and use
pip install officecli-patch
# Dump the source document. Let the AI edit only props.text in original.json,
# then save it as ai.json.
officecli-patch dump original.docx -o original.json
officecli-patch rewrite original.docx original.json ai.json -o rewritten.docx
To inspect or save the text patch only:
officecli-patch diff original.json ai.json -o patch.json
Every other command is passed through to the embedded official OfficeCLI:
officecli-patch validate original.docx
officecli-patch batch document.docx --input commands.json
officecli-patch raw --help
On first use, the PyPI launcher detects the operating system, CPU architecture, and Linux libc variant. It downloads the matching binary from the GitHub Release for that exact PyPI version, verifies its SHA-256 checksum, then caches and runs it. Each release has its own cache, so an older binary is never reused after an upgrade.
Source code, full documentation, and releases: bruce601080102/officecli-patch.
Metadata
Release files for officecli-patch 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| officecli_patch-0.1.5.tar.gz | 5.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| officecli_patch-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / officecli_patch-0.1.5.tar.gz
| Download URL | officecli_patch-0.1.5.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cdf2e467e62ac83a5bcee2043c2ee9e24d1254f83d8ba9240bdb1a8b1283ee8
|
|
BLAKE2b-256 checksum How to use checksums |
831d67ebccd625ef517039c26e11ce42515a2b7281c5c832569e99344509cb5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logRelease files / officecli_patch-0.1.5-py3-none-any.whl
| Download URL | officecli_patch-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d33560c2c0f1c54f5bc91a8be467dcc55202bd73cc961d898838edc628b8e11b
|
|
BLAKE2b-256 checksum How to use checksums |
20476b9696bf410d29a0fddfd43b83ba9674d268c8d01650bf81c8e7e80d195b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logSecurity for officecli-patch 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for officecli_patch-0.1.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.