Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AldinDuraki opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@AldinDuraki
Copy link

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:

  • Fetch the specified entry from the source space and environment.
  • Traverse and fetch all linked entries and assets recursively.
  • Export the collected data to a temporary file.
  • Import the collected data into the target space and environment.
  • Remap locales as specified by the user.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant