Skip to content

fix(dns): detect package manager in scripts init and publish scriptab…#108

Merged
jamie-at-bunny merged 2 commits into
mainfrom
fix/dns-scripts-package-manager
Jul 1, 2026
Merged

fix(dns): detect package manager in scripts init and publish scriptab…#108
jamie-at-bunny merged 2 commits into
mainfrom
fix/dns-scripts-package-manager

Conversation

@jamie-at-bunny

Copy link
Copy Markdown
Member

…le-dns-types

@bogdan-at-bunny

Copy link
Copy Markdown

@codex review

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c86566d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@bunny.net/cli Patch
@bunny.net/cli-linux-x64 Patch
@bunny.net/cli-linux-arm64 Patch
@bunny.net/cli-darwin-x64 Patch
@bunny.net/cli-darwin-arm64 Patch
@bunny.net/cli-windows-x64 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR promotes package-manager.ts from a commands/scripts-local utility to core/ so it can be shared by both the Edge Scripts and DNS Scripts init flows, and uses it in dns/scripts/init.ts to detect and invoke any installed package manager instead of hard-coding bun.

  • core/package-manager.ts – pure rename with no logic changes; pickPackageManager probes user-agent → lockfile → PATH and is now consumed by both init commands.
  • dns/scripts/init.ts – replaces the unconditional bun install with pickPackageManager; warns clearly when no PM is found and surfaces the detected PM name in the failure hint.
  • release.yml – adds a check-scriptable-dns-types version step and a lean publish-scriptable-dns-types job (no build needed; the package ships a single index.d.ts).

Confidence Score: 5/5

Safe to merge — the changes are a clean refactor that moves a utility to core, fixes hardcoded bun assumptions in the DNS init flow, and adds a minimal publish job for a types-only package.

All changed paths are well-scoped: the package-manager module is a pure rename with no logic changes, both init commands correctly handle the null-PM case, and the new CI publish job correctly omits a build step because the package ships a pre-authored index.d.ts with no compilation needed.

No files require special attention.

Important Files Changed

Filename Overview
packages/cli/src/core/package-manager.ts Renamed from commands/scripts/package-manager.ts to core/; no logic changes — pure file relocation to make the utility shared.
packages/cli/src/core/package-manager.test.ts Test file moved alongside the source; relative import ./package-manager.ts is still correct after both files land in core/.
packages/cli/src/commands/dns/scripts/init.ts Replaces hardcoded bun spawn with pickPackageManager; handles null PM gracefully with a clear warning and provides dynamic install command in the failure message.
packages/cli/src/commands/scripts/init.ts Import path updated to ../../core/package-manager.ts; placeholder in warn message replaced with plain prose.
.github/workflows/release.yml Adds version-check step and publish-scriptable-dns-types job; the package ships only index.d.ts with no build step, so the lean job (checkout → setup-node → npm publish) is correct.
.changeset/dns-scripts-package-manager.md Changeset entry for the patch release; description accurately reflects the fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User runs dns scripts init / scripts init] --> B{--skip-install?}
    B -- Yes --> Z[Done]
    B -- No --> C{Interactive?}
    C -- No --> D[shouldInstall = true]
    C -- Yes --> E[Prompt: Install dependencies?]
    E -- No --> Z
    E -- Yes --> D
    D --> F[pickPackageManager dirPath]
    F --> G{npm_config_user_agent set?}
    G -- Yes --> H{binary on PATH?}
    H -- Yes --> K[return user-agent PM]
    H -- No --> I
    G -- No --> I{lockfile in dir?}
    I -- Yes --> J{binary on PATH?}
    J -- Yes --> K
    J -- No --> L
    I -- No --> L[probe bun → pnpm → yarn → npm]
    L --> M{any found?}
    M -- No --> N[warn: no PM on PATH]
    M -- Yes --> K
    K --> O[Bun.spawn pm install]
    O --> P{exit 0?}
    P -- Yes --> Q[logger.success]
    P -- No --> R[warn: run pm install manually]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User runs dns scripts init / scripts init] --> B{--skip-install?}
    B -- Yes --> Z[Done]
    B -- No --> C{Interactive?}
    C -- No --> D[shouldInstall = true]
    C -- Yes --> E[Prompt: Install dependencies?]
    E -- No --> Z
    E -- Yes --> D
    D --> F[pickPackageManager dirPath]
    F --> G{npm_config_user_agent set?}
    G -- Yes --> H{binary on PATH?}
    H -- Yes --> K[return user-agent PM]
    H -- No --> I
    G -- No --> I{lockfile in dir?}
    I -- Yes --> J{binary on PATH?}
    J -- Yes --> K
    J -- No --> L
    I -- No --> L[probe bun → pnpm → yarn → npm]
    L --> M{any found?}
    M -- No --> N[warn: no PM on PATH]
    M -- Yes --> K
    K --> O[Bun.spawn pm install]
    O --> P{exit 0?}
    P -- Yes --> Q[logger.success]
    P -- No --> R[warn: run pm install manually]
Loading

Reviews (2): Last reviewed commit: "remove <pm>" | Re-trigger Greptile

Comment thread packages/cli/src/commands/dns/scripts/init.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 38ad4962b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jamie-at-bunny jamie-at-bunny merged commit 8c6ae43 into main Jul 1, 2026
2 checks passed
@jamie-at-bunny jamie-at-bunny deleted the fix/dns-scripts-package-manager branch July 1, 2026 08:19
@github-actions github-actions Bot mentioned this pull request Jul 1, 2026
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