Regular expression for matching Unix shebang lines at the beginning of files
88
{
"context": "This criteria evaluates how effectively the engineer uses the shebang-regex package to extract complete shebang lines from script content. The focus is on proper usage of the package's regex pattern and its exec() method to capture the full shebang line including the #! prefix.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Imports shebang-regex",
"description": "Uses require() or import to load the shebang-regex package as a dependency",
"max_score": 15
},
{
"name": "Uses exec() method",
"description": "Calls shebangRegex.exec() method on the input content to perform the pattern matching",
"max_score": 25
},
{
"name": "Extracts full line",
"description": "Accesses the [0] element of the exec() result to retrieve the complete shebang line including #! prefix",
"max_score": 30
},
{
"name": "Handles null results",
"description": "Properly handles the case when exec() returns null (no shebang present) by returning null/undefined or using optional chaining/null checks",
"max_score": 20
},
{
"name": "Returns correct value",
"description": "Returns the extracted shebang string when present, or null/undefined when absent, matching the API specification",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-shebang-regexdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9