Skip to content

Commit 6b01505

Browse files
feat: migrate Apps CLI plugin to cli-plugins monorepo and add related documentation
- Moved the `@contentstack/apps-cli` plugin from the external plugin to the `cli-plugins` monorepo. - Updated `AGENTS.md` to include Developer Hub apps in the purpose and added new sections for the Apps CLI plugin. - Created `APPS-CLI-MIGRATION.md` to document the migration process and repository changes. - Added new commands and configuration files for the Apps CLI plugin. - Updated CI workflows to include testing and publishing for the Apps CLI plugin.
1 parent 8c00c36 commit 6b01505

75 files changed

Lines changed: 7524 additions & 3 deletions

Some content is hidden

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

.cursor/rules/apps-cli.mdc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
description: 'Contentstack Apps CLI plugin (Developer Hub app lifecycle)'
3+
globs:
4+
[
5+
'packages/contentstack-apps-cli/**/*.ts',
6+
'packages/contentstack-apps-cli/test/**/*.ts',
7+
]
8+
alwaysApply: false
9+
---
10+
11+
# Apps CLI plugin standards
12+
13+
Canonical docs: [AGENTS.md](../../AGENTS.md) and skills:
14+
15+
- [skills/contentstack-apps/SKILL.md](../../skills/contentstack-apps/SKILL.md) — manifests, GraphQL, HTTP
16+
- [skills/apps-cli-framework/SKILL.md](../../skills/apps-cli-framework/SKILL.md) — `BaseCommand`, `AppCLIBaseCommand`, flags
17+
- [skills/apps-cli-typescript/SKILL.md](../../skills/apps-cli-typescript/SKILL.md) — TS/ESLint
18+
19+
## Command layout
20+
21+
- Commands live under `packages/contentstack-apps-cli/src/commands/app/`
22+
- Topic: `app` (e.g. `csdx app:create`, `csdx app:deploy`)
23+
- Extend `AppCLIBaseCommand` for manifest workflows; otherwise `BaseCommand`
24+
25+
## Testing
26+
27+
- Mocha + Chai + sinon + nock; `@oclif/test` for command runs
28+
- Use `stubAuthentication` from `test/unit/helpers/auth-stub-helper.ts`
29+
- No real API credentials; `--forbid-only` in CI
30+
31+
## Dependencies
32+
33+
- `@contentstack/cli-command`, `@contentstack/cli-utilities` — version must match the cli-plugins branch (v1 vs v2 beta)
34+
- Chalk v5: loaded via init hook `src/hooks/init/load-chalk.ts`

.github/config/release.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"migration": false,
1010
"seed": false,
1111
"bootstrap": false,
12-
"branches": false
12+
"branches": false,
13+
"apps-cli": false
1314
}
1415
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,11 @@ jobs:
142142
token: ${{ secrets.NPM_TOKEN }}
143143
package: ./packages/contentstack-query-export/package.json
144144
tag: beta
145+
146+
# Apps CLI
147+
- name: Publishing apps-cli (Beta)
148+
uses: JS-DevTools/npm-publish@v3
149+
with:
150+
token: ${{ secrets.NPM_TOKEN }}
151+
package: ./packages/contentstack-apps-cli/package.json
152+
tag: beta

.github/workflows/unit-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ 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:json

AGENTS.md

Lines changed: 11 additions & 1 deletion
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, seed, audit, variants, Developer Hub apps, 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)
@@ -39,6 +39,16 @@ CI: [.github/workflows/unit-test.yml](.github/workflows/unit-test.yml) and other
3939
| Framework | [skills/framework/SKILL.md](skills/framework/SKILL.md) | Utilities, config, logging, errors |
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 |
42+
| Contentstack Apps (Developer Hub) | [skills/contentstack-apps/SKILL.md](skills/contentstack-apps/SKILL.md) | Manifests, GraphQL, HTTP for `packages/contentstack-apps-cli` |
43+
| Apps CLI framework | [skills/apps-cli-framework/SKILL.md](skills/apps-cli-framework/SKILL.md) | `BaseCommand`, `AppCLIBaseCommand`, oclif flags for apps plugin |
44+
| Apps CLI TypeScript | [skills/apps-cli-typescript/SKILL.md](skills/apps-cli-typescript/SKILL.md) | TS/ESLint conventions for apps plugin |
45+
46+
## Apps CLI plugin (`@contentstack/apps-cli`)
47+
48+
- **Package path:** [packages/contentstack-apps-cli](packages/contentstack-apps-cli)
49+
- **npm name:** `@contentstack/apps-cli` (unchanged for consumers)
50+
- **Migrated from:** [contentstack/contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) — see [APPS-CLI-MIGRATION.md](APPS-CLI-MIGRATION.md)
51+
- **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.
4252

4353
## Using Cursor (optional)
4454

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) and [skills/contentstack-apps/SKILL.md](./skills/contentstack-apps/SKILL.md) 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

MIGRATION.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ csdx cm:migrate-rte --help
180180

181181
**Migration Action:** Refer to the detailed [Bulk Operations Migration Guide](./BULK-OPERATIONS-MIGRATION.md) for complete command mappings and examples.
182182

183+
### 7. 📱 Apps CLI plugin repository move
184+
185+
**What Changed:**
186+
- The Apps CLI plugin (`@contentstack/apps-cli`) source moved from the standalone [contentstack-apps-cli](https://github.com/contentstack/contentstack-apps-cli) repository into this **cli-plugins** monorepo at `packages/contentstack-apps-cli`
187+
- The npm package name and `csdx app:*` commands are unchanged
188+
189+
**Migration Action:** For repository location, branching (1.x vs 2.x), and issue tracking, see the [Apps CLI Migration Guide](./APPS-CLI-MIGRATION.md).
190+
183191
**Quick Example:**
184192
```bash
185193
# Before (1.x.x)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CLI supports content management scripts through which you can perform the follow
1515
- Migrate HTML RTE to JSON RTE content
1616
- Change Master Locale
1717
- Use Bootstrap plugin
18+
- Manage Developer Hub apps (`app:*` via `@contentstack/apps-cli`)
1819
- Use Tsgen plugin
1920

2021

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"parser": "@typescript-eslint/parser",
6+
"parserOptions": {
7+
"project": "tsconfig.json",
8+
"sourceType": "module"
9+
},
10+
"plugins": [
11+
"@typescript-eslint"
12+
],
13+
"extends": [
14+
"plugin:@typescript-eslint/recommended"
15+
],
16+
"ignorePatterns": [
17+
"lib/**/*",
18+
"test/**/*"
19+
],
20+
"rules": {
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{
24+
"args": "none"
25+
}
26+
],
27+
"@typescript-eslint/prefer-namespace-keyword": "error",
28+
"quotes": "off",
29+
"semi": "off",
30+
"@typescript-eslint/no-redeclare": "off",
31+
"eqeqeq": [
32+
"error",
33+
"smart"
34+
],
35+
"id-match": "error",
36+
"no-eval": "error",
37+
"no-var": "error",
38+
"@typescript-eslint/no-explicit-any": "off",
39+
"@typescript-eslint/no-require-imports": "off",
40+
"prefer-const": "error"
41+
}
42+
}

0 commit comments

Comments
 (0)