Applies a reviewed old-to-new token map across a file set, longest token first so a shorter row cannot corrupt a longer one, skipping any line marked NAMING-ALLOW. The map is the artifact a human approves; this only applies it.
| Tier | tools |
| Role | tooling |
| Path | crates/tools/token-retarget |
| Edition | 2021 |
| Targets | tools-token-retarget, tools_token_retarget |
| Public items | 4 across 0 modules |
| Tests | 9 |
What it is for
Applies a reviewed old-to-new token map to text, so a rename campaign is a program and not a remembered shell line.
Two properties do the work, and both exist because the obvious implementation gets them wrong. Longest token first: a map holding both personals_ and personals_profiles must rewrite the longer one first, or the shorter row reaches it first and leaves sighting_profiles spelled as something nobody mapped. `NAMING-ALLOW` lines are untouched: a document that quotes a retired name in order to argue about it — a naming study, a lexicon row, a rename map — would otherwise be rewritten into nonsense by the very campaign it records.
The map is the artifact a human approves. This applies it and counts what it did.
Capabilities
crate root
Applies a reviewed old-to-new token map to text, so a rename campaign is a program and not
| Item |
|---|
pub const ALLOW_MARKER: & str |
Rule
Applies a reviewed old-to-new token map to text, so a rename campaign is a program and not
| Item |
|---|
pub struct Rule |
fn parse_map(tsv : & str) -> Vec <Rule> |
fn apply(text : & str, rules : & Rule) ->(String, usize) |
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 Rule | One approved substitution. |
pub const ALLOW_MARKER: & str | Marker that exempts a line |
fn parse_map(tsv : & str) -> Vec <Rule> | Parse a two-column TSV |
fn apply(text : & str, rules : & Rule) ->(String, usize) | Apply the rules to one file's text |
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/token-retarget |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
clap | ^4 | derive, env | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-cli-conformance` | tools | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["tools-token-retarget"] SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"] 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-token-retarget | `src/main.rs` |
| lib | tools_token_retarget | `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
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 9 |
| 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 | 4 | 0 | 0 |
What the tests establish, by name:
a_file_with_no_match_is_returned_byte_identical—src/lib.rsa_missing_trailing_newline_is_not_invented—src/lib.rsa_row_missing_its_second_column_is_not_a_rule—src/lib.rsa_shorter_rule_still_applies_where_no_longer_rule_matches—src/lib.rsan_allow_marked_line_is_never_rewritten—src/lib.rscomments_and_blank_lines_are_not_rules—src/lib.rsevery_occurrence_on_a_line_is_counted_and_replaced—src/lib.rsthe_longer_token_is_applied_before_the_shorter_one—src/lib.rscli_definition_conforms—src/main.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 4 | 4 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 4
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 279 |
| Code lines | 217 |
| Public API items | 4 |
| Public modules | 0 |
| Tests | 9 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 2 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"constant" : 1
"function" : 2
"struct" : 1
pie showData
title Rust source composition
"Code" : 217
"Blank or comment" : 62
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.