# fpittelkow/mono-pub architecture

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

- Interactive diagram: https://gitdiagram.com/fpittelkow/mono-pub
- Repository: https://github.com/fpittelkow/mono-pub

## Overview

mono_pub is a Python 3.13 command-line publishing tool for the monointerferenz content workflow. Its job is to turn structured draft content into Jekyll-ready output, optionally through a terminal UI, and then publish that output via git.

1. **Top-level architecture**
   - The repository is organized around a small CLI entrypoint and a pipeline of content-processing modules.
   - Core responsibilities are split into:
     - command parsing / user interaction,
     - content lifecycle operations,
     - template-based content creation,
     - release validation and asset preparation,
     - publishing to the downstream site/repository.

2. **CLI command layer**
   - `src/mono_pub/main.py` is the central entrypoint.
   - `src/mono_pub/commands/` contains user-facing actions:
     - `new.py` creates draft content,
     - `list.py` enumerates content by status,
     - `open.py` opens draft folders in the configured editor,
     - `release.py` runs the release workflow,
     - `publish.py` pushes content downstream,
     - `tui.py` launches the terminal UI.
   - This layer is thin: it maps subcommands to processing functions and handles user interaction concerns.

3. **Content types and repository domains**
   - The tool manages three content categories: `post`, `project`, and `music`.
   - These are treated as distinct content types but follow the same broad lifecycle:
     draft creation → validation/release prep → publish.
   - `music` is described as a specialized form of project, which suggests shared handling with some content-specific metadata or templates.

4. **Template generation**
   - `src/mono_pub/templates/` contains Jinja2 markdown templates:
     - `post.md.j2`
     - `project.md.j2`
     - `music.md.j2`
   - These templates are the source for initial draft files and encode the content shape/frontmatter expected by later processing stages.
   - This is the main creation boundary: user intent becomes structured markdown + metadata.

5. **Processing pipeline**
   - The real business logic lives under `src/mono_pub/process/`.
   - Key stages appear to be:
     - `validate.py` checks draft readiness and metadata correctness,
     - `release_config.py` derives or loads configuration for release,
     - `compile.py` converts or rewrites content into deployable form,
     - `assets.py` copies or stages associated assets,
     - `release.py` coordinates the release transformation,
     - `publish.py` performs publication-oriented actions.
   - This layering indicates a pipeline where content is progressively normalized and stripped down for Jekyll deployment.

6. **Release workflow boundary**
   - Release is the main transformation boundary in the system.
   - According to the README, drafts marked `release: true` are:
     - verified,
     - have paths and links adjusted for deployment,
     - have assets copied into the asset folder,
     - have frontmatter reduced/cleaned.
   - This is the point where authoring content becomes publishable site content.

7. **Publishing workflow**
   - Publishing appears to be the final outward-facing step, handled by `process/publish.py` and the `publish` command.
   - The README indicates git is the transport mechanism: files are added, committed, and pushed to a server/repository.
   - Publish supports modes such as:
     - all content,
     - only posts,
     - only projects,
     - only music,
     - `--no-git`,
     - `--git`,
     - `--dry-run` via a local Jekyll server.
   - So the external boundary is not a custom API but a git-backed deployment flow.

8. **Configuration and environment**
   - `src/mono_pub/config.py` centralizes runtime configuration.
   - The README references an example YAML config file (`configuartion_example.yaml`), implying the app is configured externally for editor paths, content locations, release behavior, or deployment settings.
   - The configuration layer sits between commands and processing, so the architecture is environment-driven rather than hardcoded.

9. **Terminal UI subsystem**
   - `src/mono_pub/tui_interface/app.py` plus `__init__.py` implement an optional TUI.
   - The README says it is installed via the `[tui]` extra and invoked with `mono-pub tui`.
   - Architecturally, this is an alternate presentation layer over the same command/process core, not a separate application.

10. **Data flow through the system**
    - User request enters through CLI or TUI.
    - The command layer resolves the content type and action.
    - Templates generate or locate draft markdown and associated metadata.
    - Validation/release code checks that content is ready.
    - Assets are gathered and compiled into Jekyll-compatible output.
    - Publishing stages the resulting files through git and optionally dry-runs against local Jekyll.

11. **External dependencies that matter architecturally**
    - Jekyll is the downstream publishing target.
    - Git is the deployment mechanism.
    - Jinja2-like templating is implied by the `.j2` templates.
    - The tooling is Python-packaged and managed with `uv`, with an optional editable install for the TUI.

