Skip to content

Commit f535193

Browse files
committed
Merge branch 'dev' into feat/fork-session-take-2
2 parents 0958761 + 2c82e6c commit f535193

202 files changed

Lines changed: 19280 additions & 8661 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/setup-git-committer/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ runs:
2323
with:
2424
app-id: ${{ inputs.opencode-app-id }}
2525
private-key: ${{ inputs.opencode-app-secret }}
26+
owner: ${{ github.repository_owner }}
2627

2728
- name: Configure git user
2829
run: |

.github/pull_request_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
### What does this PR do?
22

3+
Please provide a description of the issue (if there is one), the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the pr.
4+
5+
**If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!**
6+
37
### How did you verify your code works?

.github/workflows/beta.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
name: beta
22

33
on:
4-
push:
5-
branches: [dev]
6-
pull_request:
7-
types: [opened, synchronize, labeled, unlabeled]
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 * * * *"
87

98
jobs:
109
sync:
11-
if: |
12-
github.event_name == 'push' ||
13-
(github.event_name == 'pull_request' &&
14-
contains(github.event.pull_request.labels.*.name, 'contributor'))
1510
runs-on: blacksmith-4vcpu-ubuntu-2404
1611
permissions:
1712
contents: write
18-
pull-requests: write
1913
steps:
2014
- name: Checkout repository
2115
uses: actions/checkout@v4

.github/workflows/close-stale-prs.yml

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,98 @@ jobs:
2828
const cutoff = new Date(Date.now() - DAYS_INACTIVE * 24 * 60 * 60 * 1000)
2929
const { owner, repo } = context.repo
3030
const dryRun = context.payload.inputs?.dryRun === "true"
31-
const stalePrs = []
3231
3332
core.info(`Dry run mode: ${dryRun}`)
33+
core.info(`Cutoff date: ${cutoff.toISOString()}`)
3434
35-
const prs = await github.paginate(github.rest.pulls.list, {
36-
owner,
37-
repo,
38-
state: "open",
39-
per_page: 100,
40-
sort: "updated",
41-
direction: "asc",
42-
})
43-
44-
for (const pr of prs) {
45-
const lastUpdated = new Date(pr.updated_at)
46-
if (lastUpdated > cutoff) {
47-
core.info(`PR ${pr.number} is fresh`)
48-
continue
35+
const query = `
36+
query($owner: String!, $repo: String!, $cursor: String) {
37+
repository(owner: $owner, name: $repo) {
38+
pullRequests(first: 100, states: OPEN, after: $cursor) {
39+
pageInfo {
40+
hasNextPage
41+
endCursor
42+
}
43+
nodes {
44+
number
45+
title
46+
author {
47+
login
48+
}
49+
createdAt
50+
commits(last: 1) {
51+
nodes {
52+
commit {
53+
committedDate
54+
}
55+
}
56+
}
57+
comments(last: 1) {
58+
nodes {
59+
createdAt
60+
}
61+
}
62+
reviews(last: 1) {
63+
nodes {
64+
createdAt
65+
}
66+
}
67+
}
68+
}
69+
}
4970
}
71+
`
72+
73+
const allPrs = []
74+
let cursor = null
75+
let hasNextPage = true
76+
77+
while (hasNextPage) {
78+
const result = await github.graphql(query, {
79+
owner,
80+
repo,
81+
cursor,
82+
})
5083
51-
stalePrs.push(pr)
84+
allPrs.push(...result.repository.pullRequests.nodes)
85+
hasNextPage = result.repository.pullRequests.pageInfo.hasNextPage
86+
cursor = result.repository.pullRequests.pageInfo.endCursor
5287
}
5388
89+
core.info(`Found ${allPrs.length} open pull requests`)
90+
91+
const stalePrs = allPrs.filter((pr) => {
92+
const dates = [
93+
new Date(pr.createdAt),
94+
pr.commits.nodes[0] ? new Date(pr.commits.nodes[0].commit.committedDate) : null,
95+
pr.comments.nodes[0] ? new Date(pr.comments.nodes[0].createdAt) : null,
96+
pr.reviews.nodes[0] ? new Date(pr.reviews.nodes[0].createdAt) : null,
97+
].filter((d) => d !== null)
98+
99+
const lastActivity = dates.sort((a, b) => b.getTime() - a.getTime())[0]
100+
101+
if (!lastActivity || lastActivity > cutoff) {
102+
core.info(`PR #${pr.number} is fresh (last activity: ${lastActivity?.toISOString() || "unknown"})`)
103+
return false
104+
}
105+
106+
core.info(`PR #${pr.number} is STALE (last activity: ${lastActivity.toISOString()})`)
107+
return true
108+
})
109+
54110
if (!stalePrs.length) {
55111
core.info("No stale pull requests found.")
56112
return
57113
}
58114
115+
core.info(`Found ${stalePrs.length} stale pull requests`)
116+
59117
for (const pr of stalePrs) {
60118
const issue_number = pr.number
61119
const closeComment = `Closing this pull request because it has had no updates for more than ${DAYS_INACTIVE} days. If you plan to continue working on it, feel free to reopen or open a new PR.`
62120
63121
if (dryRun) {
64-
core.info(`[dry-run] Would close PR #${issue_number} from ${pr.user.login}`)
122+
core.info(`[dry-run] Would close PR #${issue_number} from ${pr.author.login}: ${pr.title}`)
65123
continue
66124
}
67125
@@ -79,5 +137,5 @@ jobs:
79137
state: "closed",
80138
})
81139
82-
core.info(`Closed PR #${issue_number} from ${pr.user.login}`)
140+
core.info(`Closed PR #${issue_number} from ${pr.author.login}: ${pr.title}`)
83141
}

