fix(#2150): line-anchor + word-boundary the UI hint regex (review L1/L2)
Review found the hint value (yes|no) matched prefixes ('nope'/'not' read as
'no') and the hint regex was unanchored, so a mid-line prose mention like 'see
**UI hint**: no above' was treated as the authoritative metadata line. Line-
anchor (^ + m flag) so only a real hint line counts; word-boundary on the value
so nope/not do not mean no. Adds coverage for hint:yes over a pure-backend body
and the nope fall-through.
This commit is contained in:
@@ -81,8 +81,10 @@ export function checkUiPresence(text: string): UiPresenceResult {
|
||||
// authoritative declaration of whether the phase has a UI surface — progress.md
|
||||
// and new-project.md already parse this line (`UI hint.*yes`). The bare token
|
||||
// `UI` in the line itself must not count as a UI indicator, and the declaration
|
||||
// overrides token-sniffing.
|
||||
const hintMatch = normalised.match(/\*\*UI hint\*\*\s*:\s*(yes|no)/i);
|
||||
// overrides token-sniffing. Line-anchored (`m`) so a mid-line prose mention is
|
||||
// not treated as the metadata line; word-boundary on the value so `nope`/`not`
|
||||
// do not match `no`.
|
||||
const hintMatch = normalised.match(/^\s*\*\*UI hint\*\*\s*:\s*(yes|no)\b/im);
|
||||
const hint = hintMatch ? hintMatch[1].toLowerCase() : null;
|
||||
|
||||
// Strip ANY `**UI hint**:` line before token-sniffing so a hint without a
|
||||
|
||||
Reference in New Issue
Block a user