oox-tui (binary oox) is a Rust terminal app for inspecting Office Open XML documents (.pptx, .docx, .xlsx). It opens the OOXML ZIP package, lists its parts in a tree, previews XML content with syntax highlighting, and displays common embedded images; it also compares two packages and edits/saves XML, JSON, and text parts.
src/main.rs— Entry point, terminal setup/teardown, event loop.src/app/— App state and feature modules:mod.rs(core state and loading),tree.rs(tree construction and filtering),search.rs(path/content search),edit.rs(editor buffers and external-editor round trip),save.rs(save workflow),export.rs(extract/copy/external open),details.rs(metadata and document summary),navigation.rs(history), andtests.rs(App integration tests).src/package.rs— Canonical package model (Package,PackageIndex), bounded ZIP access, content-type/relationship parsing, the single source of truth for extension- and content-type-based part classification, andwrite_editedfor rewriting a package with parts replaced.src/integrity.rs— Phase-1 OPC package integrity checks over an indexed package (dangling targets, missing content types, orphans, duplicate relationship ids, missing required parts).src/compare.rs— Part-level comparison of two packages; XML-normalized (attribute order/whitespace) equality and unified diffs.src/preview.rs— Part-preview classification and formatters (XML/JSON pretty-print, hex dump, binary info), with bounded output writers;editableonPreview::Editorsays whether the text can be written back, andxml_well_formedis the advisory check used before saving.src/summary/— Document summary view model (mod.rs) and per-format parsers (ppt.rs,word.rs,excel.rs).src/worker.rs— Background worker thread; owns a cachedZipArchivehandle and receives the sharedArc<PackageIndex>.Job::SavePackagebuilds a validated sibling temporary package, then installs it with a no-clobber hard link for new targets or an atomic replacing rename for confirmed overwrites.src/cancel.rs— Shared cooperative cancellation token used to stop superseded worker requests.src/keybindings.rs— ConfigurableActionbindings, editor mode, and generated help-overlay content.src/layout.rs— Shared layout geometry used by both rendering and mouse hit testing.src/ui.rs— Ratatui layout and widgets (tree + metadata + content + help).Cargo.toml— Dependencies and CLI binary name (oox).CHANGELOG.md— Keep a Changelog history; updated before every commit with user-visible changes.data/sample.pptx— Default sample file.
Rust, ratatui, crossterm, tui-tree-widget, edtui (Vim-mode editor with syntax highlighting), zip (Deflate feature only), quick-xml, image, and ratatui-image.
cargo build
cargo test
cargo run -- data/sample.pptx- Do not commit, push, or create pull requests unless the user explicitly asks for it.
- Leave implementation changes uncommitted by default.
- Before any requested commit, inspect
git statusand review the diff. - Before any requested commit, update
CHANGELOG.mdfor user-visible changes (features, fixes, behavior, CLI/config, packaging, MSRV, license): add terse entries under the topmost heading if it is unreleased (## [Unreleased]or## [X.Y.Z] - Unreleased), otherwise create## [Unreleased]above it; use Keep a Changelog groups (Added,Changed,Fixed,Removed). Internal-only changes (refactors, tests, CI, dependency bumps without user impact) need no entry.
- Keep the TUI state in
App; keep rendering inui.rs; keep input handling inmain.rs. - Use
io::Resultfor app-level errors. Avoid panics in production paths — replacetodo!()and.unwrap()with proper error handling. - Preserve the current widget focus model (
Tree↔TextArea) and quit guards (only quit from tree or editor Normal mode). - OOXML files are ZIP archives. Use the
zipcrate with the configured Deflate feature for container access andquick-xmlfor XML formatting. - Keep optional dependency features minimal:
edtuiis configured without default features but with syntax highlighting;zipis configured without default features and with Deflate support. - Keep image decoding and terminal rendering aligned: supported extensions and
image::ImageFormatmappings belong together insrc/package.rs(is_image_name,image_format).
- Add new keybindings →
src/keybindings.rs(Actionenum +help_sections), dispatch insrc/main.rs(run_app); consider editor mode guards. - Change layout/styling →
src/ui.rs(andsrc/layout.rsfor geometry shared with mouse hit testing). - Add OOXML semantics → extend
src/summary/; consider higher-level OOXML crates before hand-rolling parsers. - Add a package integrity rule →
src/integrity.rs(check), then surface it viaPackageIndex::integrityconsumers (metadata panel, tree marker). - Switch XML engine →
pretty_print_xmlinsrc/preview.rsis the only XML formatting site. - Change the edit/save flow →
App.editorholds unsaved buffers (edits,baseline,dirty);collect_editslives insrc/app/save.rs;pick_up_externallives insrc/app/edit.rs. The write remainspackage::write_editeddriven byworker::save_package; the external-editor round trip remainsrun_external_editinsrc/main.rs. - Change image support → update
is_image_name/image_formatinsrc/package.rsand theimagefeatures inCargo.tomltogether. - Release → bump
versioninCargo.toml, rename the topCHANGELOG.mdheading to## [X.Y.Z] - YYYY-MM-DDand add its compare link at the bottom, keeprust-versionand themsrvjob in.github/workflows/ci.ymlin sync; pushing tagvX.Y.Zruns.github/workflows/publish.yml.