Skip to content

Commit 92baaf2

Browse files
authored
Merge pull request #170 from contentstack/feat/migrate-external-cli-plugins-v2
Feat/migrate external cli plugins v2
2 parents b376f24 + 9c76dc3 commit 92baaf2

339 files changed

Lines changed: 53993 additions & 667 deletions

File tree

Some content is hidden

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

.cursor/rules/dev-workflow.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ alwaysApply: true
99
## Monorepo Structure
1010

1111
### Package Organization
12-
- **11 plugin packages** under `packages/`
12+
- **12+ plugin packages** under `packages/`
13+
- `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)
1314
- **pnpm workspaces** with `workspaces: ["packages/*"]`
1415
- **Shared dependencies**: `@contentstack/cli-command`, `@contentstack/cli-utilities`
1516
- **Build artifacts**: `lib/` directory (compiled from `src/`)

.github/config/release.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
"migration": false,
1010
"seed": false,
1111
"bootstrap": false,
12-
"branches": false
12+
"branches": false,
13+
"apps-cli": false,
14+
"tsgen": false,
15+
"content-type": false,
16+
"regex-validate": false,
17+
"migrate-rte": false,
18+
"bulk-operations": false
1319
}
1420
}

.github/workflows/release-v2-beta-plugins.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,53 @@ jobs:
142142
token: ${{ secrets.NPM_TOKEN }}
143143
package: ./packages/contentstack-query-export/package.json
144144
tag: beta
145+
146+
# Content Type
147+
- name: Publishing content-type (Beta)
148+
uses: JS-DevTools/npm-publish@v3
149+
with:
150+
token: ${{ secrets.NPM_TOKEN }}
151+
package: ./packages/contentstack-content-type/package.json
152+
tag: beta
153+
154+
# Apps CLI
155+
- name: Publishing apps-cli (Beta)
156+
uses: JS-DevTools/npm-publish@v3
157+
with:
158+
token: ${{ secrets.NPM_TOKEN }}
159+
package: ./packages/contentstack-apps-cli/package.json
160+
tag: beta
161+
162+
# Tsgen
163+
- name: Publishing tsgen (Beta)
164+
uses: JS-DevTools/npm-publish@v3
165+
with:
166+
token: ${{ secrets.NPM_TOKEN }}
167+
package: ./packages/contentstack-cli-tsgen/package.json
168+
tag: beta
169+
# Regex Validate
170+
- name: Publishing regex-validate (Beta)
171+
uses: JS-DevTools/npm-publish@v3
172+
with:
173+
token: ${{ secrets.NPM_TOKEN }}
174+
package: ./packages/contentstack-cli-cm-regex-validate/package.json
175+
access: public
176+
tag: beta
177+
178+
# Migrate RTE
179+
- name: Publishing migrate-rte (Beta)
180+
uses: JS-DevTools/npm-publish@v3
181+
with:
182+
token: ${{ secrets.NPM_TOKEN }}
183+
package: ./packages/contentstack-migrate-rte/package.json
184+
access: public
185+
tag: beta
186+
187+
# Bulk Operations
188+
- name: Publishing bulk-operations (Beta)
189+
uses: JS-DevTools/npm-publish@v3
190+
with:
191+
token: ${{ secrets.NPM_TOKEN }}
192+
package: ./packages/contentstack-bulk-operations/package.json
193+
access: public
194+
tag: beta
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Tsgen Integration Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
tsgen-integration:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup pnpm
15+
uses: pnpm/action-setup@v4
16+
with:
17+
version: 10.28.0
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '22.x'
23+
cache: 'pnpm'
24+
25+
- name: Install dependencies
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Build tsgen plugin
29+
run: pnpm --filter contentstack-cli-tsgen run build
30+
31+
- name: Install Contentstack CLI (v2 beta)
32+
run: npm i -g @contentstack/cli@beta
33+
34+
- name: Configure CLI region
35+
run: csdx config:set:region ${{ secrets.REGION }}
36+
37+
- name: Add delivery token
38+
run: csdx auth:tokens:add -a ${{ secrets.TOKEN_ALIAS }} --delivery -k ${{ secrets.APIKEY }} --token ${{ secrets.DELIVERYKEY }} -e ${{ secrets.ENVIRONMENT }}
39+
40+
- name: Link tsgen plugin
41+
working-directory: ./packages/contentstack-cli-tsgen
42+
run: csdx plugins:link
43+
44+
- name: Run integration tests
45+
run: pnpm --filter contentstack-cli-tsgen run test
46+
env:
47+
TOKEN_ALIAS: ${{ secrets.TOKEN_ALIAS }}
48+
49+
- name: Unlink tsgen plugin
50+
working-directory: ./packages/contentstack-cli-tsgen
51+
run: csdx plugins:unlink
52+
if: always()

.github/workflows/unit-test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,23 @@ jobs:
6666
- name: Run tests for Contentstack Query Export
6767
working-directory: ./packages/contentstack-query-export
6868
run: npm run test:unit
69+
70+
- name: Run tests for Contentstack Apps CLI
71+
working-directory: ./packages/contentstack-apps-cli
72+
run: npm run test:unit:report
73+
74+
- name: Run tests for Contentstack Content Type plugin
75+
working-directory: ./packages/contentstack-content-type
76+
run: npm run test:unit
77+
78+
- name: Run tests for Contentstack Regex Validate plugin
79+
working-directory: ./packages/contentstack-cli-cm-regex-validate
80+
run: npm run test:unit
81+
82+
- name: Run tests for Contentstack Migrate RTE
83+
working-directory: ./packages/contentstack-migrate-rte
84+
run: npm test
85+
86+
- name: Run tests for Contentstack Bulk Operations
87+
working-directory: ./packages/contentstack-bulk-operations
88+
run: npm test

.talismanrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
fileignoreconfig:
2-
- filename: pnpm-lock.yaml
3-
checksum: 71b97a29a577e59d746967b4717acd013d624fd1cbf7d796647c9ef6d7652165
2+
- filename: packages/contentstack-bulk-operations/src/services/am-asset-service.ts
3+
checksum: 5f6c0ecba74e27399a7079ca15e65e77ef692697093c9fb1d57213728c4fe985
4+
- filename: packages/contentstack-bulk-operations/src/utils/asset-uids-from-file.ts
5+
checksum: 580932f192dd3fdd8bb2c55b7a7a78f1694f646ef5c5041f86c75668778f7ecb
6+
- filename: packages/contentstack-bulk-operations/test/unit/utils/asset-uids-from-file.test.ts
7+
checksum: 8123f7a675a0275795b59b15d0f2d5f8f1e57ccbecf3f97249a0dc5a037b9203
48
version: '1.0'

AGENTS.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| Field | Detail |
88
| --- | --- |
99
| **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, etc.). |
10+
| **Purpose:** | OCLIF plugins that extend the Contentstack CLI (import/export, clone, migration, migrate RTE, bulk operations, seed, audit, variants, Developer Hub apps, TypeScript codegen, etc.). |
1111
| **Out of scope (if any):** | The **core** CLI aggregation lives in the separate `cli` monorepo; this repo ships plugin packages only. |
1212

1313
## Tech stack (at a glance)
@@ -35,11 +35,60 @@ CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other
3535
| Skill | Path | What it covers |
3636
| --- | --- | --- |
3737
| Development workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | pnpm commands, CI, TDD expectations, PR checklist |
38-
| Contentstack CLI | [skills/contentstack-cli/SKILL.md](skills/contentstack-cli/SKILL.md) | Plugin commands, OCLIF, Contentstack APIs |
39-
| Framework | [skills/framework/SKILL.md](skills/framework/SKILL.md) | Utilities, config, logging, errors |
38+
| Contentstack CLI | [skills/contentstack-cli/SKILL.md](skills/contentstack-cli/SKILL.md) | Plugin commands, OCLIF, Contentstack APIs (incl. `app:*` / `@contentstack/apps-cli`) |
39+
| Framework | [skills/framework/SKILL.md](skills/framework/SKILL.md) | Utilities, config, logging, errors (incl. Developer Hub SDK, manifests, GraphQL) |
4040
| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Mocha/Chai, coverage, mocks |
4141
| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR review for this monorepo |
4242

43+
## Apps CLI plugin (`@contentstack/apps-cli`)
44+
45+
- **Package path:** [packages/contentstack-apps-cli](packages/contentstack-apps-cli)
46+
- **npm name:** `@contentstack/apps-cli` (unchanged for consumers)
47+
- **Migrated from:** [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) — see [APPS-CLI-MIGRATION.md](APPS-CLI-MIGRATION.md)
48+
- **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.
49+
- **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)
50+
51+
## Tsgen plugin (`contentstack-cli-tsgen`)
52+
53+
- **Package path:** [packages/contentstack-cli-tsgen](packages/contentstack-cli-tsgen)
54+
- **npm name:** `contentstack-cli-tsgen` (unchanged for consumers)
55+
- **Migrated from:** standalone `contentstack-cli-tsgen` repos — see [TSGEN-MIGRATION.md](TSGEN-MIGRATION.md)
56+
- **v2 beta only:** `5.0.0-beta.0`+ on `feat/migrate-external-cli-plugins-v2` / `v2-beta`; requires CLI 2.x beta.
57+
- **Docs:** `csdx tsgen`[typescript-cli-tsgen](packages/contentstack-cli-tsgen/skills/typescript-cli-tsgen/SKILL.md); tests → [package testing skill](packages/contentstack-cli-tsgen/skills/testing/SKILL.md)
58+
59+
## Content Type plugin (`contentstack-cli-content-type`)
60+
61+
- **Package path:** [packages/contentstack-content-type](packages/contentstack-content-type)
62+
- **npm name:** `contentstack-cli-content-type`
63+
- **Migrated from:** [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) — see [CONTENT-TYPE-MIGRATION.md](CONTENT-TYPE-MIGRATION.md)
64+
- **v1 / v2:** Maintain on `v1-dev` / `main` (1.x CLI deps) and `v2-beta` (2.x beta deps) branches; align `@contentstack/cli-command` and `@contentstack/cli-utilities` versions with the target CLI line.
65+
- **Tests:** Jest + ts-jest (unlike most other packages which use Mocha + Chai)
66+
- **Docs:** 6 commands under `content-type:*`[packages/contentstack-content-type/AGENTS.md](packages/contentstack-content-type/AGENTS.md)
67+
68+
## Regex Validate plugin (`@contentstack/cli-cm-regex-validate`)
69+
70+
- **Package path:** [packages/contentstack-cli-cm-regex-validate](packages/contentstack-cli-cm-regex-validate)
71+
- **npm name:** `@contentstack/cli-cm-regex-validate`
72+
- **Migrated from:** [contentstack/cli-cm-regex-validate](https://github.com/contentstack/cli-cm-regex-validate) — see [REGEX-VALIDATE-MIGRATION.md](REGEX-VALIDATE-MIGRATION.md)
73+
- **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.
74+
- **Tests:** Jest + ts-jest (unlike most other packages which use Mocha + Chai)
75+
- **Command:** Single command `cm:stacks:validate-regex` (short name `RGXVLD`)
76+
- **Docs:** [packages/contentstack-cli-cm-regex-validate/AGENTS.md](packages/contentstack-cli-cm-regex-validate/AGENTS.md)
77+
78+
## Migrate RTE plugin (`@contentstack/cli-cm-migrate-rte`)
79+
80+
- **Package path:** [packages/contentstack-migrate-rte](packages/contentstack-migrate-rte)
81+
- **npm name:** `@contentstack/cli-cm-migrate-rte` (unchanged)
82+
- **Migrated from:** [contentstack/cli-cm-migrate-rte](https://github.com/contentstack/cli-cm-migrate-rte) — see [MIGRATE-RTE-MIGRATION.md](MIGRATE-RTE-MIGRATION.md)
83+
- **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))
84+
85+
## Bulk operations plugin (`@contentstack/cli-bulk-operations`)
86+
87+
- **Package path:** [packages/contentstack-bulk-operations](packages/contentstack-bulk-operations)
88+
- **npm name:** `@contentstack/cli-bulk-operations` (unchanged)
89+
- **Migrated from:** [contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations) — see [BULK-OPERATIONS-MIGRATION.md](BULK-OPERATIONS-MIGRATION.md) (commands + repository)
90+
- **Commands:** `csdx cm:stacks:bulk-entries`, `csdx cm:stacks:bulk-assets`, `csdx cm:stacks:bulk-taxonomies` — see [dev-workflow](skills/dev-workflow/SKILL.md)
91+
4392
## Using Cursor (optional)
4493

4594
If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.

APPS-CLI-MIGRATION.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Apps CLI migration: standalone repo → cli-plugins monorepo
2+
3+
## Summary
4+
5+
The **@contentstack/apps-cli** plugin (`contentstack-apps-cli`) has moved from the standalone repository [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) into the [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) monorepo at **`packages/contentstack-apps-cli`**.
6+
7+
The **npm package name is unchanged**: `@contentstack/apps-cli`. Install and command usage stay the same.
8+
9+
## Repository and issue tracking
10+
11+
| Before | After |
12+
| --- | --- |
13+
| Source: `github.com/contentstack/contentstack-apps-cli` | Source: `github.com/contentstack/cli-plugins``packages/contentstack-apps-cli` |
14+
| Issues: contentstack-apps-cli repo | Issues: [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) (label or mention `apps-cli` / `@contentstack/apps-cli`) |
15+
16+
The standalone **contentstack-apps-cli** repository is **archived** after the first release from cli-plugins. Open PRs and bugs should be recreated or linked in cli-plugins.
17+
18+
## Version lines (1.x vs 2.x)
19+
20+
| CLI line | cli-plugins branch | Apps plugin notes |
21+
| --- | --- | --- |
22+
| **1.x** | `v1-dev` / `v1-beta` | `@contentstack/cli-command` and `@contentstack/cli-utilities` on 1.x-compatible ranges |
23+
| **2.x beta** | `v2-dev` / `v2-beta` | Align with 2.x beta core packages (same pattern as export, import, bootstrap) |
24+
25+
Develop and release each line on its branch; do not mix 1.x and 2.x dependency pins in the same branch.
26+
27+
## Install (unchanged)
28+
29+
```bash
30+
csdx plugins:install @contentstack/apps-cli
31+
# or
32+
npm install -g @contentstack/apps-cli
33+
```
34+
35+
## Local development
36+
37+
Clone [cli-dev-workspace](https://github.com/contentstack/cli-dev-workspace) (or cli-plugins only), then:
38+
39+
```bash
40+
cd cli-plugins
41+
pnpm install
42+
pnpm --filter @contentstack/apps-cli run build
43+
pnpm --filter @contentstack/apps-cli test
44+
```
45+
46+
See [AGENTS.md](./AGENTS.md), [skills/contentstack-cli/SKILL.md](./skills/contentstack-cli/SKILL.md#apps-cli-commands-app), and [skills/framework/SKILL.md](./skills/framework/SKILL.md#apps-cli-plugin-contentstackapps-cli) for contributor docs.
47+
48+
## Related migrations
49+
50+
- Core CLI: [cli](https://github.com/contentstack/cli) monorepo
51+
- Other external plugins (bulk operations, migrate-rte): same cli-plugins consolidation effort

BULK-OPERATIONS-MIGRATION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# 🔄 Migration Guide: From Bulk Publish to Bulk Operations Commands
22

33
> **Migrating from @contentstack/cli-cm-bulk-publish (v1.x) to New Unified Commands @contentstack/cli-bulk-operations (v1.x)**
4+
5+
## Repository
6+
7+
| Before | After |
8+
| --- | --- |
9+
| [contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations) | [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins)`packages/contentstack-bulk-operations` |
10+
| Issues on standalone repo | [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) |
11+
12+
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).
13+
414
---
515

616
## What Changed?

CONTENT-TYPE-MIGRATION.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Content Type plugin migration: standalone repo → cli-plugins monorepo
2+
3+
## Summary
4+
5+
The **contentstack-cli-content-type** plugin has moved from the standalone repository [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) into the [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) monorepo at **`packages/contentstack-content-type`**.
6+
7+
The **npm package name is unchanged**: `contentstack-cli-content-type`. Install and command usage stay the same.
8+
9+
First release from the monorepo: **2.0.0-beta.0** (previously 1.4.6 from the standalone repo).
10+
11+
## Repository and issue tracking
12+
13+
| Before | After |
14+
| --- | --- |
15+
| Source: `github.com/contentstack/contentstack-cli-content-type` | Source: `github.com/contentstack/cli-plugins``packages/contentstack-content-type` |
16+
| Issues: contentstack-cli-content-type repo | Issues: [cli-plugins issues](https://github.com/contentstack/cli-plugins/issues) (label or mention `content-type` / `contentstack-cli-content-type`) |
17+
18+
The standalone **contentstack-cli-content-type** repository should be **archived** after the first release from cli-plugins. Open PRs and bugs should be recreated or linked in cli-plugins.
19+
20+
## Version lines (1.x vs 2.x)
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` |
25+
| **2.x beta** | `v2-dev` / `v2-beta` | Align with 2.x beta core packages; npm tag `beta` |
26+
27+
Develop and release each line on its branch; do not mix 1.x and 2.x dependency pins in the same branch.
28+
29+
## Install (unchanged)
30+
31+
```bash
32+
csdx plugins:install contentstack-cli-content-type
33+
```
34+
35+
## Commands (unchanged)
36+
37+
All 6 commands are identical to the standalone version:
38+
39+
| Command | Description |
40+
| --- | --- |
41+
| `csdx content-type:list` | List all Content Types in a Stack |
42+
| `csdx content-type:details` | Display Content Type fields, types, references, and paths |
43+
| `csdx content-type:audit` | Display recent changes (audit log) for a Content Type |
44+
| `csdx content-type:compare` | Compare two versions of a Content Type in the same Stack |
45+
| `csdx content-type:compare-remote` | Compare the same Content Type across two Stacks |
46+
| `csdx content-type:diagram` | Generate a visual diagram (SVG or DOT) of the Stack content model |
47+
48+
## Local development
49+
50+
Clone [cli-dev-workspace](https://github.com/contentstack/cli-dev-workspace) (or cli-plugins only), then:
51+
52+
```bash
53+
cd cli-plugins
54+
pnpm install
55+
pnpm --filter contentstack-cli-content-type run build
56+
pnpm --filter contentstack-cli-content-type test
57+
```
58+
59+
To link the plugin locally into your `csdx` installation:
60+
61+
```bash
62+
cd packages/contentstack-content-type
63+
csdx plugins:link
64+
```
65+
66+
See [packages/contentstack-content-type/AGENTS.md](./packages/contentstack-content-type/AGENTS.md) and the [skills/](./packages/contentstack-content-type/skills/) directory for contributor docs.
67+
68+
## Test framework note
69+
70+
This package uses **Jest + ts-jest** (unlike most other packages in this monorepo which use Mocha + Chai). Tests live under `packages/contentstack-content-type/tests/` and run via `pnpm test` or `pnpm run test:unit`.
71+
72+
## Related migrations
73+
74+
- Apps CLI: [APPS-CLI-MIGRATION.md](./APPS-CLI-MIGRATION.md)
75+
- Tsgen plugin: [TSGEN-MIGRATION.md](./TSGEN-MIGRATION.md)
76+
- Core CLI: [cli](https://github.com/contentstack/cli) monorepo

0 commit comments

Comments
 (0)