Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9edbb33
chore: update inquirer and node types across multiple packages, refac…
harshitha-cstk Feb 20, 2026
f42ff37
update package-lock
harshitha-cstk Feb 20, 2026
b1dafff
test: fix interactive tests by stubbing additional functions and upda…
harshitha-cstk Feb 20, 2026
0da0985
chore: update @types/node and @typescript-eslint/parser versions in p…
harshitha-cstk Feb 20, 2026
60c88cd
chore: update .gitignore to include tsconfig.tsbuildinfo
harshitha-cstk Feb 20, 2026
24e4950
chore: update test script to use 'compile' instead of 'build'
harshitha-cstk Feb 20, 2026
25d2d64
test: enhance bootstrapping tests by setting authorisation type and u…
harshitha-cstk Feb 23, 2026
e64012a
test: enable previously skipped test for management token retrieval a…
harshitha-cstk Feb 23, 2026
95ab9df
refactor: enhance CLI interface by adding InquirerQuestion and Answer…
harshitha-cstk Feb 23, 2026
5dd254d
feat(audit): validate referenced entry content types in entries audit
cs-raj Feb 23, 2026
c7ecbba
Remove Redundant code block
cs-raj Feb 24, 2026
aa08882
Merge pull request #2423 from contentstack/feat/DX-3800
cs-raj Feb 24, 2026
2d1ad10
fix: Skipping lytics audience creation
cs-raj Feb 24, 2026
db01c8a
fix(personalize): filter lytics audiences in experience variants duri…
cs-raj Feb 24, 2026
f95b012
Merge branch 'v2-beta-dev' into enh/dx-362-inquirer-v12
harshitha-cstk Feb 25, 2026
7628fd8
Merge branch 'v2-beta-dev' into enh/dx-362-inquirer-v12
harshitha-cstk Feb 25, 2026
cbfec0a
Merge pull request #2427 from contentstack/fix/DX-3445
cs-raj Feb 25, 2026
63b088d
Update package lock and pnpm lock
harshitha-cstk Feb 25, 2026
abdd358
version bump
harshitha-cstk Feb 27, 2026
44fd133
Merge pull request #2435 from contentstack/fix/version-bump
harshithad0703 Feb 27, 2026
d65b8c8
Merge pull request #2431 from contentstack/development
harshithad0703 Feb 27, 2026
47c1c8a
Merge pull request #2436 from contentstack/staging
harshithad0703 Mar 2, 2026
d58b86f
Update sca-scan.yml
dhavaljain999 Mar 2, 2026
ba6bf58
Update sca-scan.yml
dhavaljain999 Mar 4, 2026
6a13b99
enhance error handling in CLI interface for better user experience
harshitha-cstk Mar 6, 2026
d1150e2
Merge branch 'v2-dev-bugfix' into enh/dx-362-inquirer-v12
harshitha-cstk Mar 6, 2026
08a166c
Merge branch 'main' into enh/dx-362-inquirer-v12
harshitha-cstk Mar 6, 2026
a7cb8b7
Add pnpm setup and Node.js version to workflow
Aravind-Kumar-cstk Mar 6, 2026
a64e69a
Update sca-scan.yml
Aravind-Kumar-cstk Mar 6, 2026
60ceac4
Update sca-scan.yml
Aravind-Kumar-cstk Mar 6, 2026
e4668e0
Update sca-scan.yml
Aravind-Kumar-cstk Mar 6, 2026
91a0b5d
update pnpm lock
harshitha-cstk Mar 9, 2026
caec548
update pnpm lock
harshitha-cstk Mar 11, 2026
48b61b1
Merge branch 'v2-dev-bugfix' into enh/dx-362-inquirer-v12
harshitha-cstk Mar 11, 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ snyk_output.log
.cursor/rules/snyk_rules.mdc
**/migration-logs
**/migration-logs/**
*.logs
*.logs
tsconfig.tsbuildinfo
2,965 changes: 1,930 additions & 1,035 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
"postpack": "rm -f oclif.manifest.json",
"prepack": "pnpm compile && oclif manifest && oclif readme",
"version": "oclif readme && git add README.md",
"test": "npm run build && npm run test:e2e",
"test": "npm run compile && npm run test:e2e",
Comment thread
harshithad0703 marked this conversation as resolved.
Outdated
"test:e2e": "nyc mocha \"test/**/*.test.js\" || exit 0",
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~2.0.0-beta.8",
"@contentstack/cli-command": "~2.0.0-beta",
"@contentstack/cli-utilities": "~2.0.0-beta",
"@contentstack/cli-config": "~2.0.0-beta.2",
"@contentstack/cli-utilities": "~2.0.0-beta",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.37",
"inquirer": "8.2.7",
"inquirer": "12.11.1",
"mkdirp": "^1.0.4",
"tar": "^7.5.7"
},
"devDependencies": {
"@oclif/test": "^4.1.13",
"@types/inquirer": "^9.0.8",
"@types/mkdirp": "^1.0.2",
"@types/node": "^14.18.63",
"@types/node": "^18.11.9",
"@types/tar": "^6.1.13",
"chai": "^4.5.0",
"eslint": "^8.57.1",
Expand All @@ -41,7 +41,7 @@
"oclif": "^4.17.46",
"tmp": "^0.2.5",
"ts-node": "^8.10.2",
"typescript": "^4.9.5"
"typescript": "^5.9.3"
},
"engines": {
"node": ">=14.0.0"
Expand Down Expand Up @@ -73,4 +73,4 @@
}
},
"repository": "contentstack/cli"
}
}
9 changes: 4 additions & 5 deletions packages/contentstack-bootstrap/src/bootstrap/interactive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const inquirer = require('inquirer');
import inquirer from 'inquirer';
import { cliux, pathValidator } from '@contentstack/cli-utilities';

import messageHandler from '../messages';
Expand Down Expand Up @@ -50,15 +50,14 @@ export async function inquireCloneDirectory(): Promise<string> {
}

// Ask for the custom path
let selectedCustomPath = await inquirer.prompt([
const selectedCustomPath = await inquirer.prompt([
{
type: 'string',
type: 'input',
name: 'path',
message: messageHandler.parse('CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY'),
},
]);
selectedCustomPath = pathValidator(selectedCustomPath.path);
return selectedCustomPath;
return pathValidator(selectedCustomPath.path);
}

export async function inquireGithubAccessToken(): Promise<any> {
Expand Down
23 changes: 16 additions & 7 deletions packages/contentstack-bootstrap/test/bootstrap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Bootstrapping an app', () => {
configHandlerTokens = { 'test-alias': { token: aliasToken } },
} = options;

// configHandler stub
// configHandler stub (tokens only when hasAlias; do not stub get for auth - use configHandler.set('authorisationType', 'OAUTH') in tests instead)
if (hasAlias) {
sandbox.stub(configHandler, 'get').withArgs('tokens').returns(configHandlerTokens);
}
Expand Down Expand Up @@ -371,9 +371,8 @@ describe('Bootstrapping an app', () => {
},
});

// Mock region and cmaHost
command.region = mock.region;
command.cmaHost = mock.region.cma;
// Mock region and cmaHost (base class getter uses _region, then cmaHost uses region)
command._region = mock.region;

