Help us shape the future of Go! Take the 2026 Go Developer Survey

dirvana

module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT

README

Dirvana - Reach directory nirvana

Read the Docs GitHub Release codecov License GitHub repo size

dirvana-logo

[!WARNING] Beta Status - We Need Your Feedback!

Dirvana is currently in beta. Found a bug? Have a feature request? Please open an issue!

Automatically load shell aliases, functions, and environment variables per directory.

Dirvana is a lightweight CLI tool that manages project-specific shell environments.

When you enter a directory, Dirvana automatically loads the configuration defined in .dirvana.yml, giving you instant access to project-specific commands and settings.

When you leave, everything is automatically unloaded.

The Problem

$ cd ~/projects/terraform
$ export TF_LOG=debug
$ alias tf="task terraform --"
$ alias plan="task terraform -- plan"
# ... and don't forget to unset everything when leaving!

The Solution

# .dirvana.yml
aliases:
  tf:
    command: task terraform --
    completion: terraform  # Auto-completion works!
  plan: task terraform -- plan

env:
  TF_LOG: debug
$ cd ~/projects/terraform
# Everything loads automatically!
$ tf <TAB>          # Auto-completion works!
  apply  console  destroy  init  plan  validate ...

$ cd ..
# Everything unloads automatically!

Features

  • Fast: <10ms overhead with intelligent caching
  • Secure: Authorization system prevents untrusted configs
  • Hierarchical: Merge configurations from parent directories
  • Simple: YAML configuration with JSON Schema validation
  • Compatible: Works with Bash, Zsh, and Fish
  • Auto-completion: Inherits completion from aliased commands
  • Conditional Aliases: Execute commands based on runtime conditions
  • Template Variables: Go templates with Sprig functions

Quick Start

1. Install
# Using go install
go install github.com/NikitaCOEUR/dirvana/cmd/dirvana@latest

# Or download binary
curl -L https://github.com/NikitaCOEUR/dirvana/releases/latest/download/dirvana-linux-amd64 -o /usr/local/bin/dirvana
chmod +x /usr/local/bin/dirvana
2. Setup Shell Hook
dirvana setup
source ~/.bashrc  # or ~/.zshrc, or ~/.config/fish/config.fish
3. Create Configuration
cd your-project
dirvana init
dirvana allow

That's it! Your environment is now automatically managed.


Configuration Example

# Simple aliases
aliases:
  # With auto-completion
  tf:
    command: task terraform -- # Execute a wrapper command that use specific variables
    completion: terraform      # But keep terraform completion

  # Conditional execution
  k:
    when:
      file: "$KUBECONFIG"      # Check if KUBECONFIG file exists
    command: kubecolor         # If exists, use command kubecolor based on $KUBECONFIG
    else: task kubecolor --    # else execute a task which generate your kubeconfig file and call kubecolor afterwards
    completion: kubectl        # Inherit kubectl completion

# Functions
functions:
  mkcd: |
    mkdir -p "$1" && cd "$1"

# Environment variables
env:
  KUBECONFIG: "/tmp/kubeconfig-{{.USER_WORKING_DIR | sha256sum | trunc 8}}"

Documentation

Full documentation is available at https://nikitacoeur.github.io/dirvana/


Contributing

Contributions are welcome! Please ensure:

  • All commits follow Conventional Commits
  • All tests pass: task test
  • Code is formatted: task fmt
  • Linter passes: task lint

Changelog

Release notes are generated from conventional commits and published on the GitHub Releases page.

License

MIT License - See LICENSE file for details

Author

Nikita C

Directories

Path Synopsis
cmd
dirvana command
Package main is the entry point for the Dirvana CLI application.
Package main is the entry point for the Dirvana CLI application.
internal
auth
Package auth provides authorization management for Dirvana projects.
Package auth provides authorization management for Dirvana projects.
cache
Package cache provides persistent and in-memory caching for Dirvana configuration.
Package cache provides persistent and in-memory caching for Dirvana configuration.
cli
Package cli implements the bodies of the dirvana CLI commands.
Package cli implements the bodies of the dirvana CLI commands.
completion
Package completion provides a pluggable completion system with multiple strategies.
Package completion provides a pluggable completion system with multiple strategies.
condition
Package condition provides condition evaluation for alias execution
Package condition provides condition evaluation for alias execution
config
Package config handles loading and parsing of Dirvana configuration files.
Package config handles loading and parsing of Dirvana configuration files.
core
Package core implements the orchestration engine behind the dirvana commands: resolving which configs are active for a directory and keeping the merged view cached for the export, exec and completion hot paths.
Package core implements the orchestration engine behind the dirvana commands: resolving which configs are active for a directory and keeping the merged view cached for the export, exec and completion hot paths.
fsutil
Package fsutil provides filesystem helpers shared by packages that persist dirvana state (cache, auth, completion caches, shell hooks).
Package fsutil provides filesystem helpers shared by packages that persist dirvana state (cache, auth, completion caches, shell hooks).
logger
Package logger provides structured logging for Dirvana.
Package logger provides structured logging for Dirvana.
setup
Package setup provides shell hook installation strategies for dirvana.
Package setup provides shell hook installation strategies for dirvana.
shell
Package shell generates shell code from Dirvana configuration.
Package shell generates shell code from Dirvana configuration.
status
Package status provides status information collection and display for Dirvana.
Package status provides status information collection and display for Dirvana.
timing
Package timing provides performance measurement utilities for Dirvana.
Package timing provides performance measurement utilities for Dirvana.
trace
Package trace provides runtime tracing for development builds.
Package trace provides runtime tracing for development builds.
tui
Package tui draws terminal output: styled text, aligned columns and a foldable full-screen view.
Package tui draws terminal output: styled text, aligned columns and a foldable full-screen view.
pkg
version
Package version contains version information for Dirvana.
Package version contains version information for Dirvana.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL