Skip to content

Commit d6e0de3

Browse files
fix(init): make URLs clickable with OSC 8 terminal hyperlinks
Wrap project and docs URLs in terminalLink() so they become clickable in terminals that support OSC 8 (iTerm2, VS Code, Windows Terminal). On unsupported terminals, the escape sequences are silently ignored.
1 parent a6d62d7 commit d6e0de3

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/lib/init/clack-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { cancel, isCancel } from "@clack/prompts";
8+
import { terminalLink } from "../formatters/colors.js";
89
import { SENTRY_DOCS_URL } from "./constants.js";
910

1011
export class WizardCancelledError extends Error {
@@ -17,7 +18,7 @@ export class WizardCancelledError extends Error {
1718
export function abortIfCancelled<T>(value: T | symbol): T {
1819
if (isCancel(value)) {
1920
cancel(
20-
`Setup cancelled. You can visit ${SENTRY_DOCS_URL} to set up manually.`
21+
`Setup cancelled. You can visit ${terminalLink(SENTRY_DOCS_URL, SENTRY_DOCS_URL)} to set up manually.`
2122
);
2223
throw new WizardCancelledError();
2324
}

src/lib/init/formatters.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { cancel, log, note, outro } from "@clack/prompts";
8+
import { terminalLink } from "../formatters/colors.js";
89
import { featureLabel } from "./clack-utils.js";
910
import {
1011
EXIT_DEPENDENCY_INSTALL_FAILED,
@@ -41,10 +42,12 @@ function buildSummaryLines(output: WizardOutput): string[] {
4142
lines.push(`Commands: ${output.commands.join("; ")}`);
4243
}
4344
if (output.sentryProjectUrl) {
44-
lines.push(`Project: ${output.sentryProjectUrl}`);
45+
lines.push(
46+
`Project: ${terminalLink(output.sentryProjectUrl, output.sentryProjectUrl)}`
47+
);
4548
}
4649
if (output.docsUrl) {
47-
lines.push(`Docs: ${output.docsUrl}`);
50+
lines.push(`Docs: ${terminalLink(output.docsUrl, output.docsUrl)}`);
4851
}
4952

5053
const changedFiles = output.changedFiles;
@@ -103,7 +106,7 @@ export function formatError(result: WorkflowRunResult): void {
103106

104107
const docsUrl = inner?.docsUrl;
105108
if (docsUrl) {
106-
log.info(`Docs: ${docsUrl}`);
109+
log.info(`Docs: ${terminalLink(docsUrl, docsUrl)}`);
107110
}
108111

109112
cancel("Setup failed");

src/lib/init/wizard-runner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { captureException } from "@sentry/bun";
1313
import { formatBanner } from "../banner.js";
1414
import { CLI_VERSION } from "../constants.js";
1515
import { getAuthToken } from "../db/auth.js";
16+
import { terminalLink } from "../formatters/colors.js";
1617
import {
1718
abortIfCancelled,
1819
STEP_LABELS,
@@ -251,7 +252,7 @@ export async function runWizard(options: WizardOptions): Promise<void> {
251252

252253
log.info(
253254
"This wizard uses AI to analyze your project and configure Sentry." +
254-
`\nFor manual setup: ${SENTRY_DOCS_URL}`
255+
`\nFor manual setup: ${terminalLink(SENTRY_DOCS_URL, SENTRY_DOCS_URL)}`
255256
);
256257

257258
const tracingOptions = {

0 commit comments

Comments
 (0)