fix(#4481): anchor bold STATE field reads to line start (#4510)

* test(#4481): reproduce mid-sentence state field reads

* fix(#4481): anchor bold STATE field reads to line start

* docs(#4481): add changeset for #4510

* fix(#4481): align bold field readers with anchored writers
This commit is contained in:
Michel Moreira
2026-09-10 21:29:10 -03:00
committed by GitHub
parent 43c48ce92e
commit eadcba5f53
4 changed files with 62 additions and 4 deletions

View File

@@ -588,7 +588,7 @@ function cmdStateGet(cwd: string, section: string | undefined, raw: boolean): vo
const fieldEscaped = escapeRegex(section);
// Check for **field:** value (bold format)
const boldPattern = new RegExp(`\\*\\*${fieldEscaped}:\\*\\*\\s*(.*)`, 'i');
const boldPattern = new RegExp(`^[ \\t]*\\*\\*${fieldEscaped}:\\*\\*[ \\t]*(.*)`, 'im');
const boldMatch = content.match(boldPattern);
if (boldMatch) {
output({ [section]: boldMatch[1].trim() }, raw, boldMatch[1].trim());