From 7a08b897994764af1c2e56f47dfab0dbfc8d004e Mon Sep 17 00:00:00 2001 From: Dasemu Date: Sun, 18 Oct 2026 15:02:58 +0200 Subject: [PATCH] chore: bootstrap Claude setup Add root CLAUDE.md, docs/ (game-rules.md, release.md), LESSONS.md and .env.example; trim README.md to a landing page linking to docs/. No linter, test runner or formatter is configured for this static HTML/CSS/JS project, so no .claude/settings.json hooks or CI workflows were added: there is nothing to run. CI (asset versioning + Android APK build/release) already exists in .gitea/workflows and .github/workflows and is documented in docs/release.md as-is, since there is no development branch to drive the standard version.yml flow. Co-Authored-By: Claude Sonnet 5 --- .claude/bootstrap-version | 1 + .env.example | 5 +++ CLAUDE.md | 29 +++++++++++++++ LESSONS.md | 5 +++ README.md | 74 +++++---------------------------------- docs/game-rules.md | 34 ++++++++++++++++++ docs/release.md | 8 +++++ 7 files changed, 90 insertions(+), 66 deletions(-) create mode 100644 .claude/bootstrap-version create mode 100644 .env.example create mode 100644 CLAUDE.md create mode 100644 LESSONS.md create mode 100644 docs/game-rules.md create mode 100644 docs/release.md diff --git a/.claude/bootstrap-version b/.claude/bootstrap-version new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/.claude/bootstrap-version @@ -0,0 +1 @@ +2 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6e52c1b --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +# This project is a static, backend-free web game (see README.md). +# It reads no environment variables at runtime or build time. +# +# CI secrets (configured in Gitea/GitHub, not here) for the Android release build: +# KEYSTORE_BASE64, KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD, GITEA_TOKEN diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..704c224 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,29 @@ +# CLAUDE.md + +## Overview +Role-based impostor-style party game. 100% static (vanilla HTML/CSS/JS, no backend, no build step, no framework) served from `www/`, packaged as an Android app via Capacitor for distribution. + +## Commands +- Dev: `python -m http.server 8000` from the repo root, then open `http://localhost:8000/www/` (a static server is required so `fetch` can load the `.txt` word-pool files). +- Test: none configured. +- Lint: none configured. +- Build (Android): `npx cap sync android` then `cd android && ./gradlew assembleDebug` (or `assembleRelease` with a keystore; see `docs/release.md`). + +## Architecture +Plain JS game logic in `www/script.js`, markup in `www/index.html`, styles in `www/styles.css`. Word pools live as `.txt` files in `www/word-pools/`, indexed by `manifest.json`; two pools are embedded in `script.js` for full offline play, the rest are fetched at runtime. Game state persists in `localStorage`. See `docs/game-rules.md` for full rules and the word-pool format, and `docs/release.md` for the CI/CD pipeline. + +## Conventions +- No build tooling: edit `www/*.js|css|html` directly; there is no transpilation or bundling step. +- `version-assets.sh` content-hashes `www/script.js`, `www/styles.css`, `www/logo.png` and rewrites references in `www/index.html`; it runs in CI (`.gitea/workflows/1-version-assets.yml`), not locally. +- Game copy and word pools are in Spanish; code and comments are in English. + +## Workflow quirks +- There is no `development` branch; `main` is the only long-lived branch. Work on a feature branch and push it; ask before merging to `main`. +- No automated semver bump workflow exists for this repo (unlike the global CLAUDE.md default). `package.json`'s `version` and `CHANGELOG.md` are updated by hand. + +## Deployment +Not a deployed web service: ships as an Android APK attached to a rolling `latest` release. See `docs/release.md` for the full pipeline (asset versioning + Gradle build + release upload, via Gitea Actions and a mirrored GitHub Actions workflow). + +## Gotchas +- Opening `www/index.html` directly via `file://` breaks the remote word pools (`fetch` needs `http(s)://`); always serve it. +- `android/`, `*.keystore` and `keystore.properties` are gitignored; the Android release build needs `KEYSTORE_BASE64`/`KEYSTORE_PASSWORD`/`KEY_ALIAS`/`KEY_PASSWORD` CI secrets or it silently falls back to a debug build. diff --git a/LESSONS.md b/LESSONS.md new file mode 100644 index 0000000..1e66bae --- /dev/null +++ b/LESSONS.md @@ -0,0 +1,5 @@ +# Lessons + +Recurring mistakes and how to avoid them. Read before starting a task; add an entry whenever a mistake repeats. + +(No recurring mistakes recorded yet.) diff --git a/README.md b/README.md index d8e1080..a9de9e1 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,16 @@ # Impostor Game (offline) ## What is it? -Role-based impostor-style game for mobile, 100% in the browser with no backend. Uses localStorage so a reload doesn't lose the match. Features **impostor-specific words** for each civilian word to make the game more challenging! +Role-based impostor-style game for mobile, 100% in the browser with no backend. Uses localStorage so a reload doesn't lose the match. Features **impostor-specific words** for each civilian word to make the game more challenging! 22 word-pool categories are available, and you can select several at once. ## Structure -- `index.html`: main UI. -- `styles.css`: mobile-first, no-scroll optimized styles. -- `script.js`: game logic (roles, timers, voting, tiebreaks, word pools with impostor variants). -- `word-pools/`: 22 word pools in `.txt` + `manifest.json`. +- `www/index.html`: main UI. +- `www/styles.css`: mobile-first, no-scroll optimized styles. +- `www/script.js`: game logic (roles, timers, voting, tiebreaks, word pools with impostor variants). +- `www/word-pools/`: 22 word pools in `.txt` + `manifest.json`. +- `android/`: Capacitor-generated Android project. -## Available pools (22 total) - -### Local pools (work offline, embedded in code): -- 🌿 Animales y Naturaleza (88 words) — `animales_naturaleza.txt` -- 🏠 Objetos Cotidianos (99 words) — `objetos_cotidianos.txt` - -### Remote pools (require internet connection): -- 🛍️ Marcas y Empresas (81 words) -- 💼 Profesiones y Trabajos (94 words) -- 🍕 Comida y Bebidas (145 words) -- 🌍 Lugares del Mundo (89 words) -- ⚽ Deportes (97 words) -- 🎬 Películas y Series (118 words) -- 📚 Escuela y Educación (114 words) -- 💻 Tecnología e Internet (63 words) -- 🚗 Vehículos y Transporte (97 words) -- 🎸 Instrumentos Musicales (106 words) -- 🎮 Videojuegos (128 words) -- 🎌 Personajes de Anime (133 words) -- 🏰 Personajes de Disney (133 words) -- 🎤 Artistas Latinos (116 words) -- 💎 Marcas de Lujo (108 words) -- 🦸 Personajes de Ficción (124 words) -- 🫀 Cuerpo Humano (129 words) -- 🏖️ Playa y Verano (69 words) -- 💕 Amor y Romance (98 words) -- 🎄 Navidad y Fiestas (88 words) - -**New feature:** You can select **multiple pools** simultaneously to mix categories! - -`.txt` format: `# Header` on first line (optional), then `civilian_word|impostor_word` pairs, one per line. - -## Key rules -- Defaults: up to 10 players; impostors by player count (<=5 →1, 6-7 →2, >7 →3) and never more than half. -- Time defaults: 5 min with 4 or fewer players, up to 15 min with 10; deliberation = 1/3 (rounded). -- No self-voting. Max executions = number of impostors. -- Tie on execution slots: 1 extra minute of deliberation and a new vote only among tied players; if tie persists, impostors win. -- Starting player and direction (clockwise/counter-clockwise) are random. +See `docs/game-rules.md` for the full rules and word-pool format, and `docs/release.md` for how builds and releases work. ## How to run (offline) Use any static file server so `fetch` can read the `.txt` files (needed if opening via `file://`). Example with Python: @@ -59,27 +23,5 @@ python -m http.server 8000 Open in browser: `http://localhost:8000` -## Word format with impostor variants -Each word pair consists of: -- **Civilian word**: What most players see -- **Impostor word**: A related but different word that impostors see - -Example from `animales_naturaleza.txt`: -``` -Oso|Pez -Camello|Arena -Elefante|Safari -``` - -This makes the game more interesting as impostors have a related word to work with! - -## Add new pools -1) Create a `.txt` in `word-pools/` with optional header `# Name` and pairs `civilian|impostor` per line. -2) Add an entry in `word-pools/manifest.json` with `id`, `name`, `emoji`, `count`, and optionally `local: true`. -3) (Optional) To make it work offline, add an embedded version in `script.js` `EMBEDDED_POOLS` array. - -## Notes -- State is saved in `localStorage` (`impostorGameStateV2`). Use "New match" to clear it. -- Mobile optimized: **No scrolling required** on setup screen, reveal via swipe or tap, compact adaptive UI. -- Pool selection grid has vertical scroll when needed to fit all 22 categories. +For Android, see `docs/release.md`. diff --git a/docs/game-rules.md b/docs/game-rules.md new file mode 100644 index 0000000..2c62451 --- /dev/null +++ b/docs/game-rules.md @@ -0,0 +1,34 @@ +# Game rules + +- Defaults: up to 10 players; impostors by player count (<=5 -> 1, 6-7 -> 2, >7 -> 3) and never more than half. +- Time defaults: 5 min with 4 or fewer players, up to 15 min with 10; deliberation = 1/3 of the match time (rounded). +- No self-voting. Max executions = number of impostors. +- Tie on execution slots: 1 extra minute of deliberation and a new vote only among tied players; if the tie persists, the impostors win. +- Starting player and direction (clockwise/counter-clockwise) are random. +- State is saved in `localStorage` (`impostorGameStateV2`). Use "New match" to clear it. + +## Word pools + +Each word pair consists of: +- **Civilian word**: what most players see. +- **Impostor word**: a related but different word that impostors see, to keep them guessing. + +Example from `www/word-pools/animales_naturaleza.txt`: +``` +Oso|Pez +Camello|Arena +Elefante|Safari +``` + +22 pools are available in `www/word-pools/*.txt`, listed in `www/word-pools/manifest.json`. Two of them (`animales_naturaleza`, `objetos_cotidianos`) are embedded in `script.js` (`EMBEDDED_POOLS`) so the game works fully offline; the rest are fetched over the network and require a connection. Players can select multiple pools at once; words are drawn randomly from the combined set. + +### Add a new pool + +1. Create a `.txt` file in `www/word-pools/` with an optional header `# Name` on the first line, then `civilian_word|impostor_word` pairs, one per line. +2. Add an entry in `www/word-pools/manifest.json` with `id`, `name`, `emoji`, `count`, and optionally `local: true`. +3. To make it work offline, also add an embedded version in `script.js`'s `EMBEDDED_POOLS` array. + +## UI notes + +- Mobile optimized: no scrolling required on the setup screen, reveal via swipe or tap, compact adaptive UI. +- The pool selection grid scrolls vertically when needed to fit all 22 categories. diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 0000000..b57f773 --- /dev/null +++ b/docs/release.md @@ -0,0 +1,8 @@ +# Release pipeline + +This repo has its own CI/CD, independent of the global CLAUDE.md `version.yml` convention (there is no `development` branch; everything ships from `main`): + +1. **Asset versioning** (`.gitea/workflows/1-version-assets.yml`, mirrored by nothing on GitHub): on push to `main` touching `www/script.js`, `www/styles.css`, `www/logo.png` or `www/index.html`, runs `version-assets.sh` to content-hash those files (e.g. `script.0bc8c210.js`), rewrites the references in `www/index.html`, and commits the result with `[skip ci]`. +2. **Android build** (`.gitea/workflows/2-build-apk.yml` and the equivalent `.github/workflows/build-apk.yml`): on push to `main` (or after step 1 finishes, on Gitea), builds the Capacitor Android app with Gradle (release build if a keystore secret is configured, debug otherwise) and publishes/updates a `latest` release asset (`impostor-game.apk`) via the Gitea/GitHub API. + +`package.json`'s `version` field and `CHANGELOG.md` are maintained by hand; there is no automated semver bump workflow for this repo.