itzmekhokan/sitecargo

SiteCargo β€” selectively promote WordPress FSE structure and content (patterns, templates, parts, global styles, navigation) between environments, without a full database migration.

Maintainers

Package info

github.com/itzmekhokan/sitecargo

Type:wordpress-plugin

pkg:composer/itzmekhokan/sitecargo

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-06-01 14:56 UTC

This package is auto-updated.

Last update: 2026-06-01 14:59:46 UTC


README

Selectively promote WordPress FSE structure and content between environments β€” without a full database migration.

Packagist Version PHP WordPress License Website

πŸ”— Website & docs: https://itzmekhokan.github.io/sitecargo/

WordPress full-site-editing structure (patterns, template parts, templates, global styles, navigation) lives in the database. Moving some of it from staging to production today means a full DB sync (destructive to orders/users/form entries) or manual copy-paste. SiteCargo packs exactly what you choose into a portable, git-trackable bundle and applies it elsewhere with stable identity, ID remapping, and media sideloading β€” never touching the data you didn't select.

Status: 0.1.1 — early release. Patterns, templates, template parts, global styles, and navigation, with a full export→import loop. Not yet production-hardened.

How it works

your-bundle/
β”œβ”€ manifest.json              # schema version, source site, entity index + checksums
β”œβ”€ entities/
β”‚   └─ wp_block/<slug>.json    # one file per exported entity (verbatim content + references)
└─ media/
    β”œβ”€ <sha256>.<ext>          # content-addressed media blobs (deduped)
    └─ media.json              # id β†’ hash β†’ url map for sideloading on import

Two ideas make it safe and repeatable:

  • Stable identity. Standalone posts (patterns, navigation) are stamped with a portable UUID (_sitecargo_guid) so re-applying updates the same entity instead of duplicating it. Templates, parts, and global styles key on theme + slug instead, since those are file-or-DB by nature.
  • Reference rewriting. Numeric IDs baked into block markup (image IDs, reusable-block refs, navigation refs, gallery ID lists) are extracted on export with their position in the block tree, then re-resolved to local IDs on import.

Installation

SiteCargo is a WP-CLI tool β€” WP-CLI is required to use it.

Via Composer (for Composer-managed sites such as Bedrock):

composer require itzmekhokan/sitecargo

The wordpress-plugin package type installs it into wp-content/plugins/sitecargo. Then activate it:

wp plugin activate sitecargo

From the WordPress.org Plugin Directory (once approved): search for "SiteCargo" under Plugins β†’ Add New, or wp plugin install sitecargo --activate.

Manually: download a release, unzip it into wp-content/plugins/, and activate.

Usage

# On the source: export structure into a bundle.
wp sitecargo export --all --dir=./my-bundle
wp sitecargo export --patterns --templates --parts --global-styles --navigation --dir=./my-bundle
wp sitecargo export --patterns --slug=hero,call-to-action --dir=./my-bundle

# On the target: preview what an import would change (no writes).
wp sitecargo diff --dir=./my-bundle

# On the target: apply the bundle (remaps IDs, sideloads media).
wp sitecargo apply --dir=./my-bundle --yes

Supported entity types: patterns (wp_block), templates (wp_template), template parts (wp_template_part), global styles (wp_global_styles), and navigation (wp_navigation). Templates/parts must be customized in the database to be exported β€” unedited theme-file templates ship with the theme already.

Roadmap

Phase Scope Status
1 wp_block patterns β€” export, media collection, reference extraction βœ… done
2a Import side β€” diff (dry-run) + apply with ID remapping & media sideloading βœ… done
2b Templates, template parts, global styles (theme+slug identity) βœ… done
3a Navigation menus (wp_navigation) + wp:navigation ref remapping βœ… done
3b Selected posts/CPTs by slug (+ navigation-link ID remapping) planned
4 Admin UI (checkbox tree + visual diff) planned
5 Direct site→site push over REST (application passwords) planned

Development

composer install
composer test          # PHPUnit β€” needs the WP test library (see tests/bootstrap.php)

Tests use the WordPress PHPUnit harness. Set WP_TESTS_DIR, or run from a workspace where wordpress-develop is a sibling directory (the bootstrap will find it automatically).

Contributing

Issues and pull requests are welcome:

Please run the test suite (composer test) and ensure it passes before opening a PR.

License

GPL-2.0-or-later. See LICENSE.