Skip to content

Commit 67638b7

Browse files
Updated cusrsor rules structure
1 parent b64f295 commit 67638b7

File tree

13 files changed

+180
-203
lines changed

13 files changed

+180
-203
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_utils`
1+
# Cursor (optional)
22

3-
Rules for **contentstack-utils-python**: Python **utils** package for **RTE / embedded** rendering, **GQL**, and **editable tags** (companion to the Contentstack Python SDK).
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, venv, **pytest**, lint (**ruff** / **black** / **flake8**) |
10-
| [`python.mdc`](python.mdc) | Python layout, `contentstack_utils/`, `setup.py` |
11-
| [`contentstack-utils-python.mdc`](contentstack-utils-python.mdc) | **Utils**, **Options**, RTE/embedded, **GQL**, **entry_editable** |
12-
| [`testing.mdc`](testing.mdc) | **pytest** under **`tests/`** |
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 files** | `dev-workflow.md` |
21-
| **`contentstack_utils/`** | `python.mdc` + `contentstack-utils-python.mdc` |
22-
| **`tests/**`** | `testing.mdc` |
23-
| **`setup.py` / packaging** | `python.mdc` |
24-
25-
## Quick reference
26-
27-
| File | `alwaysApply` | Globs (summary) |
28-
|------|---------------|-----------------|
29-
| `dev-workflow.md` | no | `**/*.py`, `requirements.txt`, `setup.py` |
30-
| `python.mdc` | no | `contentstack_utils/**/*.py`, `setup.py` |
31-
| `contentstack-utils-python.mdc` | no | `contentstack_utils/**/*.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-utils-python.mdc

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

.cursor/rules/testing.mdc

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

AGENTS.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# AGENTS.md — AI / automation context
1+
# Contentstack Utils 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.
44

