@biffo/cli 0.275.4 → 0.275.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/verify.sh +74 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.275.4",
3
+ "version": "0.275.5",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/scripts/verify.sh CHANGED
@@ -555,6 +555,77 @@ skip() {
555
555
  printf ' \033[90m-- %-16s n/a - %s\033[0m\n' "$1" "$2"
556
556
  }
557
557
 
558
+ # A JS-flavoured `run_check`, for `pnpm run <script>` calls only
559
+ # (biffo-template#1497).
560
+ #
561
+ # ## The defect
562
+ #
563
+ # A fresh worktree (AGENTS.md SS1) has no node_modules until `pnpm install`
564
+ # runs there. `pnpm run format:check` in that state does not fail on the
565
+ # CONTENT of the files -- it fails because prettier itself was never
566
+ # installed: pnpm's recursive runner exits non-zero with
567
+ # `ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL` / `Command "prettier" not found` /
568
+ # a plain shell `sh: 1: prettier: not found`. Plain `run_check` cannot tell
569
+ # that apart from a real formatting problem -- both are "the command exited
570
+ # non-zero" -- so it landed in FAILED, and the summary then printed
571
+ # `pnpm run format` as the fix: a command that fails IDENTICALLY, because
572
+ # there is still no formatter to run. The files were correctly formatted the
573
+ # whole time.
574
+ #
575
+ # ## Why this is a THIRD state, and why it is INCONCLUSIVE not NOT_RUN
576
+ #
577
+ # #1471 already separated "ran and found a problem" (FAILED) from "could not
578
+ # produce a verdict" (INCONCLUSIVE), for a lane that got killed mid-run. A
579
+ # missing toolchain is the same shape wearing different clothes: the check
580
+ # was applicable and was attempted, but could not execute. It is NOT the
581
+ # NOT_RUN case used elsewhere in this file (terraform/uv/gitleaks absent from
582
+ # the MACHINE) -- NOT_RUN is a considered, low-cost gating decision that
583
+ # still lets the rest of the run stand as a pass with an amber note, because
584
+ # the repo itself is fine and only the auditing machine is short a tool. Here
585
+ # the WORKTREE itself is not ready to be checked, which is the pg-test
586
+ # timeout's shape, not terraform's -- so it exits 2 ("cannot tell", never a
587
+ # pass), the same convention pg-test's own inconclusive case already uses,
588
+ # rather than 0-with-a-warning.
589
+ #
590
+ # ## Why detection is post-hoc pattern matching, not a pre-flight `[ -d
591
+ # node_modules ]` check
592
+ #
593
+ # A pre-flight check was tried first and reverted: several of this repo's own
594
+ # fixtures (this file's own test suite) declare a script like `"lint": "true"`
595
+ # that needs no installed binary at all, and a directory can legitimately
596
+ # have no `node_modules` and still run its scripts successfully (nothing in
597
+ # `have_script` requires one). Refusing to even ATTEMPT the check in that
598
+ # case would be the fail-open shape this whole file exists to eliminate,
599
+ # reported the opposite way round: a check that could have passed, marked
600
+ # inconclusive instead. So the check DOES run, and only a genuine
601
+ # "the binary named in the script is not there" signature in its own output
602
+ # is reclassified -- a real lint/type/format finding still reads as FAILED.
603
+ run_check_js() {
604
+ name="$1"
605
+ shift
606
+ if [ -n "$LIST" ]; then
607
+ echo "$*"
608
+ return 0
609
+ fi
610
+ start=$(date +%s)
611
+ if "$@" >"/tmp/biffo-verify.$$" 2>&1; then
612
+ PASSED="$PASSED $name"
613
+ LAST_CHECK_SECONDS=$(($(date +%s) - start))
614
+ printf ' \033[32mOK\033[0m %-16s %ss\n' "$name" "$LAST_CHECK_SECONDS"
615
+ elif grep -qE 'ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL|Command "[^"]*" not found|: not found$|command not found' \
616
+ "/tmp/biffo-verify.$$"; then
617
+ INCONCLUSIVE="$INCONCLUSIVE $name"
618
+ printf ' \033[33mINCONCLUSIVE\033[0m %-16s %ss - dependencies not installed\n' \
619
+ "$name" "$(($(date +%s) - start))"
620
+ printf " \033[33mrun 'pnpm install' in this worktree first (AGENTS.md SS1) -- 'pnpm run format' cannot fix a missing toolchain\033[0m\n"
621
+ else
622
+ FAILED="$FAILED $name"
623
+ printf ' \033[31mFAIL\033[0m %-16s %ss\n' "$name" "$(($(date +%s) - start))"
624
+ sed 's/^/ /' "/tmp/biffo-verify.$$" | tail -25
625
+ fi
626
+ rm -f "/tmp/biffo-verify.$$"
627
+ }
628
+
558
629
  if [ -z "$LIST" ]; then
559
630
  # State which template this gate came from. A gate two versions old is the
560
631
  # condition that let tabsii-crm print `verify passed` on a 700-line change
@@ -1309,13 +1380,14 @@ if [ -n "$JS_DIRS" ]; then
1309
1380
  # end up fixing the wrong one.
1310
1381
  suffix=""
1311
1382
  [ "$d" != "." ] && suffix="(${d#./})"
1383
+
1312
1384
  for s in lint typecheck format:check test; do
1313
1385
  label="$(printf '%s' "$s" | tr -d ':')$suffix"
1314
1386
  if have_script "$s" "$d"; then
1315
1387
  if [ "$d" = "." ]; then
1316
- run_check "$label" pnpm run "$s"
1388
+ run_check_js "$label" pnpm run "$s"
1317
1389
  else
1318
- run_check "$label" pnpm --dir "$d" run "$s"
1390
+ run_check_js "$label" pnpm --dir "$d" run "$s"
1319
1391
  fi
1320
1392
  else
1321
1393
  skip "$label" "no \"$s\" script"