Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ae48f28
add path validation while import
Sep 1, 2025
5a61356
refactor code based on comments
Sep 2, 2025
70c2ee8
add helper file for import path validation
Sep 2, 2025
96e54dd
updated logger
Sep 2, 2025
24815ce
Merge pull request #2103 from contentstack/main
cs-raj Sep 3, 2025
b5b7a87
Merge pull request #2104 from contentstack/staging
cs-raj Sep 3, 2025
959e547
Replaced Process.exit with return
cs-raj Sep 4, 2025
d2fbe32
Version Bump
cs-raj Sep 4, 2025
59081ca
Added the status code
cs-raj Sep 4, 2025
3a8cd4d
merge development
Sep 4, 2025
da436c0
version bumps
Sep 5, 2025
38b3f26
minor update
Sep 5, 2025
3233750
Merge pull request #2101 from contentstack/fix/DX-3246
naman-contentstack Sep 5, 2025
66801e8
fix: Improper Handling of Optional Log Config and set log level issue
aman19K Sep 5, 2025
ba5a31b
Merge branch 'development' into fix/DX-3465
aman19K Sep 5, 2025
851c54a
updated talismanrc file
aman19K Sep 5, 2025
ab5ab98
Merge pull request #2108 from contentstack/development
cs-raj Sep 5, 2025
fa280ea
Merge pull request #2107 from contentstack/fix/DX-3465
aman19K Sep 5, 2025
38501a3
fix: variant entries creation issue
aman19K Sep 9, 2025
20750b9
Merge branch 'development' into fix/DX-3519
cs-raj Sep 9, 2025
ed6221c
Merge pull request #2105 from contentstack/fix/DX-3519
cs-raj Sep 10, 2025
02b7255
Merge branch 'development' into fix/DX-3525
aman19K Sep 10, 2025
c6c2d8a
Merge pull request #2110 from contentstack/fix/DX-3525
aman19K Sep 10, 2025
bb86ca2
fix: Added error details for API failures, including a errors propert…
aman19K Sep 10, 2025
aacacbb
Merge branch 'development' into fix/DX-3532
aman19K Sep 10, 2025
2daf98e
fix: return after max retry count
aman19K Sep 10, 2025
5d8a74c
Merge branch 'staging' into fix/conflicts-update-branch
harshithad0703 Sep 10, 2025
30c5330
Merge pull request #2114 from contentstack/fix/conflicts-update-branch
harshithad0703 Sep 10, 2025
4022421
refactor: log message in import base class
aman19K Sep 10, 2025
5aef21c
refactor: log level
aman19K Sep 10, 2025
99763fd
Merge branch 'development' into fix/DX-3532
aman19K Sep 10, 2025
9c4c07a
Merge pull request #2111 from contentstack/fix/DX-3532
aman19K Sep 10, 2025
8763d33
fix: update @contentstack/cli-utilities to version 1.14.1 in package.…
harshithad0703 Sep 11, 2025
6782e67
update package lock
harshithad0703 Sep 11, 2025
f6ee280
update package lock
harshithad0703 Sep 11, 2025
af85aeb
update package lock
harshithad0703 Sep 11, 2025
19f9ab4
Merge pull request #2115 from contentstack/fix/version-bump
harshithad0703 Sep 12, 2025
94c1a34
Merge pull request #2112 from contentstack/development
harshithad0703 Sep 12, 2025
0cd1375
update package-lock
harshithad0703 Sep 12, 2025
1896873
Merge pull request #2117 from contentstack/fix/package-lock
harshithad0703 Sep 12, 2025
7b875dd
update error message
Sep 15, 2025
8246ffe
update error message
Sep 15, 2025
4336615
Merge pull request #2119 from contentstack/update_DX-3246
naman-contentstack Sep 15, 2025
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
12 changes: 9 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fileignoreconfig:
- filename: package-lock.json
checksum: 59d20d0ac10b0d5d4014817c8453e4aa9fe0be396f7902999373273a9d471658
checksum: e99f717f726226d79c6d484b44fa3d8e758038fbaca671301377741e36802b6d
- filename: pnpm-lock.yaml
checksum: 7cade45c0e4ff4755b6e7d0f7ce0e40fa5b62131513d9f800635ef4288fdc058
checksum: d26dfe4137bcd958a79beff8a2867fbbad531f81ef0c8c8a8786e8680b79b52e
- filename: packages/contentstack-import-setup/test/unit/backup-handler.test.ts
checksum: 0582d62b88834554cf12951c8690a73ef3ddbb78b82d2804d994cf4148e1ef93
- filename: packages/contentstack-import-setup/test/config.json
Expand Down Expand Up @@ -81,4 +81,10 @@ fileignoreconfig:
checksum: 7024f22a6ed3908d7cf074bbd8e7107e2d9f43bbcc42939b28d360c89d44cc29
- filename: packages/contentstack-bulk-publish/src/util/generate-bulk-publish-url.js
checksum: 5f7c1e2fac3e7fab21e861d609c54ca7191ee09fd076dd0adc66604043bf7a43
version: "1.0"
- filename: packages/contentstack-import/src/utils/interactive.ts
checksum: b401a6166313c184712ff623ea8d95a5548fb3d8b8229c053ae44a1850b54a72
- filename: packages/contentstack-import-setup/src/utils/backup-handler.ts
checksum: 7db02c6f2627400b28fc96d505bf074d477080a45ba13943709d4845b6ca0908
- filename: packages/contentstack-import/src/utils/backup-handler.ts
checksum: 4f7a8bea92ebffbc34a0979b3a63fef327562a899b773481d67a675140cfa4bf
version: "1.0"
4,686 changes: 2,376 additions & 2,310 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"dependencies": {
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"@oclif/plugin-plugins": "^5.4.38",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"otplib": "^12.0.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.12.1",
"@contentstack/cli-cm-seed": "~1.12.2",
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"inquirer": "8.2.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@contentstack/cli-command": "~1.6.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"chalk": "^4.1.2",
"just-diff": "^6.0.2",
"lodash": "^4.17.21"
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-config": "~1.15.0",
"@contentstack/cli-utilities": "~1.13.1",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-clone/1.15.0 darwin-arm64 node-v22.13.1
@contentstack/cli-cm-clone/1.16.1 darwin-arm64 node-v22.13.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.16.0",
"version": "1.16.1",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@colors/colors": "^1.6.0",
"@contentstack/cli-cm-export": "~1.20.1",
"@contentstack/cli-cm-import": "~1.27.0",
"@contentstack/cli-cm-import": "~1.28.0",
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"contentstack": "^3.25.3",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28"
Expand Down
19 changes: 15 additions & 4 deletions packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.15.1 darwin-arm64 node-v22.14.0
@contentstack/cli-config/1.15.2 darwin-arm64 node-v22.14.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -329,9 +329,10 @@ USAGE
$ csdx config:set:log [--level debug|info|warn|error] [--path <value>] [--show-console-logs]

FLAGS
--level=<option> Set the log level for the CLI.
--level=<option> Set the log level for the CLI. Defaults to "info" if not specified.
<options: debug|info|warn|error>
--path=<value> Specify the file path where logs should be saved.
--path=<value> Specify the directory path where logs should be saved. Supports both relative and absolute
paths. Defaults to ~/.contentstack/logs if not specified.
--[no-]show-console-logs Enable console logging.

DESCRIPTION
Expand All @@ -340,9 +341,19 @@ DESCRIPTION
EXAMPLES
$ csdx config:set:log

$ csdx config:set:log --level debug --path ./logs/app.log --show-console-logs
$ csdx config:set:log --level debug

$ csdx config:set:log --path ./logs

$ csdx config:set:log --level debug --path ./logs --show-console-logs

$ csdx config:set:log --no-show-console-logs

$ csdx config:set:log --level warn --show-console-logs

$ csdx config:set:log --path ~/custom/logs

$ csdx config:set:log --path /var/log/contentstack
```

_See code: [src/commands/config/set/log.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/log.ts)_
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "1.15.1",
"version": "1.15.2",
"author": "Contentstack",
"scripts": {
"build": "npm run clean && npm run compile",
Expand All @@ -22,7 +22,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.0",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"lodash": "^4.17.21"
Expand Down
40 changes: 22 additions & 18 deletions packages/contentstack-config/src/commands/config/get/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Command } from '@contentstack/cli-command';
import { cliux, configHandler, messageHandler, TableHeader } from '@contentstack/cli-utilities';
import { cliux, configHandler, TableHeader } from '@contentstack/cli-utilities';
import { getEffectiveLogConfig } from '../../../utils/log-config-defaults';

export default class LogGetCommand extends Command {
static description = 'Get logging configuration for CLI';
Expand All @@ -9,26 +10,29 @@ export default class LogGetCommand extends Command {
async run() {
try {
const currentLoggingConfig = configHandler.get('log') || {};
const logLevel = currentLoggingConfig?.level;
const logPath = currentLoggingConfig?.path;
const effectiveConfig = getEffectiveLogConfig(currentLoggingConfig);

if (logLevel || logPath) {
const logConfigList = [
{
'Log Level': logLevel || 'Not set',
'Log Path': logPath || 'Not set',
},
];
const logConfigList = [
{
Setting: 'Log Level',
Value: effectiveConfig.level,
},
{
Setting: 'Log Path',
Value: effectiveConfig.path,
},
{
Setting: 'Show Console Logs',
Value: effectiveConfig.showConsoleLogs.toString(),
},
];

const headers: TableHeader[] = [
{ value: 'Log Level' },
{ value: 'Log Path' },
];
const headers: TableHeader[] = [{ value: 'Setting' }, { value: 'Value' }];

cliux.table(headers, logConfigList);
} else {
cliux.print(`error: ${messageHandler.parse('CLI_CONFIG_LOG_NO_CONFIG')}`, { color: 'red' });
}
cliux.table(headers, logConfigList);
cliux.print('\nNote: Absolute paths are displayed. Relative paths are resolved from current working directory.', {
color: 'dim',
});
} catch (error) {
cliux.error('error', error);
}
Expand Down
67 changes: 41 additions & 26 deletions packages/contentstack-config/src/commands/config/set/log.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,75 @@
import { Command } from '@contentstack/cli-command';
import { cliux, flags, configHandler, FlagInput, messageHandler } from '@contentstack/cli-utilities';
import { interactive } from '../../../utils';
import { resolveLogPath } from '../../../utils/log-config-defaults';
import * as path from 'path';

export default class LogSetCommand extends Command {
static description = 'Set logging configuration for CLI';

static flags: FlagInput = {
'level': flags.string({
description: 'Set the log level for the CLI.',
level: flags.string({
description: 'Set the log level for the CLI. Defaults to "info" if not specified.',
options: ['debug', 'info', 'warn', 'error'],
}),
'path': flags.string({
description: 'Specify the file path where logs should be saved.',
path: flags.string({
description:
'Specify the directory path where logs should be saved. Supports both relative and absolute paths. Defaults to ~/.contentstack/logs if not specified.',
}),
'show-console-logs': flags.boolean({
description: 'Enable console logging.',
allowNo: true, // no-show-console-logs
default: false,
})
}),
};


static examples = [
'csdx config:set:log',
'csdx config:set:log --level debug --path ./logs/app.log --show-console-logs',
'csdx config:set:log --level debug',
'csdx config:set:log --path ./logs',
'csdx config:set:log --level debug --path ./logs --show-console-logs',
'csdx config:set:log --no-show-console-logs',
'csdx config:set:log --level warn --show-console-logs',
'csdx config:set:log --path ~/custom/logs',
'csdx config:set:log --path /var/log/contentstack',
];

async run() {
try {
const { flags } = await this.parse(LogSetCommand);
const currentLoggingConfig = configHandler.get('log') || {};
if (flags['level'] !== undefined) {
currentLoggingConfig.level = flags['level'];
}

let logLevel: string = flags['level'];
let logPath: string = flags['path'];
const showConsoleLogs: boolean = flags['show-console-logs'];

// Interactive prompts if not passed via flags
if (!logLevel) {
logLevel = await interactive.askLogLevel();
if (flags['path'] !== undefined) {
// Convert to absolute path and ensure it's a directory
let resolvedPath = resolveLogPath(flags['path']);
const pathExt = path.extname(resolvedPath);
if (pathExt && pathExt.length > 0) {
resolvedPath = path.dirname(resolvedPath);
}

currentLoggingConfig.path = resolvedPath;
}

if (!logPath) {
logPath = await interactive.askLogPath();
if (flags['show-console-logs'] !== undefined) {
currentLoggingConfig['show-console-logs'] = flags['show-console-logs'];
}
configHandler.set('log', currentLoggingConfig);

const currentLoggingConfig = configHandler.get('log') || {};
if (logLevel) currentLoggingConfig.level = logLevel;
if (logPath) currentLoggingConfig.path = logPath;
currentLoggingConfig['show-console-logs'] = showConsoleLogs;
if (flags['level'] !== undefined) {
cliux.success(messageHandler.parse('CLI_CONFIG_LOG_LEVEL_SET', currentLoggingConfig.level));
}

configHandler.set('log', currentLoggingConfig);
if (flags['path'] !== undefined) {
cliux.success(messageHandler.parse('CLI_CONFIG_LOG_PATH_SET', currentLoggingConfig.path));
}

cliux.success(messageHandler.parse('CLI_CONFIG_LOG_LEVEL_SET', logLevel));
cliux.success(messageHandler.parse('CLI_CONFIG_LOG_PATH_SET', logPath));
cliux.success(messageHandler.parse('CLI_CONFIG_LOG_CONSOLE_SET', String(showConsoleLogs)));
cliux.print(messageHandler.parse('CLI_CONFIG_LOG_SET_SUCCESS'), { color: 'green' });
if (flags['show-console-logs'] !== undefined) {
cliux.success(
messageHandler.parse('CLI_CONFIG_LOG_CONSOLE_SET', String(currentLoggingConfig['show-console-logs'])),
);
}
} catch (error) {
cliux.error('error', error);
}
Expand Down
36 changes: 36 additions & 0 deletions packages/contentstack-config/src/utils/log-config-defaults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as path from 'path';
import * as os from 'os';

export const LOG_CONFIG_DEFAULTS = {
LEVEL: 'info',
PATH: path.join(os.homedir(), '.contentstack', 'logs'),
SHOW_CONSOLE_LOGS: false,
} as const;

/**
* Resolves a log path to an absolute path
* @param logPath - The path to resolve
* @returns Absolute path
*/
export function resolveLogPath(logPath: string): string {
if (!logPath) return LOG_CONFIG_DEFAULTS.PATH;

return path.isAbsolute(logPath) ? logPath : path.resolve(process.cwd(), logPath);
}

/**
* Gets the effective log configuration with defaults applied
* @param currentConfig - Current configuration from config handler
* @returns Configuration with defaults applied
*/
export function getEffectiveLogConfig(currentConfig: any = {}) {
const logLevel = currentConfig?.level || LOG_CONFIG_DEFAULTS.LEVEL;
const logPath = resolveLogPath(currentConfig?.path || LOG_CONFIG_DEFAULTS.PATH);
const showConsoleLogs = currentConfig?.['show-console-logs'] ?? LOG_CONFIG_DEFAULTS.SHOW_CONSOLE_LOGS;

return {
level: logLevel,
path: logPath,
showConsoleLogs,
};
}
Loading
Loading