Files
2026-06-01 22:51:48 +02:00

74 lines
3.1 KiB
Markdown

# AGENTS.md — mgt2-compendium-amiral-denisov
## First read
- `.github/copilot-instructions.md` — packs, icons, module.json conventions (this file builds on it, don't repeat it)
## No package manager / no build
There is **no** `package.json`, no lockfile, no bundler. JavaScript is plain ESM loaded directly by FoundryVTT. Do not run `npm install` or any build command.
## Commands
5 chat commands registered at runtime (not declared in `module.json`):
| Command | Entrypoint | Dialog |
|---|---|---|
| `/commerce` | `scripts/commerce.js` | `CommerceDialog` (3 tabs) |
| `/pnj` | `scripts/npc.js` | `NpcDialog` (4 tabs) |
| `/rencontre` | `scripts/npc.js` | same dialog (tab 2) |
| `/mission` | `scripts/npc.js` | same dialog (tab 3) |
| `/sector` | `scripts/sector.js` | `SectorMapApp` (IFRAME Traveller Map, clics→chat) |
| `/subsector` | `scripts/sector.js` | `SectorMapApp` (IFRAME) |
Commands are registered via `ChatLogV2.CHAT_COMMANDS` — not Hooks.on("chatMessage") as the copilot-instructions say (that file is stale). See `commerce.js:15` and `npc.js:15` for the actual pattern.
## Framework quirks
- **ApplicationV2** + `HandlebarsApplicationMixin` for all dialogs.
- Foundry v13/v14 dual code paths: some hooks must handle both jQuery (v13) and DOM (v14) APIs.
- Dice rolls: `await new Roll(formula).evaluate()` — always async.
- Skill FQN format for `game.i18n`: e.g. `pilot.spacecraft`, `electronics.computers`, `gunner.turret`.
## Runtime systems (run at `ready` hook, GM only)
1. **Migration** (`mgt2eMigration.js`): converts legacy item types to mgt2e (armor→armour, equipment→item/augment, computer→hardware, etc.). Tracked via `game.settings` version flag. Forced re-run requires deleting the setting.
2. **NPC RollTable sync** (`npcRollTableSync.js`): writes D66 tables from `scripts/data/npcTables.js` into the `tables-pnj` compendium pack. Checksums to avoid redundant writes.
## Testing
```sh
# standalone, no npm needed — install jest globally or use npx
npx jest scripts/tests/travellerNpcGenerator.test.js
```
- Single file, 1096 lines, hand-rolled FoundryVTT mocks.
- Covers: utilities, lookups, validation, characteristic/skill generation, skill conversion, full NPC gen, ModuleCache, errors, config validation.
- No CI test step — you must run manually.
- No Jest config file — relies on defaults.
## Versioning
- `module.json``"version"` is the single source of truth.
- Git tag format: `v1.3.0` (CI strips `v`).
- No changelog file.
## CI/CD (Gitea)
- Only triggers on **`release: [published]`** — not on push/PR.
- Builds a zip archive of `module.json + assets/ + packs/ + scripts/ + styles/ + templates/` and uploads to the release.
- No test step in CI.
## Deprecated packs (still on disk, NOT in module.json)
- `packs/arme/` → superseded by `armes`
- `packs/carriere/` → superseded by `carrieres`
- `packs/talent-psy/` → superseded by `talents-psioniques`
Do not re-add them to `module.json`. They remain for historical data recovery only.
## All content is in French
Labels, comments, commit messages, UI strings, icon file names, rule references — everything. Check French naming before searching/grepping.