-
Notifications
You must be signed in to change notification settings - Fork 2
update the last updated pill and automate the process #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import re | ||
| import datetime | ||
| from pathlib import Path | ||
|
|
||
| def update_date(): | ||
| index_path = Path("index.html") | ||
| if not index_path.exists(): | ||
| return | ||
|
|
||
| content = index_path.read_text(encoding="utf-8") | ||
| original_content = content | ||
|
|
||
| now = datetime.datetime.now() | ||
| iso_date = now.strftime("%Y-%m-%d") | ||
| human_date = now.strftime("%B %d, %Y").replace(" 0", " ") # Format like 'July 26, 2026' | ||
|
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Repository files matching update_index_date.py:\n'
fd -a 'update_index_date.py' . || true
printf '\nRelevant file contents:\n'
if [ -f scripts/update_index_date.py ]; then
cat -n scripts/update_index_date.py
fi
printf '\nSearch for update script date usages/requirements:\n'
rg -n "update_index_date|last\\s+updated|generated|datetime\\.now|timezone|tzinfo" -S . || trueRepository: Asifdotexe/Theseus Length of output: 50375 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Candidate files:\n'
fd -e py -e html 'update_index_date|index\.html' . || true
printf '\nDirect file contents:\n'
if [ -f scripts/update_index_date.py ]; then
cat -n scripts/update_index_date.py
fi
printf '\nDirect focused searches:\n'
rg -n --max-count 200 "update_index_date|last\\s+updated|updated on|datetime\\.now\\(|datetime\\.(utcfromtimestamp|utcnow)|timezone|tzinfo|strftime\\(\"%Y-%m-%d%b|%B %d" . || trueRepository: Asifdotexe/Theseus Length of output: 2745 Use UTC when updating the index date.
🤖 Prompt for AI Agents |
||
|
|
||
| # Update dateModified in JSON-LD | ||
| content = re.sub(r'"dateModified": "\d{4}-\d{2}-\d{2}"', f'"dateModified": "{iso_date}"', content) | ||
|
|
||
| # Update time tag | ||
| content = re.sub( | ||
| r'<time datetime="\d{4}-\d{2}-\d{2}">[^<]+</time>', | ||
| f'<time datetime="{iso_date}">{human_date}</time>', | ||
| content | ||
| ) | ||
|
|
||
| if content != original_content: | ||
| index_path.write_text(content, encoding="utf-8") | ||
| print(f"Updated index.html date to {iso_date}") | ||
|
|
||
| if __name__ == "__main__": | ||
| update_date() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Fail loudly when the update did not occur.
A missing
index.htmlor a formatting change that prevents either regex from matching currently exits successfully, allowing stale SEO metadata and visible timestamps to be committed. Resolve the repository path relative to the script/repository and validatere.subn()replacement counts before returning.Also applies to: 18-25
🤖 Prompt for AI Agents