Skip to content

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CLI-Anything OnlyOffice v4.4.19

Programmatic control over Documents (.docx), Spreadsheets (.xlsx), Presentations (.pptx), PDFs, and RDF Knowledge Graphs — designed for AI agents.

132 commands. 7 categories. Full JSON output. Production-safe.

Part of the SLOANE OS agent stack. Agents call this via cli_anything_run(tool='onlyoffice', ...).


Installation

git clone https://github.com/noonr48/cli-anything-onlyoffice.git
cd cli-anything-onlyoffice

python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate

pip install -e .

# Verify
cli-anything-onlyoffice setup-check --json
cli-anything-onlyoffice status --json

To re-activate in a future shell session:

source /path/to/cli-anything-onlyoffice/.venv/bin/activate
cli-anything-onlyoffice status --json
cli-anything-onlyoffice setup-check --json

When calling from SLOANE OS or another agent, invoke via the venv binary directly so you don't depend on the shell's active environment:

/path/to/cli-anything-onlyoffice/.venv/bin/cli-anything-onlyoffice status --json

Dependencies

Library Purpose Required
python-docx>=1.1.0 .docx manipulation Core
openpyxl>=3.1.2 .xlsx manipulation + charts Core
python-pptx>=0.6.23 .pptx manipulation Core
rdflib>=7.0.0 RDF graph / SPARQL Core
lxml>=4.9.0 XML parsing for OOXML Core
scipy>=1.11.0 Statistical tests Core
PyMuPDF>=1.24.0 PDF image extraction + native block/span reading + page rendering Core
Pillow>=10.0.0 Image format conversion Core
pyshacl>=0.25.0 SHACL validation Core

pip install -e . installs all Python dependencies, including pyshacl. setup-check --json is the strict post-clone/post-pull gate: it also verifies external runtime dependencies that pip cannot install, including Docker and the onlyoffice-documentserver x2t converter. Use setup-check --live-smoke --json when you also want a real DOCX-to-PDF smoke through the running OnlyOffice converter.


Architecture

cli-anything-onlyoffice <command> [args] [--json]
        │
        ▼
  core/cli.py          ← Bootstrap + prefix routing
  core/general_cli.py  ← General commands + alias compatibility
  core/doc_cli.py      ← Dedicated DOCX CLI parsing/dispatch
  core/xlsx_cli.py     ← Dedicated XLSX/chart CLI parsing/dispatch
        │
        ▼
utils/docserver.py     ← Shared editor/render backend + lightweight modality wrappers
utils/doc_ops.py       ← Dedicated DOCX submission/runtime operations
utils/xlsx_ops.py      ← Dedicated XLSX/chart runtime operations
utils/pdf_ops.py       ← Dedicated PDF operations module
utils/pptx_ops.py      ← Dedicated PPTX operations module
utils/rdf_ops.py       ← Dedicated RDF graph operations module
  ├── Documents        ← python-docx wrapper + image extraction
  ├── Spreadsheets     ← openpyxl wrapper + scipy stats + data validation
  ├── Presentations    ← python-pptx wrapper + spatial awareness + preview
  ├── PDF              ← PyMuPDF wrapper (native blocks/spans, image extraction, page rendering)
  └── RDF              ← rdflib 7 wrapper

Production-Safety Features

Every write operation goes through four safeguards:

  • Atomic saves — writes to a temp file, then os.replace(). No partial writes.
  • Two-layer file lockingthreading.Lock (per-path, intra-process) + fcntl.flock(LOCK_EX) (cross-process). Both layers are required: fcntl.flock is per-process on Linux and does not serialise threads within the same process.
  • Automatic backup snapshots — pre-save copy written to ~/.cli-anything/backups/ before every mutation.

Universal Flags

Flag Effect
--json Machine-readable JSON output (always use this with agents)

All responses have {"success": true, ...} or {"success": false, "error": "..."}.


Mode 1 — Documents (.docx)

37 commands — full lifecycle from creation to APA references and citation/reference audits, plus image extraction, rendered page preview, submission preflight, rendered layout/font auditing, whole-document normalization, submission packaging, and hidden-data sanitization.

.docx files are OOXML containers, so generic text file readers will often treat them as binary. For agent use, rely on the semantic document commands below (doc-read, doc-append, doc-replace, doc-search, doc-read-tables) rather than raw file reads.

Document Defaults

Every document created with doc-create is pre-configured for academic/APA use:

Setting Value
Page size A4 (210 × 297 mm)
Margins 1.0" all sides (top, bottom, left, right)
Font Calibri 11pt
Line spacing Double (APA 7th edition)
Space after paragraph 0pt

These defaults apply to all body paragraphs including those added via doc-append. Use doc-layout to override page size or margins on an existing file.

Core CRUD

doc-create <file> <title> <content>

Create a new .docx document.

cli-anything-onlyoffice doc-create /tmp/essay.docx "My Essay" "Introduction paragraph here" --json
{"success": true, "file": "/tmp/essay.docx", "title": "My Essay", "size": 8192}

doc-read <file>

Read all content — paragraphs, tables, full text.

cli-anything-onlyoffice doc-read /tmp/essay.docx --json
{
  "success": true,
  "file": "/tmp/essay.docx",
  "paragraphs": ["Introduction paragraph here"],
  "paragraph_count": 1,
  "full_text": "Introduction paragraph here"
}

doc-append <file> <content>

Append a paragraph to the end.

cli-anything-onlyoffice doc-append /tmp/essay.docx "Body paragraph with more detail." --json

doc-replace <file> <search> <replace>

Find and replace text (cross-run safe, preserves formatting).

cli-anything-onlyoffice doc-replace /tmp/essay.docx "draft" "final version" --json

doc-search <file> <text> [--case-sensitive]

Search paragraphs and tables for text, returns match locations.

cli-anything-onlyoffice doc-search /tmp/essay.docx "introduction" --json
cli-anything-onlyoffice doc-search /tmp/essay.docx "Introduction" --case-sensitive --json

doc-insert <file> <text> <index> [--style <name>]

Insert a paragraph at a specific position (0-based index).

cli-anything-onlyoffice doc-insert /tmp/essay.docx "New first paragraph" 0 --style "Heading 1" --json
cli-anything-onlyoffice doc-insert /tmp/essay.docx "A middle paragraph" 2 --json

doc-delete <file> <index>

Delete a paragraph by index (0-based).

cli-anything-onlyoffice doc-delete /tmp/essay.docx 3 --json

doc-word-count <file>

Word, character, and paragraph counts.

cli-anything-onlyoffice doc-word-count /tmp/essay.docx --json
{"success": true, "words": 450, "characters": 2780, "paragraphs": 8}

Formatting

doc-format <file> <paragraph_index> [options]

Apply rich formatting to a paragraph.

Options: --bold, --italic, --underline, --font-name <name>, --font-size <pts>, --color <RRGGBB>, --align <left|center|right|justify>

cli-anything-onlyoffice doc-format /tmp/essay.docx 0 --bold --font-size 18 --align center --json
cli-anything-onlyoffice doc-format /tmp/essay.docx 1 --italic --color FF0000 --json

doc-set-style <file> <index> <style>

Set a paragraph style by name.

cli-anything-onlyoffice doc-set-style /tmp/essay.docx 0 "Heading 1" --json
cli-anything-onlyoffice doc-set-style /tmp/essay.docx 1 "Normal" --json

Style names: Heading 1, Heading 2, Heading 3, Normal, Title, Subtitle, Quote, etc.

doc-list-styles <file>

List all available paragraph/character styles in the document.

cli-anything-onlyoffice doc-list-styles /tmp/essay.docx --json

doc-highlight <file> <search_text> [--color <name>]

Highlight matching text runs. Colors: yellow (default), cyan, green, pink, etc.

cli-anything-onlyoffice doc-highlight /tmp/essay.docx "important term" --color yellow --json

doc-formatting-info <file> [--all] [--start <n>] [--limit <n>]

Inspect paragraph and section formatting details. The default response keeps the first 10 paragraphs for compatibility; use --all, --start, or --limit to inspect later sections such as References. Paragraph entries include direct and style-resolved indents, raw w:ind, tab stops, line spacing, page-break-before, inline page breaks, and OOXML prefix warnings.

cli-anything-onlyoffice doc-formatting-info /tmp/essay.docx --json
cli-anything-onlyoffice doc-formatting-info /tmp/essay.docx --start 50 --limit 20 --json
cli-anything-onlyoffice doc-formatting-info /tmp/essay.docx --all --json

doc-font-audit <file> [--expected-font <name>] [--expected-font-size <pt>] [--rendered] [--pdf <path>]

Audit declared DOCX fonts and, with --rendered, actual PDF span fonts after OnlyOffice conversion. The report includes DOCX run counts, theme-font leftovers, optional fontconfig matching, rendered PDF font names/sizes, and examples of mismatches.

cli-anything-onlyoffice doc-font-audit /tmp/submission.docx \
  --expected-font "Times New Roman" --expected-font-size 12 --json
cli-anything-onlyoffice doc-font-audit /tmp/submission.docx \
  --expected-font "Times New Roman" --expected-font-size 12 --rendered --json
cli-anything-onlyoffice doc-font-audit /tmp/submission.docx \
  --expected-font "Times New Roman" --rendered --pdf /tmp/submission.pdf --json

Page Layout

doc-layout <file> [options]

Set page size, orientation, margins, header, and page numbers.

Options: --size A4|Letter, --orientation portrait|landscape, --margin-top <in>, --margin-bottom <in>, --margin-left <in>, --margin-right <in>, --header <text>, --page-numbers

cli-anything-onlyoffice doc-layout /tmp/submission.docx --size A4 --json
cli-anything-onlyoffice doc-layout /tmp/essay.docx --orientation landscape --json
cli-anything-onlyoffice doc-layout /tmp/report.docx \
  --margin-top 1.0 --margin-bottom 1.0 --margin-left 1.25 --margin-right 1.25 \
  --header "Research Report 2026" --page-numbers --json

doc-normalize-format <file> [output_path] [options]

Normalize common academic formatting across styles, visible runs, headers/footers, and reference paragraphs while reporting a text-preservation hash. Useful for applying a consistent student-submission format before rendered checks.

Options include --font, --body-size, --title-size, --line-spacing, --paragraph-after, --clear-theme-fonts, --skip-header-footer, --remove-style-borders, and --reference-hanging.

cli-anything-onlyoffice doc-normalize-format /tmp/submission.docx /tmp/submission-formatted.docx \
  --font "Times New Roman" --body-size 11 --title-size 12 \
  --line-spacing double --paragraph-after 12 --clear-theme-fonts \
  --remove-style-borders --reference-hanging 0.5 --json

