-
Notifications
You must be signed in to change notification settings - Fork 9
Auto-discover project root by walking up to find .rr.yaml #154
Copy link
Copy link
Closed
Description
Problem
When running rr from a subdirectory of the project (e.g., opendata/opendata/ instead of opendata/), commands fail or sync incorrectly because rr uses the current working directory as the project root.
This is a common footgun when navigating around a project.
Proposed Solution
Walk up the directory tree to find .rr.yaml, similar to how other tools work:
gitfinds.gitdirectorynpm/bunfindpackage.jsoncargofindsCargo.tomlmakewith-Cor--directoryflag
Implementation
1. Check if .rr.yaml exists in cwd
2. If not, check parent directory
3. Repeat until .rr.yaml found or filesystem root reached
4. Use found directory as project root for all operations
Behavior
# From project root - works as today
cd ~/projects/myapp
rr test
# From subdirectory - should also work
cd ~/projects/myapp/src/components
rr test # Walks up, finds .rr.yaml in ~/projects/myapp, uses that as rootEdge Cases
- Multiple
.rr.yamlfiles in parent chain: use the nearest one (most nested) - No
.rr.yamlfound: error with helpful message - Optional
--rootflag to override auto-discovery
Alternatives
- Always require running from project root - Current behavior, error-prone
- Explicit
--rootflag - Verbose, easy to forget - Environment variable - Could complement auto-discovery
Prior Art
| Tool | Config file | Auto-discovery |
|---|---|---|
| git | .git/ |
Yes, walks up |
| npm | package.json |
Yes, walks up |
| cargo | Cargo.toml |
Yes, walks up |
| rr | .rr.yaml |
No (proposed) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels