How ddbxl/tsp works
TSP turns local documents into cleaned, token-efficient Markdown, with page images and optional tables or OCR, then offers the results for copying or download. Users enter through the desktop CLI/GUI or browser. The browser runs the shared Python engine in a worker and provides batch controls and delivery options. The core and the format-specific reader and renderer are shown separately; some browser internals are represented at subsystem level because the excerpts are partial. Edges reflect cited source references or README descriptions.
Main entry points: core.py Document engine · cli.py CLI · bridge.py Browser downloads · gui.py Desktop GUI
Components 19
Desktop interfaces
- CLI
src/tsp/cli.py - Desktop GUI
src/tsp/gui.py
Browser application
- Browser UI
web/app.js - Web worker
web/worker.js - Pyodide bridge
web/bridge.py
Document processing
- Document engine
src/tsp/core.py - Office reader
src/tsp/office.py - PDF analysis
src/tsp/core.py - Automatic settings
src/tsp/core.py - Table extraction
src/tsp/core.py - Figure handling
src/tsp/core.py - OCR processing
src/tsp/core.py
Result generation
- Markdown output
src/tsp/core.py - Page images
src/tsp/core.py - HTML rendering
src/tsp/render.py - Browser downloads
web/bridge.py
Other components
- Document user
- Local files
- Tesseract OCR
Connections 28
- Document user → CLI: runs command
README.md - Document user → Desktop GUI: opens desktop app
README.md - Document user → Browser UI: adds documents
README.md - CLI → Document engine: processes files
src/tsp/cli.py - Desktop GUI → Document engine: processes files
src/tsp/gui.py - Browser UI → Web worker: sends requests
web/app.js - Web worker → Pyodide bridge: loads bridge
web/worker.js - Web worker → Document engine: calls processing API
web/worker.js - Pyodide bridge → Document engine: processes documents
web/bridge.py - Document engine → Office reader: delegates office files
src/tsp/core.py - Document engine → PDF analysis: extracts and cleans
README.md - Document user → Automatic settings: requests automatic mode
README.md - CLI → Automatic settings: requests inspection
src/tsp/cli.py - Automatic settings → Document engine: sets processing options
README.md - Document engine → Table extraction: extracts optional tables
README.md - Document engine → Figure handling: detects and saves figures
README.md - Document engine → OCR processing: recognizes scanned pages
README.md - OCR processing → Tesseract OCR: uses OCR engine
README.md - Document engine → Markdown output: writes Markdown
README.md - Document engine → Page images: saves page images
README.md - Document engine → HTML rendering: renders HTML output
src/tsp/core.py - Pyodide bridge → HTML rendering: renders downloadable HTML
web/bridge.py - Browser UI → Browser downloads: requests result actions
web/app.js - Browser downloads → Markdown output: packages text
web/bridge.py - Browser downloads → HTML rendering: builds HTML files
web/bridge.py - Browser downloads → Local files: returns download bundle
- CLI → Local files: writes results
README.md - Desktop GUI → Local files: saves results
README.md