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

推荐订阅源

小众软件
小众软件
博客园 - Franky
罗磊的独立博客
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
V
V2EX
F
Fortinet All Blogs
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
U
Unit 42
GbyAI
GbyAI
A
About on SuperTechFans
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | Blog

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
refactor: share script budget number parsing · openclaw/o...
vincentkoc · 2026-05-30 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -0,0 +1,35 @@

1+

export function parseBudgetNumber(raw, label) {

2+

const value = raw?.trim();

3+

if (!value) {

4+

return null;

5+

}

6+

const parsed = Number(value);

7+

if (!Number.isFinite(parsed) || parsed < 0) {

8+

throw new Error(`${label} must be a non-negative number`);

9+

}

10+

return parsed;

11+

}

12+
13+

export function readBudgetEnvNumber(name, env = process.env) {

14+

return parseBudgetNumber(env[name], name);

15+

}

16+
17+

export function budgetFloatFlag(flag, key) {

18+

return {

19+

consume(argv, index) {

20+

if (argv[index] !== flag) {

21+

return null;

22+

}

23+

return {

24+

nextIndex: index + 1,

25+

apply(target) {

26+

const parsed = parseBudgetNumber(argv[index + 1], flag);

27+

if (parsed === null) {

28+

throw new Error(`${flag} requires a value`);

29+

}

30+

target[key] = parsed;

31+

},

32+

};

33+

},

34+

};

35+

}

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,7 @@

11

import { spawnSync } from "node:child_process";

22

import fs from "node:fs";

33

import { booleanFlag, intFlag, parseFlagArgs, stringFlag } from "./lib/arg-utils.mjs";

4+

import { budgetFloatFlag, readBudgetEnvNumber } from "./lib/budget-number-args.mjs";

45

import { readJsonFile } from "./test-report-utils.mjs";

56
67

const CLI_STARTUP_BENCH_FIXTURE_PATH = "test/fixtures/cli-startup-bench.json";

@@ -13,42 +14,6 @@ function formatMb(value) {

1314

return `${value.toFixed(1)}MB`;

1415

}

1516
16-

function parseBudgetNumber(raw, label) {

17-

const value = raw?.trim();

18-

if (!value) {

19-

return null;

20-

}

21-

const parsed = Number(value);

22-

if (!Number.isFinite(parsed) || parsed < 0) {

23-

throw new Error(`${label} must be a non-negative number`);

24-

}

25-

return parsed;

26-

}

27-
28-

function readBudgetEnvNumber(name) {

29-

return parseBudgetNumber(process.env[name], name);

30-

}

31-
32-

function budgetFloatFlag(flag, key) {

33-

return {

34-

consume(argv, index) {

35-

if (argv[index] !== flag) {

36-

return null;

37-

}

38-

return {

39-

nextIndex: index + 1,

40-

apply(target) {

41-

const parsed = parseBudgetNumber(argv[index + 1], flag);

42-

if (parsed === null) {

43-

throw new Error(`${flag} requires a value`);

44-

}

45-

target[key] = parsed;

46-

},

47-

};

48-

},

49-

};

50-

}

51-
5217

if (process.argv.slice(2).includes("--help")) {

5318

console.log(

5419

[

Original file line numberDiff line numberDiff line change

@@ -1,44 +1,13 @@

11

import { pathToFileURL } from "node:url";

22

import { parseFlagArgs, stringFlag } from "./lib/arg-utils.mjs";

3+

import {

4+

budgetFloatFlag,

5+

parseBudgetNumber,

6+

readBudgetEnvNumber,

7+

} from "./lib/budget-number-args.mjs";

38

import { formatMs } from "./lib/vitest-report-cli-utils.mjs";

49

import { readJsonFile, runVitestJsonReport } from "./test-report-utils.mjs";

510
6-

function parseBudgetNumber(raw, label) {

7-

const value = raw?.trim();

8-

if (!value) {

9-

return null;

10-

}

11-

const parsed = Number(value);

12-

if (!Number.isFinite(parsed) || parsed < 0) {

13-

throw new Error(`${label} must be a non-negative number`);

14-

}

15-

return parsed;

16-

}

17-
18-

function readBudgetEnvNumber(name, env) {

19-

return parseBudgetNumber(env[name], name);

20-

}

21-
22-

function budgetFloatFlag(flag, key) {

23-

return {

24-

consume(argv, index) {

25-

if (argv[index] !== flag) {

26-

return null;

27-

}

28-

return {

29-

nextIndex: index + 1,

30-

apply(target) {

31-

const parsed = parseBudgetNumber(argv[index + 1], flag);

32-

if (parsed === null) {

33-

throw new Error(`${flag} requires a value`);

34-

}

35-

target[key] = parsed;

36-

},

37-

};

38-

},

39-

};

40-

}

41-
4211

function parseArgs(argv, env = process.env) {

4312

return parseFlagArgs(

4413

argv,

@@ -71,7 +40,7 @@ function main() {

7140

config: opts.config,

7241

prefix: "openclaw-vitest-perf",

7342

});

74-

const elapsedMs = Number(process.hrtime.bigint() - startedAt) / 1_000_000;

43+

const elapsedMs = Number.parseFloat(String(process.hrtime.bigint() - startedAt)) / 1_000_000;

7544
7645

let totalFileDurationMs = 0;

7746

let fileCount = 0;