Skip to content

feat: added version command to see package version#60

Merged
sawradip merged 3 commits into
mainfrom
version/fix
Aug 29, 2025
Merged

feat: added version command to see package version#60
sawradip merged 3 commits into
mainfrom
version/fix

Conversation

@RadeenXALNW

@RadeenXALNW RadeenXALNW commented Aug 27, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • CLI adds a --version flag and a version command; several new subcommands (template, deploy_local, upload, start, deploy, serve, run).
  • Chores

    • Release process updated: synced version bumps across language packages, simplified changelog generation, reduced automatic changelog creation by default, and added post-release push/tag guidance.
    • CI release workflow now supports building and publishing to PyPI when applicable.

@coderabbitai

coderabbitai Bot commented Aug 27, 2025

Copy link
Copy Markdown

Walkthrough

Synchronizes version metadata across language bindings, updates release automation (simplifies changelog generation, adds cross-file version update, prints next-step push commands), extends the CLI with a --version flag and version command, and bumps package versions across project manifests and language SDKs.

Changes

Cohort / File(s) Summary of Edits
Release automation
release.sh
Adds OS-aware sed handling and updates runagent/__init__.py during version bumps; simplifies generate_changelog to rely on git-cliff --latest and removes multi-tag/range/backup logic; stops automatic changelog generation in main flow; updates commit message path; adds CURRENT_BRANCH and prints push/tag NEXT STEPS; minor formatting tweaks.
CLI: commands & integration
runagent/cli/commands.py, runagent/cli/main.py
Adds print_version(ctx, param, value) callback and version() command to print colored version info (handles ImportError); registers a --version eager flag on the CLI group and registers additional subcommands (version, template, deploy_local, upload, start, deploy, serve, run).
CI / Release workflow
.github/workflows/create-release.yml
Renames workflow to include PyPI publishing; adds PyPI publish steps (build, version check, pypi existence check, conditional upload) gated by release and publish flags; includes pip install snippet in release body; stricter package-version vs tag equality checks and logging.
Changelog & metadata
CHANGELOG.md, pyproject.toml
Bumps project version to 0.1.20 in pyproject.toml; updates CHANGELOG.md header and entries to reflect 0.1.20.
Python package version files
runagent/__init__.py, runagent/__version__.py
Bumps __version__ values to 0.1.20 (synchronization of version metadata).
Language SDK version bumps
runagent-go/runagent/version.go, runagent-rust/runagent/Cargo.toml, runagent-ts/package.json
Updates SDK package versions to 0.1.20; Rust Cargo.toml also adds a new dependency dirs = "5.0".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as runagent (click)
  participant Callback as commands.print_version
  participant Mod as runagent.__init__
  participant Console as STDOUT

  User->>CLI: runagent --version
  CLI->>Callback: callback(ctx, param, True)
  alt module import succeeds
    Callback->>Mod: import __version__
    Callback-->>Console: print "runagent {version}" (bold cyan)
    Callback-->>CLI: ctx.exit()
  else import fails
    Callback-->>Console: print "runagent version unknown" (red)
    Callback-->>CLI: ctx.exit()
  end
Loading
sequenceDiagram
  autonumber
  actor Dev
  participant Script as release.sh
  participant Sed as update_python_version (OS-aware)
  participant Git as git
  participant Cliff as git-cliff

  Dev->>Script: ./release.sh <VERSION>
  Script->>Sed: update pyproject.toml + runagent/__init__.py
  Sed-->>Script: files updated
  Script->>Git: commit version bump
  opt changelog (manual)
    Script->>Cliff: git-cliff --output CHANGELOG.md --latest
    Cliff-->>Script: CHANGELOG.md generated
  end
  Script-->>Dev: print NEXT STEPS (branch, git push, git push --tags)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I twitch my whiskers, version hopped anew,
