| 239 | // can recommend (and gently gate) the sequence: assessment -> P0 -> P1 -> P2 -> |
| 240 | // P3 -> validation. Unknown sections return null (never gated). |
| 241 | function phaseRankFromName(name) { |
| 242 | if (!name) return null; |
| 243 | const n = String(name).toLowerCase(); |
| 244 | if (/assessment/.test(n)) return 0; |
| 245 | const m = n.match(/\bp([0-3])\b/); |
| 246 | if (m) return 1 + Number(m[1]); |
| 247 | if (/validation|gates|sign-?off/.test(n)) return 5; |
| 248 | return null; |
| 249 | } |
| 250 | |
| 251 | // Summarize phase ordering from the checklist: which phase is the earliest one |
| 252 | // with unfinished work (the "active" phase the user should be in), plus a |