# mindfulplugins/template-updater-for-woocommerce architecture

> Architecture diagram of the GitHub repository mindfulplugins/template-updater-for-woocommerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mindfulplugins/template-updater-for-woocommerce
- Repository: https://github.com/mindfulplugins/template-updater-for-woocommerce
- Video tour (about a minute): https://gitdiagram.com/mindfulplugins/template-updater-for-woocommerce/video

## Overview

This is a WordPress/WooCommerce plugin that finds stale theme template overrides and updates them while preserving custom changes. The main workflow is initiated manually in the admin or by schedule: scan overrides, fetch historical and current template versions, merge, then apply updates or flag conflicts; optional Claude resolution can handle merge conflicts. Separate admin housekeeping detects and removes uncustomized overrides, and the plugin provides diffs and email summaries. Edges reflect shown calls or README-documented capabilities; unsampled wiring is omitted.

Main entry points: [`includes/class-wc-tu-runner.php`](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-runner.php) (Update runner), [`includes/class-wc-tu-cleaner.php`](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-cleaner.php) (Cleanup scanner/remover), [`includes/class-wc-tu-scanner.php`](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-scanner.php) (Override scanner), [`includes/class-wc-tu-admin.php`](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-admin.php) (Admin page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operation["Update workflow"]
  node_runner["Update runner"]
  node_scanner["Override scanner"]
  node_fetcher["Version fetcher"]
  node_merger["Three-way merger"]
  node_ai["Conflict resolver"]
  node_storage[("Plugin storage")]
end

subgraph group_housekeeping["Override cleanup"]
  node_cleaner["Cleanup scanner/remover"]
end

subgraph group_delivery["Admin and notifications"]
  node_admin["Admin page"]
  node_cron["Scheduled runs"]
  node_notifier["Email notifier"]
end

subgraph group_integrations["External services"]
  node_git["Git merge-file"]
  node_github["WooCommerce GitHub"]
  node_claude["Claude API"]
end

node_theme[("Theme overrides")]
node_wc_templates[("WooCommerce templates")]
node_email(("Admin email"))
node_schedule(("WordPress schedule"))
node_wp_admin(("WordPress admin"))

node_wp_admin -->|"uses"| node_admin
node_admin -->|"starts run"| node_runner
node_schedule -->|"triggers"| node_cron
node_cron -->|"runs"| node_runner
node_runner -->|"scans"| node_scanner
node_scanner -->|"reads overrides"| node_theme
node_scanner -->|"checks versions"| node_wc_templates
node_runner -->|"fetches versions"| node_fetcher
node_fetcher -->|"requests templates"| node_github
node_runner -->|"merges changes"| node_merger
node_merger -->|"runs merge-file"| node_git
node_runner -->|"updates files"| node_theme
node_runner -->|"stores backups"| node_storage
node_runner -->|"resolves conflicts"| node_ai
node_ai -->|"sends resolution request"| node_claude
node_runner -->|"sends results"| node_notifier
node_notifier -->|"emails summary"| node_email
node_admin -->|"removes overrides"| node_cleaner
node_cleaner -->|"lists overrides"| node_scanner
node_cleaner -->|"checks originals"| node_fetcher
node_cleaner -->|"deletes uncustomized"| node_theme

click node_admin "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-admin.php"
click node_cron "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-cron.php"
click node_runner "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-runner.php"
click node_scanner "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-scanner.php"
click node_fetcher "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-fetcher.php"
click node_merger "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-merger.php"
click node_ai "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-ai-resolver__premium_only.php"
click node_cleaner "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-cleaner.php"
click node_notifier "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-notifier.php"
click node_storage "https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/template-updater-for-woocommerce.php"

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_runner,node_scanner,node_fetcher,node_merger,node_ai,node_storage toneBlue
class node_cleaner,node_theme,node_wc_templates toneAmber
class node_admin,node_cron,node_notifier toneMint
class node_git,node_github,node_claude toneRose
class node_email,node_schedule,node_wp_admin toneIndigo
```

## Components

### Update workflow

- [Update runner](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-runner.php): `includes/class-wc-tu-runner.php`
- [Override scanner](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-scanner.php): `includes/class-wc-tu-scanner.php`
- [Version fetcher](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-fetcher.php): `includes/class-wc-tu-fetcher.php`
- [Three-way merger](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-merger.php): `includes/class-wc-tu-merger.php`
- [Conflict resolver](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-ai-resolver__premium_only.php): `includes/class-wc-tu-ai-resolver__premium_only.php`
- [Plugin storage](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/template-updater-for-woocommerce.php): `template-updater-for-woocommerce.php`

### Override cleanup

- [Cleanup scanner/remover](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-cleaner.php): `includes/class-wc-tu-cleaner.php`

### Admin and notifications

- [Admin page](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-admin.php): `includes/class-wc-tu-admin.php`
- [Scheduled runs](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-cron.php): `includes/class-wc-tu-cron.php`
- [Email notifier](https://github.com/mindfulplugins/template-updater-for-woocommerce/blob/main/includes/class-wc-tu-notifier.php): `includes/class-wc-tu-notifier.php`

### External services

- **Git merge-file**
- **WooCommerce GitHub**
- **Claude API**

### Other components

- **Theme overrides**
- **WooCommerce templates**
- **Admin email**
- **WordPress schedule**
- **WordPress admin**

## Connections

- WordPress admin → Admin page: uses (evidence: `README.md`)
- Admin page → Update runner: starts run (evidence: `README.md`)
- WordPress schedule → Scheduled runs: triggers (evidence: `includes/class-wc-tu-cron.php`)
- Scheduled runs → Update runner: runs (evidence: `includes/class-wc-tu-cron.php`)
- Update runner → Override scanner: scans (evidence: `includes/class-wc-tu-runner.php`)
- Override scanner → Theme overrides: reads overrides (evidence: `includes/class-wc-tu-scanner.php`)
- Override scanner → WooCommerce templates: checks versions (evidence: `includes/class-wc-tu-scanner.php`)
- Update runner → Version fetcher: fetches versions (evidence: `includes/class-wc-tu-runner.php`)
- Version fetcher → WooCommerce GitHub: requests templates (evidence: `includes/class-wc-tu-fetcher.php`)
- Update runner → Three-way merger: merges changes (evidence: `includes/class-wc-tu-runner.php`)
- Three-way merger → Git merge-file: runs merge-file (evidence: `includes/class-wc-tu-merger.php`)
- Update runner → Theme overrides: updates files (evidence: `README.md`)
- Update runner → Plugin storage: stores backups (evidence: `includes/class-wc-tu-runner.php`)
- Update runner → Conflict resolver: resolves conflicts (evidence: `includes/class-wc-tu-runner.php`)
- Conflict resolver → Claude API: sends resolution request (evidence: `includes/class-wc-tu-ai-resolver__premium_only.php`)
- Update runner → Email notifier: sends results (evidence: `includes/class-wc-tu-runner.php`)
- Email notifier → Admin email: emails summary (evidence: `includes/class-wc-tu-notifier.php`)
- Admin page → Cleanup scanner/remover: removes overrides (evidence: `includes/class-wc-tu-admin.php`)
- Cleanup scanner/remover → Override scanner: lists overrides (evidence: `includes/class-wc-tu-cleaner.php`)
- Cleanup scanner/remover → Version fetcher: checks originals (evidence: `includes/class-wc-tu-cleaner.php`)
- Cleanup scanner/remover → Theme overrides: deletes uncustomized (evidence: `includes/class-wc-tu-cleaner.php`)
