|
| 1 | +# @contentstack/types-generator – Agent guide |
| 2 | + |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
| 4 | + |
| 5 | +## What this repo is |
| 6 | + |
| 7 | +| Field | Detail | |
| 8 | +| --- | --- | |
| 9 | +| **Name:** | [contentstack/types-generator](https://github.com/contentstack/types-generator) | |
| 10 | +| **Purpose:** | Library that generates TypeScript types from Contentstack stack content types (Delivery SDK) and from GraphQL schema (introspection). | |
| 11 | +| **Out of scope (if any):** | **Management API (CMA)** client behavior—this package targets **CDA** and **GraphQL** only. | |
| 12 | + |
| 13 | +## Tech stack (at a glance) |
| 14 | + |
| 15 | +| Area | Details | |
| 16 | +| --- | --- | |
| 17 | +| **Language** | TypeScript **5.9** (`strict` in [tsconfig.json](tsconfig.json)) | |
| 18 | +| **Build** | **tsup** → `dist/` ([tsup.config.ts](tsup.config.ts)); entries include [src/index.ts](src/index.ts), [src/web.ts](src/web.ts) | |
| 19 | +| **Tests** | Jest + ts-jest ([jest.config.js](jest.config.js)); `dotenv/config` in setup | |
| 20 | +| **Lint / coverage** | No ESLint script; rely on TypeScript strictness and project conventions | |
| 21 | +| **Other** | `@contentstack/delivery-sdk`, `axios`, `@gql2ts/from-schema`, `lodash`, `async`, `prettier` | |
| 22 | + |
| 23 | +## Commands (quick reference) |
| 24 | + |
| 25 | +| Command type | Command | |
| 26 | +| --- | --- | |
| 27 | +| **Build** | `npm run build` | |
| 28 | +| **Test** | `npm test` | |
| 29 | +| **Lint** | _(not configured)_ | |
| 30 | + |
| 31 | +CI: [.github/workflows/node.js.yml](.github/workflows/node.js.yml); release: [.github/workflows/release.yml](.github/workflows/release.yml). |
| 32 | + |
| 33 | +## Credentials and integration tests |
| 34 | + |
| 35 | +Set a **`.env`** at the repo root or export variables (see `tests/integration/`). Typical names: `TOKEN`, `APIKEY`, `ENVIRONMENT`, `REGION`, `TOKENTYPE`, `BRANCH`. CI injects secrets including `TOKEN_WITH_NO_CT` and `APIKEY_WITH_NO_CT` where needed. |
| 36 | + |
| 37 | +## Where the documentation lives: skills |
| 38 | + |
| 39 | +| Skill | Path | What it covers | |
| 40 | +| --- | --- | --- | |
| 41 | +| Development workflow | [skills/dev-workflow/SKILL.md](skills/dev-workflow/SKILL.md) | Branches, CI, build/test, PRs, releases | |
| 42 | +| TypeScript types generator | [skills/typescript-types-generator/SKILL.md](skills/typescript-types-generator/SKILL.md) | `generateTS` vs `graphqlTS`, SDK and GraphQL behavior | |
| 43 | +| Testing | [skills/testing/SKILL.md](skills/testing/SKILL.md) | Jest layout, `.env`, fixtures | |
| 44 | +| Code review | [skills/code-review/SKILL.md](skills/code-review/SKILL.md) | PR checklist, terminology, semver | |
| 45 | + |
| 46 | +An index with “when to use” hints is in [skills/README.md](skills/README.md). |
| 47 | + |
| 48 | +## Using Cursor (optional) |
| 49 | + |
| 50 | +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