|
1 | | -# contentstack-cli-content-type |
| 1 | +# contentstack-cli-content-type – Agent guide |
2 | 2 |
|
3 | | -TypeScript npm package: a **Contentstack CLI** (`csdx`) plugin that reads Content Type metadata from a stack—list, field details, audit log lines, same-stack or cross-stack comparison, and stack content-model diagrams. It does not perform bulk mutations on entries or assets. |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
4 | 4 |
|
5 | | -## Stack |
| 5 | +## What this repo is |
6 | 6 |
|
7 | | -- **Language**: TypeScript (`strict` in [tsconfig.json](tsconfig.json)) |
8 | | -- **CLI**: oclif; commands under `src/commands/content-type/` |
9 | | -- **Tests**: Jest + ts-jest; tests under `tests/` (see [jest.config.js](jest.config.js)) |
10 | | -- **Core logic**: `src/core/content-type/`, shared command base in `src/core/command.ts`, HTTP in `src/core/contentstack/` |
| 7 | +| Field | Detail | |
| 8 | +|-------|--------| |
| 9 | +| **Name:** | [contentstack/contentstack-cli-content-type](https://github.com/contentstack/contentstack-cli-content-type) (`contentstack-cli-content-type` on npm) | |
| 10 | +| **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. | |
| 11 | +| **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. | |
11 | 12 |
|
12 | | -## Scripts |
| 13 | +## Tech stack (at a glance) |
13 | 14 |
|
14 | | -| Script | Purpose | |
15 | | -|--------|---------| |
16 | | -| `npm test` | Run Jest | |
17 | | -| `npm run posttest` | ESLint on `.ts` files (see [package.json](package.json)) | |
18 | | -| `npm run test:coverage` | Jest with coverage; terminal summary plus **HTML** report at `coverage/lcov-report/index.html` (see [jest.config.js](jest.config.js)) | |
19 | | -| `npm run prepack` | `tsc -b`, `oclif manifest`, `oclif readme` — run when commands, flags, or descriptions change | |
| 15 | +| Area | Details | |
| 16 | +|------|---------| |
| 17 | +| Language | TypeScript, **`strict`** ([tsconfig.json](tsconfig.json)), target ES2017, CommonJS | |
| 18 | +| Build | `tsc -b`; output **`lib/`**; **`npm run prepack`** runs compile + `oclif manifest` + `oclif readme` | |
| 19 | +| Tests | Jest + ts-jest; tests under **`tests/`** ([jest.config.js](jest.config.js)) | |
| 20 | +| Lint / coverage | ESLint via **`npm run posttest`** ([.eslintrc](.eslintrc)); Jest coverage **`npm run test:coverage`**, global thresholds in [jest.config.js](jest.config.js) | |
| 21 | +| CLI / runtime | oclif; Node engines per [package.json](package.json); `bin` is `csdx` when installed as a CLI plugin | |
20 | 22 |
|
21 | | -## Workflow |
| 23 | +## Commands (quick reference) |
22 | 24 |
|
23 | | -- Prefer adding or updating tests for behavioral changes in `src/core/` and `src/utils/`. |
24 | | -- Do not commit `test.only` / `test.skip` (or `describe.only` / `it.only`). |
25 | | -- After changing command IDs, flags, or help text, regenerate CLI docs so `README.md` and `oclif.manifest.json` stay aligned (see `prepack` / `version` in [package.json](package.json)). |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| Build (publishable) | `npm run prepack` | |
| 28 | +| Test | `npm test` | |
| 29 | +| Test + coverage | `npm run test:coverage` | |
| 30 | +| Lint | `npm run posttest` (or `eslint . --ext .ts --config .eslintrc`) | |
26 | 31 |
|
27 | | -## Coverage |
| 32 | +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. |
28 | 33 |
|
29 | | -- **Target**: **80%** minimum on statements, branches, functions, and lines. |
30 | | -- **Enforcement**: [jest.config.js](jest.config.js) sets **global** `coverageThreshold` at **80%** for all four metrics. Run `npm run test:coverage` so thresholds apply. |
31 | | -- **HTML report**: after `npm run test:coverage`, open `coverage/lcov-report/index.html` in a browser. The `coverage/` directory is gitignored. |
| 34 | +## Where the documentation lives: skills |
| 35 | + |
| 36 | +| Skill | Path | What it covers | |
| 37 | +|-------|------|----------------| |
| 38 | +| Dev workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | Scripts, `tsconfig`, ESLint, Jest/coverage, oclif README/manifest, PR checks | |
| 39 | +| 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 | |
| 40 | +| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Jest layout, mocks, conventions, coverage | |
| 41 | +| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR checklist, security and dependency review | |
| 42 | + |
| 43 | +An index with “when to use” hints is in [skills/README.md](skills/README.md). |
32 | 44 |
|
33 | 45 | ## Security |
34 | 46 |
|
35 | 47 | See [SECURITY.md](SECURITY.md) for reporting issues. |
36 | 48 |
|
37 | | -## Cursor: rules and skills |
38 | | - |
39 | | -- **Rules index**: [.cursor/rules/README.md](.cursor/rules/README.md) — context-specific `.mdc` rules. |
40 | | -- **Skills index**: [.cursor/skills/README.md](.cursor/skills/README.md) — `ContentTypeCommand`, CMA client, testing, PR review. |
| 49 | +## Using Cursor (optional) |
41 | 50 |
|
42 | | -For detailed plugin architecture and commands, start with [.cursor/skills/contentstack-cli-content-type/SKILL.md](.cursor/skills/contentstack-cli-content-type/SKILL.md). |
| 51 | +If you use **Cursor**, [.cursor/rules/README.md](.cursor/rules/README.md) only points to **[AGENTS.md](AGENTS.md)**—same docs as everyone else. |
0 commit comments