feat: Expand PPT tools to 85 with 6 major advanced capabilities

Major changes:
- PPT tools expanded from 6 to 85 (data visualization, smart layout,
  advanced animations, flowcharts/org charts, master operations, 3D effects)
- Add cross-app data caching mechanism (Excel→PPT data transfer)
- Remove python-pptx dependency (now pure JS implementation)
- Update bilingual README with new tool counts (196 total)
- Simplify macOS install script (5 steps, no Python required)

New PPT capabilities:
- Data visualization: progress bars, gauges, mini charts, donut charts
- Smart layout: auto-layout, smart distribute, grid creation
- Advanced animations: preset groups, emphasis animations
- Flowcharts: flowcharts, org charts, timelines
- Master operations: get/set background, add elements
- 3D effects: rotation, depth, material, 3D text

Co-Authored-By: Claude (claude-opus-4-5-thinking) <noreply@anthropic.com>
This commit is contained in:
PandaAI
2026-01-28 20:38:44 +08:00
parent 104bb09b7a
commit e14d1a7fbb
6 changed files with 3607 additions and 70 deletions
-9
View File
@@ -73,9 +73,6 @@ Claude Code → MCP Server (HTTP服务端:58891) ← 轮询 ← WPS加载项 (HT
- 如果不存在,提示用户先安装 WPS Office: https://www.wps.cn/product/wpsmac
3. **检测 Node.js** - 运行 `node -v`,需要 >= 18.0.0
- 如果未安装,提示用户安装: https://nodejs.org/
4. **检测 Python3** - 运行 `python3 --version`
5. **检测 python-pptx** - 用于 PPT 自动化功能
- 如果未安装:`pip3 install python-pptx`
### 第二步:克隆项目
@@ -147,12 +144,6 @@ cat ~/.claude/settings.json | grep wps-office
2. 重启 Claude Code 使配置生效
3. WPS 加载项已正确安装(目录名必须以 `_` 结尾)
### Mac: 需要手动切换应用
正常情况下系统会自动切换应用,如果自动切换失败:
1. 检查 `python-pptx` 是否安装:`python3 -c "import pptx"`
2. 检查 `wps-auto.sh` 脚本权限:`chmod +x wps-auto.sh`
### Mac: 加载项未加载
尝试:
+27 -16
View File
@@ -174,21 +174,30 @@ powershell -ExecutionPolicy Bypass -File scripts/auto-install.ps1
| 保存文档 | 保存当前文档 | ✅ | ✅ |
| 导出PDF | 转换为PDF格式 | ✅ | ✅ |
### PPT 功能
### PPT 功能 (85个已实现)
| 功能 | 说明 | Windows | macOS |
|------|------|---------|-------|
| 获取演示文稿信息 | 名称、页数、形状列表 | ✅ | 🔧 |
| 新增幻灯片 | 多种布局可选 | ✅ | 🔧 |
| 设置标题 | 修改幻灯片标题 | ✅ | 🔧 |
| 添加文本框 | 自定义位置和样式 | ✅ | 🔧 |
| 统一字体 | 全文字体统一 | ✅ | 🔧 |
| 美化幻灯片 | 商务/科技/创意/简约风格 | ✅ | 🔧 |
| 添加形状 | 插入各种形状 | 🚧 | 🚧 |
| 添加动画 | 进入/退出动画 | 🚧 | 🚧 |
| 设置主题 | 应用PPT主题 | 🚧 | 🚧 |
| 分类 | 数量 | 功能 | Windows | macOS |
|------|------|------|---------|-------|
| 演示文稿操作 | 5 | 创建/打开/关闭/切换演示文稿 | ✅ | |
| 幻灯片操作 | 9 | 添加/删除/复制/移动/切换幻灯片 | ✅ | |
| 文本框操作 | 5 | 添加/删除/设置文本框 | ✅ | |
| 标题操作 | 4 | 设置/获取标题/副标题/内容 | ✅ | |
| 形状操作 | 14 | 添加/删除/样式/阴影/渐变/边框/透明度 | ✅ | |
| 对齐分布 | 4 | 对齐/分布/组合/自动布局 | ✅ | |
| 图片操作 | 3 | 插入/删除/设置图片样式 | | |
| 表格操作 | 7 | 插入/设置单元格/样式/专业表格 | | |
| 图表操作 | 3 | 插入/设置数据/样式 | | |
| 动画效果 | 6 | 添加/删除/预设动画组/强调动画 | ✅ | ✅ |
| 切换效果 | 3 | 设置/删除/应用到全部 | ✅ | ✅ |
| 主题/背景 | 5 | 背景色/图片/渐变/配色方案 | ✅ | ✅ |
| 数据可视化 | 4 | 进度条/仪表盘/迷你图/环形图 | ✅ | ✅ |
| 流程图/架构图 | 3 | 流程图/组织架构图/时间轴 | ✅ | ✅ |
| 母版操作 | 3 | 获取/设置背景/添加元素 | ✅ | ✅ |
| 3D效果 | 4 | 3D旋转/深度/材质/3D文字 | ✅ | ✅ |
| 专业美化 | 7 | 一键美化/KPI卡片/装饰条/页码 | ✅ | ✅ |
| 其他 | 6 | 超链接/页眉页脚/查找替换/放映 | ✅ | ✅ |
> 图例:✅ 已测试通过 | 🔧 待测试 | 🚧 开发中 | ⚠️ 已知问题
> 📌 PPT功能覆盖高端汇报场景包括6大类高端能力数据可视化、智能布局、高级动画、流程图/架构图、母版操作、3D效果
### 通用功能
@@ -211,10 +220,11 @@ macOS:
Claude Code → MCP Server (Node.js) → HTTP → WPS 加载项 (JS API) → WPS Office
```
- **MCP Server**: 29 个工具,处理 AI 请求
- **MCP Server**: 196 个工具,处理 AI 请求
- **Windows COM 桥接**: 通过 PowerShell 调用 WPS COM 接口Ket/Kwps/Kwpp
- **macOS HTTP 桥接**: 通过 HTTP 调用 WPS 加载项内置服务(端口 58891
- **WPS 加载项**: 显示连接状态Mac 上提供 HTTP API
- **跨应用数据缓存**: MCP Server层缓存机制支持Excel→PPT数据传递
---
@@ -279,8 +289,9 @@ WPS_Skills/
- [x] **Excel 条件格式** - 设置条件格式规则 ✅ 已完成
- [x] **Word 生成目录** - 自动生成文档目录 ✅ 已完成
- [x] **Word 插入图片** - 插入并调整图片位置 ✅ 已完成
- [ ] **PPT 添加动画** - 进入退出强调动画
- [ ] **PPT 设置主题** - 应用内置主题
- [x] **PPT 添加动画** - 进入/退出/强调动画 ✅ 已完成
- [x] **PPT 高端美化** - 6大类高端能力 ✅ 已完成
- [x] **跨应用数据传递** - Excel→PPT数据缓存机制 ✅ 已完成
### 中期计划 (v1.2)
+27 -16
View File
@@ -174,21 +174,30 @@ powershell -ExecutionPolicy Bypass -File scripts/auto-install.ps1
| Save Document | Save current document | ✅ | ✅ |
| Export PDF | Convert to PDF format | ✅ | ✅ |
### PPT Features
### PPT Features (85 implemented)
| Feature | Description | Windows | macOS |
|---------|-------------|---------|-------|
| Get Presentation Info | Name, slide count, shapes | ✅ | 🔧 |
| Add Slide | Multiple layouts | ✅ | 🔧 |
| Set Title | Modify slide title | ✅ | 🔧 |
| Add Text Box | Custom position and style | ✅ | 🔧 |
| Unify Font | Consistent fonts | ✅ | 🔧 |
| Beautify Slide | Business/Tech/Creative/Minimal | ✅ | 🔧 |
| Add Shape | Insert shapes | 🚧 | 🚧 |
| Add Animation | Enter/exit animations | 🚧 | 🚧 |
| Set Theme | Apply PPT themes | 🚧 | 🚧 |
| Category | Count | Features | Windows | macOS |
|----------|-------|----------|---------|-------|
| Presentation Operations | 5 | Create/Open/Close/Switch presentations | ✅ | |
| Slide Operations | 9 | Add/Delete/Duplicate/Move/Switch slides | ✅ | |
| Text Box Operations | 5 | Add/Delete/Set text boxes | ✅ | |
| Title Operations | 4 | Set/Get title/subtitle/content | ✅ | |
| Shape Operations | 14 | Add/Delete/Style/Shadow/Gradient/Border/Transparency | ✅ | |
| Alignment & Distribution | 4 | Align/Distribute/Group/Auto-layout | ✅ | |
| Image Operations | 3 | Insert/Delete/Style images | | |
| Table Operations | 7 | Insert/Set cells/Style/Professional tables | | |
| Chart Operations | 3 | Insert/Set data/Style | | |
| Animations | 6 | Add/Remove/Preset groups/Emphasis | ✅ | ✅ |
| Transitions | 3 | Set/Remove/Apply to all | ✅ | ✅ |
| Themes & Backgrounds | 5 | Background color/image/gradient/color scheme | ✅ | ✅ |
| Data Visualization | 4 | Progress bars/Gauges/Mini charts/Donut charts | ✅ | ✅ |
| Flowcharts & Org Charts | 3 | Flowcharts/Org charts/Timelines | ✅ | ✅ |
| Master Slide Operations | 3 | Get/Set background/Add elements | ✅ | ✅ |
| 3D Effects | 4 | 3D rotation/depth/material/3D text | ✅ | ✅ |
| Professional Beautification | 7 | One-click beautify/KPI cards/Decorations/Page indicators | ✅ | ✅ |
| Other | 6 | Hyperlinks/Headers footers/Find replace/Slideshow | ✅ | ✅ |
> Legend: ✅ Tested | 🔧 Pending test | 🚧 In development | ⚠️ Known issue
> 📌 PPT features cover high-end presentation scenarios with 6 major advanced capabilities: Data Visualization, Smart Layout, Advanced Animations, Flowcharts/Org Charts, Master Operations, 3D Effects
### Common Features
@@ -210,10 +219,11 @@ macOS:
Claude Code → MCP Server (Node.js) → HTTP → WPS Add-in (JS API) → WPS Office
```
- **MCP Server**: 29 tools handling AI requests
- **MCP Server**: 196 tools handling AI requests
- **Windows COM Bridge**: PowerShell calls WPS COM interfaces (Ket/Kwps/Kwpp)
- **macOS HTTP Bridge**: HTTP calls to WPS Add-in built-in service (port 58891)
- **WPS Add-in**: Shows connection status, provides HTTP API on Mac
- **Cross-app Data Cache**: MCP Server layer caching for Excel→PPT data transfer
---
@@ -278,8 +288,9 @@ WPS_Skills/
- [x] **Excel Conditional Formatting** - Set format rules ✅ Completed
- [x] **Word TOC Generation** - Auto generate table of contents ✅ Completed
- [x] **Word Insert Image** - Insert and position images ✅ Completed
- [ ] **PPT Animations** - Enter, exit, emphasis animations
- [ ] **PPT Themes** - Apply built-in themes
- [x] **PPT Animations** - Enter/exit/emphasis animations ✅ Completed
- [x] **PPT Advanced Beautification** - 6 major advanced capabilities ✅ Completed
- [x] **Cross-app Data Transfer** - Excel→PPT data caching mechanism ✅ Completed
### Mid-term (v1.2)
+6 -25
View File
@@ -38,7 +38,7 @@ echo ""
# ========== 前置条件检查 ==========
check_prerequisites() {
echo "========== [1/6] 前置条件检查 =========="
echo "========== [1/5] 前置条件检查 =========="
# 检查操作系统
if [[ "$(uname)" != "Darwin" ]]; then
@@ -68,31 +68,12 @@ check_prerequisites() {
fi
echo -e "${GREEN}✓ Node.js $(node -v)${NC}"
# 检查 python3
if ! command -v python3 &> /dev/null; then
echo -e "${RED}❌ 错误: 未找到 Python3${NC}"
exit 1
fi
echo -e "${GREEN}✓ Python3 $(python3 --version | cut -d' ' -f2)${NC}"
# 检查 python-pptx (用于PPT自动化)
if ! python3 -c "import pptx" 2>/dev/null; then
echo -e "${YELLOW}⚠ python-pptx 未安装,正在安装...${NC}"
pip3 install python-pptx --quiet || {
echo -e "${YELLOW}⚠ pip3 安装失败,尝试 pip...${NC}"
pip install python-pptx --quiet || {
echo -e "${RED}❌ 无法安装 python-pptxPPT自动切换功能可能受影响${NC}"
}
}
fi
echo -e "${GREEN}✓ python-pptx 已安装${NC}"
echo ""
}
# ========== 检查加载项目录 ==========
check_addon_dir() {
echo "========== [2/6] 检查加载项目录 =========="
echo "========== [2/5] 检查加载项目录 =========="
if [ -d "$WPS_ADDON_DIR" ]; then
echo -e "${GREEN}✓ 加载项目录存在${NC}"
@@ -106,7 +87,7 @@ check_addon_dir() {
# ========== 安装加载项 ==========
install_addon() {
echo "========== [3/6] 安装 WPS Claude助手 加载项 =========="
echo "========== [3/5] 安装 WPS Claude助手 加载项 =========="
# 检查源目录
if [ ! -d "$ADDON_SOURCE" ]; then
@@ -132,7 +113,7 @@ install_addon() {
# ========== 更新 publish.xml ==========
update_publish_xml() {
echo "========== [4/6] 更新加载项配置 =========="
echo "========== [4/5] 更新加载项配置 =========="
PUBLISH_XML="$WPS_ADDON_DIR/publish.xml"
@@ -150,7 +131,7 @@ EOF
# ========== 构建 MCP Server ==========
build_mcp_server() {
echo "========== [5/6] 构建 MCP Server =========="
echo "========== [5/5] 构建 MCP Server =========="
MCP_DIR="$PROJECT_DIR/wps-office-mcp"
@@ -181,7 +162,7 @@ build_mcp_server() {
# ========== 配置 Claude Code ==========
configure_claude_code() {
echo "========== [6/6] 配置 Claude Code MCP 设置 =========="
echo "========== [+] 配置 Claude Code MCP 设置 =========="
MCP_INDEX_PATH="$PROJECT_DIR/wps-office-mcp/dist/index.js"
File diff suppressed because it is too large Load Diff
+217
View File
@@ -52,6 +52,9 @@ export class WpsMcpServer {
private readonly registry: ToolRegistry;
private isRunning: boolean = false;
// 跨应用数据缓存 - 解决macOS WPS无法跨应用操作的P0问题
private static dataCache: Map<string, { data: unknown; timestamp: number; appType: string }> = new Map();
constructor(config?: Partial<McpServerConfig>) {
this.config = { ...DEFAULT_CONFIG, ...config };
this.registry = toolRegistry;
@@ -454,6 +457,220 @@ export class WpsMcpServer {
}
);
// ==================== 跨应用数据缓存工具 ====================
// 解决macOS WPS加载项无法跨应用操作的P0问题
// Excel读取数据 → 缓存到MCP Server → PPT获取缓存 → 创建演示文稿
// 缓存数据
this.registry.register(
{
name: 'wps_cache_data',
description: '缓存数据到MCP Server用于跨应用数据传递。例如从Excel读取数据后缓存然后在PPT中使用。',
inputSchema: {
type: 'object',
properties: {
key: {
type: 'string',
description: '缓存键名,用于后续获取数据',
},
data: {
type: 'object',
description: '要缓存的数据任意JSON对象',
},
appType: {
type: 'string',
description: '数据来源应用类型et表格、wps文字、wpp演示',
enum: ['et', 'wps', 'wpp'],
},
},
required: ['key', 'data'],
},
category: ToolCategory.COMMON,
},
async (args) => {
const key = args.key as string;
const data = args.data;
const appType = (args.appType as string) || 'unknown';
WpsMcpServer.dataCache.set(key, {
data,
timestamp: Date.now(),
appType,
});
logger.info(`Data cached: key=${key}, appType=${appType}`);
return {
id: '',
success: true,
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
key,
message: `数据已缓存,可在其他应用中通过 wps_get_cached_data 获取`,
cacheSize: WpsMcpServer.dataCache.size,
}),
},
],
};
}
);
// 获取缓存数据
this.registry.register(
{
name: 'wps_get_cached_data',
description: '从MCP Server获取缓存的数据用于跨应用数据传递。',
inputSchema: {
type: 'object',
properties: {
key: {
type: 'string',
description: '缓存键名',
},
},
required: ['key'],
},
category: ToolCategory.COMMON,
},
async (args) => {
const key = args.key as string;
const cached = WpsMcpServer.dataCache.get(key);
if (!cached) {
return {
id: '',
success: false,
content: [
{
type: 'text',
text: JSON.stringify({
success: false,
error: `缓存键 "${key}" 不存在`,
availableKeys: Array.from(WpsMcpServer.dataCache.keys()),
}),
},
],
};
}
logger.info(`Cache hit: key=${key}, age=${Date.now() - cached.timestamp}ms`);
return {
id: '',
success: true,
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
key,
data: cached.data,
appType: cached.appType,
cachedAt: new Date(cached.timestamp).toISOString(),
}),
},
],
};
}
);
// 列出所有缓存
this.registry.register(
{
name: 'wps_list_cache',
description: '列出MCP Server中所有缓存的数据键名',
inputSchema: {
type: 'object',
properties: {},
},
category: ToolCategory.COMMON,
},
async () => {
const cacheList = Array.from(WpsMcpServer.dataCache.entries()).map(([key, value]) => ({
key,
appType: value.appType,
cachedAt: new Date(value.timestamp).toISOString(),
ageMs: Date.now() - value.timestamp,
}));
return {
id: '',
success: true,
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
count: cacheList.length,
caches: cacheList,
}),
},
],
};
}
);
// 清除缓存
this.registry.register(
{
name: 'wps_clear_cache',
description: '清除MCP Server中的缓存数据',
inputSchema: {
type: 'object',
properties: {
key: {
type: 'string',
description: '要清除的缓存键名,不指定则清除所有缓存',
},
},
},
category: ToolCategory.COMMON,
},
async (args) => {
const key = args.key as string | undefined;
if (key) {
const deleted = WpsMcpServer.dataCache.delete(key);
logger.info(`Cache cleared: key=${key}, deleted=${deleted}`);
return {
id: '',
success: true,
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
message: deleted ? `缓存 "${key}" 已清除` : `缓存 "${key}" 不存在`,
}),
},
],
};
} else {
const count = WpsMcpServer.dataCache.size;
WpsMcpServer.dataCache.clear();
logger.info(`All cache cleared: count=${count}`);
return {
id: '',
success: true,
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
message: `已清除所有缓存,共 ${count}`,
}),
},
],
};
}
}
);
logger.info(`Registered ${this.registry.size} built-in tools`);
}