fix(fn-run): propagar stdout/stderr de bash functions library-style
Scripts bash del registry siguen dos patrones: - Con guarda BASH_SOURCE[0]==$0: se auto-invocan al ejecutar directamente - Library-style (sin guarda): definen una función <basename>() pero no la llaman al nivel top-level → bash <script> args produce silencio total El dispatcher en buildBashCommand detecta ahora tres casos: 1. Tiene guarda BASH_SOURCE[0]==$0 → ejecutar directamente (sin cambio) 2. Library-style con función <basename>() → source + llamada explícita: bash -c 'source "$1"; shift; fn_name "$@"' -- <script> [args...] 3. Pipeline top-level (sin función ni guarda) → ejecutar directamente También corrige scan_secrets_in_dirty.sh y git_hook_audit_app_drift.sh para aceptar worktrees git (donde .git es un archivo, no un directorio). Añade bashFunctionName() helper y 4 tests unitarios/integración. Fix reportado en issue 0077 con gradle_unit_test como caso canario. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
scan_secrets_in_dirty() {
|
||||
local repo_dir="${1:-.}"
|
||||
|
||||
if [[ ! -d "$repo_dir/.git" ]]; then
|
||||
# Accept both regular repos (.git is a directory) and worktrees (.git is a
|
||||
# file containing "gitdir: ..." pointer).
|
||||
if [[ ! -d "$repo_dir/.git" && ! -f "$repo_dir/.git" ]]; then
|
||||
echo "scan_secrets_in_dirty: '$repo_dir' no es un repo git" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -17,7 +17,9 @@ git_hook_audit_app_drift() {
|
||||
echo "ERROR: repo_dir required" >&2
|
||||
return 2
|
||||
fi
|
||||
if [[ ! -d "$repo_dir/.git" ]]; then
|
||||
# Accept both regular repos (.git is a directory) and worktrees (.git is a
|
||||
# file containing "gitdir: ..." pointer).
|
||||
if [[ ! -d "$repo_dir/.git" && ! -f "$repo_dir/.git" ]]; then
|
||||
echo "ERROR: $repo_dir is not a git repo" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user