|
| 1 | +# Cursor Rules Documentation |
| 2 | + |
| 3 | +This directory contains **Cursor AI rules** that provide context-aware guidance for the **Contentstack Management JavaScript SDK** (`@contentstack/management`) — CMA client development, not a separate CLI repo. |
| 4 | + |
| 5 | +## Rules overview |
| 6 | + |
| 7 | +| Rule | Role | |
| 8 | +|------|------| |
| 9 | +| [`dev-workflow.md`](dev-workflow.md) | Branches, lint/tests before PR (unit + optional sanity), version bump guidance, links to skills | |
| 10 | +| [`javascript.mdc`](javascript.mdc) | JavaScript / TypeScript declaration style: `lib/`, `webpack/`, `types/`, root `*.mjs` | |
| 11 | +| [`contentstack-javascript-cma.mdc`](contentstack-javascript-cma.mdc) | CMA SDK patterns in `lib/`: client, stack, auth, host/region, HTTP/error handling | |
| 12 | +| [`testing.mdc`](testing.mdc) | Mocha unit suite, sanity/API tests, Jest + `test/typescript`; env and mocks | |
| 13 | +| [`code-review.mdc`](code-review.mdc) | PR checklist: JSDoc, compat, errors, SCA, unit + sanity tests, CMA semantics (**always applied**) | |
| 14 | + |
| 15 | +## Rule application |
| 16 | + |
| 17 | +Rules load from **globs** and **`alwaysApply`** in each file’s frontmatter (not every rule runs for every file). |
| 18 | + |
| 19 | +| Context | Typical rules | |
| 20 | +|---------|----------------| |
| 21 | +| **Every chat / session** | [`code-review.mdc`](code-review.mdc) (`alwaysApply: true`) | |
| 22 | +| **Most project files** | [`dev-workflow.md`](dev-workflow.md) — `**/*.js`, `**/*.ts`, `**/*.json`, `**/*.mjs` | |
| 23 | +| **SDK implementation** | [`javascript.mdc`](javascript.mdc) + [`contentstack-javascript-cma.mdc`](contentstack-javascript-cma.mdc) for `lib/**/*.js` | |
| 24 | +| **Build config** | [`javascript.mdc`](javascript.mdc) for `webpack/**/*.js` | |
| 25 | +| **Public types** | [`javascript.mdc`](javascript.mdc) for `types/**` | |
| 26 | +| **Tests** | [`testing.mdc`](testing.mdc) for `test/unit/**`, `test/sanity-check/**`, `test/typescript/**`, `test/**/index.js` | |
| 27 | + |
| 28 | +Overlaps are expected (e.g. editing `lib/foo.js` can match `dev-workflow`, `javascript`, and `contentstack-javascript-cma`). |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +- Rules are **loaded automatically** when opened files match their globs (and `code-review` is always in context). |
| 33 | +- You can **@ mention** rule files in chat when your Cursor build supports file references, e.g. `@dev-workflow`, `@javascript`, `@contentstack-javascript-cma`, `@testing`, `@code-review` (exact names depend on how Cursor labels `.md` / `.mdc` rules in your project). |
| 34 | + |
| 35 | +## Quick reference table |
| 36 | + |
| 37 | +| File | `alwaysApply` | Globs (summary) | |
| 38 | +|------|---------------|-----------------| |
| 39 | +| `dev-workflow.md` | no | `**/*.js`, `**/*.ts`, `**/*.json`, `**/*.mjs` | |
| 40 | +| `javascript.mdc` | no | `lib/**/*.js`, `webpack/**/*.js`, `types/**/*.ts`, `types/**/*.d.ts`, `*.mjs` | |
| 41 | +| `contentstack-javascript-cma.mdc` | no | `lib/**/*.js` | |
| 42 | +| `testing.mdc` | no | `test/unit/**`, `test/sanity-check/**`, `test/typescript/**`, `test/**/index.js` | |
| 43 | +| `code-review.mdc` | **yes** | — | |
| 44 | + |
| 45 | +## Skills & maintenance |
| 46 | + |
| 47 | +- Deeper playbooks: [`skills/README.md`](../../skills/README.md). |
| 48 | +- Repo agent entry: [`AGENTS.md`](../../AGENTS.md). |
| 49 | +- When directories change, update **globs** in rule frontmatter; keep rules short and put detail in `skills/*/SKILL.md`. |
0 commit comments