|
1 | | -# Contentstack Android CDA SDK – Agent Guide |
| 1 | +# Contentstack Android Delivery SDK – Agent guide |
2 | 2 |
|
3 | | -This document is the main entry point for AI agents working in this repository. |
| 3 | +**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**. |
4 | 4 |
|
5 | | -## Project |
| 5 | +## What this repo is |
6 | 6 |
|
7 | | -- **Name:** Contentstack Android CDA SDK (contentstack-android) |
8 | | -- **Purpose:** Android client for the Contentstack **Content Delivery API (CDA)**. It fetches content (entries, assets, content types, sync, etc.) from Contentstack for Android apps. |
9 | | -- **Repo:** [contentstack-android](https://github.com/contentstack/contentstack-android) |
| 7 | +| Field | Detail | |
| 8 | +|--------|--------| |
| 9 | +| **Name:** | [contentstack-android](https://github.com/contentstack/contentstack-android) (`com.contentstack.sdk:android`) | |
| 10 | +| **Purpose:** | Android library for the Contentstack Content Delivery API (Kotlin/Java consumers via AAR). | |
| 11 | +| **Out of scope:** | Not the Java-only or iOS/Swift SDKs—those live in sibling repositories. | |
10 | 12 |
|
11 | | -## Tech stack |
| 13 | +## Tech stack (at a glance) |
12 | 14 |
|
13 | | -- **Languages:** Java (primary SDK source); Kotlin may appear in tests or future code. Target **Java 8** compatibility for the library (see `contentstack/build.gradle`). |
14 | | -- **Build:** Gradle (Android Gradle Plugin), single module **`contentstack`** (AAR). |
15 | | -- **Testing:** JUnit 4, Robolectric (unit tests on JVM), Mockito / PowerMock where used; **androidTest** with AndroidX Test / Espresso for instrumented tests; JaCoCo for coverage (`jacocoTestReport`). |
16 | | -- **HTTP:** **Volley** (`CSHttpConnection`) for much of the CDA traffic; **Retrofit 2 + OkHttp + Gson** for paths such as taxonomy (`Stack`, `APIService`). OkHttp **MockWebServer** in unit tests. |
| 15 | +| Area | Details | |
| 16 | +|------|---------| |
| 17 | +| Language | Kotlin/Java; **compileSdk 34**; Java **17** compile options in `contentstack/build.gradle` | |
| 18 | +| Build | Gradle (root `build.gradle`, `settings.gradle`, module **`contentstack/`**) | |
| 19 | +| Tests | JUnit, Mockito, Robolectric, AndroidX Test—unit tests under `contentstack/src/test/` | |
| 20 | +| Lint / coverage | JaCoCo integrated with debug unit tests (`testCoverageEnabled` on debug) | |
| 21 | +| CI | `.github/workflows/check-branch.yml`, `publish-release.yml`, `sca-scan.yml`, `policy-scan.yml`, `codeql-analysis.yml` | |
17 | 22 |
|
18 | | -## Main entry points |
| 23 | +## Commands (quick reference) |
19 | 24 |
|
20 | | -- **`Contentstack`** – Factory: `Contentstack.stack(Context, apiKey, deliveryToken, environment)` (and overloads with `Config`) returns a **`Stack`**. |
21 | | -- **`Stack`** – Main API: content types, entries, queries, assets, sync, etc. |
22 | | -- **`Config`** – Optional configuration: host, version, region, branch, proxy, connection pool, endpoint. |
23 | | -- **Paths:** `contentstack/src/main/java/com/contentstack/sdk/` (production), `contentstack/src/test/java/com/contentstack/sdk/` (unit tests), `contentstack/src/androidTest/java/` (instrumented tests). |
| 25 | +| Command type | Command | |
| 26 | +|--------------|---------| |
| 27 | +| Unit tests (typical) | `./gradlew :contentstack:testDebugUnitTest` (from repo root) | |
| 28 | +| Clean | `./gradlew clean` | |
24 | 29 |
|
25 | | -## Commands |
| 30 | +## Where the documentation lives: skills |
26 | 31 |
|
27 | | -Run from the **repository root** (requires Android SDK / `local.properties` for connected tests). |
| 32 | +| Skill | Path | What it covers | |
| 33 | +|-------|------|----------------| |
| 34 | +| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Gradle, variants, CI, publishing | |
| 35 | +| **Android CDA SDK** | [`skills/contentstack-android-cda/SKILL.md`](skills/contentstack-android-cda/SKILL.md) | Library API and module boundaries | |
| 36 | +| **Android project layout** | [`skills/android/SKILL.md`](skills/android/SKILL.md) | `contentstack/` module, manifest, BuildConfig | |
| 37 | +| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Unit vs instrumented tests, Robolectric, JaCoCo | |
| 38 | +| **Build & platform** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | AGP, signing placeholders, `local.properties` | |
| 39 | +| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist | |
28 | 40 |
|
29 | | -| Goal | Command | |
30 | | -|------|---------| |
31 | | -| **Build library (debug)** | `./gradlew :contentstack:assembleDebug` | |
32 | | -| **Run all unit tests** | `./gradlew :contentstack:testDebugUnitTest` | |
33 | | -| **Run instrumented / connected tests** | `./gradlew :contentstack:connectedDebugAndroidTest` (device or emulator required) | |
34 | | -| **Unit + connected (full local test pass)** | `./gradlew :contentstack:testDebugUnitTest :contentstack:connectedDebugAndroidTest` | |
35 | | -| **Coverage report (unit)** | `./gradlew :contentstack:jacocoTestReport` | |
36 | | - |
37 | | -Instrumented tests may need **`local.properties`** entries (e.g. `APIKey`, `deliveryToken`, `environment`, `host`) for stacks that hit a real CDA endpoint—see `contentstack/build.gradle` `buildConfigField` usage. |
38 | | - |
39 | | -## Rules and skills |
40 | | - |
41 | | -- **`.cursor/rules/`** – Cursor rules for this repo: |
42 | | - - **README.md** – Index of all rules (globs / always-on). |
43 | | - - **dev-workflow.md** – Branches, tests, PR expectations. |
44 | | - - **java.mdc** – Applies to `**/*.java` and `**/*.kt`: language style, `com.contentstack.sdk` layout, logging, null-safety. |
45 | | - - **contentstack-android-cda.mdc** – SDK core: CDA patterns, Stack/Config, host/version/region/branch, retry, callbacks, CDA alignment. |
46 | | - - **testing.mdc** – `contentstack/src/test/**` and `contentstack/src/androidTest/**`: naming, unit vs instrumented, JaCoCo. |
47 | | - - **code-review.mdc** – Always applied: PR/review checklist (aligned with Java CDA SDK). |
48 | | -- **`skills/`** – Reusable skill docs: |
49 | | - - **contentstack-android-cda** – Implementing or changing CDA behavior (Stack/Config, entries, assets, sync, HTTP, callbacks). |
50 | | - - **testing** – Writing or refactoring tests. |
51 | | - - **code-review** – PR review / pre-PR checklist. |
52 | | - - **framework** – Config, HTTP layer (Volley + Retrofit/OkHttp), retry/timeouts. |
53 | | - |
54 | | -Refer to `.cursor/rules/README.md` and `skills/README.md` for details. |
| 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