diff --git a/.cursor/rules/README.md b/.cursor/rules/README.md new file mode 100644 index 0000000..f5c1f87 --- /dev/null +++ b/.cursor/rules/README.md @@ -0,0 +1,5 @@ +# Cursor (optional) + +**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**. + +This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f082e83 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,51 @@ +# contentstack-cli-content-type – Agent guide + +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. + +## What this repo is + +| Field | Detail | +|-------|--------| +| **Name:** | [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) (`contentstack-cli-content-type` on npm) | +| **Purpose:** | Contentstack CLI (`csdx`) plugin that reads Content Type metadata from a stack: list, details, audit logs, same-stack or cross-stack JSON compare (HTML diff), and stack content-model diagrams. | +| **Out of scope (if any):** | Bulk entry/asset mutations, Delivery API consumption, and unrelated HTTP clients—this package focuses on content-type introspection via the Management API patterns documented in the plugin skill. | + +## Tech stack (at a glance) + +| Area | Details | +|------|---------| +| Language | TypeScript, **`strict`** ([tsconfig.json](tsconfig.json)), target ES2017, CommonJS | +| Build | `tsc -b`; output **`lib/`**; **`npm run prepack`** runs compile + `oclif manifest` + `oclif readme` | +| Tests | Jest + ts-jest; tests under **`tests/`** ([jest.config.js](jest.config.js)) | +| Lint / coverage | ESLint via **`npm run posttest`** ([.eslintrc](.eslintrc)); Jest coverage **`npm run test:coverage`**, global thresholds in [jest.config.js](jest.config.js) | +| CLI / runtime | oclif; Node engines per [package.json](package.json); `bin` is `csdx` when installed as a CLI plugin | + +## Commands (quick reference) + +| Command type | Command | +|--------------|---------| +| Build (publishable) | `npm run prepack` | +| Test | `npm test` | +| Test + coverage | `npm run test:coverage` | +| Lint | `npm run posttest` (or `eslint . --ext .ts --config .eslintrc`) | + +CI: [.github/workflows](.github/workflows) includes policy/SCA/release/issue automation—there is no single `ci.yml` that only runs `npm test`; follow team merge requirements. + +## Where the documentation lives: skills + +| Skill | Path | What it covers | +|-------|------|----------------| +| Dev workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | Scripts, `tsconfig`, ESLint, Jest/coverage, oclif README/manifest, PR checks | +| Content Type plugin | [skills/contentstack-cli-content-type/SKILL.md](skills/contentstack-cli-content-type/SKILL.md) | `ContentTypeCommand`, CMA vs SDK, auth, commands, compare/diagram | +| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Jest layout, mocks, conventions, coverage | +| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR checklist, security and dependency review | + +An index with “when to use” hints is in [skills/README.md](skills/README.md). + +## Security + +See [SECURITY.md](SECURITY.md) for reporting issues. + +## Using Cursor (optional) + +If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **[AGENTS.md](AGENTS.md)**—same docs as everyone else. diff --git a/README.md b/README.md index 429b3be..57a6f91 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,12 @@ Display recent changes to a Content Type ``` USAGE - $ csdx content-type:audit -c [-s | -a | -a ] [-k | | ] + $ csdx content-type:audit --content-type [-k | -a ] FLAGS -a, --alias= Alias of the management token - -a, --token-alias= Management token alias - -c, --content-type= (required) Content Type UID -k, --stack-api-key= Stack API Key - -s, --stack= Stack UID + --content-type= (required) Content Type UID DESCRIPTION Display recent changes to a Content Type @@ -85,7 +83,7 @@ EXAMPLES $ csdx content-type:audit --alias "management token" --content-type "home_page" ``` -_See code: [src/commands/content-type/audit.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/audit.ts)_ +_See code: [src/commands/content-type/audit.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/audit.ts)_ ## `csdx content-type:compare` @@ -93,16 +91,14 @@ Compare two Content Type versions ``` USAGE - $ csdx content-type:compare -c [-s | -a ] [-k | ] [-a ] [-l -r ] + $ csdx content-type:compare --content-type [-k | -a ] [--left --right ] FLAGS -a, --alias= Alias of the management token - -a, --token-alias= Management token alias - -c, --content-type= (required) Content Type UID -k, --stack-api-key= Stack API Key - -l, --left= Content Type version, i.e. prev version - -r, --right= Content Type version, i.e. later version - -s, --stack= Stack UID + --content-type= (required) Content Type UID + --left= Content Type version, i.e. prev version + --right= Content Type version, i.e. later version DESCRIPTION Compare two Content Type versions @@ -115,7 +111,7 @@ EXAMPLES $ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right # ``` -_See code: [src/commands/content-type/compare.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/compare.ts)_ +_See code: [src/commands/content-type/compare.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/compare.ts)_ ## `csdx content-type:compare-remote` @@ -123,21 +119,21 @@ compare two Content Types on different Stacks ``` USAGE - $ csdx content-type:compare-remote (-o -r ) -c + $ csdx content-type:compare-remote (--origin-stack --remote-stack ) --content-type FLAGS - -c, --content-type= (required) Content Type UID - -o, --origin-stack= (required) Origin Stack API Key - -r, --remote-stack= (required) Remote Stack API Key + --content-type= (required) Content Type UID + --origin-stack= (required) Origin Stack API Key + --remote-stack= (required) Remote Stack API Key DESCRIPTION compare two Content Types on different Stacks EXAMPLES - $ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page" + $ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" --content-type "home_page" ``` -_See code: [src/commands/content-type/compare-remote.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/compare-remote.ts)_ +_See code: [src/commands/content-type/compare-remote.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/compare-remote.ts)_ ## `csdx content-type:details` @@ -145,15 +141,13 @@ Display Content Type details ``` USAGE - $ csdx content-type:details -c [-s | -a ] [-k | ] [-a ] [-p] + $ csdx content-type:details --content-type [-k | -a ] [--path] FLAGS -a, --alias= Alias of the management token - -a, --token-alias= Management token alias - -c, --content-type= (required) Content Type UID -k, --stack-api-key= Stack API Key - -p, --[no-]path show path column - -s, --stack= Stack UID + --content-type= (required) Content Type UID + --[no-]path show path column DESCRIPTION Display Content Type details @@ -166,7 +160,7 @@ EXAMPLES $ csdx content-type:details --alias "management token" --content-type "home_page" --no-path ``` -_See code: [src/commands/content-type/details.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.3.0/src/commands/content-type/details.ts)_ +_See code: [src/commands/content-type/details.ts](https://github.com/contentstack/contentstack-cli-content-type/blob/v1.5.0-beta.0/src/commands/content-type/details.ts)_ ## `csdx content-type:diagram` @@ -174,18 +168,15 @@ Create a visual diagram of a Stack's Content Types ``` USAGE - $ csdx content-type:diagram -o -d portrait|landscape -t svg|dot [-s | -a | -a ] [-k - | | ] + $ csdx content-type:diagram --output --direction portrait|landscape --type svg|dot [-k | -a ] FLAGS -a, --alias= Alias of the management token - -a, --token-alias= Management token alias - -d, --direction=