Skip to content

Conversation

@CLHatch
Copy link
Contributor

@CLHatch CLHatch commented Jul 11, 2025

run_script 'ds-version' was failing on fresh install because the .scripts folder wasn't there yet. Moved the function to main.sh to fix that. Did the same for ds_update_available.

Pull request

Purpose
Describe the problem or feature in addition to a link to the issues.

Approach
How does this change address the problem?

Open Questions and Pre-Merge TODOs
Check all boxes as they are completed

  • Use github checklists. When solved, check the box and explain the answer.

Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem

Requirements
Check all boxes as they are completed

Summary by Sourcery

Move ds_version and ds_update_available functions into main.sh, remove their standalone scripts, and update invocations to call the functions directly.

Bug Fixes:

  • Prevent ds-version and ds-update-available from failing on fresh installs when the .scripts folder is missing

Enhancements:

  • Relocate ds_version and ds_update_available into main.sh and delete their external script files
  • .Update all run_script calls to invoke the new functions directly instead of via run_script

`run_script 'ds-version'` was failing on fresh install because the `.scripts` folder wasn't there yet.  Moved the function to `main.sh` to fix that.  Did the same for `ds_update_available`.
@CLHatch CLHatch requested a review from a team as a code owner July 11, 2025 01:27
@github-actions github-actions bot added the core Automatic label label Jul 11, 2025
@CLHatch CLHatch merged commit 9b77088 into master Jul 11, 2025
17 of 19 checks passed
@CLHatch CLHatch deleted the Updates branch July 11, 2025 01:27
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 11, 2025

Reviewer's Guide

Migrated the ds_version and ds_update_available helper functions into main.sh to ensure they are available before the .scripts folder exists, updated all invocations to call these functions directly, and removed the now-obsolete external script files.

Class diagram for refactored helper functions in main.sh

classDiagram
    class main.sh {
        +ds_version() string
        +ds_update_available() bool
    }

    %% The helper functions are now part of main.sh and are no longer in separate script files.
Loading

File-Level Changes

Change Details Files
Relocate version and update-check functions into main.sh
  • Added ds_version function with git branch and tag resolution
  • Added ds_update_available function comparing HEAD to upstream
  • Ensured both functions use SCRIPTPATH and handle errors gracefully
main.sh
Refactor calls to version and update-check to direct invocation
  • Replaced run_script 'ds_version' with direct ds_version call in APPLICATION_VERSION
  • Replaced run_script 'ds_update_available' with ds_update_available in usage, dialog, and main flows
  • Updated update_self.sh to invoke ds_update_available instead of run_script
main.sh
.scripts/update_self.sh
Remove redundant external script files
  • Deleted ds_version.sh from .scripts directory
  • Deleted ds_update_available.sh from .scripts directory
.scripts/ds_version.sh
.scripts/ds_update_available.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @CLHatch - I've reviewed your changes - here's some feedback:

  • Consider caching the results of ds_update_available and ds_version to avoid repeated git fetch calls during a single run.
  • You could extract the pushd/popd+error‐handling pattern into a small helper function to reduce duplication and improve readability.
  • Make sure to handle cases where there’s no upstream branch set, since git rev-parse '@{u}' will error out in those scenarios.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider caching the results of ds_update_available and ds_version to avoid repeated git fetch calls during a single run.
- You could extract the pushd/popd+error‐handling pattern into a small helper function to reduce duplication and improve readability.
- Make sure to handle cases where there’s no upstream branch set, since git rev-parse '@{u}' will error out in those scenarios.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Automatic label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants