Skip to content

Commit a8996ec

Browse files
committed
fix: quick wins
- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc) - Add memory/ and docs/ directory creation in evolve.sh - Add brief sleep between evolution phases
1 parent 116d082 commit a8996ec

5 files changed

Lines changed: 39 additions & 25 deletions

File tree

scripts/build/build_site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import html
55
import os
66
import re
7-
from datetime import datetime, timedelta
7+
from datetime import datetime, timedelta, timezone
88
from pathlib import Path
99

1010
ROOT = Path(__file__).resolve().parent.parent.parent
@@ -491,7 +491,7 @@ def generate_rss(days, entries):
491491
<pubDate>{date_str}</pubDate>
492492
</item>"""
493493

494-
last_build = datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
494+
last_build = datetime.now(timezone.utc).strftime("%a, %d %b %Y %H:%M:%S GMT")
495495
rss = f"""<?xml version="1.0" encoding="UTF-8"?>
496496
<rss version="2.0">
497497
<channel>

scripts/build/format_discussions.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import subprocess
55
import json
66
import sys
7-
from datetime import datetime
7+
from datetime import datetime, timezone
8+
89

910
def fetch_discussions():
1011
"""Fetch discussions using gh CLI GraphQL."""
@@ -38,53 +39,62 @@ def fetch_discussions():
3839
}
3940
}
4041
"""
41-
42+
4243
try:
4344
result = subprocess.run(
44-
['gh', 'api', 'graphql', '-f', f'query={query}'],
45+
["gh", "api", "graphql", "-f", f"query={query}"],
4546
capture_output=True,
4647
text=True,
47-
timeout=30
48+
timeout=30,
4849
)
49-
50+
5051
if result.returncode == 0 and result.stdout:
5152
data = json.loads(result.stdout)
52-
return data.get('data', {}).get('repository', {}).get('discussions', {}).get('edges', [])
53+
return (
54+
data.get("data", {})
55+
.get("repository", {})
56+
.get("discussions", {})
57+
.get("edges", [])
58+
)
5359
return []
5460
except Exception as e:
5561
print(f"Error fetching discussions: {e}", file=sys.stderr)
5662
return []
5763

64+
5865
def main():
5966
"""Generate DISCUSSIONS_TODAY.md from GitHub discussions."""
6067
discussions = fetch_discussions()
61-
68+
6269
if not discussions:
6370
print("# Discussions Today\n\nNo recent discussions found.", file=sys.stdout)
6471
return
65-
72+
6673
output = ["# Discussions Today\n\n"]
67-
output.append(f"*Fetched at: {datetime.utcnow().isoformat()}*\n\n")
68-
74+
output.append(f"*Fetched at: {datetime.now(timezone.utc).isoformat()}*\n\n")
75+
6976
for edge in discussions:
70-
node = edge.get('node', {})
77+
node = edge.get("node", {})
7178
output.append(f"## {node.get('title', 'Untitled')}\n\n")
7279
output.append(f"**Author**: {node.get('author', {}).get('login', 'unknown')}\n")
7380
output.append(f"**URL**: {node.get('url', '#')}\n\n")
7481
output.append(f"**Body**: {node.get('body', '')}\n\n")
75-
82+
7683
# Add comments
77-
comments = node.get('comments', {}).get('edges', [])
84+
comments = node.get("comments", {}).get("edges", [])
7885
if comments:
7986
output.append("**Comments**:\n\n")
8087
for comment_edge in comments:
81-
comment = comment_edge.get('node', {})
82-
output.append(f"- **{comment.get('author', {}).get('login', 'unknown')}**: ")
88+
comment = comment_edge.get("node", {})
89+
output.append(
90+
f"- **{comment.get('author', {}).get('login', 'unknown')}**: "
91+
)
8392
output.append(f"{comment.get('body', '')}\n\n")
84-
93+
8594
output.append("---\n\n")
86-
87-
print(''.join(output), file=sys.stdout)
8895

89-
if __name__ == '__main__':
96+
print("".join(output), file=sys.stdout)
97+
98+
99+
if __name__ == "__main__":
90100
main()

scripts/build/generate_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import json
1010
import subprocess
1111
import sys
12-
from datetime import datetime, timedelta
12+
from datetime import datetime, timedelta, timezone
1313

1414

1515
def run(cmd, cwd="."):
@@ -94,7 +94,7 @@ def get_recent_journal(repo_path="."):
9494
def generate_stats(repo_path="."):
9595
"""Generate stats.json for the site."""
9696
stats = {
97-
"generated_at": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
97+
"generated_at": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
9898
"total_commits": get_commit_count(repo_path),
9999
"commits_this_week": get_commits_this_week(repo_path),
100100
"lines_changed": get_lines_changed_this_week(repo_path),

scripts/build/track_coverage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import json
88
import subprocess
99
import sys
10-
from datetime import datetime
10+
from datetime import datetime, timezone
1111

1212

1313
def get_coverage(repo_path="."):
@@ -91,7 +91,7 @@ def main():
9191
test_count = count_tests(repo_path)
9292

9393
entry = {
94-
"date": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
94+
"date": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
9595
"coverage_pct": round(coverage, 1),
9696
"test_count": test_count,
9797
}

scripts/evolution/evolve.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ release_lock() {
3838
trap release_lock EXIT
3939

4040
mkdir -p "${REPOPATH}/.iterate"
41+
mkdir -p "${REPOPATH}/memory"
42+
mkdir -p "${REPOPATH}/docs"
4143
acquire_lock
4244

4345
log "=== iterate evolution cycle started ==="
@@ -131,10 +133,12 @@ fi
131133

132134
# ── Phase B: Implementation ──
133135
log "Phase B: Implementation..."
136+
sleep 5 # Brief pause between phases
134137
./iterate --phase implement --gh-owner GrayCodeAI --gh-repo iterate 2>>"$LOG_FILE" || true
135138

136139
# ── Phase C: Communication ──
137140
log "Phase C: Communication..."
141+
sleep 5 # Brief pause between phases
138142
./iterate --phase communicate --gh-owner GrayCodeAI --gh-repo iterate 2>>"$LOG_FILE" || true
139143

140144
# ── Verify journal was written ──

0 commit comments

Comments
 (0)