.github/workflows/generate.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- dev
7-
pull_request:
8-
workflow_dispatch:
97

108
jobs:
119
generate:

.github/workflows/nix-hashes.yml

Lines changed: 92 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -21,120 +21,131 @@ on:
2121
- ".github/workflows/nix-hashes.yml"
2222

2323
jobs:
24-
nix-hashes:
25-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
26-
runs-on: blacksmith-4vcpu-ubuntu-2404
27-
env:
28-
TITLE: node_modules hashes
24+
# Native runners required: bun install cross-compilation flags (--os/--cpu)
25+
# do not produce byte-identical node_modules as native installs.
26+
compute-hash:
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- system: x86_64-linux
32+
runner: blacksmith-4vcpu-ubuntu-2404
33+
- system: aarch64-linux
34+
runner: blacksmith-4vcpu-ubuntu-2404-arm
35+
- system: x86_64-darwin
36+
runner: macos-15-intel
37+
- system: aarch64-darwin
38+
runner: macos-latest
39+
runs-on: ${{ matrix.runner }}
2940

3041
steps:
3142
- name: Checkout repository
3243
uses: actions/checkout@v6
44+
45+
- name: Setup Nix
46+
uses: nixbuild/nix-quick-install-action@v34
47+
48+
- name: Compute node_modules hash
49+
id: hash
50+
env:
51+
SYSTEM: ${{ matrix.system }}
52+
run: |
53+
set -euo pipefail
54+
55+
BUILD_LOG=$(mktemp)
56+
trap 'rm -f "$BUILD_LOG"' EXIT
57+
58+
# Build with fakeHash to trigger hash mismatch and reveal correct hash
59+
nix build ".#packages.${SYSTEM}.node_modules_updater" --no-link 2>&1 | tee "$BUILD_LOG" || true
60+
61+
# Extract hash from build log with portability
62+
HASH="$(grep -oE 'sha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | tail -n1 || true)"
63+
64+
if [ -z "$HASH" ]; then
65+
echo "::error::Failed to compute hash for ${SYSTEM}"
66+
cat "$BUILD_LOG"
67+
exit 1
68+
fi
69+
70+
echo "$HASH" > hash.txt
71+
echo "Computed hash for ${SYSTEM}: $HASH"
72+
73+
- name: Upload hash
74+
uses: actions/upload-artifact@v4
3375
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
76+
name: hash-${{ matrix.system }}
77+
path: hash.txt
78+
retention-days: 1
79+
80+
update-hashes:
81+
needs: compute-hash
82+
if: github.event_name != 'pull_request'
83+
runs-on: blacksmith-4vcpu-ubuntu-2404
84+
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
with:
89+
persist-credentials: false
3590
fetch-depth: 0
36-
ref: ${{ github.head_ref || github.ref_name }}
37-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
91+
ref: ${{ github.ref_name }}
3892

3993
- name: Setup git committer
40-
id: committer
4194
uses: ./.github/actions/setup-git-committer
4295
with:
4396
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
4497
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
4598

