π€ What is Yggdrasil?
Yggdrasil CLI is a project flattener and diff tool:
it takes your codebase and transforms it into a single, structured document β or compares snapshots with rich, annotated diffs.
Think of it as tree + cat + diff, but with superpowers:
- π Files β indexed, filtered by extension, glob, or blacklist.
- π Contents β full text for each file, neatly marked.
- π Anchors β clickable links from index β content (Markdown mode).
- π¨ Stylish CLI β cyberpunk colors, or plain mode for piping.
- π‘ Controls β
--only,--ignore,--black,--white,--out.
βͺ--black/--whiteaccept either a file path or launch an interactive paste mode β perfect for dropping in VS Codeβs Copy Relative Path output. - π§© Diff Mode β cross-file block detection with
[MOVED]annotations. - π Align Tags β
--align-tagskeeps metadata comments lined up.
π Why would I want this?
- π€ AI Prompts: Feed your repo or a diff as one codex to ChatGPT/Claude.
- π Docs & Reviews: Export a clean snapshot for collaborators.
- π§βπ» Developers: Browse or compare projects with context in your terminal.
- ποΈ Archival: Serialize project state for reproducibility.
Yggdrasil doesnβt just list files β it builds a codex of your project, and now shows how files evolve.
π How does it work?
Yggdrasil generates two kinds of outputs:
- Snapshot Mode β index + file contents.
- Diff Mode β compares two sets of files, showing inline diffs and cross-file
[MOVED]metadata.
Snapshot Examples
# Export your repo as Markdown (index + contents)
# List only file paths (no contents)
Diff Examples
# Compare two versions of a controller
# Compare multiple files against a single snapshot
# Align tags neatly at a column
π Manifest files
A manifest is just a plain text file with one path per line. Only the files listed in the manifest will be shown.
Example WHITE.md:
src/pages/codebase.tsx
src/data/codebaseAssets.tsx
src/i18n/codebase.en.json
src/i18n/codebase.es.json
src/types/codebase.ts
Run with:
βοΈ Interactive Lists (VS Code paste mode)
You donβt even need a manifest file. Run:
or
Then paste your paths β for example, directly from VS Code β Right-click β Copy Relative Path β and finish with:
- Ctrl + D (Linux/macOS)
- Ctrl + Z, then Enter (Windows)
Example:
src/main.rs
src/utils/io.rs
README.md
Each line becomes a filter pattern β instantly usable as a manifest (--white) or ignore list (--black).
Perfect for ad-hoc flattening or focused diffs when working on multiple files at once.
π Installation
Youβll need Rust.
Then ensure ~/.cargo/bin is in your PATH.
Upgrade after edits:
π² Philosophy
In Norse myth, Yggdrasil is the world-tree connecting all realms. In your terminal, Yggdrasil connects all files β flattening complexity into a single codex, and now diffing branches of your code-tree.
Itβs built to be:
- Minimal: no configs, just flags.
- Readable: AI-friendly and human-friendly.
- Extensible: Markdown, CLI, diff formatters, ignore lists, output redirection.
Goal: Make your projectβs structure transparent and portable.
π£ Roadmap
v0.1 β v0.2
- β
Index & contents export (
--show,--contents) - β
Markdown mode (
--md) - β
Ignore & blacklist support (
--ignore,--black) - β
Manifest inclusion (
--white) - β
Output to file (
--out) - β
Cross-file diff engine (
ygg diff) - β
[MOVED]metadata overlay - β
--align-tagsflag - β
Interactive
--black/--whitepaste mode
Future (v0.3 β v1.0)
- β³ Tree vs flat mode toggle
- β³ Configurable themes / styles
- β³ Unified codex+diff export
π License
MIT, like almost everything else thatβs friendly and open-source.