Skip to content

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

Merged
naman-contentstack merged 9 commits intofeat/AM2.0from
feat/DX-4444
Mar 5, 2026
Merged

feat: add asset management package for AM2.0 support#7
naman-contentstack merged 9 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 requested a review from a team as a code owner March 2, 2026 12:22
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 1 ✅ Passed
🟠 High Severity 0 0 1 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@naman-contentstack naman-contentstack merged commit 8410ace into feat/AM2.0 Mar 5, 2026
6 of 7 checks passed
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.

3 participants