Skip to main content

docx-cli

license python release MCP artifacts

docx-cli poster

Deterministic generator of Russian-language legal .docx documents. Builds from a machine-checkable JSON spec (or Markdown for procedural filings), then re-opens the written file and validates layout against the standard — margins, font, spacing, indents, list numbering, dashes, «ё». Any mismatch is fail-closed: the partial file is removed and an error envelope is returned. Includes an injection scanner for incoming text and an MCP mode.

RU Русский · English

Install

pip install git+https://github.com/lnfnt/docx-cli.git
docx-cli doctor

Not on PyPI. Checkout: git clone https://github.com/lnfnt/docx-cli.git && cd docx-cli && python3 -m venv .venv && . .venv/bin/activate && pip install -e . (or pipx install .). Python >= 3.11; deps: python-docx, pydantic, lxml. No network calls.

Quickstart

docx-cli build examples/spec_example.json output.docx
docx-cli validate output.docx
docx-cli doctor

One JSON envelope per command; exit codes: 0 ok, 1 business rejection, 2 usage/structural error (incl. strict warnings).

Layout standard

Setting gost (default) court profile
Page/margins A4; L 3.0 / R 1.5 / T 2.0 / B 2.0 cm same geometry
Font Times New Roman 12 pt (headings 14) Times New Roman 14 pt
Spacing 1.5 (header/title 1.15) 1.0
Indents 1.25 cm first line; body justified header left_indent = 7.0 cm, hanging lists

vs_sud (Supreme Court) and soyu_rayon (first-instance SOYU incl. justice-of-the-peace slot) are formatting skeletons: geometry plus {...} placeholders, no normative content; templates in templates/vs_sud.json, templates/soyu_rayon.json. Full contract: SPEC.md.

MCP mode

docx-cli mcp            # JSON-RPC 2.0 on stdin/stdout
docx-cli mcp --tools    # tools/list dump

Eight tools: docx_build, docx_validate, docx_scan, docx_normalize, docx_md_build, docx_doctor, docx_agent_read, docx_verify_forbidden. Write tools require confirm: true; otherwise status=needs_confirmation and nothing is written. Malformed transport lines return a -32700 envelope without crashing.

md-converter

Nested lists of depth 1-4 (List Bullet/Number 2-3; depth >4 skipped with a list_depth_gt4 marker in the report); GFM pipe tables (Table Grid, alignments, repeated headers, inline formatting in cells, \| escaping); block constructs inside cells are unsupported and flagged (block_in_cell). Legacy md converts structurally identically to v0.9.0.

Limits

  • Not legal advice; does not validate case facts.
  • Generation from spec/Markdown only — not an editor for foreign legacy .docx files.
  • vs_sud/soyu_rayon carry formatting, not norms; normative content comes from your spec.

License

Apache-2.0 (LICENSE). Verify: sha256sum -c SHA256SUMS, gpg --verify *.asc (key attached).

Author and copyright holder: lnfnt.

Metadata

Release files for docx-cli 0.1.0

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

Source distribution (sdist)

Source distribution for docx-cli 0.1.0
File Size Uploaded Provenance
docx_cli-0.1.0.tar.gz 546.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docx-cli 0.1.0
File Interpreter ABI Platform
docx_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 610.3 kB

Release files / docx_cli-0.1.0.tar.gz

Download URL docx_cli-0.1.0.tar.gz
Size 546.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5a3736065498f7d09b74e8efdc02eda5862536f5f5f694bc4a6906b548220b0e
BLAKE2b-256 checksum
How to use checksums
38df0bfea5e65f15df018935183f96b68b9155b9abb0ed76761eab62eb8c7cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / docx_cli-0.1.0-py3-none-any.whl

Download URL docx_cli-0.1.0-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54cb9233fd2352afe86b7d298e8db623d984199c35cf75d791bf7d6b6014a45e
BLAKE2b-256 checksum
How to use checksums
999586e0334753aa20860358afec57e331ef614717d29e936eed2905dc2cd9c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for docx-cli 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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