# kylef/pathkit architecture

> Architecture diagram of the GitHub repository kylef/pathkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kylef/pathkit
- Repository: https://github.com/kylef/pathkit

## Overview

PathKit is a small Swift library for representing filesystem paths and performing path-related operations. A caller creates or combines a Path, then uses it to inspect or transform paths, perform filesystem changes, read or write contents, or traverse and glob paths. The sampled source shows Foundation-backed filesystem operations and POSIX glob support; unsampled implementations are represented only where the README documents the capability.

Main entry points: [`Sources/PathKit.swift`](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift) (Path inspection)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_path_value["Path values<br/>[PathKit.swift]"]
node_path_transform["Path transformations<br/>[PathKit.swift]"]
node_path_inspect["Path inspection<br/>[PathKit.swift]"]
node_filesystem_ops["Filesystem operations<br/>[PathKit.swift]"]
node_content_io["Content I/O<br/>[PathKit.swift]"]
node_traversal_glob["Traversal and glob<br/>[PathKit.swift]"]
node_foundation["Foundation APIs"]
node_filesystem[("Local filesystem")]
node_posix_glob["POSIX glob"]

node_caller -->|"creates and combines"| node_path_value
node_caller -->|"requests transforms"| node_path_transform
node_caller -->|"queries paths"| node_path_inspect
node_caller -->|"requests changes"| node_filesystem_ops
node_caller -->|"reads or writes"| node_content_io
node_caller -->|"traverses or matches"| node_traversal_glob
node_path_transform -->|"standardizes paths"| node_foundation
node_path_inspect -->|"checks path metadata"| node_foundation
node_filesystem_ops -->|"creates moves deletes"| node_foundation
node_content_io -->|"reads and writes"| node_foundation
node_traversal_glob -->|"enumerates directories"| node_foundation
node_path_inspect -->|"checks existence and type"| node_filesystem
node_filesystem_ops -->|"changes entries"| node_filesystem
node_content_io -->|"transfers contents"| node_filesystem
node_traversal_glob -->|"matches glob patterns"| node_posix_glob

click node_path_value "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"
click node_path_transform "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"
click node_path_inspect "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"
click node_filesystem_ops "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"
click node_content_io "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"
click node_traversal_glob "https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift"

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_caller,node_posix_glob toneIndigo
class node_path_value,node_path_transform,node_path_inspect,node_filesystem_ops,node_content_io,node_traversal_glob toneTeal
class node_foundation toneMint
class node_filesystem toneAmber
```

## Components

### Other components

- **Library caller**
- [Path values](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- [Path transformations](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- [Path inspection](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- [Filesystem operations](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- [Content I/O](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- [Traversal and glob](https://github.com/kylef/pathkit/blob/master/Sources/PathKit.swift): `Sources/PathKit.swift`
- **Foundation APIs**
- **Local filesystem**
- **POSIX glob**

## Connections

- Library caller → Path values: creates and combines
- Library caller → Path transformations: requests transforms
- Library caller → Path inspection: queries paths
- Library caller → Filesystem operations: requests changes
- Library caller → Content I/O: reads or writes
- Library caller → Traversal and glob: traverses or matches
- Path transformations → Foundation APIs: standardizes paths
- Path inspection → Foundation APIs: checks path metadata
- Filesystem operations → Foundation APIs: creates moves deletes
- Content I/O → Foundation APIs: reads and writes
- Traversal and glob → Foundation APIs: enumerates directories
- Path inspection → Local filesystem: checks existence and type
- Filesystem operations → Local filesystem: changes entries
- Content I/O → Local filesystem: transfers contents
- Traversal and glob → POSIX glob: matches glob patterns
