--- name: tbd_branch_finish kind: function lang: bash domain: infra version: "1.0.0" purity: impure signature: "tbd_branch_finish([merge_title: string]) -> void" description: "Integra una rama TBD (issue/* o quick/*) a master/main con merge --no-ff, publica el merge al remote y elimina la rama local. Autodetecta la rama base (master/main), verifica working tree limpio y construye el titulo del merge commit. NO ejecuta tests — esa responsabilidad es del caller. Exit 2 si hay conflicto de merge (deja al usuario resolver)." tags: [git, tbd, merge, trunk-based-development, workflow, pendiente-usar] uses_functions: [] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [] params: - name: merge_title desc: "Titulo opcional del merge commit. Si se provee, el commit sera 'merge: '. Si no, sera 'merge: '." output: "Mergea la rama a base, hace push y elimina la rama local. Imprime confirmacion a stdout. Exit 1 en error (dirty tree, push fallido, no en rama TBD). Exit 2 si hay conflicto de merge (merge iniciado pero no resuelto — el usuario debe resolver manualmente)." tested: true tests: - "finish lands on base branch" - "issue branch deleted locally" - "finish exits 0" - "merge commit pushed to remote" - "quick branch finish lands on master" - "merge title included in commit" - "dirty tree exits 1" - "on master exits 1" - "non-TBD branch exits 1" - "works with main as base" test_file_path: "bash/functions/infra/tbd_branch_finish.sh" file_path: "bash/functions/infra/tbd_branch_finish.sh" --- ## Ejemplo ```bash # Desde una rama issue/0042-add-auth, sin titulo adicional tbd_branch_finish # Con titulo descriptivo en el merge commit tbd_branch_finish "implementar autenticacion OAuth" # Ejecutar suite de tests bash bash/functions/infra/tbd_branch_finish.sh --test ``` ## Notas La funcion NO ejecuta tests del proyecto — esa responsabilidad es del caller (slash command, agente, CI) porque depende del stack (go test, pytest, ctest, etc.). Si el push falla, la rama local NO se elimina para no perder trabajo. Si hay conflicto de merge, sale con exit 2 dejando el repo en estado de merge-en-progreso para que el usuario resuelva con `git add` + `git commit`. Los tests internos usan un remote bare simulado con `git init --bare` para validar el push completo.