Rich Content

doc-add-table <file> <headers_csv> <data_csv>

Add a table. Rows are separated by ;.

cli-anything-onlyoffice doc-add-table /tmp/essay.docx \
  "Name,Score,Grade" \
  "Alice,92,A;Bob,78,B;Charlie,85,B+" --json

doc-read-tables <file>

Read all tables from the document.

cli-anything-onlyoffice doc-read-tables /tmp/essay.docx --json
{
  "success": true,
  "tables": [
    {"rows": [["Name", "Score"], ["Alice", "92"]], "row_count": 2, "col_count": 2}
  ],
  "table_count": 1
}

doc-add-image <file> <image_path> [--width <inches>] [--caption <text>] [--paragraph <index>] [--position before|after]

Embed an image with optional caption. By default it appends to the end; use --paragraph with --position to anchor the figure before or after a specific paragraph.

cli-anything-onlyoffice doc-add-image /tmp/essay.docx /tmp/figure1.png --width 5.0 --caption "Figure 1: Overview" --json
cli-anything-onlyoffice doc-add-image /tmp/essay.docx /tmp/figure1.png \
  --paragraph 3 --position after --caption "Figure 1: Overview" --json

doc-extract-images <file> <output_dir> [--format png|jpg] [--prefix <name>]

Extract all embedded images from a .docx file and save as separate files.

cli-anything-onlyoffice doc-extract-images /tmp/essay.docx /tmp/extracted_images --format png --json
{
  "success": true,
  "images_extracted": 3,
  "images": [
    {"index": 0, "file": "/tmp/extracted_images/image_000.png", "width": 800, "height": 600, "size_bytes": 45320}
  ]
}

doc-to-pdf <file> [output_path] [--layout-warnings] [--profile auto|generic|apa-references]

Convert a .docx file to PDF using OnlyOffice DocumentServer's x2t converter (runs inside Docker). Requires onlyoffice-documentserver container to be running.

cli-anything-onlyoffice doc-to-pdf /tmp/report.docx --json
cli-anything-onlyoffice doc-to-pdf /tmp/report.docx /tmp/final-submission.pdf --json
cli-anything-onlyoffice doc-to-pdf /tmp/report.docx /tmp/final-submission.pdf --layout-warnings --profile apa-references --json
{
  "success": true,
  "input_file": "/tmp/report.docx",
  "output_file": "/tmp/report.pdf",
  "file_size": 15145,
  "pages": 1
}

doc-preview <file> <output_dir> [--pages <range>] [--dpi <n>] [--format png|jpg]

Render a DOCX as page images using the existing OnlyOffice conversion path plus PyMuPDF. Use this after figure insertion to inspect the actual rendered page layout.

cli-anything-onlyoffice doc-preview /tmp/report.docx /tmp/doc_previews --json
cli-anything-onlyoffice doc-preview /tmp/report.docx /tmp/doc_previews --pages 1-2 --dpi 200 --format jpg --json
{
  "success": true,
  "file": "/tmp/report.docx",
  "total_pages": 3,
  "pages_rendered": 2,
  "images": [
    {"page": 1, "file": "/tmp/doc_previews/page_001.jpg", "width": 1654, "height": 2339, "dpi": 200}
  ]
}

doc-render-map <file>

Build a deterministic render map that links DOCX paragraphs and table cells to OnlyOffice-rendered PDF pages, block ids, span ids, and bounding boxes. Use this when downstream review tooling needs native rendered anchors instead of heuristic page matching.

cli-anything-onlyoffice doc-render-map /tmp/report.docx --json

doc-render-audit <file> [--pdf <path>] [--tolerance-points <n>] [--profile auto|generic|apa-references]

Convert the DOCX to PDF, or audit an existing converted PDF with --pdf, then compare rendered line boxes against DOCX reference layout intent. auto uses APA References checks when a References heading exists and generic margin-envelope checks otherwise. Repeated header/footer artifacts are filtered before body/reference checks. Externally supplied PDFs are reported as untrusted for submission-ready claims unless they were produced by this conversion pipeline.

cli-anything-onlyoffice doc-render-audit /tmp/report.docx --json
cli-anything-onlyoffice doc-render-audit /tmp/report.docx --pdf /tmp/report.pdf --profile apa-references --json

doc-add-hyperlink <file> <text> <url> [--paragraph <index>]

Insert a hyperlink. Use --paragraph -1 (default) to add to a new paragraph.

cli-anything-onlyoffice doc-add-hyperlink /tmp/essay.docx "Click here" "https://example.com" --json
cli-anything-onlyoffice doc-add-hyperlink /tmp/essay.docx "Source" "https://doi.org/..." --paragraph 3 --json

doc-add-page-break <file>

Insert a page break at the end of the document.

cli-anything-onlyoffice doc-add-page-break /tmp/essay.docx --json

doc-add-list <file> <items> [--type bullet|number]

Add a bulleted or numbered list. Items separated by ;.

cli-anything-onlyoffice doc-add-list /tmp/essay.docx "First point;Second point;Third point" --type bullet --json
cli-anything-onlyoffice doc-add-list /tmp/essay.docx "Step one;Step two;Step three" --type number --json

Metadata & Annotations

doc-set-metadata <file> [options]

Set document properties: --author, --title, --subject, --keywords, --comments, --category

cli-anything-onlyoffice doc-set-metadata /tmp/essay.docx \
  --author "SLOANE Agent" --title "Research Essay" --keywords "health,survey,2026" --json

doc-get-metadata <file>

Read all document properties.

cli-anything-onlyoffice doc-get-metadata /tmp/essay.docx --json
{"success": true, "author": "SLOANE Agent", "title": "Research Essay", "created": "2026-04-07T10:00:00"}

doc-inspect-hidden-data <file>

Inspect hidden DOCX data relevant to submission workflows: comment parts/references, revision markup, custom XML parts, custom document properties, timestamps, page size, and core/app metadata.

cli-anything-onlyoffice doc-inspect-hidden-data /tmp/submission.docx --json

doc-preflight <file> [--expected-page-size <A4|Letter>] [--expected-font <name>] [--expected-font-size <pt>] [--rendered-layout] [--profile auto|generic|apa-references]

Run a submission-oriented DOCX preflight. This wraps hidden-data inspection, section page-size checks, OOXML prefix checks, visible text font audits, and inline-image sizing checks into a single pass/fail/warn report. Add --rendered-layout when submission readiness depends on the OnlyOffice-rendered PDF honoring margins, page breaks, and reference hanging indents.

cli-anything-onlyoffice doc-preflight /tmp/submission.docx --expected-page-size A4 --json
cli-anything-onlyoffice doc-preflight /tmp/submission.docx \
  --expected-page-size A4 --expected-font "Times New Roman" --expected-font-size 12 --json
cli-anything-onlyoffice doc-preflight /tmp/submission.docx \
  --expected-page-size A4 --expected-font "Times New Roman" --expected-font-size 12 \
  --rendered-layout --profile apa-references --json

doc-submission-pack <file> <output_dir> [options]

Create a clean submission bundle in one pass: sanitized/canonicalized DOCX, rendered PDF, sanitized PDF, hidden-data reports, rendered layout audit, rendered font audit, text-preservation fingerprint, and a JSON manifest. The manifest contains submission_ready plus exact blockers.

cli-anything-onlyoffice doc-submission-pack /tmp/submission.docx /tmp/submission-pack \
  --basename final-submission \
  --expected-page-size A4 \
  --expected-font "Times New Roman" \
  --expected-font-size 12 \
  --profile apa-references --json

Use --skip-docx-sanitize, --skip-pdf-sanitize, or --skip-rendered-layout only when you deliberately want a partial pack; skipped rendered layout blocks submission-ready claims.

doc-sanitize <file> [output_path] [options]

Sanitize a DOCX for submission. Useful options: --remove-comments, --accept-revisions, --clear-metadata, --remove-custom-xml, --set-remove-personal-information, --canonicalize-ooxml, and metadata overrides such as --author.

cli-anything-onlyoffice doc-sanitize /tmp/submission.docx /tmp/submission-clean.docx \
  --remove-comments --accept-revisions --clear-metadata --canonicalize-ooxml --author benbi --json

doc-comment <file> <comment> [--paragraph <index>]

Attach an OOXML comment annotation to a paragraph.

cli-anything-onlyoffice doc-comment /tmp/essay.docx "Review this section" --paragraph 2 --json

References (APA 7th)

doc-add-reference <file> <ref_json>

Add a reference to the sidecar .refs.json file.

cli-anything-onlyoffice doc-add-reference /tmp/essay.docx \
  '{"author": "Smith, J.", "year": "2023", "title": "Health Outcomes", "source": "Journal of Health", "type": "journal", "doi": "10.1234/jh.2023"}' --json

Supported types: journal, book, website, report, chapter

doc-build-references <file>

Build a formatted APA 7th edition References section from the sidecar .refs.json and append it to the document.

cli-anything-onlyoffice doc-build-references /tmp/essay.docx --json

doc-citation-audit <file> [--include-sidecar]

Run a read-only APA-like internal consistency audit between in-text citations and the DOCX References section. This does not use the network and does not verify source existence, DOI correctness, or whether a claim is supported by the source.

cli-anything-onlyoffice doc-citation-audit /tmp/essay.docx --json
cli-anything-onlyoffice doc-citation-audit /tmp/essay.docx --include-sidecar --json

Mode 2 — Spreadsheets (.xlsx)

39 commands — cell-level access, sheets, stats, CSV I/O, charts, data validation, and rendered export/preview.

Spreadsheet Defaults

Every sheet written with xlsx-write automatically:

  • Auto-fits column widths to content (min 12 chars, max 50 chars)
  • Sets A4 paper size (paperSize=9) for printing

Core CRUD

xlsx-create <file> [sheet_name]

Create a new empty spreadsheet.

cli-anything-onlyoffice xlsx-create /tmp/data.xlsx "Grades" --json

xlsx-write <file> <headers_csv> <data_csv> [options]

Write headers and rows. Row values separated by ,, rows by ;. Values starting with = become formulas.

Options: --sheet <name>, --overwrite (replace entire workbook), --coerce-rows (pad/trim row lengths), --text-columns <A,B> (force columns as text)

cli-anything-onlyoffice xlsx-write /tmp/grades.xlsx \
  "Student,Assignment1,Assignment2,Total" \
  "Alice,85,90,=B2+C2;Bob,78,82,=B3+C3;Charlie,92,88,=B4+C4" \
  --sheet Grades --json

xlsx-read <file> [sheet_name]

