Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# AGENTS.md

Guidance for AI agents working in this repository.

## Project

TrackerBot — Discord.js v14 companion bot for TarkovTracker.org. Two services run side by side:

- `bot.js` — Discord bot (slash commands, reaction roles, welcome automation, ticketing)
- `webserver.js` — Express server serving public bug/data intake forms that open GitHub issues

ESM throughout (`"type": "module"` in `package.json`). Requires Node.js 18+.

## Architecture

```
bot.js # Entry point: ensureEnvVars -> createClient -> register handlers -> login
webserver.js # Express issue intake server
src/
client/ # Discord client setup (intents, partials)
commands/ # Slash command registration + command definitions
config/ # env.js (required-var validation), constants.js (role/config derivation)
handlers/ # Event-driven handlers registered via registerXxxHandlers(client)
interactions/ # Slash + button interaction logic
utils/ # Shared helpers (embeds)
web/ # Static issue/data report forms
test/ # Node --test files
```
Comment on lines +16 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Label the architecture fence.

This block should include a language tag (for example, text) to satisfy markdownlint and keep the docs build clean.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 16-16: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 16 - 28, The architecture section uses a fenced code
block without a language tag, which trips markdownlint. Update the fenced block
in AGENTS.md to include a language identifier such as text while keeping the
existing content and formatting intact. Use the surrounding architecture listing
to locate the block and ensure all fenced blocks in that section are properly
tagged.

Source: Linters/SAST tools


### Conventions

- Handlers export a `registerXxxHandlers(client)` (or `setupXxx(client)`) function that attaches event listeners; wired up in `bot.js`.
- Env vars are validated centrally in `src/config/env.js` via `requiredEnvVars` + `getRequiredEnv`/`ensureEnvVars`. New required vars must be added there AND to `.env.example` AND documented in `README.md`.
- Optional features should read their env var defensively (not in `requiredEnvVars`) so existing deployments and the test suite don't break.
- Constants derived from env (role sets, configs) live in `src/config/constants.js`.
- Error handling: catch at handler boundaries, log via `console.error`/`console.warn`, never crash the process.

## Verification

Run before considering work complete:

```bash
npm test # Node --test (env validation tests)
node --check bot.js && node --check webserver.js # syntax check entry points
# CI also runs a full `find . -name "*.js" -not -path "./node_modules/*" | node --check` sweep
```

CI (`.github/workflows/ci.yml`) runs: `npm ci` -> syntax check all JS -> `npm test`.

## Git / PR

- Conventional commit style (`feat:`, `fix:`, `chore:`, `refactor:`).
- Branch naming: `<type>/<short-desc>` (e.g. `feat/honeypot`, `chore/add-agents-md`).
- PRs target `main`. Use `gh` for all GitHub operations.
Loading