Skip to content

Improve installation scripts and documentation #1843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rnkrtt
Copy link

@rnkrtt rnkrtt commented Jun 26, 2025

  • Enhanced help text in install.sh with better formatting and examples
  • Improved build.sh with better error handling and informative messages
  • Fixed Anchor version in documentation to match actual version in Cargo.toml
  • Updated dependency specifications in Cargo.toml for better flexibility
  • Expanded INSTALL.md with detailed system requirements and troubleshooting guides

Summary by CodeRabbit

  • Documentation

    • Expanded and reorganized installation instructions with detailed system requirements, dependency setup, troubleshooting tips, and post-installation verification steps.
    • Updated Anchor CLI version in setup prerequisites for clarity.
  • Chores

    • Relaxed version constraints for key dependencies to allow for compatible updates.
  • Style

    • Improved user feedback and error messages in build and install scripts for a clearer installation and build process.

Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

Walkthrough

The updates include relaxing version constraints for dependencies in Cargo.toml, significantly expanding and clarifying installation documentation, updating the Anchor CLI version in the README, and enhancing both the build and install scripts with improved error handling, user messages, and clearer usage instructions. No changes were made to exported or public entities.

Changes

File(s) Change Summary
Cargo.toml Relaxed version constraints for anchor-lang and anchor-spl dependencies from exact to compatible 0.31.x.
INSTALL.md Major expansion: added system requirements, detailed dependency installation, component descriptions, troubleshooting, and post-installation checks.
README.md Updated Anchor CLI version in manual setup prerequisites from 0.29.0 to 0.31.1.
scripts/build.sh Improved error handling, user feedback, and command checks; added structured error trapping and informative messages.
scripts/install.sh Expanded and reformatted usage/help output for unknown options; added detailed option descriptions and examples.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant build.sh
    participant install.sh

    User->>build.sh: Run build script
    build.sh->>build.sh: Set error trap (set -e, handle_error)
    build.sh->>build.sh: Check for pnpm/npx
    alt pnpm/npx missing
        build.sh->>User: Prompt to run install.sh
        Note right of build.sh: Exit script
    end
    build.sh->>build.sh: Install dependencies
    alt Dependency install fails
        build.sh->>User: Show error, suggest checking internet/access
        Note right of build.sh: Exit script
    end
    build.sh->>build.sh: Copy spl_noop.so
    build.sh->>build.sh: Start build process
    alt Build fails
        build.sh->>User: Output failure message
    else
        build.sh->>User: Output success message
    end
Loading

Poem

A bunny hops with nimble feet,
Scripts now warn before defeat.
Docs are plump with helpful tips,
Anchor’s version takes new sips.
Install and build, with clearer cheer—
The path ahead is bright and clear!
🐇✨

✨ 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
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 (4)
scripts/install.sh (1)

425-440: Helpful usage banner, but missing stderr redirection & exits with confusing code

  1. Consider printing the usage to stderr so mycmd 2>/dev/null behaves as expected in scripts.
  2. The banner exits with status 1 even for --help style output; exiting with 0 is more conventional when the user only asked for help.
-echo "Unknown option: $1"
+echo "Unknown option: $1" >&2
 ...
-echo "------------------------------------------------"
-exit 1
+echo "------------------------------------------------" >&2
+exit 1

(and add a dedicated --help|-h branch that prints the same banner but exit 0).

INSTALL.md (1)

69-72: Minor punctuation nit

Comma missing before but in a compound sentence.

-If you already have Node.js installed but the script doesn't recognize it, try skipping this component:
+If you already have Node.js installed, but the script doesn't recognize it, try skipping this component:
scripts/build.sh (2)

3-14: Add -u -o pipefail for more robust error propagation

set -e alone misses failures inside pipes and unbound variables. Two-line tweak:

-# Exit on any error
-set -e
+# Strict shell mode
+set -Eeuo pipefail

(-E keeps traps working with -u).


27-38: pnpm install runs every build – use --frozen-lockfile or skip when node_modules exists

Re-installing on every invocation slows local builds. Either:

[ -d node_modules ] || pnpm install --frozen-lockfile

or rely on the lock-file flag alone (CI).

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ef0dd04 and 5a79246.

📒 Files selected for processing (5)
  • Cargo.toml (1 hunks)
  • INSTALL.md (3 hunks)
  • README.md (1 hunks)
  • scripts/build.sh (1 hunks)
  • scripts/install.sh (1 hunks)
🧰 Additional context used
🪛 LanguageTool
INSTALL.md

[uncategorized] ~69-~69: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...*: If you already have Node.js installed but the script doesn't recognize it, try sk...

(COMMA_COMPOUND_SENTENCE_2)

⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: lint
  • GitHub Check: Test program-libs-fast
  • GitHub Check: Test program-libs-slow
  • GitHub Check: Test batched-merkle-tree-simulate
  • GitHub Check: Test sdk-libs
  • GitHub Check: Test concurrent-merkle-tree
  • GitHub Check: stateless-js-v2
  • GitHub Check: cli-v1
  • GitHub Check: test-double-registration
  • GitHub Check: test-2-foresters
  • GitHub Check: test-address-batched
  • GitHub Check: test-state-photon-batched
  • GitHub Check: test-state-batched
  • GitHub Check: test-e2e
  • GitHub Check: stateless-js-v1
  • GitHub Check: cli-v2
🔇 Additional comments (2)
Cargo.toml (1)

112-114: ```shell
#!/usr/bin/env bash
set -e
echo "=== Listing all shell scripts in the repo ==="
fd --type f --extension sh

echo
echo "=== Searching for 'install.sh' references ==="
rg -n 'install.sh' -g '*.sh' || true

echo
echo "=== Searching for a VERSIONS array in shell scripts ==="
rg -n 'VERSIONS' -A3 -B3 -g '*.sh' || true

echo
echo "=== Searching for pinned anchor versions in shell scripts ==="
rg -n 'anchor-v[0-9]' -A2 -B2 -g '*.sh' || true


</details>
<details>
<summary>README.md (1)</summary>

`139-140`: **README is already updated – double-check installation script**

Good catch updating the docs to 0.31.1.  
After merging the previous comment’s fix in `install.sh`, the documentation and tooling will be in sync.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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

Successfully merging this pull request may close these issues.

2 participants