Skip to content

feat(scene): route Scene MCP commands to PinK editor runtimes #1134

feat(scene): route Scene MCP commands to PinK editor runtimes

feat(scene): route Scene MCP commands to PinK editor runtimes #1134

Workflow file for this run

name: Check DTS
on:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
check-dts:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
clean: false
persist-credentials: true
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: '22.17.0'
- name: Setup environment
uses: ./.github/actions/setup-env
env:
MINIMAL_DOWNLOAD_TOOLS: 'true'
- name: Generate DTS
shell: pwsh
run: npm run generate:dts:ci
- name: Run DTS tests
shell: bash
run: |
cp packages/engine/bin/.declarations/cc.d.ts packages/cocos-cli-types/cc.d.ts
npx jest --roots packages/cocos-cli-types --testPathPattern dts-snapshot --no-cache
npx eslint --fix "./packages/cocos-cli-types/*.d.ts"
npx jest packages/cocos-cli-types --roots="<rootDir>/packages/cocos-cli-types" --testPathIgnorePatterns dts-snapshot
- name: Typecheck DTS declarations
shell: bash
run: |
errors=$(npx tsc -p packages/cocos-cli-types/tsconfig.typecheck.json --noEmit 2>&1 | grep "^packages/cocos-cli-types/" || true)
if [ -n "$errors" ]; then
echo "::error::DTS typecheck failed — type errors found in cocos-cli-types declarations:"
echo "$errors"
exit 1
fi
echo "DTS typecheck passed."
- name: Check DTS API compatibility
shell: bash
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
BASE_REF="origin/${{ github.base_ref }}"
SNAP_FILE="packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap"
# Skip if snapshot file is new (not in base branch yet)
if ! git show "$BASE_REF:$SNAP_FILE" > /dev/null 2>&1; then
echo "Snapshot file is new, skipping API compatibility check."
exit 0
fi
# Detect truly removed API lines by comparing deleted vs added lines.
# Lines that appear in both deleted and added sets are modifications or
# snapshot reorganizations (due to index.d.ts duplication), not removals.
# Only lines present in deleted but NOT in added are real breaking changes.
extract_truly_deleted() {
local diff_output="$1"
local noise_filter='grep -v "^exports\[" | grep -v "^$" | grep -v "^[[:space:]]*$" | grep -v "^\`;" | grep -v "^[[:space:]]*}[;,]\?$" | grep -v "^export { }$" | grep -v "^[[:space:]]*static readonly version" | grep -v "^export { .*_[0-9]\+ as "'
# Extract deleted lines (strip leading -, normalize non-semantic syntax differences)
local deleted
deleted=$(echo "$diff_output" | grep '^-' | grep -v '^---' | sed 's/^-//' \
| eval "$noise_filter" | sed "s/\"/'/g; s/\bObject\b/object/g; s/,[[:space:]]*$//" | sort -u || true)
# Extract added lines (strip leading +, normalize non-semantic syntax differences)
local added
added=$(echo "$diff_output" | grep '^+' | grep -v '^+++' | sed 's/^+//' \
| eval "$noise_filter" | sed "s/\"/'/g; s/\bObject\b/object/g; s/,[[:space:]]*$//" | sort -u || true)
# Lines in deleted but NOT in added = truly removed
if [ -n "$deleted" ]; then
comm -23 <(echo "$deleted") <(echo "$added") || true
fi
}
# 1) Committed snapshot changes (BASE...HEAD)
COMMITTED_REMOVED=""
if git diff --name-only "$BASE_REF"...HEAD | grep -q "$SNAP_FILE"; then
DIFF_OUTPUT=$(git diff "$BASE_REF"...HEAD -- "$SNAP_FILE")
COMMITTED_REMOVED=$(extract_truly_deleted "$DIFF_OUTPUT")
fi
# 2) Uncommitted snapshot changes: the -u step regenerated the snapshot
# from current code; diff HEAD vs working tree catches type changes
# that were not committed as snapshot updates.
UNCOMMITTED_REMOVED=""
if ! git diff --quiet HEAD -- "$SNAP_FILE" 2>/dev/null; then
DIFF_OUTPUT=$(git diff HEAD -- "$SNAP_FILE")
UNCOMMITTED_REMOVED=$(extract_truly_deleted "$DIFF_OUTPUT")
fi
# Merge and deduplicate across both sources
DELETED_LINES=$(printf '%s\n%s' "$COMMITTED_REMOVED" "$UNCOMMITTED_REMOVED" | grep -v '^$' | sort -u || true)
if [ -z "$DELETED_LINES" ]; then
echo "No DTS API breaking changes detected."
exit 0
fi
# There are deleted/modified lines — this is a breaking change
if [[ "$PR_TITLE" != *"[break]"* ]]; then
echo "::error::DTS API breaking change detected! Existing API signatures were modified or removed."
echo "::error::If this change is intentional, add [break] to your PR title."
echo "Changed lines:"
echo "$DELETED_LINES"
exit 1
fi
echo "API breaking change detected and [break] tag found in PR title."