Module Dependency CLI Commands
Invowk provides a set of invowk module commands for managing module dependencies declared in invowkmod.cue.
Command Overview
| Command | Description |
|---|---|
invowk module add | Add a module dependency (resolves, caches, updates lock file and invowkmod.cue) |
invowk module remove | Remove a module dependency (updates lock file and invowkmod.cue) |
invowk module deps | List resolved dependencies |
invowk module sync | Resolve dependencies from invowkmod.cue |
invowk module update | Update dependencies to latest matching versions |
invowk module vendor | Vendor 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
| Argument | Description |
|---|---|
git-url | Git repository URL (HTTPS or SSH) |
version | Semantic version constraint |
Flags
| Flag | Description |
|---|---|
--alias <name> | Custom namespace for the dependency |
--path <path> | Subdirectory within the repository |
Examples
# Add a dependency with caret version
invowk module add https://github.com/user/mod.invowkmod.git ^1.0.0
# Add with SSH URL
invowk module add git@github.com:user/mod.invowkmod.git ~2.0.0
# Add with custom alias
invowk module add https://github.com/user/common.invowkmod.git ^1.0.0 --alias tools
# Add from monorepo subdirectory
invowk module add https://github.com/user/monorepo.invowkmod.git ^1.0.0 --path modules/cli
Output
Add Module Dependency
ℹ Resolving https://github.com/user/mod.invowkmod.git@^1.0.0...
✓ Module resolved and lock file updated
ℹ Git URL: https://github.com/user/mod.invowkmod.git
ℹ Version: ^1.0.0 → 1.2.3
ℹ Namespace: mod@1.2.3
ℹ Cache: /home/user/.invowk/modules/github.com/user/mod.invowkmod/1.2.3
✓ Updated invowkmod.cue with new requires entry
invowk module add performs three actions automatically:
- Resolves and caches the module
- Updates the lock file
- Auto-edits
invowkmod.cueto add therequiresentry (if the file exists)
The output looks like:
ℹ Resolving <url>@<version>...
✓ Module resolved and lock file updated
ℹ Git URL: <url>
ℹ Version: <requested> → <resolved>
ℹ Namespace: <namespace>
ℹ Cache: <path>
✓ Updated invowkmod.cue with new requires entry
invowk module remove
Remove a module dependency from the lock file and invowkmod.cue.
Usage
invowk module remove <identifier>
Arguments
| Argument | Description |
|---|---|
identifier | Module identifier: git URL, alias, module name, or full key (modulename@version) |
Examples
invowk module remove https://github.com/user/mod.invowkmod.git
Output
Remove Module Dependency
ℹ Removing https://github.com/user/mod.invowkmod.git...
✓ Removed mod@1.2.3
✓ Lock file and invowkmod.cue updated
invowk module remove performs two actions automatically:
- Removes the module from the lock file
- Auto-edits
invowkmod.cueto remove the correspondingrequiresentry
The output looks like:
Remove Module Dependency
ℹ Removing <identifier>...
✓ Removed <namespace>
✓ Lock file and invowkmod.cue updated
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.invowkmod.git
Version: ^2.0.0 → 2.3.1
Commit: abc123def456
Cache: /home/user/.invowk/modules/github.com/company/build-tools.invowkmod/2.3.1
✓ deploy-utils@1.5.2
Git URL: https://github.com/company/deploy-tools.invowkmod.git
Version: ~1.5.0 → 1.5.2
Commit: 789xyz012abc
Cache: /home/user/.invowk/modules/github.com/company/deploy-tools.invowkmod/1.5.2
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
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
| Argument | Description |
|---|---|
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/mod.invowkmod.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
No Updates
Update Module Dependencies
• Updating all modules...
• No modules to update
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
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.
Common Workflows
Initial Setup
# 1. Resolve dependencies
invowk module add https://github.com/company/build-tools.invowkmod.git ^2.0.0 --alias build
invowk module add https://github.com/company/deploy-tools.invowkmod.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
| Variable | Description |
|---|---|
INVOWK_MODULES_PATH | Override module cache directory |
GITHUB_TOKEN | GitHub authentication |
GITLAB_TOKEN | GitLab authentication |
GIT_TOKEN | Generic Git authentication |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 1 | Module not found (for remove) |
| 1 | No invowkmod.cue found (for sync) |
| 1 | Version resolution failed |
| 1 | Git clone/fetch failed |