mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
docs: 更新远程控制及 rg 下载
This commit is contained in:
13
README.md
13
README.md
@@ -31,13 +31,10 @@
|
||||
bun i -g claude-code-best
|
||||
bun pm -g trust claude-code-best
|
||||
ccb # 直接打开 claude code
|
||||
CLAUDE_BRIDGE_BASE_URL=https://remote-control.claude-code-best.win/ CLAUDE_BRIDGE_OAUTH_TOKEN=test-my-key bun run dev --remote-control # 我们有自部署的远程控制
|
||||
```
|
||||
|
||||
⚠️ 国内对 github 网络较差的, 需要先设置这个环境变量
|
||||
|
||||
```bash
|
||||
DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v15.0.1
|
||||
```
|
||||
⚠️ 如果 GitHub 下载 ripgrep 失败,postinstall 会自动回退到 ghproxy.net 镜像,无需手动配置。
|
||||
|
||||
## ⚡ 快速开始(源码版)
|
||||
|
||||
@@ -54,12 +51,6 @@ DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-pr
|
||||
bun install
|
||||
```
|
||||
|
||||
⚠️ 国内对 github 网络较差的,可以使用这个环境变量
|
||||
|
||||
```bash
|
||||
DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v15.0.1
|
||||
```
|
||||
|
||||
### ▶️ 运行
|
||||
|
||||
```bash
|
||||
|
||||
@@ -29,6 +29,7 @@ try {
|
||||
|
||||
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(/\/$/, "")
|
||||
|
||||
const scriptDir = path.dirname(__filename)
|
||||
@@ -262,7 +263,6 @@ async function extractTarGz(buffer, binaryPath, extractedBinary, assetName) {
|
||||
async function downloadAndExtract() {
|
||||
const { target, ext } = getPlatformMapping()
|
||||
const assetName = `ripgrep-v${RG_VERSION}-${target}.${ext}`
|
||||
const downloadUrl = `${RELEASE_BASE}/${assetName}`
|
||||
|
||||
const binaryPath = getBinaryPath()
|
||||
const binaryDir = path.dirname(binaryPath)
|
||||
@@ -277,12 +277,32 @@ async function downloadAndExtract() {
|
||||
}
|
||||
|
||||
console.log(`[ripgrep] Downloading v${RG_VERSION} for ${target}...`)
|
||||
console.log(`[ripgrep] URL: ${downloadUrl}`)
|
||||
|
||||
const extractedBinary = process.platform === "win32" ? "rg.exe" : "rg"
|
||||
|
||||
const mirrors = [RELEASE_BASE]
|
||||
if (RELEASE_BASE === DEFAULT_RELEASE_BASE.replace(/\/$/, "")) {
|
||||
mirrors.push(MIRROR_RELEASE_BASE.replace(/\/$/, ""))
|
||||
}
|
||||
|
||||
let buffer
|
||||
let lastError
|
||||
for (const base of mirrors) {
|
||||
const url = `${base}/${assetName}`
|
||||
try {
|
||||
console.log(`[ripgrep] Trying ${url}`)
|
||||
buffer = await downloadUrlToBufferWithFallback(url)
|
||||
break
|
||||
} catch (e) {
|
||||
console.warn(`[ripgrep] Download from ${base} failed: ${e instanceof Error ? e.message : e}`)
|
||||
lastError = e
|
||||
}
|
||||
}
|
||||
if (!buffer) {
|
||||
throw lastError
|
||||
}
|
||||
|
||||
try {
|
||||
const buffer = await downloadUrlToBufferWithFallback(downloadUrl)
|
||||
console.log(`[ripgrep] Downloaded ${Math.round(buffer.length / 1024)} KB`)
|
||||
|
||||
mkdirSync(binaryDir, { recursive: true })
|
||||
|
||||
Reference in New Issue
Block a user