vix add
vix add adds a Vix Registry package to the current project.
Use it when your project needs a package from the Vix Registry.
vix add gk/jwtOverview
vix add is the command for declaring a new project dependency.
It resolves the package from the local registry index, chooses the correct version, updates vix.json, resolves the full dependency graph, and rewrites vix.lock.
It is the right command when you want to add or change one dependency requirement.
vix add
-> resolve package
-> update vix.json
-> resolve project dependencies
-> fetch pinned package commits
-> rewrite vix.lock2
3
4
5
6
Usage
vix add [@]namespace/name[@version]Basic examples
# Add the latest available version
vix add gk/jwt
# Add a compatible version range
vix add gk/jwt@^1.0.0
# Add an exact version
vix add gk/jwt@1.0.0
# Scoped-style syntax is supported
vix add @gk/jwt
# Scoped-style syntax with a range
vix add @gk/jwt@~1.2.02
3
4
5
6
7
8
9
10
11
12
13
14
What it does
When you run:
vix add gk/jwt@^1.0.0Vix does this:
- Checks that the local registry index exists.
- Parses the package spec.
- Finds the package in the local registry index.
- Resolves the requested version or range.
- Updates
vix.json. - Resolves all project dependencies.
- Fetches required package repositories at pinned commits.
- Computes package content hashes.
- Rewrites
vix.lock. - Prints the resolved package and dependency count.
Registry requirement
vix add requires the local registry index.
If the registry has not been synced, Vix reports:
registry not synced
Run: vix registry sync2
Fix:
vix registry sync
vix add gk/jwt2
Package format
A package name uses this format:
namespace/nameExamples:
gk/jwt
gk/json
gaspardkirira/tree2
3
Scoped-style syntax is also accepted:
@namespace/nameExample:
@gk/jwtBoth forms point to the same package id:
gk/jwtVersion format
A package spec can include a version or version range.
vix add gk/jwt
vix add gk/jwt@1.0.0
vix add gk/jwt@^1.0.0
vix add gk/jwt@~1.2.0
vix add @gk/jwt@^1.0.02
3
4
5
If no version is provided, Vix resolves the latest available version from the local registry index.
vix add gk/jwtIf a range is provided, Vix resolves the highest version that satisfies that range.
vix add gk/jwt@^1.0.0Supported version behavior
vix add uses semver resolution.
Supported forms include:
1.0.0
^1.0.0
~1.2.02
3
The selected version is stored exactly in vix.lock.
The requested version or range is stored in vix.json.
What files are updated
vix add updates:
vix.json
vix.lock2
It does not directly edit vix.app.
After adding a dependency, you still need to link the package in vix.app or CMake when your code uses it.
vix.json
vix.json stores declared dependency requirements.
The current dependency format is:
{
"deps": [
{
"id": "gk/jwt",
"version": "^1.0.0"
}
]
}2
3
4
5
6
7
8
If the dependency already exists, vix add updates its requested version.
Example:
vix add gk/jwt@^1.0.0
vix add gk/jwt@~1.2.02
After the second command, the gk/jwt entry is updated instead of duplicated.
vix.lock
vix.lock stores exact resolved versions.
It is rewritten after dependency resolution.
Example shape:
{
"lockVersion": 1,
"dependencies": [
{
"id": "gk/jwt",
"requested": "^1.0.0",
"version": "1.2.0",
"repo": "https://github.com/...",
"tag": "v1.2.0",
"commit": "...",
"hash": "..."
}
]
}2
3
4
5
6
7
8
9
10
11
12
13
14
The lockfile is sorted by dependency id.
This keeps installs reproducible.
Transitive dependencies
vix add resolves the full project dependency graph.
If the package you add depends on other Vix packages, those dependencies are also resolved and written to vix.lock.
Example:
app depends on gk/http
gk/http depends on gk/json2
After:
vix add gk/httpvix.lock can include:
gk/http
gk/json2
This is important because vix.lock represents the resolved project dependency state, not only the direct dependency you typed.
Package fetching
During resolution, Vix fetches package repositories into the global Git store.
Typical location:
~/.vix/store/git/A package is checked out at the pinned commit recorded by the registry.
This gives the lockfile stable fields such as:
repo
tag
commit
hash2
3
4
Content hash
After checkout, Vix computes a package content hash.
That hash is written into vix.lock.
The goal is to make package state verifiable and reproducible.
Output
Example output shape:
resolved: gk/jwt@1.2.0
Add
id: gk/jwt
version: 1.2.0
tag: v1.2.0
commit: 8f3a...
resolving project dependencies...
✔ added: gk/jwt@1.2.0
✔ lock: /home/user/api/vix.lock
✔ deps: 32
3
4
5
6
7
8
9
10
11
12
The deps count is the number of resolved locked dependencies after the full graph resolution.
Package not found
If a package is not found, Vix searches the local registry index using the package name.
Example:
vix add gk/unknownOutput shape:
package not found: gk/unknown
Search
query: "unknown"
No matches found in the local registry index.
If you just updated the registry, run: vix registry sync2
3
4
5
6
7
8
If matching packages exist, Vix prints local search results.
Invalid package spec
Valid:
vix add gk/jwt
vix add @gk/jwt
vix add gk/jwt@1.0.0
vix add @gk/jwt@^1.0.02
3
4
Invalid:
vix add jwt
vix add gk
vix add @/jwt
vix add gk/jwt@2
3
4
If the spec is invalid, Vix reports:
invalid package spec
Expected: <namespace>/<name>[@<version>]
Example: vix add gaspardkirira/tree
Example: vix add gaspardkirira/tree@0.1.0
Try search: vix search <input>2
3
4
5
Version not found
If the requested version or range cannot be resolved, Vix reports an error.
Example:
vix add gk/jwt@99.0.0Output shape:
no version matches range: gk/jwt@99.0.0If a resolved version is missing from the registry entry, Vix can show available versions and suggest the latest version.
Add latest version
vix add gk/jwtThis resolves the latest version from the local registry index.
The resolved exact version is stored in both:
vix.json
vix.lock2
For no-version input, the requested version becomes the resolved exact version.
Example result:
{
"deps": [
{
"id": "gk/jwt",
"version": "1.2.0"
}
]
}2
3
4
5
6
7
8
Add a version range
vix add gk/jwt@^1.0.0This stores the declared range in vix.json:
{
"deps": [
{
"id": "gk/jwt",
"version": "^1.0.0"
}
]
}2
3
4
5
6
7
8
And stores the exact resolved version in vix.lock:
{
"id": "gk/jwt",
"requested": "^1.0.0",
"version": "1.2.0"
}2
3
4
5
Add an exact version
vix add gk/jwt@1.0.0This stores:
{
"deps": [
{
"id": "gk/jwt",
"version": "1.0.0"
}
]
}2
3
4
5
6
7
8
And locks:
{
"id": "gk/jwt",
"requested": "1.0.0",
"version": "1.0.0"
}2
3
4
5
Add a scoped package
vix add @gk/jwtThis is normalized to:
gk/jwtThe @ form is supported for users who prefer scoped package syntax.
After adding a dependency
After vix add, build the project.
vix buildFor development:
vix devFor validation:
vix check --testsIf the dependency exposes headers or targets, you must still use it from your project.
Using the dependency in vix.app
vix add updates vix.json and vix.lock.
For vix.app projects, also add the package target alias to links.
Example dependency:
vix add gk/json@^1.0.0Then in vix.app:
deps = [
gk/json@^1.0.0,
]
links = [
vix::vix,
gk::json,
]2
3
4
5
6
7
8
The registry package spec goes in:
depsThe CMake target alias goes in:
linksdeps in vix.json vs deps in vix.app
There are two places you may see dependency declarations.
vix.json is the package management manifest used by vix add, vix update, and vix install.
Example:
{
"deps": [
{
"id": "gk/json",
"version": "^1.0.0"
}
]
}2
3
4
5
6
7
8
vix.app is the app build manifest.
Example:
deps = [
gk/json@^1.0.0,
]2
3
The project dependency manager uses vix.json.
The app build manifest uses vix.app.
Keep them aligned when using vix.app.
Using the dependency in CMake
For a manual CMake project, include the generated dependency integration after install.
include(.vix/vix_deps.cmake)
target_link_libraries(api PRIVATE
gk::json
)2
3
4
5
A normal flow is:
vix add gk/json@^1.0.0
vix install
vix build2
3
Difference between vix add and vix install
| Command | Purpose |
|---|---|
vix add <pkg> | Add or change a dependency requirement and rewrite vix.lock. |
vix install | Install dependencies already pinned in vix.lock. |
Use vix add when changing dependencies.
Use vix install after clone or when the lockfile already exists.
Difference between vix add and vix update
| Command | Purpose |
|---|---|
vix add <pkg> | Add or change one dependency requirement. |
vix update | Re-resolve project dependencies and rewrite vix.lock. |
Use vix update when you want to refresh existing locked versions.
Difference between vix add and vix search
| Command | Purpose |
|---|---|
vix search <query> | Search the local registry index. |
vix add <pkg> | Add a package by exact registry id. |
If you do not know the exact package name, search first:
vix search jwt
vix add gk/jwt2
Full workflow
vix registry sync
vix search jwt
vix add gk/jwt@^1.0.0
vix install
vix build
vix tests2
3
4
5
6
For development:
vix devCI workflow
After dependencies are committed:
vix registry sync
vix install
vix build --build-target all
vix tests2
3
4
vix add is usually not used in CI.
CI should use:
vix installbecause CI should install the exact versions from vix.lock.
Options
vix add currently takes one package spec.
vix add [@]namespace/name[@version]| Option | Description |
|---|---|
-h, --help | Show help. |
Commands reference
| Command | Description |
|---|---|
vix add gk/jwt | Add latest available version. |
vix add gk/jwt@1.0.0 | Add exact version. |
vix add gk/jwt@^1.0.0 | Add compatible range. |
vix add @gk/jwt | Add using scoped-style syntax. |
Common workflows
Add latest package
vix registry sync
vix add gk/jwt
vix install
vix build2
3
4
Add compatible range
vix add gk/jwt@^1.0.0
vix install
vix check --tests2
3
Add exact version
vix add gk/jwt@1.0.0
vix install
vix build2
3
Search before adding
vix search jwt
vix add gk/jwt2
Add and validate
vix add gk/jwt
vix install
vix check --tests2
3
Common mistakes
Forgetting to sync the registry
Wrong:
vix add gk/jwtwhen the registry has not been synced.
Correct:
vix registry sync
vix add gk/jwt2
Using a package name without namespace
Wrong:
vix add jwtCorrect:
vix add gk/jwtExpecting vix add to update every dependency
vix add adds or changes one dependency requirement.
To refresh existing locked versions, use:
vix updateExpecting vix add to only update vix.json
vix add also rewrites vix.lock.
It resolves the whole project dependency graph after updating vix.json.
Expecting vix add to automatically edit vix.app
vix add updates package metadata.
For vix.app, add the target alias to links when you need to link it.
Example:
links = [
vix::vix,
gk::json,
]2
3
4
Confusing package specs and CMake aliases
Package spec:
gk/json@^1.0.0CMake alias:
gk::jsonUse package specs in dependency declarations.
Use aliases in links or target_link_libraries.
Editing vix.lock manually
Do not manually edit vix.lock.
Use:
vix add
vix update
vix remove2
3
to change dependency state.
Troubleshooting
Registry not synced
Run:
vix registry syncThen:
vix add gk/jwtPackage not found
Search locally:
vix search jwtThen add the exact package id:
vix add gk/jwtIf the package should exist, refresh the registry:
vix registry syncInvalid package spec
Use:
namespace/name
namespace/name@version
@namespace/name
@namespace/name@version2
3
4
Examples:
vix add gk/jwt
vix add @gk/jwt@^1.0.02
No version matches range
If Vix reports:
no version matches range: gk/jwt@^2.0.0choose a range that exists in the registry.
Check available versions through the registry or package listing tools.
Version not found
If Vix reports that the resolved version is not found in the registry entry, sync the registry again:
vix registry syncThen retry.
Git clone failed
Vix fetches package source from the repository URL stored in the registry entry.
Check:
- network connection
- repository URL
- Git authentication if private
- registry metadata
Then retry:
vix add gk/jwtGit checkout failed
The registry entry points to a commit that could not be checked out.
This usually means registry metadata is stale or invalid.
Run:
vix registry syncIf the issue remains, the registry entry needs correction.
Add failed while resolving transitive dependencies
A transitive dependency may be missing, invalid, or impossible to resolve.
Run:
vix registry sync
vix add <package>2
If it still fails, inspect the dependency package’s vix.json.
Best practices
Run vix registry sync before adding packages.
Use vix search when you do not know the exact package id.
Use version ranges for libraries that can accept compatible updates. Use exact versions when you need strict reproducibility.
Commit vix.json.
Commit vix.lock.
Do not commit .vix/deps.
Do not edit vix.lock manually.
Run vix install after adding dependencies.
Run vix build and vix tests after adding dependencies.
For vix.app, keep deps and links aligned.
Use registry package specs in deps.
Use CMake aliases in links.
Related commands
| Command | Purpose |
|---|---|
vix search | Search the local registry index. |
vix install | Install dependencies from vix.lock. |
vix update | Re-resolve dependency versions. |
vix outdated | Check outdated dependencies. |
vix remove | Remove dependencies. |
vix list | List dependencies. |
vix registry sync | Refresh the local registry index. |
vix build | Build after dependency changes. |
vix tests | Run tests after dependency changes. |
Next step
Install locked dependencies.