Skip to content

Commit 6813477

Browse files
docs(DX-6049): add AGENTS.md, skills, and Cursor rules entry
1 parent cdba1ce commit 6813477

14 files changed

Lines changed: 155 additions & 322 deletions

File tree

.cursor/rules/README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
1-
# Cursor Rules — `@contentstack/delivery-sdk`
1+
# Cursor (optional)
22

3-
Rules for **contentstack-typescript**: TypeScript **CDA** SDK built on **`@contentstack/core`**.
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
44

5-
## Rules overview
6-
7-
| Rule | Role |
8-
|------|------|
9-
| [`dev-workflow.md`](dev-workflow.md) | Branch/PR, build, tests (`unit` / `api` / `browser`), e2e |
10-
| [`typescript.mdc`](typescript.mdc) | TS conventions, `src/`, `config/` |
11-
| [`contentstack-delivery-typescript.mdc`](contentstack-delivery-typescript.mdc) | **stack**, queries, cache, live preview, **core** integration |
12-
| [`testing.mdc`](testing.mdc) | Jest suites, **jest.setup.ts**, env, Playwright |
13-
| [`code-review.mdc`](code-review.mdc) | PR checklist (**always applied**) |
14-
15-
## Rule application
16-
17-
| Context | Typical rules |
18-
|---------|----------------|
19-
| **Every session** | `code-review.mdc` |
20-
| **Most files** | `dev-workflow.md` |
21-
| **`src/`** | `typescript.mdc` + `contentstack-delivery-typescript.mdc` |
22-
| **`test/**`** | `testing.mdc` |
23-
| **Rollup / TS config** | `typescript.mdc` |
24-
25-
## Quick reference
26-
27-
| File | `alwaysApply` | Globs (summary) |
28-
|------|---------------|-----------------|
29-
| `dev-workflow.md` | no | `**/*.ts`, `**/*.mjs`, `**/*.json` |
30-
| `typescript.mdc` | no | `src/**/*.ts`, `config/**/*.ts`, `jest.config.ts`, `jest.config.browser.ts`, `jest.setup.ts` |
31-
| `contentstack-delivery-typescript.mdc` | no | `src/**/*.ts` |
32-
| `testing.mdc` | no | `test/**/*.ts`, `playwright.config.ts` |
33-
| `code-review.mdc` | **yes** ||
34-
35-
## Skills
36-
37-
- [`skills/README.md`](../../skills/README.md) · [`AGENTS.md`](../../AGENTS.md)
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

.cursor/rules/code-review.mdc

Lines changed: 0 additions & 27 deletions
This file was deleted.

.cursor/rules/contentstack-delivery-typescript.mdc

Lines changed: 0 additions & 33 deletions
This file was deleted.

.cursor/rules/dev-workflow.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

.cursor/rules/testing.mdc

Lines changed: 0 additions & 37 deletions
This file was deleted.

.cursor/rules/typescript.mdc

Lines changed: 0 additions & 34 deletions
This file was deleted.

AGENTS.md

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,45 @@
1-
# AGENTS.md — AI / automation context
1+
# Contentstack TypeScript Delivery SDK – Agent guide
22

3-
## Project
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
44

