Skip to content

feat(devframe): resolve the assets install command against the project's package manager - #516

Open
btea wants to merge 2 commits into
devframes:mainfrom
btea:feat/remote-assets-install-command
Open

btea wants to merge 2 commits into
devframes:mainfrom
btea:feat/remote-assets-install-command

Conversation

@btea

@btea btea commented Dec 1, 2026

Copy link
Copy Markdown

When using pnpm to manage and start a project, the prompt to install missing dependencies still uses npm.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 04:23
@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown

@btea is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

👁️‍🗨️ Review this pull request with grouped, summarized diffs at:
👉 https://pulls.review/gh/devframes/devframe/516?from=github-actions[bot]

raw result

💭 analyzed by vercel-ai-gateway/anthropic/claude-sonnet-5
🕰️ 2026-12-01 05:52 UTC
🔗 head e8f4b1a
🤖 automated by pulls.review

{
  "headSha": "e8f4b1aeea4b82275096bca65adfbb8d49bfd958",
  "result": {
    "overallSummary": "Fixes the remote-assets \"install missing dependencies\" hint so it suggests the correct command for the project's actual package manager (e.g. `pnpm add`) instead of always `npm install`. A new `resolveInstallCommandLine` helper detects the manager from the project directory, `serveStaticHandler` threads a `cwd` option through to use it when building the error page/message, the hub passes its workspace root so the hint matches the served project, and the hub-ui viewer displays the resolved command with a backward-compatible fallback.",
    "groups": [
      {
        "key": "install-command-resolution",
        "label": "Resolve install command",
        "summary": "Adds `resolveInstallCommandLine`, which detects the project's package manager (via `package-manager-detector`) and produces the correct local-install command line instead of always assuming npm. `serveStaticHandler`/`serveStaticNodeMiddleware` now accept a `cwd` option, thread it through to resolve the hint, and embed the resolved `installCommand` in the remote-assets error message and page. The hub passes its workspace `cwd` through so the hint matches the served project rather than the process directory.",
        "category": "core",
        "filePaths": [
          "packages/devframe/src/utils/package-manager.ts",
          "packages/devframe/src/utils/serve-static.ts",
          "packages/devframe/src/types/remote-assets.ts",
          "packages/hub/src/node/initiate.ts",
          "packages/devframe/package.json"
        ],
        "fileNotes": [
          {
            "path": "packages/devframe/src/utils/package-manager.ts",
            "text": "Falls back to the npm spelling both when no manager is detected and when the detected agent is npm itself, since `resolveCommand` would otherwise shorten it to `npm i`."
          },
          {
            "path": "packages/hub/src/node/initiate.ts",
            "text": "Passes `cwd` (the served project's workspace root) rather than the hub process's own directory, so the install hint names the right package manager."
          }
        ]
      },
      {
        "key": "ui-install-hint",
        "label": "Surface install hint in UI",
        "summary": "Updates the hub UI error view to display the server-resolved `installCommand` when present, falling back to the old npm spelling for messages from older senders, and forwards the new field through the iframe postMessage bridge.",
        "category": "ui",
        "filePaths": [
          "packages/hub-ui/src/client/components/views/ViewAssetsError.vue",
          "packages/hub-ui/src/client/components/views/ViewIframe.vue"
        ],
        "fileNotes": [
          {
            "path": "packages/hub-ui/src/client/components/views/ViewIframe.vue",
            "text": "`installCommand` is optional and only copied through when it's a string, preserving compatibility with older error payloads."
          }
        ]
      },
      {
        "key": "tests",
        "label": "Tests",
        "summary": "Adds unit tests for `resolveInstallCommandLine` (lockfile detection, upward directory walk, fallback) and extends the remote-assets tests to assert the resolved `installCommand` appears in both the error payload and the rendered page, including when a custom `cwd` is configured.",
        "category": "tests",
        "filePaths": [
          "packages/devframe/src/utils/package-manager.test.ts",
          "packages/devframe/src/utils/remote-assets.test.ts"
        ]
      },
      {
        "key": "generated",
        "label": "Generated snapshots & lockfile",
        "summary": "Mechanical updates: lockfile entry for the new `package-manager-detector` dependency and regenerated API snapshots reflecting the new `installCommand`/`cwd` fields.",
        "category": "other",
        "filePaths": [
          "pnpm-lock.yaml",
          "tests/__snapshots__/tsnapi/devframe/index.snapshot.d.ts",
          "tests/__snapshots__/tsnapi/devframe/types.snapshot.d.ts",
          "tests/__snapshots__/tsnapi/devframe/utils/serve-static.snapshot.d.ts"
        ]
      }
    ],
    "schemaVersion": 1,
    "source": "llm",
    "generatedAt": "2026-12-01T05:52:30.506Z",
    "model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
    "locale": "en"
  }
}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The asset-error hint detects the package manager from the process working directory rather than the configured project directory, so it can incorrectly recommend npm install for a pnpm project.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

This PR makes missing-assets installation prompts use the project’s detected package manager instead of always suggesting npm, both in the standalone error page and the hub UI.

Changes:

  • Add package-manager detection and install-command resolution.
  • Pass the resolved command to the hub UI, retaining an npm fallback for older senders.
  • Add resolver tests and extend remote-assets error-page assertions.
File Description
pnpm-lock.yaml Record the detector dependency and consolidate its version.
packages/​hub-ui/​src/​client/​components/​views/​ViewIframe.vue Read the install command from iframe error messages.
packages/​hub-ui/​src/​client/​components/​views/​ViewAssetsError.vue Display the supplied command with an npm fallback.
packages/​devframe/​src/​utils/​serve-static.ts Resolve and include the command in remote-assets error pages.
packages/​devframe/​src/​utils/​remote-assets.test.ts Check command inclusion in the page and message.
packages/​devframe/​src/​utils/​package-manager.ts Add package-manager-aware command resolution.
packages/​devframe/​src/​utils/​package-manager.test.ts Cover lockfile detection, parent lookup, and fallback.
packages/​devframe/​src/​types/​remote-assets.ts Add the optional install-command message field.
packages/​devframe/​package.json Declare the detector runtime dependency.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 1, 2026 05:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The suggested recovery command fails at pnpm workspace roots with ERR_PNPM_ADDING_TO_ROOT, preventing installation of missing assets and requiring explicit workspace-root handling with a regression test.

1 open issue
1 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants