Skip to content

Commit f3de42a

Browse files
authored
Merge pull request #173 from contentstack/enhc/DX-7530-migrate-cli-regex-v1
feat: migrate @contentstack/cli-cm-regex-validate to cli-plugins monorepo (v1)
2 parents ace877a + e69019b commit f3de42a

54 files changed

Lines changed: 10004 additions & 179 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/config/release.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"launch": false,
2121
"branches": false,
2222
"apps-cli": false,
23+
"regex-validate": false,
2324
"tsgen": false,
2425
"bulk-operations": false,
2526
"core": false

.github/workflows/release-production-plugins.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ jobs:
159159
package: ./packages/contentstack-query-export/package.json
160160
tag: latest
161161

162+
# Regex Validate
163+
- name: Publishing regex-validate (Production)
164+
uses: JS-DevTools/npm-publish@v3
165+
with:
166+
token: ${{ secrets.NPM_TOKEN }}
167+
package: ./packages/contentstack-cli-cm-regex-validate/package.json
168+
tag: latest
169+
162170
# Tsgen
163171
- name: Publishing tsgen (Production)
164172
uses: JS-DevTools/npm-publish@v3

.github/workflows/unit-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ jobs:
7070
working-directory: ./packages/contentstack-apps-cli
7171
run: npm run test:unit:report:json
7272

73+
- name: Run tests for Contentstack Regex Validate plugin
74+
working-directory: ./packages/contentstack-cli-cm-regex-validate
75+
run: npm run test:unit
76+
7377
- name: Run tests for Contentstack Tsgen plugin
7478
working-directory: ./packages/contentstack-cli-tsgen
7579
run: npm run test

.talismanrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
fileignoreconfig:
2+
- filename: pnpm-lock.yaml
3+
checksum: 607e6b24e94919ad07de1d4716b24c5b818dd1a72f3b35ad2f0a40b32b001419
4+
- filename: skills/framework/SKILL.md
5+
checksum: c5746de64b1e7d1df051c4337de5eb32de6a4c85c7297aa408838d304bb2d771
6+
- filename: packages/contentstack-cli-cm-regex-validate/messages/index.json
7+
checksum: 044b311bde624dcc3c12434174d6027dbb6b62eefdfae120570a1748f806c60c
8+
- filename: packages/contentstack-cli-cm-regex-validate/skills/code-review/SKILL.md
9+
checksum: b92ea1c8e2f901c9e1e60f6ef6986d348a40a7869c236e3c1f3ca53b553dbb8e
10+
- filename: packages/contentstack-cli-cm-regex-validate/skills/contentstack-cli/SKILL.md
11+
checksum: 9420a516ba6046b05748683c90e3817d091cef76c46e029cb3745d6c0c350838
12+
- filename: packages/contentstack-cli-cm-regex-validate/skills/dev-workflow/SKILL.md
13+
checksum: b423dd35d0f7f0f25315e2a30198669b50db350f0ab2f917a1d3c4fbb0af0534
14+
- filename: packages/contentstack-cli-cm-regex-validate/src/utils/connect-stack.ts
15+
checksum: c77c7c25efc6d043b26e3dd0a516e22ac50142fa9fa5ff3a53a7c9fb8f24ebd6
16+
- filename: packages/contentstack-cli-cm-regex-validate/test/utils/connect-stack.test.ts
17+
checksum: 8fcd1dc2770a2a3f55ba462b7ffd3fc2e3cf45342c63e5b6dc5c1db4c2bd9738
218
- filename: packages/contentstack-migrate-rte/test/dummy/expectedEntriesResponse.json
319
checksum: a2784a3cb21780434958478d478dcb91d2d9a3a8025567d90fe8d74e9141b052
420
- filename: packages/contentstack-migrate-rte/test/dummy/entriesResponse.json
@@ -73,4 +89,10 @@ fileignoreconfig:
7389
checksum: 178611b1f153b46a0020da22cc18293d5bd9c539ec2e54557fd8c1a3c2e796b3
7490
- filename: packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts
7591
checksum: cec7ba35157c6516d67931d41deb57b7a156d9fc05dbab93ca5116e89b95c820
92+
- filename: packages/contentstack-cli-tsgen/AGENTS.md
93+
checksum: 75b4f1414b547d0bd83df5ed4fb80020acc0ed849619bed2639491b565be7a1b
94+
- filename: packages/contentstack-cli-tsgen/src/lib/helper.ts
95+
checksum: a7ead0030ead9d15b6b6e9623f61e7def77b00325e3988f0e3d73a145180dedc
96+
- filename: packages/contentstack-cli-tsgen/src/commands/tsgen.ts
97+
checksum: 054ea78f765edca62c785714cf8962df4fb91529c0851439d1ed61e963467408
7698
version: '1.0'

AGENTS.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Contentstack CLI plugins – Agent guide
2+
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`** (per-package).
4+
5+
## What this repo is
6+
7+
| Field | Detail |
8+
| --- | --- |
9+
| **Name:** | Contentstack CLI plugins (pnpm monorepo; root package name `csdx`) |
10+
| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, seed, audit, variants, Developer Hub apps, regex validation, etc.). |
11+
| **Out of scope (if any):** | The **core** CLI aggregation lives in the separate `cli` monorepo; this repo ships plugin packages only. |
12+
13+
## Tech stack (at a glance)
14+
15+
| Area | Details |
16+
| --- | --- |
17+
| **Language** | TypeScript / JavaScript, Node **>= 18** (`engines` in root `package.json`) |
18+
| **Build** | pnpm workspaces (`packages/*`); per package: `tsc`, OCLIF manifest/readme where applicable → `lib/` |
19+
| **Tests** | Mocha + Chai (most packages); Jest + ts-jest (`contentstack-cli-cm-regex-validate`); layouts under `packages/*/test/` |
20+
| **Lint / coverage** | ESLint in packages that define `lint` scripts; nyc where configured |
21+
| **Other** | OCLIF v4, Husky |
22+
23+
## Commands (quick reference)
24+
25+
| Command type | Command |
26+
| --- | --- |
27+
| **Build** | `pnpm build` |
28+
| **Test** | `pnpm test` |
29+
| **Lint** | `pnpm run lint` in a package that defines `lint` (no root aggregate lint script) |
30+
31+
CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other workflows under [.github/workflows/](.github/workflows/).
32+
33+
## Apps CLI plugin (`@contentstack/apps-cli`)
34+
35+
- **Package path:** [packages/contentstack-apps-cli](packages/contentstack-apps-cli)
36+
- **npm name:** `@contentstack/apps-cli` (unchanged for consumers)
37+
- **Migrated from:** [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) — see [APPS-CLI-MIGRATION.md](APPS-CLI-MIGRATION.md)
38+
- **v1 / v2:** This branch carries the **v1 line** (`@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`).
39+
- **Docs:** See [packages/contentstack-apps-cli/AGENTS.md](packages/contentstack-apps-cli/AGENTS.md)
40+
41+
## Regex Validate plugin (`@contentstack/cli-cm-regex-validate`)
42+
43+
- **Package path:** [packages/contentstack-cli-cm-regex-validate](packages/contentstack-cli-cm-regex-validate)
44+
- **npm name:** `@contentstack/cli-cm-regex-validate`
45+
- **Migrated from:** [contentstack/cli-cm-regex-validate](https://github.com/contentstack/cli-cm-regex-validate) — see [REGEX-VALIDATE-MIGRATION.md](REGEX-VALIDATE-MIGRATION.md)
46+
- **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`).
47+
- **Tests:** Jest + ts-jest (unlike most other packages which use Mocha + Chai)
48+
- **Command:** Single command `cm:stacks:validate-regex` (short name `RGXVLD`)
49+
- **Docs:** [packages/contentstack-cli-cm-regex-validate/AGENTS.md](packages/contentstack-cli-cm-regex-validate/AGENTS.md)
50+
51+
## Using Cursor (optional)
52+
53+
If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ To get a more detailed documentation for every command, visit the [CLI section](
5555

5656
## Useful Plugins
5757

58+
- [Generate TypeScript typings from a Stack](https://github.com/Contentstack-Solutions/contentstack-cli-tsgen)
59+
- [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`)
5860
- [Generate TypeScript typings from a Stack](https://github.com/contentstack/cli-plugins/tree/v1-dev/packages/contentstack-cli-tsgen) (`contentstack-cli-tsgen`)

REGEX-VALIDATE-MIGRATION.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Regex Validate plugin migration: standalone repo → cli-plugins monorepo
2+
3+
## Summary
4+
5+
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`**.
6+
7+
The **npm package name is unchanged**: `@contentstack/cli-cm-regex-validate`. This is the **first npm release** — the package was previously not published.
8+
9+
First release: **1.0.0** (v1 line) / **2.0.0-beta.0** (v2-beta line).
10+
11+
## Repository and issue tracking
12+
13+
| Before | After |
14+
| --- | --- |
15+
| Source: `github.com/contentstack/cli-cm-regex-validate` | Source: `github.com/contentstack/cli-plugins``packages/contentstack-cli-cm-regex-validate` |
16+
| Issues: cli-cm-regex-validate repo | Issues: [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) (label or mention `regex-validate`) |
17+
18+
The standalone **cli-cm-regex-validate** repository should be **archived** after the first release from cli-plugins.
19+
20+
## Version lines
21+
22+
| CLI line | cli-plugins branch | Plugin notes |
23+
| --- | --- | --- |
24+
| **1.x** | `v1-dev` / `main` | `@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`; npm tag `latest`; version `1.0.0` |
25+
| **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` |
26+
27+
## Install
28+
29+
```bash
30+
csdx plugins:install @contentstack/cli-cm-regex-validate
31+
```
32+
33+
## Command (unchanged)
34+
35+
| Command | Description |
36+
| --- | --- |
37+
| `csdx cm:stacks:validate-regex` | Validate fields with regex property in Content Types and Global Fields of a Stack |
38+
39+
Flags: `-a` (token alias), `-c` (content types), `-g` (global fields), `-f` (CSV output path).
40+
41+
## Local development
42+
43+
```bash
44+
cd cli-plugins
45+
pnpm install
46+
pnpm --filter @contentstack/cli-cm-regex-validate run build
47+
pnpm --filter @contentstack/cli-cm-regex-validate test
48+
```
49+
50+
## Test framework note
51+
52+
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`.
53+
54+
## Related migrations
55+
56+
- Apps CLI: [APPS-CLI-MIGRATION.md](./APPS-CLI-MIGRATION.md)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Cursor (optional)
2+
3+
**Cursor** users: start at **[`AGENTS.md`](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
4+
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.
6+
7+
Path from this file to the repo root agent guide: **`../../AGENTS.md`** (two levels up from `.cursor/rules/`).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/lib

0 commit comments

Comments
 (0)