Skip to content

Commit 8853d0e

Browse files
author
naman-contentstack
committed
Merge branch 'v2-dev' into feat/Asset-Scanning
2 parents b189be5 + e32d7d5 commit 8853d0e

111 files changed

Lines changed: 31367 additions & 158 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release-v2-beta-plugins.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ jobs:
135135
package: ./packages/contentstack-branches/package.json
136136
tag: beta
137137

138+
# Apps CLI
139+
- name: Publishing apps-cli (Production)
140+
uses: JS-DevTools/npm-publish@v3
141+
with:
142+
token: ${{ secrets.NPM_TOKEN }}
143+
package: ./packages/contentstack-apps-cli/package.json
144+
tag: latest
145+
138146
# Query Export
139147
- name: Publishing query-export (Beta)
140148
uses: JS-DevTools/npm-publish@v3
@@ -183,6 +191,22 @@ jobs:
183191
package: ./packages/contentstack-migrate-rte/package.json
184192
access: public
185193
tag: beta
194+
# External Migrate
195+
- name: Publishing external-migrate (Production)
196+
uses: JS-DevTools/npm-publish@v3
197+
with:
198+
token: ${{ secrets.NPM_TOKEN }}
199+
package: ./packages/contentstack-external-migrate/package.json
200+
tag: latest
201+
202+
- name: Create Production Release
203+
id: create_release
204+
env:
205+
GITHUB_TOKEN: ${{ secrets.PKG_TOKEN }}
206+
VERSION: ${{ steps.publish-plugins.outputs.version }}
207+
run: |
208+
# Get the previous production release for comparison
209+
PREVIOUS_PROD=$(gh release list --limit 10 | grep -v 'prerelease' | head -1 | cut -f1)
186210
187211
# Bulk Operations
188212
- name: Publishing bulk-operations (Beta)

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fileignoreconfig:
22
- filename: pnpm-lock.yaml
3-
checksum: cdead0797199d22bbc55b9e5b6b86983f28eb760fabe5e1f2d5139c4456a9131
3+
checksum: 7ec6345eb15ed0be001753ee49733421a8a07096dc8a18465cdad1b82562fed8
44
version: '1.0'

