* Extract the leading verb from a strategy step for bolding. * Only extracts a single verb to avoid splitting compound phrases. * e.g. "Verify Cursor CLI installation" -> "Verify" * "Run `npm test` to check" -> "Run" * "Configure non-interactive mode" -> "Configure" * * Excludes anti
(step)
| 216 | * anti-pattern list items in the dedicated "## Avoid" section instead. |
| 217 | */ |
| 218 | function extractStepVerb(step) { |
| 219 | var ANTI_PATTERN_MARKERS = /^(AVOID|DO|DON'?T|NEVER|NOT|STOP|SKIP|IGNORE|FORBIDDEN|WARN|WARNING|CAUTION|NOTE)\b/i; |
| 220 | if (ANTI_PATTERN_MARKERS.test(step)) return ''; |
| 221 | // Only match a capitalized verb at the very start (no leading backtick/special chars) |
| 222 | var match = step.match(/^([A-Z][a-z]+)/); |
| 223 | if (!match) return ''; |
| 224 | // Extra safety: do not treat single-capital-letter + no-lowercase abbreviations |
| 225 | // (already filtered by the [a-z]+ requirement) or common non-verbs like |
| 226 | // "The", "This", "These", "Those" as verbs. |
| 227 | var DETERMINERS = new Set(['The', 'This', 'These', 'Those', 'That', 'A', 'An']); |
| 228 | if (DETERMINERS.has(match[1])) return ''; |
| 229 | return match[1]; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Remove the leading verb from a step (already shown in bold). |
no outgoing calls
no test coverage detected