Add RODNEY_HOME env var to support custom state directories.#11
Merged
Conversation
Owner
|
Thanks for the PR, I've now handled this need in a different way: |
Owner
|
I'm open to arguments as to why we should add this as well though, it may turn out to be a useful feature even with |
Owner
|
I'm leaning towards accepting this - it is a bit messy having a hard-coded path like that for the default case. |
Contributor
Author
|
Thanks for merging! Having both I particularly like your local-first resolution from #14 since this avoids having global state var or prefixing RODNEY_HOME for invocation (which messes up Claude's permission cache which is a bit annoying). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
RODNEY_HOMEenvironment variable to customize the state directory, instead of it being hardcoded to~/.rodney.This is a potential solution for #6 that could support per-project, or temporary, state directories, while imposing no overhead/impact for users that don't need it.
I choose env variable as the mechanism because there are already some env vars that control how the binary works (
ROD_CHROME_BIN,HTTPS_PROXY), and the documented CLI flags (eg. for accessibility testing) seem to be subcommand-specific.Designed and developed using Claude Code (Opus 4.6), I personally reviewed the output and tested it locally before submitting this PR.
This is the complete plan Claude implemented:
Add
RODNEY_HOMEenvironment variableContext
The rodney data directory (
~/.rodney/) is hard-coded via thestateDir()function inmain.go:41-44. There is no way to customize it, which blocks per-project or multi-session usage (see GitHub issue #6). We'll add aRODNEY_HOMEenv var to allow overriding the directory.Changes
1.
rodney-src/main.go(lines 41-44)Replace the current
stateDir()with a minimal version that checksRODNEY_HOMEfirst:No validation or directory creation here —
saveState()(line 63) andcmdStart()(line 262-263) already callos.MkdirAllon the returned path.2.
rodney-src/main_test.goAdd tests (no browser needed — pure function tests):
TestStateDir_Default— unsetRODNEY_HOME, verifystateDir()returns$HOME/.rodneyTestStateDir_EnvVar— setRODNEY_HOMEto a temp dir, verifystateDir()returns it3.
rodney-src/help.txtAdd
RODNEY_HOMEto the configuration/environment section.4.
rodney-src/README.mdAdd
RODNEY_HOMEto the configuration table.Verification
cd rodney-src && go test -run TestStateDir -vgo build -o rodney .RODNEY_HOME=/tmp/rodney-test ./rodney start && ls /tmp/rodney-test/ && RODNEY_HOME=/tmp/rodney-test ./rodney stop