Regular expression for matching Unix shebang lines at the beginning of files
88
{
"context": "This criteria evaluates how well the engineer uses the shebang-regex package to safely handle both matching and non-matching strings, focusing on proper null safety patterns when accessing regex execution results.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses shebang-regex package",
"description": "Solution imports and uses the shebang-regex package rather than implementing a custom regex",
"max_score": 15
},
{
"name": "Uses exec() method",
"description": "Solution uses the shebangRegex.exec() method to extract shebang information from strings",
"max_score": 20
},
{
"name": "Accesses capture group",
"description": "Solution correctly accesses the capture group at index [1] from exec() results to extract the interpreter path without the #! prefix",
"max_score": 20
},
{
"name": "Null safety pattern",
"description": "Solution implements proper null safety when accessing exec() results, using optional chaining (?.), nullish coalescing (??), or explicit null checks to handle non-matching strings",
"max_score": 30
},
{
"name": "Uses test() method",
"description": "Solution uses the shebangRegex.test() method to determine if a shebang exists (hasShebang field)",
"max_score": 15
}
]
}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