12. **What to show in an architecture diagram**
    - A good diagram would show two entry points: CLI and optional TUI.
    - Both feed into the same command layer and then into the process pipeline.
    - The process pipeline should be split into draft creation, validation/release prep, asset handling, and publishing.
    - Configuration should be shown as a shared dependency across commands and processing.
    - Jekyll and git should be shown as external systems on the publish side.

Main entry points: [`src/mono_pub/process/release.py`](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/release.py) (Release flow), [`src/mono_pub/main.py`](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/main.py) (Main), [`src/mono_pub/process/publish.py`](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/publish.py) (Publish flow), [`src/mono_pub/config.py`](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/config.py) (Config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_cli["CLI layer"]
  node_main["Main<br/>entrypoint<br/>[main.py]"]
  node_cmd_new["New<br/>command<br/>[new.py]"]
  node_cmd_list["List<br/>command<br/>[list.py]"]
  node_cmd_open["Open<br/>command<br/>[open.py]"]
  node_cmd_release["Release<br/>command<br/>[release.py]"]
  node_cmd_publish["Publish<br/>command<br/>[publish.py]"]
  node_cmd_tui["TUI command<br/>[tui.py]"]
end

subgraph group_group_core["Core pipeline"]
  node_templates["Templates<br/>jinja2 drafts"]
  node_config["Config<br/>[config.py]"]
  node_validate["Validate<br/>processing<br/>[validate.py]"]
  node_release_cfg["Release config<br/>processing<br/>[release_config.py]"]
  node_compile["Compile<br/>processing<br/>[compile.py]"]
  node_assets[("Assets<br/>processing<br/>[assets.py]")]
  node_release_proc{{"Release flow<br/>orchestration<br/>[release.py]"}}
  node_publish_proc{{"Publish flow<br/>deployment<br/>[publish.py]"}}
end

subgraph group_group_ui["Alternate UI"]
  node_tui_app["TUI app<br/>terminal UI<br/>[app.py]"]
end

subgraph group_group_external["External systems"]
  node_git{{"Git<br/>deployment target"}}
  node_jekyll{{"Jekyll<br/>site target"}}
end

node_main -->|"dispatches"| node_cmd_new
node_main -->|"dispatches"| node_cmd_list
node_main -->|"dispatches"| node_cmd_open
node_main -->|"dispatches"| node_cmd_release
node_main -->|"dispatches"| node_cmd_publish
node_main -->|"dispatches"| node_cmd_tui
node_cmd_new -->|"renders"| node_templates
node_cmd_new -->|"uses"| node_config
node_cmd_list -->|"uses"| node_config
node_cmd_open -->|"uses"| node_config
node_cmd_release -->|"invokes"| node_release_proc
node_cmd_publish -->|"invokes"| node_publish_proc
node_cmd_tui -->|"launches"| node_tui_app
node_tui_app -->|"uses"| node_config
node_tui_app -->|"drives"| node_release_proc
node_tui_app -->|"drives"| node_publish_proc
node_release_proc -->|"checks"| node_validate
node_release_proc -->|"loads"| node_release_cfg
node_release_proc -->|"rewrites"| node_compile
node_release_proc -->|"stages"| node_assets
node_release_proc -->|"hands off"| node_publish_proc
node_publish_proc -->|"pushes via"| node_git
node_publish_proc -->|"targets"| node_jekyll
node_config -->|"feeds"| node_release_cfg
node_templates -->|"shapes"| node_compile
node_validate -->|"gates"| node_compile
node_compile -->|"prepares"| node_assets

click node_main "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/main.py"
click node_cmd_new "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/new.py"
click node_cmd_list "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/list.py"
click node_cmd_open "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/open.py"
click node_cmd_release "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/release.py"
click node_cmd_publish "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/publish.py"
click node_cmd_tui "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/tui.py"
click node_templates "https://github.com/fpittelkow/mono-pub/tree/main/src/mono_pub/templates"
click node_config "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/config.py"
click node_validate "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/validate.py"
click node_release_cfg "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/release_config.py"
click node_compile "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/compile.py"
click node_assets "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/assets.py"
click node_release_proc "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/release.py"
click node_publish_proc "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/publish.py"
click node_tui_app "https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/tui_interface/app.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_main,node_cmd_new,node_cmd_list,node_cmd_open,node_cmd_release,node_cmd_publish,node_cmd_tui toneBlue
class node_templates,node_config,node_validate,node_release_cfg,node_compile,node_assets,node_release_proc,node_publish_proc toneAmber
class node_tui_app toneMint
class node_git,node_jekyll toneRose
```

## Components

### CLI layer

Command entrypoints and user-facing actions.

- [Main](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/main.py): entrypoint · CLI entrypoint and subcommand dispatch. · `src/mono_pub/main.py`
- [New](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/new.py): command · Creates new draft content. · `src/mono_pub/commands/new.py`
- [List](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/list.py): command · Lists content by status. · `src/mono_pub/commands/list.py`
- [Open](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/open.py): command · Opens draft folders in the editor. · `src/mono_pub/commands/open.py`
- [Release](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/release.py): command · Runs the release workflow. · `src/mono_pub/commands/release.py`
- [Publish](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/publish.py): command · Pushes prepared content downstream. · `src/mono_pub/commands/publish.py`
- [TUI command](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/commands/tui.py): command · Launches the terminal interface. · `src/mono_pub/commands/tui.py`

### Core pipeline

Content lifecycle and release processing.

- [Templates](https://github.com/fpittelkow/mono-pub/tree/main/src/mono_pub/templates): jinja2 drafts · Markdown templates for post, project, and music drafts. · `src/mono_pub/templates`
- [Config](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/config.py): runtime config · Centralized configuration loaded by commands and processing. · `src/mono_pub/config.py`
- [Validate](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/validate.py): processing · Checks draft readiness and metadata correctness. · `src/mono_pub/process/validate.py`
- [Release config](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/release_config.py): processing · Derives or loads release-time settings. · `src/mono_pub/process/release_config.py`
- [Compile](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/compile.py): processing · Rewrites content into deployable form. · `src/mono_pub/process/compile.py`
- [Assets](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/assets.py): processing · Stages or copies associated assets. · `src/mono_pub/process/assets.py`
- [Release flow](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/release.py): orchestration · Coordinates verification, rewriting, and asset preparation. · `src/mono_pub/process/release.py`
- [Publish flow](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/process/publish.py): deployment · Performs publication-oriented actions. · `src/mono_pub/process/publish.py`

### Alternate UI

Optional terminal interface over the same core.

- [TUI app](https://github.com/fpittelkow/mono-pub/blob/main/src/mono_pub/tui_interface/app.py): terminal UI · Optional interactive interface. · `src/mono_pub/tui_interface/app.py`

### External systems

Downstream deployment and site runtime.

- **Git**: deployment target · Transport for adding, committing, and pushing output.
- **Jekyll**: site target · Downstream static site format and local preview target.

## Connections

- Main → New: dispatches · Routes subcommands to content creation.
- Main → List: dispatches · Routes subcommands to listing.
- Main → Open: dispatches · Routes subcommands to editor opening.
- Main → Release: dispatches · Routes subcommands to release workflow.
- Main → Publish: dispatches · Routes subcommands to publishing.
- Main → TUI command: dispatches · Routes subcommands to TUI launch.
- New → Templates: renders · Creates drafts from content templates.
- New → Config: uses · Resolves content locations and editor/runtime settings.
- List → Config: uses · Reads configured content sources.
- Open → Config: uses · Finds draft folders and editor configuration.
- Release → Release flow: invokes · Starts release preparation.
- Publish → Publish flow: invokes · Starts publication workflow.
- TUI command → TUI app: launches · Opens the interactive terminal UI.
- TUI app → Config: uses · Shares the same runtime configuration.
- TUI app → Release flow: drives · Can trigger release operations interactively.
- TUI app → Publish flow: drives · Can trigger publishing interactively.
- Release flow → Validate: checks · Verifies readiness before transformation.
- Release flow → Release config: loads · Derives release-specific settings.
- Release flow → Compile: rewrites · Converts content into deployable form.
- Release flow → Assets: stages · Collects and copies assets for release.
- Release flow → Publish flow: hands off · Passes prepared output toward publication.
- Publish flow → Git: pushes via · Uses git as the deployment transport.
- Publish flow → Jekyll: targets · Produces Jekyll-ready output and can dry-run locally.
- Config → Release config: feeds · Provides environment-driven release settings.
- Templates → Compile: shapes · Defines the initial document structure that later processing preserves or rewrites.
- Validate → Compile: gates · Only validated content proceeds to compilation.
- Compile → Assets: prepares · Compilation leads into asset staging.
