@contentstack/cli 1.56.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version|-v)
21
- @contentstack/cli/1.56.0 linux-x64 node-v22.22.0
21
+ @contentstack/cli/1.57.0 linux-x64 node-v22.22.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -71,8 +71,10 @@ USAGE
71
71
  * [`csdx cm:migrate-rte`](#csdx-cmmigrate-rte)
72
72
  * [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple)
73
73
  * [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y-value--s-value---locale-value)
74
+ * [`csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent)
74
75
  * [`csdx cm:stacks:audit`](#csdx-cmstacksaudit)
75
76
  * [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix)
77
+ * [`csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent)
76
78
  * [`csdx cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`](#csdx-cmstacksexport--c-value--k-value--d-value--a-value---module-value---content-types-value---branch-value---secured-assets)
77
79
  * [`csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksimport--c-value--k-value--d-value--a-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent)
78
80
  * [`csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue)
@@ -2600,6 +2602,61 @@ EXAMPLES
2600
2602
  $ csdx cm:stacks:seed --repo "account/repository" --org "your-org-uid" --stack-name "stack-name" //create a new stack in given org uid
2601
2603
  ```
2602
2604
 
2605
+ ## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`
2606
+
2607
+ Clone data (structure/content or both) of a stack into another stack
2608
+
2609
+ ```
2610
+ USAGE
2611
+ $ csdx cm:stack-clone cm:stacks:clone [--source-branch <value>] [--target-branch <value>]
2612
+ [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b]
2613
+ [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]
2614
+
2615
+ FLAGS
2616
+ -c, --config=<value> Path for the external configuration
2617
+ -n, --stack-name=<value> Provide a name for the new stack to store the cloned content.
2618
+ -y, --yes Force override all Marketplace prompts.
2619
+ --destination-management-token-alias=<value> Destination management token alias.
2620
+ --destination-stack-api-key=<value> Destination stack API key
2621
+ --import-webhook-status=<option> [default: disable] [default: disable] (optional) The status of the
2622
+ import webhook. <options: disable|current>
2623
+ <options: disable|current>
2624
+ --skip-audit (optional) Skips the audit fix that occurs during an import
2625
+ operation.
2626
+ --source-branch=<value> Branch of the source stack.
2627
+ --source-branch-alias=<value> Alias of Branch of the source stack.
2628
+ --source-management-token-alias=<value> Source management token alias.
2629
+ --source-stack-api-key=<value> Source stack API key
2630
+ --target-branch=<value> Branch of the target stack.
2631
+ --target-branch-alias=<value> Alias of Branch of the target stack.
2632
+ --type=<option> Type of data to clone. You can select option a or b.
2633
+ a) Structure (all modules except entries & assets).
2634
+ b) Structure with content (all modules including entries & assets).
2635
+
2636
+ <options: a|b>
2637
+
2638
+ DESCRIPTION
2639
+ Clone data (structure/content or both) of a stack into another stack
2640
+ Use this plugin to automate the process of cloning a stack in few steps.
2641
+
2642
+
2643
+ ALIASES
2644
+ $ csdx cm:stack-clone
2645
+
2646
+ EXAMPLES
2647
+ $ csdx cm:stacks:clone
2648
+
2649
+ $ csdx cm:stacks:clone --source-branch <source-branch-name> --target-branch <target-branch-name> --yes
2650
+
2651
+ $ csdx cm:stacks:clone --source-stack-api-key <apiKey> --destination-stack-api-key <apiKey>
2652
+
2653
+ $ csdx cm:stacks:clone --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>
2654
+
2655
+ $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>
2656
+
2657
+ $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias> --type <value a or b>
2658
+ ```
2659
+
2603
2660
  ## `csdx cm:stacks:audit`
2604
2661
 
2605
2662
  Perform audits and find possible errors in the exported Contentstack data
@@ -2713,6 +2770,63 @@ EXAMPLES
2713
2770
 
2714
2771
  _See code: [@contentstack/cli-audit](https://github.com/contentstack/audit/blob/main/packages/contentstack-audit/src/commands/cm/stacks/audit/fix.ts)_
2715
2772
 
2773
+ ## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`
2774
+
2775
+ Clone data (structure/content or both) of a stack into another stack
2776
+
2777
+ ```
2778
+ USAGE
2779
+ $ csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias
2780
+ <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>]
2781
+ [--destination-stack-api-key <value>] [--import-webhook-status disable|current]
2782
+
2783
+ FLAGS
2784
+ -c, --config=<value> Path for the external configuration
2785
+ -n, --stack-name=<value> Provide a name for the new stack to store the cloned content.
2786
+ -y, --yes Force override all Marketplace prompts.
2787
+ --destination-management-token-alias=<value> Destination management token alias.
2788
+ --destination-stack-api-key=<value> Destination stack API key
2789
+ --import-webhook-status=<option> [default: disable] [default: disable] (optional) The status of the
2790
+ import webhook. <options: disable|current>
2791
+ <options: disable|current>
2792
+ --skip-audit (optional) Skips the audit fix that occurs during an import
2793
+ operation.
2794
+ --source-branch=<value> Branch of the source stack.
2795
+ --source-branch-alias=<value> Alias of Branch of the source stack.
2796
+ --source-management-token-alias=<value> Source management token alias.
2797
+ --source-stack-api-key=<value> Source stack API key
2798
+ --target-branch=<value> Branch of the target stack.
2799
+ --target-branch-alias=<value> Alias of Branch of the target stack.
2800
+ --type=<option> Type of data to clone. You can select option a or b.
2801
+ a) Structure (all modules except entries & assets).
2802
+ b) Structure with content (all modules including entries & assets).
2803
+
2804
+ <options: a|b>
2805
+
2806
+ DESCRIPTION
2807
+ Clone data (structure/content or both) of a stack into another stack
2808
+ Use this plugin to automate the process of cloning a stack in few steps.
2809
+
2810
+
2811
+ ALIASES
2812
+ $ csdx cm:stack-clone
2813
+
2814
+ EXAMPLES
2815
+ $ csdx cm:stacks:clone
2816
+
2817
+ $ csdx cm:stacks:clone --source-branch <source-branch-name> --target-branch <target-branch-name> --yes
2818
+
2819
+ $ csdx cm:stacks:clone --source-stack-api-key <apiKey> --destination-stack-api-key <apiKey>
2820
+
2821
+ $ csdx cm:stacks:clone --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>
2822
+
2823
+ $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>
2824
+
2825
+ $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias> --type <value a or b>
2826
+ ```
2827
+
2828
+ _See code: [@contentstack/cli-cm-clone](https://github.com/contentstack/cli/blob/main/packages/contentstack-clone/src/commands/cm/stacks/clone.ts)_
2829
+
2716
2830
  ## `csdx cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`
2717
2831
 
2718
2832
  Export content from a stack
@@ -2946,7 +3060,7 @@ EXAMPLES
2946
3060
  $ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
2947
3061
  ```
2948
3062
 
2949
- _See code: [@contentstack/cli-migration](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.js)_
3063
+ _See code: [@contentstack/cli-migration](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
2950
3064
 
2951
3065
  ## `csdx cm:stacks:publish`
2952
3066
 
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_utilities_1 = require("@contentstack/cli-utilities");
4
- const cli_utilities_2 = require("@contentstack/cli-utilities");
5
4
  // TBD: run region command if region is not there
6
5
  async function default_1(opts) {
7
- const newLogger = new cli_utilities_2.LoggerService(process.cwd(), 'cli-log');
8
6
  const { context: { plugin: { config: { protectedCommands = {} } = {} } = {}, region = null } = {} } = this.config;
9
7
  if (opts.Command.id !== 'config:set:region') {
10
8
  if (!region) {
@@ -17,7 +15,7 @@ async function default_1(opts) {
17
15
  // Auth guard
18
16
  if (protectedCommands[opts.Command.id]) {
19
17
  if (!(0, cli_utilities_1.isAuthenticated)()) {
20
- newLogger.error('No auth token found for command.', opts.Command.id);
18
+ (0, cli_utilities_1.handleAndLogError)(new Error('Authentication required for this command'), { module: 'auth-guard', commandId: opts.Command.id });
21
19
  cli_utilities_1.cliux.error('Please log in to execute the command');
22
20
  this.exit();
23
21
  }
@@ -25,14 +23,14 @@ async function default_1(opts) {
25
23
  try {
26
24
  const result = await client.getUser();
27
25
  if (!result) {
28
- newLogger.error('Error in auth validation');
26
+ (0, cli_utilities_1.handleAndLogError)(new Error('Error in auth validation'), { module: 'auth-guard' });
29
27
  cli_utilities_1.cliux.error('Please log in to execute the command');
30
28
  this.exit();
31
29
  }
32
- newLogger.debug('Logged-in user', result.data);
30
+ cli_utilities_1.log.debug('Logged-in user', { module: 'auth-guard', userData: result.data });
33
31
  }
34
32
  catch (error) {
35
- newLogger.error('Error in auth validation', error);
33
+ (0, cli_utilities_1.handleAndLogError)(error, { module: 'auth-guard' }, 'Error in auth validation');
36
34
  cli_utilities_1.cliux.error('Please log in to execute the command');
37
35
  process.exit();
38
36
  }
@@ -10,7 +10,6 @@ async function default_1(_opts) {
10
10
  var _a, _b;
11
11
  const now = Date.now();
12
12
  const today = new Date().toISOString().split('T')[0];
13
- const logger = new cli_utilities_1.LoggerService(process.env.CS_CLI_LOG_PATH || process.cwd(), 'cli-log');
14
13
  let cache = { lastChecked: 0, lastWarnedDate: '', latestVersion: '' };
15
14
  // if CLI_VERSION is not set or is not the same as the current version, set it
16
15
  if (!cli_utilities_1.configHandler.get('CLI_VERSION') || cli_utilities_1.configHandler.get('CLI_VERSION') !== this.config.version) {
@@ -30,7 +29,7 @@ async function default_1(_opts) {
30
29
  try {
31
30
  const latestVersion = (_b = (_a = (await httpClient.get(`https://registry.npmjs.org/@contentstack/cli/latest`))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.version;
32
31
  if (!latestVersion) {
33
- logger.error('Failed to retrieve the latest version from the registry.');
32
+ (0, cli_utilities_1.handleAndLogError)(new Error('Failed to retrieve the latest version from the registry.'), { module: 'latest-version-warning' });
34
33
  return;
35
34
  }
36
35
  cache.latestVersion = latestVersion;
@@ -39,7 +38,7 @@ async function default_1(_opts) {
39
38
  cli_utilities_1.configHandler.set('versionUpgradeWarningCache', cache);
40
39
  }
41
40
  catch (error) {
42
- logger.error('Failed to check the latest version', error);
41
+ (0, cli_utilities_1.handleAndLogError)(error, { module: 'latest-version-warning' }, 'Failed to check the latest version');
43
42
  return;
44
43
  }
45
44
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "commands": {},
3
- "version": "1.56.0"
3
+ "version": "1.57.0"
4
4
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli",
3
3
  "description": "Command-line tool (CLI) to interact with Contentstack",
4
- "version": "1.56.0",
4
+ "version": "1.57.0",
5
5
  "author": "Contentstack",
6
6
  "bin": {
7
7
  "csdx": "./bin/run.js"
@@ -25,11 +25,11 @@
25
25
  "@contentstack/cli-audit": "~1.17.1",
26
26
  "@contentstack/cli-cm-export": "~1.23.1",
27
27
  "@contentstack/cli-cm-import": "~1.31.2",
28
- "@contentstack/cli-auth": "~1.7.2",
28
+ "@contentstack/cli-auth": "~1.7.3",
29
29
  "@contentstack/cli-cm-bootstrap": "~1.18.2",
30
30
  "@contentstack/cli-cm-branches": "~1.6.3",
31
31
  "@contentstack/cli-cm-bulk-publish": "~1.10.6",
32
- "@contentstack/cli-cm-clone": "~1.20.0",
32
+ "@contentstack/cli-cm-clone": "~1.20.1",
33
33
  "@contentstack/cli-cm-export-to-csv": "~1.11.0",
34
34
  "@contentstack/cli-cm-import-setup": "~1.7.3",
35
35
  "@contentstack/cli-cm-migrate-rte": "~1.6.4",
@@ -37,8 +37,8 @@
37
37
  "@contentstack/cli-command": "~1.7.2",
38
38
  "@contentstack/cli-config": "~1.18.0",
39
39
  "@contentstack/cli-launch": "^1.9.2",
40
- "@contentstack/cli-migration": "~1.10.3",
41
- "@contentstack/cli-utilities": "~1.17.0",
40
+ "@contentstack/cli-migration": "~1.11.0",
41
+ "@contentstack/cli-utilities": "~1.17.1",
42
42
  "@contentstack/cli-variants": "~1.3.7",
43
43
  "@contentstack/management": "~1.27.3",
44
44
  "@oclif/core": "^4.3.0",
@@ -167,4 +167,4 @@
167
167
  }
168
168
  },
169
169
  "repository": "https://github.com/contentstack/cli"
170
- }
170
+ }