Add sync-local commands for local-server development#38
Open
jerico wants to merge 7 commits into
Open
Conversation
Adds `altis-cli stack sync database <app>`, `stack sync uploads <app>`, and `stack sync all <app>` to pull remote Vantage backups into a local altis/local-server environment. Key features: - Choose between an existing backup or triggering a new remote backup - SSE stream for live backup progress with 10s poll fallback to handle fast backups that complete before the stream connects - Search-replace on the SQL stream via @automattic/vip-search-replace before import, configured under extra.altis.cloud.search-replace in composer.json (default key: local-server) - Uploads extracted directly to content/uploads/ then synced into the local-server S3 bucket via composer server s3 import-uploads - Cache flush and optional wp altis post-sync hook after DB import; post-sync is silently skipped if the command is not registered - --dry-run-search-replace, --skip-search-replace, --skip-post-sync, --resume, --keep-archive, --yes, --debug, --json options Also fixes lib/stream.js which was calling got.default.stream() — got.default is undefined in got v14 ESM, so SSE streaming was silently broken. Fixed to got.stream(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--latest uses the most recent existing backup without prompting and implies --yes, making it suitable for scripted or repeated syncs. Errors if no backup exists for the app. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
I'd vote for more like "import-local" or "sync-local" as most things are by default in cloud, so sync could indicate that it is between cloud environments |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace --tables with --table (repeatable array, comma-separated)
- Add --site-id to database and all: resolves multisite site IDs to
table names via the database-tables endpoint before backup
- Add --site-id to uploads: maps to sites/{id}/ uploads path prefix
- Error early on multiple --site-id for uploads and all commands
- Warn when --site-id is passed with --latest or --resume
- Add app sites command to list multisite site ID → domain mapping
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app sync-local commands for local-server development
app sync-local commands for local-server developmentsync-local commands for local-server development
joehoyle
reviewed
May 4, 2026
Site ID 1 uses the base table prefix (wp_posts etc.) and stores uploads at the root, not sites/1/. Syncing all data when site ID 1 is given and noting this to the user. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
joehoyle
reviewed
May 4, 2026
Only applies to uploads where sites/1/ doesn't exist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
@jerico if I run
Does that make sense? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app sync-local database <app>,app sync-local uploads <app>, andapp sync-local all <app>to pull remote Altis Dashboard backups into a localaltis/local-serverenvironment@automattic/vip-search-replacebefore import, configured underextra.altis.cloud.search-replace.<key>incomposer.json(default key:local-server)--latestskips the prompt and auto-confirmswp altis post-sync) is silently skipped if the command isn't registeredPartial sync — sync only the data you need:
--table(repeatable/comma-separated) filters the backup to specific tables--site-idondatabaseresolves multisite site IDs to their table names via thedatabase-tablesendpoint, then passes those astablesto the backup--site-idonuploadsmaps tosites/{id}/prefix--site-idonallapplies to both DB tables and uploads path (single value only — errors early if multiple given)app sites <app>lists multisite site ID → domain mapping to help pick the right IDOptions
--tabledatabase,all--site-iddatabase/all: resolves to table names. Foruploads/all: maps tosites/{id}/prefix.--latest--yes)--search-replace-keydatabase,allextra.altis.cloud.search-replacein composer.json (default:local-server)--replace from=todatabase,all--skip-search-replacedatabase,all--skip-post-syncdatabase,allwp altis post-sync--dry-run-search-replacedatabase,all--resume <logId>--uploads-pathuploads,all--keep-archive--yes--debugExample usage
Test plan
app sync-local database <app>— new backup, stream progress, import with search-replace, cache flush, post-syncapp sync-local database <app> --latest— no prompt, no confirm, uses latest backupapp sync-local uploads <app>app sync-local all <app>--tablefilters backup to specific tables--site-idon database resolves to correct table names--site-idon uploads maps tosites/{id}/prefix--site-idonuploadsorallerrors before backup starts--dry-run-search-replaceexits before validationapp sites <app>lists site ID → domain mapping🤖 Generated with Claude Code