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
18 changes: 17 additions & 1 deletion .agent/scripts/version-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ validate_version_consistency() {
fi
fi

# Check aidevops.sh CLI
if [[ -f "$REPO_ROOT/aidevops.sh" ]]; then
if grep -q "# Version: $expected_version" "$REPO_ROOT/aidevops.sh"; then
Copy link

Choose a reason for hiding this comment

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

grep -q treats . as “any character”, so version strings like 2.54.0 can match unintended text; consider grep -Fq for a fixed-string match (also applies to the other version consistency checks).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

print_success "aidevops.sh: $expected_version ✓"
else
print_error "aidevops.sh does not contain version $expected_version"
errors=$((errors + 1))
fi
fi
Comment on lines +399 to +406

Choose a reason for hiding this comment

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

medium

This block correctly validates the version in aidevops.sh. However, it's very similar to the other validation blocks in this function (e.g., the one for marketplace.json that follows). To improve maintainability and reduce code duplication, consider refactoring this logic into a helper function.

For example, you could create a function like this:

_validate_file_version() {
    local file_path="$1"
    local grep_pattern="$2"
    local file_desc="$3"
    local expected_version="$4"

    if [[ -f "$file_path" ]]; then
        if grep -q "$grep_pattern" "$file_path"; then
            print_success "$file_desc: $expected_version"
        else
            print_error "$file_desc does not contain version $expected_version"
            errors=$((errors + 1))
        fi
    fi
}

Then you could call it for each file:

_validate_file_version "$REPO_ROOT/aidevops.sh" "# Version: $expected_version" "aidevops.sh" "$expected_version"
_validate_file_version "$REPO_ROOT/.claude-plugin/marketplace.json" '"version": "$expected_version"' "Claude Code plugin" "$expected_version"

This would make the validate_version_consistency function much cleaner and easier to extend in the future.


# Check Claude Code plugin marketplace.json
if [[ -f "$REPO_ROOT/.claude-plugin/marketplace.json" ]]; then
if grep -q "\"version\": \"$expected_version\"" "$REPO_ROOT/.claude-plugin/marketplace.json"; then
Expand Down Expand Up @@ -445,6 +455,12 @@ update_version_in_files() {
print_success "Updated setup.sh"
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"
fi
Comment on lines +459 to +462

Choose a reason for hiding this comment

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

medium

This block correctly updates the version in aidevops.sh. Similar to the validation function, this logic is repeated for several files. To make the code more DRY (Don't Repeat Yourself), you could abstract this into a helper function.

For example:

_update_file_version() {
    local file_path="$1"
    local sed_expr="$2"
    local file_desc="$3"

    if [[ -f "$file_path" ]]; then
        sed -i '' "$sed_expr" "$file_path"
        print_success "Updated $file_desc"
    fi
}

And then call it like this:

_update_file_version "$REPO_ROOT/aidevops.sh" "s/# Version: .*/# Version: $new_version/" "aidevops.sh"

This would simplify the update_version_in_files function and make it easier to add more files to the versioning process in the future.


# Update README version badge
if [[ -f "$REPO_ROOT/README.md" ]]; then
# Use more robust regex pattern for version numbers (handles single and multi-digit)
Expand Down Expand Up @@ -498,7 +514,7 @@ commit_version_changes() {
print_info "Committing version changes..."

# Stage all version-related files (including CHANGELOG.md and Claude plugin)
git add VERSION package.json README.md setup.sh sonar-project.properties CHANGELOG.md .claude-plugin/marketplace.json 2>/dev/null
git add VERSION package.json README.md setup.sh aidevops.sh sonar-project.properties CHANGELOG.md .claude-plugin/marketplace.json 2>/dev/null

# Check if there are changes to commit
if git diff --cached --quiet; then
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.13.0
# Version: 2.54.0

set -euo pipefail

Expand Down
Loading