Skip to content

feat(setup-aionui): AionUI 集成 — 一键安装 Track Changes 技能 + 注册 Word 修订助手#131

Open
NextDoorLaoHuang-HF wants to merge 10 commits into
iOfficeAI:mainfrom
NextDoorLaoHuang-HF:feat/revision-preview-and-toolbar
Open

feat(setup-aionui): AionUI 集成 — 一键安装 Track Changes 技能 + 注册 Word 修订助手#131
NextDoorLaoHuang-HF wants to merge 10 commits into
iOfficeAI:mainfrom
NextDoorLaoHuang-HF:feat/revision-preview-and-toolbar

Conversation

@NextDoorLaoHuang-HF
Copy link
Copy Markdown
Contributor

概述

新增 officecli setup-aionui 命令,一键将 OfficeCLI 的 Track Changes 功能集成到 AionUI 桌面应用中。

功能

  • 自动检测 AionUI 配置目录(macOS / Linux / Windows)
  • 安装技能文件 officecli-track-changes/SKILL.md,定义 OOXML 修订能力
  • 注册助手 "Word 修订助手"(ID 前缀 custom-officecli-revision-*),预配置 officecli-docx + officecli-track-changes 技能
  • 自动备份 修改 aionui-config.txt 前创建 .bak 备份
  • 幂等性 重复执行检测到已安装/已注册状态,不会重复注册
  • 支持 flag--dry-run--verbose--force

文件变更

文件 说明
src/officecli/Core/AionuiInstaller.cs 核心安装器:检测、安装、注册、编码/解码
src/officecli/Program.cs 早期分发:setup-aionui 在 mcp / install 之前执行
src/officecli/Core/SkillInstaller.cs 技能映射:添加 track-changes 条目
skills/officecli-track-changes/SKILL.md 技能文件:OOXML Track Changes 能力定义

测试结果

构建

dotnet build → 0 errors, 1 warning (NU1902: OpenMcdf 预存漏洞)

端到端测试(macOS arm64)

$ officecli setup-aionui --verbose
AionUI detected at: ~/Library/Application Support/AionUI/config

  ✓ Skill installed: .../skills/officecli-track-changes/SKILL.md
  Backed up config to: .../aionui-config.txt.bak
  ✓ Assistant registered: Word 修订助手 (id: custom-officecli-revision-xxx)

Done! Restart AionUI to see "Word 修订助手" in the assistant list.

验证清单

  • 技能文件已安装且内容匹配源文件
  • 助手已注册到 assistants 数组,无重复
  • 助手属性正确:id 前缀 custom-officecli-revision-enabledSkills 包含两个技能、isPreset=truepresetAgentType=opencode
  • 原始配置已备份为 .bak
  • 幂等性:重复执行返回 "already up to date" / "already registered"
  • --force 覆盖现有助手条目(新 ID),无重复
  • --dry-run 预览模式正常工作

助手配置示例

{
  "id": "custom-officecli-revision-1779860156330",
  "name": "Word 修订助手",
  "description": "专注 Word 文档修订(Track Changes)的助手,支持查找替换修订、格式修订、接受/拒绝修订。",
  "avatar": "📝",
  "isPreset": true,
  "isBuiltin": false,
  "presetAgentType": "opencode",
  "enabled": true,
  "enabledSkills": ["officecli-docx", "officecli-track-changes"],
  "customSkillNames": []
}

…preview

Add visual indicators for revision types that were previously invisible
in the HTML preview (view html / watch):

- rPrChange: yellow highlight with bottom border on affected runs
- pPrChange: yellow highlight with left border on affected paragraphs
- tblPrChange: yellow highlight with left border on affected tables
- Table row ins/del/moveFrom/moveTo: flatten revision-wrapped rows
  and apply green (ins) / red strikethrough (del) row styling
- Add CSS classes: .track-format, .track-ins-row, .track-del-row

Before this change, only w:ins and w:del run-level revisions were
visible. Format changes and table row revisions were silently absent
from the preview.
Add three new HTTP endpoints to the watch server:

- POST /api/revision/accept — accept all tracked changes
- POST /api/revision/reject — reject all tracked changes
- GET /api/revision/count — return revision count as JSON

All endpoints spawn officecli commands (following the existing
/api/edit pattern) and notify SSE clients with a "full" refresh
after accept/reject operations.

Additionally, inject a floating revision toolbar into watch HTML
output for Word documents:

- Shows revision count badge (fetched from /api/revision/count)
- Accept All (green) / Reject All (red) buttons
- Auto-hides when no revisions exist
- Only appears for Word documents (detected by data-block markers)
- Refreshes automatically via SSE update events

This enables AionUI and other watch consumers to provide revision
management without any frontend code changes.
- acceptallchanges=all → revision.action=accept
- rejectallchanges=all → revision.action=reject
- path / → /revision
- update doc comments
- Add AionuiInstaller.cs: one-shot integration that installs
  officecli-track-changes skill and registers Word 修订助手 assistant
- Add skills/officecli-track-changes/SKILL.md: skill file defining
  OOXML Track Changes capabilities for AionUI agents
- Add SkillInstaller entry for track-changes skill
- Add early dispatch for setup-aionui command in Program.cs
  (placed between mcp and install blocks for early exit)
- Supports --dry-run, --verbose, and --force flags
- Auto-detects AionUI config directory across macOS/Linux/Windows
- Handles base64url-encoded aionui-config.txt
- Idempotent: detects existing skill and assistant, skips re-registration
- Creates .bak backup before modifying config
- Named id prefix custom-officecli-revision-* for easy identification
… fallback

- Primary check: _setupBy == 'officecli' marker field (deterministic)
- Fallback: name match via ToString() (avoids GetValue<string>() edge cases)
- Added _setupBy marker to all new assistant entries
- Show visual preview after revisions when client supports web pages
- AionUI: no action (watch server already shows live preview)
- CLI-only: fall back to text summary via query revision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant