From 42e5b5d1198448cd78689f938179a3dbbf00ffe5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 28 Sep 2026 16:59:56 +0000 Subject: [PATCH] Remove the no-emdash Trunk linter after a one-time sweep The linter ran over every Markdown file and Python comment, so full-repo trunk runs on master kept failing on em-dashes that predate it. Replace the existing ones once and drop the check. The AGENTS.md rule stays, the v2 ESLint rule stays, and pr-ready's humanizer pass catches new ones in prose. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RyamrxVw5BzEidVzm68LY7 --- .claude/skills/backend-development/SKILL.md | 14 +++---- .claude/skills/frontend-i18n/SKILL.md | 8 ++-- .../skills/frontend-v2-components/SKILL.md | 22 +++++----- .claude/skills/frontend-v2-input/SKILL.md | 14 +++---- .claude/skills/frontend-v2-patterns/SKILL.md | 22 +++++----- .claude/skills/frontend-v2-theming/SKILL.md | 16 ++++---- .claude/skills/review-polish/SKILL.md | 12 +++--- .claude/skills/security-audit/SKILL.md | 40 +++++++++---------- .trunk/trunk.yaml | 19 +-------- backend/adapters/services/rahasher.py | 4 +- backend/endpoints/logs.py | 2 +- backend/endpoints/roms/files.py | 4 +- backend/endpoints/sockets/logs.py | 2 +- backend/handler/database/roms_handler.py | 4 +- backend/handler/filesystem/base_handler.py | 2 +- backend/handler/filesystem/roms_handler.py | 2 +- backend/handler/metadata/ss_handler.py | 4 +- backend/handler/scan_handler.py | 2 +- backend/logger/formatter.py | 2 +- backend/models/assets.py | 6 +-- backend/tests/endpoints/roms/test_manual.py | 2 +- backend/tests/endpoints/test_screenshots.py | 8 ++-- .../handler/database/test_roms_handler.py | 2 +- .../handler/metadata/test_base_handler.py | 2 +- .../handler/metadata/test_igdb_handler.py | 6 +-- backend/tests/handler/test_fastapi.py | 2 +- backend/utils/audio_tags.py | 4 +- frontend/e2e/README.md | 2 +- 28 files changed, 106 insertions(+), 123 deletions(-) diff --git a/.claude/skills/backend-development/SKILL.md b/.claude/skills/backend-development/SKILL.md index 0da2427fd..c424fbba9 100644 --- a/.claude/skills/backend-development/SKILL.md +++ b/.claude/skills/backend-development/SKILL.md @@ -1,9 +1,9 @@ --- name: backend-development -description: Working on the RomM Python backend (backend/) — a FastAPI app with SQLAlchemy 2.0, Alembic, RQ/Redis, and Socket.IO. Use when adding or changing API endpoints, handlers, ORM models, response schemas, metadata-provider adapters, background tasks, database migrations, or backend tests. Covers the layered architecture, conventions, auth/scopes, the OpenAPI→frontend type pipeline, and the uv/pytest/alembic/trunk workflow. Trigger on any work under backend/. +description: Working on the RomM Python backend (backend/), a FastAPI app with SQLAlchemy 2.0, Alembic, RQ/Redis, and Socket.IO. Use when adding or changing API endpoints, handlers, ORM models, response schemas, metadata-provider adapters, background tasks, database migrations, or backend tests. Covers the layered architecture, conventions, auth/scopes, the OpenAPI→frontend type pipeline, and the uv/pytest/alembic/trunk workflow. Trigger on any work under backend/. --- -# RomM Backend — FastAPI / SQLAlchemy +# RomM Backend: FastAPI / SQLAlchemy Python 3.14+, FastAPI, SQLAlchemy 2.0 (MariaDB default; MySQL/PostgreSQL supported), Alembic, Redis + RQ for jobs/cache/sessions, Socket.IO for real-time. Managed with **uv**. @@ -11,7 +11,7 @@ Full reference: **`docs/BACKEND_ARCHITECTURE.md`** (directory map, ER diagram, e --- -## Layered architecture — where code goes +## Layered architecture: where code goes ```txt endpoints/ FastAPI routers: request validation, response schemas, @protected_route scopes @@ -24,7 +24,7 @@ handler/ Business logic, decoupled from HTTP └ filesystem/ ROM/asset/firmware file I/O, hashing, archive extraction adapters/services/ Typed external API clients (igdb.py + igdb_types.py, screenscraper.py, …) models/ SQLAlchemy ORM models (BaseModel adds created_at/updated_at) -tasks/ RQ jobs — scheduled/ (cron) and manual/ (on-demand); base classes in tasks.py +tasks/ RQ jobs, scheduled/ (cron) and manual/ (on-demand); base classes in tasks.py config/ Env-var loading (__init__.py) + YAML config manager (singleton) decorators/ @begin_session (DB session), @protected_route (auth + scopes) exceptions/ Custom exception hierarchy @@ -48,7 +48,7 @@ alembic/ Migrations (env.py + versions/) - Roles: `VIEWER` (read), `EDITOR` (+write roms/platforms/assets), `ADMIN` (+users/tasks/logs). Defined on `models/user.py`; scope tiers in `handler/auth/constants.py`. - Granular scopes: `me.read/write`, `roms.read/write`, `platforms.*`, `assets.*`, `devices.*`, `firmware.*`, `collections.*`, `users.*`, `tasks.run`, `logs.read`. -- Protect routes with `@protected_route(router., "", [Scope.X])`. The frontend mirrors these scopes — keep them aligned. +- Protect routes with `@protected_route(router., "", [Scope.X])`. The frontend mirrors these scopes; keep them aligned. ## Adding things @@ -60,7 +60,7 @@ alembic/ Migrations (env.py + versions/) ## Database migrations (Alembic) -Migrations must work on **MariaDB, MySQL, and PostgreSQL** (CI runs `alembic upgrade head` on Postgres and MariaDB — `.github/workflows/migrations.yml`). Use batch mode / DB-specific SQL where needed; mirror existing migrations in `alembic/versions/`. +Migrations must work on **MariaDB, MySQL, and PostgreSQL** (CI runs `alembic upgrade head` on Postgres and MariaDB; see `.github/workflows/migrations.yml`). Use batch mode / DB-specific SQL where needed; mirror existing migrations in `alembic/versions/`. ```bash cd backend @@ -69,7 +69,7 @@ uv run alembic upgrade head # apply uv run alembic downgrade -1 # verify the downgrade works ``` -Always review autogenerated migrations — they miss server-default/enum/index nuances and cross-dialect differences. The `virtual_collections` DB view is excluded from migrations. +Always review autogenerated migrations: they miss server-default/enum/index nuances and cross-dialect differences. The `virtual_collections` DB view is excluded from migrations. ### Migration hygiene (recurring review fixes) diff --git a/.claude/skills/frontend-i18n/SKILL.md b/.claude/skills/frontend-i18n/SKILL.md index 495d1b2d9..61be2d2b1 100644 --- a/.claude/skills/frontend-i18n/SKILL.md +++ b/.claude/skills/frontend-i18n/SKILL.md @@ -3,9 +3,9 @@ name: frontend-i18n description: Internationalization for the RomM frontend (both v1 and v2). Use whenever adding, renaming, or removing any user-visible string / translation key under frontend/src/locales/. Covers the en_US-is-source rule, the requirement to add every new key to ALL locale directories in the same change, namespace layout, and the check_i18n_locales.py validator enforced in CI. Trigger on any change to frontend/src/locales/**. --- -# RomM Frontend — i18n / Localization +# RomM Frontend: i18n / Localization -User-visible strings are **never hard-coded** in components — they come from locale files via `vue-i18n` (`$t(...)` in templates/composites; utils may call `i18n.global.t(...)`; **v2 lib primitives must not call `$t` at all** — text passes via props/slots). +User-visible strings are **never hard-coded** in components; they come from locale files via `vue-i18n` (`$t(...)` in templates/composites; utils may call `i18n.global.t(...)`; **v2 lib primitives must not call `$t` at all**, text passes via props/slots). ## Structure @@ -17,9 +17,9 @@ User-visible strings are **never hard-coded** in components — they come from l - **`en_US` is the source of truth**, but **every key added to `en_US` must be added to all other locale directories in the same change.** Never leave a key English-only. - **`en_US` uses US spelling**: "favorites", "color", "canceled". British forms belong in `en_GB` only. This bites tests too: an e2e or unit assertion on a label must expect the `en_US` string. -- **Actually translate the value into each locale's language** — never paste English into non-English locales. +- **Actually translate the value into each locale's language**: never paste English into non-English locales. - Editing an existing string counts: changing `en_US` means re-translating that key in every other locale. -- Reuse each locale's established terms — grep a sibling key for how it renders "metadata", "provider", etc. +- Reuse each locale's established terms: grep a sibling key for how it renders "metadata", "provider", etc. - Copying the English value is a last-resort placeholder, only when no translation is available, and must be flagged to revisit. - Removing or renaming a key means doing it across **every** locale. diff --git a/.claude/skills/frontend-v2-components/SKILL.md b/.claude/skills/frontend-v2-components/SKILL.md index 4ed7873fd..c34f8b0b3 100644 --- a/.claude/skills/frontend-v2-components/SKILL.md +++ b/.claude/skills/frontend-v2-components/SKILL.md @@ -1,11 +1,11 @@ --- name: frontend-v2-components -description: Building or modifying components in the RomM v2 frontend (frontend/src/v2/). Use when creating/editing v2 primitives (R* components in src/v2/lib/), shared composites, or feature composites — covers the three-tier model, file/folder conventions, SFC structure, import order, barrels, Storybook requirements, and v2 anti-patterns. Trigger on any work under frontend/src/v2/. +description: Building or modifying components in the RomM v2 frontend (frontend/src/v2/). Use when creating/editing v2 primitives (R* components in src/v2/lib/), shared composites, or feature composites. Covers the three-tier model, file/folder conventions, SFC structure, import order, barrels, Storybook requirements, and v2 anti-patterns. Trigger on any work under frontend/src/v2/. --- -# RomM Frontend v2 — Component Constitution +# RomM Frontend v2: Component Constitution -This governs work inside `frontend/src/v2/`. **v1 is frozen** (`src/views/`, `src/components/`, `src/console/`, `src/layouts/`) — never refactor it; it will be deleted wholesale in a final wave. v2 is gated by `user.ui_settings.uiVersion`. +This governs work inside `frontend/src/v2/`. **v1 is frozen** (`src/views/`, `src/components/`, `src/console/`, `src/layouts/`); never refactor it; it will be deleted wholesale in a final wave. v2 is gated by `user.ui_settings.uiVersion`. > Official language for all code, comments, identifiers, `.md`, and commit/PR messages: **English**. @@ -17,7 +17,7 @@ Related skills: `frontend-v2-theming` (tokens/colors), `frontend-v2-input` (focu 1. **v1 is frozen.** Don't touch `src/views/`, `src/components/`, `src/console/`, `src/layouts/`. When coexistence forces a v2 fork of a store/composable/util, annotate the v1 export with `@deprecated` pointing at the v2 replacement. 2. **Three component tiers** (below). -3. **Shared resources are canonical.** Pinia stores, API services, OpenAPI types (`src/__generated__/`), locales, utils — v2 _imports_ them, never forks them. Additive changes to shared resources are allowed; changing a shared store API to work around a v2 call-site issue is not. +3. **Shared resources are canonical.** Pinia stores, API services, OpenAPI types (`src/__generated__/`), locales, utils: v2 _imports_ them, never forks them. Additive changes to shared resources are allowed; changing a shared store API to work around a v2 call-site issue is not. 4. **TypeScript strict.** Zero `any` (justify with a comment if unavoidable). No `as unknown as ...`; fix the source or define an intermediate type. 5. **Universal substitution.** When an `R*` primitive exists, use it. If it doesn't, create or extend it. Never drop to raw HTML when a primitive applies. 6. **Attribute forwarding contract.** A primitive whose root is polymorphic (``) or that forwards to an inner element uses `defineOptions({ inheritAttrs: false })` + `v-bind="$attrs"` + slot passthrough, so call-site attrs and listeners land on the intended node instead of vanishing silently. @@ -38,7 +38,7 @@ Related skills: `frontend-v2-theming` (tokens/colors), `frontend-v2-input` (focu 1. Does not depend on stores, services, router, or emitter. 2. No knowledge of a product domain (ROM, Platform, Collection, User…). `RAvatar` yes, `UserAvatar` no. -3. Its API can be described without naming features — generic props/slots/events. +3. Its API can be described without naming features: generic props/slots/events. If any fails: **shared composite** if generic across features, **feature composite** if owned by one feature. Edge cases get raised to the user, not auto-decided. Consumer count never demotes a primitive. @@ -62,9 +62,9 @@ If any fails: **shared composite** if generic across features, **feature composi ## File & folder conventions -- **Primitive**: one per folder — `RFoo/RFoo.vue`, `RFoo/RFoo.stories.ts`, `RFoo/index.ts`, optional `RFoo/types.ts`. +- **Primitive**: one per folder: `RFoo/RFoo.vue`, `RFoo/RFoo.stories.ts`, `RFoo/index.ts`, optional `RFoo/types.ts`. - **Composite**: flat `.vue` if one file suffices; a folder with the same internal structure (no story required) if it has sub-pieces. -- **Barrel**: `src/v2/lib/index.ts` re-exports every primitive — update it when a new primitive ships. Composites are imported directly by path; no barrel. No single-file `index.ts` that just re-exports to shorten a path. +- **Barrel**: `src/v2/lib/index.ts` re-exports every primitive; update it when a new primitive ships. Composites are imported directly by path; no barrel. No single-file `index.ts` that just re-exports to shorten a path. ### SFC structure @@ -90,7 +90,7 @@ import GameCard from "@/v2/components/GameCard.vue"; import { useCan } from "@/v2/composables/useCan"; ``` -- `@v2/lib` — primitives barrel. `@/v2/...` — anything else under v2. `@/...` — canonical shared resources. Never relative paths (`../../foo`) when an alias exists. +- `@v2/lib`: primitives barrel. `@/v2/...`: anything else under v2. `@/...`: canonical shared resources. Never relative paths (`../../foo`) when an alias exists. - Shared v2 types live in `src/v2/types/`; backend types come from `src/__generated__/`; not `src/types/` (legacy). ### Composables @@ -99,7 +99,7 @@ import { useCan } from "@/v2/composables/useCan"; ### Console logging -- `console.error` allowed for production-visible errors. `console.log`/`console.warn` must not ship. `console.debug` is dev-only — remove before PR. +- `console.error` allowed for production-visible errors. `console.log`/`console.warn` must not ship. `console.debug` is dev-only; remove before PR. --- @@ -116,8 +116,8 @@ import { useCan } from "@/v2/composables/useCan"; ## Anti-patterns (beyond what the premises already say) 1. Don't change shared store APIs to work around a v2 call-site issue. (Fix the call site; the Gallery lesson was calling `romsStore.reset()` from the view, not adding `_fetchSeq` to the store.) -2. Don't drop to inline role checks — always go through `useCan` (see `frontend-v2-patterns`). -3. Don't reinvent a surface — dialog/menu/popover/card all go through their primitive; special cases become a new prop, not a parallel surface. +2. Don't drop to inline role checks; always go through `useCan` (see `frontend-v2-patterns`). +3. Don't reinvent a surface: dialog/menu/popover/card all go through their primitive; special cases become a new prop, not a parallel surface. 4. Don't hand-roll a `
`; use `RForm`. 5. Don't add backwards-compat shims inside v2: delete removed code; no `// removed`, no renamed-but-unused exports, no deprecated wrappers that just call the new function. 6. Don't write redundant tests; don't touch v1; never `--no-verify` on commits. diff --git a/.claude/skills/frontend-v2-input/SKILL.md b/.claude/skills/frontend-v2-input/SKILL.md index f66f8b364..50af47897 100644 --- a/.claude/skills/frontend-v2-input/SKILL.md +++ b/.claude/skills/frontend-v2-input/SKILL.md @@ -3,9 +3,9 @@ name: frontend-v2-input description: Universal input (mouse, touch, keyboard, gamepad) and responsive/universal-viewport layout in the RomM v2 frontend. Use when adding interactive v2 components, focus management, spatial navigation, gamepad/keyboard handling, modality-gated focus rings, breakpoints, or responsive layout. Covers useInput, focus geometry primitives, the overlay scope stack, useBreakpoint, and the data-bp/data-input attributes. Trigger on interactive or responsive work under frontend/src/v2/. --- -# RomM v2 — Universal Input & Universal Viewport +# RomM v2: Universal Input & Universal Viewport -**Premise:** all v2 UI works with mouse, touch, keyboard, **and** gamepad; and every surface reads cleanly from a 320px phone to a 4K display. Both mechanisms are fixed — don't invent a parallel one. +**Premise:** all v2 UI works with mouse, touch, keyboard, **and** gamepad; and every surface reads cleanly from a 320px phone to a 4K display. Both mechanisms are fixed; don't invent a parallel one. The input system lives in `src/v2/composables/useInput/` (bus, keyboard, gamepad, actions, scope). It generalises the original gamepad-only `src/console/` system. There are **no `/console/*` routes in v2**. @@ -15,12 +15,12 @@ The input system lives in `src/v2/composables/useInput/` (bus, keyboard, gamepad `useInputModality` sets `data-input="mouse|touch|key|pad"` on `` from the most recent input. -- **Focus rings appear only with `key` and `pad`** (CSS in `global.css`). **Never use bare `:focus` in styles** — use the modality-gated selectors, or focus rings flash on mouse click. +- **Focus rings appear only with `key` and `pad`** (CSS in `global.css`). **Never use bare `:focus` in styles**; use the modality-gated selectors, or focus rings flash on mouse click. - **Modality gates appearance and behaviour, never size**: focus rings, hover-reveal, autofocus. A tap is followed by compatibility mouse events, so anything sized off `data-input` resizes under the finger. Hit targets scale by breakpoint instead (below). -## Coverage — every interactive primitive participates +## Coverage: every interactive primitive participates -Buttons, list items, tabs, menu items, focusable cards, toggleable chips — all participate in spatial navigation (not optional). A new interactive primitive must: +Buttons, list items, tabs, menu items, focusable cards, toggleable chips: all participate in spatial navigation (not optional). A new interactive primitive must: - be focusable (a natively focusable element, or a proper `tabindex`); - react to logical actions (confirm/cancel) from `useInput`, in addition to native click; @@ -42,7 +42,7 @@ Above per-view geometry, some elements bind globally regardless of focus locatio ## Scope (overlay stack) -When a dialog opens, push a scope; when it closes, pop. This stops Escape from closing two things at once and stops `confirm` leaking to controls beneath an overlay. `RDialog` and `RMenu` manage their scope automatically — custom overlays are an anti-pattern; go through the primitives. +When a dialog opens, push a scope; when it closes, pop. This stops Escape from closing two things at once and stops `confirm` leaking to controls beneath an overlay. `RDialog` and `RMenu` manage their scope automatically; custom overlays are an anti-pattern; go through the primitives. --- @@ -50,7 +50,7 @@ When a dialog opens, push a scope; when it closes, pop. This stops Escape from c - **Single breakpoint source: `useBreakpoint`** (`src/v2/composables/useBreakpoint/`). Material thresholds: `xs <600`, `sm 600–959`, `md 960–1279`, `lg 1280–1919`, `xl ≥1920`. `installBreakpointAttribute()` mirrors the active set onto `` (from `AppLayout` and `AuthLayout` in the app, and from `.storybook/preview.ts` so stories match production CSS). - **Layout switches live in CSS** via the attribute selector: `html[data-bp~="xs"] .foo { … }`, `html[data-bp~="sm-and-down"] .foo { … }`. **No raw `@media` for layout**: the only allowed `@media` are `prefers-reduced-motion` and print. The attribute is on `` so it reaches teleported overlays. `romm/no-layout-media-query` (ESLint) enforces this in SFC styles. -- **Conditional rendering** (mount/unmount a different component per tier) uses the `useBreakpoint()` refs in `