How fpittelkow/mono-pub works
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: release.py Release flow · main.py Main · publish.py Publish flow · config.py Config
Components 18
CLI layer
Command entrypoints and user-facing actions.
- Main · CLI entrypoint and subcommand dispatch.
src/mono_pub/main.py - New · Creates new draft content.
src/mono_pub/commands/new.py - List · Lists content by status.
src/mono_pub/commands/list.py - Open · Opens draft folders in the editor.
src/mono_pub/commands/open.py - Release · Runs the release workflow.
src/mono_pub/commands/release.py - Publish · Pushes prepared content downstream.
src/mono_pub/commands/publish.py - TUI command · Launches the terminal interface.
src/mono_pub/commands/tui.py
Core pipeline
Content lifecycle and release processing.
- Templates · Markdown templates for post, project, and music drafts.
src/mono_pub/templates - Config · Centralized configuration loaded by commands and processing.
src/mono_pub/config.py - Validate · Checks draft readiness and metadata correctness.
src/mono_pub/process/validate.py - Release config · Derives or loads release-time settings.
src/mono_pub/process/release_config.py - Compile · Rewrites content into deployable form.
src/mono_pub/process/compile.py - Assets · Stages or copies associated assets.
src/mono_pub/process/assets.py - Release flow · Coordinates verification, rewriting, and asset preparation.
src/mono_pub/process/release.py - Publish flow · Performs publication-oriented actions.
src/mono_pub/process/publish.py
Alternate UI
Optional terminal interface over the same core.
- TUI app · Optional interactive interface.
src/mono_pub/tui_interface/app.py
External systems
Downstream deployment and site runtime.
- Git · Transport for adding, committing, and pushing output.
- Jekyll · Downstream static site format and local preview target.
Connections 27
- 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.