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

推荐订阅源

WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
U
Unit 42
L
LangChain Blog
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
F
Fortinet All Blogs
小众软件
小众软件
I
InfoQ
P
Proofpoint News Feed
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Help Net Security
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
B
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
fix(test): guard dev smoke cli args · openclaw/openclaw@7...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -32,6 +32,17 @@ class UsageError extends Error {

3232

readonly exitCode = 1;

3333

}

343435+

class CliArgumentError extends UsageError {}

36+37+

type DevicePairTelegramArgs = {

38+

accountId?: string;

39+

chatId?: string;

40+

help: boolean;

41+

};

42+43+

const BOOLEAN_FLAGS = new Set(["--help", "-h"]);

44+

const VALUE_FLAGS = new Set(["--account", "-a", "--chat", "-c"]);

45+3546

function writeStdoutLine(...parts: string[]): void {

3647

process.stdout.write(`${parts.join(" ")}\n`);

3748

}

@@ -57,9 +68,41 @@ function readArg(args: string[], flag: string, short?: string): string | undefin

5768

function usage(): string {

5869

return [

5970

"Usage: bun scripts/dev/test-device-pair-telegram.ts --chat <telegram-chat-id> [--account <accountId>]",

71+

"",

72+

"Options:",

73+

" --chat, -c <id> Telegram chat id",

74+

" --account, -a <id> Telegram account id",

75+

" -h, --help Show this help",

6076

].join("\n");

6177

}

627879+

function validateArgs(args: readonly string[]): void {

80+

for (let index = 0; index < args.length; index += 1) {

81+

const arg = args[index] ?? "";

82+

if (BOOLEAN_FLAGS.has(arg)) {

83+

continue;

84+

}

85+

if (VALUE_FLAGS.has(arg)) {

86+

const value = args[index + 1];

87+

if (!value || value.startsWith("--")) {

88+

throw new CliArgumentError(`${arg} requires a value`);

89+

}

90+

index += 1;

91+

continue;

92+

}

93+

throw new CliArgumentError(`Unknown argument: ${arg}`);

94+

}

95+

}

96+97+

function parseDevicePairTelegramArgs(args: readonly string[]): DevicePairTelegramArgs {

98+

validateArgs(args);

99+

return {

100+

accountId: readArg([...args], "--account", "-a"),

101+

chatId: readArg([...args], "--chat", "-c"),

102+

help: args.includes("--help") || args.includes("-h"),

103+

};

104+

}

105+63106

async function loadTelegramRuntimeSendMessage(): Promise<SendMessageTelegram> {

64107

const specifier = "../../extensions/telegram/runtime-api.js";

65108

const runtime = (await import(specifier)) as { sendMessageTelegram?: SendMessageTelegram };

@@ -86,8 +129,10 @@ async function runDevicePairTelegram(

86129

args = process.argv.slice(2),

87130

deps: DevicePairTelegramDeps = createDefaultDeps(),

88131

): Promise<DevicePairTelegramResult> {

89-

const chatId = readArg(args, "--chat", "-c");

90-

const accountId = readArg(args, "--account", "-a");

132+

const { accountId, chatId, help } = parseDevicePairTelegramArgs(args);

133+

if (help) {

134+

throw new UsageError(usage());

135+

}

91136

if (!chatId) {

92137

throw new UsageError(usage());

93138

}

@@ -133,7 +178,12 @@ async function runDevicePairTelegram(

133178134179

async function main(): Promise<void> {

135180

try {

136-

const result = await runDevicePairTelegram();

181+

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

182+

if (args.includes("--help") || args.includes("-h")) {

183+

writeStdoutLine(usage());

184+

return;

185+

}

186+

const result = await runDevicePairTelegram(args);

137187

writeStdoutLine(

138188

"Sent split /pair messages to",

139189

result.chatId,

@@ -150,4 +200,4 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {

150200

await main();

151201

}

152202153-

export { runDevicePairTelegram };

203+

export { parseDevicePairTelegramArgs, runDevicePairTelegram };