Skip to content

feat(install): rename old manual binaries to .bak after Homebrew install#8

Merged
AnnatarHe merged 1 commit intomainfrom
feat/prefer-homebrew
Apr 12, 2026
Merged

feat(install): rename old manual binaries to .bak after Homebrew install#8
AnnatarHe merged 1 commit intomainfrom
feat/prefer-homebrew

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

@AnnatarHe AnnatarHe commented Apr 12, 2026

When migrating from manual install to Homebrew, rename existing ~/.shelltime/bin/shelltime and shelltime-daemon with .bak suffix so the shell resolves to the Homebrew-managed version instead.


Open with Devin

When migrating from manual install to Homebrew, rename existing
~/.shelltime/bin/shelltime and shelltime-daemon with .bak suffix so
the shell resolves to the Homebrew-managed version instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AnnatarHe AnnatarHe merged commit c5776cb into main Apr 12, 2026
2 of 7 checks passed
@AnnatarHe AnnatarHe deleted the feat/prefer-homebrew branch April 12, 2026 17:58
@claude
Copy link
Copy Markdown

claude Bot commented Apr 12, 2026

PR Review: feat(install): rename old manual binaries to .bak after Homebrew install

Overall, this is a well-targeted fix for a real migration problem. The approach is straightforward and the implementation is mostly solid. A few items worth considering.


No error handling on mv

If mv fails (e.g., permission error, read-only filesystem, disk full), the script silently continues and a subsequent shell session would still resolve to the old manual binary. Consider checking the exit code:

if [ -f "$HOME/.shelltime/bin/shelltime" ]; then
    if mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"; then
        echo "Renamed shelltime to shelltime.bak (now using Homebrew version)"
    else
        echo "Warning: Failed to rename shelltime -- old binary may shadow the Homebrew version"
    fi
fi

Idempotency

Re-running after a successful Homebrew install is safe — the [ -f ... ] check prevents double-renaming. However, if a prior shelltime.bak already exists from an earlier run, mv will silently overwrite it. This is unlikely to matter in practice but worth being aware of.


User clarity

The .bak files in ~/.shelltime/bin/ will persist indefinitely. Users may find them confusing and wonder if they are safe to delete. Consider noting them in the completion output or adding a cleanup step on subsequent install runs.


Observation: shelltime-daemon consistency

Worth noting for context: the manual install path (lines 145–150) already installs the daemon binary as shelltime-daemon.bak rather than shelltime-daemon. This PR mirrors that pattern in the Homebrew path, making both paths consistent in their treatment of the daemon. That consistency is good.


Summary

Area Assessment
Code quality Good — follows existing script style
Error handling Needs improvement on mv failure
Security No concerns
Logic / correctness Correct for the happy path
Test coverage macOS Homebrew path not exercised by CI (pre-existing gap)

The change is small, purposeful, and addresses a real user pain point. Adding error handling on the mv calls is the main actionable improvement.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the installation script to rename existing manual-install binaries to backup files upon a successful Homebrew installation. The review feedback suggests using the force flag with the move command to prevent interactive prompts and recommends verifying the success of the move operation before printing confirmation messages.

Comment thread install.bash
Comment on lines +29 to +30
mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"
echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use mv -f to ensure the command does not prompt for confirmation (e.g., if the user has an alias like mv -i) and wrap it in an if block to only print the success message if the operation actually succeeds.

Suggested change
mv "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"
echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)"
if mv -f "$HOME/.shelltime/bin/shelltime" "$HOME/.shelltime/bin/shelltime.bak"; then
echo "Renamed ~/.shelltime/bin/shelltime to shelltime.bak (now using Homebrew version)"
fi

Comment thread install.bash
Comment on lines +33 to +34
mv "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak"
echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use mv -f to avoid interactive prompts and only print the success message if the command succeeds.

Suggested change
mv "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak"
echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)"
if mv -f "$HOME/.shelltime/bin/shelltime-daemon" "$HOME/.shelltime/bin/shelltime-daemon.bak"; then
echo "Renamed ~/.shelltime/bin/shelltime-daemon to shelltime-daemon.bak (now using Homebrew version)"
fi

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.

1 participant