feat(dawgrun): CLI mode#84
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR extends ChangesCLI mode and config infrastructure for dawgrun
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 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 unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tools/dawgrun/pkg/commands/config.go`:
- Around line 36-45: When loading connections in the loop that calls
openConnection for each entry in config.Connections, avoid leaving a partially
applied state by tracking successfully opened connections (e.g., opened :=
[]string{}) and on any openConnection error iterate over opened to roll them
back: call an existing teardown API (or implement one) such as
closeConnection(ctx, name) or removeConnection(name) to close resources and
remove them from the in-memory registry, then return the original error (or an
aggregated error if you prefer); update the loop around openConnection and
ensure opened is appended only after a successful open and cleaned up on error.
In `@tools/dawgrun/pkg/commands/db.go`:
- Around line 186-187: The error message currently includes the raw connStr
which may leak credentials; update the fmt.Errorf call in the DB open path (the
return using driverName and connStr) to omit or redact connStr and instead
include only safe identifiers like driverName or a connection identifier.
Replace fmt.Errorf("error opening %s database connection '%s': %w", driverName,
connStr, err) with a message that does not embed connStr (e.g. fmt.Errorf("error
opening %s database connection: %w", driverName, err)) or use a
sanitized/redacted version of connStr if you must show it.
In `@tools/dawgrun/README.md`:
- Around line 54-64: Replace the indented code examples in the README CLI
section with fenced code blocks using triple backticks and a language tag (use
"text") so markdownlint MD046 is satisfied; for each example that currently
shows lines like "dawgrun >", "dawgrun parse \"match (n) return n limit 1\"",
"dawgrun > list-connections", "dawgrun > save-connections", "dawgrun >
load-connections", and the two examples with paths, wrap the example lines with
```text and ``` (opening before the example and closing after) rather than using
indentation, and apply the same fenced-block change to the other occurrences in
the same README section.
🪄 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: 7c3893c9-4ed3-44c8-8dee-f346eb88638a
📒 Files selected for processing (20)
tools/dawgrun/.gitignoretools/dawgrun/README.mdtools/dawgrun/cmd/dawgrun/main.gotools/dawgrun/cmd/dawgrun/main_test.gotools/dawgrun/docs/RFC.mdtools/dawgrun/pkg/commands/commandcontext.gotools/dawgrun/pkg/commands/commandcontext_test.gotools/dawgrun/pkg/commands/commandscope.gotools/dawgrun/pkg/commands/config.gotools/dawgrun/pkg/commands/config_test.gotools/dawgrun/pkg/commands/cypher.gotools/dawgrun/pkg/commands/db.gotools/dawgrun/pkg/commands/help.gotools/dawgrun/pkg/commands/helpers.gotools/dawgrun/pkg/commands/opengraph.gotools/dawgrun/pkg/commands/registry.gotools/dawgrun/pkg/commands/runtime.gotools/dawgrun/pkg/texttools/cypher.gotools/dawgrun/pkg/texttools/style.gotools/dawgrun/pkg/types/config.go
💤 Files with no reviewable changes (1)
- tools/dawgrun/pkg/commands/helpers.go
| Run without arguments to start the REPL: | ||
|
|
||
| dawgrun > | ||
|
|
||
| Pass a command and its arguments to execute that command once and exit: | ||
|
|
||
| dawgrun parse "match (n) return n limit 1" | ||
|
|
||
| CLI mode reads `$XDG_CONFIG_HOME/dawgrun/config.json` (or the platform | ||
| equivalent) if it exists, so commands can refer to configured | ||
| connection names without an interactive `open` first. |
There was a problem hiding this comment.
Use fenced code blocks to satisfy markdownlint MD046.
These newly added command examples are indented code blocks, but markdownlint expects fenced blocks in this repo style (warnings at Lines 56, 60, 105, 112, 116, 120).
Suggested doc fix
-Run without arguments to start the REPL:
-
- dawgrun >
+Run without arguments to start the REPL:
+```text
+dawgrun >
+```
-Pass a command and its arguments to execute that command once and exit:
-
- dawgrun parse "match (n) return n limit 1"
+Pass a command and its arguments to execute that command once and exit:
+```text
+dawgrun parse "match (n) return n limit 1"
+```
-To list open and configured connection names directly:
-
- dawgrun > list-connections
+To list open and configured connection names directly:
+```text
+dawgrun > list-connections
+```
-Save the currently open connections to the default config file:
-
- dawgrun > save-connections
+Save the currently open connections to the default config file:
+```text
+dawgrun > save-connections
+```
-Load and open connections from the default config file:
-
- dawgrun > load-connections
+Load and open connections from the default config file:
+```text
+dawgrun > load-connections
+```
-Both commands accept an optional config path:
-
- dawgrun > save-connections ./dawgrun.local.json
- dawgrun > load-connections ./dawgrun.local.json
+Both commands accept an optional config path:
+```text
+dawgrun > save-connections ./dawgrun.local.json
+dawgrun > load-connections ./dawgrun.local.json
+```Also applies to: 103-121
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 56-56: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
[warning] 60-60: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tools/dawgrun/README.md` around lines 54 - 64, Replace the indented code
examples in the README CLI section with fenced code blocks using triple
backticks and a language tag (use "text") so markdownlint MD046 is satisfied;
for each example that currently shows lines like "dawgrun >", "dawgrun parse
\"match (n) return n limit 1\"", "dawgrun > list-connections", "dawgrun >
save-connections", "dawgrun > load-connections", and the two examples with
paths, wrap the example lines with ```text and ``` (opening before the example
and closing after) rather than using indentation, and apply the same
fenced-block change to the other occurrences in the same README section.
kpom-specter
left a comment
There was a problem hiding this comment.
Love the direction! This sets us up for more/different way of interacting with the data
Description
Adds a CLI mode to dawgrun, enabling users (and agents) to run queries, copy datasets, etc.
Note that this does not have any changes in the production path.
Type of Change
Testing
make test_allwithCONNECTION_STRINGset)Screenshots (if appropriate):
Driver Impact
drivers/pg)drivers/neo4j)Checklist
go.mod/go.sumare up to date if dependencies changedSummary by CodeRabbit
New Features
$XDG_CONFIG_HOME/dawgrun/config.json.load-connectionsandsave-connectionscommands.help allto display all available commands.Documentation