Skip to content

Commit a14f18f

Browse files
committed
merged latest changes
2 parents ebc855d + 89c399c commit a14f18f

File tree

9 files changed

+473
-418
lines changed

9 files changed

+473
-418
lines changed

.github/workflows/sca-scan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ jobs:
1313
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1414
with:
1515
args: --all-projects --fail-on=all
16+
json: true
17+
continue-on-error: true
18+
- uses: contentstack/sca-policy@main

.talismanrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
fileignoreconfig:
2-
- filename: package-lock.json
3-
checksum: c91b9e5fba1c84c0b6de15ad2f8cce698a5c781c9db31bebb7a3ad63ee88d9e1
4-
- filename: pnpm-lock.yaml
5-
checksum: 93f587bdb40e90560278654d116ca15ac901abfbfc666f82cddb53eac212eebe
62
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
73
checksum: 6e6fb00bb11b03141e5ad27eeaa4af9718dc30520c3e73970bc208cc0ba2a7d2
84
- filename: .github/workflows/release.yml
95
checksum: 73807361b1a862dc882846ac75fefca49e3c734db032e9aa80158f2a686bea13
6+
- filename: pnpm-lock.yaml
7+
checksum: 45b77e385a0b13c82ba125dcdc82d27a360132ff6edda801cd8b75943996c310
8+
- filename: packages/contentstack-auth/src/commands/auth/logout.ts
9+
checksum: 20ff708d5a0ee56eb8786b19df07b49dacaddfa1deafe99c0397716c7865726d
1010
version: '1.0'

packages/contentstack-auth/messages/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"CLI_AUTH_LOGOUT_DESCRIPTION": "User session logout",
1919
"CLI_AUTH_LOGOUT_FLAG_FORCE": "Force logging out for skipping the confirmation",
2020
"CLI_AUTH_LOGOUT_ALREADY": "You're already logged out",
21+
"CLI_AUTH_LOGOUT_CANCELLED": "Log out cancelled",
2122
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS": "No authorizations found",
2223
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS_USER": "No authorizations found for current user",
2324
"CLI_AUTH_WHOAMI_LOGGED_IN_AS": "You are currently logged in with email:",

