diff --git a/.github/config/release.json b/.github/config/release.json index f43492a73..2e417b8e4 100755 --- a/.github/config/release.json +++ b/.github/config/release.json @@ -10,6 +10,8 @@ "seed": false, "bootstrap": false, "branches": false, - "apps-cli": false + "apps-cli": false, + "migrate-rte": false, + "bulk-operations": false } } diff --git a/.github/workflows/release-v2-beta-plugins.yml b/.github/workflows/release-v2-beta-plugins.yml index fa5a42c6e..922a7837a 100644 --- a/.github/workflows/release-v2-beta-plugins.yml +++ b/.github/workflows/release-v2-beta-plugins.yml @@ -150,3 +150,21 @@ jobs: token: ${{ secrets.NPM_TOKEN }} package: ./packages/contentstack-apps-cli/package.json tag: beta + + # Migrate RTE + - name: Publishing migrate-rte (Beta) + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-migrate-rte/package.json + access: public + tag: beta + + # Bulk Operations + - name: Publishing bulk-operations (Beta) + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-bulk-operations/package.json + access: public + tag: beta diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 853bb54e9..e5acae444 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -70,3 +70,11 @@ jobs: - name: Run tests for Contentstack Apps CLI working-directory: ./packages/contentstack-apps-cli run: npm run test:unit:report:json + + - name: Run tests for Contentstack Migrate RTE + working-directory: ./packages/contentstack-migrate-rte + run: npm test + + - name: Run tests for Contentstack Bulk Operations + working-directory: ./packages/contentstack-bulk-operations + run: npm test diff --git a/AGENTS.md b/AGENTS.md index cb3fd24d1..61605dbeb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,7 +7,7 @@ | Field | Detail | | --- | --- | | **Name:** | Contentstack CLI plugins (pnpm monorepo; root package name `csdx`) | -| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, seed, audit, variants, Developer Hub apps, etc.). | +| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, migrate RTE, bulk operations, seed, audit, variants, Developer Hub apps, etc.). | | **Out of scope (if any):** | The **core** CLI aggregation lives in the separate `cli` monorepo; this repo ships plugin packages only. | ## Tech stack (at a glance) @@ -48,6 +48,20 @@ CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other - **v1 / v2:** Maintain on `v1-dev` (1.x CLI deps) and `v2-dev` / `v2-beta` (2.x beta deps) branches; align `@contentstack/cli-command` and `@contentstack/cli-utilities` versions with the target CLI line. - **Docs:** OCLIF / `app:*` commands → [contentstack-cli](skills/contentstack-cli/SKILL.md#apps-cli-commands-app); SDK, manifests, GraphQL, HTTP → [framework](skills/framework/SKILL.md#apps-cli-plugin-contentstackapps-cli) +## Migrate RTE plugin (`@contentstack/cli-cm-migrate-rte`) + +- **Package path:** [packages/contentstack-migrate-rte](packages/contentstack-migrate-rte) +- **npm name:** `@contentstack/cli-cm-migrate-rte` (unchanged) +- **Migrated from:** [contentstack/cli-cm-migrate-rte](https://github.com/contentstack/cli-cm-migrate-rte) — see [MIGRATE-RTE-MIGRATION.md](MIGRATE-RTE-MIGRATION.md) +- **Command:** `csdx cm:entries:migrate-html-rte` — JS sources in `src/`; `pnpm --filter @contentstack/cli-cm-migrate-rte run build` (`oclif manifest`) and `test` (see [dev-workflow](skills/dev-workflow/SKILL.md)) + +## Bulk operations plugin (`@contentstack/cli-bulk-operations`) + +- **Package path:** [packages/contentstack-bulk-operations](packages/contentstack-bulk-operations) +- **npm name:** `@contentstack/cli-bulk-operations` (unchanged) +- **Migrated from:** [contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations) — see [BULK-OPERATIONS-MIGRATION.md](BULK-OPERATIONS-MIGRATION.md) (commands + repository) +- **Commands:** `csdx cm:stacks:bulk-entries`, `csdx cm:stacks:bulk-assets`, `csdx cm:stacks:bulk-taxonomies` — see [dev-workflow](skills/dev-workflow/SKILL.md) + ## Using Cursor (optional) If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else. diff --git a/BULK-OPERATIONS-MIGRATION.md b/BULK-OPERATIONS-MIGRATION.md index fecea2cb6..576e83c0b 100644 --- a/BULK-OPERATIONS-MIGRATION.md +++ b/BULK-OPERATIONS-MIGRATION.md @@ -1,6 +1,16 @@ # 🔄 Migration Guide: From Bulk Publish to Bulk Operations Commands > **Migrating from @contentstack/cli-cm-bulk-publish (v1.x) to New Unified Commands @contentstack/cli-bulk-operations (v1.x)** + +## Repository + +| Before | After | +| --- | --- | +| [contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations) | [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) → `packages/contentstack-bulk-operations` | +| Issues on standalone repo | [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) | + +npm package name unchanged: **`@contentstack/cli-bulk-operations`**. Local dev: `pnpm --filter @contentstack/cli-bulk-operations run build` / `test` from cli-plugins (or cli-dev-workspace). + --- ## What Changed? diff --git a/MIGRATE-RTE-MIGRATION.md b/MIGRATE-RTE-MIGRATION.md new file mode 100644 index 000000000..d46ea6917 --- /dev/null +++ b/MIGRATE-RTE-MIGRATION.md @@ -0,0 +1,40 @@ +# Migrate RTE migration: standalone repo → cli-plugins monorepo + +## Summary + +**@contentstack/cli-cm-migrate-rte** moved from [contentstack/cli-cm-migrate-rte](https://github.com/contentstack/cli-cm-migrate-rte) into [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) at **`packages/contentstack-migrate-rte`**. + +The npm package name and command **`csdx cm:entries:migrate-html-rte`** are unchanged. + +## Repository and issues + +| Before | After | +| --- | --- | +| `github.com/contentstack/cli-cm-migrate-rte` | `github.com/contentstack/cli-plugins` → `packages/contentstack-migrate-rte` | +| Issues on standalone repo | [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) | + +## Version lines (1.x vs 2.x) + +| CLI line | cli-plugins branch | Plugin notes | +| --- | --- | --- | +| **1.x** | `v1-dev` / `v1-beta` | 1.x-compatible `cli-command` / `cli-utilities` | +| **2.x beta** | `v2-dev` / `v2-beta` | e.g. `2.0.0-beta.x`; uses `@contentstack/json-rte-serializer`, jsdom | + +## Install + +```bash +csdx plugins:install @contentstack/cli-cm-migrate-rte +# or +npm install -g @contentstack/cli-cm-migrate-rte +``` + +## Local development + +```bash +cd cli-dev-workspace +pnpm install +pnpm --filter @contentstack/cli-cm-migrate-rte run build +pnpm --filter @contentstack/cli-cm-migrate-rte test +``` + +Core CLI: add `@contentstack/cli-cm-migrate-rte` to `cli/packages/contentstack` dependencies and `oclif.plugins` (use `workspace:*` in cli-dev-workspace). diff --git a/MIGRATION.md b/MIGRATION.md index d9fe2acfe..41922466f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -158,6 +158,8 @@ npm install -g @contentstack/cli-cm-migrate-rte csdx plugins:install @contentstack/cli-cm-migrate-rte@2.0.0-beta ``` +**Source repository:** Plugin code lives in [cli-plugins](https://github.com/contentstack/cli-plugins) at `packages/contentstack-migrate-rte` (formerly [cli-cm-migrate-rte](https://github.com/contentstack/cli-cm-migrate-rte)). See [MIGRATE-RTE-MIGRATION.md](./MIGRATE-RTE-MIGRATION.md). + **Usage:** After installation, RTE migration commands will be available through the CLI: ```bash diff --git a/README.md b/README.md index ef8ea5843..85964e21c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Contentstack is a headless CMS with an API-first approach that puts content at t CLI supports content management scripts through which you can perform the following tasks: -- Bulk publish content +- Bulk publish content (`cm:stacks:bulk-*` via `@contentstack/cli-bulk-operations`) - Export content - Import content - Clone Stack diff --git a/packages/contentstack-bulk-operations/.editorconfig b/packages/contentstack-bulk-operations/.editorconfig new file mode 100644 index 000000000..9a91138fb --- /dev/null +++ b/packages/contentstack-bulk-operations/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + + diff --git a/packages/contentstack-bulk-operations/.gitignore b/packages/contentstack-bulk-operations/.gitignore new file mode 100644 index 000000000..60cf481c5 --- /dev/null +++ b/packages/contentstack-bulk-operations/.gitignore @@ -0,0 +1,21 @@ +*-debug.log +*-error.log +/.nyc_output +/dist +/lib +/tmp +node_modules +oclif.manifest.json +.env +*.log +tsconfig.tsbuildinfo +.vscode +*.env +coverage +.husky/_ +.nvmrc +report.json +/doc +/logs +/bulk-operation +.DS_Store \ No newline at end of file diff --git a/packages/contentstack-bulk-operations/.mocharc.json b/packages/contentstack-bulk-operations/.mocharc.json new file mode 100644 index 000000000..5cf9a0423 --- /dev/null +++ b/packages/contentstack-bulk-operations/.mocharc.json @@ -0,0 +1,14 @@ +{ + "require": [ + "test/helpers/init.js", + "ts-node/register" + ], + "watch-extensions": [ + "ts" + ], + "recursive": true, + "reporter": "spec", + "timeout": 60000, + "exit": true, + "spec": ["test/**/*.test.ts"] +} \ No newline at end of file diff --git a/packages/contentstack-bulk-operations/.npmignore b/packages/contentstack-bulk-operations/.npmignore new file mode 100644 index 000000000..780b61332 --- /dev/null +++ b/packages/contentstack-bulk-operations/.npmignore @@ -0,0 +1,27 @@ +* +!lib/** +!bin/** +!oclif.manifest.json +!npm-shrinkwrap.json +lib/**/*.test.js +lib/**/*.test.d.ts +*.test.ts +.vscode +.github +src +test +eslint.config.js +.prettierrc +.prettierignore +.editorconfig +.mocharc.json +.nycrc +tsconfig.json +.husky +*.log +coverage +.env +*.env +.nvmrc + + diff --git a/packages/contentstack-bulk-operations/.npmrc b/packages/contentstack-bulk-operations/.npmrc new file mode 100644 index 000000000..521a9f7c0 --- /dev/null +++ b/packages/contentstack-bulk-operations/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true diff --git a/packages/contentstack-bulk-operations/.nycrc b/packages/contentstack-bulk-operations/.nycrc new file mode 100644 index 000000000..937827050 --- /dev/null +++ b/packages/contentstack-bulk-operations/.nycrc @@ -0,0 +1,28 @@ +{ + "extension": [ + ".ts" + ], + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "**/*.d.ts", + "test/**", + "lib/**" + ], + "reporter": [ + "text", + "lcov", + "html", + "json", + "json-summary", + "clover" + ], + "all": true, + "check-coverage": true, + "lines": 80, + "statements": 80, + "functions": 80, + "branches": 75 +} + diff --git a/packages/contentstack-bulk-operations/.prettierignore b/packages/contentstack-bulk-operations/.prettierignore new file mode 100644 index 000000000..39a4b599b --- /dev/null +++ b/packages/contentstack-bulk-operations/.prettierignore @@ -0,0 +1,9 @@ +lib +node_modules +coverage +*.log +dist +oclif.manifest.json +tsconfig.tsbuildinfo + + diff --git a/packages/contentstack-bulk-operations/.prettierrc b/packages/contentstack-bulk-operations/.prettierrc new file mode 100644 index 000000000..20cbf8f0f --- /dev/null +++ b/packages/contentstack-bulk-operations/.prettierrc @@ -0,0 +1,10 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "printWidth": 120, + "tabWidth": 2, + "useTabs": false, + "arrowParens": "always" +} + diff --git a/packages/contentstack-bulk-operations/LICENSE b/packages/contentstack-bulk-operations/LICENSE new file mode 100644 index 000000000..aff1142ee --- /dev/null +++ b/packages/contentstack-bulk-operations/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Contentstack + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/contentstack-bulk-operations/README.md b/packages/contentstack-bulk-operations/README.md new file mode 100644 index 000000000..c3da40745 --- /dev/null +++ b/packages/contentstack-bulk-operations/README.md @@ -0,0 +1,373 @@ +> **Source of truth:** [cli-plugins](https://github.com/contentstack/cli-plugins) — `packages/contentstack-bulk-operations`. Migrated from [cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations). Command migration guide: [BULK-OPERATIONS-MIGRATION.md](../../BULK-OPERATIONS-MIGRATION.md). + +# @contentstack/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 + + +```sh-session +# 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 +``` +```sh-session +# 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`](#csdx-cmstacksbulk-assets) +* [`csdx cm:stacks:bulk-entries`](#csdx-cmstacksbulk-entries) +* [`csdx cm:stacks:bulk-taxonomies`](#csdx-cmstacksbulk-taxonomies) + +## `csdx cm:stacks:bulk-assets` + +Bulk operations for assets (publish/unpublish/cross-publish) + +``` +USAGE + $ csdx cm:stacks:bulk-assets [-a ] [-k ] [--operation publish|unpublish] [--environments ...] + [--locales ...] [--source-env ] [--source-alias ] [--publish-mode bulk|single] [--branch + ] [-c ] [-y] [--retry-failed ] [--revert ] [--bulk-operation-file ] [--folder-uid + ] + +FLAGS + -a, --alias= Uses the name of a saved Management Token to authenticate the command. The command + can only access the branches allowed for that token. This option can be used as an + alternative to` --stack-api-key.` + -c, --config= (optional) Specifies the path to a JSON configuration file that defines the options + for the command. Use this file instead of passing multiple CLI flags for a single + run. + -k, --stack-api-key= API key of the source stack. You must use either the --stack-api-key flag or the + --alias flag. + -y, --yes Skips interactive confirmation prompts and runs the command immediately using the + provided options. Useful for automation and scripts. + --branch= [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= [default: bulk-operation] (optional) Folder path to store operation logs. Creates + separate files for success and failed operations. Default: bulk-operation + --environments=... Specifies one or more environments where the entries or assets should be published. + Separate multiple environments with spaces. + --folder-uid= (optional) The UID of the Assets' folder from which the assets need to be + published. The default value is cs_root. + --locales=... Specifies one or more locale codes for which the entries or assets should be + published. Separate multiple locales with spaces. + --operation=