// Mock managementSDKClient
const managementAPIClientStub = {
Expand Down Expand Up @@ -408,6 +407,7 @@ describe('Bootstrapping an app', () => {
sandbox.restore();
sandbox = sinon.createSandbox();
setupStubs();
configHandler.set('authorisationType', 'OAUTH');

const BootstrapCommand = require('../lib/commands/cm/bootstrap').default;
const command = new BootstrapCommand([], {});
Expand All @@ -417,6 +417,8 @@ describe('Bootstrapping an app', () => {
sandbox.stub(interactive, 'inquireAppType').resolves('starterapp');
sandbox.stub(interactive, 'inquireApp').resolves(mock.appConfig);
sandbox.stub(interactive, 'inquireCloneDirectory').resolves('/test/path');
sandbox.stub(interactive, 'inquireLivePreviewSupport');
sandbox.stub(interactive, 'inquireRunDevServer');

// Mock config
const config = require('../lib/config');
Expand Down Expand Up @@ -462,6 +464,7 @@ describe('Bootstrapping an app', () => {
sandbox.restore();
sandbox = sinon.createSandbox();
setupStubs();
configHandler.set('authorisationType', 'OAUTH');

const BootstrapCommand = require('../lib/commands/cm/bootstrap').default;
const command = new BootstrapCommand([], {});
Expand All @@ -471,6 +474,8 @@ describe('Bootstrapping an app', () => {
sandbox.stub(interactive, 'inquireAppType').resolves('starterapp');
sandbox.stub(interactive, 'inquireApp').resolves(mock.appConfig);
sandbox.stub(interactive, 'inquireCloneDirectory').resolves('/test/path');
sandbox.stub(interactive, 'inquireLivePreviewSupport');
sandbox.stub(interactive, 'inquireRunDevServer');

// Mock config
const config = require('../lib/config');
Expand Down Expand Up @@ -516,6 +521,7 @@ describe('Bootstrapping an app', () => {
sandbox.restore();
sandbox = sinon.createSandbox();
setupStubs();
configHandler.set('authorisationType', 'OAUTH');

const BootstrapCommand = require('../lib/commands/cm/bootstrap').default;
const command = new BootstrapCommand([], {});
Expand Down Expand Up @@ -572,6 +578,7 @@ describe('Bootstrapping an app', () => {
sandbox.restore();
sandbox = sinon.createSandbox();
setupStubs();
configHandler.set('authorisationType', 'OAUTH');

const BootstrapCommand = require('../lib/commands/cm/bootstrap').default;
const command = new BootstrapCommand([], {});
Expand Down Expand Up @@ -619,21 +626,23 @@ describe('Bootstrapping an app', () => {
// Verify that appType is set correctly
expect(bootstrapOptions).to.not.be.null;
expect(bootstrapOptions.appType).to.equal('sampleapp');
// Verify that inquireApp was called with sampleApps
expect(interactive.inquireApp.calledWith(config.sampleApps)).to.be.true;
// Verify that inquireApp was called with sampleApps (config.default in compiled CJS)
expect(interactive.inquireApp.calledWith(config.default.sampleApps)).to.be.true;
});

it('should handle app-name flag correctly', async () => {
sandbox.restore();
sandbox = sinon.createSandbox();
setupStubs();
configHandler.set('authorisationType', 'OAUTH');

const BootstrapCommand = require('../lib/commands/cm/bootstrap').default;
const command = new BootstrapCommand([], {});

// Mock interactive functions
// Mock interactive functions (stub inquireApp so .called exists for assertion)
const interactive = require('../lib/bootstrap/interactive');
sandbox.stub(interactive, 'inquireAppType').resolves('starterapp');
sandbox.stub(interactive, 'inquireApp').resolves(mock.appConfig);
sandbox.stub(interactive, 'inquireCloneDirectory').resolves('/test/path');
sandbox.stub(interactive, 'inquireLivePreviewSupport').resolves(false);
sandbox.stub(interactive, 'inquireRunDevServer').resolves(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const { expect } = require('chai');
const sinon = require('sinon');
const inquirer = require('inquirer');
// Inquirer v12 CJS export is { default: { prompt, ... } }; use default so stubs apply to what lib uses
const inquirer = require('inquirer').default || require('inquirer');
const { inquireRunDevServer } = require('../lib/bootstrap/interactive');
const messages = require('../messages/index.json');

Expand Down
15 changes: 7 additions & 8 deletions packages/contentstack-bootstrap/test/interactive.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const { expect } = require('chai');
const sinon = require('sinon');
const inquirer = require('inquirer');
// Inquirer v12 CJS export is { default: { prompt, ... } }; use default so stubs apply to what lib uses
const inquirer = require('inquirer').default || require('inquirer');
const {
inquireApp,
inquireCloneDirectory,
Expand All @@ -11,6 +14,7 @@ const {
continueBootstrapCommand,
} = require('../lib/bootstrap/interactive');
const messages = require('../messages/index.json');
const { pathValidator } = require('@contentstack/cli-utilities');

describe('Interactive Functions Tests', () => {
let sandbox;
Expand Down Expand Up @@ -101,30 +105,25 @@ describe('Interactive Functions Tests', () => {
.resolves({ path: 'Other' })
.onSecondCall()
.resolves({ path: customPath });
const pathValidatorStub = sandbox.stub(require('@contentstack/cli-utilities'), 'pathValidator').returns(customPath);

const result = await inquireCloneDirectory();

expect(result).to.equal(customPath);
expect(result).to.equal(pathValidator(customPath));
expect(inquirer.prompt.calledTwice).to.be.true;
expect(pathValidatorStub.calledOnce).to.be.true;
});

it('should validate custom path using pathValidator', async () => {
const rawPath = '/some/path';
const validatedPath = '/validated/path';
sandbox
.stub(inquirer, 'prompt')
.onFirstCall()
.resolves({ path: 'Other' })
.onSecondCall()
.resolves({ path: rawPath });
const pathValidatorStub = sandbox.stub(require('@contentstack/cli-utilities'), 'pathValidator').returns(validatedPath);

const result = await inquireCloneDirectory();

expect(pathValidatorStub.calledWith(rawPath)).to.be.true;
expect(result).to.equal(validatedPath);
expect(result).to.equal(pathValidator(rawPath));
});
});

Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"chalk": "^4.1.2",
"inquirer": "8.2.7",
"inquirer": "12.11.1",
"lodash": "^4.17.23",
"merge": "^2.1.1",
"ora": "^5.4.1",
Expand All @@ -24,7 +24,7 @@
"@oclif/test": "^4.1.13",
"@types/chai": "^4.3.0",
"@types/mocha": "^10.0.0",
"@types/node": "^14.18.63",
"@types/node": "^18.11.9",
"@types/sinon": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"chai": "^4.5.0",
Expand All @@ -35,7 +35,7 @@
"oclif": "^4.17.46",
"sinon": "^21.0.1",
"ts-node": "^10.9.2",
"typescript": "^4.9.5"
"typescript": "^5.9.3"
},
"engines": {
"node": ">=14.0.0"
Expand Down Expand Up @@ -78,4 +78,4 @@
"cm:stacks:clone": "CLN"
}
}
}
}
3 changes: 1 addition & 2 deletions packages/contentstack-clone/src/core/util/clone-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ export class CloneHandler {
}

displayBackOptionMessage(): void {
const ui = new inquirer.ui.BottomBar();
ui.updateBottomBar(chalk.cyan('\nPress shift & left arrow together to undo the operation\n'));
process.stdout.write(chalk.cyan('\nPress shift & left arrow together to undo the operation\n'));
}

setBackKeyPressHandler(backKeyPressHandler: (...args: any[]) => void): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,6 @@ describe('CloneHandler - Commands', () => {
const configHandler = require('@contentstack/cli-utilities').configHandler;
configHandlerGetStub = sandbox.stub(configHandler, 'get').returns(undefined);

// Stub inquirer.ui.BottomBar to prevent hanging in displayBackOptionMessage
sandbox.stub(inquirer.ui, 'BottomBar').returns({
updateBottomBar: sandbox.stub(),
} as any);

// Stub ora spinner - following import plugin pattern
const oraModule = require('ora');
const mockSpinner = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,6 @@ describe('CloneHandler - Execution', () => {
stack: sandbox.stub(),
};
handler.setClient(mockClient);
// Stub inquirer.ui.BottomBar to prevent hanging
sandbox.stub(inquirer.ui, 'BottomBar').returns({
updateBottomBar: sandbox.stub(),
} as any);
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@ describe('CloneHandler - Helpers', () => {
});

it('should display back option message', () => {
const uiStub = {
updateBottomBar: sandbox.stub(),
};
sandbox.stub(inquirer.ui, 'BottomBar').returns(uiStub as any);

const writeStub = sandbox.stub(process.stdout, 'write');
handler.displayBackOptionMessage();

expect(uiStub.updateBottomBar.calledOnce).to.be.true;
expect(writeStub.calledOnce).to.be.true;
expect(writeStub.firstCall.args[0]).to.include('Press shift & left arrow together to undo');
writeStub.restore();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ describe('CloneHandler - Stack', () => {
const configHandler = require('@contentstack/cli-utilities').configHandler;
configHandlerGetStub = sandbox.stub(configHandler, 'get').returns(undefined);

// Stub inquirer.ui.BottomBar to prevent hanging in displayBackOptionMessage
sandbox.stub(inquirer.ui, 'BottomBar').returns({
updateBottomBar: sandbox.stub(),
} as any);

const config: CloneConfig = {
cloneContext: {
command: 'test',
Expand Down
5 changes: 2 additions & 3 deletions packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
"dependencies": {
"@contentstack/cli-command": "~2.0.0-beta",
"@contentstack/cli-utilities": "~2.0.0-beta",
"@inquirer/prompts": "^8.2.1",
"@oclif/core": "^4.8.0",
"@oclif/plugin-help": "^6.2.32",
"fast-csv": "^4.3.6",
"inquirer": "8.2.7",
"inquirer-checkbox-plus-prompt": "1.4.2"
"fast-csv": "^4.3.6"
},
"devDependencies": {
"@oclif/test": "^4.1.13",
Expand Down
Loading
Loading