Communitygithub.com

cli-anything-libreoffice

一個有狀態的命令列工具,用於編輯文件、產生真正的 ODF 檔案(ZIP 壓縮檔內含 XML),不需 GUI 或安裝 LibreOffice。

cli-anything-libreoffice 是什麼?

這是一個專為 AI 代理與進階使用者設計的 CLI 工具,可建立與操作 LibreOffice Writer、Calc 與 Impress 文件,並直接生成標準的 ODF 格式(ZIP + XML),無需圖形介面或完整的 LibreOffice 安裝。它支援互動式 REPL 模式、批次指令,以及結構化 JSON 輸出,便於程控與代理使用。工具內建專案管理、樣式編輯、匯出/匯入(支援 DOCX、XLSX、PPTX 等格式),並具備多達 50 層的復原/重做歷史與會話追蹤。支援的平台包含所有可安裝 Python 3.10+ 與 LibreOffice 的作業系統。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-libreoffice

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

cli-anything-libreoffice 是做什麼的?

一個有狀態的命令列介面,用於文件編輯,可產生真正的 ODF 檔案(ZIP 壓縮檔內含 XML)。專為 AI 代理與進階使用者設計,無需 GUI 或安裝 LibreOffice 即可建立與操作 Writer、Calc 及 Impress 文件。

安裝

此 CLI 作為 cli-anything-libreoffice 套件的一部分安裝:

pip install cli-anything-libreoffice

必要條件:

  • Python 3.10+
  • 系統上必須安裝 libreoffice

使用方式

基本指令

# 顯示說明
cli-anything-libreoffice --help

# 啟動互動式 REPL 模式
cli-anything-libreoffice

# 建立新專案
cli-anything-libreoffice project new -o project.json

# 以 JSON 輸出執行(供代理使用)
cli-anything-libreoffice --json project info -p project.json

REPL 模式

當不帶子指令執行時,CLI 會進入互動式 REPL 工作階段:

cli-anything-libreoffice
# 以 Tab 補全與歷史紀錄功能互動輸入指令

指令群組

Document

文件管理指令。

指令說明
new建立新文件
open開啟專案 JSON,或匯入現有的 Office/ODF 檔案
import將現有的 Office/ODF 檔案匯入為專案 JSON
import-formats列出支援的匯入格式
save儲存目前文件
info顯示文件資訊
profiles列出可用的頁面設定檔
json列印原始專案 JSON

Writer

Writer(文書處理)指令。

指令說明
add-paragraph在文件中新增段落
add-heading在文件中新增標題
add-list在文件中新增清單
add-table在文件中新增表格
add-page-break新增分頁符號
remove依索引移除內容項目
list列出所有內容項目
set-text設定內容項目的文字

Calc

Calc(試算表)指令。

指令說明
add-sheet新增工作表
remove-sheet依索引移除工作表
rename-sheet重新命名工作表
set-cell設定儲存格值
get-cell取得儲存格值
list-sheets列出所有工作表

Impress

Impress(簡報)指令。

指令說明
add-slide在簡報中新增投影片
remove-slide依索引移除投影片
set-content更新投影片的標題及/或內容
list-slides列出所有投影片
add-element在投影片中新增元素

Style Group

樣式管理指令。

指令說明
create建立新樣式
modify修改現有樣式
list列出所有樣式
apply將樣式套用至內容項目(僅限 Writer)
remove移除樣式

Export Group

匯出/轉譯指令。

指令說明
presets列出匯出預設值
preset-info顯示預設值詳細資料
render將文件匯出為檔案

Session

工作階段管理指令。

指令說明
status顯示工作階段狀態
undo復原上一個操作
redo重做上一個被復原的操作
history顯示復原歷史紀錄

範例

建立新專案

建立新的 LibreOffice 專案檔案。

cli-anything-libreoffice project new -o myproject.json
# 或以 JSON 輸出供程式使用
cli-anything-libreoffice --json project new -o myproject.json

互動式 REPL 工作階段

啟動支援復原/重做的互動式工作階段。

cli-anything-libreoffice
# 互動輸入指令
# 使用 'help' 檢視可用指令
# 使用 'undo' 和 'redo' 瀏覽歷史紀錄

匯出專案

將專案匯出為最終輸出格式。

cli-anything-libreoffice --project myproject.json export render output.pdf --overwrite

狀態管理

CLI 會維護工作階段狀態,包含:

  • 復原/重做:最多 50 層的歷史紀錄
  • 專案持久性:將專案狀態儲存/載入為 JSON
  • 匯入現有檔案:將 ODF/DOCX/XLSX/PPTX 及相關格式轉換為可編輯的專案 JSON
  • 工作階段追蹤:記錄修改與變更

輸出格式

所有指令皆支援雙重輸出模式:

  • 人類可讀(預設):表格、色彩、格式化文字
  • 機器可讀(--json 旗標):結構化 JSON,供代理使用
# 人類可讀輸出
cli-anything-libreoffice project info -p project.json

# 供代理使用的 JSON 輸出
cli-anything-libreoffice --json project info -p project.json

供 AI 代理使用

以程式方式使用此 CLI 時:

  1. 一律使用 --json 旗標 取得可剖析輸出
  2. 檢查回傳碼 - 0 表示成功,非零表示錯誤
  3. 剖析 stderr 以取得失敗時的錯誤訊息
  4. 對所有檔案操作使用絕對路徑
  5. 先將現有 Office 檔案匯入為 JSON:document import input.docx -o work.json
  6. 匯出操作後確認輸出檔案已存在

更多資訊

  • 完整文件:請參閱套件中的 README.md
  • 測試涵蓋範圍:請參閱套件中的 TEST.md
  • 方法論:請參閱 cli-anything-plugin 中的 HARNESS.md

版本

1.0.0

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相關技能