Skip to content

Commit c883952

Browse files
mango766easonysliuclaude
authored
fix: match 'Last updated' timestamp with or without bold markers (#1836)
The template outputs plain text `Last updated: [DATE]` but both update-agent-context scripts only matched `**Last updated**: [DATE]` (bold Markdown). Make the bold markers optional in the regex so the timestamp is refreshed regardless of formatting. Co-authored-by: easonysliu <easonysliu@tencent.com> Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com>
1 parent b9c1a1c commit c883952

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/bash/update-agent-context.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ update_existing_agent_file() {
482482
fi
483483

484484
# Update timestamp
485-
if [[ "$line" =~ \*\*Last\ updated\*\*:.*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then
485+
if [[ "$line" =~ (\*\*)?Last\ updated(\*\*)?:.*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then
486486
echo "$line" | sed "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/$current_date/" >> "$temp_file"
487487
else
488488
echo "$line" >> "$temp_file"

scripts/powershell/update-agent-context.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ function Update-ExistingAgentFile {
331331
if ($existingChanges -lt 2) { $output.Add($line); $existingChanges++ }
332332
continue
333333
}
334-
if ($line -match '\*\*Last updated\*\*: .*\d{4}-\d{2}-\d{2}') {
334+
if ($line -match '(\*\*)?Last updated(\*\*)?: .*\d{4}-\d{2}-\d{2}') {
335335
$output.Add(($line -replace '\d{4}-\d{2}-\d{2}',$Date.ToString('yyyy-MM-dd')))
336336
continue
337337
}

0 commit comments

Comments
 (0)