Metadata-Version: 2.4
Name: ghlike
Version: 0.1.0
Summary: Like (star) repos on GitHub with your existing browser session — no tokens, no API keys.
Author: ghlike contributors
License: MIT
Project-URL: Homepage, https://github.com/686f6c61/ghlike-py
Project-URL: Repository, https://github.com/686f6c61/ghlike-py
Project-URL: Issues, https://github.com/686f6c61/ghlike-py/issues
Project-URL: Changelog, https://github.com/686f6c61/ghlike-py/releases
Keywords: github,star,like,cli,browser-session
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# ghlike

**Star GitHub repos with your browser session — no tokens. / Da estrellas
en GitHub con la sesión de tu navegador — sin tokens.**

[English](#english) · [Español](#español)

This is the Python CLI of the [ghlike project](https://github.com/686f6c61/ghlike)
(like-button widget + browser extension + Node CLI live there). Zero
dependencies: the CDP WebSocket client is implemented on the standard
library, so the whole package audits in one sitting.

---

# English

## What it does

`ghlike owner/repo` stars a GitHub repository using the login session
already active in your browser. No `gh auth login`, no personal access
tokens, no OAuth: if you're logged into GitHub in Brave, Chrome, Chromium,
Edge, Vivaldi or Opera (native or snap installs), it just works.

How: it finds the browser profile with your github.com session → copies the
**encrypted** cookie store to a throwaway profile → opens your own browser
headless with a private debug port → clicks the real Star button (GitHub
handles its own CSRF) → verifies → kills the browser and deletes the
profile. Cookies are never decrypted and never leave your machine.

## Install

```bash
pipx install ghlike        # or: pip install --user ghlike
```

Requires Python ≥ 3.9 and a Chromium-family browser with a github.com
session. Firefox is not supported (no CDP).

## CLI

```bash
ghlike owner/repo            # star (idempotent — tells you if already starred)
ghlike https://github.com/o/r  # full URLs work
ghlike owner/repo -c         # check current state only
ghlike owner/repo -u         # unstar
ghlike owner/repo --toggle   # flip
ghlike --list                # github.com sessions found in your browsers
ghlike --browser brave o/r   # force one browser (strict)
ghlike o/r --json            # machine-readable output
```

Exit codes: `0` ok (incl. nothing-to-do) · `1` generic error · `2` no
github.com session · `3` repo not found.

JSON example:

```bash
$ ghlike cli/cli --check --json
{"repo":"cli/cli","user":"you","browser":"Brave","profile":"Default",
 "before":false,"action":"check","after":false,"changed":false}
```

## Library

```python
from ghlike import star, unstar, check, toggle

star("vercel/next.js")                 # -> {"repo": ..., "changed": True, ...}
state = check("vercel/next.js")        # -> {"repo": ..., "after": True/False, ...}
unstar("vercel/next.js", browser="brave")
toggle("vercel/next.js")
```

Exceptions: `NoSessionError`, `RepoNotFoundError`, `GhlikeError`.

## Limitations

- Chromium-family browsers only; Firefox is not supported (no CDP).
- Each operation takes ~8–12 s (headless browser + page load). That's the
  price of the no-token approach.
- Depends on GitHub's Star button; if the markup changes, one selector line
  fixes it (`STATE_JS` in `src/ghlike/core.py`).

## Development

```bash
PYTHONPATH=src python3 -m ghlike.cli --list
python -m pip wheel . --no-deps --no-build-isolation -w dist
```

Publishing is automated: push a git tag / create a GitHub Release `vX.Y.Z`
and `.github/workflows/publish-pypi.yml` publishes to PyPI via
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (no
secrets). Versions live in `pyproject.toml` and `src/ghlike/__init__.py`.

License: MIT.

---

# Español

## Qué hace

`ghlike owner/repo` da una estrella a un repositorio de GitHub usando la
sesión ya iniciada en tu navegador. Sin `gh auth login`, sin personal access
tokens, sin OAuth: si estás logueado en GitHub en Brave, Chrome, Chromium,
Edge, Vivaldi u Opera (nativo o snap), funciona directamente.

Cómo: busca el perfil del navegador con tu sesión de github.com → copia la
tienda de cookies **cifrada** a un perfil desechable → abre tu propio
navegador en modo invisible con un puerto de depuración privado → pulsa el
botón de Star real (GitHub gestiona su propio CSRF) → verifica → cierra el
navegador y borra el perfil. Las cookies nunca se descifran ni salen de tu
máquina.

## Instalación

```bash
pipx install ghlike        # o: pip install --user ghlike
```

Requiere Python ≥ 3.9 y un navegador de la familia Chromium con sesión de
github.com. Firefox no está soportado (sin CDP).

## CLI

```bash
ghlike owner/repo            # dar star (idempotente)
ghlike https://github.com/o/r  # URLs completas valen
ghlike owner/repo -c         # solo consultar estado
ghlike owner/repo -u         # quitar star
ghlike owner/repo --toggle   # invertir
ghlike --list                # sesiones de GitHub detectadas
ghlike --browser brave o/r   # forzar un navegador (estricto)
ghlike o/r --json            # salida para scripts
```

Códigos de salida: `0` ok (también "nada que hacer") · `1` error genérico ·
`2` sin sesión de github.com · `3` repo no encontrado.

## Librería

```python
from ghlike import star, unstar, check, toggle

star("vercel/next.js")                 # -> {"repo": ..., "changed": True, ...}
state = check("vercel/next.js")        # -> {"repo": ..., "after": True/False, ...}
unstar("vercel/next.js", browser="brave")
```

Excepciones: `NoSessionError`, `RepoNotFoundError`, `GhlikeError`.

## Limitaciones

- Solo navegadores Chromium; Firefox no (sin CDP).
- Cada operación tarda ~8–12 s (navegador invisible + carga). Es el precio
  del enfoque sin tokens.
- Depende del botón de Star de GitHub; si cambia el markup, se arregla con
  una línea (`STATE_JS` en `src/ghlike/core.py`).

## Desarrollo

```bash
PYTHONPATH=src python3 -m ghlike.cli --list
python -m pip wheel . --no-deps --no-build-isolation -w dist
```

La publicación es automática: crea un Release `vX.Y.Z` en GitHub y
`.github/workflows/publish-pypi.yml` publica en PyPI con Trusted Publishing
(sin secrets). Las versiones viven en `pyproject.toml` y
`src/ghlike/__init__.py`.

Licencia: MIT.
