{"library":"storyblok","title":"Storyblok CLI","type":"library","description":"The Storyblok CLI (Command Line Interface) is a powerful development tool designed to enhance the developer experience for projects integrating with the Storyblok Headless CMS. It provides a robust set of features for managing Storyblok spaces directly from the terminal, including generating TypeScript type definitions for components to ensure type safety in frontend applications. The current stable version is 4.16.9, released very recently, indicating an active development and release cadence, often as part of a monorepo that includes various Storyblok SDKs. Key differentiators include its comprehensive component management capabilities (pulling, pushing schemas, groups, presets, tags), a flexible migration system for content updates, secure authentication across regions, and advanced filtering options. It focuses on improving workflow efficiency with features like organized file structures, customizable paths, and a dry run mode for migrations.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install storyblok"],"cli":{"name":"storyblok","version":null}},"imports":["storyblok <command> [options]","npx storyblok <command> [options]","import { MyComponentType } from './.storyblok/components'"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://www.storyblok.com","github":"https://github.com/storyblok/monoblok","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/storyblok","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"npm install -g storyblok\nstoryblok login\n# Follow the prompts to enter your personal access token\n\n# Pull all component schemas from your space\nstoryblok pull-components --space=<YOUR_SPACE_ID> --path=./src/storyblok/components\n\n# Generate TypeScript types for your components\nstoryblok generate-types --path=./src/storyblok/types.d.ts\n\n# Run a simple migration (example: rename a field)\n# First, create a migration file, e.g., 'storyblok/migrations/001-rename-field.js'\n// storyblok/migrations/001-rename-field.js\nmodule.exports = { \n  up: async (api) => {\n    console.log('Running migration: Rename old_field to new_field');\n    // Example: Find a component and rename a field\n    // await api.put('spaces/YOUR_SPACE_ID/components/COMPONENT_ID', { component: { schema: { new_field: { type: 'text' } } } });\n  },\n  down: async (api) => {},\n};\nstoryblok migrate --space=<YOUR_SPACE_ID> --path=./storyblok/migrations --dry-run\nstoryblok migrate --space=<YOUR_SPACE_ID> --path=./storyblok/migrations","lang":"javascript","description":"This quickstart demonstrates how to install the Storyblok CLI globally, log in, pull component schemas, generate TypeScript types, and run a basic content migration with a dry run.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}