Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 62 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,116 +1,116 @@
# OpenCode CLI

> OpenCode 成为可被其他 AI 调用和监督的命令行工具
> Make OpenCode a command-line tool that can be invoked and supervised by other AI

本项目是 OpenCode 生态系统的扩展,提供基于 Bash 的完整命令行客户端,让 OpenCode 能够被其他 AI 系统调用和监督。
This project is an extension of the OpenCode ecosystem, providing a complete Bash-based command-line client that enables OpenCode to be invoked and supervised by other AI systems.

## 项目愿景
## Vision

**oho** 的设计目标是让 OpenCode 更好地被其他 AI 调用和监督。在 [OpenCode 生态系统](https://opencode.ai/docs/zh-cn/ecosystem/) 中,存在许多类似的应用,但 **oho 是唯一一个完全基于 Bash 实现的方案**。
**oho** is designed to make OpenCode more accessible for invocation and supervision by other AI. Within the [OpenCode Ecosystem](https://opencode.ai/docs/ecosystem/), there are many similar applications, but **oho is the only solution implemented entirely in Bash**.

> "oho 在 Bash 中可调用" 代表着强大的扩展性和兼容性 —— 这是本项目独一无二的定位。
> "oho is callable from Bash" represents powerful extensibility and compatibility — this is the project's unique positioning.

## 核心特性
## Core Features

### 完整的 API 覆盖
### Complete API Coverage

oho 基于 OpenCode REST API 构建,提供完整的命令行接口:
oho is built on the OpenCode REST API, providing a complete command-line interface:

- ✅ 会话管理(创建、删除、继续、终止)
- ✅ 消息发送与接收
- ✅ 项目与文件操作
- ✅ 配置与提供商管理
- ✅ MCP/LSP/格式化器状态管理
- ✅ Session management (create, delete, continue, terminate)
- ✅ Message sending and receiving
- ✅ Project and file operations
- ✅ Configuration and provider management
- ✅ MCP/LSP/Formatter status management

### 独特的 Linux 能力
### Unique Linux Capabilities

Linux 环境中,oho 可以做到 OpenCode CLI 暂时不具备的功能:
In Linux environments, oho can provide capabilities that OpenCode CLI doesn't currently support:

- 📁 **指定目录创建 Session**:在任意目录启动 AI 编程会话
- 💬 **基于 Session 继续发消息**:接续之前的会话上下文
- 🗑️ **销毁 Session**:完整管理会话生命周期
- 🔄 **会话分叉与回退**:实验性开发轻松切换
- 📁 **Create Session in Specified Directory**: Start AI programming sessions in any directory
- 💬 **Continue Sending Messages Based on Session**: Resume previous session context
- 🗑️ **Destroy Session**: Complete lifecycle management for sessions
- 🔄 **Session Fork and Revert**: Easy switching for experimental development

### Bash 可调用性
### Bash Callable

作为纯 Bash 实现,oho 可以:
As a pure Bash implementation, oho can be:

- 被任何 AI Agent 调用
- 集成到自动化工作流
- CI/CD 管道中运行
- 与其他 shell 工具无缝组合
- Invoked by any AI Agent
- Integrated into automated workflows
- Run in CI/CD pipelines
- Seamlessly combined with other shell tools

## 快速开始
## Quick Start

### 安装
### Installation

```bash
cd oho
make build
```

### 基本用法
### Basic Usage

```bash
# 配置服务器连接
# Configure server connection
export OPENCODE_SERVER_HOST=127.0.0.1
export OPENCODE_SERVER_PORT=4096
export OPENCODE_SERVER_PASSWORD=your-password

# 列出所有会话
# List all sessions
oho session list

# 创建新会话
# Create a new session
oho session create

# 在指定目录创建会话
# Create session in specified directory
oho session create --path /your/project

# 发送消息
oho message add -s <session-id> "帮我分析这个代码"
# Send a message
oho message add -s <session-id> "Help me analyze this code"

# 继续已有会话
oho message add -s <session-id> "继续刚才的任务"
# Continue existing session
oho message add -s <session-id> "Continue the previous task"

# 销毁会话
# Destroy session
oho session delete <session-id>
```

## 与其他生态项目的对比
## Comparison with Other Ecosystem Projects

| 特性 | oho | 其他生态项目 |
|------|-----|-------------|
| 实现语言 | Bash | TypeScript/Python/Go |
| AI 可调用 | ✅ 天然支持 | 需要额外适配 |
| 集成难度 | ⭐⭐⭐⭐⭐ 极低 | ⭐⭐⭐ 中等 |
| Feature | oho | Other Ecosystem Projects |
|---------|-----|-------------------------|
| Implementation Language | Bash | TypeScript/Python/Go |
| AI Callable | ✅ Native support | Requires additional adaptation |
| Integration Difficulty | ⭐⭐⭐⭐⭐ Extremely Low | ⭐⭐⭐ Medium |

## 项目结构
## Project Structure

```
.
├── oho/ # OpenCode Bash 客户端
│ ├── cmd/ # 命令行入口
│ ├── internal/ # 内部包
│ ├── go.mod # Go 模块定义
│ └── README.md # 客户端详细文档
├── docs/ # 项目文档
│ └── plans/ # 设计计划
├── assets/ # 资源文件
│ └── oho_cli.png # 命令行截图
├── AGENTS.md # AI 开发指南
└── LICENSE # GPL v3 许可证
├── oho/ # OpenCode Bash Client
│ ├── cmd/ # Command-line entry
│ ├── internal/ # Internal packages
│ ├── go.mod # Go module definition
│ └── README.md # Client detailed documentation
├── docs/ # Project documentation
│ └── plans/ # Design plans
├── assets/ # Resource files
│ └── oho_cli.png # CLI screenshot
├── AGENTS.md # AI Development Guide
└── LICENSE # GPL v3 License
```

## 命令参考
## Command Reference

完整命令列表请参考 [oho/README.md](oho/README.md)
For complete command list, see [oho/README.md](oho/README.md)

## 许可证
## License

本项目基于 GPL v3 许可证开源,详见 [LICENSE](LICENSE) 文件。
This project is open source under the GPL v3 license. See [LICENSE](LICENSE) for details.

## 参考资源
## References

- [OpenCode 官方文档](https://opencode.ai/docs/zh-cn/)
- [OpenCode 生态系统](https://opencode.ai/docs/zh-cn/ecosystem/)
- [OpenCode Official Documentation](https://opencode.ai/docs/)
- [OpenCode Ecosystem](https://opencode.ai/docs/ecosystem/)
- [OpenCode GitHub](https://github.com/anomalyco/opencode)
116 changes: 116 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# OpenCode CLI

> 让 OpenCode 成为可被其他 AI 调用和监督的命令行工具

本项目是 OpenCode 生态系统的扩展,提供基于 Bash 的完整命令行客户端,让 OpenCode 能够被其他 AI 系统调用和监督。

## 项目愿景

**oho** 的设计目标是让 OpenCode 更好地被其他 AI 调用和监督。在 [OpenCode 生态系统](https://opencode.ai/docs/zh-cn/ecosystem/) 中,存在许多类似的应用,但 **oho 是唯一一个完全基于 Bash 实现的方案**。

> "oho 在 Bash 中可调用" 代表着强大的扩展性和兼容性 —— 这是本项目独一无二的定位。

## 核心特性

### 完整的 API 覆盖

oho 基于 OpenCode REST API 构建,提供完整的命令行接口:

- ✅ 会话管理(创建、删除、继续、终止)
- ✅ 消息发送与接收
- ✅ 项目与文件操作
- ✅ 配置与提供商管理
- ✅ MCP/LSP/格式化器状态管理

### 独特的 Linux 能力

在 Linux 环境中,oho 可以做到 OpenCode CLI 暂时不具备的功能:

- 📁 **指定目录创建 Session**:在任意目录启动 AI 编程会话
- 💬 **基于 Session 继续发消息**:接续之前的会话上下文
- 🗑️ **销毁 Session**:完整管理会话生命周期
- 🔄 **会话分叉与回退**:实验性开发轻松切换

### Bash 可调用性

作为纯 Bash 实现,oho 可以:

- 被任何 AI Agent 调用
- 集成到自动化工作流
- 在 CI/CD 管道中运行
- 与其他 shell 工具无缝组合

## 快速开始

### 安装

```bash
cd oho
make build
```

### 基本用法

```bash
# 配置服务器连接
export OPENCODE_SERVER_HOST=127.0.0.1
export OPENCODE_SERVER_PORT=4096
export OPENCODE_SERVER_PASSWORD=your-password

# 列出所有会话
oho session list

# 创建新会话
oho session create

# 在指定目录创建会话
oho session create --path /your/project

# 发送消息
oho message add -s <session-id> "帮我分析这个代码"

# 继续已有会话
oho message add -s <session-id> "继续刚才的任务"

# 销毁会话
oho session delete <session-id>
```

## 与其他生态项目的对比

| 特性 | oho | 其他生态项目 |
|------|-----|-------------|
| 实现语言 | Bash | TypeScript/Python/Go |
| AI 可调用 | ✅ 天然支持 | 需要额外适配 |
| 集成难度 | ⭐⭐⭐⭐⭐ 极低 | ⭐⭐⭐ 中等 |

## 项目结构

```
.
├── oho/ # OpenCode Bash 客户端
│ ├── cmd/ # 命令行入口
│ ├── internal/ # 内部包
│ ├── go.mod # Go 模块定义
│ └── README.md # 客户端详细文档
├── docs/ # 项目文档
│ └── plans/ # 设计计划
├── assets/ # 资源文件
│ └── oho_cli.png # 命令行截图
├── AGENTS.md # AI 开发指南
└── LICENSE # GPL v3 许可证
```

## 命令参考

完整命令列表请参考 [oho/README.md](oho/README.md)

## 许可证

本项目基于 GPL v3 许可证开源,详见 [LICENSE](LICENSE) 文件。

## 参考资源

- [OpenCode 官方文档](https://opencode.ai/docs/zh-cn/)
- [OpenCode 生态系统](https://opencode.ai/docs/zh-cn/ecosystem/)
- [OpenCode GitHub](https://github.com/anomalyco/opencode)
Loading