|
1 | | -# Agent guide — @contentstack/marketplace-sdk |
| 1 | +# Contentstack Marketplace SDK – Agent guide |
2 | 2 |
|
3 | | -## What this package is |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
4 | 4 |
|
5 | | -**Contentstack Marketplace SDK** — a **JavaScript client for Marketplace / Developer Hub** operations (apps, installations, hosting, OAuth, webhooks, authorization flows against the Developer Hub API). It is **not** the [Content Delivery API (CDA)](https://www.contentstack.com/docs/developers/apis/content-delivery-api/) SDK and **not** a general stack **Content Management API (CMA)** content SDK; it targets **marketplace app lifecycle and related management APIs** using the same style of auth as CMA (authtoken, `authorization` header, optional `login`). |
| 5 | +## What this repo is |
6 | 6 |
|
7 | | -- **Repository:** [github.com/contentstack/contentstack-marketplace-sdk](https://github.com/contentstack/contentstack-marketplace-sdk) |
8 | | -- **npm:** `@contentstack/marketplace-sdk` |
| 7 | +| Field | Detail | |
| 8 | +|--------|--------| |
| 9 | +| **Name:** | [contentstack-marketplace-sdk](https://github.com/contentstack/contentstack-marketplace-sdk) (`@contentstack/marketplace-sdk`) | |
| 10 | +| **Purpose:** | Node/browser SDK for managing Contentstack **Marketplace** app content and related APIs. | |
| 11 | +| **Out of scope:** | Not the core Delivery/Management content APIs for arbitrary stacks—scope changes belong to product requirements. | |
9 | 12 |
|
10 | | -## Tech stack |
| 13 | +## Tech stack (at a glance) |
11 | 14 |
|
12 | | -| Area | Choice | |
13 | | -|------|--------| |
14 | | -| Language | JavaScript (ES modules in `lib/`), transpiled with Babel; TypeScript only for `test/typescript/` and `types/` | |
15 | | -| Runtime | Node (README: 10+; CI uses Node 22.x) | |
16 | | -| HTTP / JSON | [axios](https://axios-http.com/), [qs](https://github.com/ljharb/qs) for query serialization | |
17 | | -| Config / regions | [@contentstack/utils](https://www.npmjs.com/package/@contentstack/utils) (`getContentstackEndpoint` for Developer Hub host) | |
18 | | -| Unit / API-style tests | Mocha, Chai, NYC; Babel register for `lib/` | |
19 | | -| Typecheck tests | Jest + ts-jest (`jest.config.js`) | |
20 | | -| Lint | ESLint + `eslint-config-standard` (`.eslintrc.js`) | |
21 | | -| Bundling | Webpack → `dist/node`, `dist/web`, etc. | |
| 15 | +| Area | Details | |
| 16 | +|------|---------| |
| 17 | +| Language | JavaScript (Babel transpilation); TypeScript tests via Jest (`test/typescript`) | |
| 18 | +| Build | Webpack configs under **`webpack/`**; outputs under **`dist/`** (`npm run build`) | |
| 19 | +| Tests | Mocha + NYC for unit/API tests; `npm run test:typescript` for Jest subset | |
| 20 | +| Lint / coverage | ESLint on `lib` and `test` (`npm run lint`); NYC coverage | |
| 21 | +| CI | `.github/workflows/unit-test.yml`, `check_branch.yml`, `sca-scan.yml`, `policy-scan.yml`, `npm-publish.yml` | |
22 | 22 |
|
23 | | -## Public entry points (source of truth) |
| 23 | +## Commands (quick reference) |
24 | 24 |
|
25 | | -| Role | Path | |
26 | | -|------|------| |
27 | | -| Factory | `lib/contentstack.js` — `client()`, exports `Region` | |
28 | | -| Request surface | `lib/contentstackClient.js` — `login`, `marketplace`, `logout` | |
29 | | -| HTTP stack | `lib/core/contentstackHTTPClient.js`, `lib/core/concurrency-queue.js`, `lib/core/messageHandler.js` | |
30 | | -| Errors | `lib/core/contentstackError.js` | |
31 | | -| Marketplace domain | `lib/marketplace/**` | |
32 | | -| Published `main` | `dist/node/contentstack-marketplace.js` (build output) | |
33 | | -| Type declarations | `types/contentstackClient.d.ts` and `types/marketplace/**` | |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| Build | `npm run build` | |
| 28 | +| Test | `npm test` (runs API + unit per `package.json`) | |
| 29 | +| Lint | `npm run lint` | |
34 | 30 |
|
35 | | -## Commands |
| 31 | +## Where the documentation lives: skills |
36 | 32 |
|
37 | | -```bash |
38 | | -npm install |
39 | | -npm run build # clean + Babel + webpack targets |
40 | | -npm run lint # eslint lib test |
41 | | -npm run format # eslint --fix lib test |
42 | | -npm run test:unit # Mocha unit suite + NYC (also runs lint via pretest) |
43 | | -npm run test:typescript # Jest on test/typescript |
44 | | -npm run test:sanity-test # Mocha live stack under test/sanity-check (long timeout) |
45 | | -``` |
| 33 | +| Skill | Path | What it covers | |
| 34 | +|-------|------|----------------| |
| 35 | +| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | npm scripts, Husky, CI | |
| 36 | +| **Marketplace SDK** | [`skills/marketplace-sdk/SKILL.md`](skills/marketplace-sdk/SKILL.md) | Public API in `lib/`, axios usage | |
| 37 | +| **JavaScript tooling** | [`skills/javascript/SKILL.md`](skills/javascript/SKILL.md) | Babel, Webpack targets, dual builds | |
| 38 | +| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Mocha, NYC, Jest, fixtures | |
| 39 | +| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist | |
46 | 40 |
|
47 | | -**CI (`.github/workflows/unit-test.yml`):** `npm ci` then `npm run test:unit:report:json`. |
| 41 | +## Using Cursor (optional) |
48 | 42 |
|
49 | | -> **`npm test` caveat:** `package.json` defines `"test": "npm run test:api && npm run test:unit"` but there is **no** `test:api` script. Use `npm run test:unit` (or fix the `test` script when adding `test:api`). |
50 | | -
|
51 | | -## Credentials and live tests |
52 | | - |
53 | | -Sanity tests under `test/sanity-check/` use **dotenv** and env vars such as `HOST` / `DEFAULTHOST`, `ORG_UID`, `ADMIN_EMAIL`, `USER_EMAIL`, `EMAIL`, `PASSWORD`. They also read/write JSON fixtures (e.g. `loggedinAdmin.json`) via `test/sanity-check/utility/fileOperations/readwrite.js`. Do not commit real tokens; use `.env` locally (see `.gitignore`). |
54 | | - |
55 | | -## Further reading for agents |
56 | | - |
57 | | -- [Cursor rules index](.cursor/rules/README.md) — when each rule applies and how to reference it. |
58 | | -- [Skills index](skills/README.md) — deeper checklists and SDK mental model. |
| 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