Skip to content

feat(nubi): add single query (-q/--query) and --async modes - #108

Merged
blue4209211 merged 10 commits into
mainfrom
feat/nubi-single-query-mode
Aug 13, 2026
Merged

feat(nubi): add single query (-q/--query) and --async modes#108
blue4209211 merged 10 commits into
mainfrom
feat/nubi-single-query-mode

Conversation

@blue4209211

Copy link
Copy Markdown
Contributor

Summary

This PR adds single-query non-interactive execution mode (-q / --query) and --async flag support for nbctl nubi, and cleans up unused subcommand stubs.

Changes

  • Single Query Mode (-q, --query <string>): Runs a single query non-interactively, outputs formatted markdown response, and exits without launching the interactive prompt shell.
  • Async Execution (--async): Triggers an investigation asynchronously and outputs the Session ID immediately without polling/waiting for response.
  • Subcommand Cleanup: Removed empty stub subcommand files cmd/nubi_create.go, cmd/nubi_delete.go, and cmd/nubi_suggest.go.
  • Documentation: Updated README.md with new flags and single-query usage examples.
  • Testing: Added unit tests in cmd/nubi_test.go.

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 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.

Comment thread cmd/nubi.go Outdated
Comment thread cmd/nubi.go Outdated
@blue4209211
blue4209211 force-pushed the feat/nubi-single-query-mode branch from a743920 to d34e18e Compare August 13, 2026 06:41
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go Outdated
Comment thread cmd/nubi.go Outdated
Comment thread cmd/nubi_test.go
Comment thread cmd/nubi_test.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go
Comment thread cmd/nubi_test.go Outdated
Comment thread cmd/nubi_test.go Outdated
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi_test.go Outdated
Comment thread cmd/nubi_test.go Outdated
Comment thread cmd/nubi_test.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go Outdated
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go
Comment thread cmd/nubi.go Outdated
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go Outdated
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
Comment thread cmd/nubi.go
@blue4209211

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 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.

Comment thread cmd/nubi.go
@blue4209211
blue4209211 merged commit 5305d40 into main Aug 13, 2026
2 checks passed
@blue4209211
blue4209211 deleted the feat/nubi-single-query-mode branch August 13, 2026 11:00
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