Skip to content

Comments

Fix overly permissive --pr regex pattern in compact command#14

Merged
khaliqgant merged 2 commits intomainfrom
fix/pr-regex-pattern
Feb 20, 2026
Merged

Fix overly permissive --pr regex pattern in compact command#14
khaliqgant merged 2 commits intomainfrom
fix/pr-regex-pattern

Conversation

@khaliqgant
Copy link
Collaborator

@khaliqgant khaliqgant commented Feb 20, 2026

Summary

  • Fixes overly permissive regex pattern in the --pr flag of the compact command
  • Adds husky + lint-staged for automatic lint fixing on commit

Changes

1. PR Regex Fix

The previous regex PR.*${escaped}\b matched words containing "pr" (e.g., "Improve", "Express") due to case-insensitive matching.

Before: #${escaped}\b|PR.*${escaped}\b
After: #${escaped}\b|\bPR\s*#?\s*${escaped}\b

2. Pre-commit Lint Fixing

  • Added husky for git hooks
  • Added lint-staged to run biome on staged files
  • Pre-commit hook runs biome check --write on staged .js/.ts/.json/.md files
  • Fixed existing lint issues (package.json files array formatting)

Test plan

🤖 Generated with Claude Code

The previous regex `PR.*${escaped}\b` was matching words containing "pr"
(e.g., "Improve", "Express") because the case-insensitive flag made "PR"
match any "pr" substring. Combined with `.*` allowing any characters,
this caused false-positive trajectory matching.

For example, `--pr 5` would match "Improve error handling for module 15"
because "Improve" contains "pr" and "15" contains "5".

Fix: Use `\bPR\s*#?\s*${escaped}\b` which requires "PR" at a word boundary
and properly handles variations like "PR #5", "PR#5", "PR 5".

Fixes Devin review comment on PR #13.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

- Added husky for git hooks
- Added lint-staged to run biome on staged files
- Pre-commit hook runs biome check --write on staged .js/.ts/.json/.md files
- Fixed existing lint issues (package.json files array formatting)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 174cbc5 into main Feb 20, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/pr-regex-pattern branch February 20, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant