diff --git a/.cursor/rules/README.md b/.cursor/rules/README.md index cbb51b61b..6c4c0e333 100644 --- a/.cursor/rules/README.md +++ b/.cursor/rules/README.md @@ -37,7 +37,7 @@ Context-aware rules that load automatically based on the files you're editing, o ### Monorepo Structure -This is a **CLI plugins** monorepo with 12 plugin packages under `packages/`: +This is a **CLI plugins** monorepo with plugin packages under `packages/`, including: - `contentstack-audit` - Stack audit and fix operations - `contentstack-bootstrap` - Seed/bootstrap stacks with content - `contentstack-branches` - Git-based branch management for stacks @@ -50,6 +50,9 @@ This is a **CLI plugins** monorepo with 12 plugin packages under `packages/`: - `contentstack-migration` - Content migration workflows - `contentstack-seed` - Seed stacks with generated data - `contentstack-variants` - Manage content variants +- `contentstack-apps-cli` - Developer Hub apps (`app:*` commands; npm `@contentstack/apps-cli`) +- `contentstack-content-type` - Content Type introspection (`content-type:*` commands; npm `contentstack-cli-content-type`; Jest tests) +- `contentstack-cli-tsgen` - TypeScript typings (`csdx tsgen`; npm `contentstack-cli-tsgen`; Jest integration tests) All plugins depend on: - `@contentstack/cli-command` - Base Command class diff --git a/.github/config/release.json b/.github/config/release.json index 078a8824b..8bb034f84 100755 --- a/.github/config/release.json +++ b/.github/config/release.json @@ -1,6 +1,8 @@ { "releaseAll": true, "plugins": { + "variants": false, + "query-export": false, "utilities": false, "command": false, "config": false, @@ -17,6 +19,11 @@ "dev-dependencies": false, "launch": false, "branches": false, + "apps-cli": false, + "content-type": false, + "regex-validate": false, + "tsgen": false, + "bulk-operations": false, "core": false } } diff --git a/.github/workflows/release-production-plugins.yml b/.github/workflows/release-production-plugins.yml index e17f9a817..81d5f1c19 100644 --- a/.github/workflows/release-production-plugins.yml +++ b/.github/workflows/release-production-plugins.yml @@ -103,6 +103,14 @@ jobs: package: ./packages/contentstack-migration/package.json tag: latest + # Migrate RTE + - name: Publishing migrate RTE (Production) + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-migrate-rte/package.json + tag: latest + # Seed - name: Publishing seed (Production) uses: JS-DevTools/npm-publish@v3 @@ -127,6 +135,14 @@ jobs: package: ./packages/contentstack-bulk-publish/package.json tag: latest + # Bulk Operations + - name: Publishing bulk operations (Production) + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-bulk-operations/package.json + tag: latest + # Branches - name: Publishing branches (Production) uses: JS-DevTools/npm-publish@v3 @@ -143,6 +159,30 @@ jobs: package: ./packages/contentstack-query-export/package.json tag: latest + # Content Type + - name: Publishing content-type (Production) + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-content-type/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 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/contentstack-cli-tsgen/package.json + tag: latest + - name: Create Production Release id: create_release env: diff --git a/.github/workflows/tsgen-integration-test.yml b/.github/workflows/tsgen-integration-test.yml new file mode 100644 index 000000000..1d1affab1 --- /dev/null +++ b/.github/workflows/tsgen-integration-test.yml @@ -0,0 +1,52 @@ +name: Tsgen Integration Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + tsgen-integration: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.28.0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build tsgen plugin + run: pnpm --filter contentstack-cli-tsgen run build + + - name: Install Contentstack CLI (v1) + run: npm i -g @contentstack/cli + + - name: Configure CLI region + run: csdx config:set:region ${{ secrets.REGION }} + + - name: Add delivery token + run: csdx auth:tokens:add -a ${{ secrets.TOKEN_ALIAS }} --delivery -k ${{ secrets.APIKEY }} --token ${{ secrets.DELIVERYKEY }} -e ${{ secrets.ENVIRONMENT }} + + - name: Link tsgen plugin + working-directory: ./packages/contentstack-cli-tsgen + run: csdx plugins:link + + - name: Run integration tests + run: pnpm --filter contentstack-cli-tsgen run test:integration + env: + TOKEN_ALIAS: ${{ secrets.TOKEN_ALIAS }} + + - name: Unlink tsgen plugin + working-directory: ./packages/contentstack-cli-tsgen + run: csdx plugins:unlink + if: always() diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index eecc68d16..ea6eb86b2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -65,3 +65,27 @@ jobs: - name: Run tests for Contentstack Query Export working-directory: ./packages/contentstack-query-export run: npm run test:unit + + - 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 Content Type plugin + working-directory: ./packages/contentstack-content-type + run: npm run test:unit + + - 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 + + - 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/.talismanrc b/.talismanrc index 3e8b96c8b..abd4b976c 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,4 +1,96 @@ fileignoreconfig: + - filename: packages/contentstack-migrate-rte/test/dummy/expectedEntriesResponse.json + checksum: a2784a3cb21780434958478d478dcb91d2d9a3a8025567d90fe8d74e9141b052 + - filename: packages/contentstack-migrate-rte/test/dummy/entriesResponse.json + checksum: 691f3dcfbbcf69fd21e109a0d7003bdb500af2d0253bb7d7e8a0636d8f2a58f4 - filename: pnpm-lock.yaml - checksum: 89acb731dc98c886694fa4d267c11c188000b8ecbe5ee6e4809e5bc6ec33a2f3 + checksum: e0fb4541c1f31354c8899eba61bc579942a4c1057658973b4691c2890c98ff93 + - 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/core/index.test.ts + checksum: 0d789258f5a9664e8a7dc5f5b23da846d0eaf8c52638ff20fb1f26104d3f9f8d + - filename: packages/contentstack-migrate-rte/README.md + checksum: 3810817d905405de86814af35fc0f0a6712cacd70f43223869b4f0599b6e579c + - filename: packages/contentstack-bulk-operations/test/unit/messages/index.test.ts + checksum: e86e76db4f4afc899ae2a4742627a71a7d227a7139014361b9d83de6154b3c7a + - filename: packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts + checksum: 18684a596707865e671f1ee57b4819cb3f4b4f2633d6c49f7f4b6ce09391359f + - filename: packages/contentstack-bulk-operations/src/base-bulk-command.ts + checksum: 34907f0e00c40096cbe517b680a24fdf57caac351e45bc44b96e41987e619b67 + - filename: packages/contentstack-bulk-operations/test/unit/services/index.test.ts + checksum: aae62ba072551bedf869ec7b1f6bf90238bc039336f37e7c583da8ba0637f9be + - filename: packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts + checksum: cec7ba35157c6516d67931d41deb57b7a156d9fc05dbab93ca5116e89b95c820 + - filename: packages/contentstack-bulk-operations/test/unit/utils/client.test.ts + checksum: 178611b1f153b46a0020da22cc18293d5bd9c539ec2e54557fd8c1a3c2e796b3 + - filename: packages/contentstack-bulk-operations/test/unit/services/taxonomy-service.test.ts + checksum: 33af8ee198158dd92916d76207e172b5316864d063a6929526ca259b459ec79a + - filename: packages/contentstack-cli-tsgen/src/commands/tsgen.ts + checksum: 054ea78f765edca62c785714cf8962df4fb91529c0851439d1ed61e963467408 + - filename: packages/contentstack-cli-cm-regex-validate/messages/index.json + checksum: 044b311bde624dcc3c12434174d6027dbb6b62eefdfae120570a1748f806c60c + - filename: packages/contentstack-cli-tsgen/AGENTS.md + checksum: 75b4f1414b547d0bd83df5ed4fb80020acc0ed849619bed2639491b565be7a1b + - filename: packages/contentstack-bulk-operations/eslint.config.js + checksum: 0d93d7f660fe4cd6d62348c85ac10bf7c66018ea0b8e3e6d5a53419433f15867 + - filename: packages/contentstack-cli-cm-regex-validate/test/utils/connect-stack.test.ts + checksum: 8fcd1dc2770a2a3f55ba462b7ffd3fc2e3cf45342c63e5b6dc5c1db4c2bd9738 + - filename: packages/contentstack-bulk-operations/test/unit/utils/validators.test.ts + checksum: 69cf394584e325b972d6825879de7c31b9dd1bd50b0bb057aecb739258ac0317 + - filename: packages/contentstack-bulk-operations/test/unit/commands/bulk-assets.test.ts + checksum: c099c628c7ae1a40a9ca5580de0afa8309a611b2dff7837b10bb8f70eb92f8b3 + - filename: packages/contentstack-bulk-operations/test/unit/core/operation-executor.test.ts + checksum: 97f0ddd4d547f37a8d93650aa1e8af4ef4dbce343dd51853e34bbde6107cd725 + - filename: packages/contentstack-cli-tsgen/src/lib/helper.ts + checksum: a7ead0030ead9d15b6b6e9623f61e7def77b00325e3988f0e3d73a145180dedc + - filename: packages/contentstack-migrate-rte/test/utils/index.js + checksum: bc2a509a86174aecbaf0bfc44d6ad3afabe57ef871ec91b796d498e00177e3f0 + - filename: packages/contentstack-cli-cm-regex-validate/skills/code-review/SKILL.md + checksum: b92ea1c8e2f901c9e1e60f6ef6986d348a40a7869c236e3c1f3ca53b553dbb8e + - filename: packages/contentstack-migrate-rte/test/commands/json-migration.test.js + checksum: 56e10f1e0d2794fa13bcf5a6bb3e868b28277df1762fb3df0a8a82ad44f8045b + - filename: packages/contentstack-bulk-operations/test/unit/utils/interactive.test.ts + checksum: 3ee0ff5a74929346bfe997aeb977b4e93d398ea63892efc5f85e0b51a21074f6 + - filename: packages/contentstack-bulk-operations/src/core/operation-executor.ts + checksum: 46295f495f007ad291787133936c5af3c76838d72f2be0de9c235bb644d6f905 + - filename: packages/contentstack-bulk-operations/src/utils/batch-queue-handler.ts + checksum: d1d031242b99f5c738e2f4587ca2f5f3e96373e479ebaf4d93b2f98152943593 + - filename: packages/contentstack-bulk-operations/src/messages/index.ts + checksum: 2d904462af6dc3ddc00ae6bb4433c846500ddfecee5a9e1fb1c236bd598a2ee1 + - filename: packages/contentstack-migrate-rte/src/commands/cm/entries/migrate-html-rte.js + checksum: a069c50d5152022a0957d5f597158e2d8c74803b3d24ff6bbbe3b09f0e9053e2 + - filename: packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts + checksum: d46757d3bb98d76845e83d4585f269b62b1fa9cb5bee3215b88fed38fd1dbb53 + - filename: packages/contentstack-bulk-operations/src/utils/revert-retry-handler.ts + checksum: 76899098d74de1dd20f1b08401c65f23b2bec584c051388e63f70f3d24a6d1a4 + - filename: packages/contentstack-bulk-operations/src/utils/interactive.ts + checksum: ba4fdd6f17c7d43cae639158f82dea3065ba8a368ddce8c476bfe49a6945e5c1 + - filename: packages/contentstack-bulk-operations/test/unit/utils/taxonomy-interactive-select.test.ts + checksum: 34a085702d01d7e16e1507ea1e434b374c2cba5dd884aad5996c5484412897c0 + - filename: packages/contentstack-bulk-operations/src/core/rate-limiter.ts + checksum: 81e3d624166ab34a589e3e8527b9e57ebc7e7f4374efd0483b1df0dd11788b68 + - filename: packages/contentstack-bulk-operations/src/interfaces/index.ts + checksum: 0ff6bbc372758a20783f36bd391ba9d500530433fde472a1aacaf54f6b4a1688 + - filename: packages/contentstack-bulk-operations/test/unit/utils/operation-confirmation.test.ts + checksum: 043185e56361ffae2116a2af5a4da16986816ad054fd94f189269e5b6150609e + - 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-bulk-operations/test/unit/commands/bulk-entries.test.ts + checksum: 845512e660813a6d7d96efd89dcff6eba4591a3f9ff371dc9b1aad38921e18a6 + - filename: packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts + checksum: 078f9633edb53204ed14ebe3cf6b1d6063729dd37b7ee1c6e936a344ceabebda + - filename: packages/contentstack-migrate-rte/src/lib/util/index.js + checksum: 7d85f342c7fd7875713cebfae83f68d8592cc732a15cca48ddecbeae818cb4c5 + - filename: packages/contentstack-cli-cm-regex-validate/src/utils/connect-stack.ts + checksum: c77c7c25efc6d043b26e3dd0a516e22ac50142fa9fa5ff3a53a7c9fb8f24ebd6 + - filename: packages/contentstack-bulk-operations/src/utils/config-builder.ts + checksum: a7b5259ad719b8c5929f9fea3783bdc92610dc2549426204c1bb6813e7e1112a + - filename: packages/contentstack-bulk-operations/README.md + checksum: 169110e7c6159632f19dc16e17dcb5bac22e5d6880339b35ba076a2fe0d75266 + - filename: packages/contentstack-bulk-operations/test/unit/utils/batch-queue-handler.test.ts + checksum: c91f1822b5cfd34a4f4ba05dfc56c10a66e0f5ddb55a1cf5b454fa9549ea0052 version: '1.0' diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..565826b2c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,75 @@ +# 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; layouts under `packages/*/test/` (see [skills/testing/SKILL.md](skills/testing/SKILL.md)) | +| **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/). + +## Where the documentation lives: skills + +| Skill | Path | What it covers | +| --- | --- | --- | +| Development workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | pnpm commands, CI, TDD expectations, PR checklist | +| Contentstack CLI | [skills/contentstack-cli/SKILL.md](skills/contentstack-cli/SKILL.md) | Plugin commands, OCLIF, Contentstack APIs (incl. `app:*` / `@contentstack/apps-cli`) | +| Framework | [skills/framework/SKILL.md](skills/framework/SKILL.md) | Utilities, config, logging, errors (incl. Developer Hub SDK, manifests, GraphQL) | +| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Mocha/Chai, coverage, mocks | +| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR review for this monorepo | + +## 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:** 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) + +## Content Type plugin (`contentstack-cli-content-type`) + +- **Package path:** [packages/contentstack-content-type](packages/contentstack-content-type) +- **npm name:** `contentstack-cli-content-type` +- **Migrated from:** [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) — see [CONTENT-TYPE-MIGRATION.md](CONTENT-TYPE-MIGRATION.md) +- **v1 / v2:** This branch carries the **v1 line** (`@contentstack/cli-command ^1.8.2`, `@contentstack/cli-utilities ^1.18.3`, npm tag `latest`). The v2-beta line lives on `v2-beta`. +- **Tests:** Jest + ts-jest (unlike most other packages which use Mocha + Chai) +- **Docs:** 6 commands under `content-type:*` → [packages/contentstack-content-type/AGENTS.md](packages/contentstack-content-type/AGENTS.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. diff --git a/APPS-CLI-MIGRATION.md b/APPS-CLI-MIGRATION.md new file mode 100644 index 000000000..d3b9af325 --- /dev/null +++ b/APPS-CLI-MIGRATION.md @@ -0,0 +1,45 @@ +# Apps CLI migration: standalone repo → cli-plugins monorepo + +## Summary + +The **@contentstack/apps-cli** plugin has moved from [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) into [contentstack/cli-plugins](https://github.com/contentstack/cli-plugins) at **`packages/contentstack-apps-cli`**. + +The **npm package name is unchanged**: `@contentstack/apps-cli`. + +## Repository and issues + +| Before | After | +| --- | --- | +| `github.com/contentstack/contentstack-apps-cli` | `github.com/contentstack/cli-plugins` → `packages/contentstack-apps-cli` | +| 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 | Apps plugin | +| --- | --- | --- | +| **1.x** | `v1-dev` / `v1-beta` | Version **1.7.x**; `@contentstack/cli-command` ~1.8.2, `@contentstack/cli-utilities` ~1.18.x; chalk v4 | +| **2.x beta** | `v2-dev` / `v2-beta` | Version **2.0.0-beta.x**; 2.x beta core packages; chalk v5 | + +Develop and release each line on its branch. + +## Install (unchanged) + +```bash +csdx plugins:install @contentstack/apps-cli +``` + +## Local development (cli-dev-workspace) + +```bash +cd cli-dev-workspace +pnpm install +pnpm --filter @contentstack/apps-cli run build +pnpm -C cli/packages/contentstack run build +``` + +Core CLI must list `@contentstack/apps-cli` as `workspace:*` and register it in `oclif.plugins` — see [cli](https://github.com/contentstack/cli) `packages/contentstack/package.json`. + +## Contributor docs + +- [AGENTS.md](./AGENTS.md) +- [skills/contentstack-apps/SKILL.md](./skills/contentstack-apps/SKILL.md) diff --git a/BULK-OPERATIONS-MIGRATION.md b/BULK-OPERATIONS-MIGRATION.md new file mode 100644 index 000000000..576e83c0b --- /dev/null +++ b/BULK-OPERATIONS-MIGRATION.md @@ -0,0 +1,520 @@ +# 🔄 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? + +We've consolidated **15 separate commands** into **2 simple commands** with flags: + +**Before (v1.x):** +- ❌ `cm:entries:publish` +- ❌ `cm:entries:publish-modified` +- ❌ `cm:entries:publish-only-unpublished` +- ❌ `cm:entries:unpublish` +- ❌ `cm:assets:publish` +- ❌ `cm:assets:unpublish` +- ❌ `cm:stacks:unpublish` +- ❌ `cm:bulk-publish:cross-publish` +- ❌ And 7 more commands... + +**After (v2.0):** +- `csdx cm:stacks:bulk-entries` (for all entry operations) +- `csdx cm:stacks:bulk-assets` (for all asset operations) + +--- + +## Quick Migration Examples + +### 1️⃣ **Basic Publish Entries** + +```bash +# OLD +csdx cm:entries:publish --content-types blog --environments prod --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed from `cm:entries:publish` to `cm:stacks:bulk-entries` +- Added required `--operation publish` flag + +--- + +### 2️⃣ **Publish Only Modified Entries** + +```bash +# OLD +csdx cm:entries:publish-modified --content-types blog --source-env staging --environments prod --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-entries --operation publish --filter modified --content-types blog --source-env staging --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-entries` +- Added `--filter modified` flag instead of separate command + +--- + +### 3️⃣ **Publish Only Unpublished Entries** + +```bash +# OLD +csdx cm:entries:publish-only-unpublished --content-types blog --environments prod --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-entries --operation publish --filter unpublished --content-types blog --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-entries` +- Added `--filter unpublished` flag + +--- + +### 4️⃣ **Publish Non-Localized Field Changes** + +```bash +# OLD +csdx cm:entries:publish-non-localized-fields --content-types blog --source-env staging --environments prod -k blt123 + +# NEW +csdx cm:stacks:bulk-entries --operation publish --filter non-localized --content-types blog --source-env staging --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-entries` +- Added `--filter non-localized` flag +- `--locales` flag is now required + +--- + +### 5️⃣ **Unpublish Entries** + +```bash +# OLD +csdx cm:entries:unpublish --content-types blog --environments staging --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-entries --operation unpublish --content-types blog --environments staging --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-entries` +- Added `--operation unpublish` flag + +--- + +### 6️⃣ **Publish Assets** + +```bash +# OLD +csdx cm:assets:publish --environments prod --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-assets --operation publish --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-assets` +- Added `--operation publish` flag + +--- + +### 7️⃣ **Publish Assets from Specific Folder** + +```bash +# OLD +csdx cm:assets:publish --folder-uid images_folder --environments prod --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-assets --operation publish --folder-uid images_folder --environments prod --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-assets` +- Added `--operation publish` flag +- `--folder-uid` flag remains the same + +--- + +### 8️⃣ **Unpublish Assets** + +```bash +# OLD +csdx cm:assets:unpublish --environments staging --locales en-us -k blt123 + +# NEW +csdx cm:stacks:bulk-assets --operation unpublish --environments staging --locales en-us -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-assets` +- Added `--operation unpublish` flag + +--- + +### 9️⃣ **Cross-Publish Entries** + +```bash +# OLD +csdx cm:bulk-publish:cross-publish --source-env staging --environments prod --locales en-us -k blt123 --delivery-token blt*** + +# NEW - Step 1: Add delivery token as alias +csdx auth:tokens:add \ + -a staging-delivery \ + --delivery-token blt*** \ + --api-key blt123 \ + --environment staging \ + --type delivery + +# NEW - Step 2: Use the alias for cross-publish +csdx cm:stacks:bulk-entries \ + --operation publish \ + --source-env staging \ + --source-alias staging-delivery \ + --content-types blog article \ + --environments prod \ + --locales en-us \ + -k blt123 +``` + +**What changed:** +- Command renamed to `cm:stacks:bulk-entries` +- Delivery token must be stored as an alias first +- Added `--source-alias` flag (required for cross-publish) +- `--delivery-token` flag no longer supported inline + +--- + +### 🔟 **Unpublish All Content (Entries + Assets)** + +```bash +# OLD +csdx cm:stacks:unpublish --environments staging --locales en-us -k blt123 + +# NEW - Run two commands: +# 1. Unpublish entries +csdx cm:stacks:bulk-entries --operation unpublish --content-types blog,article,page --environments staging --locales en-us -k blt123 + +# 2. Unpublish assets +csdx cm:stacks:bulk-assets --operation unpublish --environments staging --locales en-us -k blt123 +``` + +**What changed:** +- Split into two explicit commands for better control +- Must specify content types for entries + +--- + +## ⚠️ Missing Functionality in v2.0 + +The following features from v1.x are **NOT** available in v2.0: + +### **1. Interactive Menu Command** +```bash +# ❌ NOT AVAILABLE +csdx cm:stacks:publish +``` + +**Impact:** You must use explicit commands instead of an interactive selection menu. + +**Workaround:** Use the explicit `bulk-entries` or `bulk-assets` commands directly. + +--- + +### **2. Configuration Generator Command** +```bash +# ❌ NOT AVAILABLE +csdx cm:stacks:publish-configure +csdx cm:bulk-publish:configure +``` + +**Impact:** No command to generate configuration files interactively. + +**Workaround:** Create `config.json` files manually (see [Config File Support](#7-config-file-support) above). + +--- + +### **3. Clear Logs Command** +```bash +# ❌ NOT AVAILABLE +csdx cm:stacks:publish-clear-logs +csdx cm:bulk-publish:clear +``` + +**Impact:** No CLI command to clear log files. + +**Workaround:** Use OS commands: +```bash +# Unix/Linux/Mac +rm -rf ./bulk-operation/* + +# Windows +del /q bulk-operation\* +``` + +--- + +### **4. Publish All Content Types Flag** +```bash +# ❌ NOT AVAILABLE +--publish-all-content-types +``` + +**Impact:** If content-types flag isn't provided then it will automatically fetch all content types. + +```bash +csdx cm:stacks:bulk-entries --operation publish --environments prod --locales en-us -k blt123 +``` + +--- + +### **5. Direct Delivery Token Flag** +```bash +# ❌ NOT AVAILABLE +--delivery-token blt*** +``` + +**Impact:** Cannot pass delivery token directly for cross-publish. + +**Workaround:** Store delivery token as an alias first: +```bash +# Step 1: Add delivery token +csdx auth:tokens:add -a prod-delivery --delivery-token blt*** --api-key blt123 --environment production --type delivery + +# Step 2: Use the alias +csdx cm:stacks:bulk-entries --operation publish --source-env production --source-alias prod-delivery --environments staging --locales en-us -k blt123 +``` + +--- + +## 📝 Step-by-Step Migration Process + +### **Step 1: Find Your Current Command** + +Look at your existing scripts/CI-CD pipelines and identify which old commands you're using. + +Example: `csdx cm:entries:publish-modified` + +--- + +### **Step 2: Find the Equivalent in the Table Above** + +For `cm:entries:publish-modified`, the new command is: +```bash +csdx cm:stacks:bulk-entries --operation publish --filter modified +``` + +--- + +### **Step 3: Update Authentication for Cross-Publish** + +If you use cross-publish with delivery tokens, store them as aliases: + +```bash +# Old way (not supported) +csdx cm:bulk-publish:cross-publish --delivery-token blt*** ... + +# New way - Step 1: Store token +csdx auth:tokens:add \ + -a staging-delivery \ + --delivery-token blt*** \ + --api-key blt123 \ + --environment staging \ + --type delivery + +# New way - Step 2: Use alias +csdx cm:stacks:bulk-entries --operation publish --source-env staging --source-alias staging-delivery ... +``` + +--- + +### **Step 4: Update Your Script** + +Replace the old command with the new one: + +```bash +# Before +csdx cm:entries:publish-modified --content-types blog --source-env staging --environments prod --locales en-us -k $API_KEY + +# After +csdx cm:stacks:bulk-entries --operation publish --filter modified --content-types blog --source-env staging --environments prod --locales en-us -k $API_KEY +``` + +--- + +### **Step 5: Test Your New Command** + +Run the command in a test environment first: + +```bash +# Test with staging environment +csdx cm:stacks:bulk-entries --operation publish --filter modified --content-types blog --environments staging --locales en-us -k $API_KEY +``` + +--- + +### **Step 6: Update All Scripts** + +Find and replace all instances across your: +- CI/CD pipelines (GitHub Actions, Jenkins, etc.) +- Deployment scripts +- Documentation +- Team runbooks + +--- + +## ⚠️ Breaking Changes + +### **1. Operation Flag Now Required** + +**Old behavior:** +```bash +csdx cm:entries:publish --content-types blog --environments prod --locales en-us -k blt123 +# Command name implies the operation +``` + +**New behavior:** +```bash +csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us -k blt123 +# Must explicitly specify --operation flag +``` + +--- + +### **2. Combined Unpublish Split into Separate Commands** + +**Old behavior:** +```bash +csdx cm:stacks:unpublish --environments staging --locales en-us -k blt123 +# Unpublishes both entries and assets in one command +``` + +**New behavior:** +```bash +# Must run two separate commands for full control +csdx cm:stacks:bulk-entries --operation unpublish --content-types blog article --environments staging --locales en-us -k blt123 +csdx cm:stacks:bulk-assets --operation unpublish --environments staging --locales en-us -k blt123 +``` + +**Benefits:** +- Better control over what gets unpublished +- Clearer logging and error handling +- Can unpublish entries and assets independently + +--- + +### **3. Publish all content types** + +**Old behavior:** +```bash +csdx cm:entries:publish --publish-all-content-types --environments prod --locales en-us -k blt123 +# Flag to publish all content types +``` + +**New behavior:** +```bash +csdx cm:stacks:bulk-entries --operation publish --environments prod --locales en-us -k blt123 +``` + +--- + +### **4. Delivery Token Must Be Stored as Alias** + +**Old behavior:** +```bash +csdx cm:bulk-publish:cross-publish --delivery-token blt*** --source-env prod --environments staging --locales en-us -k blt123 +# Pass delivery token directly +``` + +**New behavior:** +```bash +# Step 1: Store delivery token +csdx auth:tokens:add -a prod-delivery --delivery-token blt*** --api-key blt123 --environment production --type delivery + +# Step 2: Use the alias +csdx cm:stacks:bulk-entries --operation publish --source-env production --source-alias prod-delivery --content-types blog --environments staging --locales en-us -k blt123 +``` + +**Why?** +- More secure (tokens not in command history) +- Tokens can be reused across commands +- Better token management + +--- + +### **5. Filter Flags Replace Separate Commands** + +**Old behavior:** +```bash +# Different commands for different filters +csdx cm:entries:publish-modified ... +csdx cm:entries:publish-only-unpublished ... +csdx cm:entries:publish-non-localized-fields ... +``` + +**New behavior:** +```bash +# One command with --filter flag +csdx cm:stacks:bulk-entries --operation publish --filter modified ... +csdx cm:stacks:bulk-entries --operation publish --filter unpublished ... +csdx cm:stacks:bulk-entries --operation publish --filter non-localized ... +``` + +--- + +### **6. Multiple Values Format Changed** + +**Old behavior:** +```bash +# Comma-separated values +--environments dev,staging,prod +--locales en-us,es-es,fr-fr +``` + +**New behavior:** +```bash +# Space-separated values +--environments dev staging prod +--locales en-us es-es fr-fr +``` + +--- + +## 📝 Summary + +**Key Takeaways:** + +1. **Two commands replace 15 old commands**: `cm:stacks:bulk-entries` and `cm:stacks:bulk-assets` +2. **Operation flag is required**: Always specify `--operation publish` or `--operation unpublish` +3. **Filters replace separate commands**: Use `--filter` for modified, unpublished, draft, non-localized +4. **Delivery tokens must be stored as aliases**: Use `auth:tokens:add` before cross-publish +5. **Content types must be explicit**: No more `--publish-all-content-types` +6. **Config files recommended for complex operations**: Use JSON files with `--config` flag +7. **New features**: `--publish-mode`, `--revert`, `--include-variants`, `--api-version` + +**Migration is straightforward:** +- Replace old command names with new ones +- Add `--operation` flag +- Use `--filter` instead of separate commands +- Store delivery tokens as aliases for cross-publish +- Test in lower environments first + +**Need Help?** +- Check [official documentation](https://www.contentstack.com/docs/developers/cli/bulk-operations-in-cli) +- Contact [Contentstack Support](https://www.contentstack.com/support/) + + diff --git a/MIGRATE-RTE-MIGRATION.md b/MIGRATE-RTE-MIGRATION.md new file mode 100644 index 000000000..595ef45a7 --- /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` | e.g. **1.6.x**; `@contentstack/cli-command` ~1.8.2, `@contentstack/cli-utilities` ~1.18.x; chalk v4 | +| **2.x beta** | `v2-dev` / `v2-beta` | e.g. **2.0.0-beta.x**; 2.x beta core packages; chalk v5 + `load-chalk` init hook | + +## 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 until the monorepo package is published). diff --git a/README.md b/README.md index 60eca7d5e..cae98a050 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ CLI supports content management scripts through which you can perform the follow - Migrate HTML RTE to JSON RTE content - Change Master Locale - Use Bootstrap plugin +- Manage Developer Hub apps (`app:*` via `@contentstack/apps-cli`) - Use Tsgen plugin @@ -55,3 +56,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) +- [Manage Content Types (list, details, audit, compare, diagram)](https://github.com/contentstack/cli-plugins/tree/main/packages/contentstack-content-type) (`contentstack-cli-content-type`) +- [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`) diff --git a/REGEX-VALIDATE-MIGRATION.md b/REGEX-VALIDATE-MIGRATION.md new file mode 100644 index 000000000..ee712fdf7 --- /dev/null +++ b/REGEX-VALIDATE-MIGRATION.md @@ -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) diff --git a/packages/contentstack-apps-cli/.eslintignore b/packages/contentstack-apps-cli/.eslintignore new file mode 100644 index 000000000..9b1c8b133 --- /dev/null +++ b/packages/contentstack-apps-cli/.eslintignore @@ -0,0 +1 @@ +/dist diff --git a/packages/contentstack-apps-cli/.eslintrc b/packages/contentstack-apps-cli/.eslintrc new file mode 100644 index 000000000..aa58bce72 --- /dev/null +++ b/packages/contentstack-apps-cli/.eslintrc @@ -0,0 +1,42 @@ +{ + "env": { + "node": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "plugin:@typescript-eslint/recommended" + ], + "ignorePatterns": [ + "lib/**/*", + "test/**/*" + ], + "rules": { + "@typescript-eslint/no-unused-vars": [ + "error", + { + "args": "none" + } + ], + "@typescript-eslint/prefer-namespace-keyword": "error", + "quotes": "off", + "semi": "off", + "@typescript-eslint/no-redeclare": "off", + "eqeqeq": [ + "error", + "smart" + ], + "id-match": "error", + "no-eval": "error", + "no-var": "error", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-require-imports": "off", + "prefer-const": "error" + } +} \ No newline at end of file diff --git a/packages/contentstack-apps-cli/.gitignore b/packages/contentstack-apps-cli/.gitignore new file mode 100644 index 000000000..976172982 --- /dev/null +++ b/packages/contentstack-apps-cli/.gitignore @@ -0,0 +1,21 @@ +*-debug.log +*-error.log +/.nyc_output +/dist +/lib +/package-lock.json +/tmp +/yarn.lock +node_modules +oclif.manifest.json +.env +*.log +tsconfig.tsbuildinfo +dependabot.yml +.vscode +*.todo +/bkp +.editorconfig +oclif.manifest.json +*.env +.vscode/ diff --git a/packages/contentstack-apps-cli/.mocharc.json b/packages/contentstack-apps-cli/.mocharc.json new file mode 100644 index 000000000..4a09d1446 --- /dev/null +++ b/packages/contentstack-apps-cli/.mocharc.json @@ -0,0 +1,12 @@ +{ + "require": [ + "test/helpers/init.js", + "ts-node/register" + ], + "watch-extensions": [ + "ts" + ], + "recursive": true, + "reporter": "spec", + "timeout": 60000 +} diff --git a/packages/contentstack-apps-cli/.snyk b/packages/contentstack-apps-cli/.snyk new file mode 100644 index 000000000..73147de24 --- /dev/null +++ b/packages/contentstack-apps-cli/.snyk @@ -0,0 +1,10 @@ +# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. +version: v1.25.1 +# ignores vulnerabilities until expiry date; change duration by modifying expiry date +ignore: + SNYK-JS-TMP-11501554: + - '*': + reason: 'https://contentstack.atlassian.net/browse/IS-5312' + expires: 2025-11-06T14:18:34.2257Z + created: 2025-08-08T14:18:34.2256Z +patch: {} diff --git a/packages/contentstack-apps-cli/LICENSE b/packages/contentstack-apps-cli/LICENSE new file mode 100644 index 000000000..aff1142ee --- /dev/null +++ b/packages/contentstack-apps-cli/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-apps-cli/README.md b/packages/contentstack-apps-cli/README.md new file mode 100644 index 000000000..06e597559 --- /dev/null +++ b/packages/contentstack-apps-cli/README.md @@ -0,0 +1,313 @@ +> **Source of truth:** [cli-plugins](https://github.com/contentstack/cli-plugins) — `packages/contentstack-apps-cli` (v1 line: `v1-dev` / `v1-beta`) +> Migrated from [contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli). See [APPS-CLI-MIGRATION.md](../../APPS-CLI-MIGRATION.md). + + + + +# @contentstack/apps-cli + +Contentstack lets you develop apps in your organization using the Developer Hub portal. With the Apps CLI plugin, Contentstack CLI allows you to perform the CRUD operations on your app in Developer Hub and then use the app in your organization or stack by installing or uninstalling your app as required. + +## How to install this plugin + +```shell +$ csdx plugins:install @contentstack/apps-cli +``` + +## How to use this plugin + +This plugin requires you to be authenticated using [csdx auth:login](https://www.contentstack.com/docs/developers/cli/authenticate-with-the-cli/). + + +```sh-session +$ npm install -g @contentstack/apps-cli +$ csdx COMMAND +running command... +$ csdx (--version|-v) +@contentstack/apps-cli/1.6.1 darwin-arm64 node-v18.20.2 +$ csdx --help [COMMAND] +USAGE + $ csdx COMMAND +... +``` + + +# Commands + + +* [`csdx app`](#csdx-app) +* [`csdx app:create`](#csdx-appcreate) +* [`csdx app:delete`](#csdx-appdelete) +* [`csdx app:deploy`](#csdx-appdeploy) +* [`csdx app:get`](#csdx-appget) +* [`csdx app:install`](#csdx-appinstall) +* [`csdx app:reinstall`](#csdx-appreinstall) +* [`csdx app:uninstall`](#csdx-appuninstall) +* [`csdx app:update`](#csdx-appupdate) + +## `csdx app` + +Apps CLI plugin + +``` +USAGE + $ csdx app + +DESCRIPTION + Apps CLI plugin + +EXAMPLES + $ csdx app:create + + $ csdx app:delete + + $ csdx app:deploy + + $ csdx app:get + + $ csdx app:install + + $ csdx app:reinstall + + $ csdx app:uninstall + + $ csdx app:update +``` + +_See code: [src/commands/app/index.ts](https://github.com/contentstack/apps-cli/blob/v1.6.1/src/commands/app/index.ts)_ + +## `csdx app:create` + +Create a new app in Developer Hub and optionally clone a boilerplate locally. + +``` +USAGE + $ csdx app:create [--org ] [-n ] [--app-type stack|organization] [-c ] [-d ] + [--boilerplate ] + +FLAGS + -c, --config= Path of the external config + -d, --data-dir= Current working directory. + -n, --name= Name of the app to be created + --app-type=