Commit graph

239 commits

Author SHA1 Message Date
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
7700bff39d chore: update references to .cursor bootstrap paths
Point environment.json, hooks, skills, and docs at the relocated .cursor/ files.
2026-08-05 01:39:42 -03:00
Francisco Solla
7312f155b6 chore: move Cursor hooks and cloud bootstrap to .cursor/
Relocate environment.json, hooks, and Postgres setup scripts so Cursor discovers them from the canonical project paths.
2026-08-05 01:38:52 -03:00
Francisco Ignácio Fontoura Solla
a2fbcb9c00 chore(agents): reorganiza árvore de skills — .claude/.cursor → .agents
- Remove .claude/skills (symlinks) e a árvore .cursor (rules, hooks, skills)
- Adiciona .agents/ com skills (+ references/), rules/, hooks/ e scripts
- Adiciona .codex/hooks.json (hook do impeccable)
- Corrige referências .cursor → .agents em environment.json, hooks.json e AGENTS.md
2026-08-03 21:24:11 -03:00
Cursor Agent
b7f4e16c0f
feat(ops): OPS18 — Action promote Related #N no merge
Safety net dual com agent:ready: no merge em main, workflow lê Related #N
e promove Issues ainda aguardando plano (canPromotePlanIssue), soft-skip
idempotente. Helper parseRelatedIssueNumbers + pins unitários.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-03 00:20:48 +00:00
Cursor Agent
6eb6a91f04
fix(ops): remove conflict markers from plan-issue skill after rebase 2026-08-03 00:06:14 +00:00
Cursor Agent
6773bbb526
docs(ops): alinhar contrato agent:ready ao canPromotePlanIssue 2026-08-03 00:06:14 +00:00
Cursor Agent
d2cc1d2693
feat(ops): OPS17 — plan-issue blocked até plano em main
Register com --plan nasce blocked (não claimável); pnpm agent:ready
promove após o plano em main. Gate da skill plan-issue endurecido.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-03 00:06:14 +00:00
Francisco Ignácio Fontoura Solla
cb8881177c docs(plan-issue): require Cursor canvas UI draft at gate when UI changes 2026-08-02 20:13:36 -03:00
Francisco Ignácio Fontoura Solla
8a712510f5 docs(plan-issue): ciclo blocked→ready + planos in-progress imutáveis
Documenta o ciclo de vida (gate → register blocked → Related → merge →
promote) e proíbe editar planos de Issues já claimadas ou fechadas.

Related #292
Related #296
2026-08-02 18:53:07 -03:00
Francisco Solla
13d62bc539
Merge pull request #247 from fsolla/cursor/faef5f54
Separate intention plans from engineering execution in agent skills
2026-08-02 14:15:07 -03:00
Francisco Ignácio Fontoura Solla
7f803ad14a docs: clarify product locks vs editable engineering
Agents were treating "locked decisions" and the 3+ call-site rule as a ban on changing prior code. Reframe product constraints, prefer editing the owner over twins, and mark the campaign notebook as changelog-only.
2026-08-02 14:08:07 -03:00
Francisco Ignácio Fontoura Solla
8bca9d8e82 Separate intention plans from engineering execution in agent skills.
plan-issue now shapes product intent only; agent-work-issue (pool) and
work-issue (human gate) deliberate the implementation plan before coding.
2026-08-02 14:02:18 -03:00
Francisco Ignácio Fontoura Solla
a7e1a8f2e7 Drop internal WhatsApp bridge plans; keep wa.me only.
Unofficial linked-device bridges risk banning staff phone numbers; D3–D5 stay wontfix and their plan files are removed.
2026-08-02 13:39:40 -03:00
Francisco Solla
8c6b838797
Merge pull request #238 from fsolla/cursor/pool-hard-max-12
Raise agent pool hard max to 12
2026-08-02 13:32:15 -03:00
Francisco Ignácio Fontoura Solla
186950168b Raise agent pool hard max slots from 8 to 12.
Default remains 5; parsePoolConfig now clamps POOL_MAX_SLOTS up to 12.
2026-08-02 13:30:36 -03:00
Francisco Ignácio Fontoura Solla
29b2b0d895 Add addyosmani agent skills and wire plan-issue to them
Install the engineering skill pack under .agents/skills with skills-lock entries, and extend plan-issue with a skills map plus decision/template hooks.
2026-08-02 13:28:58 -03:00
Cursor Agent
1ad8863994
OPS12 — CI bloqueia Closes/Fixes em PR só docs/plans
- Lógica pura em plansOnlyClosesGuard.mjs + CLI check-plans-only-pr-closes
- Job plans-only-closes em ci-pr.yml (rollup checks)
- Unit tests com fixture do incidente #115
- plan-issue, agent-pr-workflow, PR template e GUARDRAILS atualizados

