yggdrasil-cli

Crates.ioyggdrasil-cli
lib.rsyggdrasil-cli
version0.2.0
created_at2025-09-06 21:55:21.888257+00
updated_at2025-09-22 20:04:33.353992+00
descriptionThe god-tree of your codebase β€” flatten projects into an AI-ready codex.
homepage
repositoryhttps://github.com/andrewrgarcia/yggdrasil-cli
max_upload_size
id1827653
size945,044
Andrew Garcia (andrewrgarcia)

documentation

README

yggdrasil logo

Yggdrasil

The god-tree of your codebase
Flatten your entire project into an AI-ready codex β€” index + contents, in one command.


πŸ€” 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, --blacklist, --out.
  • 🧩 Diff Mode β†’ cross-file block detection with [MOVED] annotations.
  • πŸ“ Align Tags β†’ --align-tags keeps 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:

  1. Snapshot Mode β€” index + file contents.
  2. Diff Mode β€” compares two sets of files, showing inline diffs and cross-file [MOVED] metadata.

Snapshot Examples

# Export your repo as Markdown (index + contents)
ygg --show --md --contents --out SHOW.md

# List only file paths (no contents)
ygg --show rs
ygg --show py

Diff Examples

# Compare two versions of a controller
ygg diff controller.py -- controller_old.py

# Compare multiple files against a single snapshot
ygg diff controller.py updates sampling trainer.py -- controller_old.py

# Align tags neatly at a column
ygg diff --align-tags src/ -- old_src/

πŸ“„ 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:

ygg --show --manifest WHITE.md --contents

πŸš€ Installation

You’ll need Rust.

cargo install yggdrasil-cli

Then ensure ~/.cargo/bin is in your PATH.

Upgrade after edits:

cargo install --path . --force

🌲 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, --blacklist)
  • βœ… Output to file (--out)
  • βœ… Cross-file diff engine (ygg diff)
  • βœ… [MOVED] metadata overlay
  • βœ… --align-tags flag

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.

Commit count: 25

cargo fmt