contentful / contentful-cli

The official Contentful command line interface. Use Contentful features straight from the command line!
https://www.contentful.com/developers/docs/tutorials/cli/
MIT License
329 stars 62 forks source link

Feature Request: Add Recursive Copy Functionality to Contentful CLI #2683

Open AldinDuraki opened 1 month ago

AldinDuraki commented 1 month ago

Description I would like to request the addition of a recursive copy feature to the Contentful CLI. This feature would significantly enhance the CLI's capabilities by allowing users to copy entries and their linked content (entries and assets) across different spaces and environments in a single command.

Use Case Currently, copying content between spaces and environments using the Contentful CLI is a multi-step process, involving exporting the root entry and its assets, traversing and exporting linked entries and assets, and then importing the collected data into the target environment. This process is both time-consuming and prone to errors, especially for complex content structures with deep or circular references. The proposed recursive copy feature would simplify this workflow, making it easier to manage content across different environments and spaces.

Proposed Solution Implement a new command (or extend an existing command) in the Contentful CLI to support recursive copying of entries. The command should:

Example Usage

contentful space recursive-copy --source-space-id $sourceSpaceId \
                                --source-environment-id $sourceEnvId \
                                --target-space-id $targetSpaceId \
                                --target-environment-id $targetEnvId \
                                --entry-id $entryId \
                                --locales-map "en-GB:en" \
                                --management-token $cmaToken

This command would handle the entire process of copying the specified entry and all its linked content to the target environment, remapping locales as necessary.

Benefits Simplified Workflow: Reduces the complexity of copying content between environments. Error Reduction: Minimizes the risk of missing linked entries or assets. Time Savings: Automates a multi-step process, saving time and effort for developers and content managers.

Additional Information I have experimented with the existing CLI commands and found them useful but limited for this specific use case. I have also attempted to script this functionality myself, but having it natively supported in the CLI would be far more efficient and reliable. Thank you for considering this feature request. I believe it would be a valuable addition to the Contentful CLI and greatly improve the developer experience.