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
1 change: 1 addition & 0 deletions .github/config/release.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"launch": false,
"branches": false,
"apps-cli": false,
"regex-validate": false,
"tsgen": false,
"bulk-operations": false,
"core": false
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release-production-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ jobs:
package: ./packages/contentstack-query-export/package.json
tag: latest

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

# Tsgen
- name: Publishing tsgen (Production)
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 @@ -70,6 +70,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 Tsgen plugin
working-directory: ./packages/contentstack-cli-tsgen
run: npm run test
Expand Down
22 changes: 22 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 607e6b24e94919ad07de1d4716b24c5b818dd1a72f3b35ad2f0a40b32b001419
- filename: skills/framework/SKILL.md
checksum: c5746de64b1e7d1df051c4337de5eb32de6a4c85c7297aa408838d304bb2d771
- filename: packages/contentstack-cli-cm-regex-validate/messages/index.json
checksum: 044b311bde624dcc3c12434174d6027dbb6b62eefdfae120570a1748f806c60c
- filename: packages/contentstack-cli-cm-regex-validate/skills/code-review/SKILL.md
checksum: b92ea1c8e2f901c9e1e60f6ef6986d348a40a7869c236e3c1f3ca53b553dbb8e
- filename: packages/contentstack-cli-cm-regex-validate/skills/contentstack-cli/SKILL.md
checksum: 9420a516ba6046b05748683c90e3817d091cef76c46e029cb3745d6c0c350838
- filename: packages/contentstack-cli-cm-regex-validate/skills/dev-workflow/SKILL.md
checksum: b423dd35d0f7f0f25315e2a30198669b50db350f0ab2f917a1d3c4fbb0af0534
- filename: packages/contentstack-cli-cm-regex-validate/src/utils/connect-stack.ts
checksum: c77c7c25efc6d043b26e3dd0a516e22ac50142fa9fa5ff3a53a7c9fb8f24ebd6
- filename: packages/contentstack-cli-cm-regex-validate/test/utils/connect-stack.test.ts
checksum: 8fcd1dc2770a2a3f55ba462b7ffd3fc2e3cf45342c63e5b6dc5c1db4c2bd9738
- filename: packages/contentstack-migrate-rte/test/dummy/expectedEntriesResponse.json
checksum: a2784a3cb21780434958478d478dcb91d2d9a3a8025567d90fe8d74e9141b052
- filename: packages/contentstack-migrate-rte/test/dummy/entriesResponse.json
Expand Down Expand Up @@ -73,4 +89,10 @@ fileignoreconfig:
checksum: 178611b1f153b46a0020da22cc18293d5bd9c539ec2e54557fd8c1a3c2e796b3
- filename: packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts
checksum: cec7ba35157c6516d67931d41deb57b7a156d9fc05dbab93ca5116e89b95c820
- filename: packages/contentstack-cli-tsgen/AGENTS.md
checksum: 75b4f1414b547d0bd83df5ed4fb80020acc0ed849619bed2639491b565be7a1b
- filename: packages/contentstack-cli-tsgen/src/lib/helper.ts
checksum: a7ead0030ead9d15b6b6e9623f61e7def77b00325e3988f0e3d73a145180dedc
- filename: packages/contentstack-cli-tsgen/src/commands/tsgen.ts
checksum: 054ea78f765edca62c785714cf8962df4fb91529c0851439d1ed61e963467408
version: '1.0'
53 changes: 53 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contentstack CLI plugins – Agent guide

**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`** (per-package).

## What this repo is

| 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, regex validation, 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)

| Area | Details |
| --- | --- |
| **Language** | TypeScript / JavaScript, Node **>= 18** (`engines` in root `package.json`) |
| **Build** | pnpm workspaces (`packages/*`); per package: `tsc`, OCLIF manifest/readme where applicable → `lib/` |
| **Tests** | Mocha + Chai (most packages); Jest + ts-jest (`contentstack-cli-cm-regex-validate`); layouts under `packages/*/test/` |
| **Lint / coverage** | ESLint in packages that define `lint` scripts; nyc where configured |
| **Other** | OCLIF v4, Husky |

## Commands (quick reference)

| Command type | Command |
| --- | --- |
| **Build** | `pnpm build` |
| **Test** | `pnpm test` |
| **Lint** | `pnpm run lint` in a package that defines `lint` (no root aggregate lint script) |

CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other workflows under [.github/workflows/](.github/workflows/).

## Apps CLI plugin (`@contentstack/apps-cli`)

- **Package path:** [packages/contentstack-apps-cli](packages/contentstack-apps-cli)
- **npm name:** `@contentstack/apps-cli` (unchanged for consumers)
- **Migrated from:** [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) — see [APPS-CLI-MIGRATION.md](APPS-CLI-MIGRATION.md)
- **v1 / v2:** This branch carries the **v1 line** (`@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`).
- **Docs:** See [packages/contentstack-apps-cli/AGENTS.md](packages/contentstack-apps-cli/AGENTS.md)

## 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:** This branch carries the **v1 line** (`@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`, version `1.0.0`, npm tag `latest`).
- **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)

## 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.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ 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`)
- [Generate TypeScript typings from a Stack](https://github.com/contentstack/cli-plugins/tree/v1-dev/packages/contentstack-cli-tsgen) (`contentstack-cli-tsgen`)
56 changes: 56 additions & 0 deletions REGEX-VALIDATE-MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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

- Apps CLI: [APPS-CLI-MIGRATION.md](./APPS-CLI-MIGRATION.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cursor (optional)

**Cursor** users: start at **[`AGENTS.md`](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.

This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

Path from this file to the repo root agent guide: **`../../AGENTS.md`** (two levels up from `.cursor/rules/`).
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
23 changes: 23 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["eslint-config-oclif", "eslint-config-oclif-typescript"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"unicorn/prefer-module": "off",
"@typescript-eslint/no-require-imports": "off",
"unicorn/no-array-for-each": "off",
"camelcase": "off",
"@typescript-eslint/no-unused-vars": "error",

"quotes": ["error", "single", { "avoidEscape": true }],
"semi": ["error", "never"],
"unicorn/import-style": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/consistent-function-scoping": "off",
"@typescript-eslint/ban-ts-comment": "off",
"object-curly-spacing": ["error", "never"]
}
}
15 changes: 15 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*-debug.log
*-error.log
*.log
.dccache
/.nyc_output
/dist
/lib
/tmp
/yarn.lock
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](https://github.com/contentstack/cli-cm-regex-validate) (`@contentstack/cli-cm-regex-validate` on npm) |
| **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 | npm; `prepack` runs `tsc -b`, oclif manifest, oclif readme — see `package.json` |
| Tests | Jest + ts-jest (`jest.config.ts`), `npm test`; suites under `test/utils/`, fixtures `test/data/*.json` |
| Lint / coverage | ESLint (`.eslintrc`), `npm run posttest` |
| Other | oclif v3, `@contentstack/cli-command`; CI: Node 22.x — [`.github/workflows/unit-tests.yml`](.github/workflows/unit-tests.yml). **CI runs Jest only** (`npm run test`); **ESLint is not run in CI** — run `npm run posttest` locally before merge. |

## Commands (quick reference)

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

CI runs `npm i` and `npm run test` on pull requests — see [`.github/workflows/unit-tests.yml`](.github/workflows/unit-tests.yml). It does **not** run `npm run posttest` (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.
11 changes: 11 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* @contentstack/devex-pr-reviewers

.github/workflows/sca-scan.yml @contentstack/security-admin

.github/workflows/codeql-anaylsis.yml @contentstack/security-admin

**/.snyk @contentstack/security-admin

.github/workflows/policy-scan.yml @contentstack/security-admin

.github/workflows/issues-jira.yml @contentstack/security-admin
21 changes: 21 additions & 0 deletions packages/contentstack-cli-cm-regex-validate/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
Loading
Loading