|
| 1 | +# Contentstack Utils (Java) – 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-utils-java](https://github.com/contentstack/contentstack-utils-java) — Maven `com.contentstack.sdk:utils` | |
| 10 | +| **Purpose:** | Library for rendering **Rich Text Editor (RTE)** content and **embedded items** from Contentstack entry JSON (REST/CDA-style with `_embedded_items`) and GraphQL-shaped responses. Consumed by the [Contentstack Java Delivery SDK](https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/java) and apps that already hold entry JSON. | |
| 11 | +| **Out of scope (if any):** | **No HTTP client** in this package: no stack API calls, tokens, or `includeEmbeddedItems()` — those belong to the Delivery SDK or your app. Optional **`sample/`** wires the SDK + Utils for manual testing only. | |
| 12 | + |
| 13 | +## Tech stack (at a glance) |
| 14 | + |
| 15 | +| Area | Details | |
| 16 | +|------|---------| |
| 17 | +| **Language** | Java **17** — `maven-compiler-plugin` `<release>17</release>` in root `pom.xml` (legacy `1.8` properties in `pom.xml` are not authoritative). | |
| 18 | +| **Build** | **Maven** — root `pom.xml`; optional module `sample/pom.xml`. | |
| 19 | +| **Tests** | **JUnit 4**, Maven **Surefire** (`src/test/java/com/contentstack/utils/**/*.java`). Surefire **`testFailureIgnore`** is `true` — check `target/surefire-reports/`. | |
| 20 | +| **Lint / coverage** | No Checkstyle/Spotless in repo — match existing style. **JaCoCo** (`target/site/jacoco/` after `mvn test`). | |
| 21 | +| **Other** | JSON: `org.json`, `json-simple` (provided). HTML: **Jsoup**. `spring-web` compile dependency — not a public REST client API for this module. **Snyk** on PRs (`.github/workflows/sca-scan.yml`). | |
| 22 | + |
| 23 | +## Commands (quick reference) |
| 24 | + |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| **Build** | `mvn clean compile` | |
| 28 | +| **Test** | `mvn clean test` | |
| 29 | +| **Lint** | *(none configured — rely on IDE and code review)* | |
| 30 | + |
| 31 | +| Optional | Command / location | |
| 32 | +|----------|---------------------| |
| 33 | +| Single test class | `mvn test -Dtest=UtilTests` | |
| 34 | +| Javadoc | `mvn javadoc:javadoc` | |
| 35 | +| Sample (after `mvn install` with skips if needed) | `mvn -f sample/pom.xml compile` | |
| 36 | +| **CI** | Java **17** publish: `.github/workflows/maven-publish.yml` · SCA: `.github/workflows/sca-scan.yml` · branch rules: `.github/workflows/check-branch.yml` | |
| 37 | + |
| 38 | +## Where the documentation lives: skills |
| 39 | + |
| 40 | +| Skill | Path | What it covers | |
| 41 | +|-------|------|----------------| |
| 42 | +| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, build/test commands, PR expectations, optional TDD. | |
| 43 | +| **Java (language & layout)** | [`skills/java/SKILL.md`](skills/java/SKILL.md) | Java 17, `com.contentstack.utils` packages, naming, JSON/Jsoup, dependencies. | |
| 44 | +| **Contentstack Utils API** | [`skills/contentstack-utils-java/SKILL.md`](skills/contentstack-utils-java/SKILL.md) | Public API: `Utils`, `GQL`, `DefaultOption`, JSON contracts, RTE/embedded boundaries. | |
| 45 | +| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | JUnit 4, fixtures, Surefire/JaCoCo, offline tests vs `sample/`. | |
| 46 | +| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist, optional Blocker/Major/Minor. | |
| 47 | +| **Framework (build & tooling)** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | Maven plugins, publishing, GPG, Central, `sample/` dependency hygiene. | |
| 48 | + |
| 49 | +An index with **when to use** hints is in [`skills/README.md`](skills/README.md). |
| 50 | + |
| 51 | +## Using Cursor (optional) |
| 52 | + |
| 53 | +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