Skip to content

fix(scripts): install-d2 uses macos asset name for darwin#632

Merged
saif-at-scalekit merged 1 commit into
mainfrom
preview/fix-d2-install-macos
Apr 28, 2026
Merged

fix(scripts): install-d2 uses macos asset name for darwin#632
saif-at-scalekit merged 1 commit into
mainfrom
preview/fix-d2-install-macos

Conversation

@satyapd549
Copy link
Copy Markdown
Contributor

@satyapd549 satyapd549 commented Apr 25, 2026

Summary

  • Fixes 404 errors when running pnpm install:d2 on macOS
  • Updates OS mapping in install-d2.sh to use "macos" instead of "darwin" for GitHub release asset names, matching d2 v0.7.x upstream release naming

Test plan

  • Run pnpm install:d2 on macOS arm64 and confirm it downloads and installs successfully
  • Verify the installed d2 binary works correctly

Preview

N/A — build script change only, no doc pages affected.

Summary by CodeRabbit

Bug Fixes

  • Improved macOS installer compatibility by ensuring the correct binary is downloaded during installation.

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

Walkthrough

Updates 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 darwin to macos, affecting which GitHub release asset is downloaded during installation.

Changes

Cohort / File(s) Summary
OS Mapping Update
scripts/install-d2.sh
Changes Darwin→macos mapping in OS normalization logic for release asset selection; affects tarball filename construction in installer artifact download flow.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • ravibits
  • amitash1912
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating the OS mapping in install-d2.sh to use 'macos' instead of 'darwin' for Darwin systems.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch preview/fix-d2-install-macos

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
Copy Markdown
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.

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 | 🔵 Trivial

LGTM — 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, not darwin. 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 same d2-$VERSION/ directory structure as Linux.

Optional suggestion: the inline comment states "starting in v0.7.x", but upstream used macos in asset names well before that version. Consider simplifying to "upstream uses macos for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 60e479c and 24c3d0e.

📒 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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 25, 2026

Deploy Preview for scalekit-starlight ready!

Name Link
🔨 Latest commit 24c3d0e
🔍 Latest deploy log https://app.netlify.com/projects/scalekit-starlight/deploys/69ec4644d8b9690008d83d82
😎 Deploy Preview https://deploy-preview-632--scalekit-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@saif-at-scalekit saif-at-scalekit merged commit b2c8c95 into main Apr 28, 2026
4 checks passed
@saif-at-scalekit saif-at-scalekit deleted the preview/fix-d2-install-macos branch May 7, 2026 10:16
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.

3 participants