El botón de «me gusta»
para repos de GitHub
The “like” button
for GitHub repositories

Quien visita tu web y ya está logueado en GitHub le da star a tu repo sin salir de tu página. Sin tokens, sin OAuth, sin fricción: el navegador ya tiene la sesión. Visitors to your site who are already logged into GitHub can star your repo without leaving the page. No tokens, no OAuth, no friction: the browser already holds the session.

Poner el botón en mi web Add the button to my site Probar el CLI Try the CLI
Demo en vivoLive demo Cambiar los botonesCustomize buttons Instalar el CLIInstall the CLI La extensiónThe extension
demo

Dale like a los dos paquetes Like the two packages

Los dos paquetes de ghlike viven en el mismo repositorio, así que una sola star los cubre. Estos botones son widgets reales <gh-like> apuntando a 686f6c61/ghlike: pruébalos ahora mismo. Both ghlike packages live in the same repository, so one star covers them both. The buttons below are real <gh-like> widgets pointing at 686f6c61/ghlike — try them right now.

Buscando el daemon local… Looking for the local daemon… Daemon conectado. Todos los botones <gh-like> de esta página dan like con un clic (~8–12 s por clic: tu navegador pulsa el botón real de GitHub). Cierra el daemon con Ctrl+C al terminar. Daemon connected. Every <gh-like> button on this page likes with one click (~8–12 s per click: your browser presses GitHub’s real button). Close the daemon with Ctrl+C when done. Daemon no detectado. Sin él, el clic abre el repo en una pestaña nueva. Para dar like con un clic desde aquí: instala el CLI con pipx o npm y ejecuta ghlike daemon — los 2 pasos, justo debajo. No daemon detected. Without it, clicking opens the repo in a new tab. To like with one click from here: install the CLI with pipx or npm and run ghlike daemon — the 2 steps, right below.
ghlike CLI PyPI npm

Likes (stars) desde el terminal con la sesión de tu navegador. Cero dependencias — Python ≥ 3.9 y Node ≥ 22. Likes (stars) from the terminal using your browser session. Zero dependencies — Python ≥ 3.9 and Node ≥ 22.

bash
pipx install ghlike  # o · or: npm install -g ghlike
ghlike-widget npm web component

El botón <gh-like> para tu web, con contador de stars en vivo, modo oscuro automático y 5 variantes. Un fichero, cero dependencias. The <gh-like> button for your website, with a live star counter, automatic dark mode and 5 variants. One file, zero dependencies.

html
<gh-like repo="686f6c61/ghlike" variant="pill"></gh-like>

Activa el like con un clic — 2 pasos Enable one-click likes — 2 steps

El daemon es la vía sin extensión: instala el CLI, déjalo corriendo en un terminal, y todos los botones <gh-like> de esta página pasan a dar like con un clic usando la sesión de github.com de tu navegador. The daemon is the extension-free path: install the CLI, keep it running in a terminal, and every <gh-like> button on this page becomes one-click, using your browser’s github.com session.

Paso 1 · Instala el CLI (elige uno): Step 1 · Install the CLI (pick one):

bash · Python ≥ 3.9
pipx install ghlike
bash · Node ≥ 22
npm install -g ghlike

Paso 2 · Arranca el daemon y vuelve aquí: Step 2 · Start the daemon and come back here:

terminal
$ ghlike daemon
ghlike daemon escuchando en http://127.0.0.1:8469
Ctrl+C para parar…
# el indicador de arriba pasa a verde · the indicator above turns green

Condiciones: sesión de github.com en un navegador Chromium (Brave, Chrome, Edge…) de esta máquina · el subcomando daemon viaja en ghlike de npm (≥ 0.1.3); en PyPI llega con la próxima versión · si un clic falla, reinténtalo · si ya tienes la extensión, no necesitas el daemon · páralo con Ctrl+C al acabar. Requirements: a github.com session in a Chromium browser (Brave, Chrome, Edge…) on this machine · the daemon subcommand ships in npm’s ghlike (≥ 0.1.3); on PyPI it lands with the next release · if a click fails, retry · if you already have the extension, you don’t need the daemon · stop it with Ctrl+C when done.

¿Qué pasa al hacer clic? What happens when you click?

El widget se adapta a lo que tenga instalado el visitante. Nunca queda roto: The widget adapts to whatever the visitor has installed. It is never broken:

Con la extensiónWith the extension

Un clic da la star en el sitio, sin salir de la página (~2–4 s). One click stars in place, without leaving the page (~2–4 s).

Con el daemon localWith the local daemon

