sb-mig
Reference

Utility Commands

Discover, migrations, init, and debug command reference; copy has its own page.

Utility commands

This page covers commands that do not fit the main sync/migrate/backup groups.

copy

The copy family — copy space, copy stories, copy assets, copy relink and copy manifests — has its own page: copy. The end-to-end workflow is in Copy a space.

discover

Components

sb-mig discover components --all
sb-mig discover components --all --write
sb-mig discover components --all --write --file all-components
FlagTypeEffect
--allbooleanDiscover all local and external component schema files.
--writebooleanWrite discovered component names to a local file.
--filestringOutput file name when --write is passed.

Without --write, the command prints discovered component metadata. With --write, it creates or overwrites the component list file.

Migrations

sb-mig discover migrations --all

Prints discovered migration config filenames. This command is read-only.

migrations recognize

sb-mig migrations recognize --from 3.4.0
sb-mig migrations recognize --from 3.4.0 --to 4.0.0

This command is specific to Backpack upgrade flows. It compares a previous Backpack version with a target version and prints recommended migrate content and migrate presets commands.

FlagTypeEffect
--fromstringPrevious package version. Required.
--tostringTarget package version. Optional. Falls back to installed @ef-global/backpack dependency version from package.json.

The command reads applied-backpack-migrations.json when present and reads package.json when --to is omitted. It does not call Storyblok and does not write files.

init project

sb-mig init project \
  --spaceId 12345 \
  --oauthToken xxx \
  --region eu

sb-mig init project \
  --spaceId 12345 \
  --oauthToken xxx \
  --region us \
  --gtmToken GTM-XXXX

init project creates a local .env and updates the Storyblok space preview domain.

FlagTypeEffect
--spaceIdstringStoryblok space ID. Required.
--oauthTokenstringManagement API OAuth token. Required.
--regioneu, us, or cnStoryblok region. Required.
--gtmTokenstringOptional Google Tag Manager token. Defaults to put-your-gtm-token-here.

The generated .env includes region URLs, access token, OAuth token, preview secret, space ID, translation strategy, and GTM ID. The preview domain is set to https://localhost:3000/api/preview/preview?secret=<secret>&slug=.

debug

sb-mig debug

Prints resolved Storyblok config, sb-mig version, dependency versions, the consumer @ef-global/backpack version when available, and whether the consumer package is ESM or CommonJS. It reads local config and package metadata only.

On this page