teqo-backup/scripts/git-push.mjs
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

36 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
/**
* Canonical push: bootstrap deps/hooks, run gate:push, then push.
*
* Does NOT rely on the Husky pre-push hook — `gate:push` runs here on purpose
* so worktrees/agents without wired hooks still get the ci-pr mirror (incl.
* format:check). Uses `--no-verify` only because the gate already ran; this is
* not an escape hatch (`git push --no-verify` without `pnpm push` still is).
*
* Humans who prefer `git push` after `pnpm i` still hit `.husky/pre-push`.
*/
import { spawnSync } from 'node:child_process'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { ensureRepoDeps } from './ensure-repo-deps.mjs'
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
const runOrDie = (label, command, args) => {
console.log(`[pnpm push] ▶ ${label}`)
const result = spawnSync(command, args, { cwd: repoRoot, stdio: 'inherit' })
if ((result.status ?? 1) !== 0) {
process.exit(result.status ?? 1)
}
}
ensureRepoDeps()
runOrDie('gate:push', 'pnpm', ['gate:push'])
const args = process.argv.slice(2)
const result = spawnSync('git', ['push', '--no-verify', ...args], {
cwd: repoRoot,
stdio: 'inherit',
})
process.exit(result.status ?? 1)