npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@contentstack/cli-bulk-operations

v1.0.0

Published

Contentstack CLI plugin for bulk operations

Readme

cli-bulk-operations

Contentstack CLI plugin for performing bulk operations on your content.

Features

  • Perform bulk operations on Contentstack content
  • Built with TypeScript for type safety
  • Comprehensive test coverage
  • Code quality enforced with ESLint and Prettier
  • Automated CI/CD workflows

Usage

# For CLI 1.x:**

# Install Contentstack CLI
$ npm install -g @contentstack/cli
$ csdx 
running command...
$ csdx (--version|-v)
$ csdx --help [COMMAND]

# Install bulk operations plugin
csdx plugins:install @contentstack/cli-bulk-operations

# Verify installation
csdx cm:stacks:bulk-entries --help
# For CLI 2.x:**

# Install Contentstack CLI
$ npm install -g @contentstack/cli
$ csdx 
running command...
$ csdx (--version|-v)
$ csdx --help [COMMAND]

# Verify installation
csdx cm:stacks:bulk-entries --help

Commands

csdx cm:stacks:bulk-assets

Bulk operations for assets (publish/unpublish/cross-publish)

USAGE
  $ csdx cm:stacks:bulk-assets [-a <value>] [-k <value>] [--operation publish|unpublish] [--environments <value>...]
    [--locales <value>...] [--source-env <value>] [--source-alias <value>] [--publish-mode bulk|single] [--branch
    <value>] [-c <value>] [-y] [--retry-failed <value>] [--revert <value>] [--bulk-operation-file <value>] [--folder-uid
    <value>]

FLAGS
  -a, --alias=<value>                Alias (name) of the management token. You must use either the --alias flag or the
                                     --stack-api-key flag.
  -c, --config=<value>               (optional) The path of the optional configuration JSON file containing all the
                                     options for a single run. Refer to the configure command to create a configuration
                                     file.
  -k, --stack-api-key=<value>        API key of the source stack. You must use either the --stack-api-key flag or the
                                     --alias flag.
  -y, --yes                          Set it to true to process the command with the current configuration.
      --branch=<value>               [default: main] The name of the branch where you want to perform the bulk publish
                                     operation. If you don't mention the branch name, then by default the content from
                                     main branch will be published.
      --bulk-operation-file=<value>  [default: bulk-operation] (optional) Folder path to store operation logs. Creates
                                     separate files for success and failed operations. Default: bulk-operation
      --environments=<value>...      The name of the environment(s) on which entries/assets will be published. In case
                                     of multiple environments, specify their names separated by spaces.
      --folder-uid=<value>           (optional) The UID of the Assets' folder from which the assets need to be
                                     published. The default value is cs_root.
      --locales=<value>...           Locales in which entries/assets will be published, e.g., en-us. In the case of
                                     multiple locales, specify the codes separated by spaces.
      --operation=<option>           Operation to perform (publish/unpublish)
                                     <options: publish|unpublish>
      --publish-mode=<option>        [default: bulk] Publish mode: bulk (uses Bulk Publish API) or single (individual
                                     API calls)
                                     <options: bulk|single>
      --retry-failed=<value>         (optional) Use this option to retry publishing the failed entries/assets from the
                                     logfile. Specify the name of the logfile that lists failed publish calls. If this
                                     option is used, it will override all other flags.
      --revert=<value>               (optional) Revert publish operations from a log folder. Specify the folder path
                                     containing success logs. Works similar to retry-failed.
      --source-alias=<value>         Alias name for source environment delivery token (required for cross-publish). Add
                                     delivery token using: csdx auth:tokens:add
      --source-env=<value>           Source environment for cross-publish

DESCRIPTION
  Bulk operations for assets (publish/unpublish/cross-publish)

EXAMPLES
  $ csdx cm:stacks:bulk-assets --operation publish --environments dev,staging --locales en-us -k blt123

  $ csdx cm:stacks:bulk-assets --operation unpublish --environments prod --locales en-us -a myAlias

  $ csdx cm:stacks:bulk-assets --operation publish --folder-uid cs_root --environments prod --locales en-us -k blt123

  $ csdx cm:stacks:bulk-assets --operation publish --environments prod --locales en-us --publish-mode bulk -k blt123

  $ csdx cm:stacks:bulk-assets --operation publish --source-env production --source-alias prod-delivery --environments staging,dev --locales en-us -a myAlias

  $ csdx cm:stacks:bulk-assets --retry-failed ./bulk-operation -a myAlias

  $ csdx cm:stacks:bulk-assets --revert ./bulk-operation -a myAlias

See code: src/commands/cm/stacks/bulk-assets.ts

csdx cm:stacks:bulk-entries

Bulk operations for entries (publish/unpublish/cross-publish)

