mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-14 18:36:07 +00:00
* fix(pr): serialize operations per pull request * fix(pr): tighten supervisor error handling
3.4 KiB
3.4 KiB
Scripts Guide
This directory owns local tooling, script wrappers, and generated-artifact helper rules.
Wrapper Rules
- Prefer existing wrappers over raw tool entrypoints when the repo already has a curated seam.
- For tests, prefer
scripts/run-vitest.mjsor the rootpnpm test ...entrypoints over rawvitest runcalls. - Never use bare
vitest ...in automation; it starts local watch mode unlessrunor--runis explicit. - For lint/typecheck flows, prefer
scripts/run-oxlint.mjsandscripts/run-tsgo.mjswhen adding or editing package scripts or CI steps that should honor repo-local runtime behavior. - For changed-file verification, prefer
scripts/check-changed.mjsand keep lane classification inscripts/changed-lanes.mjs. Usenode scripts/check-changed.mjs --dry-run [--staged|-- <files...>]to inspect the plan before running anything expensive. Do not copy path-scope rules into new hooks or ad hoc CI snippets. - For one/few lint files, prefer direct
node scripts/run-oxlint.mjs --tsconfig <matching config> <files...>over shardedpnpm lint;check-changed.mjsowns this targeting for core, extension, and script diffs.
Local Heavy-Check Lock
- Respect the local heavy-check lock behavior in
scripts/lib/local-heavy-check-runtime.mjs. - Do not bypass that lock for real heavy commands just to make a local loop look faster.
- Metadata-only or explicitly narrow commands may skip the lock when the existing helper logic says that is safe.
- If you change the lock heuristics, add or update the narrow tests under
test/scripts/.
PR Prepare Gates
scripts/prserializes review, prepare, and merge operations per PR across linked worktrees;scripts/pr gcskips active or indeterminate locks. A successful command return is the trusted synchronous-completion contract: every PR-state-mutating child must be joined before returning, and such work must never daemonize or explicitly escape both the operation group and lock-notification FD. Failed, interrupted, or controller-lost operations stay locked because detached children cannot be disproved; after verifying no child tools remain, use the reported exact-OIDscripts/pr lock-recovercommand. Never bypass or delete these refs manually.scripts/pr prepare-gatesholds the heavy-check lock for its whole local gate block (scripts/pr-gates-lock.mjs), so concurrent gate runs across.worktreesqueue as units instead of dying on child lock timeouts or vitest no-output watchdog kills.OPENCLAW_PR_GATES_REMOTE=testboxruns the full-suitepnpm testgate on a Blacksmith Testbox throughscripts/crabbox-wrapper.mjs(same delegation ascheck:changed);pnpm build/pnpm checkstay local. Thetbx_lease id and Actions run URL land in.local/gates.env(REMOTE_GATES_*) and.local/prep.md. Use it for reviewed trusted code when a loaded host makes the local 88-shard run stall-kill; contributor/fork code stays on secretless CI or sanitized AWS unless a maintainer explicitly approves credentialed execution.
Generated Outputs
- If a script writes generated artifacts, keep the source-of-truth generator, the package script, and the matching verification/check command aligned.
- Prefer additive generator/check pairs like
*:genand*:checkover one-off undocumented scripts.
Scope
- Keep script-runner behavior, wrapper expectations, and generated-artifact guidance here.
- Leave repo-global verification policy in the root
AGENTS.md.