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

推荐订阅源

雷峰网
雷峰网
MongoDB | Blog
MongoDB | Blog
D
Docker
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
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(cli): resolve PowerShell completion profiles · opencl...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -16,9 +16,20 @@ export function isCompletionShell(value: string): value is CompletionShell {

1616

return COMPLETION_SHELLS.includes(value as CompletionShell);

1717

}

181819+

function resolveShellBasename(

20+

shellPath: string,

21+

platform: NodeJS.Platform = process.platform,

22+

): string {

23+

const platformBasename =

24+

platform === "win32" ? path.win32.basename(shellPath) : path.basename(shellPath);

25+

const winBasename = path.win32.basename(shellPath);

26+

const basename = winBasename.length < platformBasename.length ? winBasename : platformBasename;

27+

return normalizeLowercaseStringOrEmpty(basename.replace(/\.(?:exe|cmd|bat)$/i, ""));

28+

}

29+1930

export function resolveShellFromEnv(env: NodeJS.ProcessEnv = process.env): CompletionShell {

2031

const shellPath = normalizeOptionalString(env.SHELL) ?? "";

21-

const shellName = shellPath ? normalizeLowercaseStringOrEmpty(path.basename(shellPath)) : "";

32+

const shellName = shellPath ? resolveShellBasename(shellPath) : "";

2233

if (shellName === "zsh") {

2334

return "zsh";

2435

}

@@ -162,10 +173,13 @@ export function resolveCompletionProfilePath(

162173

return path.join(home, ".config", "fish", "config.fish");

163174

}

164175

if (platform === "win32") {

176+

const shellPath = normalizeOptionalString(env.SHELL) ?? "";

177+

const shellName = shellPath ? resolveShellBasename(shellPath, platform) : "";

178+

const profileDirectory = shellName === "powershell" ? "WindowsPowerShell" : "PowerShell";

165179

return path.win32.join(

166180

env.USERPROFILE || home,

167181

"Documents",

168-

"PowerShell",

182+

profileDirectory,

169183

"Microsoft.PowerShell_profile.ps1",

170184

);

171185

}

@@ -217,9 +231,6 @@ export async function usesSlowDynamicCompletion(

217231

}

218232219233

export async function installCompletion(shell: string, yes: boolean, binName = "openclaw") {

220-

let profilePath = "";

221-

let sourceLine = "";

222-223234

const isShellSupported = isCompletionShell(shell);

224235

if (!isShellSupported) {

225236

console.error(`Automated installation not supported for ${shell} yet.`);

@@ -235,27 +246,31 @@ export async function installCompletion(shell: string, yes: boolean, binName = "

235246

return;

236247

}

237248238-

if (shell === "zsh") {

239-

profilePath = resolveCompletionProfilePath("zsh");

240-

sourceLine = formatCompletionSourceLine("zsh", binName, cachePath);

241-

} else if (shell === "bash") {

242-

profilePath = resolveCompletionProfilePath("bash");

243-

try {

244-

await fs.access(profilePath);

245-

} catch {

246-

const home = process.env.HOME || os.homedir();

247-

profilePath = path.join(home, ".bash_profile");

248-

}

249-

sourceLine = formatCompletionSourceLine("bash", binName, cachePath);

250-

} else if (shell === "fish") {

251-

profilePath = resolveCompletionProfilePath("fish");

252-

sourceLine = formatCompletionSourceLine("fish", binName, cachePath);

253-

} else if (shell === "powershell") {

254-

profilePath = resolveCompletionProfilePath("powershell");

255-

sourceLine = formatCompletionSourceLine("powershell", binName, cachePath);

256-

} else {

257-

console.error(`Automated installation not supported for ${shell} yet.`);

258-

return;

249+

let profilePath: string;

250+

let sourceLine: string;

251+

switch (shell) {

252+

case "zsh":

253+

profilePath = resolveCompletionProfilePath("zsh");

254+

sourceLine = formatCompletionSourceLine("zsh", binName, cachePath);

255+

break;

256+

case "bash":

257+

profilePath = resolveCompletionProfilePath("bash");

258+

try {

259+

await fs.access(profilePath);

260+

} catch {

261+

const home = process.env.HOME || os.homedir();

262+

profilePath = path.join(home, ".bash_profile");

263+

}

264+

sourceLine = formatCompletionSourceLine("bash", binName, cachePath);

265+

break;

266+

case "fish":

267+

profilePath = resolveCompletionProfilePath("fish");

268+

sourceLine = formatCompletionSourceLine("fish", binName, cachePath);

269+

break;

270+

case "powershell":

271+

profilePath = resolveCompletionProfilePath("powershell");

272+

sourceLine = formatCompletionSourceLine("powershell", binName, cachePath);

273+

break;

259274

}

260275261276

try {