@biffo/cli 0.256.7 → 0.256.9

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/claim.sh +20 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.256.7",
3
+ "version": "0.256.9",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/scripts/claim.sh CHANGED
@@ -267,7 +267,7 @@ if [ -n "$GUARD_BRANCH" ]; then
267
267
  pr_err=$(mktemp)
268
268
  slug=$(repo_slug)
269
269
  open_prs=$(gh_pr list --state open --limit 100 --json number,headRefName,closingIssuesReferences \
270
- --jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $guard_issue and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9])$guard_issue([^0-9]|\$)\")))] | .[] | select(.headRefName != \"$GUARD_BRANCH\") | \"#\(.number) \(.headRefName)\"" \
270
+ --jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $guard_issue and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9A-Za-z])$guard_issue([^0-9A-Za-z]|\$)\")))] | .[] | select(.headRefName != \"$GUARD_BRANCH\") | \"#\(.number) \(.headRefName)\"" \
271
271
  2>"$pr_err")
272
272
  pr_status=$?
273
273
  pr_err_text=$(cat "$pr_err")
@@ -294,7 +294,7 @@ open_prs=$(gh_pr list --state open --limit 100 --json number,headRefName,closing
294
294
  else
295
295
  other_branch=$(printf '%s\n' "$raw_branches" |
296
296
  sed 's|.*refs/heads/||' |
297
- grep -E "(^|[^0-9])$guard_issue([^0-9]|$)" |
297
+ grep -E "(^|[^0-9A-Za-z])$guard_issue([^0-9A-Za-z]|$)" |
298
298
  grep -v -x "$GUARD_BRANCH" | head -1)
299
299
  if [ -n "$other_branch" ]; then
300
300
  conflict=1
@@ -379,7 +379,7 @@ esac
379
379
 
380
380
  slug=$(repo_slug)
381
381
  open_prs=$(gh_pr list --state open --limit 100 --json number,headRefName,closingIssuesReferences \
382
- --jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $ISSUE and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9])$ISSUE([^0-9]|\$)\")))] | .[] | \"#\(.number) \(.headRefName)\"" 2>/dev/null)
382
+ --jq "[.[] | select(([.closingIssuesReferences[]? | select(.number == $ISSUE and ((.repository.owner.login + \"/\" + .repository.name) == \"$slug\"))] | length > 0) or (.headRefName | test(\"(^|[^0-9A-Za-z])$ISSUE([^0-9A-Za-z]|\$)\")))] | .[] | \"#\(.number) \(.headRefName)\"" 2>/dev/null)
383
383
 
384
384
  if [ -n "$open_prs" ]; then
385
385
  printf '%s\n' "$open_prs" | while IFS= read -r pr; do
@@ -390,11 +390,26 @@ fi
390
390
 
391
391
  # --- 3. A remote branch naming it --------------------------------------------
392
392
  #
393
- # Catches work that has been pushed but has no PR yet. Whole-number match again.
393
+ # Catches work that has been pushed but has no PR yet. Whole-number match
394
+ # again — and "whole number" means bounded by a NON-ALPHANUMERIC character on
395
+ # both sides, not just a non-digit. `[^0-9]` alone let a letter sit directly
396
+ # against the digit: `docs/h3-tabsii-strict-restored` (a real branch, from the
397
+ # H3 strict-branch-protection experiment) matched issue #3, because "h" is not
398
+ # a digit either. Reproduced against a clean `origin/dev` clone with zero
399
+ # relation to the branch under test — this is a live false-positive, not a
400
+ # fixture artefact — and confirmed via `cli/src/lib/claim-structured-refs.test.ts`
401
+ # ("a CROSS-REPO closing reference with the same number does not claim it"),
402
+ # whose own git-remote-backed fixture happened to expose it. `[^0-9A-Za-z]`
403
+ # requires an actual word boundary, matching the branch-naming convention
404
+ # (`<type>/<number>-<slug>`, where the character before the number is always
405
+ # `/`, never a letter) — so `h3` no longer matches `3`, while `feat/1234-x`
406
+ # still matches `1234`. Same fix applied to the three other whole-number
407
+ # matches in this file (the `--guard` path's PR and branch checks above, and
408
+ # the normal path's PR check below) — all four shared the identical pattern.
394
409
 
395
410
  branches=$(remote_branches 2>/dev/null |
396
411
  sed 's|.*refs/heads/||' |
397
- grep -E "(^|[^0-9])$ISSUE([^0-9]|$)" 2>/dev/null)
412
+ grep -E "(^|[^0-9A-Za-z])$ISSUE([^0-9A-Za-z]|$)" 2>/dev/null)
398
413
 
399
414
  if [ -n "$branches" ]; then
400
415
  printf '%s\n' "$branches" | while IFS= read -r b; do