From 2772d2a4e9036ef780bd1871a87ffbbcafe6e6a2 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 24 Mar 2026 19:00:38 +0100 Subject: [PATCH] fix: use OSC 8 escape directly instead of terminal-link terminal-link uses supports-hyperlinks which doesn't detect all terminals (e.g. Ghostty behind tmux). Use the OSC 8 escape sequence directly so the URL is always clickable in supported terminals. --- pnpm-lock.yaml | 3 --- releasing/commands/package.json | 1 - releasing/commands/src/publish/otp.ts | 7 +++++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f7cc739c2..88477f736e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7617,9 +7617,6 @@ importers: tempy: specifier: 'catalog:' version: 3.0.0 - terminal-link: - specifier: 'catalog:' - version: 5.0.0 tinyglobby: specifier: 'catalog:' version: 0.2.15 diff --git a/releasing/commands/package.json b/releasing/commands/package.json index 33d1677d1c..f7df4796b7 100644 --- a/releasing/commands/package.json +++ b/releasing/commands/package.json @@ -76,7 +76,6 @@ "semver": "catalog:", "tar-stream": "catalog:", "tempy": "catalog:", - "terminal-link": "catalog:", "tinyglobby": "catalog:", "validate-npm-package-name": "catalog:", "write-json-file": "catalog:", diff --git a/releasing/commands/src/publish/otp.ts b/releasing/commands/src/publish/otp.ts index bb399cc719..9fba3c2f78 100644 --- a/releasing/commands/src/publish/otp.ts +++ b/releasing/commands/src/publish/otp.ts @@ -2,7 +2,6 @@ import { PnpmError } from '@pnpm/error' import type { ExportedManifest } from '@pnpm/releasing.exportable-manifest' import type { PublishOptions } from 'libnpmpublish' import qrcodeTerminal from 'qrcode-terminal' -import terminalLink from 'terminal-link' import { SHARED_CONTEXT } from './utils/shared-context.js' @@ -189,7 +188,7 @@ async function webAuthOtp ( ): Promise { const qrCode = generateQrCode(authUrl) const sanitizedUrl = sanitizeUrl(authUrl) - const displayUrl = sanitizedUrl != null ? terminalLink(sanitizedUrl, sanitizedUrl, { fallback: false }) : authUrl + const displayUrl = sanitizedUrl != null ? hyperlinkEscape(sanitizedUrl) : authUrl globalInfo(`Authenticate your account at:\n${displayUrl}\n\n${qrCode}`) const startTime = Date.now() const timeout = 5 * 60 * 1000 // 5 minutes @@ -301,3 +300,7 @@ function sanitizeUrl (url: string): string | undefined { return undefined } } + +function hyperlinkEscape (url: string): string { + return `\u001B]8;;${url}\u0007${url}\u001B]8;;\u0007` +}