tpt-codex

Rust

A unified, headless, deterministic document and data workspace in Rust. One block-based model projects as a flowing document, live spreadsheet, slide canvas, or byte-exact PDF, via WebAssembly. MIT OR Apache-2.0.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust96.5%JavaScript1.6%Python1.1%HTML0.6%Shell0.1%PowerShell0.1%Just0.1%
README

tpt-codex

A unified, deterministic, strictly-licensed document and data workspace.

tpt-codex replaces fragmented office suites with one headless data model. A document is a tree (DAG) of structured blocks. The same data can be projected as a flowing document, a live spreadsheet, a presentation canvas, or a byte-exact PDF, and it runs in the browser via WebAssembly.

Status: pre-release (0.1.0-spec). The data model, Markdown/.cdx reader and writer, typesetting, paginated and tagged PDF export, PDF text import, collaboration (CRDT and relay), and .docx/.xlsx/.pptx interop are implemented and tested. The browser editor is a demo on a sample document. See todo.md for what is left and spec.txt for the design specification.

Design principles

  • Single source of truth. Data is decoupled from presentation. The UI is a reactive projection of the block tree.
  • Deterministic rendering. The same model yields the same output on native, WASM, and PDF.
  • Strict licensing. Shipped dependencies must be MIT, 0BSD, BSD-2/3-Clause, Unicode-DFS-2016, Unicode-3.0, Zlib, or dual-licensed with an MIT option. Apache-2.0-only, GPL, AGPL, SSPL and BSL are rejected by CI. Development-only dependencies (tests, benchmarks, examples) are not checked.
  • Headless, no_std core. Core model, views, Markdown and typesetting are no_std + alloc. Platform I/O sits behind trait boundaries.

Workspace layout

CratePurposeno_std
tpt-codex-coreBlock data model, undo history, CRDT replicas, version logyes
tpt-codex-viewsFlow, Paginated and Canvas (slide) layout, hyphenation, SVG slidesyes
tpt-codex-markdownMarkdown and .cdx reader/writeryes
tpt-typesetOutline, math, citations, footnotes, cross-references, queries, bindingsyes
tpt-codex-gridLive grid evaluation with tpt-latticeno
tpt-codex-textBundled fonts and text measurement with tpt-textno
tpt-codex-pdfDeterministic PDF export of documents and slidesno
tpt-codex-interop.docx, .xlsx, .pptx, .pdf (text) import and .docx, .xlsx exportno
tpt-codex-filesOpen and save by file extension, from and to bytes (shared by the CLI and the browser)no
tpt-codex-cliThe tpt command: convert, check, watch, diff, merge, newno
tpt-codex-appEditor state and UI tree on tpt-appfrontno
tpt-codex-webBrowser entry point (wasm) and demo pageno
tpt-codex-syncWebSocket transport and tpt-codex-relay serverno
tpt-codex-acceptanceOne end-to-end test file per milestoneno

Each crate has its own README (linked above) and CHANGELOG. The root CHANGELOG summarises the workspace. More: Markdown grammar · versioning · dependency map · browser demo · relay server

Using it

cargo install --path crates/tpt-codex-cli
tpt new article                       # start from a template
tpt check article.cdx                 # broken references, bad math, missing footnotes
tpt convert article.cdx -o article.pdf
tpt watch article.cdx -o article.pdf  # rebuild on save
tpt convert report.docx -o report.cdx --report

See the quickstart, the .cdx cheat-sheet and migrating from Office.

Building and testing

Requires a stable Rust toolchain (edition 2024, Rust 1.85+). rust-toolchain.toml installs the required components and targets automatically.

cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all -- --check

# no_std / WASM builds of the headless crates
cargo build -p tpt-codex-core -p tpt-codex-views -p tpt-codex-markdown -p tpt-typeset --target thumbv7m-none-eabi
cargo build -p tpt-codex-core -p tpt-codex-views -p tpt-codex-markdown -p tpt-typeset --target wasm32-unknown-unknown

# Licensing and header gates
cargo metadata --format-version 1 | python3 scripts/check_licenses.py
python3 -m unittest scripts/test_check_licenses.py
python3 scripts/check_spdx.py

License

Dual-licensed under either of

at your option. Copyright © 2026 TPT Solutions.

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Every Rust source file begins with the header // SPDX-License-Identifier: MIT OR Apache-2.0.