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

推荐订阅源

小众软件
小众软件
B
Blog RSS Feed
美团技术团队
博客园 - 【当耐特】
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
Vercel News
Vercel News
P
Proofpoint News Feed
IT之家
IT之家
I
InfoQ
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More

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
test: tighten command arg assertions · openclaw/openclaw@...
shakkernerd · 2026-05-09 · via Recent Commits to openclaw:main

@@ -115,6 +115,39 @@ function requireNativeCommand(name: string, provider?: string): ChatCommandDefin

115115

return command;

116116

}

117117118+

function requireCommandArg(

119+

command: ChatCommandDefinition,

120+

name: string,

121+

): NonNullable<ChatCommandDefinition["args"]>[number] {

122+

const arg = command.args?.find((candidate) => candidate.name === name);

123+

if (!arg) {

124+

throw new Error(`Expected ${command.key} command arg "${name}"`);

125+

}

126+

return arg;

127+

}

128+129+

function requireCommandArgAt(

130+

command: ChatCommandDefinition,

131+

index: number,

132+

): NonNullable<ChatCommandDefinition["args"]>[number] {

133+

const arg = command.args?.[index];

134+

if (!arg) {

135+

throw new Error(`Expected ${command.key} command arg ${index}`);

136+

}

137+

return arg;

138+

}

139+140+

function requireCommandArgMenu(

141+

params: Parameters<typeof resolveCommandArgMenu>[0],

142+

): NonNullable<ReturnType<typeof resolveCommandArgMenu>> {

143+

const menu = resolveCommandArgMenu(params);

144+

expect(menu).not.toBeNull();

145+

if (!menu) {

146+

throw new Error(`Expected arg menu for ${params.command.key}`);

147+

}

148+

return menu;

149+

}

150+118151

describe("commands registry", () => {

119152

it("builds command text with args", () => {

120153

expect(buildCommandText("status")).toBe("/status");

@@ -301,8 +334,8 @@ describe("commands registry", () => {

301334302335

it("keeps ACP native action choices aligned with implemented handlers", () => {

303336

const acp = requireChatCommand("acp");

304-

const actionArg = acp.args?.find((arg) => arg.name === "action");

305-

expect(actionArg?.choices).toEqual([

337+

const actionArg = requireCommandArg(acp, "action");

338+

expect(actionArg.choices).toEqual([

306339

"spawn",

307340

"cancel",

308341

"steer",

@@ -323,14 +356,14 @@ describe("commands registry", () => {

323356

});

324357325358

it("registers fast mode as a first-class options command", () => {

326-

const fast = listChatCommands().find((command) => command.key === "fast");

359+

const fast = requireChatCommand("fast");

327360

expect(fast).toMatchObject({

328361

nativeName: "fast",

329362

textAliases: ["/fast"],

330363

category: "options",

331364

});

332-

const modeArg = fast?.args?.find((arg) => arg.name === "mode");

333-

expect(modeArg?.choices).toEqual(["status", "on", "off"]);

365+

const modeArg = requireCommandArg(fast, "mode");

366+

expect(modeArg.choices).toEqual(["status", "on", "off"]);

334367

});

335368336369

it("detects known text commands", () => {

@@ -458,7 +491,7 @@ describe("commands registry args", () => {

458491

};

459492460493

const args = parseCommandArgs(command, "set foo bar baz");

461-

expect(args?.values).toEqual({ action: "set", path: "foo", value: "bar baz" });

494+

expect(args).toMatchObject({ values: { action: "set", path: "foo", value: "bar baz" } });

462495

});

463496464497

it("serializes args via raw first, then values", () => {

@@ -481,9 +514,9 @@ describe("commands registry args", () => {

481514

it("resolves auto arg menus when missing a choice arg", () => {

482515

const command = createUsageModeCommand();

483516484-

const menu = resolveCommandArgMenu({ command, args: undefined, cfg: {} as never });

485-

expect(menu?.arg.name).toBe("mode");

486-

expect(menu?.choices).toEqual([

517+

const menu = requireCommandArgMenu({ command, args: undefined, cfg: {} as never });

518+

expect(menu.arg.name).toBe("mode");

519+

expect(menu.choices).toEqual([

487520

{ label: "off", value: "off" },

488521

{ label: "tokens", value: "tokens" },

489522

{ label: "full", value: "full" },

@@ -492,11 +525,12 @@ describe("commands registry args", () => {

492525

});

493526494527

it("keeps verbose full available while preserving no-arg status dispatch", () => {

495-

const verbose = listChatCommands().find((command) => command.key === "verbose");

528+

const verbose = requireChatCommand("verbose");

496529497-

expect(verbose?.args?.[0]?.choices).toEqual(["on", "off", "full"]);

530+

const modeArg = requireCommandArgAt(verbose, 0);

531+

expect(modeArg.choices).toEqual(["on", "off", "full"]);

498532

expect(

499-

resolveCommandArgMenu({ command: verbose!, args: undefined, cfg: {} as never }),

533+

resolveCommandArgMenu({ command: verbose, args: undefined, cfg: {} as never }),

500534

).toBeNull();

501535

});

502536