# hxuxingy1212/astorm-office architecture

> Architecture diagram of the GitHub repository hxuxingy1212/astorm-office, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hxuxingy1212/astorm-office
- Repository: https://github.com/hxuxingy1212/astorm-office

## Overview

astorm-office is a Rust toolkit for AI agents to parse, generate, edit, convert, and preview Word, Excel, PowerPoint, and PDF documents. Its main workflow is unpacking a document into an editable JSON product directory, viewing or editing it through a format-specific CLI, repacking it, then rendering or validating the result. Format libraries provide parsing, models, and generation; shared CLI infrastructure standardizes output and package handling. The Vue viewer consumes unpacked data and exposes CLI paths. Relationships below follow README workflows and documented library roles; many implementation details were not sampled.

Main entry points: [`ai-pdf/cli/src/main.rs`](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/cli/src/main.rs) (PDF CLI), [`ai-word/cli/src/main.rs`](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/cli/src/main.rs) (Word CLI), [`ai-ppt/cli/src/main.rs`](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/cli/src/main.rs) (PowerPoint CLI), [`office-web/src/index.ts`](https://github.com/hxuxingy1212/astorm-office/blob/main/office-web/src/index.ts) (Office viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_word["Word"]
  node_word_cli["Word CLI<br/>[main.rs]"]
  node_word_parse["DOCX parser<br/>[document.rs]"]
  node_word_model["Document model<br/>[blocks.rs]"]
  node_word_generate["DOCX generator<br/>[mod.rs]"]
end

subgraph group_excel["Excel"]
  node_excel_cli["Excel CLI<br/>[main.rs]"]
  node_excel_parse["XLSX parser<br/>[mod.rs]"]
  node_excel_model["Workbook model<br/>[workbook.rs]"]
  node_excel_eval["Formula evaluator<br/>[eval.rs]"]
  node_excel_generate["XLSX generator<br/>[mod.rs]"]
end

subgraph group_ppt["PowerPoint"]
  node_ppt_cli["PowerPoint CLI<br/>[main.rs]"]
  node_ppt_parse["PPTX parser<br/>[mod.rs]"]
  node_ppt_model["Presentation model<br/>[presentation.rs]"]
  node_ppt_generate["PPTX generator<br/>[mod.rs]"]
  node_ppt_editor["Web editor<br/>[App.vue]"]
end

subgraph group_pdf["PDF"]
  node_pdf_cli["PDF CLI<br/>[main.rs]"]
  node_pdf_unpack["PDF unpack<br/>[unpack.rs]"]
  node_pdf_model["PDF model<br/>[model.rs]"]
  node_pdf_repack["PDF repack<br/>[repack.rs]"]
  node_pdf_extract["Text and OCR<br/>[text.rs]"]
  node_pdf_convert["Format conversion<br/>[convert.rs]"]
  node_pdf_qa["PDF quality checks<br/>[qa.rs]"]
end

subgraph group_shared["Shared tools"]
  node_core["Shared CLI and OPC<br/>[lib.rs]"]
end

subgraph group_viewer["Web preview"]
  node_office_viewer["Office viewer<br/>[index.ts]"]
  node_xlsx_virtual["Virtual sheet renderer<br/>[virtual.ts]"]
end

node_agent(("AI agent"))

node_agent -->|"requests document operations"| node_word_cli
node_agent -->|"requests document operations"| node_excel_cli
node_agent -->|"requests document operations"| node_ppt_cli
node_agent -->|"requests document operations"| node_pdf_cli
node_word_cli -->|"unpacks DOCX"| node_word_parse
node_word_cli -->|"repacks DOCX"| node_word_generate
node_word_parse -->|"builds model"| node_word_model
node_word_generate -->|"generates from model"| node_word_model
node_word_cli -->|"unpacks XLSX"| node_excel_parse
node_excel_cli -->|"repacks XLSX"| node_excel_generate
node_excel_parse -->|"builds workbook"| node_excel_model
node_excel_generate -->|"generates from workbook"| node_excel_model
node_excel_model -->|"evaluates formulas"| node_excel_eval
node_ppt_cli -->|"unpacks PPTX"| node_ppt_parse
node_ppt_cli -->|"repacks PPTX"| node_ppt_generate
node_ppt_parse -->|"builds presentation"| node_ppt_model
node_ppt_generate -->|"generates from model"| node_ppt_model
node_pdf_cli -->|"unpacks PDF"| node_pdf_unpack
node_pdf_cli -->|"repacks PDF"| node_pdf_repack
node_pdf_unpack -->|"creates product data"| node_pdf_model
node_pdf_repack -->|"rebuilds from product data"| node_pdf_model
node_pdf_cli -->|"extracts text"| node_pdf_extract
node_pdf_cli -->|"converts formats"| node_pdf_convert
node_pdf_cli -->|"checks PDF"| node_pdf_qa
node_word_cli -->|"uses shared facilities"| node_core
node_excel_cli -->|"uses shared facilities"| node_core
node_ppt_cli -->|"uses shared facilities"| node_core
node_pdf_cli -->|"uses output contract"| node_core
node_ppt_editor -.->|"selects CLI paths"| node_ppt_cli
node_office_viewer -->|"renders large sheets"| node_xlsx_virtual
node_word_cli -->|"supplies unpacked data"| node_office_viewer
node_excel_cli -->|"supplies unpacked data"| node_office_viewer
node_ppt_cli -->|"supplies unpacked data"| node_office_viewer
node_pdf_cli -->|"supplies unpacked data"| node_office_viewer

click node_word_cli "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/cli/src/main.rs"
click node_word_parse "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/parse/document.rs"
click node_word_model "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/model/blocks.rs"
click node_word_generate "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/generate/mod.rs"
click node_excel_cli "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/cli/src/main.rs"
click node_excel_parse "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/parse/mod.rs"
click node_excel_model "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/model/workbook.rs"
click node_excel_eval "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/eval.rs"
click node_excel_generate "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/generate/mod.rs"
click node_ppt_cli "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/cli/src/main.rs"
click node_ppt_parse "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/parse/mod.rs"
click node_ppt_model "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/model/presentation.rs"
click node_ppt_generate "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/generate/mod.rs"
click node_ppt_editor "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/web/src/App.vue"
click node_pdf_cli "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/cli/src/main.rs"
click node_pdf_unpack "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/unpack.rs"
click node_pdf_model "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/model.rs"
click node_pdf_repack "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/repack.rs"
click node_pdf_extract "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/text.rs"
click node_pdf_convert "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/convert.rs"
click node_pdf_qa "https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/qa.rs"
click node_core "https://github.com/hxuxingy1212/astorm-office/blob/main/office-core/src/lib.rs"
click node_office_viewer "https://github.com/hxuxingy1212/astorm-office/blob/main/office-web/src/index.ts"
click node_xlsx_virtual "https://github.com/hxuxingy1212/astorm-office/blob/main/office-web/src/renderers/xlsx/virtual.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_word_cli,node_word_parse,node_word_model,node_word_generate toneBlue
class node_excel_cli,node_excel_parse,node_excel_model,node_excel_eval,node_excel_generate toneAmber
class node_ppt_cli,node_ppt_parse,node_ppt_model,node_ppt_generate,node_ppt_editor toneMint
class node_pdf_cli,node_pdf_unpack,node_pdf_model,node_pdf_repack,node_pdf_extract,node_pdf_convert,node_pdf_qa toneRose
class node_core,node_agent toneIndigo
class node_office_viewer,node_xlsx_virtual toneTeal
```

## Components

### Word

- [Word CLI](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/cli/src/main.rs): `ai-word/cli/src/main.rs`
- [DOCX parser](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/parse/document.rs): `ai-word/src/parse/document.rs`
- [Document model](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/model/blocks.rs): `ai-word/src/model/blocks.rs`
- [DOCX generator](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-word/src/generate/mod.rs): `ai-word/src/generate/mod.rs`

### Excel

- [Excel CLI](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/cli/src/main.rs): `ai-excel/cli/src/main.rs`
- [XLSX parser](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/parse/mod.rs): `ai-excel/src/parse/mod.rs`
- [Workbook model](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/model/workbook.rs): `ai-excel/src/model/workbook.rs`
- [Formula evaluator](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/eval.rs): `ai-excel/src/eval.rs`
- [XLSX generator](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-excel/src/generate/mod.rs): `ai-excel/src/generate/mod.rs`

### PowerPoint

- [PowerPoint CLI](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/cli/src/main.rs): `ai-ppt/cli/src/main.rs`
- [PPTX parser](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/parse/mod.rs): `ai-ppt/src/parse/mod.rs`
- [Presentation model](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/model/presentation.rs): `ai-ppt/src/model/presentation.rs`
- [PPTX generator](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/src/generate/mod.rs): `ai-ppt/src/generate/mod.rs`
- [Web editor](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-ppt/web/src/App.vue): `ai-ppt/web/src/App.vue`

### PDF

- [PDF CLI](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/cli/src/main.rs): `ai-pdf/cli/src/main.rs`
- [PDF unpack](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/unpack.rs): `ai-pdf/src/unpack.rs`
- [PDF model](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/model.rs): `ai-pdf/src/model.rs`
- [PDF repack](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/repack.rs): `ai-pdf/src/repack.rs`
- [Text and OCR](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/text.rs): `ai-pdf/src/text.rs`
- [Format conversion](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/convert.rs): `ai-pdf/src/convert.rs`
- [PDF quality checks](https://github.com/hxuxingy1212/astorm-office/blob/main/ai-pdf/src/qa.rs): `ai-pdf/src/qa.rs`

### Shared tools

- [Shared CLI and OPC](https://github.com/hxuxingy1212/astorm-office/blob/main/office-core/src/lib.rs): `office-core/src/lib.rs`

### Web preview

- [Office viewer](https://github.com/hxuxingy1212/astorm-office/blob/main/office-web/src/index.ts): `office-web/src/index.ts`
- [Virtual sheet renderer](https://github.com/hxuxingy1212/astorm-office/blob/main/office-web/src/renderers/xlsx/virtual.ts): `office-web/src/renderers/xlsx/virtual.ts`

### Other components

- **AI agent**

## Connections

- AI agent → Word CLI: requests document operations (evidence: `README.md`)
- AI agent → Excel CLI: requests document operations (evidence: `README.md`)
- AI agent → PowerPoint CLI: requests document operations (evidence: `README.md`)
- AI agent → PDF CLI: requests document operations (evidence: `README.md`)
- Word CLI → DOCX parser: unpacks DOCX (evidence: `README.md`)
- Word CLI → DOCX generator: repacks DOCX (evidence: `README.md`)
- DOCX parser → Document model: builds model (evidence: `ai-word/src/parse/document.rs`)
- DOCX generator → Document model: generates from model (evidence: `ai-word/src/generate/mod.rs`)
- Word CLI → XLSX parser: unpacks XLSX (evidence: `README.md`)
- Excel CLI → XLSX generator: repacks XLSX (evidence: `README.md`)
- XLSX parser → Workbook model: builds workbook (evidence: `ai-excel/src/parse/mod.rs`)
- XLSX generator → Workbook model: generates from workbook (evidence: `ai-excel/src/generate/mod.rs`)
- Workbook model → Formula evaluator: evaluates formulas (evidence: `ai-excel/src/eval.rs`)
- PowerPoint CLI → PPTX parser: unpacks PPTX (evidence: `README.md`)
- PowerPoint CLI → PPTX generator: repacks PPTX (evidence: `README.md`)
- PPTX parser → Presentation model: builds presentation (evidence: `ai-ppt/src/parse/mod.rs`)
- PPTX generator → Presentation model: generates from model (evidence: `ai-ppt/src/generate/mod.rs`)
- PDF CLI → PDF unpack: unpacks PDF (evidence: `README.md`)
- PDF CLI → PDF repack: repacks PDF (evidence: `README.md`)
- PDF unpack → PDF model: creates product data (evidence: `ai-pdf/src/unpack.rs`)
- PDF repack → PDF model: rebuilds from product data (evidence: `README.md`)
- PDF CLI → Text and OCR: extracts text
- PDF CLI → Format conversion: converts formats
- PDF CLI → PDF quality checks: checks PDF (evidence: `README.md`)
- Word CLI → Shared CLI and OPC: uses shared facilities (evidence: `office-core/src/lib.rs`)
- Excel CLI → Shared CLI and OPC: uses shared facilities (evidence: `office-core/src/lib.rs`)
- PowerPoint CLI → Shared CLI and OPC: uses shared facilities (evidence: `office-core/src/lib.rs`)
- PDF CLI → Shared CLI and OPC: uses output contract
- Web editor → PowerPoint CLI: selects CLI paths (evidence: `README.md`)
- Office viewer → Virtual sheet renderer: renders large sheets (evidence: `README.md`)
- Word CLI → Office viewer: supplies unpacked data (evidence: `README.md`)
- Excel CLI → Office viewer: supplies unpacked data (evidence: `README.md`)
- PowerPoint CLI → Office viewer: supplies unpacked data (evidence: `README.md`)
- PDF CLI → Office viewer: supplies unpacked data (evidence: `README.md`)
