Skip to content

Conversation

@ascandone
Copy link
Contributor

@ascandone ascandone commented Jul 10, 2025

I changed the following:

  1. moved internal/numscript/numscript.go (the main file) to cmd/numscript/main.go , so that it can be installed with go install
  2. added an install.sh that fetches the last released version and installs it
  3. updated the readme accordingly

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

Walkthrough

This update introduces a new install.sh script to automate the installation of the numscript CLI and revises the README. The README's installation instructions are updated to include both the new curl-based script and the Go toolchain method, replacing the previous "Build locally" section.

Changes

File(s) Change Summary
README.md Replaces "Build locally" with "Installation"; adds curl-based install and updates Go install.
install.sh Adds a shell script that automates OS/arch detection, download, extraction, and installation.

Suggested reviewers

  • gfyrag

Poem

From burrows deep, a script appears,
To fetch and place your tools with cheers!
No more to build or hunt or seek,
Just curl and run—installation’s sleek.
With paws and code, the work is done,
Numscript’s journey has begun!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch numscript-cli-installer

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 auto-generate unit tests to generate unit tests for 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.

@ascandone ascandone force-pushed the numscript-cli-installer branch from 09b53ea to e5c1b23 Compare July 10, 2025 18:44
@codecov
Copy link

codecov bot commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.28%. Comparing base (93fb5d8) to head (5686c91).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
- Coverage   72.47%   72.28%   -0.20%     
==========================================
  Files          36       37       +1     
  Lines        4080     4091      +11     
==========================================
  Hits         2957     2957              
- Misses        995     1006      +11     
  Partials      128      128              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@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: 4

🧹 Nitpick comments (2)
README.md (1)

20-24: Heading level & sub-headings violate Markdown lint, use proper h2/h3 hierarchy

### Installation jumps from the top-level # directly to h3, and the subsequent Using … lines abuse emphasis in place of headings.
Switch to an h2 followed by h3 sub-headings to satisfy MD001 / MD036 and improve readability.

-### Installation
-
-You can install the `numscript` cli with one of the following ways:
-
-**Using curl**
+## Installation
+
+You can install the `numscript` CLI using one of the following methods:
+
+### Using curl
install.sh (1)

6-23: Add set -u and trap for safer bash script

set -e alone doesn’t guard against unset vars and makes debugging harder.
Recommend:

-set -e
+set -euo pipefail
+trap 'echo "❌ Installation failed"; exit 1' ERR
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 02e1423 and e5c1b23.

