Files
AITrader/AGENTS.md
T

44 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AGENTS.md Repository QuickStart 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 hotmodule replacement via **reactrouter dev**. The app is served at `http://localhost:5173`.
- `npm run build` Produces a production build using **reactrouter build**. Output lives in `./build` with `client/` (static assets) and `server/` (Node entry point).
- `npm start` Serves the built server bundle with **reactrouter-serve ./build/server/index.js**. Use after `npm run build`.
- `npm run typecheck` Runs **reactrouter typegen** then `tsc`. Must be run before committing any TypeScript changes.
## Development workflow
1. **Install deps** `npm install` (first time only).
2. **Start dev** `npm run dev`. Changes are hotreloaded; no manual restart needed.
3. **Iterate** Edit files under `src/` (React components, routes, loaders, actions, etc.).
4. **Validate** Run `npm run typecheck` regularly; it catches missing typegen steps.
5. **Build & serve** When ready for a preview:
```bash
npm run build && npm start
```
This uses the productionready server (`@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 build` in your Dockerfile before the final `CMD`.
## TypeScript nuances
- The `typecheck` script runs **reactrouter 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 start` will fail if `npm run build` hasn't been executed first.
- **Skipping typegen** Directly running `tsc` without the preceding `react-router typegen` results in missing type definitions.
- **Assuming a `test` script exists** This repository has no test suite; any `npm test` command will error.
- **Port assumptions** Development server runs on `5173`; production server (Docker) defaults to `3000` unless overridden.
---
*Keep this file uptodate as scripts or tooling evolve.*