{"id":13393877,"url":"https://github.com/hyperupcall/autoenv","last_synced_at":"2025-05-16T12:01:48.650Z","repository":{"id":37391208,"uuid":"3421292","full_name":"hyperupcall/autoenv","owner":"hyperupcall","description":"Directory-based environments.","archived":false,"fork":false,"pushed_at":"2025-04-12T16:38:24.000Z","size":255,"stargazers_count":5851,"open_issues_count":6,"forks_count":262,"subscribers_count":71,"default_branch":"main","last_synced_at":"2025-05-13T14:23:30.176Z","etag":null,"topics":["bash","cd","environment","shell","shell-extension","shell-script","shell-scripts","terminal","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperupcall.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["hyperupcall"]}},"created_at":"2012-02-12T10:41:55.000Z","updated_at":"2025-05-12T08:54:27.000Z","dependencies_parsed_at":"2023-02-12T21:35:11.867Z","dependency_job_id":"2bee8e9e-9da3-49c7-9178-8e9043936b06","html_url":"https://github.com/hyperupcall/autoenv","commit_stats":{"total_commits":248,"total_committers":55,"mean_commits":4.509090909090909,"dds":0.7379032258064516,"last_synced_commit":"90241f182d6a7c96e9de8a25c1eccaf2a2d1b43a"},"previous_names":["kennethreitz/autoenv","inishchith/autoenv"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperupcall%2Fautoenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperupcall%2Fautoenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperupcall%2Fautoenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperupcall%2Fautoenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperupcall","download_url":"https://codeload.github.com/hyperupcall/autoenv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254291961,"owners_count":22046424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cd","environment","shell","shell-extension","shell-script","shell-scripts","terminal","zsh"],"created_at":"2024-07-30T17:01:01.749Z","updated_at":"2025-05-16T12:01:48.604Z","avatar_url":"https://github.com/hyperupcall.png","language":"Shell","readme":"# Autoenv: Directory-based Environments ![Build Status](https://github.com/hyperupcall/autoenv/actions/workflows/ci.yml/badge.svg)\n\nMagic per-project shell environments.\n\n## What is it?\n\nIf a directory contains an `.env` file, it will automatically be executed when you `cd` into it. And, if a directory contains an `.env.leave` file (and `AUTOENV_ENABLE_LEAVE` is a non-empty string), the file will automatically be executed when `cd`'ing away from the directory that contains that file.\n\nThis is great for...\n\n- auto-activating virtualenvs\n- auto-deactivating virtualenvs\n- project-specific environment variables\n- making millions\n\nYou can also nest envs within each other. How awesome is that!?\n\nWhen executing, autoenv, will walk up the directories until the mount\npoint and execute all `.env` files beginning at the top.\n\n## Usage\n\nFollow the white rabbit:\n\n```sh\n$ echo \"echo 'whoa'\" \u003e ./project/.env\n$ cd ./project\nwhoa\n```\n\n![Mind blown GIF](http://media.tumblr.com/tumblr_ltuzjvbQ6L1qzgpx9.gif)\n\n## Installation (automated)\n\n```sh\n# with cURL\ncurl -#fLo- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh\n\n# with wget\nwget --show-progress -o /dev/null -O- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh\n```\n\nIf you encounter some variant of a `curl: command not found` or `wget: command not found` error, please install either cURL or wget (with your package manager) and try again.\n\n## Installation (manual)\n\nWhen installing manually, you first install autoenv with either Homebrew, npm, or Git. Then, you run a command to ensure autoenv is loaded when you open a terminal (this command depends on your [default shell](https://askubuntu.com/a/590901)).\n\n### Installation Method\n\nNote that depending on your shell and operating system, you may need to write to `.zprofile` instead of `.zshrc`, or write to `.bash_profile` instead of `.bashrc` (or visa-versa).\n\n#### Using Homebrew\n\nPrefer this if you're running macOS. Homebrew [must be installed](https://brew.sh).\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand content\u003c/summary\u003e\n\nFirst, download the [autoenv](https://formulae.brew.sh/formula/autoenv) homebrew formulae:\n\n```sh\n$ brew install 'autoenv'\n```\n\nThen, execute one of the following to ensure autoenv is loaded when you open a terminal:\n\n```sh\n# For Zsh shell (on Linux or macOS)\n$ printf '%s\\n' \"source $(brew --prefix autoenv)/activate.sh\" \u003e\u003e \"${ZDOTDIR:-$HOME}/.zprofile\"\n\n# For Bash shell (on Linux)\n$ printf '%s\\n' \"source $(brew --prefix autoenv)/activate.sh\" \u003e\u003e ~/.bashrc\n\n# For Bash shell (on macOS)\n$ printf '%s\\n' \"source $(brew --prefix autoenv)/activate.sh\" \u003e\u003e ~/.bash_profile\n```\n\n\u003c/details\u003e\n\n#### Using npm\n\nPrefer this if you're running Linux or an unsupported version of macOS. npm [must be installed](https://nodejs.org/en/download) (usually through NodeJS).\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand content\u003c/summary\u003e\n\nFirst, download the [@hyperupcall/autoenv](https://www.npmjs.com/package/@hyperupcall/autoenv) npm package:\n\n```sh\n$ npm install -g '@hyperupcall/autoenv'\n```\n\nThen, execute one of the following to ensure autoenv is loaded when you open a terminal:\n\n```sh\n# For Zsh shell (on Linux or macOS)\n$ printf '%s\\n' \"source $(npm root -g)/@hyperupcall/autoenv/activate.sh\" \u003e\u003e \"${ZDOTDIR:-$HOME}/.zprofile\"\n\n# For Bash shell (on Linux)\n$ printf '%s\\n' \"source $(npm root -g)/@hyperupcall/autoenv/activate.sh\" \u003e\u003e ~/.bashrc\n\n# For Bash shell (on macOS)\n$ printf '%s\\n' \"source $(npm root -g)/@hyperupcall/autoenv/activate.sh\" \u003e\u003e ~/.bash_profile\n```\n\n\u003c/details\u003e\n\n#### Using Git\n\nUse this if you cannot install with Homebrew or npm.\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand content\u003c/summary\u003e\n\nFirst, clone this repository:\n\n```sh\n$ git clone 'https://github.com/hyperupcall/autoenv' ~/.autoenv\n```\n\nThen, execute one of the following to ensure autoenv is loaded when you open a terminal:\n\n```sh\n# For Zsh shell (on Linux or macOS)\n$ printf '%s\\n' \"source ~/.autoenv/activate.sh\" \u003e\u003e \"${ZDOTDIR:-$HOME}/.zprofile\"\n\n# For Bash shell (on Linux)\n$ printf '%s\\n' \"source ~/.autoenv/activate.sh\" \u003e\u003e ~/.bashrc\n\n# For Bash shell (on macOS)\n$ printf '%s\\n' \"source ~/.autoenv/activate.sh\" \u003e\u003e ~/.bash_profile\n```\n\n\u003c/details\u003e\n\n## Configuration\n\n_Before_ `source`ing `activate.sh`, you can set the following variables:\n\n- `AUTOENV_AUTH_FILE`: Files authorized to be sourced; defaults to `~/.autoenv_authorized` if it exists, otherwise, `~/.local/state/autoenv/authorized_list`\n- `AUTOENV_NOTAUTH_FILE`: Files not authorized to be sourced; defaults to `~/.autoenv_not_authorized` if it exists, otherwise, `~/.local/state/autoenv/not_authorized_list`\n- `AUTOENV_ENV_FILENAME`: Name of the `.env` file; defaults to `.env`\n- `AUTOENV_LOWER_FIRST`: Set this variable to a non-empty string to flip the order of `.env` files executed\n- `AUTOENV_ENV_LEAVE_FILENAME`: Name of the `.env.leave` file; defaults to `.env.leave`\n- `AUTOENV_ENABLE_LEAVE`: Set this to a non-empty string in order to enable source env when leaving\n- `AUTOENV_ASSUME_YES`: Set this variable to a non-empty string to silently authorize the initialization of new environments\n- `AUTOENV_VIEWER`: Program used to display env files prior to authorization; defaults to `cat`\n- `AUTOENV_PRESERVE_CD`: Set this variable to a non-empty string to prevent the `cd` builtin from being overridden (to active autoenv, you must invoke `autoenv_init` within a `cd` function of your own)\n\nWe recommend setting the following configuration variables:\n\n```bash\nAUTOENV_ENABLE_LEAVE=yes\nAUTOENV_VIEWER=cat\n```\n\nThese options are not set by default as to conform to the expectations of backwards-compatible behavior.\n\n### API\n\nInside the `.env` file, two _environment variables_ can be accessed:\n\n- `AUTOENV_CUR_FILE` - The file being sourced\n- `AUTOENV_CUR_DIR` - Equivalent to `dirname \"$AUTOENV_CUR_FILE\"`\n\n## Shells\n\nautoenv is tested on:\n\n- Bash\n- Zsh\n- Dash\n- Fish is supported by [autoenv_fish](https://github.com/loopbit/autoenv_fish)\n- More to come\n\n## Disclaimer\n\nAutoenv overrides `cd` (unless `AUTOENV_PRESERVE_CD` is set to a non-empty string). If you already do this, invoke `autoenv_init` within your custom `cd` after sourcing `activate.sh`.\n\nIf you define a `cd` alias, `autoenv` will (properly) show an error except when using Zsh. We recommend removing any aliases to `cd`! (`unalias cd`).\n\nIf you are using `dash`, `autoenv` will work. However, `dash` does not support `builtin`. As a reuslt, in `dash`, `autoenv` invokes `chdir` instead of `cd` to prevent infinite loops.\n\nAutoenv can be disabled via `unset -f cd` if you experience I/O issues with certain file systems, particularly those that are FUSE-based (such as `smbnetfs`).\n\n## Other info\n\nTo uninstall autoenv, see [`./docs/uninstall.md`](./docs/uninstall.md).\n\nTo update autoenv, see [`./docs/updating.md`](./docs/updating.md).\n\n## Attributions\n\nAutoenv was originally created by [@kennethreitz](https://github.com/kennethreitz). Later, ownership was transfered to [@inishchith](https://github.com/inishchith). As of August 22nd, 2021, Edwin Kofler ([@hyperupcall](https://github.com/hyperupcall)) owns and maintains the project.\n","funding_links":["https://github.com/sponsors/hyperupcall"],"categories":["Environment Variables","Shell","Plugins","Command-Line Productivity","bash"],"sub_categories":["Caveats","ZSH on Windows"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperupcall%2Fautoenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperupcall%2Fautoenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperupcall%2Fautoenv/lists"}