Skip to content

feat(cli): add JSON event output - #1110

Merged
KnifeLemon merged 1 commit into
KnifeLemon:mainfrom
yavuzmeteafsar:feat/cli-json-events
Nov 4, 2026
Merged

KnifeLemon merged 1 commit into
KnifeLemon:mainfrom
yavuzmeteafsar:feat/cli-json-events

Conversation

@yavuzmeteafsar

@yavuzmeteafsar yavuzmeteafsar commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

As agreed in #1076.

What does this change?

convert --json now streams events to stderr while it runs, one JSON object per line: {"event":"progress","source":…,"fraction":…} (0 to 1, about every 150 ms while it changes) and {"event":"file",…} as each file finishes, with the same fields as its entry in "files". stdout is unchanged and still gets one JSON document when the job is done.

watch gets a --json option: stdout carries only events, {"event":"started",…} with the folder, preset, target and output folder, {"event":"file",…} per converted file (same fields as convert --json), and {"event":"stopped"} on Ctrl+C.

A file event and the file's entry in files[] are written by the same function (WriteFileFields), so they can't drift apart. In watch --json the watcher is disposed before stopped, so a batch still running can't print after it. --json --quiet

@github-actions github-actions Bot added the feature New features label Nov 4, 2026

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @yavuzmeteafsar. This matches what we agreed in #1076: Utf8JsonWriter escapes the paths, lines are written whole under the gate, stopped comes last, and nothing changes with the flag off. CI is green. Merging.

We'll follow up on these ourselves, so nothing is needed from you:

  • watch --json --quiet still prints every event (Cli.cs:110). convert checks options.Json && !options.Quiet, and the help says --quiet prints nothing but errors.
  • Tests: OnlyEvents also passes on empty stderr, so the failed and cancelled runs don't prove a file event was written.
  • skills/filee/SKILL.md tells agents to always pass --json. Agent shells often merge stderr into stdout, so it should recommend --json --quiet now that stderr has events.

One thing for the changelog: a wrapper that reads stdout to the end before reading stderr can now stall on a long conversion, because writing an event blocks once the stderr pipe is full. --quiet avoids that.

@KnifeLemon
KnifeLemon merged commit d2e25d9 into KnifeLemon:main Nov 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants