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 extract interpreter paths from shebang lines, specifically focusing on using the package's regex capture group to obtain the interpreter path without the #! prefix.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Package import",
"description": "The shebang-regex package is correctly imported using require() or import statement",
"max_score": 10
},
{
"name": "exec() method usage",
"description": "The shebangRegex.exec() method is called with the script string to match and extract shebang information",
"max_score": 25
},
{
"name": "Capture group extraction",
"description": "The capturing group [1] is accessed from the exec() result to extract the interpreter path without the #! prefix (e.g., shebangRegex.exec(script)[1])",
"max_score": 30
},
{
"name": "Null/undefined handling",
"description": "Proper null safety is implemented to handle cases where exec() returns null (no shebang found), such as using optional chaining (?.) or explicit null checks",
"max_score": 20
},
{
"name": "Correct return values",
"description": "The function returns the correct structure with hasShebang boolean and interpreterPath (string or null) matching the specification requirements",
"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