mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +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 i -g claude-code-best
|
||||||
bun pm -g trust claude-code-best
|
bun pm -g trust claude-code-best
|
||||||
ccb # 直接打开 claude code
|
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 网络较差的, 需要先设置这个环境变量
|
⚠️ 如果 GitHub 下载 ripgrep 失败,postinstall 会自动回退到 ghproxy.net 镜像,无需手动配置。
|
||||||
|
|
||||||
```bash
|
|
||||||
DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v15.0.1
|
|
||||||
```
|
|
||||||
|
|
||||||
## ⚡ 快速开始(源码版)
|
## ⚡ 快速开始(源码版)
|
||||||
|
|
||||||
@@ -54,12 +51,6 @@ DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-pr
|
|||||||
bun install
|
bun install
|
||||||
```
|
```
|
||||||
|
|
||||||
⚠️ 国内对 github 网络较差的,可以使用这个环境变量
|
|
||||||
|
|
||||||
```bash
|
|
||||||
DEFAULT_RELEASE_BASE=https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v15.0.1
|
|
||||||
```
|
|
||||||
|
|
||||||
### ▶️ 运行
|
### ▶️ 运行
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ try {
|
|||||||
|
|
||||||
const RG_VERSION = "15.0.1"
|
const RG_VERSION = "15.0.1"
|
||||||
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
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 RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
|
||||||
|
|
||||||
const scriptDir = path.dirname(__filename)
|
const scriptDir = path.dirname(__filename)
|
||||||
@@ -262,7 +263,6 @@ async function extractTarGz(buffer, binaryPath, extractedBinary, assetName) {
|
|||||||
async function downloadAndExtract() {
|
async function downloadAndExtract() {
|
||||||
const { target, ext } = getPlatformMapping()
|
const { target, ext } = getPlatformMapping()
|
||||||
const assetName = `ripgrep-v${RG_VERSION}-${target}.${ext}`
|
const assetName = `ripgrep-v${RG_VERSION}-${target}.${ext}`
|
||||||
const downloadUrl = `${RELEASE_BASE}/${assetName}`
|
|
||||||
|
|
||||||
const binaryPath = getBinaryPath()
|
const binaryPath = getBinaryPath()
|
||||||
const binaryDir = path.dirname(binaryPath)
|
const binaryDir = path.dirname(binaryPath)
|
||||||
@@ -277,12 +277,32 @@ async function downloadAndExtract() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[ripgrep] Downloading v${RG_VERSION} for ${target}...`)
|
console.log(`[ripgrep] Downloading v${RG_VERSION} for ${target}...`)
|
||||||
console.log(`[ripgrep] URL: ${downloadUrl}`)
|
|
||||||
|
|
||||||
const extractedBinary = process.platform === "win32" ? "rg.exe" : "rg"
|
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 {
|
try {
|
||||||
const buffer = await downloadUrlToBufferWithFallback(downloadUrl)
|
|
||||||
console.log(`[ripgrep] Downloaded ${Math.round(buffer.length / 1024)} KB`)
|
console.log(`[ripgrep] Downloaded ${Math.round(buffer.length / 1024)} KB`)
|
||||||
|
|
||||||
mkdirSync(binaryDir, { recursive: true })
|
mkdirSync(binaryDir, { recursive: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user