Read all data from a sheet (or all sheets if none specified).

cli-anything-onlyoffice xlsx-read /tmp/grades.xlsx Grades --json
cli-anything-onlyoffice xlsx-read /tmp/grades.xlsx --json  # reads all sheets

xlsx-append <file> <row_data_csv> [--sheet <name>]

Append a row to a sheet.

cli-anything-onlyoffice xlsx-append /tmp/grades.xlsx "Diana,91,87" --sheet Grades --json

xlsx-search <file> <text> [--sheet <name>]

Search for text across cells, returns exact cell addresses.

cli-anything-onlyoffice xlsx-search /tmp/grades.xlsx "Alice" --json
{"success": true, "matches": [{"sheet": "Grades", "cell": "A2", "value": "Alice"}], "count": 1}

Cell & Range Operations

xlsx-cell-read <file> <cell> [--sheet <name>]

Read the value of a single cell.

cli-anything-onlyoffice xlsx-cell-read /tmp/grades.xlsx B2 --sheet Grades --json
{"success": true, "cell": "B2", "value": 85, "type": "int"}

xlsx-cell-write <file> <cell> <value> [--sheet <name>] [--text]

Write a value to a single cell. --text forces the value to be stored as text (not parsed as number/formula).

cli-anything-onlyoffice xlsx-cell-write /tmp/grades.xlsx C2 95 --sheet Grades --json
cli-anything-onlyoffice xlsx-cell-write /tmp/grades.xlsx A1 "Student Name" --text --json

xlsx-range-read <file> <range> [--sheet <name>]

Read a rectangular range of cells.

cli-anything-onlyoffice xlsx-range-read /tmp/grades.xlsx A1:D4 --sheet Grades --json
{"success": true, "range": "A1:D4", "data": [["Student","A1","A2","Total"], ["Alice",85,90,175]]}

xlsx-delete-rows <file> <start_row> [count] [--sheet <name>]

Delete rows (1-indexed). count defaults to 1.

cli-anything-onlyoffice xlsx-delete-rows /tmp/grades.xlsx 3 --json  # delete row 3
cli-anything-onlyoffice xlsx-delete-rows /tmp/grades.xlsx 3 2 --json  # delete rows 3-4

xlsx-delete-cols <file> <start_col> [count] [--sheet <name>]

Delete columns (1-indexed).

cli-anything-onlyoffice xlsx-delete-cols /tmp/grades.xlsx 4 --json  # delete column 4 (D)

Sorting & Filtering

xlsx-sort <file> <column> [--sheet <name>] [--desc] [--numeric]

Sort data by column, preserving the header row. Column can be letter (B) or name.

cli-anything-onlyoffice xlsx-sort /tmp/grades.xlsx B --sheet Grades --desc --numeric --json

xlsx-filter <file> <column> <op> <value> [--sheet <name>]

Filter rows by condition. Returns matching rows.

Operators: eq, ne, gt, lt, ge, le, contains, startswith, endswith

cli-anything-onlyoffice xlsx-filter /tmp/grades.xlsx B gt 80 --sheet Grades --json
cli-anything-onlyoffice xlsx-filter /tmp/grades.xlsx A contains "li" --json
{"success": true, "rows": [["Alice", 85, 90]], "count": 1, "column": "B", "op": "gt", "value": "80"}

Formulas & Calculations

xlsx-formula <file> <cell> <formula> [--sheet <name>]

Write a formula to a cell.

cli-anything-onlyoffice xlsx-formula /tmp/grades.xlsx D2 "=AVERAGE(B2:C2)" --json
cli-anything-onlyoffice xlsx-formula /tmp/grades.xlsx E2 "=IF(D2>=85,\"A\",\"B\")" --json

xlsx-calc <file> <column> <operation> [--sheet <name>] [--include-formulas]

Column statistics. Operations: sum, avg, min, max, all

cli-anything-onlyoffice xlsx-calc /tmp/grades.xlsx B avg --sheet Grades --json
cli-anything-onlyoffice xlsx-calc /tmp/grades.xlsx B all --json
{"success": true, "column": "B", "count": 3, "sum": 255, "average": 85.0, "min": 78, "max": 92}

xlsx-formula-audit <file> [--sheet <name>]

Audit formula complexity and risk for production safety.

cli-anything-onlyoffice xlsx-formula-audit /tmp/data.xlsx --json

Sheet Management

xlsx-sheet-list <file>

List all sheets with row/column counts.

cli-anything-onlyoffice xlsx-sheet-list /tmp/grades.xlsx --json
{"success": true, "sheets": [{"name": "Grades", "rows": 4, "cols": 4}], "count": 1}

xlsx-sheet-add <file> <name> [--position <n>]

Add a new sheet.

cli-anything-onlyoffice xlsx-sheet-add /tmp/grades.xlsx "Charts" --json
cli-anything-onlyoffice xlsx-sheet-add /tmp/grades.xlsx "Summary" --position 0 --json

xlsx-sheet-delete <file> <name>

Delete a sheet by name.

cli-anything-onlyoffice xlsx-sheet-delete /tmp/grades.xlsx "OldSheet" --json

xlsx-sheet-rename <file> <old_name> <new_name>

Rename a sheet.

cli-anything-onlyoffice xlsx-sheet-rename /tmp/grades.xlsx "Sheet1" "Grades" --json

Cell Formatting

xlsx-merge-cells <file> <range> [--sheet <name>]

Merge a cell range.

cli-anything-onlyoffice xlsx-merge-cells /tmp/grades.xlsx A1:D1 --json

xlsx-unmerge-cells <file> <range> [--sheet <name>]

Unmerge a previously merged range.

cli-anything-onlyoffice xlsx-unmerge-cells /tmp/grades.xlsx A1:D1 --json

xlsx-format-cells <file> <range> [options] [--sheet <name>]

Apply rich formatting to a cell range.

Options: --bold, --italic, --wrap, --font-name <name>, --font-size <pts>, --color <RRGGBB>, --bg-color <RRGGBB>, --number-format <fmt>, --align <left|center|right>

# Bold white text on blue header
cli-anything-onlyoffice xlsx-format-cells /tmp/grades.xlsx A1:D1 \
  --bold --color FFFFFF --bg-color 4472C4 --json

# Currency format
cli-anything-onlyoffice xlsx-format-cells /tmp/budget.xlsx B2:B100 \
  --number-format '"$"#,##0.00' --json

CSV Import/Export

xlsx-csv-import <xlsx_file> <csv_file> [--sheet <name>] [--delimiter <char>]

Import a CSV file into a sheet (replaces sheet content).

cli-anything-onlyoffice xlsx-csv-import /tmp/data.xlsx /tmp/raw.csv --sheet Imported --json
cli-anything-onlyoffice xlsx-csv-import /tmp/data.xlsx /tmp/european.csv --delimiter ";" --json

xlsx-csv-export <xlsx_file> <csv_file> [--sheet <name>] [--delimiter <char>]

Export a sheet to CSV.

cli-anything-onlyoffice xlsx-csv-export /tmp/grades.xlsx /tmp/grades.csv --sheet Grades --json

Data Validation

Excel-style cell validation with post-hoc data auditing.

xlsx-add-validation <file> <range> <type> [options]

Add a data validation rule. Types: list, whole, decimal, date, time, textLength, custom.

Options: --operator <op>, --formula1 <v>, --formula2 <v>, --sheet <name>, --error <msg>, --prompt <msg>, --error-style stop|warning|information, --no-blank

Operators: between, notBetween, equal, notEqual, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual

# Number range: rating must be 1-10
cli-anything-onlyoffice xlsx-add-validation /tmp/survey.xlsx C2:C100 whole \
  --operator between --formula1 1 --formula2 10 \
  --error "Rating must be 1-10" --json

# Text length: max 200 characters
cli-anything-onlyoffice xlsx-add-validation /tmp/survey.xlsx D2:D100 textLength \
  --operator lessThanOrEqual --formula1 200 --json

xlsx-add-dropdown <file> <range> <options_csv> [--sheet <name>] [--prompt <msg>] [--error <msg>]

Shortcut: add a dropdown list. Most common validation type.

cli-anything-onlyoffice xlsx-add-dropdown /tmp/survey.xlsx B2:B100 \
  "Yes,No,Maybe" --prompt "Select your answer" --json

xlsx-list-validations <file> [--sheet <name>]

List all validation rules on a sheet.

cli-anything-onlyoffice xlsx-list-validations /tmp/survey.xlsx --json
{
  "success": true,
  "validation_count": 2,
  "validations": [
    {"range": "B2:B100", "type": "list", "allowed_values": ["Yes", "No", "Maybe"]},
    {"range": "C2:C100", "type": "whole", "operator": "between", "formula1": "1", "formula2": "10"}
  ]
}

xlsx-remove-validation <file> [--range <range>] [--all] [--sheet <name>]

Remove validation rules by range or clear all.

cli-anything-onlyoffice xlsx-remove-validation /tmp/survey.xlsx --range B2:B100 --json
cli-anything-onlyoffice xlsx-remove-validation /tmp/survey.xlsx --all --json

xlsx-validate-data <file> [--sheet <name>] [--max-rows <n>]

Audit existing data against validation rules. Returns every failing cell with a reason.

cli-anything-onlyoffice xlsx-validate-data /tmp/survey.xlsx --sheet Data --json
{
  "success": true,
  "cells_checked": 12, "cells_passed": 9, "cells_failed": 3,
  "failures": [
    {"cell": "B4", "value": "INVALID", "reason": "'INVALID' not in allowed list: ['Yes', 'No', 'Maybe']"},
    {"cell": "C3", "value": "11", "reason": "value 11 not between 1.0 and 10.0"},
    {"cell": "C5", "value": "abc", "reason": "'abc' is not a valid whole number"}
  ]
}

Visual Export & Preview

xlsx-to-pdf <file> [output_path]

Convert a spreadsheet to PDF using OnlyOffice DocumentServer's x2t converter. Use this for appendix-ready evidence exports when you want rendered sheet pages rather than raw cell data.

cli-anything-onlyoffice xlsx-to-pdf /tmp/grades.xlsx --json
cli-anything-onlyoffice xlsx-to-pdf /tmp/grades.xlsx /tmp/grades-appendix.pdf --json

xlsx-preview <file> <output_dir> [--pages <range>] [--dpi <n>] [--format png|jpg]

Render spreadsheet pages as images using the existing OnlyOffice conversion path plus PyMuPDF. This is the closest CLI-equivalent to a clean spreadsheet screenshot because it uses the rendered workbook pages instead of guessing a crop from raw workbook data.

