Skip to content

Use git-discovered repo root for xtask repo-level paths #531

Description

@flyingrobots

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.

Activity

  1. coderabbitai commented on Jun 3, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #308 - feat: begin PR workflow hardening [merged]
    #309 - feat: add Doghouse PR flight recorder [merged]
    #330 - test(wasm): own package export smoke boundary [merged]
    #383 - chore(dev-loop): kill the slow iteration loop on echo-wesley-gen tests [merged]
    #529 - Add Hello Echo demo and docs lifecycle policy [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions