Skip to main content

officecli-patch

繁體中文 · English

繁體中文

officecli-patch 是 iOfficeAI OfficeCLI 的相容擴充工具。它保留官方 OfficeCLI 的所有原生指令與參數,並新增 diff 與 rewrite。

為什麼會有這個套件?

官方 OfficeCLI 很適合 dump、檢查與批次處理 Office 文件。不過,當 DOCX、XLSX 或 PPTX 已有既定格式時,直接回寫 AI 產生的完整 JSON,可能影響原本不該變動的文件內容。

常見需求其實是:只修改 AI 真正改過的內容,同時保留原始 Office 文件的圖片、shape、表格、樣式與 relationship。

官方 OfficeCLI 目前尚未提供這個「以原始文件為基礎、執行完整 AI JSON batch 後再以內容 patch 修正」的整合流程。officecli-patch 因此將手動複製文件、執行 AI JSON batch、比較 JSON、產生 patch、再執行 batch 的流程,收斂為 rewrite 指令。內容 patch 支援 DOCX 文字 run、PPTX 文字,以及 XLSX 工作表 import 與 rich text。

XLSX 的 import.text 差異會被拆成個別儲存格指令,只更新真正變動的儲存格,避免未修改的 rich text 或格式流失。

安裝與使用

python -m pip install --upgrade officecli-patch
officecli-patch --version

# 先 dump 原始文件;AI 修改內容欄位後另存 ai.json
officecli-patch dump original.xlsx -o original.json
officecli-patch rewrite original.xlsx original.json ai.json -o rewritten.xlsx

pip 會依目前作業系統與 CPU 選擇包含原生執行檔的 wheel。執行時不會下載 GitHub Release;第一次執行僅將 wheel 內的執行檔解壓至本機快取。如果終端顯示找不到命令,請重新開啟終端或將 Python 的 Scripts/bin 目錄加入 PATH;也可用 python -m officecli_patch --version 作為不依賴 PATH 的備援入口。

若只需要查看內容差異:

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 類型發佈獨立 wheel。啟動器從安裝的 wheel 取得對應執行檔並快取到本機;每個版本使用獨立快取,不會重用舊版 binary,也不需要存取 GitHub。

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 content the AI actually changed, while retaining the original Office document's 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 content patch. officecli-patch provides that workflow through rewrite, replacing the manual copy → AI JSON batch → JSON comparison → patch generation → best-effort batch sequence. Content patches support DOCX runs, PPTX text, and XLSX worksheet imports/rich text.

XLSX import.text differences are expanded into per-cell commands so unchanged rich text and formatting are retained.

Install and use

python -m pip install --upgrade officecli-patch
officecli-patch --version

# Dump the source document. Let the AI edit content fields in original.json,
# then save it as ai.json.
officecli-patch dump original.pptx -o original.json
officecli-patch rewrite original.pptx original.json ai.json -o rewritten.pptx

pip installs an officecli-patch terminal command from a wheel containing the native executable for the current platform. It never downloads from GitHub at runtime; first use only extracts that executable into a local cache. If the command is not found, reopen the terminal or add Python's Scripts/bin directory to PATH; python -m officecli_patch --version is a PATH-independent fallback.

To inspect or save the content 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

PyPI publishes a separate wheel for each operating system, CPU architecture, and Linux libc variant. pip installs the matching wheel, which already contains its native binary; first use only extracts it to a local versioned cache and never contacts GitHub.

Source code, full documentation, and releases: bruce601080102/officecli-patch.

Metadata

Release files for officecli-patch 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for officecli-patch 0.1.8
File
officecli_patch-0.1.8-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
officecli_patch-0.1.8-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
officecli_patch-0.1.8-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
officecli_patch-0.1.8-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
officecli_patch-0.1.8-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
officecli_patch-0.1.8-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
officecli_patch-0.1.8-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
officecli_patch-0.1.8-py3-none-macosx_10_15_x86_64.whl Python 3 none macOS 10.15+ x86-64 Details

Total release size: 109.7 MB

Release files / officecli_patch-0.1.8-py3-none-win_arm64.whl

Download URL officecli_patch-0.1.8-py3-none-win_arm64.whl
Size 13.4 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
f25cf4339b61778268c37f04ec708c057957d597eed6db19863c0a1f956ee51c
BLAKE2b-256 checksum
How to use checksums
c440c246179151ebff0ac8c07ab6a7a915db74fce5e1ddcec8826699b7676fa9
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-win_amd64.whl

Download URL officecli_patch-0.1.8-py3-none-win_amd64.whl
Size 13.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
023648876f1391cb4a31055e10631150229753ff204ca3a32fc0dc7e3cb17035
BLAKE2b-256 checksum
How to use checksums
81a41f9c7f368848252eae4421a5624887e17d9c1d864a70209e96fc202fc7ca
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-musllinux_1_2_x86_64.whl

Download URL officecli_patch-0.1.8-py3-none-musllinux_1_2_x86_64.whl
Size 14.0 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
29e1d200a922d064736fe95a466c73903cad28c1255db497ff3123c6647e6431
BLAKE2b-256 checksum
How to use checksums
4aeb260b16512c3195a3eca6d7d75c43974a3c0cbd9d05866c1cb51ab54f8af6
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-musllinux_1_2_aarch64.whl

Download URL officecli_patch-0.1.8-py3-none-musllinux_1_2_aarch64.whl
Size 13.5 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0a63e081fc67f7038bc52d181dae2e38cda0a2417435e061db91c02afe3a2448
BLAKE2b-256 checksum
How to use checksums
89e8abb2f5e0bbf00e997e638c8fb945b6cbf64f752ba0e24074ffc1d5525930
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-manylinux_2_17_x86_64.whl

Download URL officecli_patch-0.1.8-py3-none-manylinux_2_17_x86_64.whl
Size 14.0 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
be55a25de59103122368590a895b9b34c1df4a2a030c367d51cd61990e90ea12
BLAKE2b-256 checksum
How to use checksums
0c23eaee12a6472d58f42eaebdae24d77d491c4922ac49c9593a8648876410b6
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-manylinux_2_17_aarch64.whl

Download URL officecli_patch-0.1.8-py3-none-manylinux_2_17_aarch64.whl
Size 13.5 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9fc0e33f5b6bb15fae5151c7af729401607baa840552889b2091cbc1853c2407
BLAKE2b-256 checksum
How to use checksums
86c4ac86fbb1bafaffb581c22adf047ce564b8dc37f7f0655259992cd8e6edf1
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-macosx_11_0_arm64.whl

Download URL officecli_patch-0.1.8-py3-none-macosx_11_0_arm64.whl
Size 13.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1a29a344dd91b5bbc4a5ad1fd0aa311d73c464a86a84900f28417ac6fd18123d
BLAKE2b-256 checksum
How to use checksums
f083ed23a2057ac6713160756bb240c3d072a4f47aec7b9606a4fe6dc0cc253e
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 29, 2026.

Transparency log

Release files / officecli_patch-0.1.8-py3-none-macosx_10_15_x86_64.whl

Download URL officecli_patch-0.1.8-py3-none-macosx_10_15_x86_64.whl
Size 14.0 MB
Tags Python 3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
09f2ea75a731fd1079b9f4d24416e9dc8d2ef63b96af0bfbe7399b80788be545
BLAKE2b-256 checksum
How to use checksums
e81693d1b356c4582bb953918e96a7333fb9107b0eee69108298ebe7057ac1d1
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 29, 2026.

Transparency log

Security for officecli-patch 0.1.8

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 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for officecli_patch-0.1.8-py3-none-win_arm64.whl

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 29, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page