ghlike daemon → un clic en cualquier navegador de tu máquina, incluidos los embebidos. ghlike daemon → one click in any browser on your machine, embedded ones included.

Sin nada instaladoNothing installed

El clic explica aquí mismo cómo activar el like con un clic — y deja el enlace para dar la star a mano, solo si lo pides. The click explains right here how to enable one-click likes — with the manual star link only if you ask for it.

El contador de stars viene de la API pública de GitHub (CORS, sin clave), con caché de 1 hora por repo. Los clics con daemon tardan ~8–12 s: el navegador real pulsa el botón de Star con tu sesión. The star counter comes from GitHub’s public API (CORS, no key), cached for 1 hour per repo. Daemon clicks take ~8–12 s: your real browser presses the Star button with your session.

widget

Pon el botón en tu web Put the button on your website

Dos pasos y listo: carga el script una vez, y pon el botón donde quieras con una etiqueta HTML. Two steps and you’re done: load the script once, then place the button anywhere with a single HTML tag.

1Carga el scriptLoad the script

Desde el CDN oficial, una vez por página (antes de </body>): From the official CDN, once per page (before </body>):

html
<!-- carga el widget una vez por página · load the widget once per page -->
<script type="module" src="https://cdn.jsdelivr.net/npm/ghlike-widget"></script>

O desde npm, si bundlean tu web: Or from npm, if you bundle your site:

bash + js
npm install ghlike-widget
js
// en tu JS de entrada · in your entry JS
import "ghlike-widget";

El widget también viaja hoy dentro del paquete del CLI, por si lo prefieres: <script type="module" src="https://unpkg.com/ghlike/widget"></script>. The widget also ships today inside the CLI package, if you prefer: <script type="module" src="https://unpkg.com/ghlike/widget"></script>.

2Pon el botón donde quierasPlace the button anywhere

Una etiqueta con el repo destino. Acepta owner/repo o la URL completa de GitHub: One tag with the target repo. It accepts owner/repo or the full GitHub URL:

html
<!-- el botón · the button -->
<gh-like repo="686f6c61/ghlike"></gh-like>

<!-- también vale la URL completa · the full URL works too -->
<gh-like repo="https://github.com/vercel/next.js"></gh-like>

Resultado real de la primera línea: Real result of the first line:

3Sin configurar nada más, ya tienes…With zero extra config, you already get…

personalizacióncustomization

Cambia los botones a tu gusto Make the buttons yours

Tres niveles: elige una variante predefinida con un atributo, retoca cualquier color con variables CSS, o entra al detalle con shadow parts. Todo se controla desde el CSS de tu propia página — sin reescribir el widget. Three levels: pick a predefined variant with one attribute, tweak any color with CSS variables, or go deeper with shadow parts. Everything is controlled from your own page’s CSS — no need to rewrite the widget.

1 · Las 5 variantes — atributo variant1 · The 5 variants — variant attribute

classic

Por defecto, estilo GitHub.Default, GitHub-like.

pill

Oscuro y redondeado.Dark and rounded.

outline

Azul, ligero, tipo enlace.Blue, light, link-style.

glass

Cristal: para héroes con degradado o foto.Glass: for gradient or photo heroes.

block

Llamada a la acción, ancho completo.Call to action, full width.

html
<gh-like repo="owner/repo"></gh-like>                          classic · default
<gh-like repo="owner/repo" variant="pill"></gh-like>             pill
<gh-like repo="owner/repo" variant="outline"></gh-like>           outline
<gh-like repo="owner/repo" variant="glass"></gh-like>             glass · héroes/heroes
<gh-like repo="owner/repo" variant="block"></gh-like>             block · CTA

2 · Variables CSS — --ghlike-*2 · CSS variables — --ghlike-*

Cualquier valor del botón se cambia desde tu hoja de estilos. Ejemplo — un botón rosa: Every button value can be changed from your stylesheet. Example — a pink button:

css
gh-like.mi-estilo {
  /* fondo · background */        --ghlike-bg: #fff0f6;
  /* borde · border */           --ghlike-border: #ff2d87;
  /* texto · text */             --ghlike-fg: #c2185b;
  /* estrella · star */          --ghlike-star: #ff2d87;
  /* esquinas · corners */       --ghlike-radius: 4px;
  /* relleno · padding */        --ghlike-padding: 8px 16px;
}

Referencia completa de variables (valores por defecto del tema claro): Full variable reference (light-theme defaults):

variablevariable qué controlacontrols por defectodefault
--ghlike-bgfondo del botónbutton background#f6f8fa
--ghlike-bg-hoverfondo al pasar el ratónhover background#eef1f4
--ghlike-fgcolor del textotext color#24292f
--ghlike-bordercolor del bordeborder color#d0d7de
--ghlike-radiusredondeo de esquinascorner radius6px
--ghlike-paddingrelleno internoinner padding5px 14px
--ghlike-gapespacio icono–textoicon–text gap7px
--ghlike-icontamaño de la estrellastar icon size15px
--ghlike-font-sizetamaño de letrafont size14px
--ghlike-starcolor de la estrellastar color#9a6700
--ghlike-star-onestrella en estado «Liked»star when “Liked”#eac54f
--ghlike-on-bg / on-border / on-fgcolores del estado «Liked»“Liked” state colors#fff8c5 · #d4a72c · #24292f
--ghlike-min-widthancho mínimo (variante block)min width (block variant)220px

3 · Shadow parts — ::part()3 · Shadow parts — ::part()

El botón expone tres partes del shadow DOM que puedes estilizar directamente: ::part(button), ::part(label) y ::part(count). The button exposes three shadow-DOM parts you can style directly: ::part(button), ::part(label) and ::part(count).

css
gh-like::part(button) { font-weight: 700; letter-spacing: .4px; }
gh-like::part(count) { font-size: 13px; }

4 · Modo oscuro y tema de tu web4 · Dark mode and your site’s theme

La variante classic sigue prefers-color-scheme del sistema por defecto. Si tu web cambia de tema con un atributo (como esta página), los estilos de la página siempre ganan a los internos del widget — esta es la técnica para sincronizarlos: The classic variant follows the system’s prefers-color-scheme by default. If your site switches themes with an attribute (like this page does), page styles always win over the widget’s internal ones — this is the technique to sync them:

css
/* cuando TU web está en oscuro · when YOUR site is dark */
html[data-theme="dark"] gh-like {
  --ghlike-bg: #26282d; --ghlike-fg: #e6edf3;
  --ghlike-border: #42474e; --ghlike-star: #d29922;
}

Pruébalo aquí mismo: cambia el tema de la página con el botón de la luna del header y mira cómo los widgets de arriba acompañan. Try it right here: switch the page theme with the moon button in the header and watch the widgets above follow along.

5 · Pruébalo en vivo5 · Try it live

variant:
html
cli

El CLI: likes desde el terminal The CLI: likes from the terminal

Dos paquetes gemelos con comportamiento idéntico — elige tu ecosistema. Encuentra tu sesión de github.com en cualquier navegador Chromium (Brave, Chrome, Chromium, Edge, Vivaldi, Opera), y da stars sin gh auth ni tokens. Two twin packages with identical behavior — pick your ecosystem. They find your github.com session in any Chromium browser (Brave, Chrome, Chromium, Edge, Vivaldi, Opera) and give stars with no gh auth and no tokens.

1Instala el paqueteInstall the package

Python ≥ 3.9 · cero dependencias≥ 3.9 · zero dependencies

bash
pipx install ghlike   # o · or: pip install --user ghlike

Node ≥ 22 · cero dependencias≥ 22 · zero dependencies

bash
npm install -g ghlike

2Da tu primer likeGive your first like

terminal
$ ghlike 686f6c61/ghlike
686f6c61/ghlike: like dado ★ [your-user via Brave]

Todas las opciones — acepta owner/repo o la URL completa: All the options — it accepts owner/repo or the full URL:

bash
ghlike owner/repo                  # dar like · give a like (idempotente · idempotent)
ghlike https://github.com/o/r      # URLs completas valen · full URLs work
ghlike owner/repo -c               # consultar estado · check state only
ghlike owner/repo -u               # quitar like · unstar
ghlike owner/repo --toggle         # invertir · flip
ghlike --list                      # sesiones encontradas · sessions found
ghlike --browser brave owner/repo  # forzar navegador · force one browser
ghlike owner/repo --json           # salida para scripts · scriptable output
ghlike daemon                      # servidor local para widgets · local server for widgets

3El daemon: botones con un clic en tu máquinaThe daemon: one-click buttons on your machine

ghlike daemon levanta un servidor local en 127.0.0.1:8469. Mientras corra, cualquier botón <gh-like> de las páginas que tengas abiertas funciona con un clic — en cualquier navegador de tu máquina, incluidos los embebidos que no pueden cargar extensiones. Es una herramienta de desarrollo y pruebas: páralo al acabar. ghlike daemon starts a local server on 127.0.0.1:8469. While it runs, every <gh-like> button on the pages you have open works with one click — in any browser on your machine, including embedded ones that can’t load extensions. It’s a development/testing tool: stop it when you’re done.

Como libreríaAs a library

python
from ghlike import star, unstar, check, toggle

star("686f6c61/ghlike")
check("vercel/next.js")          # {starred: True/False, …}
unstar("vercel/next.js", browser="brave")
js
import { star, check } from "ghlike";

await star("686f6c61/ghlike");
await check("vercel/next.js");     // {starred: true/false, …}

Códigos de salidaExit codes

códigocodesignificameaning
0éxito (también «ya tenía like»)success (including “already starred”)
1error genérico (navegador falló, cambió el markup…)generic error (browser failed, markup changed…)
2no hay sesión de github.com en ningún navegador soportadono github.com session in any supported browser
3el repo no existerepo not found
extensiónextension

La extensión: likes con un clic para tus visitantes The extension: one-click likes for your visitors

Se instala una vez y, a partir de ahí, todo botón <gh-like> de la web funciona con un clic usando la sesión de github.com del visitante. Install it once and, from then on, every <gh-like> button on the web works with one click using the visitor’s github.com session.

Qué pasa por dentro al hacer clicWhat happens under the hood on click

  1. El content script de la web visitada (widget-bridge.js) intercepta el clic sobre <gh-like>. The content script on the visited site (widget-bridge.js) intercepts the click on <gh-like>.
  2. El service worker abre una pestaña en segundo plano del repo en github.com. The service worker opens one background tab of the repo on github.com.
  3. El script de github.com pulsa el botón de Star real — el JS de la propia página envía la petición con su token CSRF — y verifica el nuevo estado. The github.com script clicks the real Star button — the page’s own JS sends the request with its CSRF token — and verifies the new state.
  4. La pestaña se cierra y el widget pasa a «Liked». The tab closes and the widget switches to “Liked”.

Instalación (modo desarrollador)Install (developer mode)

Navegadores Chromium (Brave, Chrome, Edge…): Chromium browsers (Brave, Chrome, Edge…):

bash
# 1 · abre brave://extensions (o chrome://extensions) y activa «Developer mode»
#   open brave://extensions (or chrome://extensions) and enable “Developer mode”
# 2 · «Load unpacked» → selecciona la carpeta extension/ del repo
#   “Load unpacked” → select the repo’s extension/ folder

# o lanza una instancia dedicada · or launch a dedicated instance:
brave --load-extension=$PWD/extension http://127.0.0.1:8123/site/

Mínima superficie: Manifest V3 · content scripts en sitios http/https + acceso solo a https://github.com/* · sin permiso amplio de pestañas, sin storage, sin código remoto · ~150 líneas de JS. Minimal surface: Manifest V3 · content scripts on http/https sites + host access only to https://github.com/* · no broad tabs permission, no storage, no remote code · ~150 lines of JS.

seguridadsecurity

Seguridad y privacidad Security & privacy

ghlike toca sesiones de navegador, así que el diseño entero está pensado para poder auditarse de un vistazo. ghlike touches browser sessions, so the whole design is built to be auditable at a glance.

Cero dependencias, en todas las piezasZero dependencies, everywhere

El cliente WebSocket de CDP es stdlib de Python y el WebSocket nativo de Node. Todo el proyecto: ~1.400 líneas. The CDP WebSocket client is Python stdlib and Node’s native WebSocket. The whole project: ~1,400 lines.

Las cookies nunca se descifranCookies are never decrypted

La tienda de cookies cifrada se copia a un perfil desechable; al acabar, el navegador se cierra y el perfil se borra. Nada sale de tu máquina. The encrypted cookie store is copied to a throwaway profile; when done, the browser is killed and the profile deleted. Nothing ever leaves your machine.

El clic lo da tu propio navegadorYour own browser does the clicking

Lo único que usa tu sesión es un clic en el botón de Star real — GitHub gestiona su propio CSRF. The only thing your session is ever used for is one click on the real Star button — GitHub handles its own CSRF.

Contadores vía API públicaCounts via the public API

Los números de stars del widget vienen de la API pública de GitHub, sin claves y con caché de 1 h por repo. The widget’s star numbers come from GitHub’s public API, keyless and cached for 1 h per repo.

Limitaciones: solo navegadores Chromium (Firefox no implementa CDP) · cada operación del CLI tarda ~8–12 s · si GitHub cambia el markup del botón de Star, se arregla con una línea de selector. Limitations: Chromium browsers only (Firefox has no CDP) · each CLI operation takes ~8–12 s · if GitHub changes the Star button markup, one selector line fixes it.