Semantic version manager for files containing VERSION marker blocks.
Quick: version bump patch increments patch version in all discovered files.
sudo ln -sf /ai/scripts/Okusi/version/version /usr/local/bin/versionversion [OPTIONS] COMMAND [ARGS]
version get # Show versions
version set 2.0.0 # Set explicit version
version bump patch # Increment component
| Command | Description |
|---|---|
get |
Display versions from discovered files |
set VERSION |
Set explicit version (X.Y.Z or X.Y.Z.B) |
bump COMPONENT |
Increment: major / minor / patch / build |
| Option | Description |
|---|---|
-d DIR |
Target directory (default: .) |
-f FILE |
Target specific file (repeatable) |
-n |
Dry-run (show changes without writing) |
-q |
Quiet mode |
-v |
Verbose mode |
-V |
Show script version |
-h |
Help |
Add to any file to enable version management:
### VERSION [optional description]
declare -r VERSION=1.2.2
###◉ Bare ### VERSION is auto-expanded to ### VERSION managed by version
◉ Custom suffixes (e.g., ### VERSION managed by myapp) are preserved
Supported declaration patterns (style preserved on update):
VERSION=X.Y.Zdeclare -- VERSION=X.Y.Zdeclare -r VERSION=X.Y.Zreadonly VERSION=X.Y.Z
| Command | Result | Resets |
|---|---|---|
bump major |
1.2.3 → 2.0.0 | minor, patch, build |
bump minor |
1.2.3 → 1.3.0 | patch, build |
bump patch |
1.2.3 → 1.2.4 | build |
bump build |
1.2.3 → 1.2.3.1 | (adds if missing) |
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error (no files found, operation failed) |
| 2 | Directory not found |
| 22 | Invalid argument (bad version format, missing arg) |
# Get versions
version get # All files in current dir
version -f app.sh get # Specific file
version -q get # Version number only
# Set versions
version set 2.0.0 # Set to 2.0.0
version -n set 3.0.0 # Dry-run first
# Bump versions
version bump patch # 1.0.0 → 1.0.1
version -d src/ bump minor # In src/ directory
version -f a.sh -f b.sh bump major # Multiple files- Discovers files recursively via
grep -rl - Verifies each update succeeded
- BCS-compliant (Bash 5.2+, ShellCheck clean)
#fin