|
1 | | -# AGENTS.md — AI / automation context |
| 1 | +# @contentstack/core – Agent guide |
2 | 2 |
|
3 | | -## Project |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
4 | 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) | |
| 5 | +## What this repo is |
10 | 6 |
|
11 | | -## Tech stack |
| 7 | +| Field | Detail | |
| 8 | +|--------|--------| |
| 9 | +| **Name:** | [contentstack-js-core](https://github.com/contentstack/contentstack-js-core) (`@contentstack/core`) | |
| 10 | +| **Purpose:** | TypeScript core library: HTTP client wiring, errors, serialization, retries—shared by Contentstack TS SDKs. | |
| 11 | +| **Out of scope:** | Not an end-user SDK; apps should use the Delivery SDK, which depends on this package. | |
| 12 | + |
| 13 | +## Tech stack (at a glance) |
12 | 14 |
|
13 | 15 | | Area | Details | |
14 | 16 | |------|---------| |
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/). |
| 17 | +| Language | TypeScript (see `typescript` in `package.json`; `config/tsconfig.*.json`) | |
| 18 | +| Build | `tsc` (CJS/ESM/types) + Webpack UMD (`config/webpack.config.js`, `tools/`) | |
| 19 | +| Tests | Jest → `test/` (`npm test` → `jest ./test`) | |
| 20 | +| Lint / coverage | ESLint `.eslintrc.js` (`npm run lint`) | |
| 21 | +| CI | `.github/workflows/unit-test.yml`, `check-branch.yml`, `sca-scan.yml`, `policy-scan.yml`, `codeql-analysis.yml` | |
| 22 | + |
| 23 | +## Commands (quick reference) |
| 24 | + |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| Build | `npm run build` | |
| 28 | +| Test | `npm test` | |
| 29 | +| Lint | `npm run lint` | |
| 30 | + |
| 31 | +## Where the documentation lives: skills |
| 32 | + |
| 33 | +| Skill | Path | What it covers | |
| 34 | +|-------|------|----------------| |
| 35 | +| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, npm scripts, Husky, release notes | |
| 36 | +| **Contentstack core (package)** | [`skills/contentstack-core/SKILL.md`](skills/contentstack-core/SKILL.md) | `@contentstack/core` boundaries, public surface, dependency role | |
| 37 | +| **TypeScript & layout** | [`skills/typescript/SKILL.md`](skills/typescript/SKILL.md) | `src/`, `config/` tsconfigs, ESM/CJS/UMD outputs | |
| 38 | +| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest layout, mocks, fixtures | |
| 39 | +| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR expectations and checklist | |
| 40 | + |
| 41 | +## Using Cursor (optional) |
| 42 | + |
| 43 | +If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else. |
0 commit comments