Pre-launch: CI, community health files, AGENTS.md, screenshots, OG tags

- .github/workflows/ci.yml — npm ci + npm run build on push/PR, with the
  PokéAPI snapshot cached so only the first run pays the fetch cost.
- .github/dependabot.yml — weekly npm, monthly actions, grouped.
- .github/ISSUE_TEMPLATE/ — bug report, feature request, config with
  discussion / upstream-data links.
- CODE_OF_CONDUCT.md — Contributor Covenant 2.1 (contact method is a
  placeholder to fill in).
- SECURITY.md — private reporting + the known dev-only Vite/esbuild advisory.
- AGENTS.md — machine-facing version of CONTRIBUTING for AI coding agents.
- docs/screenshots/ + a strip in the README (resized + pngquant'd, ~240 KB).
- public/og.png + Open Graph / Twitter card meta in index.html.
- .nvmrc (20); gitignore .claude/ .idea/ .vscode/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Ve7HLspzeG2xDPtJQ8vmu
This commit is contained in:
chris 2026-09-10 11:14:01 -04:00
parent 31cc076c0c
commit c7c0f9b6da
18 changed files with 392 additions and 1 deletions

24
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: Bug report
about: Something isn't working right
title: ""
labels: bug
assignees: ""
---
**What happened**
<!-- and what you expected instead -->
**Steps to reproduce**
1.
2.
3.
**Context**
- Browser / OS:
- Installed as a PWA or in a browser tab:
- Selected game (if relevant):
- Console errors (DevTools → Console):
**Screenshot / clip**
<!-- optional but very helpful -->

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Question or discussion
url: https://github.com/OWNER/pocketdex/discussions
about: Ask a question or float an idea before opening an issue.
- name: PokéAPI data looks wrong
url: https://github.com/PokeAPI/pokeapi/issues
about: Pocketdex reads its data from PokéAPI — report data errors upstream.

View File

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea
title: ""
labels: enhancement
assignees: ""
---
**The idea**
<!-- What would you like Pocketdex to do? -->
**Why**
<!-- What problem does it solve, or what does it make easier? -->
**Notes**
<!-- Is the data in PokéAPI? Does it need a new snapshot field? Any prior art
in other Pokédex tools? -->

18
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
groups:
workbox:
patterns:
- "workbox-*"
dev-dependencies:
dependency-type: development
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly

33
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
# The build's `prebuild` step fetches a data snapshot from PokéAPI.
# Cache it so only the first run (or a change to the script) pays that
# cost; CI only needs *a* snapshot to prove the build compiles.
- name: Cache PokéAPI snapshot
uses: actions/cache@v4
with:
path: src/data/snapshot.json
key: pokeapi-snapshot-${{ hashFiles('scripts/build-snapshot.mjs') }}
- run: npm run build

5
.gitignore vendored
View File

@ -5,5 +5,10 @@ dev-dist
*.local *.local
.vite .vite
# Local editor / tool state
.claude/
.idea/
.vscode/
# Generated at build time from PokéAPI. Run `npm run snapshot` to (re)create. # Generated at build time from PokéAPI. Run `npm run snapshot` to (re)create.
src/data/snapshot.json src/data/snapshot.json

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
20

97
AGENTS.md Normal file
View File

@ -0,0 +1,97 @@
# AGENTS.md
Guidance for AI coding agents working in this repo. Humans: see
[CONTRIBUTING.md](CONTRIBUTING.md) — this file is the short, machine-facing
version of the same rules.
## What this is
Pocketdex — an offline-first Pokédex / team builder / save-file tracker.
**Vanilla JS, no UI framework.** Vite 5 + `vite-plugin-pwa` (Workbox,
injectManifest). All data comes from [PokéAPI](https://pokeapi.co/).
## Setup & commands
```bash
npm install
npm run snapshot # build src/data/snapshot.json from PokéAPI (git-ignored; required before first build/dev)
npm run dev # dev server, http://localhost:5173
npm run build # runs `snapshot` (prebuild) then builds to dist/
npm run preview # serve the production build — REQUIRED to test the service worker / offline / install
```
- Node **20+**.
- There is **no lint or test command** and **no test suite**. The build
(`npm run build`) is the only automated check — it must pass. It runs
esbuild over every module, so it catches syntax and import errors.
- `npm run snapshot -- --force` rebuilds the snapshot even if it's fresh.
## Project structure
| Path | What |
| --- | --- |
| `src/main.js` | boot: theme, nav, router, SW registration, install prompt |
| `src/router.js` | hash router; `routes` array; each view is `() => Promise<Node>` |
| `src/views/*.js` | one file per route (`DexGrid`, `PokemonDetail`, `TeamView`, …) |
| `src/components/*.js` | reusable DOM pieces (`Card`, `Sprite`, `TypeChip`, `CompareTable`, …) |
| `src/store/*.js` | `createStore()` state, persisted to `localStorage` under `pdx.*` |
| `src/data/*.js` | snapshot loader, pokedex resolver, lazy PokéAPI client, type chart, natures |
| `src/lib/*.js` | app-agnostic helpers (`dom`, `anim`, `damage-calc`, `savedex`, `swipe`, …) |
| `scripts/build-snapshot.mjs` | the only thing that calls PokéAPI at build time |
| `src/styles/tokens.css` | palette, type colours, the five themes |
| `src/styles/layout.css` | everything else |
## Conventions
- **Build DOM with `el()`** from `src/lib/dom.js``el(tag, props, ...children)`.
No template-string HTML, no `innerHTML`, except the deliberate `html:` prop
for trusted inline SVG.
- **Stores**: `createStore(key, initial)``{ get, set, subscribe, replace }`.
`set(fn)` **replaces** state (it does not merge) — spread `...s` yourself.
In views, `subscribe()` and call the returned unsub in
`onTeardown(viewNode, off)`.
- **Everything is game-aware.** The selected game lives in
`settings.get().versionGroup`. If you touch typings, effectiveness,
learnsets or evolution, honour that game's generation: `typesForGen()`,
`multiplier(atk, def, gen)`, PokéAPI `past_values`.
- **Tracking is per game.** `src/store/selection.js`: `entry(id)` /
`toggle(id, field)` / `stats(ids)` default to the selected game;
`favorite` and `note` are global. Don't reintroduce a single global
caught set.
- Respect `prefersReducedMotion()` (from `src/store/settings.js`) for any
animation.
- 2-space indent, semicolons, single quotes, trailing commas in multi-line
literals. Match the surrounding file; keep comments about *why*.
- No new runtime dependencies. Prefer adding to the snapshot over a new
runtime fetch.
## Adding things
- **Route** — new `src/views/Foo.js` exporting `async function Foo()`
returning a node; add one entry to `routes` in `src/router.js`. Add a
`skeleton` if it does async work before first paint.
- **Setting** — key + default in `src/store/settings.js` (and `applyTheme()`
if it affects the document), a field in `src/views/SettingsView.js`, and
add it to the export payload in `exportData()` if it should survive a
backup.
- **Snapshot field** — add it in `scripts/build-snapshot.mjs`, run
`npm run snapshot -- --force`, read it via `loadSnapshot()`. Keep the
snapshot small; it's precached on every install.
## Do not
- Commit `dist/` or `src/data/snapshot.json` (both git-ignored).
- Commit Pokémon sprites, artwork, audio, ROMs or save files. All imagery
is fetched at runtime from PokéAPI.
- Add analytics, telemetry, ads, tracking, or "sign in" flows.
- Add a framework or a build step that isn't Vite.
- Break offline-first: the grid, search, filters and game switching must
work with no network.
## Verifying a change
`npm run build` must pass. Then sanity-check by hand: the dex grid
(filters, sort, catching from a card), switching games (numbers + typings
update), a detail page (all tabs, form switch), and `npm run preview`
offline (DevTools → Network → Offline → reload). Check light and dark
theme and a mobile-width viewport.

132
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for
moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@ -17,6 +17,13 @@ runtime dependencies in the app bundle.
> **Not affiliated with Nintendo, Game Freak or The Pokémon Company.** This > **Not affiliated with Nintendo, Game Freak or The Pokémon Company.** This
> is a non-commercial fan reference tool. See [Legal](#legal). > is a non-commercial fan reference tool. See [Legal](#legal).
<p align="center">
<img src="docs/screenshots/dex-grid.png" alt="Dex grid" width="24%">
<img src="docs/screenshots/detail.png" alt="Pokémon detail" width="24%">
<img src="docs/screenshots/team-coverage.png" alt="Team coverage analysis" width="24%">
<img src="docs/screenshots/progress.png" alt="Per-game progress" width="24%">
</p>
--- ---
## Quick start ## Quick start
@ -251,7 +258,8 @@ SPA fallback and long-cache headers for `/assets/*` while keeping
Issues and pull requests are welcome — see Issues and pull requests are welcome — see
**[CONTRIBUTING.md](CONTRIBUTING.md)** for setup, project conventions, and **[CONTRIBUTING.md](CONTRIBUTING.md)** for setup, project conventions, and
what's in and out of scope. what's in and out of scope. AI coding agents: there's an
**[AGENTS.md](AGENTS.md)**.
Known gaps: no interactive region map (PokéAPI has no map imagery or Known gaps: no interactive region map (PokéAPI has no map imagery or
coordinates), no automated test suite yet, and no formal Lighthouse pass. coordinates), no automated test suite yet, and no formal Lighthouse pass.

31
SECURITY.md Normal file
View File

@ -0,0 +1,31 @@
# Security Policy
## Supported versions
Pocketdex is a rolling static web app — only the current `main` (and
whatever is deployed from it) is supported. There are no maintenance
branches.
## Reporting a vulnerability
Please **don't** open a public issue for a security problem.
Use GitHub's **private vulnerability reporting** (the *Report a
vulnerability* button under the repository's *Security* tab). Include what
you found, how to reproduce it, and the impact you think it has. You'll get
an acknowledgement as soon as possible.
Since Pocketdex has no backend and stores everything in the visitor's own
browser, the realistic surface is: the service worker / caching, the
save-file parser (`src/lib/savedex.js`) operating on untrusted binary
input, and the JSON backup import.
## Known issues
- **`npm audit` reports a moderate advisory for `esbuild` via Vite 5**
(GHSA-67mh-4wv8-2f99). It affects the **local dev server only** — a
malicious website could read responses from `npm run dev`. It is **not**
present in the production build (`dist/`), which ships no dev server.
Mitigation: don't expose the Vite dev server to untrusted networks.
Upgrading past Vite 5 needs a newer Node baseline and is tracked as a
follow-up.

BIN
docs/screenshots/detail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
docs/screenshots/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -16,6 +16,23 @@
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Pocketdex" /> <meta name="apple-mobile-web-app-title" content="Pocketdex" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Pocketdex" />
<meta property="og:title" content="Pocketdex" />
<meta
property="og:description"
content="An offline-first Pokédex, team builder and save-file tracker powered by PokéAPI."
/>
<meta property="og:image" content="/og.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Pocketdex" />
<meta
name="twitter:description"
content="An offline-first Pokédex, team builder and save-file tracker powered by PokéAPI."
/>
<meta name="twitter:image" content="/og.png" />
<title>Pocketdex</title> <title>Pocketdex</title>
</head> </head>
<body> <body>

BIN
public/og.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB