Repository navigation
feat(cli-docs): Serve /install/<handoff code> with SENTRY_HANDOFF set - #2354
Merged
Merged
Conversation
`curl -fsSL https://cli.sentry.dev/install/<code> | bash` now runs the install script with SENTRY_HANDOFF exported, so Sentry can show one command that installs the CLI and claims the agent handoff during setup. The site is static, so the route goes to a small Vercel Edge Function that embeds the release's install script and adds the export after the shebang. It only accepts well-formed `sntryh_` codes and sends `Cache-Control: no-store`. Packaging moves out of inline workflow shell into build-output.mjs; the existing /install routes are unchanged. Co-Authored-By: Evan Purkhiser <1421724+evanpurkhiser@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
MathurAditya724
approved these changes
Nov 18, 2026
MathurAditya724
left a comment
Member
There was a problem hiding this comment.
Reviewed script embedding, code validation, cache headers, and build-output packaging. All 22 CLI docs tests pass, including executing the emitted handoff script through bash, malformed-code rejection, and the packaged function. No blocking issues found. Hosted checks pass; production Vercel routing was not exercised locally.
MathurAditya724
marked this pull request as ready for review
November 18, 2026 18:27
7 tasks done
github-actions Bot
pushed a commit
to Fields-Education/sentry-mcp
that referenced
this pull request
Nov 30, 2026
… set (getsentry#2429) Follow-up to getsentry#2354, which added this only for bash. Windows now gets the same one-liner: `irm https://cli.sentry.dev/install.ps1/sntryh_… | iex`. One Edge Function now serves both scripts. The route `^/(install|install\.ps1)/(<code>)$` rewrites to `/install-handoff?script=$1&code=$2`. The handler returns 404 for any other script name, and it still accepts only codes that match `HANDOFF_CODE`. `install.ps1` already passes `SENTRY_HANDOFF` to `sentry cli setup`, so the script itself doesn't change. PowerShell differs from bash in one way. `curl | bash` runs in a child process, so the `export` goes away when the install ends. `iex` runs in the caller's session, so `$env:SENTRY_HANDOFF` would stay set afterwards. To prevent that, the PowerShell response sets the variable, wraps the script in `try { … } finally { Remove-Item Env:SENTRY_HANDOFF }`, and so clears it even when the install throws. Wrapping is safe because `install.ps1` has no `param`, `using`, or `#Requires` statement that must come first. Plain `/install` and `/install.ps1` don't change. **Open questions** - Is `/install.ps1/<code>` the URL that Sentry's setup page should show? It mirrors `/install/<code>`, and getsentry#2354 suggested it. `/install/<code>.ps1` would also work. - As with getsentry#2354, the Vercel routing hasn't been tried on a real deployment yet. The handler also reads the script and code from the original path, so it works whether or not Vercel has rewritten the URL. <!-- junior-request-attribution:start --> via @evanpurkhiser. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC010884QHLG%3A1795107208.690639 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC010884QHLG%3A1795107208.690639) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC010884QHLG%3A1795107208.690639/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Evan Purkhiser <1421724+evanpurkhiser@users.noreply.github.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets Sentry's setup page show one command that installs the CLI and claims the agent handoff:
curl -fsSL https://cli.sentry.dev/install/sntryh_… | bash./install/<code>returns the normal install script withexport SENTRY_HANDOFF='<code>'added after the shebang.sentry cli setup --installthen claims the handoff (#2320). Plain/installdoesn't change.The site is deployed as static Vercel build output, so the new route goes to a small Edge Function. At packaging time, the function gets the same install script the release ships. It only accepts codes that match Sentry's format:
sntryh_followed by 43 base64url chars, the same regex assentry/agent_handoff/views.py. That keeps anything shell-unsafe out of the script. Any other code returns 404, and responses are sent withCache-Control: no-store.To add a function, packaging had to move out of the inline
printf/zipincli-build.ymland intoapps/cli-docs/vercel/build-output.mjs. The existing/installroutes are byte-for-byte unchanged.Open questions
?code=or the original/install/<code>path, so it works whichever URL Vercel passes it. Worth trying on a preview deploy before merging.install.ps1/<code>would be a small follow-up if we want a Windows one-liner.via @evanpurkhiser.
--
View Session [Sentry]