Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a19b257
Update CLI Release Pipeline and update contentstack package.json
harshitha-cstk May 21, 2026
3b9c227
Update @contentstack/apps-cli dependency version in package.json
harshitha-cstk May 21, 2026
9e2bf18
Add @contentstack/cli-bulk-operations dependency to package.json
harshitha-cstk May 22, 2026
effff88
Update @contentstack/cli-cm-migrate-rte dependency version to ~1.7.0 …
harshitha-cstk May 22, 2026
490890b
fixed message code resolving
shafeeqd959 May 25, 2026
5522c5a
Merge branch 'development' into feat/migrate-external-cli-plugins-v1
harshitha-cstk May 26, 2026
ced041d
Remove the CLI Release Pipeline workflow from GitHub Actions
harshitha-cstk May 26, 2026
03a8e06
Remove external dependencies from package.json as it increases the pa…
harshitha-cstk May 26, 2026
3438697
Refactor package.json
harshitha-cstk May 26, 2026
5658c27
Update pnpm-lock.yaml
harshitha-cstk May 26, 2026
efa959b
update pnpm lock
harshitha-cstk May 28, 2026
8a3b48e
upgrade oclif dependency
harshitha-cstk May 28, 2026
6a4c0d8
update pnpm lock
harshitha-cstk May 29, 2026
76af093
update pnpm lock file
harshitha-cstk May 29, 2026
e6394bb
upgrade package json files
harshitha-cstk May 29, 2026
89626e6
upgrade package json files
harshitha-cstk May 29, 2026
433a5c0
Merge pull request #2581 from contentstack/feat/migrate-external-cli-…
harshitha-cstk May 29, 2026
6b8db5e
version bump
harshitha-cstk May 29, 2026
1b1bbb8
update pnpm lock
harshitha-cstk May 29, 2026
0ed0442
Merge pull request #2594 from contentstack/fix/version-bump-1
harshitha-cstk May 29, 2026
3225f31
Merge pull request #2600 from contentstack/v2-beta
harshitha-cstk Jun 1, 2026
1a5e5be
Merge branch 'development' into fix/back-merge-development
harshitha-cstk Jun 1, 2026
aba4688
Merge pull request #2602 from contentstack/fix/back-merge-development
harshitha-cstk Jun 1, 2026
98e993e
Merge branch 'v2-beta' into fix/back-merge
Jun 8, 2026
6a0656b
Merge pull request #2606 from contentstack/fix/back-merge
naman-contentstack Jun 8, 2026
fba4f9d
merged changes
Jun 11, 2026
2c4984d
Merge pull request #2584 from contentstack/fix/DX-7599
shafeeqd959 Jun 11, 2026
a6e7669
Standardises the minimum supported Node.js version to >=22.0.0 across…
cs-raj Jun 24, 2026
23fc62f
lock file update
cs-raj Jun 24, 2026
26c0371
upgrade eslint to v10
harshitha-cstk Jun 24, 2026
1582788
Merge pull request #2612 from contentstack/fix/DX-9300
cs-raj Jun 24, 2026
cdd0c8a
Merge branch 'v2-dev' into enh/dx-9299-eslint-upgrade
harshitha-cstk Jun 24, 2026
60084f4
revert pnpm upgrade
harshitha-cstk Jun 24, 2026
7dce357
Merge pull request #2613 from contentstack/enh/dx-9299-eslint-upgrade
harshitha-cstk Jun 24, 2026
b0d1455
feat: add auth:tokens namespace help and auth:tokens:list command
harshitha-cstk Jun 25, 2026
ced638c
Merge pull request #2615 from contentstack/enh/dx-3812-tokens-enh
harshitha-cstk Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 3679e7796d7b2b35b3485f4d56a52778557e94a079900bb65ecd41785b234383
version: '1.0'
checksum: 0f2e17618b7c8286c5f76d4e25a98b830d3eb2d29acc6f8099f3501ff150d4f4
- filename: packages/contentstack-utilities/src/message-handler.ts
checksum: e7221e8413005b9efe3a230cd91aff130850976addc41c0acb10745a56ec3245
version: '1.0'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"pnpm": "^10.28.0"
},
"engines": {
"node": ">=18.0.0"
"node": ">=22.0.0"
},
"private": true,
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/sinon": "^21.0.1",
"chai": "^4.5.0",
"dotenv": "^16.6.1",
"eslint": "^9.26.0",
"eslint": "^10.5.0",
"eslint-config-oclif": "^5.2.2",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "10.8.2",
Expand All @@ -45,7 +45,7 @@
"typescript": "^4.9.5"
},
"engines": {
"node": ">=14.0.0"
"node": ">=22.0.0"
},
"files": [
"/lib",
Expand Down
88 changes: 17 additions & 71 deletions packages/contentstack-auth/src/commands/auth/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
cliux,
configHandler,
CLITable,
TableFlags,
FlagInput,
handleAndLogError,
log,
} from '@contentstack/cli-utilities';
import { Help } from '@oclif/core';
import { BaseCommand } from '../../../base-command';
export default class TokensListCommand extends BaseCommand<typeof TokensListCommand> {
static aliases = ['tokens'];
static examples = ['$ csdx auth:tokens'];
static description = 'Lists all existing tokens added to the session';
import { CLITable, FlagInput } from '@contentstack/cli-utilities';

export default class AuthTokensCommand extends BaseCommand<typeof AuthTokensCommand> {
static description = 'Manage authentication tokens for API access';
static strict = false;

static examples = [
'$ csdx auth:tokens:list',
'$ csdx auth:tokens:add --alias mytoken',
'$ csdx auth:tokens:remove --alias mytoken',
];

static flags: FlagInput = CLITable.getTableFlags([
'columns',
'sort',
Expand All @@ -20,65 +20,11 @@ export default class TokensListCommand extends BaseCommand<typeof TokensListComm
'no-truncate',
'no-header',
'output',
]); // use the cli table flags as it displays tokens in table
]);

async run(): Promise<any> {
log.debug('TokensListCommand run method started.', this.contextDetails);
this.contextDetails.module = 'tokens-list';

try {
log.debug('Retrieving tokens from configuration.', this.contextDetails);
const managementTokens = configHandler.get('tokens');
log.debug('Tokens retrieved from configuration.', {...this.contextDetails, tokenCount: managementTokens ? Object.keys(managementTokens).length : 0 });

const tokens: Record<string, unknown>[] = [];
if (managementTokens && Object.keys(managementTokens).length > 0) {
log.debug('Processing tokens for display.', this.contextDetails);
Object.keys(managementTokens).forEach(function (item) {
tokens.push({
alias: item,
token: managementTokens[item].token,
apiKey: managementTokens[item].apiKey,
environment: managementTokens[item].environment ? managementTokens[item].environment : '-',
type: managementTokens[item].type,
});
log.debug(`Token processed: ${item}`, {tokenType: managementTokens[item].type });
});

const { flags } = await this.parse(TokensListCommand);
log.debug('Token list flags parsed.', {...this.contextDetails, flags });

const headers = [
{
value: 'alias',
},
{
value: 'token',
},
{
value: 'apiKey',
},
{
value: 'environment',
},
{
value: 'type',
},
];

log.debug('Displaying token table.', {...this.contextDetails, tokenCount: tokens.length });
cliux.table(headers, tokens, flags as TableFlags);
log.debug('Token table displayed successfully.', this.contextDetails);
} else {
log.debug('No tokens found in configuration.', this.contextDetails);
cliux.print('CLI_AUTH_TOKENS_LIST_NO_TOKENS');
}

log.debug('Token list command completed successfully.', this.contextDetails);
} catch (error) {
log.debug('Token list command failed.', {...this.contextDetails, error });
cliux.print('CLI_AUTH_TOKENS_LIST_FAILED', { color: 'yellow' });
handleAndLogError(error, { ...this.contextDetails });
}
await this.parse(AuthTokensCommand, this.argv.filter((a) => a !== '-help' && a !== '-h'));
const cmd = this.config.findCommand('auth:tokens');
if (cmd) await new Help(this.config).showCommandHelp(cmd);
}
}
74 changes: 74 additions & 0 deletions packages/contentstack-auth/src/commands/auth/tokens/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import {
cliux,
configHandler,
CLITable,
TableFlags,
FlagInput,
handleAndLogError,
log,
} from '@contentstack/cli-utilities';
import { BaseCommand } from '../../../base-command';

