# GL Robotics AI 一键安装工具

这是面向国内用户的跨平台 AI 工具链一键安装器。

当前已支持的功能：

- Obsidian 接入 DeepSeek
- Chrome Ghelper 安装辅助
- Clash Verge 一键安装

`Obsidian 接入 DeepSeek` 会自动安装/配置：

- Claude Code CLI
- DeepSeek Anthropic 兼容接口
- Obsidian Claudian 插件
- 自动启用 Claudian 插件

`Chrome Ghelper 安装辅助` 会先检测 Chrome；如果用户没有 Chrome，会自动安装 Chrome，然后下载/解压 Ghelper 包，打开安装目录和 Chrome 扩展管理页。Chrome 不允许普通脚本直接静默启用第三方扩展，因此最后的拖入/确认安装需要用户在浏览器里点一次。

如果已经检测到 Chrome、Ghelper 或 Clash Verge，安装器会跳过对应安装步骤，不覆盖重装。

`Clash Verge 一键安装` 会优先检测是否已安装；未安装时使用 `packages/clash-verge/` 里的离线安装包；没有离线包时，先从 Clash Verge Rev 官方 GitHub Release 下载，官方源失败后再使用 GL Robotics 中转。这个功能只安装客户端，不自动导入订阅、不强制修改系统代理。

## Project Structure

```text
ai-dev-installer/
  install.bat
  scripts/
    install.ps1
    prepare-offline-package.ps1
  bootstrap/
    install.ps1
  config/
    install-config.example.json
  packages/
    node/
    claude-code/
    chrome/
    ghelper/
    clash-verge/
    obsidian-plugins/claudian/
  logs/
```

## User Flow

1. Start `install.bat` on Windows or `install.sh` on Ubuntu/macOS.
2. Select a feature:
   - `1. Obsidian 接入 DeepSeek`
   - `2. 安装 Chrome Ghelper`
   - `3. 安装 Clash Verge`
3. Follow the short Chinese prompts.

## Obsidian DeepSeek Flow

1. Select `Obsidian 接入 DeepSeek`.
2. Enter a DeepSeek API key.
3. The installer checks Node.js, npm, Claude Code CLI, and Obsidian vault path.
4. It installs missing parts where possible.
5. It configures DeepSeek:
   - `ANTHROPIC_BASE_URL`
   - `ANTHROPIC_AUTH_TOKEN`
   - `ANTHROPIC_MODEL`
6. Write local Claude Code user settings:
   - Windows: `%USERPROFILE%\.claude\settings.json`
   - Ubuntu/macOS: `~/.claude/settings.json`
7. Close Obsidian if it is running, to avoid config overwrite.
8. Install Claudian into `<vault>/.obsidian/plugins/claudian`.
9. Enable Claudian in `<vault>/.obsidian/community-plugins.json`.
10. Write Claudian and Claude project environment hints.
11. Write detailed logs for troubleshooting.

## Offline Package Names

Put files under these directories when preparing a full offline or mirrored package:

- `packages/claude-code/anthropic-ai-claude-code-*.tgz`
- `packages/node/node-*-x64.msi`
- `packages/chrome/*.exe`, `*.msi`, `*.dmg`, or `*.deb`
- `packages/obsidian-plugins/claudian/main.js`
- `packages/obsidian-plugins/claudian/manifest.json`
- `packages/obsidian-plugins/claudian/styles.css`
- `packages/ghelper/Ghelper-*.zip` or `packages/ghelper/*.crx`
- `packages/clash-verge/*setup.exe`, `*.dmg`, `*.deb`, `*.AppImage`, or `*.app.tar.gz`

## Offline Package Preparation

Run this on a machine that can access npm and GitHub:

```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\prepare-offline-package.ps1
```

Then upload the whole folder, or only `packages/`, to your preferred transfer location.

## Fishros-Style Web Install

For Windows users, the closest equivalent to `wget http://fishros.com/install -O fishros && . fishros` is:

```powershell
irm https://gl-robotics.com/ai-dev/install.ps1 | iex
```

For Ubuntu/macOS users:

```bash
curl -fsSL https://gl-robotics.com/ai-dev/install.sh | bash
```

or:

```bash
wget -O- https://gl-robotics.com/ai-dev/install.sh | bash
```

Publish `bootstrap/install.ps1` as the small remote entry script, and publish the full zip package separately. Before publishing, edit `$DefaultZipUrl` in `bootstrap/install.ps1` so it points to your real installer zip.

See `PUBLISH.zh-CN.md` for the full release flow.

## Current Limitations

- Installing offline does not solve runtime access by itself. DeepSeek API configuration is required for users who cannot access Anthropic directly.
- Claudian settings may change between plugin versions. This MVP writes compatible environment and CLI-path settings, but users may still need to confirm provider settings inside Obsidian.
- The script does not bundle Obsidian itself yet.

## Existing Claude Config Safety

If the installer detects an existing Claude Code configuration that conflicts with DeepSeek, it asks before switching the user's Claude Code configuration to DeepSeek. Existing DeepSeek configuration is updated silently.

When it writes JSON settings, it creates timestamped backups first and merges only the fields needed by this installer where possible.

The installer does not ask whether to store the API key in the Obsidian vault. By default, the key stays in the user's Claude Code configuration. Advanced users can opt in with `-StoreApiKeyInVault` on Windows or `--store-api-key-in-vault` on Ubuntu/macOS.

## Sources Checked

- Claudian README says manual install requires `main.js`, `manifest.json`, and `styles.css` in the vault plugin folder.
- The default bundled Claudian package uses plugin id `claudian` for compatibility with older Obsidian desktop shells. The latest upstream release may use `realclaudian`.
- Claudian troubleshooting recommends using `cli-wrapper.cjs` for npm-installed Claude Code on Windows when needed.
