{"id":47727456,"url":"https://github.com/deeptrial/claude-code-offline","last_synced_at":"2026-05-28T06:00:56.625Z","repository":{"id":347743901,"uuid":"1195130293","full_name":"DeepTrial/claude-code-offline","owner":"DeepTrial","description":"An intelligent deployment solution for Claude Code with automatic mirror detection and multi-language support.","archived":false,"fork":false,"pushed_at":"2026-04-26T15:05:09.000Z","size":120,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-26T15:24:01.473Z","etag":null,"topics":["claude-code","offline","setup-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeepTrial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-29T09:06:51.000Z","updated_at":"2026-04-26T15:05:12.000Z","dependencies_parsed_at":"2026-05-28T06:00:31.712Z","dependency_job_id":null,"html_url":"https://github.com/DeepTrial/claude-code-offline","commit_stats":null,"previous_names":["deeptrial/claude-code-offline"],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/DeepTrial/claude-code-offline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepTrial%2Fclaude-code-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepTrial%2Fclaude-code-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepTrial%2Fclaude-code-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepTrial%2Fclaude-code-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeepTrial","download_url":"https://codeload.github.com/DeepTrial/claude-code-offline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepTrial%2Fclaude-code-offline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33596317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","offline","setup-script"],"created_at":"2026-04-02T20:54:17.566Z","updated_at":"2026-05-28T06:00:56.617Z","avatar_url":"https://github.com/DeepTrial.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Code 离线部署方案\n\n\u003e **简体中文** | [English](docs/i18n/README.en.md) | [繁體中文](docs/i18n/README.zh-TW.md) | [Русский](docs/i18n/README.ru.md) | [日本語](docs/i18n/README.ja.md) | [한국어](docs/i18n/README.ko.md)\n\n[![GitHub Actions](https://img.shields.io/badge/GitHub%20Actions-Enabled-blue)](.github/workflows/download-claude-packages.yml)\n[![Version](https://img.shields.io/badge/version-2.1-green)](setup-claude-code.sh)\n[![License](https://img.shields.io/badge/license-MIT-yellow)](LICENSE)\n\n一个智能的 Claude Code 离线部署方案，支持自动镜像源检测、地区限制绕过和多语言支持。\n\n## 特性\n\n- ✅ **GitHub Actions 自动下载**: 自动从 npm 下载最新 Claude Code 并打包\n- ✅ **多路径自动检测**: 自动查找离线包，无需硬编码路径\n- ✅ **通用 Node.js 安装**: 支持 nvm、apt 或直接下载二进制文件安装 Node.js\n- ✅ **灵活的部署方式**: 支持离线包、在线下载或直接 npm 安装\n- ✅ **智能配置管理**: 自动清理旧配置，保持 .bashrc 整洁\n- ✅ **内置清理工具**: 包含 TMP 目录清理脚本\n- ✅ **🆕 镜像源自动检测**: 自动测试并选择最快的下载源（Node.js、npm、GitHub）\n- ✅ **🆕 地区限制绕过**: 自动配置跳过首次启动的地区验证\n- ✅ **🆕 卸载功能**: 完整的卸载功能，支持备份\n- ✅ **🆕 离线 Skills 支持**: 内置 14 个离线可用的 Claude Code 插件（文档处理、设计、测试等）\n\n---\n\n## 🚀 快速开始（3 种方式）\n\n### 方式 1：一行命令安装（推荐，需要网络）\n\n```bash\nbash \u003c(curl -fsSL https://raw.githubusercontent.com/DeepTrial/claude-code-offline/main/setup-claude-code.sh) --auto-download\n```\n\n### 方式 2：使用离线包安装（无需网络）\n\n1. 从 [Releases](https://github.com/DeepTrial/claude-code-offline/releases) 下载 `claude-offline-packages.tar.gz`\n2. 解压并运行：\n\n```bash\ntar -xzf claude-offline-packages.tar.gz\ncd claude-offline-packages\nbash setup-claude-code.sh\n```\n\n### 方式 3：本地已有离线包\n\n```bash\nbash setup-claude-code.sh --offline-path /path/to/claude-offline-packages\n```\n\n---\n\n## ⚠️ 安装后必做（关键步骤）\n\n安装完成后，**必须配置 API 密钥**才能使用：\n\n### 1. 编辑配置文件\n\n```bash\nnano ~/.claude/settings.json\n```\n\n### 2. 修改以下配置\n\n```json\n{\n  \"env\": {\n    \"ANTHROPIC_BASE_URL\": \"https://api.anthropic.com\",\n    \"ANTHROPIC_API_KEY\": \"sk-your-api-key-here\",\n    \"ANTHROPIC_DEFAULT_OPUS_MODEL\": \"claude-3-opus-20240229\",\n    \"ANTHROPIC_DEFAULT_SONNET_MODEL\": \"claude-3-sonnet-20240229\",\n    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\": \"claude-3-haiku-20240307\"\n  }\n}\n```\n\n### 3. 重新加载配置\n\n```bash\nsource ~/.bashrc\nclaude --version\n```\n\n\u003e 💡 **提示**：如果你所在地区无法直接访问 Anthropic API，需要配置代理地址到 `ANTHROPIC_BASE_URL`\n\n---\n\n## 详细使用指南\n\n### 目录\n\n- [自动版本更新](#自动版本更新)\n- [平台支持](#平台支持)\n- [镜像源自动检测](#镜像源自动检测)\n- [地区限制绕过](#地区限制绕过)\n- [高级用法](#高级用法)\n- [卸载方法](#卸载方法)\n- [故障排除](#故障排除)\n\n## 自动版本更新\n\n本仓库包含自动版本检查和更新机制：\n\n### GitHub Actions 自动构建\n\n工作流自动执行：\n1. **每日检查**：每天 UTC 00:00 检查 npm registry 新版本\n2. **版本对比**：对比 npm 版本与现有 GitHub Release\n3. **智能构建**：仅检测到新版本时才构建\n4. **自动发布**：自动创建 GitHub Release\n\n### 本地版本检查器\n\n使用 `check-update.sh` 脚本检查和下载更新：\n\n```bash\n# 交互式检查更新\nbash check-update.sh\n\n# 仅检查版本\nbash check-update.sh --check-only\n\n# 有更新则下载并安装\nbash check-update.sh --install\n```\n\n## 平台支持\n\n### 默认构建平台\n\nGitHub Actions 自动构建的离线包默认为 **linux-x64** 平台。包中包含：\n- Claude Code CLI 原生二进制 (linux-x64)\n- 所有离线可用的 skills 和 plugins\n\n### 支持的平台列表\n\n| 平台 | npm 包名 | 说明 |\n|------|---------|------|\n| **linux-x64** | `@anthropic-ai/claude-code-linux-x64` | 默认构建 (glibc) |\n| **linux-arm64** | `@anthropic-ai/claude-code-linux-arm64` | ARM Linux (glibc) |\n| **linux-x64-musl** | `@anthropic-ai/claude-code-linux-x64-musl` | Alpine/BusyBox |\n| **linux-arm64-musl** | `@anthropic-ai/claude-code-linux-arm64-musl` | Alpine ARM |\n| **darwin-x64** | `@anthropic-ai/claude-code-darwin-x64` | macOS Intel |\n| **darwin-arm64** | `@anthropic-ai/claude-code-darwin-arm64` | macOS Apple Silicon |\n| **win32-x64** | `@anthropic-ai/claude-code-win32-x64` | Windows x64 |\n| **win32-arm64** | `@anthropic-ai/claude-code-win32-arm64` | Windows ARM |\n\n### 修改项目以支持其他平台\n\n如需为其他平台构建离线包，修改 `.github/workflows/download-claude-packages.yml`：\n\n#### 修改下载的原生二进制包\n\n找到以下部分，将 `linux-x64` 替换为目标平台：\n\n```yaml\n# 原代码（linux-x64）\nnpm pack \"@anthropic-ai/claude-code-linux-x64@${CLAUDE_VERSION}\" --pack-destination .\nNATIVE_TGZ=$(ls -t anthropic-ai-claude-code-linux-x64-*.tgz 2\u003e/dev/null | head -1)\nif [ -n \"$NATIVE_TGZ\" ]; then\n  mv \"$NATIVE_TGZ\" \"claude-code-linux-x64-${CLAUDE_VERSION}.tgz\"\n```\n\n替换为对应平台，例如 **macOS Apple Silicon**：\n\n```yaml\nnpm pack \"@anthropic-ai/claude-code-darwin-arm64@${CLAUDE_VERSION}\" --pack-destination .\nNATIVE_TGZ=$(ls -t anthropic-ai-claude-code-darwin-arm64-*.tgz 2\u003e/dev/null | head -1)\nif [ -n \"$NATIVE_TGZ\" ]; then\n  mv \"$NATIVE_TGZ\" \"claude-code-darwin-arm64-${CLAUDE_VERSION}.tgz\"\n```\n\n#### 同时修改解压步骤\n\n找到解压原生二进制包的部分：\n\n```yaml\n# 原代码（linux-x64）\nNATIVE_TGZ=$(ls -t claude-code-linux-x64-*.tgz 2\u003e/dev/null | head -1)\nif [ -n \"$NATIVE_TGZ\" ]; then\n  echo \"Extracting: $NATIVE_TGZ to node_modules/@anthropic-ai/claude-code-linux-x64\"\n  mkdir -p node_modules/@anthropic-ai/claude-code-linux-x64\n  tar -xzf \"$NATIVE_TGZ\" -C node_modules/@anthropic-ai/claude-code-linux-x64 --strip-components=1\nfi\n```\n\n替换为：\n\n```yaml\nNATIVE_TGZ=$(ls -t claude-code-darwin-arm64-*.tgz 2\u003e/dev/null | head -1)\nif [ -n \"$NATIVE_TGZ\" ]; then\n  echo \"Extracting: $NATIVE_TGZ to node_modules/@anthropic-ai/claude-code-darwin-arm64\"\n  mkdir -p node_modules/@anthropic-ai/claude-code-darwin-arm64\n  tar -xzf \"$NATIVE_TGZ\" -C node_modules/@anthropic-ai/claude-code-darwin-arm64 --strip-components=1\nfi\n```\n\n#### 修改 package.json 平台标记\n\n```yaml\n# 找到并修改 platform 字段\n\"platform\": \"darwin-arm64\"  # 原为 \"linux-x64\"\n```\n\n### Fork 后自动构建\n\n1. Fork 本仓库\n2. 按上述方法修改 workflow 文件\n3. 在你 fork 的仓库中启用 GitHub Actions\n4. 等待自动构建或手动触发 workflow\n\n构建完成后，离线包会发布到你 fork 的仓库 Releases 中。\n\n```bash\n# 示例：下载 macOS ARM64 版本用于离线部署\nnpm pack @anthropic-ai/claude-code@latest\nnpm pack @anthropic-ai/claude-code-darwin-arm64@latest\n\n# 将 .tgz 文件传输到目标机器后解压\nmkdir -p node_modules/@anthropic-ai/claude-code\ntar -xzf anthropic-ai-claude-code-*.tgz -C node_modules/@anthropic-ai/claude-code --strip-components=1\n\nmkdir -p node_modules/@anthropic-ai/claude-code-darwin-arm64\ntar -xzf anthropic-ai-claude-code-darwin-arm64-*.tgz -C node_modules/@anthropic-ai/claude-code-darwin-arm64 --strip-components=1\n\n# 运行 postinstall\ncd node_modules/@anthropic-ai/claude-code\nnode install.cjs\n```\n\n## 镜像源自动检测\n\n脚本内置智能镜像源检测系统，自动测试并选择最快的下载源：\n\n### 支持的镜像源\n\n| 类型 | 默认源 | 国内镜像源 |\n|------|--------|-----------|\n| **Node.js 二进制** | `nodejs.org/dist/` | 淘宝(npmmirror)、腾讯云 |\n| **npm registry** | `registry.npmjs.org/` | `registry.npmmirror.com` |\n| **nvm 安装脚本** | `raw.githubusercontent.com` | jsDelivr CDN、gitmirror |\n| **GitHub API** | `api.github.com` | gitmirror、ghproxy、ghps.cc |\n\n### 自定义镜像源\n\n```bash\n# 自定义 Node.js 镜像\nexport NODE_MIRROR=https://your-mirror.com/node/\n\n# 自定义 npm registry\nexport NPM_MIRROR=https://your-registry.com\n\n# 然后运行脚本\nbash setup-claude-code.sh --auto-download\n```\n\n## 地区限制绕过\n\n脚本已内置配置来自动绕过 Claude Code 的首次启动地区限制：\n\n### 自动配置项\n\n| 配置 | 作用 |\n|------|------|\n| `hasCompletedOnboarding: true` | 标记引导流程已完成 |\n| `skipOnboarding: true` | 跳过首次启动引导 |\n| `hasAcceptedTerms: true` | 标记已接受服务条款 |\n| `telemetry.enabled: false` | 禁用遥测 |\n| `DISABLE_AUTOUPDATER=1` | 禁用自动更新 |\n| `CLAUDE_CODE_SKIP_FIRST_RUN=1` | 跳过首次运行检查 |\n| `regionCheck.bypassed: true` | 标记地区检查已绕过 |\n\n### 如果仍遇到地区问题\n\n确保正确配置 API 端点（使用代理）：\n\n```json\n{\n  \"env\": {\n    \"ANTHROPIC_BASE_URL\": \"https://your-proxy-api-endpoint.com\",\n    \"ANTHROPIC_API_KEY\": \"your-api-key\"\n  }\n}\n```\n\n## 高级用法\n\n### 脚本参数\n\n| 参数 | 说明 |\n|------|------|\n| `--offline-path PATH` | 指定离线包路径 |\n| `--auto-download` | 自动从 GitHub Release 下载 |\n| `--force-download` | 强制重新下载，即使本地已有包 |\n| `--skip-mirror-test` | 跳过镜像速度测试 |\n| `--uninstall` | 卸载 Claude Code 及所有配置 |\n| `--help, -h` | 显示帮助信息 |\n\n### 环境变量\n\n| 变量 | 说明 | 示例 |\n|------|------|------|\n| `NODE_MIRROR` | 自定义 Node.js 镜像源 | `https://npmmirror.com/mirrors/node/` |\n| `NPM_MIRROR` | 自定义 npm registry | `https://registry.npmmirror.com` |\n| `GITHUB_MIRROR` | 自定义 GitHub API 镜像 | `https://hub.gitmirror.com/https://api.github.com` |\n\n### GitHub Actions 触发方式\n\n1. **手动触发**:\n   ```\n   GitHub 页面 → Actions → Download Claude Code Offline Packages → Run workflow\n   ```\n\n2. **定时触发**:\n   - 每天 UTC 00:00 自动检查新版本\n   - 每周一 UTC 00:00 完整重建\n\n## 卸载方法\n\n```bash\n# 卸载 Claude Code\nbash setup-claude-code.sh --uninstall\n```\n\n卸载内容包括：\n- ✅ 删除 `~/.claude/` 配置目录\n- ✅ 删除 `~/.claude.json` 配置文件\n- ✅ 从 `.bashrc` 中移除所有相关配置\n- ✅ 可选：删除 Node.js 和 nvm（如果由本脚本安装）\n- ✅ 卸载前自动备份配置\n\n## 故障排除\n\n### Node.js 安装失败\n\n```bash\n# 手动安装 nvm\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash\nsource ~/.nvm/nvm.sh\nnvm install 20\nnvm use 20\n\n# 重新运行脚本\nbash setup-claude-code.sh\n```\n\n### Claude 命令找不到\n\n```bash\n# 重新加载 shell 配置\nsource ~/.bashrc\n\n# 或手动添加 PATH\nexport PATH=\"/path/to/claude-offline-packages/node_modules/.bin:$PATH\"\n```\n\n### API 连接失败\n\n如果配置后仍无法使用，检查：\n1. API 密钥是否正确\n2. 网络是否可以访问配置的 `ANTHROPIC_BASE_URL`\n3. 是否需要配置代理\n\n## 许可证\n\n与原 Claude Code 许可证一致。\n\n## 贡献\n\n欢迎提交 Issue 和 Pull Request 来改进这个项目。\n\n---\n\n**注意**: Claude Code 和 Claude 标志是 Anthropic 的商标。本项目与 Anthropic 无关。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeptrial%2Fclaude-code-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeptrial%2Fclaude-code-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeptrial%2Fclaude-code-offline/lists"}