Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11),
free to diverge. Tree copied sans upstream .git; upstream remote added for
future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19.
Preserves docs/ARCHITECTURE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

179
scripts/pr-lib/worktree.sh Normal file
View File

@@ -0,0 +1,179 @@
repo_root() {
# Resolve canonical repository root from git common-dir so wrappers work
# the same from main checkout or any linked worktree.
local base_dir
local common_git_dir
base_dir="${script_parent_dir:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
if common_git_dir=$(git -C "$base_dir" rev-parse --path-format=absolute --git-common-dir 2>/dev/null); then
(cd "$(dirname "$common_git_dir")" && pwd)
return
fi
# Fallback for environments where git common-dir is unavailable.
(cd "$base_dir/.." && pwd)
}
ensure_gh_api_auth() {
# gh auth status fetches token scopes through REST and misreports quota
# failures as invalid credentials. GraphQL verifies the active local token
# without sending maintainers through a login that cannot restore quota.
if gh_plain api graphql -f 'query=query { viewer { login } }' --jq .data.viewer.login >/dev/null 2>&1; then
return 0
fi
cat >&2 <<'EOF'
GitHub CLI auth is not usable for non-interactive API calls.
Run `gh auth login -h github.com` (or refresh the current token) and retry.
EOF
return 1
}
enter_worktree() {
local pr="$1"
local reset_to_main="${2:-false}"
local invoke_cwd
invoke_cwd="$PWD"
local root
root=$(repo_root)
if [ "$invoke_cwd" != "$root" ]; then
echo "Detected non-root invocation cwd=$invoke_cwd, using canonical root $root"
fi
cd "$root"
ensure_gh_api_auth
git fetch origin main
local dir=".worktrees/pr-$pr"
if [ -d "$dir" ]; then
cd "$dir"
git fetch origin main
if [ "$reset_to_main" = "true" ]; then
git checkout -B "temp/pr-$pr" origin/main
fi
else
git worktree add "$dir" -b "temp/pr-$pr" origin/main
cd "$dir"
fi
mkdir -p .local
}
pr_meta_json() {
local pr="$1"
gh pr view "$pr" --json number,title,state,isDraft,author,baseRefName,headRefName,headRefOid,headRepository,headRepositoryOwner,url,body,labels,assignees,reviewRequests,files,additions,deletions,statusCheckRollup
}
write_pr_meta_files() {
local json="$1"
printf '%s\n' "$json" > .local/pr-meta.json
# Security: shell-escape all values with printf %q to prevent command injection
# via malicious branch names containing $() or backticks. See GHSA-xxxx-xxxx-xxxx.
local pr_number pr_url pr_author pr_base pr_head pr_head_sha
local pr_head_repo pr_head_repo_url pr_head_owner pr_head_repo_name
pr_number=$(printf '%s\n' "$json" | jq -r .number)
pr_url=$(printf '%s\n' "$json" | jq -r .url)
pr_author=$(printf '%s\n' "$json" | jq -r .author.login)
pr_base=$(printf '%s\n' "$json" | jq -r .baseRefName)
pr_head=$(printf '%s\n' "$json" | jq -r .headRefName)
pr_head_sha=$(printf '%s\n' "$json" | jq -r .headRefOid)
pr_head_repo=$(printf '%s\n' "$json" | jq -r .headRepository.nameWithOwner)
pr_head_repo_url=$(printf '%s\n' "$json" | jq -r '.headRepository.url // ""')
pr_head_owner=$(printf '%s\n' "$json" | jq -r '.headRepositoryOwner.login // ""')
pr_head_repo_name=$(printf '%s\n' "$json" | jq -r '.headRepository.name // ""')
printf '%s=%q\n' \
PR_NUMBER "$pr_number" \
PR_URL "$pr_url" \
PR_AUTHOR "$pr_author" \
PR_BASE "$pr_base" \
PR_HEAD "$pr_head" \
PR_HEAD_SHA "$pr_head_sha" \
PR_HEAD_REPO "$pr_head_repo" \
PR_HEAD_REPO_URL "$pr_head_repo_url" \
PR_HEAD_OWNER "$pr_head_owner" \
PR_HEAD_REPO_NAME "$pr_head_repo_name" \
> .local/pr-meta.env
}
list_pr_worktrees() {
local root
root=$(repo_root)
cd "$root"
local dir
local found=false
for dir in .worktrees/pr-*; do
[ -d "$dir" ] || continue
found=true
local pr
if ! pr=$(pr_number_from_worktree_dir "$dir"); then
printf 'UNKNOWN\t%s\tUNKNOWN\t(unparseable)\t\n' "$dir"
continue
fi
local info
info=$(gh pr view "$pr" --json state,title,url --jq '[.state, .title, .url] | @tsv' 2>/dev/null || printf 'UNKNOWN\t(unavailable)\t')
printf '%s\t%s\t%s\n' "$pr" "$dir" "$info"
done
if [ "$found" = "false" ]; then
echo "No PR worktrees found."
fi
}
gc_pr_worktrees() {
local dry_run="${1:-false}"
local root
root=$(repo_root)
cd "$root"
local dir
local removed=0
for dir in .worktrees/pr-*; do
[ -d "$dir" ] || continue
local pr
if ! pr=$(pr_number_from_worktree_dir "$dir"); then
echo "skipping $dir (could not parse PR number)"
continue
fi
local state
state=$(gh pr view "$pr" --json state --jq .state 2>/dev/null || printf 'UNKNOWN')
case "$state" in
MERGED|CLOSED)
if [ "$dry_run" = "true" ]; then
echo "would remove $dir (PR #$pr state=$state)"
else
remove_worktree_if_present "$dir"
delete_local_branch_if_safe "temp/pr-$pr"
delete_local_branch_if_safe "pr-$pr"
delete_local_branch_if_safe "pr-$pr-prep"
echo "removed $dir (PR #$pr state=$state)"
fi
removed=$((removed + 1))
;;
esac
done
if [ "$removed" -eq 0 ]; then
if [ "$dry_run" = "true" ]; then
echo "No merged/closed PR worktrees eligible for removal."
else
echo "No merged/closed PR worktrees removed."
fi
fi
}
pr_number_from_worktree_dir() {
local dir="$1"
local token
token="${dir##*/pr-}"
token="${token%%[^0-9]*}"
if [ -n "$token" ]; then
printf '%s\n' "$token"
return 0
fi
return 1
}