Skip to content

[Feature Request] - Branch-Aware Asset Compare & Targeted Asset Export/Import #2661

Description

@cgondrovic-servpro

Summary

Add support for comparing assets between branches and exporting/importing only the assets that are missing or different. This would provide an asset workflow similar to the existing content compare/merge functionality.

Problem

The Contentstack CLI currently provides excellent support for comparing and merging content between branches, but there is no equivalent workflow for assets.

Today, if assets are missing from a target branch, the only option is to:

  1. Export all assets from the source branch.
  2. Import the entire asset export into the target branch.

For stacks with thousands of assets, this process is inefficient because:

  • Exporting every asset can take a significant amount of time.
  • Importing every asset is unnecessary when only a few assets are actually missing.
  • CI/CD pipelines become slower due to the extra processing.
  • Developers must manually determine which assets need to be synchronized.

This results in an all-or-nothing workflow that doesn't scale well for larger Contentstack implementations.

Proposed Solution

Introduce branch-aware asset comparison and targeted asset export/import functionality.

1. Compare Assets Between Branches

Provide a command similar to the existing content compare functionality.

csdx cm:branches:assets:compare \
  --source development \
  --target release

Example output:

Comparing assets...

✓ 8,421 assets exist in source
✓ 8,397 assets exist in target

Missing in target:
- hero-homepage.jpg
- service-icons.zip
- emergency-water.webp
- marketing/logo-dark.svg

Modified:
- brochure.pdf

Summary:
Missing: 24
Modified: 1

2. Export Only Missing or Modified Assets

Allow exporting only the assets identified during the comparison.

Example:

csdx cm:assets:export \
  --branch development \
  --compare release \
  --missing-only \
  --output assets.zip

or

csdx cm:branches:assets:export-diff \
  --source development \
  --target release \
  --output assets.zip

This would generate an export package containing only the assets that need to be synchronized.

3. Import into the Target Branch

Import only those assets into the destination branch.

csdx cm:assets:import \
  --branch release \
  --file assets.zip

Since the export contains only the required assets, the import is significantly faster and avoids unnecessary processing.

Benefits

  • Eliminates exporting thousands of unchanged assets.
  • Greatly reduces import times.
  • Makes asset synchronization consistent with the existing content compare/merge workflow.
  • Improves developer productivity.
  • Better supports CI/CD and automated deployment pipelines.
  • Reduces unnecessary API calls and processing overhead.
  • Scales much better for enterprise stacks with large asset libraries.

Example Workflow

Source Branch (development)
           │
           │
           ▼
Compare Assets
           │
           ▼
Identify Missing / Modified Assets
           │
           ▼
Export Only Required Assets
           │
           ▼
assets.zip
           │
           ▼
Import into Target Branch (release)

Optional Enhancements

Additional flags that could make this feature even more powerful:

  • --missing-only
  • --modified-only
  • --deleted
  • --dry-run
  • --json output for CI/CD automation
  • --overwrite
  • --include-folders
  • --include-references
  • Interactive mode to review assets before exporting

Why This Matters

The existing branch compare and merge functionality for content is one of the strongest features of the CLI. Bringing the same experience to assets would create a much more complete branch management workflow.

Many organizations have asset libraries containing tens of thousands of files, while only a handful of assets change between releases. Requiring a full export and import for every synchronization is unnecessarily time-consuming and resource-intensive.

A branch-aware asset comparison with targeted export/import would significantly improve the developer experience, reduce deployment times, and make Contentstack CLI more efficient for large-scale implementations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions