Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "dev",
"image": "mcr.microsoft.com/devcontainers/base:debian",
"customizations": {
"vscode": {
"extensions": [
"StarkWare.cairo1",
"tamasfe.even-better-toml",
"rust-lang.rust-analyzer"
]
}
},
"features": {
"ghcr.io/devcontainers/features/rust:1": {
"version": "stable"
}
},
"postCreateCommand": "bash .devcontainer/install-tools.sh",
"remoteUser": "vscode"
}
30 changes: 30 additions & 0 deletions .devcontainer/install-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
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

Harden shell options

Prefer strict mode to surface errors early.

-set -e
+set -euo pipefail
+IFS=$'\n\t'
🤖 Prompt for AI Agents
In .devcontainer/install-tools.sh around line 2, the script currently uses only
"set -e" which is not strict enough; replace it with a stricter shell mode by
changing to "set -euo pipefail" and add a safe IFS like "IFS=$'\n\t'" directly
after that (and ensure this is placed near the top of the script, after any
shebang) so undefined variables, pipeline failures, and word-splitting are
handled robustly.


echo "🚀 Setting up development environment..."

# Install dependencies
apt-get update && apt-get install -y curl git build-essential
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

Apt commands will fail under non-root remoteUser

postCreateCommand runs as the “vscode” user; calling apt-get without sudo will fail. Use sudo and noninteractive flags.

-apt-get update && apt-get install -y curl git build-essential
+sudo apt-get update -y
+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git build-essential

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
.devcontainer/install-tools.sh around line 7: the apt commands run as the
non-root "vscode" user in postCreateCommand and will fail; update the line to
call sudo for apt-get update and sudo with a noninteractive frontend and flags
for install (e.g., DEBIAN_FRONTEND=noninteractive and -y/--no-install-recommends
or -qq) so the install runs successfully without prompting and with elevated
privileges.



# Install asdf
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

Comment on lines +11 to +15
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

Make asdf install idempotent and avoid .bashrc duplication

Guard clone, avoid appending duplicate lines, and quiet ShellCheck for sourcing.

-# Install asdf
-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
+# Install asdf (idempotent)
+if [ ! -d "$HOME/.asdf" ]; then
+  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 disable=SC1090
+. "$HOME/.asdf/asdf.sh"
📝 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
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
# Install asdf (idempotent)
if [ ! -d "$HOME/.asdf" ]; then
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 disable=SC1090
. "$HOME/.asdf/asdf.sh"
🧰 Tools
🪛 Shellcheck (0.10.0)

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

(SC1090)

🤖 Prompt for AI Agents
In .devcontainer/install-tools.sh around lines 11–15, make the asdf setup
idempotent by only cloning if ~/.asdf doesn't already exist, avoid appending
duplicate lines to ~/.bashrc by checking for each line before adding it, and
silence ShellCheck warnings for sourcing by adding a shellcheck disable comment
just before the source line; implement these checks (e.g., test -d ~/.asdf to
skip git clone, use grep -Fxq to conditionally append each echo line) and add a
"# shellcheck disable=SC1090,SC1091" comment immediately above the ".
~/.asdf/asdf.sh" source invocation.

# Add and install plugins
asdf plugin add scarb || true
asdf install scarb 2.10.1
asdf global scarb 2.10.1

asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true
asdf install dojo 1.5.0
asdf global dojo 1.5.0

asdf plugin add starknet-foundry || true
asdf install starknet-foundry 0.35.0
asdf global starknet-foundry 0.35.0
Comment on lines +17 to +27
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

Avoid masking real failures with || true; check/add plugins explicitly

Fail fast if a plugin is unavailable, and keep installs DRY with variables.

-# Add and install plugins
-asdf plugin add scarb || true
-asdf install scarb 2.10.1
-asdf global scarb 2.10.1
-
-asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true
-asdf install dojo 1.5.0
-asdf global dojo 1.5.0
-
-asdf plugin add starknet-foundry || true
-asdf install starknet-foundry 0.35.0
-asdf global starknet-foundry 0.35.0
+# Add and install plugins
+SCARB_VERSION=2.10.1
+DOJO_VERSION=1.5.0
+SNF_VERSION=0.35.0
+
+ensure_plugin() {
+  local name="$1"; shift
+  if ! asdf plugin list | grep -qx "$name"; then
+    asdf plugin add "$name" "$@"
+  fi
+}
+
+ensure_plugin scarb
+asdf install scarb "${SCARB_VERSION}"
+asdf global scarb "${SCARB_VERSION}"
+
+ensure_plugin dojo https://github.com/dojoengine/asdf-dojo
+asdf install dojo "${DOJO_VERSION}"
+asdf global dojo "${DOJO_VERSION}"
+
+ensure_plugin starknet-foundry
+asdf install starknet-foundry "${SNF_VERSION}"
+asdf global starknet-foundry "${SNF_VERSION}"
+
+asdf reshim
📝 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
asdf plugin add scarb || true
asdf install scarb 2.10.1
asdf global scarb 2.10.1
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true
asdf install dojo 1.5.0
asdf global dojo 1.5.0
asdf plugin add starknet-foundry || true
asdf install starknet-foundry 0.35.0
asdf global starknet-foundry 0.35.0
# Add and install plugins
SCARB_VERSION=2.10.1
DOJO_VERSION=1.5.0
SNF_VERSION=0.35.0
ensure_plugin() {
local name="$1"; shift
if ! asdf plugin list | grep -qx "$name"; then
asdf plugin add "$name" "$@"
fi
}
ensure_plugin scarb
asdf install scarb "${SCARB_VERSION}"
asdf global scarb "${SCARB_VERSION}"
ensure_plugin dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo "${DOJO_VERSION}"
asdf global dojo "${DOJO_VERSION}"
ensure_plugin starknet-foundry
asdf install starknet-foundry "${SNF_VERSION}"
asdf global starknet-foundry "${SNF_VERSION}"
asdf reshim
🤖 Prompt for AI Agents
.devcontainer/install-tools.sh lines 17-27: the script masks plugin-add failures
with "|| true", repeats installs, and hardcodes versions; change to explicitly
check for and add each plugin (e.g., use "asdf plugin-list" to detect presence
and run "asdf plugin add" only when missing), remove "|| true" so failures
surface and cause exit, capture and reuse version numbers in variables to avoid
repetition, and run "asdf install" then "asdf global" for each tool while
checking their exit codes and exiting fast on error.



echo "✅ Environment ready!"
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,28 @@ Once you're ready:
- A detailed explanation of your changes.
- References to related issues (if applicable).

## 🐳 DevContainer Setup (Docker)

We provide a **Docker DevContainer** to simplify development and avoid local dependency issues.

### Prerequisites
- [Docker](https://docs.docker.com/get-docker/) installed and running
- [Visual Studio Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

### Setup
1. Open the project in **VS Code**.
2. Press **CTRL + SHIFT + P** → select **“Dev Containers: Reopen in Container”**.
3. The container will build and install all required tools automatically.

### Verify
Inside the container, run:

```bash
sozo build
sozo test
scarb fmt --check
```

## Maintainers

<table> <tr> <td align="center"> <img src="Maintainers/Josue.png" width="100px;" alt="Mantenedor: Josué"/> <br /> <a href="https://t.me/Josue1908Cr">Josué</a> <br /> </td> <td align="center"> <img src="Maintainers/Kevin.jpeg" width="100px;" alt="Mantenedor: Kevin"/> <br /> <a href="https://t.me/kevinnzx213">Kevin</a> <br /> </td> </tr> </table> ```
Expand Down
Loading