feature request: function to get repository root directory
- Dominant language
- Rust
- Stars
- 35.8k
- Forks
- 846
- Avg merge
- 27m
- Merged PRs (30d)
- 3
Description
With `!include` support now it has allowed me to start using just in a monorepo and having shared rules and macro*ish* rules that can allow for reuse.
However including a common file is relative to the justfile that is being ran. So now when i start a new project I just have to be aware of the relative path to to the root of my repo and figure it out.
Example
```
build/common.just # common rules
project1/justfile # !include ../build/common.just
project2/subproject/justfile # !include ../../build/common.just
```
This works for now but it would be nice to have this as just
```
!include {{repo_root()}} / "build/common.just"
```
I think this also means allowing evaluation in the include statement which may not be there.
A function also come in handy for docker commands and other things that may want to know about the root.
This could look for `.git` .hg` etc files, or could be a generic function to look up until a certain file/directory is found and return it or the base directory.
Contributor guide
Research direction
The issue names no implementation files or tests. Start by tracing how !include paths are evaluated and how just determines the working or justfile directory; then define repository-root discovery and include-expression behavior, with completion requiring the proposed repo_root() use case to work for nested justfiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100