Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .cursor/rules/dev-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ alwaysApply: true
## Monorepo Structure

### Package Organization
- **11 plugin packages** under `packages/`
- **12+ plugin packages** under `packages/`
- `contentstack-cli-cm-regex-validate` - Regex validation for Content Type/Global Field fields (`cm:stacks:validate-regex`; npm `@contentstack/cli-cm-regex-validate`; Jest tests)
- **pnpm workspaces** with `workspaces: ["packages/*"]`
- **Shared dependencies**: `@contentstack/cli-command`, `@contentstack/cli-utilities`
- **Build artifacts**: `lib/` directory (compiled from `src/`)
Expand Down
1 change: 1 addition & 0 deletions .github/config/release.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bootstrap": false,
"branches": false,
"apps-cli": false,
"regex-validate": false,
"migrate-rte": false,
"bulk-operations": false
}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release-v2-beta-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ jobs:
package: ./packages/contentstack-apps-cli/package.json
tag: beta

# Regex Validate
- name: Publishing regex-validate (Beta)
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-cli-cm-regex-validate/package.json
access: public
tag: beta

# Migrate RTE
- name: Publishing migrate-rte (Beta)
uses: JS-DevTools/npm-publish@v3
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ jobs:
working-directory: ./packages/contentstack-apps-cli
run: npm run test:unit:report:json

- name: Run tests for Contentstack Regex Validate plugin
working-directory: ./packages/contentstack-cli-cm-regex-validate
run: npm run test:unit

- name: Run tests for Contentstack Migrate RTE
working-directory: ./packages/contentstack-migrate-rte
run: npm test
Expand Down
78 changes: 75 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
fileignoreconfig:
- filename: packages/contentstack-migrate-rte/test/dummy/entriesResponse.json
checksum: 691f3dcfbbcf69fd21e109a0d7003bdb500af2d0253bb7d7e8a0636d8f2a58f4
- filename: packages/contentstack-migrate-rte/test/dummy/expectedEntriesResponse.json
checksum: a2784a3cb21780434958478d478dcb91d2d9a3a8025567d90fe8d74e9141b052
- filename: packages/contentstack-bulk-operations/eslint.config.js
checksum: 0d93d7f660fe4cd6d62348c85ac10bf7c66018ea0b8e3e6d5a53419433f15867
- filename: packages/contentstack-bulk-operations/test/unit/messages/index.test.ts
checksum: e86e76db4f4afc899ae2a4742627a71a7d227a7139014361b9d83de6154b3c7a
- filename: packages/contentstack-bulk-operations/src/utils/batch-queue-handler.ts
checksum: d1d031242b99f5c738e2f4587ca2f5f3e96373e479ebaf4d93b2f98152943593
- filename: packages/contentstack-bulk-operations/src/utils/bulk-publish-url-generator.ts
checksum: 052d811adb5da9bac8c70e5b3dc4ddf700d5aea274dd2aa90a2df374118fbd26
- filename: packages/contentstack-bulk-operations/src/utils/client.ts
checksum: efdada21291db6d66e3114b7408163dee4cafe6ddb3904f02aa67140a1a89bb6
- filename: packages/contentstack-bulk-operations/test/unit/services/index.test.ts
checksum: aae62ba072551bedf869ec7b1f6bf90238bc039336f37e7c583da8ba0637f9be
- filename: packages/contentstack-bulk-operations/src/base-bulk-command.ts
checksum: 34907f0e00c40096cbe517b680a24fdf57caac351e45bc44b96e41987e619b67
- filename: packages/contentstack-bulk-operations/src/core/operation-executor.ts
checksum: 46295f495f007ad291787133936c5af3c76838d72f2be0de9c235bb644d6f905
- filename: packages/contentstack-bulk-operations/test/unit/services/taxonomy-service.test.ts
checksum: 33af8ee198158dd92916d76207e172b5316864d063a6929526ca259b459ec79a
- filename: packages/contentstack-bulk-operations/src/core/rate-limiter.ts
checksum: 81e3d624166ab34a589e3e8527b9e57ebc7e7f4374efd0483b1df0dd11788b68
- filename: packages/contentstack-bulk-operations/README.md
checksum: 08ce31ed44af9b8b4c1ee054514198ec3533f713b59e7eaffd06d737c17cc867
- filename: packages/contentstack-bulk-operations/src/interfaces/index.ts
checksum: 0ff6bbc372758a20783f36bd391ba9d500530433fde472a1aacaf54f6b4a1688
- filename: packages/contentstack-bulk-operations/src/utils/config-builder.ts
checksum: a7b5259ad719b8c5929f9fea3783bdc92610dc2549426204c1bb6813e7e1112a
- filename: packages/contentstack-migrate-rte/src/commands/cm/entries/migrate-html-rte.js
checksum: 42f5322863e422f5b9c64f61116367fa825ea526bd198256a5ef296aac5b07a8
- filename: packages/contentstack-bulk-operations/test/unit/utils/client.test.ts
checksum: 178611b1f153b46a0020da22cc18293d5bd9c539ec2e54557fd8c1a3c2e796b3
- filename: packages/contentstack-bulk-operations/test/unit/utils/batch-queue-handler.test.ts
checksum: c91f1822b5cfd34a4f4ba05dfc56c10a66e0f5ddb55a1cf5b454fa9549ea0052
- filename: packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts
checksum: cec7ba35157c6516d67931d41deb57b7a156d9fc05dbab93ca5116e89b95c820
- filename: packages/contentstack-bulk-operations/src/messages/index.ts
checksum: 2d904462af6dc3ddc00ae6bb4433c846500ddfecee5a9e1fb1c236bd598a2ee1
- filename: packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts
checksum: d46757d3bb98d76845e83d4585f269b62b1fa9cb5bee3215b88fed38fd1dbb53
- filename: packages/contentstack-bulk-operations/src/utils/interactive.ts
checksum: ba4fdd6f17c7d43cae639158f82dea3065ba8a368ddce8c476bfe49a6945e5c1
- filename: packages/contentstack-bulk-operations/test/unit/utils/operation-confirmation.test.ts
checksum: 043185e56361ffae2116a2af5a4da16986816ad054fd94f189269e5b6150609e
- filename: packages/contentstack-bulk-operations/test/unit/utils/interactive.test.ts
checksum: 3ee0ff5a74929346bfe997aeb977b4e93d398ea63892efc5f85e0b51a21074f6
- filename: packages/contentstack-bulk-operations/test/unit/utils/taxonomy-interactive-select.test.ts
checksum: 34a085702d01d7e16e1507ea1e434b374c2cba5dd884aad5996c5484412897c0
- filename: packages/contentstack-migrate-rte/test/utils/index.js
checksum: bc2a509a86174aecbaf0bfc44d6ad3afabe57ef871ec91b796d498e00177e3f0
- filename: packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts
checksum: 078f9633edb53204ed14ebe3cf6b1d6063729dd37b7ee1c6e936a344ceabebda
- filename: packages/contentstack-bulk-operations/test/unit/utils/validators.test.ts
checksum: 69cf394584e325b972d6825879de7c31b9dd1bd50b0bb057aecb739258ac0317
- filename: packages/contentstack-bulk-operations/test/unit/core/index.test.ts
checksum: 0d789258f5a9664e8a7dc5f5b23da846d0eaf8c52638ff20fb1f26104d3f9f8d
- filename: packages/contentstack-bulk-operations/src/utils/revert-retry-handler.ts
checksum: 76899098d74de1dd20f1b08401c65f23b2bec584c051388e63f70f3d24a6d1a4
- filename: packages/contentstack-migrate-rte/src/lib/util/index.js
checksum: 47a154b83045535af878888d618d8e1d42d7b128318a361e03be881cb0d71c6e
- filename: packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts
checksum: 18684a596707865e671f1ee57b4819cb3f4b4f2633d6c49f7f4b6ce09391359f
- filename: packages/contentstack-bulk-operations/test/unit/core/operation-executor.test.ts
checksum: 97f0ddd4d547f37a8d93650aa1e8af4ef4dbce343dd51853e34bbde6107cd725
- filename: packages/contentstack-bulk-operations/test/unit/commands/bulk-assets.test.ts
checksum: c099c628c7ae1a40a9ca5580de0afa8309a611b2dff7837b10bb8f70eb92f8b3
- filename: packages/contentstack-migrate-rte/README.md
checksum: 971bfdd67d66ae565feab612978123a9956248b25439e8cea65e4fa7cbcb403f
- filename: packages/contentstack-migrate-rte/test/commands/json-migration.test.js
checksum: 56e10f1e0d2794fa13bcf5a6bb3e868b28277df1762fb3df0a8a82ad44f8045b
- filename: packages/contentstack-bulk-operations/test/unit/commands/bulk-entries.test.ts
checksum: 845512e660813a6d7d96efd89dcff6eba4591a3f9ff371dc9b1aad38921e18a6
- filename: pnpm-lock.yaml
checksum: e5b5f8ab64f4f27a1483e426cc01d7388482263e1d6fe3baf1caafcf2878ebb2
- filename: skills/framework/SKILL.md
checksum: c5746de64b1e7d1df051c4337de5eb32de6a4c85c7297aa408838d304bb2d771
checksum: 47c3ff1b2883aa208e81fed6974ab911055b279944c95fde351c1a57c566354b
version: '1.0'
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ 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)

## Regex Validate plugin (`@contentstack/cli-cm-regex-validate`)

- **Package path:** [packages/contentstack-cli-cm-regex-validate](packages/contentstack-cli-cm-regex-validate)
- **npm name:** `@contentstack/cli-cm-regex-validate`
- **Migrated from:** [contentstack/cli-cm-regex-validate](https://github.com/contentstack/cli-cm-regex-validate) — see [REGEX-VALIDATE-MIGRATION.md](REGEX-VALIDATE-MIGRATION.md)
- **v1 / v2:** Maintain on `v1-dev` / `main` (v1 CLI deps) and `v2-beta` (`~2.0.0-beta.7` / `~2.0.0-beta.8`, version `2.0.0-beta.0`); align with target CLI line.
- **Tests:** Jest + ts-jest (unlike most other packages which use Mocha + Chai)
- **Command:** Single command `cm:stacks:validate-regex` (short name `RGXVLD`)
- **Docs:** [packages/contentstack-cli-cm-regex-validate/AGENTS.md](packages/contentstack-cli-cm-regex-validate/AGENTS.md)

## Migrate RTE plugin (`@contentstack/cli-cm-migrate-rte`)

- **Package path:** [packages/contentstack-migrate-rte](packages/contentstack-migrate-rte)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ To get a more detailed documentation for every command, visit the [CLI section](
## Useful Plugins

- [Generate TypeScript typings from a Stack](https://github.com/Contentstack-Solutions/contentstack-cli-tsgen)
- [Validate regex fields in Content Types and Global Fields](https://github.com/contentstack/cli-plugins/tree/main/packages/contentstack-cli-cm-regex-validate) (`@contentstack/cli-cm-regex-validate`)
57 changes: 57 additions & 0 deletions REGEX-VALIDATE-MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Regex Validate plugin migration: standalone repo → cli-plugins monorepo

## Summary

The **@contentstack/cli-cm-regex-validate** plugin has moved from the standalone repository [contentstack/cli-cm-regex-validate](https://github.com/contentstack/cli-cm-regex-validate) into the [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) monorepo at **`packages/contentstack-cli-cm-regex-validate`**.

The **npm package name is unchanged**: `@contentstack/cli-cm-regex-validate`. This is the **first npm release** — the package was previously not published.

First release: **1.0.0** (v1 line) / **2.0.0-beta.0** (v2-beta line).

## Repository and issue tracking

| Before | After |
| --- | --- |
| Source: `github.com/contentstack/cli-cm-regex-validate` | Source: `github.com/contentstack/cli-plugins` → `packages/contentstack-cli-cm-regex-validate` |
| Issues: cli-cm-regex-validate repo | Issues: [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) (label or mention `regex-validate`) |

The standalone **cli-cm-regex-validate** repository should be **archived** after the first release from cli-plugins.

## Version lines

| CLI line | cli-plugins branch | Plugin notes |
| --- | --- | --- |
| **1.x** | `v1-dev` / `main` | `@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`; npm tag `latest`; version `1.0.0` |
| **2.x beta** | `v2-dev` / `v2-beta` | `@contentstack/cli-command ~2.0.0-beta.7`, `@contentstack/cli-utilities ~2.0.0-beta.8`; npm tag `beta`; version `2.0.0-beta.0` |

## Install

```bash
csdx plugins:install @contentstack/cli-cm-regex-validate
```

## Command (unchanged)

| Command | Description |
| --- | --- |
| `csdx cm:stacks:validate-regex` | Validate fields with regex property in Content Types and Global Fields of a Stack |

Flags: `-a` (token alias), `-c` (content types), `-g` (global fields), `-f` (CSV output path).

## Local development

```bash
cd cli-plugins
pnpm install
pnpm --filter @contentstack/cli-cm-regex-validate run build
pnpm --filter @contentstack/cli-cm-regex-validate test
```

## Test framework note

This package uses **Jest + ts-jest** (unlike most other packages in this monorepo which use Mocha + Chai). Tests live under `packages/contentstack-cli-cm-regex-validate/test/` and run via `pnpm test` or `pnpm run test:unit`.

## Related migrations

- Content Type plugin: [CONTENT-TYPE-MIGRATION.md](./CONTENT-TYPE-MIGRATION.md)
- Apps CLI: [APPS-CLI-MIGRATION.md](./APPS-CLI-MIGRATION.md)
11 changes: 11 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib
13 changes: 13 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*-debug.log
*-error.log
*.log
/.nyc_output
/dist
/lib
/tmp
node_modules
/coverage
/results
oclif.manifest.json
.DS_Store
tsconfig.tsbuildinfo
4 changes: 4 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/.talismanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fileignoreconfig:
- filename: package-lock.json
checksum: 88dcc5e2639a4fb4d04d1f1cc97581515b687290ac20abf1f18ce7476db36eef
version: ""
46 changes: 46 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# cli-cm-regex-validate – Agent guide

**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.

## What this repo is

| Field | Detail |
|-------|--------|
| **Name:** | `@contentstack/cli-cm-regex-validate` ([contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) → `packages/contentstack-cli-cm-regex-validate`) |
| **Purpose:** | Contentstack CLI oclif plugin with a single command, **`csdx cm:stacks:validate-regex`**, which scans content types and/or global fields in a stack for regex `format` values that fail the `safe-regex` check, then writes results to CSV and prints a summary table. User-facing copy lives in `messages/index.json`. |
| **Out of scope (if any):** | Not a general-purpose Contentstack SDK — only this plugin’s command, utils, and tests. |

## Tech stack (at a glance)

| Area | Details |
|------|---------|
| Language | TypeScript (`strict`), Node `>=14.0.0` per `package.json` engines |
| Build | pnpm; `build` runs `tsc -b`, oclif manifest, oclif readme — see `package.json` |
| Tests | Jest + ts-jest (`jest.config.ts`), `pnpm test`; suites under `test/utils/`, fixtures `test/data/*.json` |
| Lint / coverage | ESLint (`.eslintrc`), `pnpm run lint` |
| Other | oclif v4, `@contentstack/cli-command ^1.8.2`; CI: Node 22.x — [`.github/workflows/unit-test.yml`](../../.github/workflows/unit-test.yml). **CI runs Jest only** (`pnpm test`); **ESLint is not run in CI** — run `pnpm run lint` locally before merge. |

## Commands (quick reference)

| Command type | Command |
|--------------|---------|
| Build (release prep) | `pnpm run build` — cleans `lib`, compiles, generates oclif manifest and readme |
| Test | `pnpm test` |
| Lint | `pnpm run lint` |

CI runs `pnpm install` and `pnpm test` on pull requests — see [`.github/workflows/unit-test.yml`](../../.github/workflows/unit-test.yml). It does **not** run `pnpm run lint` (ESLint); run lint locally before merging.

## Where the documentation lives: skills

| Skill | Path | What it covers |
|-------|------|----------------|
| Development workflow | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Commands, repo layout, naming, hooks, TDD, before merge |
| Testing | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest, mocks, fixtures, no live API calls |
| Contentstack CLI | [`skills/contentstack-cli/SKILL.md`](skills/contentstack-cli/SKILL.md) | Command flow, SDK, schema walk, `safe-regex`, CSV/table output |
| Code review | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR and release checklist |

An index with “when to use” hints is in [`skills/README.md`](skills/README.md).

## Using Cursor (optional)

If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **[`AGENTS.md`](AGENTS.md)** — same docs as everyone else.
91 changes: 91 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Regex Validation CLI Plugin

The “Regex Validation” plugin in Contentstack CLI allows users to search for invalid regexes within the content types and global fields of their stack.

Using the CLI “Regex Validation” plugin, you can find the invalid regexes within your stack
and rectify them.

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/cli-cm-regex-validate.svg)](https://npmjs.org/package/cli-cm-regex-validate)
[![Downloads/week](https://img.shields.io/npm/dw/cli-cm-regex-validate.svg)](https://npmjs.org/package/cli-cm-regex-validate)
[![License](https://img.shields.io/npm/l/cli-cm-regex-validate.svg)](https://github.com/contentstack/cli-cm-regex-validate/blob/master/package.json)

<!-- toc -->
* [Regex Validation CLI Plugin](#regex-validation-cli-plugin)
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

# Usage

<!-- usage-no-overwrite -->

#### Step 1:

```sh-session
$ npm install -g @contentstack/cli

$ csdx plugins:install https://github.com/contentstack/cli-cm-regex-validate/releases/download/v1.2.1/contentstack-cli-cm-regex-validate-1.2.1.tgz

$ csdx plugins
running command...
@contentstack/cli-cm-regex-validate/1.2.1 darwin-arm64 node-v20.8.0

$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
...
```

#### Step 2:

[Set the region](https://www.contentstack.com/docs/developers/cli/configure-regions-in-the-cli#set-region)

<!-- usagestop-overwrite -->

#### Step 3:

[Configured management token alias](https://www.contentstack.com/docs/developers/cli/cli-authentication#add-management-token)

# Commands

<!-- commands -->
* [`csdx cm:stacks:validate-regex`](#csdx-cmstacksvalidate-regex)

## `csdx cm:stacks:validate-regex`

This command is used to find all the invalid regexes present in the content types and global fields of your stack.

```
USAGE
$ csdx cm:stacks:validate-regex [-h] [-a <value>] [-c] [-g] [-f <value>]

FLAGS
-a, --alias=<value> Alias (name) assigned to the management token
-c, --contentType To find invalid regexes within the content types
-f, --filePath=<value> [optional] The path or the location in your file system where the CSV output file should be
stored.
-g, --globalField To find invalid regexes within the global fields
-h, --help To show the flags that can be used with this CLI command

DESCRIPTION
This command is used to find all the invalid regexes present in the content types and global fields of your stack.

EXAMPLES
$ csdx cm:stacks:validate-regex

$ csdx cm:stacks:validate-regex -a <management_token_alias>

$ csdx cm:stacks:validate-regex -c

$ csdx cm:stacks:validate-regex -g

$ csdx cm:stacks:validate-regex -f <path/to/the/directory>

$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g

$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g -f <path/to/the/directory>
```

_See code: [src/commands/cm/stacks/validate-regex.ts](https://github.com/contentstack/cli-cm-regex-validate/blob/v1.2.6/src/commands/cm/stacks/validate-regex.ts)_
<!-- commandsstop -->
Loading
Loading