Skip to content

fix(.claude): add session-start-profiler hook with Windows-aware CLI detection#15698

Open
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:fix-15697
Open

fix(.claude): add session-start-profiler hook with Windows-aware CLI detection#15698
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:fix-15697

Conversation

@sleitor
Copy link
Copy Markdown
Contributor

@sleitor sleitor commented Mar 24, 2026

Summary

Adds .claude/hooks/session-start-profiler.mjs — a Claude Code SessionStart hook that checks whether the Vercel CLI is installed and prints a helpful message if not.

Fixes the Windows false-negative reported in #15697.

Root Cause

On Windows, npm installs an extensionless wrapper script (e.g. C:\Users\<user>\AppData\Roaming\npm\vercel) alongside the actual launchers vercel.CMD and vercel.EXE. The extensionless file passes fs.accessSync(constants.X_OK), so it was returned first as the resolved binary — but child_process.execFileSync cannot spawn it directly and throws ENOENT. The hook catches that error and (incorrectly) concludes the CLI is not installed.

Fix

resolveBinaryFromPath now probes .CMD and .EXE candidates before the extensionless name on Windows. The first candidate that both exists+is-executable AND can be successfully spawned is returned.

Changes

  • .claude/hooks/session-start-profiler.mjs — new SessionStart hook
  • .claude/settings.json — registers the hook for Claude Code
  • .changeset/fix-claude-hooks-windows-binary.md — empty-frontmatter changeset (non-package file change)

Closes #15697

@sleitor sleitor requested a review from a team as a code owner March 24, 2026 10:37
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: 20a89cd

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 24, 2026

Low Risk — New developer tooling hook for CLI detection — no auth, billing, schema, or shared infrastructure changes.

  • .claude/hooks/session-start-profiler.mjs: new SessionStart hook checking Vercel CLI availability with Windows-aware binary resolution
  • .claude/settings.json: registers hook to run on Claude Code session start
  • .changeset/fix-claude-hooks-windows-binary.md: changeset documenting fix

Assessed at 20a89cd.

…detection

Adds `.claude/hooks/session-start-profiler.mjs` — a Claude Code SessionStart
hook that warns when the Vercel CLI is not installed.

On Windows, npm installs an extensionless wrapper script (e.g. `vercel`)
alongside `vercel.CMD` and `vercel.EXE`. The extensionless file passes
`fs.accessSync(X_OK)` but cannot be spawned directly via `execFileSync`,
causing a false "CLI not installed" warning. The hook now probes `.CMD` and
`.EXE` candidates BEFORE the extensionless name on Windows.

Closes vercel#15697
@sleitor
Copy link
Copy Markdown
Contributor Author

sleitor commented Mar 24, 2026

Rebased on latest main (through #15699) to keep the CI checks current. The change is a minimal .claude/hooks/ tooling addition — no runtime code touched.

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.

[Vercel Plugin] session-start-profiler falsely reports "Vercel CLI is not installed" on Windows

1 participant