46-
- name: Setup Nix
47-
uses: nixbuild/nix-quick-install-action@v34
48-
4999
- name: Pull latest changes
50-
env:
51-
TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
52100
run: |
53-
BRANCH="${TARGET_BRANCH:-${GITHUB_REF_NAME}}"
54-
git pull --rebase --autostash origin "$BRANCH"
101+
git pull --rebase --autostash origin "$GITHUB_REF_NAME"
55102
56-
- name: Compute all node_modules hashes
103+
- name: Download hash artifacts
104+
uses: actions/download-artifact@v4
105+
with:
106+
path: hashes
107+
pattern: hash-*
108+
109+
- name: Update hashes.json
57110
run: |
58111
set -euo pipefail
59112
60113
HASH_FILE="nix/hashes.json"
61-
SYSTEMS="x86_64-linux aarch64-linux x86_64-darwin aarch64-darwin"
62-
63-
if [ ! -f "$HASH_FILE" ]; then
64-
mkdir -p "$(dirname "$HASH_FILE")"
65-
echo '{"nodeModules":{}}' > "$HASH_FILE"
66-
fi
67-
68-
for SYSTEM in $SYSTEMS; do
69-
echo "Computing hash for ${SYSTEM}..."
70-
BUILD_LOG=$(mktemp)
71-
trap 'rm -f "$BUILD_LOG"' EXIT
72114
73-
# The updater derivations use fakeHash, so they will fail and reveal the correct hash
74-
UPDATER_ATTR=".#packages.x86_64-linux.${SYSTEM}_node_modules"
75-
76-
nix build "$UPDATER_ATTR" --no-link 2>&1 | tee "$BUILD_LOG" || true
77-
78-
CORRECT_HASH="$(grep -E 'got:\s+sha256-[A-Za-z0-9+/=]+' "$BUILD_LOG" | awk '{print $2}' | head -n1 || true)"
79-
80-
if [ -z "$CORRECT_HASH" ]; then
81-
CORRECT_HASH="$(grep -A2 'hash mismatch' "$BUILD_LOG" | grep 'got:' | awk '{print $2}' | sed 's/sha256:/sha256-/' || true)"
82-
fi
83-
84-
if [ -z "$CORRECT_HASH" ]; then
85-
echo "Failed to determine correct node_modules hash for ${SYSTEM}."
86-
cat "$BUILD_LOG"
87-
exit 1
115+
[ -f "$HASH_FILE" ] || echo '{"nodeModules":{}}' > "$HASH_FILE"
116+
117+
for SYSTEM in x86_64-linux aarch64-linux x86_64-darwin aarch64-darwin; do
118+
FILE="hashes/hash-${SYSTEM}/hash.txt"
119+
if [ -f "$FILE" ]; then
120+
HASH="$(tr -d '[:space:]' < "$FILE")"
121+
echo "${SYSTEM}: ${HASH}"
122+
jq --arg sys "$SYSTEM" --arg h "$HASH" '.nodeModules[$sys] = $h' "$HASH_FILE" > tmp.json
123+
mv tmp.json "$HASH_FILE"
124+
else
125+
echo "::warning::Missing hash for ${SYSTEM}"
88126
fi
89-
90-
echo " ${SYSTEM}: ${CORRECT_HASH}"
91-
jq --arg sys "$SYSTEM" --arg h "$CORRECT_HASH" \
92-
'.nodeModules[$sys] = $h' "$HASH_FILE" > "${HASH_FILE}.tmp"
93-
mv "${HASH_FILE}.tmp" "$HASH_FILE"
94127
done
95128
96-
echo "All hashes computed:"
97129
cat "$HASH_FILE"
98130
99-
- name: Commit ${{ env.TITLE }} changes
100-
env:
101-
TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
131+
- name: Commit changes
102132
run: |
103133
set -euo pipefail
104134
105135
HASH_FILE="nix/hashes.json"
106-
echo "Checking for changes..."
107-
108-
summarize() {
109-
local status="$1"
110-
{
111-
echo "### Nix $TITLE"
112-
echo ""
113-
echo "- ref: ${GITHUB_REF_NAME}"
114-
echo "- status: ${status}"
115-
} >> "$GITHUB_STEP_SUMMARY"
116-
if [ -n "${GITHUB_SERVER_URL:-}" ] && [ -n "${GITHUB_REPOSITORY:-}" ] && [ -n "${GITHUB_RUN_ID:-}" ]; then
117-
echo "- run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"
118-
fi
119-
echo "" >> "$GITHUB_STEP_SUMMARY"
120-
}
121-
122-
FILES=("$HASH_FILE")
123-
STATUS="$(git status --short -- "${FILES[@]}" || true)"
124-
if [ -z "$STATUS" ]; then
125-
echo "No changes detected."
126-
summarize "no changes"
136+
137+
if [ -z "$(git status --short -- "$HASH_FILE")" ]; then
138+
echo "No changes to commit"
139+
echo "### Nix hashes" >> "$GITHUB_STEP_SUMMARY"
140+
echo "Status: no changes" >> "$GITHUB_STEP_SUMMARY"
127141
exit 0
128142
fi
129143
130-
echo "Changes detected:"
131-
echo "$STATUS"
132-
git add "${FILES[@]}"
144+
git add "$HASH_FILE"
133145
git commit -m "chore: update nix node_modules hashes"
134146
135-
BRANCH="${TARGET_BRANCH:-${GITHUB_REF_NAME}}"
136-
git pull --rebase --autostash origin "$BRANCH"
137-
git push origin HEAD:"$BRANCH"
138-
echo "Changes pushed successfully"
147+
git pull --rebase --autostash origin "$GITHUB_REF_NAME"
148+
git push origin HEAD:"$GITHUB_REF_NAME"
139149
140-
summarize "committed $(git rev-parse --short HEAD)"
150+
echo "### Nix hashes" >> "$GITHUB_STEP_SUMMARY"
151+
echo "Status: committed $(git rev-parse --short HEAD)" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
target: x86_64-pc-windows-msvc
104104
- host: blacksmith-4vcpu-ubuntu-2404
105105
target: x86_64-unknown-linux-gnu
106-
- host: blacksmith-4vcpu-ubuntu-2404-arm
106+
- host: blacksmith-8vcpu-ubuntu-2404-arm
107107
target: aarch64-unknown-linux-gnu
108108
runs-on: ${{ matrix.settings.host }}
109109
steps:

0 commit comments

Comments
 (0)