From 5b19bcd32499409e332d1cb8df014b19145e5639 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 18 Jul 2026 20:59:25 +0200 Subject: [PATCH] chore: init agents instructions --- AGENTS.md | 62 ++++++++++++++++++++++++++++++++----------------------- CLAUDE.md | 7 +++++++ 2 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md index 1e5d055..377762b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,13 +4,15 @@ Guidance for AI coding agents working in this repository. ## What this is -Classic Minesweeper as a vanilla web game — no framework, no TypeScript (JSDoc + `// @ts-check` only). Deployed at [mnswpr.com](https://mnswpr.com) (Netlify) and published to npm as `@cozy-games/mnswpr`. The game engine has **zero runtime dependencies**; only the website adds Firebase. +Classic Minesweeper as a vanilla web game — no framework, no TypeScript (JSDoc + `// @ts-check` only). Deployed at [mnswpr.com](https://mnswpr.com) (Netlify), with a Firestore-backed leaderboard. -**`mnswpr` is the main test app.** It's the reference app for the monorepo and the default target for local runs — `.claude/launch.json` launches it (`dev` on :5173, `preview` on :4173), and it's what you should build/run/preview when verifying changes to the shared packages or tooling. +**This repo is only the app.** The engine, leaderboard, and shared services (`@cozy-games/mnswpr`, `@cozy-games/leaderboard`, `@cozy-games/utils`) live in [ayo-run/cozy-games](https://github.com/ayo-run/cozy-games) and are consumed here **from npm** — there is no local `packages/` to edit. A change to game mechanics, leaderboard internals, or the shared services belongs in that repo and arrives here as a version bump in `apps/mnswpr/package.json`. + +Structurally it is still a pnpm workspace (`pnpm-workspace.yaml` → `apps/*`) with a single member, `apps/mnswpr`, so app scripts are addressed with pnpm's `-F` filter. ## Commands -Workspace-wide commands run from the root; per-app commands target the app by name with pnpm's `-F` filter (apps are named `` — there are no mnswpr-specific root scripts). +Workspace-wide commands run from the root; app commands target the app with pnpm's `-F` filter. `pnpm dev` and `pnpm build` are root aliases for the two most common ones. ```bash pnpm i # install (pnpm is required — this is a pnpm workspace) @@ -18,14 +20,17 @@ pnpm test # run the Vitest suite once (jsdom) pnpm test:watch # run Vitest in watch mode pnpm lint # eslint . (JS + CSS); runs automatically on pre-commit pnpm lint:fix # eslint --fix -pnpm build:lib # build the publishable library -> packages/mnswpr/dist +pnpm scan:secrets # secretlint over the tree pnpm -F mnswpr run dev # Firestore emulator + auto-seed + dev server (emulators:exec) — most common; needs JDK 21+ pnpm -F mnswpr run dev:no-db # plain vite, no emulator (UI-only work / no JDK) pnpm -F mnswpr run build # build the website -> apps/mnswpr/dist +pnpm -F mnswpr run preview # serve the production build pnpm -F mnswpr run build:preview # build the app and serve the production preview ``` +Run a single test file or name: `pnpm vitest run scripts/test/check-content.test.js` · `pnpm vitest run -t 'partial name'`. + ### Infra (local CLI only — no web dashboards) **Every infra operation — provision, deploy hosting, deploy DB, manage env — is doable from the CLI, and every configuration/schema is codified in-repo.** Nothing lives only in a web dashboard. There are two distinct layers, both owned by the app: @@ -71,28 +76,31 @@ pnpm -F mnswpr exec netlify env:list # inspect what's set **Non-npm tools get a setup script instead of a devDependency.** The Firestore emulator needs **Java** (it's a JVM program), which isn't an npm package — so `pnpm install` runs a root `postinstall` (`scripts/ensure-java.mjs`) that installs a user-local Temurin JRE 21 into `~/.local` without `sudo` when `java` is missing — idempotent, non-fatal, and auto-skipped on `CI` / `SKIP_JRE_SETUP` / unsupported platforms. Any future infra tool that isn't on npm follows the same pattern (a checked-in setup script), never a manual install step. -Tests are co-located with the package they exercise (`packages/utils/test/`, `packages/mnswpr/test/`) and run under **Vitest** with a jsdom environment (root config in `vitest.config.js`). They cover the shared utils and drive the engine through real DOM events (mount `#app`, dispatch mouse events, assert on cell/grid attributes). For anything visual or input-timing related, also verify by running `pnpm -F mnswpr run dev` and playing. +Tests run under **Vitest** with a jsdom environment (root config in `vitest.config.js`), which collects `apps/**/test/**/*.test.js` and `scripts/test/**/*.test.js`. Today only `scripts/test/` exists (the content scanner); app-level tests go in `apps/mnswpr/test/`. Engine and shared-package tests live in the cozy-games repo, not here. For anything visual or input-timing related, verify by running `pnpm -F mnswpr run dev` and playing. Node version: `.nvmrc` pins `lts/*`. -## Repository layout (Cozy Games monorepo, pnpm workspace) +## Repository layout -This is the **Cozy Games** monorepo. Workspaces are declared in `pnpm-workspace.yaml` as `apps/*`, `packages/*`, and `sites/*`. `utils/` is now a real workspace package (`@cozy-games/utils`), imported by name — no more `../utils` relative paths. +`pnpm-workspace.yaml` declares `apps/*`; `apps/mnswpr/` (package name `mnswpr`) is the only member. -- **`apps/mnswpr/`** — package `mnswpr`, `@cozy-games/mnswpr`'s host, the mnswpr.com website. Consumes the engine and leaderboard via `workspace:*` (`import mnswpr from '@cozy-games/mnswpr/mnswpr.js'`) and wires them together in `apps/mnswpr/main.js`. Owns its Firebase config (`firebase.json`, `firestore.rules`, `.firebaserc`) and app-specific scripts (`apps/mnswpr/scripts/`). A future app (e.g. sudoku) gets its own `apps//` and its `package.json` `name` is just the app name (``, unscoped) so it's addressable directly by name (`pnpm -F run