Files
MC_Report/AGENTS.md

36 lines
2.0 KiB
Markdown

# Project Rules
## Shell & Process Rules
- **NEVER run `cmd /c` or `cmd.exe` directly.** Use `Invoke-WebRequest`, `Invoke-RestMethod`, `Start-Process`, or direct `node` commands via PowerShell instead.
- **NEVER run long-running processes (e.g. `node server.js`) in the foreground.** Always use `Start-Process -NoNewWindow` without `-Wait` to background them.
- **NEVER run long-running processes (e.g. `node server.js`) in the foreground.** Always use `Start-Process -NoNewWindow` without `-Wait` to background them.
- **Prefer `Invoke-WebRequest` / `Invoke-RestMethod`** over `curl.exe` for HTTP testing.
- When backgrounding a server process, redirect stdout/stderr to log files: `-RedirectStandardOutput "out.log" -RedirectStandardError "err.log"`.
## Project Context
This is a **Game Player Complaint/Suggestion/Appeal System** (MC Report System) built with:
- **Backend**: Node.js + Express + **MySQL** (mysql2)
- **Frontend**: Vanilla JS SPA with hash-based routing
- **Auth**: JWT with role-based access (owner/admin/player)
### Key Files
- `backend/db.js` — MySQL connection pool + schema init + config persistence
- `backend/server.js` — Express entry point, checks install status, conditional route loading
- `backend/routes/tickets.js` — Core ticket logic (report/suggestion/appeal)
- `backend/routes/install.js` — Installation wizard API
- `public/js/app.js` — Frontend router
- `data/config.json` — MySQL connection config (created during install)
### Installation Flow
1. Start server: `node backend/server.js`
2. Visit `http://localhost:3100/#/install`
3. Step 1: Enter MySQL credentials, test connection
4. Step 2: Create owner account
5. Restart server to load business routes
### After making backend changes
1. Stop existing server: `Get-Process -Name "node" -ErrorAction SilentlyContinue | Stop-Process -Force`
2. Restart: `Start-Process -FilePath "node" -ArgumentList "backend\server.js" -WorkingDirectory "C:\Users\canglan\Documents\Web\mc-report" -NoNewWindow -RedirectStandardOutput "o.log" -RedirectStandardError "e.log"`