---
slug: proto-v0.50
title: proto v0.50 - URL rewrites, on-init activation, preserved comments, and more
authors: [milesj]
tags: [rewrite, url, activation, comments, config, plugin, shell]
image: ./img/proto/v0.50.png
---

In this release, we're landing a handful of quality of life improvements that have been requested by
the community.

<!--truncate-->

## Rewrite URLs for better interoperability

proto is heavily reliant on URLs, as they power everything from tool and plugin downloading to
version resolving. Many URLs are hard-coded into proto but most of them come from plugins. For the
most part this is fine, but if you work within a corporate environment, or have a firewall, you may
have to deal with proxy servers, mirrors, or other factors.

Until now, this was very difficult to circumvent, so we wanted to provide a built-in solution to
this problem, and as such, we're introducing the new
[`url-rewrites`](/docs/proto/config#url-rewrites) configuration setting. This setting accepts a map
of regex patterns to replacements, and will rewrite URLs that match the pattern.

```toml title=".prototools"
[settings.url-rewrites]
"github.com/(\\w+)/(\\w+)" = "gh-mirror.corp.com/$1/$2"
"mo+n" = "lunar"
```

For example, in the configuration above, any URL that contains `github.com` will be replaced with
`gh-mirror.corp.com`, and any URL that contains the word "moon" (with different length o's) will be
replaced with "lunar". Learn more about URL rewriting in the settings documentation!

## Activation flow now triggers immediately

Our [activation flow](/docs/proto/workflows#shell-activation) (shell hooks) is seeing more and more
usage, with improved stability, but based on feedback we've received, there was still some pain
points. One of these pain points was that activation would not trigger immediately (new terminal
window/tab), and would only trigger after changing directories.

There was a way around this using the `--on-init` flag, but that was not easily discoverable, and
the setup as a whole was not very intuitive. With this release, that flag has been deprecated and
the activation flow now triggers immediately, so you can start using your tools right away.

Historically we've been hesitent to do this, as we were worried about potential performance hits
when having to download WASM plugins, or refetch caches. However in practice this has not been an
issue.

## Comments are now preserved in `.prototools`

This has been a long standing issue and a long requested feature, and it's finally here! Comments
are now preserved in `.prototools` files, and they'll no longer be removed when running `proto`
commands that modify these files (like [`proto alias`](/docs/proto/commands/alias) or
[`proto pin`](/docs/proto/commands/pin)).

Historically this has been a hard problem to solve, as Rust serde (serialization/deserialization
library) strips comments when deserializing (reading) the file. To solve this problem, we had to
avoid serde, and operate on an AST-like structure instead. Because of this, we lose type-safety and
there may be some edge cases not accounted for.

## Plugin commands are now executed within a shell

When a plugin executes a command (child process) on the host system (your computer), it now executes
it within a shell, e.g. `bash -c "command"`. This change was made to ensure environment variables
(like `PATH`), aliases, and other shell features that you have configured are available to the
plugin.

By default the shell to use is detected from the parent host process, but you can override it with
the `PROTO_SHELL` environment variable. For example, to use `zsh` you can set:

```shell
PROTO_SHELL=zsh
```

## Other changes

View the [official release](https://github.com/moonrepo/proto/releases/tag/v0.50.0) for a full list
of changes.

- Added `--dir` and `--all` options to the [`proto bin`](/docs/proto/commands/bin) command.
- Added environment variable support to many non-tool related `.prototools` settings.
- Updated `proto install <tool>` (without version) to install a version pinned in `.prototools`,
  instead of the latest version.
