From 3e5bb0e799f2dc83ce5313c31933c432a422f6a8 Mon Sep 17 00:00:00 2001 From: Askhz <1361267452@qq.com> Date: Wed, 29 Apr 2026 11:50:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ripgrep=20=E5=AE=89=E8=A3=85=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=86=85=E7=BD=91=E7=A7=81=E6=9C=8D=E5=85=9C=E5=BA=95?= =?UTF-8?q?=20&=20=E4=BF=AE=E5=A4=8D=E7=BB=88=E7=AB=AF=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E4=B8=BA=20csc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- scripts/postinstall.cjs | 14 ++++++++++++++ src/main.tsx | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/postinstall.cjs b/scripts/postinstall.cjs index 990d08174..971b5ad69 100644 --- a/scripts/postinstall.cjs +++ b/scripts/postinstall.cjs @@ -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 } diff --git a/src/main.tsx b/src/main.tsx index 77440e614..bc3cb088e 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1362,7 +1362,7 @@ async function run(): Promise { // 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.