Imported from saoirineu/saoirineu.github.io (
AGENTS.md). Install upstream withnpx skills add saoirineu/saoirineu.github.io. Copyright stays with the author.
AGENTS
Purpose
This repository contains a Firebase-backed knowledge app with a Vite/React/TypeScript frontend in frontend/ plus documentation and ontology/data assets at the repository root.
Agents working here should optimize for small, verified changes and preserve user work already in progress.
Architecture
- The frontend is the primary runtime surface.
- Keep Firebase Auth and Firestore access in
frontend/src/lib/. - Keep route pages thin: query orchestration, mutations, and composition in the page; form mapping and large JSX sections in nearby modules.
- Reuse shared normalization helpers such as
frontend/src/lib/firestoreData.tsinstead of duplicating Firestore shaping logic. - See
docs/arquitetura-frontend.mdfor detailed frontend structure and examples. - See
docs/firestore-schema.mdwhen changing collections or document fields.
Build And Test
make servestarts the frontend dev server.cd frontend && npm run buildis the primary validation command.cd frontend && npm run testruns the Vitest helper suite.cd frontend && npm run lintmust stay clean; it runs with--max-warnings 0.make firestore-rulesdeploys Firestore rules.make storage-rulesdeploys Firebase Storage rules.make firebase-rulesdeploys both Firestore and Storage rules.make deploy-functionsbuilds and deploys Cloud Functions.make deploy-backenddeploys Firestore rules, Storage rules, and Cloud Functions.make mail-relay-secretpushes the mail relay's shared secret (see Safety).
Conventions
- Prefer strict typing over
anycasts. - Keep Portuguese UI copy and the existing Tailwind-heavy styling approach.
- Show dates through
frontend/src/lib/dateFormat.tsand edit them withcomponents/DateInput.tsx: dd/MMM/yyyy in pt/es/it, MMM/dd/yyyy in en, following the site language rather than the browser's. AvoidtoLocaleStringand visible nativetype="date"inputs. Store dates as YYYY-MM-DD. - Store pure form/payload helpers beside their page domain, using the
pages/<domain>/form.tspattern. - Add tests around pure helpers before expanding refactors; current baseline lives beside the helper modules as
*.test.ts. - Link to existing docs instead of duplicating them in new instruction files.
Safety
- Keep changes focused; do not reformat unrelated files.
- Check local changes before editing active feature files.
- Active work area: the generic events engine (
frontend/src/lib/events.ts,frontend/src/lib/eventRegistrations.ts,frontend/src/lib/leaderReview.ts,frontend/src/pages/events/,EventRegistrationPage.tsx,EventsAdminPage.tsx,LeaderReviewPage.tsx). Check recent git history before editing these. (The bespoke European Gathering code was retired in June 2026 — EG is now theevents/encontro-europeu-2026instance.) - Work records (
trabalhos,WorksPage.tsx,pages/works/,lib/churchManagers.ts,lib/workTypes.ts) book Daime through theonWorkSacramentChangeCloud Function, which ownssacramentTransactions/work-{workId}. Never write those movements from the client; the rules keep the ledger custodian-only. Read docs/work-records.md for the access model and known limitations. - Donations to ICEFLU Brazil (
icefluDonations,DonationsPage.tsx,pages/donations/,lib/donations.ts) share that access model throughproviders/useChurchRecordAccess.ts. Their receipts live in Storage underchurches/{churchId}/donations/{donationId}/, and the Storage rules refuse overwrites so a reviewed donation's proof cannot be swapped. See docs/iceflu-donations.md. - Do not modify generated files unless they change as a result of a validated command.
- Email does not go over SMTP. Cloud Functions POST to a PHP relay hosted on the santodaime.it cPanel (
scripts/portal-mail/), because Serverplan blocks Google's egress IPs. Deploying functions does not update that endpoint — it is uploaded by hand through cPanel — and its shared secret is mirrored in two places that must change together. Send mail only throughdeliverOrQueue()(the mail queue, with retries and guards), neversendPortalMail()directly. Read docs/email-delivery.md before touching either or anything underscripts/portal-mail/.make test-mail-queueruns the queue against the Firestore emulator. - Use route-level lazy loading and domain splits before accepting bundle growth.
Key Paths
frontend/src/lib/: Firebase and Firestore access helpersfrontend/src/pages/: route-level screens and nearby helper modulesfrontend/src/components/: reusable UI shell componentsfrontend/src/providers/: auth and shared context statedocs/: architecture, schema, and agent-facing reference docs
Docs
- Update this file when commands, architectural boundaries, or sensitive areas change.
- Prefer linking
docs/arquitetura-frontend.md,docs/firestore-schema.md, anddocs/agentes-e-customizacoes.mdinstead of copying their content here.