Commit graph

40 commits

Author SHA1 Message Date
Francisco Solla
45e29a7785 feat(OPS52-media): recupera os objetos de media de produção do WordPress para o bucket (pnpm media:recover)
All checks were successful
Agent PR Ready + auto-merge / ready-automerge (pull_request) Has been skipped
CI (PR) / docs-guards (pull_request) Successful in 7s
CI (PR) / plans-only-closes (pull_request) Successful in 8s
CI (PR) / scope (pull_request) Successful in 51s
CI (PR) / lint (pull_request) Successful in 1m4s
CI (PR) / format (pull_request) Successful in 1m14s
CI (PR) / typecheck (pull_request) Successful in 39s
CI (PR) / knip (pull_request) Successful in 40s
CI (PR) / cycles (pull_request) Successful in 39s
CI (PR) / unit (pull_request) Successful in 1m0s
CI (PR) / int (pull_request) Successful in 2m39s
CI (PR) / build (pull_request) Successful in 4m2s
CI (PR) / e2e (2) (pull_request) Successful in 6m2s
CI / e2e (1) (push) Successful in 6m39s
CI (PR) / e2e (1) (pull_request) Successful in 7m26s
CI (PR) / checks (pull_request) Successful in 7s
Promote plan-issue Related on main merge / plan-issue-ready (pull_request) Has been skipped
Main merge flips claimed issues to done + in-prod / issue-done (pull_request) Successful in 19s
Agent pool supervisor / tick (pull_request) Successful in 42s
CI / int (push) Successful in 2m52s
CI / static (push) Successful in 2m57s
CI / build (push) Successful in 3m52s
CI / e2e (2) (push) Successful in 5m34s
CI / checks (push) Successful in 2s
CI / deploy homeserver (teqo-1313) (push) Successful in 8m27s
- scripts/recover-media.mjs: CLI de reconciliação (reconcile/--dry-run/--verify)
  — lê rows de media + posts.coverImage, resolve a capa com a mesma lógica do
  seed (featured media, senão 1ª imagem inline), PutObject com key = filename;
  DB nunca escrito; fail-closed (S3_* completas, ALLOW_REMOTE_DB, echo do alvo,
  timeouts curtos, covers só do origin WP e image/*)
- scripts/lib/wpArticles.mjs: fetch ao vivo do WordPress extraído do seed
  (sem twin), helpers puros de resolução + row→cover mapping (unit-testados)
- seed-posts.mjs: importa o fetch da lib (comportamento idêntico) e usa
  resolveCoverSource em processContent
- runbook de execução no homeserver (impl plan), nota no AGENTS.md, changelog
Closes #10
2026-08-18 08:20:45 -03:00
Francisco Solla
dabc00f46c ops(OPS52): migra a media de produção do Vercel Blob para o Garage S3
- payload.config.ts: vercelBlobStorage -> s3Storage (@payloadcms/storage-s3)
  com endpoint Garage (forcePathStyle, region garage); bucket privado — o
  staticHandler do plugin streama os objetos em /api/media/file/<filename>,
  mantendo o contrato de URL relativa das 40 rows pré-existentes
- src/utilities/mediaStorage.ts: resolveS3StorageEnv fail-closed (S3_* parcial
  -> throw no boot com a lista exata; nenhuma -> storage local dev/test)
- seed-posts: remove pre-delete do @vercel/blob (S3 sobrescreve nativamente)
- worktree-env.mjs: s3EnvCopiedLines all-or-nothing (unit-testada)
- envs S3_BUCKET/S3_ENDPOINT/S3_REGION/S3_ACCESS_KEY_ID/S3_SECRET_ACCESS_KEY
  no .env.example/.env.test; cloud-setup.sh sem o sed morto do blob
- deps: -storage-vercel-blob -@vercel/blob +storage-s3; importMap regenerado
- docs: impl plan (revisão A->B: Garage v2 sem acesso anônimo na API S3),
  AGENTS.md, changelog 2026-08-18-ops52
2026-08-17 22:36:34 -03:00
Francisco Solla
7ddc281f22 feat(site): publica home da campanha Jorge Solla 1313 2026-08-16 00:49:24 -03:00
Francisco Solla
70070db8dc feat(C114): agenda da campanha espelhada no Google Calendar com notificação (push Teqo → Google)
Espelho oficial da agenda em calendário Google compartilhado via API
(service account, jose + fetch): reconciliação por passada com id
determinístico teqo+base32hex (upsert idempotente, sem estado por evento),
hooks afterChange/afterDelete na activity (só campos espelhados, nunca
lança), auto-resync quando calendarId muda, retry na view da agenda,
pill de estado no header + FAB + diálogo (4 estados). Cancelado no Teqo
deleta o evento no Google. Sem participantes no v1 (decisão de produto).
Sem migration nova de tabela (hand-written). Closes #635
2026-08-11 13:53:51 -03:00
Francisco Solla
fdedfa9ad4 feat(C97): seletor shadcn de dia+horário 24h no popover de criação rápida da agenda
Troca o datetime-local nativo (AM/PM no idioma do browser, horário pouco
confiável) por ActivityDateTimeField: trigger com rótulo civil
dd/mm/aaaa às hh:mm + popover com Calendar (react-day-picker 9.7,
timeZone America/Bahia, locale pt-BR) e selects Hora 00-23 / Minuto
em passos de 15. Contrato de valor e submit inalterados; prefill do
slot mantido. Novo ui/Calendar.tsx (variante radix-nova), helpers
puros em campaignTime.ts. Sem migration. Closes #482 (PR).
2026-08-09 15:13:15 -03:00
Francisco Solla
5be317318d
chore(ai-chat): Sollinha volta para a DeepSeek direta (api.deepseek.com) (#476)
O cache-hit do DeepSeek-V4-Flash custa $0.0028/M contra $0.018/M na
Deep Infra (~6,4x mais barato), e a Sollinha tem prefixo estável
(system prompt + tools + historico), entao o custo efetivo cai. Mesmo
modelo (deepseek-v4-flash), mesmas tools. @ai-sdk/deepseek pinado em
3.0.19 para ficar na ferroviaria provider 4.0.4 / provider-utils
5.0.18 do ai@7.0.47 (o ^ flutuaria a 3.0.26 e duplicaria 4.0.7).

STT (B173) permanece na Deep Infra: whisper-large-v3 a $0.00045/min
de audio e o mais barato verificado (Groq $0.0019, OpenAI $0.006).
.env.example documenta as duas chaves: DEEPSEEK_API_KEY (LLM) e
DEEPINFRA_API_KEY (STT).
2026-08-09 06:11:00 +00:00
Francisco Solla
3a8506ad06 chore(ai-chat): Sollinha via Deep Infra — mesma API e chave dos agentes
Troca o provider da Sollinha de @ai-sdk/deepseek (api.deepseek.com) para
@ai-sdk/deepinfra (API OpenAI-compatível da Deep Infra), mantendo o mesmo
modelo deepseek-ai/DeepSeek-V4-Flash e as mesmas tools. Uma chave só
(DEEPINFRA_API_KEY), a mesma dos agentes; rollback = git revert.

Closes #449
2026-08-09 00:06:12 -03:00
Francisco Solla
59983b33f7 feat(campanha): C15 — FullCalendar em /campanha/agenda
Issue #390 — entrada operacional staff com FullCalendar v7 route-local
(semana/mês/lista), filtros compartilháveis por município/deputado/tag,
criação pelo slot, detalhe por URL e remarcação drag/resize sob RBAC,
transação e lock por atividade.

- /campanha/atividades e giros permanecem como lista/fluxos legados
- Sem migration/collection nova; reutiliza activity de C14
- Fuso Bahia, range exclusivo, erro/revert, loading/empty testados
- Leader negado, advisor limitado pelo access atual
- E2E cobre filtros, drag, mobile 390x844 e slot prefill
- Int specs cobrem RBAC, concorrência e defense-in-depth

Impl: docs/plans/fullcalendar-agenda-campanha-impl.md
2026-08-07 04:37:36 -03:00
Francisco Ignácio Fontoura Solla
f9cd1df7b2 feat: AI chat 'Sollinha' — campaign data assistant (v1 read-only)
- Streaming AI endpoint at /campanha/api/ai-chat with DeepSeek V4 Flash
- 8 tools: calculate, getMunicipalityVotes, getTopDeputies, getDobradinhas,
  getMunicipalityOverview, getLeaderships, getOrganizations, searchEntities
- In-memory rate limiter (50 msgs / 15 min per user)
- Desktop: resizable right sidebar via react-resizable-panels
- Mobile: full-screen Drawer opened by FAB (2/3 size of quick-actions FAB)
- Markdown rendering with react-markdown + remark-gfm (tables, bold, lists)
- Session-bound context (clean slate each open)
- Auth via existing campaign-token cookie, tools respect user RBAC
- Architecture doc: docs/plans/ai-chat-sollinha.md
- E2E tests: campaignAiChat.e2e.spec.ts (mocked endpoint)
2026-08-04 06:17:31 -03:00
Cursor Agent
de67acf41b D2 — Push + sino in-app para /campanha
- Collections Notification e PushSubscription com migration
- Sino no header (mobile + desktop) com drawer de avisos lidos/não lidos
- Hooks em municipalityUpdate, supporter, activity e convite aceito
- Push Web via web-push + handlers no service worker /campanha/sw.js
- Opt-in LGPD em /campanha/perfil (chave campanha-notificacoes-push)
- Testes unit/int de contrato e access

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-07-31 01:51:41 +00:00
Francisco Ignácio Fontoura Solla
763f64080a Deliver B40: biometric login for /campanha.
WebAuthn platform passkeys: opt-in enrollment after a password login, a
password-less sign-in that mints the same 14-day campaign-token, and
revocation from the profile. The session is minted through Payload's public
pieces (checkLoginPermission, addSessionToUser, getFieldsToSign, jwtSign)
inside a transaction with an advisory lock, so a passkey login neither
bypasses a lockout nor evicts the account's other sessions. The rpID is
derived from NEXT_PUBLIC_SITE_URL and resolves to null when the request host
disagrees, so previews never offer a ceremony the browser would refuse.
2026-07-28 10:59:23 -03:00
Francisco Ignácio Fontoura Solla
84e796ab49 B8 F2: polígonos das ZE de Salvador e re-keying do coroplético por map key
Salvador era um polígono só carregando os votos da cidade inteira, então o
coroplético não conseguia responder "qual pedaço de Salvador está fraco / é
meu". As 19 ZE ganham polígono próprio, dissolvido da malha de bairros do IBGE
(Censo 2022) pela lista de circunscrição da RA 02/2017 do TRE-BA, e o mapa passa
a pintar por map key (slug para as zonas, ibgeCode para o resto) em vez de
codarea. O polígono municipal de Salvador continua desenhado por baixo, sem dado
e sem interação, para não abrir buraco no contorno do estado.

Aproximação declarada na copy e no cabeçalho do script: o TRE publica a
circunscrição como lista de bairros, então o bairro é o átomo geométrico —
Periperi, que a resolução corta na Rua das Pedrinhas, vai inteiro para a ZE 17.
competitiveRank segue por cidade (o artefato TSE só tem federalRankByIbgeCode).

Sem migration, sem collection, sem action, sem Consent.
2026-07-26 23:08:09 -03:00
Francisco Ignácio Fontoura Solla
e6f7c2e70f Tooling: prettier como autoridade de formatacao (organize-imports deterministico, scripts format/format:check, normalizacao mecanica de 312 arquivos; artefatos gerados e migrations excluidos via .prettierignore) 2026-07-25 17:22:20 -03:00
Francisco Ignácio Fontoura Solla
d14ed67801 Ship E4R: always-overwrite seed of projection spreadsheet into voteGoals and priority.
One-shot CLI (`pnpm db:seed:projecao`) matches MAPA GERAL to municipalities, skips Salvador, and re-seeds when a newer sheet arrives; dry-run + docs/roadmap updated.
2026-07-24 13:13:46 -03:00
Francisco Ignácio Fontoura Solla
0e4e6855dc Add the tooling gate: knip, CI, zero-warning lint, as-never ban
- knip (files/deps at error level; unused exports ledgered as warn) with
  config for Payload/Next entries; deleted the dead modules it confirmed:
  RecentlyVisited + UpcomingActionPlansCard + actionPlanUpcomingPreview,
  lazy-dialog helpers, tseZone, federalCandidateTotalsAggregate (test-only),
  unused ui kit files, one-shot rename script; pruned unused radix deps and
  typescript-eslint; added pg/@types/pg (pinned to drizzle's 8.10.2)
- GitHub Actions CI on the mirror: lint, typecheck, knip, unit, migrate, int
  against a Postgres 17 service
- eslint: unused-vars with ^_ ignore patterns (migrations args exempt),
  repo-wide ban on `as never` (no-restricted-syntax), lint gate at
  --max-warnings=0; fixed all 54 pre-existing warnings (dead imports,
  hooks deps, tracking-pixel img disable with impeccable config exception)
- tsconfig: include consolidated from 219 lines to 5 (wildcard covers all
  .next dist variants), noUnusedLocals on
- typed replacements for every as-never: hookFilledCreateData (actions
  create data completed by collection hooks), drizzle scopeColumn narrowing,
  tests' stub<T> helper (property-level checking kept, completeness waived)
- test infra: leased-consent generalization used by onda0 spec (shared
  leases over the stable consent keys; window race ledgered), purge fix
- docs: IMPROVE-CODE-QUALITY-PLAN.md tracker, TECH-DEBT.md ledger,
  TESTING.md safety-net map (package.json also gains the Phase 2
  build:election-aggregates script entry; the script lands next commit)
2026-07-23 23:06:12 -03:00
Francisco Ignácio Fontoura Solla
d93e2aa72f Add admin CSV export for signatures and contacts.
Enables @payloadcms/plugin-import-export on signature (flattened contact/petition columns) and contact (native fields) so operations can download filtered lists for external ESP/SMS workflows.
2026-07-23 00:53:04 -03:00
Francisco Ignácio Fontoura Solla
0cb83bdfa6 Adopt TypeScript 6 for tooling and TypeScript 7 for typecheck.
Dual-package setup keeps ESLint/editor on the TS 6 API while pnpm typecheck uses Go tsc 7.0.2; tsconfig drops deprecated baseUrl and adds ambient CSS module declarations.
2026-07-21 20:32:15 -03:00
Francisco Ignácio Fontoura Solla
b8547ff292 Deliver B3 Leaflet choropleth maps and register post-simplify follow-ups.
Add BahiaMap surfaces on nuclei list, detail, and geral dashboard with server-side choropleth aggregation, lazy geometry loading (B5 F1), and roadmap plans for A7 F4, B5 F3, and B6 scale debts.
2026-07-19 17:13:27 -03:00
Francisco Ignácio Fontoura Solla
7fb688ab95 Add pre-push typecheck hook and fix campaign avatar field access.
Wire husky with a typecheck script, await the async avatar update guard, harden Onda 0 consent unit tests, and extend the roadmap implementation skill with Impeccable UI gates.
2026-07-19 12:10:59 -03:00
Francisco Ignácio Fontoura Solla
3b463173da Add campaign password reset, profile photo, and RS+ follow-up plan.
Deliver self-service forgot/reset via Resend, logged-in password change, and optional avatar on /campanha/perfil; register post-simplify engineering debts as RS+.
2026-07-19 05:26:56 -03:00
Francisco Ignácio Fontoura Solla
e5968f81d5 Add static Bahia municipality and territory geometries for the campaign map.
Ship TopoJSON meshes, IBGE code lookups, a re-runnable build script, and evidence tests so B3 can render Leaflet surfaces without PostGIS.
2026-07-18 22:07:41 -03:00
Francisco Ignácio Fontoura Solla
c42b16baab Add TSE 2022 election results model and local seed import. 2026-07-18 18:25:19 -03:00
Francisco Ignácio Fontoura Solla
bcac665cb5 Ship /campanha nuclei MVP with RBAC, invites, and vote estimates.
Adds electoral nuclei, leaderships, updates, and WhatsApp invite flows behind campaign auth, plus the consolidated schema migration that Vercel applies on deploy.
2026-07-18 15:01:56 -03:00
Francisco Ignácio Fontoura Solla
bcb6c6c014 Make posts seed idempotent against the shared Vercel Blob store
The Vercel Blob store is shared across environments and the
@payloadcms/storage-vercel-blob plugin uploads via put() without
allowOverwrite (and exposes no option to enable it). Cover images left
under the deterministic <slug>.<ext> key by an earlier run therefore made
the prod seed abort with "This blob already exists" on the first upload.

Delete any orphan blob at that key (via @vercel/blob del, idempotent) right
before creating a new media doc, so uploads are deterministic and the seed
stays re-runnable. Existing media rows are still reused, so no duplicate
media is created.
2026-07-15 21:18:16 -03:00
Francisco Ignácio Fontoura Solla
28647e4760 Add Post and Tag collections for news and publications
- Add Post + Tag collections (notícias/publicações) with tag-based
  "Esconder" visibility control for electoral-law compliance
- Add static SEO routes /[type]/[category]/[slug] plus /[type] and
  /[type]/[category] listings, with shared header/breadcrumb and PostCard
- Recreate the homepage and refresh the site color palette (styles.css)
- Add posts/slug/seo utilities and revalidation wiring (documents.ts)
- Add live-fetch seed script (scripts/seed-posts.mjs + seed-loader.mjs,
  db:seed:posts)
- Upgrade Payload 3.79.0 -> 3.82.0 (fixes admin relationship-filter crash)
- Remove obsolete Header component; add shadcn card/badge/breadcrumb;
  update AGENTS.md and components rule docs
2026-07-15 19:12:11 -03:00
Francisco Ignácio Fontoura Solla
712649eecf Replace state/city selects with type-to-filter comboboxes
Turn StateSelect and CitySelect into autocomplete comboboxes so long
lists no longer bias people toward the top option. A shared FormCombobox
wraps shadcn's (Base UI) Combobox and bridges it to react-hook-form via
useController, storing the state code / city name while displaying a
label. Matching is accent-insensitive and prefix-based; the list opens
after 1 character and results are alphabetical. State searches by both
full name and initials (new StateNames map).

Adds @base-ui/react + shadcn combobox/input-group primitives, and
documents our export-const and named-hook-import conventions in the
components rule (with the src/components/ui/* shadcn carve-out).
2026-07-15 14:41:58 -03:00
Francisco Ignácio Fontoura Solla
4f22824d4f Fix ESLint flat config so pnpm lint runs
The flat config spread eslint-config-next's subpath imports as if they were
flat-config arrays, but that package ships legacy eslintrc configs, so lint
crashed before checking any file. Wrap them with FlatCompat (add
@eslint/eslintrc) and fix the two pre-existing react/no-unescaped-entities
errors so lint passes.
2026-07-15 13:56:53 -03:00
Francisco Ignácio Fontoura Solla
9313eb7f29 feat: Add schema-dts to package.json and update SEO metadata
Adds the `schema-dts` dependency to `package.json` for structured data.
Updates the petition page to include JSON-LD schema markup for improved
SEO and rich results. This involves extracting the first image from the
Lexical editor or falling back to a global image for Open Graph and
schema.org metadata.
2026-05-01 02:13:39 -03:00
Francisco Solla
0695ae8082 solve payload next peer dependency conflict 2026-03-15 14:09:01 -03:00
Francisco Ignácio Fontoura Solla
f804da60eb Including page mandato-no-whatsapp 2026-03-14 18:07:40 -03:00
Francisco Ignácio Fontoura Solla
5460eeee3c fix: Create petition: Downgraded back to Next 15, removed revalidation on first draft save, chaged reavlidation patter to factory mode to support a revalidation tag per document 2026-03-08 22:53:57 -03:00
Francisco Ignácio Fontoura Solla
4c59c965b0 chore: align Payload package versions and refresh admin import map
- pin @payloadcms/live-preview-react to 3.76.1
- pin @payloadcms/storage-vercel-blob to 3.76.1
- update lockfile accordingly
- regenerate Payload admin import map for Vercel Blob client upload handler
2026-02-23 01:15:43 -03:00
Francisco Ignácio Fontoura Solla
c841d59abe feat: configure Vercel Blob storage for Payload media uploads
- add @payloadcms/storage-vercel-blob dependency
- configure vercelBlobStorage plugin in payload config
- enable Blob-backed storage for media collection using BLOB_READ_WRITE_TOKEN
2026-02-23 01:01:29 -03:00
Francisco Ignácio Fontoura Solla
d8794c6e13 feat: add Vercel telemetry and wrap Payload layout in Suspense
- add @vercel/analytics and @vercel/speed-insights dependencies
- integrate Analytics and SpeedInsights into frontend root layout
- wrap (payload) RootLayout with Suspense to improve admin rendering compatibility
- apply minor formatting cleanup in revalidateGlobal
- update lockfile for dependency changes
2026-02-23 00:21:33 -03:00
Francisco Ignácio Fontoura Solla
14961c5fea feat: overhaul petition UX, add contact/signature data model, and refresh shadcn theming
- redesign petition page layout with responsive hero, content section, and form card
  ()
- refactor frontend theming setup:
  - add  with  in frontend layout
  - migrate/clean global style tokens and base styles in
  - adjust header/social visuals for theme-aware rendering
  (, ,
   , , )
- expand petition form with additional fields and new UI primitives
  (native select, textarea, button, state/city flow)
  (, , , )
- add new Payload collections and wire them into config:
  , ,
  (, ,
   , ,
   )
- update petition collection admin grouping and project config
  (, , )
- add supporting dependency/lockfile updates and workspace tooling tweaks
  (, , , )
2026-02-22 20:02:51 -03:00
Francisco Ignácio Fontoura Solla
8f3bd3845b Migrate from unstable_cache to use cache. And start Petition Form 2026-02-17 22:16:53 -03:00
Francisco Ignácio Fontoura Solla
0e9dcceb83 Update to NextJS 16 2026-02-17 01:56:16 -03:00
Francisco Ignácio Fontoura Solla
375398af84 feat(live-preview): enable Payload live preview for site settings global
- add  dependency
- configure  in  for
- add  client utility to refresh Next routes on live updates
- mount live preview refresh bridge in frontend layout
- enable drafts/autosave/schedule publish for  global
- regenerate  and update lockfile
2026-02-15 11:13:29 -03:00
Francisco Ignácio Fontoura Solla
c3d1e5c717 feat: add Tailwind CSS integration
Install and configure Tailwind CSS v4 for the frontend app, wire PostCSS processing, and add a visible utility-class example to confirm styles are applied.
2026-02-14 16:47:25 -03:00
Francisco Ignácio Fontoura Solla
87ebb726d2 feat: initial commit 2026-02-14 16:11:51 -03:00