Skip to content
Open
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
74 changes: 74 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# AGENTS.md — OfficeCLI Fork (AionUI-optimized)

> **For AI agents** working with this repository. This is a **fork** of [iOfficeAI/OfficeCLI](https://github.com/iOfficeAI/OfficeCLI) optimized for [AionUI](https://github.com/iOfficeAI/AionUi) preview with enhanced Track Changes / revision mode support.

## Quick start (if user asked you to install this project)

```bash
# 1. Build from source
git clone https://github.com/NextDoorLaoHuang-HF/OfficeCLI.git && cd OfficeCLI
dotnet publish src/officecli/officecli.csproj -c Release -r osx-arm64 --self-contained -o out
# Other platforms: replace osx-arm64 with osx-x64, linux-x64, linux-arm64, win-x64, or win-arm64

# 2. Install to PATH
sudo cp out/officecli /usr/local/bin/ # macOS/Linux
# or: copy out/officecli.exe %LOCALAPPDATA%\OfficeCli\ (Windows)

# 3. Verify
officecli --version
```

## Install skills to AI agents

```bash
officecli install # install base skill to all detected agents
officecli skills install word # install docx-specific skill
```

## AionUI integration (Track Changes / 修订模式)

If the user uses **AionUI** and wants revision/track-changes capabilities:

```bash
officecli setup-aionui
```

This does two things:
1. Installs the `officecli-track-changes` skill into AionUI's skills directory
2. Registers the **Word 修订助手** assistant preset in AionUI's configuration

After running, tell the user to **restart AionUI** — the "Word 修订助手" will appear in the assistant list, pre-configured with both `officecli-docx` and `officecli-track-changes` skills.

The `setup-aionui` command is **idempotent** — safe to run multiple times.

### Track Changes workflow after setup

```bash
# Preferred: find + revision (one command)
officecli set "$FILE" /body --prop find="old" --prop replace="new" --prop revision.author=AI

# Verify
officecli query "$FILE" revision

# Accept/reject
officecli set "$FILE" /revision --prop revision.action=accept
```

## Key differences from upstream

| Feature | Upstream | This fork |
|---------|----------|-----------|
| Binary distribution | Prebuilt releases | Build from source |
| AionUI assistant | Word Creator (generic) | + Word 修订助手 (revision-focused) |
| HTML preview | Standard | Enhanced: 7 CSS classes for revision marks |
| Watch API | Standard | + /api/revision/accept\|reject\|count endpoints |
| `setup-aionui` command | None | ✅ One-shot AionUI integration |
| `officecli-track-changes` skill | None | ✅ Embedded in binary |

## Important files

- `SKILL.md` — base skill file (embedded in binary, installed by `officecli install`)
- `skills/officecli-docx/SKILL.md` — docx-specific skill
- `skills/officecli-track-changes/SKILL.md` — track changes / revision mode skill
- `src/officecli/Core/AionuiInstaller.cs` — `setup-aionui` implementation
- `src/officecli/Core/SkillInstaller.cs` — skill installation to AI agents
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# OfficeCLI
> **This is a fork** of [iOfficeAI/OfficeCLI](https://github.com/iOfficeAI/OfficeCLI) maintained by [@NextDoorLaoHuang-HF](https://github.com/NextDoorLaoHuang-HF), optimized for [AionUI](https://github.com/iOfficeAI/AionUi) preview.
>
> **Differences from upstream:**
> - **HTML preview: Track Changes rendering** — revision marks (ins/del/format/move) are visually rendered in `view html` and Watch mode with distinct CSS styling
> - **Watch server: Revision API endpoints** — `POST /api/revision/accept`, `POST /api/revision/reject`, `GET /api/revision/count` for in-browser accept/reject controls
> - **Revision toolbar** — floating toolbar injected into Watch HTML with revision count badge and accept/reject buttons
>
> All changes are cleanly rebased on upstream `main` (3 commits ahead). Build as usual: `dotnet publish -c Release -r osx-arm64 --self-contained -o out`.

> **OfficeCLI is the world's first and the best Office suite designed for AI agents.**

**Give any AI agent full control over Word, Excel, and PowerPoint — in one line of code.**

Open-source. Single binary. No Office installation. No dependencies. Works everywhere.
Expand Down Expand Up @@ -76,20 +83,29 @@ That's it. The skill file teaches the agent how to install the binary and use al

**Option A — GUI:** Install [**AionUi**](https://github.com/iOfficeAI/AionUi) — a desktop app that lets you create and edit Office documents through natural language, powered by OfficeCLI under the hood. Just describe what you want, and AionUi handles the rest.

**Option B — CLI:** Download the binary for your platform from [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases), then run:
**Option B — CLI:** Build from source (see [Installation](#installation) below), then run:

```bash
officecli install
```

This copies the binary to your PATH and installs the **officecli skill** into every AI coding agent it detects — Claude Code, Cursor, Windsurf, GitHub Copilot, and more. Your agent can immediately create, read, and edit Office documents on your behalf, no extra configuration needed.

**AionUI users** — get Track Changes / revision mode with one command:

```bash
officecli setup-aionui
```

This installs the `officecli-track-changes` skill and registers the **Word 修订助手** assistant in AionUI. Restart AionUI and you'll see it in the assistant list — ready for contract review, redlining, and revision workflows.

## For Developers — See It Live in 30 Seconds

```bash
# 1. Install (macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
# Windows (PowerShell): irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
# 1. Build and install (macOS / Linux)
git clone https://github.com/NextDoorLaoHuang-HF/OfficeCLI.git && cd OfficeCLI
dotnet publish src/officecli/officecli.csproj -c Release -r osx-arm64 --self-contained -o out
sudo cp out/officecli /usr/local/bin/

# 2. Create a blank PowerPoint
officecli create deck.pptx
Expand Down Expand Up @@ -198,39 +214,23 @@ officecli add deck.pptx / --type slide --prop title="Q4 Report"

## Installation

Ships as a single self-contained binary. The .NET runtime is embedded -- nothing to install, no runtime to manage.
This fork does not publish its own releases. Build from source:

**One-line install:**
**Prerequisites:**
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)

```bash
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
git clone https://github.com/NextDoorLaoHuang-HF/OfficeCLI.git
cd OfficeCLI
dotnet publish src/officecli/officecli.csproj -c Release -r osx-arm64 --self-contained -o out
sudo cp out/officecli /usr/local/bin/
```

**Or download manually** from [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases):

| Platform | Binary |
|----------|--------|
| macOS Apple Silicon | `officecli-mac-arm64` |
| macOS Intel | `officecli-mac-x64` |
| Linux x64 | `officecli-linux-x64` |
| Linux ARM64 | `officecli-linux-arm64` |
| Windows x64 | `officecli-win-x64.exe` |
| Windows ARM64 | `officecli-win-arm64.exe` |
**Other platforms:** replace `osx-arm64` with `osx-x64`, `linux-x64`, `linux-arm64`, `win-x64`, or `win-arm64`.

Verify installation: `officecli --version`

**Or self-install from a downloaded binary (or run bare `officecli` to auto-install):**

```bash
officecli install # explicit
officecli # bare invocation also triggers install
```

Updates are checked automatically in the background. Disable with `officecli config autoUpdate false` or skip per-invocation with `OFFICECLI_SKIP_UPDATE=1`. Configuration lives under `~/.officecli/config.json`.
> **Tip:** For the original upstream release with prebuilt binaries, see [iOfficeAI/OfficeCLI](https://github.com/iOfficeAI/OfficeCLI#installation).

## Key Features

Expand Down
59 changes: 30 additions & 29 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# OfficeCLI

> **这是 [iOfficeAI/OfficeCLI](https://github.com/iOfficeAI/OfficeCLI) 的一个 fork**,由 [@NextDoorLaoHuang-HF](https://github.com/NextDoorLaoHuang-HF) 维护,为 [AionUI](https://github.com/iOfficeAI/AionUi) 预览体验优化。
>
> **相对于上游的差异:**
> - **HTML 预览:修订模式(Track Changes)渲染** — 插入/删除/格式/移动标记在 `view html` 和 Watch 模式中以独立 CSS 样式可视化渲染
> - **Watch 服务:修订 API 端点** — `POST /api/revision/accept`、`POST /api/revision/reject`、`GET /api/revision/count`,支持浏览器内接受/拒绝修订
> - **修订工具栏** — Watch HTML 中注入浮动工具栏,显示修订计数徽章和接受/拒绝按钮
>
> 所有改动干净地 rebase 在上游 `main` 之上(领先 3 个提交)。构建方式不变:`dotnet publish -c Release -r osx-arm64 --self-contained -o out`。
> **OfficeCLI 是全球首个、也是最好的专为 AI 智能体设计的 Office 套件。**

**让任何 AI 智能体完全掌控 Word、Excel 和 PowerPoint——只需一行代码。**
Expand Down Expand Up @@ -76,20 +84,29 @@ curl -fsSL https://officecli.ai/SKILL.md

**方式 A — 图形界面:** 安装 [**AionUi**](https://github.com/iOfficeAI/AionUi) — 一款桌面应用,用自然语言就能创建和编辑 Office 文档,底层由 OfficeCLI 驱动。只需描述你想要什么,AionUi 帮你搞定。

**方式 B — 命令行:** 从 [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases) 下载对应平台的二进制文件,然后运行:
**方式 B — 命令行:** 从源码构建(见下方[安装](#安装)),然后运行:

```bash
officecli install
```

该命令会将二进制文件复制到 PATH,并自动将 **officecli 技能文件**安装到检测到的所有 AI 编程助手 — Claude Code、Cursor、Windsurf、GitHub Copilot 等。您的智能体可以立即创建、读取和编辑 Office 文档,无需额外配置。

**AionUI 用户** — 一条命令启用修订模式(Track Changes):

```bash
officecli setup-aionui
```

这会安装 `officecli-track-changes` 技能并在 AionUI 中注册 **Word 修订助手**。重启 AionUI 后即可在助手列表中看到 — 适用于合同审查、修订标记等工作流。

## 开发者 — 30 秒亲眼看到效果

```bash
# 1. 安装(macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
# Windows (PowerShell): irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
# 1. 构建并安装(macOS / Linux)
git clone https://github.com/NextDoorLaoHuang-HF/OfficeCLI.git && cd OfficeCLI
dotnet publish src/officecli/officecli.csproj -c Release -r osx-arm64 --self-contained -o out
sudo cp out/officecli /usr/local/bin/

# 2. 创建一个空白 PowerPoint
officecli create deck.pptx
Expand Down Expand Up @@ -198,39 +215,23 @@ officecli add deck.pptx / --type slide --prop title="Q4 Report"

## 安装

单一自包含可执行文件,.NET 运行时已内嵌 -- 无需安装任何依赖,无需管理运行时。
本 fork 不发布独立 release。请从源码构建:

**一键安装:**
**前置条件:**
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)

```bash
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
git clone https://github.com/NextDoorLaoHuang-HF/OfficeCLI.git
cd OfficeCLI
dotnet publish src/officecli/officecli.csproj -c Release -r osx-arm64 --self-contained -o out
sudo cp out/officecli /usr/local/bin/
```

**或手动下载** [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases):

| 平台 | 文件名 |
|------|--------|
| macOS Apple Silicon | `officecli-mac-arm64` |
| macOS Intel | `officecli-mac-x64` |
| Linux x64 | `officecli-linux-x64` |
| Linux ARM64 | `officecli-linux-arm64` |
| Windows x64 | `officecli-win-x64.exe` |
| Windows ARM64 | `officecli-win-arm64.exe` |
**其他平台:** 将 `osx-arm64` 替换为 `osx-x64`、`linux-x64`、`linux-arm64`、`win-x64` 或 `win-arm64`。

验证安装:`officecli --version`

**或从已下载的二进制文件自安装(直接运行 `officecli` 也会触发安装):**

```bash
officecli install # 显式安装
officecli # 直接运行也会触发安装
```

OfficeCLI 会在后台自动检查更新。通过 `officecli config autoUpdate false` 关闭,或通过 `OFFICECLI_SKIP_UPDATE=1` 跳过单次检查。配置文件位于 `~/.officecli/config.json`。
> **提示:** 如需上游原始 release(含预编译二进制),请见 [iOfficeAI/OfficeCLI](https://github.com/iOfficeAI/OfficeCLI#安装)。

## 核心功能

Expand Down
Loading