Skip to content

Architecture

karlmoriaty edited this page Dec 6, 2026 · 1 revision

Architecture

One binary

cmd_op is a self-contained .NET binary. It reads and writes OOXML packages directly; Office, Python, and COM are not involved.

Three layers of control

Layer Purpose Commands
L1 Read Semantic views view (text, outline, annotated, stats, issues, html, svg, screenshot, pdf)
L2 DOM Element operations get, query, set, add, remove, move, swap
L3 Raw XML XPath fallback raw, raw-set, add-part, validate

Every element has a stable path such as /slide[1]/shape[2]; indexes are 1-based and use element names, not XPath.

Render, look, fix

The renderer turns a document into HTML, and PNG screenshots are produced through a headless browser. That lets an agent check overflow, overlap, and layout before delivery — in CI, Docker, or a headless server.

JSON contract

Every command supports --json with stable envelopes. Mutations return {success, path}; errors carry code, message, and suggestion. Exit code 2 means the command ran with caveats.

Resident mode

open keeps a document in memory and serves edits over a named pipe; the SDKs use this to avoid process startup per call. Run save or close before another tool reads the file.

Deliberate limits

  • macOS is not covered.
  • Complex layout fidelity is best-effort, not pixel-identical to Office.
  • serve is loopback-only by default.

Canonical details: docs/.

Clone this wiki locally