packages/contentstack-apps-cli/src/util/common-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function fetchAppInstallations(
120120
flags: FlagInput,
121121
orgUid: string,
122122
options: MarketPlaceOptions
123-
) {
123+
): Promise<any> {
124124
const { marketplaceSdk } = options;
125125
const app: any = flags["app-uid"];
126126
return marketplaceSdk
@@ -218,7 +218,7 @@ function uninstallApp(
218218
orgUid: string,
219219
options: MarketPlaceOptions,
220220
installationUid: string
221-
) {
221+
): Promise<any> {
222222
const { marketplaceSdk } = options;
223223
// const app: any = flags["app-uid"];
224224
return marketplaceSdk
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# @contentstack/cli-asset-management
2+
3+
Asset Management 2.0 API adapter for Contentstack CLI export and import. Used by the export and import plugins when Asset Management (AM 2.0) is enabled. To learn how to export and import content in Contentstack, refer to the [Migration guide](https://www.contentstack.com/docs/developers/cli/migration/).
4+
5+
[![License](https://img.shields.io/npm/l/@contentstack/cli)](https://github.com/contentstack/cli/blob/main/LICENSE)
6+
7+
<!-- toc -->
8+
* [@contentstack/cli-asset-management](#contentstackcli-asset-management)
9+
* [Overview](#overview)
10+
* [Usage](#usage)
11+
* [Exports](#exports)
12+
<!-- tocstop -->
13+
14+
# Overview
15+
16+
This package provides:
17+
18+
- **AssetManagementAdapter** – HTTP client for the Asset Management API (spaces, assets, folders, fields, asset types).
19+
- **exportSpaceStructure** – Exports space metadata and full workspace structure (metadata, folders, assets, fields, asset types) for linked workspaces.
20+
- **Types**`AssetManagementExportOptions`, `LinkedWorkspace`, `IAssetManagementAdapter`, and related types for export/import integration.
21+
22+
# Usage
23+
24+
This package is consumed by the export and import plugins. When using the export CLI with the `--asset-management` flag (or when the host app enables AM 2.0), the export plugin calls `exportSpaceStructure` with linked workspaces and options:
25+
26+
```ts
27+
import { exportSpaceStructure } from '@contentstack/cli-asset-management';
28+
29+
await exportSpaceStructure({
30+
linkedWorkspaces,
31+
exportDir,
32+
branchName: 'main',
33+
assetManagementUrl,
34+
org_uid,
35+
context,
36+
progressManager,
37+
progressProcessName,
38+
updateStatus,
39+
downloadAsset, // optional
40+
});
41+
```
42+
43+
# Exports
44+
45+
| Export | Description |
46+
|--------|-------------|
47+
| `exportSpaceStructure` | Async function to export space structure for given linked workspaces. |
48+
| `AssetManagementAdapter` | Class to call the Asset Management API (getSpace, getWorkspaceFields, getWorkspaceAssets, etc.). |
49+
| Types from `./types` | `AssetManagementExportOptions`, `ExportSpaceOptions`, `ChunkedJsonWriteOptions`, `LinkedWorkspace`, `SpaceResponse`, `FieldsResponse`, `AssetTypesResponse`, and related API types. |

packages/contentstack-asset-management/src/import/workspaces.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ export default class ImportWorkspace extends CSAssetsImportAdapter {
6666
assetsImporter.setProcessName(spaceProcessName);
6767
}
6868

69-
// Map source default space → existing target default space (cross-org migration).
70-
// The caller supplies the uid of the pre-existing target default space; we upload
71-
// source assets into it instead of creating a new space.
72-
if (isDefault && targetDefaultSpaceUid) {
73-
const newSpaceUid = targetDefaultSpaceUid;
74-
const resolvedWorkspaceUid = targetDefaultWorkspaceUid ?? workspaceUid;
75-
log.info(
76-
`Source default space "${oldSpaceUid}" mapped to existing target default space "${newSpaceUid}".`,
77-
this.importContext.context,
78-
);
79-
const { uidMap, urlMap } = await assetsImporter.start(newSpaceUid, spaceDir);
80-
return { oldSpaceUid, newSpaceUid, workspaceUid: resolvedWorkspaceUid, isDefault: true, uidMap, urlMap };
81-
}
82-
8369
// Reuse: target org already has a space with the same uid as the export directory.
8470
if (existingSpaceUids.has(oldSpaceUid)) {
8571
log.info(
@@ -100,6 +86,20 @@ export default class ImportWorkspace extends CSAssetsImportAdapter {
10086
urlMap,
10187
};
10288
}
89+
90+
// Map source default space → existing target default space (cross-org migration).
91+
// The caller supplies the uid of the pre-existing target default space; we upload
92+
// source assets into it instead of creating a new space.
93+
if (isDefault && targetDefaultSpaceUid) {
94+
const newSpaceUid = targetDefaultSpaceUid;
95+
const resolvedWorkspaceUid = targetDefaultWorkspaceUid ?? workspaceUid;
96+
log.info(
97+
`Source default space "${oldSpaceUid}" mapped to existing target default space "${newSpaceUid}".`,
98+
this.importContext.context,
99+
);
100+
const { uidMap, urlMap } = await assetsImporter.start(newSpaceUid, spaceDir);
101+
return { oldSpaceUid, newSpaceUid, workspaceUid: resolvedWorkspaceUid, isDefault: true, uidMap, urlMap };
102+
}
103103

104104
// Create new space with exact exported title
105105
log.debug(`Creating space "${exportedTitle}" (old uid: ${oldSpaceUid})`, this.importContext.context);

packages/contentstack-content-type/README.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,181 @@ $ csdx content-type:details -a "management token" -c "content type" --no-path
5454
<!-- usagestop -->
5555
# Commands
5656
<!-- commands -->
57+
* [`csdx content-type:audit`](#csdx-content-typeaudit)
58+
* [`csdx content-type:compare`](#csdx-content-typecompare)
59+
* [`csdx content-type:compare-remote`](#csdx-content-typecompare-remote)
60+
* [`csdx content-type:details`](#csdx-content-typedetails)
61+
* [`csdx content-type:diagram`](#csdx-content-typediagram)
62+
* [`csdx content-type:list`](#csdx-content-typelist)
5763

64+
## `csdx content-type:audit`
65+
66+
Display recent changes to a Content Type
67+
68+
```
69+
USAGE
70+
$ csdx content-type:audit -c <value> [-s <value> | -a <value> | -a <value>] [-k <value> | | ]
71+
72+
FLAGS
73+
-a, --alias=<value> Alias of the management token
74+
-a, --token-alias=<value> Management token alias
75+
-c, --content-type=<value> (required) Content Type UID
76+
-k, --stack-api-key=<value> Stack API Key
77+
-s, --stack=<value> Stack UID
78+
79+
DESCRIPTION
80+
Display recent changes to a Content Type
81+
82+
EXAMPLES
83+
$ csdx content-type:audit --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
84+
85+
$ csdx content-type:audit --alias "management token" --content-type "home_page"
86+
```
87+
88+
_See code: [src/commands/content-type/audit.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/audit.ts)_
89+
90+
## `csdx content-type:compare`
91+
92+
Compare two Content Type versions
93+
94+
```
95+
USAGE
96+
$ csdx content-type:compare -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-l <value> -r <value>]
97+
98+
FLAGS
99+
-a, --alias=<value> Alias of the management token
100+
-a, --token-alias=<value> Management token alias
101+
-c, --content-type=<value> (required) Content Type UID
102+
-k, --stack-api-key=<value> Stack API Key
103+
-l, --left=<value> Content Type version, i.e. prev version
104+
-r, --right=<value> Content Type version, i.e. later version
105+
-s, --stack=<value> Stack UID
106+
107+
DESCRIPTION
108+
Compare two Content Type versions
109+
110+
EXAMPLES
111+
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
112+
113+
$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page" --left # --right #
114+
115+
$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #
116+
```
117+
118+
_See code: [src/commands/content-type/compare.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/compare.ts)_
119+
120+
## `csdx content-type:compare-remote`
121+
122+
compare two Content Types on different Stacks
123+
124+
```
125+
USAGE
126+
$ csdx content-type:compare-remote (-o <value> -r <value>) -c <value>
127+
128+
FLAGS
129+
-c, --content-type=<value> (required) Content Type UID
130+
-o, --origin-stack=<value> (required) Origin Stack API Key
131+
-r, --remote-stack=<value> (required) Remote Stack API Key
132+
133+
DESCRIPTION
134+
compare two Content Types on different Stacks
135+
136+
EXAMPLES
137+
$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"
138+
```
139+
140+
_See code: [src/commands/content-type/compare-remote.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/compare-remote.ts)_
141+
142+
## `csdx content-type:details`
143+
144+
Display Content Type details
145+
146+
```
147+
USAGE
148+
$ csdx content-type:details -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-p]
149+
150+
FLAGS
151+
-a, --alias=<value> Alias of the management token
152+
-a, --token-alias=<value> Management token alias
153+
-c, --content-type=<value> (required) Content Type UID
154+
-k, --stack-api-key=<value> Stack API Key
155+
-p, --[no-]path show path column
156+
-s, --stack=<value> Stack UID
157+
158+
DESCRIPTION
159+
Display Content Type details
160+
161+
EXAMPLES
162+
$ csdx content-type:details --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"
163+
164+
$ csdx content-type:details --alias "management token" --content-type "home_page"
165+
166+
$ csdx content-type:details --alias "management token" --content-type "home_page" --no-path
167+
```
168+
169+
_See code: [src/commands/content-type/details.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/details.ts)_
170+
171+
## `csdx content-type:diagram`
172+
173+
Create a visual diagram of a Stack's Content Types
174+
175+
```
176+
USAGE
177+
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-s <value> | -a <value> | -a <value>] [-k
178+
<value> | | ]
179+
180+
FLAGS
181+
-a, --alias=<value> Alias of the management token
182+
-a, --token-alias=<value> Management token alias
183+
-d, --direction=<option> (required) [default: portrait] graph orientation
184+
<options: portrait|landscape>
185+
-k, --stack-api-key=<value> Stack API Key
186+
-o, --output=<value> (required) full path to output
187+
-s, --stack=<value> Stack UID
188+
-t, --type=<option> (required) [default: svg] graph output file type
189+
<options: svg|dot>
190+
191+
DESCRIPTION
192+
Create a visual diagram of a Stack's Content Types
193+
194+
EXAMPLES
195+
$ csdx content-type:diagram --stack-api-key "xxxxxxxxxxxxxxxxxxx" --output "content-model.svg"
196+
197+
$ csdx content-type:diagram --alias "management token" --output "content-model.svg"
198+
199+
$ csdx content-type:diagram --alias "management token" --output "content-model.svg" --direction "landscape"
200+
201+
$ csdx content-type:diagram --alias "management token" --output "content-model.dot" --type "dot"
202+
```
203+
204+
_See code: [src/commands/content-type/diagram.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/diagram.ts)_
205+
206+
## `csdx content-type:list`
207+
208+
List all Content Types in a Stack
209+
210+
```
211+
USAGE
212+
$ csdx content-type:list [-s <value> | -a <value> | -a <value>] [-k <value> | | ] [-o title|modified]
213+
214+
FLAGS
215+
-a, --alias=<value> Alias of the management token
216+
-a, --token-alias=<value> Management token alias
217+
-k, --stack-api-key=<value> Stack API Key
218+
-o, --order=<option> [default: title] order by column
219+
<options: title|modified>
220+
-s, --stack=<value> Stack UID
221+
222+
DESCRIPTION
223+
List all Content Types in a Stack
224+
225+
EXAMPLES
226+
$ csdx content-type:list --stack-api-key "xxxxxxxxxxxxxxxxxxx"
227+
228+
$ csdx content-type:list --alias "management token"
229+
230+
$ csdx content-type:list --alias "management token" --order modified
231+
```
232+
233+
_See code: [src/commands/content-type/list.ts](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-content-type/src/commands/content-type/list.ts)_
58234
<!-- commandsstop -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
ecmaVersion: 2020,
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint'],
8+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
9+
rules: {
10+
'unicorn/prefer-module': 'off',
11+
'unicorn/no-abusive-eslint-disable': 'off',
12+
'@typescript-eslint/no-use-before-define': 'off',
13+
'node/no-missing-import': 'off',
14+
'@typescript-eslint/no-explicit-any': 'off',
15+
'@typescript-eslint/no-require-imports': 'off',
16+
'no-useless-escape': 'off',
17+
},
18+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
node_modules/
2+
/lib/
3+
oclif.manifest.json
4+
*.log
5+
.DS_Store
6+
coverage/
7+
8+
# Local migration outputs (may contain customer content)
9+
migration-workspace/
10+
contentstack-import/
11+
audit-reports/
12+
audit-fix/
13+
audit-verify/
14+
export.json
15+
contentfulMigrationData/
16+
_backup_*/
17+
migration-manifest.json
18+
19+
# Import/audit session logs (local artifacts, may contain customer content)
20+
logs/
21+
session.json
22+
23+
# Internal scratch docs — never commit (PR drafts / status notes)
24+
pr.md
25+
achieve.md
26+
out/
27+
.vscode/

0 commit comments

Comments
 (0)