Skip to content

Commit 01a2f61

Browse files
reeshika-hclaude
andcommitted
Merge development into back-merge/DX-20927
Brings back-merge branch up to date with development so master can be back-merged cleanly (DX-20927). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents c8b4b60 + 72673f2 commit 01a2f61

21 files changed

Lines changed: 408 additions & 377 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: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
run: |
30+
set -euo pipefail
31+
git fetch origin development master
32+
33+
MASTER_SHA=$(git rev-parse origin/master)
34+
DEV_SHA=$(git rev-parse origin/development)
35+
36+
if [ "$MASTER_SHA" = "$DEV_SHA" ]; then
37+
echo "master and development are at the same commit; nothing to back-merge."
38+
exit 0
39+
fi
40+
41+
EXISTING=$(gh pr list --repo "${{ github.repository }}" \
42+
--base development \
43+
--head master \
44+
--state open \
45+
--json number \
46+
--jq 'length')
47+
48+
if [ "$EXISTING" -gt 0 ]; then
49+
echo "An open PR from master to development already exists; skipping."
50+
exit 0
51+
fi
52+
53+
gh pr create --repo "${{ github.repository }}" \
54+
--base development \
55+
--head master \
56+
--title "chore: back-merge master into development" \
57+
--body "Automated back-merge after changes landed on \`master\`. Review and merge to keep \`development\` in sync."
58+
59+
echo "Created back-merge PR master → development."

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

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
run: |
18+
set -euo pipefail
19+
20+
VERSION_FILE="package.json"
21+
CHANGELOG_FILE="CHANGELOG.md"
22+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
23+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
24+
25+
mapfile -t CHANGED_FILES < <(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
26+
if [ "${#CHANGED_FILES[@]}" -eq 0 ]; then
27+
echo "No changed files detected."
28+
exit 0
29+
fi
30+
31+
is_production_source_change() {
32+
local f="$1"
33+
[[ "$f" == src/* ]]
34+
}
35+
36+
has_source_changes=false
37+
for file in "${CHANGED_FILES[@]}"; do
38+
if is_production_source_change "$file"; then
39+
has_source_changes=true
40+
break
41+
fi
42+
done
43+
44+
if [ "$has_source_changes" = false ]; then
45+
echo "Skipping: no src/ production code changes."
46+
exit 0
47+
fi
48+
49+
changed_file() {
50+
local target="$1"
51+
for file in "${CHANGED_FILES[@]}"; do
52+
if [ "$file" = "$target" ]; then
53+
return 0
54+
fi
55+
done
56+
return 1
57+
}
58+
59+
changed_file "$VERSION_FILE" || { echo "Version bump required in $VERSION_FILE."; exit 1; }
60+
changed_file "$CHANGELOG_FILE" || { echo "Matching changelog update required in $CHANGELOG_FILE."; exit 1; }
61+
62+
head_version=$(node -e "console.log(require('./package.json').version)")
63+
CHANGELOG_HEAD=$(sed -nE 's/^## v?([^[:space:]]+).*/\1/p' "$CHANGELOG_FILE" | head -1)
64+
65+
[ -n "$CHANGELOG_HEAD" ] || { echo "::error::Could not find a top changelog heading like '## vX.Y.Z' in $CHANGELOG_FILE."; exit 1; }
66+
[ "$CHANGELOG_HEAD" = "$head_version" ] || { echo "::error::$CHANGELOG_FILE top version ($CHANGELOG_HEAD) does not match project version ($head_version)."; exit 1; }
67+
68+
latest_tag=$(git tag --list 'v*' --sort=-version:refname | sed -n '1p')
69+
latest_version="${latest_tag#v}"
70+
[ -n "$latest_version" ] || latest_version="0.0.0"
71+
72+
version_gt() {
73+
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"
74+
}
75+
76+
[ "$(version_gt "$head_version" "$latest_version")" = "true" ] || { echo "Version must be greater than latest tag version ($latest_version). Found $head_version."; exit 1; }

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Unit-Test-CI
22

33
on:
44
push:
5-
branches: [ master, staging, development ]
5+
branches: [ master, development ]
66
pull_request:
7-
branches: [ master, staging, development ]
7+
branches: [ master, development ]
88

99
jobs:
1010
build-test:

0 commit comments

Comments
 (0)