feat(nubi): add single query (-q/--query) and --async modes - #108
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single query mode to the nubi command with support for synchronous and asynchronous execution, along with corresponding documentation and tests. It also cleans up several unused commands and adds new workflow management commands (approve, replay, task-definitions, and templates). The review feedback recommends validating that the --async flag is only used in conjunction with --query to avoid silent failures, and propagating the active command context instead of using context.Background() when retrieving usage metrics.
…unused subcommands
a743920 to
d34e18e
Compare
…to GetUsageMetrics
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a single-query non-interactive mode to the nbctl nubi command, allowing synchronous and asynchronous query execution via the new --query and --async flags. It also removes several unused subcommands and adds corresponding unit tests. The review feedback suggests avoiding package-level global variables for CLI flags to prevent state pollution and flaky tests, recommending instead that flags be retrieved dynamically from the command context and that the manual resets in the tests be removed.
…ad of global vars
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single query mode to the nbctl nubi command via the new --query and --async flags, updates the README with relevant documentation and examples, removes several unused subcommands, and adds corresponding unit tests. The review feedback highlights opportunities to improve terminal behavior by gracefully handling interrupt signals with signal.NotifyContext, adding a warning message when a non-interactive query is left in a WAITING state, and using t.Cleanup in tests to reset global command flags and prevent test pollution.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single query mode to the nubi command, supporting both synchronous and asynchronous execution via the new --query and --async flags, while removing several unused subcommands and updating the documentation and tests. The review feedback suggests using errors.Is to safely check for context cancellation, explicitly setting the username configuration in tests to ensure they are hermetic, and adding test coverage for the synchronous query flow.
…me in tests, and add sync query test
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single-query mode to the nbctl nubi command via the new --query (-q) and --async flags, updates the documentation, deletes several unused subcommands (create, delete, suggest), and adds comprehensive unit tests. The feedback suggests removing a redundant context cancellation assignment in single-query mode and improving the user experience by providing instructions on how to resume a conversation when Nubi is waiting for a followup response.
…nd in WAITING notice
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a single-query (non-interactive) mode to the nbctl nubi command, supporting both synchronous and asynchronous execution via the new --query (-q) and --async flags. It also cleans up several unused commands (create, delete, suggest) and adds comprehensive unit tests. The feedback suggests trimming the query string to prevent whitespace-only queries, returning the context cancellation error instead of nil to ensure a non-zero CLI exit code, and robustly handling potential trailing slashes in the endpoint URL construction.
…n, and trim endpoint trailing slash
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single-query mode to the nbctl nubi command, supporting both synchronous and asynchronous execution via the new --query and --async flags. It also cleans up unused subcommands (create, delete, and suggest), updates the documentation, and adds corresponding tests. The review feedback highlights a latent bug in the underlying GetUsageMetrics implementation where SessionID is used instead of ConversationID, and suggests refactoring duplicated lipgloss style definitions to improve code readability.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single-query mode to the nbctl nubi command, allowing users to execute queries synchronously or asynchronously using the new --query (-q) and --async flags. It also removes several unused subcommands (create, delete, and suggest), adds corresponding tests, and updates the documentation. The feedback recommends improving robustness by preventing unintended interactive fallback when an empty query is explicitly provided, and ensuring the terminal cursor is properly restored if a synchronous query is interrupted while the spinner is running.
…re cursor on signal interrupt
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive single query mode to the nbctl nubi command, supporting both synchronous and asynchronous execution via the new --query and --async flags. It also cleans up several unused command files and adds comprehensive unit tests. The reviewer feedback highlights two key improvements: avoiding os.Exit(1) in the background signal-handling goroutine to allow graceful cleanup, and returning nil instead of context.Canceled from Cobra's RunE to prevent redundant error messages upon cancellation.
…urn nil on context cancellation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a single query mode (non-interactive) to the nbctl nubi command, supporting both synchronous and asynchronous execution via the new --query and --async flags. It also cleans up unused subcommands (create, delete, suggest), adds comprehensive tests, and updates the documentation. The feedback highlights a potential issue where an empty endpoint configuration results in a broken URL being printed, and suggests falling back to a default URL.
Summary
This PR adds single-query non-interactive execution mode (
-q/--query) and--asyncflag support fornbctl nubi, and cleans up unused subcommand stubs.Changes
-q, --query <string>): Runs a single query non-interactively, outputs formatted markdown response, and exits without launching the interactive prompt shell.--async): Triggers an investigation asynchronously and outputs the Session ID immediately without polling/waiting for response.cmd/nubi_create.go,cmd/nubi_delete.go, andcmd/nubi_suggest.go.README.mdwith new flags and single-query usage examples.cmd/nubi_test.go.Verification
golangci-lint run: 0 issuesgo test ./...: 100% pass