Skip to main content

Architecture Overview

src/
├── wp-seo-ops # Main entry point (Bash)
├── lib/
│ ├── color-lib.sh # Terminal colors and output formatting
│ ├── config-lib.sh # Config file read/write
│ ├── seo-adapter.sh # SEO plugin detection and meta key mapping
│ └── wp-adapter.sh # WP-CLI wrapper functions
└── commands/
├── config/config.sh # config subcommands
├── meta/meta.sh # meta subcommands (get, list, set, export, import, delete)
├── meta/bulk.sh # meta bulk subcommand
├── inventory/inventory.sh # inventory command
├── audit/audit.sh # audit subcommands (meta-check, full, links, images, speed, broken, duplicate-content, report)
├── redirect/
│ ├── redirect.sh # redirect subcommand router
│ ├── list.sh # redirect list
│ ├── add.sh # redirect add
│ ├── delete.sh # redirect delete
│ ├── import.sh # redirect import
│ └── export.sh # redirect export
├── content/
│ ├── content.sh # content subcommand router
│ ├── generate.sh # content generate
│ └── pipeline-import.sh # content pipeline import
├── analyze/
│ ├── analyze.sh # analyze subcommand router
│ ├── keyword.sh # analyze keyword
│ └── gsc-adapter.sh # analyze gsc-adapter
└── instant-indexing/
├── instant-indexing.sh # instant-indexing subcommand router
└── submit.sh # instant-indexing submit

python/wp_seo_ops/
├── __init__.py
├── audit_engine.py # Audit scoring and report formatting
├── link_analyzer.py # Internal/external link analysis
├── image_analyzer.py # Image alt text analysis
├── speed_analyzer.py # Google PageSpeed API client
├── duplicate_analyzer.py # Duplicate content detection (TF-IDF)
├── report_generator.py # Audit report generation (md/json/csv/html)
├── keyword_analyzer.py # SpyFu keyword analysis
├── content_generator.py # AI content generation
├── gsc_adapter.py # Google Search Console API client
├── indexnow_submitter.py # IndexNow protocol client
└── adapters/
├── __init__.py
├── spyfu.py # SpyFu API adapter
├── gsc.py # GSC API adapter class
└── indexnow.py # IndexNow API adapter

tests/
├── bash/ # Bats test files
└── python/ # Python unit tests

Layer Architecture

Bash Layer (CLI Routing)

The entry point src/wp-seo-ops parses the first argument as the command name, sources the corresponding command file, and dispatches to the subcommand function. Each command file follows the same pattern:

<command>_help() — shows usage
<command>_main() — parses subcommand, dispatches
<subcommand>_fn() — implements the subcommand

Python Layer (Analysis Engine)

Python modules handle complex analysis that is impractical in Bash:

  • Web API clients (PageSpeed, GSC, IndexNow, SpyFu)
  • Text analysis (TF-IDF, content similarity)
  • Report formatting (markdown, HTML)
  • Scoring and recommendation engines

WP-CLI Adapter

All WordPress interaction goes through wp-adapter.sh which wraps wp CLI commands. This provides:

  • Path validation
  • Plugin detection
  • Post querying
  • Meta CRUD operations

SEO Plugin Detection

The plugin detection uses WP-CLI to list active plugins and match against known plugin slugs:

yoast → wordpress-seo
seopress → wp-seopress
rankmath → seo-by-rank-math
aioseo → all-in-one-seo-pack
slimseo → slim-seo
none → fallback

Meta keys are mapped per plugin via seo-adapter.sh.