Files aligned in neat, coordinated stew.
A tiny script nudged, changelog trimmed light,
CLI now answers when you ask, "What's right?"
I thump—push tags, release, then nibble on a carrot bright. 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Ruff (0.12.2)
runagent/__init__.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to parse /pyproject.toml
�[1mCause:�[0m TOML parse error at line 162, column 18
|
162 | target-version = "0.1.20"
| ^^^^^^^^
unknown variant 0.1.20, expected one of py37, py38, py39, py310, py311, py312, py313, py314

runagent/__version__.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to parse /pyproject.toml
�[1mCause:�[0m TOML parse error at line 162, column 18
|
162 | target-version = "0.1.20"
| ^^^^^^^^
unknown variant 0.1.20, expected one of py37, py38, py39, py310, py311, py312, py313, py314

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch version/fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
release.sh (3)

388-407: Fix release order: tag is created/pushed before commit; plus invalid push flag.

Current flow tags and pushes before committing the version bump and changelog, so the tag points to the wrong commit. Also, git uses --tags (plural) or an explicit ref; --tag is invalid. Reorder to commit first, then tag, and push both commit and tag. Stage the generated CHANGELOG.md before committing.

Apply this diff:

-# Create new tag
-git tag -a "v$VERSION" -m "Release v$VERSION
-RunAgent Universal Release v$VERSION"
-
-git push --tag
-echo "✅ Tag v$VERSION created and pushed successfully!"
-
-generate_changelog
-
-git commit -m "chore: bump version to v$VERSION
-
-- Updated all SDK versions to $VERSION
-- Generated changelog with git-cliff" -q
+generate_changelog
+git add CHANGELOG.md 2>/dev/null || true
+
+# Ensure we actually have something to commit (after staging changelog)
+if git diff --staged --quiet; then
+    echo "⚠️  No changes to commit."
+    exit 1
+fi
+
+git commit -m "chore: bump version to v$VERSION
+
+- Updated all SDK versions to $VERSION
+- Generated changelog with git-cliff" -q
+
+# Create tag at the commit we just made
+git tag -a "v$VERSION" -m "Release v$VERSION
+RunAgent Universal Release v$VERSION"

And push the branch and tag:

-CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
-echo ""
-echo "📋 Next steps:"
-echo "  1. Push changes: git push origin $CURRENT_BRANCH"
-echo "  2. Push tag: git push origin v$VERSION"
-echo "  3. Monitor workflows at: https://github.com/runagent-dev/runagent/actions"
+CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
+git push origin "$CURRENT_BRANCH"
+git push origin "v$VERSION"
+echo "✅ Changes and tag pushed successfully!"
+echo ""
+echo "📋 Next steps:"
+echo "  • Monitor workflows at: https://github.com/runagent-dev/runagent/actions"

373-379: Existing-tag path exits early without committing or pushing; moved tag not pushed.

If the tag exists, the script moves it, generates a changelog, and exits — leaving version bumps uncommitted and not pushing the moved tag. Commit staged changes and force-push the updated tag before exiting.

Apply this diff:

-if handle_existing_tag "$VERSION"; then
-    echo "✅ Tag v$VERSION updated successfully!"
-    generate_changelog
-    exit 0
-fi
+if handle_existing_tag "$VERSION"; then
+    echo "✅ Tag v$VERSION updated successfully!"
+    generate_changelog
+    git add CHANGELOG.md 2>/dev/null || true
+    if ! git diff --staged --quiet; then
+        git commit -m "chore: bump version to v$VERSION
+
+- Updated all SDK versions to $VERSION
+- Generated changelog with git-cliff" -q
+    fi
+    CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
+    git push origin "$CURRENT_BRANCH"
+    git push --force-with-lease origin "v$VERSION"
+    echo "✅ Tag v$VERSION moved and pushed successfully!"
+    exit 0
+fi

383-386: “No changes to commit” check happens too early.

This check runs before generating and staging CHANGELOG.md, producing false negatives. Defer the check until after changelog generation and staging (as in the previous diff).

-if git diff --staged --quiet; then
-    echo "⚠️  No changes to commit."
-    exit 1
-fi
+# Defer "no changes" check until after changelog generation and staging.
runagent/cli/commands.py (1)

584-589: NameError: printing capacity uses undefined variable.

capacity is commented out; code should use capacity_info.

Apply this diff:

-            # capacity = sdk.get_local_capacity()
-            capacity_info = sdk.db_service.get_database_capacity_info()
-
-            console.print(
-                f"📊 Capacity: [cyan]{capacity.get('current_count', 1)}/5[/cyan] slots used"
-            )
+            capacity_info = sdk.db_service.get_database_capacity_info()
+            console.print(
+                f"📊 Capacity: [cyan]{capacity_info.get('current_count', 1)}/5[/cyan] slots used"
+            )
🧹 Nitpick comments (4)
release.sh (1)

93-102: Minor: unused function parameter.

verify_version_update receives version but doesn’t use it. Consider removing the unused parameter and its call-site args to reduce noise.

-verify_version_update() {
-    local file=$1
-    local version=$2
-    local pattern=$3
+verify_version_update() {
+    local file=$1
+    local pattern=$2

And update call sites accordingly.

runagent/cli/commands.py (3)

42-49: DRY up version printing and add fallback.

Both print_version and version duplicate logic and only read from runagent.version.py. Consider a shared helper and a fallback to runagent.init.version.

Example:

def _display_version():
    try:
        from runagent.__version__ import __version__
    except Exception:
        try:
            from runagent import __version__  # fallback if defined in __init__
        except Exception:
            __version__ = None
    if __version__:
        console.print(f"[bold cyan]runagent {__version__}[/bold cyan]")
    else:
        console.print("[red]runagent version unknown[/red]")

Use _display_version() in both functions.


376-377: Remove stray debug print.

Leftover print(">>", ...) will leak noise into CLI output.

-        print(">>", framework, ">>", template)
+        # Debug print removed

1293-1302: Duplicate “Status” column label in table.

Two columns are labeled “Status”. Rename the first to “State” (icon) or similar.

-            table.add_column("Status", width=8)
+            table.add_column("State", width=8)
...
-            table.add_column("Status", style="yellow", width=10)
+            table.add_column("Status", style="yellow", width=10)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b55f297 and 28f0f93.

📒 Files selected for processing (3)
  • release.sh (3 hunks)
  • runagent/cli/commands.py (1 hunks)
  • runagent/cli/main.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
runagent/cli/main.py (1)
runagent/cli/commands.py (2)
  • print_version (30-39)
  • version (43-49)
🔇 Additional comments (4)
release.sh (1)

108-144: Python version sync to init.py looks good.

Cross-file version consistency with runagent/init.py is helpful for CLI version reads and imports.

runagent/cli/commands.py (1)

30-39: LGTM: --version callback behavior is correct and user-friendly.

The eager callback with resilient_parsing check and colored output is solid.

runagent/cli/main.py (2)

7-8: LGTM: group-level --version flag wiring.

Eager option with callback integrates cleanly with the CLI group.


12-26: LGTM: version command registered alongside other subcommands.

Command surface looks consistent and discoverable.

Comment thread release.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good Cleanup.

@sawradip

Copy link
Copy Markdown
Contributor

lgtm. Solves #59

sawradip
sawradip previously approved these changes Aug 27, 2025
- Updated all SDK versions to 0.1.20
- Generated changelog with git-cliff

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
release.sh (4)

388-407: Fix release flow: commit before tagging; include CHANGELOG; correct tag push

Currently you tag and push before committing, and you generate the changelog after staging, so CHANGELOG.md won’t be in the commit. Also, git push --tag is incorrect; push the specific tag or use --tags. Refactor this block as below.

-# Create new tag
-git tag -a "v$VERSION" -m "Release v$VERSION
-RunAgent Universal Release v$VERSION"
-
-git push --tag
-echo "✅ Tag v$VERSION created and pushed successfully!"
-
-generate_changelog
-
-git commit -m "chore: bump version to v$VERSION
-
-- Updated all SDK versions to $VERSION
-- Generated changelog with git-cliff" -q
-
-CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
-echo ""
-echo "📋 Next steps:"
-echo "  1. Push changes: git push origin $CURRENT_BRANCH"
-echo "  2. Push tag: git push origin v$VERSION"
-echo "  3. Monitor workflows at: https://github.com/runagent-dev/runagent/actions"
+# Generate changelog BEFORE staging so it's included
+generate_changelog
+
+# Stage and commit changes (including CHANGELOG.md)
+git add .
+if git diff --staged --quiet; then
+  echo "⚠️  No changes to commit."
+  exit 1
+fi
+git commit -m "chore: bump version to v$VERSION
+
+- Updated all SDK versions to $VERSION" -q
+
+# Create and push tag that points to the release commit
+git tag -a "v$VERSION" -m "Release v$VERSION
+RunAgent Universal Release v$VERSION"
+
+CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
+git push origin "$CURRENT_BRANCH"
+git push origin "v$VERSION"
+echo "✅ Release commit and tag pushed successfully!"
+
+echo ""
+echo "📋 Next steps:"
+echo "  1. Monitor workflows: https://github.com/runagent-dev/runagent/actions"

93-102: Use fixed-string grep in version verification

grep -q "$pattern" treats dots in versions as regex wildcards. Use -F to prevent false positives/negatives.

-    if [[ -f "$file" ]] && grep -q "$pattern" "$file" 2>/dev/null; then
+    if [[ -f "$file" ]] && grep -Fq "$pattern" "$file" 2>/dev/null; then

111-121: Anchor and harden sed for pyproject/version.py edits

The current patterns may touch unintended keys (e.g., tool configs). Anchor and tolerate whitespace.

-            sed -i '' "s/version = \".*\"/version = \"$version\"/" "$pyproject_file"
+            sed -i '' "s/^[[:space:]]*version[[:space:]]*=[[:space:]]*\"[^\"]*\"/version = \"$version\"/" "$pyproject_file"
...
-            sed -i "s/version = \".*\"/version = \"$version\"/" "$pyproject_file"
+            sed -i "s/^[[:space:]]*version[[:space:]]*=[[:space:]]*\"[^\"]*\"/version = \"$version\"/" "$pyproject_file"
-            sed -i '' "s/__version__ = \".*\"/__version__ = \"$version\"/" "$version_file"
+            sed -i '' "s/^[[:space:]]*__version__[[:space:]]*=[[:space:]]*\"[^\"]*\"/__version__ = \"$version\"/" "$version_file"
...
-            sed -i "s/__version__ = \".*\"/__version__ = \"$version\"/" "$version_file"
+            sed -i "s/^[[:space:]]*__version__[[:space:]]*=[[:space:]]*\"[^\"]*\"/__version__ = \"$version\"/" "$version_file"

Also applies to: 126-131


285-316: Avoid moving existing tags silently; ensure commit flow continues

If a tag exists, you currently force-move it and then exit, skipping commit/stage steps. That’s risky for published tags and inconsistent with the rest of the flow.

  • Default to abort when tag exists; require explicit force with a second confirmation.
  • If forcing, still run the normal commit + tag push flow so the tag points to the release commit.

Also applies to: 373-379

runagent-rust/runagent/Cargo.toml (1)

44-50: Avoid duplicative platform-dirs crates; prefer one (directories vs dirs).

You already depend on directories from the workspace; adding dirs = "5.0" creates API duplication and extra artifact bloat. Standardize on one crate (recommend directories, which you already have).

Apply this diff to drop dirs:

 url = "2.5"
 bytes = "1.5"
 mime = "0.3"
 percent-encoding = "2.3"
-dirs = "5.0"  # Add this line

If you truly need dirs, remove directories instead and update call sites accordingly.

.github/workflows/create-release.yml (2)

12-12: Fix job-level condition to avoid referencing pull_request on push events.

GitHub expressions don’t short-circuit reliably; github.event.pull_request can be undefined on push. Guard it.

-    if: github.event_name == 'push' || (github.event.pull_request.merged == true)
+    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)

23-59: Simplify tag discovery and eliminate word-splitting bugs.

Replace manual loop and unquoted expansions with native git filtering.

-    - name: Find new tags reachable from main
+    - name: Find new tags reachable from main
       id: find-tags
       run: |
-        echo "🔍 [MAIN RELEASE] Checking for version tags now reachable from main..."
-
-        # Get all version tags
-        ALL_TAGS=$(git tag -l 'v*' | sort -V)
-        echo "All version tags: $ALL_TAGS"
-
-        # Find tags that are reachable from main
-        REACHABLE_TAGS=""
-        for tag in $ALL_TAGS; do
-          TAG_COMMIT=$(git rev-list -n 1 $tag)
-          if git merge-base --is-ancestor $TAG_COMMIT HEAD; then
-            echo "✅ Tag $tag is reachable from main (commit: $TAG_COMMIT)"
-            REACHABLE_TAGS="$REACHABLE_TAGS $tag"
-          else
-            echo "❌ Tag $tag is NOT reachable from main (commit: $TAG_COMMIT)"
-          fi
-        done
-        
-        echo "reachable_tags=$REACHABLE_TAGS" >> $GITHUB_OUTPUT
-        
-        # Find the latest reachable tag
-        if [ -n "$REACHABLE_TAGS" ]; then
-          LATEST_TAG=$(echo $REACHABLE_TAGS | tr ' ' '\n' | sort -V | tail -1)
-          echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
-          echo "🏷️ Latest reachable tag: $LATEST_TAG"
-          
-          # Extract version
-          VERSION=${LATEST_TAG#v}
-          echo "version=$VERSION" >> $GITHUB_OUTPUT
-        else
-          echo "No version tags reachable from main"
-          echo "latest_tag=" >> $GITHUB_OUTPUT
-          echo "version=" >> $GITHUB_OUTPUT
-        fi
+        echo "🔍 [MAIN RELEASE] Checking for version tags reachable from main..."
+        REACHABLE_TAGS=$(git tag -l --merged HEAD 'v*' | sort -V)
+        echo "reachable_tags=${REACHABLE_TAGS}" >> "$GITHUB_OUTPUT"
+        if [ -n "$REACHABLE_TAGS" ]; then
+          LATEST_TAG=$(printf '%s\n' "$REACHABLE_TAGS" | tail -1)
+          echo "latest_tag=${LATEST_TAG}" >> "$GITHUB_OUTPUT"
+          echo "🏷️ Latest reachable tag: ${LATEST_TAG}"
+          VERSION="${LATEST_TAG#v}"
+          echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
+        else
+          echo "No version tags reachable from main"
+          echo "latest_tag=" >> "$GITHUB_OUTPUT"
+          echo "version=" >> "$GITHUB_OUTPUT"
+        fi
🧹 Nitpick comments (5)
.github/workflows/create-release.yml (5)

61-80: Minor: ensure gh is available and authenticated.

You already export GH_TOKEN; add a quick sanity check to fail fast if gh is missing to avoid silent skips.

       run: |
+        gh --version || { echo "gh CLI not available"; exit 1; }
         LATEST_TAG="${{ steps.find-tags.outputs.latest_tag }}"

83-96: Twine install is unnecessary when using pypa/gh-action-pypi-publish.

Drop it to speed the job.

-    - name: Install build dependencies
+    - name: Install build dependencies
       if: steps.check-release.outputs.should_release == 'true'
       run: |
         python -m pip install --upgrade pip
-        python -m pip install build twine
+        python -m pip install build

136-169: Use skip-existing in publish action; remove manual PyPI check.

The action supports skipping existing versions, simplifying logic and avoiding curl.

-    - name: Check if package exists on PyPI
-      if: steps.check-release.outputs.should_release == 'true'
-      id: check-pypi
-      run: |
-        VERSION="${{ steps.find-tags.outputs.version }}"
-        # Get package name from pyproject.toml
-        if [ -f "pyproject.toml" ]; then
-          PACKAGE_NAME=$(python -c "
-          import tomllib
-          with open('pyproject.toml', 'rb') as f:
-              data = tomllib.load(f)
-          print(data['project']['name'])
-          ")
-        elif [ -f "setup.py" ]; then
-          PACKAGE_NAME=$(python setup.py --name)
-        else
-          echo "❌ Cannot determine package name"
-          exit 1
-        fi
-        echo "Checking if $PACKAGE_NAME version $VERSION exists on PyPI..."
-        HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/$PACKAGE_NAME/$VERSION/json/")
-        if [ "$HTTP_CODE" = "200" ]; then
-          echo "⚠️ Package $PACKAGE_NAME v$VERSION already exists on PyPI, skipping upload"
-          echo "should_publish_pypi=false" >> $GITHUB_OUTPUT
-        else
-          echo "✅ Package $PACKAGE_NAME v$VERSION not found on PyPI, proceeding with upload"
-          echo "should_publish_pypi=true" >> $GITHUB_OUTPUT
-        fi
-
-    # NEW: Publish to PyPI using API token
-    - name: Publish package to PyPI
-      if: steps.check-release.outputs.should_release == 'true' && steps.check-pypi.outputs.should_publish_pypi == 'true'
-      uses: pypa/gh-action-pypi-publish@release/v1
-      with:
-        password: ${{ secrets.PYPI_API_TOKEN }}
-        print-hash: true
+    # Publish to PyPI using API token (skip if version exists)
+    - name: Publish package to PyPI
+      if: steps.check-release.outputs.should_release == 'true'
+      uses: pypa/gh-action-pypi-publish@release/v1
+      with:
+        password: ${{ secrets.PYPI_API_TOKEN }}
+        print-hash: true
+        skip-existing: true

Also applies to: 171-177


2-8: Add workflow-level concurrency to avoid duplicate runs on push + PR close.

Prevents redundant executions and noisy logs.

 name: Create GitHub Release and Publish to PyPI
 on:
   push:
     branches: [main]  # Trigger on ANY push to main (including PR merges)
   pull_request:
     types: [closed]   # Also trigger when PRs are merged
     branches: [main]
+concurrency:
+  group: release-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true

89-96: Clean up trailing whitespace to satisfy YAML linting.

Multiple lines have trailing spaces flagged by YAMLlint (see provided hints). Remove them to keep CI green.

Also applies to: 102-102, 119-129, 134-134, 141-141, 156-161, 169-169, 177-177, 196-200

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 28f0f93 and 8d818c8.

📒 Files selected for processing (9)
  • .github/workflows/create-release.yml (3 hunks)
  • CHANGELOG.md (1 hunks)
  • pyproject.toml (3 hunks)
  • release.sh (3 hunks)
  • runagent-go/runagent/version.go (1 hunks)
  • runagent-rust/runagent/Cargo.toml (1 hunks)
  • runagent-ts/package.json (1 hunks)
  • runagent/__init__.py (1 hunks)
  • runagent/__version__.py (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • runagent/init.py
  • runagent-go/runagent/version.go
  • runagent/version.py
  • runagent-ts/package.json
  • CHANGELOG.md
  • pyproject.toml
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/create-release.yml

139-139: shellcheck reported issue in this script: SC2086:info:25:39: Double quote to prevent globbing and word splitting

(shellcheck)


139-139: shellcheck reported issue in this script: SC2086:info:28:38: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 YAMLlint (1.37.1)
.github/workflows/create-release.yml

[error] 89-89: trailing spaces

(trailing-spaces)


[error] 96-96: trailing spaces

(trailing-spaces)


[error] 102-102: trailing spaces

(trailing-spaces)


[error] 119-119: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 134-134: trailing spaces

(trailing-spaces)


[error] 141-141: trailing spaces

(trailing-spaces)


[error] 156-156: trailing spaces

(trailing-spaces)


[error] 158-158: trailing spaces

(trailing-spaces)


[error] 161-161: trailing spaces

(trailing-spaces)


[error] 169-169: trailing spaces

(trailing-spaces)


[error] 177-177: trailing spaces

(trailing-spaces)


[error] 196-196: trailing spaces

(trailing-spaces)


[error] 200-200: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
release.sh (1)

203-232: Module path is correct; no changes needed
Verified that runagent-go/go.mod declares module github.com/runagent-dev/runagent/runagent-go, and update_go_version only creates the file when it’s absent.

runagent-rust/runagent/Cargo.toml (1)

3-3: Version bump looks consistent with cross-repo 0.1.20.

No issues spotted here. Make sure the Rust crate tag v0.1.20 is part of the release plan.

Comment on lines +98 to +129
- name: Verify package version matches tag
if: steps.check-release.outputs.should_release == 'true'
run: |
TAG_VERSION="${{ steps.find-tags.outputs.version }}"

# Check if setup.py exists
if [ -f "setup.py" ]; then
PACKAGE_VERSION=$(python setup.py --version)
# Check if pyproject.toml exists
elif [ -f "pyproject.toml" ]; then
# Extract version from pyproject.toml
PACKAGE_VERSION=$(python -c "
import tomllib
with open('pyproject.toml', 'rb') as f:
data = tomllib.load(f)
print(data['project']['version'])
")
else
echo "❌ Neither setup.py nor pyproject.toml found!"
exit 1
fi

echo "Tag version: $TAG_VERSION"
echo "Package version: $PACKAGE_VERSION"

if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "❌ Version mismatch! Tag: $TAG_VERSION, Package: $PACKAGE_VERSION"
exit 1
else
echo "✅ Version match confirmed: $TAG_VERSION"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid executing setup.py during version check. Parse pyproject.toml instead.

Running setup.py can execute arbitrary code. Prefer tomllib; fall back to grep if needed.

-        # Check if setup.py exists
-        if [ -f "setup.py" ]; then
-          PACKAGE_VERSION=$(python setup.py --version)
-        # Check if pyproject.toml exists
-        elif [ -f "pyproject.toml" ]; then
+        if [ -f "pyproject.toml" ]; then
           # Extract version from pyproject.toml
           PACKAGE_VERSION=$(python -c "
           import tomllib
           with open('pyproject.toml', 'rb') as f:
               data = tomllib.load(f)
           print(data['project']['version'])
           ")
         else
           echo "❌ Neither setup.py nor pyproject.toml found!"
           exit 1
         fi

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 102-102: trailing spaces

(trailing-spaces)


[error] 119-119: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
.github/workflows/create-release.yml around lines 98-129: the workflow currently
runs setup.py to get PACKAGE_VERSION (unsafe because setup.py can execute
arbitrary code); change it to never execute setup.py and instead parse
pyproject.toml with tomllib when present, and only if pyproject.toml is absent
and setup.py exists, fall back to a non-executing extraction (e.g., grep/sed to
find a version string or __version__ assignment) to avoid code execution;
implement the python -c tomllib snippet for pyproject.toml parsing, remove the
python setup.py --version call, and ensure the fallback extract is robust and
exits with an error if no version can be safely parsed.

Comment thread release.sh
Comment on lines +108 to 110
local init_file="runagent/__init__.py"
local success=false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Reflect init.py update in success status; optionally create if missing

python_status won’t turn true when only __init__.py exists. Also consider creating __init__.py with version if it’s the chosen source.

     # Also update __init__.py version
     if [[ -f "$init_file" ]]; then
       if [[ "$OSTYPE" == "darwin"* ]]; then
         sed -i '' "s/__version__ = \".*\"/__version__ = \"$version\"/" "$init_file"
       else
         sed -i "s/__version__ = \".*\"/__version__ = \"$version\"/" "$init_file"
       fi
     fi
-    
+    # Count __init__.py as a success too
+    if verify_version_update "$init_file" "$version" "__version__ = \"$version\""; then
+        success=true
+    fi

Optionally, if __init__.py doesn’t exist, write:

echo "__version__ = \"$version\"" > "$init_file"

Also applies to: 136-145

🤖 Prompt for AI Agents
In release.sh around lines 108-110 (and also apply the same change to 136-145),
the script currently won't set python_status true when only runagent/__init__.py
is present or updated; update the logic so that presence or update of
__init__.py is treated as a successful Python version source (i.e., set
success/python_status to true when __init__.py exists and contains or is updated
with the version). Additionally, if you choose __init__.py as the source and the
file is missing, create it with the version string (write "__version__ =
\"$version\"" into runagent/__init__.py) and then mark success/python_status
true; make the same adjustments in the duplicate block at lines 136-145.

@sawradip sawradip merged commit 5803b58 into main Aug 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants