# s-yadav/relative-to-alias architecture

> Architecture diagram of the GitHub repository s-yadav/relative-to-alias, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/s-yadav/relative-to-alias
- Repository: https://github.com/s-yadav/relative-to-alias

## Overview

relative-to-alias is a CLI codemod: users specify source files, an alias and its target path; the tool discovers eligible files, rewrites matching imports or requires, and writes changed files back in place. The CLI orchestration and transformation helpers are implemented in `src/index.js` and `src/util.js`; the parallel `lib/` files are the published runtime entry. The graph follows the source implementation. Major relationships are supported by the excerpts; external library and filesystem interactions are shown where the source makes them explicit.

Main entry points: [`src/index.js`](https://github.com/s-yadav/relative-to-alias/blob/master/src/index.js) (CLI orchestration), [`src/util.js`](https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js) (File processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("CLI user"))
node_cli["CLI orchestration<br/>[index.js]"]
node_discovery["Source discovery<br/>[util.js]"]
node_glob["Glob library"]
node_filter["File filtering<br/>[util.js]"]
node_processing["File processing<br/>[util.js]"]
node_rewrite["AST rewriting<br/>[util.js]"]
node_filesystem["Filesystem"]

node_user -->|"provides options"| node_cli
node_cli -->|"builds search pattern"| node_discovery
node_cli -->|"searches files"| node_glob
node_cli -->|"filters candidates"| node_filter
node_cli -->|"transforms each file"| node_processing
node_processing -->|"reads and writes"| node_filesystem
node_processing -->|"gets transformed code"| node_rewrite

click node_cli "https://github.com/s-yadav/relative-to-alias/blob/master/src/index.js"
click node_discovery "https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js"
click node_filter "https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js"
click node_processing "https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js"
click node_rewrite "https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_cli,node_discovery,node_filter,node_processing,node_rewrite toneTeal
class node_glob,node_filesystem toneIndigo
```

## Components

### Other components

- **CLI user**
- [CLI orchestration](https://github.com/s-yadav/relative-to-alias/blob/master/src/index.js): `src/index.js`
- [Source discovery](https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js): `src/util.js`
- **Glob library**
- [File filtering](https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js): `src/util.js`
- [File processing](https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js): `src/util.js`
- [AST rewriting](https://github.com/s-yadav/relative-to-alias/blob/master/src/util.js): `src/util.js`
- **Filesystem**

## Connections

- CLI user → CLI orchestration: provides options (evidence: `README.md`)
- CLI orchestration → Source discovery: builds search pattern (evidence: `src/index.js`)
- CLI orchestration → Glob library: searches files (evidence: `src/index.js`)
- CLI orchestration → File filtering: filters candidates (evidence: `src/index.js`)
- CLI orchestration → File processing: transforms each file (evidence: `src/index.js`)
- File processing → Filesystem: reads and writes (evidence: `src/util.js`)
- File processing → AST rewriting: gets transformed code (evidence: `src/util.js`)
