pumuki-ast-hooks 5.5.50 → 5.5.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,6 @@ AUTO_MERGE_PR=${GITFLOW_AUTO_MERGE:-false}
25
25
  PR_BASE_BRANCH=${GITFLOW_PR_BASE:-develop}
26
26
  STRICT_ATOMIC=${GITFLOW_STRICT_ATOMIC:-true}
27
27
  REQUIRE_TEST_RELATIONS=${GITFLOW_REQUIRE_TESTS:-true}
28
- STRICT_CHECK=${GITFLOW_STRICT_CHECK:-false}
29
28
 
30
29
  print_section() {
31
30
  printf "${BLUE}═══════════════════════════════════════════════════════════════${NC}\n"
@@ -168,17 +167,16 @@ verify_atomic_commit() {
168
167
  return 0
169
168
  fi
170
169
 
171
- local files=()
170
+ local -a files=()
172
171
  while IFS= read -r file; do
173
- [[ -z "$file" ]] && continue
174
- files+=("$file")
172
+ [[ -n "$file" ]] && files+=("$file")
175
173
  done < <($GIT_BIN diff --name-only "${commit}^..${commit}")
176
174
  if [[ "${#files[@]}" -eq 0 ]]; then
177
175
  return 0
178
176
  fi
179
177
 
180
- local roots_list
181
- roots_list=()
178
+ local roots_list=""
179
+ local root_count=0
182
180
  for file in "${files[@]}"; do
183
181
  local root="${file%%/*}"
184
182
  if [[ "$root" == "$file" ]]; then
@@ -193,36 +191,24 @@ verify_atomic_commit() {
193
191
  ;;
194
192
  esac
195
193
 
196
- local seen=0
197
- local existing
198
- if (( ${#roots_list[@]:-0} > 0 )); then
199
- for existing in "${roots_list[@]}"; do
200
- if [[ "$existing" == "$root" ]]; then
201
- seen=1
202
- break
203
- fi
204
- done
205
- fi
206
- if [[ "$seen" -eq 0 ]]; then
207
- roots_list+=("$root")
194
+ if [[ " $roots_list " != *" $root "* ]]; then
195
+ roots_list="${roots_list}${root} "
196
+ root_count=$((root_count + 1))
208
197
  fi
209
198
  done
210
199
 
211
- local root_count=${#roots_list[@]}
212
200
  if (( root_count > 1 )); then
213
201
  local has_scripts=0
214
202
  local has_tests=0
215
- for root in "${roots_list[@]}"; do
203
+ for root in $roots_list; do
216
204
  [[ "$root" == "scripts" ]] && has_scripts=1
217
205
  [[ "$root" == "tests" ]] && has_tests=1
218
206
  done
219
-
220
207
  if [[ $has_scripts -eq 1 && $has_tests -eq 1 && $root_count -eq 2 ]]; then
221
208
  printf "${GREEN}✅ Commit %s toca scripts + tests (permitido para bugfixes/features con tests).${NC}\n" "$commit"
222
209
  return 0
223
210
  fi
224
-
225
- printf "${RED}❌ Commit %s toca múltiples raíces (%s). Divide los cambios en commits atómicos.${NC}\n" "$commit" "$(printf "%s " "${roots_list[@]}")"
211
+ printf "${RED}❌ Commit %s toca múltiples raíces (%s). Divide los cambios en commits atómicos.${NC}\n" "$commit" "$roots_list"
226
212
  return 1
227
213
  fi
228
214
  if (( root_count == 0 )); then
@@ -230,7 +216,7 @@ verify_atomic_commit() {
230
216
  return 0
231
217
  fi
232
218
  local root_name
233
- for root_name in "${roots_list[@]}"; do
219
+ for root_name in $roots_list; do
234
220
  printf "${GREEN}✅ Commit %s cumple atomicidad (raíz %s).${NC}\n" "$commit" "$root_name"
235
221
  done
236
222
  return 0
@@ -250,10 +236,9 @@ verify_pending_commits_atomic() {
250
236
  return $?
251
237
  fi
252
238
 
253
- local commits=()
239
+ local -a commits=()
254
240
  while IFS= read -r commit; do
255
- [[ -z "$commit" ]] && continue
256
- commits+=("$commit")
241
+ [[ -n "$commit" ]] && commits+=("$commit")
257
242
  done < <($GIT_BIN rev-list "${base_ref}..${branch}")
258
243
  local failed=0
259
244
  for commit in "${commits[@]}"; do
@@ -384,50 +369,22 @@ cmd_check() {
384
369
  local branch
385
370
  branch=$(current_branch)
386
371
  printf "${CYAN}📍 Rama actual: %s${NC}\n" "$branch"
387
- local failed=0
388
-
389
- if [[ "${STRICT_CHECK}" == "true" ]]; then
390
- ensure_evidence_fresh || failed=1
391
- lint_hooks_system || failed=1
392
- run_mobile_checks || failed=1
393
- else
394
- ensure_evidence_fresh || true
395
- lint_hooks_system || true
396
- run_mobile_checks || true
397
- fi
372
+ ensure_evidence_fresh || true
373
+ lint_hooks_system || true
374
+ run_mobile_checks || true
398
375
  print_sync_table
399
376
  print_cleanup_candidates
400
- if [[ "${STRICT_CHECK}" == "true" ]]; then
401
- verify_atomic_commit "HEAD" || failed=1
402
- if [[ "$REQUIRE_TEST_RELATIONS" == "true" ]]; then
403
- verify_related_files_commit "HEAD" || failed=1
404
- fi
405
- if ! verify_pending_commits_atomic "$branch"; then
406
- failed=1
407
- fi
408
- if [[ "$REQUIRE_TEST_RELATIONS" == "true" ]]; then
409
- if ! verify_pending_commits_related "$branch"; then
410
- failed=1
411
- fi
412
- fi
413
- else
414
- verify_atomic_commit "HEAD" || true
415
- if [[ "$REQUIRE_TEST_RELATIONS" == "true" ]]; then
416
- verify_related_files_commit "HEAD" || true
417
- fi
377
+ verify_atomic_commit "HEAD" || true
378
+ if [[ "$REQUIRE_TEST_RELATIONS" == "true" ]]; then
379
+ verify_related_files_commit "HEAD" || true
418
380
  fi
419
381
  local pending
420
382
  pending=$(unpushed_commits "$branch")
421
383
  if [[ "$pending" != "0" ]]; then
422
384
  printf "${YELLOW}⚠️ Commits sin subir (${pending}). Ejecuta git push.${NC}\n"
423
- if [[ "${STRICT_CHECK}" == "true" ]]; then
424
- failed=1
425
- fi
426
385
  else
427
386
  printf "${GREEN}✅ No hay commits pendientes de push.${NC}\n"
428
387
  fi
429
-
430
- return $failed
431
388
  }
432
389
 
433
390
  cmd_cycle() {
@@ -580,7 +537,6 @@ main() {
580
537
  ;;
581
538
  esac
582
539
  }
583
-
584
540
  is_test_file() {
585
541
  local file="$1"
586
542
  case "$file" in
@@ -681,14 +637,12 @@ verify_pending_commits_related() {
681
637
  local base_ref="origin/${branch}"
682
638
 
683
639
  if ! $GIT_BIN show-ref --verify --quiet "refs/remotes/origin/${branch}"; then
684
- verify_related_files_commit "HEAD"
685
- return $?
640
+ return verify_related_files_commit "HEAD"
686
641
  fi
687
642
 
688
- local commits=()
643
+ local -a commits=()
689
644
  while IFS= read -r commit; do
690
- [[ -z "$commit" ]] && continue
691
- commits+=("$commit")
645
+ [[ -n "$commit" ]] && commits+=("$commit")
692
646
  done < <($GIT_BIN rev-list "${base_ref}..${branch}")
693
647
  local failed=0
694
648
  local commit