Summary
Several Echo xtask repo-level commands derive their root from std::env::current_dir(). Replace those repo-root assumptions with the existing Git-discovered root helper (git rev-parse --show-toplevel) or an equivalent shared Rust boundary.
Problem
env::current_dir() is the invocation directory, not necessarily the repository root. Commands that read repo files, create method artifacts, check release files, or display repo-relative paths can become brittle when invoked from a subdirectory, an IDE task, an agent harness, or a nested workspace command.
Echo already has find_repo_root() in xtask/src/main.rs backed by git rev-parse --show-toplevel; the issue is that some repo-level code paths still bypass it.
Evidence
Current scan found std::env::current_dir() repo-root-style uses in xtask/src/main.rs, including method workspace commands around method_workspace, run_method_inbox, run_method_close, and run_method_pull. The same file already defines find_repo_root() using git rev-parse --show-toplevel, so this should be a consolidation rather than new discovery logic.
Desired Outcome
- Repo-level
xtask commands resolve a checkout root through Git discovery instead of assuming cwd is the root.
- Cwd remains available only for behavior that intentionally means invocation directory.
- Display paths remain stable and repo-relative when commands are run from subdirectories.
- Failure outside a Git checkout is explicit and actionable.
Acceptance Criteria
- A regression test or command witness proves a representative repo-level
xtask command works when invoked from a nested directory.
xtask has one shared repo-root discovery boundary for repo-level paths.
- Existing
cargo xtask commands keep their root-invocation behavior unchanged.
- Intentional crate-local test paths using
CARGO_MANIFEST_DIR are left alone unless they are actually claiming repo-root semantics.
Summary
Several Echo
xtaskrepo-level commands derive their root fromstd::env::current_dir(). Replace those repo-root assumptions with the existing Git-discovered root helper (git rev-parse --show-toplevel) or an equivalent shared Rust boundary.Problem
env::current_dir()is the invocation directory, not necessarily the repository root. Commands that read repo files, create method artifacts, check release files, or display repo-relative paths can become brittle when invoked from a subdirectory, an IDE task, an agent harness, or a nested workspace command.Echo already has
find_repo_root()inxtask/src/main.rsbacked bygit rev-parse --show-toplevel; the issue is that some repo-level code paths still bypass it.Evidence
Current scan found
std::env::current_dir()repo-root-style uses inxtask/src/main.rs, including method workspace commands aroundmethod_workspace,run_method_inbox,run_method_close, andrun_method_pull. The same file already definesfind_repo_root()usinggit rev-parse --show-toplevel, so this should be a consolidation rather than new discovery logic.Desired Outcome
xtaskcommands resolve a checkout root through Git discovery instead of assuming cwd is the root.Acceptance Criteria
xtaskcommand works when invoked from a nested directory.xtaskhas one shared repo-root discovery boundary for repo-level paths.cargo xtaskcommands keep their root-invocation behavior unchanged.CARGO_MANIFEST_DIRare left alone unless they are actually claiming repo-root semantics.