From 4216b9a9278815a9f19f9496827578303af5a3be Mon Sep 17 00:00:00 2001 From: Andrea Collet Date: Tue, 24 Nov 2026 11:39:48 +0100 Subject: [PATCH 1/2] docs: fill functional and technical documentation scaffolding Replaces TODO placeholders in intent.md, README.md, CONTRIBUTING.md, SECURITY.md and docs/{architecture,deployment,testing,security/threat-model}.md with real content matching the current single-maintainer, read-only, bring-your-own-session CLI. Scopes intent.md to manual (not automated) profile read/edit and future swipe actions. Co-Authored-By: Claude Sonnet 5 --- .env.example | 14 +++++++++++ CONTRIBUTING.md | 10 +++++--- README.md | 19 ++++++++++---- SECURITY.md | 5 ++-- docs/architecture.md | 47 ++++++++++++++++++++++++++++++++--- docs/deployment.md | 25 ++++++++++++++++--- docs/security/threat-model.md | 7 +++++- docs/testing.md | 21 +++++++++++----- intent.md | 33 ++++++++++++++++++++---- 9 files changed, 151 insertions(+), 30 deletions(-) diff --git a/.env.example b/.env.example index b55ac6c..a303305 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,16 @@ # Copy to .env (git-ignored). Names and safe placeholders only: never real credentials, # tokens or production endpoints. + +# Where the saved session lives. Default: OS config dir (~/.config/hinge-cli/session.json +# or %APPDATA%\hinge-cli\session.json). Leave unset unless you need a non-default path. +HINGE_SESSION_FILE= + +# Password-manager reference in place of a session file, e.g. op://Private/hinge/session +# or bw://hinge-session. When set, nothing is written to disk. See docs/auth.md. +HINGE_SESSION_REF= + +# Only needed for `hinge inspect` (Appium/WebDriverAgent exploration), not for tier/limits/auth. +HINGE_APPIUM_URL=http://127.0.0.1:4723 +HINGE_UDID= +HINGE_BUNDLE_ID=co.hinge.mobile.ios +HINGE_TEAM_ID= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00d376a..f30c363 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,8 +19,12 @@ Enable the template once: `git config commit.template .gitmessage.txt`. - Dependency changes reviewed explicitly (new packages, version bumps, lockfile diff). ## Review roles -- Reviewer: TODO (who reviews, and who may approve changes to sensitive paths — see CODEOWNERS where supported). -- Single-maintainer repository: document how self-review is done (checklist in the PR template, cooling-off before merge). +- Reviewer: @ifthenelse approves all changes; CODEOWNERS requires their review on every path, and on + `.github/` and `docs/security/` specifically. +- Single-maintainer repository: self-review follows the PR requirements above (verify green, tests + updated, docs/ADR updated) plus a 24h cooling-off before merging anything touching `src/secrets.ts`, + `src/session-store.ts`, `src/api.ts`, or `.github/workflows/`. ## Escalation -TODO: whom to contact for blocked reviews, security concerns or production incidents. +Security concerns: see [SECURITY.md](SECURITY.md). Blocked reviews or anything else: open a GitHub +issue — there is no other channel for this single-maintainer project. diff --git a/README.md b/README.md index 7a41b5a..657c8a5 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,21 @@ # hinge-cli -> TODO: one paragraph — what this is and who it is for. Business intent lives in [intent.md](intent.md). +An unofficial, read-only command-line client for your own Hinge account. It talks directly to +Hinge's real HTTP API (reverse-engineered, not UI automation) using a session you capture from your +own phone, and reports things the app shows but doesn't let you script: your subscription tier, +like/rose limits. For members who want to check or audit their own account from a terminal or a +script, on Windows, macOS or Linux. Business intent lives in [intent.md](intent.md). | | | | --- | --- | | Owner | Andrea Collet | -| Support | TODO: team channel / contact | +| Support | GitHub issues on this repository (single-maintainer project — see CONTRIBUTING.md) | ## Architecture -TODO: short summary. Details: [docs/architecture.md](docs/architecture.md); decisions: [docs/adr/](docs/adr/). +A single local binary (`hinge`) calls `prod-api.hingeaws.net` directly with a member-supplied +session; there is no server component. Full summary: [docs/architecture.md](docs/architecture.md); +decisions: [docs/adr/](docs/adr/). ## Prerequisites @@ -23,13 +29,16 @@ TODO: short summary. Details: [docs/architecture.md](docs/architecture.md); deci ## Commands - Verify everything: `scripts/verify` +- Build: `npm run build` · Import a captured session: `hinge auth import ` · Check it: + `hinge auth status` · Read your account: `hinge tier`, `hinge limits`. Capturing a session in the + first place is a manual, documented process: [docs/auth.md](docs/auth.md). ## Environment model | Environment | Purpose | Notes | | --- | --- | --- | -| local | development | configured through `.env` (see `.env.example`) | -| TODO | TODO | TODO | +| local | development, and the only environment this tool runs in | configured through `.env` (see `.env.example`); no `.env` is required to build/test, only to import/use a real session | +| npm registry | distribution | versioned release, see docs/deployment.md — no staging/production split, this is a local CLI | ## Deployment and recovery diff --git a/SECURITY.md b/SECURITY.md index c17ac8e..e98c291 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,8 +7,9 @@ | older | no | ## Reporting a vulnerability -TODO: reporting route (private advisory or security mailbox). Do not open public issues for vulnerabilities. -We aim to acknowledge reports within TODO business days. +Use GitHub's private vulnerability reporting for this repository (Security tab → "Report a +vulnerability"). Do not open public issues for vulnerabilities. We aim to acknowledge reports within +5 business days. ## Secure development expectations - No credentials, tokens or confidential incident data in the repository, issues or this file. diff --git a/docs/architecture.md b/docs/architecture.md index 937f12f..75f604a 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -3,13 +3,52 @@ One canonical location for the current architecture. Link to authoritative diagrams rather than copying them. ## System context -TODO: what the system does, its users and neighbouring systems. +hinge-cli is a single Node.js/TypeScript binary (`hinge`) that a Hinge member runs locally. It makes +direct HTTPS calls to Hinge's own backend (`prod-api.hingeaws.net`) using session headers the member +captured from their own phone — it does not drive the Hinge app's UI and does not go through Appium +at runtime. Appium/WebDriverAgent is a one-time exploration tool (`hinge inspect`), not part of the +request path. There is no server component and no multi-user backend: each install talks only to +Hinge's API and to the member's own secret store. + +``` +member's terminal ── hinge ──▶ src/cli.ts + │ + ┌─────────────┼─────────────┐ + ▼ ▼ ▼ + session-store.ts api.ts session.ts (Appium, `inspect` only) + │ │ + ▼ ▼ + secrets.ts prod-api.hingeaws.net (Hinge's real API) + (op:// bw:// keychain:// cmd:// env://) +``` ## Components and boundaries -TODO: components, responsibilities, ownership. +- **`src/cli.ts`** — commander-based entrypoint; owns argument parsing, the `--json` flag, and the + top-level error-to-exit-code mapping. No business logic lives here beyond wiring. +- **`src/api.ts`** — the only module that talks to Hinge. `call()` issues authenticated GETs and + normalizes 401/403/non-2xx into plain errors that never echo the token. `describeTier()` maps the + real `/store/v2/account` response shape into `TierInfo`. +- **`src/session-store.ts`** — owns where a session lives (file or password-manager reference), + validates untrusted JSON on import (`parseSession`, header allowlist, `authorization` required), + and the cross-platform config-path logic. +- **`src/secrets.ts`** — resolves `scheme://` references (`env://`, `op://`, `bw://`, `keychain://`, + `cmd://`) to a secret value. The only module allowed to shell out for credentials. +- **`src/session.ts`** — Appium/WebDriverAgent connection used solely by `hinge inspect`, the + exploration command used while reverse-engineering the API. Not used by `tier`/`limits`/`auth`. ## Data flows and integration contracts -TODO: main flows; contracts live in `docs/api/` and `docs/data-contracts/`. +1. **Capture (manual, one-time, outside the CLI):** member runs mitmproxy against their own phone + with `tools/hinge_token.py` to extract session headers, per `docs/auth.md`. +2. **Import:** `hinge auth import ` → `session-store.parseSession` (validates/allowlists + headers) → `saveSession` (0600 file, or writes nothing if `HINGE_SESSION_REF` is set) → source + file deleted by default. +3. **Authenticated call:** `hinge tier`/`limits` → `loadSession()` (file or `resolveSecret` via + `HINGE_SESSION_REF`) → `api.call(path, session)` → Hinge REST API → response mapped and printed. + +Endpoint inventory, headers observed, and the (unimplemented) login/attestation sequence: +[`docs/api-inventory.md`](api-inventory.md). ## Trust boundaries -TODO: see [threat model](security/threat-model.md). +The member's captured session header is the only secret in the system; everything downstream of +`loadSession()` treats it as sensitive and no code path logs or echoes it (see `secret` command, +which reports length only). See the [threat model](security/threat-model.md). diff --git a/docs/deployment.md b/docs/deployment.md index 4e96866..9bd891c 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,15 +1,32 @@ # Deployment +hinge-cli has no server and no hosted environment — "deployment" means publishing a versioned npm +package that members install locally. There is no staging/production split for a local CLI. + ## Environments and promotion path | Environment | Purpose | Promotion from | Approval | | --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +| local (dev) | member's own machine, running against the real Hinge API with their own session | n/a | n/a | +| npm registry | distributable, versioned release | `main` branch, tagged | maintainer (self-review; single-maintainer repo, see CONTRIBUTING.md) | ## Release -TODO: release command(s); the version comes from its single source (see AGENTS.md). +1. `npm version ` on `main` (bumps `package.json`, the single version source). +2. `npm run build` (`tsc -p tsconfig.build.json`) to produce `dist/`. +3. `scripts/verify` must be green. +4. `git push --follow-tags`, then `npm publish` (not yet automated — no publish job exists in + `.github/workflows/`; this is a manual step today, tracked as an open item below). ## Smoke tests -TODO +After install (`npm install -g hinge-cli` or `npm link`): +- `hinge doctor` — checks Appium reachability (only relevant if `inspect` will be used). +- `hinge auth status` — confirms a session, once imported, is accepted by Hinge's API. +- `hinge tier` — confirms a real authenticated call round-trips correctly. ## Rollback -Conditions: TODO. Steps: TODO. +There is nothing running to roll back (no server). If a published npm version is broken: +- `npm deprecate hinge-cli@ ""` to warn installers off it. +- Publish a patched version; members on the broken version re-run `npm install`. + +## Open item +No CI job publishes to npm yet, and CI/tests currently run on `ubuntu-latest` only even though the +tool targets Windows/macOS/Linux — a Windows/macOS matrix job is not yet in `.github/workflows/ci.yml`. diff --git a/docs/security/threat-model.md b/docs/security/threat-model.md index 2aa52d1..bab680e 100644 --- a/docs/security/threat-model.md +++ b/docs/security/threat-model.md @@ -4,4 +4,9 @@ Update when architecture or exposure changes. | Asset | Actor | Entry point | Trust boundary | Abuse case | Mitigation | Residual risk | | --- | --- | --- | --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | TODO | TODO | TODO | +| Hinge session header (bearer-equivalent) | Malware/other local process on the member's machine | Session file on disk / env var / password-manager process | OS file permissions and OS process boundary | Local process reads the session file and impersonates the member to Hinge | File written mode 0600, directory 0700 (`session-store.ts`); `HINGE_SESSION_REF` keeps the secret out of the filesystem entirely, resolved on demand via the member's password manager | Mode bits are a no-op on Windows (relies on per-user `%APPDATA%` ACL instead) — documented, not yet hardened to the OS credential store | +| Hinge session header | Shoulder-surfing / shell history / CI logs | `hinge secret `, error messages | CLI output boundary | Secret value printed to stdout/stderr or committed to logs | `secret` command reports length only, never the value; `api.ts` error paths are built to never interpolate the header | None known; relies on no future code path echoing the header — worth a lint rule if the codebase grows | +| Captured session file | The member, during capture | `tools/hinge_token.py` output file | Local filesystem | File left on disk after import, later committed or backed up | `hinge auth import` deletes the source file by default (`--keep` opts out); documented cleanup steps in `docs/auth.md` | Depends on the member actually using `auth import` rather than hand-copying the header elsewhere | +| Other Hinge members' data | The CLI author, during API reverse-engineering | mitmproxy capture of the member's own app traffic | Hinge's platform boundary | Capture incidentally includes another member's profile/message content relayed through the member's own session | Captures were deleted after use; `docs/api-inventory.md` records only endpoints/headers/ordering, no bodies, tokens or third-party content | None for past captures (deleted); future captures must follow the same discipline — not yet enforced by tooling, only by process | +| Hinge's production API | This project's own CI | GitHub Actions runners | Network boundary to a third party | An automated "pentest" workflow sends attack traffic to Hinge's live infrastructure | No such job exists; `security.yml` explicitly scopes to static/dependency scanning instead (see comment at the top of that file) | None — this is a closed decision, not a residual risk | +| npm dependencies | Supply chain | `package.json` / lockfile | Build boundary | A compromised or vulnerable transitive dependency ships in a release | Dependabot (npm + actions, weekly), `npm audit --audit-level=high` in CI, CodeQL static analysis | Standard supply-chain residual risk; mitigated, not eliminated | diff --git a/docs/testing.md b/docs/testing.md index becd6f4..48bd966 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -1,17 +1,26 @@ # Testing ## Strategy -TODO: what is covered by which kind of test. +Unit tests cover the modules that don't need a live Hinge session or a real phone: secret resolution, +session parsing/storage, and the API client's response mapping (success, 401, 500, free-tier fallback) +against fake `fetch` implementations. Nothing in CI calls Hinge's real API or Appium — those require +live, member-specific state (a captured session, a connected iPhone) that isn't safe or reproducible +in CI. ## Suites | Suite | Location | Speed | Run with | | --- | --- | --- | --- | -| unit | `tests/unit/` | fast | `scripts/verify` | -| integration | TODO | TODO | TODO | -| e2e | TODO | slow, opt-in | TODO | +| unit | `test/*.test.ts` | fast (<1s) | `npm test` / `scripts/verify` | +| integration (live Hinge API) | none yet | — | manual: `hinge tier` against a real imported session | +| e2e (Appium/`hinge inspect`) | none | slow, opt-in | manual, requires a connected iPhone + WebDriverAgent | ## Fixtures and environments -Fixtures are kept apart from production data. Tests that touch live or state-changing systems are opt-in and isolated. +Unit tests use literal fixture objects (fake sessions, fake `Account` JSON shapes) inline in +`test/core.test.ts` — no fixtures touch a real captured session file. Tests that would touch a live +or state-changing system (a real Hinge session, a real phone) are intentionally not automated; they +are manual smoke checks (see `docs/deployment.md`). ## Definition of a passing release -`scripts/verify` green in CI, plus: TODO. +`scripts/verify` green in CI (typecheck + `node --test`), plus: a manual `hinge auth status` / +`hinge tier` check against one real account before publishing, since no automated test exercises +the real API contract. diff --git a/intent.md b/intent.md index c1d76ab..9a2c786 100644 --- a/intent.md +++ b/intent.md @@ -3,18 +3,41 @@ Durable statement of intent. It is not a requirements backlog. ## Business problem -TODO: the problem and who has it. +Hinge has no official API client and no data-export tooling for a member's own account: checking +subscription tier, remaining likes, or automating anything beyond what the mobile app's UI exposes +requires manually tapping through the app. There is no way to script, audit, or integrate a member's +own Hinge usage from a terminal or CI job. ## Intended outcomes -- TODO +- A member can read, edit and check their own profile and account (subscription tier, like/rose + limits) from the command line, on Windows, macOS or Linux, without opening the mobile app. +- Session credentials are supplied by the member (captured from their own device) and stored through + a password manager or a local file with restrictive permissions — never hardcoded, never shared + across users. +- The reverse-engineered API surface is documented (`docs/api-inventory.md`) so the client's behaviour + is auditable rather than opaque. +- **Future (not yet built):** browse Discover/Standout candidates from the terminal — rendering their + photos inline (Kitty/iTerm2/Sixel graphics protocol where supported, ASCII art otherwise) — and let + the member manually like or pass. This is a manual, one-decision-at-a-time interface change (a + different client for the same human decision the app already asks for), not automation of the + decision itself. ## Non-goals -- TODO +- No AI- or script-driven decision-making on who to like/pass/message — every like/pass/message + action is a single explicit command run by the member for one candidate; there is no "auto-swipe" + or "auto-match" mode, and none is planned. +- No automated/bulk messaging, mass-liking, or any action that mimics bot-like use of the platform. +- No multi-account or on-behalf-of-other-users operation — this is a single-member, bring-your-own-session tool. +- No reimplementation of Hinge's phone+SMS login flow in this version — it requires passing Apple + App Attest, which a plain CLI cannot satisfy (see `docs/api-inventory.md`, "Open risk for `hinge auth login`"). +- No live testing (security or otherwise) against Hinge's production infrastructure from this repo's CI. ## Success measures | Measure | Target | Source | | --- | --- | --- | -| TODO | TODO | TODO | +| `hinge tier` / `hinge limits` return correct, current account data | Matches what the app shows | Manual comparison against the Hinge app | +| Session import works without a captured credential ever being committed or logged | 0 leaked secrets | `gitleaks` in CI, manual review | +| CLI runs unmodified on Windows, macOS, Linux | `scripts/verify` green on all three | CI matrix (currently ubuntu-only — see open item in `docs/testing.md`) | ## Accountable owners -- Andrea Collet — TODO: role +- Andrea Collet — sole maintainer; owns design, security review, and release decisions. From 612bc669f68ce2378dfafee45d897581865cce78 Mon Sep 17 00:00:00 2001 From: Andrea Collet Date: Fri, 27 Nov 2026 18:52:07 +0100 Subject: [PATCH 2/2] chore: ignore local agent tooling and launch artifacts Co-Authored-By: Claude Sonnet 5.5 --- .gitignore | 7 +++++-- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f3f4d0c..62646ad 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,8 @@ DerivedData/ xcuserdata/ # AI tooling (history is kept in ~/.claude and ~/.codex, not in the repo) .specstory/ -.claude/settings.local.json -.claude/worktrees/ + +# Local agent tooling and launch artifacts +.claude/ +.codex/ +launches/ diff --git a/CHANGELOG.md b/CHANGELOG.md index cd27b83..036ae08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ rather than editing several version sources by hand. Format: [Keep a Changelog]( ## [Unreleased] +## [0.1.4] - 2026-11-27 +### Changed +- `.gitignore` now ignores `.claude/`, `.codex/` and `launches/` (local agent tooling and launch-pipeline + artifacts), replacing the narrower `.claude/` entries. + ## [0.1.3] - 2026-11-25 ### Added - Project logo (`.github/assets/hinge-cli-symbol-{black,white}.svg`) and a light/dark README banner diff --git a/package-lock.json b/package-lock.json index 4cd4876..8bca39e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hinge-cli", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hinge-cli", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "dependencies": { "commander": "^15.1.0", diff --git a/package.json b/package.json index 47ac507..f2204ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hinge-cli", - "version": "0.1.3", + "version": "0.1.4", "description": "Command-line client for your own Hinge account, built on its reverse-engineered HTTP API.", "type": "module", "license": "MIT",