Media Sync
Media sync commands let you keep local assets and LeadCMS media library aligned.
By default, media is stored in public/media unless overridden with LEADCMS_MEDIA_DIR.
Pull media
Pull only media files from LeadCMS:
pnpm exec leadcms pull-media
Options:
--reset– Clear local media state and perform a fresh pull.
Targeting a specific remote
Media commands also support --remote / -r in multi‑remote setups:
npx leadcms pull-media -r dev
npx leadcms status-media -r prod
npx leadcms push-media -r dev
Check media status
Inspect local vs remote media differences:
pnpm exec leadcms status-media
Options:
--scope <scopeUid>– Restrict status to one media scope.--delete– Include delete operations.
Push media
Push local media changes to LeadCMS:
pnpm exec leadcms push-media
Options:
--dry-run– Preview operations without uploading/deleting.--force– Skip confirmation prompt.--delete– Delete remote files not present locally.--scope <scopeUid>– Push only one scope.
Scope-based workflows
Use scope filtering to isolate changes in large repositories:
# Preview one scope
npx leadcms status-media --scope blog --delete
# Push one scope safely
npx leadcms push-media --scope blog --dry-run
npx leadcms push-media --scope blog
Best practices
- Prefer scoped pushes for high-volume media libraries.
- Always run a dry-run before using
--delete. - Use
pull-mediaafter CMS-side uploads or reorganizations. - Treat pulled media as generated sync output, not as manually edited source.