Skip to content

Commit 453ebc8

Browse files
authored
Merge pull request #287 from contentstack/development
DX | 02-11-2026 | Release
2 parents b85e63e + 0d7297e commit 453ebc8

24 files changed

Lines changed: 1322 additions & 1149 deletions

File tree

‎.cursor/rules/README.md‎

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
# Cursor rules — `@contentstack/utils`
1+
# Cursor (optional)
22

3-
This folder holds project-specific rules for AI assistants working in **contentstack-utils-javascript**. For the full project overview, see **[`AGENTS.md`](../../AGENTS.md)** at the repository root.
3+
**Cursor** users: start at **[`AGENTS.md`](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
44

5-
## How rules are picked up
6-
7-
Each rule is a `.md`/`.mdc` file. Files with YAML frontmatter can set `description`, `globs`, and `alwaysApply`. Cursor uses these to decide when a rule is included in context.
8-
9-
### Referencing rules in chat
10-
11-
In Cursor, you can **`@`-mention** a rule file (e.g. type `@` and choose the rule from the list) to force its guidance into the conversation. The file name (without extension) is the usual handle, e.g. **`typescript`**, **`testing`**, **`code-review`**.
12-
13-
## Rule index
14-
15-
| File | `alwaysApply` | Globs | When it applies |
16-
|------|----------------|-------|------------------|
17-
| [`dev-workflow.md`](dev-workflow.md) | no | *(none)* | Branching, CI alignment, commits, releases, and day-to-day commands for this repo. |
18-
| [`typescript.mdc`](typescript.mdc) | no | `src/**/*.ts`, `__test__/**/*.ts` | TypeScript version, layout, ESLint/Prettier, strictness, imports. |
19-
| [`typescript-contentstack-utils.mdc`](typescript-contentstack-utils.mdc) | no | `src/**/*.ts` | Delivery-oriented utils only: RTE rendering, GQL helpers, endpoints JSON, Live Preview tags—**not** full CDA/CMA SDK surface. |
20-
| [`testing.mdc`](testing.mdc) | no | `__test__/**/*.ts` | Jest, jsdom, mocks, coverage output paths, no live-test env. |
21-
| [`code-review.mdc`](code-review.mdc) | **yes** | *(global)* | PR checklist: public API docs, compatibility, errors, dependencies, terminology (utils + delivery context). |
22-
23-
## Related
24-
25-
- **[`AGENTS.md`](../../AGENTS.md)** — Single entry point (package purpose, stack, commands).
26-
- **[`skills/README.md`](../../skills/README.md)** — Longer-form skill docs for the same themes.
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

‎.cursor/rules/code-review.mdc‎

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

‎.cursor/rules/dev-workflow.md‎

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

‎.cursor/rules/testing.mdc‎

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

‎.cursor/rules/typescript-contentstack-utils.mdc‎

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

‎.cursor/rules/typescript.mdc‎

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Opens a PR from master → development after changes land on master (back-merge).
2+
#
3+
# Org/repo Settings → Actions → General → Workflow permissions: read and write
4+
# (so GITHUB_TOKEN can create pull requests). Or use a PAT in secret GH_TOKEN.
5+
6+
name: Back-merge master to development
7+
8+
on:
9+
push:
10+
branches: [master]
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
jobs:
18+
open-back-merge-pr:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Open back-merge PR if needed
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
REPO: ${{ github.repository }}
30+
run: |
31+
set -euo pipefail
32+
git fetch origin development master
33+
34+
MASTER_SHA=$(git rev-parse origin/master)
35+
DEV_SHA=$(git rev-parse origin/development)
36+
37+
if [ "$MASTER_SHA" = "$DEV_SHA" ]; then
38+
echo "master and development are at the same commit; nothing to back-merge."
39+
exit 0
40+
fi
41+
42+
EXISTING=$(gh pr list --repo "$REPO" \
43+
--base development \
44+
--head master \
45+
--state open \
46+
--json number \
47+
--jq 'length')
48+
49+
if [ "$EXISTING" -gt 0 ]; then
50+
echo "An open PR from master to development already exists; skipping."
51+
exit 0
52+
fi
53+
54+
gh pr create --repo "$REPO" \
55+
--base development \
56+
--head master \
57+
--title "chore: back-merge master into development" \
58+
--body "Automated back-merge after changes landed on \`master\`. Review and merge to keep \`development\` in sync."
59+
60+
echo "Created back-merge PR master → development."

‎.github/workflows/check-branch.yml‎

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Runs only when production code under src/ changes. Version must be > latest v* tag (not vs base branch).
2+
3+
name: Check Version Bump
4+
5+
on:
6+
pull_request:
7+
8+
jobs:
9+
check-version-bump:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- name: Validate version and changelog updates
16+
shell: bash
17+
env:
18+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
19+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
20+
run: |
21+
set -euo pipefail
22+
23+
VERSION_FILE="package.json"
24+
CHANGELOG_FILE="CHANGELOG.md"
25+
26+
mapfile -t CHANGED_FILES < <(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
27+
if [ "${#CHANGED_FILES[@]}" -eq 0 ]; then
28+
echo "No changed files detected."
29+
exit 0
30+
fi
31+
32+
is_production_source_change() {
33+
local f="$1"
34+
[[ "$f" == src/* ]]
35+
}
36+
37+
has_source_changes=false
38+
for file in "${CHANGED_FILES[@]}"; do
39+
if is_production_source_change "$file"; then
40+
has_source_changes=true
41+
break
42+
fi
43+
done
44+
45+
if [ "$has_source_changes" = false ]; then
46+
echo "Skipping: no src/ production code changes."
47+
exit 0
48+
fi
49+
50+
changed_file() {
51+
local target="$1"
52+
for file in "${CHANGED_FILES[@]}"; do
53+
if [ "$file" = "$target" ]; then
54+
return 0
55+
fi
56+
done
57+
return 1
58+
}
59+
60+
changed_file "$VERSION_FILE" || { echo "Version bump required in $VERSION_FILE."; exit 1; }
61+
changed_file "$CHANGELOG_FILE" || { echo "Matching changelog update required in $CHANGELOG_FILE."; exit 1; }
62+
63+
head_version=$(node -e "console.log(require('./package.json').version)")
64+
CHANGELOG_HEAD=$(sed -nE 's/^## v?([^[:space:]]+).*/\1/p' "$CHANGELOG_FILE" | head -1)
65+
66+
[ -n "$CHANGELOG_HEAD" ] || { echo "::error::Could not find a top changelog heading like '## vX.Y.Z' in $CHANGELOG_FILE."; exit 1; }
67+
[ "$CHANGELOG_HEAD" = "$head_version" ] || { echo "::error::$CHANGELOG_FILE top version ($CHANGELOG_HEAD) does not match project version ($head_version)."; exit 1; }
68+
69+
latest_tag=$(git tag --list 'v*' --sort=-version:refname | sed -n '1p')
70+
latest_version="${latest_tag#v}"
71+
[ -n "$latest_version" ] || latest_version="0.0.0"
72+
73+
version_gt() {
74+
python3 -c 'import sys;v=lambda s:[int(x) if x.isdigit() else 0 for x in (s.strip().lstrip("v").split("-",1)[0].split("+",1)[0].split(".")+["0","0","0"])[:3]];print("true" if v(sys.argv[1])>v(sys.argv[2]) else "false")' "$1" "$2"
75+
}
76+
77+
[ "$(version_gt "$head_version" "$latest_version")" = "true" ] || { echo "Version must be greater than latest tag version ($latest_version). Found $head_version."; exit 1; }

0 commit comments

Comments
 (0)