Support different cli output formats: text, json, streaming json#10812
Merged
Support different cli output formats: text, json, streaming json#10812
Conversation
Contributor
All issues have been resolved.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
apps/cli/src/commands/cli/run.ts
Outdated
|
|
||
| if (useJsonOutput) { | ||
| const errorEvent = { type: "error", id: Date.now(), content: errorMessage } | ||
| console.log(JSON.stringify(errorEvent)) |
Contributor
There was a problem hiding this comment.
In JSON output mode, quietMode is enabled (line 228), which suppresses console.log in the ExtensionHost constructor before host.activate() is called. If an error occurs during activation, this console.log will be a no-op since restoreConsole() only runs inside host.dispose() which happens after this line. The error output will be silently discarded.
Suggested change
| console.log(JSON.stringify(errorEvent)) | |
| process.stdout.write(JSON.stringify(errorEvent) + "\n") |
Fix it with Roo Code or mention @roomote and request a fix.
Contributor
There was a problem hiding this comment.
Fixaroo
See task on Roo Cloud
Fixed the reported issue. All local checks passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Adds support for CLI output formats (text, json, streaming json) with a new
JsonEventEmitterclass and updates to CLI options and validation.--output-formatoption inindex.tsandrun.tsto specify output format astext,json, orstream-json.outputFormatinrun.tsand ensures it only works with--printmode.run.tsto handle different output formats, usingJsonEventEmitterfor JSON outputs.JsonEventEmitterinjson-event-emitter.tsto handle structured JSON output, supportingjsonandstream-jsonmodes.ExtensionHostinextension-host.tsto integrate withJsonEventEmitter.OutputFormatand related types injson-events.ts.FlagOptionsintypes.tsto includeoutputFormat.This description was created by
for d9805c4. You can customize this summary. It will automatically update as commits are pushed.