Closes #116

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-01 11:26:19 +00:00
Cursor Agent
196e15b827
fix(agent-pool): pin fast=false on Cloud Agent spawns
Cursor's Create-Agent API defaults omitted `fast` to true, so pool
workers requesting composer-2.5 were billed as composer-2.5-fast.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-01 06:56:57 +00:00
Cursor Agent
b150644d21
OPS: Ready+auto-merge for all agent PRs including audit
Remove the engineering-audit artifact exception; add a GHA safety net
that marks cursor/* → main PRs Ready and arms auto-merge.
2026-08-01 03:55:56 +00:00
Cursor Agent
69aafbb219
fix(agents): alwaysApply Ready+auto-merge; Cloud must pass draft:false
agent-pr-workflow was correct but not alwaysApply, so Cloud agents
followed ManagePullRequest's draft default. Make the rule always-on,
document the ManagePullRequest path, and narrow the engineering-audit
"no auto-merge" exception to the audit sign-off PR only.
2026-08-01 03:51:08 +00:00
Cursor Agent
df76e70a8a
docs(agent-pool): invoke flow is status-first, confirm before start
Skill no longer reads as start-only: always emit pool status + eligible
queue with the next maxSlots highlighted; ask before start when off;
when already on, stay in session monitoring without auto-restart.
2026-08-01 03:48:19 +00:00
Cursor Agent
18fe4f8e9b
fix(agent-pool): ban -fast model slugs
Never map or request fast=true. Slugs ending in -fast are stripped to
the base (with a warn); model-selection and the pool plan document the ban.
2026-08-01 03:34:35 +00:00
Cursor Agent
629364f3e4
fix(agent-pool): map Grok effort + Kimi reasoning slugs to Cloud API
cursor-grok-4.5-{low,medium,high}[-fast] and kimi-k3-low were falling
back to composer-2.5 against live /v1/models (grok-4.5 + effort,
kimi-k3 + reasoning). Teach resolvePoolModel the mapping, document
when to pick each Grok effort in model-selection, and align plan/work
skills.
2026-08-01 03:32:41 +00:00
Francisco Ignácio Fontoura Solla
f021992de0 ci: main-only cutover with gated Vercel deploy
Remove stage/promote/Neon smoke. PR CI targets main; ci.yml full-suite
verifier deploys via vercel CLI and requeues when HEAD moves. Pool uses
POOL_GITHUB_TOKEN and POOL_BASE_REF=main. Docs/skills/rules retargeted.
2026-07-31 20:57:18 -03:00
Francisco Ignácio Fontoura Solla
5237fa9d79 docs(skills): model-selection Composer / Grok / Kimi K3 only
Collapse the canonical table; bipartition for complex issues; drop
K2.7/Haiku/GLM/Gemini from the happy path.
2026-07-31 20:57:18 -03:00
Cursor Agent
503a775b9f fix(cloud): ensure-postgres bootstrap before teqo readiness check
Warm Cloud snapshots often have PostgreSQL online without the teqo
role/DBs. start_postgres previously gated on teqo_ready, exited before
bootstrap_databases, and marked the environment INSTALL_FAILED even
though agents still ran. Also pin DATABASE_URL and assert migrations
in cloud-setup so a silent no-op migrate cannot slip through.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-07-31 20:57:18 -03:00
Francisco Solla
5a6591e9b1 chore(ops): engineering-audit pronta para rodada autônoma no Cursor Cloud (#79)
- Precheck solitário fail-closed (pnpm agent:pool -- status; gh read-only no Cloud não pausa o pool)
- Sign-off em modo autônomo = PR dos artefatos (Ready, base stage); P0/P1 e guardrails de misses executam na sessão
- Harvest kind:agent-miss: investigação via gh issue view; fechamento via Closes #N + flip determinístico do issue-done-on-stage-merge.yml
- Âncora de delta: foco no churn desde a data do último Pass em vez de --since=3months

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-07-30 23:13:34 -03:00
Francisco Ignácio Fontoura Solla
5987aedeaf chore(ops): Cloud Agents rename session and use pnpm push without Docker
Document native Postgres on Cloud (no db:start) and that gate:fast/push need no DB. Print rename_chat title in agent:claim brief; reinforce rename_chat + pnpm push (not raw --no-verify) in work-issue skill.
2026-07-30 21:40:46 -03:00
Francisco Solla
e04db48742 feat(ops): auto-promote stage→main e merge em stage sem exigir head (#68)
* feat(ops): auto-promote stage→main e merge em stage sem exigir head

Substitui o promote manual por workflow disparado no ci-stage green,
relaxa strict na proteção de stage (script configure:branch-protection)
e documenta o novo paradigma em AGENT-OPS e work-issue.

* style: format AGENT-OPS and configure-branch-protection for ci-pr

* feat(ops): pnpm push com ensure-repo-deps determinístico

Bootstrap install + Husky antes de todo push (pnpm push e pre-push).
Documenta fluxo canônico em work-issue, agent-pr-workflow e AGENT-OPS.

* fix(ops): pnpm push roda gate no script, sem depender do Husky

Cloud environment.json chama prepare explicitamente após install.

* test(int): isolate advisor portfolio search from shared cairu slug

Parallel int specs were stomping municipality.advisors on the fixed
cairu row; allocate per-test municipalities instead.
2026-07-30 21:12:52 -03:00
Francisco Solla
680ff56754 feat(agent-pool): orquestrador de pool de workers Cursor Cloud (fases A–D) (#65)
* feat(agent-pool): fundacao read-only do orquestrador (fase A)

- docs/plans/agent-pool-orchestrator.md: plano completo (14 secoes)
- buildClaimQueue extraido de agent-claim para agent-github (comportamento identico, pinado)
- agent-pool-eligibility: isAutonomousClaimable puro e fail-closed + buildPoolQueue
- agent-pool-state: parsePoolConfig, marcadores pool-worker, classifyPoolClaim, spawn plan, auto-stop
- agent-pool-github: leitura de repo variables (degrada nao-estrito), claims/PRs/migration-lock
- pnpm agent:pool -- status|tick --dry-run (inspecao local; live chega na fase B)
- 34 specs unit novos (992/992 verde); lint/tsc/knip/cycles/format verdes

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>

* feat(agent-pool): spawn remoto de workers via Cursor API (fase B)

- agent-pool-cursor: client fino da Cloud Agents API v1 (fetch injetavel; CursorApiError com status/body)
- agent-pool-models: resolvePoolModel contra /v1/models (id/alias, sufixo -fast -> param, fallback composer-2.5 com warn)
- agent-pool-prompt: contrato do worker (claim pre-feito, pula passo 1; PR base stage + Closes #N; promote proibido)
- claim coordenado no tick: lock otimista + flip + marcador; agentId idempotente bc-<uuid>; 409 recupera; rollback em falha de spawn
- agent:pool workflow --action start|stop|pause|resume|tick|status (variables POOL_*); doctor; wrappers gh workflow run
- .github/workflows/agent-pool.yml (dispatch-only; schedule/triggers na fase C)
- 19 specs novos (1011/1011); lint/tsc/knip/cycles/format verdes

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>

* feat(agent-pool): ciclo de vida do supervisor (fase C)

- derivePoolClaims com status real dos runs (getCursorRun), heal de spawn via agentId deterministico, cancel de duplicatas
- reconcilePoolClaims: falha terminal -> comentario + blocked + archive; merge concluido -> slot livre + archive
- auto-stop real: fila drenada + zero ativos -> POOL_ENABLED=false (exclusoes migration-busy nao desligam)
- job summary markdown (GITHUB_STEP_SUMMARY) — superficie remota de status
- workflow: schedule */10min + pull_request closed em stage (ativam na default branch apos promote)
- 2 specs novos (1013/1013); lint/tsc/knip/cycles/format verdes

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>

