# geekjourneyx/md2wechat-skill architecture

> Architecture diagram of the GitHub repository geekjourneyx/md2wechat-skill, 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/geekjourneyx/md2wechat-skill
- Repository: https://github.com/geekjourneyx/md2wechat-skill

## Overview

md2wechat is an agent-oriented CLI for creating, checking, formatting, and preparing WeChat Official Account content. Its main article workflow is Markdown input → structured readiness inspection → HTML conversion and preview → optional image upload and draft creation in WeChat. Separate capabilities cover AI-assisted writing and image generation, layout discovery and validation, and preparation of cross-platform drafts for a host agent to complete. The README documents these branches; sampled source confirms key preview, publishing, draft, and provider behavior, but not every command’s internal wiring.

Main entry points: [`cmd/md2wechat/preview.go`](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/preview.go) (Preview command), [`internal/converter/converter.go`](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/converter/converter.go) (Markdown converter), [`internal/publish/service.go`](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/publish/service.go) (Publish pipeline), [`internal/inspect/inspect.go`](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/inspect/inspect.go) (Readiness inspection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_article["Article workflow"]
  node_inspect["Readiness inspection<br/>[inspect.go]"]
  node_inspectcmd["Inspect command<br/>[inspect.go]"]
  node_previewcmd["Preview command<br/>[preview.go]"]
  node_convertcmd["Convert command<br/>[convert.go]"]
  node_converter["Markdown converter<br/>[converter.go]"]
  node_themes["Theme catalog<br/>[theme.go]"]
  node_layout["Layout catalog<br/>[loader.go]"]
end

subgraph group_publishing["WeChat publishing"]
  node_publish["Publish pipeline<br/>[service.go]"]
  node_wechatdraft["WeChat draft service<br/>[service.go]"]
  node_wechat["WeChat API service<br/>[service.go]"]
end

subgraph group_creation["Content creation"]
  node_write["Article writing<br/>[generator.go]"]
  node_humanize["Article humanizer<br/>[humanizer.go]"]
  node_title["Title suggestions<br/>[suggest.go]"]
  node_imagecmd["Image generation commands<br/>[generate_image.go]"]
  node_image["Image provider layer<br/>[provider.go]"]
end

subgraph group_agent["Agent capabilities"]
  node_discovery["Capability discovery<br/>[discovery.go]"]
  node_doctor["Configuration check<br/>[doctor.go]"]
end

subgraph group_platform["Platform preparation"]
  node_sync["Cross-platform preparation<br/>[prepare.go]"]
end

node_user(("Author / Agent"))
node_markdown["Markdown article"]
node_previewfile["Preview HTML"]
node_wechatapi{{"WeChat Official Account"}}
node_imageproviders{{"Image providers"}}
node_host(("Host browser agent"))

node_user -->|"requests check"| node_inspectcmd
node_markdown -->|"provides article"| node_inspectcmd
node_inspectcmd -->|"inspects input"| node_inspect
node_inspect -->|"parses metadata"| node_converter
node_user -->|"requests preview"| node_previewcmd
node_markdown -->|"provides article"| node_previewcmd
node_previewcmd -->|"checks readiness"| node_inspect
node_previewcmd -->|"converts Markdown"| node_converter
node_converter -->|"uses theme"| node_themes
node_previewcmd -->|"writes HTML"| node_previewfile
node_user -->|"requests conversion"| node_convertcmd
node_markdown -->|"provides article"| node_convertcmd
node_convertcmd -->|"runs conversion"| node_publish
node_publish -->|"converts content"| node_converter
node_publish -->|"creates draft"| node_wechatdraft
node_wechatdraft -->|"submits articles"| node_wechat
node_wechat -->|"calls API"| node_wechatapi
node_user -->|"requests image"| node_imagecmd
node_imagecmd -->|"generates image"| node_image
node_image -->|"dispatches generation"| node_imageproviders
node_user -->|"requests article"| node_write
node_user -->|"requests rewrite"| node_humanize
node_user -->|"requests titles"| node_title
node_user -->|"browses or validates"| node_layout
node_layout -->|"defines layout syntax"| node_converter
node_user -->|"requests capabilities"| node_discovery
node_user -->|"requests diagnosis"| node_doctor
node_user -->|"prepares draft"| node_sync
node_sync -->|"returns instructions"| node_host

click node_inspect "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/inspect/inspect.go"
click node_inspectcmd "https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/inspect.go"
click node_previewcmd "https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/preview.go"
click node_convertcmd "https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/convert.go"
click node_converter "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/converter/converter.go"
click node_themes "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/converter/theme.go"
click node_layout "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/layoutcatalog/loader.go"
click node_publish "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/publish/service.go"
click node_wechatdraft "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/draft/service.go"
click node_wechat "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/wechat/service.go"
click node_write "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/writer/generator.go"
click node_humanize "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/humanizer/humanizer.go"
click node_title "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/title/suggest.go"
click node_imagecmd "https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/generate_image.go"
click node_image "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/image/provider.go"
click node_imageproviders "https://github.com/geekjourneyx/md2wechat-skill/tree/main/internal/image"
click node_discovery "https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/discovery.go"
click node_doctor "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/doctor/doctor.go"
click node_sync "https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/syncprepare/prepare.go"

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_inspect,node_inspectcmd,node_previewcmd,node_convertcmd,node_converter,node_themes,node_layout,node_previewfile,node_host toneBlue
class node_publish,node_wechatdraft,node_wechat toneAmber
class node_write,node_humanize,node_title,node_imagecmd,node_image toneMint
class node_discovery,node_doctor toneRose
class node_sync,node_user,node_markdown,node_wechatapi,node_imageproviders toneIndigo
```

## Components

### Article workflow

- [Readiness inspection](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/inspect/inspect.go): `internal/inspect/inspect.go`
- [Inspect command](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/inspect.go): `cmd/md2wechat/inspect.go`
- [Preview command](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/preview.go): `cmd/md2wechat/preview.go`
- [Convert command](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/convert.go): `cmd/md2wechat/convert.go`
- [Markdown converter](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/converter/converter.go): `internal/converter/converter.go`
- [Theme catalog](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/converter/theme.go): `internal/converter/theme.go`
- [Layout catalog](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/layoutcatalog/loader.go): `internal/layoutcatalog/loader.go`

### WeChat publishing

- [Publish pipeline](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/publish/service.go): `internal/publish/service.go`
- [WeChat draft service](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/draft/service.go): `internal/draft/service.go`
- [WeChat API service](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/wechat/service.go): `internal/wechat/service.go`

### Content creation

- [Article writing](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/writer/generator.go): `internal/writer/generator.go`
- [Article humanizer](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/humanizer/humanizer.go): `internal/humanizer/humanizer.go`
- [Title suggestions](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/title/suggest.go): `internal/title/suggest.go`
- [Image generation commands](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/generate_image.go): `cmd/md2wechat/generate_image.go`
- [Image provider layer](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/image/provider.go): `internal/image/provider.go`

### Agent capabilities

- [Capability discovery](https://github.com/geekjourneyx/md2wechat-skill/blob/main/cmd/md2wechat/discovery.go): `cmd/md2wechat/discovery.go`
- [Configuration check](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/doctor/doctor.go): `internal/doctor/doctor.go`

### Platform preparation

- [Cross-platform preparation](https://github.com/geekjourneyx/md2wechat-skill/blob/main/internal/syncprepare/prepare.go): `internal/syncprepare/prepare.go`

### Other components

- **Author / Agent**
- **Markdown article**
- **Preview HTML**
- **WeChat Official Account**
- [Image providers](https://github.com/geekjourneyx/md2wechat-skill/tree/main/internal/image): `internal/image`
- **Host browser agent**

## Connections

- Author / Agent → Inspect command: requests check
- Markdown article → Inspect command: provides article
- Inspect command → Readiness inspection: inspects input
- Readiness inspection → Markdown converter: parses metadata
- Author / Agent → Preview command: requests preview
- Markdown article → Preview command: provides article
- Preview command → Readiness inspection: checks readiness
- Preview command → Markdown converter: converts Markdown
- Markdown converter → Theme catalog: uses theme
- Preview command → Preview HTML: writes HTML
- Author / Agent → Convert command: requests conversion
- Markdown article → Convert command: provides article
- Convert command → Publish pipeline: runs conversion
- Publish pipeline → Markdown converter: converts content
- Publish pipeline → WeChat draft service: creates draft
- WeChat draft service → WeChat API service: submits articles
- WeChat API service → WeChat Official Account: calls API
- Author / Agent → Image generation commands: requests image
- Image generation commands → Image provider layer: generates image
- Image provider layer → Image providers: dispatches generation
- Author / Agent → Article writing: requests article
- Author / Agent → Article humanizer: requests rewrite
- Author / Agent → Title suggestions: requests titles
- Author / Agent → Layout catalog: browses or validates
- Layout catalog → Markdown converter: defines layout syntax
- Author / Agent → Capability discovery: requests capabilities
- Author / Agent → Configuration check: requests diagnosis
- Author / Agent → Cross-platform preparation: prepares draft
- Cross-platform preparation → Host browser agent: returns instructions
