-
Notifications
You must be signed in to change notification settings - Fork 2
chore: add AGENTS.md with project conventions and verification steps #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` | ||
|
|
||
| ### 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. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
Source: Linters/SAST tools