# AGENTS.md — fvtt-les-oublies

FoundryVTT AppV2 game system for the French TTRPG *Les Oubliés* (Les XII Singes).

## Commands

```sh
npm run build           # split compendium content + compile LESS → css/
npm run build:packs     # build packs/ LevelDB from packs-src/ JSON only
npm run watch           # gulp watch (LESS only, not compendiums)
```

No test, lint, format, or typecheck commands exist.

## Build pipeline

- **LESS** (`less/` → `css/`) via gulp + gulp-less + sourcemaps.
- **Compendiums** (`packs-src/*.json` → `packs/` LevelDB) via `scripts/pack-builder.mjs` using the `level` npm package.
- `npm run build` runs both steps.

## Compendium "split" (base content module)

`npm run build:packs` also copies sanitized sources to `../fvtt-les-oublies-base/` (overridable via `$FVTT_LES_OUBLIES_BASE_ROOT`). Rich HTML fields from `system.json` `documentTypes.Item.*.htmlFields` are cleared in the system copy and preserved in the base module copy. That sibling dir is a standalone Foundry module (`fvtt-les-oublies-base`).

## Entrypoints

- `modules/les-oublies-main.js` — Hooks.on("init") registers data models, sheets, config.
- `modules/models/index.mjs` — re-exports all DataModel classes (9 Item + 3 Actor).
- `modules/applications/sheets/_module.mjs` — re-exports all sheet classes.
- `modules/les-oublies-config.js` — game config (profiles, skills, etc).

## Project structure

| Path | Purpose |
|------|---------|
| `modules/` | JS source (ESM) |
| `modules/models/` | DataModel classes (one per document type) |
| `modules/applications/sheets/` | SheetApplication classes |
| `templates/` | Handlebars templates |
| `less/` → `css/` | Styles |
| `lang/fr.json` | French localization (only language) |
| `packs-src/` | Compendium JSON source (human-editable) |
| `packs/` | Compiled LevelDB packs (generated) |
| `assets/` | Icons, tokens, UI images |
| `scripts/` | Build scripts (Node ESM) |
| `_regles/` | Reference PDFs (gitignored) |

## Release

Only `.gitea/workflows/release.yaml` — triggered on `release: [published]`:
1. `npm ci` + `npm run build`
2. Zips: `system.json css/ lang/ modules/ packs/ templates/`
3. Attaches archive + `system.json` to release

## .gitignore quirks

- `.github/*` is ignored (so copilot-instructions.md changes won't commit unless forced)
- `styles/*.css` is ignored (but CSS lives in `css/`, not `styles/`)
- `_regles/` and `.history/` are ignored

## Stale sources

- `.github/copilot-instructions.md` predates the JS implementation and calls this a "minimal content repository with no build commands" — ignore it.
