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.
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.
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.
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.
<gh-like repo="686f6c61/ghlike" variant="pill"></gh-like>
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):
pipx install ghlike
npm install -g ghlike
Paso 2 · Arranca el daemon y vuelve aquí: Step 2 · Start the daemon and come back here:
$ 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.
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:
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).
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.
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.
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.
Desde el CDN oficial, una vez por página (antes de </body>):
From the official CDN, once per page (before </body>):
<!-- 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:
npm install ghlike-widget
// 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>.
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:
<!-- 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:
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.
variant1 · The 5 variants — variant attributePor defecto, estilo GitHub.Default, GitHub-like.
Oscuro y redondeado.Dark and rounded.
Azul, ligero, tipo enlace.Blue, light, link-style.
Cristal: para héroes con degradado o foto.Glass: for gradient or photo heroes.
Llamada a la acción, ancho completo.Call to action, full width.
<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
--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:
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-bg | fondo del botónbutton background | #f6f8fa |
--ghlike-bg-hover | fondo al pasar el ratónhover background | #eef1f4 |
--ghlike-fg | color del textotext color | #24292f |
--ghlike-border | color del bordeborder color | #d0d7de |
--ghlike-radius | redondeo de esquinascorner radius | 6px |
--ghlike-padding | relleno internoinner padding | 5px 14px |
--ghlike-gap | espacio icono–textoicon–text gap | 7px |
--ghlike-icon | tamaño de la estrellastar icon size | 15px |
--ghlike-font-size | tamaño de letrafont size | 14px |
--ghlike-star | color de la estrellastar color | #9a6700 |
--ghlike-star-on | estrella en estado «Liked»star when “Liked” | #eac54f |
--ghlike-on-bg / on-border / on-fg | colores del estado «Liked»“Liked” state colors | #fff8c5 · #d4a72c · #24292f |
--ghlike-min-width | ancho mínimo (variante block)min width (block variant) | 220px |
::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).
gh-like::part(button) { font-weight: 700; letter-spacing: .4px; }
gh-like::part(count) { font-size: 13px; }
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:
/* 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.
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.
Python ≥ 3.9 · cero dependencias≥ 3.9 · zero dependencies
pipx install ghlike # o · or: pip install --user ghlike
Node ≥ 22 · cero dependencias≥ 22 · zero dependencies
npm install -g ghlike
$ 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:
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
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.
from ghlike import star, unstar, check, toggle
star("686f6c61/ghlike")
check("vercel/next.js") # {starred: True/False, …}
unstar("vercel/next.js", browser="brave")
import { star, check } from "ghlike";
await star("686f6c61/ghlike");
await check("vercel/next.js"); // {starred: true/false, …}
| códigocode | significameaning |
|---|---|
0 | éxito (también «ya tenía like»)success (including “already starred”) |
1 | error genérico (navegador falló, cambió el markup…)generic error (browser failed, markup changed…) |
2 | no hay sesión de github.com en ningún navegador soportadono github.com session in any supported browser |
3 | el repo no existerepo not found |
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.
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>.
Navegadores Chromium (Brave, Chrome, Edge…): Chromium browsers (Brave, Chrome, Edge…):
# 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.
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.
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.
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.
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.
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.