5-
| | |
6-
|---|---|
7-
| **Name** | **`@contentstack/delivery-sdk`** (npm) — **Contentstack TypeScript Content Delivery SDK** |
8-
| **Purpose** | TypeScript client for the **Content Delivery API (CDA)**: stacks, entries, assets, queries, sync, live preview, cache. Built on **`@contentstack/core`** (**Axios** HTTP + retry helpers) and **`@contentstack/utils`**. |
9-
| **Repository** | [contentstack/contentstack-typescript](https://github.com/contentstack/contentstack-typescript.git) |
5+
## What this repo is
106

11-
## Tech stack
7+
| Field | Detail |
8+
|--------|--------|
9+
| **Name:** | [contentstack-typescript](https://github.com/contentstack/contentstack-typescript) (`@contentstack/delivery-sdk`) |
10+
| **Purpose:** | TypeScript/JavaScript Content Delivery SDK for fetching and working with stack content in Node and browsers. |
11+
| **Out of scope:** | Not the Management API or CLI; use the appropriate Contentstack tools for non-delivery workflows. |
12+
13+
## Tech stack (at a glance)
1214

1315
| Area | Details |
1416
|------|---------|
15-
| **Language** | **TypeScript**, **ES modules** (`"type": "module"`) |
16-
| **Runtime** | Node **>= 18** (`package.json` `engines`) |
17-
| **Build** | **Rollup** (`npm run build:rollup`) + **`tsc`** declarations (`config/tsconfig.decl-esm.json`) → **`dist/modern/`** |
18-
| **Tests** | **Jest** + **ts-jest**: **`test/unit`**, **`test/api`**, **`test/browser`**; **Playwright** e2e (`test/e2e`, `npm run test:e2e`) |
19-
| **Lint** | **ESLint** (`.eslintrc.json`) |
20-
21-
## Source layout
22-
23-
| Path | Role |
24-
|------|------|
25-
| `src/stack/contentstack.ts` | **`stack(config)`** factory — wires **`httpClient`** from **`@contentstack/core`**, region/host, live preview |
26-
| `src/stack/stack.ts` | **Stack** class |
27-
| `src/query/**` | Queries (entry, asset, taxonomy, content type, …) |
28-
| `src/entries/**`, `src/assets/**`, `src/sync/**`, `src/cache/**` | Domain modules |
29-
| `src/common/**` | Types, utils, errors, pagination |
30-
| `src/index.ts` | Public package exports |
31-
| `test/utils/stack-instance.ts` | **`stackInstance()`** — loads **dotenv**, **`HOST`**, **`API_KEY`**, **`DELIVERY_TOKEN`**, **`ENVIRONMENT`**, optional live-preview vars |
32-
33-
## Common commands
34-
35-
```bash
36-
npm install
37-
npm run build
38-
npm run test:unit # jest ./test/unit
39-
npm run test:api # live API — needs .env (see stack-instance)
40-
npm run test:browser
41-
npm run test:e2e # Playwright (builds browser bundle first)
42-
npm run test:all # unit + browser + api
43-
```
44-
45-
## Environment variables (API / integration tests)
46-
47-
Loaded via **`dotenv`** in **`test/utils/stack-instance.ts`**:
48-
49-
- **`HOST`**, **`API_KEY`**, **`DELIVERY_TOKEN`**, **`ENVIRONMENT`** — stack connection
50-
- Optional: **`PREVIEW_TOKEN`**, **`LIVE_PREVIEW_HOST`** for live preview tests
51-
52-
Do not commit secrets.
53-
54-
## Further guidance
55-
56-
- **Cursor rules:** [`.cursor/rules/README.md`](.cursor/rules/README.md)
57-
- **Skills:** [`skills/README.md`](skills/README.md)
58-
59-
Product docs: [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/).
17+
| Language | TypeScript (`typescript` in `package.json`); Node **≥ 18** |
18+
| Build | Rollup (`rollup -c`), declaration emit (`config/tsconfig.decl-esm.json`) → `dist/modern/` |
19+
| Tests | Jest: `test/unit`, `test/api`, browser config; Playwright for e2e (`test/e2e`); bundler smoke tests under `test/bundlers/` |
20+
| Lint / coverage | No root `lint` script—use `npm run validate:all` and `.github/workflows/coverage-check.yml` for quality gates |
21+
| CI | `.github/workflows/coverage-check.yml`, `check-branch.yml`, `sca-scan.yml`, `policy-scan.yml`, `npm-publish.yml` |
22+
23+
## Commands (quick reference)
24+
25+
| Command type | Command |
26+
|--------------|---------|
27+
| Build | `npm run build` |
28+
| Test (common) | `npm run test:unit` / `npm run test:api` / `npm run test:all` |
29+
| Validate | `npm run validate:all` |
30+
| Full CI-style suite | `npm run test:cicd` or `npm run test:cicd:no-browser` (see `package.json`) |
31+
32+
## Where the documentation lives: skills
33+
34+
| Skill | Path | What it covers |
35+
|-------|------|----------------|
36+
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, npm scripts, prerelease |
37+
| **Delivery SDK** | [`skills/contentstack-delivery-typescript/SKILL.md`](skills/contentstack-delivery-typescript/SKILL.md) | Public API, stack client, `@contentstack/core` usage |
38+
| **TypeScript & layout** | [`skills/typescript/SKILL.md`](skills/typescript/SKILL.md) | `src/`, Rollup outputs, modern CJS/ESM |
39+
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest, API tests, Playwright, bundler matrix |
40+
| **Build & platform** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | Rollup, browser safety, bundler validation |
41+
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist for SDK changes |
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.

skills/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

skills/code-review/SKILL.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
---
22
name: code-review
3-
description: PR review for @contentstack/delivery-sdk — public API, StackConfig, core alignment, tests.
3+
description: Use when reviewing PRs for the TypeScript Delivery SDK—API, tests, bundler impact, semver.
44
---
55

6-
# Code review `@contentstack/delivery-sdk`
6+
# Code review contentstack-typescript
77

8-
## Checklist
8+
## When to use
99

10-
- [ ] **API:** New or changed **`stack()`** / **Stack** / query methods documented; exports updated in **`src/index.ts`**.
11-
- [ ] **Types:** **StackConfig** and public interfaces remain consistent with **`dist/modern/*.d.ts`** after build.
12-
- [ ] **@contentstack/core:** Version or API changes validated in **`src/stack/contentstack.ts`** (interceptors, **httpClient** options).
13-
- [ ] **Tests:** **`test:unit`** passes; add/extend **`test/api`** when integration behavior changes; browser/e2e if relevant.
14-
- [ ] **Secrets:** No tokens in repo; **stack-instance** env vars only for local CI secrets store.
10+
- Reviewing SDK features, fixes, or dependency upgrades
11+
- Assessing risk of a change to browser/Node consumers
1512

16-
## References
13+
## Instructions
1714

18-
- `.cursor/rules/code-review.mdc`
19-
- `.cursor/rules/dev-workflow.md`
15+
### Checklist
16+
17+
- **Semver**: Public API or default behavior change flagged for major/minor/patch appropriately.
18+
- **Core/utils**: Coordinated version bumps for `@contentstack/core` and `@contentstack/utils` when needed.
19+
- **Tests**: Unit + relevant API/browser/bundler coverage for the change.
20+
- **Build**: `npm run build` succeeds; consider `npm run validate:all` for packaging-sensitive edits.
21+
- **Docs**: README or type docs updated for user-visible changes.
22+
23+
### Severity hints
24+
25+
- **Blocker**: Broken `exports`, failing CI, or security issues in dependencies.
26+
- **Major**: Missing tests for cross-bundler or browser regressions.
27+
- **Minor**: Internal refactors with full green matrix.

0 commit comments

Comments
 (0)