Skip to main content
Version: Next

Module Dependency CLI Commands

Invowk provides a set of invowk module commands for managing module dependencies declared in invowkmod.cue.

Command Overview​

CommandDescription
invowk module addAdd a module dependency (resolves, caches, updates lock file and invowkmod.cue)
invowk module removeRemove a module dependency (updates lock file and invowkmod.cue)
invowk module depsList resolved dependencies
invowk module syncResolve dependencies from invowkmod.cue
invowk module updateUpdate dependencies to latest matching versions
invowk module tidyAdd missing transitive dependencies to invowkmod.cue
invowk module vendorVendor dependencies into invowk_modules/

invowk module add​

Resolve a dependency, cache it, update the lock file, and auto-edit invowkmod.cue to add the requires entry.

Usage​

invowk module add <git-url> <version> [flags]

Arguments​

ArgumentDescription
git-urlGit repository URL (HTTPS or SSH)
versionSemantic version constraint

Flags​

FlagDescription
--alias <name>Custom command source ID for the dependency
--path <path>Subdirectory within the repository

Examples​

# Add a dependency with caret version
invowk module add https://github.com/user/tools.git ^1.0.0

# Add with SSH URL
invowk module add git@github.com:user/tools.git ~2.0.0

# Add with custom alias
invowk module add https://github.com/user/common.git ^1.0.0 --alias tools

# Add from monorepo subdirectory
invowk module add https://github.com/user/monorepo.git ^1.0.0 --path modules/io.example.cli.invowkmod

Output​

Add Module Dependency

• Resolving https://github.com/user/tools.git@^1.0.0...
✓ Module resolved

• Git URL: https://github.com/user/tools.git
• Version: ^1.0.0 → 1.2.3
• Namespace: io.example.tools@1.2.3
• Cache: /home/user/.invowk/modules/github.com/user/tools/1.2.3/io.example.tools.invowkmod
✓ Module lock file updated
✓ Updated invowkmod.cue with new requires entry
note

invowk module add performs three actions automatically:

  1. Resolves and caches the module
  2. Updates the lock file
  3. Auto-edits invowkmod.cue to add the requires entry

The output looks like:

• Resolving <url>@<version>...
✓ Module resolved
• Git URL: <url>
• Version: <requested> → <resolved>
• Namespace: <namespace>
• Cache: <path>
✓ Module lock file updated
✓ Updated invowkmod.cue with new requires entry

When the lock file already held the module with the same entry, the save leaves it untouched and the lock line reads ✓ Module lock file unchanged; the invowkmod.cue line still reports its own edit.

When the invowkmod.cue edit fails, the command restores the lock file and prints neither line. If invowkmod.cue does not exist, the last line reads invowkmod.cue not found — dependency was not persisted; for any other failure (for example, a requires entry for the module already exists) it reads Could not auto-edit invowkmod.cue; lock file changes were rolled back: <error>. If restoring a file fails as well, the last line reads Could not auto-edit invowkmod.cue; lock file rollback may be incomplete: <error> even when invowkmod.cue is missing, and <error> names the failed restore. After a rollback the command exits with status 1 and prints the error on stderr.

invowk module remove​

Remove a module dependency from the lock file and invowkmod.cue.

Usage​

invowk module remove <identifier>

Arguments​

ArgumentDescription
identifierModule identifier: git URL, alias, module name, or full key (modulename@version)

Examples​

invowk module remove https://github.com/user/tools.git

Output​

Remove Module Dependency

• Removing https://github.com/user/tools.git...
✓ Removed io.example.tools@1.2.3

✓ Lock file and invowkmod.cue updated
note

invowk module remove performs two actions automatically:

  1. Removes the module from the lock file
  2. Auto-edits invowkmod.cue to remove the corresponding requires entry

The output looks like:

Remove Module Dependency
• Removing <identifier>...
✓ Removed <namespace>

✓ Lock file and invowkmod.cue updated

Only when the lock file on disk already lacks the removed entries, because it was edited outside invowk, does the save leave it untouched; then the last line reads ✓ Lock file unchanged; invowkmod.cue updated. Another invowk module command cannot remove them in between: it waits for this one (Concurrent Module Commands).

When invowkmod.cue has no requires entry for the removed module, or does not exist, the command leaves it untouched and the last line reads ✓ Lock file updated; invowkmod.cue unchanged (or ✓ Lock file and invowkmod.cue unchanged when the lock save was skipped as well).

When the invowkmod.cue edit fails, the command restores the lock file. It prints Could not auto-edit invowkmod.cue: <error> and no Removed <namespace> line, since nothing was removed, and the last line reads Lock file changes were rolled back; invowkmod.cue needs manual review. If restoring a file fails as well, <error> names the failed restore and the last line reads Lock file rollback may be incomplete; invowkmod.cue needs manual review. After a rollback the command exits with status 1 and prints the error on stderr.

Cached files are not deleted.

invowk module deps​

List all resolved dependencies from the lock file.

Usage​

invowk module deps

Output​

Module Dependencies

• Found 2 module dependency(ies)

✓ build-tools@2.3.1
Git URL: https://github.com/company/build-tools.git
Version: ^2.0.0 → 2.3.1
Commit: abc123def456
Cache: /home/user/.invowk/modules/github.com/company/build-tools/2.3.1/io.company.buildtools.invowkmod

✓ deploy-utils@1.5.2
Git URL: https://github.com/company/deploy-tools.git
Version: ~1.5.0 → 1.5.2
Commit: 789xyz012abc
Cache: /home/user/.invowk/modules/github.com/company/deploy-tools/1.5.2/io.company.deploytools.invowkmod

No Dependencies​

Module Dependencies

• No module dependencies found

• To add modules, use: invowk module add <git-url> <version>

invowk module sync​

Sync all dependencies declared in invowkmod.cue. This reads the requires field, resolves version constraints, downloads modules, and updates the lock file.

Usage​

invowk module sync

Output​

Sync Module Dependencies

• Found 2 requirement(s) in invowkmod.cue

✓ build-tools@2.3.1 → 2.3.1
✓ deploy-utils@1.5.2 → 1.5.2

✓ Lock file updated: invowkmod.lock.cue

When the resolved lock has the same content as the lock on disk, the save leaves it untouched and the last line reads ✓ Lock file unchanged: invowkmod.lock.cue.

No Requirements​

Sync Module Dependencies

• No requires field found in invowkmod.cue

invowk module update​

Update dependencies to their latest versions matching the declared constraints.

Usage​

invowk module update [identifier]

Arguments​

ArgumentDescription
identifier(Optional) Specific dependency to update: git URL, alias, module name, or full key (modulename@version)

Examples​

# Update all modules
invowk module update

# Update a specific module
invowk module update https://github.com/user/tools.git

Output​

Update Module Dependencies

• Updating all modules...

✓ build-tools@2.3.1 → 2.4.0
✓ deploy-utils@1.5.2 → 1.5.3

✓ Lock file updated: invowkmod.lock.cue

When nothing newer matches the constraints, the lock keeps its content, the save leaves it untouched and the last line reads ✓ Lock file unchanged: invowkmod.lock.cue.

No Updates​

Update Module Dependencies

• Updating all modules...
• No modules to update
✓ Lock file unchanged: invowkmod.lock.cue

invowk module tidy​

Scan all resolved modules' dependencies and add any missing transitive requirements to your invowkmod.cue. This implements the explicit-only dependency model: every module in the dependency tree must appear in your invowkmod.cue.

Usage​

invowk module tidy

What It Does​

  1. Parses your invowkmod.cue to get declared requirements
  2. Resolves each dependency and inspects its own requires
  3. Identifies transitive dependencies not yet declared in your invowkmod.cue
  4. Auto-adds missing entries to invowkmod.cue

After running tidy, run invowk module sync to update the lock file.

Output​

Tidy Module Dependencies
• Found 3 requirement(s) in invowkmod.cue
• Resolving dependencies to find missing transitive requirements...
✓ Added https://github.com/example/utils.git (^1.0.0)

✓ Added 1 missing transitive dependency(ies) to invowkmod.cue
• Run invowk module sync to update the lock file

invowk module vendor​

Vendor dependencies into the invowk_modules/ directory for offline use and distribution.

Usage​

invowk module vendor [module-path]