* docs(agent-pool): runbook operacional e adendo do spike (fase D)

- skill agent-pool: runbook humano (pre-requisitos, start/stop/pause remoto, ciclo de vida, triage, smoke de aceite)
- AGENT-OPS: linha na tabela de comandos + secao Agent pool (canal, secrets, ativacao pos-promote)
- CHANGELOG-AGENTS: entrada curta da entrega
- engineering-audit: pause/resume do pool no protocolo do modo solitario
- plano secao 14.1: evidencias do spike 2026-07-30 (environment repo-file confirmado, id bc-<uuid>, degradacao 403, pendencias do primeiro run com CURSOR_API_KEY)

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>

* fix(test): teardown flake no homeSearchUi.unit.spec (dono do CI)

O scheduler do react (prefetch do next/link) podia disparar apos o teardown
do jsdom e derrubar o job unit com 'window is not defined' (run 30587862940).
afterEach(cleanup) — padrao dos 14 specs irmaos.

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-07-30 20:08:34 -03:00
Francisco Ignácio Fontoura Solla
a27778619b merge stage into docs/work-issue-simplify-rename-chat 2026-07-30 19:53:14 -03:00
Francisco Ignácio Fontoura Solla
4774087f45 docs(work-issue): reinforce /simplify reviewers and session rename
Mandate three parallel Task reviewers in Passo 5 and add rename_chat
with canonical title format #<N> <id> — <título> right after claim.
2026-07-30 19:48:13 -03:00
Francisco Ignácio Fontoura Solla
644047d92d chore(ops): gate:ci no pre-push espelha ci-pr com blast radius
Agentes rodam o mesmo escopo affected que o CI de feature antes do push;
documenta PR Ready/auto-merge e pula build Vercel em branches agent/*.
2026-07-30 18:48:10 -03:00
Francisco Ignácio Fontoura Solla
8e93f02556 Revert "chore(ops): gate:ci no pre-push espelha ci-pr com blast radius"
This reverts commit 784d4cd2e3.
2026-07-30 18:47:45 -03:00
Francisco Ignácio Fontoura Solla
784d4cd2e3 chore(ops): gate:ci no pre-push espelha ci-pr com blast radius
Agentes rodam o mesmo escopo affected que o CI de feature antes do push;
documenta PR Ready/auto-merge e pula build Vercel em branches agent/*.
2026-07-30 18:45:24 -03:00
Francisco Solla
b0d158cc87 fix(cloud): bootstrap Postgres nativo no Cursor Cloud (#59)
* fix(cloud): bootstrap Postgres nativo no Cursor Cloud

VMs Cloud não têm Docker (sem daemon/systemd; overlayfs falha em
docker compose). Substitui compose por ensure-postgres.sh (PG 16 via
apt, pg_ctlcluster) e corrige placeholders do .env (BLOB token no
formato vercel_blob_rw_* exigido pelo adapter).

Testado: cloud-setup.sh completa migrate + seed em teqo e teqo_test.

* fix(ci): define GH_REPO no job migration-lock

gh pr list falha sem checkout quando não há repositório git no runner
(fatal: not a git repository). GH_REPO aponta explicitamente para o repo.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-07-30 18:36:33 -03:00
Francisco Solla
0636235fb6 docs(work-issue): require pnpm i before claim and open plan in editor (#58) 2026-07-30 18:33:21 -03:00
Francisco Ignácio Fontoura Solla
2e0cc2c03e chore(ci): parallel PR jobs, affected tests, push gate, owner-of-red-CI policy
- ci-pr.yml: split the serial checks job into parallel lint/format/
  typecheck/knip/cycles + unit/int (vitest --changed vs PR base via
  scripts/test-affected.mjs, full fallback on high-risk paths) + e2e
  (manifest path->spec via scripts/e2e-affected.mjs, blocking) + build;
  migration-lock gains checkout + pull-requests:read (fixes the failures
  that blocked PR #50)
- ci.yml (main): full safety net — seed:minimal + int full + build + e2e
- package.json: gate:fast / gate:push; .husky/pre-push runs gate:push
- docs: "Dono do PR, dono do CI" policy in AGENT-OPS + work-issue +
  engineering-standards; changelog entry; plans for OPS3-OPS7
2026-07-30 17:37:20 -03:00
Francisco Ignácio Fontoura Solla
9eafe6081c feat(campanha): add Demandas group to home global search (B53)
Staff can find demands by title from the Início omnibox with municipality and status in the secondary line, scoped by campaignDemand access.
2026-07-30 12:39:35 -03:00
Francisco Ignácio Fontoura Solla
4d097cd5c6 chore: delete legacy skills 2026-07-30 12:22:06 -03:00
Francisco Ignácio Fontoura Solla
0ac6863ed8 feat: project-status + agent:status 2026-07-30 12:22:05 -03:00
Francisco Ignácio Fontoura Solla
111308f00e feat: work-issue skill 2026-07-30 12:22:05 -03:00
Francisco Ignácio Fontoura Solla
1c1a379897 feat: plan-issue skill 2026-07-30 12:22:05 -03:00
Francisco Ignácio Fontoura Solla
4262aa5a67 docs: agent ops + slice AGENTS.md + kernels + cursorignore + portable hooks + cloud env + PR template 2026-07-30 05:21:35 -03:00
Francisco Ignácio Fontoura Solla
09fa21d4b3 B63: wizard registrar sinal (grid de tipos + passo de texto).
Two-step UX-1 flow on the B59 chassis with URL contract ?signalType= and optional ?entryAction= for embedded skip; reuses createMunicipalityListSignalFormAction.
2026-07-30 04:01:48 -03:00
Francisco Ignácio Fontoura Solla
dbd9d0fa3e feat(campanha): ship B70 leadership update wizard (grid + short form).
Replaces the post-municipality stub with a full wizard: tile grid, contact+leadership writes, entryAction skip, and Continuar after save.
2026-07-30 03:51:25 -03:00
Francisco Ignácio Fontoura Solla
f2bdb1ce3c B77: replace vote wizard ?cenario= ritual with single-screen editor.
Three scenarios on one step with confirm-only validation, legacy URL redirect, and updated tests/docs.
2026-07-30 03:31:57 -03:00
Francisco Ignácio Fontoura Solla
037785b280 B75: wizard mobile header chrome on Mandate Red bar.
Publish flow navigation from CampaignWizardShell via layout-level chrome so wizards no longer stack a second sticky header under the app bar.
2026-07-30 03:26:54 -03:00
Francisco Ignácio Fontoura Solla
29e6d43567 docs(skills): add ASCII wireframe guidance to implement-roadmap-item
So UI plans can show quick text layout for confirmation before craft.
2026-07-30 03:22:31 -03:00