feat(nubi): add kb and memory command groups for Knowledge Base and Cortex context - #116
Conversation
|
/gemini review |
1 similar comment
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces two new CLI command files, cmd/nubi_kb.go and cmd/nubi_memory.go, to manage Knowledge Base vector sources and AI-learned operational memory. The review feedback highlights opportunities to improve error handling by defensively checking GraphQL response structures, concatenating all backend errors instead of reporting only the first one, and preserving detailed error context from resolveAccountID. Additionally, it suggests reducing code duplication by defining the --account-id flag as a persistent flag on the parent command.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces two new CLI command files, cmd/nubi_kb.go and cmd/nubi_memory.go, to manage Knowledge Base vector sources and AI operational memory respectively. The review feedback highlights two main issues: first, the fallback logic for resolving the account-id incorrectly ignores the positional argument when a default profile exists, preventing overrides; second, several commands discard the original error context from resolveAccountID instead of wrapping it with %w to preserve troubleshooting details.
…ault and wrap error context with %w
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands under the nubi command group to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. The review feedback highlights a bug in both cmd/nubi_kb.go and cmd/nubi_memory.go where an explicitly provided positional [account-id] argument is ignored if a profile-level account-id is already configured in viper. To resolve this, the resolution logic should be restructured to prioritize the command-line flag and positional argument over the profile configuration.
…nt ID precedence and join GraphQL backend errors
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands under the nubi namespace to manage Knowledge Base vector sources (kb commands for listing, getting, syncing, enabling, and disabling) and AI-learned operational memory (memory commands for listing), along with their corresponding unit tests. The reviewer feedback suggests adopting a more defensive approach when parsing GraphQL responses by using pointer fields for the top-level query or mutation keys (such as ai_list_kb, ai_get_kb, ai_sync_kb, ai_update_kb_enabled, and ai_list_memory) to prevent potential nil pointer dereferences if these keys are missing or null in the response.
…o prevent nil panics
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands for managing AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding tests and helper functions. The review feedback focuses on improving code quality and error handling by reusing the existing client.GraphQLErrors type, defining named structs instead of inline anonymous structs or raw maps to ensure consistent output formatting, defensively validating GraphQL responses, and adding input validation for the limit flag.
There was a problem hiding this comment.
Code Review
This pull request introduces commands to manage AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding tests. It also adds a helper function to resolve account IDs with positional argument precedence. The review feedback suggests improving robustness by handling ignored errors when retrieving command-line flags in cmd/account_id.go and cmd/nubi_memory.go, and reducing code duplication by declaring the --account-id flag as a persistent flag on the parent kb command.
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands to manage AI Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. It also adds a helper function to resolve account IDs with positional argument support. The feedback highlights opportunities to improve code robustness and maintainability by handling ignored errors when reading CLI flags in cmd/account_id.go and cmd/nubi_memory.go, and by refactoring duplicated request-handling logic across the kb subcommands in cmd/nubi_kb.go.
…abular output in text mode
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory) under the nubi command group. It also adds helper logic to resolve account IDs with positional argument precedence, along with comprehensive unit tests for the new commands. Feedback is provided to validate the limit flag in the memory list command to ensure it is a positive integer.
|
/gemini review |
…d handle flag errors in account_id.go
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands under the nubi namespace to manage Knowledge Base vector sources (kb) and AI-learned operational memory (memory), along with their corresponding unit tests. It also adds a helper function resolveAccountIDWithPositional to handle account ID resolution with positional argument precedence. Feedback suggests defining the account-id flag as a persistent flag on the parent nubiKbCmd to reduce code repetition across its subcommands.
I am having trouble creating individual review comments. Click here to see my feedback.
cmd/nubi_kb.go (360-364)
To reduce code repetition and improve maintainability, you can define the account-id flag once as a persistent flag on the parent nubiKbCmd. This will make the flag available to all of its subcommands (list, get, sync, etc.) without needing to declare it for each one individually.
nubiKbCmd.PersistentFlags().String("account-id", "", "Account ID (overrides profile)")
There was a problem hiding this comment.
Code Review
This pull request introduces new CLI commands under nubi kb and nubi memory to manage Knowledge Base vector sources and AI-learned operational memory, respectively, along with their corresponding unit tests. It also updates account ID resolution logic to support positional arguments. Feedback suggests trimming whitespace from resolved account IDs to prevent validation issues and refactoring shared GraphQL error types and helpers into a common file to improve maintainability.
Description
Extends
nbctl nubiwith dedicated command groups for Knowledge Base vector management (nbctl nubi kb) and AI-learned operational memory / Cortex context (nbctl nubi memory):New Commands
nbctl nubi kb(Knowledge Base Management):nbctl nubi kb list [account-id](Query:ai_list_kb) — List Knowledge Base vector sources with status, document counts, and sync timestamps.nbctl nubi kb get <kb-id>(Query:ai_get_kb) — Fetch detailed specs and metadata for a Knowledge Base source.nbctl nubi kb sync <kb-id>(Mutation:ai_sync_kb) — Trigger manual re-indexing / vector embedding sync for a KB source.nbctl nubi kb enable <kb-id>&nbctl nubi kb disable <kb-id>(Mutation:ai_update_kb_enabled) — Toggle active status for AI agent retrieval.nbctl nubi memory(Cortex & Operational Memory):bcortex,app-context.nbctl nubi memory list [account-id] [--type <pattern|decision>] [--query <text>](Query:ai_list_memory) — Query AI-learned infrastructure memory, architecture decisions, and operational preferences.Testing & Verification
make lint— 0 issues.go test ./...— 100% PASS.devenvironment (listing 33 Knowledge Base sources and operational memory entries).