cli-anything-onlyoffice xlsx-preview /tmp/grades.xlsx /tmp/xlsx-previews --json
cli-anything-onlyoffice xlsx-preview /tmp/grades.xlsx /tmp/xlsx-previews --pages 0-1 --dpi 200 --format jpg --json
{
  "success": true,
  "file": "/tmp/grades.xlsx",
  "total_pages": 2,
  "pages_rendered": 2,
  "images": [
    {"page": 0, "file": "/tmp/xlsx-previews/page_000.jpg", "width": 1654, "height": 2339, "dpi": 200}
  ]
}

Statistical Analysis

All statistical commands return APA-formatted results with effect sizes and confidence intervals where applicable.

xlsx-freq <file> <column> [--sheet <name>] [--valid <values_csv>]

Frequency table with percentages.

cli-anything-onlyoffice xlsx-freq /tmp/survey.xlsx C --sheet Sheet0 \
  --valid "Strongly Agree,Agree,Neutral,Disagree,Strongly Disagree" --json
{
  "success": true,
  "frequencies": {"Agree": 45, "Strongly Agree": 20, "Neutral": 15},
  "percentages": {"Agree": 54.9, "Strongly Agree": 24.4, "Neutral": 18.3},
  "n": 82
}

xlsx-corr <file> <x_col> <y_col> [--sheet <name>] [--method pearson|spearman]

Correlation test with APA output.

cli-anything-onlyoffice xlsx-corr /tmp/data.xlsx B C --sheet Sheet0 --method pearson --json
{
  "success": true, "r": 0.742, "p_value": 0.001,
  "significant": true, "apa": "r(45) = .742, p < .001"
}

xlsx-ttest <file> <value_col> <group_col> <group_a> <group_b> [options]

Independent samples t-test (Welch default). Includes Cohen's d.

cli-anything-onlyoffice xlsx-ttest /tmp/data.xlsx B A Male Female \
  --sheet Sheet0 --json
{
  "success": true, "t": 2.34, "p_value": 0.023, "df": 78,
  "cohens_d": 0.52, "significant": true,
  "apa": "t(78) = 2.34, p = .023, d = 0.52"
}

xlsx-mannwhitney <file> <value_col> <group_col> <group_a> <group_b> [--sheet <name>]

Non-parametric Mann-Whitney U test.

cli-anything-onlyoffice xlsx-mannwhitney /tmp/data.xlsx B A GroupX GroupY --json

xlsx-chi2 <file> <row_col> <col_col> [options]

Chi-square test of independence with Cramér's V effect size.

cli-anything-onlyoffice xlsx-chi2 /tmp/survey.xlsx C D --sheet Sheet0 \
  --row-valid "Yes,No" --col-valid "Male,Female" --json
{
  "success": true, "chi2": 5.84, "p_value": 0.016, "df": 1,
  "cramers_v": 0.27, "apa": "χ²(1) = 5.84, p = .016, V = .27"
}

xlsx-text-extract <file> <column> [options]

Extract open-text responses for qualitative coding.

cli-anything-onlyoffice xlsx-text-extract /tmp/survey.xlsx E --sheet Sheet0 \
  --limit 50 --min-length 20 --json

xlsx-text-keywords <file> <column> [options]

Generate keyword frequency summary from text responses.

cli-anything-onlyoffice xlsx-text-keywords /tmp/survey.xlsx E --top 15 --json

xlsx-research-pack <file> [options]

Bundled research analysis pack. Runs freq tables, t-tests, chi-square, and correlations in one shot.

cli-anything-onlyoffice xlsx-research-pack /tmp/survey.xlsx \
  --sheet Sheet0 --profile hlth3112 --json

Mode 3 — Charts (.xlsx)

4 commands — embedded charts rendered directly in the workbook.

Chart types: bar, column, bar_horizontal, line, pie, scatter

chart-create <file> <type> <data_range> <categories_range> <title> [options]

Create a chart from explicit cell ranges.

Options: --sheet <name>, --output-sheet <name>, --x-label <text>, --y-label <text>, --labels, --no-legend, --legend-pos right|top|bottom|left, --colors <RRGGBB,RRGGBB>

# Bar chart
cli-anything-onlyoffice chart-create /tmp/grades.xlsx bar B2:D4 A2:A4 "Assignment Comparison" \
  --output-sheet Charts --x-label "Student" --y-label "Score" --labels --json

# Line chart with custom colors
cli-anything-onlyoffice chart-create /tmp/grades.xlsx line B2:D10 A2:A10 "Score Trend" \
  --colors FF0000,00BB00,0000FF --json

chart-comparison <file> <type> <title> [options]

Smart comparison chart — auto-detects series from structured data layout.

Options: --sheet <name>, --start-row <n>, --start-col <n>, --cats <n>, --series <n>, --cat-col <n>, --value-cols <n,n,n>, --output <cell>, --labels, --no-legend

cli-anything-onlyoffice chart-comparison /tmp/grades.xlsx bar "Assignment Trends" \
  --start-row 2 --cat-col 1 --value-cols 2,3,4 --output A10 --labels --json

chart-grade-dist <file> <grade_col> <title> [--sheet <name>] [--output <cell>]

Auto-generate a pie chart from grade distribution in a column.

cli-anything-onlyoffice chart-grade-dist /tmp/grades.xlsx B "Grade Distribution" \
  --output F2 --json
{"success": true, "chart_type": "pie", "distribution": {"A": 2, "B": 2, "C": 1}, "total_grades": 5}

chart-progress <file> <student_col> <grade_col> <title> [options]

Horizontal bar chart of individual grades.

Options: --sheet <name>, --output <cell>, --labels, --no-labels

cli-anything-onlyoffice chart-progress /tmp/grades.xlsx A B "Student Grades" \
  --output D2 --labels --json

Mode 4 — Presentations (.pptx)

16 commands — full slide lifecycle, spatial awareness, textbox control, image extraction, and visual preview.

pptx-create <file> <title> [subtitle]

Create a new presentation with a title slide. Slide size is 16:9 widescreen (13.333" × 7.5") — the modern standard for PowerPoint and OnlyOffice.

cli-anything-onlyoffice pptx-create /tmp/lecture.pptx "Biology 101" "Introduction to Cell Structure" --json

pptx-add-slide <file> <title> [content] [layout]

Add a slide. Layouts: title_only, content, blank, two_content, comparison

cli-anything-onlyoffice pptx-add-slide /tmp/lecture.pptx "Agenda" "Topics we'll cover today" content --json

pptx-add-bullets <file> <title> <bullets>

Add a bullet-point slide. Separate bullets with \n.

cli-anything-onlyoffice pptx-add-bullets /tmp/lecture.pptx "Learning Objectives" \
  "Understand cell theory\nIdentify organelles\nExplain cellular functions" --json

pptx-add-table <file> <title> <headers_csv> <data_csv> [--coerce-rows]

Add a table slide. Rows separated by ;.

cli-anything-onlyoffice pptx-add-table /tmp/lecture.pptx "Cell Types" \
  "Type,Nucleus,Size,Examples" \
  "Prokaryotic,No,1-5µm,Bacteria;Eukaryotic,Yes,10-100µm,Animals" --json

pptx-add-image <file> <title> <image_path>

Add an image slide.

cli-anything-onlyoffice pptx-add-image /tmp/lecture.pptx "Cell Diagram" /tmp/cell.png --json

pptx-read <file>

Read all slides — titles, content, notes, layouts.

cli-anything-onlyoffice pptx-read /tmp/lecture.pptx --json
{
  "success": true,
  "slides": [
    {"index": 0, "title": "Biology 101", "content": "Introduction...", "notes": ""}
  ],
  "slide_count": 1
}

pptx-slide-count <file>

Get slide count and all slide titles.

cli-anything-onlyoffice pptx-slide-count /tmp/lecture.pptx --json
{"success": true, "count": 5, "titles": ["Biology 101", "Agenda", "Cell Types", ...]}

pptx-delete-slide <file> <index>

Delete a slide by 0-based index.

cli-anything-onlyoffice pptx-delete-slide /tmp/lecture.pptx 2 --json

pptx-speaker-notes <file> <slide_index> [notes_text]

Read or set speaker notes. Omit notes_text to read.

# Read notes
cli-anything-onlyoffice pptx-speaker-notes /tmp/lecture.pptx 0 --json

# Set notes
cli-anything-onlyoffice pptx-speaker-notes /tmp/lecture.pptx 0 "Remember to introduce yourself" --json

pptx-update-text <file> <slide_index> [--title <t>] [--body <b>]

Update title and/or body text of an existing slide.

cli-anything-onlyoffice pptx-update-text /tmp/lecture.pptx 1 \
  --title "Updated Agenda" --body "New content here" --json

Image Extraction

pptx-extract-images <file> <output_dir> [--slide <index>] [--format png|jpg] [--prefix <name>]

Extract all images from slides. Optionally target a single slide.

cli-anything-onlyoffice pptx-extract-images /tmp/lecture.pptx /tmp/slide_images --json
cli-anything-onlyoffice pptx-extract-images /tmp/lecture.pptx /tmp/slide3_imgs --slide 3 --json
{
  "success": true, "images_extracted": 2,
  "images": [
    {"index": 0, "slide": 2, "file": "/tmp/slide_images/slide_02_000.png", "width": 800, "height": 600, "shape_name": "Picture 2"}
  ]
}

Spatial Awareness & Layout Control

The agent can now see exact positions and sizes of all shapes, enabling precise layout control and overlap detection.

Slide coordinate system: Origin (0,0) = top-left. Slide is 13.333" wide x 7.5" tall (16:9).

pptx-list-shapes <file> [--slide <index>]

List all shapes with exact position, size, text, type, and edges. Essential for understanding layout before modifying slides.

cli-anything-onlyoffice pptx-list-shapes /tmp/lecture.pptx --slide 1 --json
{
  "success": true,
  "slide_width_inches": 13.333, "slide_height_inches": 7.5,
  "slides": [{
    "slide_index": 1, "shape_count": 3,
    "shapes": [
      {
        "name": "Title 1", "shape_type": "PLACEHOLDER (14)",
        "left_inches": 0.5, "top_inches": 0.3, "width_inches": 9.0, "height_inches": 1.25,
        "right_inches": 9.5, "bottom_inches": 1.55,
        "has_text": true, "text": "Data Slide"
      },
      {
        "name": "TextBox 3", "shape_type": "TEXT_BOX (17)",
        "left_inches": 10.0, "top_inches": 0.5, "width_inches": 3.0, "height_inches": 0.8,
        "right_inches": 13.0, "bottom_inches": 1.3,
        "has_text": true, "text": "Custom Label"
      }
    ]
  }]
}