USAGE
  $ csdx cm:stacks:bulk-entries [-a <value>] [-k <value>] [--operation publish|unpublish] [--environments <value>...]
    [--locales <value>...] [--source-env <value>] [--source-alias <value>] [--publish-mode bulk|single] [--branch
    <value>] [-c <value>] [-y] [--retry-failed <value>] [--revert <value>] [--bulk-operation-file <value>]
    [--content-types <value>...] [--filter draft|modified|non-localized|unpublished] [--include-variants] [--api-version
    <value>]

FLAGS
  -a, --alias=<value>                Alias (name) of the management token. You must use either the --alias flag or the
                                     --stack-api-key flag.
  -c, --config=<value>               (optional) The path of the optional configuration JSON file containing all the
                                     options for a single run. Refer to the configure command to create a configuration
                                     file.
  -k, --stack-api-key=<value>        API key of the source stack. You must use either the --stack-api-key flag or the
                                     --alias flag.
  -y, --yes                          Set it to true to process the command with the current configuration.
      --api-version=<value>          [default: 3.2] API version to be used. Values [Default: 3, Nested Reference
                                     Publishing: 3.2].
      --branch=<value>               [default: main] The name of the branch where you want to perform the bulk publish
                                     operation. If you don't mention the branch name, then by default the content from
                                     main branch will be published.
      --bulk-operation-file=<value>  [default: bulk-operation] (optional) Folder path to store operation logs. Creates
                                     separate files for success and failed operations. Default: bulk-operation
      --content-types=<value>...     Content type UIDs to perform operation on. If not provided, operates on all content
                                     types.
      --environments=<value>...      The name of the environment(s) on which entries/assets will be published. In case
                                     of multiple environments, specify their names separated by spaces.
      --filter=<option>              Filter entries by status
                                     <options: draft|modified|non-localized|unpublished>
      --include-variants             Include variant entries in operation
      --locales=<value>...           Locales in which entries/assets will be published, e.g., en-us. In the case of
                                     multiple locales, specify the codes separated by spaces.
      --operation=<option>           Operation to perform (publish/unpublish)
                                     <options: publish|unpublish>
      --publish-mode=<option>        [default: bulk] Publish mode: bulk (uses Bulk Publish API) or single (individual
                                     API calls)
                                     <options: bulk|single>
      --retry-failed=<value>         (optional) Use this option to retry publishing the failed entries/assets from the
                                     logfile. Specify the name of the logfile that lists failed publish calls. If this
                                     option is used, it will override all other flags.
      --revert=<value>               (optional) Revert publish operations from a log folder. Specify the folder path
                                     containing success logs. Works similar to retry-failed.
      --source-alias=<value>         Alias name for source environment delivery token (required for cross-publish). Add
                                     delivery token using: csdx auth:tokens:add
      --source-env=<value>           Source environment for cross-publish

DESCRIPTION
  Bulk operations for entries (publish/unpublish/cross-publish)

EXAMPLES
  $ csdx cm:stacks:bulk-entries --operation publish --environments dev --locales en-us -k blt123

  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog,article --environments dev --locales en-us -k blt123

  $ csdx cm:stacks:bulk-entries --operation unpublish --content-types blog --environments prod --locales en-us -a myAlias

  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --source-env production --source-alias prod-delivery --environments staging --locales en-us -a myAlias

  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --publish-mode bulk -k blt123

  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --filter modified -k blt123

  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --include-variants -k blt123

  $ csdx cm:stacks:bulk-entries --retry-failed ./bulk-operation

  $ csdx cm:stacks:bulk-entries --revert ./bulk-operation

See code: src/commands/cm/stacks/bulk-entries.ts

Requirements

  • Node.js >= 22
  • Contentstack account with API credentials

Development

Setup

# Clone the repository
git clone https://github.com/contentstack/cli-bulk-operations.git
cd cli-bulk-operations

# Install dependencies
npm install

# Build the project
npm run build

Available Scripts

  • npm run build - Build the TypeScript project
  • npm run lint - Run ESLint checks
  • npm run lint:fix - Fix ESLint issues automatically
  • npm run format - Format code with Prettier
  • npm run format:check - Check code formatting
  • npm test - Run tests
  • npm run test:coverage - Run tests with coverage
  • npm run clean - Clean build artifacts

Testing

This project uses Mocha for testing with comprehensive coverage reporting.

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests with detailed coverage report
npm run test:coverage:report

Code Quality

Linting

The project uses ESLint with TypeScript-specific rules:

npm run lint

Formatting

Code formatting is handled by Prettier:

npm run format

Git Hooks

Husky is configured to run checks before commits and pushes:

  • Pre-commit: Runs lint-staged to check and format staged files
  • Pre-push: Runs linting and tests to ensure code quality

CI/CD

GitHub Actions Workflows

  1. PR Checks (pr-checks.yml): Runs on pull requests

    • Lint checks
    • Test execution with coverage
    • Build verification
  2. Test (test.yml): Runs on pushes and PRs

    • Tests across multiple Node.js versions (18, 20, 22)
    • Coverage reporting to Codecov
  3. Release (release.yml): Runs on main branch

    • Automated npm publishing
    • GitHub release creation
    • Semantic versioning

Changelog

See CHANGELOG.md for release history.