Skip to content

Commit df34bc3

Browse files
authored
Merge pull request #2630 from contentstack/v2-dev
DX | 06-07-2026 | Beta Release
2 parents bf5caa8 + 4cb6268 commit df34bc3

8 files changed

Lines changed: 428 additions & 570 deletions

File tree

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fileignoreconfig:
22
- filename: pnpm-lock.yaml
3-
checksum: 0f2e17618b7c8286c5f76d4e25a98b830d3eb2d29acc6f8099f3501ff150d4f4
3+
checksum: a72a1c8e7109e8eb3a4159b7945e20cdb25a99bff32e45fcbf5a6b4534bdb0da
44
- filename: packages/contentstack-utilities/src/message-handler.ts
55
checksum: e7221e8413005b9efe3a230cd91aff130850976addc41c0acb10745a56ec3245
66
version: '1.0'

packages/contentstack-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-auth",
33
"description": "Contentstack CLI plugin for authentication activities",
4-
"version": "2.0.0-beta.14",
4+
"version": "2.0.0-beta.15",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {

packages/contentstack-auth/src/commands/auth/tokens/remove.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export default class TokensRemoveCommand extends BaseCommand<typeof TokensRemove
66
static examples = ['$ csdx auth:tokens:remove', '$ csdx auth:tokens:remove -a <alias>'];
77
static flags: FlagInput = {
88
alias: flags.string({ char: 'a', description: 'Alias (name) of the token to delete.' }),
9-
ignore: flags.boolean({ char: 'i', description: 'Ignores if the token is not present.' }),
109
};
1110

1211
async run(): Promise<any> {
@@ -17,21 +16,25 @@ export default class TokensRemoveCommand extends BaseCommand<typeof TokensRemove
1716
log.debug('Token removal flags parsed.', {...this.contextDetails, flags: removeTokenFlags });
1817

1918
const alias = removeTokenFlags.alias;
20-
const ignore = removeTokenFlags.ignore;
21-
log.debug('Token removal parameters set.', {...this.contextDetails, alias, ignore });
22-
19+
log.debug('Token removal parameters set.', {...this.contextDetails, alias });
20+
2321
try {
2422
log.debug('Retrieving token from configuration.', {...this.contextDetails, alias });
2523
const token = configHandler.get(`tokens.${alias}`);
2624
log.debug('Token retrieved from configuration.', {...this.contextDetails, hasToken: !!token, tokenType: token?.type });
27-
25+
26+
if (alias && !token) {
27+
log.debug('Alias provided but token not found.', {...this.contextDetails, alias });
28+
return cliux.print(`No token found with alias '${alias}'.`, { color: 'yellow' });
29+
}
30+
2831
const tokens = configHandler.get('tokens');
2932
log.debug('All tokens retrieved from configuration.', {...this.contextDetails, tokenCount: tokens ? Object.keys(tokens).length : 0 });
30-
33+
3134
const tokenOptions: Array<string> = [];
32-
33-
if (token || ignore) {
34-
log.debug('Token found, or ignore flag set.', {...this.contextDetails, hasToken: !!token, ignore });
35+
36+
if (token) {
37+
log.debug('Token found.', {...this.contextDetails, hasToken: !!token });
3538
configHandler.delete(`tokens.${alias}`);
3639
log.debug('Token removed from configuration.', {...this.contextDetails, alias });
3740
return cliux.success(`CLI_AUTH_TOKENS_REMOVE_SUCCESS`);

packages/contentstack-auth/test/unit/commands/tokens-remove.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ describe('Tokens Remove Command', () => {
3737
expect(Boolean(config.get(`${configKeyTokens}.${token1Alias}`))).to.be.false;
3838
});
3939

40-
it('Remove the token with invalid alias, should list the table', async function () {
40+
it('Remove the token with invalid alias, should print error and not show interactive picker', async function () {
4141
// Skip this test in PREPACK_MODE - config handler uses in-memory store that doesn't persist properly
4242
if (isPrepackMode) {
4343
this.skip();
4444
return;
4545
}
4646
const inquireStub = sinon.stub(cliux, 'inquire').resolves([]);
47+
const printStub = sinon.stub(cliux, 'print');
4748
await TokensRemoveCommand.run(['-a', 'invalid-test-tokens-remove']);
48-
expect(inquireStub.calledOnce).to.be.true;
49+
expect(printStub.calledOnce).to.be.true;
50+
expect(printStub.firstCall.args[0]).to.include('invalid-test-tokens-remove');
51+
expect(inquireStub.called).to.be.false;
4952
});
5053

5154
it('Selectes multiple token, remove all the selected tokens', async function () {

packages/contentstack-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-config",
33
"description": "Contentstack CLI plugin for configuration",
4-
"version": "2.0.0-beta.12",
4+
"version": "2.0.0-beta.13",
55
"author": "Contentstack",
66
"scripts": {
77
"build": "pnpm compile && oclif manifest && oclif readme",

packages/contentstack-config/src/commands/config/set/region.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
3030
dependsOn: ['cda', 'cma', 'name'],
3131
}),
3232
name: _flags.string({
33-
char: 'n',
3433
description: 'Name for the region, if this flag is added then cda, cma and ui-host flags are required',
3534
dependsOn: ['cda', 'cma', 'ui-host'],
3635
}),
@@ -65,7 +64,7 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
6564
'$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --launch <custom_launch_url>',
6665
'$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --studio <custom_studio_url>',
6766
'$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --cs-assets <cs_assets_url>',
68-
'$ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name "India" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url>',
67+
'$ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name "India" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url> --cs-assets <cs_assets_url>',
6968
];
7069

7170
static args: ArgInput = {

0 commit comments

Comments
 (0)