Skip to content

Commit 1404226

Browse files
author
naman-contentstack
committed
Merge branch 'v2-dev' into feat/AM2.0
2 parents 1e8fbdf + 808999c commit 1404226

84 files changed

Lines changed: 3760 additions & 1492 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/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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.

.talismanrc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
fileignoreconfig:
2+
- filename: packages/contentstack-export/src/export/modules/environments.ts
3+
checksum: a92c5de7ed8e80f08f911727973a66e0416b4a52265c275d1d25c3095f912811
4+
- filename: packages/contentstack-import/src/utils/backup-handler.ts
5+
checksum: 9a892b5c4b5aac230fb5969e7f34afdac0b6f96208e64bf9d1195468c935c66c
6+
- filename: packages/contentstack-import/test/unit/utils/backup-handler.test.ts
7+
checksum: 69860727e9b3099d8e1e95db2af17fc8b161684f675477981d27877cd8e1b3bb
28
- filename: pnpm-lock.yaml
3-
checksum: 7a2d08a029dd995917883504dd816fc7a579aca7d3e39fc5368959f0e766c7b2
9+
checksum: 794f45eb36d5f0639963694dc6d5e0c6a789584e9a7a3e54bd0d531275c29857
10+
- filename: packages/contentstack-export/test/unit/export/module-exporter.test.ts
11+
checksum: 67b70c93ed679ccb2c61d0c277380676e33c91da8a423f948e81937e5d1d9479
12+
- filename: packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts
13+
checksum: 299b8f60cce1f64be7c20786d6a7c9c370474b97b06d1846114a76a70ec20cf7
14+
- filename: skills/contentstack-cli/SKILL.md
15+
checksum: 36762d43bbacedd0b344f9d4f1179a88e3dbc7e2467341ba42198dcd1bf9e40c
16+
- filename: skills/code-review/SKILL.md
17+
checksum: 29673e16f6b41fcec7fa236912e7f72b920ed4a3d9a66a89308b4a058b247f3e
18+
- filename: skills/testing/SKILL.md
19+
checksum: ee1c82f1bb51860cb26fb9f112a53df0127e316fcb22a094034024741251fa3c
420
version: '1.0'

AGENTS.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contentstack CLI plugins – Agent guide
2+
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
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, 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; layouts under `packages/*/test/` (see [skills/testing/SKILL.md](skills/testing/SKILL.md)) |
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+
## Where the documentation lives: skills
34+
35+
| Skill | Path | What it covers |
36+
| --- | --- | --- |
37+
| 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 |
40+
| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Mocha/Chai, coverage, mocks |
41+
| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR review for this monorepo |
42+
43+
## Using Cursor (optional)
44+
45+
If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.

packages/contentstack-audit/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-audit",
3-
"version": "2.0.0-beta.9",
3+
"version": "2.0.0-beta.10",
44
"description": "Contentstack audit plugin",
55
"author": "Contentstack CLI",
66
"homepage": "https://github.com/contentstack/cli",
@@ -18,8 +18,8 @@
1818
"/oclif.manifest.json"
1919
],
2020
"dependencies": {
21-
"@contentstack/cli-command": "~2.0.0-beta.5",
22-
"@contentstack/cli-utilities": "~2.0.0-beta.5",
21+
"@contentstack/cli-command": "~2.0.0-beta.6",
22+
"@contentstack/cli-utilities": "~2.0.0-beta.7",
2323
"@oclif/core": "^4.3.0",
2424
"@oclif/plugin-help": "^6.2.28",
2525
"chalk": "^5.6.2",
@@ -83,4 +83,4 @@
8383
"keywords": [
8484
"oclif"
8585
]
86-
}
86+
}

packages/contentstack-bootstrap/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "2.0.0-beta.14",
4+
"version": "2.0.0-beta.15",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -16,10 +16,10 @@
1616
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
1717
},
1818
"dependencies": {
19-
"@contentstack/cli-cm-seed": "~2.0.0-beta.13",
20-
"@contentstack/cli-command": "~2.0.0-beta.5",
21-
"@contentstack/cli-utilities": "~2.0.0-beta.5",
22-
"@contentstack/cli-config": "~2.0.0-beta.6",
19+
"@contentstack/cli-cm-seed": "~2.0.0-beta.14",
20+
"@contentstack/cli-command": "~2.0.0-beta.6",
21+
"@contentstack/cli-utilities": "~2.0.0-beta.7",
22+
"@contentstack/cli-config": "~2.0.0-beta.8",
2323
"@oclif/core": "^4.3.0",
2424
"@oclif/plugin-help": "^6.2.37",
2525
"inquirer": "12.11.1",
@@ -73,4 +73,4 @@
7373
}
7474
},
7575
"repository": "contentstack/cli"
76-
}
76+
}

