# @genoffice/cli `genoffice` is the GenOffice command line. It exposes the suite's document engines to scripts and AI agents without opening a window: the packaged app runs the bundled CLI on its own Node runtime (`ELECTRON_RUN_AS_NODE`), so nothing extra has to be installed. ``` genoffice info report.docx genoffice convert scan.pdf --to docx genoffice convert data.csv --to xlsx --out out/data.xlsx genoffice open report.docx genoffice convert scan.pdf --to pptx --json genoffice guide slides # op groups; `genoffice guide slides insert` for one group, `genoffice guide slides setText` for one op genoffice slides read deck.pptx [--full] --json # durable ids + geometry an agent targets ops at; --full: whole text, tables, notes; text elements add `effective` (displayed style of the first run + `src` = the inheritance layer each value comes from) genoffice slides read deck.pptx --units in --json # box and size in inches (or cm, pt, px at 96 dpi) with `unit` named; default emu genoffice create --type pptx --ops deck.json --out deck.pptx genoffice create --type pptx --spec deck/pages --outline deck/outline.json --out deck.pptx # one page spec file per slide (`genoffice guide slides design|spec`) genoffice create --type pptx --spec deck.json --out deck.pptx --render deck/previews --audit # plus one PNG per slide (detail.previews) and the geometry audit (detail.audit) in the same call genoffice slides check deck/outline.json | deck/pages/03.json # outline rules (exit 1 on errors) / build + audit one page file genoffice slides replace deck.pptx --slide 2 --spec deck/pages/03.json # rebuild one slide from its page file genoffice slides apply deck.pptx --ops edit.json [--dry-run] [--out copy.pptx] genoffice slides audit deck.pptx [--slide 0] --json # out_of_bounds / off_slide / text_overflow / text_overflow_width / overlap / picture_distorted: typed issues with durable ids and a setTransform `suggest` where geometry fixes it genoffice slides render deck.pptx --out shots/ [--scale 2] # one PNG per slide through the app's PDF export genoffice render report.docx|book.xlsx|page.html|file.pdf --out shots/ [--page 3] [--scale 2] # one PNG per page of any document, to look at what was made genoffice render deck.pptx --out shots/ --el e_12 [--pad 16] # plus the page cropped to that element (-NN-e_12.png) genoffice render deck.pptx --out shots/ --grid [--cols 4] [--tile 320] # plus -grid.png: every page on one contact sheet genoffice create --type xlsx --from table.json --out book.xlsx # 2-D array or {sheets:[{name,rows}]}; "=..." cells are formulas genoffice create --type xlsx --from data.csv --out data.xlsx [--header] [--decimal ,] # ISO dates become real dates; sep= lines are honoured genoffice sheet read book.xlsx [--sheet Data] [--range A1:D20] [--formats] --json # values, formulas, sheet features; --formats adds styles, widths, heights genoffice sheet apply book.xlsx --cells cells.json # [{cell:"B2", value|formula, style?, sheet?}] genoffice sheet apply book.xlsx --ops ops.json [--dry-run] # workbook DSL: cells, formats, charts, tables, filters, conditional formats, validation, links, notes, panes, page setup, sheets (`genoffice guide sheets`) genoffice sheet check book.xlsx --json # formula errors, missing-sheet references, broken defined names, chart ranges off the data, ### columns (suggest: set_col_width), placeholder text, existing rules; exit 0 genoffice sheet links book.xlsx # external [n] links: stored path, resolved path, reachable, source sheets genoffice sheet links book.xlsx --update # re-read reachable sources and write the computed values as the formulas' cached (formulas untouched; unreachable links keep their cache) genoffice sheet links book.xlsx --break 1,2 # break links: formulas become their cached values, the links' parts are removed and surviving links renumber genoffice create --type docx --from report.md --out report.docx # or --from fragment.html (restricted HTML); the new file carries Word-like docProps/core.xml + app.xml; --no-generator-fields drops the Application / AppVersion stamps genoffice convert notes.md --to docx|html genoffice convert report.docx --to html # the Word editor's standalone-HTML export genoffice convert page.html --to docx # html2docx, same as the HTML app's Export as Word genoffice convert report.docx --to md # GFM via the markdown editor's serializer genoffice convert letter.doc --to docx # Word 97-2003 .doc/.dot through the in-process doc2docx importer genoffice convert book.xlsx --to csv [--sheet Data] # one sheet, cell text as displayed, UTF-8 BOM, CRLF genoffice capabilities --json # which cloud features GenOffice has configured (no network call) genoffice search "electron headless export" [--images] [--max 6] --json genoffice image "isometric office, soft light" --aspect 16:9 --out hero.png genoffice media photo.jpg --ask "What text is in this picture?" --json genoffice docs read report.docx [--range 0-9] [--html] [--full] [--comments] [--revisions] [--header-footer] [--properties] --json # blocks (--full: whole text; contentControls chain + inlineContentControls for w:sdt controls), comment threads, tracked changes, header/footer text, document properties (custom values plus their vt customTypes) genoffice docs apply report.docx --ops ops.json [--dry-run] # apply_ops entries + insert_content / replace_blocks / insert_image / insert_chart / edit_chart / set_header_footer / reply_comment / resolve_comment / set_properties (document metadata; numeric/boolean custom values keep or take a typed vt type) / wrap_content_control / unwrap_content_control (nested tags unwrap level by level) / remove_parts (strip customXml + web-extension parts) genoffice docs check report.docx --json # fields without results, broken bookmark references, stale TOC, missing images, empty charts/headings, heading level skips, placeholder text, pending revisions, open comments; exit 0 genoffice docs compare original.docx revised.docx --out redline.docx [--author name] [--date iso] [--granularity word|char] [--ignore formatting,case,whitespace] # redline: the revised document with the differences marked as tracked insertions and deletions; --json reports the counts genoffice merge invoice-template.docx --data values.json --out invoice.docx [--force] [--strict] # fill {{key}} placeholders in a docx/pptx/xlsx template; reports used, unused and unresolved keys (or --data '{"name":"Ada"}') genoffice pdf read scan.pdf [--page 3 | --range 1-5] [--full] --json # text layer page by page (pages 1-20 by default, 4000 characters each) with page sizes and metadata; headless pdfium, no app process genoffice guide docs # op signatures + restricted-HTML rules (`guide --json` = the catalog with each op's schema and a fingerprint) genoffice selection report.docx --json # what the user has selected in the editor showing the file genoffice skill list # coding agents found on this machine and the skill version each has genoffice skill install --dir ./skills --force # copy the bundled skill into a skills directory genoffice install-cli # put genoffice on the PATH genoffice mcp --http 3000 [--host 127.0.0.1] [--token secret] # Streamable HTTP for clients on other machines; omit --http for stdio genoffice mcp --compact-schemas # advertise ops/cells/data as plain arrays instead of the per-op schema (smaller tools/list; also GENOFFICE_MCP_COMPACT_SCHEMAS=1) genoffice mcp install all # register the stdio server with every coding agent found (or one: claude-code, codex, cursor, gemini, copilot, opencode, windsurf, dsh) genoffice mcp list # each agent's MCP config and whether genoffice is registered; `mcp uninstall ` removes the entry ``` Word and Markdown commands run the docs and markdown editors under jsdom (installed once per process, loaded lazily). Those modules are imported from the app renderers by relative path until they move into packages of their own. Workbook writes go through `@genoffice/xlsx-gateway` (the app's save path). The in-memory workbook validates and applies the cell, format and structure ops; ops the snapshot cannot hold (charts, images, tables, filters, conditional formats, validation, hyperlinks, notes, panes, page setup, protection, defined names, tab order) become the gateway's declarative save payloads, as the app's edit journal does. `add_pivot` and `add_sparkline` run headless too; only `refresh_pivot` and edits to objects created in an editor session (`add_table_row` / `add_table_column`, `delete_table_row` / `delete_table_column` / `delete_table`, `edit_shape`, `delete_visual`) are refused headless. After writing formulas genoffice evaluates them with the xlsx sidecar and stores the results as cached values, so `sheet read` and plain readers see numbers, not blanks. `create`/`slides apply` take the same ops the in-app AI uses (`@genoffice/pptx-ops`), as a JSON array or `{ "ops": [...] }`; `--ops -` reads stdin. Image ops accept a local file path in their `bytes` field. A rejected op comes back with the guided error and its usage line so the caller can fix and retry; atomic transactions leave the file untouched. `create --type pptx --spec` is the CLI end of the app's deck generation pipeline (`@genoffice/pipelines`): the caller's agent does the design work following `genoffice guide slides design`, writing the style sheet, the outline and one page spec file per slide (`genoffice guide slides spec`), and the same page builder the app uses turns them into a pptx, measuring every text box and growing it to its content. Where the app separates the stages into model calls, the CLI separates them into files: `slides check` validates the outline against the planning rules and builds and audits a single page file, then checks it against its outline entry and the style sheet's palette (both found beside the page files), `create --spec ` runs the same checks on every file and refuses to assemble a deck with pages missing or disagreeing with the outline, and `slides replace` rebuilds one slide from its file. `slides audit` runs the app's deterministic layout audit; `slides render` gives the agent PNGs to look at. No model call happens inside genoffice. Every command prints a one-line human summary by default or a single JSON object with `--json` (`{ status, command, summary, output_path?, warnings?, detail? }`); `warnings[]` (`{ code, message, suggestion? }`) carries advisories about a result that still succeeded. Errors are `{ status: "error", code, error, message, suggestion?, detail? }`: `code` is the exit code, `error` a stable snake_case reason (`unknown_op`, `target_not_found`, `out_of_range`, `sheet_not_found`, `file_open_in_gui`, …) and `suggestion` the next step (with `did you mean …?` for one-typo mistakes); the facts an agent needs to retry (valid ranges, available ids, sheet names, usage lines) come back as fields in `detail` rather than only inside the message. Exit codes: `0` ok, `1` usage, `2` file, `3` conversion failed, `4` app not available. ## Template merge `genoffice merge