Skip to content

Commit f1b882b

Browse files
authored
Merge pull request #162 from contentstack/fix/backmerge-16-06-2026
Fix/backmerge 16 06 2026
2 parents 057e873 + 374049a commit f1b882b

9 files changed

Lines changed: 73 additions & 107 deletions

File tree

.cursor/rules/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cursor (optional)
22

3-
**Cursor** users: start at the repo root **[`AGENTS.md`](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`** (universal for any editor or tool).
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
44

5-
This folder only points contributors here so nothing editor-specific duplicates the canonical docs.
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

AGENTS.md

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Contentstack Management Python Agent guide
1+
# Contentstack Management Python Agent guide
22

3-
**Universal entry point** for anyone automating or assisting work in this repo—AI agents (Cursor, Copilot, CLI tools), reviewers, and contributors. Conventions and detailed guidance live in **`skills/*/SKILL.md`**, not in editor-specific config, so the same instructions apply whether or not you use Cursor.
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
44

55
## What this repo is
66

7-
| | |
8-
|---|---|
9-
| **Name** | **`contentstack-management`** (PyPI) — **Contentstack Management Python SDK** |
10-
| **Purpose** | Python client for the **Content Management API (CMA)**: organizations, stacks, content types, entries, assets, webhooks, workflows, OAuth, and related resources. Uses **`requests`** via **`_APIClient`**. |
11-
| **Repository** | [contentstack/contentstack-management-python](https://github.com/contentstack/contentstack-management-python.git) |
7+
| Field | Detail |
8+
|--------|--------|
9+
| **Name:** | **`contentstack-management`** (PyPI) — [contentstack/contentstack-management-python](https://github.com/contentstack/contentstack-management-python) |
10+
| **Purpose:** | Python client for the **Content Management API (CMA)**: organizations, stacks, content types, entries, assets, webhooks, workflows, OAuth, and related resources. Uses **`requests`** via **`_APIClient`**. |
1211

13-
## Tech stack
12+
## Tech stack (at a glance)
1413

1514
| Area | Details |
1615
|------|---------|
17-
| **Language** | **Python** ≥ 3.9 (`setup.py` `python_requires`) |
18-
| **HTTP** | **`requests`**, **`requests-toolbelt`**, **`urllib3`** |
19-
| **Tests** | **pytest****`tests/unit`**, **`tests/api`**, **`tests/mock`** |
20-
| **Lint** | **pylint** (see `requirements.txt`) |
21-
| **Secrets / hooks** | **Talisman**, **Snyk** (see **README.md** development setup) |
16+
| Language | Python ≥ 3.9 (`setup.py` `python_requires`) |
17+
| Build | `setuptools` / `setup.py`; package `contentstack_management` |
18+
| HTTP | `requests`, `requests-toolbelt`, `urllib3` |
19+
| Tests | `pytest``tests/unit`, `tests/api`, `tests/mock` |
20+
| Lint / coverage | `pylint`, `coverage` (see `requirements.txt`) |
21+
| Secrets / hooks | Talisman, Snyk (see `README.md` development setup) |
2222

2323
## Source layout
2424

@@ -33,26 +33,22 @@
3333

3434
## Commands (quick reference)
3535

36-
```bash
37-
pip install -e ".[dev]"
38-
# or: pip install -r requirements.txt && pip install pytest pytest-cov
39-
40-
pytest tests/unit/ -v
41-
pytest tests/api/ -v # live CMA — needs .env (see tests/cred.py)
42-
pytest tests/mock/ -v
43-
pytest tests/ -v
44-
coverage run -m pytest tests/unit/
45-
```
36+
| Command Type | Command |
37+
|---|---|
38+
| Install | `pip install -e ".[dev]"` |
39+
| Test (unit) | `pytest tests/unit/ -v` |
40+
| Test (API, live) | `pytest tests/api/ -v` (needs `.env` — see `tests/cred.py`) |
41+
| Test (mock) | `pytest tests/mock/ -v` |
42+
| Coverage | `coverage run -m pytest tests/unit/` |
43+
| Lint | `pylint contentstack_management/` |
4644

4745
## Environment variables (API / integration tests)
4846

4947
Loaded via **`tests/cred.py`** (`load_dotenv()`). Examples include **`HOST`**, **`APIKEY`**, **`AUTHTOKEN`**, **`MANAGEMENT_TOKEN`**, **`ORG_UID`**, and resource UIDs (**`CONTENT_TYPE_UID`**, **`ENTRY_UID`**, …). See that file for the full list.
5048

5149
Do not commit secrets.
5250

53-
## Where the real documentation lives: skills
54-
55-
Read these **`SKILL.md` files** for full conventions—**this is the source of truth** for implementation and review:
51+
## Where the documentation lives: skills
5652

5753
| Skill | Path | What it covers |
5854
|-------|------|----------------|
@@ -63,10 +59,10 @@ Read these **`SKILL.md` files** for full conventions—**this is the source of t
6359
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist—public API, HTTP/auth, tests, security |
6460
| **Framework / HTTP** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | **`requests`**, retries, OAuth interceptor, where to change transport |
6561

66-
An index with short “when to use” hints is in [`skills/README.md`](skills/README.md).
62+
An index with “when to use” hints is in [`skills/README.md`](skills/README.md).
6763

68-
## Using Cursor
64+
## Using Cursor (optional)
6965

70-
If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same source of truth as everyone else; no separate `.mdc` rule files.
66+
If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.
7167

7268
Product docs: [Content Management API](https://www.contentstack.com/docs/developers/apis/content-management-api/).

skills/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Skills Contentstack Management Python
1+
# Skills Contentstack Management Python
22

3-
**This directory is the source of truth** for conventions (workflow, SDK API, style, tests, review, HTTP layer). Read **`AGENTS.md`** at the repo root for the index and quick commands; each skill is a folder with **`SKILL.md`** (YAML frontmatter: `name`, `description`).
3+
Source of truth for detailed guidance. Read **[`AGENTS.md`](../AGENTS.md)** first, then open the skill that matches your task.
44

55
## When to use which skill
66

@@ -13,7 +13,4 @@
1313
| **code-review** | PR checklist, API semver, HTTP regressions, secrets |
1414
| **framework** | Changing **`_APIClient`**, retries, **`requests`** usage, OAuth interceptor wiring |
1515

16-
## How to use these docs
17-
18-
- **Humans / any AI tool:** Start at **`AGENTS.md`**, then open the relevant **`skills/<name>/SKILL.md`**.
19-
- **Cursor users:** **`.cursor/rules/README.md`** only points to **`AGENTS.md`** so guidance stays universal—no duplicate `.mdc` rule sets.
16+
Each folder contains `SKILL.md` with YAML frontmatter (`name`, `description`).

skills/code-review/SKILL.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: code-review
3-
description: PR checklist—public API, Client/Stack, _APIClient/OAuth, tests, secrets; align with README and exports.
3+
description: Use when reviewing PRs for the Management Python SDK — public API, _APIClient, OAuth, tests, security.
44
---
55

6-
# Code review Contentstack Management Python
6+
# Code review Contentstack Management Python
77

88
## When to use
99

@@ -42,9 +42,3 @@ Work through the checklist below. Optionally tag findings: **Blocker**, **Major*
4242
| **Blocker** | Breaking public API without approval; security issue; no tests for new logic where tests are practical |
4343
| **Major** | Inconsistent HTTP/auth behavior; README examples that do not match code |
4444
| **Minor** | Style; minor docs |
45-
46-
## References
47-
48-
- **`skills/testing/SKILL.md`**
49-
- **`skills/contentstack-management/SKILL.md`**
50-
- **`skills/dev-workflow/SKILL.md`**
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
11
---
22
name: contentstack-management
3-
description: Public CMA surface—Client, Stack, _APIClient, domain resources, OAuth; align with CMA docs and semver.
3+
description: Use for Client, Stack, _APIClient, domain resources, OAuth, and CMA API alignment.
44
---
55

6-
# Contentstack Management SDK skill
6+
# Contentstack Management SDK – Contentstack Management Python
77

88
## When to use
99

1010
- Implementing or changing **`Client`**, **Stack**, or resource modules (entries, assets, webhooks, …).
1111
- Updating **`README.md`** or public exports for user-visible behavior.
1212
- Assessing semver impact of constructor, method, or export changes.
1313

14-
## Main entry (consumer API)
14+
## Instructions
15+
16+
### Main entry (consumer API)
1517

1618
- **`contentstack_management.Client`** in **`contentstack.py`**: builds CMA **endpoint** from **region** / **host** / **scheme**, merges **headers** (**authtoken**, **management_token**, **early_access**), constructs **`_APIClient`**, optional **`oauth_config`** with **`OAuthHandler`**.
1719

18-
## Structure
20+
### Structure
1921

2022
- **`Stack`****`contentstack_management/stack/stack.py`**: stack-scoped resources (content types, entries, assets, branches, webhooks, …).
2123
- **Org / user****`organizations/`**, **`users/`**, **`user_session/`** as applicable.
2224
- **Resources** — packages under **`contentstack_management/`** following existing patterns.
2325
- **OAuth****`oauth/oauth_handler.py`**, **`oauth/oauth_interceptor.py`**; keep aligned with **`_APIClient`** request path.
2426

25-
## HTTP layer
27+
### HTTP layer
2628

2729
- **`_APIClient._call_request`** — central place for method, URL, JSON, files; respect **timeout** and **max_retries**.
2830

29-
## Extending
31+
### Extending
3032

3133
- Add methods on the appropriate resource class; align path and payload shapes with **CMA** docs.
3234
- Prefer routing HTTP through **`_APIClient`** for consistent retries and OAuth handling.
3335

34-
## Docs and versioning
36+
### Docs and versioning
3537

3638
- Exported **`Client`**, **`Region`**, and stack helpers should match **README** and **`contentstack_management.__init__.py`**.
3739
- Document migration for intentional breaking changes.
38-
39-
## References
40-
41-
- [Content Management API](https://www.contentstack.com/docs/developers/apis/content-management-api/)
42-
- **`skills/framework/SKILL.md`**
43-
- **`skills/python-style/SKILL.md`**

skills/dev-workflow/SKILL.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
11
---
22
name: dev-workflow
3-
description: Install, pytest unit/API/mock, versioning, pylint, hooks—standard workflow for this SDK repo.
3+
description: Use for install, pytest suites, versioning, pylint, hooks, and PR baseline in contentstack-management-python.
44
---
55

6-
# Development workflow Contentstack Management Python
6+
# Development workflow Contentstack Management Python
77

88
## When to use
99

1010
- Setting up locally, opening a PR, or matching CI expectations.
11-
- Answering how do we run tests? or what runs in CI?
11+
- Answering "how do we run tests?" or "what runs in CI?"
1212

13-
## Branches & releases
13+
## Instructions
14+
15+
### Branches & releases
1416

1517
- **Flow:** merge work to **`development`**; **release PRs** are **`development``main`**. After **`main`** moves, [`.github/workflows/back-merge-pr.yml`](../../.github/workflows/back-merge-pr.yml) can open **`main``development`** to resync.
1618
- **PyPI:** publish a **GitHub Release** (`release: published`) to run [`.github/workflows/release.yml`](../../.github/workflows/release.yml). PRs that touch **`contentstack_management/`** or **`setup.py`** must bump **`__version__`** and **`CHANGELOG.md`** per [`.github/workflows/check-version-bump.yml`](../../.github/workflows/check-version-bump.yml).
1719

18-
## Before a PR
20+
### Before a PR
1921

2022
1. **Install**`pip install -e ".[dev]"` or install **`requirements.txt`** plus **pytest** / **pytest-cov** as needed.
2123
2. **`pytest tests/unit/`** — required baseline (matches CI **`coverage run -m pytest tests/unit/`**).
2224
3. **API tests**`pytest tests/api/` when your change affects live CMA behavior; configure **`.env`** per **`tests/cred.py`**. Never commit tokens.
2325
4. **Mock tests**`pytest tests/mock/` when extending mocked HTTP or fixtures.
2426

25-
## Packaging
27+
### Packaging
2628

2729
- Bump **`contentstack_management/__init__.py`** **`__version__`** and align **`setup.py`** versioning if release-facing.
2830

29-
## Tooling
31+
### Tooling
3032

3133
- **pylint** is listed in **`requirements.txt`**; follow existing style in touched files.
3234
- **Husky / Talisman / Snyk** — see **README.md** for local hook setup.
3335

34-
## Pull requests
36+
### Pull requests
3537

3638
- Build passes: **`pytest tests/unit/`** at minimum; run **API** / **mock** when your change touches those layers.
3739
- Follow **`skills/code-review/SKILL.md`** before merge.
3840
- Prefer backward-compatible public API; call out breaking changes and semver.
39-
40-
## References
41-
42-
- **`AGENTS.md`**
43-
- **`skills/contentstack-management/SKILL.md`**
44-
- **`skills/testing/SKILL.md`**

skills/framework/SKILL.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
---
22
name: framework
3-
description: requests-based _APIClient, retries, timeout, OAuth interceptor—central HTTP for the Management SDK.
3+
description: Use for _APIClient, requests usage, retries, timeout, and OAuth interceptor in contentstack-management-python.
44
---
55

6-
# Framework / HTTP Contentstack Management Python
6+
# Framework / HTTP Contentstack Management Python
77

88
## When to use
99

1010
- Editing **`contentstack_management/_api_client.py`** or OAuth interceptor/handler wiring.
1111
- Changing retry policy, timeouts, or how **`requests`** is invoked.
1212

13-
## Integration point
13+
## Instructions
14+
15+
### Integration point
1416

1517
- **`_APIClient`** uses **`requests`** in **`_call_request`**, honors **timeout** and **max_retries**, and delegates to **`oauth_interceptor`** when configured.
1618

17-
## When to change
19+
### When to change
1820

1921
- **Retry or transport behavior** — keep logic centralized in **`_APIClient`** unless a resource truly needs a documented exception.
2022
- **Auth headers** — prefer extending **`Client`** / **`user_agents`** patterns rather than scattering header merges.
2123

22-
## Testing
24+
### Testing
2325

2426
- **Unit** — mock **`requests`** or **`_APIClient`** at the boundary used by existing tests.
2527
- **API** — full stack via credentials from **`tests/cred.py`**.
26-
27-
## References
28-
29-
- **`skills/contentstack-management/SKILL.md`**
30-
- **`skills/dev-workflow/SKILL.md`**
31-
- **`skills/testing/SKILL.md`**

skills/python-style/SKILL.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
11
---
22
name: python-style
3-
description: Package layout under contentstack_management/, setup.py, pylint-friendly style, imports, no secret logging.
3+
description: Use for package layout under contentstack_management/, setup.py, pylint-friendly style, and imports.
44
---
55

6-
# Python style and repo layout Contentstack Management Python
6+
# Python style and repo layout Contentstack Management Python
77

88
## When to use
99

1010
- Editing any Python under **`contentstack_management/`**, **`setup.py`**, or **`requirements.txt`**.
1111
- Adding modules or changing how the public package surface is exported.
1212

13-
## Layout
13+
## Instructions
14+
15+
### Layout
1416

1517
- **`contentstack_management/contentstack.py`****`Client`**, **`Region`**, **`user_agents`**, OAuth wiring.
1618
- **`contentstack_management/_api_client.py`****`_APIClient`** (HTTP, retries).
1719
- **`contentstack_management/stack/`** — stack-scoped API surface.
1820
- **Domain modules****`entries/`**, **`assets/`**, **`webhooks/`**, **`oauth/`**, etc.
1921

20-
## Style
22+
### Style
2123

2224
- Match existing modules: naming, docstrings, and patterns already used in the same directory.
2325
- Prefer small, focused changes; keep **`__init__.py`** exports consistent with public API intent (**`README`**, **`contentstack_management.__all__`**).
2426

25-
## Imports
27+
### Imports
2628

2729
- Use **`requests`** (and **`requests-toolbelt`** where already used) through **`_APIClient`** patterns rather than ad-hoc clients in domain modules unless justified.
2830

29-
## Security
31+
### Security
3032

3133
- Do not log **authtokens**, **management tokens**, **passwords**, or **API keys**; preserve existing header handling in **`Client`**.
32-
33-
## References
34-
35-
- **`skills/framework/SKILL.md`**
36-
- **`skills/contentstack-management/SKILL.md`**
37-
- **`skills/testing/SKILL.md`**

skills/testing/SKILL.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,39 @@
11
---
22
name: testing
3-
description: pytest—unit, API, mock; tests/cred.py and .env; no committed secrets.
3+
description: Use for pytest unit/API/mock suites, tests/cred.py, .env setup, and hygiene in contentstack-management-python.
44
---
55

6-
# Testing Contentstack Management Python
6+
# Testing Contentstack Management Python
77

88
## When to use
99

1010
- Adding or changing tests under **`tests/`**.
1111
- Debugging API vs mock failures; improving **`tests/cred.py`** usage.
1212

13-
## Runner and tooling
13+
## Instructions
14+
15+
### Runner and tooling
1416

1517
| Suite | Path | Notes |
1618
|-------|------|--------|
1719
| **Unit** | `tests/unit/**` | Fast, isolated; primary CI target |
1820
| **API** | `tests/api/**` | Live CMA — **`.env`** via **`tests/cred.py`** |
1921
| **Mock** | `tests/mock/**` | Mocked HTTP / contracts |
2022

21-
### Commands
22-
2323
| Goal | Command |
2424
|------|---------|
2525
| Unit (CI-style) | `pytest tests/unit/ -v` or `coverage run -m pytest tests/unit/` |
2626
| API (live CMA) | `pytest tests/api/ -v` |
2727
| Mock | `pytest tests/mock/ -v` |
2828
| Full tree | `pytest tests/ -v` |
2929

30-
## Environment (`tests/cred.py`)
30+
### Environment (tests/cred.py)
3131

3232
- **`get_credentials()`** loads **dotenv** and returns host, tokens, and resource UIDs.
3333
- Common vars: **`HOST`**, **`APIKEY`**, **`AUTHTOKEN`**, **`MANAGEMENT_TOKEN`**, **`ORG_UID`**, plus resource UIDs as tests require.
3434
- Use a **`.env`** at repo root for local API runs; never commit secrets.
3535

36-
## Hygiene
36+
### Hygiene
3737

3838
- No committed secrets; use placeholders or env-only values for CI.
3939
- Avoid leaving **`pytest.skip`** or focused-only tests enabled in paths meant for full suite runs unless intentional.
40-
41-
## References
42-
43-
- **`skills/dev-workflow/SKILL.md`**
44-
- **`skills/code-review/SKILL.md`**

0 commit comments

Comments
 (0)