Skip to content

Add one-shot creation and option-aware views to batch - #286

Open
IoannisMaras wants to merge 2 commits into
iOfficeAI:mainfrom
IoannisMaras:feat/batch-one-shot-workflow
Open

Add one-shot creation and option-aware views to batch#286
IoannisMaras wants to merge 2 commits into
iOfficeAI:mainfrom
IoannisMaras:feat/batch-one-shot-workflow

Conversation

@IoannisMaras

Copy link
Copy Markdown

Summary

  • Add batch --create-if-missing so a missing document can be created and processed in one invocation
  • Add batch --save as an explicit persistence boundary for resident batches
  • Add an options object to batch items
  • Support view options such as start, end, max-lines, cols, range, type, limit, page, out, render, screenshot size, and grid
  • Support outline, filtered HTML/SVG, and HTML screenshots inside a batch
  • Make schema validation errors fail the batch and trigger atomic rollback
  • Remove a newly created target if an atomic batch fails

Motivation

Batch already supported document edits. The missing capability was command options and several view modes. For example, this could not previously be expressed inside a batch:

officecli view report.docx text --start 1 --max-lines 50 --json

It required a separate CLI invocation after the batch, adding another process startup and document-open cycle. It could also lead callers to request an unbounded view and consume substantially more output tokens when they only needed a small section.

The same bounded view can now be part of operations.json:

{
  "command": "view",
  "mode": "text",
  "options": {
    "start": "1",
    "max-lines": "50"
  }
}

Page-specific screenshot output can also remain in the batch:

{
  "command": "view",
  "mode": "screenshot",
  "options": {
    "page": "1",
    "render": "html",
    "out": "page-1.png",
    "screenshot-width": "1000"
  }
}

Together with creation, this enables a one-shot workflow:

officecli batch report.docx `
  --create-if-missing `
  --input operations.json `
  --save `
  --json

Local timings

Creation-path comparison measured on the same Windows machine and Release build:

Workflow Time
Separate create invocation 1.61 s
Empty batch with --create-if-missing 0.77 s
Saved about 0.85 s (about 52%)

For commands that previously had to run outside the batch, each avoided invocation removes roughly one CLI startup plus a document-open cycle. Local read/view commands were generally around 0.34-0.42 s per separate invocation. Output-limiting options such as max-lines also reduce response size, although token savings depend on the document and requested limit and were not benchmarked here.

These are local wall-clock measurements intended to illustrate avoided overhead, not a formal cross-platform benchmark.

Validation

  • Release build succeeds with 0 errors
  • Create + edit + outline + validate + save smoke test passes
  • git diff --check passes
  • Persistent/prewarmed Chromium experiments are not included

@IoannisMaras

Copy link
Copy Markdown
Author

I didnt want to mess up the skills , but I you want me to include these changes there I could do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant