Skip to content

fix(nubi): support --format json machine-readable output in single query mode - #109

Merged
blue4209211 merged 3 commits into
mainfrom
fix/nubi-format-json
Aug 20, 2026
Merged

fix(nubi): support --format json machine-readable output in single query mode#109
blue4209211 merged 3 commits into
mainfrom
fix/nubi-format-json

Conversation

@blue4209211

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for machine-readable JSON output (--format json) when executing nbctl nubi in single-query mode (both synchronous and asynchronous).

Changes

  • Machine-Readable Output: When --format json is specified with -q / --query:
    • Suppresses TUI markdown rendering, lipgloss borders, and spinner progress output.
    • Outputs a structured JSON payload containing query, response, status, conversation/session/account IDs, execution duration, and web URL.
    • Returns structured JSON payloads for async mode (--async) and context cancellation.
  • Testing: Added TestNubiCmd_SyncQuery_JSON unit test in cmd/nubi_test.go verifying JSON payload parsing and key assertions.

Verification

  • golangci-lint run ./...: 0 issues
  • go test ./...: 100% pass

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces JSON output formatting support to the nubi command, allowing users to retrieve structured execution details, and adds a corresponding unit test. The review feedback suggests enhancing this feature by ensuring all execution errors are returned in JSON format, parsing the raw usage metrics string into a structured nested JSON object for better machine readability, and adding corresponding test assertions to verify the metrics structure.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go
Comment thread cmd/nubi_test.go
@blue4209211
blue4209211 merged commit 8c343e3 into main Aug 20, 2026
2 checks passed
@blue4209211
blue4209211 deleted the fix/nubi-format-json branch August 20, 2026 17:49
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.

2 participants