Added shortcut commands to set graph_driver config#26
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds two new CLI shortcuts ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
cmd/config.go (1)
17-18: Consider centralizing the documentation URL in a constant.The same URL is printed in multiple places. A shared constant prevents drift during future doc URL updates.
♻️ Suggested refactor
package cmd import ( "fmt" env "github.com/SpecterOps/BloodHound_CLI/cmd/internal" "github.com/spf13/cobra" ) +const configDocsURL = "https://bloodhound.specterops.io/manage-bloodhound/bh-config" + // configCmd represents the config command var configCmd = &cobra.Command{ @@ Configuration values are documented here: -https://bloodhound.specterops.io/manage-bloodhound/bh-config`, +` + configDocsURL, Run: configDisplay, } @@ - fmt.Println(" https://bloodhound.specterops.io/manage-bloodhound/bh-config") + fmt.Println(" " + configDocsURL) }Also applies to: 34-35
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/config.go` around lines 17 - 18, Create a package-level constant (e.g., bhConfigURL or DocsURL) and replace the hard-coded string occurrences in cmd/config.go (the printed "https://bloodhound.specterops.io/manage-bloodhound/bh-config" at the two locations shown around the current lines 17-18 and 34-35) with that constant; update any fmt/print/log calls that use the literal so they reference the new constant to centralize the documentation URL and avoid duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmd/graphDriver_test.go`:
- Around line 14-16: Extend the test around pgCmd to also exercise the alias
commands for "postgres" and "postgresql": call the command(s) or invoke the same
execution path as pgCmd for the "postgres" and "postgresql" aliases, then call
env.GetConfig([]string{"graph_driver"}) and assert the returned setting equals
"pg" (same pattern as pgSetting and assert.Equal used currently); update or add
assertions to verify both aliases set graph_driver to "pg" using the existing
pgCmd/test helpers so tests cover all new alias behaviors.
In `@cmd/graphDriver.go`:
- Around line 21-23: The Run handlers for the shortcut commands currently ignore
extra positional arguments (e.g., "neo4j foo"); add argument validation so
unexpected args are rejected: set Args: cobra.ExactArgs(0) on the command
definitions (or explicitly check len(args)==0 at the top of the Run functions
and return an error) for the command(s) that call setGraphDriver("neo4j") and
the other Run handler referenced (the other shortcut at lines 33-35), so the
commands fail fast when any positional arguments are provided.
---
Nitpick comments:
In `@cmd/config.go`:
- Around line 17-18: Create a package-level constant (e.g., bhConfigURL or
DocsURL) and replace the hard-coded string occurrences in cmd/config.go (the
printed "https://bloodhound.specterops.io/manage-bloodhound/bh-config" at the
two locations shown around the current lines 17-18 and 34-35) with that
constant; update any fmt/print/log calls that use the literal so they reference
the new constant to centralize the documentation URL and avoid duplication.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bc804c67-0a2b-48be-8de1-e5dda171f670
📒 Files selected for processing (5)
CHANGELOG.mdcmd/config.gocmd/graphDriver.gocmd/graphDriver_test.gocmd/internal/env_test.go
Added shortcut commands for setting
graph_driverto make it easier for users to discover how to do this for OpenGraph. This also updates some terminal output to provide a documentation reference.Summary by CodeRabbit
New Features
Documentation
Tests