pptx-add-textbox <file> <slide_index> <text> [options]

Add a textbox at exact coordinates with full formatting control.

Options: --left <in>, --top <in>, --width <in>, --height <in>, --font-size <pt>, --font-name <name>, --bold, --italic, --color <RRGGBB>, --align <left|center|right>

cli-anything-onlyoffice pptx-add-textbox /tmp/lecture.pptx 1 "Important Note" \
  --left 10.0 --top 6.0 --width 3.0 --height 0.8 \
  --font-size 14 --bold --color FF0000 --align center --json

pptx-modify-shape <file> <slide_index> <shape_name> [options]

Move, resize, or edit any shape by name. Use pptx-list-shapes first to get shape names.

Options: --left <in>, --top <in>, --width <in>, --height <in>, --text <text>, --font-size <pt>, --rotation <deg>

# Move and resize a textbox
cli-anything-onlyoffice pptx-modify-shape /tmp/lecture.pptx 1 "TextBox 3" \
  --left 10.5 --top 0.3 --width 2.5 --text "Updated Label" --json

# Resize a title placeholder
cli-anything-onlyoffice pptx-modify-shape /tmp/lecture.pptx 0 "Title 1" \
  --width 12.0 --font-size 36 --json

Visual Preview

pptx-preview <file> <output_dir> [--slide <index>] [--dpi <n>]

Render slides as PNG images via OnlyOffice x2t converter. Requires the onlyoffice-documentserver Docker container running.

cli-anything-onlyoffice pptx-preview /tmp/lecture.pptx /tmp/previews --slide 1 --dpi 150 --json
{
  "success": true, "total_slides": 5, "slides_rendered": 1,
  "images": [{"slide": 1, "file": "/tmp/previews/slide_001.png", "width": 2000, "height": 1125}]
}

Recommended presentation workflow:

  1. Create slides with content (pptx-add-slide, pptx-add-bullets, etc.)
  2. pptx-list-shapes — see exact positions of all elements
  3. pptx-modify-shape — fix overlaps, reposition elements
  4. pptx-add-textbox — add custom positioned text
  5. pptx-preview — render as PNG, view the image to verify layout
  6. Iterate if needed

Mode 5 — PDF Native Blocks + Image Operations

15 commands — read/search native PDF blocks, extract/render images, inspect hidden PDF data, sanitize metadata, and perform opt-in PDF compaction, stitching, page extraction/reorder, redaction, and text/image overlays using PyMuPDF.

PDF page indexing: PDF page numbers and page ranges are zero-based and inclusive across PDF commands. Human-visible page 1 is CLI page 0; visible pages 1-4 are --pages 0-3; visible pages 2 and 4 are --pages 1,3.

pdf-extract-images <file> <output_dir> [--format png|jpg] [--pages <range>]

Extract embedded image objects (photos, figures, charts) from a PDF.

cli-anything-onlyoffice pdf-extract-images /tmp/paper.pdf /tmp/figures --format png --pages 0-5 --json
{
  "success": true, "total_pages": 12, "pages_scanned": 6, "images_extracted": 4,
  "images": [
    {"index": 0, "page": 2, "file": "/tmp/figures/pdf_img_002_000.png", "width": 1200, "height": 800, "original_format": "jpeg"}
  ]
}

pdf-page-to-image <file> <output_dir> [--pages <range>] [--dpi <n>] [--format png|jpg]

Render full PDF pages as images. Use when you want the entire page as a figure.

# Render all pages at 150 DPI
cli-anything-onlyoffice pdf-page-to-image /tmp/paper.pdf /tmp/pages --json

# Render specific pages at print quality
cli-anything-onlyoffice pdf-page-to-image /tmp/paper.pdf /tmp/pages --pages 0,3,5 --dpi 300 --json
{
  "success": true, "total_pages": 12, "pages_rendered": 3,
  "images": [
    {"page": 0, "file": "/tmp/pages/page_000.png", "width": 2480, "height": 3508, "dpi": 300}
  ]
}

Page ranges: 0-3 (pages 0 through 3), 1,3,5 (specific pages), omit for all. Default DPI: 150.

pdf-map-page <file> <page> <output_image> [--dpi <n>] [--format png|jpg] [--no-labels] [--no-images]

Render one PDF page with visible native block boxes and block_id labels. Use this before block-guided redaction or manual coordinate work.

cli-anything-onlyoffice pdf-map-page /tmp/form.pdf 0 /tmp/form-map.png --json

pdf-inspect-hidden-data <file>

Inspect hidden PDF metadata, XMP/XML metadata presence, annotations, embedded files, form usage, and page-size consistency.

cli-anything-onlyoffice pdf-inspect-hidden-data /tmp/submission.pdf --json

pdf-sanitize <file> [output_path] [options]

Clear PDF metadata/XMP and, only when explicitly requested, remove annotations, remove embedded files/attachments, or flatten form fields.

cli-anything-onlyoffice pdf-sanitize /tmp/submission.pdf /tmp/submission-clean.pdf \
  --clear-metadata --remove-xml-metadata --author benbi --json
cli-anything-onlyoffice pdf-sanitize /tmp/submission.pdf /tmp/submission-clean.pdf \
  --clear-metadata --remove-xml-metadata --remove-annotations \
  --remove-embedded-files --flatten-forms --json

pdf-compact <file> [output_path] [options]

Explicitly compact/optimize a PDF. This is never applied by default by doc-to-pdf, pdf-sanitize, or doc-submission-pack; run this command only when compression is intended.

cli-anything-onlyoffice pdf-compact /tmp/large.pdf /tmp/large-compact.pdf --json
cli-anything-onlyoffice pdf-compact /tmp/large.pdf /tmp/large-linear.pdf --linearize --json

pdf-merge <input_file> <input_file> [input_file ...] --output <file>

Stitch multiple PDFs into a single output file.

cli-anything-onlyoffice pdf-merge /tmp/a.pdf /tmp/b.pdf --output /tmp/combined.pdf --json

pdf-split <file> <output_dir> [--pages <range>] [--prefix <name>]

Split selected zero-based pages into one-page PDF files.

# Split human-visible pages 1-4
cli-anything-onlyoffice pdf-split /tmp/combined.pdf /tmp/pages --pages 0-3 --prefix page --json

pdf-reorder <file> <page_order> [output_path]

Create a PDF with pages in an explicit zero-based order. Unlike read/render page ranges, duplicates and order are preserved.

cli-anything-onlyoffice pdf-reorder /tmp/combined.pdf 2,0,1 /tmp/reordered.pdf --json

pdf-add-text <file> <page> <text> [options]

Overlay bounded text onto a PDF page. Coordinates are points from the top-left page origin.

cli-anything-onlyoffice pdf-add-text /tmp/form.pdf 0 "Reviewed" \
  --output /tmp/form-reviewed.pdf --x 72 --y 72 --width 180 --height 36 --font-size 14 --json

pdf-add-image <file> <page> <image_path> [options]

Overlay an image onto a PDF page. Image inputs are safety-checked with the existing bounded decode path.

cli-anything-onlyoffice pdf-add-image /tmp/form.pdf 0 /tmp/stamp.png \
  --output /tmp/form-stamped.pdf --x 72 --y 120 --width 96 --height 96 --json

pdf-redact <file> [output_path] (--text <query> | --rect <page,left,top,right,bottom>) [options]

Apply true PDF redactions by exact text match or rectangle. Use --dry-run first to inspect matches.

cli-anything-onlyoffice pdf-redact /tmp/form.pdf /tmp/form-redacted.pdf --text "SECRET" --json
cli-anything-onlyoffice pdf-redact /tmp/form.pdf --rect 0,72,72,220,120 --dry-run --json

pdf-redact-block <file> <block_id> [output_path] [--fill <hex>] [--dry-run]

Apply true PDF redaction to one native block_id from pdf-read-blocks or pdf-map-page.

cli-anything-onlyoffice pdf-redact-block /tmp/form.pdf page_0_block_3 /tmp/form-redacted.pdf --json

pdf-read-blocks <file> [--pages <range>] [--no-spans] [--no-images] [--include-empty]

Read native PDF text blocks, lines, and spans with exact bounding boxes. Use this when downstream tooling needs stable block_id / line_id / span_id anchors instead of page-only references.

cli-anything-onlyoffice pdf-read-blocks /tmp/paper.pdf --pages 0-1 --json

pdf-search-blocks <file> <query> [--pages <range>] [--case-sensitive] [--no-spans]

Search exact PDF block/span text and return the matching native anchors and bounding boxes.

cli-anything-onlyoffice pdf-search-blocks /tmp/paper.pdf "Results" --pages 2-3 --json

Mode 6 — RDF Knowledge Graphs

10 commands — full CRUD, SPARQL 1.1, multi-format I/O, and SHACL validation.

Requires: rdflib>=7.0.0 and pyshacl>=0.25.0 (included in core).

Supported formats: turtle (.ttl), xml (.rdf), n3, nt, json-ld, trig

Built-in prefixes (auto-bound on create): rdf, rdfs, owl, xsd, foaf, dcterms, skos


rdf-create <file> [options]

Create an empty RDF graph with optional base URI and custom prefixes.

Options: --base <uri>, --format turtle|xml|n3|json-ld, --prefix <p>=<uri>

cli-anything-onlyoffice rdf-create /tmp/knowledge.ttl \
  --base "http://example.org/" \
  --prefix ex="http://example.org/" \
  --format turtle --json
{"success": true, "file": "/tmp/knowledge.ttl", "format": "turtle", "triples": 0, "prefixes": ["rdf", "rdfs", "owl", "xsd", "foaf", "dcterms", "skos", "ex"]}

rdf-read <file> [--limit <n>]

Parse an RDF file and return triples. Default limit: 100.

cli-anything-onlyoffice rdf-read /tmp/knowledge.ttl --limit 50 --json
{
  "success": true,
  "triples": [
    {"subject": "http://example.org/Alice", "predicate": "http://xmlns.com/foaf/0.1/name", "object": "Alice"}
  ],
  "triple_count": 1,
  "namespaces": {"foaf": "http://xmlns.com/foaf/0.1/"}
}

rdf-add <file> <subject> <predicate> <object> [options]

Add a single triple. Object types: uri (default), literal, bnode

Options: --type uri|literal|bnode, --lang <language_tag>, --datatype <xsd_uri>, --format <f>

# URI object
cli-anything-onlyoffice rdf-add /tmp/knowledge.ttl \
  "http://example.org/Alice" \
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" \
  "http://xmlns.com/foaf/0.1/Person" --json

# Literal object
cli-anything-onlyoffice rdf-add /tmp/knowledge.ttl \
  "http://example.org/Alice" \
  "http://xmlns.com/foaf/0.1/name" \
  "Alice Smith" --type literal --lang en --json

# Typed literal (date)
cli-anything-onlyoffice rdf-add /tmp/knowledge.ttl \
  "http://example.org/Alice" \
  "http://schema.org/birthDate" \
  "1990-01-01" --type literal \
  --datatype "http://www.w3.org/2001/XMLSchema#date" --json

rdf-remove <file> (--all | [options])

Remove triples matching explicit selectors. Full-graph removal requires --all; omitting selectors is rejected to prevent accidental data loss.

Options: --all, --dry-run, --subject <uri>, --predicate <uri>, --object <value>, --type uri|literal|bnode, --lang <tag>, --datatype <xsd_uri>, --format <f>

# Remove all triples about Alice
cli-anything-onlyoffice rdf-remove /tmp/knowledge.ttl \
  --subject "http://example.org/Alice" --json

# Remove specific triple
cli-anything-onlyoffice rdf-remove /tmp/knowledge.ttl \
  --subject "http://example.org/Alice" \
  --predicate "http://xmlns.com/foaf/0.1/name" \
  --object "Alice Smith" --type literal --json

# Remove a language-tagged literal
cli-anything-onlyoffice rdf-remove /tmp/knowledge.ttl \
  --predicate "http://www.w3.org/2000/01/rdf-schema#label" \
  --object "Alice" --type literal --lang en --json

# Preview full graph removal without mutating
cli-anything-onlyoffice rdf-remove /tmp/knowledge.ttl --all --dry-run --json

rdf-query <file> <sparql_query> [--limit <n>]

Execute a SPARQL 1.1 query. Default limit: 100.

# SELECT query
cli-anything-onlyoffice rdf-query /tmp/knowledge.ttl \
  "SELECT ?s ?name WHERE { ?s <http://xmlns.com/foaf/0.1/name> ?name } LIMIT 10" --json

# ASK query
cli-anything-onlyoffice rdf-query /tmp/knowledge.ttl \
  "ASK { <http://example.org/Alice> a <http://xmlns.com/foaf/0.1/Person> }" --json
{
  "success": true,
  "query_type": "SELECT",
  "results": [{"s": "http://example.org/Alice", "name": "Alice Smith"}],
  "count": 1
}

rdf-export <file> <output_file> [--format <format>]

Convert and export RDF to a different serialisation format.

# Turtle → JSON-LD
cli-anything-onlyoffice rdf-export /tmp/knowledge.ttl /tmp/knowledge.jsonld \
  --format json-ld --json

# Turtle → N-Triples
cli-anything-onlyoffice rdf-export /tmp/knowledge.ttl /tmp/knowledge.nt \
  --format nt --json

rdf-merge <file_a> <file_b> [--output <file>] [--format <f>]

Merge two RDF graphs into one. If --output is omitted, merges into file_a.

cli-anything-onlyoffice rdf-merge /tmp/graph1.ttl /tmp/graph2.ttl \
  --output /tmp/merged.ttl --format turtle --json
{"success": true, "triples_a": 10, "triples_b": 15, "triples_merged": 25}

rdf-stats <file>

Graph statistics: triple count, unique subjects/predicates/objects, top predicates, RDF types.

cli-anything-onlyoffice rdf-stats /tmp/knowledge.ttl --json
{
  "success": true,
  "triples": 42,
  "unique_subjects": 8,
  "unique_predicates": 12,
  "rdf_types": {"foaf:Person": 5, "foaf:Organization": 3},
  "top_predicates": [["foaf:name", 8], ["dcterms:title", 5]]
}

rdf-namespace <file> [<prefix> <uri>] [--format <f>]

List all namespace prefixes, or bind a new prefix.

# List all prefixes
cli-anything-onlyoffice rdf-namespace /tmp/knowledge.ttl --json

# Add a prefix
cli-anything-onlyoffice rdf-namespace /tmp/knowledge.ttl schema "http://schema.org/" --json

rdf-validate <data_file> <shapes_file>

Validate an RDF graph against a SHACL shapes graph. Requires pyshacl.

cli-anything-onlyoffice rdf-validate /tmp/data.ttl /tmp/shapes.ttl --json
{
  "success": true,
  "conforms": false,
  "violations": [
    {"severity": "Violation", "focus": "http://example.org/Alice", "message": "Missing required foaf:mbox"}
  ]
}

General Commands

list

List recent .docx/.xlsx/.pptx files from ~/Documents and ~/Downloads.

cli-anything-onlyoffice list --json

open <file> [gui|web]

Open a file in OnlyOffice Desktop Editors GUI or web viewer.

cli-anything-onlyoffice open /tmp/report.xlsx gui --json
cli-anything-onlyoffice spreadsheet.open /tmp/report.xlsx --json
cli-anything-onlyoffice document.open /tmp/essay.docx web --json

Compatibility aliases are accepted for agent-style dotted commands: document.open, spreadsheet.open, presentation.open, pdf.open. The same alias pattern also works for watch and info.

watch <file> [gui|web]

Watch a file for changes and keep the GUI open for real-time viewing.

# Terminal 1: watch
cli-anything-onlyoffice watch /tmp/essay.docx gui

# Terminal 2: agent writes content, GUI reflects changes live
cli-anything-onlyoffice doc-append /tmp/essay.docx "New paragraph..." --json

info <file>

File metadata: type, size, sheet/slide/paragraph counts.

cli-anything-onlyoffice info /tmp/grades.xlsx --json

editor-session <file> [--open] [--wait <sec>] [--activate]

Inspect or open a native OnlyOffice Desktop Editors window for a file and return machine-readable window metadata.

cli-anything-onlyoffice editor-session /tmp/report.xlsx --open --json
cli-anything-onlyoffice editor-session /tmp/report.docx --activate --json

editor-capture <file> <output_image> [options]

Capture the live editor viewport from OnlyOffice Desktop Editors when desktop automation is available, or fall back to rendered page export when --backend rendered is requested.

Common options:

  • --backend auto|desktop|rendered
  • --open open the file first if no desktop session exists
  • --page <n> zero-based page index for documents/PDFs
  • --range <Sheet0!A1:F20> spreadsheet range target via native Ctrl+G
  • --slide <n> zero-based slide index for presentations
  • --zoom-reset, --zoom-in <n>, --zoom-out <n>
  • --crop x,y,w,h crop relative to the captured window image
  • --wait <sec>, --settle-ms <n>, --dpi <n>, --format png|jpg
# Exact current desktop editor viewport for a workbook
cli-anything-onlyoffice editor-capture /tmp/report.xlsx /tmp/current-view.png \
  --backend desktop --open --range Sheet0!A1:F20 --crop 100,120,1400,800 --json

# Document page capture through the live desktop editor
cli-anything-onlyoffice editor-capture /tmp/report.docx /tmp/page2.png \
  --backend desktop --open --page 1 --zoom-reset --json

# Rendered fallback when native desktop automation is unavailable
cli-anything-onlyoffice editor-capture /tmp/report.xlsx /tmp/page0.png \
  --backend rendered --page 0 --json

setup-check

Strict post-clone/post-pull dependency gate. Use this after git pull and pip install -e .; it exits nonzero if required Python packages or external conversion dependencies are missing.

cli-anything-onlyoffice setup-check --json
cli-anything-onlyoffice setup-check --live-smoke --json

Aliases: update-check, doctor. The optional --live-smoke flag creates a temporary DOCX, renders it to PDF through x2t, reads the rendered PDF blocks, and checks stable facts such as PDF header, sentinel text, and font/size span metadata.

status

Check installation and all capability flags. status is informational and includes an install_check summary; use setup-check when automation must fail on missing dependencies.

cli-anything-onlyoffice status --json
{
  "success": true,
  "version": "4.4.19",
  "python": "/path/to/.venv/bin/python3",
  "python_docx": true,
  "openpyxl": true,
  "python_pptx": true,
  "rdflib": true,
  "rdflib_version": "7.6.0",
  "pyshacl": true,
  "capabilities": {
    "docx_create": true, "xlsx_charts": true,
    "rdf_create": true, "rdf_validate": true
  }
}

The python field shows which interpreter is running. If it doesn't point inside your .venv, you are using the wrong Python and imports will fail.

help

Machine-readable command reference (JSON mode recommended for agents).

cli-anything-onlyoffice help --json

Backup Management

All writes auto-create a backup in ~/.cli-anything/backups/.

backup-list <file> [--limit <n>]

List backups for a file.

cli-anything-onlyoffice backup-list /tmp/grades.xlsx --limit 10 --json

backup-prune [options]

Prune old backups by count or age.

cli-anything-onlyoffice backup-prune --file /tmp/grades.xlsx --keep 10 --json
cli-anything-onlyoffice backup-prune --days 30 --json  # prune all backups older than 30 days

backup-restore <file> [options]

Restore from backup.

cli-anything-onlyoffice backup-restore /tmp/grades.xlsx --latest --json
cli-anything-onlyoffice backup-restore /tmp/grades.xlsx --latest --dry-run --json  # preview only

Command Reference Summary

Category Count Commands
Documents (.docx) 37 doc-create, doc-read, doc-append, doc-replace, doc-search, doc-insert, doc-delete, doc-format, doc-set-style, doc-list-styles, doc-highlight, doc-comment, doc-layout, doc-normalize-format, doc-formatting-info, doc-font-audit, doc-add-table, doc-read-tables, doc-add-image, doc-extract-images, doc-to-pdf, doc-preview, doc-render-map, doc-render-audit, doc-add-hyperlink, doc-add-page-break, doc-add-list, doc-add-reference, doc-build-references, doc-citation-audit, doc-set-metadata, doc-get-metadata, doc-inspect-hidden-data, doc-preflight, doc-submission-pack, doc-sanitize, doc-word-count
Spreadsheets (.xlsx) 39 xlsx-create, xlsx-write, xlsx-read, xlsx-append, xlsx-search, xlsx-cell-read, xlsx-cell-write, xlsx-range-read, xlsx-delete-rows, xlsx-delete-cols, xlsx-sort, xlsx-filter, xlsx-calc, xlsx-formula, xlsx-formula-audit, xlsx-freq, xlsx-corr, xlsx-ttest, xlsx-mannwhitney, xlsx-chi2, xlsx-research-pack, xlsx-text-extract, xlsx-text-keywords, xlsx-sheet-list, xlsx-sheet-add, xlsx-sheet-delete, xlsx-sheet-rename, xlsx-merge-cells, xlsx-unmerge-cells, xlsx-format-cells, xlsx-csv-import, xlsx-csv-export, xlsx-add-validation, xlsx-add-dropdown, xlsx-list-validations, xlsx-remove-validation, xlsx-validate-data, xlsx-to-pdf, xlsx-preview
Charts (.xlsx) 4 chart-create, chart-comparison, chart-grade-dist, chart-progress
Presentations (.pptx) 15 pptx-create, pptx-add-slide, pptx-add-bullets, pptx-add-table, pptx-add-image, pptx-read, pptx-slide-count, pptx-delete-slide, pptx-speaker-notes, pptx-update-text, pptx-extract-images, pptx-list-shapes, pptx-add-textbox, pptx-modify-shape, pptx-preview
PDF (.pdf) 15 pdf-extract-images, pdf-page-to-image, pdf-map-page, pdf-read-blocks, pdf-search-blocks, pdf-inspect-hidden-data, pdf-sanitize, pdf-compact, pdf-merge, pdf-split, pdf-reorder, pdf-add-text, pdf-add-image, pdf-redact, pdf-redact-block
RDF Knowledge Graphs 10 rdf-create, rdf-read, rdf-add, rdf-remove, rdf-query, rdf-export, rdf-merge, rdf-stats, rdf-namespace, rdf-validate
General 12 list, open, watch, info, backup-list, backup-prune, backup-restore, editor-session, editor-capture, setup-check, status, help
Total 132

Agent Workflow Examples

Complete Grade Tracker

# 1. Create spreadsheet
cli-anything-onlyoffice xlsx-write /tmp/grades.xlsx \
  "Student,A1,A2,A3,Total" \
  "Alice,85,90,88,=B2+C2+D2;Bob,78,82,85,=B3+C3+D3;Charlie,92,88,95,=B4+C4+D4" \
  --sheet Grades --json

# 2. Style the header
cli-anything-onlyoffice xlsx-format-cells /tmp/grades.xlsx A1:E1 \
  --bold --color FFFFFF --bg-color 4472C4 --json

# 3. Calculate averages
cli-anything-onlyoffice xlsx-calc /tmp/grades.xlsx B all --sheet Grades --json

# 4. Visualize
cli-anything-onlyoffice chart-progress /tmp/grades.xlsx A E "Student Totals" --labels --json
cli-anything-onlyoffice chart-grade-dist /tmp/grades.xlsx E "Total Distribution" --json

Research Report with APA Stats

# Frequency analysis
cli-anything-onlyoffice xlsx-freq /tmp/survey.xlsx C --sheet Sheet0 \
  --valid "SA,A,N,D,SD" --json

# Correlation
cli-anything-onlyoffice xlsx-corr /tmp/survey.xlsx B C --sheet Sheet0 --json

# T-test by gender
cli-anything-onlyoffice xlsx-ttest /tmp/survey.xlsx B A Male Female --json

# Full pack
cli-anything-onlyoffice xlsx-research-pack /tmp/survey.xlsx --sheet Sheet0 --json

Lecture Presentation

cli-anything-onlyoffice pptx-create /tmp/lecture.pptx "Biology 101" "Spring 2026" --json
cli-anything-onlyoffice pptx-add-bullets /tmp/lecture.pptx "Objectives" \
  "Cell theory\nDNA structure\nMitosis vs Meiosis" --json
cli-anything-onlyoffice pptx-add-table /tmp/lecture.pptx "Cell Comparison" \
  "Type,Nucleus,Size" "Prokaryotic,No,1-5µm;Eukaryotic,Yes,10-100µm" --json
cli-anything-onlyoffice pptx-speaker-notes /tmp/lecture.pptx 0 "Introduce yourself first" --json
cli-anything-onlyoffice pptx-slide-count /tmp/lecture.pptx --json

Presentation with Spatial Awareness

# 1. Create presentation
cli-anything-onlyoffice pptx-create /tmp/report.pptx "Q1 Report" "Sales Overview" --json
cli-anything-onlyoffice pptx-add-bullets /tmp/report.pptx "Key Metrics" \
  "Revenue up 15%\nNew customers: 340\nChurn rate: 2.1%" --json

# 2. Inspect the layout
cli-anything-onlyoffice pptx-list-shapes /tmp/report.pptx --slide 1 --json

# 3. Add a custom callout box in the empty space on the right
cli-anything-onlyoffice pptx-add-textbox /tmp/report.pptx 1 "Record Quarter!" \
  --left 10.0 --top 2.0 --width 3.0 --height 1.0 \
  --font-size 20 --bold --color 00AA00 --align center --json

# 4. Preview the slide to verify layout
cli-anything-onlyoffice pptx-preview /tmp/report.pptx /tmp/previews --slide 1 --json
# → Agent views /tmp/previews/slide_001.png to check for overlaps

PDF Image Extraction

# Extract all figures from a research paper
cli-anything-onlyoffice pdf-extract-images /tmp/paper.pdf /tmp/figures --pages 0-10 --json

# Render page 5 as a high-quality image
cli-anything-onlyoffice pdf-page-to-image /tmp/paper.pdf /tmp/pages --pages 5 --dpi 300 --json

# Insert extracted figure into a document
cli-anything-onlyoffice doc-add-image /tmp/essay.docx /tmp/figures/pdf_img_005_000.png \
  --width 5.0 --paragraph 8 --position after \
  --caption "Figure 1: Study framework (adapted from Smith, 2024)" --json

# Render the affected pages to verify the figure placement visually
cli-anything-onlyoffice doc-preview /tmp/essay.docx /tmp/doc-preview --pages 2-3 --json

RDF Knowledge Graph Pipeline

# Create graph
cli-anything-onlyoffice rdf-create /tmp/knowledge.ttl \
  --base "http://example.org/" --prefix ex="http://example.org/" --json

# Add entities
cli-anything-onlyoffice rdf-add /tmp/knowledge.ttl \
  "http://example.org/Alice" \
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" \
  "http://xmlns.com/foaf/0.1/Person" --json

cli-anything-onlyoffice rdf-add /tmp/knowledge.ttl \
  "http://example.org/Alice" "http://xmlns.com/foaf/0.1/name" "Alice" \
  --type literal --lang en --json

# Query
cli-anything-onlyoffice rdf-query /tmp/knowledge.ttl \
  "SELECT ?s ?name WHERE { ?s a <http://xmlns.com/foaf/0.1/Person> ; <http://xmlns.com/foaf/0.1/name> ?name }" --json

# Export to JSON-LD
cli-anything-onlyoffice rdf-export /tmp/knowledge.ttl /tmp/knowledge.jsonld --format json-ld --json

# Stats
cli-anything-onlyoffice rdf-stats /tmp/knowledge.ttl --json

Essay with References

cli-anything-onlyoffice doc-create /tmp/essay.docx "Research Essay" "" --json
cli-anything-onlyoffice doc-insert /tmp/essay.docx "Introduction" 0 --style "Heading 1" --json
cli-anything-onlyoffice doc-append /tmp/essay.docx "Health outcomes improve when..." --json
cli-anything-onlyoffice doc-set-metadata /tmp/essay.docx --author "SLOANE Agent" --title "Health Research 2026" --json

# Add reference to sidecar
cli-anything-onlyoffice doc-add-reference /tmp/essay.docx \
  '{"author":"Smith, J.", "year":"2024", "title":"Health Outcomes Study", "source":"Journal of Health", "type":"journal", "doi":"10.1234/jh.2024"}' --json

# Build references section
cli-anything-onlyoffice doc-build-references /tmp/essay.docx --json
cli-anything-onlyoffice doc-citation-audit /tmp/essay.docx --json
cli-anything-onlyoffice doc-word-count /tmp/essay.docx --json

SLOANE OS Integration

This CLI is called by SLOANE subject agents via:

result = cli_anything_run(tool="onlyoffice", args=[
    "xlsx-write", "/tmp/report.xlsx",
    "Month,Revenue", "Jan,5000;Feb,6200",
    "--sheet", "Data", "--json"
])

Agent Tips

  1. Always use --json — machine-readable, structured, parseable.
  2. Check success first — every response has {"success": true/false}.
  3. Run setup-check --json after install or git pull to confirm all required Python and external dependencies are available; then use status --json for routine capability checks.
  4. Run help --json to get the full command reference programmatically.
  5. Backups are automatic — every write is snapshotted. Use backup-restore --latest on error.
  6. Atomic writes — no partial file corruption, safe to run concurrently from multiple threads or processes.
  7. RDF for knowledge — use the RDF mode to build structured knowledge graphs that can be queried with SPARQL, exported to any format, and validated against SHACL shapes.
  8. Always invoke via the venv binary — never cd .venv && python3. Use the full path: .venv/bin/cli-anything-onlyoffice or .venv/bin/python3 -m cli_anything.onlyoffice.core.cli. Running system python3 will fail with ModuleNotFoundError.
  9. Use pptx-list-shapes before modifying slides — know exact positions to avoid overlaps and text clipping.
  10. Use pptx-preview after building slides — visually verify the layout before delivering.
  11. Use xlsx-validate-data after writing data — audit all cells against validation rules, fix failures, re-audit until clean.

File Tree

agent-harness/
├── setup.py                          # Package config (v4.4.19)
├── README.md                         # This file
├── cli_anything/
│   └── onlyoffice/
│       ├── core/
│       │   ├── __init__.py
│       │   ├── cli.py                # Main CLI bootstrap + modality routing
│       │   ├── command_registry.py   # Single source of truth for command/help metadata
│       │   ├── general_cli.py        # General command handling + alias compatibility
│       │   ├── doc_cli.py            # DOCX-specific CLI parsing/dispatch
│       │   ├── pdf_cli.py            # PDF-specific CLI parsing/dispatch
│       │   ├── pptx_cli.py           # PPTX-specific CLI parsing/dispatch
│       │   ├── rdf_cli.py            # RDF-specific CLI parsing/dispatch
│       │   └── xlsx_cli.py           # XLSX/chart-specific CLI parsing/dispatch
│       ├── utils/
│       │   ├── __init__.py
│       │   ├── docserver.py          # Shared backend engine (~2,800 lines)
│       │   ├── pdf_ops.py            # Dedicated PDF operations
│       │   ├── pptx_ops.py           # Dedicated PPTX operations
│       │   ├── doc_ops.py            # Dedicated DOCX submission/runtime operations
│       │   ├── rdf_ops.py            # Dedicated RDF graph operations
│       │   └── xlsx_ops.py           # Dedicated XLSX/chart operations
│       ├── skills/
│       │   ├── __init__.py
│       │   └── SKILL.md              # SLOANE skill manifest
│       └── tests/
│           ├── __init__.py
│           ├── test_concurrency_stress.py
│           ├── test_formula_safety.py
│           ├── test_inferential_stats.py
│           ├── test_pdf_ops.py
│           ├── test_pptx_ops.py
│           ├── test_production_readiness.py
│           ├── test_doc_cli.py
│           ├── test_doc_ops.py
│           ├── test_general_cli.py
│           ├── test_rdf_ops.py
│           ├── test_xlsx_cli.py
│           ├── test_xlsx_ops.py
│           └── test_research_pack.py

