Skip to content

feat: add asset management package for AM2.0 support#2437

Open
naman-contentstack wants to merge 3 commits intofeat/AM2.0from
feat/DX-4444
Open

feat: add asset management package for AM2.0 support#2437
naman-contentstack wants to merge 3 commits intofeat/AM2.0from
feat/DX-4444

Conversation

@naman-contentstack
Copy link
Contributor

Asset Management 2.0 – Export Support

Summary

  • Add a new @contentstack/cli-asset-management package that handles exporting space-based asset data when AM 2.0 is enabled for a stack
  • The assets export module now checks for linkedWorkspaces (fetched from CMA branch settings am_v2.linked_workspaces during stack export) to decide between the legacy asset flow and the new spaces-based flow
  • When AM 2.0 is active, exports org-level fields and asset types (shared), then per-space metadata, folder structure, asset metadata, and downloaded asset files into a spaces/ directory structure
  • Legacy export behavior is fully preserved when no linked workspaces are present

What changed

New package: @contentstack/cli-asset-management

  • ExportSpaces orchestrator with per-space export classes (ExportWorkspace, ExportAssets, ExportFields, ExportAssetTypes)
  • AssetManagementAdapter HTTP client for the AM API (/api/spaces, /api/fields, /api/asset_types)
  • Base class with progress tracking and chunked JSON write support

Modified: contentstack-export

  • assets.ts: Branches on linkedWorkspaces.length > 0 to delegate to ExportSpaces
  • stack.ts: Fetches linked workspaces from branch settings and sets them on exportConfig
  • New get-linked-workspaces.ts utility
  • Added linkedWorkspaces to ExportConfig and assetManagementUrl to Region type
  • Updated progress strategy registry for AM 2.0 process names

Export structure (AM 2.0)

{branch}/spaces/
  ├── fields/fields.json            (shared, org-level)
  ├── asset_types/asset-types.json  (shared, org-level)
  └── {space_uid}/
      ├── metadata.json
      └── assets/
          ├── folders.json
          ├── assets.json
          └── files/{asset_uid}/{filename}

@naman-contentstack naman-contentstack self-assigned this Feb 27, 2026
@naman-contentstack naman-contentstack requested a review from a team as a code owner February 27, 2026 10:03
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

Successfully merging this pull request may close these issues.

1 participant