Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

version

Semantic version manager for files containing VERSION marker blocks.

Quick: version bump patch increments patch version in all discovered files.

Installation

sudo ln -sf /ai/scripts/Okusi/version/version /usr/local/bin/version

Synopsis

version [OPTIONS] COMMAND [ARGS]
version get                     # Show versions
version set 2.0.0               # Set explicit version
version bump patch              # Increment component

Commands

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

Options

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

Marker Block

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.Z
  • declare -- VERSION=X.Y.Z
  • declare -r VERSION=X.Y.Z
  • readonly VERSION=X.Y.Z

Bump Behavior

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)

Exit Codes

Code Meaning
0 Success
1 General error (no files found, operation failed)
2 Directory not found
22 Invalid argument (bad version format, missing arg)

Examples

# 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

Notes

  • Discovers files recursively via grep -rl
  • Verifies each update succeeded
  • BCS-compliant (Bash 5.2+, ShellCheck clean)

#fin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages