refactor: remove local bin/ fallback, download only from GitHub Release

- Remove Strategy 2 (fallback to local bin/) from installer.ts
- Binary source is now exclusively GitHub Release (preset tag)
- Improve error message with direct download link on failure
- Update CHANGELOG.md to reflect the change
- Developers can self-build via codeagent-wrapper/build-all.sh
This commit is contained in:
li committed 2026-03-11 11:54:21 +08:00
1 parent e88a085898
commit 240b453050
2 files changed
+5 -22

No files matched your search

+2 -1
View File
@@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **二进制产物迁移至 GitHub Release**:`bin/codeagent-wrapper-*` 不再打包到 npm 和 git,改从 GitHub Release (`preset` tag) 按需下载,npm 包从 16.3MB 缩减至 161KB
- **GitHub Actions CI**:新增 `.github/workflows/build-binaries.yml`,`codeagent-wrapper/` 变更时自动交叉编译 6 平台并上传到 `preset` Release
- **installer.ts 下载逻辑**:优先从 GitHub Release 下载,失败后 fallback 到本地 `bin/`(开发/离线场景)
- **installer.ts 下载逻辑**:仅从 GitHub Release 下载,移除本地 `bin/` fallback(开发者可用 `build-all.sh` 自行编译)
- **移除本地二进制**:`bin/codeagent-wrapper-*` 6 个文件已从仓库删除,仅保留 `bin/ccg.mjs` 入口
---
+3 -21
View File
@@ -845,26 +845,8 @@ ${workflow.description}
const destBinary = join(binDir, platform === 'win32' ? 'codeagent-wrapper.exe' : 'codeagent-wrapper')
// Strategy 1: Download from GitHub Release (preferred)
let installed = false
try {
installed = await downloadBinaryFromRelease(binaryName, destBinary)
}
catch {
// Download failed, will try fallback
}
// Strategy 2: Fallback to local bin/ (development or offline)
if (!installed) {
const srcBinary = join(PACKAGE_ROOT, 'bin', binaryName)
if (await fs.pathExists(srcBinary)) {
await fs.copy(srcBinary, destBinary)
if (platform !== 'win32') {
await fs.chmod(destBinary, 0o755)
}
installed = true
}
}
// Download from GitHub Release (only source)
const installed = await downloadBinaryFromRelease(binaryName, destBinary)
if (installed) {
// Verify installation by running --version
@@ -880,7 +862,7 @@ ${workflow.description}
}
}
else {
result.errors.push(`Failed to obtain binary: ${binaryName} (download failed, no local fallback)`)
result.errors.push(`Failed to download binary: ${binaryName} from GitHub Release. Check network or visit https://github.com/${GITHUB_REPO}/releases/tag/${RELEASE_TAG}`)
result.success = false
}
}