Warning
🧪 Beta Status - We Need Your Feedback!
Dirvana is currently in beta and actively seeking testers to help validate its functionality across different configurations and use cases. Your feedback will help us:
- Identify edge cases and limitations
- Improve compatibility across different shell environments
- Shape the tool's evolution based on real-world usage
Found a bug? Have a feature request? Please open an issue or share your experience!
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, environment variables, and functions.
Dirvana solves a common problem: managing different shell environments for different projects. Instead of cluttering your .bashrc with project-specific aliases or manually sourcing environment files, Dirvana automatically loads the right configuration when you cd into a directory.
The magic: When you leave the directory, everything is automatically unloaded. No pollution of your global shell environment!
Before Dirvana:
With Dirvana:
- 🚀 Fast: <10ms overhead with intelligent caching
- 🔒 Secure: Authorization system prevents untrusted configs + Explicit user consent for dynamic environment variables
- 🌳 Hierarchical: Merge configurations from parent directories
- 📝 Simple: YAML configuration with JSON Schema validation
- 🐚 Compatible: Works with Bash and Zsh
- 🔄 Auto-completion: Inherits completion from aliased commands (git, kubectl, etc.)
Download the latest release for your platform:
Linux:
macOS:
See all releases at GitHub Releases.
Install the shell hook (required for automatic loading):
This adds a hook to your ~/.bashrc or ~/.zshrc that automatically runs when you change directories.
Reload your shell:
- Initialize a project (creates .dirvana.yml with JSON Schema validation):
- Authorize the project:
- Reload your configuration:
Your aliases, functions, and environment variables are now loaded!
Dirvana supports two types of configuration files:
- Global config: ~/.config/dirvana/global.yml - Applied to all projects
- Local configs: .dirvana.yml in project directories - Project-specific settings
Configuration files are merged in this order: global → root → parent → current directory (child configs override parent values).
All configuration files generated by dirvana init or dirvana edit automatically include JSON Schema validation for IDE support (auto-completion, validation, documentation).
Dirvana supports dynamic environment variables that are evaluated at load time using shell commands (similar to Taskfile's sh syntax):
The shell commands are executed when the configuration is loaded, and the output becomes the environment variable value.
Create a global config at ~/.config/dirvana/global.yml (or $XDG_CONFIG_HOME/dirvana/global.yml) to apply settings across all projects:
Local configurations can:
- Add to or override global settings
- Ignore global config entirely with ignore_global: true
- Use local_only: true to prevent merging with parent directories (but still merge with global)
See the examples/ directory for more configuration examples.
For auto-completion and validation in your editor, add the schema reference to your config files:
YAML:
VS Code settings.json (workspace or user):
Generate schema locally:
This enables:
- ✨ Auto-completion for configuration keys
- 🔍 Inline documentation for all options
- ⚠️ Real-time validation errors
- 💡 IntelliSense suggestions
All command parameters can be set via environment variables with the DIRVANA_ prefix:
Export shell code for the current folder. This is automatically called by the shell hook.
Flags:
- --prev : Previous directory for context cleanup (also via DIRVANA_PREV)
- --log-level : Log level - debug, info, warn, error (also via DIRVANA_LOG_LEVEL, default: warn)
Authorize a project for automatic execution. Without path, authorizes current directory.
Revoke authorization for a project.
List all authorized projects.
Show current Dirvana configuration status including:
- Authorization status
- Configuration hierarchy (from global to local)
- Active aliases, functions, and environment variables
- Cache status
- Configuration flags
Create a sample configuration file in the current directory.
Validate a Dirvana configuration file using JSON Schema and custom validation rules. If no file is specified, looks for a config file in the current directory.
Validation checks:
- JSON Schema validation (draft-07) for structure and types
- YAML/TOML/JSON syntax errors
- Name conflicts between aliases and functions
- Empty values in aliases, functions, and shell commands
- Invalid environment variable configurations
- Validates alias/function/env var naming conventions
Open or create a Dirvana configuration file in your editor ($EDITOR or $VISUAL). If no config exists, creates a new .dirvana.yml with helpful comments and automatic JSON Schema validation support.
Note: Generated files automatically include the JSON Schema reference for IDE validation and auto-completion.
Display or export the JSON Schema (draft-07) for Dirvana configuration files. Useful for IDE integration and validation.
The schema can be used with:
- VS Code: Add "$schema" field to your .dirvana.yml
- IntelliJ/WebStorm: Automatic detection via JSON Schema Store
- vim/neovim: Use with yaml-language-server
Example configuration with schema:
Print shell hook code for manual installation. The hook includes a safety check to ensure the dirvana command exists before executing, preventing "command not found" errors.
Flags:
- --shell : Shell type - bash, zsh, or auto (also via DIRVANA_SHELL, default: auto)
Automatically install shell hook and completion to the appropriate configuration file. If the hook is already installed but outdated, it will be automatically updated.
The setup command uses markers (# Dirvana shell hook - START/END) to:
- Detect if the hook is already installed
- Compare the installed version with the current version
- Automatically update the hook if it has changed
- Preserve other content in your shell configuration file
- Automatically install shell completion
Flags:
- --shell : Shell type - bash, zsh, or auto (also via DIRVANA_SHELL, default: auto)
Show version information.
Dirvana supports auto-completion for bash and zsh.
Bash:
Zsh:
- Go 1.21 or later
- Task (managed via aqua.yaml, or install via go install github.com/go-task/task/v3/cmd/task@latest)
- Optional: aqua for dependency management
Integration tests validate that Dirvana works correctly in real shell environments using Docker containers:
- Bash - Tests aliases, functions, and environment variables in Bash
- Zsh - Tests hooks and features in Zsh
Each test:
- Builds a Docker image with the specific shell
- Installs Dirvana and sets up hooks
- Creates a test configuration
- Validates that all features work correctly
Run task or task --list to see all available tasks.
Cache is stored in $XDG_CACHE_HOME/dirvana/cache.json and includes:
- Folder path
- Config file hash
- Generated shell code
- Timestamp
- Dirvana version
- local_only flag
Cache is automatically invalidated when:
- Configuration files change
- Dirvana version changes
Authorized projects are stored in $XDG_DATA_HOME/dirvana/authorized.json.
Only authorized projects can execute automatically. This prevents malicious code execution from untrusted directories.
This project uses GoReleaser for automated releases with semantic versioning based on conventional commits.
All commits must follow the Conventional Commits specification:
- feat: - New features (minor version bump)
- fix: - Bug fixes (patch version bump)
- perf: - Performance improvements (patch version bump)
- refactor: - Code refactoring (patch version bump)
- docs: - Documentation changes (no version bump)
- test: - Test changes (no version bump)
- chore: - Maintenance tasks (no version bump)
- ci: - CI/CD changes (no version bump)
Breaking changes: Add BREAKING CHANGE: in the commit footer or ! after the type (e.g., feat!:) for major version bumps.
- Ensure all commits follow conventional commit format
- Create and push a new tag:
git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0
- GitHub Actions will automatically:
- Run tests
- Build binaries for multiple platforms
- Create GitHub release with changelog
Each release includes:
- Pre-built binaries for Linux, macOS, Windows (amd64, arm64)
- Checksums and signatures
Contributions are welcome! Please ensure:
- All commits follow Conventional Commits format
- All tests pass: task test
- Code is formatted: task fmt
- Linter passes: task lint
- Coverage remains at 90%+
MIT License - See LICENSE file for details
Nikita C (https://github.com/NikitaCOEUR)
.png)



