Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .agent/scripts/auto-version-bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return
print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; }
print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; }

# Cross-platform sed in-place edit (works on macOS and Linux)
sed_inplace() {
local pattern="$1"
local file="$2"
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' "$pattern" "$file"
else
sed -i "$pattern" "$file"
fi
return $?
}
Comment on lines +23 to +32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This sed_inplace function is also defined in .agent/scripts/version-manager.sh. To avoid code duplication and improve maintainability, consider moving this and other shared helper functions (like the print_* functions) into a common script that can be sourced by both this script and version-manager.sh.


# Repository root directory
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" || exit
VERSION_MANAGER="$REPO_ROOT/.agent/scripts/version-manager.sh"
Expand Down Expand Up @@ -68,15 +80,20 @@ update_version_badge() {
local readme_file="$REPO_ROOT/README.md"

if [[ -f "$readme_file" ]]; then
# Use more robust regex pattern for version numbers (handles single and multi-digit)
# macOS sed requires different syntax for extended regex
sed -i '' "s/Version-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-blue/Version-$new_version-blue/" "$readme_file"
# Skip if using dynamic GitHub release badge
if grep -q "img.shields.io/github/v/release" "$readme_file"; then
print_success "README.md uses dynamic GitHub release badge (no update needed)"
return 0
fi

# Use cross-platform sed for hardcoded badge
sed_inplace "s/Version-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-blue/Version-$new_version-blue/" "$readme_file"

# Validate the update was successful
if grep -q "Version-$new_version-blue" "$readme_file"; then
print_success "Updated version badge in README.md to $new_version"
else
print_error "Failed to update version badge in README.md"
print_warning "README.md has no version badge (consider adding dynamic GitHub release badge)"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After attempting the sed_inplace replacement, this warning can also trigger when the badge exists but the update failed/mismatched the pattern; the log message may be misleading during CI debugging.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

fi
fi
return 0
Expand Down
88 changes: 71 additions & 17 deletions .agent/scripts/version-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return
print_warning() { local msg="$1"; echo -e "${YELLOW}[WARNING]${NC} $msg"; return 0; }
print_error() { local msg="$1"; echo -e "${RED}[ERROR]${NC} $msg" >&2; return 0; }

# Cross-platform sed in-place edit (works on macOS and Linux)
# Usage: sed_inplace 'pattern' 'file'
sed_inplace() {
local pattern="$1"
local file="$2"
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' "$pattern" "$file"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sed_inplace() is a good start, but there are still direct sed -i '' ... calls later in this script (e.g., in the TODO auto-marking flow) that will still fail on GNU sed/Linux, so the cross-platform fix looks incomplete.

Other Locations
  • .agent/scripts/version-manager.sh:687
  • .agent/scripts/version-manager.sh:690

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

else
sed -i "$pattern" "$file"
fi
return $?
}

# Repository root directory
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
VERSION_FILE="$REPO_ROOT/VERSION"
Expand Down Expand Up @@ -388,37 +401,63 @@ validate_version_consistency() {
# Function to update version in files
update_version_in_files() {
local new_version="$1"
local errors=0

print_info "Updating version references in files..."

# Update VERSION file
if [[ -f "$VERSION_FILE" ]]; then
echo "$new_version" > "$VERSION_FILE"
print_success "Updated VERSION file"
if [[ "$(cat "$VERSION_FILE")" == "$new_version" ]]; then
print_success "Updated VERSION file"
else
print_error "Failed to update VERSION file"
errors=$((errors + 1))
fi
fi

# Update package.json if it exists
if [[ -f "$REPO_ROOT/package.json" ]]; then
sed -i '' "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/package.json"
print_success "Updated package.json"
sed_inplace "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/package.json"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regex used here is a bit brittle as it assumes a very specific format for the version line in package.json (e.g., the space after the colon). A more robust regex would be less sensitive to whitespace changes and different version string formats.

Suggested change
sed_inplace "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/package.json"
sed_inplace "s/\"version\": *\"[^\"]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/package.json"

if grep -q "\"version\": \"$new_version\"" "$REPO_ROOT/package.json"; then
print_success "Updated package.json"
else
print_error "Failed to update package.json"
errors=$((errors + 1))
fi
fi

# Update sonar-project.properties
if [[ -f "$REPO_ROOT/sonar-project.properties" ]]; then
sed -i '' "s/sonar\.projectVersion=.*/sonar.projectVersion=$new_version/" "$REPO_ROOT/sonar-project.properties"
print_success "Updated sonar-project.properties"
sed_inplace "s/sonar\.projectVersion=.*/sonar.projectVersion=$new_version/" "$REPO_ROOT/sonar-project.properties"
if grep -q "sonar.projectVersion=$new_version" "$REPO_ROOT/sonar-project.properties"; then
print_success "Updated sonar-project.properties"
else
print_error "Failed to update sonar-project.properties"
errors=$((errors + 1))
fi
fi

# Update setup.sh if it exists
if [[ -f "$REPO_ROOT/setup.sh" ]]; then
sed -i '' "s/# Version: .*/# Version: $new_version/" "$REPO_ROOT/setup.sh"
print_success "Updated setup.sh"
sed_inplace "s/# Version: .*/# Version: $new_version/" "$REPO_ROOT/setup.sh"
if grep -q "# Version: $new_version" "$REPO_ROOT/setup.sh"; then
print_success "Updated setup.sh"
else
print_error "Failed to update setup.sh"
errors=$((errors + 1))
fi
fi

# Update aidevops.sh CLI if it exists
if [[ -f "$REPO_ROOT/aidevops.sh" ]]; then
sed -i '' "s/# Version: .*/# Version: $new_version/" "$REPO_ROOT/aidevops.sh"
print_success "Updated aidevops.sh"
sed_inplace "s/# Version: .*/# Version: $new_version/" "$REPO_ROOT/aidevops.sh"
if grep -q "# Version: $new_version" "$REPO_ROOT/aidevops.sh"; then
print_success "Updated aidevops.sh"
else
print_error "Failed to update aidevops.sh"
errors=$((errors + 1))
fi
fi

# Update README version badge (skip if using dynamic GitHub release badge)
Expand All @@ -428,15 +467,14 @@ update_version_in_files() {
print_success "README.md uses dynamic GitHub release badge (no update needed)"
elif grep -q "Version-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-blue" "$REPO_ROOT/README.md"; then
# Hardcoded badge - update it
sed -i '' "s/Version-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-blue/Version-$new_version-blue/" "$REPO_ROOT/README.md"
sed_inplace "s/Version-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-blue/Version-$new_version-blue/" "$REPO_ROOT/README.md"

# Validate the update was successful
if grep -q "Version-$new_version-blue" "$REPO_ROOT/README.md"; then
print_success "Updated README.md version badge to $new_version"
else
print_error "Failed to update README.md version badge"
print_info "Please manually update the version badge in README.md"
return 1
errors=$((errors + 1))
fi
else
# No version badge found - that's okay, just warn
Expand All @@ -448,17 +486,24 @@ update_version_in_files() {

# Update Claude Code plugin marketplace.json
if [[ -f "$REPO_ROOT/.claude-plugin/marketplace.json" ]]; then
sed -i '' "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/.claude-plugin/marketplace.json"
sed_inplace "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/.claude-plugin/marketplace.json"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the package.json update, this regex is a bit brittle. A more robust regex would be less sensitive to whitespace and version format.

Suggested change
sed_inplace "s/\"version\": \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/.claude-plugin/marketplace.json"
sed_inplace "s/\"version\": *\"[^\"]*\"/\"version\": \"$new_version\"/" "$REPO_ROOT/.claude-plugin/marketplace.json"


# Validate the update was successful
if grep -q "\"version\": \"$new_version\"" "$REPO_ROOT/.claude-plugin/marketplace.json"; then
print_success "Updated .claude-plugin/marketplace.json"
else
print_error "Failed to update .claude-plugin/marketplace.json"
print_info "Please manually update the version in .claude-plugin/marketplace.json"
return 1
errors=$((errors + 1))
fi
fi

# Return error if any updates failed
if [[ $errors -gt 0 ]]; then
print_error "Failed to update $errors file(s)"
return 1
fi

print_success "All version files updated to $new_version"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unconditional print_success adds another stdout line inside update_version_in_files(), which can break callers that capture version-manager.sh bump ... output as a version string (e.g., .agent/scripts/auto-version-bump.sh assigns new_version=$(...)).

Other Locations
  • .agent/scripts/auto-version-bump.sh:132
  • .opencode/tool/version-manager.ts:10

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

return 0
}

Expand Down Expand Up @@ -847,7 +892,11 @@ main() {

if [[ $? -eq 0 ]]; then
print_success "Bumped version: $current_version → $new_version"
update_version_in_files "$new_version"
if ! update_version_in_files "$new_version"; then
print_error "Failed to update version in all files"
print_info "Run validation to check: $0 validate"
exit 1
fi
echo "$new_version"
else
exit 1
Expand Down Expand Up @@ -928,7 +977,12 @@ main() {

if [[ $? -eq 0 ]]; then
print_info "Updating version references in files..."
update_version_in_files "$new_version"
if ! update_version_in_files "$new_version"; then
print_error "Failed to update version in all files. Aborting release."
print_info "The VERSION file may have been updated. Run validation to check:"
print_info " $0 validate"
exit 1
fi

print_info "Updating CHANGELOG.md..."
if ! update_changelog "$new_version"; then
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"metadata": {
"description": "AI DevOps Framework - comprehensive DevOps automation with 25+ service integrations",
"version": "2.92.1"
"version": "2.92.2"
},
"plugins": [
{
Expand Down
2 changes: 1 addition & 1 deletion aidevops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# AI DevOps Framework CLI
# Usage: aidevops <command> [options]
#
# Version: 2.92.1
# Version: 2.92.2

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aidevops",
"version": "2.92.1",
"version": "2.92.2",
"description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
"type": "module",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# AI Assistant Server Access Framework Setup Script
# Helps developers set up the framework for their infrastructure
#
# Version: 2.92.1
# Version: 2.92.2
#
# Quick Install (one-liner):
# bash <(curl -fsSL https://aidevops.dev/install)
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sonar.organization=marcusquinn

# This is the name and version displayed in the SonarCloud UI
sonar.projectName=AI DevOps Framework
sonar.projectVersion=2.92.1
sonar.projectVersion=2.92.2

# Path is relative to the sonar-project.properties file
sonar.sources=.agent,configs,templates
Expand Down
Loading