teqo-backup/scripts/agent-file-miss.mjs
Francisco Solla f20305759a OPS50: port CI e scripts de agentes do GitHub para o Forgejo
Workflows nativos em .forgejo/workflows/ (ci, ci-pr, agent-pool,
automerge, issue-transition, plan-issue, vercel-promote, archive),
removendo .github/workflows e .github/actions. Runner Forgejo v13 com
services Postgres por porta + DB_HOST via gateway do bridge. Libs de
agente sobre o novo cliente forgejo-api.mjs (zero dependências,
GITHUB_SERVER_URL/FORGEJO_API_URL), helpers de workflow plain-Node.
pnpm issue corrigido (await em função sync) e validado ao vivo. Testes:
forgejoApi.unit.spec.ts novo, pin do matrix do ci.yml atualizado.

Closes #1 (parte 1 — docs/issues/pool seguem na parte 2)
2026-08-16 23:32:20 -03:00

39 lines
1.4 KiB
JavaScript

/**
* `pnpm agent:file-miss` — file an agent-miss issue (guardrail pipeline).
*
* Misses feed the progressive-guardrail harvest: each miss becomes an issue
* with `kind:agent-miss`; periodically a human/agent harvests them into a
* programmatic guardrail (codebaseConventions spec, ESLint rule, CI check).
*
* pnpm agent:file-miss -- --title "migration merged sem atualizar seed:minimal" \
* [--body "contexto..."] [--kind agent-miss|defect]
*/
import { dieAgent, parseArgs } from './lib/agent-forgejo.mjs'
import { forgejoApi as api } from './lib/forgejo-api.mjs'
const die = dieAgent('file-miss')
const { flags } = parseArgs(process.argv.slice(2), new Set(['title', 'body', 'kind']))
if (!flags.title) {
die(
'Usage: pnpm agent:file-miss -- --title <what went wrong> [--body details] [--kind agent-miss|defect]',
)
}
const kind = flags.kind === 'defect' ? 'defect' : 'agent-miss'
const body = [
flags.body ?? '',
'',
'_Registrado por `pnpm agent:file-miss`. Harvest: avaliar guardrail programático (teste de convenção, ESLint, check de CI) e registrar em `docs/GUARDRAILS.md`._',
].join('\n')
const created = await api.createIssue({
title: flags.title,
body,
})
const url = `https://git.solla.dev/fsolla/teqo/issues/${created.number}`
await api.setLabels(created.number, { add: [`kind:${kind}`, 'prio:P2'] })
console.log(`[agent:file-miss] filed ${url}`)