跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

prepare-macos-media.sh

68 行 · 3.7 KB历史下载
1#!/bin/bash
2# Download application media on the host. The guest's external network stays closed.
3set -euo pipefail
4export PATH=/usr/bin:/bin:/usr/sbin:/sbin
5[[ $# == 1 && $1 == /* ]]
6media=$1
7src=$(cd "$(dirname "$0")" && pwd)
8mkdir -p "$media"
9export CAGE_HOST_DOWNLOAD_CACHE="$media/.downloads"
10fetch() {
11 if [[ -n ${CAGE_HOST_DOWNLOADER:-} ]]; then
12 "$CAGE_HOST_DOWNLOADER" host-download "$1" "$2" "$3" "${4:-}" "$CAGE_HOST_DOWNLOAD_CACHE" "$5"
13 else
14 # Standalone source builds can supply curl proxy environment variables.
15 curl --disable -fsSL --proto '=https' --proto-redir '=https' --retry 2 --connect-timeout 15 --speed-time 60 --speed-limit 1 -H "Accept: ${4:-*/*}" "$1" -o "$2"
16 fi
17}
18download() {
19 local name=$1 url=$2 expected=$3 api=${4:-}
20 local target="$media/$name" temporary
21 [[ ! -L $target && ( ! -e $target || -f $target ) ]]
22 if [[ -f $target && ! -L $target ]]; then
23 if [[ -z $expected && ${CAGE_REFRESH_TOOLS:-} != 1 ]] || [[ -n $expected && $(shasum -a 256 "$target" | cut -d' ' -f1) == "$expected" ]]; then return; fi
24 fi
25 printf '下载 %s\n' "$name"
26 temporary=$(mktemp "$media/.$name.XXXXXXXX")
27 if ! fetch "$url" "$temporary" "$name" "" "$expected"; then
28 if [[ -z $api ]] || ! fetch "$api" "$temporary" "$name" application/octet-stream "$expected"; then
29 rm "$temporary"
30 return 1
31 fi
32 fi
33 if [[ -n $expected && $(shasum -a 256 "$temporary" | cut -d' ' -f1) != "$expected" ]]; then
34 rm "$temporary"
35 return 1
36 fi
37 mv "$temporary" "$target"
38}
39download editor.tgz https://github.com/coder/code-server/releases/download/v4.145.0/code-server-4.145.0-macos-arm64.tar.gz a79774d8d34eed785c1f831bc0125f7534bc21a0039bef8e8a2aa32463f9421a https://api.github.com/repos/coder/code-server/releases/assets/711206948
40download playwright.tgz https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.0.tgz 315247c55a793ca760b2f05bdcee0e6a53fd65b1f22d1d3de8323c8c9395add3
41download node.tgz https://nodejs.org/dist/v24.22.2/node-v24.22.2-darwin-arm64.tar.gz aa9549349e47dffaa42dcf95d6e06ade8c4bdafc980979883b88767670df385a
42if [[ ${CAGE_REFRESH_TOOLS:-} != 1 ]]; then
43 download macfuse.dmg https://github.com/macfuse/macfuse/releases/download/macfuse-5.5.0/macfuse-5.5.0.dmg 92c21ef2db4199bcf5bddc8e6efb57b23ecb9715f74ab38cba2c77ab226d3830
44 if [[ ! -f $media/macfuse.pkg ]]; then bash "$src/macos-fuse-media.sh" "$media/macfuse.dmg" "$media/macfuse.pkg"; fi
45 download claude.dmg https://downloads.claude.ai/releases/darwin/universal/4.23118.0/Claude-8175c354eda704cea00fdeddfa69cea329dd321a.dmg 0e3d86a8b7ac6d7e6a3de011134db1717716fa6ecbe323f5ea4a5356fba62810
46fi
47download chrome.dmg https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg ''
48if [[ ! -f $media/cli/git.tar.gz || ${CAGE_REFRESH_TOOLS:-} == 1 ]]; then
49 fresh=$(mktemp -d "$media/.cli-repair.XXXXXXXX")
50 if ! bash "$src/prepare-macos-cli-kit.sh" "$fresh/cli" "$media/cli"; then
51 rmdir "$fresh"
52 exit 1
53 fi
54 # Earlier builds cached a kit without Git. Preserve it until the full kit
55 # is verified and the next install can resume after either rename.
56 if [[ -d $media/cli ]]; then mv "$media/cli" "$fresh/previous"; fi
57 mv "$fresh/cli" "$media/cli"
58 rm -rf "$fresh"
59fi
60
61# Cached archives may survive several application builds. Refresh first-party
62# CLI source from this bundle without changing downloaded package bytes.
63for name in install-macos-cli.sh macos-cli.py cli_channel.py cli_channel.resume.md claude_account_resume.md claude-account.py; do
64 if [[ -f $src/$name ]]; then
65 [[ ! -L $media/cli/$name ]]
66 cp "$src/$name" "$media/cli/$name"
67 fi
68done