# zhyx91/docwen architecture

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

- Interactive diagram: https://gitdiagram.com/zhyx91/docwen
- Repository: https://github.com/zhyx91/docwen

## Overview

DocWen is a local document-conversion and office-processing application with GUI and CLI entry points. Users provide files and options; the application coordinates a task, the runtime resolves a conversion route and executes its plugin, and generated artifacts are returned or saved. Major documented branches include document and spreadsheet conversion, PDF/layout operations, image conversion and OCR, proofreading, and templates. The runtime excerpts establish task routing and workspace ownership; several feature branches are represented from the README and tree, not sampled implementation.

Main entry points: [`packages/runtime/src/docwen_runtime/engine/task_manager.py`](https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/engine/task_manager.py) (Task manager), [`packages/application/src/docwen_application/controller.py`](https://github.com/zhyx91/docwen/blob/main/packages/application/src/docwen_application/controller.py) (App controller), [`packages/apps/cli/src/docwen_cli/main.py`](https://github.com/zhyx91/docwen/blob/main/packages/apps/cli/src/docwen_cli/main.py) (CLI), [`packages/apps/gui/src/docwen_gui/app.py`](https://github.com/zhyx91/docwen/blob/main/packages/apps/gui/src/docwen_gui/app.py) (Desktop GUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI<br/>[main.py]"]
  node_gui["Desktop GUI<br/>[app.py]"]
  node_bundle["Runtime bootstrap<br/>[runtime_factory.py]"]
end

subgraph group_coordination["Task coordination"]
  node_controller["App controller<br/>[controller.py]"]
  node_taskmgr["Task manager<br/>[task_manager.py]"]
  node_routes["Route registry<br/>[routes.py]"]
  node_workspace["Task workspace<br/>[manager.py]"]
end

subgraph group_conversion["Conversion engines"]
  node_spreadsheet["Spreadsheet conversion"]
  node_layout["PDF / layout<br/>[plugin.py]"]
  node_image["Image / OCR<br/>[plugin.py]"]
end

subgraph group_document["Document features"]
  node_document_plugin["Word / Markdown<br/>[plugin.py]"]
  node_markdown_plugin["Markdown engine<br/>[plugin.py]"]
  node_optimizer["Document optimizer"]
end

subgraph group_support["Supporting services"]
  node_templates["Template manager<br/>[manager.py]"]
  node_postprocess["Proofreading stage"]
end

node_user(("User / files"))
node_local_files[("Local files")]
node_office["Office suite"]
node_result["Converted artifacts"]

node_user -->|"submits command"| node_cli
node_user -->|"provides files"| node_gui
node_cli -->|"starts runtime"| node_bundle
node_gui -->|"starts runtime"| node_bundle
node_bundle -->|"provides runtime"| node_controller
node_cli -->|"submits operation"| node_controller
node_gui -->|"submits operation"| node_controller
node_controller -->|"executes request"| node_taskmgr
node_taskmgr -->|"resolves route"| node_routes
node_taskmgr -->|"creates workspace"| node_workspace
node_taskmgr -->|"resolves template"| node_templates
node_taskmgr -->|"dispatches conversion"| node_document_plugin
node_taskmgr -->|"dispatches conversion"| node_markdown_plugin
node_taskmgr -->|"dispatches conversion"| node_spreadsheet
node_taskmgr -->|"dispatches operation"| node_layout
node_taskmgr -->|"dispatches conversion"| node_image
node_taskmgr -.->|"dispatches optimization"| node_optimizer
node_document_plugin -->|"reads / writes"| node_local_files
node_markdown_plugin -->|"reads / writes"| node_local_files
node_spreadsheet -->|"reads / writes"| node_local_files
node_layout -->|"reads / writes"| node_local_files
node_image -->|"reads / writes"| node_local_files
node_taskmgr -->|"runs postprocess"| node_postprocess
node_postprocess -->|"reads / writes"| node_local_files
node_document_plugin -.->|"optional conversion"| node_office
node_taskmgr -->|"publishes artifacts"| node_result

click node_cli "https://github.com/zhyx91/docwen/blob/main/packages/apps/cli/src/docwen_cli/main.py"
click node_gui "https://github.com/zhyx91/docwen/blob/main/packages/apps/gui/src/docwen_gui/app.py"
click node_bundle "https://github.com/zhyx91/docwen/blob/main/packages/bundle/src/docwen_bundle/runtime_factory.py"
click node_controller "https://github.com/zhyx91/docwen/blob/main/packages/application/src/docwen_application/controller.py"
click node_taskmgr "https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/engine/task_manager.py"
click node_routes "https://github.com/zhyx91/docwen/blob/main/packages/core/src/docwen_core/formats/routes.py"
click node_workspace "https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/workspace/manager.py"
click node_templates "https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/templates/manager.py"
click node_postprocess "https://github.com/zhyx91/docwen/blob/main/packages/application/src/docwen_application/postprocess_pipeline.py"
click node_document_plugin "https://github.com/zhyx91/docwen/blob/main/packages/plugins/document/src/docwen_plugin_document/plugin.py"
click node_markdown_plugin "https://github.com/zhyx91/docwen/blob/main/packages/plugins/markdown/src/docwen_plugin_markdown/plugin.py"
click node_spreadsheet "https://github.com/zhyx91/docwen/tree/main/packages/plugins"
click node_layout "https://github.com/zhyx91/docwen/blob/main/packages/plugins/layout/src/docwen_plugin_layout/plugin.py"
click node_image "https://github.com/zhyx91/docwen/blob/main/packages/plugins/image/src/docwen_plugin_image/plugin.py"

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_cli,node_gui,node_bundle,node_user toneBlue
class node_controller,node_taskmgr,node_routes,node_workspace,node_local_files toneAmber
class node_spreadsheet,node_layout,node_image toneMint
class node_document_plugin,node_markdown_plugin,node_optimizer toneRose
class node_templates,node_postprocess,node_office,node_result toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/zhyx91/docwen/blob/main/packages/apps/cli/src/docwen_cli/main.py): `packages/apps/cli/src/docwen_cli/main.py`
- [Desktop GUI](https://github.com/zhyx91/docwen/blob/main/packages/apps/gui/src/docwen_gui/app.py): `packages/apps/gui/src/docwen_gui/app.py`
- [Runtime bootstrap](https://github.com/zhyx91/docwen/blob/main/packages/bundle/src/docwen_bundle/runtime_factory.py): `packages/bundle/src/docwen_bundle/runtime_factory.py`

### Task coordination

- [App controller](https://github.com/zhyx91/docwen/blob/main/packages/application/src/docwen_application/controller.py): `packages/application/src/docwen_application/controller.py`
- [Task manager](https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/engine/task_manager.py): `packages/runtime/src/docwen_runtime/engine/task_manager.py`
- [Route registry](https://github.com/zhyx91/docwen/blob/main/packages/core/src/docwen_core/formats/routes.py): `packages/core/src/docwen_core/formats/routes.py`
- [Task workspace](https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/workspace/manager.py): `packages/runtime/src/docwen_runtime/workspace/manager.py`

### Conversion engines

- [Spreadsheet conversion](https://github.com/zhyx91/docwen/tree/main/packages/plugins): `packages/plugins`
- [PDF / layout](https://github.com/zhyx91/docwen/blob/main/packages/plugins/layout/src/docwen_plugin_layout/plugin.py): `packages/plugins/layout/src/docwen_plugin_layout/plugin.py`
- [Image / OCR](https://github.com/zhyx91/docwen/blob/main/packages/plugins/image/src/docwen_plugin_image/plugin.py): `packages/plugins/image/src/docwen_plugin_image/plugin.py`

### Document features

- [Word / Markdown](https://github.com/zhyx91/docwen/blob/main/packages/plugins/document/src/docwen_plugin_document/plugin.py): `packages/plugins/document/src/docwen_plugin_document/plugin.py`
- [Markdown engine](https://github.com/zhyx91/docwen/blob/main/packages/plugins/markdown/src/docwen_plugin_markdown/plugin.py): `packages/plugins/markdown/src/docwen_plugin_markdown/plugin.py`
- **Document optimizer**

### Supporting services

- [Template manager](https://github.com/zhyx91/docwen/blob/main/packages/runtime/src/docwen_runtime/templates/manager.py): `packages/runtime/src/docwen_runtime/templates/manager.py`
- [Proofreading stage](https://github.com/zhyx91/docwen/blob/main/packages/application/src/docwen_application/postprocess_pipeline.py): `packages/application/src/docwen_application/postprocess_pipeline.py`

### Other components

- **User / files**
- **Local files**
- **Office suite**
- **Converted artifacts**

## Connections

- User / files → CLI: submits command
- User / files → Desktop GUI: provides files
- CLI → Runtime bootstrap: starts runtime
- Desktop GUI → Runtime bootstrap: starts runtime
- Runtime bootstrap → App controller: provides runtime
- CLI → App controller: submits operation
- Desktop GUI → App controller: submits operation
- App controller → Task manager: executes request
- Task manager → Route registry: resolves route
- Task manager → Task workspace: creates workspace
- Task manager → Template manager: resolves template
- Task manager → Word / Markdown: dispatches conversion
- Task manager → Markdown engine: dispatches conversion
- Task manager → Spreadsheet conversion: dispatches conversion
- Task manager → PDF / layout: dispatches operation
- Task manager → Image / OCR: dispatches conversion
- Task manager → Document optimizer: dispatches optimization
- Word / Markdown → Local files: reads / writes
- Markdown engine → Local files: reads / writes
- Spreadsheet conversion → Local files: reads / writes
- PDF / layout → Local files: reads / writes
- Image / OCR → Local files: reads / writes
- Task manager → Proofreading stage: runs postprocess
- Proofreading stage → Local files: reads / writes
- Word / Markdown → Office suite: optional conversion
- Task manager → Converted artifacts: publishes artifacts