5-
| | |
6-
|---|---|
7-
| **Name** | **`contentstack_utils`** (PyPI) — **Contentstack Python Utils SDK** |
8-
| **Purpose** | Utilities for **Contentstack** headless CMS: **RTE / embedded** rendering (`Utils`, `Options`), **GQL** helpers, **editable tags** on entries, HTML/metadata helpers. Often used alongside the **`Contentstack`** Python delivery package. |
9-
| **Repository** | [contentstack/contentstack-utils-python](https://github.com/contentstack/contentstack-utils-python.git) |
5+
## What this repo is
106

11-
## Tech stack
7+
- **Name:** [contentstack-utils-python](https://github.com/contentstack/contentstack-utils-python)**`contentstack_utils`** on PyPI (**Contentstack Python Utils SDK**).
8+
- **Purpose:** Utilities for **Contentstack** headless CMS: **RTE / embedded** rendering (`Utils`, `Options`), **GQL** helpers, **editable tags** on entries, HTML/metadata helpers. Often used alongside the **Contentstack** Python delivery package.
9+
- **Out of scope:** This package does **not** ship HTTP clients or stack credentials. Apps fetch content with the [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/) / Python SDK, then pass field data into **`Utils`**.
10+
11+
## Tech stack (at a glance)
1212

1313
| Area | Details |
1414
|------|---------|
@@ -32,7 +32,7 @@
3232
| `contentstack_utils/__init__.py` | Public exports — keep **`__all__`** aligned with documented API |
3333
| `tests/` | pytest modules (`test_*.py`), mocks under `tests/mocks/` |
3434

35-
## Common commands
35+
## Commands (quick reference)
3636

3737
```bash
3838
python -m venv .venv && source .venv/bin/activate # or equivalent on Windows
@@ -47,9 +47,21 @@ coverage run -m pytest && coverage report -m
4747

4848
- Do not commit **API keys**, **delivery tokens**, or other secrets. Examples in **`README.md`** use placeholders only.
4949

50-
## Further guidance
50+
## Where the real documentation lives: skills
51+
52+
Read these **`SKILL.md` files** for full conventions—**this is the source of truth** for implementation and review:
53+
54+
| Skill | Path | What it covers |
55+
|-------|------|----------------|
56+
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, venv, **pytest**, ruff/black/flake8, PR expectations |
57+
| **Contentstack Utils (SDK)** | [`skills/contentstack-utils/SKILL.md`](skills/contentstack-utils/SKILL.md) | **`Utils`**, **`Options`**, RTE/embedded, **GQL**, editable tags, JS parity, semver |
58+
| **Python style & layout** | [`skills/python-style/SKILL.md`](skills/python-style/SKILL.md) | Package layout, typing, imports, **`lxml`**, **`setup.py`**, security |
59+
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | **pytest** layout, coverage, **`tests/mocks/`**, hygiene |
60+
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist (API, **`__all__`**, deps, tests, secrets) |
61+
| **Framework / integration** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | **`lxml`**, companion **Contentstack** Python SDK, dependency boundaries |
62+
63+
An index with short “when to use” hints is in [`skills/README.md`](skills/README.md).
5164

52-
- **Cursor rules:** [`.cursor/rules/README.md`](.cursor/rules/README.md)
53-
- **Skills:** [`skills/README.md`](skills/README.md)
65+
## Using Cursor
5466

55-
Product docs: [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/).
67+
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.

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_utils`
1+
# Skills – Contentstack Utils Python
22

3-
| Skill | When to use |
4-
|-------|-------------|
5-
| [`code-review/`](code-review/SKILL.md) | PR review, semver, public **`__all__`**, dependency changes |
6-
| [`testing/`](testing/SKILL.md) | **pytest**, coverage, **`tests/mocks`** |
7-
| [`contentstack-utils-python/`](contentstack-utils-python/SKILL.md) | **`Utils`**, **`Options`**, RTE/embedded, **GQL**, editable tags |
8-
| [`framework/`](framework/SKILL.md) | **`lxml`**, companion **`Contentstack`** Python SDK usage |
3+
**This directory is the source of truth** for conventions (workflow, SDK API, style, tests, review, framework). 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** | Branches, CI, venv, **`pip install -e .`**, **pytest**, ruff/black/flake8, PRs |
10+
| **contentstack-utils** | **`Utils`**, **`Options`**, RTE/embedded, **GQL**, editable tags, semver, README |
11+
| **python-style** | `contentstack_utils/` layout, typing, **`lxml`** usage, **`setup.py`** |
12+
| **testing** | **pytest**, coverage, **`tests/mocks/`**, HTML reports |
13+
| **code-review** | PR checklist, public API / **`__all__`**, dependencies, security |
14+
| **framework** | **`lxml`** integration, delivery SDK handoff, parsing impact |
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: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,48 @@
11
---
22
name: code-review
3-
description: PR review for contentstack_utils — public API, __all__, lxml/deps, pytest.
3+
description: PR checklist—public API, __all__, semver, lxml/deps, pytest, secrets; aligns with JS utils where applicable.
44
---
55

6-
# Code review `contentstack_utils`
6+
# Code review – Contentstack Utils Python
77

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

10-
- [ ] **API:** New or changed **`Utils`** / **`Options`** / tag helpers reflected in **`contentstack_utils/__init__.py`** **`__all__`** and **README** if user-facing.
11-
- [ ] **Version:** **`setup.py` `version`** bumped when releasing behavioral or API changes (semver).
12-
- [ ] **Dependencies:** Any new **`install_requires`** entry documented; **`lxml`** usage stays appropriate for parsing/rendering.
13-
- [ ] **Tests:** **`pytest`** passes; add tests under **`tests/`** for new behavior.
14-
- [ ] **Secrets:** No tokens in repo; examples use placeholders only.
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+
- [ ] **`contentstack_utils/__init__.py`** **`__all__`** and exports match **README** examples and intended surface (**`Utils`**, **`Options`**, **`GQL`**, **`Automate`**, embed types, **`addEditableTags`** / **`addTags`** / **`getTag`**).
19+
- [ ] **JS parity** — where methods mirror the JS utils SDK, **parameter names** and behavior stay consistent unless a documented breaking change.
20+
21+
### Compatibility
22+
23+
- [ ] No breaking **`Utils`** / **`Options`** / tag helpers without a **semver** plan; **`setup.py` `version`** bumped for user-visible changes.
24+
25+
### Dependencies
26+
27+
- [ ] **`lxml`** usage stays bounded to parsing/rendering paths; new **`install_requires`** documented in **README** / changelog.
28+
29+
### Tests
30+
31+
- [ ] **`pytest`** passes; tests added or extended under **`tests/`** for new behavior and edge cases.
32+
33+
### Security
34+
35+
- [ ] No hardcoded tokens; no logging of secrets in new code.
36+
37+
### Severity (optional)
38+
39+
| Level | Examples |
40+
|-------|----------|
41+
| **Blocker** | Breaking public API without approval; security issue; no tests where practical |
42+
| **Major** | Inconsistent behavior vs documented API; README examples wrong |
43+
| **Minor** | Style; minor docs |
1544

1645
## References
1746

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

skills/contentstack-utils-python/SKILL.md

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

skills/contentstack-utils/SKILL.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: contentstack-utils
3+
description: Public API—Utils, Options, RTE/embedded, GQL, editable tags; JS parity; no bundled HTTP client.
4+
---
5+
6+
# Contentstack Utils – SDK skill
7+
8+
## When to use
9+
10+
- Implementing or changing RTE/HTML rendering, embedded resolution, **GQL**, or editable-tag behavior.
11+
- Updating **`README.md`** / **`changelog.rst`** / **`setup.py`** for user-visible behavior.
12+
- Assessing semver impact of **`__init__.py`** exports and public classes.
13+
14+
## Core entry points
15+
16+
- **`Utils`****`contentstack_utils.utils`**: **`render_content`**, **`render`**, embedded/RTE resolution; subclasses **`Automate`**.
17+
- **`Options`****`contentstack_utils.render.options`**: rendering configuration passed into **`Utils`** methods.
18+
- **Editable tags****`entry_editable`**: **`addEditableTags`**, **`addTags`**, **`getTag`**; also exposed as **`Utils.addEditableTags`** / **`Utils.addTags`** / **`Utils.getTag`** for parity.
19+
20+
## Features
21+
22+
- **Embedded / RTE** — JSON and HTML paths through **`Utils`** and **`Automate`**; **metadata** via **`Metadata`**.
23+
- **Styles****`convert_style`** and **embedded** **StyleType** / **ItemType** where applicable.
24+
- **GQL****`GQL`** in **`gql.py`** for GraphQL-oriented HTML/helpers.
25+
26+
## Public API and docs
27+
28+
- **`contentstack_utils/__init__.py`** **`__all__`** and exports must match **README** examples and intended surface (**`Utils`**, **`Options`**, **`GQL`**, **`Automate`**, embed types, tag helpers).
29+
- **JS parity** — where methods mirror the JS utils SDK, keep **parameter names** and behavior consistent unless a documented breaking change.
30+
31+
## Compatibility
32+
33+
- Avoid breaking **`Utils`** / **`Options`** / tag helpers without a **semver** plan; bump **`setup.py` `version`** for user-visible changes.
34+
35+
## Dependencies
36+
37+
- **`lxml`** usage stays bounded to parsing/rendering paths; note any new **`install_requires`** in **README** / changelog if added to **`setup.py`**.
38+
39+
## No network layer
40+
41+
- This package does **not** ship HTTP clients or tokens.
42+
- Consumers often use **`contentstack.Stack`** (**Contentstack** package) to fetch entries, then **`Utils.render`** / **`Utils.render_content`** — keep **README** examples accurate.
43+
44+
## References
45+
46+
- [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/)
47+
- **`skills/python-style/SKILL.md`**, **`skills/framework/SKILL.md`**
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
2-
description: "Branches, venv, pytest, and lint for contentstack-utils-python"
3-
globs: ["**/*.py", "requirements.txt", "setup.py"]
4-
alwaysApply: false
2+
name: dev-workflow
3+
description: Branches, CI, venv, pytest, lint—standard workflow for Contentstack Utils Python.
54
---
65

7-
# Development workflow — `contentstack_utils`
6+
# Development workflow – Contentstack Utils Python
7+
8+
## When to use
9+
10+
- Setting up locally, opening a PR, or aligning with CI.
11+
- Answering “how do we run tests?” or “which branch targets `master`?”
812

913
## Before a PR
1014

@@ -15,8 +19,9 @@ alwaysApply: false
1519

1620
## Branching
1721

18-
- Follow org conventions: **`development`** / **`staging`** / **`master`**; PRs to **`master`** may be restricted (see **`.github/workflows/check-branch.yml`**).
22+
- Follow org conventions: **`development`** / **`staging`** / **`master`**; PRs to **`master`** may be restricted (see **`.github/workflows/check-branch.yml`**). Confirm with your team before opening PRs to **`master`**.
1923

2024
## Links
2125

22-
- [`AGENTS.md`](../../AGENTS.md) · [`skills/contentstack-utils-python/SKILL.md`](../../skills/contentstack-utils-python/SKILL.md)
26+
- **`AGENTS.md`** — commands and layout overview.
27+
- **`skills/code-review/SKILL.md`** — pre-merge checklist.

0 commit comments

Comments
 (0)