Version History

Version Changes
4.4.19 Explicit PDF cleanup and block-guided redaction. pdf-sanitize can now explicitly remove annotations, remove embedded files/attachments, and flatten form fields when requested. Added pdf-map-page and pdf-redact-block for visual block-id mapping and block-level redaction without OCR.
4.4.18 Citation audit and exact text redaction. Added read-only doc-citation-audit for deterministic APA-like in-text/reference-list consistency checks without network/source verification. Hardened pdf-redact --text to use exact character-level match geometry instead of redacting the entire surrounding text span.
4.4.17 Opt-in PDF compaction and editing. Added standalone pdf-compact, pdf-merge, pdf-split, pdf-reorder, pdf-add-text, pdf-add-image, and pdf-redact. Compression/compaction is explicit only and is not applied by default in doc-to-pdf, pdf-sanitize, or doc-submission-pack. Mutating PDF operations use locked atomic saves and safety preflights.
4.4.16 Submission workflow hardening. Added doc-normalize-format, doc-font-audit, and doc-submission-pack; rendered layout audits now filter repeated DOCX/PDF header-footer artifacts before body/reference checks; setup-check --live-smoke optionally runs a real DOCX-to-PDF converter smoke; DOCX sanitization clears extended Application metadata.
4.4.15 Install/update dependency gate. pyshacl is now a core install dependency so rdf-validate is available after normal pip install -e .. Added setup-check (update-check/doctor aliases) as a strict post-clone/post-pull readiness check that validates required Python packages plus Docker/OnlyOffice x2t external conversion dependencies. status now includes an install_check summary while remaining informational.
4.4.14 Rendered-readiness and safety hardening. Generic DOCX render audits now perform margin-envelope checks instead of passing on text presence alone, externally supplied PDFs block submission-ready claims unless trusted by the conversion pipeline, DOCX hidden-data inspection/sanitization covers timestamps, custom document properties, and all comment parts, RDF removal requires explicit selectors or --all, and PDF/PPTX extraction/rendering now enforce path and resource preflights.
4.4.13 DOCX OOXML canonicalization repair. Added doc-sanitize --canonicalize-ooxml to rewrite legacy ns0: WordprocessingML parts back to stable canonical w: OOXML so OnlyOffice/x2t can honor DOCX page breaks, margins, and hanging indents without relying on Microsoft Word to repair the package.
4.4.12 Rendered DOCX layout auditing + stable OOXML namespace serialization. Added doc-render-audit, optional doc-preflight --rendered-layout, and doc-to-pdf --layout-warnings to flag PDF-rendered hanging-indent, margin, horizontal-shift, and References page-break mismatches. Expanded doc-formatting-info with --all/--start/--limit plus paragraph indent, tab, spacing, and page-break details. DOCX sanitization now preserves canonical w: prefixes when rewriting OOXML story/settings parts because OnlyOffice x2t can ignore layout properties in ns0:-round-tripped WordprocessingML.
4.4.11 General CLI modularization + direct handler coverage. Moved alias normalization plus the non-prefixed open/watch/info/editor-* / backup-* / status / help / list command layer into core/general_cli.py, reducing core/cli.py to bootstrap and modality routing. Added dedicated test_general_cli.py coverage for alias handling, editor-session parsing, backup pruning, usage errors, and unknown-command fallthrough.
4.4.10 Registry-driven handler usage strings. Extended core/command_registry.py with canonical command-usage lookups and usage overrides, then rewired the DOCX/XLSX/PPTX/PDF/RDF handlers plus general command usage errors to consume the registry instead of embedding raw Usage: strings. This removes the last large block of duplicated command-surface text from the handler layer.
4.4.9 Registry-driven command/help surface. Added core/command_registry.py as the single source of truth for command catalogue metadata, help examples, category counts, and total command count. help and status now consume the registry instead of maintaining separate hardcoded counts/descriptions, and regression coverage now verifies the live CLI surface matches the registry.
4.4.8 DOCX backend split completed + broader runtime coverage. Moved the remaining public DOCX CRUD, formatting, layout, metadata, table, hyperlink, list, and APA-reference methods into utils/doc_ops.py, reducing utils/docserver.py to shared helpers, editor/render plumbing, and thin wrappers. Expanded test_doc_ops.py to cover direct CRUD, formatting, table/search, metadata/layout, and reference-building workflows.
4.4.7 DOCX backend modularization + direct runtime regression coverage. Extracted DOCX submission/runtime logic into utils/doc_ops.py, moving hidden-data inspection, preflight/sanitization, DOCX image extraction, rendered preview delegation, and render-map generation out of utils/docserver.py. Added dedicated test_doc_ops.py coverage for sanitization, preflight, preview delegation, and render-map delegation.
4.4.6 XLSX backend modularization + direct runtime regression coverage. Extracted spreadsheet/chart runtime logic into utils/xlsx_ops.py, reducing utils/docserver.py to shared DOCX/editor/render responsibilities plus thin spreadsheet wrappers. Added dedicated test_xlsx_ops.py coverage for spreadsheet creation/writes, formula-audit risk detection, and preview delegation through the shared PDF render pipeline.
4.4.5 DOCX CLI modularization + dispatch regression coverage. Extracted document command parsing into core/doc_cli.py, moving the last large document command slab out of the main router while preserving the existing command surface and DOCX availability guards. Added dedicated test_doc_cli.py coverage for document creation, layout parsing, sanitization, preview dispatch, render-map dispatch, and unavailable-python-docx error handling.
4.4.4 XLSX/chart CLI modularization + dispatch regression coverage. Extracted spreadsheet and chart command parsing into core/xlsx_cli.py, removing the largest remaining command slab from the main router while preserving the public CLI surface. Added dedicated test_xlsx_cli.py coverage for spreadsheet writes/calculations, validation parsing, preview dispatch, Mann-Whitney dispatch, and chart creation dispatch.
4.4.3 PPTX modularization + regression coverage. Extracted presentation runtime logic into utils/pptx_ops.py and PPTX CLI parsing into core/pptx_cli.py. Added dedicated PPTX regression coverage for creation, notes, text/image/table editing, image extraction, spatial inspection, textbox/shape editing, preview delegation, and CLI dispatch. Also removed the lingering DOCX/PPTX symbol collision in the shared backend by localising presentation-specific imports.
4.4.2 PDF modularization + regression coverage. Extracted PDF runtime logic into utils/pdf_ops.py and PDF CLI parsing into core/pdf_cli.py. Added dedicated PDF regression coverage for extraction, rendering, block reading/search, hidden-data inspection, sanitization, and PDF CLI dispatch. This reduces pressure on the monolithic DOCX/XLSX/PPTX/PDF backend while preserving the existing command surface.
4.4.1 RDF modularization + hardening. Extracted RDF runtime logic into utils/rdf_ops.py and RDF CLI parsing into core/rdf_cli.py. Added dedicated RDF regression coverage for CRUD, query modes, merge/export, namespace handling, and SHACL validation. Hardened rdf-export with lock/backup discipline, made rdf-validate surface violation-parse errors, and extended rdf-remove so language-tagged and typed literals can be targeted precisely.
4.4.0 2 new commands + richer preflight auditing. Added doc-preflight to combine DOCX hidden-data inspection, page-size checks, font audits, and image sizing checks into a single submission report. Added pdf-inspect-hidden-data to expose PDF metadata, annotations, embedded files, forms, and page-size consistency before export or submission.
4.3.0 3 new commands + page-size upgrade. doc-layout now supports named page sizes (A4, Letter). Added doc-inspect-hidden-data for submission preflight, doc-sanitize for DOCX comment/revision/metadata cleanup, and pdf-sanitize for PDF metadata/XMP cleanup.
4.2.0 3 new commands. Native PDF block/span reading and search with exact bounding boxes, plus DOCX render-map generation that anchors paragraphs and table cells to OnlyOffice-rendered PDF coordinates for downstream review tooling.
4.1.0 15 new commands. Image extraction from PDFs (PyMuPDF), .docx, and .pptx files. PDF page-to-image rendering at configurable DPI. Spatial awareness for presentations — list all shapes with exact positions/sizes, add textboxes at precise coordinates, modify any shape by name. Slide preview rendering via OnlyOffice x2t. Excel-style data validation — dropdowns, number/decimal ranges, text length, date constraints, custom formulas — plus post-hoc data auditing that checks every cell against its rules. New deps: PyMuPDF, Pillow.
4.0.2 Comprehensive bug-fix audit across all four modes: RDF full rewrite — 13 bugs fixed (ASK/CONSTRUCT/DESCRIBE query support, rdf-remove literal/bnode type flag, file-not-found guard, double-iteration fix, locking + atomic saves on all write methods, lang+datatype mutual exclusion, self-merge guard, rdf-validate structured violations output); xlsx — xlsx-filter now validates operator before executing, xlsx-read returns error on unknown sheet name instead of silently reading all sheets; docx — doc-layout landscape correctly swaps page dimensions, doc-search NameError fixed on table-only documents; pptx — pptx-add-bullets leading-empty-line enumerate-index bug fixed (orphan empty first paragraph)
4.0.1 Bug fixes: two-layer file locking (threading.Lock + fcntl.flock) fixes concurrent write loss under thread load; docx defaults corrected to A4/1" margins/Calibri 11pt/double spacing; xlsx auto-fits column widths and sets A4 paper size; pptx defaults to 16:9 (13.333"×7.5"); status exposes active Python interpreter path
4.0.0 Added RDF mode (10 commands), 42 new CRUD/sheet/cell commands across all modes, atomic saves, file locking, auto-backups, full JSON output, SHACL validation support
3.0.0 Chart creation (bar, line, pie, scatter), statistical tests (t-test, chi-square, correlation), research analysis pack
2.0.0 Presentation support, formula safety auditing
1.0.0 Documents and spreadsheets

Author: SLOANE OS
License: MIT
Python: ≥ 3.8

About

90-command CLI for AI agents: Documents, Spreadsheets, Presentations, and RDF Knowledge Graphs — part of SLOANE OS

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages