一键导入
port-swc-pr
Port a PR from swc-project/swc to this repository, including tests and code changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Port a PR from swc-project/swc to this repository, including tests and code changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | port-swc-pr |
| description | Port a PR from swc-project/swc to this repository, including tests and code changes. |
This skill guides you through the process of porting a Pull Request from the upstream swc-project/swc repository to the local swc-experimental repository.
swc-project/swc (e.g., 11462).First, retrieve the changes from the upstream PR.
gh pr diff <PR_ID> -R swc-project/swc
Goal: Identify:
crates/swc_ecma_parser/tests. Upstream uses snapshot tests.crates/swc_ecma_parser/src.Create a git branch named like 02-01-feat/port-1234, where feat should be respected to the type of change in the source PR.
Rule: Always match the test failure before fixing the code.
Locate Target Directory:
Tests in this repo are stored in tasks/testsuite/fixtures/misc-parser.
tasks/testsuite/fixtures/misc-parser/passtasks/testsuite/fixtures/misc-parser/failCreate Test File:
tasks/testsuite/fixtures/misc-parser/{pass,fail}.tests/foo/bar.js, name it bar.js or foo-bar.js).Run Tests (Expect Failure): Run the test suite to confirm the tests fail (or behave incorrectly) without the fix.
cargo run -p testsuite
Verify that your new test case is failing.
Apply the logic changes from the diff to the local codebase.
File Mapping Guide: The local repository structure differs slightly from upstream. Use this mapping as a reference:
crates/swc_ecma_parser/src/parser/*.rs -> Local crates/swc_ecma_parser/src/parser/js/*.rs
src/parser/expr.rs -> src/parser/js/expr.rssrc/parser/stmt.rs -> src/parser/js/stmt.rsInstructions:
Run the test suite again to verify the fix.
cargo run -p testsuite
Once the tests pass and the code is verified:
Get Upstream Title:
gh pr view <PR_ID> -R swc-project/swc --json title --jq .title
Create PR: Create the PR using the upstream title and referencing the upstream PR ID in the body.
gh pr create --title "<UPSTREAM_TITLE>" --body "Port of <PR_ID>"
find_by_name if you can't locate a file.testsuite might run all tests. If it's too slow, check if cargo run -p testsuite -- --help offers filtering options (e.g., matching the filename).