Skip to content

Conversation

Souvlaki42
Copy link

@Souvlaki42 Souvlaki42 commented May 30, 2025

The title says most of what I have done.

I changed the install script so it fetches the latest version tag directly from GitHub, instead of defaulting to v35, which is now old.

As a bonus, I also changed the script so it says "updating Codecrafters" instead of "installing" if it finds that the INSTALL_DIR is already there.

Just a small little QOL fix, shouldn't conflict with anything you are doing.

Summary by CodeRabbit

  • New Features
    • The installation script now automatically selects the latest available version if no version is specified.
    • Installation messages now clearly indicate whether the action is a fresh install or an update.

Copy link

coderabbitai bot commented May 30, 2025

Walkthrough

The installation script now dynamically retrieves the latest release version from the GitHub API when no version is specified, replacing the previous fixed default. The script also enhances user messaging by distinguishing between a fresh installation and an update, based on the presence of the target binary at the install location.

Changes

File Change Summary
install.sh Changed version selection to fetch latest release from GitHub API; added curl presence check; improved install/update messaging.

Poem

A script that now will check and see,
The latest tag from GitHub’s tree.
No more fixed old version fate—
It fetches fresh, up-to-date!
And with a hop, it lets you know
If it’s install or update—let’s go! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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

Documentation and Community

  • 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
install.sh (2)

37-41: Make the update detection more robust
Using -f only catches regular files. If the existing binary is a symlink or has different file metadata, the script will still advertise a fresh install. Consider using -x (executable) or -e (exists) to more reliably detect an installed CLI.

Example:

-if [ -f "$INSTALL_PATH" ]; then
+if [ -x "$INSTALL_PATH" ]; then
  ACTION="update"
else
  ACTION="install"
fi

Or, to detect any file type:

-if [ -f "$INSTALL_PATH" ]; then
+if [ -e "$INSTALL_PATH" ]; then

43-43: Use the official CLI name in messaging
For consistent branding, refer to the tool as “CodeCrafters CLI” instead of “codecrafters” in the user‐facing message.

- echo "This script will automatically $ACTION codecrafters (${VERSION}) for you."
+ echo "This script will automatically $ACTION the CodeCrafters CLI (${VERSION}) for you."
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a36513 and 113da93.

📒 Files selected for processing (1)
  • install.sh (2 hunks)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
install.sh (2)

11-14: Enable robust failure detection for the version fetch
Since you’re using pipelines (curl | grep | sed) under set -eu, consider adding set -o pipefail (or switching to bash with #!/usr/bin/env bash) so that any intermediate failures (e.g., grep not matching) cause the script to exit instead of silently producing an empty or malformed $VERSION. Example diff:

-#!/bin/sh
+#!/usr/bin/env bash
 set -eu
+set -o pipefail

56-56: Capitalize tool name in user messaging
Minor nit: for consistency with branding, consider capitalizing “Codecrafters” (or “Codecrafters CLI”) in the message:

-echo "This script will automatically $ACTION codecrafters (${VERSION}) for you."
+echo "This script will automatically $ACTION Codecrafters CLI (${VERSION}) for you."
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 113da93 and e67c4b1.

📒 Files selected for processing (1)
  • install.sh (2 hunks)
🔇 Additional comments (3)
install.sh (3)

5-9: Validate presence of curl before API fetch
Good catch adding an early check for curl to avoid cryptic failures. This ensures users get an immediate, clear error if curl is missing.


15-19: Early exit on empty version enhances reliability
The explicit check for an empty $VERSION after fetching the GitHub tag is a solid way to catch API or parsing errors before proceeding.


50-54: Correctly differentiate between install and update
Switching the action based on whether $INSTALL_PATH already exists makes the UX clearer, and the implementation is straightforward and correct.

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