packages/contentstack-auth/src/commands/auth/logout.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ export default class LogoutCommand extends BaseCommand<typeof LogoutCommand> {
9393
confirm,
9494
isAuthenticated: oauthHandler.isAuthenticated(),
9595
});
96-
log.success(messageHandler.parse('CLI_AUTH_LOGOUT_ALREADY'), this.contextDetails);
96+
const messageKey = confirm === false && oauthHandler.isAuthenticated()
97+
? 'CLI_AUTH_LOGOUT_CANCELLED'
98+
: 'CLI_AUTH_LOGOUT_ALREADY';
99+
log.success(messageHandler.parse(messageKey), this.contextDetails);
97100
}
98101
} catch (error) {
99102
log.debug('Logout failed.', { ...this.contextDetails, error: error.message });

packages/contentstack-config/package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,21 @@
6767
"protected": [
6868
"config:get:region"
6969
],
70-
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-config/<%- commandPath %>"
70+
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-config/<%- commandPath %>",
71+
"topics": {
72+
"config": {
73+
"description": "Perform configuration related activities"
74+
},
75+
"config:get": {
76+
"description": "View the list of set configuration values"
77+
},
78+
"config:set": {
79+
"description": "Set configuration values"
80+
},
81+
"config:remove": {
82+
"description": "Remove set configuration values"
83+
}
84+
}
7185
},
7286
"csdxConfig": {
7387
"shortCommandName": {

packages/contentstack/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli
1818
$ csdx COMMAND
1919
running command...
2020
$ csdx (--version|-v)
21-
@contentstack/cli/1.60.0-beta.0 darwin-arm64 node-v22.13.1
21+
@contentstack/cli/1.60.0-beta.5 darwin-arm64 node-v22.13.1
2222
$ csdx --help [COMMAND]
2323
USAGE
2424
$ csdx COMMAND
@@ -70,7 +70,7 @@ USAGE
7070
* [`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)
7171
* [`csdx cm:migrate-rte`](#csdx-cmmigrate-rte)
7272
* [`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-
* [`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)
73+
* [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y--s-value---locale-value)
7474
* [`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)
7575
* [`csdx cm:stacks:audit`](#csdx-cmstacksaudit)
7676
* [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix)
@@ -83,7 +83,7 @@ USAGE
8383
* [`csdx cm:stacks:publish-clear-logs`](#csdx-cmstackspublish-clear-logs)
8484
* [`csdx cm:stacks:publish-configure`](#csdx-cmstackspublish-configure)
8585
* [`csdx cm:stacks:publish-revert`](#csdx-cmstackspublish-revert)
86-
* [`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)
86+
* [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y--s-value---locale-value)
8787
* [`csdx csdx cm:stacks:unpublish [-a <value>] [-e <value>] [-c <value>] [-y] [--locale <value>] [--branch <value>] [--retry-failed <value>] [--bulk-unpublish <value>] [--content-type <value>] [--delivery-token <value>] [--only-assets] [--only-entries]`](#csdx-csdx-cmstacksunpublish--a-value--e-value--c-value--y---locale-value---branch-value---retry-failed-value---bulk-unpublish-value---content-type-value---delivery-token-value---only-assets---only-entries)
8888
* [`csdx config:get:base-branch`](#csdx-configgetbase-branch)
8989
* [`csdx config:get:ea-header`](#csdx-configgetea-header)
@@ -2561,19 +2561,19 @@ EXAMPLES
25612561
25622562
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
25632563
2564-
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
2564+
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
25652565
25662566
$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
25672567
```
25682568

2569-
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>] [--locale <value>]`
2569+
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>] [--locale <value>]`
25702570

25712571
Create a stack from existing content types, entries, assets, etc
25722572

25732573
```
25742574
USAGE
2575-
$ csdx cm:seed cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s
2576-
<value>] [--locale <value>]
2575+
$ csdx cm:seed cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>]
2576+
[--locale <value>]
25772577
25782578
FLAGS
25792579
-a, --alias=<value> Alias of the management token
@@ -2582,7 +2582,7 @@ FLAGS
25822582
-o, --org=<value> Provide Organization UID to create a new stack
25832583
-r, --repo=<value> GitHub organization name or GitHub user name/repository name.
25842584
-s, --stack=<value> Provide the stack UID to seed content.
2585-
-y, --yes=<value> [Optional] Skip the stack confirmation.
2585+
-y, --yes [Optional] Skip the stack confirmation.
25862586
25872587
DESCRIPTION
25882588
Create a stack from existing content types, entries, assets, etc
@@ -3055,7 +3055,7 @@ EXAMPLES
30553055
30563056
$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
30573057
3058-
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
3058+
$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
30593059
30603060
$ csdx cm:migration --alias --file-path <migration/script/file/path> -k <api-key>
30613061
```
@@ -3213,14 +3213,14 @@ EXAMPLES
32133213

32143214
_See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/stacks/publish-revert.js)_
32153215

3216-
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>] [--locale <value>]`
3216+
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>] [--locale <value>]`
32173217

32183218
Create a stack from existing content types, entries, assets, etc
32193219

32203220
```
32213221
USAGE
3222-
$ csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>]
3223-
[--locale <value>]
3222+
$ csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y] [-s <value>] [--locale
3223+
<value>]
32243224
32253225
FLAGS
32263226
-a, --alias=<value> Alias of the management token
@@ -3229,7 +3229,7 @@ FLAGS
32293229
-o, --org=<value> Provide Organization UID to create a new stack
32303230
-r, --repo=<value> GitHub organization name or GitHub user name/repository name.
32313231
-s, --stack=<value> Provide the stack UID to seed content.
3232-
-y, --yes=<value> [Optional] Skip the stack confirmation.
3232+
-y, --yes [Optional] Skip the stack confirmation.
32333233
32343234
DESCRIPTION
32353235
Create a stack from existing content types, entries, assets, etc
@@ -4148,7 +4148,7 @@ EXAMPLES
41484148
$ csdx plugins
41494149
```
41504150

4151-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/index.ts)_
4151+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/index.ts)_
41524152

41534153
## `csdx plugins:add PLUGIN`
41544154

@@ -4222,7 +4222,7 @@ EXAMPLES
42224222
$ csdx plugins:inspect myplugin
42234223
```
42244224

4225-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/inspect.ts)_
4225+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/inspect.ts)_
42264226

42274227
## `csdx plugins:install PLUGIN`
42284228

@@ -4271,7 +4271,7 @@ EXAMPLES
42714271
$ csdx plugins:install someuser/someplugin
42724272
```
42734273

4274-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/install.ts)_
4274+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/install.ts)_
42754275

42764276
## `csdx plugins:link PATH`
42774277

@@ -4302,7 +4302,7 @@ EXAMPLES
43024302
$ csdx plugins:link myplugin
43034303
```
43044304

4305-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/link.ts)_
4305+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/link.ts)_
43064306

43074307
## `csdx plugins:remove [PLUGIN]`
43084308

@@ -4343,7 +4343,7 @@ FLAGS
43434343
--reinstall Reinstall all plugins after uninstalling.
43444344
```
43454345

4346-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/reset.ts)_
4346+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/reset.ts)_
43474347

43484348
## `csdx plugins:uninstall [PLUGIN]`
43494349

@@ -4371,7 +4371,7 @@ EXAMPLES
43714371
$ csdx plugins:uninstall myplugin
43724372
```
43734373

4374-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/uninstall.ts)_
4374+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/uninstall.ts)_
43754375

43764376
## `csdx plugins:unlink [PLUGIN]`
43774377

@@ -4415,7 +4415,7 @@ DESCRIPTION
44154415
Update installed plugins.
44164416
```
44174417

4418-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.56/src/commands/plugins/update.ts)_
4418+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.58/src/commands/plugins/update.ts)_
44194419

44204420
## `csdx tokens`
44214421

packages/contentstack/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
"dependencies": {
2525
"@contentstack/cli-audit": "~1.19.0-beta.0",
2626
"@contentstack/cli-cm-export": "~1.24.0-beta.0",
27-
"@contentstack/cli-cm-import": "~1.32.0-beta.0",
27+
"@contentstack/cli-cm-import": "~1.32.0-beta.1",
2828
"@contentstack/cli-auth": "~1.8.0-beta.0",
29-
"@contentstack/cli-cm-bootstrap": "~1.19.0-beta.0",
29+
"@contentstack/cli-cm-bootstrap": "~1.19.0-beta.1",
3030
"@contentstack/cli-cm-branches": "~1.7.0-beta.0",
3131
"@contentstack/cli-cm-bulk-publish": "~1.11.0-beta.0",
32-
"@contentstack/cli-cm-clone": "~1.21.0-beta.0",
32+
"@contentstack/cli-cm-clone": "~1.21.0-beta.1",
3333
"@contentstack/cli-cm-export-to-csv": "~1.12.0-beta.0",
3434
"@contentstack/cli-cm-import-setup": "~1.8.0-beta.0",
3535
"@contentstack/cli-cm-migrate-rte": "~1.6.4",
36-
"@contentstack/cli-cm-seed": "~1.15.0-beta.0",
36+
"@contentstack/cli-cm-seed": "~1.15.0-beta.2",
3737
"@contentstack/cli-command": "~1.8.0-beta.0",
3838
"@contentstack/cli-config": "~1.20.0-beta.0",
3939
"@contentstack/cli-launch": "^1.9.6",
@@ -156,6 +156,7 @@
156156
],
157157
"hooks": {
158158
"prerun": [
159+
"./lib/hooks/prerun/init-context-for-command",
159160
"./lib/hooks/prerun/command-deprecation-check",
160161
"./lib/hooks/prerun/default-rate-limit-check",
161162
"./lib/hooks/prerun/latest-version-warning"
@@ -167,4 +168,4 @@
167168
}
168169
},
169170
"repository": "https://github.com/contentstack/cli"
170-
}
171+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {
2+
cliux,
3+
messageHandler,
4+
managementSDKInitiator,
5+
marketplaceSDKInitiator,
6+
} from '@contentstack/cli-utilities';
7+
import { CsdxContext } from '../../utils';
8+
9+
/**
10+
* When an invalid command is corrected (e.g. loginasda → login), init ran with the invalid
11+
* command so context.messageFilePath was never set. Re-build context and re-init utilities
12+
* for the actual command so i18n prompts show human-readable text.
13+
*/
14+
export default async function (opts: {
15+
Command?: { id?: string };
16+
config?: any;
17+
}): Promise<void> {
18+
const config = opts?.config ?? this.config;
19+
const commandId = opts?.Command?.id;
20+
if (!config?.context?.messageFilePath && commandId) {
21+
config.context = new CsdxContext({ id: commandId }, config);
22+
messageHandler.init(config.context);
23+
cliux.init(config.context);
24+
managementSDKInitiator.init(config.context);
25+
marketplaceSDKInitiator.init(config.context);
26+
}
27+
}

0 commit comments

Comments
 (0)