-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsync-claude-md.sh
More file actions
executable file
·61 lines (51 loc) · 1.92 KB
/
sync-claude-md.sh
File metadata and controls
executable file
·61 lines (51 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Sync CLAUDE.md with current project metrics
# Used by semantic-release during the release process
set -e
VERSION=${1:-$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')}
TODAY=$(date +%Y-%m-%d)
echo "Syncing CLAUDE.md to version $VERSION (date: $TODAY)"
# Update all version numbers (simpler regex that works across different sed versions)
sed -i.bak "s/v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/v$VERSION/g" CLAUDE.md
sed -i.bak "s/\*\*AgentReady Version\*\*: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/\*\*AgentReady Version\*\*: $VERSION/" CLAUDE.md
# Update "Last Updated" date at top (first occurrence only)
awk -v today="$TODAY" '
!updated && /\*\*Last Updated\*\*:/ {
sub(/[0-9]{4}-[0-9]{2}-[0-9]{2}/, today);
updated=1
}
{print}
' CLAUDE.md > CLAUDE.md.tmp && mv CLAUDE.md.tmp CLAUDE.md
# Update "Last Updated" date at bottom (second occurrence)
awk -v today="$TODAY" '
/\*\*Last Updated\*\*:.*by Jeremy Eder/ {
sub(/[0-9]{4}-[0-9]{2}-[0-9]{2}/, today);
}
{print}
' CLAUDE.md > CLAUDE.md.tmp && mv CLAUDE.md.tmp CLAUDE.md
# Try to extract self-assessment score (if examples exist)
if [ -f "examples/self-assessment/assessment-latest.json" ]; then
SCORE=$(python3 -c "
import json
try:
with open('examples/self-assessment/assessment-latest.json') as f:
data = json.load(f)
print(f\"{data['overall_score']}\")
except Exception as e:
print('unknown', file=sys.stderr)
exit(1)
" 2>/dev/null || echo "")
if [ -n "$SCORE" ] && [ "$SCORE" != "unknown" ]; then
echo "Updating self-assessment score to $SCORE"
# Update self-assessment scores (match any number with optional decimal)
sed -i.bak "s/[0-9][0-9]*\.[0-9][0-9]*\/100/$SCORE\/100/g" CLAUDE.md
fi
fi
# Clean up backup files
rm -f CLAUDE.md.bak
echo "✓ CLAUDE.md synced successfully"
echo " - Version: $VERSION"
echo " - Date: $TODAY"
if [ -n "$SCORE" ]; then
echo " - Self-Assessment: $SCORE/100"
fi