fix: ripgrep 安装支持内网私服兜底 & 修复终端标题为 csc

- postinstall.cjs: GitHub/ghproxy 均失败时降级到内网私服下载
  (shenma.sangfor.com.cn/costrict-cli/pkg/ripgrep)
- main.tsx: 将 process.title 从 "claude" 改为 "csc"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Askhz 2026-04-29 11:50:39 +08:00
parent 766f9741ce
commit 3e5bb0e799
2 changed files with 15 additions and 1 deletions

View File

@ -31,6 +31,8 @@ const RG_VERSION = "15.0.1"
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
// costrict change: fallback to private registry when GitHub and ghproxy are both unreachable
const COSTRICT_PRIVATE_BASE = "https://shenma.sangfor.com.cn/costrict-cli/pkg/ripgrep"
const scriptDir = path.dirname(__filename)
const projectRoot = path.resolve(scriptDir, "..")
@ -298,6 +300,18 @@ async function downloadAndExtract() {
lastError = e
}
}
// costrict change: fallback to private registry (intranet) when all public mirrors fail
if (!buffer) {
const privateUrl = `${COSTRICT_PRIVATE_BASE}/ripgrep-v${RG_VERSION}-${target}.${ext}`
try {
console.log(`[ripgrep] Trying private registry: ${privateUrl}`)
buffer = await downloadUrlToBufferWithFallback(privateUrl)
} catch (e) {
console.warn(`[ripgrep] Private registry download failed: ${e instanceof Error ? e.message : e}`)
}
}
if (!buffer) {
throw lastError
}

View File

@ -1362,7 +1362,7 @@ async function run(): Promise<CommanderCommand> {
// terminal shell integration may mirror the process name to the tab.
// After init() so settings.json env can also gate this (gh-4765).
if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {
process.title = "claude";
process.title = "csc";
}
// Attach logging sinks so subcommand handlers can use logEvent/logError.