feat: added version command to see package version#60
Conversation
WalkthroughSynchronizes 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
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
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)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
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 runagent/__version__.py�[1;31mruff failed�[0m 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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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=$2And 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.
📒 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.
|
lgtm. Solves #59 |
- Updated all SDK versions to 0.1.20 - Generated changelog with git-cliff
There was a problem hiding this comment.
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 pushCurrently 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 --tagis 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-Fto 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 editsThe 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 continuesIf 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
directoriesfrom the workspace; addingdirs = "5.0"creates API duplication and extra artifact bloat. Standardize on one crate (recommenddirectories, 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 lineIf you truly need
dirs, removedirectoriesinstead 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_requestcan 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: trueAlso 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.
📒 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 thatrunagent-go/go.moddeclaresmodule github.com/runagent-dev/runagent/runagent-go, andupdate_go_versiononly 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.
| - 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 | ||
|
|
There was a problem hiding this comment.
🛠️ 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
fiCommittable 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.
| local init_file="runagent/__init__.py" | ||
| local success=false | ||
|
|
There was a problem hiding this comment.
🛠️ 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
+ fiOptionally, 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.
Summary by CodeRabbit
New Features
Chores