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
235 lines
5.0 KiB
Bash
Executable File
235 lines
5.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
# Disable glob expansion to handle brackets in file paths
|
|
set -f
|
|
usage() {
|
|
local exit_code=${1:-2}
|
|
if [ "$exit_code" -eq 0 ]; then
|
|
printf 'Usage: %s [--force] [--fast] "commit message" "file" ["file" ...]\n' "$(basename "$0")"
|
|
else
|
|
printf 'Usage: %s [--force] [--fast] "commit message" "file" ["file" ...]\n' "$(basename "$0")" >&2
|
|
fi
|
|
exit "$exit_code"
|
|
}
|
|
|
|
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
usage 0
|
|
fi
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
usage
|
|
fi
|
|
|
|
force_delete_lock=false
|
|
fast_commit=false
|
|
while [[ "${1:-}" == --* ]]; do
|
|
case "${1:-}" in
|
|
--force)
|
|
force_delete_lock=true
|
|
shift
|
|
;;
|
|
--fast)
|
|
fast_commit=true
|
|
shift
|
|
;;
|
|
--help|-h)
|
|
usage 0
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
usage
|
|
fi
|
|
|
|
commit_message=$1
|
|
shift
|
|
|
|
if [[ "$commit_message" != *[![:space:]]* ]]; then
|
|
printf 'Error: commit message must not be empty\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -e "$commit_message" ]; then
|
|
printf 'Error: first argument looks like a file path ("%s"); provide the commit message first\n' "$commit_message" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
usage
|
|
fi
|
|
|
|
path_exists_or_tracked() {
|
|
local candidate=$1
|
|
[ -e "$candidate" ] ||
|
|
git ls-files --error-unmatch -- "$candidate" >/dev/null 2>&1 ||
|
|
git cat-file -e "HEAD:$candidate" >/dev/null 2>&1
|
|
}
|
|
|
|
append_normalized_file_arg() {
|
|
local raw=$1
|
|
|
|
if path_exists_or_tracked "$raw"; then
|
|
files+=("$raw")
|
|
return
|
|
fi
|
|
|
|
if [[ "$raw" == *$'\n'* || "$raw" == *$'\r'* ]]; then
|
|
local normalized=${raw//$'\r'/}
|
|
while IFS= read -r line; do
|
|
if [[ "$line" == *[![:space:]]* ]]; then
|
|
files+=("$line")
|
|
fi
|
|
done <<< "$normalized"
|
|
return
|
|
fi
|
|
|
|
if [[ "$raw" == *[[:space:]]* ]]; then
|
|
local split_paths=()
|
|
# Intentional IFS split for callers that pass a single shell-expanded path blob.
|
|
# shellcheck disable=SC2206
|
|
split_paths=($raw)
|
|
if [ "${#split_paths[@]}" -gt 1 ]; then
|
|
files+=("${split_paths[@]}")
|
|
return
|
|
fi
|
|
fi
|
|
|
|
files+=("$raw")
|
|
}
|
|
|
|
files=()
|
|
for raw_arg in "$@"; do
|
|
append_normalized_file_arg "$raw_arg"
|
|
done
|
|
|
|
# Disallow "." because it stages the entire repository and defeats the helper's safety guardrails.
|
|
for file in "${files[@]}"; do
|
|
if [ "$file" = "." ]; then
|
|
printf 'Error: "." is not allowed; list specific paths instead\n' >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# Prevent staging node_modules even if a path is forced.
|
|
for file in "${files[@]}"; do
|
|
case "$file" in
|
|
*node_modules* | */node_modules | */node_modules/* | node_modules)
|
|
printf 'Error: node_modules paths are not allowed: %s\n' "$file" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
last_commit_error=''
|
|
|
|
run_git_command() {
|
|
local stderr_log
|
|
stderr_log=$(mktemp)
|
|
if "$@" 2>"$stderr_log"; then
|
|
if [ -s "$stderr_log" ]; then
|
|
cat "$stderr_log" >&2
|
|
fi
|
|
rm -f "$stderr_log"
|
|
last_commit_error=''
|
|
return 0
|
|
fi
|
|
|
|
if [ -s "$stderr_log" ]; then
|
|
cat "$stderr_log" >&2
|
|
fi
|
|
last_commit_error=$(cat "$stderr_log")
|
|
rm -f "$stderr_log"
|
|
return 1
|
|
}
|
|
|
|
is_git_lock_error() {
|
|
printf '%s\n' "$last_commit_error" | grep -Eq \
|
|
"Another git process seems to be running|Unable to create '.*\\.git/[^']+\\.lock'"
|
|
}
|
|
|
|
extract_git_lock_path() {
|
|
printf '%s\n' "$last_commit_error" |
|
|
sed -n "s/.*'\(.*\.git\/[^']*\.lock\)'.*/\1/p" |
|
|
head -n 1
|
|
}
|
|
|
|
run_git_with_lock_retry() {
|
|
local label=$1
|
|
shift
|
|
|
|
local deadline=$((SECONDS + 5))
|
|
local announced_retry=false
|
|
|
|
while true; do
|
|
if run_git_command "$@"; then
|
|
return 0
|
|
fi
|
|
|
|
if ! is_git_lock_error; then
|
|
return 1
|
|
fi
|
|
|
|
if [ "$SECONDS" -ge "$deadline" ]; then
|
|
break
|
|
fi
|
|
|
|
if [ "$announced_retry" = false ]; then
|
|
printf 'Git lock during %s; retrying for up to 5 seconds...\n' "$label" >&2
|
|
announced_retry=true
|
|
fi
|
|
|
|
sleep 0.5
|
|
done
|
|
|
|
if [ "$force_delete_lock" = true ]; then
|
|
local lock_path
|
|
lock_path=$(extract_git_lock_path)
|
|
if [ -n "$lock_path" ] && [ -e "$lock_path" ]; then
|
|
rm -f "$lock_path"
|
|
printf 'Removed stale git lock: %s\n' "$lock_path" >&2
|
|
run_git_command "$@"
|
|
return $?
|
|
fi
|
|
fi
|
|
|
|
return 1
|
|
}
|
|
|
|
for file in "${files[@]}"; do
|
|
if ! path_exists_or_tracked "$file"; then
|
|
printf 'Error: file not found: %s\n' "$file" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
run_git_with_lock_retry "unstaging files" git restore --staged :/
|
|
run_git_with_lock_retry "staging files" git add --all --force -- "${files[@]}"
|
|
|
|
if git diff --staged --quiet; then
|
|
printf 'Warning: no staged changes detected for: %s\n' "${files[*]}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
committed=false
|
|
if [ "$fast_commit" = true ]; then
|
|
declare -a commit_env=(FAST_COMMIT=1)
|
|
if run_git_with_lock_retry "commit" env "${commit_env[@]}" git commit --no-verify -m "$commit_message"; then
|
|
committed=true
|
|
fi
|
|
else
|
|
if run_git_with_lock_retry "commit" git commit -m "$commit_message"; then
|
|
committed=true
|
|
fi
|
|
fi
|
|
|
|
if [ "$committed" = false ]; then
|
|
exit 1
|
|
fi
|
|
|
|
printf 'Committed "%s" with %d files\n' "$commit_message" "${#files[@]}"
|