fix: state mutations recurse when Current Position has dollar amounts (#3463)

* fix(state): prevent  backreference expansion in state mutations

* chore(changeset): set pr field for #3463

* test(state): use structured STATE parser in bug-3454 regression
This commit is contained in:
Tom Boucher
2026-05-13 13:54:30 -04:00
committed by GitHub
parent d0f916728b
commit c5d4cf35e6
5 changed files with 171 additions and 7 deletions

View File

@@ -77,7 +77,7 @@ function updateCurrentPositionFields(content: string, fields: Record<string, str
posBody = posBody.replace(/^Plan:.*$/m, `Plan: ${fields.plan}`);
}
return content.replace(posPattern, `${posMatch[1]}${posBody}`);
return content.replace(posPattern, () => `${posMatch[1]}${posBody}`);
}
/** Port of `readTextArgOrFile` from `state.cjs` — inline text or file path under project root. */
@@ -508,7 +508,7 @@ export const stateBeginPhase: QueryHandler = async (args, projectDir, workstream
posBody = posBody.replace(/^Last activity:.*$/im, newActivity);
}
content = content.replace(positionPattern, `${header}${posBody}`);
content = content.replace(positionPattern, () => `${header}${posBody}`);
updated.push('Current Position');
}