export default class AuthTokensListCommand extends BaseCommand<typeof AuthTokensListCommand> {
static description = 'Lists all existing tokens added to the session';
static examples = ['$ csdx auth:tokens:list'];
static flags: FlagInput = CLITable.getTableFlags([
'columns',
'sort',
'filter',
'csv',
'no-truncate',
'no-header',
'output',
]);

async run(): Promise<any> {
log.debug('AuthTokensListCommand run method started.', this.contextDetails);
this.contextDetails.module = 'auth-tokens-list';

try {
log.debug('Retrieving tokens from configuration.', this.contextDetails);
const managementTokens = configHandler.get('tokens');
log.debug('Tokens retrieved from configuration.', { ...this.contextDetails, tokenCount: managementTokens ? Object.keys(managementTokens).length : 0 });

const tokens: Record<string, unknown>[] = [];
if (managementTokens && Object.keys(managementTokens).length > 0) {
log.debug('Processing tokens for display.', this.contextDetails);
Object.keys(managementTokens).forEach(function (item) {
tokens.push({
alias: item,
token: managementTokens[item].token,
apiKey: managementTokens[item].apiKey,
environment: managementTokens[item].environment ? managementTokens[item].environment : '-',
type: managementTokens[item].type,
});
log.debug(`Token processed: ${item}`, { tokenType: managementTokens[item].type });
});

const { flags } = await this.parse(AuthTokensListCommand);
log.debug('Token list flags parsed.', { ...this.contextDetails, flags });

const headers = [
{ value: 'alias' },
{ value: 'token' },
{ value: 'apiKey' },
{ value: 'environment' },
{ value: 'type' },
];

log.debug('Displaying token table.', { ...this.contextDetails, tokenCount: tokens.length });
cliux.table(headers, tokens, flags as TableFlags);
log.debug('Token table displayed successfully.', this.contextDetails);
} else {
log.debug('No tokens found in configuration.', this.contextDetails);
cliux.print('CLI_AUTH_TOKENS_LIST_NO_TOKENS');
}

log.debug('Token list command completed successfully.', this.contextDetails);
} catch (error) {
log.debug('Token list command failed.', { ...this.contextDetails, error });
cliux.print('CLI_AUTH_TOKENS_LIST_FAILED', { color: 'yellow' });
handleAndLogError(error, { ...this.contextDetails });
}
}
}
4 changes: 2 additions & 2 deletions packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@oclif/test": "^4.1.18",
"@types/mocha": "^8.2.3",
"@types/node": "^14.18.63",
"eslint": "^9.26.0",
"eslint": "^10.5.0",
"eslint-config-oclif": "^6.0.15",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "10.8.2",
Expand All @@ -36,7 +36,7 @@
"typescript": "^4.9.5"
},
"engines": {
"node": ">=14.0.0"
"node": ">=22.0.0"
},
"files": [
"/types",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@types/node": "^14.18.63",
"@types/sinon": "^21.0.1",
"chai": "^4.5.0",
"eslint": "^9.26.0",
"eslint": "^10.5.0",
"eslint-config-oclif": "^6.0.166",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "10.8.2",
Expand All @@ -42,7 +42,7 @@
"typescript": "^4.9.5"
},
"engines": {
"node": ">=14.0.0"
"node": ">=22.0.0"
},
"files": [
"/lib",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"inquirer": "12.11.1",
"inquirer-search-checkbox": "^1.0.0",
"inquirer-search-list": "^1.2.6",
"js-yaml": "^4.1.1",
"js-yaml": "^4.2.0",
"klona": "^2.0.6",
"lodash": "^4.18.1",
"mkdirp": "^1.0.4",
Expand Down Expand Up @@ -72,7 +72,7 @@
"@types/sinon": "^21.0.0",
"@types/traverse": "^0.6.37",
"chai": "^4.5.0",
"eslint": "^9.26.0",
"eslint": "^10.5.0",
"eslint-config-oclif": "^6.0.62",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "10.8.2",
Expand Down
20 changes: 7 additions & 13 deletions packages/contentstack-utilities/src/message-handler.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import fs from 'fs';
import CLIError from './cli-error';

const STORE_KEY = '__cs_messages__';

/**
* Message handler
*/
class Messages {
private messages: object;
messageFilePath: any;

constructor() {
this.messages = {};
}

init(context) {
if (!context.messageFilePath) {
return;
}
try {
this.messages = JSON.parse(fs.readFileSync(context.messageFilePath, 'utf-8'));
const loaded = JSON.parse(fs.readFileSync(context.messageFilePath, 'utf-8'));
(globalThis as any)[STORE_KEY] = { ...(globalThis as any)[STORE_KEY], ...loaded };
} catch (error) {
// create empty messages object if message file is not exist
if (error.code === 'ENOENT') {
this.messages = {};
} else {
if (error.code !== 'ENOENT') {
throw new CLIError(`Error: ${error.message}`);
}
}
}

parse(messageKey: string, ...substitutions: Array<any>): string {
const msg = this.messages[messageKey];
const store = (globalThis as any)[STORE_KEY] || {};
const msg = store[messageKey];
if (!msg) {
return messageKey;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/semver": "^7.7.1",
"@types/sinon": "^21.0.0",
"chai": "^4.5.0",
"eslint": "^9.26.0",
"eslint": "^10.5.0",
"eslint-config-oclif": "^6.0.137",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "10.8.2",
Expand All @@ -83,7 +83,7 @@
"typescript": "^5.9.3"
},
"engines": {
"node": ">=14.0.0"
"node": ">=22.0.0"
},
"files": [
"/bin",
Expand Down
Loading
Loading