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 docx-cli
docx-cli doctor

From the repo: pip install git+https://github.com/lnfnt/docx-cli.git.

From PyPI: pip install docx-cli. 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). The md converter output is layout-stable across releases.

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

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.1
File Size Uploaded Provenance
docx_cli-0.1.1.tar.gz 546.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 610.3 kB

Release files / docx_cli-0.1.1.tar.gz

Download URL docx_cli-0.1.1.tar.gz
Size 546.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ef317f6af257fefe691e1087731b4bdfb30303e82910dd40e003f353690769c1
BLAKE2b-256 checksum
How to use checksums
a4ba4d58ae8956d9a4ccae69f69ea839d90cf204f1651757a77f9af65de74a3f
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.1-py3-none-any.whl

Download URL docx_cli-0.1.1-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d7ef30d16c66fea94fc5be03ed203cac92464d63db1af985ab39e9c831cedf4
BLAKE2b-256 checksum
How to use checksums
6507f35151a8c6ccd694a42aca4815c9b125c888a6f15ed2a56ca7a8929c2f7c
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.1

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