Redirect Graphite.dev to Github

Redirects all Graphite.com PR links to Github

Stan na 07-11-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Redirect Graphite.dev to Github
// @namespace    https://app.graphite.dev/
// @version      2025-11-07
// @description  Redirects all Graphite.com PR links to Github
// @author       Jared Allard <[email protected]>
// @license      GPL-3.0
// @match        http*://app.graphite.com/github/pr/*
// @match        http*://app.graphite.dev/github/pr/*
// @run-at       document-start
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

// Example URL: https://app.graphite.dev/github/pr/org/repo/number

(function() {
    'use strict';

    const u = new URL(window.location.href)
    if(!u) {
        console.error(`failed to parse current location as a URL: ${window.location.href}`)
        return
    }

    // github/pr/gathertown/gather-town-v2/13844
    const values = u.pathname.split("/")
    if (values.length < 6) {
        console.error("split path was unexpected value", u)
        return
    }

    const vcs_provider = values[1]
    const link_type    = values[2]
    const org          = values[3]
    const repo         = values[4]
    const id           = values[5]

    let new_url = '';
    if (vcs_provider !== "github") {
        console.error(`unexpected VCS provider: ${vcs_provider}`)
        return
    }
    if(link_type !== "pr") {
        console.error(`unexpected type: ${link_type}`)
        return
    }

    new_url += `https://github.com/${org}/${repo}/pull/${id}`

    console.log("Redirecting Graphite -> Github", new_url)
    window.location.replace(new_url)
})();