Skip to content

Conversation

@ryzen-xp
Copy link
Contributor

@ryzen-xp ryzen-xp commented Sep 6, 2025

Close #___

Summary by CodeRabbit

  • Chores
    • Added a preconfigured development container for consistent local environments, including Rust support and relevant editor extensions.
    • Introduced an automated setup script that installs required system packages, configures asdf, and pins tooling versions (e.g., Scarb, Dojo, Starknet Foundry).
    • Automatically initializes tools on container creation for faster onboarding and reproducible builds.
    • Improves developer experience with streamlined setup and standardized configurations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 6, 2025

Walkthrough

Adds a development container configuration and a post-create bootstrap script. The dev container installs Rust and VS Code extensions, then runs a shell script that installs prerequisites, sets up asdf, and installs pinned versions of scarb, dojo, and starknet-foundry.

Changes

Cohort / File(s) Summary
Devcontainer configuration
.devcontainer.json
New Debian-based devcontainer named "dev" with Rust feature (stable), VS Code extensions, remoteUser set to vscode, and a postCreateCommand executing .devcontainer/install-tools.sh.
Bootstrap script
.devcontainer/install-tools.sh
New setup script: installs apt packages (curl, git, build-essential), installs/configures asdf v0.14.0, adds plugins (scarb, dojo from custom repo, starknet-foundry), installs pinned versions (2.10.1/1.5.0/0.35.0), sets globals, prints status banners.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant VS as VS Code Dev Containers
    participant DC as Devcontainer (Docker)
    participant PC as postCreateCommand
    participant SH as install-tools.sh
    participant APT as apt-get
    participant AS as asdf
    participant PG as asdf plugins

    VS->>DC: Build & start container (Debian + Rust feature)
    DC-->>VS: Container ready (remoteUser=vscode)
    VS->>PC: Run postCreateCommand
    PC->>SH: bash .devcontainer/install-tools.sh
    SH->>APT: Install curl, git, build-essential
    SH->>AS: Install asdf v0.14.0 & source shell init
    SH->>PG: asdf plugin-add scarb (tolerant)
    SH->>PG: asdf plugin-add dojo (custom repo, tolerant)
    SH->>PG: asdf plugin-add starknet-foundry
    SH->>AS: asdf install/set-global pinned versions
    SH-->>VS: ✅ Environment ready
    note over SH,VS: Script uses set -e with tolerant plugin-add (|| true)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

Poem

I burrowed a box where the dev tools grow,
With Rusty carrots in tidy rows.
asdf sprouts, three plugins in line,
Scarb, Dojo, Foundry—versions fine.
Tap-tap, my paws: “env is set!”
Now hop to code—our best one yet. 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (8)
.devcontainer/install-tools.sh (6)

2-2: Harden shell options.

Enable undefined-var and pipefail for safer bootstraps.

-set -e
+set -euo pipefail

10-13: Make asdf setup idempotent and address ShellCheck SC1090.

Guard clone, avoid duplicate bashrc lines, and annotate the dynamic source for ShellCheck.

-git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
-echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
-echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
-. ~/.asdf/asdf.sh
+if [ -d "$HOME/.asdf" ]; then
+  git -C "$HOME/.asdf" fetch --tags && git -C "$HOME/.asdf" checkout "v0.14.0"
+else
+  git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf" --branch v0.14.0
+fi
+grep -qxF '. "$HOME/.asdf/asdf.sh"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/asdf.sh"' >> "$HOME/.bashrc"
+grep -qxF '. "$HOME/.asdf/completions/asdf.bash"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/completions/asdf.bash"' >> "$HOME/.bashrc"
+# shellcheck source=/home/vscode/.asdf/asdf.sh
+. "$HOME/.asdf/asdf.sh"

16-26: Avoid masking plugin-add failures; make plugin management idempotent.

Using || true can hide real errors. Check for existing plugins and add/update accordingly.

-asdf plugin add scarb || true
+if ! asdf plugin list | grep -qx 'scarb'; then asdf plugin add scarb; fi
 asdf install scarb 2.10.1
 asdf global scarb 2.10.1

-asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true
+if ! asdf plugin list | grep -qx 'dojo'; then
+  asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
+fi
 asdf install dojo 1.5.0
 asdf global dojo 1.5.0

-asdf plugin add starknet-foundry || true
+if ! asdf plugin list | grep -qx 'starknet-foundry'; then asdf plugin add starknet-foundry; fi
 asdf install starknet-foundry 0.35.0
 asdf global starknet-foundry 0.35.0

16-26: Optional: factor versions into variables for easier bumps.

Minor QoL improvement for maintainability.

+# Versions
+SCARB_VERSION=2.10.1
+DOJO_VERSION=1.5.0
+FOUNDRY_VERSION=0.35.0
-asdf install scarb 2.10.1
-asdf global scarb 2.10.1
+asdf install scarb "$SCARB_VERSION"
+asdf global scarb "$SCARB_VERSION"
- asdf install dojo 1.5.0
- asdf global dojo 1.5.0
+asdf install dojo "$DOJO_VERSION"
+asdf global dojo "$DOJO_VERSION"
- asdf install starknet-foundry 0.35.0
- asdf global starknet-foundry 0.35.0
+asdf install starknet-foundry "$FOUNDRY_VERSION"
+asdf global starknet-foundry "$FOUNDRY_VERSION"

13-13: Silence ShellCheck SC1090 correctly.

You already source a non-constant path; the directive above will prevent false positives. If you prefer not to pin the absolute path, you can disable the rule locally.

-. ~/.asdf/asdf.sh
+# shellcheck disable=SC1090
+. "$HOME/.asdf/asdf.sh"

16-26: Consider adding asdf reshim after installs.

Some plugins don’t auto-reshim; adding explicit asdf reshim avoids PATH surprises.

 asdf global starknet-foundry 0.35.0
+
+asdf reshim
.devcontainer.json (2)

3-3: Pin base image more tightly to reduce drift.

Optional: switch to a specific Debian variant tag (e.g., bookworm) or digest to make environments reproducible.

-"image": "mcr.microsoft.com/devcontainers/base:debian",
+"image": "mcr.microsoft.com/devcontainers/base:debian-bookworm",

13-17: Leverage features for common utilities instead of apt in script.

You can avoid manual apt-get by adding common-utils (includes git, curl, sudo) and keep installs declarative.

   "features": {
+    "ghcr.io/devcontainers/features/common-utils:2": {},
     "ghcr.io/devcontainers/features/rust:1": {
       "version": "stable"
     }
   },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85409da and e983f68.

📒 Files selected for processing (2)
  • .devcontainer.json (1 hunks)
  • .devcontainer/install-tools.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/install-tools.sh

[warning] 13-13: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

⏰ 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). (1)
  • GitHub Check: build-and-test
🔇 Additional comments (2)
.devcontainer.json (2)

18-19: postCreateCommand runs as "vscode"; ensure bootstrap uses sudo.

Given "remoteUser": "vscode", your install script must prefix apt-get with sudo (or move package installs to features). This ties to the fix suggested in install-tools.sh.


6-10: Extensions LGTM.

Good coverage for Cairo/TOML/Rust.

@ryzen-xp ryzen-xp marked this pull request as draft September 6, 2025 15:45
@ryzen-xp ryzen-xp marked this pull request as ready for review September 7, 2025 05:00
@ryzen-xp ryzen-xp closed this by deleting the head repository Sep 7, 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.

1 participant