|
| 1 | +# AGENTS.md — AI / automation context |
| 2 | + |
| 3 | +## Project |
| 4 | + |
| 5 | +| | | |
| 6 | +|---|---| |
| 7 | +| **Name** | **`@contentstack/core`** (npm) — **Contentstack JavaScript / TypeScript core library** | |
| 8 | +| **Purpose** | Foundational HTTP client, errors, serialization, and retry helpers consumed by **Contentstack TypeScript Delivery SDK** (`@contentstack/delivery-sdk`) and related packages. **Not** an app-facing CDA client by itself. | |
| 9 | +| **Repository** | [contentstack/contentstack-js-core](https://github.com/contentstack/contentstack-js-core.git) | |
| 10 | + |
| 11 | +## Tech stack |
| 12 | + |
| 13 | +| Area | Details | |
| 14 | +|------|---------| |
| 15 | +| **Language** | **TypeScript** in `src/` | |
| 16 | +| **HTTP** | **Axios** (`src/lib/contentstack-core.ts`), **qs** / custom **`param-serializer`**, **lodash** | |
| 17 | +| **Build** | **TypeScript** → **CJS** / **ESM** / **types** (`config/tsconfig.*.json`); **UMD** via **webpack** (`config/webpack.config.js`) | |
| 18 | +| **Lint** | **ESLint** (Airbnb TypeScript + Prettier; `.eslintrc.js` / `.eslintrc.json`) | |
| 19 | +| **Tests** | **Jest** + **ts-jest** (`jest.config.ts`, `test/**/*.spec.ts`); coverage thresholds in Jest config | |
| 20 | + |
| 21 | +## Source layout |
| 22 | + |
| 23 | +| Path | Role | |
| 24 | +|------|------| |
| 25 | +| `src/index.ts` | Public exports | |
| 26 | +| `src/lib/contentstack-core.ts` | **`httpClient`** factory, Axios config | |
| 27 | +| `src/lib/request.ts` / `param-serializer.ts` | Request wiring and query serialization | |
| 28 | +| `src/lib/contentstack-error.ts` / `api-error.ts` / `error-messages.ts` | Error types and messages | |
| 29 | +| `src/lib/retryPolicy/delivery-sdk-handlers.ts` | Retry interceptors for delivery SDK | |
| 30 | +| `src/lib/types.ts` | Shared TS types | |
| 31 | +| `config/` | TS compiler + webpack configs | |
| 32 | +| `tools/` | `cleanup`, `postbuild` | |
| 33 | +| `dist/` | Published artifacts (`package.json` `exports`) | |
| 34 | + |
| 35 | +## Common commands |
| 36 | + |
| 37 | +```bash |
| 38 | +npm install |
| 39 | +npm run build # cjs + esm + umd + types |
| 40 | +npm run lint # eslint . -c .eslintrc.js |
| 41 | +npm test # jest ./test |
| 42 | +npm run clean # node tools/cleanup |
| 43 | +``` |
| 44 | + |
| 45 | +## Consumer relationship |
| 46 | + |
| 47 | +- **End users** should depend on **`@contentstack/delivery-sdk`**, not usually this package directly. |
| 48 | +- When changing public exports or behavior, consider impact on **contentstack-typescript** and semver for **`@contentstack/core`**. |
| 49 | + |
| 50 | +## Further guidance |
| 51 | + |
| 52 | +- **Cursor rules:** [`.cursor/rules/README.md`](.cursor/rules/README.md) |
| 53 | +- **Skills:** [`skills/README.md`](skills/README.md) |
| 54 | + |
| 55 | +Official API context for consumers: [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/). |
0 commit comments