fix(scripts): install-d2 uses macos asset name for darwin#632
Conversation
Starting with d2 v0.7.x, upstream GitHub releases renamed the macOS asset from darwin-* to macos-*, causing 404 errors on pnpm install:d2. This fix updates the OS mapping in install-d2.sh to use "macos" when the system is detected as Darwin.
WalkthroughUpdates the macOS artifact naming convention in the installer script. When the system identifies as Darwin, the OS string used for the release tarball filename changes from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/install-d2.sh (1)
32-45: 🧹 Nitpick | 🔵 TrivialLGTM — correctly matches upstream asset naming.
Change resolves the macOS install 404: terrastruct/d2 v0.7.1 publishes tarballs as
d2-<version>-macos-<arch>.tar.gz, notdarwin. Verified both macos variants return HTTP 200 and darwin variants return 404. Tarball extraction logic (lines 66–72) remains compatible since macOS archives expand to the samed2-$VERSION/directory structure as Linux.Optional suggestion: the inline comment states "starting in v0.7.x", but upstream used
macosin asset names well before that version. Consider simplifying to "upstream usesmacosfor Darwin" to avoid implying a version cutover.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/install-d2.sh` around lines 32 - 45, Update the inline comment above the OS name mapping to remove the version implication; change the comment from "Map OS names (upstream uses \"macos\" for Darwin starting in v0.7.x)" to a simpler phrasing like "Map OS names (upstream uses \"macos\" for Darwin)". Edit the comment that sits immediately before the case "$OS" in the OS-to-asset-name mapping so it no longer references a specific version cutover while leaving the case block and mapping logic (case "$OS", Darwin -> OS="macos", Linux -> OS="linux") unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@scripts/install-d2.sh`:
- Around line 32-45: Update the inline comment above the OS name mapping to
remove the version implication; change the comment from "Map OS names (upstream
uses \"macos\" for Darwin starting in v0.7.x)" to a simpler phrasing like "Map
OS names (upstream uses \"macos\" for Darwin)". Edit the comment that sits
immediately before the case "$OS" in the OS-to-asset-name mapping so it no
longer references a specific version cutover while leaving the case block and
mapping logic (case "$OS", Darwin -> OS="macos", Linux -> OS="linux") unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e5a761ca-28c4-485f-ae40-39d90fa910d3
📒 Files selected for processing (1)
scripts/install-d2.sh
📜 Review details
⏰ 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: Redirect rules - scalekit-starlight
- GitHub Check: Header rules - scalekit-starlight
- GitHub Check: Pages changed - scalekit-starlight
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: saif-at-scalekit
Repo: scalekit-inc/developer-docs PR: 0
File: :0-0
Timestamp: 2026-03-13T04:24:59.653Z
Learning: In scalekit-inc/developer-docs, for PRs focused on tooling and templatizing (e.g., extracting usage sections into reusable MDX templates and updating sync scripts), review comments about .mdx file content quality (casing, unused imports, import consolidation, endpoint descriptions, etc.) are considered out of scope and should be resolved without blocking the PR.
✅ Deploy Preview for scalekit-starlight ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary
pnpm install:d2on macOSinstall-d2.shto use "macos" instead of "darwin" for GitHub release asset names, matching d2 v0.7.x upstream release namingTest plan
pnpm install:d2on macOS arm64 and confirm it downloads and installs successfullyPreview
N/A — build script change only, no doc pages affected.
Summary by CodeRabbit
Bug Fixes