Skip to content

Commit bacb1f0

Browse files
Updated cursor rules as per new structure
1 parent fddda8e commit bacb1f0

File tree

13 files changed

+196
-197
lines changed

13 files changed

+196
-197
lines changed

.cursor/rules/README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
1-
# Cursor Rules — `contentstack-management`
1+
# Cursor (optional)
22

3-
Rules for **contentstack-management-python**: Python **CMA** SDK (`contentstack_management`).
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).
44

5-
## Rules overview
6-
7-
| Rule | Role |
8-
|------|------|
9-
| [`dev-workflow.md`](dev-workflow.md) | Branch/PR, install, pytest (`unit` / `api` / `mock`), tooling |
10-
| [`python.mdc`](python.mdc) | Python conventions, `contentstack_management/`, `setup.py` |
11-
| [`contentstack-management-python.mdc`](contentstack-management-python.mdc) | **Client**, **Stack**, **`_APIClient`**, CMA modules |
12-
| [`testing.mdc`](testing.mdc) | pytest suites, **`tests/cred.py`**, env |
13-
| [`code-review.mdc`](code-review.mdc) | PR checklist (**always applied**) |
14-
15-
## Rule application
16-
17-
| Context | Typical rules |
18-
|---------|----------------|
19-
| **Every session** | `code-review.mdc` |
20-
| **Most repo files** | `dev-workflow.md` |
21-
| **`contentstack_management/`** | `python.mdc` + `contentstack-management-python.mdc` |
22-
| **`tests/**`** | `testing.mdc` |
23-
| **Packaging / CI** | `python.mdc` |
24-
25-
## Quick reference
26-
27-
| File | `alwaysApply` | Globs (summary) |
28-
|------|---------------|-----------------|
29-
| `dev-workflow.md` | no | `**/*.py`, `setup.py`, `requirements.txt`, `.github/**/*.yml` |
30-
| `python.mdc` | no | `contentstack_management/**/*.py`, `setup.py`, `requirements.txt` |
31-
| `contentstack-management-python.mdc` | no | `contentstack_management/**/*.py` |
32-
| `testing.mdc` | no | `tests/**/*.py` |
33-
| `code-review.mdc` | **yes** ||
34-
35-
## Skills
36-
37-
- [`skills/README.md`](../../skills/README.md) · [`AGENTS.md`](../../AGENTS.md)
5+
This folder only points contributors here so nothing editor-specific duplicates the canonical docs.

.cursor/rules/code-review.mdc

Lines changed: 0 additions & 27 deletions
This file was deleted.

.cursor/rules/contentstack-management-python.mdc

Lines changed: 0 additions & 26 deletions
This file was deleted.

.cursor/rules/testing.mdc

Lines changed: 0 additions & 26 deletions
This file was deleted.

AGENTS.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# AGENTS.md — AI / automation context
1+
# Contentstack Management Python — Agent guide
22

3-
## Project
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.
4+
5+
## What this repo is
46

57
| | |
68
|---|---|
@@ -29,7 +31,7 @@
2931
| `contentstack_management/__init__.py` | Public exports |
3032
| `tests/cred.py` | **`get_credentials()`****dotenv** + env vars for API/mock tests |
3133

32-
## Common commands
34+
## Commands (quick reference)
3335

