# @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 slides read deck.pptx [--full] --json # durable ids + geometry an agent targets ops at; --full: whole text, tables, notes 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 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 / text overflow / overlap per slide, durable ids 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 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 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 create --type docx --from report.md --out report.docx # or --from fragment.html (restricted HTML) 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 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] --json # blocks (--full: whole text), comment threads, tracked changes, header/footer text 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 genoffice guide docs # op signatures + restricted-HTML rules ``` 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. Pivots, sparklines and edits to editor-session objects stay app-only. 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