# StigmergyLite 快速使用指南

## 🚀 快速开始

### 完整安装（推荐新用户）

```bash
npm install -g stigmergylite
stigmergylite
```

---

## 🛠️ 命令参考

### 1. 完整安装
```bash
stigmergylite
```
**功能**：安装 Git + OpenCode + Bun + Oh My OpenCode + 所有 CLI 工具

---

### 2. 诊断问题
```bash
stigmergylite doctor
```
**用途**：当 OpenCode 无法启动或出现问题时

**检查内容**：
- ✅ 系统信息
- ✅ 工具安装状态（Bun、OpenCode、Git）
- ✅ OpenCode 配置文件格式
- ✅ PATH 环境变量
- ✅ 目录权限
- ✅ Oh My OpenCode 安装状态

---

### 3. 自动修复
```bash
stigmergylite fix
```
**用途**：自动修复常见问题

**修复内容**：
- ✅ 修复 OpenCode 配置文件
- ✅ 刷新 PATH 环境变量
- ✅ 配置 Git Bash
- ✅ 验证工具可用性

---

### 4. 查看状态
```bash
stigmergylite status
```
**用途**：查看所有工具的安装状态

**显示内容**：
- Git 版本和路径
- OpenCode 版本
- Bun 版本
- Oh My OpenCode 插件列表
- CLI 工具状态

---

### 5. 单独安装 Oh My OpenCode
```bash
stigmergylite install-oh-my-opencode
```
**用途**：重新安装 Oh My OpenCode（无需运行完整安装）

**场景**：
- Oh My OpenCode 安装失败
- 插件冲突需要重新安装
- 配置文件损坏导致无法启动

---

### 6. 显示帮助
```bash
stigmergylite help
```
**用途**：查看完整的命令说明和示例

---

## 📋 常见问题排查流程

### 问题 1：OpenCode 无法启动

```bash
# 步骤 1：诊断问题
stigmergylite doctor

# 步骤 2：自动修复
stigmergylite fix

# 步骤 3：重新安装 Oh My OpenCode
stigmergylite install-oh-my-opencode

# 步骤 4：验证状态
stigmergylite status
```

---

### 问题 2：插件或技能加载失败

```bash
# 1. 查看已安装的插件
stigmergylite status

# 2. 诊断配置
stigmergylite doctor

# 3. 自动修复配置文件
stigmergylite fix

# 4. 重新安装 Oh My OpenCode
stigmergylite install-oh-my-opencode
```

---

### 问题 3：bunx 命令找不到

```bash
# 自动修复（会刷新 PATH）
stigmergylite fix

# 验证
stigmergylite status
```

---

### 问题 4：配置文件损坏

```bash
# 自动修复（会备份并修复配置文件）
stigmergylite fix

# 如果自动修复失败，手动删除
# Windows:
del C:\Users\XXX\.config\opencode\opencode.json

# macOS/Linux:
rm ~/.config/opencode/opencode.json

# 然后重新安装
stigmergylite install-oh-my-opencode
```

---

## 🎯 典型使用场景

### 场景 1：首次安装

```bash
# 1. 完整安装
stigmergylite

# 2. 查看状态
stigmergylite status

# 3. 启动 OpenCode
opencode
```

---

### 场景 2：更新 Oh My OpenCode

```bash
# 单独重新安装 Oh My OpenCode
stigmergylite install-oh-my-opencode
```

---

### 场景 3：遇到插件冲突

```bash
# 1. 诊断（查看已安装的插件）
stigmergylite doctor

# 2. 自动修复
stigmergylite fix

# 3. 重新安装
stigmergylite install-oh-my-opencode
```

---

### 场景 4：检查环境状态

```bash
# 快速查看所有工具状态
stigmergylite status
```

---

## 💡 提示和技巧

### 1. 定期检查状态
```bash
# 安装后或遇到问题前
stigmergylite status
```

### 2. 遇到问题先诊断
```bash
# 不要盲目重装，先诊断
stigmergylite doctor
```

### 3. 使用自动修复
```bash
# 大部分问题可以自动修复
stigmergylite fix
```

### 4. 单独重装组件
```bash
# 不需要运行完整安装
stigmergylite install-oh-my-opencode
```

### 5. 查看帮助
```bash
# 忘记命令时
stigmergylite help
```

---

## 📊 状态符号说明

| 符号 | 含义 |
|------|------|
| ✅ | 已安装/正常 |
| ❌ | 未安装/错误 |
| ⚠️ | 警告 |
| ℹ️ | 信息 |

---

## 🔧 高级选项

### 仅安装 Git
```bash
stigmergylite --no-opencode --no-bun --no-oh-my-opencode --no-clis
```

### 仅安装 OpenCode + Bun + Oh My OpenCode
```bash
stigmergylite --no-clis
```

### 静默模式
```bash
stigmergylite --silent
# 或
stigmergylite -s
```

---

## 🆘 获取帮助

### 内置帮助
```bash
stigmergylite help
```

### 诊断工具
```bash
stigmergylite doctor
```

### 详细文档
查看项目中的文档文件：
- `NEW_FEATURES_SUMMARY.md` - 新功能详细说明
- `OHMYOPENCODE_FIX_SUMMARY.md` - Oh My OpenCode 问题修复
- `ARM64_FIX_SUMMARY_CN.md` - Windows ARM64 支持说明

---

## ✅ 最佳实践

1. **安装后立即检查状态**
   ```bash
   stigmergylite
   stigmergylite status
   ```

2. **遇到问题按顺序执行**
   ```bash
   stigmergylite doctor
   stigmergylite fix
   stigmergylite install-oh-my-opencode
   ```

3. **定期更新组件**
   ```bash
   # 更新 Oh My OpenCode
   stigmergylite install-oh-my-opencode
   ```

4. **保持环境健康**
   ```bash
   # 定期运行
   stigmergylite doctor
   stigmergylite status
   ```

---

## 🎉 总结

StigmergyLite 现在提供：

- ✅ **自动诊断**：快速识别问题
- ✅ **自动修复**：解决大部分问题
- ✅ **状态透明**：清楚知道安装了什么
- ✅ **灵活重装**：可以单独重装组件
- ✅ **友好帮助**：清晰的指引和文档

**问题？先诊断，再修复，最后查看状态！**

```bash
stigmergylite doctor → stigmergylite fix → stigmergylite status
```