⛔ Files ignored due to path filters (1)
  • .goreleaser.yaml is excluded by !**/*.yaml
📒 Files selected for processing (2)
  • README.md (1 hunks)
  • install.sh (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

20-20: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


24-24: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


30-30: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

@ascandone ascandone requested review from Dav-14 and flemzord July 10, 2025 18:47
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@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: 2

♻️ Duplicate comments (1)
install.sh (1)

42-43: Asset name still contains an extra dot – download will 404
The FILENAME pattern wasn’t fixed; the unwanted dot after numscript_ remains, so the generated URL does not match the published assets.

-FILENAME="numscript_.${LATEST_TAG#v}_${PLATFORM}_${ARCH}.${EXT}"
+FILENAME="numscript_${LATEST_TAG#v}_${PLATFORM}_${ARCH}.${EXT}"
🧹 Nitpick comments (2)
install.sh (2)

1-3: Harden script with set -euo pipefail
Enabling -u and -o pipefail prevents silent failures due to unset vars or broken pipes.

-set -e
+set -euo pipefail

30-32: Tag detection via redirect is brittle
Parsing the Location header can break if GitHub changes its redirect format or adds query params. The releases API is more stable:

LATEST_TAG=$(curl -s https://api.github.com/repos/formancehq/numscript/releases/latest | jq -r .tag_name)

Requires jq, but greatly increases reliability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e5c1b23 and 28ebec8.

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

Comment on lines +58 to +63
INSTALL_PATH="$HOME/.local/bin"
mkdir -p "$INSTALL_PATH"

mv "$BIN" "$INSTALL_PATH"
chmod +x "$INSTALL_PATH/$BIN"

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Installation path & chmod are not Windows-friendly
For the Windows branch the script:

  1. Installs to $HOME/.local/bin, a Unix-style path that is rarely on PATH in Git-Bash/PowerShell.
  2. Runs chmod, which is a no-op (or errors) on native Windows.

Consider computing a platform-specific default such as:

if [ "$PLATFORM" = "Windows" ]; then
    INSTALL_PATH="$USERPROFILE/bin"
    mkdir -p "$INSTALL_PATH"
    mv "$BIN" "$INSTALL_PATH"
else
    INSTALL_PATH="$HOME/.local/bin"
    mkdir -p "$INSTALL_PATH"
    mv "$BIN" "$INSTALL_PATH"
    chmod +x "$INSTALL_PATH/$BIN"
fi
🤖 Prompt for AI Agents
In install.sh around lines 58 to 63, the script uses a Unix-style installation
path and runs chmod, which are not appropriate for Windows. Modify the script to
detect if PLATFORM is Windows; if so, set INSTALL_PATH to "$USERPROFILE/bin",
create the directory, and move the binary there without running chmod. For other
platforms, keep the existing behavior of installing to "$HOME/.local/bin",
creating the directory, moving the binary, and running chmod to make it
executable.

Comment on lines +53 to +55
tar -xf "$FILENAME" numscript
BIN="numscript"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Extraction will fail: missing -z flag for .tar.gz archives
tar -xf cannot decompress gzip streams; the command will exit with “gzip: stdin: not in gzip format”.

-    tar -xf "$FILENAME" numscript
+    tar -xzf "$FILENAME" numscript
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tar -xf "$FILENAME" numscript
BIN="numscript"
fi
tar -xzf "$FILENAME" numscript
BIN="numscript"
fi
🤖 Prompt for AI Agents
In install.sh around lines 53 to 55, the tar extraction command is missing the
-z flag needed for decompressing .tar.gz files. Update the tar command to
include the -z option (tar -xzf) to properly handle gzip compressed archives and
avoid extraction errors.

cursor[bot]

This comment was marked as outdated.

@ascandone ascandone requested a review from gfyrag July 14, 2025 09:32
fi

# Build file name and URL
FILENAME="numscript_.${LATEST_TAG#v}_${PLATFORM}_${ARCH}.${EXT}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the dot normal?

@ascandone ascandone force-pushed the numscript-cli-installer branch from 66b05b9 to 5686c91 Compare July 15, 2025 13:17
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Script Filename Error Causes Download Failures

The install.sh script fails to download release assets due to an incorrect filename construction. The script's generated filename (line 42) has two issues: it includes an extra dot after numscript_ and incorrectly strips the 'v' prefix from the version tag. This mismatch with Goreleaser's asset naming convention causes download attempts to fail with a 404 error.

install.sh#L41-L42

numscript/install.sh

Lines 41 to 42 in 5686c91

# Build file name and URL
FILENAME="numscript_.${LATEST_TAG#v}_${PLATFORM}_${ARCH}.${EXT}"

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Contributor

@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 (3)
README.md (3)

20-21: Fix Markdown heading level – use ## instead of ###

The document jumps from # to ###, violating MD001 and harming screen-reader outline.

-### Installation
+## Installation

24-34: Promote bold labels to proper sub-headings

Use heading syntax for the two installation methods; this improves navigation and satisfies MD036.

-**Using curl**
+### Using curl-**Using golang toolchain**
+### Using Go toolchain

27-27: Consider pinning the install script to a tag for reproducibility

Pulling from main means an arbitrary future commit is executed with bash.
Pointing to a versioned tag (e.g., v0.0.18) or asking users to review the script first would reduce supply-chain risk.

No change required if you accept the trade-off, but worth documenting.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 28ebec8 and 5686c91.

⛔ Files ignored due to path filters (1)
  • .goreleaser.yaml is excluded by !**/*.yaml
📒 Files selected for processing (2)
  • README.md (1 hunks)
  • install.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • install.sh
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ascandone
PR: formancehq/numscript#72
File: install.sh:28-44
Timestamp: 2025-07-11T08:02:26.428Z
Learning: In the formancehq/numscript repository, release assets are named with an extra dot after the underscore, following the pattern "numscript_.{version}_{platform}_{arch}.{ext}" (e.g., "numscript_.0.0.18_Darwin_arm64.tar.gz"), not "numscript_{version}_{platform}_{arch}.{ext}".
README.md (2)
Learnt from: ascandone
PR: formancehq/numscript#72
File: install.sh:28-44
Timestamp: 2025-07-11T08:02:26.428Z
Learning: In the formancehq/numscript repository, release assets are named with an extra dot after the underscore, following the pattern "numscript_.{version}_{platform}_{arch}.{ext}" (e.g., "numscript_.0.0.18_Darwin_arm64.tar.gz"), not "numscript_{version}_{platform}_{arch}.{ext}".
Learnt from: ascandone
PR: formancehq/numscript#40
File: internal/lsp/codeactions_test.go:177-189
Timestamp: 2025-03-07T12:40:05.628Z
Learning: When reviewing code, focus on substantive issues related to core functionality rather than minor details in test utilities. For ascandone specifically, avoid nitpicky comments about testing utilities.
🪛 markdownlint-cli2 (0.17.2)
README.md

20-20: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


24-24: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


30-30: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Cursor BugBot
  • GitHub Check: Tests
  • GitHub Check: Dirty

@ascandone ascandone changed the title Updated install instruction docs: update install instructions Jul 15, 2025
@ascandone ascandone merged commit 90ba9a4 into main Jul 15, 2025
7 of 9 checks passed
@ascandone ascandone deleted the numscript-cli-installer branch July 15, 2025 13:52
ascandone added a commit that referenced this pull request Aug 26, 2025
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.

3 participants