Redirect Graphite.dev to Github

Redirects all Graphite.com PR links to Github

07.11.2025 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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)
})();