2.7 KiB
2.7 KiB
AGENTS.md – Repository Quick‑Start Guide
Purpose: Give OpenCode agents the exact commands and conventions they need to work safely and efficiently in the AITrader codebase. Only include items that are easy to miss without explicit guidance.
Core npm scripts (run from the repository root)
npm run dev– Starts the development server with hot‑module replacement via react‑router dev. The app is served athttp://localhost:5173.npm run build– Produces a production build using react‑router build. Output lives in./buildwithclient/(static assets) andserver/(Node entry point).npm start– Serves the built server bundle with react‑router-serve ./build/server/index.js. Use afternpm run build.npm run typecheck– Runs react‑router typegen thentsc. Must be run before committing any TypeScript changes.
Development workflow
- Install deps –
npm install(first time only). - Start dev –
npm run dev. Changes are hot‑reloaded; no manual restart needed. - Iterate – Edit files under
src/(React components, routes, loaders, actions, etc.). - Validate – Run
npm run typecheckregularly; it catches missing typegen steps. - Build & serve – When ready for a preview:
This uses the production‑ready server (
npm run build && npm start@react-router/serve).
Docker deployment (optional)
- Build image:
docker build -t aitrader . - Run container:
docker run -p 3000:3000 aitrader - The container expects the app to be built; include
npm run buildin your Dockerfile before the finalCMD.
TypeScript nuances
- The
typecheckscript runs react‑router typegen first; agents must not skip this step because generated types are required for successful compilation. - The project uses ES modules (
"type": "module"). Import paths should include file extensions (.js,.ts) where Node requires them.
TailwindCSS
- Tailwind is configured via Vite (
@tailwindcss/vite). No extra build steps are needed; the dev server and production build automatically process Tailwind classes.
Common pitfalls agents might miss
- Running the server without a build –
npm startwill fail ifnpm run buildhasn't been executed first. - Skipping typegen – Directly running
tscwithout the precedingreact-router typegenresults in missing type definitions. - Assuming a
testscript exists – This repository has no test suite; anynpm testcommand will error. - Port assumptions – Development server runs on
5173; production server (Docker) defaults to3000unless overridden.
Keep this file up‑to‑date as scripts or tooling evolve.