npm package: @gengjiawen/os-init
Description: [![npm version](https://img.shields.io/npm/v/%40gengjiawen%2Fos-init)](https://www.npmjs.com/package/@gengjiawen/os-init)
Latest version: 1.21.0

## os-init CLI

[![npm version](https://img.shields.io/npm/v/%40gengjiawen%2Fos-init)](https://www.npmjs.com/package/@gengjiawen/os-init)

A CLI tool to quickly configure development tools and environments.

## Usage

### Setup Dev Environment

```bash
pnpx @gengjiawen/os-init set-dev <SSH_PUBLIC_KEY>
```

Sets up a Docker-based development environment with SSH access. This command will:

- Copy `dev-setup` directory to your current directory (or specify with `-t, --target <dir>`)
- Configure SSH public key in Dockerfile
- Automatically run `docker-compose build && docker-compose up -d` (if docker-compose is available)
- Display SSH connection command with your local IP address

Example:

```bash
pnpx @gengjiawen/os-init set-dev "ssh-rsa AAAAB3NzaC1yc2..."
```

### Setup Android Development Environment

```bash
pnpx @gengjiawen/os-init set-android
```

Sets up a complete Android development environment on macOS and Linux. This command will:

- Install Android SDK to `~/Android` (or custom path with `--android-home <path>`)
- Download and install Android SDK Command-line Tools, Platform Tools, Build Tools, CMake, and NDK
- Automatically accept Android SDK licenses
- Configure environment variables in your shell config (~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish)
- Works on both macOS (Intel and Apple Silicon) and Linux
- No sudo access required

Example:

```bash
# Custom installation path
pnpx @gengjiawen/os-init set-android --android-home ~/my-android-sdk

# Skip environment variable configuration
pnpx @gengjiawen/os-init set-android --skip-env-vars
```

### Setup Fish Shell Import Script

```bash
pnpx @gengjiawen/os-init set-fish
```

Sets up Fish shell to automatically import environment variables from `.bashrc`. This command will:

- Detect if Fish shell is installed (by checking for `~/.config/fish/config.fish`)
- Add an import script to `~/.config/fish/config.fish` that reads environment variables from `~/.bashrc`
- Automatically convert Bash-style environment variable syntax to Fish shell syntax
- Handle PATH variables correctly (converting `:` separators to spaces)
- Skip if the import script already exists

This is useful when you have environment variables configured in `.bashrc` but want to use them in Fish shell without duplicating configuration.

Example:

```bash
pnpx @gengjiawen/os-init set-fish
```

### Generate Mihomo Config

```bash
pnpx @gengjiawen/os-init set-clash
pnpx @gengjiawen/os-init set-clash --download
pnpx @gengjiawen/os-init set-clash --target ~/mihomo/config.yml
```

Generates a Mihomo `config.yml` from the built-in template. This command will:

- Write `./config.yml` in the current directory by default
- Download the Mihomo binary to the config directory when `--download` is set
- Support a custom output path with `-t, --target <path>`

After generating the config, you can keep Mihomo running with pm2:

```bash
pm2 start mihomo --name mihomo -- -f /absolute/path/to/config.yml && pm2 save
```

---

### Configure Claude Code

```bash
pnpx @gengjiawen/os-init set-cc <API_KEY>
```

Configures Claude Code with your API key. This command will:

- Write `~/.claude/settings.json`
- Write VSCode Claude extension config in user `settings.json`
- Install global tool: `@anthropic-ai/claude-code`

### Configure Codex CLI

```bash
pnpx @gengjiawen/os-init set-codex <API_KEY>
```

Configures Codex CLI with your API key. This command will:

- Write `~/.codex/config.toml`
- Write `~/.codex/auth.json`
- Install global tool: `@openai/codex`

### Configure OpenCode CLI

```bash
pnpx @gengjiawen/os-init set-opencode <API_KEY>
```

Configures OpenCode CLI with your API key. This command will:

- Write `~/.config/opencode/opencode.json`
- Install global tool: `opencode-ai` (provides `opencode` command)

### Configure Raycast AI

```bash
pnpx @gengjiawen/os-init set-raycast-ai <API_KEY>
```

Configures Raycast AI providers with your API key. This command will:

- Write `~/.config/raycast/ai/providers.yaml`

Project generated by [gengjiawen/ts-scaffold](https://github.com/gengjiawen/ts-scaffold)