Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
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
fa280ea
Merge pull request #2107 from contentstack/fix/DX-3465
aman19K Sep 5, 2025
163a405
Delete secrets-scan.yml
aravindbuilt Sep 8, 2025
e824fac
Updated codeowners
aravindbuilt Sep 8, 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
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
29 changes: 0 additions & 29 deletions .github/workflows/secrets-scan.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fileignoreconfig:
- filename: package-lock.json
checksum: b7a69ac42575d552fa99e0f7b62fa16485cdb8bb83efec3c5d46c22537e8bc37
checksum: cb0cdd68b035c13d2f3b8a9e44f0a5da4418f54db6c659ad04fd3933bbe749f4
- filename: pnpm-lock.yaml
checksum: 62fc7744149464cc3a0b285544e90739d48e8e1384ac211d4799389c3c78db10
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 @@ -87,4 +87,4 @@ fileignoreconfig:
checksum: 7db02c6f2627400b28fc96d505bf074d477080a45ba13943709d4845b6ca0908
- filename: packages/contentstack-import/src/utils/backup-handler.ts
checksum: 4f7a8bea92ebffbc34a0979b3a63fef327562a899b773481d67a675140cfa4bf
version: "1.0"
version: "1.0"
12 changes: 11 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
* @contentstack/security-admin
* @contentstack/devex-pr-reviewers

.github/workflows/sca-scan.yml @contentstack/security-admin

.github/workflows/codeql-anaylsis.yml @contentstack/security-admin

**/.snyk @contentstack/security-admin

.github/workflows/policy-scan.yml @contentstack/security-admin

.github/workflows/issues-jira.yml @contentstack/security-admin
3,971 changes: 2,026 additions & 1,945 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
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@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/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@contentstack/cli-cm-export": "~1.20.1",
"@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