Output​

Vendor Module Dependencies

• Found 2 requirement(s) in invowkmod.cue
• Loading from lock file
• Vendor directory: /home/user/project/invowk_modules

✓ common@1.2.3
✓ deploy@1.5.4

✓ Vendored 2 module(s) successfully
note

invowk module vendor resolves dependencies and copies them into invowk_modules/. If invowkmod.lock.cue exists, vendoring uses locked versions by default. Use --update to force re-resolution and --prune to remove stale vendored modules.

Concurrent Module Commands​

invowk module add, remove, sync, update, tidy and vendor, and invowk agent mod change when it writes, edit a project one at a time. Each takes the project's lock before it reads invowkmod.cue or invowkmod.lock.cue and releases it after its last write, so two of them started on the same project never lose each other's edits: the second waits until the first is done and then works on the files the first left. While it waits it prints, once, on stderr:

• Waiting for another invowk module command on this project (lock: <path>)

A command that fetches a module also locks that module's Git source while it checks it out, so two projects that fetch the same source take turns there:

• Waiting for another invowk module command on module source <git-url> (lock: <path>)

A command waits at most 5 minutes for a lock. Then it fails with exit status 1 and an error that names the lock file; Ctrl+C stops the wait at once. Either way it leaves invowkmod.cue and invowkmod.lock.cue as they were.

The lock files live in the locks directory of the module cache (INVOWK_MODULES_PATH, or ~/.invowk/modules): project-<hash>.lock for a project and source-<hash>.lock for a Git source. They are empty, and invowk never deletes them; removing them while no module command runs is harmless. Because every edit command takes the lock, module remove and a module sync, tidy or vendor that finds no requires now create the module cache directory and its locks directory when they are missing; so do module sync, tidy, update and remove run in a directory with no invowkmod.cue, which take the lock before they find the file missing. When the cache directory cannot be resolved or created, they fail with an error that names the path and suggests setting INVOWK_MODULES_PATH to a writable directory.

Read-only commands never wait: module deps, module list, validate, audit and running commands do not take the lock, and the locks directory is not a project input, even when the module cache sits inside the project.

Project paths are canonicalized across symbolic links on every system—plus letter case and firmlinks on macOS, and junctions, letter case, and 8.3 short names on Windows—so commands started through different path spellings of the same directory share one lock.

Known limits:

  • Two runs with different INVOWK_MODULES_PATH values use different locks directories and do not wait for each other.
  • The locks are advisory locks between invowk processes on one machine. They do not stop an editor or another tool from changing the files, and on a network file system they may not exclude processes on other machines.

Common Workflows​

Initial Setup​

# 1. Resolve dependencies
invowk module add https://github.com/company/build-tools.git ^2.0.0 --alias build
invowk module add https://github.com/company/deploy-tools.git ~1.5.0 --alias deploy

# 2. Add requires to invowkmod.cue manually or verify
cat invowkmod.cue

# 3. Sync to generate lock file
invowk module sync

# 4. Commit the lock file
git add invowkmod.lock.cue
git commit -m "Add module dependencies"

Fresh Clone​

# On a fresh clone, sync downloads all modules
git clone https://github.com/yourorg/project.git
cd project
invowk module sync

Regular Updates​

# Update all modules periodically
invowk module update

# Review changes
git diff invowkmod.lock.cue

# Commit if tests pass
git add invowkmod.lock.cue
git commit -m "Update module dependencies"

Troubleshooting​

# List current dependencies to verify state
invowk module deps

# Re-sync if something seems wrong
invowk module sync

# Check commands are available
invowk cmd

Environment Variables​

VariableDescription
INVOWK_MODULES_PATHOverride module cache directory; must be an absolute path (a relative value is rejected)
GITHUB_TOKENGitHub authentication
GITLAB_TOKENGitLab authentication
GIT_TOKENGeneric Git authentication

Exit Codes​

CodeMeaning
0Success
1General error
1Module not found (for remove)
1No invowkmod.cue found (for sync)
1Version resolution failed
1Git clone/fetch failed
1Timed out after 5 minutes waiting for a module lock
2Command line rejected (unknown subcommand or flag, wrong number of arguments)