cli-anything-libreoffice
A stateful command-line interface for document editing, producing real ODF files (ZIP archives with XML). Designed for AI agents and power users who need to create and manipulate Writer, Calc, and Impress documents without a GUI or LibreOffice installation.
Installation
This CLI is installed as part of the cli-anything-libreoffice package:
Prerequisites:
- Python 3.10+
- libreoffice must be installed on your system
Usage
Basic Commands
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
Command Groups
Document
Document management commands.
Writer
Writer (word processor) commands.
Calc
Calc (spreadsheet) commands.
Impress
Impress (presentation) commands.
Style Group
Style management commands.
Export Group
Export/render commands.
Session
Session management commands.
Examples
Create a New Project
Create a new libreoffice project file.
Interactive REPL Session
Start an interactive session with undo/redo support.
Export Project
Export the project to a final output format.
State Management
The CLI maintains session state with:
- Undo/Redo: Up to 50 levels of history
- Project persistence: Save/load project state as JSON
- Existing file import: Convert ODF/DOCX/XLSX/PPTX and related formats into editable project JSON
- Session tracking: Track modifications and changes
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (
--jsonflag): Structured JSON for agent consumption
For AI Agents
When using this CLI programmatically:
- Always use
--jsonflag for parseable output - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use absolute paths for all file operations
- Import existing Office files to JSON first with
document import input.docx -o work.json - Verify outputs exist after export operations
More Information
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything-plugin
Version
1.0.0

