# MetaWeb Project Timeline Calculator

Hosted web app that calculates and tracks website project timelines for MetaWeb
(Sydney office, Chennai dev team). Full requirements: @docs/SPEC.md. Plan: @docs/PLAN.md.

## Commands
- `npm run dev` — local server
- `npm run typecheck` / `npm run lint` / `npm run test` / `npm run test:e2e`
- `npm run db:generate` / `npm run db:migrate` / `npm run db:seed`

## Rules
- All scheduling logic lives in `src/lib/schedule/` as pure TypeScript. No scheduling logic in UI, routes or SQL.
- The engine uses plain calendar dates (`YYYY-MM-DD`). Never use time zones or `Date` arithmetic inside it.
- Working days = Mon–Fri minus the phase calendar's holidays (AU-NSW or IN-TN) minus assignee leave.
- A phase of N working days includes its start day; the next phase starts on the next working day of its own calendar.
- "Today" is an engine input, never read inside it. Approval dates are the Sydney (Australia/Sydney) calendar date.
- Early approvals never pull later dates in; projected dates only move forward.
- Every date shift must create a DelayEvent (Client / Internal / Holiday / Capacity) with a reason.
- Any change to the engine needs tests, and the `schedule-engine-reviewer` subagent must pass it.
- Check current library docs with the Context7 MCP before using an API. Latest stable versions only.
- Check roles on every server action. Never read or commit `.env` files; keep `.env.example` current.
- Dates in the UI use Australian format: 14 Dec 2026.
- Record deviations from the spec in `docs/DECISIONS.md`. Update `docs/PROGRESS.md` after each milestone.
- **Every change updates `docs/PROJECT-SUMMARY.md`** (user rule, 29 Oct 2026): add a dated line to its
  update log, and change the summary, flows, screens, data or open items wherever they no longer match
  the app. Bump "Last updated". Do this in the same commit as the change.
- Commit each finished change, then push to the Bitbucket remote `origin` (private: bitbucket.org/anaxusgit/project_management_tool). Never
  commit client data, `.env*` files, database folders or anything from `~/.metaweb-timeline/`.
- Before restarting the dev server, use `POST /api/dev/shutdown`; never kill it (PGlite corrupts).
  Read `docs/HANDOFF.md` for the full working rules.

## Glossary
- Gate: a client approval point (design, demo, go-live) with a review window in AU working days.
- Baseline: dates frozen at kickoff. Projected: current forecast. Actual: what happened.
- Queue delay: days a project waits because its developer is busy on another project.
