Repairs stale `path = "..."` dependency values in Cargo manifests after crates move (the tier refactor renamed crates/forge-<x> to crates/<tier>/<x>). Reads the package-name -> directory index from the manifests that exist now, rewrites only path values that no longer resolve on disk, and reports any dep it cannot resolve instead of guessing. Standalone example workspaces (examples/*) are the class of victim: they carry their own lockfile and are not built by `cargo build --workspace`, so a moved crate breaks them silently.
| Tier | tools |
| Role | tooling |
| Path | crates/tools/path-dep-repair |
| Edition | 2021 |
| Targets | tools-path-dep-repair, tools_path_dep_repair |
| Public items | 14 across 0 modules |
| Tests | 11 |
What it is for
Pure repair logic: given a manifest's text, its directory, a package-name -> directory index, and a path-existence oracle, produce the repaired text plus the list of changes and unresolved deps.
Everything decidable is a pure function (Gate 2.1); the only fs work lives in main.rs (walking the tree, reading/writing files).
Capabilities
crate root
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
fn package_name(manifest : & str) -> Option <String> |
fn dep_table_header(line : & str) -> Option <String> |
fn relative_path(from_dir : & Path, to : & Path) -> String |
Change
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
pub struct Change |
PackageIndex
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
pub struct PackageIndex |
PackageIndex :: fn insert(& mut self, name : impl Into <String>, dir : impl Into <PathBuf>) |
PackageIndex :: fn get(& self, name : & str) -> Option <& Path> |
PackageIndex :: fn len(& self) -> usize |
PackageIndex :: fn is_empty(& self) -> bool |
PathDep
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
pub struct PathDep |
fn parse_path_dep(line : & str, section_dep : Option <& str>) -> Option <PathDep> |
Repair
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
pub struct Repair |
fn repair(manifest : & str, manifest_dir : & Path, index : & PackageIndex, exists : & dyn Fn(& Path) -> bool,) -> Repair |
Unresolved
Pure repair logic: given a manifest's text, its directory, a package-name ->
| Item |
|---|
pub struct Unresolved |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct PackageIndex | package name -> absolute directory holding its Cargo.toml. |
PackageIndex :: fn insert(& mut self, name : impl Into <String>, dir : impl Into <PathBuf>) | — |
PackageIndex :: fn get(& self, name : & str) -> Option <& Path> | — |
PackageIndex :: fn len(& self) -> usize | — |
PackageIndex :: fn is_empty(& self) -> bool | — |
fn package_name(manifest : & str) -> Option <String> | name = "..." from the package section |
pub struct Change | — |
pub struct Unresolved | — |
pub struct Repair | — |
fn repair(manifest : & str, manifest_dir : & Path, index : & PackageIndex, exists : & dyn Fn(& Path) -> bool,) -> Repair | Rewrite every path = "..." whose target does not exist, when the dependency name is in index |
pub struct PathDep | One path = "..." dependency as written in a manifest |
fn parse_path_dep(line : & str, section_dep : Option <& str>) -> Option <PathDep> | The dep a path = "..." line declares, or None for any other line |
fn dep_table_header(line : & str) -> Option <String> | dependencies.foo, dev-dependencies.foo, target.'cfg(x)'.dependencies.foo. |
fn relative_path(from_dir : & Path, to : & Path) -> String | A ..-relative path from from_dir to to, in forward-slash form for TOML. |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | tooling |
| Location | crates/tools/path-dep-repair |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
Development. None.
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_tools_crate_retarget["tools-crate-retarget"] -->|uses| SELF SELF["tools-path-dep-repair"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-path-dep-repair | `src/main.rs` |
| lib | tools_path_dep_repair | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
1 workspace crate depends on this one: tools-crate-retarget.
Verification
| Kind | Count |
|---|---|
| Unit tests | 11 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 10 | 0 | 4 |
What the tests establish, by name:
a_file_with_no_trailing_newline_stays_that_way—src/lib.rsan_aliased_dep_keeps_its_key_and_its_package_apart—src/lib.rsignores_a_commented_out_dep—src/lib.rskeeps_features_and_comments_on_the_line—src/lib.rsleaves_a_resolving_path_untouched_so_reruns_are_no_ops—src/lib.rspackage_name_ignores_a_bin_section_name—src/lib.rsrelative_path_walks_up_then_down—src/lib.rsreports_an_unknown_dep_instead_of_guessing—src/lib.rsresolves_a_dep_declared_as_its_own_table—src/lib.rsresolves_a_renamed_dep_by_its_package_key—src/lib.rsrewrites_a_broken_path_to_the_crates_new_home—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 7 | 14 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 7
"No rustdoc detected" : 7
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 584 |
| Code lines | 495 |
| Public API items | 14 |
| Public modules | 0 |
| Tests | 11 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 1 |
| Workspace reverse dependencies | 1 |
pie showData
title Public API by kind
"function" : 5
"method" : 4
"struct" : 5
pie showData
title Rust source composition
"Code" : 495
"Blank or comment" : 89
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.