{"id":50554987,"url":"https://github.com/inhere/xenv","last_synced_at":"2026-06-04T06:02:42.250Z","repository":{"id":359289588,"uuid":"1240373608","full_name":"inhere/xenv","owner":"inhere","description":"xenv is a local development environment and SDK manager.","archived":false,"fork":false,"pushed_at":"2026-06-01T13:55:57.000Z","size":346,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T15:27:18.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/inhere.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-16T04:10:11.000Z","updated_at":"2026-06-01T14:20:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/inhere/xenv","commit_stats":null,"previous_names":["inhere/xenv"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/inhere/xenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fxenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fxenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fxenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fxenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inhere","download_url":"https://codeload.github.com/inhere/xenv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fxenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33891733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-04T06:02:39.450Z","updated_at":"2026-06-04T06:02:42.244Z","avatar_url":"https://github.com/inhere.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xenv\n\nEnglish | [简体中文](README.zh-CN.md)\n\n`xenv` is a local development environment manager for SDK versions, environment variables, and `PATH` entries. It is designed for developers who switch between projects that need different toolchains or local runtime settings.\n\n## Features\n\n- Discover and activate locally installed SDKs, such as Go and Node.js.\n- Manage global, project-local, and shell-session environment variables.\n- Manage global, project-local, and shell-session `PATH` entries.\n- Load project state from `.xenv.toml` when you enter a directory through the shell integration.\n- Check active SDKs and project tool requirements.\n- Generate shell hooks for bash, zsh, PowerShell, and cmd/clink.\n\n## Install\n\nInstall by [Eget](https://github.com/inherelab/eget):\n\n```bash\neget install inhere/xenv\n```\n\nInstall the latest version with Go:\n\n```bash\ngo install github.com/inhere/xenv/cmd/xenv@latest\n```\n\n## Quick Start\n\nEnable shell integration first. This lets `xenv use`, `xenv set`, and `xenv path add` update the current shell instead of only printing shell script output.\n\nBash:\n\n```bash\neval \"$(xenv shell --type bash)\"\n```\n\nZsh:\n\n```bash\neval \"$(xenv shell --type zsh)\"\n```\n\nPowerShell:\n\n```powershell\nInvoke-Expression (\u0026xenv shell --type pwsh)\n```\n\nInitialize the default configuration explicitly if you want to create it before first use:\n\n```bash\nxenv config init\n```\n\nThe default configuration file is created at:\n\n```text\n~/.config/xenv/config.yaml\n```\n\nThen index locally installed SDKs and activate a version:\n\n```bash\nxenv sdk index\nxenv sdk list\nxenv use go:latest\n```\n\nSave project-local settings to `.xenv.toml`:\n\n```bash\nxenv use -s go:1.24\nxenv set -s APP_ENV local\nxenv path add -s ./bin\n```\n\nCheck the active environment:\n\n```bash\nxenv list activity\nxenv check\n```\n\n## Shell Integration\n\nGenerate shell integration scripts:\n\n```bash\nxenv shell --type bash\nxenv shell --type zsh\nxenv shell --type pwsh\nxenv shell --type cmd\n```\n\nInstall the hook into your shell profile:\n\n```bash\n# PowerShell\nxenv shell --install -t pwsh --profile $PROFILE.CurrentUserAllHosts\n\n# bash or zsh\nxenv shell --install -t $SHELL\n```\n\nPowerShell can also load the hook directly:\n\n```powershell\nInvoke-Expression (\u0026xenv shell --type pwsh)\n# or\nxenv shell --type pwsh | Out-String | Invoke-Expression\n```\n\nWhen shell integration is active, `xenv` keeps a shell-session state file and can automatically load matching `.xenv.toml` files when you change directories.\n\n## State Scopes\n\nMost environment-changing commands support three scopes:\n\n| Scope | Flag | Storage | Use case |\n| --- | --- | --- | --- |\n| Session | none | `~/.config/xenv/session/\u003csession_id\u003e.json` | Temporary changes for the current hooked shell |\n| Project | `-s`, `--save`, or `-d` | nearest `.xenv.toml` | Project-specific SDKs, env vars, and paths |\n| Global | `-g` or `--global` | `~/.config/xenv/global.toml` | Defaults shared by all projects |\n\nExamples:\n\n```bash\n# Current shell session\nxenv use go:latest\nxenv set APP_ENV local\nxenv path add ./bin\n\n# Project .xenv.toml\nxenv use -s go:1.24\nxenv set -s APP_ENV local\nxenv path add -s ./bin\n\n# Global state\nxenv use -g go:1.24\nxenv set -g GOPROXY https://proxy.golang.org,direct\nxenv path add -g ~/.local/bin\n```\n\n## Project State\n\nProject state is stored in `.xenv.toml`. The shell hook can load it automatically when you enter the project directory.\n\nExample:\n\n```toml\npaths = [\n  \"./bin\",\n]\n\n[sdks]\ngo = \"1.24\"\nnode = \"20\"\n\n[envs]\nAPP_ENV = \"local\"\n\n[tools]\nrg = \"*\"\ngolangci-lint = \"\u003e=1.60,required\"\n```\n\nSections:\n\n- `paths`: Project-local entries added to `PATH`.\n- `sdks`: SDK versions activated for the project.\n- `envs`: Environment variables loaded for the project.\n- `tools`: External tool requirements checked by `xenv check tools`.\n\n## SDK Management\n\nSDKs are configured in `config.yaml`, then indexed from local installation directories.\n\nCommon commands:\n\n```bash\nxenv sdk index\nxenv sdk list\nxenv sdk list --all\nxenv sdk show go\nxenv sdk where go:1.24\nxenv sdk where --bin go:1.24\nxenv sdk which go:1.24\n```\n\nVersion specs can use either `name:version` or `name@version`:\n\n```bash\nxenv use go:1.24\nxenv use node@20\n```\n\nWhen the version is omitted, `latest` is used:\n\n```bash\nxenv use go\n```\n\nActivate or deactivate multiple SDKs at once:\n\n```bash\nxenv use go:1.24 node:20\nxenv unuse go:1.24 node:20\n```\n\n## Environment Variables\n\nList environment variables managed by `xenv`:\n\n```bash\nxenv env\nxenv env list\nxenv list env\n```\n\nSet and unset values:\n\n```bash\nxenv env set APP_ENV local\nxenv env unset APP_ENV\n```\n\nTop-level shortcuts are also available:\n\n```bash\nxenv set APP_ENV local\nxenv unset APP_ENV\n```\n\nUse `-s` for project state or `-g` for global state:\n\n```bash\nxenv set -s APP_ENV local\nxenv unset -g GOPROXY\n```\n\n## PATH Management\n\nList managed `PATH` entries:\n\n```bash\nxenv path\nxenv path list\nxenv list path\n```\n\nAdd, remove, and search entries:\n\n```bash\nxenv path add ./bin\nxenv path remove ./bin\nxenv path search go\n```\n\nUse `-s` for project state or `-g` for global state:\n\n```bash\nxenv path add -s ./bin\nxenv path add -g ~/.local/bin\n```\n\n## Tool Checks\n\nRun all checks:\n\n```bash\nxenv check\n```\n\nCheck active SDK availability:\n\n```bash\nxenv check sdk\n```\n\nCheck project tool requirements from `.xenv.toml`:\n\n```bash\nxenv check tools\n```\n\nTool requirements live under `[tools]`:\n\n```toml\n[tools]\nrg = \"*\"\ngolangci-lint = \"\u003e=1.60,required\"\n```\n\n## Configuration\n\nDefault files:\n\n```text\n~/.config/xenv/config.yaml\n~/.config/xenv/global.toml\n~/.config/xenv/session/\u003csession_id\u003e.json\n~/.config/xenv/sdks.local.json\n~/.config/xenv/hooks\n```\n\nShow the active configuration summary:\n\n```bash\nxenv config\n```\n\nRead selected configuration values:\n\n```bash\nxenv config get bin_dir\nxenv config get shell_hooks_dir\n```\n\nExport configuration:\n\n```bash\nxenv config export zip\nxenv config export json\n```\n\nConfiguration files support environment variable expansion in values, for example `${HOME}` or `${XENV_SDK_ROOT}`.\n\nExample `config.yaml`:\n\n```yaml\nbin_dir: \"~/.local/bin\"\neget_enable: false\neget_store_file: \"\"\ncheck_tools_on_direnv: false\nsource_project_scripts: false\nallow_up_match: 1\nshell_hooks_dir: \"~/.config/xenv/hooks\"\nglobal_env: {}\nglobal_paths: []\nsdks:\n  - name: go\n    alias: golang\n    install_dir: \"${XENV_SDK_ROOT}/go{version}\"\n    bin_dir: \"bin\"\n    active_env:\n      GOROOT: \"{install_dir}\"\n  - name: node\n    install_dir: \"${XENV_SDK_ROOT}/node-v{version}\"\n    bin_dir: \"bin\"\n```\n\nSDK fields:\n\n| Field | Description |\n| --- | --- |\n| `name` | SDK name used in commands, such as `go` |\n| `alias` | Optional alias for display or lookup |\n| `install_dir` | SDK installation directory template; `{version}` is replaced by the selected version |\n| `bin_dir` | SDK binary directory relative to `install_dir` |\n| `active_env` | Environment variables exported when the SDK is active |\n| `other_versions` | Additional versions that should be considered by the SDK index |\n\n## Command Reference\n\n| Command | Description |\n| --- | --- |\n| `xenv sdk index` | Scan configured SDK directories and update the local SDK index |\n| `xenv sdk list` | List installed SDKs |\n| `xenv sdk list --all` | List all configured SDKs, including uninstalled ones |\n| `xenv sdk show \u003cname\u003e` | Show details for one SDK |\n| `xenv sdk where [--bin] \u003cname:version\u003e` | Print an SDK installation or binary path |\n| `xenv use [-g] [-s] \u003cname:version\u003e...` | Activate SDK versions |\n| `xenv unuse [-g] [-s] \u003cname:version\u003e...` | Deactivate SDK versions |\n| `xenv env list` | List managed environment variables |\n| `xenv env set [-g] [-s] \u003cname\u003e \u003cvalue\u003e` | Set an environment variable |\n| `xenv env unset [-g] [-s] \u003cname...\u003e` | Remove environment variables |\n| `xenv path list` | List managed `PATH` entries |\n| `xenv path add [-g] [-s] \u003cpath\u003e` | Add a `PATH` entry |\n| `xenv path remove [-g] [-s] \u003cpath\u003e` | Remove a `PATH` entry |\n| `xenv path search \u003cvalue\u003e` | Search current `PATH` entries |\n| `xenv list activity [-t]` | List active SDKs, env vars, paths, and tool requirements |\n| `xenv check` | Run SDK and tool checks |\n| `xenv check sdk` | Check active SDK availability |\n| `xenv check tools` | Check project tool requirements |\n| `xenv shell --type \u003cshell\u003e` | Print shell hook script |\n| `xenv shell --install -t \u003cshell\u003e` | Install shell hook into a shell profile |\n| `xenv config` | Show configuration summary |\n| `xenv config get \u003cname\u003e` | Read a supported configuration value |\n| `xenv config export \u003czip\\|json\u003e` | Export configuration |\n\nAliases:\n\n- `xenv sdks` for `xenv sdk`\n- `xenv ls` for `xenv list`\n- `xenv e` for `xenv env`\n- `xenv p` for `xenv path`\n- `xenv cfg` for `xenv config`\n- `xenv sdk refresh` or `xenv sdk scan` for `xenv sdk index`\n- `xenv sdk which` for `xenv sdk where`\n- `xenv path rm` or `xenv path delete` for `xenv path remove`\n\n## Development\n\nRun tests:\n\n```bash\ngo test ./...\n```\n\nBuild without release compression:\n\n```bash\ngo build ./cmd/xenv\n```\n\nBuild with the project Makefile:\n\n```bash\nmake build\n```\n\nThe Makefile uses UPX for compression on supported targets, so `upx` must be available for those build targets.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finhere%2Fxenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finhere%2Fxenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finhere%2Fxenv/lists"}