惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 聂微东
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
D
Docker
B
Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
月光博客
月光博客
F
Fortinet All Blogs
爱范儿
爱范儿
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Cloudflare Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
U
Unit 42

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(scripts): preserve test passthrough args · openclaw/o...
vincentkoc · 2026-05-25 · via Recent Commits to openclaw:main

@@ -1,14 +1,16 @@

11

#!/usr/bin/env node

22

import { spawn, spawnSync } from "node:child_process";

3-

import { mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";

3+

import { accessSync, constants, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";

44

import { tmpdir } from "node:os";

55

import { delimiter, dirname, extname, isAbsolute, relative, resolve } from "node:path";

66

import { fileURLToPath } from "node:url";

77

import { resolvePathEnvKey } from "./windows-cmd-helpers.mjs";

8899

const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");

1010

const repoLocal = resolveCrabboxBinary(process.env, process.platform);

11-

const binary = repoLocal ?? resolvePathBinary("crabbox", process.env, process.platform);

11+

const pathLocal = resolvePathBinary("crabbox", process.env, process.platform);

12+

const binary =

13+

repoLocal ?? pathLocal ?? resolveGitCommonCrabboxBinary(process.env, process.platform) ?? "crabbox";

1214

const args = process.argv.slice(2);

13151416

if (args[0] === "--") {

@@ -32,37 +34,63 @@ function commandCandidates(command, platform) {

3234

function resolveCrabboxBinary(env, platform) {

3335

const base = resolve(repoRoot, "../crabbox/bin/crabbox");

3436

for (const candidate of commandCandidates(base, platform)) {

35-

if (isFile(candidate)) {

37+

if (isExecutableFile(candidate, platform)) {

3638

return candidate;

3739

}

3840

}

3941

return null;

4042

}

41434244

function resolvePathBinary(command, env, platform) {

43-

if (platform !== "win32") {

44-

return command;

45-

}

46-

for (const candidate of commandCandidates(command, platform)) {

47-

if (isFile(candidate)) {

48-

return candidate;

49-

}

50-

}

5145

const pathValue = env[resolvePathEnvKey(env)] ?? "";

5246

for (const dir of pathValue.split(delimiter).filter(Boolean)) {

5347

for (const candidate of commandCandidates(command, platform)) {

5448

const fullPath = resolve(dir, candidate);

55-

if (isFile(fullPath)) {

49+

if (isExecutableFile(fullPath, platform)) {

5650

return fullPath;

5751

}

5852

}

5953

}

60-

return command;

54+

return null;

6155

}

625663-

function isFile(path) {

57+

function resolveGitCommonCrabboxBinary(env, platform) {

58+

const gitBinary = resolvePathBinary("git", env, platform) ?? "git";

59+

const invocation = spawnInvocation(gitBinary, ["rev-parse", "--git-common-dir"], env, platform);

60+

const result = spawnSync(invocation.command, invocation.args, {

61+

cwd: repoRoot,

62+

encoding: "utf8",

63+

stdio: ["ignore", "pipe", "ignore"],

64+

windowsVerbatimArguments: invocation.windowsVerbatimArguments,

65+

});

66+

if ((result.status ?? 1) !== 0) {

67+

return null;

68+

}

69+

const gitCommonDir = result.stdout.trim();

70+

if (!gitCommonDir) {

71+

return null;

72+

}

73+

const absoluteGitCommonDir = isAbsolute(gitCommonDir)

74+

? gitCommonDir

75+

: resolve(repoRoot, gitCommonDir);

76+

const base = resolve(absoluteGitCommonDir, "../..", "crabbox/bin/crabbox");

77+

for (const candidate of commandCandidates(base, platform)) {

78+

if (isExecutableFile(candidate, platform)) {

79+

return candidate;

80+

}

81+

}

82+

return null;

83+

}

84+85+

function isExecutableFile(path, platform) {

6486

try {

65-

return statSync(path).isFile();

87+

if (!statSync(path).isFile()) {

88+

return false;

89+

}

90+

if (platform !== "win32") {

91+

accessSync(path, constants.X_OK);

92+

}

93+

return true;

6694

} catch {

6795

return false;

6896

}

@@ -116,7 +144,7 @@ function checkedOutput(command, commandArgs) {

116144

}

117145118146

function gitOutput(commandArgs) {

119-

const gitBinary = resolvePathBinary("git", process.env, process.platform);

147+

const gitBinary = resolvePathBinary("git", process.env, process.platform) ?? "git";

120148

const invocation = spawnInvocation(gitBinary, commandArgs, process.env, process.platform);

121149

const result = spawnSync(invocation.command, invocation.args, {

122150

cwd: repoRoot,