You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+375Lines changed: 375 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -228,6 +228,381 @@ csdx launch --help
228
228
229
229
**Migration Action:** If you use any `launch:*` command, install the `@contentstack/cli-launch` plugin before (or immediately after) upgrading to 2.x GA to avoid `command not found` errors. This applies to 2.x beta users as well, since `launch` was bundled during the beta.
230
230
231
+
### 8. 🔁 Flag Renames on Export / Import / Export-to-CSV
232
+
233
+
**What Changed:**
234
+
Several flags on `cm:stacks:export`, `cm:stacks:import`, and `cm:stacks:export-to-csv` were renamed or removed. Passing the old flag names now causes an **immediate error** — V2 does not silently fall back.
235
+
236
+
**cm:stacks:export — Removed Flags:**
237
+
238
+
| V1 Flag | V2 Replacement |
239
+
|---|---|
240
+
|`--data`|`--data-dir`|
241
+
|`--stack-uid` / `-s`|`--stack-api-key`|
242
+
|`--management-token-alias`|`--alias`|
243
+
|`--auth-token` / `-A`| use `csdx auth:login`, then `--alias`|
244
+
|`-m`|`--module` (long form only) |
245
+
|`-t`|`--content-types` (long form only) |
246
+
|`-B`|`--branch` (long form only) |
247
+
248
+
**cm:stacks:import — Removed Flags:**
249
+
250
+
| V1 Flag | V2 Replacement |
251
+
|---|---|
252
+
|`--data`|`--data-dir`|
253
+
|`--stack-uid` / `-s`|`--stack-api-key`|
254
+
|`--management-token-alias`|`--alias`|
255
+
|`--auth-token` / `-A`| use `csdx auth:login`, then `--alias`|
256
+
|`-m`|`--module` (long form only) |
257
+
|`-b`|`--backup-dir` (long form only) |
258
+
|`-B`|`--branch` (long form only) |
259
+
|`--skip-app-recreation`|**Removed — no replacement**|
260
+
261
+
> ⚠️ `--skip-app-recreation` is gone entirely. Remove it from all import scripts.
262
+
263
+
**cm:stacks:export-to-csv — Removed Flags:**
264
+
265
+
| V1 Flag | V2 Replacement |
266
+
|---|---|
267
+
|`--data`|`--data-dir`|
268
+
|`--stack-uid` / `-s`|`--stack-api-key`|
269
+
270
+
**Before (1.x.x):**
271
+
```bash
272
+
csdx cm:stacks:export -s blt123 --data ./export -B main
273
+
csdx cm:stacks:import -s blt123 --data ./export -b ./backup -B main
274
+
```
275
+
276
+
**After (2.x.x):**
277
+
```bash
278
+
csdx cm:stacks:export --stack-api-key blt123 --data-dir ./export --branch main
279
+
csdx cm:stacks:import --stack-api-key blt123 --data-dir ./export --backup-dir ./backup --branch main
280
+
```
281
+
282
+
**Also note — `--module studio` renamed:**
283
+
V1's `--module studio` is now `--module composable-studio`. Using the old value fails immediately:
284
+
```bash
285
+
# V1
286
+
csdx cm:stacks:export --module studio
287
+
288
+
# V2
289
+
csdx cm:stacks:export --module composable-studio
290
+
```
291
+
292
+
**Migration Action:** Update all export and import scripts to use the new flag names above. Search your CI/CD configs for `--data`, `-s`, `-B`, `-b`, `-m`, `-t`, `--auth-token`, `--management-token-alias`, `--skip-app-recreation`, and `--module studio`.
293
+
294
+
---
295
+
296
+
### 9. ⚠️ Export Directory Structure Changed (CRITICAL — Silent Data Loss Risk)
297
+
298
+
**What Changed:**
299
+
V2 changes two structural aspects of the export directory that can cause **silent failures** in downstream pipelines and V1 import operations.
300
+
301
+
#### 9.1 Global Fields: One File Per UID (was one combined file)
302
+
303
+
V1 wrote all global field schemas into a single file. V2 writes one file per global field UID.
304
+
305
+
```
306
+
# V1 export layout
307
+
export/global_fields/globalfields.json ← all schemas in one array
308
+
309
+
# V2 export layout
310
+
export/global_fields/my_header.json ← one file per UID
V1 also wrote `content_types/schema.json` containing all content type schemas as an array. V2 removes this file — only individual `content_types/<uid>.json` files are written.
318
+
319
+
```bash
320
+
cat export/content_types/schema.json # this file does not exist in V2 exports
321
+
ls export/content_types/*.json # correct: iterate per-UID files
322
+
```
323
+
324
+
#### 9.3 Branches: `branches.json` No Longer Written
325
+
326
+
V1 wrote a `branches.json` to the export root. V2 does not write this file and raises no error.
327
+
328
+
**Migration Action:**
329
+
- Update any tooling that reads `globalfields.json` or `content_types/schema.json` to iterate per-UID files.
330
+
- Remove any pipeline steps that check for or read `branches.json`.
331
+
- If you run a V2 export and then import with a **V1 CLI**, content types and global fields will be silently skipped (see section 10).
332
+
333
+
---
334
+
335
+
### 10. 🚨 V2 Export Cannot Be Imported with V1 CLI — Silent Skip (CRITICAL)
336
+
337
+
**What Changed:**
338
+
V2's importer (`cm:stacks:import`) reads only per-UID `<uid>.json` files for content types and global fields. It **explicitly ignores** the V1 aggregate files (`schema.json`, `globalfields.json`). There is no error or warning — the import completes "successfully" with zero content types and zero global fields created.
339
+
340
+
The same silent-skip applies when running `cm:stacks:audit` against a V1 export directory — the audit reads per-UID files only and will report 0 schemas found.
**Resolution:** Always re-export with the V2 CLI before importing with the V2 CLI. If you must work with a V1 export, split `schema.json` and `globalfields.json` into individual per-UID files first.
355
+
356
+
**Migration Action:** Do not mix V1-exported data with a V2 import run. Add a step in your pipeline to verify exports were produced by the same CLI major version before importing.
357
+
358
+
---
359
+
360
+
### 11. 🔗 Command Aliases Removed
361
+
362
+
**What Changed:**
363
+
Several short-form command aliases that worked in V1 no longer exist in V2. Running them produces a `command not found` error.
All six `content-type:*` commands (`audit`, `compare`, `compare-remote`, `details`, `diagram`, `list`) had their deprecated V1 flags and multiple short chars removed. These flags printed deprecation warnings in V1 but now **fail with an error** in V2.
csdx content-type:audit --stack blt123 --token-alias myalias -c blog
419
+
csdx content-type:compare --stack blt123 -c blog -l 1 -r 2
420
+
```
421
+
422
+
**After (2.x.x):**
423
+
```bash
424
+
csdx content-type:audit --stack-api-key blt123 --alias myalias --content-type blog
425
+
csdx content-type:compare --stack-api-key blt123 --content-type blog --left 1 --right 2
426
+
```
427
+
428
+
**Migration Action:** Replace `--stack` with `--stack-api-key`, `--token-alias` with `--alias`, and use long-form flags for all removed short chars.
429
+
430
+
---
431
+
432
+
### 13. 🚫 `--api-version` Flag Removed from Bulk Operations
433
+
434
+
**What Changed:**
435
+
The `--api-version` flag has been **removed** from `cm:stacks:bulk-entries` and `cm:stacks:bulk-taxonomies`. V2 hardcodes `api_version: 3.2` for all publish/unpublish calls. Passing `--api-version` now causes an immediate flag error.
**Migration Action:** Replace removed short chars with their long-form equivalents in all scripts.
483
+
484
+
---
485
+
486
+
### 15. ⚙️ Console Log Config Key Renamed
487
+
488
+
**What Changed:**
489
+
The internal config key that stores the console log preference was renamed from hyphenated to camelCase. Your V1 log preference is **not carried over** to V2 — you must re-apply it after upgrading.
490
+
491
+
| Config version | Key stored |
492
+
|---|---|
493
+
| V1 |`log["show-console-logs"]`|
494
+
| V2 |`log["showConsoleLogs"]`|
495
+
496
+
This does not affect the CLI flag name (`--show-console-logs` still works), only the stored config key. If your setup reads the Contentstack CLI config file directly (e.g. in a dotfile or CI bootstrap script), update the key name.
497
+
498
+
**Migration Action:** After upgrading to V2, re-run your log preference command:
499
+
500
+
```bash
501
+
# If you use console log mode in CI:
502
+
csdx config:set:log --show-console-logs
503
+
504
+
# If you use progress bar mode (default — run this to clear any stale V1 setting):
`cm:bootstrap` no longer recognises 13 app name values that were valid in V1. Passing any of them now throws `CLI_BOOTSTRAP_INVALID_APP_NAME`. Additionally, the flag names themselves changed (see section 8 above).
**Migration Action:** Replace removed `--app-name` values with one of the 8 valid V2 app names. Update `--appName` → `--app-name`, `--directory` → `--project-dir`, `--appType` → `--app-type`.
565
+
566
+
---
567
+
568
+
### 17. 🌱 Seed Stack List Is Now Curated (4 Stacks Only)
569
+
570
+
**What Changed:**
571
+
In V1, running `csdx cm:stacks:seed` without `--repo` triggered a live GitHub API search and presented all matching Contentstack repositories. In V2, the list is fixed — only 4 curated repos are shown in the interactive picker.
If you previously relied on the interactive list to discover repos, those repos no longer appear. Any script that passed a repo name not in this list via the interactive prompt will now time out or fail.
580
+
581
+
**Migration Action:** Use `--repo owner/repo-name` directly if you need a repository that is not in the curated list:
### 18. 🛑 Ctrl+C Now Exits with Code 130 (Was an Uncaught Exception)
590
+
591
+
**What Changed:**
592
+
In V1, pressing Ctrl+C during an interactive prompt (e.g. environment selection, alias selection) caused an `ExitPromptError` to be thrown. Depending on how your shell or CI pipeline handled unhandled exceptions, this could produce a non-zero exit code or an error stack trace.
593
+
594
+
In V2, SIGINT is caught and the process exits cleanly with **exit code 130** — the POSIX standard for SIGINT termination. No stack trace is printed.
595
+
596
+
**Before (1.x.x):**
597
+
- Ctrl+C → `ExitPromptError` thrown → unpredictable exit code, possible stack trace in logs
598
+
599
+
**After (2.x.x):**
600
+
- Ctrl+C → clean exit with code 130
601
+
602
+
**Migration Action:** If your CI pipeline checks the exit code of CLI commands that may be cancelled interactively, update the expected exit code from a non-zero exception code to `130`. If you catch `ExitPromptError` in any wrapper scripts, remove that handler.
0 commit comments