Skip to content

Commit 156092c

Browse files
committed
add skill to sync upstream into sigma fork
1 parent fdd7a07 commit 156092c

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

.claude/commands/sync-upstream.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Sync Upstream into Sigma Fork
2+
3+
Sync the sigmacomputing fork of sqlparser-rs with commits from the apache upstream remote.
4+
5+
## Instructions
6+
7+
### Step 1: Determine the sync target
8+
9+
The user may have provided a sync target as an argument: `$ARGUMENTS`
10+
11+
If a target was provided, interpret it as one of:
12+
- `latest` or empty — sync to `upstream/main` HEAD
13+
- `latest-tag` — sync to the most recent upstream tag
14+
- A tag name like `v0.61.0` — sync to that specific tag
15+
- A commit hash — sync to that specific commit
16+
17+
If no argument was provided, first fetch remotes and gather context, then ask the user:
18+
```bash
19+
git fetch origin
20+
git fetch upstream --tags
21+
22+
# Gather info for the prompt:
23+
git log -1 --format="%h %s (%ci)" upstream/main # latest commit
24+
git tag --list --sort=-version:refname | grep -E '^v?[0-9]' | head -1 # latest tag name
25+
git log -1 --format="%h %s (%ci)" $(git tag --list --sort=-version:refname | grep -E '^v?[0-9]' | head -1) # latest tag commit info
26+
```
27+
28+
Use AskUserQuestion with the gathered info included in each option description:
29+
1. **Latest commit on upstream/main** — show the commit hash, message, and date
30+
2. **Latest tag** — show the tag name, commit hash, and date
31+
3. **Specific tag** — prompt for tag name (list a few recent tags with dates as context)
32+
4. **Specific commit** — prompt for commit hash
33+
34+
Once the target is known, resolve it:
35+
```bash
36+
# Latest commit: TARGET=upstream/main
37+
# Latest tag: TARGET=$(git tag --list --sort=-version:refname | grep -E '^v?[0-9]' | head -1)
38+
# Specific tag: TARGET=<tag>
39+
# Specific commit: TARGET=<hash>
40+
41+
git rev-parse $TARGET # confirm it resolves
42+
```
43+
44+
### Step 2: Create a new branch off the target
45+
46+
Name the branch to reflect what's being synced:
47+
```bash
48+
git checkout -b ayman/sync-upstream-$(date +%Y%m%d) $TARGET
49+
```
50+
51+
### Step 3: Merge origin/main
52+
```bash
53+
git merge origin/main --no-ff -m "Merge sigma origin/main into upstream/main for sync"
54+
```
55+
56+
This will likely produce conflicts. Do NOT abort — proceed to resolve them.
57+
58+
### Step 4: Resolve all merge conflicts
59+
60+
For each conflicted file:
61+
62+
1. **Understand sigma's intent**: Look at the original sigma commits and PRs to understand the purpose behind each change. Use `git log`, `git show`, and the GitHub PR history as needed.
63+
64+
2. **Understand upstream's changes**: Determine whether upstream's changes cover, supersede, or are orthogonal to sigma's changes.
65+
66+
3. **Default resolution**: Keep changes from BOTH sides unless one side clearly supersedes the other. Never discard either side without good reason.
67+
68+
4. Ask the user if uncertain about any conflict resolution.
69+
70+
After resolving all conflicts in all files:
71+
```bash
72+
git add <all-resolved-files>
73+
git commit --no-edit # completes the merge commit
74+
```
75+
76+
All conflict resolutions must be in the single merge commit.
77+
78+
### Step 5: Fix compilation and test issues
79+
80+
```bash
81+
cargo clippy --all-features --all-targets
82+
```
83+
84+
Investigate and fix any errors or warnings. Commit fixes as a separate commit (do not amend the merge commit).
85+
86+
### Step 6: Run full verification
87+
88+
```bash
89+
cargo fmt
90+
cargo clippy --all-features --all-targets
91+
cargo test --all-features --all-targets
92+
```
93+
94+
All must pass before creating the PR. Fix any remaining issues and commit them.
95+
96+
### Step 7: Push and create PR
97+
98+
```bash
99+
git push origin ayman/sync-upstream-$(date +%Y%m%d)
100+
gh pr create \
101+
--repo sigmacomputing/sqlparser-rs \
102+
--base main \
103+
--head ayman/sync-upstream-$(date +%Y%m%d) \
104+
--title "[chore] Sync upstream apache/datafusion-sqlparser-rs into sigma fork" \
105+
--body "..."
106+
```
107+
108+
The PR description must include:
109+
- The upstream ref being synced to (commit hash, tag, or HEAD) and what it corresponds to
110+
- Number of upstream commits brought in
111+
- Summary of notable upstream changes (new features, dialects, fixes)
112+
- List of all sigma features confirmed preserved
113+
- Summary of each conflict resolved and how
114+
- Checklist confirming clippy, fmt, and tests all pass

.claude/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git fetch:*)",
5+
"Bash(git merge:*)",
6+
"Bash(echo \"EXIT: $?\")",
7+
"Bash(cargo build:*)",
8+
"Bash(cargo test:*)",
9+
"Bash(git add:*)",
10+
"Bash(git push:*)",
11+
"Bash(gh pr:*)",
12+
"Bash(git stash:*)",
13+
"Bash(git checkout:*)",
14+
"Bash(gh auth:*)",
15+
"Bash(git remote:*)",
16+
"Bash(gh repo:*)",
17+
"Bash(git log:*)",
18+
"Bash(git commit:*)",
19+
"Bash(cargo fmt:*)",
20+
"Bash(cargo clippy:*)"
21+
]
22+
}
23+
}

0 commit comments

Comments
 (0)