packages/contentstack-branches/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@contentstack/cli-cm-branches",
33
"description": "Contentstack CLI plugin to do branches operations",
4-
"version": "2.0.0-beta.5",
4+
"version": "2.0.0-beta.6",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
8-
"@contentstack/cli-command": "~2.0.0-beta.5",
8+
"@contentstack/cli-command": "~2.0.0-beta.6",
99
"@oclif/core": "^4.3.0",
1010
"@oclif/plugin-help": "^6.2.28",
11-
"@contentstack/cli-utilities": "~2.0.0-beta.5",
11+
"@contentstack/cli-utilities": "~2.0.0-beta.7",
1212
"chalk": "^5.6.2",
1313
"just-diff": "^6.0.2",
1414
"lodash": "^4.18.1"
@@ -79,4 +79,4 @@
7979
}
8080
},
8181
"repository": "https://github.com/contentstack/cli"
82-
}
82+
}

packages/contentstack-clone/.mocharc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"require": ["test/helpers/init.js", "ts-node/register", "source-map-support/register", "test/helpers/mocha-root-hooks.js"],
2+
"require": ["test/helpers/stub-ora.js", "test/helpers/init.js", "ts-node/register", "source-map-support/register", "test/helpers/mocha-root-hooks.js"],
33
"watch-extensions": [
44
"ts"
55
],

packages/contentstack-clone/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "@contentstack/cli-cm-clone",
33
"description": "Contentstack stack clone plugin",
4-
"version": "2.0.0-beta.15",
4+
"version": "2.0.0-beta.16",
55
"author": "Contentstack",
66
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
77
"dependencies": {
88
"@colors/colors": "^1.6.0",
9-
"@contentstack/cli-cm-export": "~2.0.0-beta.14",
10-
"@contentstack/cli-cm-import": "~2.0.0-beta.14",
11-
"@contentstack/cli-command": "~2.0.0-beta.5",
12-
"@contentstack/cli-utilities": "~2.0.0-beta.5",
9+
"@contentstack/cli-cm-export": "~2.0.0-beta.15",
10+
"@contentstack/cli-cm-import": "~2.0.0-beta.15",
11+
"@contentstack/cli-command": "~2.0.0-beta.6",
12+
"@contentstack/cli-utilities": "~2.0.0-beta.7",
1313
"@oclif/core": "^4.3.0",
1414
"@oclif/plugin-help": "^6.2.28",
1515
"chalk": "^5.6.2",
@@ -78,4 +78,4 @@
7878
"cm:stacks:clone": "CLN"
7979
}
8080
}
81-
}
81+
}

packages/contentstack-clone/src/core/util/clone-handler.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ export class CloneHandler {
644644
importConfig.contentDir = importConfig.data;
645645
}
646646

647-
if (!importConfig.contentDir && importConfig.sourceStackBranch && importConfig.pathDir) {
648-
const dataPath = path.join(importConfig.pathDir, importConfig.sourceStackBranch);
647+
if (!importConfig.contentDir && importConfig.pathDir) {
648+
const dataPath = importConfig.pathDir;
649649
cmd.push('-d', dataPath);
650650
log.debug(`Import data path: ${dataPath}`, this.config.cloneContext);
651651
}
@@ -675,7 +675,7 @@ export class CloneHandler {
675675
cmd: cmd.join(' '),
676676
targetStack: importConfig.apiKey || importConfig.target_stack,
677677
targetBranch: importConfig.targetStackBranch,
678-
dataPath: importConfig.contentDir || (importConfig.pathDir && importConfig.sourceStackBranch ? path.join(importConfig.pathDir, importConfig.sourceStackBranch) : undefined)
678+
dataPath: importConfig.contentDir || importConfig.pathDir || undefined
679679
});
680680
log.debug('Running import command', { ...this.config.cloneContext, cmd });
681681
const importData = importCmd.run(cmd);
@@ -804,9 +804,10 @@ export class CloneHandler {
804804
];
805805
let successMsg: string;
806806
let selectedValue: any = {};
807-
// Resolve path to package root - go up 3 levels from __dirname (core/util -> package root)
807+
// Export root only (single-branch layout: modules live directly under -d, not pathDir/<branch>)
808808
const cloneTypePackageRoot = path.resolve(__dirname, '../../..');
809-
this.config.contentDir = path.join(cloneTypePackageRoot, 'contents', this.config.sourceStackBranch || '');
809+
this.config.contentDir =
810+
this.config.pathDir || path.join(cloneTypePackageRoot, 'contents');
810811
log.debug(`Clone content directory: ${this.config.contentDir}`, this.config.cloneContext);
811812

812813
if (!this.config.cloneType) {

packages/contentstack-clone/src/types/clone-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface CloneConfig {
3131
forceStopMarketplaceAppsPrompt?: boolean;
3232

3333
// Data and modules
34-
/** Path to exported content for import (aligns with import plugin's contentDir) */
34+
/** Export root directory for import (same path as export `-d`; not a branch-named subdirectory) */
3535
contentDir?: string;
3636
modules?: string[];
3737
filteredModules?: string[];

0 commit comments

Comments
 (0)