Summary
Several Wesley Rust xtask repo-level checks derive their root from std::env::current_dir() / env::current_dir(). Move repo-root discovery to a shared Rust helper backed by git rev-parse --show-toplevel, and reserve cwd for behavior that intentionally means invocation directory.
Problem
env::current_dir() is not a repository-root contract. Release checks, docs checks, manifest checks, and other repo-level guards become brittle when invoked from a subdirectory, an IDE runner, an agent harness, or a nested workspace command.
Wesley already uses Git root discovery in some code paths, such as schema diff path handling. The missing piece is consolidating repo-level xtask checks onto the same posture.
Evidence
Current scan found env::current_dir() repo-root-style uses in xtask/src/main.rs, including release manifest checks, required-file checks, backlog checks, docs checks, node-retirement ledger checks, docs truth checks, and forbidden-literal checks. Wesley CLI also has a Git-root helper for schema diff (git rev-parse --show-toplevel), which is the preferred shape for repo-root semantics.
Desired Outcome
- Repo-level Rust
xtask checks resolve the checkout root with Git discovery.
- Cwd remains injectable/explicit only where invocation directory semantics are intended.
- Checks can be run from nested directories without misreading paths relative to the nested cwd.
- Failure outside a Git checkout is explicit and actionable.
Acceptance Criteria
- A regression test or command witness proves a representative repo-level
xtask check works when invoked from a nested directory.
xtask has one shared repo-root discovery boundary for repo-level checks.
- Existing root-invocation behavior remains unchanged.
- Crate-local tests using
CARGO_MANIFEST_DIR are left alone unless they are actually asserting repo-root semantics.
Related Local Backlog
Wesley already has local ambient runtime-environment debt documented in docs/method/backlog/bad-code/RUNTIME_cli-runtime-environment-port.md; this issue is the narrower Rust repo-root slice.
Summary
Several Wesley Rust
xtaskrepo-level checks derive their root fromstd::env::current_dir()/env::current_dir(). Move repo-root discovery to a shared Rust helper backed bygit rev-parse --show-toplevel, and reserve cwd for behavior that intentionally means invocation directory.Problem
env::current_dir()is not a repository-root contract. Release checks, docs checks, manifest checks, and other repo-level guards become brittle when invoked from a subdirectory, an IDE runner, an agent harness, or a nested workspace command.Wesley already uses Git root discovery in some code paths, such as schema diff path handling. The missing piece is consolidating repo-level
xtaskchecks onto the same posture.Evidence
Current scan found
env::current_dir()repo-root-style uses inxtask/src/main.rs, including release manifest checks, required-file checks, backlog checks, docs checks, node-retirement ledger checks, docs truth checks, and forbidden-literal checks. Wesley CLI also has a Git-root helper for schema diff (git rev-parse --show-toplevel), which is the preferred shape for repo-root semantics.Desired Outcome
xtaskchecks resolve the checkout root with Git discovery.Acceptance Criteria
xtaskcheck works when invoked from a nested directory.xtaskhas one shared repo-root discovery boundary for repo-level checks.CARGO_MANIFEST_DIRare left alone unless they are actually asserting repo-root semantics.Related Local Backlog
Wesley already has local ambient runtime-environment debt documented in
docs/method/backlog/bad-code/RUNTIME_cli-runtime-environment-port.md; this issue is the narrower Rust repo-root slice.