feat: 新增 .doc 格式支持,借助 LibreOffice soffice

- 提取 LibreOffice 解析逻辑为公共工具函数 _utils.parse_via_libreoffice()
- 新增 DocReader 独立 Reader,支持 .doc 格式
- 新增 is_valid_doc() 文件验证函数(复用 OLE2 检测)
- 新增 doc 格式依赖配置(独立配置)
- 新增完整的测试套件,使用静态测试文件
- 更新 README.md 和 SKILL.md,添加 .doc 格式支持说明
- 新增 openspec/specs/doc-reader/spec.md 规范文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 10:40:43 +08:00
parent 0dd7aa221c
commit e0c6ed1638
14 changed files with 274 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
---
name: lyxy-document-reader
description: 统一文档解析工具 - 将 DOCX、XLS、XLSX、PPTX、PDF、HTML/URL 转换为 Markdown。支持全文输出、字数统计、行数统计、标题提取、章节提取、正则搜索。当用户要求"读取/解析/打开文档"、上传 .docx/.xls/.xlsx/.pptx/.pdf/.html 文件、或提供 URL 时使用。
description: 统一文档解析工具 - 将 DOC、DOCX、XLS、XLSX、PPTX、PDF、HTML/URL 转换为 Markdown。支持全文输出、字数统计、行数统计、标题提取、章节提取、正则搜索。当用户要求"读取/解析/打开文档"、上传 .doc/.docx/.xls/.xlsx/.pptx/.pdf/.html 文件、或提供 URL 时使用。
license: MIT
compatibility: Requires Python 3.11+。优先使用 lyxy-runner-python skill次选 uv run --with降级到主机 Python。
---
@@ -26,6 +26,7 @@ python scripts/lyxy_document_reader.py <文件路径或URL>
## Purpose
**支持格式**
- DOCWord 旧格式)
- DOCXWord 文档)
- XLSExcel 旧格式)
- XLSXExcel 表格)
@@ -44,8 +45,8 @@ python scripts/lyxy_document_reader.py <文件路径或URL>
### 触发词
- 中文:"读取/解析/打开 文档/Word/Excel/PPT/PDF/网页"
- 英文:"read/parse/extract document/docx/xls/xlsx/pptx/pdf/html"
- 文件扩展名:`.docx``.xls``.xlsx``.pptx``.pdf``.html``.htm`
- 英文:"read/parse/extract document/doc/docx/xls/xlsx/pptx/pdf/html"
- 文件扩展名:`.doc``.docx``.xls``.xlsx``.pptx``.pdf``.html``.htm`
- URL`http://``https://`
## Quick Reference