3436
```bash
3537
pip install -e ".[dev]"
@@ -48,9 +50,23 @@ Loaded via **`tests/cred.py`** (`load_dotenv()`). Examples include **`HOST`**, *
4850

4951
Do not commit secrets.
5052

51-
## Further guidance
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:
56+
57+
| Skill | Path | What it covers |
58+
|-------|------|----------------|
59+
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Install, pytest suites, packaging version, pylint, hooks, PR baseline |
60+
| **Contentstack Management (SDK)** | [`skills/contentstack-management/SKILL.md`](skills/contentstack-management/SKILL.md) | **`Client`**, **`Stack`**, **`_APIClient`**, CMA resources, OAuth, CMA docs |
61+
| **Python style & repo layout** | [`skills/python-style/SKILL.md`](skills/python-style/SKILL.md) | Package layout, naming, imports via **`_APIClient`**, secrets in logs |
62+
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | pytest unit / API / mock, **`tests/cred.py`**, env hygiene |
63+
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist—public API, HTTP/auth, tests, security |
64+
| **Framework / HTTP** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | **`requests`**, retries, OAuth interceptor, where to change transport |
65+
66+
An index with short “when to use” hints is in [`skills/README.md`](skills/README.md).
67+
68+
## Using Cursor
5269

53-
- **Cursor rules:** [`.cursor/rules/README.md`](.cursor/rules/README.md)
54-
- **Skills:** [`skills/README.md`](skills/README.md)
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.
5571

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

skills/README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
# Project skills — `contentstack-management`
1+
# Skills — Contentstack Management Python
22

3-
| Skill | When to use |
4-
|-------|-------------|
5-
| [`code-review/`](code-review/SKILL.md) | PR review, semver, Client / HTTP changes |
6-
| [`testing/`](testing/SKILL.md) | Unit vs API vs mock pytest |
7-
| [`contentstack-management-python/`](contentstack-management-python/SKILL.md) | **Client**, **Stack**, **`_APIClient`**, CMA modules |
8-
| [`framework/`](framework/SKILL.md) | **`requests`** + **`_APIClient`** + OAuth interceptor |
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`).
94

10-
**Overview:** [`AGENTS.md`](../AGENTS.md) · **Rules:** [`.cursor/rules/README.md`](../.cursor/rules/README.md)
5+
## When to use which skill
6+
7+
| Skill folder | Use when |
8+
|--------------|----------|
9+
| **dev-workflow** | Install, **`pytest`** (unit / API / mock), **`__version__`**, pylint, Talisman/Snyk, before PR |
10+
| **contentstack-management** | **`Client`**, **`Stack`**, **`_APIClient`**, domain modules, OAuth, CMA paths and payloads |
11+
| **python-style** | Editing **`contentstack_management/`** or **`setup.py`** / **`requirements.txt`**—layout, style, imports |
12+
| **testing** | Adding or changing tests under **`tests/`**, **`tests/cred.py`**, env for API runs |
13+
| **code-review** | PR checklist, API semver, HTTP regressions, secrets |
14+
| **framework** | Changing **`_APIClient`**, retries, **`requests`** usage, OAuth interceptor wiring |
15+
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.

skills/code-review/SKILL.md

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,50 @@
11
---
22
name: code-review
3-
description: PR review for contentstack-management — public API, Client, _APIClient, OAuth, tests.
3+
description: PR checklist—public API, Client/Stack, _APIClient/OAuth, tests, secrets; align with README and exports.
44
---
55

6-
# Code review — `contentstack-management`
6+
# Code review — Contentstack Management Python
77

8-
## Checklist
8+
## When to use
99

10-
- [ ] **API:** New or changed **`Client`** / **Stack** / resource methods documented; **`contentstack_management/__init__.py`** exports updated if public surface changes.
11-
- [ ] **Version:** **`__version__`** in **`contentstack_management/__init__.py`** aligned with release strategy when user-visible behavior changes.
12-
- [ ] **HTTP:** **`_APIClient`** or OAuth changes covered by unit tests; retries and headers remain consistent.
13-
- [ ] **Tests:** **`pytest tests/unit/`** passes; extend **`tests/api`** or **`tests/mock`** when integration or contract behavior changes.
14-
- [ ] **Secrets:** No tokens in repo; use **`tests/cred.py`** / env for local API runs.
10+
- Reviewing a PR, self-review before submit, or automated review prompts.
11+
12+
## Instructions
13+
14+
Work through the checklist below. Optionally tag findings: **Blocker**, **Major**, **Minor**.
15+
16+
### Public API
17+
18+
- [ ] **Exported** **`Client`**, **`Region`**, stack and resource helpers match **README** and **`contentstack_management.__all__`** / **`__init__.py`**.
19+
- [ ] **Docstrings** on **`Client`** and changed public methods when behavior or parameters change.
20+
21+
### Compatibility
22+
23+
- [ ] Avoid breaking **`Client`** constructor or stack method chains without a semver strategy; document migration for breaking changes.
24+
25+
### HTTP / auth
26+
27+
- [ ] Changes to **`_APIClient`** or **OAuth** paths: verify retries, headers, and interceptor behavior with unit tests; no regressions for **authtoken** / **management_token** headers.
28+
29+
### Testing
30+
31+
- [ ] **Unit** coverage for new logic; **API** updates when live CMA request/response behavior changes; **mock** when contract-style tests are appropriate.
32+
- [ ] **`pytest tests/unit/`** passes.
33+
34+
### Security
35+
36+
- [ ] No hardcoded tokens; no logging secrets in new code.
37+
38+
### Severity (optional)
39+
40+
| Level | Examples |
41+
|-------|----------|
42+
| **Blocker** | Breaking public API without approval; security issue; no tests for new logic where tests are practical |
43+
| **Major** | Inconsistent HTTP/auth behavior; README examples that do not match code |
44+
| **Minor** | Style; minor docs |
1545

1646
## References
1747

18-
- `.cursor/rules/code-review.mdc`
19-
- `.cursor/rules/dev-workflow.md`
48+
- **`skills/testing/SKILL.md`**
49+
- **`skills/contentstack-management/SKILL.md`**
50+
- **`skills/dev-workflow/SKILL.md`**

skills/contentstack-management-python/SKILL.md

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: contentstack-management
3+
description: Public CMA surface—Client, Stack, _APIClient, domain resources, OAuth; align with CMA docs and semver.
4+
---
5+
6+
# Contentstack Management — SDK skill
7+
8+
## When to use
9+
10+
- Implementing or changing **`Client`**, **Stack**, or resource modules (entries, assets, webhooks, …).
11+
- Updating **`README.md`** or public exports for user-visible behavior.
12+
- Assessing semver impact of constructor, method, or export changes.
13+
14+
## Main entry (consumer API)
15+
16+
- **`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`**.
17+
18+
## Structure
19+
20+
- **`Stack`****`contentstack_management/stack/stack.py`**: stack-scoped resources (content types, entries, assets, branches, webhooks, …).
21+
- **Org / user****`organizations/`**, **`users/`**, **`user_session/`** as applicable.
22+
- **Resources** — packages under **`contentstack_management/`** following existing patterns.
23+
- **OAuth****`oauth/oauth_handler.py`**, **`oauth/oauth_interceptor.py`**; keep aligned with **`_APIClient`** request path.
24+
25+
## HTTP layer
26+
27+
- **`_APIClient._call_request`** — central place for method, URL, JSON, files; respect **timeout** and **max_retries**.
28+
29+
## Extending
30+
31+
- Add methods on the appropriate resource class; align path and payload shapes with **CMA** docs.
32+
- Prefer routing HTTP through **`_APIClient`** for consistent retries and OAuth handling.
33+
34+
## Docs and versioning
35+
36+
- Exported **`Client`**, **`Region`**, and stack helpers should match **README** and **`contentstack_management.__init__.py`**.
37+
- 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`**
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
description: "Branches, install, and test layout for contentstack-management-python"
3-
globs:
4-
- "**/*.py"
5-
- "setup.py"
6-
- "requirements.txt"
7-
- ".github/**/*.yml"
8-
alwaysApply: false
2+
name: dev-workflow
3+
description: Install, pytest unit/API/mock, versioning, pylint, hooks—standard workflow for this SDK repo.
94
---
105

11-
# Development workflow — `contentstack-management`
6+
# Development workflow — Contentstack Management Python
7+
8+
## When to use
9+
10+
- Setting up locally, opening a PR, or matching CI expectations.
11+
- Answering “how do we run tests?” or “what runs in CI?”
1212

1313
## Before a PR
1414

@@ -26,6 +26,14 @@ alwaysApply: false
2626
- **pylint** is listed in **`requirements.txt`**; follow existing style in touched files.
2727
- **Husky / Talisman / Snyk** — see **README.md** for local hook setup.
2828

29-
## Links
29+
## Pull requests
30+
31+
- Build passes: **`pytest tests/unit/`** at minimum; run **API** / **mock** when your change touches those layers.
32+
- Follow **`skills/code-review/SKILL.md`** before merge.
33+
- Prefer backward-compatible public API; call out breaking changes and semver.
34+
35+
## References
3036

31-
- [`AGENTS.md`](../../AGENTS.md) · [`skills/contentstack-management-python/SKILL.md`](../../skills/contentstack-management-python/SKILL.md)
37+
- **`AGENTS.md`**
38+
- **`skills/contentstack-management/SKILL.md`**
39+
- **`skills/testing/SKILL.md`**

0 commit comments

Comments
 (0)