mega-plant/AGENTS.md
Mega Plant 0516220110 Round 4: regressions fixed + mobile standard
Part A — Round 3 regressions:
- A.1: verify-cost-reconciliation.mjs now loads .env.local, wraps in try/catch, exits 1 on any failure
- A.2: Vehicle Costs restored Santam — back to R 14,996.31 (matches row-by-row sum)
- A.3: incl<excl / VAT math / VAT>20% now FATAL — seed exits 2 with full report (4 anomalies on Charl-CCS + Buildsmart)
- A.4: Reconciliation target R 694,962.93 with both deltas itemised (Personnel +R19,800, Santam -R5,322.44, unexplained R 0.00)
- A.5: 'Lines' view uses actual lines (recharts LineChart), no fills; fills only in 'Cost stack'

Part B — Mobile standard:
- B.1: header wraps to 2 rows on mobile; YTD badge cards stack; page-wide overflow eliminated on /income, /charts, /overheads, /running, /expenses
- B.2: IncomeView card row layout stacked — name gets its own line on mobile, never truncated to single char
- B.3: Plant type filter is a <select> dropdown below lg (was 18 pills wrapping to 13 rows); same for sort on /income and /running
- B.4: Plant table first column sticky; -webkit-overflow-scrolling: touch; tables scroll inside their own container
- B.5: All buttons/links use min-h-[44px] tap targets; text below 12px is bumped where it matters
- B.6: Charts legend wraps below title; chart min-height h-44 → h-52 on mobile
- B.7: paddingTop env(safe-area-inset-top) on sticky header for notch/home indicator clearance

AGENTS.md created with the standing mobile checklist rule.
2026-09-12 12:05:43 +02:00

2.7 KiB
Raw Blame History

AGENTS.md — Mega Plant

Mobile checklist (Round 4 standing rule)

Every page must pass the mobile checklist before it is considered complete:

  1. No horizontal page scroll at 375px. Individual tables may scroll inside their own container; the page itself may not.
  2. No text under 12px on mobile. Bump text-[10px] labels up.
  3. No tap target under 44×44px. Keep the visual size if you like — add padding to the hit area.
  4. Wide tables scroll inside their own container with a sticky first column and -webkit-overflow-scrolling: touch. Add a visible scroll affordance (e.g. right-edge fade).
  5. Filter controls collapse below lg — pills become a <select> dropdown. Don't stack 13 pills into 13 rows.
  6. Verify at 375×812 and 768×1024. Run document.documentElement.scrollWidth > document.documentElement.clientWidth and confirm it returns false. Count tap targets and text sizes. Screenshot every route.

If a route fails any of the above, it is not done.

Build / dev

  • npm run dev → port 6007 (nohup-detached: nohup npm run dev > /tmp/plant-dev.log 2>&1 & disown)
  • npm run build → 15 routes, webpack mode (PWA is webpack-only)
  • npm run typecheck → npx tsc --noEmit
  • npm run seed → wipe + re-import data/source/*.json into PocketBase. Fails loudly on any unmatched row or broken VAT.

Color palette — never change

Coolors:

  • #EDAE49 Sunny — orange/positive accent
  • #D1495B Brick Red — deficit/destructive
  • #00798C Notartis Seaweed — teal/stable
  • #30638E Lights Casual — main blue/brand
  • #003D5B Indigo Dye — deep navy

Chart marks (deeper steps of the same hues — see HANDOFF-PROMPT-3 §A.4):

  • --color-chart-income (light #0090A6, dark #00A6BE)
  • --color-chart-fixed (#BE851F both)
  • --color-chart-running (light #C13B4D, dark #D94F60)

Cost model

  • lib/profit.ts is the single source of truth for profit. Default includeRunningCost: false (matches workbook). To flip: one-line change in lib/profit.ts.
  • Term 1 = instalment ✅ confirmed.
  • Term 2 = insurance ✅ confirmed.
  • Term 3 = operator wages — varies per month per machine — STILL NEEDS CLIENT INPUT.

Open questions

  • Q1: Does profit include running cost? (default: no, matches workbook).
  • Q2: What is term 3 of the fixed-expense formula? (See Round 1/2/3 HANDOFF-PROMPT files.)

PocketBase

  • URL: process.env.NEXT_PUBLIC_PB_URL (env or .env.local)
  • Auth: pb.collection("_superusers").authWithPassword(env) (Round 1 §5.3)
  • Collections: assets, monthly_income, monthly_running_costs, overheads, cost_lines
  • monthly_income no longer carries running_cost — derive from monthly_running_costs at read time