Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

buffrs add

Adds a new dependency to the package manifest.

Synopsis

buffrs add --registry <REGISTRY> <DEPENDENCY>

Description

The add command is the recommended way to include a new dependency in the current package. It modifies the local manifest file and will overwrite a pre-existing entry for the same dependency package if it exists.

Dependency locator format

The dependency should be specified with the repository, name and version according to the following format:

<repository>/<package>[@<version>]

Note: the version can be omitted (or set to @latest), in which case it will default to the latest version of this artifact in the registry.

The repository name should adhere to lower-kebab case (e.g. my-buffrs-repo). The package name has its own set of constraints as detailed in Package Name Specification. When specified, the version must adhere to the Semantic Version convention (e.g. 1.2.3) – see SemVer compatibility for more information.

Buffrs supports full SemVer version requirements here, including ^1.0.0, ~2.0.0, exact pins such as =1.2.3, and comparison ranges like >=1.2.0, <2.0.0.

Options

--resolver <RESOLVER>

Specify the dependency resolver strategy:

  • default - Standard single-version resolution (default)
  • multiversion - Allow multiple versions of this package to coexist

Use multiversion when you need different parts of your codebase to depend on different versions of the same package. See Multi-Version Dependencies for details.

buffrs add --registry <REGISTRY> --resolver multiversion <DEPENDENCY>

If one manifest needs two versions of the same package, declare one of them under an alias key in Proto.toml. That alias is how you refer to each version clearly after multi-version resolution.

Lockfile interaction

Currently adding a new dependency won’t automatically update the lockfile (Proto.lock). This is planned to change, but for now follow up with buffrs install after adding a new dependency to make sure your lockfile is kept in sync.