-
Notifications
You must be signed in to change notification settings - Fork 44
build: script to configure environments for ai coding agents #2845
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
Conversation
WalkthroughA new Ubuntu 24.04 setup script is introduced that comprehensively configures build dependencies including system packages, Node.js, Rust, protobuf, and WASM tooling. Documentation in AGENTS.md references this script under the Dependencies section. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Script as setup-ai-agent-environment.sh
participant System as System/OS
participant APT as APT/Package Manager
participant Tools as Build Tools<br/>(Node, Rust, etc.)
User->>Script: Execute setup script
Script->>System: Validate Ubuntu 24.04
alt OS validation fails
Script-->>User: Exit with error
end
Script->>Script: Determine sudo availability
Script->>APT: Update APT metadata
Script->>APT: Install system dependencies
APT-->>Script: Installation complete
rect rgb(200, 220, 255)
Note over Script,Tools: Install Build Toolchains
Script->>Tools: Ensure Node.js 20+
Script->>Tools: Enable Corepack for Yarn
Script->>Tools: Install/update Rust toolchain
Script->>Tools: Install protobuf compiler
Script->>Tools: Install WASM tooling
end
Script->>System: Configure Docker group (if needed)
Script-->>User: Output completion guidance<br/>(restart shell, run setup)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
@copilot please test this PR. |
There was a problem hiding this 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)
scripts/setup-ai-agent-environment.sh (2)
122-149: Rust toolchain installation is robust but could improve parsing.The function reads the rust-toolchain.toml and correctly installs components and targets. However, the grep/awk parsing at line 124 is somewhat fragile—if the TOML format deviates slightly, it could fail silently. Consider adding a fallback or validation.
A more robust parsing approach for rust-toolchain.toml:
install_rust_toolchain() { local toolchain # More defensive TOML parsing toolchain=$(grep -m 1 '^\s*channel\s*=' "${REPO_ROOT}/rust-toolchain.toml" | sed 's/.*=\s*"\?\([^"]*\)\"\?.*/\1/' | tr -d ' ' || true) if [[ -z "${toolchain}" ]]; then warn "Unable to determine toolchain from rust-toolchain.toml; defaulting to stable." toolchain="stable" fi # ... rest of functionThis adds support for optional spaces and different quote styles while remaining shell-portable.
201-219: Cargo tools installation should pin wasm-pack version.The script correctly pins wasm-bindgen-cli to v0.2.103, which is good practice. However, wasm-pack at line 213 installs without an explicit version constraint, which reduces reproducibility and predictability.
Pin wasm-pack to a specific version for reproducibility:
install_cargo_tools() { local wasm_bindgen_version="0.2.103" local wasm_pack_version="1.3.4" # Or appropriate version if ! command -v wasm-bindgen >/dev/null 2>&1 || [[ "$(wasm-bindgen --version | awk '{print $2}')" != "${wasm_bindgen_version}" ]]; then log "Installing wasm-bindgen-cli ${wasm_bindgen_version}" cargo install --locked "wasm-bindgen-cli@${wasm_bindgen_version}" else log "wasm-bindgen-cli ${wasm_bindgen_version} already installed." fi if ! command -v wasm-pack >/dev/null 2>&1 || [[ "$(wasm-pack --version | awk '{print $2}')" != "${wasm_pack_version}" ]]; then log "Installing wasm-pack ${wasm_pack_version}" cargo install --locked "wasm-pack@${wasm_pack_version}" else log "wasm-pack ${wasm_pack_version} already installed." fi }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
AGENTS.md(1 hunks)scripts/setup-ai-agent-environment.sh(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/**
📄 CodeRabbit inference engine (AGENTS.md)
Place automation and helper scripts in scripts/
Files:
scripts/setup-ai-agent-environment.sh
🧠 Learnings (1)
📓 Common learnings
Learnt from: shumkov
Repo: dashpay/platform PR: 2346
File: .github/workflows/release-docker-image.yml:0-0
Timestamp: 2024-11-22T12:53:36.084Z
Learning: As of November 2024, `ubuntu-24.04` and `macos-14` runners are available for use in GitHub Actions workflows.
⏰ 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 JS packages / Build JS
🔇 Additional comments (7)
scripts/setup-ai-agent-environment.sh (6)
1-47: Header, utilities, and environment setup look good.The script establishes a solid foundation with strict bash options (
set -euo pipefail), proper logging utilities, and clean path derivation. OS version detection appropriately warns on mismatch, and sudo detection is well-structured.
49-78: Comprehensive system dependency installation.The APT update and dependency list are thorough and appropriate for the build environment. No concerns here.
80-94: Node.js version detection and installation logic is sound.The version parsing correctly extracts the major version, and the conditional installation logic handles both fresh installs and version upgrades properly. The NodeSource setup is a standard practice.
96-120: Corepack enablement handles user context thoughtfully.The function defensively retrieves user home and handles both sudo and non-sudo scenarios. Warnings on failure are appropriate rather than hard errors.
221-239: Docker group configuration is defensive and well-handled.The script checks Docker availability, verifies group membership, and provides appropriate guidance. The warning message is helpful.
240-243: Final guidance messages are clear and actionable.The script provides concise next steps for the user, including shell restart and repository setup.
AGENTS.md (1)
10-10: Documentation reference is clear and well-placed.The addition of the setup script reference under Dependencies is straightforward and helpful.
|
Don't we have already dev container ? |
We do; however, codex doesn't support using non-standard docker image at this point, it only allows using some script. |
Issue being fixed or feature implemented
Github Copilot and OpenAI Codex cannot build the platform due to lack of proper
dependencies (eg. wrong version of protoc compiler).
What was done?
Added a script to install dependencies on Ubuntu.
How Has This Been Tested?
TODO.
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit