Repository Guidelines
Project Structure & Module Organization
backend/: Express + TypeScript API that wraps the Codex CLI; entry pointbackend/src/index.ts; compiled output inbackend/dist/.frontend/: React + Vite client with main bootstrap infrontend/src/main.tsxand UI logic infrontend/src/App.tsx; static assets live underfrontend/public/, and production bundles land infrontend/dist/.- Keep environment-specific configuration outside the repo (
.envor shell exports) and document any new env vars in PRs.
Build, Test, and Development Commands
cd backend && npm install: install backend deps;npm run dev: runtsxwatcher on http://localhost:4000;npm run build: type-check and emitdist/;npm start: serve the built bundle.cd frontend && npm install: install UI deps;npm run dev: start Vite dev server with proxy to backend;npm run build: runtscthen bundle;VITE_API_BASE_URL=http://localhost:4000/api npm run preview: preview production bundle.- Export Codex credentials (
AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_KEY,AZURE_OPENAI_DEPLOYMENT) before launching the backend; overrideCODEX_WORKDIRwhen pointing Codex to another directory.
Coding Style & Naming Conventions
- TypeScript strict mode is enabled; prefer explicit types at module boundaries and validate request payloads via
zodas inbackend/src/index.ts. - Use 2-space indentation, camelCase for variables/functions, PascalCase for React components, and descriptive file names (
ThreadList.tsx,useCodexClient.tsif added). - Run
npm run buildin both packages prior to PRs; match existing formatting until Prettier/ESLint configs are introduced.
Testing Guidelines
- Automated tests are not yet configured; add future backend tests alongside code (
backend/src/__tests__/api.spec.ts) and frontend tests underfrontend/src/__tests__/. - Fallback validation: hit
POST /api/runwithcurlor REST clients, and walk through the UI flow to confirm prompt/response loops; capture manual steps in PR descriptions.
Commit & Pull Request Guidelines
- Follow Conventional Commits, scoping messages where helpful (e.g.,
feat(frontend): persist thread history). - Each PR should explain motivation, list manual or automated test results, call out environment variable changes, and include UI screenshots/log snippets when behavior shifts.
- Keep changes focused; update docs or configuration examples that drift alongside code updates.
Security & Configuration Tips
- Never commit secrets; rely on
.env.localor shell exports and document required variables. - Limit backend access by using the minimal
CODEX_WORKDIR; ensure dependencies are reviewed for security before upgrades. - Remove temporary logging or debugging code before merging to avoid leaking prompt data.