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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
量子位
T
Tailwind CSS Blog
Vercel News
Vercel News
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
U
Unit 42
Engineering at Meta
Engineering at Meta
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
D
Docker
博客园_首页
P
Proofpoint News Feed
月光博客
月光博客
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
腾讯CDC
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & 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
refactor(cli): share gateway argv prefix scan · openclaw/...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -85,33 +85,41 @@ export function consumeGatewayFastPathRootOptionToken(

8585

return 0;

8686

}

8787
88-

/** Resolve the gateway command path from raw argv for catalog/policy lookups. */

89-

export function resolveGatewayCatalogCommandPath(argv: string[]): string[] | null {

88+

function resolveGatewayCommandStart(argv: string[]): {

89+

args: string[];

90+

startIndex: number;

91+

} | null {

9092

const args = argv.slice(2);

91-

let sawGateway = false;

92-
9393

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

9494

const arg = args[index];

9595

if (!arg || arg === "--") {

96-

break;

96+

return null;

9797

}

98-

if (!sawGateway) {

99-

const consumed = consumeRootOptionToken(args, index);

100-

if (consumed > 0) {

101-

index += consumed - 1;

102-

continue;

103-

}

104-

if (arg.startsWith("-")) {

105-

continue;

106-

}

107-

if (arg !== "gateway") {

108-

return null;

109-

}

110-

sawGateway = true;

98+

const consumed = consumeRootOptionToken(args, index);

99+

if (consumed > 0) {

100+

index += consumed - 1;

111101

continue;

112102

}

103+

if (arg.startsWith("-")) {

104+

continue;

105+

}

106+

return arg === "gateway" ? { args, startIndex: index + 1 } : null;

107+

}

108+

return null;

109+

}

113110
114-

const consumed = consumeGatewayRunOptionToken(args, index);

111+

/** Resolve the gateway command path from raw argv for catalog/policy lookups. */

112+

export function resolveGatewayCatalogCommandPath(argv: string[]): string[] | null {

113+

const gateway = resolveGatewayCommandStart(argv);

114+

if (!gateway) {

115+

return null;

116+

}

117+

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

118+

const arg = gateway.args[index];

119+

if (!arg || arg === "--") {

120+

break;

121+

}

122+

const consumed = consumeGatewayRunOptionToken(gateway.args, index);

115123

if (consumed > 0) {

116124

index += consumed - 1;

117125

continue;

@@ -122,44 +130,31 @@ export function resolveGatewayCatalogCommandPath(argv: string[]): string[] | nul

122130

return ["gateway", arg];

123131

}

124132
125-

return sawGateway ? ["gateway"] : null;

133+

return ["gateway"];

126134

}

127135
128136

/** Resolve destructive gateway-run flags before Commander registration. */

129137

export function resolveGatewayRunPreBootstrapOptions(

130138

argv: string[],

131139

): { force: boolean; reset: boolean } | null {

132-

const args = argv.slice(2);

140+

const gateway = resolveGatewayCommandStart(argv);

141+

if (!gateway) {

142+

return null;

143+

}

133144

let force = false;

134145

let reset = false;

135-

let sawGateway = false;

136146

let sawRun = false;

137147
138-

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

139-

const arg = args[index];

148+

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

149+

const arg = gateway.args[index];

140150

if (!arg || arg === "--") {

141151

break;

142152

}

143-

if (!sawGateway) {

144-

const consumed = consumeRootOptionToken(args, index);

145-

if (consumed > 0) {

146-

index += consumed - 1;

147-

continue;

148-

}

149-

if (arg.startsWith("-")) {

150-

continue;

151-

}

152-

if (arg !== "gateway") {

153-

return null;

154-

}

155-

sawGateway = true;

156-

continue;

157-

}

158153

if (!sawRun && arg === "run") {

159154

sawRun = true;

160155

continue;

161156

}

162-

const consumed = consumeGatewayRunPreBootstrapOptionToken(args, index);

157+

const consumed = consumeGatewayRunPreBootstrapOptionToken(gateway.args, index);

163158

if (consumed > 0) {

164159

if (arg === "--force") {

165160

force = true;

@@ -179,5 +174,5 @@ export function resolveGatewayRunPreBootstrapOptions(

179174

}

180175

}

181176
182-

return sawGateway ? { force, reset } : null;

177+

return { force, reset };

183178

}