Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 2 additions & 22 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: acb2fc21dd3481f162aedaccecbe45d565b3297957345044a12aa50d2850ac4e
- filename: packages/contentstack-variants/test/unit/import/experiences.test.ts
checksum: 6142418bafea6454a72b313d933deb494ce4ea1d8cead7ef918c10e283c2c603
- filename: packages/contentstack-variants/test/unit/export/variant-entries.test.ts
checksum: e150faeefa7b3586b70a6f454c1f68efe05526f582977dba28243b1e47606a42
- filename: packages/contentstack-variants/test/unit/export/experiences.test.ts
checksum: eb9c989dd14373a90e8866ba3350245d3c06e8ba43cfebb24f40c1106b2e6b95
- filename: packages/contentstack-variants/test/unit/utils/personalization-api-adapter.test.ts
checksum: d729c9586d3a19e321d79e490790b9d0aa345f81917376199d962de68317fae1
- filename: packages/contentstack-variants/test/unit/import/variant-entries.test.ts
checksum: 1337a680c98cfa7d4be2e48db284c8e44866f5eee1e72afb4ba52c2264c3850f
- filename: packages/contentstack-export/src/export/modules/taxonomies.ts
checksum: b6d077118280bc88385405f504f921468a9fd490ac37a4a21f741be729fd1ca3
- filename: packages/contentstack-import/test/unit/import/modules/base-class.test.ts
checksum: fe372852d5f2f3f57ef62c603406c30ccecdb444c17133ac0b21dda399b962c0
- filename: packages/contentstack-export/test/unit/export/modules/taxonomies.test.ts
checksum: cab2ad4d897d23f04f988c1f018a9583ab7f0ee1815994d7bc9fce23dea70073
- filename: packages/contentstack-query-export/src/core/query-executor.ts
checksum: 708f8a9bc837ed15342fe73920588978a97cab9002c401dbc6ad7030e0238f48
- filename: packages/contentstack-bulk-operations/test/unit/commands/bulk-am-assets.test.ts
checksum: f8d21db7db0ca2eebe7cc40af0a59f02e74e1689efb6d50a1072dc5ca3e03e9b
- filename: packages/contentstack-asset-management/src/query-export/cs-assets-query-exporter.ts
checksum: f7d03d649ab0b6d45985fcd9bd8ae374ea34ad5c44cb9365af92b3c9ae4728e6
- filename: packages/contentstack-import/src/commands/cm/stacks/import.ts
checksum: d50d85534c8779b99e46b0fb8a765c0b4e5a30881007346852c254e8e2604c03
version: '1.0'
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { flags, handleAndLogError, log } from '@contentstack/cli-utilities';

import { AssetPublishData, BulkOperationResult, OperationType, ResourceType } from '../../../interfaces';
import { BaseBulkCommand } from '../../../base-bulk-command';
import { $t, messages, fetchAssets, scanDataDirStats, BATCH_CONSTANTS, categorizeByScanStatus } from '../../../utils';
import { $t, messages, fetchAssets, scanDataDirStats, BATCH_CONSTANTS, categorizeByScanStatus, fillMissingFlags } from '../../../utils';
import type { DataDirScanStats } from '../../../utils';
import { AssetService } from '../../../services';

Expand Down Expand Up @@ -63,7 +63,7 @@ export default class BulkAssets extends BaseBulkCommand {
if (flags['data-dir']) {
return flags;
}
return super.resolveFlagsInteractively(flags);
return fillMissingFlags(flags, { promptDataDir: true });
}

async run(): Promise<void> {
Expand Down
5 changes: 5 additions & 0 deletions packages/contentstack-bulk-operations/src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ const interactiveMsg = {
TAXONOMY_UNSUPPORTED_RETRY: 'Retry and revert are not supported for bulk-taxonomies.',
TAXONOMY_UNSUPPORTED_CROSS_PUBLISH: 'Cross-publish is not supported for bulk-taxonomies.',

// Data-dir (backup folder) prompt
USE_DATA_DIR_PROMPT: 'Do you want to publish assets using publish details from an import backup folder (data-dir)?',
ENTER_DATA_DIR: 'Enter the path to the import backup folder (data-dir):',
DATA_DIR_REQUIRED: 'Backup folder path is required',

// Errors
NO_DELIVERY_TOKENS_FOUND:
'No delivery token aliases found. Add one using: csdx auth:tokens:add -a <alias> --delivery-token <token> --api-key <api-key> --environment <source-env> --type delivery',
Expand Down
25 changes: 23 additions & 2 deletions packages/contentstack-bulk-operations/src/utils/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async function promptForSourceAlias(): Promise<string> {
/**
* Fills in missing required flags by prompting the user
*/
export async function fillMissingFlags(flags: any): Promise<any> {
export async function fillMissingFlags(flags: any, options?: { promptDataDir?: boolean }): Promise<any> {
const updatedFlags = { ...flags };

// Skip interactive mode for retry/revert operations
Expand All @@ -169,9 +169,10 @@ export async function fillMissingFlags(flags: any): Promise<any> {
// Check if non-localized filter is used
const isNonLocalized = updatedFlags.filter === FilterType.NON_LOCALIZED;
const needsLocales = !isNonLocalized && (!updatedFlags.locales || updatedFlags.locales.length === 0);
const needsDataDir = options?.promptDataDir && !updatedFlags['data-dir'];

// Only show interactive mode header if we need to prompt
if (needsCredentials || needsOperation || needsEnvironments || needsLocales) {
if (needsCredentials || needsOperation || needsEnvironments || needsLocales || needsDataDir) {
cliux.print(messages.INTERACTIVE_MODE_START, { color: 'cyan' });
didPrompt = true;
}
Expand All @@ -191,6 +192,26 @@ export async function fillMissingFlags(flags: any): Promise<any> {
updatedFlags.operation = await promptForOperation();
}

// 2.5. Data-dir (import backup folder) — alternative to environments/locales for asset publish
if (needsDataDir) {
const useDataDir = await cliux.inquire<boolean>({
type: 'confirm',
name: 'useDataDir',
message: messages.USE_DATA_DIR_PROMPT,
default: false,
});
if (useDataDir) {
updatedFlags['data-dir'] = await cliux.inquire<string>({
type: 'input',
name: 'dataDir',
message: messages.ENTER_DATA_DIR,
validate: (v: string) => (!v?.trim() ? messages.DATA_DIR_REQUIRED : true),
});
cliux.print(messages.INTERACTIVE_MODE_COMPLETE, { color: 'green' });
return updatedFlags;
}
}

// 3. Check for cross-publish mode
const isCrossPublish = updatedFlags['source-env'] || updatedFlags['source-alias'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ export default class ImportCommand extends Command {
backupDir = importConfig.backupDir;
//Note: Final summary is now handled by summary manager
CLIProgressManager.printGlobalSummary();
if (importConfig.assetScanningEnabled) {
cliux.print('\nAsset Scanning is enabled — assets were not published.', { color: 'yellow' });
cliux.print(' Once scanning completes, publish your assets using:', { color: 'yellow' });
cliux.print(` csdx cm:stacks:bulk-assets --data-dir ${backupDir} --stack-api-key ${importConfig.apiKey}`, { color: 'cyan' });
}
this.logSuccessAndBackupMessages(backupDir, importConfig);
// Clear progress module setting now that import is complete
clearProgressModuleSetting();
Expand Down
Loading