From 3597e69ca579e310456cb8a6815a2bad16ab8268 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 22:49:10 +0000 Subject: [PATCH 1/2] feat(cli-docs): Show a banner to visitors redirected from docs.sentry.io The docs.sentry.io /cli/* redirects add ?from=sentry-docs to their cli.sentry.dev destinations. With that param, a banner above the page content says the docs moved and links the v3 migration guide and getsentry/sentry-cli, then the param is dropped from the address bar. Without it, the page is unchanged. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com> --- apps/cli-docs/src/components/PageFrame.astro | 5 ++- .../src/components/RedirectBanner.astro | 42 +++++++++++++++++++ apps/cli-docs/test/redirect-banner.test.mjs | 38 +++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 apps/cli-docs/src/components/RedirectBanner.astro create mode 100644 apps/cli-docs/test/redirect-banner.test.mjs diff --git a/apps/cli-docs/src/components/PageFrame.astro b/apps/cli-docs/src/components/PageFrame.astro index 43fc52a379..3671039915 100644 --- a/apps/cli-docs/src/components/PageFrame.astro +++ b/apps/cli-docs/src/components/PageFrame.astro @@ -2,9 +2,11 @@ import Default from "@astrojs/starlight/components/PageFrame.astro"; import Analytics from "@vercel/analytics/astro"; import SpeedInsights from "@vercel/speed-insights/astro"; + +import RedirectBanner from "./RedirectBanner.astro"; --- - + @@ -13,3 +15,4 @@ import SpeedInsights from "@vercel/speed-insights/astro"; + diff --git a/apps/cli-docs/src/components/RedirectBanner.astro b/apps/cli-docs/src/components/RedirectBanner.astro new file mode 100644 index 0000000000..266f52582f --- /dev/null +++ b/apps/cli-docs/src/components/RedirectBanner.astro @@ -0,0 +1,42 @@ +--- +const baseUrl = import.meta.env.BASE_URL; +const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/"; +--- + + + + + + diff --git a/apps/cli-docs/test/redirect-banner.test.mjs b/apps/cli-docs/test/redirect-banner.test.mjs new file mode 100644 index 0000000000..3130202be2 --- /dev/null +++ b/apps/cli-docs/test/redirect-banner.test.mjs @@ -0,0 +1,38 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { runInNewContext } from "node:vm"; +import test from "node:test"; + +const component = readFileSync(fileURLToPath(new URL("../src/components/RedirectBanner.astro", import.meta.url)), "utf8"); +const script = component.match(/